]> cloud.milkyroute.net Git - dolphin.git/commitdiff
* improved interface + documentation of MetaDataWidget
authorPeter Penz <peter.penz19@gmail.com>
Fri, 16 Oct 2009 13:01:11 +0000 (13:01 +0000)
committerPeter Penz <peter.penz19@gmail.com>
Fri, 16 Oct 2009 13:01:11 +0000 (13:01 +0000)
* provide a configuration dialog for adjusting the visibility of the meta data

svn path=/trunk/KDE/kdebase/apps/; revision=1036058

src/CMakeLists.txt
src/panels/information/commentwidget.cpp
src/panels/information/dolphin_informationpanelsettings.kcfg
src/panels/information/informationpanelcontent.cpp
src/panels/information/metadataconfigurationdialog.cpp [new file with mode: 0644]
src/panels/information/metadataconfigurationdialog_p.h [new file with mode: 0644]
src/panels/information/metadatawidget.cpp
src/panels/information/metadatawidget.h
src/panels/information/taggingwidget.cpp

index 173a769e46ed290f2409de3ef4f253199e8c0bbd..596490ae9ff4e431001976044a75d3260c9da54d 100644 (file)
@@ -154,6 +154,7 @@ set(dolphin_SRCS
   ${dolphin_SRCS}
   panels/information/commentwidget.cpp
   panels/information/edittagsdialog.cpp
+  panels/information/metadataconfigurationdialog.cpp
   panels/information/nepomukmassupdatejob.cpp
   panels/information/taggingwidget.cpp
 )
index 673a8c30af1925e477d2460fa45c170e0fcb9e9f..06a4c33be57a5e6b478309f9f916cbc4b540565c 100644 (file)
@@ -81,8 +81,7 @@ void CommentWidget::slotLinkActivated(const QString& link)
     dialog.setButtons(KDialog::Ok | KDialog::Cancel);
     dialog.setDefaultButton(KDialog::Ok);
 
-    KConfigGroup dialogConfig(KSharedConfig::openConfig("dolphinrc"),
-                              "EditCommentDialog");
+    KConfigGroup dialogConfig(KGlobal::config(), "Nepomuk EditCommentDialog");
     dialog.restoreDialogSize(dialogConfig);
 
     if (dialog.exec() == QDialog::Accepted) {
index ebd921eefffaeb2ed197899c704673753f063268..2bde1c4afeb102b5aac9ef20b1119ec5dff1bda9 100644 (file)
@@ -7,17 +7,5 @@
             <label>Show preview</label>
             <default>true</default>
         </entry>
-        <entry name="showRating" type="Bool">
-            <label>Show rating</label>
-            <default>true</default>
-        </entry>
-        <entry name="showComment" type="Bool">
-            <label>Show comment</label>
-            <default>true</default>
-        </entry>
-        <entry name="showTags" type="Bool">
-            <label>Show tags</label>
-            <default>true</default>
-        </entry>
     </group>
 </kcfg>
index 2b26c55a8d05d2a5864dbe18b174272e840bc44c..dfa88be17f8b871d127cf41609eaeb6a4e9879be 100644 (file)
@@ -290,79 +290,8 @@ void InformationPanelContent::configureSettings()
     previewAction->setCheckable(true);
     previewAction->setChecked(InformationPanelSettings::showPreview());
 
-    const bool metaDataAvailable = true; // MetaDataWidget::metaDataAvailable(); TODO
-
-    QAction* ratingAction = popup.addAction(i18nc("@action:inmenu", "Rating"));
-    ratingAction->setIcon(KIcon("rating"));
-    ratingAction->setCheckable(true);
-    ratingAction->setChecked(InformationPanelSettings::showRating());
-    ratingAction->setEnabled(metaDataAvailable);
-
-    QAction* commentAction = popup.addAction(i18nc("@action:inmenu", "Comment"));
-    commentAction->setIcon(KIcon("text-plain"));
-    commentAction->setCheckable(true);
-    commentAction->setChecked(InformationPanelSettings::showComment());
-    commentAction->setEnabled(metaDataAvailable);
-
-    QAction* tagsAction = popup.addAction(i18nc("@action:inmenu", "Tags"));
-    tagsAction->setCheckable(true);
-    tagsAction->setChecked(InformationPanelSettings::showTags());
-    tagsAction->setEnabled(metaDataAvailable);
-
-    KConfig config("kmetainformationrc", KConfig::NoGlobals);
-    KConfigGroup settings = config.group("Show");
-
-    QList<QAction*> actions;
-
-    // Get all meta information labels that are available for
-    // the currently shown file item and add them to the popup.
-    /*Nepomuk::Resource res(m_item.url());
-    QHash<QUrl, Nepomuk::Variant> properties = res.properties();
-    QHash<QUrl, Nepomuk::Variant>::const_iterator it = properties.constBegin();
-    while (it != properties.constEnd()) {
-        Nepomuk::Types::Property prop(it.key());
-        const QString key = prop.name();
-
-        // Meta information provided by Nepomuk that is already
-        // available from KFileItem should not be configurable.
-        bool skip = (key == "fileExtension") ||
-                    (key == "name") ||
-                    (key == "sourceModified") ||
-                    (key == "size") ||
-                    (key == "mime type");
-        if (!skip) {
-            // Check whether there is already a meta information
-            // having the same label. In this case don't show it
-            // twice in the menu.
-            foreach (const QAction* action, actions) {
-                if (action->data().toString() == key) {
-                    skip = true;
-                    break;
-                }
-            }
-        }
-
-        if (!skip) {
-            const QString label = tunedLabel(prop.label());
-            QAction* action = new QAction(label, &popup);
-            action->setCheckable(true);
-            action->setChecked(settings.readEntry(key, true));
-            action->setData(key);
-            actions.append(action);
-        }
-
-        ++it;
-    }*/
-
-    if (!actions.isEmpty()) {
-        popup.addSeparator();
-
-        // add all items alphabetically sorted to the popup
-        qSort(actions.begin(), actions.end(), lessThan);
-        foreach (QAction* action, actions) {
-            popup.addAction(action);
-        }
-    }
+    QAction* configureAction = popup.addAction(i18nc("@action:inmenu", "Configure..."));
+    configureAction->setIcon(KIcon("configure"));
 
     // Open the popup and adjust the settings for the
     // selected action.
@@ -376,27 +305,10 @@ void InformationPanelContent::configureSettings()
         m_preview->setVisible(isChecked);
         m_previewSeparator->setVisible(isChecked);
         InformationPanelSettings::setShowPreview(isChecked);
-    } else if (action == ratingAction) {
-        //m_metaDataWidget->setRatingVisible(isChecked);
-        InformationPanelSettings::setShowRating(isChecked);
-    } else if (action == commentAction) {
-        //m_metaDataWidget->setCommentVisible(isChecked);
-        InformationPanelSettings::setShowComment(isChecked);
-    } else if (action == tagsAction) {
-        //m_metaDataWidget->setTagsVisible(isChecked);
-        InformationPanelSettings::setShowTags(isChecked);
-    } else {
-        settings.writeEntry(action->data().toString(), action->isChecked());
-        settings.sync();
+    } else if (action == configureAction) {
+        m_metaDataWidget->openConfigurationDialog();
     }
 
-    /*if (m_metaDataWidget != 0) {
-        const bool visible = m_metaDataWidget->isRatingVisible() ||
-                             m_metaDataWidget->isCommentVisible() ||
-                             m_metaDataWidget->areTagsVisible();
-        m_metaDataSeparator->setVisible(visible);
-    }*/
-
     showItem(m_item);
 }
 
diff --git a/src/panels/information/metadataconfigurationdialog.cpp b/src/panels/information/metadataconfigurationdialog.cpp
new file mode 100644 (file)
index 0000000..4234378
--- /dev/null
@@ -0,0 +1,147 @@
+/***************************************************************************
+ *   Copyright (C) 2009 by Peter Penz <peter.penz@gmx.at>                  *
+ *                                                                         *
+ *   This program is free software; you can redistribute it and/or modify  *
+ *   it under the terms of the GNU General Public License as published by  *
+ *   the Free Software Foundation; either version 2 of the License, or     *
+ *   (at your option) any later version.                                   *
+ *                                                                         *
+ *   This program is distributed in the hope that it will be useful,       *
+ *   but WITHOUT ANY WARRANTY; without even the implied warranty of        *
+ *   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the         *
+ *   GNU General Public License for more details.                          *
+ *                                                                         *
+ *   You should have received a copy of the GNU General Public License     *
+ *   along with this program; if not, write to the                         *
+ *   Free Software Foundation, Inc.,                                       *
+ *   51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA            *
+ ***************************************************************************/
+
+#include "metadataconfigurationdialog_p.h"
+
+#include "metadatawidget.h"
+
+#include <klocale.h>
+
+#define DISABLE_NEPOMUK_LEGACY
+#include <Nepomuk/Resource>
+#include <Nepomuk/Types/Property>
+#include <Nepomuk/Variant>
+
+#include <QLabel>
+#include <QListWidget>
+#include <QVBoxLayout>
+
+MetaDataConfigurationDialog::MetaDataConfigurationDialog(const KUrl& url,
+                                                         QWidget* parent,
+                                                         Qt::WFlags flags) :
+    KDialog(parent, flags),
+    m_url(url),
+    m_metaDataList(0)
+{
+    setCaption(i18nc("@title:window", "Configure Shown Data"));
+    setButtons(KDialog::Ok | KDialog::Cancel);
+    setDefaultButton(KDialog::Ok);
+
+    QWidget* mainWidget = new QWidget(this);
+    QVBoxLayout* topLayout = new QVBoxLayout(mainWidget);
+
+    QLabel* label = new QLabel(i18nc("@label:textbox",
+                                     "Configure which data should "
+                                     "be shown."), this);
+
+    m_metaDataList = new QListWidget(this);
+    m_metaDataList->setSelectionMode(QAbstractItemView::NoSelection);
+
+    topLayout->addWidget(label);
+    topLayout->addWidget(m_metaDataList);
+
+    setMainWidget(mainWidget);
+
+    loadMetaData();
+}
+
+MetaDataConfigurationDialog::~MetaDataConfigurationDialog()
+{
+}
+
+void MetaDataConfigurationDialog::slotButtonClicked(int button)
+{
+    if (button == KDialog::Ok) {
+        KConfig config("kmetainformationrc", KConfig::NoGlobals);
+        KConfigGroup showGroup = config.group("Show");
+    
+        const int count = m_metaDataList->count();
+        for (int i = 0; i < count; ++i) {
+            QListWidgetItem* item = m_metaDataList->item(i);
+            const bool show = (item->checkState() == Qt::Checked);
+            const QString key = item->data(Qt::UserRole).toString();
+            showGroup.writeEntry(key, show);
+        }
+    
+        showGroup.sync();
+
+        accept();
+    } else {
+        KDialog::slotButtonClicked(button);
+    }
+}
+
+void MetaDataConfigurationDialog::loadMetaData()
+{
+    KConfig config("kmetainformationrc", KConfig::NoGlobals);
+    KConfigGroup settings = config.group("Show");
+
+    // Add fixed meta data items where the visibility does not
+    // depend on the currently used URL.
+    typedef QPair<QString, QString> FixedItem;
+    QList<FixedItem> fixedItems;
+    fixedItems.append(FixedItem("type",        i18nc("@item::inlistbox", "Type")));
+    fixedItems.append(FixedItem("size",        i18nc("@item::inlistbox", "Size")));
+    fixedItems.append(FixedItem("modified",    i18nc("@item::inlistbox", "Modified")));
+    fixedItems.append(FixedItem("owner",       i18nc("@item::inlistbox", "Owner")));
+    fixedItems.append(FixedItem("permissions", i18nc("@item::inlistbox", "Permission")));
+    fixedItems.append(FixedItem("rating",      i18nc("@item::inlistbox", "Rating")));
+    fixedItems.append(FixedItem("tags",        i18nc("@item::inlistbox", "Tags")));
+    fixedItems.append(FixedItem("comment",     i18nc("@item::inlistbox", "Comment")));
+
+    foreach (const FixedItem& fixedItem, fixedItems) {
+        const QString key = fixedItem.first;
+        const QString label = fixedItem.second;
+        QListWidgetItem* item = new QListWidgetItem(label, m_metaDataList);
+        item->setData(Qt::UserRole, key);
+        const bool show = settings.readEntry(key, true);
+        item->setCheckState(show ? Qt::Checked : Qt::Unchecked);
+
+    }
+
+    // Get all meta information labels that are available for
+    // the currently shown file item and add them to the list.
+    Nepomuk::Resource res(m_url);
+    QHash<QUrl, Nepomuk::Variant> properties = res.properties();
+    QHash<QUrl, Nepomuk::Variant>::const_iterator it = properties.constBegin();
+    while (it != properties.constEnd()) {
+        Nepomuk::Types::Property prop(it.key());
+        const QString key = prop.name();
+
+        // Meta information provided by Nepomuk that is already
+        // available from KFileItem should not be configurable.
+        bool skip = (key == "fileExtension") ||
+                    (key == "name") ||
+                    (key == "sourceModified") ||
+                    (key == "size") ||
+                    (key == "mime type");
+        if (!skip) {
+            // const QString label = tunedLabel(prop.label());
+            const QString label = prop.label();
+            QListWidgetItem* item = new QListWidgetItem(label, m_metaDataList);
+            item->setData(Qt::UserRole, key);
+            const bool show = settings.readEntry(key, true);
+            item->setCheckState(show ? Qt::Checked : Qt::Unchecked);
+        }
+
+        ++it;
+    }
+}
+
+#include "metadataconfigurationdialog_p.moc"
diff --git a/src/panels/information/metadataconfigurationdialog_p.h b/src/panels/information/metadataconfigurationdialog_p.h
new file mode 100644 (file)
index 0000000..b566bbd
--- /dev/null
@@ -0,0 +1,52 @@
+/***************************************************************************
+ *   Copyright (C) 2009 by Peter Penz <peter.penz@gmx.at>                  *
+ *                                                                         *
+ *   This program is free software; you can redistribute it and/or modify  *
+ *   it under the terms of the GNU General Public License as published by  *
+ *   the Free Software Foundation; either version 2 of the License, or     *
+ *   (at your option) any later version.                                   *
+ *                                                                         *
+ *   This program is distributed in the hope that it will be useful,       *
+ *   but WITHOUT ANY WARRANTY; without even the implied warranty of        *
+ *   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the         *
+ *   GNU General Public License for more details.                          *
+ *                                                                         *
+ *   You should have received a copy of the GNU General Public License     *
+ *   along with this program; if not, write to the                         *
+ *   Free Software Foundation, Inc.,                                       *
+ *   51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA            *
+ ***************************************************************************/
+
+#ifndef META_DATA_CONFIGURATION_DIALOG_H
+#define META_DATA_CONFIGURATION_DIALOG_H
+
+#include <kdialog.h>
+#include <kurl.h>
+
+class QListWidget;
+
+/**
+ * @brief Dialog which allows to configure which meta data should be shown.
+ */
+class MetaDataConfigurationDialog : public KDialog
+{
+    Q_OBJECT
+
+public:
+    MetaDataConfigurationDialog(const KUrl& url,
+                                QWidget* parent = 0,
+                                Qt::WFlags flags = 0);
+    virtual ~MetaDataConfigurationDialog();
+
+protected slots:
+    virtual void slotButtonClicked(int button);
+
+private:
+    void loadMetaData();
+
+private:
+    KUrl m_url;
+    QListWidget* m_metaDataList;
+};
+
+#endif
index 368d57e921086c6154fc41da963421f5f1d1628e..108728c79358973693534d24f77baf796e159994 100644 (file)
@@ -35,6 +35,7 @@
     #define DISABLE_NEPOMUK_LEGACY
 
     #include "commentwidget_p.h"
+    #include "metadataconfigurationdialog_p.h"
     #include "nepomukmassupdatejob_p.h"
     #include "taggingwidget_p.h"
 
@@ -68,6 +69,12 @@ public:
     void removeMetaInfoRows();
     void setRowVisible(QWidget* infoWidget, bool visible);
 
+    /**
+     * Parses the configuration file "kmetainformationrc" and
+     * updates the visibility of all rows.
+     */
+    void updateRowsVisibility();
+
     void slotLoadingFinished();
     void slotRatingChanged(unsigned int rating);
     void slotTagsChanged(const QList<Nepomuk::Tag>& tags);
@@ -81,6 +88,7 @@ public:
      */
     void startChangeDataJob(KJob* job);
 
+    QList<KFileItem> m_fileItems;
     QList<Row> m_rows;
 
     QGridLayout* m_gridLayout;
@@ -152,6 +160,7 @@ private:
 };
 
 MetaDataWidget::Private::Private(MetaDataWidget* parent) :
+    m_fileItems(),
     m_rows(),
     m_gridLayout(0),
     m_typeInfo(0),
@@ -207,6 +216,8 @@ MetaDataWidget::Private::Private(MetaDataWidget* parent) :
     m_loadFilesThread = new LoadFilesThread(&m_sharedData, &m_mutex);
     connect(m_loadFilesThread, SIGNAL(finished()), q, SLOT(slotLoadingFinished()));
 #endif
+
+    updateRowsVisibility();
 }
 
 MetaDataWidget::Private::~Private()
@@ -260,6 +271,22 @@ void MetaDataWidget::Private::setRowVisible(QWidget* infoWidget, bool visible)
     }
 }
 
+void MetaDataWidget::Private::updateRowsVisibility()
+{   
+    KConfig config("kmetainformationrc", KConfig::NoGlobals);
+    KConfigGroup settings = config.group("Show");
+    setRowVisible(m_typeInfo, settings.readEntry("type", true));
+    setRowVisible(m_sizeInfo, settings.readEntry("size", true));
+    setRowVisible(m_modifiedInfo, settings.readEntry("modified", true));
+    setRowVisible(m_ownerInfo, settings.readEntry("owner", true));
+    setRowVisible(m_permissionsInfo, settings.readEntry("permissions", true));
+#ifdef HAVE_NEPOMUK
+    setRowVisible(m_ratingWidget, settings.readEntry("rating", true));
+    setRowVisible(m_taggingWidget, settings.readEntry("tagging", true));
+    setRowVisible(m_commentWidget, settings.readEntry("comment", true));
+#endif
+}
+
 void MetaDataWidget::Private::slotLoadingFinished()
 {
 #ifdef HAVE_NEPOMUK
@@ -302,6 +329,8 @@ void MetaDataWidget::Private::slotLoadingFinished()
         delete m_rows[i].infoWidget;
         m_rows.pop_back();
     }
+
+    emit q->loadingFinished();
 #endif
 }
 
@@ -313,9 +342,8 @@ void MetaDataWidget::Private::slotRatingChanged(unsigned int rating)
             Nepomuk::MassUpdateJob::rateResources(m_sharedData.files.values(), rating);
     locker.unlock();
     startChangeDataJob(job);
-#else
-    Q_UNUSED(rating);
 #endif
+    emit q->ratingChanged(rating);
 }
 
 void MetaDataWidget::Private::slotTagsChanged(const QList<Nepomuk::Tag>& tags)
@@ -326,9 +354,8 @@ void MetaDataWidget::Private::slotTagsChanged(const QList<Nepomuk::Tag>& tags)
             Nepomuk::MassUpdateJob::tagResources(m_sharedData.files.values(), tags);
     locker.unlock();
     startChangeDataJob(job);
-#else
-    Q_UNUSED(tags);
 #endif
+    emit q->tagsChanged(tags);
 }
 
 void MetaDataWidget::Private::slotCommentChanged(const QString& comment)
@@ -339,9 +366,8 @@ void MetaDataWidget::Private::slotCommentChanged(const QString& comment)
             Nepomuk::MassUpdateJob::commentResources(m_sharedData.files.values(), comment);
     locker.unlock();
     startChangeDataJob(job);
-#else
-    Q_UNUSED(comment);
 #endif
+    emit q->commentChanged(comment);
 }
 
 void MetaDataWidget::Private::slotMetaDataUpdateDone()
@@ -434,7 +460,7 @@ void MetaDataWidget::Private::LoadFilesThread::run()
             QHash<QUrl, Nepomuk::Variant>::const_iterator it = properties.constBegin();
             while (it != properties.constEnd()) {
                 Nepomuk::Types::Property prop(it.key());
-                if (true /*settings.readEntry(prop.name(), true)*/) {
+                if (settings.readEntry(prop.name(), true)) {
                     // TODO #1: use Nepomuk::formatValue(res, prop) if available
                     // instead of it.value().toString()
                     // TODO #2: using tunedLabel() is a workaround for KDE 4.3 until
@@ -468,7 +494,7 @@ void MetaDataWidget::Private::LoadFilesThread::initMetaInfoSettings(KConfigGroup
             "asText", "contentSize", "depth", "fileExtension",
             "fileName", "fileSize", "isPartOf", "mimetype", "name",
             "parentUrl", "plainTextContent", "sourceModified",
-            "size", "url",
+            "url",
             0 // mandatory last entry
         };
 
@@ -537,6 +563,8 @@ void MetaDataWidget::setItem(const KFileItem& item)
 
 void MetaDataWidget::setItems(const KFileItemList& items)
 {
+    d->m_fileItems = items;
+
     if (items.count() > 1) {
         // calculate the size of all items and show this
         // information to the user
@@ -564,4 +592,55 @@ void MetaDataWidget::setItems(const KFileItemList& items)
 #endif
 }
 
+void MetaDataWidget::openConfigurationDialog()
+{
+#ifdef HAVE_NEPOMUK
+    if (d->m_fileItems.count() > 1) {
+        return;
+    }
+    const KUrl url = d->m_fileItems[0].nepomukUri();
+    if (!url.isValid()) {
+        return;
+    }
+
+    MetaDataConfigurationDialog dialog(url, this, Qt::Dialog);
+    KConfigGroup dialogConfig(KGlobal::config(), "Nepomuk MetaDataConfigurationDialog");
+    dialog.restoreDialogSize(dialogConfig);
+    if (dialog.exec() == KDialog::Accepted) {
+        d->updateRowsVisibility();
+    }
+    dialog.saveDialogSize(dialogConfig, KConfigBase::Persistent);
+#endif
+}
+
+unsigned int MetaDataWidget::rating() const
+{
+#ifdef HAVE_NEPOMUK
+    QMutexLocker locker(&d->m_mutex);
+    return d->m_sharedData.rating;
+#else
+    return 0;
+#endif
+}
+
+const QList<Nepomuk::Tag> MetaDataWidget::tags() const
+{
+#ifdef HAVE_NEPOMUK
+    QMutexLocker locker(&d->m_mutex);
+    return d->m_sharedData.tags;
+#else
+    return QList<Nepomuk::Tag>();
+#endif
+}
+
+QString MetaDataWidget::comment() const
+{
+#ifdef HAVE_NEPOMUK
+    QMutexLocker locker(&d->m_mutex);
+    return d->m_sharedData.comment;
+#else
+    return QString();
+#endif
+}
+
 #include "metadatawidget.moc"
index f12ce65d96efa147cd91fe7eeacd5905f7dd1e79..f1746030ca1122b4c6b60374052ca02f2cac9651 100644 (file)
@@ -40,7 +40,13 @@ class KFileItem;
 class KFileItemList;
 
 /**
- * @brief
+ * @brief Shows the meta data of one or more file items.
+ *
+ * Meta data like name, size, rating, comment, ... are
+ * shown as several rows containing a description and
+ * the meta data value. It is possible for the user
+ * to change specific meta data like rating, tags and
+ * comment.
  */
 class MetaDataWidget : public QWidget
 {
@@ -50,9 +56,83 @@ public:
     explicit MetaDataWidget(QWidget* parent = 0);
     virtual ~MetaDataWidget();
 
+    /**
+     * Triggers the asynchronous loading of the meta data
+     * for the file item \p item. Connect to the signal
+     * loadingFinished() to be able to read the meta
+     * data.
+     */
     void setItem(const KFileItem& item);
+
+    /**
+     * Triggers the asynchronous loading of the meta data
+     * for the file items \p items. Connect to the signal
+     * loadingFinished() to be able to read the meta
+     * data.
+     */
     void setItems(const KFileItemList& items);
 
+    /**
+     * Opens a dialog which allows to configure the visibility
+     * of meta data.
+     */
+    void openConfigurationDialog();
+
+    /**
+     * Returns the rating for the currently set item(s). It is required
+     * to wait for the signal loadingFinished() or ratingChanged()
+     * to get a valid result.
+     */
+    unsigned int rating() const;
+
+    /**
+     * Returns the tags for the currently set item(s). It is required
+     * to wait for the signal loadingFinished() or tagsChanged()
+     * to get a valid result.
+     */
+    const QList<Nepomuk::Tag> tags() const;
+
+    /**
+     * Returns the comment for the currently set item(s). It is required
+     * to wait for the signal loadingFinished() or commentChanged()
+     * to get a valid result.
+     */
+    QString comment() const;
+
+signals:
+    /**
+     * Is emitted if the loading of the meta data has been finished
+     * after invoking MetaDataWidget::setItem() or MetaDataWidget::setItems().
+     */
+    void loadingFinished();
+
+    /**
+     * Is emitted after the user has changed the rating.
+     * Note that the signal is not emitted if the rating has
+     * indirectly been changed by MetaDataWidget::setItem() or
+     * MetaDataWidget::setItems(). In this case connect to
+     * the signal loadingFinished() instead.
+     */
+    void ratingChanged(const int rating);
+
+    /**
+     * Is emitted after the user has changed the tags.
+     * Note that the signal is not emitted if the rating has
+     * indirectly been changed by MetaDataWidget::setItem() or
+     * MetaDataWidget::setItems(). In this case connect to
+     * the signal loadingFinished() instead.
+     */
+    void tagsChanged(const QList<Nepomuk::Tag>& tags);
+
+    /**
+     * Is emitted after the user has changed the comment.
+     * Note that the signal is not emitted if the rating has
+     * indirectly been changed by MetaDataWidget::setItem() or
+     * MetaDataWidget::setItems(). In this case connect to
+     * the signal loadingFinished() instead.
+     */
+    void commentChanged(const QString& comment);
+
 private:
     class Private;
     Private* d;
index caba8fd41e17f4203a9123ede466871e48f5de9b..057b17e551e0710ac4df570ef01568b81a2e7c26 100644 (file)
@@ -82,8 +82,7 @@ void TaggingWidget::slotLinkActivated(const QString& link)
     Q_UNUSED(link);
 
     EditTagsDialog dialog(m_tags, this, Qt::Dialog);
-    KConfigGroup dialogConfig(KSharedConfig::openConfig("dolphinrc"),
-                              "EditTagsDialog");
+    KConfigGroup dialogConfig(KGlobal::config(), "Nepomuk EditTagsDialog");
     dialog.restoreDialogSize(dialogConfig);
 
     if (dialog.exec() == QDialog::Accepted) {