diff options
| author | Sebastian Trueg <[email protected]> | 2010-07-22 08:26:07 +0000 |
|---|---|---|
| committer | Sebastian Trueg <[email protected]> | 2010-07-22 08:26:07 +0000 |
| commit | ed68687614472e18904c4a3f613d01df2f5bb90e (patch) | |
| tree | 096f0111489df625cd5fd3a12f053878d140dd63 /src/panels/information/informationpanel.cpp | |
| parent | 20adf66415f31ac6b52b506d13db665215b3f2b4 (diff) | |
Properly KIO::stat instead of simply using the KFileItem constructor when
showing metadata for the currently selected folder. This way we can even get rid of the
special handling of nepomuksearch:/ URLs since the KIO slave provides a nice name and
all you need to show to the user.
Even nicer: When clicking an entry in the metadata view the resulting query will be related
to the one clicked resource. This resource will then be represented by the query folder.
So all in all this patch makes Dolphin more generic while additionally activating a new feature.
svn path=/trunk/KDE/kdebase/apps/; revision=1152959
Diffstat (limited to 'src/panels/information/informationpanel.cpp')
| -rw-r--r-- | src/panels/information/informationpanel.cpp | 28 |
1 files changed, 22 insertions, 6 deletions
diff --git a/src/panels/information/informationpanel.cpp b/src/panels/information/informationpanel.cpp index f15cf05d5..2d6810c88 100644 --- a/src/panels/information/informationpanel.cpp +++ b/src/panels/information/informationpanel.cpp @@ -23,6 +23,8 @@ #include <QVBoxLayout> #include "informationpanelcontent.h" +#include <kio/job.h> + InformationPanel::InformationPanel(QWidget* parent) : Panel(parent), m_initialized(false), @@ -34,6 +36,7 @@ InformationPanel::InformationPanel(QWidget* parent) : m_invalidUrlCandidate(), m_fileItem(), m_selection(), + m_folderStatJob(0), m_content(0) { } @@ -170,17 +173,28 @@ void InformationPanel::showItemInfo() } else if (!m_selection.isEmpty()) { Q_ASSERT(m_selection.count() == 1); item = m_selection.first(); - } else { + } + + if ( item.isNull() ) { // no item is hovered and no selection has been done: provide // an item for the directory represented by m_shownUrl - item = KFileItem(KFileItem::Unknown, KFileItem::Unknown, m_shownUrl); - item.refresh(); + m_folderStatJob = KIO::stat(m_shownUrl, KIO::HideProgressInfo); + connect(m_folderStatJob, SIGNAL(result(KJob*)), + this, SLOT(slotFolderStatFinished(KJob*))); + } + else { + m_content->showItem(item); } - - m_content->showItem(item); } } +void InformationPanel::slotFolderStatFinished(KJob* job) +{ + m_folderStatJob = 0; + const KIO::UDSEntry entry = static_cast<KIO::StatJob*>(job)->statResult(); + m_content->showItem(KFileItem(entry, m_shownUrl)); +} + void InformationPanel::slotInfoTimeout() { m_shownUrl = m_urlCandidate; @@ -272,6 +286,8 @@ void InformationPanel::slotLeftDirectory(const QString& directory) void InformationPanel::cancelRequest() { + delete m_folderStatJob; + m_folderStatJob = 0; m_infoTimer->stop(); } @@ -324,7 +340,7 @@ void InformationPanel::init() m_content = new InformationPanelContent(this); connect(m_content, SIGNAL(urlActivated(KUrl)), this, SIGNAL(urlActivated(KUrl))); - + QVBoxLayout* layout = new QVBoxLayout(this); layout->addWidget(m_content); |
