3 /// Mode derived class for syncing
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 __BARRYDESKTOP_MODE_SYNC_H__
23 #define __BARRYDESKTOP_MODE_SYNC_H__
26 #include "deviceset.h"
29 class SyncMode
: public wxEvtHandler
, public Mode
32 DECLARE_EVENT_TABLE() // sets to protected:
37 std::auto_ptr
<DeviceSet
> m_device_set
;
41 std::auto_ptr
<wxBoxSizer
> m_topsizer
;
42 std::auto_ptr
<wxButton
> m_sync_now_button
;
43 std::auto_ptr
<wxButton
> m_configure_button
;
44 std::auto_ptr
<wxButton
> m_run_app_button
;
45 std::auto_ptr
<wxButton
> m_1way_reset_button
;
46 std::auto_ptr
<wxListCtrl
> m_device_list
;
47 std::auto_ptr
<wxStaticText
> m_label
[4];
50 static std::string
Timestamp(time_t last_sync
);
52 int GetMaxTimestampWidth(wxWindow
*win
);
53 void FillDeviceList();
55 DeviceSet::subset_type
GetSelectedDevices();
56 void ReselectDevices(const DeviceSet::subset_type
&set
);
57 void ConfigureDevice(int device_index
);
58 void ConfigureDevice(DeviceEntry
&entry
);
59 void CheckConfigured(DeviceSet::subset_type
&subset
);
61 int GetSelectedDevice(); // returns index, or -1 if none or
62 // more than one selected... also
63 // handles the message box
64 int GetAuthoritativeSide(int device_index
);
65 bool ZapConflicts(int device_index
, int authoritative_side
);
66 void RewriteConfig(int device_index
);
67 bool WarnAbout1WayReset();
70 SyncMode(wxWindow
*parent
);
73 // virtual override events (derived from Mode)
74 wxString
GetTitleText() const { return _T("Barry Sync"); }
77 void OnSyncNow(wxCommandEvent
&event
);
78 void OnConfigure(wxCommandEvent
&event
);
79 void OnRunApp(wxCommandEvent
&event
);
80 void On1WayReset(wxCommandEvent
&event
);
81 void OnListSelChange(wxListEvent
&event
);//to keep track of button state
82 void OnConfigureDevice(wxListEvent
&event
);