Compare commits
	
		
			2 Commits
		
	
	
		
			e56994955c
			...
			8cdb49bd83
		
	
	| Author | SHA1 | Date | |
|---|---|---|---|
| 8cdb49bd83 | |||
| 7d0d0c112b | 
| @@ -19,6 +19,9 @@ | ||||
|     with this program; if not, write to the Free Software Foundation, Inc., | ||||
|     51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. | ||||
| */ | ||||
| // module "org.kde.plasma.components" version 2.0 is not installed | ||||
|  | ||||
|  | ||||
| import QtQuick 2.3 | ||||
| import org.kde.plasma.plasmoid 2.0 | ||||
| import QtQuick.Layouts 1.1 | ||||
| @@ -26,7 +29,7 @@ import org.kde.plasma.plasmoid as PlasmaCore | ||||
| import org.kde.ksvg as KSvg | ||||
| import org.kde.plasma.plasma5support as Plasma5Support | ||||
| import org.kde.kirigami 2.20 as Kirigami | ||||
| import org.kde.plasma.components 3.0 as PlasmaComponents | ||||
| import org.kde.plasma.components as PlasmaComponents | ||||
| import org.kde.plasma.extras 2.0 as PlasmaExtras | ||||
| import org.kde.kquickcontrolsaddons 2.0 | ||||
|  | ||||
| @@ -125,187 +128,279 @@ Item { | ||||
|         id: mainArea | ||||
|         anchors.topMargin: mainTabGroup.state == "top" ? Kirigami.Units.smallSpacing : 0 | ||||
|  | ||||
|         Kirigami.Page { | ||||
|             id: mainPage | ||||
|         PlasmaComponents.TabGroup { | ||||
|             id: mainTabGroup | ||||
|             currentTab: favoritesPage | ||||
|  | ||||
|             // Set anchors | ||||
|             anchors.fill: parent | ||||
|             anchors { | ||||
|                 fill: parent | ||||
|             } | ||||
|  | ||||
|             // Create a row for the tab buttons | ||||
|             Kirigami.PageRow { | ||||
|                 id: tabRow | ||||
|             //pages | ||||
|             FavoritesView { | ||||
|                 id: favoritesPage | ||||
|             } | ||||
|             PlasmaExtras.ConditionalLoader { | ||||
|                 id: applicationsPage | ||||
|                 when: mainTabGroup.currentTab == applicationsPage | ||||
|                 source: Qt.resolvedUrl("ApplicationsView.qml") | ||||
|             } | ||||
|             PlasmaExtras.ConditionalLoader { | ||||
|                 id: systemPage | ||||
|                 when: mainTabGroup.currentTab == systemPage | ||||
|                 source: Qt.resolvedUrl("ComputerView.qml") | ||||
|             } | ||||
|             PlasmaExtras.ConditionalLoader { | ||||
|                 id: recentlyUsedPage | ||||
|                 when: mainTabGroup.currentTab == recentlyUsedPage | ||||
|                 source: Qt.resolvedUrl("RecentlyUsedView.qml") | ||||
|             } | ||||
|             PlasmaExtras.ConditionalLoader { | ||||
|                 id: oftenUsedPage | ||||
|                 when: mainTabGroup.currentTab == oftenUsedPage | ||||
|                 source: Qt.resolvedUrl("OftenUsedView.qml") | ||||
|             } | ||||
|             PlasmaExtras.ConditionalLoader { | ||||
|                 id: leavePage | ||||
|                 when: mainTabGroup.currentTab == leavePage | ||||
|                 source: Qt.resolvedUrl("LeaveView.qml") | ||||
|             } | ||||
|             PlasmaExtras.ConditionalLoader { | ||||
|                 id: searchPage | ||||
|                 when: root.state == "Search" | ||||
|                 //when: mainTabGroup.currentTab == searchPage || root.state == "Search" | ||||
|                 source: Qt.resolvedUrl("SearchView.qml") | ||||
|             } | ||||
|  | ||||
|                 // Set row orientation based on plasmoid location | ||||
|                 orientation: { | ||||
|             state: { | ||||
|                 switch (plasmoid.location) { | ||||
|                 case PlasmaCore.Types.LeftEdge: | ||||
|                     return LayoutMirroring.enabled ? "right" : "left"; | ||||
|                 case PlasmaCore.Types.TopEdge: | ||||
|                     return "top"; | ||||
|                 case PlasmaCore.Types.RightEdge: | ||||
|                             return Qt.Horizontal | ||||
|                     return LayoutMirroring.enabled ? "left" : "right"; | ||||
|                 case PlasmaCore.Types.BottomEdge: | ||||
|                 default: | ||||
|                             return Qt.Vertical | ||||
|                     return "bottom"; | ||||
|                 } | ||||
|             } | ||||
|  | ||||
|                 // Add tab buttons | ||||
|                 PlasmaComponents.Button { | ||||
|                     text: i18n("Favorites") | ||||
|                     onClicked: mainPage.currentIndex = 0 | ||||
|                 } | ||||
|                 PlasmaComponents.Button { | ||||
|                     text: i18n("Applications") | ||||
|                     onClicked: mainPage.currentIndex = 1 | ||||
|                 } | ||||
|                 PlasmaComponents.Button { | ||||
|                     text: i18n("Computer") | ||||
|                     onClicked: mainPage.currentIndex = 2 | ||||
|                 } | ||||
|                 PlasmaComponents.Button { | ||||
|                     text: i18n("Recently Used") | ||||
|                     onClicked: mainPage.currentIndex = 3 | ||||
|                 } | ||||
|                 PlasmaComponents.Button { | ||||
|                     text: i18n("Often Used") | ||||
|                     onClicked: mainPage.currentIndex = 4 | ||||
|                 } | ||||
|                 PlasmaComponents.Button { | ||||
|                     text: i18n("Leave") | ||||
|                     onClicked: mainPage.currentIndex = 5 | ||||
|                 } | ||||
|                 PlasmaComponents.Button { | ||||
|                     text: i18n("Search") | ||||
|                     onClicked: root.state = "Search" | ||||
|                 } | ||||
|             } | ||||
|  | ||||
|             // Add pages | ||||
|             Kirigami.Page { | ||||
|                 id: favoritesPage | ||||
|                 anchors.fill: parent | ||||
|                 visible: mainPage.currentIndex === 0 | ||||
|                 // Add contents of the Favorites view here | ||||
|             } | ||||
|             Kirigami.Page { | ||||
|                 id: applicationsPage | ||||
|                 anchors.fill: parent | ||||
|                 visible: mainPage.currentIndex === 1 | ||||
|                 // Add contents of the Applications view here | ||||
|             } | ||||
|             Kirigami.Page { | ||||
|                 id: computerPage | ||||
|                 anchors.fill: parent | ||||
|                 visible: mainPage.currentIndex === 2 | ||||
|                 // Add contents of the Computer view here | ||||
|             } | ||||
|             Kirigami.Page { | ||||
|                 id: recentlyUsedPage | ||||
|                 anchors.fill: parent | ||||
|                 visible: mainPage.currentIndex === 3 | ||||
|                 // Add contents of the Recently Used view here | ||||
|             } | ||||
|             Kirigami.Page { | ||||
|                 id: oftenUsedPage | ||||
|                 anchors.fill: parent | ||||
|                 visible: mainPage.currentIndex === 4 | ||||
|                 // Add contents of the Often Used view here | ||||
|             } | ||||
|             Kirigami.Page { | ||||
|                 id: leavePage | ||||
|                 anchors.fill: parent | ||||
|                 visible: mainPage.currentIndex === 5 | ||||
|                 // Add contents of the Leave view here | ||||
|             } | ||||
|             Kirigami.Page { | ||||
|                 id: searchPage | ||||
|                 anchors.fill: parent | ||||
|                 visible: root.state === "Search" | ||||
|                 // Add contents of the Search view here | ||||
|             } | ||||
|  | ||||
|             // Handle the plasmoid location states | ||||
|             states: [ | ||||
|                 State { | ||||
|                     name: "left" | ||||
|                     PropertyChanges { | ||||
|                         target: tabRow | ||||
|                         rotation: 0 | ||||
|                     AnchorChanges { | ||||
|                         target: header | ||||
|                         anchors { | ||||
|                             left: root.left | ||||
|                             top: undefined | ||||
|                             right: root.right | ||||
|                             bottom: root.bottom | ||||
|                         } | ||||
|                     } | ||||
|                     PropertyChanges { | ||||
|                         target: tabRow | ||||
|                         target: header | ||||
|                         width: header.implicitWidth | ||||
|                         location: PlasmaExtras.PlasmoidHeading.Location.Footer | ||||
|                     } | ||||
|                     AnchorChanges { | ||||
|                         target: mainArea | ||||
|                         anchors { | ||||
|                             left: parent.left | ||||
|                             top: parent.top | ||||
|                             bottom: parent.bottom | ||||
|                             left: tabBar.right | ||||
|                             top: root.top | ||||
|                             right: root.right | ||||
|                             bottom: header.top | ||||
|                         } | ||||
|                     } | ||||
|                     PropertyChanges { | ||||
|                         target: tabBar | ||||
|                         width: (tabBar.opacity == 0) ? 0 : PlasmaCore.Units.gridUnit * 5 | ||||
|                     } | ||||
|                     AnchorChanges { | ||||
|                         target: tabBar | ||||
|                         anchors { | ||||
|                             left: root.left | ||||
|                             top: root.top | ||||
|                             right: undefined | ||||
|                             bottom: header.top | ||||
|                         } | ||||
|                     } | ||||
|                     PropertyChanges { | ||||
|                         target:tabBarSeparator | ||||
|                         width: tabBarSeparatorLine.elementSize("vertical-line").width | ||||
|                         elementId: "vertical-line" | ||||
|                     } | ||||
|                     AnchorChanges { | ||||
|                         target: tabBarSeparator | ||||
|                         anchors { | ||||
|                             left: tabBar.right | ||||
|                             top: tabBar.top | ||||
|                             bottom:tabBar.bottom | ||||
|                         } | ||||
|                     } | ||||
|                 }, | ||||
|                 State { | ||||
|                     name: "top" | ||||
|                     PropertyChanges { | ||||
|                         target: tabRow | ||||
|                         rotation: -90 | ||||
|                     AnchorChanges { | ||||
|                         target: header | ||||
|                         anchors { | ||||
|                             left: root.left | ||||
|                             top: undefined | ||||
|                             right: root.right | ||||
|                             bottom: root.bottom | ||||
|                         } | ||||
|                     } | ||||
|                     PropertyChanges { | ||||
|                         target: tabRow | ||||
|                         target: header | ||||
|                         height: header.implicitHeight | ||||
|                         location: PlasmaExtras.PlasmoidHeading.Location.Footer | ||||
|                     } | ||||
|                     AnchorChanges { | ||||
|                         target: mainArea | ||||
|                         anchors { | ||||
|                             top: parent.top | ||||
|                             left: parent.left | ||||
|                             right: parent.right | ||||
|                             left: root.left | ||||
|                             top: tabBar.bottom | ||||
|                             right: root.right | ||||
|                             bottom: header.top | ||||
|                         } | ||||
|                     } | ||||
|                     PropertyChanges { | ||||
|                         target: tabBar | ||||
|                         height: (tabBar.opacity == 0) ? 0 : PlasmaCore.Units.gridUnit * 5 | ||||
|                     } | ||||
|                     AnchorChanges { | ||||
|                         target: tabBar | ||||
|                         anchors { | ||||
|                             left: root.left | ||||
|                             top: root.top | ||||
|                             right: root.right | ||||
|                             bottom: undefined | ||||
|                         } | ||||
|                     } | ||||
|                     PropertyChanges { | ||||
|                         target:tabBarSeparator | ||||
|                         height: tabBarSeparatorLine.elementSize("horizontal-line").height | ||||
|                         elementId: "horizontal-line" | ||||
|                     } | ||||
|                     AnchorChanges { | ||||
|                         target: tabBarSeparator | ||||
|                         anchors { | ||||
|                             left: tabBar.left | ||||
|                             right: tabBar.right | ||||
|                             top: tabBar.bottom | ||||
|                         } | ||||
|                     } | ||||
|                 }, | ||||
|                 State { | ||||
|                     name: "right" | ||||
|                     PropertyChanges { | ||||
|                         target: tabRow | ||||
|                         rotation: 180 | ||||
|                     AnchorChanges { | ||||
|                         target: header | ||||
|                         anchors { | ||||
|                             left: root.left | ||||
|                             top: undefined | ||||
|                             right: root.right | ||||
|                             bottom: root.bottom | ||||
|                         } | ||||
|                     } | ||||
|                     PropertyChanges { | ||||
|                         target: tabRow | ||||
|                         target: header | ||||
|                         width: header.implicitWidth | ||||
|                         location: PlasmaExtras.PlasmoidHeading.Location.Footer | ||||
|                     } | ||||
|                     AnchorChanges { | ||||
|                         target: mainArea | ||||
|                         anchors { | ||||
|                             right: parent.right | ||||
|                             top: parent.top | ||||
|                             bottom: parent.bottom | ||||
|                             left: root.left | ||||
|                             top: root.top | ||||
|                             right: tabBar.left | ||||
|                             bottom: header.top | ||||
|                         } | ||||
|                     } | ||||
|                     PropertyChanges { | ||||
|                         target: tabBar | ||||
|                         width: (tabBar.opacity == 0) ? 0 : PlasmaCore.Units.gridUnit * 5 | ||||
|                     } | ||||
|                     AnchorChanges { | ||||
|                         target: tabBar | ||||
|                         anchors { | ||||
|                             left: undefined | ||||
|                             top: root.top | ||||
|                             right: root.right | ||||
|                             bottom: header.top | ||||
|                         } | ||||
|                     } | ||||
|                     PropertyChanges { | ||||
|                         target:tabBarSeparator | ||||
|                         width: tabBarSeparatorLine.elementSize("vertical-line").width | ||||
|                         elementId: "vertical-line" | ||||
|                     } | ||||
|                     AnchorChanges { | ||||
|                         target: tabBarSeparator | ||||
|                         anchors { | ||||
|                             right: tabBar.left | ||||
|                             top: tabBar.top | ||||
|                             bottom: tabBar.bottom | ||||
|                         } | ||||
|                     } | ||||
|                 }, | ||||
|                 State { | ||||
|                     name: "bottom" | ||||
|                     PropertyChanges { | ||||
|                         target: tabRow | ||||
|                         rotation: 90 | ||||
|                     AnchorChanges { | ||||
|                         target: header | ||||
|                         anchors { | ||||
|                             left: root.left | ||||
|                             top: root.top | ||||
|                             right: root.right | ||||
|                             bottom: undefined | ||||
|                         } | ||||
|                     } | ||||
|                     PropertyChanges { | ||||
|                         target: tabRow | ||||
|                         target: header | ||||
|                         height: header.implicitHeight | ||||
|                         location: PlasmaExtras.PlasmoidHeading.Location.Header | ||||
|                     } | ||||
|                     AnchorChanges { | ||||
|                         target: mainArea | ||||
|                         anchors { | ||||
|                             bottom: parent.bottom | ||||
|                             left: parent.left | ||||
|                             right: parent.right | ||||
|                             left: root.left | ||||
|                             top: header.bottom | ||||
|                             right: root.right | ||||
|                             bottom: tabBar.top | ||||
|                         } | ||||
|                     } | ||||
|                     PropertyChanges { | ||||
|                         target: tabBar | ||||
|                         height: (tabBar.opacity == 0) ? 0 : PlasmaCore.Units.gridUnit * 5 | ||||
|                     } | ||||
|                     AnchorChanges { | ||||
|                         target: tabBar | ||||
|                         anchors { | ||||
|                             left: root.left | ||||
|                             top: undefined | ||||
|                             right: root.right | ||||
|                             bottom: root.bottom | ||||
|                         } | ||||
|                     } | ||||
|                     PropertyChanges { | ||||
|                         target:tabBarSeparator | ||||
|                         height: tabBarSeparatorLine.elementSize("horizontal-line").height | ||||
|                         elementId: "horizontal-line" | ||||
|                     } | ||||
|                     AnchorChanges { | ||||
|                         target: tabBarSeparator | ||||
|                         anchors { | ||||
|                             bottom: tabBar.top | ||||
|                             left: tabBar.left | ||||
|                             right: tabBar.right | ||||
|                         } | ||||
|                     } | ||||
|                 } | ||||
|             ] | ||||
|  | ||||
|             // Set initial plasmoid state | ||||
|             state: { | ||||
|                 switch (plasmoid.location) { | ||||
|                     case PlasmaCore.Types.LeftEdge: | ||||
|                         return "left" | ||||
|                     case PlasmaCore.Types.TopEdge: | ||||
|                         return "top" | ||||
|                     case PlasmaCore.Types.RightEdge: | ||||
|                         return "right" | ||||
|                     case PlasmaCore.Types.BottomEdge: | ||||
|                     default: | ||||
|                         return "bottom" | ||||
|                 } | ||||
|             } | ||||
|         } | ||||
|         } // mainTabGroup | ||||
|     } | ||||
|  | ||||
|     PlasmaComponents.TabBar { | ||||
|         id: tabBar | ||||
|  | ||||
|         property int count: 5 // updated in createButtons() | ||||
|         count: 5 // updated in createButtons() | ||||
|  | ||||
|         Behavior on width { | ||||
|             NumberAnimation { duration: Kirigami.Units.longDuration; easing.type: Easing.InQuad; } | ||||
|   | ||||
| @@ -23,13 +23,14 @@ import org.kde.plasma.core as PlasmaCore | ||||
| import org.kde.kirigami as Kirigami | ||||
| import org.kde.plasma.components 3.0 as PlasmaComponents | ||||
| import org.kde.plasma.extras as PlasmaExtras | ||||
| import org.kde.kcoreaddons 1.0 as KCoreAddons | ||||
| import org.kde.coreaddons 1.0 as KCoreAddons | ||||
| // While using Kirigami in applets is normally a no, we | ||||
| // use Avatar, which doesn't need to read the colour scheme | ||||
| // at all to function, so there won't be any oddities with colours. | ||||
| import org.kde.kirigami 2.13 as Kirigami | ||||
| import org.kde.kirigami 2.20 as Kirigami | ||||
| import org.kde.kirigamiaddons.components as KirigamiAddons | ||||
| import org.kde.kquickcontrolsaddons 2.0 | ||||
| import QtGraphicalEffects 1.0 | ||||
| import Qt5Compat.GraphicalEffects 1.0 | ||||
|  | ||||
| PlasmaExtras.PlasmoidHeading { | ||||
|     id: header | ||||
| @@ -81,7 +82,7 @@ PlasmaExtras.PlasmoidHeading { | ||||
|             Layout.preferredWidth: Kirigami.Units.gridUnit * 3 | ||||
|             Layout.preferredHeight: Kirigami.Units.gridUnit * 3 | ||||
|  | ||||
|             Kirigami.Avatar { | ||||
|             KirigamiAddons.Avatar { | ||||
|                 source: kuser.faceIconUrl | ||||
|                 name: nameLabel | ||||
|                 anchors { | ||||
|   | ||||
		Reference in New Issue
	
	Block a user