Skip to content

Commit 6612912

Browse files
committed
[Plugin] Add a canGoBack property
1 parent b2f3368 commit 6612912

File tree

2 files changed

+13
-0
lines changed

2 files changed

+13
-0
lines changed

src/plugin/folderlistmodel/dirmodel.cpp

+6
Original file line numberDiff line numberDiff line change
@@ -452,9 +452,15 @@ void DirModel::setPathFromCurrentLocation()
452452
{
453453
mPathList.append(mCurrentDir);
454454
}
455+
456+
emit canGoBackChanged();
455457
emit pathChanged(mCurLocation->urlPath());
456458
}
457459

460+
bool DirModel::canGoBack() const
461+
{
462+
return mPathList.count() > 1;
463+
}
458464

459465
void DirModel::goBack()
460466
{

src/plugin/folderlistmodel/dirmodel.h

+7
Original file line numberDiff line numberDiff line change
@@ -52,6 +52,7 @@ class ExternalFSWatcher;
5252
class DirModel : public DirItemAbstractListModel
5353
{
5454
Q_OBJECT
55+
5556
public:
5657
enum Roles {
5758
FileNameRole = Qt::UserRole,
@@ -119,7 +120,12 @@ class DirModel : public DirItemAbstractListModel
119120
Q_INVOKABLE QString curPathModifiedDateLocaleShort() const;
120121
Q_INVOKABLE bool curPathIsWritable() const;
121122

123+
Q_PROPERTY(bool canGoBack READ canGoBack NOTIFY canGoBackChanged)
124+
125+
bool canGoBack() const;
126+
122127
Q_PROPERTY(bool awaitingResults READ awaitingResults NOTIFY awaitingResultsChanged)
128+
123129
bool awaitingResults() const;
124130

125131
Q_INVOKABLE void rm(const QStringList &paths);
@@ -150,6 +156,7 @@ public slots:
150156
void onItemsFetched();
151157

152158
signals:
159+
void canGoBackChanged();
153160
void awaitingResultsChanged();
154161
void nameFiltersChanged();
155162
void filterDirectoriesChanged();

0 commit comments

Comments
 (0)