58 |
57 |
59 @param parent reference to the parent widget (QWidget) |
58 @param parent reference to the parent widget (QWidget) |
60 """ |
59 """ |
61 super(WebBrowserTabWidget, self).__init__(parent, dnd=True) |
60 super(WebBrowserTabWidget, self).__init__(parent, dnd=True) |
62 |
61 |
63 # TODO: implement this |
62 from .WebBrowserTabBar import WebBrowserTabBar |
64 ## from .WebBrowserTabBar import WebBrowserTabBar |
63 self.__tabBar = WebBrowserTabBar(self) |
65 ## self.__tabBar = WebBrowserTabBar(self) |
64 self.setCustomTabBar(True, self.__tabBar) |
66 ## self.setCustomTabBar(True, self.__tabBar) |
|
67 |
65 |
68 self.__mainWindow = parent |
66 self.__mainWindow = parent |
69 |
67 |
70 self.setUsesScrollButtons(True) |
68 self.setUsesScrollButtons(True) |
71 self.setDocumentMode(True) |
69 self.setDocumentMode(True) |
72 self.setElideMode(Qt.ElideNone) |
70 self.setElideMode(Qt.ElideNone) |
73 |
71 |
74 # TODO: re-enable once Closed Tabs Manager is done |
72 # TODO: Closed Tabs Manager |
75 ## from .ClosedTabsManager import ClosedTabsManager |
73 ## from .ClosedTabsManager import ClosedTabsManager |
76 ## self.__closedTabsManager = ClosedTabsManager(self) |
74 ## self.__closedTabsManager = ClosedTabsManager(self) |
77 ## self.__closedTabsManager.closedTabAvailable.connect( |
75 ## self.__closedTabsManager.closedTabAvailable.connect( |
78 ## self.__closedTabAvailable) |
76 ## self.__closedTabAvailable) |
79 |
77 |
80 from .UrlBar.StackedUrlBar import StackedUrlBar |
78 from .UrlBar.StackedUrlBar import StackedUrlBar |
81 self.__stackedUrlBar = StackedUrlBar(self) |
79 self.__stackedUrlBar = StackedUrlBar(self) |
82 ## self.__tabBar.tabMoved.connect(self.__stackedUrlBar.moveBar) |
80 self.__tabBar.tabMoved.connect(self.__stackedUrlBar.moveBar) |
83 |
81 |
84 self.__tabContextMenuIndex = -1 |
82 self.__tabContextMenuIndex = -1 |
85 self.currentChanged[int].connect(self.__currentChanged) |
83 self.currentChanged[int].connect(self.__currentChanged) |
86 self.setTabContextMenuPolicy(Qt.CustomContextMenu) |
84 self.setTabContextMenuPolicy(Qt.CustomContextMenu) |
87 self.customTabContextMenuRequested.connect(self.__showContextMenu) |
85 self.customTabContextMenuRequested.connect(self.__showContextMenu) |
103 self.__navigationButton.setPopupMode(QToolButton.InstantPopup) |
101 self.__navigationButton.setPopupMode(QToolButton.InstantPopup) |
104 self.__navigationButton.setMenu(self.__navigationMenu) |
102 self.__navigationButton.setMenu(self.__navigationMenu) |
105 self.__navigationButton.setEnabled(False) |
103 self.__navigationButton.setEnabled(False) |
106 self.__rightCornerWidgetLayout.addWidget(self.__navigationButton) |
104 self.__rightCornerWidgetLayout.addWidget(self.__navigationButton) |
107 |
105 |
108 # TODO: re-enable once Closed Tabs Manager is done |
106 # TODO: Closed Tabs Manager |
109 ## self.__closedTabsMenu = QMenu(self) |
107 ## self.__closedTabsMenu = QMenu(self) |
110 ## self.__closedTabsMenu.aboutToShow.connect( |
108 ## self.__closedTabsMenu.aboutToShow.connect( |
111 ## self.__aboutToShowClosedTabsMenu) |
109 ## self.__aboutToShowClosedTabsMenu) |
112 ## |
110 ## |
113 ## self.__closedTabsButton = QToolButton(self) |
111 ## self.__closedTabsButton = QToolButton(self) |
835 """ |
833 """ |
836 Public method to check, if the application should be shut down. |
834 Public method to check, if the application should be shut down. |
837 |
835 |
838 @return flag indicating a shut down (boolean) |
836 @return flag indicating a shut down (boolean) |
839 """ |
837 """ |
840 if self.count() > 1 and Preferences.getHelp("WarnOnMultipleClose"): |
838 if self.count() > 1 and Preferences.getWebBrowser( |
|
839 "WarnOnMultipleClose"): |
841 mb = E5MessageBox.E5MessageBox( |
840 mb = E5MessageBox.E5MessageBox( |
842 E5MessageBox.Information, |
841 E5MessageBox.Information, |
843 self.tr("Are you sure you want to close the window?"), |
842 self.tr("Are you sure you want to close the window?"), |
844 self.tr("""Are you sure you want to close the window?\n""" |
843 self.tr("""Are you sure you want to close the window?\n""" |
845 """You have %n tab(s) open.""", "", self.count()), |
844 """You have %n tab(s) open.""", "", self.count()), |
915 Private method to guess an URL given a path string. |
914 Private method to guess an URL given a path string. |
916 |
915 |
917 @param path path string to guess an URL for (string) |
916 @param path path string to guess an URL for (string) |
918 @return guessed URL (QUrl) |
917 @return guessed URL (QUrl) |
919 """ |
918 """ |
920 # TODO: re-enable once Open Search is done |
919 # TODO: Open Search |
921 ## manager = self.__mainWindow.openSearchManager() |
920 ## manager = self.__mainWindow.openSearchManager() |
922 ## path = Utilities.fromNativeSeparators(path) |
921 ## path = Utilities.fromNativeSeparators(path) |
923 ## url = manager.convertKeywordSearchToUrl(path) |
922 ## url = manager.convertKeywordSearchToUrl(path) |
924 ## if url.isValid(): |
923 ## if url.isValid(): |
925 ## return url |
924 ## return url |
960 if browser.url() == "" and browser.hasFocus(): |
959 if browser.url() == "" and browser.hasFocus(): |
961 self.__stackedUrlBar.currentWidget.setFocus() |
960 self.__stackedUrlBar.currentWidget.setFocus() |
962 elif browser.url() != "": |
961 elif browser.url() != "": |
963 browser.setFocus() |
962 browser.setFocus() |
964 |
963 |
965 # TODO: re-enable once Closed Tabs Manager is done |
964 # TODO: Closed Tabs Manager |
966 ## def restoreClosedTab(self): |
965 ## def restoreClosedTab(self): |
967 ## """ |
966 ## """ |
968 ## Public slot to restore the most recently closed tab. |
967 ## Public slot to restore the most recently closed tab. |
969 ## """ |
968 ## """ |
970 ## if not self.canRestoreClosedTab(): |
969 ## if not self.canRestoreClosedTab(): |