Bumped copyright dates for 2013
[barry.git] / desktop / src / CUI_KDEPim.cc
blob4178c8a68ab7f0fbf8721c976cb22cb697eec1e8
1 ///
2 /// \file CUI_KDEPim.cc
3 /// ConfigUI derived class to configure the KDEPim App
4 ///
6 /*
7 Copyright (C) 2009-2013, 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>
26 #include "wxi18n.h"
28 namespace AppConfig {
30 //////////////////////////////////////////////////////////////////////////////
31 // KDEPim config UI class
33 KDEPim::KDEPim()
34 : m_kdepim(0)
35 , m_parent(0)
39 std::string KDEPim::AppName() const
41 return OpenSync::Config::KDEPim::AppName();
44 bool KDEPim::Configure(wxWindow *parent, plugin_ptr old_plugin)
46 m_parent = parent;
48 // create our plugin config
49 m_kdepim = dynamic_cast<OpenSync::Config::KDEPim*> (old_plugin.get());
50 if( m_kdepim ) {
51 m_kdepim = m_kdepim->Clone();
53 else {
54 m_kdepim = new OpenSync::Config::KDEPim;
56 m_container.reset( m_kdepim );
58 // tell the user all went well
59 wxMessageBox(_W("KDEPim needs no configuration."), _W("KDEPim Config"), wxOK | wxICON_INFORMATION, m_parent);
60 return true;
63 ConfigUI::plugin_ptr KDEPim::GetPlugin()
65 m_kdepim = 0;
66 return m_container;
69 bool KDEPim::RunApp(wxWindow *parent)
71 return Run(parent, AppName(), _T("kontact"));
74 void KDEPim::PreSyncAppInit()
78 bool KDEPim::ZapData(wxWindow *parent,
79 plugin_ptr plugin,
80 OpenSync::API *engine)
82 m_parent = parent;
84 if( IsAppRunning() ) {
85 wxMessageBox(_W("Kontact already running."),
86 _W("Oops..."), wxOK | wxICON_INFORMATION,
87 m_parent);
88 return false;
91 // tell the user what to do
92 wxString msg;
93 if( dynamic_cast<OpenSync::OpenSync22*>(engine) ) {
94 msg = _W(
95 "Starting Kontact. Delete all contacts and calendar "
96 "entries manually.");
98 else {
99 msg = _W(
100 "Starting Kontact. Delete all contacts and calendar "
101 "entries manually (as well as memos and tasks if you are "
102 "syncing them too)."
105 int choice = wxMessageBox(msg, _W("Starting Kontact"),
106 wxOK | wxCANCEL | wxICON_QUESTION, m_parent);
107 if( choice != wxOK )
108 return false;
110 RunApp(parent);
112 // Kontact forks, so we just have to trust that the user did it :-(
113 return true;
116 } // namespace AppConfig