summaryrefslogtreecommitdiff
path: root/RealtimeSync/main_dlg.cpp
diff options
context:
space:
mode:
authorDaniel Wilhelm <daniel@wili.li>2014-04-18 17:22:18 +0200
committerDaniel Wilhelm <daniel@wili.li>2014-04-18 17:22:18 +0200
commitbcc5cc28c6dc5178e8f4fd0cc521034ae5def388 (patch)
treebacc60d27b435d32172f97643576c5e4e953177d /RealtimeSync/main_dlg.cpp
parent5.9 (diff)
downloadFreeFileSync-bcc5cc28c6dc5178e8f4fd0cc521034ae5def388.tar.gz
FreeFileSync-bcc5cc28c6dc5178e8f4fd0cc521034ae5def388.tar.bz2
FreeFileSync-bcc5cc28c6dc5178e8f4fd0cc521034ae5def388.zip
5.10
Diffstat (limited to 'RealtimeSync/main_dlg.cpp')
-rw-r--r--RealtimeSync/main_dlg.cpp31
1 files changed, 29 insertions, 2 deletions
diff --git a/RealtimeSync/main_dlg.cpp b/RealtimeSync/main_dlg.cpp
index bb9ac75b..ca6fa4fa 100644
--- a/RealtimeSync/main_dlg.cpp
+++ b/RealtimeSync/main_dlg.cpp
@@ -28,6 +28,21 @@
using namespace zen;
+class DirectoryPanel : public FolderGenerated
+{
+public:
+ DirectoryPanel(wxWindow* parent) :
+ FolderGenerated(parent),
+ dirName(*this, *m_buttonSelectDir, *m_txtCtrlDirectory) {}
+
+ void setName(const wxString& dirname) { dirName.setName(dirname); }
+ wxString getName() const { return dirName.getName(); }
+
+private:
+ zen::DirectoryName<wxTextCtrl> dirName;
+};
+
+
MainDialog::MainDialog(wxDialog* dlg, const wxString& cfgFileName)
: MainDlgGenerated(dlg)
{
@@ -59,7 +74,7 @@ MainDialog::MainDialog(wxDialog* dlg, const wxString& cfgFileName)
if (!cfgFileName.empty() || wxFileExists(lastConfigFileName()))
try
{
- rts::readRealOrBatchConfig(toZ(currentConfigFile), newConfig);
+ rts::readRealOrBatchConfig(toZ(currentConfigFile), newConfig); //throw FfsXmlError
loadCfgSuccess = true;
}
catch (const xmlAccess::FfsXmlError& error)
@@ -92,6 +107,10 @@ MainDialog::MainDialog(wxDialog* dlg, const wxString& cfgFileName)
}
else
m_buttonStart->SetFocus(); //don't "steal" focus if program is running from sys-tray"
+
+ //drag and drop .ffs_real and .ffs_batch on main dialog
+ setupFileDrop(*m_panelMain);
+ m_panelMain->Connect(EVENT_DROP_FILE, FileDropEventHandler(MainDialog::onFilesDropped), nullptr, this);
}
@@ -102,7 +121,7 @@ MainDialog::~MainDialog()
try //write config to XML
{
- writeRealConfig(currentCfg, toZ(lastConfigFileName()));
+ writeRealConfig(currentCfg, toZ(lastConfigFileName())); //throw FfsXmlError
}
catch (const xmlAccess::FfsXmlError& error)
{
@@ -255,6 +274,14 @@ void MainDialog::OnConfigLoad(wxCommandEvent& event)
}
+void MainDialog::onFilesDropped(FileDropEvent& event)
+{
+ const auto& files = event.getFiles();
+ if (!files.empty())
+ loadConfig(files[0]);
+}
+
+
void MainDialog::setConfiguration(const xmlAccess::XmlRealConfig& cfg)
{
//clear existing folders
bgstack15