fix: sidebar umount

This commit is contained in:
kateleet 2021-12-26 23:24:08 +08:00
parent f7ff4e1c77
commit f89af80744
3 changed files with 37 additions and 2 deletions

View file

@ -31,6 +31,31 @@ void PathHistory::append(const QUrl &path)
m_prevHistory.append(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() QUrl PathHistory::posteriorPath()
{ {
if (m_postHistory.isEmpty()) if (m_postHistory.isEmpty())

View file

@ -32,6 +32,14 @@ public:
void append(const QUrl &path); void append(const QUrl &path);
QUrl first();
QUrl last();
QUrl at(int i);
int count();
bool isEmpty();
QUrl posteriorPath(); QUrl posteriorPath();
QUrl previousPath(); QUrl previousPath();

View file

@ -147,7 +147,8 @@ ListView {
text: qsTr("Eject") text: qsTr("Eject")
visible: model.isDevice && visible: model.isDevice &&
!model.setupNeeded && !model.setupNeeded &&
model.isOpticalDisc model.isOpticalDisc &&
!model.url.toString() === "/"
onTriggered: { onTriggered: {
placesModel.requestEject(index) placesModel.requestEject(index)
@ -159,7 +160,8 @@ ListView {
text: qsTr("Unmount") text: qsTr("Unmount")
visible: model.isDevice && visible: model.isDevice &&
!model.setupNeeded && !model.setupNeeded &&
!model.isOpticalDisc !model.isOpticalDisc &&
!model.url.toString() === "/"
onTriggered: { onTriggered: {
placesModel.requestTeardown(index) placesModel.requestTeardown(index)