commit e48c9bdcc8066e2961f590a2accb08e4e3254621
parent 90e44dd5cefc6b81f1f2e0bb00d67eb8c226d363
Author: cfillion <cfillion@users.noreply.github.com>
Date: Mon, 6 Jun 2016 19:09:16 -0400
manager: prompt to apply changes when clicking on browse packages button
Diffstat:
2 files changed, 17 insertions(+), 1 deletion(-)
diff --git a/src/manager.cpp b/src/manager.cpp
@@ -67,7 +67,7 @@ void Manager::onCommand(const int id, int)
m_reapack->importRemote();
break;
case IDC_BROWSE:
- m_reapack->browsePackages();
+ launchBrowser();
break;
case IDC_OPTIONS:
options();
@@ -323,6 +323,21 @@ void Manager::copyUrl(const int index)
setClipboard(remote.url());
}
+void Manager::launchBrowser()
+{
+ const auto promptApply = [&] {
+ const auto_char *title = AUTO_STR("ReaPack Query");
+ const auto_char *msg = AUTO_STR("Apply unsaved changes?");
+ const int btn = MessageBox(handle(), msg, title, MB_YESNO);
+ return btn == IDYES;
+ };
+
+ if(m_changes && promptApply())
+ apply();
+
+ m_reapack->browsePackages();
+}
+
void Manager::options()
{
RECT rect;
diff --git a/src/manager.hpp b/src/manager.hpp
@@ -54,6 +54,7 @@ private:
void about(int index);
void copyUrl(int index);
void options();
+ void launchBrowser();
void setChange(int);
bool confirm() const;