desktop: added timezone list to CalendarEditDlg
[barry.git] / desktop / src / CUI_KDEPim.cc
blob44577cc7d382d880e1ed55e536dc6dba5605f3de
1 ///
2 /// \file CUI_KDEPim.cc
3 /// ConfigUI derived class to configure the KDEPim App
4 ///
6 /*
7 Copyright (C) 2009-2012, Net Direct Inc. (http://www.netdirect.ca/)
9 This program is free software; you can redistribute it and/or modify
10 it under the terms of the GNU General Public License as published by
11 the Free Software Foundation; either version 2 of the License, or
12 (at your option) any later version.
14 This program is distributed in the hope that it will be useful,
15 but WITHOUT ANY WARRANTY; without even the implied warranty of
16 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
18 See the GNU General Public License in the COPYING file at the
19 root directory of this project for more details.
22 #include "CUI_KDEPim.h"
23 #include "os22.h" // only for the dynamic_cast
24 #include <wx/wx.h>
25 #include <wx/process.h>
27 namespace AppConfig {
29 //////////////////////////////////////////////////////////////////////////////
30 // KDEPim config UI class
32 KDEPim::KDEPim()
33 : m_kdepim(0)
34 , m_parent(0)
38 std::string KDEPim::AppName() const
40 return OpenSync::Config::KDEPim::AppName();
43 bool KDEPim::Configure(wxWindow *parent, plugin_ptr old_plugin)
45 m_parent = parent;
47 // create our plugin config
48 m_kdepim = dynamic_cast<OpenSync::Config::KDEPim*> (old_plugin.get());
49 if( m_kdepim ) {
50 m_kdepim = m_kdepim->Clone();
52 else {
53 m_kdepim = new OpenSync::Config::KDEPim;
55 m_container.reset( m_kdepim );
57 // tell the user all went well
58 wxMessageBox(_T("KDEPim needs no configuration."), _T("KDEPim Config"), wxOK | wxICON_INFORMATION, m_parent);
59 return true;
62 ConfigUI::plugin_ptr KDEPim::GetPlugin()
64 m_kdepim = 0;
65 return m_container;
68 bool KDEPim::RunApp(wxWindow *parent)
70 return Run(parent, AppName(), _T("kontact"));
73 void KDEPim::PreSyncAppInit()
77 bool KDEPim::ZapData(wxWindow *parent,
78 plugin_ptr plugin,
79 OpenSync::API *engine)
81 m_parent = parent;
83 if( IsAppRunning() ) {
84 wxMessageBox(_T("Kontact already running."),
85 _T("No Biscuit"), wxOK | wxICON_INFORMATION,
86 m_parent);
87 return false;
90 // tell the user what to do
91 wxString msg;
92 if( dynamic_cast<OpenSync::OpenSync22*>(engine) ) {
93 msg = _T(
94 "Starting Kontact. Delete all contacts and calendar "
95 "entries manually.");
97 else {
98 msg = _T(
99 "Starting Kontact. Delete all contacts and calendar "
100 "entries manually (as well as memos and tasks if you are "
101 "syncing them too)."
104 int choice = wxMessageBox(msg, _T("Starting Kontact"),
105 wxOK | wxCANCEL | wxICON_QUESTION, m_parent);
106 if( choice != wxOK )
107 return false;
109 RunApp(parent);
111 // Kontact forks, so we just have to trust that the user did it :-(
112 return true;
115 } // namespace AppConfig