← Back to team overview

linuxdcpp-team team mailing list archive

[Branch ~dcplusplus-team/dcplusplus/trunk] Rev 2543: clicking a finished DL balloon highlights the file in the finished DL list

 

------------------------------------------------------------
revno: 2543
committer: poy <poy@xxxxxxxxxx>
branch nick: trunk
timestamp: Mon 2011-05-30 19:06:19 +0200
message:
  clicking a finished DL balloon highlights the file in the finished DL list
modified:
  dwt/include/dwt/widgets/Notification.h
  dwt/src/widgets/Notification.cpp
  win32/FinishedFrameBase.h
  win32/MainWindow.cpp
  win32/StaticFrame.h


--
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 'dwt/include/dwt/widgets/Notification.h'
--- dwt/include/dwt/widgets/Notification.h	2011-05-29 21:40:28 +0000
+++ dwt/include/dwt/widgets/Notification.h	2011-05-30 17:06:19 +0000
@@ -87,8 +87,8 @@
 	Callback iconClicked;
 	Callback updateTip;
 
-	std::deque<Callback> balloons;
-	bool onlyBalloons; /// the icon has been created solely for balloons; it will disappear afterwards.
+	std::deque<std::pair<Callback, IconPtr>> balloons; // keep a ref of the icon until the balloon has been shown.
+	bool onlyBalloons; /// the tray icon has been created solely for balloons; it will disappear afterwards.
 
 	NOTIFYICONDATA makeNID() const;
 

=== modified file 'dwt/src/widgets/Notification.cpp'
--- dwt/src/widgets/Notification.cpp	2011-05-29 21:40:28 +0000
+++ dwt/src/widgets/Notification.cpp	2011-05-30 17:06:19 +0000
@@ -136,7 +136,7 @@
 		onlyBalloons = true;
 	}
 
-	balloons.push_back(callback);
+	balloons.push_back(std::make_pair(callback, balloonIcon));
 
 	NOTIFYICONDATA nid = makeNID();
 	nid.uFlags |= NIF_INFO;
@@ -199,7 +199,7 @@
 
 	case NIN_BALLOONUSERCLICK:
 		{
-			balloons.front()();
+			balloons.front().first();
 		} // fall through
 	case NIN_BALLOONHIDE: // fall through
 	case NIN_BALLOONTIMEOUT:

=== modified file 'win32/FinishedFrameBase.h'
--- win32/FinishedFrameBase.h	2011-05-04 19:32:00 +0000
+++ win32/FinishedFrameBase.h	2011-05-30 17:06:19 +0000
@@ -58,6 +58,11 @@
 		STATUS_LAST
 	};
 
+	static void focusFile(TabViewPtr parent, const string& file) {
+		openWindow(parent, false);
+		frame->focusFile(file);
+	}
+
 protected:
 	friend class StaticFrame<T>;
 	friend class MDIChildFrame<T>;
@@ -380,14 +385,21 @@
 	dwt::CheckBoxPtr onlyFull;
 	bool bOnlyFull;
 
+	void focusFile(const string& file) {
+		tabs->setActive(filesWindow);
+		files->forEachT([this, &file](FileInfo* fi) {
+			if(fi->file == file) {
+				auto pos = files->find(fi);
+				files->setSelected(pos);
+				files->ensureVisible(pos);
+			}
+		});
+	}
+
 	static bool noClose() {
 		return false;
 	}
 
-	static void fills(dwt::ContainerPtr parent, dwt::TablePtr control) {
-		control->resize(dwt::Rectangle(parent->getClientSize()));
-	}
-
 	bool handleFilesKeyDown(int c) {
 		switch(c) {
 			case VK_RETURN: handleOpenFile(); return true;

=== modified file 'win32/MainWindow.cpp'
--- win32/MainWindow.cpp	2011-05-29 21:40:28 +0000
+++ win32/MainWindow.cpp	2011-05-30 17:06:19 +0000
@@ -1511,8 +1511,9 @@
 			auto user = qi->getDownloads()[0]->getHintedUser();
 			callAsync([this, file, dir, user, speed] {
 				DirectoryListingFrame::openWindow(getTabView(), Text::toT(file), Text::toT(dir), user, speed);
-				WinUtil::notify(WinUtil::NOTIFICATION_FINISHED_FL, Text::toT(Util::getFileName(file)),
-					[=] { DirectoryListingFrame::activateWindow(user); });
+				WinUtil::notify(WinUtil::NOTIFICATION_FINISHED_FL, Text::toT(Util::getFileName(file)), [=] {
+					DirectoryListingFrame::activateWindow(user);
+				});
 			});
 
 		} else if(qi->isSet(QueueItem::FLAG_TEXT)) {
@@ -1528,8 +1529,7 @@
 		auto file = qi->getTarget();
 		callAsync([this, file] {
 			WinUtil::notify(WinUtil::NOTIFICATION_FINISHED_DL, Text::toT(file), [=] {
-				FinishedDLFrame::openWindow(getTabView(), false);
-				///@todo focus the file in the finished download list?
+				FinishedDLFrame::focusFile(getTabView(), file);
 			});
 		});
 	}

=== modified file 'win32/StaticFrame.h'
--- win32/StaticFrame.h	2011-05-04 19:32:00 +0000
+++ win32/StaticFrame.h	2011-05-30 17:06:19 +0000
@@ -57,8 +57,7 @@
 		openWindow(parent, false, BaseType::parseActivateParam(params));
 	}
 
-private:
-	friend class MDIChildFrame<T>;
+protected:
 	static T* frame;
 };