diff options
Diffstat (limited to 'FreeFileSync/Source/RealtimeSync/main_dlg.cpp')
-rw-r--r-- | FreeFileSync/Source/RealtimeSync/main_dlg.cpp | 31 |
1 files changed, 25 insertions, 6 deletions
diff --git a/FreeFileSync/Source/RealtimeSync/main_dlg.cpp b/FreeFileSync/Source/RealtimeSync/main_dlg.cpp index 4ad5c5be..c49db1cf 100644 --- a/FreeFileSync/Source/RealtimeSync/main_dlg.cpp +++ b/FreeFileSync/Source/RealtimeSync/main_dlg.cpp @@ -34,6 +34,21 @@ using namespace zen; +namespace +{ +#ifdef ZEN_WIN_VISTA_AND_LATER +bool acceptDialogFileDrop(const std::vector<Zstring>& shellItemPaths) +{ + return std::any_of(shellItemPaths.begin(), shellItemPaths.end(), [](const Zstring& shellItemPath) + { + return pathEndsWith(shellItemPath, Zstr(".ffs_real")) || + pathEndsWith(shellItemPath, Zstr(".ffs_batch")); + }); +} +#endif +} + + class DirectoryPanel : public FolderGenerated { public: @@ -126,8 +141,12 @@ MainDialog::MainDialog(wxDialog* dlg, const Zstring& cfgFileName) } //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); +#ifdef ZEN_WIN_VISTA_AND_LATER + setupShellItemDrop(*this, acceptDialogFileDrop); +#else + setupFileDrop(*this); +#endif + Connect(EVENT_DROP_FILE, FileDropEventHandler(MainDialog::onFilesDropped), nullptr, this); } @@ -184,7 +203,7 @@ void MainDialog::OnMenuAbout(wxCommandEvent& event) showNotificationDialog(this, DialogInfoType::INFO, PopupDialogCfg(). setTitle(_("About")). - setMainInstructions(L"RealtimeSync" L"\n\n" + replaceCpy(_("Build: %x"), L"%x", build))); + setMainInstructions(L"RealTimeSync" L"\n\n" + replaceCpy(_("Build: %x"), L"%x", build))); } @@ -243,7 +262,7 @@ void MainDialog::OnConfigSave(wxCommandEvent& event) //OS X really needs dir/file separated like this: utfCvrtTo<wxString>(beforeLast(defaultFileName, FILE_NAME_SEPARATOR, IF_MISSING_RETURN_NONE)), //default dir utfCvrtTo<wxString>(afterLast (defaultFileName, FILE_NAME_SEPARATOR, IF_MISSING_RETURN_ALL)), //default file - wxString(L"RealtimeSync (*.ffs_real)|*.ffs_real") + L"|" +_("All files") + L" (*.*)|*", + wxString(L"RealTimeSync (*.ffs_real)|*.ffs_real") + L"|" +_("All files") + L" (*.*)|*", wxFD_SAVE | wxFD_OVERWRITE_PROMPT); if (filePicker.ShowModal() != wxID_OK) return; @@ -292,7 +311,7 @@ void MainDialog::setLastUsedConfig(const Zstring& filepath) //set title if (filepath == lastConfigFileName()) { - SetTitle(L"RealtimeSync - " + _("Automated Synchronization")); + SetTitle(L"RealTimeSync - " + _("Automated Synchronization")); currentConfigFileName.clear(); } else @@ -309,7 +328,7 @@ void MainDialog::OnConfigLoad(wxCommandEvent& event) wxString(), utfCvrtTo<wxString>(beforeLast(currentConfigFileName, FILE_NAME_SEPARATOR, IF_MISSING_RETURN_NONE)), //default dir wxString(), - wxString(L"RealtimeSync (*.ffs_real; *.ffs_batch)|*.ffs_real;*.ffs_batch") + L"|" +_("All files") + L" (*.*)|*", + wxString(L"RealTimeSync (*.ffs_real; *.ffs_batch)|*.ffs_real;*.ffs_batch") + L"|" +_("All files") + L" (*.*)|*", wxFD_OPEN); if (filePicker.ShowModal() == wxID_OK) loadConfig(utfCvrtTo<Zstring>(filePicker.GetPath())); |