376 """ |
376 """ |
377 Private slot to open a new browser tab. |
377 Private slot to open a new browser tab. |
378 """ |
378 """ |
379 self.newBrowser() |
379 self.newBrowser() |
380 |
380 |
381 def newBrowser(self, link=None, position=-1, background=False): |
381 def newBrowser(self, link=None, position=-1, background=False, |
|
382 restoreSession=False): |
382 """ |
383 """ |
383 Public method to create a new web browser tab. |
384 Public method to create a new web browser tab. |
384 |
385 |
385 @param link link to be shown (string or QUrl) |
386 @param link link to be shown |
|
387 @type str or QUrl |
386 @keyparam position position to create the new tab at or -1 to add it |
388 @keyparam position position to create the new tab at or -1 to add it |
387 to the end (integer) |
389 to the end |
|
390 @type int |
388 @keyparam background flag indicating to open the tab in the |
391 @keyparam background flag indicating to open the tab in the |
389 background (bool) |
392 background |
|
393 @type bool |
|
394 @keyparam restoreSession flag indicating a restore session action |
|
395 @type bool |
390 @return reference to the new browser |
396 @return reference to the new browser |
391 @rtype WebBrowserView |
397 @rtype WebBrowserView |
392 """ |
398 """ |
393 if link is None: |
399 if link is None: |
394 linkName = "" |
400 linkName = "" |
447 self.__mainWindow.closeAct.setEnabled(True) |
453 self.__mainWindow.closeAct.setEnabled(True) |
448 self.__mainWindow.closeAllAct.setEnabled(True) |
454 self.__mainWindow.closeAllAct.setEnabled(True) |
449 self.__closeButton.setEnabled(True) |
455 self.__closeButton.setEnabled(True) |
450 self.__navigationButton.setEnabled(True) |
456 self.__navigationButton.setEnabled(True) |
451 |
457 |
452 if not linkName: |
458 if not linkName and not restoreSession: |
453 if Preferences.getWebBrowser("StartupBehavior") == 0: |
459 if Preferences.getWebBrowser("StartupBehavior") == 0: |
454 linkName = Preferences.getWebBrowser("HomePage") |
460 linkName = Preferences.getWebBrowser("HomePage") |
455 elif Preferences.getWebBrowser("StartupBehavior") == 1: |
461 elif Preferences.getWebBrowser("StartupBehavior") == 1: |
456 linkName = "eric:speeddial" |
462 linkName = "eric:speeddial" |
457 |
463 |
1220 tabCount = self.count() |
1226 tabCount = self.count() |
1221 |
1227 |
1222 # 1. load tab data |
1228 # 1. load tab data |
1223 if "Tabs" in sessionData: |
1229 if "Tabs" in sessionData: |
1224 for data in sessionData["Tabs"]: |
1230 for data in sessionData["Tabs"]: |
1225 browser = self.newBrowser() |
1231 browser = self.newBrowser(restoreSession=True) |
1226 browser.page().loadFromSessionData(data) |
1232 browser.page().loadFromSessionData(data) |
1227 |
1233 |
1228 # 2. set tab index |
1234 # 2. set tab index |
1229 if "CurrentTabIndex" in sessionData: |
1235 if "CurrentTabIndex" in sessionData: |
1230 index = tabCount + sessionData["CurrentTabIndex"] |
1236 index = tabCount + sessionData["CurrentTabIndex"] |