2021-09-29 17:10:18 +00:00
|
|
|
|
/*
|
|
|
|
|
Copyright (C) 2011 Martin Gräßlin <mgraesslin@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.0
|
|
|
|
|
import org.kde.plasma.core 2.0 as PlasmaCore
|
2024-08-09 01:20:25 +00:00
|
|
|
|
import org.kde.plasma.components 3.0 as PlasmaComponents
|
2024-01-20 02:08:06 +00:00
|
|
|
|
import org.kde.plasma.extras 2.0 as PlasmaExtras
|
2024-08-09 01:20:25 +00:00
|
|
|
|
|
|
|
|
|
import org.kde.ksvg as KSvg
|
|
|
|
|
|
|
|
|
|
import org.kde.kirigami as Kirigami
|
|
|
|
|
//import QtQuick.Controls.Styles.Plasma as Styles
|
2021-09-29 17:10:18 +00:00
|
|
|
|
|
|
|
|
|
Item {
|
|
|
|
|
id: crumbRoot
|
|
|
|
|
|
2024-08-09 01:20:25 +00:00
|
|
|
|
height: crumb.implicitHeight + Kirigami.Units.smallSpacing * 2
|
2021-09-29 17:10:18 +00:00
|
|
|
|
width: crumb.implicitWidth + arrowSvg.width
|
|
|
|
|
|
|
|
|
|
property string text
|
|
|
|
|
property bool root: false
|
|
|
|
|
property int depth: model.depth
|
|
|
|
|
|
|
|
|
|
function clickCrumb() {
|
2024-01-20 02:08:06 +00:00
|
|
|
|
heading_ma.clicked(null);
|
2021-09-29 17:10:18 +00:00
|
|
|
|
}
|
|
|
|
|
|
2024-01-20 02:08:06 +00:00
|
|
|
|
PlasmaExtras.Heading {
|
|
|
|
|
id: crumb
|
|
|
|
|
anchors {
|
|
|
|
|
left: arrowSvg.right
|
|
|
|
|
top: parent.top
|
|
|
|
|
bottom: parent.bottom
|
2024-08-09 01:20:25 +00:00
|
|
|
|
topMargin: Kirigami.Units.smallSpacing
|
|
|
|
|
leftMargin: Kirigami.Units.smallSpacing
|
|
|
|
|
bottomMargin: Kirigami.Units.smallSpacing
|
2024-01-20 02:08:06 +00:00
|
|
|
|
}
|
|
|
|
|
horizontalAlignment: Text.AlignHCenter
|
|
|
|
|
text: crumbRoot.text + " "
|
|
|
|
|
color: "#404040"
|
|
|
|
|
font.underline: heading_ma.enabled && heading_ma.containsMouse
|
|
|
|
|
level: 5
|
2021-09-29 17:10:18 +00:00
|
|
|
|
|
2024-01-20 02:08:06 +00:00
|
|
|
|
MouseArea {
|
|
|
|
|
id: heading_ma
|
2023-08-24 22:32:11 +00:00
|
|
|
|
anchors.fill: parent
|
2024-01-20 02:08:06 +00:00
|
|
|
|
hoverEnabled: crumbRoot.depth < crumbModel.count
|
|
|
|
|
enabled: crumbRoot.depth < crumbModel.count
|
|
|
|
|
onClicked: {
|
|
|
|
|
// Remove all the breadcrumbs in front of the clicked one
|
|
|
|
|
while (crumbModel.count > 0 && crumbRoot.depth < crumbModel.get(crumbModel.count-1).depth) {
|
|
|
|
|
crumbModel.remove(crumbModel.count-1)
|
|
|
|
|
crumbModel.models.pop()
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if (crumbRoot.root) {
|
|
|
|
|
applicationsView.newModel = rootModel;
|
|
|
|
|
} else {
|
|
|
|
|
applicationsView.newModel = crumbModel.models[index];
|
|
|
|
|
}
|
|
|
|
|
applicationsView.state = "OutgoingRight";
|
|
|
|
|
}
|
|
|
|
|
cursorShape: Qt.PointingHandCursor
|
|
|
|
|
z: 99
|
|
|
|
|
}
|
|
|
|
|
}
|
2024-08-09 01:20:25 +00:00
|
|
|
|
KSvg.SvgItem{
|
2024-01-20 02:08:06 +00:00
|
|
|
|
id: arrowSvg
|
|
|
|
|
|
|
|
|
|
anchors.left: parent.left
|
2024-08-09 01:20:25 +00:00
|
|
|
|
anchors.leftMargin: Kirigami.Units.smallSpacing*2
|
2024-01-20 02:08:06 +00:00
|
|
|
|
anchors.verticalCenter: parent.verticalCenter
|
|
|
|
|
height: crumbRoot.height / 2
|
|
|
|
|
width: visible ? height : 0
|
2021-09-29 17:10:18 +00:00
|
|
|
|
|
2024-01-20 02:08:06 +00:00
|
|
|
|
svg: arrowsSvg
|
|
|
|
|
elementId: LayoutMirroring.enabled ? "right-arrow" : "left-arrow"
|
2021-09-29 17:10:18 +00:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
} // crumbRoot
|