80 |
80 |
81 if selectedRowsCount == 1: |
81 if selectedRowsCount == 1: |
82 row = self.downloadsView.selectionModel().selectedRows()[0].row() |
82 row = self.downloadsView.selectionModel().selectedRows()[0].row() |
83 itm = self.__downloads[row] |
83 itm = self.__downloads[row] |
84 if itm.downloadCanceled(): |
84 if itm.downloadCanceled(): |
85 menu.addAction(UI.PixmapCache.getIcon("restart.png"), |
85 menu.addAction( |
|
86 UI.PixmapCache.getIcon("restart.png"), |
86 self.trUtf8("Retry"), self.__contextMenuRetry) |
87 self.trUtf8("Retry"), self.__contextMenuRetry) |
87 else: |
88 else: |
88 if itm.downloadedSuccessfully(): |
89 if itm.downloadedSuccessfully(): |
89 menu.addAction(UI.PixmapCache.getIcon("open.png"), |
90 menu.addAction( |
|
91 UI.PixmapCache.getIcon("open.png"), |
90 self.trUtf8("Open"), self.__contextMenuOpen) |
92 self.trUtf8("Open"), self.__contextMenuOpen) |
91 elif itm.downloading(): |
93 elif itm.downloading(): |
92 menu.addAction(UI.PixmapCache.getIcon("stopLoading.png"), |
94 menu.addAction( |
|
95 UI.PixmapCache.getIcon("stopLoading.png"), |
93 self.trUtf8("Cancel"), self.__contextMenuCancel) |
96 self.trUtf8("Cancel"), self.__contextMenuCancel) |
94 menu.addSeparator() |
97 menu.addSeparator() |
95 menu.addAction(self.trUtf8("Open Containing Folder"), |
98 menu.addAction( |
|
99 self.trUtf8("Open Containing Folder"), |
96 self.__contextMenuOpenFolder) |
100 self.__contextMenuOpenFolder) |
97 menu.addSeparator() |
101 menu.addSeparator() |
98 menu.addAction(self.trUtf8("Go to Download Page"), |
102 menu.addAction( |
|
103 self.trUtf8("Go to Download Page"), |
99 self.__contextMenuGotoPage) |
104 self.__contextMenuGotoPage) |
100 menu.addAction(self.trUtf8("Copy Download Link"), |
105 menu.addAction( |
|
106 self.trUtf8("Copy Download Link"), |
101 self.__contextMenuCopyLink) |
107 self.__contextMenuCopyLink) |
102 menu.addSeparator() |
108 menu.addSeparator() |
103 menu.addAction(self.trUtf8("Select All"), self.__contextMenuSelectAll) |
109 menu.addAction(self.trUtf8("Select All"), self.__contextMenuSelectAll) |
104 if selectedRowsCount > 1 or \ |
110 if selectedRowsCount > 1 or \ |
105 (selectedRowsCount == 1 and \ |
111 (selectedRowsCount == 1 and \ |
106 not self.__downloads[ |
112 not self.__downloads[ |
107 self.downloadsView.selectionModel().selectedRows()[0].row()]\ |
113 self.downloadsView.selectionModel().selectedRows()[0].row()]\ |
108 .downloading()): |
114 .downloading()): |
109 menu.addSeparator() |
115 menu.addSeparator() |
110 menu.addAction(self.trUtf8("Remove From List"), |
116 menu.addAction( |
|
117 self.trUtf8("Remove From List"), |
111 self.__contextMenuRemoveSelected) |
118 self.__contextMenuRemoveSelected) |
112 |
119 |
113 menu.exec_(QCursor.pos()) |
120 menu.exec_(QCursor.pos()) |
114 |
121 |
115 def shutdown(self): |
122 def shutdown(self): |
138 Public method to check, if it is ok to quit. |
145 Public method to check, if it is ok to quit. |
139 |
146 |
140 @return flag indicating allowance to quit (boolean) |
147 @return flag indicating allowance to quit (boolean) |
141 """ |
148 """ |
142 if self.activeDownloads() > 0: |
149 if self.activeDownloads() > 0: |
143 res = E5MessageBox.yesNo(self, |
150 res = E5MessageBox.yesNo( |
|
151 self, |
144 self.trUtf8(""), |
152 self.trUtf8(""), |
145 self.trUtf8("""There are %n downloads in progress.\n""" |
153 self.trUtf8("""There are %n downloads in progress.\n""" |
146 """Do you want to quit anyway?""", "", |
154 """Do you want to quit anyway?""", "", |
147 self.activeDownloads()), |
155 self.activeDownloads()), |
148 icon=E5MessageBox.Warning) |
156 icon=E5MessageBox.Warning) |
162 @keyparam mainWindow reference to the main window (HelpWindow) |
170 @keyparam mainWindow reference to the main window (HelpWindow) |
163 """ |
171 """ |
164 request = QNetworkRequest(requestOrUrl) |
172 request = QNetworkRequest(requestOrUrl) |
165 if request.url().isEmpty(): |
173 if request.url().isEmpty(): |
166 return |
174 return |
167 self.handleUnsupportedContent(self.__manager.get(request), |
175 self.handleUnsupportedContent( |
|
176 self.__manager.get(request), |
168 requestFileName=requestFileName, |
177 requestFileName=requestFileName, |
169 download=True, |
178 download=True, |
170 mainWindow=mainWindow) |
179 mainWindow=mainWindow) |
171 |
180 |
172 def handleUnsupportedContent(self, reply, requestFileName=False, |
181 def handleUnsupportedContent(self, reply, requestFileName=False, |
250 if icon.isNull(): |
259 if icon.isNull(): |
251 icon = self.style().standardIcon(QStyle.SP_FileIcon) |
260 icon = self.style().standardIcon(QStyle.SP_FileIcon) |
252 itm.setIcon(icon) |
261 itm.setIcon(icon) |
253 |
262 |
254 oldHeight = self.downloadsView.rowHeight(row) |
263 oldHeight = self.downloadsView.rowHeight(row) |
255 self.downloadsView.setRowHeight(row, |
264 self.downloadsView.setRowHeight( |
|
265 row, |
256 max(oldHeight, itm.minimumSizeHint().height() * 1.5)) |
266 max(oldHeight, itm.minimumSizeHint().height() * 1.5)) |
257 |
267 |
258 remove = False |
268 remove = False |
259 globalSettings = QWebSettings.globalSettings() |
269 globalSettings = QWebSettings.globalSettings() |
260 if not itm.downloading() and \ |
270 if not itm.downloading() and \ |