diff --git a/apps/browser/qml/pages/components/Overlay.qml b/apps/browser/qml/pages/components/Overlay.qml index 23b6d3dccc52..be2e9888f9cd 100644 --- a/apps/browser/qml/pages/components/Overlay.qml +++ b/apps/browser/qml/pages/components/Overlay.qml @@ -626,9 +626,6 @@ Shared.Background { portrait: tabPage.isPortrait privateMode: webView.privateMode - scaledPortraitHeight: toolBar.scaledPortraitHeight - scaledLandscapeHeight: toolBar.scaledLandscapeHeight - onHide: pageStack.pop() onPrivateModeChanged: { diff --git a/apps/browser/qml/pages/components/TabGridView.qml b/apps/browser/qml/pages/components/TabGridView.qml index 05278eac7f06..fc19559aa653 100644 --- a/apps/browser/qml/pages/components/TabGridView.qml +++ b/apps/browser/qml/pages/components/TabGridView.qml @@ -19,6 +19,7 @@ SilicaGridView { property bool closingAllTabs property var remorsePopup + readonly property int _spacing: Theme.paddingLarge readonly property bool largeScreen: Screen.sizeCategory > Screen.Medium readonly property real thumbnailHeight: largeScreen ? Screen.width / 3 @@ -27,10 +28,9 @@ SilicaGridView { ? portrait ? 2 : 3 : parent.width < 2 * parent.height ? parent.width <= height ? 1 : 2 : 3 - readonly property real thumbnailWidth: (parent.width - Theme.horizontalPageMargin * 2 - (Theme.paddingLarge * (columns - 1))) / columns + readonly property real thumbnailWidth: (parent.width - Theme.horizontalPageMargin * 2 - (_spacing * (columns - 1))) / columns signal hide - signal enterNewTabUrl signal activateTab(int index) signal closeTab(int index) signal closeAll @@ -59,12 +59,17 @@ SilicaGridView { onCountChanged: if (count > 0) closingAllTabs = false onClosingAllTabsChanged: if (closingAllTabs) closeAllPending() - width: parent.width - Theme.horizontalPageMargin - height: parent.height - x: Theme.horizontalPageMargin + anchors.fill: parent currentIndex: model.activeTabIndex - cellWidth: thumbnailWidth + Theme.paddingLarge - cellHeight: thumbnailHeight + Theme.paddingLarge + cellWidth: thumbnailWidth + _spacing + cellHeight: thumbnailHeight + _spacing + contentItem.anchors.left: tabGridView.left + contentItem.anchors.leftMargin: Theme.horizontalPageMargin + + header: Item { + width: 1 + height: _spacing + } delegate: TabItem { id: tabItem @@ -94,25 +99,15 @@ SilicaGridView { } ] - - Item { - height: parent.height - anchors.right: parent.right - width: Math.round(Theme.paddingSmall/2) - - VerticalScrollDecorator { - _forcedParent: parent - flickable: tabGridView - } - } + VerticalScrollDecorator {} ViewPlaceholder { x: -Theme.horizontalPageMargin width: parent.width + Theme.horizontalPageMargin enabled: !model.count || closingAllTabs //: Hint to create a new tab via button new tab. - //% "Push button plus to create a new tab" - text: qsTrId("sailfish_browser-la-push_button_plus_to_create_tab_hint") + //% "Pull down menu to create a new tab" + text: qsTrId("sailfish_browser-la-pull_menu_to_create_tab_hint") } Timer { diff --git a/apps/browser/qml/pages/components/TabView.qml b/apps/browser/qml/pages/components/TabView.qml index 422f185301ff..9eb78dcff275 100644 --- a/apps/browser/qml/pages/components/TabView.qml +++ b/apps/browser/qml/pages/components/TabView.qml @@ -21,8 +21,6 @@ SilicaControl { property bool portrait property bool privateMode property var tabModel - property alias scaledPortraitHeight: tabsToolBar.scaledPortraitHeight - property alias scaledLandscapeHeight: tabsToolBar.scaledLandscapeHeight signal hide signal enterNewTabUrl @@ -42,12 +40,9 @@ SilicaControl { Private.TabView { id: tabs - anchors { - fill: parent - bottomMargin: tabsToolBar.height - } + anchors.fill: parent - header: Private.TabBar { + footer: Private.TabBar { id: headerTabs model: modeModel delegate: Private.TabButton { @@ -113,18 +108,43 @@ SilicaControl { portrait: tabView.portrait model: tabItem.privateMode ? webView.privateTabModel : webView.persistentTabModel - header: Item { - width: 1 - height: Theme.paddingLarge - } onHide: tabView.hide() - onEnterNewTabUrl: tabView.enterNewTabUrl() onActivateTab: tabView.activateTab(index) onCloseTab: tabView.closeTab(index) onCloseAll: tabView.closeAll() onCloseAllCanceled: tabView.closeAllCanceled() onCloseAllPending: tabView.closeAllPending() + + PullDownMenu { + MenuItem { + visible: tabView.showCloseAllAction.value && model.count + //% "Close all tabs" + text: qsTrId("sailfish_browser-me-close_all") + onClicked: _tabView.closeAllTabs() + } + MenuItem { + text: tabItem.privateMode + //% "New tab" + ? qsTrId("sailfish_browser-la-new_tab") + //% "New private tab" + : qsTrId("sailfish_browser-la-new_private_tab") + onClicked: { + // remove binding to block animation + tabs.currentIndex = tabs.currentIndex + tabView.privateMode = !tabItem.privateMode + tabView.enterNewTabUrl() + } + } + MenuItem { + text: tabItem.privateMode + //% "New private tab" + ? qsTrId("sailfish_browser-la-new_private_tab") + //% "New tab" + : qsTrId("sailfish_browser-la-new_tab") + onClicked: tabView.enterNewTabUrl() + } + } } onIsCurrentItemChanged: { @@ -134,14 +154,6 @@ SilicaControl { } } - Connections { - target: popupMenu - onCloseAllTabs: { - if (isCurrentItem) - _tabView.closeAllTabs() - } - } - PrivateModeTexture { visible: privateMode z: -1 @@ -167,91 +179,6 @@ SilicaControl { } } - TabsToolBar { - id: tabsToolBar - anchors.bottom: parent.bottom - onBack: pageStack.pop() - onEnterNewTabUrl: tabView.enterNewTabUrl() - onOpenMenu: popupMenu.active = true - } - - PopUpMenu { - id: popupMenu - - signal closeAllTabs - - anchors.fill: parent - active: false - - menuItem: Component { - Item { - id: menuItem_ - readonly property int iconWidth: Theme.iconSizeMedium + Theme.paddingLarge - readonly property int verticalPadding: 3 * Theme.paddingSmall - - height: content.height + verticalPadding * 2 - - Column { - id: content - - y: verticalPadding - width: parent.width - spacing: Theme.paddingLarge - - Column { - width: parent.width - - OverlayListItem { - height: Theme.itemSizeSmall - iconWidth: menuItem_.iconWidth - iconSource: "image://theme/icon-m-tab-new" - enabled: !_closingAllTabs - //% "New tab" - text: qsTrId("sailfish_browser-la-new_tab") - onClicked: { - popupMenu.visible = false - // override to block animation - tabs.currentIndex = privateMode ? 1 : 0 - tabView.privateMode = false - tabView.enterNewTabUrl() - } - } - - OverlayListItem { - height: Theme.itemSizeSmall - iconWidth: menuItem_.iconWidth - iconSource: "image://theme/icon-m-incognito-new" - enabled: !_closingAllTabs - //% "New private tab" - text: qsTrId("sailfish_browser-la-new_private_tab") - onClicked: { - popupMenu.visible = false - // override to block animation - tabs.currentIndex = privateMode ? 1 : 0 - tabView.privateMode = true - tabView.enterNewTabUrl() - } - } - - OverlayListItem { - height: Theme.itemSizeSmall - iconWidth: menuItem_.iconWidth - iconSource: "image://theme/icon-m-tab-close" - enabled: showCloseAllAction.value && webView.tabModel.count && !_closingAllTabs - //% "Close all tabs" - text: qsTrId("sailfish_browser-me-close_all") - onClicked: { - popupMenu.active = false - popupMenu.closeAllTabs() - } - } - } - } - } - } - onClosed: active = false - } - ConfigurationValue { id: showCloseAllAction key: "/apps/sailfish-browser/settings/show_close_all"