← Back to team overview

linuxdcpp-team team mailing list archive

[Branch ~dcplusplus-team/dcplusplus/trunk] Rev 2803: load the cached list before showing a partial file list

 

------------------------------------------------------------
revno: 2803
committer: poy <poy@xxxxxxxxxx>
branch nick: trunk
timestamp: Sun 2012-01-08 15:08:54 +0100
message:
  load the cached list before showing a partial file list
modified:
  win32/DirectoryListingFrame.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/DirectoryListingFrame.cpp'
--- win32/DirectoryListingFrame.cpp	2012-01-07 18:05:09 +0000
+++ win32/DirectoryListingFrame.cpp	2012-01-08 14:08:54 +0000
@@ -484,7 +484,19 @@
 
 void DirectoryListingFrame::loadXML(const string& txt) {
 	try {
+		string prevDir;
+		auto sel = dirs->getSelectedData();
+		if(sel && sel->type == ItemInfo::DIRECTORY) {
+			prevDir = dl->getPath(sel->dir);
+		}
+
 		path = QueueManager::getInstance()->getListPath(dl->getUser()) + ".xml";
+
+		if(!loaded && File::getSize(path) != -1) {
+			// load the cached list.
+			dl->updateXML(File(path, File::READ, File::OPEN).read());
+		}
+
 		auto base = dl->updateXML(txt);
 		dl->save(path);
 
@@ -516,6 +528,10 @@
 		});
 		refreshTree(Text::toT(Util::toNmdcFile(base)));
 
+		if(!prevDir.empty()) {
+			selectItem(Text::toT(prevDir));
+		}
+
 	} catch(const Exception& e) {
 		error = Text::toT(e.getError());
 		updateTitle();