--- a/Helpviewer/Download/DownloadManager.py Sat Dec 18 18:11:02 2010 +0100 +++ b/Helpviewer/Download/DownloadManager.py Sun Dec 19 13:20:52 2010 +0100 @@ -191,6 +191,7 @@ @param itm reference to the download item (DownloadItem) """ itm.statusChanged.connect(self.__updateRow) + itm.downloadFinished.connect(self.__finished) row = len(self.__downloads) self.__model.beginInsertRows(QModelIndex(), row, row) @@ -204,6 +205,7 @@ # just in case the download finished before the constructor returned self.__updateRow(itm) self.changeOccurred() + self.__updateActiveItemCount() def __updateRow(self, itm = None): """ @@ -315,6 +317,7 @@ (len(self.__downloads) - self.activeDownloads()) > 0) self.__loaded = True + self.__updateActiveItemCount() def cleanup(self): """ @@ -336,6 +339,7 @@ self.__iconProvider = None self.changeOccurred() + self.__updateActiveItemCount() def __updateItemCount(self): """ @@ -344,6 +348,24 @@ count = len(self.__downloads) self.countLabel.setText(self.trUtf8("%n Download(s)", "", count)) + def __updateActiveItemCount(self): + """ + Private method to update the window title. + """ + count = self.activeDownloads() + if count > 0: + self.setWindowTitle(self.trUtf8("Downloading %n file(s)", "", count)) + else: + self.setWindowTitle(self.trUtf8("Downloads")) + + def __finished(self): + """ + Private slot to handle a finished download. + """ + self.__updateActiveItemCount() + if self.isVisible(): + QApplication.alert(self) + def setDownloadDirectory(self, directory): """ Public method to set the current download directory.