← Back to team overview

linuxdcpp-team team mailing list archive

[Branch ~dcplusplus-team/dcplusplus/trunk] Rev 2947: Fix disabled buttons in user matching settings

 

------------------------------------------------------------
revno: 2947
committer: poy <poy@xxxxxxxxxx>
branch nick: trunk
timestamp: Sat 2012-06-16 16:29:41 +0200
message:
  Fix disabled buttons in user matching settings
modified:
  changelog.txt
  win32/UserMatchPage.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 'changelog.txt'
--- changelog.txt	2012-06-08 14:15:53 +0000
+++ changelog.txt	2012-06-16 14:29:41 +0000
@@ -8,7 +8,8 @@
 * Make the menu bar hideable (poy)
 * Add a /info hub command (poy)
 * [L#957994] Fix glitches with the file list loader (poy)
-* [1007103] Correct download logging after an app restart (emtee)
+* [L#1007103] Correct download logging after an app restart (emtee)
+* [L#1007099] Fix disabled buttons in user matching settings (poy)
 
 -- 0.799 2012-05-05 --
 * Add icons (iceman50)

=== modified file 'win32/UserMatchPage.cpp'
--- win32/UserMatchPage.cpp	2012-03-18 15:43:00 +0000
+++ win32/UserMatchPage.cpp	2012-06-16 14:29:41 +0000
@@ -169,14 +169,20 @@
 }
 
 void UserMatchPage::handleSelectionChanged() {
-	auto sel = table->countSelected();
-	auto& matcher = list[sel];
-	auto predef = matcher.isSet(UserMatch::PREDEFINED);
-
-	edit->setEnabled(sel == 1 && !predef);
-	up->setEnabled(sel > 0);
-	down->setEnabled(sel > 0);
-	remove->setEnabled(sel > 0 && !predef);
+	auto sel = table->getSelection();
+
+	bool predef = false;
+	for(auto i: sel) {
+		if(list[i].isSet(UserMatch::PREDEFINED)) {
+			predef = true;
+			break;
+		}
+	}
+
+	edit->setEnabled(sel.size() == 1 && !predef);
+	up->setEnabled(!sel.empty());
+	down->setEnabled(!sel.empty());
+	remove->setEnabled(!sel.empty() && !predef);
 }
 
 tstring UserMatchPage::handleTooltip(int i) {