aerothemeplasma/Plasma/Plasma Widgets/User/Start Menu/SevenStart/contents/ui/MenuRepresentation.qml

1294 lines
49 KiB
QML
Raw Normal View History

2021-07-16 19:33:52 +00:00
/***************************************************************************
* Copyright (C) 2014 by Weng Xuetian <wengxt@gmail.com>
* Copyright (C) 2013-2017 by Eike Hein <hein@kde.org> *
* *
* 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 QtQuick.Controls 1.1
import QtQuick.Controls.Styles 1.1
import QtQuick.Layouts 1.1
import QtQuick.Window 2.1
import org.kde.plasma.plasmoid 2.0
import org.kde.plasma.core 2.0 as PlasmaCore
import org.kde.plasma.components 2.0 as PlasmaComponents
import org.kde.plasma.extras 2.0 as PlasmaExtras
import org.kde.plasma.private.kicker 0.1 as Kicker
import org.kde.kcoreaddons 1.0 as KCoreAddons // kuser
import org.kde.plasma.private.shell 2.0
import org.kde.kwindowsystem 1.0
import QtGraphicalEffects 1.0
import org.kde.kquickcontrolsaddons 2.0
import org.kde.plasma.private.quicklaunch 1.0
import QtQuick.Dialogs 1.2
2021-07-16 19:33:52 +00:00
PlasmaCore.Dialog {
id: root
objectName: "popupWindow"
flags: Qt.WindowStaysOnTopHint
//location: kicker.location;
location: "Floating"
2022-04-19 20:04:22 +00:00
//backgroundHints: PlasmaCore.Types.SolidBackground
//color: "red";
2022-04-19 20:04:22 +00:00
//clip: true
2021-07-16 19:33:52 +00:00
hideOnWindowDeactivate: true
property int iconSize: units.iconSizes.medium
property int iconSizeSide: units.iconSizes.smallMedium
2022-04-19 20:04:22 +00:00
property int cellWidth: units.gridUnit * 14
property int cellWidthSide: units.gridUnit * 8
2022-04-19 20:04:22 +00:00
property int cellHeight: iconSize + units.smallSpacing + (Math.max(highlightItemSvg.margins.top + highlightItemSvg.margins.bottom,
2021-07-16 19:33:52 +00:00
highlightItemSvg.margins.left + highlightItemSvg.margins.right))
property bool searching: (searchField.text != "")
property bool showingAllPrograms: false
property int slideAnimationDuration: 105
2021-07-16 19:33:52 +00:00
2022-04-19 20:04:22 +00:00
2021-07-16 19:33:52 +00:00
onVisibleChanged: {
var pos = popupPosition(width, height);
x = pos.x;
y = pos.y;
2021-07-16 19:33:52 +00:00
if (!visible) {
reset();
} else {
requestActivate();
2022-04-19 20:04:22 +00:00
resetRecents();
2021-07-16 19:33:52 +00:00
}
}
onHeightChanged: {
var pos = popupPosition(width, height);
x = pos.x;
y = pos.y;
}
onWidthChanged: {
var pos = popupPosition(width, height);
x = pos.x;
y = pos.y;
}
onSearchingChanged: {
if (searching) {
//pageList.model = runnerModel;
2021-07-16 19:33:52 +00:00
} else {
reset();
}
}
2022-04-19 20:04:22 +00:00
function resetRecents() {
recents.model = rootModel.modelForRow(0);
recents.model.refresh();
recents.currentIndex = -1;
}
2021-07-16 19:33:52 +00:00
function reset() {
if (!searching) {
//pageList.model = rootModel.modelForRow(0);
//pageList.currentIndex = 1;
2021-07-16 19:33:52 +00:00
}
searchField.text = "";
2022-04-19 20:04:22 +00:00
//resetRecents();
//pageListScrollArea.focus = true;
//pageList.currentItem.itemGrid.currentIndex = -1;
2021-07-16 19:33:52 +00:00
}
function popupPosition(width, height) {
var screenAvail = plasmoid.availableScreenRect;
var screen/*Geom*/ = plasmoid.screenGeometry;
2021-07-16 19:33:52 +00:00
//QtBug - QTBUG-64115
/*var screen = Qt.rect(screenAvail.x + screenGeom.x,
screenAvail.y + screenGeom.y,
screenAvail.width,
screenAvail.height);*/
2021-07-16 19:33:52 +00:00
var offset = 0;
2021-07-16 19:33:52 +00:00
// Fall back to bottom-left of screen area when the applet is on the desktop or floating.
var x = offset;
var y = screen.height - height - offset;
var horizMidPoint = screen.x + (screen.width / 2);
var vertMidPoint = screen.y + (screen.height / 2);
var appletTopLeft = kicker.mapToGlobal(0, 0);
var appletBottomLeft = kicker.mapToGlobal(0, kicker.height);
x = (appletTopLeft.x < horizMidPoint) ? screen.x : (screen.x + screen.width) - width;
if (appletTopLeft.x < horizMidPoint) {
x += offset
} else if (appletTopLeft.x + width > horizMidPoint){
x -= offset
}
if (plasmoid.location == PlasmaCore.Types.TopEdge) {
/*this is floatingAvatar.width*/
offset = 2;
y = screen.y + parent.height + panelSvg.margins.bottom + offset;
} else {
offset = 2;
y = screen.y + screen.height - parent.height - height - panelSvg.margins.top - offset;
}
2021-07-16 19:33:52 +00:00
return Qt.point(x, y);
}
FocusScope {
2022-04-19 20:04:22 +00:00
2021-07-16 19:33:52 +00:00
//clip: true
Layout.minimumWidth: root.cellWidth + root.cellWidthSide// + units.smallSpacing*3
Layout.maximumWidth: root.cellWidth + root.cellWidthSide// + units.smallSpacing*3
Layout.minimumHeight: (cellHeight * plasmoid.configuration.numberRows) + searchField.height + units.iconSizes.smallMedium
Layout.maximumHeight: (cellHeight * plasmoid.configuration.numberRows) + searchField.height + units.iconSizes.smallMedium
2021-07-16 19:33:52 +00:00
focus: true
KCoreAddons.KUser { id: kuser }
Logic { id: logic }
Connections {
target: plasmoid.configuration
onNumberRowsChanged: {
recents.model = rootModel.modelForRow(0);
2022-04-19 20:04:22 +00:00
recents.model.refresh();
}
}
2022-04-19 20:04:22 +00:00
2021-07-16 19:33:52 +00:00
PlasmaCore.DataSource {
id: pmEngine
engine: "powermanagement"
connectedSources: ["PowerDevil", "Sleep States"]
function performOperation(what) {
var service = serviceForSource("PowerDevil")
var operation = service.operationDescription(what)
service.startOperationCall(operation)
}
}
PlasmaCore.DataSource {
id: executable
engine: "executable"
connectedSources: []
onNewData: {
var exitCode = data["exit code"]
var exitStatus = data["exit status"]
var stdout = data["stdout"]
var stderr = data["stderr"]
exited(sourceName, exitCode, exitStatus, stdout, stderr)
disconnectSource(sourceName)
}
function exec(cmd) {
if (cmd) {
connectSource(cmd)
}
}
signal exited(string cmd, int exitCode, int exitStatus, string stdout, string stderr)
}
PlasmaComponents.Highlight {
id: delegateHighlight
visible: false
z: -1 // otherwise it shows ontop of the icon/label and tints them slightly
}
PlasmaExtras.Heading {
id: dummyHeading
visible: false
width: 0
level: 5
}
TextMetrics {
id: headingMetrics
font: dummyHeading.font
}
ActionMenu {
id: actionMenu
onActionClicked: visualParent.actionTriggered(actionId, actionArgument)
onClosed: {
/*if (pageList.currentItem) {
2021-07-16 19:33:52 +00:00
pageList.currentItem.itemGrid.currentIndex = -1;
}*/
2021-07-16 19:33:52 +00:00
}
}
Rectangle {
id: backgroundRect
//anchors.fill: pageListScrollArea
anchors.top: faves.top
anchors.topMargin: -4
anchors.left: faves.left
//anchors.leftMargin: units.smallSpacing
2021-07-16 19:33:52 +00:00
width: root.cellWidth
2022-04-19 20:04:22 +00:00
height: (root.cellHeight * plasmoid.configuration.numberRows) + searchBackground.height + 2
2021-07-16 19:33:52 +00:00
color: "white"
border.color: "#44000000"
border.width: 1
2021-07-16 19:33:52 +00:00
radius: 3
z: 5
Behavior on width {
NumberAnimation { easing.type: Easing.Linear; duration: slideAnimationDuration }
//NumberAnimation { duration: 1000 }
}
Rectangle {
id: backgroundBorderLine
color: "#cddbea"
radius: 3
anchors {
top: searchBackground.top
topMargin: 1
//bottomMargin: units.smallSpacing
left: parent.left
leftMargin: 1
}
width: backgroundRect.width-2
height: 2
//height: backgroundRect
z: 5
}
Rectangle {
id: searchBackground
Behavior on width {
NumberAnimation { easing.type: Easing.Linear; duration: slideAnimationDuration }
//NumberAnimation { duration: 1000 }
}
color: "#F3F7FB"
radius: 3
anchors {
bottom: parent.bottom
bottomMargin: units.smallSpacing-2
left: parent.left
leftMargin: 1
}
width: root.cellWidth - 2
2022-04-19 20:04:22 +00:00
height: searchField.height + units.smallSpacing * 4.5 - 2
2021-07-16 19:33:52 +00:00
}
}
FavoritesView {
id: faves
anchors.left: parent.left
anchors.top: parent.top
2022-04-19 20:04:22 +00:00
anchors.topMargin: 6
anchors.leftMargin: 2
//anchors.bottom: pageListScrollAreabottom
//anchors.right: pageListScrollArea.right
width: root.cellWidth
height: plasmoid.configuration.showRecentsView ? ((root.cellHeight * (faves.getFavoritesCount() > 9 ? 9 : faves.getFavoritesCount())) - units.smallSpacing * 2) : (root.cellHeight * plasmoid.configuration.numberRows - units.smallSpacing*2 - allProgramsButton.height - allProgramsSeparator.height)
visible: !showingAllPrograms && !searching
z: 8
}
Rectangle {
id: tabBarSeparator
anchors.top: faves.bottom
2022-04-19 20:04:22 +00:00
//anchors.topMargin: units.smallSpacing
anchors.left: parent.left
2022-04-19 20:04:22 +00:00
anchors.leftMargin: units.smallSpacing*4+2
anchors.right: faves.right
anchors.rightMargin: units.smallSpacing*4
height: 1
color: "#d6e5f5"
opacity: 1
visible: plasmoid.configuration.showRecentsView && (!showingAllPrograms && !searching)
z: 6
}
OftenUsedView {
id: recents
anchors.left: parent.left
anchors.top: faves.bottom
anchors.topMargin: units.smallSpacing*2
anchors.bottomMargin: units.smallSpacing
2022-04-19 20:04:22 +00:00
anchors.leftMargin: 3
width: root.cellWidth-2
height: (root.cellHeight * plasmoid.configuration.numberRows) - (root.cellHeight * (faves.getFavoritesCount() > 9 ? 9 : faves.getFavoritesCount())) - units.smallSpacing*2 - allProgramsButton.height
visible: plasmoid.configuration.showRecentsView && (!showingAllPrograms && !searching)
z: 8
}
Rectangle {
id: allProgramsSeparator
anchors.top: plasmoid.configuration.showRecentsView ? recents.bottom : faves.bottom
//anchors.topMargin: units.smallSpacing
anchors.left: parent.left
2022-04-19 20:04:22 +00:00
anchors.leftMargin: units.smallSpacing*4+2
//anchors.right: faves.right
anchors.rightMargin: units.smallSpacing*4
width: root.cellWidth - units.smallSpacing*8
Behavior on width {
NumberAnimation { easing.type: Easing.Linear; duration: slideAnimationDuration }
}
height: 1
color: "#d6e5f5"
opacity: 1
//visible: !showingAllPrograms && !searching
z: 6
}
MouseArea {
id: allButtonsArea
hoverEnabled: true
anchors.top: plasmoid.configuration.showRecentsView ? recents.bottom : faves.bottom
2022-04-19 20:04:22 +00:00
anchors.topMargin: units.smallSpacing-1
anchors.left: parent.left
2022-04-19 20:04:22 +00:00
anchors.leftMargin: units.smallSpacing +2
anchors.rightMargin: units.smallSpacing
onClicked: {
if(searching)
{
searchField.text = "";
//searching = false;
console.log("stopped searching");
}
else if(showingAllPrograms)
{
showingAllPrograms = false;
appsView.reset();
console.log("showing normal view");
}
else if(!searching && !showingAllPrograms)
{
showingAllPrograms = true;
console.log("showing all apps");
}
}
height: 25
width: root.cellWidth - units.smallSpacing*2
Behavior on width {
NumberAnimation { easing.type: Easing.Linear; duration: slideAnimationDuration }
}
z: 8
PlasmaCore.FrameSvgItem {
id : allProgramsButton
//visible: true
anchors.fill: parent
2022-04-19 20:04:22 +00:00
imagePath: "widgets/menuitem"
prefix: "hover"
visible: allButtonsArea.containsMouse ? true : false
//z:7
2021-07-16 19:33:52 +00:00
}
PlasmaCore.SvgItem {
id: arrowDirection
svg: arrowsSvg
elementId: (searching || showingAllPrograms) ? "left-arrow" : "right-arrow"
anchors.left: parent.left
anchors.verticalCenter: parent.verticalCenter
anchors.leftMargin: units.smallSpacing
width: 16
height: 16
Colorize {
anchors.fill: arrowDirection
source: arrowDirection
hue: 0.0
saturation: 0.0
lightness: -0.6
}
}
Text {
text: showingAllPrograms || searching ? "Back" : "All programs"
font.pixelSize: 12
//color: searching ? "#202020" : "white"
anchors.left: arrowDirection.right
anchors.leftMargin: units.smallSpacing
//anchors.horizontalCenter: parent.horizontalCenter
anchors.verticalCenter: parent.verticalCenter
}
2021-07-16 19:33:52 +00:00
}
SearchView {
id: searchView
anchors.top: parent.top
2022-04-19 20:04:22 +00:00
anchors.topMargin: units.smallSpacing*2 -2
anchors.left: parent.left
2022-04-19 20:04:22 +00:00
anchors.leftMargin: 2
anchors.right: parent.right
2022-04-19 20:04:22 +00:00
anchors.rightMargin: 2
anchors.bottom: allProgramsSeparator.top
height: root.cellHeight * plasmoid.configuration.numberRows - units.smallSpacing*2 - allProgramsButton.height
//Layout.fillWidth: true
opacity: 0
Behavior on opacity {
NumberAnimation { easing.type: Easing.InOutQuart; duration: 150 }
}
z: 7
//visible: !showingAllPrograms && searching
}
ApplicationsView {
id: appsView
anchors.top: parent.top
2022-04-19 20:04:22 +00:00
anchors.topMargin: 2
anchors.left: parent.left
2022-04-19 20:04:22 +00:00
anchors.leftMargin: 2
anchors.right: faves.right
width: root.cellWidth
height: (root.cellHeight * plasmoid.configuration.numberRows) - units.smallSpacing*2 - allProgramsButton.height
opacity: 0
z: 1
function resetIndex() {
appsView.listView.currentIndex = -1;
}
}
states: [
2021-07-16 19:33:52 +00:00
State {
name: "AllPrograms"; when: !searching && showingAllPrograms
PropertyChanges {
target: faves; opacity: 0;
2021-07-16 19:33:52 +00:00
}
PropertyChanges {
target: recents; opacity: 0;
2021-07-16 19:33:52 +00:00
}
PropertyChanges {
target: tabBarSeparator; opacity: 0;
2021-07-16 19:33:52 +00:00
}
PropertyChanges {
target: appsView; opacity: 1;
2021-07-16 19:33:52 +00:00
}
PropertyChanges {
target: appsView; z: 7;
2021-07-16 19:33:52 +00:00
}
StateChangeScript {
script: appsView.resetIndex();
//target: appsView.applicationsView.listView; currentIndex: -1;
2021-07-16 19:33:52 +00:00
}
},
State {
name: "Searching"; when: searching// && !showingAllPrograms
PropertyChanges {
target: searchView; opacity: (backgroundRect.width === searchView.width ? 1 : 0);
}
PropertyChanges {
target: faves; opacity: 0;
}
PropertyChanges {
target: recents; opacity: 0;
}
PropertyChanges {
target: tabBarSeparator; opacity: 0;
}
PropertyChanges {
target: searchBackground; width: searchView.width - units.smallSpacing;
}
PropertyChanges {
target: backgroundRect; width: searchView.width;
}
PropertyChanges {
target: allProgramsButton; width: searchView.width - units.smallSpacing*2;
}
PropertyChanges {
target: allProgramsSeparator; width: searchView.width - units.smallSpacing*8;
}
PropertyChanges {
target: allButtonsArea; width: searchView.width - units.smallSpacing*2;
2021-07-16 19:33:52 +00:00
}
PropertyChanges {
target: sidePanel; opacity: 0;
}
/*PropertyChanges {
target: appsView; opacity: 0;
}*/
PropertyChanges {
target: sidePanel; enabled: false
}
/*PropertyChanges {
target: searchBackground; width: searchView.width
}*/
2021-07-16 19:33:52 +00:00
}
]
transitions: [
Transition {
PropertyAnimation { properties: "opacity"; easing.type: Easing.InOutQuad; duration: 100 }
2021-07-16 19:33:52 +00:00
}
/*Transition {
NumberAnimation { properties: "width"; easing.type: Easing.OutQuad; duration: 250 }
}*/
]
PlasmaComponents.TextField {
2021-07-16 19:33:52 +00:00
id: searchField
anchors{
//top: leaveButtons.top
bottom: parent.bottom
bottomMargin: units.smallSpacing * 2.5
2021-07-16 19:33:52 +00:00
left: parent.left
right: faves.right// + units.largeSpacing
rightMargin: units.smallSpacing * 2
2022-04-19 20:04:22 +00:00
leftMargin: units.smallSpacing * 2 + 2
2021-07-16 19:33:52 +00:00
}
style: TextFieldStyle {
textColor: "black"
placeholderTextColor: "#707070"
font.italic: searchField.length == 0 ? true : false
2021-07-16 19:33:52 +00:00
Rectangle {
anchors.fill: parent
color: "white" }
}
z: 7
//clearButtonShown: true
2022-04-19 20:04:22 +00:00
width: root.cellWidth - units.smallSpacing * 4 - 2
height: units.smallSpacing * 7 - units.smallSpacing
2021-07-16 19:33:52 +00:00
placeholderText: i18n("Search programs and files")
text: ""
onTextChanged: {
searchView.onQueryChanged();
//runnerModel.query = text;
2021-07-16 19:33:52 +00:00
}
Keys.onPressed: {
if(searching)
{
var currentView = searchView;
switch(event.key) {
case Qt.Key_Up: {
currentView.decrementCurrentIndex();
event.accepted = true;
break;
}
case Qt.Key_Down: {
currentView.incrementCurrentIndex();
event.accepted = true;
break;
}
/*case Qt.Key_Left: {
if (searchField.focus && header.state == "query") {
break;
}
if (!currentView.deactivateCurrentIndex()) {
if (root.state == "Applications") {
mainTabGroup.currentTab = firstButton.tab;
tabBar.currentTab = firstButton;
2021-07-16 19:33:52 +00:00
}
root.state = "Normal"
}
event.accepted = true;
break;
}
case Qt.Key_Right: {
if (header.input.focus && header.state == "query") {
break;
}
currentView.activateCurrentIndex();
event.accepted = true;
break;
}*/
/*case Qt.Key_Tab: {
root.state == "Applications" ? root.state = "Normal" : root.state = "Applications";
event.accepted = true;
break;
}*/
case Qt.Key_Enter:
case Qt.Key_Return: {
currentView.activateCurrentIndex(1);
event.accepted = true;
break;
}
default:
if (!searchField.focus) {
searchField.forceActiveFocus();
}
}
2021-07-16 19:33:52 +00:00
}
}
function backspace() {
if (!root.visible) {
return;
}
focus = true;
text = text.slice(0, -1);
}
function appendText(newText) {
if (!root.visible) {
return;
}
focus = true;
text = text + newText;
}
}
Item{
id: sidePanel
//width: root.cellWidthSide
//height: parent.height
z: 7
2021-07-16 19:33:52 +00:00
anchors{
left: faves.right
2021-07-16 19:33:52 +00:00
right: parent.right
top: parent.top
bottom: parent.bottom
bottomMargin: units.largeSpacing
leftMargin: units.smallSpacing * 2
2021-07-16 19:33:52 +00:00
rightMargin: units.smallSpacing
}
FileDialog {
id: folderDialog
visible: false
folder: shortcuts.pictures
function getPath(val){
if(val === 1)
return shortcuts.pictures
else if (val === 2)
return shortcuts.documents
else if (val === 3)
return shortcuts.music
else if (val === 4)
return shortcuts.home
else if (val === 5)
return shortcuts.movies
else if (val === 6)
return "~/Downloads"
else if (val === 7)
return "/"
2021-07-16 19:33:52 +00:00
}
}
Rectangle{
id: iconUser
height: units.iconSizes.huge
width: height
color: "transparent"
clip: true
//anchors.left: parent.width
2021-07-16 19:33:52 +00:00
anchors.leftMargin: units.smallSpacing
anchors.top: parent.top
anchors.topMargin: -units.smallSpacing
2021-07-16 19:33:52 +00:00
anchors.horizontalCenter: parent.horizontalCenter
// Image {
Image {
source: "../pics/user.png"
smooth: true
z: 1
//anchors.fill: parent
anchors.left: parent.left
//anchors.leftMargin: -units.smallSpacing*2.2
2021-07-16 19:33:52 +00:00
anchors.right: parent.right
//anchors.rightMargin: -units.smallSpacing*2.2
2021-07-16 19:33:52 +00:00
anchors.bottom: parent.bottom
//anchors.bottomMargin: -units.smallSpacing*1.7
2021-07-16 19:33:52 +00:00
anchors.top: parent.top
//anchors.topMargin: -units.smallSpacing*2.2
2021-07-16 19:33:52 +00:00
//width: parent.width + units.smallSpacing * 2
//height: parent.height + units.smallSpacing * 2
}
PlasmaCore.IconItem {
id: imgAuthor
anchors.top: parent.top
anchors.left: parent.left
anchors.right: parent.right
anchors.bottom: parent.bottom
anchors.topMargin: 2
anchors.leftMargin: 2
anchors.rightMargin: 2
anchors.bottomMargin: 2
2021-07-16 19:33:52 +00:00
source: kuser.faceIconUrl.toString() || "user-identity"
smooth: true
2021-07-16 19:33:52 +00:00
visible: false
usesPlasmaTheme: false
}
OpacityMask {
anchors.fill: imgAuthor
source: imgAuthor
maskSource: Rectangle {
width: imgAuthor.width
height: imgAuthor.height
//radius: iconUser.width*0.5
2021-07-16 19:33:52 +00:00
visible: false
}
}
MouseArea{
anchors.fill: parent
acceptedButtons: Qt.LeftButton
onPressed: {
root.visible = false;
KCMShell.open("kcm_users")
}
2022-04-19 20:04:22 +00:00
cursorShape: Qt.PointingHandCursor
2021-07-16 19:33:52 +00:00
}
}
ColumnLayout {
id: columnItems
spacing: 3
//spacing: units.smallSpacing
2021-07-16 19:33:52 +00:00
anchors.top: iconUser.bottom
anchors.topMargin: units.largeSpacing
2022-04-19 20:04:22 +00:00
//anchors.bottom: parent.bottom
2021-07-16 19:33:52 +00:00
anchors.left: parent.left
2022-04-19 20:04:22 +00:00
//anchors.right: parent.right
width: parent.width
2021-07-16 19:33:52 +00:00
ListDelegate {
text: kuser.loginName
2021-07-16 19:33:52 +00:00
//highlight: delegateHighlight
icon: "user-home"
size: iconSizeSide + units.smallSpacing / 1.5 + 1
2022-04-19 20:04:22 +00:00
anchors.left: parent.left;
anchors.right: parent.right;
PlasmaCore.FrameSvgItem {
id: homeFrame
z: -1
2021-07-16 19:33:52 +00:00
property bool hovered: false
opacity: hovered ? 1.0 : 0.0
//visible: true
2022-04-19 20:04:22 +00:00
anchors.fill: parent
imagePath: "widgets/sidebaritem"
prefix: "menuitem"
}
MouseArea {
2021-07-16 19:33:52 +00:00
enabled: !root.hoverDisabled
acceptedButtons: Qt.LeftButton
onEntered: {
homeFrame.hovered = true
2021-07-16 19:33:52 +00:00
}
onExited: {
homeFrame.hovered = false
2021-07-16 19:33:52 +00:00
}
onClicked: {
root.visible = false;
executable.exec("dolphin --new-window "+folderDialog.getPath(4))
}
hoverEnabled: true
anchors.fill: parent
}
}
ListDelegate {
text: "Documents"
2022-04-19 20:04:22 +00:00
anchors.left: parent.left;
anchors.right: parent.right;
PlasmaCore.FrameSvgItem {
id: documentsFrame
z: -1
2021-07-16 19:33:52 +00:00
property bool hovered: false
opacity: hovered ? 1.0 : 0.0
//visible: true
anchors.fill: parent
imagePath: "widgets/sidebaritem"
prefix: "menuitem"
}
MouseArea {
2021-07-16 19:33:52 +00:00
enabled: !root.hoverDisabled
acceptedButtons: Qt.LeftButton
onEntered: {
documentsFrame.hovered = true
2021-07-16 19:33:52 +00:00
}
onExited: {
documentsFrame.hovered = false
2021-07-16 19:33:52 +00:00
}
onClicked: {
root.visible = false;
executable.exec("dolphin --new-window "+folderDialog.getPath(2))
}
hoverEnabled: true
anchors.fill: parent
}
icon: "folder-documents"
size: iconSizeSide + units.smallSpacing / 1.5 + 1
2021-07-16 19:33:52 +00:00
//onClicked: executable.exec("dolphin --new-window "+folderDialog.getPath(2))
}
ListDelegate {
text: "Pictures"
2022-04-19 20:04:22 +00:00
anchors.left: parent.left;
anchors.right: parent.right;
PlasmaCore.FrameSvgItem {
id: picturesFrame
z: -1
property bool hovered: false
opacity: hovered ? 1.0 : 0.0
//visible: true
anchors.fill: parent
imagePath: "widgets/sidebaritem"
prefix: "menuitem"
}
MouseArea {
enabled: !root.hoverDisabled
acceptedButtons: Qt.LeftButton
onEntered: {
picturesFrame.hovered = true
}
onExited: {
picturesFrame.hovered = false
}
onClicked: {
root.visible = false;
executable.exec("dolphin --new-window "+folderDialog.getPath(1))
}
hoverEnabled: true
anchors.fill: parent
}
icon: "folder-pictures"
size: iconSizeSide + units.smallSpacing / 1.5 + 1
//onClicked: executable.exec("dolphin --new-window "+folderDialog.getPath(1))
}
2021-07-16 19:33:52 +00:00
ListDelegate {
2022-04-19 20:04:22 +00:00
2021-07-16 19:33:52 +00:00
text: "Music"
2022-04-19 20:04:22 +00:00
anchors.left: parent.left;
anchors.right: parent.right;
PlasmaCore.FrameSvgItem {
id: musicFrame
z: -1
2021-07-16 19:33:52 +00:00
property bool hovered: false
opacity: hovered ? 1.0 : 0.0
//visible: true
anchors.fill: parent
imagePath: "widgets/sidebaritem"
prefix: "menuitem"
}
MouseArea {
2021-07-16 19:33:52 +00:00
enabled: !root.hoverDisabled
acceptedButtons: Qt.LeftButton
onEntered: {
musicFrame.hovered = true
2021-07-16 19:33:52 +00:00
}
onExited: {
musicFrame.hovered = false
2021-07-16 19:33:52 +00:00
}
onClicked: {
root.visible = false;
executable.exec("dolphin --new-window "+folderDialog.getPath(3))
}
hoverEnabled: true
anchors.fill: parent
}
icon: "folder-music"
size: iconSizeSide + units.smallSpacing / 1.5 + 1
2021-07-16 19:33:52 +00:00
//onClicked: executable.exec("dolphin --new-window "+folderDialog.getPath(3))
}
ListDelegate {
text: "Videos"
2022-04-19 20:04:22 +00:00
anchors.left: parent.left;
anchors.right: parent.right;
PlasmaCore.FrameSvgItem {
id: videosFrame
z: -1
2021-07-16 19:33:52 +00:00
property bool hovered: false
opacity: hovered ? 1.0 : 0.0
//visible: true
anchors.fill: parent
imagePath: "widgets/sidebaritem"
prefix: "menuitem"
}
MouseArea {
2021-07-16 19:33:52 +00:00
enabled: !root.hoverDisabled
acceptedButtons: Qt.LeftButton
onEntered: {
videosFrame.hovered = true
2021-07-16 19:33:52 +00:00
}
onExited: {
videosFrame.hovered = false
2021-07-16 19:33:52 +00:00
}
onClicked: {
root.visible = false;
executable.exec("dolphin --new-window "+folderDialog.getPath(5))
2021-07-16 19:33:52 +00:00
}
hoverEnabled: true
anchors.fill: parent
}
icon: "folder-music"
size: iconSizeSide + units.smallSpacing / 1.5 + 1
//onClicked: executable.exec("dolphin --new-window "+folderDialog.getPath(5))
2021-07-16 19:33:52 +00:00
}
ListDelegate {
text: "Downloads"
2022-04-19 20:04:22 +00:00
anchors.left: parent.left;
anchors.right: parent.right;
PlasmaCore.FrameSvgItem {
id: downloadsFrame
z: -1
2021-07-16 19:33:52 +00:00
property bool hovered: false
opacity: hovered ? 1.0 : 0.0
//visible: true
anchors.fill: parent
imagePath: "widgets/sidebaritem"
prefix: "menuitem"
}
MouseArea {
2021-07-16 19:33:52 +00:00
enabled: !root.hoverDisabled
acceptedButtons: Qt.LeftButton
onEntered: {
downloadsFrame.hovered = true
2021-07-16 19:33:52 +00:00
}
onExited: {
downloadsFrame.hovered = false
2021-07-16 19:33:52 +00:00
}
onClicked: {
root.visible = false;
executable.exec("dolphin --new-window "+folderDialog.getPath(6))
}
hoverEnabled: true
anchors.fill: parent
}
icon: "folder-music"
size: iconSizeSide + units.smallSpacing / 1.5 + 1
//onClicked: executable.exec("dolphin --new-window "+folderDialog.getPath(5))
}
ListDelegate {
text: "Computer"
2022-04-19 20:04:22 +00:00
anchors.left: parent.left;
anchors.right: parent.right;
PlasmaCore.FrameSvgItem {
id: computerFrame
z: -1
property bool hovered: false
opacity: hovered ? 1.0 : 0.0
//visible: true
anchors.fill: parent
imagePath: "widgets/sidebaritem"
prefix: "menuitem"
}
MouseArea {
enabled: !root.hoverDisabled
acceptedButtons: Qt.LeftButton
onEntered: {
computerFrame.hovered = true
}
onExited: {
computerFrame.hovered = false
}
onClicked: {
root.visible = false;
executable.exec("dolphin --new-window "+folderDialog.getPath(7))
2021-07-16 19:33:52 +00:00
}
hoverEnabled: true
anchors.fill: parent
}
icon: "folder-music"
size: iconSizeSide + units.smallSpacing / 1.5 + 1
2021-07-16 19:33:52 +00:00
//onClicked: executable.exec("dolphin --new-window "+folderDialog.getPath(5))
}
ListDelegate {
text: "System Settings"
2022-04-19 20:04:22 +00:00
anchors.left: parent.left;
anchors.right: parent.right;
PlasmaCore.FrameSvgItem {
id: settingsFrame
z: -1
2021-07-16 19:33:52 +00:00
property bool hovered: false
opacity: hovered ? 1.0 : 0.0
//visible: true
anchors.fill: parent
imagePath: "widgets/sidebaritem"
prefix: "menuitem"
}
MouseArea {
2021-07-16 19:33:52 +00:00
enabled: !root.hoverDisabled
acceptedButtons: Qt.LeftButton
onEntered: {
settingsFrame.hovered = true
2021-07-16 19:33:52 +00:00
}
onExited: {
settingsFrame.hovered = false
2021-07-16 19:33:52 +00:00
}
onClicked: {
root.visible = false;
executable.exec("systemsettings5")
}
hoverEnabled: true
anchors.fill: parent
}
icon: "configure"
size: iconSizeSide + units.smallSpacing / 1.5 + 1
//onClicked: logic.openUrl("file:///usr/share/applications/systemsettings.desktop")
}
ListDelegate {
text: "Default Programs"
2022-04-19 20:04:22 +00:00
anchors.left: parent.left;
anchors.right: parent.right;
PlasmaCore.FrameSvgItem {
id: defaultProgramsFrame
z: -1
property bool hovered: false
opacity: hovered ? 1.0 : 0.0
//visible: true
anchors.fill: parent
imagePath: "widgets/sidebaritem"
prefix: "menuitem"
}
MouseArea {
enabled: !root.hoverDisabled
acceptedButtons: Qt.LeftButton
onEntered: {
defaultProgramsFrame.hovered = true
}
onExited: {
defaultProgramsFrame.hovered = false
}
onClicked: {
root.visible = false;
2022-04-19 20:04:22 +00:00
executable.exec("systemsettings5 kcm_componentchooser")
2021-07-16 19:33:52 +00:00
}
hoverEnabled: true
anchors.fill: parent
}
icon: "configure"
size: iconSizeSide + units.smallSpacing / 1.5 + 1
2021-07-16 19:33:52 +00:00
//onClicked: logic.openUrl("file:///usr/share/applications/systemsettings.desktop")
}
Item{
Layout.fillHeight: true
}
//Clock{}
Item{
height: units.smallSpacing
}
}
}
RowLayout{
2021-07-16 19:33:52 +00:00
id: leaveButtons
spacing: 0
//width: units.smallSpacing*28
//height: units.smallSpacing * 7
z: 7
anchors{
//top: leaveButtons.top
//bottom: searchField.bottom
top: searchField.top
//topMargin: -units.smallSpacing/2
//bottom: searchField.bottom
//bottomMargin: -units.smallSpacing * 3
left: searchField.right
leftMargin: units.smallSpacing*4-1
}
2022-04-19 20:04:22 +00:00
//anchors.top: searchField.top
//anchors.topMargin: searchField.topMargin
//Layout.fillWidth: false
2021-07-16 19:33:52 +00:00
ListDelegate {
//text: i18nd("plasma_lookandfeel_org.kde.lookandfeel", "Shut Down")
id: shutdown
width: units.smallSpacing * 17
height: units.smallSpacing * 6
2021-07-16 19:33:52 +00:00
Text {
text: i18nd("plasma_lookandfeel_org.kde.lookandfeel", "Shut Down")
font.pixelSize: 12
color: searching ? "#202020" : PlasmaCore.Theme.textColor
2021-07-16 19:33:52 +00:00
anchors.horizontalCenter: parent.horizontalCenter
anchors.verticalCenter: parent.verticalCenter
2022-04-19 20:04:22 +00:00
z: 5
2021-07-16 19:33:52 +00:00
}
size: iconSizeSide
PlasmaCore.FrameSvgItem {
id: shutdownButton
prefix: {
if(ma.containsPress) return "pressed";
else if(ma.containsMouse || lockma.containsMouse) return "hover";
else return "normal";
}
anchors.fill:parent
//width: parent.width + units.smallSpacing / 2
//height: parent.height - units.smallSpacing / 2
anchors.left: parent.left
imagePath: "widgets/startmenu-buttons"
}
MouseArea {
id: ma
enabled: !root.hoverDisabled
acceptedButtons: Qt.LeftButton
onClicked: {
root.visible = false;
pmEngine.performOperation("requestShutDown");
}
hoverEnabled: true
anchors.fill: parent
}
2021-07-16 19:33:52 +00:00
}
ListDelegate {
id: lockScreenDelegate
//text: i18nc("@action", "Lock Screen")
2022-04-19 20:04:22 +00:00
//width: units.smallSpacing * 8
2021-07-16 19:33:52 +00:00
anchors.left: shutdown.right
anchors.leftMargin: -1
2021-07-16 19:33:52 +00:00
anchors.top: shutdown.top
height: shutdown.height
//icon: "system-lock-screen"
PlasmaCore.FrameSvgItem {
id: lockButton
prefix: {
if(ma.containsPress || lockma.containsPress) return "rtl-pressed";
else if(ma.containsMouse || lockma.containsMouse) return "rtl-hover";
else return "rtl-normal";
}
anchors.fill: parent;
//width: parent.width / 1.5
//height: parent.height - units.smallSpacing / 2
anchors.left: parent.left
imagePath: "widgets/startmenu-buttons"
}
MouseArea {
id: lockma
enabled: !root.hoverDisabled
acceptedButtons: Qt.LeftButton
onClicked: {
root.visible = false;
pmEngine.performOperation("lockScreen")
}
hoverEnabled: true
anchors.fill: lockButton
}
2021-07-16 19:33:52 +00:00
Image {
id: lockScreenSvg
source: "../pics/system-lock-screen.svg"
2022-04-19 20:04:22 +00:00
//width: parent.height - units.smallSpacing
//height: parent.height - units.smallSpacing
//anchors.horizontalCenter: parent.horizontalCenter
2022-04-19 20:04:22 +00:00
//anchors.left: parent.left
anchors.fill: lockButton
// anchors.leftMargin: -1
2022-04-19 20:04:22 +00:00
//anchors.leftMargin: units.smallSpacing
ColorOverlay {
anchors.fill: lockScreenSvg
source: lockScreenSvg
/*hue: 0.0
saturation: 0.0
lightness: searching ? -0.5 : 1.0*/
color: searching ? "#FF202020" : PlasmaCore.Theme.textColor
}
2021-07-16 19:33:52 +00:00
}
//highlight: delegateHighlight
enabled: pmEngine.data["Sleep States"]["LockScreen"]
size: iconSizeSide
//showIcon: true
}
}
Keys.onPressed: {
if (event.key == Qt.Key_Escape) {
event.accepted = true;
if (searching) {
reset();
} else if(showingAllPrograms) {
showingAllPrograms = false;
appsView.reset();
2021-07-16 19:33:52 +00:00
} else {
root.visible = false;
}
return;
}
if (searchField.focus) {
return;
}
if (event.key == Qt.Key_Backspace) {
event.accepted = true;
searchField.backspace();
/*} else if (event.key == Qt.Key_Tab || event.key == Qt.Key_Backtab) {
2021-07-16 19:33:52 +00:00
if (pageListScrollArea.focus == true && pageList.currentItem.itemGrid.currentIndex == -1) {
event.accepted = true;
pageList.currentItem.itemGrid.tryActivate(0, 0);
}*/
2021-07-16 19:33:52 +00:00
} else if (event.text != "") {
event.accepted = true;
searchField.appendText(event.text);
}
}
}
Component.onCompleted: {
kicker.reset.connect(reset);
//dragHelper.dropped.connect(pageList.cycle);
2021-07-16 19:33:52 +00:00
reset();
faves.listView.currentIndex = -1;
var pos = popupPosition(width, height);
x = pos.x;
y = pos.y;
//root.backgroundHints = 2;
2021-07-16 19:33:52 +00:00
}
}