Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions src/FileMenu.qml
Original file line number Diff line number Diff line change
Expand Up @@ -303,8 +303,8 @@ FolioMenu {
}
// On empty space, only where the folder shown is one to work in.
FolioMenuItem {
shown: fileMenu.forItem ? fileMenu.forFolder && fileMenu.forFiles
: fileMenu.folder.startsWith("/") && !fileMenu.trashView
shown: !fileMenu.trashView && (fileMenu.forItem ? fileMenu.forFolder && fileMenu.forFiles
: fileMenu.folder.startsWith("/"))
text: qsTr("Open Terminal Here")
onTriggered: fileOps.openTerminal(fileMenu.forItem ? fileMenu.target.path : fileMenu.folder)
}
Expand Down
29 changes: 29 additions & 0 deletions src/FolioMenu.qml
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,35 @@ Menu {
return widest
}

// Rules go only between entries that show: none at the top or the
// bottom, and one where several would meet. Which entries show is only
// known once the menu's owner has set it up, so it's done as it opens.
function tidyLines() {
let entries = 0 // entries shown since the last rule kept
let last = null // the last rule kept, to drop if nothing follows it
for (let i = 0; i < count; ++i) {
const entry = itemAt(i)
if (!entry)
continue
if (entry.isLine) {
entry.tucked = false
if (!entry.shown)
continue
if (entries === 0) {
entry.tucked = true
} else {
last = entry
entries = 0
}
} else if (entry.shown !== false) {
++entries
}
}
if (entries === 0 && last)
last.tucked = true
}
onAboutToShow: tidyLines()

background: Rectangle {
implicitWidth: 240
color: theme.background
Expand Down
10 changes: 8 additions & 2 deletions src/MenuLine.qml
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,16 @@ import QtQuick
import QtQuick.Controls

// A thin rule between groups of menu entries, with little room around it.
// `shown` is what the menu's owner asks for; FolioMenu also sets `tucked`
// for a rule that would have no entry on one side of it, or sit beside
// another rule (a group emptied by the entries that don't apply, as in the
// trash), so a menu never starts, ends or doubles up with a line.
MenuSeparator {
property bool shown: true
visible: shown
height: shown ? implicitHeight : 0
property bool tucked: false
readonly property bool isLine: true
visible: shown && !tucked
height: shown && !tucked ? implicitHeight : 0
topPadding: 4
bottomPadding: 4
contentItem: Rectangle {
Expand Down