diff --git a/applets/kicker/package/contents/ui/DashboardTabBar.qml b/applets/kicker/package/contents/ui/DashboardTabBar.qml index 97f9efa12..66dc4cf8e 100644 --- a/applets/kicker/package/contents/ui/DashboardTabBar.qml +++ b/applets/kicker/package/contents/ui/DashboardTabBar.qml @@ -1,90 +1,93 @@ /*************************************************************************** * Copyright (C) 2016 by Eike Hein * * * * This program is free software; you can redistribute it and/or modify * * it under the terms of the GNU General Public License as published by * * the Free Software Foundation; either version 2 of the License, or * * (at your option) any later version. * * * * This program is distributed in the hope that it will be useful, * * but WITHOUT ANY WARRANTY; without even the implied warranty of * * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * * GNU General Public License for more details. * * * * You should have received a copy of the GNU General Public License * * along with this program; if not, write to the * * Free Software Foundation, Inc., * * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA . * ***************************************************************************/ import QtQuick 2.4 Row { id: tabBar property int activeTab: 0 property int hoveredTab: -1 + Accessible.role: Accessible.PageTabList signal containsMouseChanged(int index, bool containsMouse) onContainsMouseChanged: { if (containsMouse) { hoveredTab = index; } else { hoveredTab = -1; } } DashboardTabButton { id: appsdocs index: 0 text: i18n("Apps & Docs") active: (tabBar.activeTab == 0) + focus: parent.focus & active } DashboardTabButton { id: widgets index: 1 text: i18n("Widgets") active: (tabBar.activeTab == 1) + focus: parent.focus & active } Keys.onLeftPressed: { if (activeTab == 1) { activeTab = 0; } } Keys.onRightPressed: { if (activeTab == 0) { activeTab = 1; } } Keys.onPressed: { if (event.key == Qt.Key_Tab) { event.accepted = true; if (searching) { cancelSearchButton.focus = true; } else { mainColumn.tryActivate(0, 0); } } else if (event.key == Qt.Key_Backtab) { event.accepted = true; if (globalFavoritesGrid.enabled) { globalFavoritesGrid.tryActivate(0, 0); } else { systemFavoritesGrid.tryActivate(0, 0); } } } } diff --git a/applets/kicker/package/contents/ui/DashboardTabButton.qml b/applets/kicker/package/contents/ui/DashboardTabButton.qml index 7647a71fa..96348fc30 100644 --- a/applets/kicker/package/contents/ui/DashboardTabButton.qml +++ b/applets/kicker/package/contents/ui/DashboardTabButton.qml @@ -1,72 +1,74 @@ /*************************************************************************** * Copyright (C) 2016 by Eike Hein * * * * This program is free software; you can redistribute it and/or modify * * it under the terms of the GNU General Public License as published by * * the Free Software Foundation; either version 2 of the License, or * * (at your option) any later version. * * * * This program is distributed in the hope that it will be useful, * * but WITHOUT ANY WARRANTY; without even the implied warranty of * * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * * GNU General Public License for more details. * * * * You should have received a copy of the GNU General Public License * * along with this program; if not, write to the * * Free Software Foundation, Inc., * * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA . * ***************************************************************************/ import QtQuick 2.4 import org.kde.plasma.plasmoid 2.0 import org.kde.plasma.extras 2.0 as PlasmaExtras Item { id: tab width: label.contentWidth + (units.largeSpacing * 2) height: label.contentHeight + (units.smallSpacing * 2) property int index: 0 property bool active: false property alias text: label.text + Accessible.name: text + Accessible.role: Accessible.PageTab Rectangle { anchors.fill: parent color: tab.parent.focus ? theme.highlightColor : "black" opacity: active ? 0.4 : 0.15 Behavior on opacity { SmoothedAnimation { duration: units.shortDuration; velocity: 0.01 } } } PlasmaExtras.Heading { id: label x: units.largeSpacing elide: Text.ElideNone wrapMode: Text.NoWrap opacity: active ? 1.0 : 0.6 Behavior on opacity { SmoothedAnimation { duration: units.shortDuration; velocity: 0.01 } } color: tab.parent.focus ? theme.highlightedTextColor : "white" level: 1 } MouseArea { anchors.fill: parent hoverEnabled: true onClicked: { tab.parent.activeTab = tab.index; } onContainsMouseChanged: { tab.parent.containsMouseChanged(index, containsMouse); } } }