commit 7acb82afc48b9f66ced690a669b4badd4d5705a9
parent ee411e86be8878b7afee04eaad158e22b558f52e
Author: cfillion <cfillion@users.noreply.github.com>
Date: Tue, 7 Jun 2016 16:27:13 -0400
manager: consider the whole selection when build the context menu
Diffstat:
1 file changed, 18 insertions(+), 5 deletions(-)
diff --git a/src/manager.cpp b/src/manager.cpp
@@ -140,7 +140,6 @@ void Manager::onContextMenu(HWND target, const int x, const int y)
const int index = m_list->itemUnderMouse();
const Remote &remote = getRemote(index);
-
Menu menu;
if(!remote) {
@@ -171,12 +170,26 @@ void Manager::onContextMenu(HWND target, const int x, const int y)
AUTO_STR("&About %s..."), name.c_str());
menu.addAction(aboutLabel, index | (ACTION_ABOUT << 8));
- if(isRemoteEnabled(remote))
+ bool allEnabled = true;
+ bool allDisabled = true;
+ bool allProtected = true;
+
+ for(const int i : m_list->selection()) {
+ const Remote &r = getRemote(i);
+ if(isRemoteEnabled(r))
+ allDisabled = false;
+ else
+ allEnabled = false;
+
+ if(!r.isProtected())
+ allProtected = false;
+ };
+
+ if(allEnabled)
menu.disable(enableAction);
- else
+ if(allDisabled)
menu.disable(disableAction);
-
- if(remote.isProtected())
+ if(allProtected)
menu.disable(uninstallAction);
menu.show(x, y, handle());