231 |
231 |
232 count = 0 |
232 count = 0 |
233 for index in range(len(backItems) - 1, -1, -1): |
233 for index in range(len(backItems) - 1, -1, -1): |
234 item = backItems[index] |
234 item = backItems[index] |
235 act = QAction(self) |
235 act = QAction(self) |
236 act.setData(-1 * (index + 1)) |
236 act.setData(item) |
237 icon = WebBrowserWindow.icon(item.url()) |
237 icon = WebBrowserWindow.icon(item.url()) |
238 act.setIcon(icon) |
238 act.setIcon(icon) |
239 act.setText(item.title()) |
239 act.setText(item.title()) |
240 self.__backMenu.addAction(act) |
240 self.__backMenu.addAction(act) |
241 |
241 |
258 |
258 |
259 count = 0 |
259 count = 0 |
260 for index in range(len(forwardItems)): |
260 for index in range(len(forwardItems)): |
261 item = forwardItems[index] |
261 item = forwardItems[index] |
262 act = QAction(self) |
262 act = QAction(self) |
263 act.setData(index + 1) |
263 act.setData(item) |
264 icon = WebBrowserWindow.icon(item.url()) |
264 icon = WebBrowserWindow.icon(item.url()) |
265 act.setIcon(icon) |
265 act.setIcon(icon) |
266 act.setText(item.title()) |
266 act.setText(item.title()) |
267 self.__forwardMenu.addAction(act) |
267 self.__forwardMenu.addAction(act) |
268 |
268 |
279 Private slot to go to the selected page. |
279 Private slot to go to the selected page. |
280 |
280 |
281 @param act reference to the action selected in the navigation menu |
281 @param act reference to the action selected in the navigation menu |
282 (QAction) |
282 (QAction) |
283 """ |
283 """ |
284 offset = act.data() |
284 historyItem = act.data() |
285 if offset is not None: |
285 if historyItem is not None: |
286 history = self.__mw.currentBrowser().history() |
286 history = self.__mw.currentBrowser().history() |
287 historyCount = history.count() |
287 history.goToItem(historyItem) |
288 if offset < 0: |
|
289 # go back |
|
290 history.goToItem( |
|
291 history.backItems(historyCount)[-1 * offset - 1]) |
|
292 else: |
|
293 # go forward |
|
294 history.goToItem( |
|
295 history.forwardItems(historyCount)[offset - 1]) |
|
296 |
288 |
297 def __goBack(self): |
289 def __goBack(self): |
298 """ |
290 """ |
299 Private slot called to handle the backward button. |
291 Private slot called to handle the backward button. |
300 """ |
292 """ |