← Back to team overview

openlp-core team mailing list archive

[Merge] lp:~trb143/openlp/bug-827027 into lp:openlp

 

Tim Bentley has proposed merging lp:~trb143/openlp/bug-827027 into lp:openlp.

Requested reviews:
  OpenLP Core (openlp-core)
Related bugs:
  Bug #827027 in OpenLP: "Added mediaitems are not sorted"
  https://bugs.launchpad.net/openlp/+bug/827027

For more details, see:
https://code.launchpad.net/~trb143/openlp/bug-827027/+merge/75849

Fix lists to sort if new items are added for Images, Media and Presentations
-- 
https://code.launchpad.net/~trb143/openlp/bug-827027/+merge/75849
Your team OpenLP Core is requested to review the proposed merge of lp:~trb143/openlp/bug-827027 into lp:openlp.
=== modified file 'openlp/core/lib/mediamanageritem.py'
--- openlp/core/lib/mediamanageritem.py	2011-09-06 17:53:43 +0000
+++ openlp/core/lib/mediamanageritem.py	2011-09-17 08:31:24 +0000
@@ -376,18 +376,23 @@
          The files to be loaded
         """
         names = []
+        fullList = []
         for count in range(0, self.listView.count()):
             names.append(unicode(self.listView.item(count).text()))
-        newFiles = []
+            fullList.append(unicode(self.listView.item(count).
+                data(QtCore.Qt.UserRole).toString()))
         duplicatesFound = False
+        filesAdded = False
         for file in files:
             filename = os.path.split(unicode(file))[1]
             if filename in names:
                 duplicatesFound = True
             else:
-                newFiles.append(file)
-        if newFiles:
-            self.loadList(newFiles)
+                filesAdded = True
+                fullList.append(file)
+        if fullList and filesAdded:
+            self.listView.clear()
+            self.loadList(fullList)
             lastDir = os.path.split(unicode(files[0]))[0]
             SettingsManager.set_last_dir(self.settingsSection, lastDir)
             SettingsManager.set_list(self.settingsSection,