diff options
author | Yoann Lopes <yoann.lopes@nokia.com> | 2011-11-03 13:24:46 +0100 |
---|---|---|
committer | Yoann Lopes <yoann.lopes@nokia.com> | 2011-11-03 13:24:46 +0100 |
commit | a796452855186e3b141c9d8910b3ba4a8461b122 (patch) | |
tree | 84a0cc7e3a740039579d1f28ff410f7e2dcfb4ff | |
parent | 1136464ca13be9d517c2ce5e8540d5339b8a271f (diff) |
Clicking on the tab button of the active tab makes the first page active
-rw-r--r-- | qml/MainPage.qml | 46 |
1 files changed, 40 insertions, 6 deletions
diff --git a/qml/MainPage.qml b/qml/MainPage.qml index cfe6302..d00ead0 100644 --- a/qml/MainPage.qml +++ b/qml/MainPage.qml @@ -5,22 +5,22 @@ ** Contact: Yoann Lopes (yoann.lopes@nokia.com) ** ** This file is part of the MeeSpot project. -** +** ** Redistribution and use in source and binary forms, with or without ** modification, are permitted provided that the following conditions ** are met: -** +** ** Redistributions of source code must retain the above copyright notice, ** this list of conditions and the following disclaimer. -** +** ** Redistributions in binary form must reproduce the above copyright ** notice, this list of conditions and the following disclaimer in the ** documentation and/or other materials provided with the distribution. -** +** ** Neither the name of Nokia Corporation and its Subsidiary(-ies) nor the names of its ** contributors may be used to endorse or promote products derived from ** this software without specific prior written permission. -** +** ** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS ** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT ** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS @@ -121,20 +121,54 @@ Page { tab: playlistsTab iconSource: theme.inverted ? "image://theme/icon-m-toolbar-list-white" : "image://theme/icon-m-toolbar-list" + + property bool isCurrentTab: false + + onPressedChanged: { + if (pressed) + isCurrentTab = (tabGroup.currentTab == playlistsTab); + } + + onClicked: { + if (isCurrentTab && playlistsTab.depth > 1) + playlistsTab.pop(null); + } } TabButton { tab: searchTab iconSource: theme.inverted ? "image://theme/icon-m-toolbar-search-white" : "image://theme/icon-m-toolbar-search" - onClicked: { mainPage.checkSearchPage() } + + property bool isCurrentTab: false + + onPressedChanged: { + if (pressed) + isCurrentTab = (tabGroup.currentTab == searchTab); + } + + onClicked: { + mainPage.checkSearchPage(); + if (isCurrentTab && searchTab.depth > 1) + searchTab.pop(null); + } } TabButton { tab: toplistTab iconSource: theme.inverted ? "image://theme/icon-m-toolbar-home-white" : "image://theme/icon-m-toolbar-home" + + property bool isCurrentTab: false + + onPressedChanged: { + if (pressed) + isCurrentTab = (tabGroup.currentTab == toplistTab); + } + onClicked: { if (toplistTab.depth === 0) toplistTab.push(Qt.resolvedUrl("ToplistPage.qml")) + else if (isCurrentTab && toplistTab.depth > 1) + toplistTab.pop(null); } } TabButton { |