┌   ┐
54
└   ┘

summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorPeter Penz <[email protected]>2008-06-07 12:14:29 +0000
committerPeter Penz <[email protected]>2008-06-07 12:14:29 +0000
commit2848f1fb5a0e265150bc11c1e7e3ae5d50057007 (patch)
tree941ba153864de8758c37a377ceb36faabdbee56a /src
parentff332849632d81ae0a12f1102774d1108b2a9730 (diff)
Fixed the following Information Panel issues:
* Trash icon is not updated when trash has been emptied or got filled. * When renaming an item the old name will be shown in the Information Panel. * When unmounting media, still the mounted icon is shown. BUG: 161385 BUG: 153514 BUG: 154747 CCBUG: 159366 svn path=/trunk/KDE/kdebase/apps/; revision=818005
Diffstat (limited to 'src')
-rw-r--r--src/infosidebarpage.cpp68
-rw-r--r--src/infosidebarpage.h6
2 files changed, 71 insertions, 3 deletions
diff --git a/src/infosidebarpage.cpp b/src/infosidebarpage.cpp
index 07827fd1d..fdfa230a2 100644
--- a/src/infosidebarpage.cpp
+++ b/src/infosidebarpage.cpp
@@ -21,12 +21,13 @@
#include <config-nepomuk.h>
+#include <kdialog.h>
+#include <kdirnotify.h>
#include <kfileplacesmodel.h>
#include <klocale.h>
#include <kstandarddirs.h>
#include <kio/previewjob.h>
#include <kfileitem.h>
-#include <kdialog.h>
#include <kglobalsettings.h>
#include <kfilemetainfo.h>
#include <kiconeffect.h>
@@ -47,8 +48,6 @@
#include "metatextlabel.h"
#include "pixmapviewer.h"
-#include <kdebug.h>
-
InfoSidebarPage::InfoSidebarPage(QWidget* parent) :
SidebarPage(parent),
m_initialized(false),
@@ -242,6 +241,61 @@ void InfoSidebarPage::showPreview(const KFileItem& item,
}
}
+void InfoSidebarPage::slotFileRenamed(const QString& source, const QString& dest)
+{
+ if (m_shownUrl == KUrl(source)) {
+ // the currently shown file has been renamed, hence update the item information
+ // for the renamed file
+ KFileItem item(KFileItem::Unknown, KFileItem::Unknown, KUrl(dest));
+ requestDelayedItemInfo(item);
+ }
+}
+
+void InfoSidebarPage::slotFilesAdded(const QString& directory)
+{
+ if (m_shownUrl == KUrl(directory)) {
+ // If the 'trash' icon changes because the trash has been emptied or got filled,
+ // the signal filesAdded("trash:/") will be emitted.
+ KFileItem item(KFileItem::Unknown, KFileItem::Unknown, KUrl(directory));
+ requestDelayedItemInfo(item);
+ }
+}
+
+void InfoSidebarPage::slotFilesChanged(const QStringList& files)
+{
+ foreach (const QString& fileName, files) {
+ if (m_shownUrl == KUrl(fileName)) {
+ showItemInfo();
+ break;
+ }
+ }
+}
+
+void InfoSidebarPage::slotFilesRemoved(const QStringList& files)
+{
+ foreach (const QString& fileName, files) {
+ if (m_shownUrl == KUrl(fileName)) {
+ // the currently shown item has been removed, show
+ // the parent directory as fallback
+ m_shownUrl = url();
+ showItemInfo();
+ break;
+ }
+ }
+}
+
+void InfoSidebarPage::slotLeftDirectory(const QString& directory)
+{
+ if (m_shownUrl == KUrl(directory)) {
+ // The signal 'leftDirectory' is also emitted when a media
+ // has been unmounted. In this case no directory change will be
+ // done in Dolphin, but the Information Panel must be updated to
+ // indicate an invalid directory.
+ m_shownUrl = url();
+ showItemInfo();
+ }
+}
+
bool InfoSidebarPage::applyPlace(const KUrl& url)
{
KFilePlacesModel* placesModel = DolphinSettings::instance().placesModel();
@@ -427,6 +481,14 @@ void InfoSidebarPage::init()
layout->addStretch(1);
setLayout(layout);
+ org::kde::KDirNotify* dirNotify = new org::kde::KDirNotify(QString(), QString(),
+ QDBusConnection::sessionBus(), this);
+ connect(dirNotify, SIGNAL(FileRenamed(QString, QString)), SLOT(slotFileRenamed(QString, QString)));
+ connect(dirNotify, SIGNAL(FilesAdded(QString)), SLOT(slotFilesAdded(QString)));
+ connect(dirNotify, SIGNAL(FilesChanged(QStringList)), SLOT(slotFilesChanged(QStringList)));
+ connect(dirNotify, SIGNAL(FilesRemoved(QStringList)), SLOT(slotFilesRemoved(QStringList)));
+ connect(dirNotify, SIGNAL(leftDirectory(QString)), SLOT(slotLeftDirectory(QString)));
+
m_initialized = true;
}
diff --git a/src/infosidebarpage.h b/src/infosidebarpage.h
index bfbaf0e45..b6575751b 100644
--- a/src/infosidebarpage.h
+++ b/src/infosidebarpage.h
@@ -105,6 +105,12 @@ private slots:
*/
void showPreview(const KFileItem& item, const QPixmap& pixmap);
+ void slotFileRenamed(const QString& source, const QString& dest);
+ void slotFilesAdded(const QString& directory);
+ void slotFilesChanged(const QStringList& files);
+ void slotFilesRemoved(const QStringList& files);
+ void slotLeftDirectory(const QString& directory);
+
private:
enum { TimerDelay = 300 };