commit 1dd24ba233e1d8e49e66918164ff16b8ef1dc203
parent c12f5c7a8e807bc04789fa107a9eb4c22b90ab08
Author: cfillion <cfillion@users.noreply.github.com>
Date: Mon, 12 Dec 2016 23:54:51 -0500
browser: prompt to enable "Install new packages when sychronizing" when installing everything
Diffstat:
2 files changed, 27 insertions(+), 1 deletion(-)
diff --git a/src/browser.cpp b/src/browser.cpp
@@ -185,7 +185,7 @@ void Browser::onCommand(const int id, const int event)
installLatest(m_currentIndex);
break;
case ACTION_LATEST_ALL:
- selectionDo(bind(&Browser::installLatest, this, placeholders::_1, false));
+ installLatestAll();
break;
case ACTION_REINSTALL:
reinstall(m_currentIndex);
@@ -865,6 +865,31 @@ void Browser::aboutRemote(const int index, const bool focus)
}
}
+void Browser::installLatestAll()
+{
+ InstallOpts &installOpts = m_reapack->config()->install;
+ const bool isEverything = (size_t)m_list->selectionSize() == m_entries.size();
+
+ if(isEverything && !installOpts.autoInstall) {
+ const int btn = MessageBox(handle(),
+ AUTO_STR("Do you want ReaPack to install new packages automatically when")
+ AUTO_STR(" synchronizing in the future?\r\n\r\nThis setting can also be")
+ AUTO_STR(" customized globally or on a per-repository basis in")
+ AUTO_STR(" ReaPack > Manage repositories."),
+ AUTO_STR("Install every available packages"), MB_YESNOCANCEL);
+
+ switch(btn) {
+ case IDYES:
+ installOpts.autoInstall = true;
+ break;
+ case IDCANCEL:
+ return;
+ }
+ }
+
+ selectionDo(bind(&Browser::installLatest, this, placeholders::_1, false));
+}
+
void Browser::installLatest(const int index, const bool toggle)
{
const Entry *entry = getEntry(index);
diff --git a/src/browser.hpp b/src/browser.hpp
@@ -132,6 +132,7 @@ private:
bool apply();
void installLatest(int index, bool toggle = true);
+ void installLatestAll();
void reinstall(int index, bool toggle = true);
void installVersion(int index, size_t verIndex);
void uninstall(int index, bool toggle = true);