fix(trash): update folder
This commit is contained in:
parent
7592e048ce
commit
d6bbf7c08f
2 changed files with 11 additions and 12 deletions
|
@ -89,6 +89,7 @@ static bool isDropBetweenSharedViews(const QList<QUrl> &urls, const QUrl &folder
|
||||||
FolderModel::FolderModel(QObject *parent)
|
FolderModel::FolderModel(QObject *parent)
|
||||||
: QSortFilterProxyModel(parent)
|
: QSortFilterProxyModel(parent)
|
||||||
, m_dirWatch(nullptr)
|
, m_dirWatch(nullptr)
|
||||||
|
, m_status(None)
|
||||||
, m_sortMode(0)
|
, m_sortMode(0)
|
||||||
, m_sortDesc(false)
|
, m_sortDesc(false)
|
||||||
, m_sortDirsFirst(true)
|
, m_sortDirsFirst(true)
|
||||||
|
@ -111,6 +112,7 @@ FolderModel::FolderModel(QObject *parent)
|
||||||
m_dirLister = new DirLister(this);
|
m_dirLister = new DirLister(this);
|
||||||
m_dirLister->setDelayedMimeTypes(true);
|
m_dirLister->setDelayedMimeTypes(true);
|
||||||
m_dirLister->setAutoErrorHandlingEnabled(false, nullptr);
|
m_dirLister->setAutoErrorHandlingEnabled(false, nullptr);
|
||||||
|
m_dirLister->setAutoUpdate(true);
|
||||||
m_dirLister->setShowingDotFiles(m_showHiddenFiles);
|
m_dirLister->setShowingDotFiles(m_showHiddenFiles);
|
||||||
// connect(dirLister, &DirLister::error, this, &FolderModel::notification);
|
// connect(dirLister, &DirLister::error, this, &FolderModel::notification);
|
||||||
|
|
||||||
|
@ -381,31 +383,27 @@ void FolderModel::setUrl(const QString &url)
|
||||||
|
|
||||||
// Refresh this directory.
|
// Refresh this directory.
|
||||||
if (url == m_url) {
|
if (url == m_url) {
|
||||||
m_dirModel->dirLister()->updateDirectory(resolvedNewUrl);
|
refresh();
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
setStatus(Status::Listing);
|
||||||
|
|
||||||
m_pathHistory.append(resolvedNewUrl);
|
m_pathHistory.append(resolvedNewUrl);
|
||||||
|
|
||||||
beginResetModel();
|
beginResetModel();
|
||||||
m_url = resolvedNewUrl.toString(QUrl::PreferLocalFile);
|
m_url = resolvedNewUrl.toString(QUrl::PreferLocalFile);
|
||||||
m_dirModel->dirLister()->openUrl(resolvedNewUrl);
|
m_dirModel->dirLister()->openUrl(isTrash ? QUrl(QStringLiteral("trash:/")) : resolvedNewUrl);
|
||||||
clearDragImages();
|
clearDragImages();
|
||||||
m_dragIndexes.clear();
|
m_dragIndexes.clear();
|
||||||
endResetModel();
|
endResetModel();
|
||||||
|
|
||||||
|
if (isTrash) {
|
||||||
|
refresh();
|
||||||
|
}
|
||||||
|
|
||||||
emit urlChanged();
|
emit urlChanged();
|
||||||
emit resolvedUrlChanged();
|
emit resolvedUrlChanged();
|
||||||
|
|
||||||
// if (m_dirWatch) {
|
|
||||||
// delete m_dirWatch;
|
|
||||||
// m_dirWatch = nullptr;
|
|
||||||
// }
|
|
||||||
|
|
||||||
// if (resolvedNewUrl.isValid()) {
|
|
||||||
// m_dirWatch = new KDirWatch(this);
|
|
||||||
// m_dirWatch->addFile(resolvedNewUrl.toLocalFile() + QLatin1String("/.directory"));
|
|
||||||
// }
|
|
||||||
}
|
}
|
||||||
|
|
||||||
QUrl FolderModel::resolvedUrl() const
|
QUrl FolderModel::resolvedUrl() const
|
||||||
|
|
|
@ -148,6 +148,7 @@ Item {
|
||||||
font.pointSize: 15
|
font.pointSize: 15
|
||||||
anchors.centerIn: parent
|
anchors.centerIn: parent
|
||||||
visible: dirModel.status === FM.FolderModel.Ready
|
visible: dirModel.status === FM.FolderModel.Ready
|
||||||
|
&& _viewLoader.status === Loader.Ready
|
||||||
&& _viewLoader.item.count === 0
|
&& _viewLoader.item.count === 0
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue