← Back to team overview

linuxdcpp-team team mailing list archive

[Branch ~dcplusplus-team/dcplusplus/trunk] Rev 3326: ask before removing plugins

 

------------------------------------------------------------
revno: 3326
committer: poy <poy@xxxxxxxxxx>
branch nick: trunk
timestamp: Mon 2013-07-22 23:14:10 +0200
message:
  ask before removing plugins
modified:
  win32/MainWindow.cpp
  win32/PluginPage.cpp


--
lp:dcplusplus
https://code.launchpad.net/~dcplusplus-team/dcplusplus/trunk

Your team Dcplusplus-team is subscribed to branch lp:dcplusplus.
To unsubscribe from this branch go to https://code.launchpad.net/~dcplusplus-team/dcplusplus/trunk/+edit-subscription
=== modified file 'win32/MainWindow.cpp'
--- win32/MainWindow.cpp	2013-07-19 16:24:10 +0000
+++ win32/MainWindow.cpp	2013-07-22 21:14:10 +0000
@@ -709,9 +709,10 @@
 
 	for(auto& guid: plugins) {
 		const auto enabled = PluginManager::getInstance()->isLoaded(guid);
+		const auto name = Text::toT(PluginManager::getInstance()->getPlugin(guid).name);
 
-		auto sub = menu->appendPopup(Text::toT(PluginManager::getInstance()->getPlugin(guid).name),
-			WinUtil::menuIcon(enabled ? IDI_GREEN_BALL : IDI_RED_BALL));
+		auto sub = menu->appendPopup(name, WinUtil::menuIcon(enabled ? IDI_GREEN_BALL : IDI_RED_BALL), false);
+		sub->setTitle(name); // don't want the enabled/disabled icon repeated there
 
 		sub->appendItem(T_("Enable"), [this, guid] { PluginUtils::enablePlugin(guid, this); }, WinUtil::menuIcon(IDI_GREEN_BALL), !enabled);
 		sub->appendItem(T_("Disable"), [this, guid] { PluginUtils::disablePlugin(guid, this); }, WinUtil::menuIcon(IDI_RED_BALL), enabled);

=== modified file 'win32/PluginPage.cpp'
--- win32/PluginPage.cpp	2013-05-13 18:22:52 +0000
+++ win32/PluginPage.cpp	2013-07-22 21:14:10 +0000
@@ -327,9 +327,13 @@
 	if(!plugins->hasSelected())
 		return;
 
-	auto guid = sel();
-	plugins->erase(plugins->getSelected());
-	PluginManager::getInstance()->removePlugin(guid);
+	if(dwt::MessageBox(this).show(T_("Really remove?"), T_("Plugins"), dwt::MessageBox::BOX_YESNO, dwt::MessageBox::BOX_ICONQUESTION) == IDYES) {
+		int i;
+		while((i = plugins->getNext(-1, LVNI_SELECTED)) != -1) {
+			PluginManager::getInstance()->removePlugin(Text::fromT(plugins->getText(i, COLUMN_GUID)));
+			plugins->erase(i);
+		}
+	}
 }
 
 void PluginPage::refreshList() {