From 76c4466fb6a9de8cbeabef1c8cfd5be04dc39357 Mon Sep 17 00:00:00 2001 From: Christophe Dumez Date: Sun, 6 Dec 2009 10:19:29 +0000 Subject: [PATCH] - In File tree (torrent content), set parent priority to NORMAL if its children have mixed priorities * This also fixes the "you must select at least one file" warning when ignoring all files and then selecting only one --- src/torrentfilesmodel.h | 13 +++++++++---- 1 file changed, 9 insertions(+), 4 deletions(-) diff --git a/src/torrentfilesmodel.h b/src/torrentfilesmodel.h index 89bb2ec89..813930836 100644 --- a/src/torrentfilesmodel.h +++ b/src/torrentfilesmodel.h @@ -184,7 +184,7 @@ public: return itemData.value(3).toInt(); } - void setPriority(int new_prio) { + void setPriority(int new_prio, bool update_children=true) { int old_prio = getPriority(); if(old_prio != new_prio) { itemData.replace(3, new_prio); @@ -200,8 +200,10 @@ public: } } // Update children - foreach(TreeItem* child, childItems) { - child->setPriority(new_prio); + if(update_children) { + foreach(TreeItem* child, childItems) { + child->setPriority(new_prio); + } } } @@ -215,7 +217,10 @@ public: priority = child->getPriority(); first = false; } else { - if(child->getPriority() != priority) return; + if(child->getPriority() != priority) { + setPriority(NORMAL, false); + return; + } } } setPriority(priority);