| 1 |
/* |
| 2 |
* Copyright (C) 2025 UBports Foundation |
| 3 |
* |
| 4 |
* This program is free software: you can redistribute it and/or modify |
| 5 |
* it under the terms of the GNU General Public License 3 as published by |
| 6 |
* the Free Software Foundation, either version 3 of the License, or |
| 7 |
* (at your option) any later version. |
| 8 |
* |
| 9 |
* This program is distributed in the hope that it will be useful, |
| 10 |
* but WITHOUT ANY WARRANTY; without even the implied warranty of |
| 11 |
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
| 12 |
* GNU General Public License for more details. |
| 13 |
* |
| 14 |
* You should have received a copy of the GNU General Public License |
| 15 |
* along with this program. If not, see http://www.gnu.org/licenses/. |
| 16 |
*/ |
| 17 |
|
| 18 |
import QtQuick 2.12 |
| 19 |
import Lomiri.Components 1.3 |
| 20 |
import QtQuick.Layouts 1.12 |
| 21 |
|
| 22 |
import "../components" as Components |
| 23 |
|
| 24 |
Item { |
| 25 |
id: rootItem |
| 26 |
|
| 27 |
readonly property bool noActions: leadingActionBar.actions.length === 0 && trailingActionBar.actions.length === 0 |
| 28 |
|
| 29 |
property alias folderModel: pathHistoryRow.folderModel |
| 30 |
property alias leadingActionBar: leadingActionBar |
| 31 |
property alias trailingActionBar: trailingActionBar |
| 32 |
|
| 33 |
anchors { left: parent.left; right: parent.right } |
| 34 |
implicitHeight: noActions ? units.gu(4) : units.gu(5) |
| 35 |
|
| 36 |
RowLayout { |
| 37 |
anchors.fill: parent |
| 38 |
|
| 39 |
ActionBar { |
| 40 |
id: leadingActionBar |
| 41 |
|
| 42 |
Layout.fillHeight: true |
| 43 |
Layout.topMargin: units.gu(0.1) |
| 44 |
Layout.bottomMargin: units.gu(0.1) |
| 45 |
|
| 46 |
visible: actions.length > 0 |
| 47 |
numberOfSlots: 5 |
| 48 |
} |
| 49 |
|
| 50 |
Components.PathHistoryRow { |
| 51 |
id: pathHistoryRow |
| 52 |
|
| 53 |
Layout.fillHeight: true |
| 54 |
Layout.fillWidth: true |
| 55 |
Layout.alignment: Qt.AlignVCenter |
| 56 |
|
| 57 |
// Adds visual separator between history row and action buttons |
| 58 |
Rectangle { |
| 59 |
visible: !rootItem.noActions |
| 60 |
anchors.fill: parent |
| 61 |
color: "transparent" |
| 62 |
border { |
| 63 |
width: units.dp(2) |
| 64 |
color: theme.palette.normal.base |
| 65 |
} |
| 66 |
} |
| 67 |
} |
| 68 |
|
| 69 |
ActionBar { |
| 70 |
id: trailingActionBar |
| 71 |
|
| 72 |
Layout.fillHeight: true |
| 73 |
Layout.topMargin: units.gu(0.1) |
| 74 |
Layout.bottomMargin: units.gu(0.1) |
| 75 |
|
| 76 |
visible: actions.length > 0 |
| 77 |
numberOfSlots: 5 |
| 78 |
} |
| 79 |
} |
| 80 |
|
| 81 |
// Top and bottom dividers |
| 82 |
Components.HorizontalDivider { |
| 83 |
visible: !rootItem.noActions |
| 84 |
anchors { |
| 85 |
left: parent.left |
| 86 |
right: parent.right |
| 87 |
top: parent.top |
| 88 |
} |
| 89 |
} |
| 90 |
|
| 91 |
Components.HorizontalDivider { |
| 92 |
visible: !rootItem.noActions |
| 93 |
anchors { |
| 94 |
left: parent.left |
| 95 |
right: parent.right |
| 96 |
bottom: parent.bottom |
| 97 |
} |
| 98 |
} |
| 99 |
} |