diff --git a/containments/desktop/plugins/folder/foldermodel.h b/containments/desktop/plugins/folder/foldermodel.h --- a/containments/desktop/plugins/folder/foldermodel.h +++ b/containments/desktop/plugins/folder/foldermodel.h @@ -253,6 +253,7 @@ void createActions(); void updatePasteAction(); void addDragImage(QDrag *drag, int x, int y); + bool trashEmpty() const; QList selectedUrls(bool forTrash) const; KDirModel *m_dirModel; KDirWatch *m_dirWatch; diff --git a/containments/desktop/plugins/folder/foldermodel.cpp b/containments/desktop/plugins/folder/foldermodel.cpp --- a/containments/desktop/plugins/folder/foldermodel.cpp +++ b/containments/desktop/plugins/folder/foldermodel.cpp @@ -222,7 +222,17 @@ QString FolderModel::iconName() const { - const KFileItem rootItem(m_dirModel->dirLister()->url()); + const QUrl &url = m_dirModel->dirLister()->url(); + + if (url == QUrl(QStringLiteral("trash:/"))) { + if (trashEmpty()) { + return QStringLiteral("user-trash"); + } else { + return QStringLiteral("user-trash-full"); + } + } + + const KFileItem rootItem(url); if (!rootItem.isFinalIconKnown()) { rootItem.determineMimeType(); @@ -1242,8 +1252,7 @@ if (emptyTrash) { if (resolvedUrl() == QUrl(QStringLiteral("trash:/"))) { emptyTrash->setVisible(true); - KConfig trashConfig(QStringLiteral("trashrc"), KConfig::SimpleConfig); - emptyTrash->setEnabled(!trashConfig.group("Status").readEntry("Empty", true)); + emptyTrash->setEnabled(!trashEmpty()); } else { emptyTrash->setVisible(false); } @@ -1501,6 +1510,12 @@ } } +bool FolderModel::trashEmpty() const +{ + KConfig trashConfig(QStringLiteral("trashrc"), KConfig::SimpleConfig); + return trashConfig.group("Status").readEntry("Empty", true); +} + void FolderModel::emptyTrashBin() { KIO::JobUiDelegate uiDelegate;