3 /// Base class for plugin config user interfaces
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 #ifndef __BARRY_CONFIGUI_H__
23 #define __BARRY_CONFIGUI_H__
26 #include <wx/process.h>
31 #include "exechelper.h"
36 /// Base class for plugin config user interfaces
38 /// To use, call the static factory function to create the config UI
39 /// object for a given App. Then call Configure(), which will block
40 /// and may do a number of configuration steps to let the user
41 /// configure the App. If Configure() returns true, then call
42 /// GetPlugin() to retrieve the fully configured plugin.
44 class ConfigUI
: public ExecHelper
47 typedef OpenSync::Config::Group::plugin_ptr plugin_ptr
;
48 typedef std::auto_ptr
<ConfigUI
> configui_ptr
;
49 typedef configui_ptr ptr
;
55 /// Returns OpenSync::Config::*::AppName() for the specific app
56 virtual std::string
AppName() const = 0;
57 /// Handles all the GUI work of configuring the App
58 /// old_plugin may contain null if this is a first-time config
59 virtual bool Configure(wxWindow
*parent
, plugin_ptr old_plugin
) = 0;
60 /// Returns a configured plugin object (after a successful Configure())
61 virtual plugin_ptr
GetPlugin() = 0;
62 /// Runs the Application, if not already running.. parent may
63 /// be NULL if you don't want this class to pop up error messages
64 /// if unable to run the app
65 virtual bool RunApp(wxWindow
*parent
) = 0;
66 /// Performs any initialization steps that the App requires before
67 /// running the sync (for example, Evolution needs a --force-shutdown)
68 virtual void PreSyncAppInit() = 0;
69 /// Presents the user with the warning / instructions for zapping
70 /// the data on this plugin. Returns false if user aborted along
72 virtual bool ZapData(wxWindow
*parent
, plugin_ptr plugin
,
73 OpenSync::API
*engine
) = 0;
75 static configui_ptr
CreateConfigUI(const std::string
&appname
);