← Back to team overview

linuxdcpp-team team mailing list archive

[Branch ~dcplusplus-team/dcplusplus/trunk] Rev 2150: Refresh open file lists when they are being opened again

 

------------------------------------------------------------
revno: 2150
committer: poy <poy@xxxxxxxxxx>
branch nick: repo
timestamp: Sun 2010-05-16 19:26:49 +0200
message:
  Refresh open file lists when they are being opened again
modified:
  changelog.txt
  dwt/include/dwt/widgets/TabView.h
  dwt/src/widgets/TabView.cpp
  win32/DirectoryListingFrame.cpp
  win32/MDIChildFrame.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 'changelog.txt'
--- changelog.txt	2010-05-16 16:33:58 +0000
+++ changelog.txt	2010-05-16 17:26:49 +0000
@@ -21,7 +21,8 @@
 * [L#545264] Correct ADC hub counts (emtee)
 * Add an "Elapsed" column in finished transfer windows (poy)
 * [L#539841] Network settings arrangements (poy)
-* [L#556799] Fix positioning and possible queue problems with downloaded file lists (emtee) 
+* [L#556799] Fix positioning and possible queue problems with downloaded file lists (emtee)
+* Refresh open file lists when they are being opened again (poy)
 
 -- 0.761 2010-03-14 --
 * [L#533840] Fix crashes with themed menus (poy)

=== modified file 'dwt/include/dwt/widgets/TabView.h'
--- dwt/include/dwt/widgets/TabView.h	2010-03-11 17:11:26 +0000
+++ dwt/include/dwt/widgets/TabView.h	2010-05-16 17:26:49 +0000
@@ -102,7 +102,7 @@
 
 	void next(bool reverse = false);
 
-	ContainerPtr getActive();
+	ContainerPtr getActive() const;
 	void setActive(ContainerPtr w) { setActive(findTab(w)); }
 
 	IconPtr getIcon(ContainerPtr w) const;

=== modified file 'dwt/src/widgets/TabView.cpp'
--- dwt/src/widgets/TabView.cpp	2010-03-11 23:08:08 +0000
+++ dwt/src/widgets/TabView.cpp	2010-05-16 17:26:49 +0000
@@ -162,7 +162,7 @@
 	w->onTextChanging(std::tr1::bind(&TabView::handleTextChanging, this, w, _1));
 }
 
-ContainerPtr TabView::getActive() {
+ContainerPtr TabView::getActive() const {
 	TabInfo* ti = getTabInfo(getSelected());
 	return ti ? ti->w : 0;
 }

=== modified file 'win32/DirectoryListingFrame.cpp'
--- win32/DirectoryListingFrame.cpp	2010-05-16 16:33:58 +0000
+++ win32/DirectoryListingFrame.cpp	2010-05-16 17:26:49 +0000
@@ -80,15 +80,22 @@
 }
 
 void DirectoryListingFrame::openWindow(dwt::TabView* mdiParent, const tstring& aFile, const tstring& aDir, const HintedUser& aUser, int64_t aSpeed) {
-	UserIter i = lists.find(aUser);
-	if(i != lists.end()) {
-		i->second->speed = aSpeed;
-	} else {
-		DirectoryListingFrame* frame = new DirectoryListingFrame(mdiParent, aUser, aSpeed);
-		frame->loadFile(aFile, aDir);
-		if(!BOOLSETTING(POPUNDER_FILELIST))
-			frame->activate();
+	bool wasActive = false;
+	UserIter prev = lists.find(aUser);
+	if(prev != lists.end()) {
+		wasActive = prev->second->isActive();
+		// close the other window this way instead of via SendMessage so we don't have to wait for it
+		MSG msg = { prev->second->handle(), WM_CLOSE };
+		prev->second->getDispatcher().chain(msg);
 	}
+
+	DirectoryListingFrame* frame = new DirectoryListingFrame(mdiParent, aUser, aSpeed);
+	frame->loadFile(aFile, aDir);
+
+	if(!wasActive && BOOLSETTING(POPUNDER_FILELIST))
+		frame->setDirty(SettingsManager::POPUNDER_FILELIST); /// @todo add a setting
+	else
+		frame->activate();
 }
 
 void DirectoryListingFrame::openOwnList(dwt::TabView* parent) {
@@ -145,10 +152,13 @@
 	if(i != lists.end()) {
 		i->second->speed = aSpeed;
 		i->second->loadXML(txt);
+		i->second->setDirty(SettingsManager::POPUNDER_FILELIST); /// @todo add a setting
 	} else {
 		DirectoryListingFrame* frame = new DirectoryListingFrame(mdiParent, aUser, aSpeed);
 		frame->loadXML(txt);
-		if(!BOOLSETTING(POPUNDER_FILELIST))
+		if(BOOLSETTING(POPUNDER_FILELIST))
+			frame->setDirty(SettingsManager::POPUNDER_FILELIST); /// @todo add a setting
+		else
 			frame->activate();
 	}
 }

=== modified file 'win32/MDIChildFrame.h'
--- win32/MDIChildFrame.h	2010-02-22 18:27:24 +0000
+++ win32/MDIChildFrame.h	2010-05-16 17:26:49 +0000
@@ -119,7 +119,11 @@
 		getParent()->setActive(this);
 	}
 
-	dwt::TabView* getParent() {
+	bool isActive() const {
+		return getParent()->getActive() == this;
+	}
+
+	dwt::TabView* getParent() const {
 		return static_cast<dwt::TabView*>(BaseType::getParent());
 	}