← Back to team overview

linuxdcpp-team team mailing list archive

[Branch ~dcplusplus-team/dcplusplus/trunk] Rev 3351: Always show the window when double-clicking the notif icon

 

------------------------------------------------------------
revno: 3351
committer: poy <poy@xxxxxxxxxx>
branch nick: trunk
timestamp: Mon 2013-09-16 20:41:22 +0200
message:
  Always show the window when double-clicking the notif icon
modified:
  changelog.txt
  dwt/include/dwt/widgets/Notification.h
  dwt/src/widgets/Notification.cpp
  win32/MainWindow.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	2013-09-15 18:28:03 +0000
+++ changelog.txt	2013-09-16 18:41:22 +0000
@@ -11,6 +11,7 @@
 * [ADC] Validate connection tokens to avoid impersonators (poy)
 * [ADC] Send FM / FB in code 43 STAs instead of FL (poy)
 * Don't reconnect after a manual hub disconnect (poy)
+* [L#1225930] Always show the window when double-clicking the notif icon (poy)
 
 -- 0.828 2013-07-23 --
 * Translation fixes

=== modified file 'dwt/include/dwt/widgets/Notification.h'
--- dwt/include/dwt/widgets/Notification.h	2013-01-18 21:28:38 +0000
+++ dwt/include/dwt/widgets/Notification.h	2013-09-16 18:41:22 +0000
@@ -35,6 +35,7 @@
 #include <dwt/resources/Icon.h>
 
 #include <deque>
+#include <functional>
 
 namespace dwt {
 
@@ -72,24 +73,29 @@
 	@param balloonIcon icon shown next to the title, only available on >= Vista. */
 	void addMessage(const tstring& title, const tstring& message, const Callback& callback, const IconPtr& balloonIcon = 0);
 
-	void onContextMenu(const Callback& callback_) { contextMenu = callback_; }
+	void onContextMenu(Callback callback) { contextMenu = callback; }
 
 	/// The icon was left-clicked / selected
-	void onIconClicked(const Callback& callback_) { iconClicked = callback_; }
+	void onIconClicked(Callback callback) { iconClicked = callback; }
+
+	/// The icon was double-clicked - this will swallow the next left-click message
+	void onIconDbClicked(Callback callback) { iconDbClicked = callback; }
 
 	/// This is sent when the tooltip text should be updated
-	void onUpdateTip(const Callback& callback_) { updateTip = callback_; }
+	void onUpdateTip(Callback callback) { updateTip = callback; }
 
 private:
 	Widget* parent;
 	IconPtr icon;
 
 	bool visible;
+	bool ignoreNextClick; // true after a double-click
 
 	tstring tip;
 
 	Callback contextMenu;
 	Callback iconClicked;
+	Callback iconDbClicked;
 	Callback updateTip;
 
 	std::deque<std::pair<Callback, IconPtr>> balloons; // keep a ref of the icon until the balloon has been shown.

=== modified file 'dwt/src/widgets/Notification.cpp'
--- dwt/src/widgets/Notification.cpp	2013-01-18 21:28:38 +0000
+++ dwt/src/widgets/Notification.cpp	2013-09-16 18:41:22 +0000
@@ -64,6 +64,7 @@
 Notification::Notification(Widget* parent) :
 parent(parent),
 visible(false),
+ignoreNextClick(false),
 onlyBalloons(false),
 lastTick(0)
 {
@@ -169,12 +170,23 @@
 
 	case WM_LBUTTONUP:
 		{
-			if(iconClicked) {
+			if(ignoreNextClick) {
+				ignoreNextClick = false;
+			} else if(iconClicked) {
 				iconClicked();
 			}
 			break;
 		}
 
+	case WM_LBUTTONDBLCLK:
+		{
+			if(iconDbClicked) {
+				iconDbClicked();
+				ignoreNextClick = true;
+			}
+			break;
+		}
+
 	case WM_RBUTTONUP:
 		{
 			if(contextMenu) {

=== modified file 'win32/MainWindow.cpp'
--- win32/MainWindow.cpp	2013-09-15 18:28:03 +0000
+++ win32/MainWindow.cpp	2013-09-16 18:41:22 +0000
@@ -625,6 +625,7 @@
 	notifier = addChild(dwt::Notification::Seed(mainSmallIcon));
 	notifier->onContextMenu([this] { handleTrayContextMenu(); });
 	notifier->onIconClicked([this] { handleTrayClicked(); });
+	notifier->onIconDbClicked([this] { handleRestore(); });
 	notifier->onUpdateTip([this] { handleTrayUpdate(); });
 	if(SETTING(ALWAYS_TRAY)) {
 		notifier->setVisible(true);