From f89af80744adf3d3b7a3fbe24a3781adea552cd4 Mon Sep 17 00:00:00 2001 From: kateleet Date: Sun, 26 Dec 2021 23:24:08 +0800 Subject: [PATCH] fix: sidebar umount --- helper/pathhistory.cpp | 25 +++++++++++++++++++++++++ helper/pathhistory.h | 8 ++++++++ qml/SideBar.qml | 6 ++++-- 3 files changed, 37 insertions(+), 2 deletions(-) diff --git a/helper/pathhistory.cpp b/helper/pathhistory.cpp index d4801e8..fdc34cc 100644 --- a/helper/pathhistory.cpp +++ b/helper/pathhistory.cpp @@ -31,6 +31,31 @@ void PathHistory::append(const QUrl &path) m_prevHistory.append(path); } +QUrl PathHistory::first() +{ + return m_prevHistory.first(); +} + +QUrl PathHistory::last() +{ + return m_prevHistory.last(); +} + +QUrl PathHistory::at(int i) +{ + return m_prevHistory.at(i); +} + +int PathHistory::count() +{ + return m_prevHistory.count(); +} + +bool PathHistory::isEmpty() +{ + return m_prevHistory.isEmpty(); +} + QUrl PathHistory::posteriorPath() { if (m_postHistory.isEmpty()) diff --git a/helper/pathhistory.h b/helper/pathhistory.h index 1b8a960..78fa3c4 100644 --- a/helper/pathhistory.h +++ b/helper/pathhistory.h @@ -32,6 +32,14 @@ public: void append(const QUrl &path); + QUrl first(); + QUrl last(); + + QUrl at(int i); + int count(); + + bool isEmpty(); + QUrl posteriorPath(); QUrl previousPath(); diff --git a/qml/SideBar.qml b/qml/SideBar.qml index 0461ea6..34400d4 100644 --- a/qml/SideBar.qml +++ b/qml/SideBar.qml @@ -147,7 +147,8 @@ ListView { text: qsTr("Eject") visible: model.isDevice && !model.setupNeeded && - model.isOpticalDisc + model.isOpticalDisc && + !model.url.toString() === "/" onTriggered: { placesModel.requestEject(index) @@ -159,7 +160,8 @@ ListView { text: qsTr("Unmount") visible: model.isDevice && !model.setupNeeded && - !model.isOpticalDisc + !model.isOpticalDisc && + !model.url.toString() === "/" onTriggered: { placesModel.requestTeardown(index)