diff options
author | Daniel Wilhelm <daniel@wili.li> | 2014-04-18 17:24:35 +0200 |
---|---|---|
committer | Daniel Wilhelm <daniel@wili.li> | 2014-04-18 17:24:35 +0200 |
commit | 460091fb0b2ff114cc741372f15bb43b702ea3b1 (patch) | |
tree | 0562c2eda4c66969c6e6d0910080db9f5b0def3e /ui/small_dlgs.cpp | |
parent | 5.15 (diff) | |
download | FreeFileSync-460091fb0b2ff114cc741372f15bb43b702ea3b1.tar.gz FreeFileSync-460091fb0b2ff114cc741372f15bb43b702ea3b1.tar.bz2 FreeFileSync-460091fb0b2ff114cc741372f15bb43b702ea3b1.zip |
5.16
Diffstat (limited to 'ui/small_dlgs.cpp')
-rw-r--r-- | ui/small_dlgs.cpp | 17 |
1 files changed, 14 insertions, 3 deletions
diff --git a/ui/small_dlgs.cpp b/ui/small_dlgs.cpp index 3827c837..32bb3e85 100644 --- a/ui/small_dlgs.cpp +++ b/ui/small_dlgs.cpp @@ -8,6 +8,7 @@ #include <wx/wupdlock.h> #include <zen/format_unit.h> #include <zen/build_info.h> +#include <zen/tick_count.h> #include <zen/stl_tools.h> #include <wx+/choice_enum.h> #include <wx+/button.h> @@ -306,8 +307,8 @@ ReturnSmallDlg::ButtonPressed zen::showFilterDialog(wxWindow* parent, bool isGlo filter); return static_cast<ReturnSmallDlg::ButtonPressed>(filterDlg.ShowModal()); } -//######################################################################################## +//######################################################################################## class DeleteDialog : public DeleteDlgGenerated { @@ -331,6 +332,8 @@ private: const std::vector<zen::FileSystemObject*>& rowsToDeleteOnRight; bool& outRefdeleteOnBothSides; bool& outRefuseRecycleBin; + const TickVal tickCountStartup; + const std::int64_t ticksPerSec_; }; @@ -343,7 +346,9 @@ DeleteDialog::DeleteDialog(wxWindow* parent, rowsToDeleteOnLeft(rowsOnLeft), rowsToDeleteOnRight(rowsOnRight), outRefdeleteOnBothSides(deleteOnBothSides), - outRefuseRecycleBin(useRecycleBin) + outRefuseRecycleBin(useRecycleBin), + tickCountStartup(getTicks()), + ticksPerSec_(ticksPerSec()) { #ifdef FFS_WIN new zen::MouseMoveWindow(*this); //allow moving main dialog by clicking (nearly) anywhere...; ownership passed to "this" @@ -403,6 +408,12 @@ void DeleteDialog::updateGui() void DeleteDialog::OnOK(wxCommandEvent& event) { + //additional safety net, similar to Windows Explorer: time delta between DEL and ENTER must be at least 50ms to avoid accidental deletion! + const TickVal now = getTicks(); //0 on error + if (now.isValid() && tickCountStartup.isValid() && ticksPerSec_ != 0) + if (dist(tickCountStartup, now) * 1000 / ticksPerSec_ < 50) + return; + outRefuseRecycleBin = m_checkBoxUseRecycler->GetValue(); if (rowsToDeleteOnLeft != rowsToDeleteOnRight) outRefdeleteOnBothSides = m_checkBoxDeleteBothSides->GetValue(); @@ -746,7 +757,7 @@ void GlobalSettingsDlg::OnOkay(wxCommandEvent& event) void GlobalSettingsDlg::OnResetDialogs(wxCommandEvent& event) { if (showQuestionDlg(this, ReturnQuestionDlg::BUTTON_YES | ReturnQuestionDlg::BUTTON_CANCEL, - _("Make hidden warnings and dialogs visible again?")) == ReturnQuestionDlg::BUTTON_YES) + _("Make hidden warnings and dialogs visible again?"), QuestConfig().setLabelYes(_("&Restore"))) == ReturnQuestionDlg::BUTTON_YES) settings.optDialogs.resetDialogs(); } |