← Back to team overview

linuxdcpp-team team mailing list archive

[Branch ~dcplusplus-team/dcplusplus/trunk] Rev 3015: Fix partial list browsing after loading an old full list

 

------------------------------------------------------------
revno: 3015
committer: poy <poy@xxxxxxxxxx>
branch nick: trunk
timestamp: Thu 2012-07-26 19:35:45 +0200
message:
  Fix partial list browsing after loading an old full list
modified:
  changelog.txt
  dcpp/DirectoryListing.cpp
  dcpp/DirectoryListing.h
  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 'changelog.txt'
--- changelog.txt	2012-07-20 14:03:59 +0000
+++ changelog.txt	2012-07-26 17:35:45 +0000
@@ -29,6 +29,7 @@
 * Increase the chat buffer limit (iceman50)
 * Eliminate GUI freezes when opening large file lists (poy)
 * Remove the search spy in favor of the dev plugin - works on ADC too (poy)
+* Fix partial list browsing after loading an old full list (poy)
 
 -- 0.799 2012-05-05 --
 * Add icons (iceman50)

=== modified file 'dcpp/DirectoryListing.cpp'
--- dcpp/DirectoryListing.cpp	2012-07-11 17:13:42 +0000
+++ dcpp/DirectoryListing.cpp	2012-07-26 17:35:45 +0000
@@ -354,6 +354,17 @@
 	return compare(a->getName(), b->getName()) < 0;
 }
 
+void DirectoryListing::setComplete(bool complete) {
+	root->setAllComplete(complete);
+}
+
+void DirectoryListing::Directory::setAllComplete(bool complete) {
+	for(auto d: directories) {
+		d->setAllComplete(complete);
+	}
+	setComplete(complete);
+}
+
 string DirectoryListing::getPath(const Directory* d) const {
 	if(d == root)
 		return "";

=== modified file 'dcpp/DirectoryListing.h'
--- dcpp/DirectoryListing.h	2012-07-11 17:13:42 +0000
+++ dcpp/DirectoryListing.h	2012-07-26 17:35:45 +0000
@@ -93,6 +93,7 @@
 		void getHashList(TTHSet& l);
 		void save(OutputStream& stream, string& indent, string& tmp) const;
 		void sortDirs();
+		void setAllComplete(bool complete);
 
 		size_t getFileCount() const { return files.size(); }
 
@@ -131,6 +132,8 @@
 	void save(const string& path) const;
 	/** sort directories and sub-directories recursively (case-insensitive). */
 	void sortDirs();
+	/** recursively mark directories and sub-directories as complete or incomplete. */
+	void setComplete(bool complete);
 
 	void download(const string& aDir, const string& aTarget, bool highPrio);
 	void download(Directory* aDir, const string& aTarget, bool highPrio);

=== modified file 'win32/DirectoryListingFrame.cpp'
--- win32/DirectoryListingFrame.cpp	2012-07-12 20:49:11 +0000
+++ win32/DirectoryListingFrame.cpp	2012-07-26 17:35:45 +0000
@@ -518,6 +518,9 @@
 		if(!loaded && File::getSize(path) != -1) {
 			// load the cached list.
 			dl->updateXML(File(path, File::READ, File::OPEN).read());
+
+			// mark all dirs as incomplete (the list we have loaded may be old).
+			dl->setComplete(false);
 		}
 
 		auto base = dl->updateXML(txt);