]> cloud.milkyroute.net Git - dolphin.git/commitdiff
Use KFileMetaDataWidget from kdelibs. Still open: Provide dialog which wraps KFileMet...
authorPeter Penz <peter.penz19@gmail.com>
Mon, 22 Mar 2010 22:23:02 +0000 (22:23 +0000)
committerPeter Penz <peter.penz19@gmail.com>
Mon, 22 Mar 2010 22:23:02 +0000 (22:23 +0000)
svn path=/trunk/KDE/kdebase/apps/; revision=1106465

27 files changed:
src/CMakeLists.txt
src/panels/information/informationpanelcontent.cpp
src/panels/information/informationpanelcontent.h
src/panels/information/kcommentwidget.cpp [deleted file]
src/panels/information/kcommentwidget_p.h [deleted file]
src/panels/information/kedittagsdialog.cpp [deleted file]
src/panels/information/kedittagsdialog_p.h [deleted file]
src/panels/information/kloadmetadatathread.cpp [deleted file]
src/panels/information/kloadmetadatathread_p.h [deleted file]
src/panels/information/kmetadataconfigurationdialog.cpp [deleted file]
src/panels/information/kmetadataconfigurationdialog.h [deleted file]
src/panels/information/kmetadatamodel.cpp [deleted file]
src/panels/information/kmetadatamodel.h [deleted file]
src/panels/information/kmetadatawidget.cpp [deleted file]
src/panels/information/kmetadatawidget.h [deleted file]
src/panels/information/knfotranslator.cpp [deleted file]
src/panels/information/knfotranslator_p.h [deleted file]
src/panels/information/ktaggingwidget.cpp [deleted file]
src/panels/information/ktaggingwidget_p.h [deleted file]
src/panels/information/nepomukmassupdatejob.cpp [deleted file]
src/panels/information/nepomukmassupdatejob_p.h [deleted file]
src/settings/behaviorsettingspage.cpp
src/tooltips/tooltipmanager.cpp
src/versioncontrol/updateitemstatesthread.cpp
src/versioncontrol/updateitemstatesthread.h
src/versioncontrol/versioncontrolobserver.cpp
src/versioncontrol/versioncontrolobserver.h

index f6d63fc1161486310dd4338c6c37d485f811e4cd..0340a9856d3dff74f860ac425a0139e019be2c0c 100644 (file)
@@ -42,10 +42,6 @@ set(dolphinprivate_LIB_SRCS
     settings/dolphinsettings.cpp
     settings/viewpropertiesdialog.cpp
     settings/viewpropsprogressinfo.cpp
-    panels/information/kmetadataconfigurationdialog.cpp
-    panels/information/kmetadatamodel.cpp
-    panels/information/kmetadatawidget.cpp
-    panels/information/knfotranslator.cpp
     tooltips/ktooltip.cpp
     tooltips/ktooltipwindow.cpp
     tooltips/tooltipmanager.cpp
@@ -56,17 +52,6 @@ set(dolphinprivate_LIB_SRCS
     zoomlevelinfo.cpp
 )
 
-if(Nepomuk_FOUND)
-    set(dolphinprivate_LIB_SRCS
-        ${dolphinprivate_LIB_SRCS}
-        panels/information/kcommentwidget.cpp
-        panels/information/kedittagsdialog.cpp
-        panels/information/kloadmetadatathread.cpp
-        panels/information/nepomukmassupdatejob.cpp
-        panels/information/ktaggingwidget.cpp
-    )
-endif(Nepomuk_FOUND)
-
 kde4_add_kcfg_files(dolphinprivate_LIB_SRCS
     settings/dolphin_columnmodesettings.kcfgc
     settings/dolphin_directoryviewpropertysettings.kcfgc
@@ -126,10 +111,6 @@ set(dolphin_SRCS
     pixmapviewer.cpp
     panels/information/informationpanel.cpp
     panels/information/informationpanelcontent.cpp
-    panels/information/kmetadataconfigurationdialog.cpp
-    panels/information/kmetadatamodel.cpp
-    panels/information/kmetadatawidget.cpp
-    panels/information/knfotranslator.cpp
     panels/information/phononwidget.cpp
     panels/folders/ktreeview.cpp
     panels/places/placespanel.cpp
@@ -172,11 +153,6 @@ kde4_add_kcfg_files(dolphin_SRCS
 if(Nepomuk_FOUND)
     set(dolphin_SRCS
         ${dolphin_SRCS}
-        panels/information/kcommentwidget.cpp
-        panels/information/kedittagsdialog.cpp
-        panels/information/kloadmetadatathread.cpp
-        panels/information/nepomukmassupdatejob.cpp
-        panels/information/ktaggingwidget.cpp
         search/dolphinsearchoptionsconfigurator.cpp
         search/searchcriteriondescription.cpp
         search/searchcriterionselector.cpp
@@ -251,24 +227,10 @@ set(kcm_dolphinservices_PART_SRCS
 
 set(kcm_dolphingeneral_PART_SRCS
     kcm/kcmdolphingeneral.cpp
-    panels/information/kmetadataconfigurationdialog.cpp
-    panels/information/kmetadatamodel.cpp
-    panels/information/kmetadatawidget.cpp
-    panels/information/knfotranslator.cpp
     settings/behaviorsettingspage.cpp
     settings/previewssettingspage.cpp
     settings/contextmenusettingspage.cpp
     settings/settingspagebase.cpp)
-if (Nepomuk_FOUND)
-    set(kcm_dolphingeneral_PART_SRCS
-        ${kcm_dolphingeneral_PART_SRCS}
-        panels/information/kcommentwidget.cpp
-        panels/information/kedittagsdialog.cpp
-        panels/information/kloadmetadatathread.cpp
-        panels/information/nepomukmassupdatejob.cpp
-        panels/information/ktaggingwidget.cpp
-    )
-endif (Nepomuk_FOUND)
 
 kde4_add_kcfg_files(kcm_dolphinviewmodes_PART_SRCS
     settings/dolphin_columnmodesettings.kcfgc
index 87294bfc1e86f88b5f3f5be6a2811310ad599930..351b2d9c157f1ce6212caf1d256fc97cf7bb6e0b 100644 (file)
@@ -21,6 +21,7 @@
 
 #include <kdialog.h>
 #include <kfileitem.h>
+#include <kfilemetadatawidget.h>
 #include <kfileplacesmodel.h>
 #include <kio/previewjob.h>
 #include <kiconeffect.h>
@@ -46,9 +47,6 @@
 
 #include "dolphin_informationpanelsettings.h"
 #include "settings/dolphinsettings.h"
-#include "kmetadatamodel.h"
-#include "kmetadatawidget.h"
-#include "kmetadataconfigurationdialog.h"
 #include "phononwidget.h"
 #include "pixmapviewer.h"
 
@@ -102,8 +100,7 @@ InformationPanelContent::InformationPanelContent(QWidget* parent) :
     const bool showPreview = InformationPanelSettings::showPreview();
     m_preview->setVisible(showPreview);
 
-    m_metaDataWidget = new KMetaDataWidget(parent);
-    m_metaDataWidget->setModel(new KMetaDataModel(this));
+    m_metaDataWidget = new KFileMetaDataWidget(parent);
     m_metaDataWidget->setSizePolicy(QSizePolicy::Preferred, QSizePolicy::Minimum);
     connect(m_metaDataWidget, SIGNAL(urlActivated(KUrl)), this, SIGNAL(urlActivated(KUrl)));
 
@@ -195,7 +192,7 @@ void InformationPanelContent::showItem(const KFileItem& item)
             m_metaDataWidget->hide();
         } else {
             m_metaDataWidget->show();
-            m_metaDataWidget->setItem(item);
+            m_metaDataWidget->setItems(KFileItemList() << item);
         }
     }
 
@@ -295,11 +292,14 @@ void InformationPanelContent::configureSettings()
         m_preview->setVisible(isChecked);
         InformationPanelSettings::setShowPreview(isChecked);
     } else if (action == configureAction) {
-        QPointer<KMetaDataConfigurationDialog> dialog = new KMetaDataConfigurationDialog(m_metaDataWidget, this, Qt::Dialog);
-        dialog->setDescription(i18nc("@label::textbox",
-                               "Configure which data should be shown in the Information Panel."));
-        dialog->exec();
-        delete dialog;
+        // TODO:
+        //QPointer<KFileMetaDataConfigurationDialog> dialog =
+        //        new KFileMetaDataConfigurationDialog(this);
+        //dialog->setDescription(i18nc("@label::textbox",
+        //                       "Configure which data should be shown in the Information Panel."));
+        //dialog->setItems(m_metaDataWidget->items());
+        //dialog->exec();
+        //delete dialog;
     }
 
     if (!m_item.isNull() && m_item.nepomukUri().isValid()) {
@@ -317,7 +317,7 @@ void InformationPanelContent::showIcon(const KFileItem& item)
 }
 
 void InformationPanelContent::showPreview(const KFileItem& item,
-                                  const QPixmap& pixmap)
+                                          const QPixmap& pixmap)
 {
     m_outdatedPreviewTimer->stop();
 
index 2f32cf71731eb838e24366b7ef8976d0508833a4..92a1c62d7bd849e816d6f4469e7a792694092d9c 100644 (file)
@@ -27,7 +27,7 @@
 #include <kvbox.h>
 
 class KFileItem;
-class KMetaDataWidget;
+class KFileMetaDataWidget;
 class KSeparator;
 class MetaTextLabel;
 class PhononWidget;
@@ -128,7 +128,7 @@ private:
     PixmapViewer* m_preview;
     PhononWidget* m_phononWidget;
     QLabel* m_nameLabel;
-    KMetaDataWidget* m_metaDataWidget;
+    KFileMetaDataWidget* m_metaDataWidget;
     QScrollArea* m_metaDataArea;
 };
 
diff --git a/src/panels/information/kcommentwidget.cpp b/src/panels/information/kcommentwidget.cpp
deleted file mode 100644 (file)
index 408e6a8..0000000
+++ /dev/null
@@ -1,129 +0,0 @@
-/*****************************************************************************
- * Copyright (C) 2008 by Sebastian Trueg <trueg@kde.org>                     *
- * Copyright (C) 2009 by Peter Penz <peter.penz@gmx.at>                      *
- *                                                                           *
- * This library is free software; you can redistribute it and/or             *
- * modify it under the terms of the GNU Library General Public               *
- * License version 2 as published by the Free Software Foundation.           *
- *                                                                           *
- * This library 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         *
- * Library General Public License for more details.                          *
- *                                                                           *
- * You should have received a copy of the GNU Library General Public License *
- * along with this library; see the file COPYING.LIB.  If not, write to      *
- * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,      *
- * Boston, MA 02110-1301, USA.                                               *
- *****************************************************************************/
-
-#include "kcommentwidget_p.h"
-
-#include <kdialog.h>
-#include <kglobalsettings.h>
-#include <klocale.h>
-
-#include <QEvent>
-#include <QLabel>
-#include <QTextEdit>
-#include <QVBoxLayout>
-
-KCommentWidget::KCommentWidget(QWidget* parent) :
-    QWidget(parent),
-    m_readOnly(false),
-    m_label(0),
-    m_comment()
-{
-    m_label = new QLabel(this);
-    m_label->setFont(KGlobalSettings::smallestReadableFont());
-    m_label->setWordWrap(true);
-    m_label->setAlignment(Qt::AlignTop);
-    connect(m_label, SIGNAL(linkActivated(const QString&)), this, SLOT(slotLinkActivated(const QString&)));
-
-    QVBoxLayout* layout = new QVBoxLayout(this);
-    layout->setMargin(0);
-    layout->addWidget(m_label);
-
-    setText(m_comment);
-}
-
-KCommentWidget::~KCommentWidget()
-{
-}
-
-void KCommentWidget::setText(const QString& comment)
-{
-    QString text;
-    if (comment.isEmpty()) {        
-        if (m_readOnly) {
-            text = "-";
-        } else {
-            text = "<a href=\"addComment\">" + i18nc("@label", "Add Comment...") + "</a>";
-        }
-    } else {
-        if (m_readOnly) {
-            text = comment;
-        } else {
-            text = "<p>" + comment + " <a href=\"changeComment\">" + i18nc("@label", "Change...") + "</a></p>";
-        }
-    }
-
-    m_label->setText(text);
-    m_comment = comment;
-}
-
-QString KCommentWidget::text() const
-{
-    return m_comment;
-}
-
-void KCommentWidget::setReadOnly(bool readOnly)
-{
-    m_readOnly = readOnly;
-    setText(m_comment);
-}
-
-bool KCommentWidget::isReadOnly() const
-{
-    return m_readOnly;
-}
-
-bool KCommentWidget::event(QEvent* event)
-{
-    if (event->type() == QEvent::Polish) {
-        m_label->setForegroundRole(foregroundRole());
-    }
-    return QWidget::event(event);
-}
-
-void KCommentWidget::slotLinkActivated(const QString& link)
-{
-    KDialog dialog(this, Qt::Dialog);
-
-    QTextEdit* editor = new QTextEdit(&dialog);
-    editor->setText(m_comment);
-
-    dialog.setMainWidget(editor);
-
-    const QString caption = (link == "changeComment") ?
-                            i18nc("@title:window", "Change Comment") :
-                            i18nc("@title:window", "Add Comment");
-    dialog.setCaption(caption);
-    dialog.setButtons(KDialog::Ok | KDialog::Cancel);
-    dialog.setDefaultButton(KDialog::Ok);
-
-    KConfigGroup dialogConfig(KGlobal::config(), "Nepomuk KEditCommentDialog");
-    dialog.restoreDialogSize(dialogConfig);
-
-    if (dialog.exec() == QDialog::Accepted) {
-        const QString oldText = m_comment;
-        setText(editor->toPlainText());
-        if (oldText != m_comment) {
-            emit commentChanged(m_comment);
-        }
-    }
-
-    dialog.saveDialogSize(dialogConfig, KConfigBase::Persistent);
-}
-
-#include "kcommentwidget_p.moc"
diff --git a/src/panels/information/kcommentwidget_p.h b/src/panels/information/kcommentwidget_p.h
deleted file mode 100644 (file)
index b40fa71..0000000
+++ /dev/null
@@ -1,65 +0,0 @@
-/*****************************************************************************
- * Copyright (C) 2008 by Sebastian Trueg <trueg@kde.org>                     *
- * Copyright (C) 2009 by Peter Penz <peter.penz@gmx.at>                      *
- *                                                                           *
- * This library is free software; you can redistribute it and/or             *
- * modify it under the terms of the GNU Library General Public               *
- * License version 2 as published by the Free Software Foundation.           *
- *                                                                           *
- * This library 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         *
- * Library General Public License for more details.                          *
- *                                                                           *
- * You should have received a copy of the GNU Library General Public License *
- * along with this library; see the file COPYING.LIB.  If not, write to      *
- * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,      *
- * Boston, MA 02110-1301, USA.                                               *
- *****************************************************************************/
-
-#ifndef KCOMMENT_WIDGET
-#define KCOMMENT_WIDGET
-
-#include <QString>
-#include <QWidget>
-
-class QLabel;
-
-/**
- * @brief Allows to edit and show a comment as part of KMetaDataWidget.
- */
-class KCommentWidget : public QWidget
-{
-    Q_OBJECT
-
-public:
-    KCommentWidget(QWidget* parent);
-    virtual ~KCommentWidget();
-
-    void setText(const QString& comment);
-    QString text() const;
-
-    /**
-     * If set to true, the comment cannot be changed by the user.
-     * Per default read-only is disabled.
-     */
-    // TODO: provide common interface class for metadatawidgets
-    void setReadOnly(bool readOnly);
-    bool isReadOnly() const;
-
-signals:
-    void commentChanged(const QString& comment);
-
-protected:
-    virtual bool event(QEvent* event);
-
-private slots:
-    void slotLinkActivated(const QString& link);
-
-private:
-    bool m_readOnly;
-    QLabel* m_label;
-    QString m_comment;
-};
-
-#endif
diff --git a/src/panels/information/kedittagsdialog.cpp b/src/panels/information/kedittagsdialog.cpp
deleted file mode 100644 (file)
index fd637b7..0000000
+++ /dev/null
@@ -1,253 +0,0 @@
-/*****************************************************************************
- * Copyright (C) 2009 by Peter Penz <peter.penz@gmx.at>                      *
- *                                                                           *
- * This library is free software; you can redistribute it and/or             *
- * modify it under the terms of the GNU Library General Public               *
- * License version 2 as published by the Free Software Foundation.           *
- *                                                                           *
- * This library 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         *
- * Library General Public License for more details.                          *
- *                                                                           *
- * You should have received a copy of the GNU Library General Public License *
- * along with this library; see the file COPYING.LIB.  If not, write to      *
- * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,      *
- * Boston, MA 02110-1301, USA.                                               *
- *****************************************************************************/
-
-#include "kedittagsdialog_p.h"
-
-#include <kicon.h>
-#include <klineedit.h>
-#include <klocale.h>
-#include <kmessagebox.h>
-
-#include <QEvent>
-#include <QHBoxLayout>
-#include <QLabel>
-#include <QListWidget>
-#include <QPushButton>
-#include <QTimer>
-#include <QVBoxLayout>
-#include <QWidget>
-
-KEditTagsDialog::KEditTagsDialog(const QList<Nepomuk::Tag>& tags,
-                                 QWidget* parent,
-                                 Qt::WFlags flags) :
-    KDialog(parent, flags),
-    m_tags(tags),
-    m_tagsList(0),
-    m_newTagItem(0),
-    m_deleteCandidate(0),
-    m_newTagEdit(0),
-    m_deleteButtonTimer(0)
-{
-
-    const QString caption = (tags.count() > 0) ?
-                            i18nc("@title:window", "Change Tags") :
-                            i18nc("@title:window", "Add Tags");
-    setCaption(caption);
-    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 tags should "
-                                     "be applied."), this);
-
-    m_tagsList = new QListWidget(this);
-    m_tagsList->setMouseTracking(true);
-    m_tagsList->setSortingEnabled(true);
-    m_tagsList->setSelectionMode(QAbstractItemView::NoSelection);
-    m_tagsList->installEventFilter(this);
-    connect(m_tagsList, SIGNAL(itemEntered(QListWidgetItem*)),
-            this, SLOT(slotItemEntered(QListWidgetItem*)));
-    connect(m_tagsList, SIGNAL(itemEntered(QListWidgetItem*)),
-            this, SLOT(slotItemEntered(QListWidgetItem*)));
-
-    QLabel* newTagLabel = new QLabel(i18nc("@label", "Create new tag:"));
-    m_newTagEdit = new KLineEdit(this);
-    m_newTagEdit->setClearButtonShown(true);
-    connect(m_newTagEdit, SIGNAL(textEdited(const QString&)),
-            this, SLOT(slotTextEdited(const QString&)));
-
-    QHBoxLayout* newTagLayout = new QHBoxLayout();
-    newTagLayout->addWidget(newTagLabel);
-    newTagLayout->addWidget(m_newTagEdit, 1);
-
-    topLayout->addWidget(label);
-    topLayout->addWidget(m_tagsList);
-    topLayout->addLayout(newTagLayout);
-
-    setMainWidget(mainWidget);
-
-    loadTags();
-
-    // create the delete button, which is shown when
-    // hovering the items
-    m_deleteButton = new QPushButton(m_tagsList->viewport());
-    m_deleteButton->setIcon(KIcon("edit-delete"));
-    m_deleteButton->setToolTip(i18nc("@info", "Delete tag"));
-    m_deleteButton->hide();
-    connect(m_deleteButton, SIGNAL(clicked()), this, SLOT(deleteTag()));
-
-    m_deleteButtonTimer = new QTimer(this);
-    m_deleteButtonTimer->setSingleShot(true);
-    m_deleteButtonTimer->setInterval(500);
-    connect(m_deleteButtonTimer, SIGNAL(timeout()), this, SLOT(showDeleteButton()));
-}
-
-KEditTagsDialog::~KEditTagsDialog()
-{
-}
-
-QList<Nepomuk::Tag> KEditTagsDialog::tags() const
-{
-    return m_tags;
-}
-
-bool KEditTagsDialog::eventFilter(QObject* watched, QEvent* event)
-{
-    if ((watched == m_tagsList) && (event->type() == QEvent::Leave)) {
-        m_deleteButtonTimer->stop();
-        m_deleteButton->hide();
-    }
-    return KDialog::eventFilter(watched, event);
-}
-
-void KEditTagsDialog::slotButtonClicked(int button)
-{
-    if (button == KDialog::Ok) {
-        // update m_tags with the checked values, so
-        // that the caller of the KEditTagsDialog can
-        // receive the tags by KEditTagsDialog::tags()
-        m_tags.clear();
-
-        const int count = m_tagsList->count();
-        for (int i = 0; i < count; ++i) {
-            QListWidgetItem* item = m_tagsList->item(i);
-            if (item->checkState() == Qt::Checked) {
-                const QString label = item->data(Qt::UserRole).toString();
-                Nepomuk::Tag tag(label);
-                tag.setLabel(label);
-                m_tags.append(tag);
-            }
-        }
-
-        accept();
-    } else {
-        KDialog::slotButtonClicked(button);
-    }
-}
-
-void KEditTagsDialog::slotTextEdited(const QString& text)
-{
-    // Remove unnecessary spaces from a new tag is
-    // mandatory, as the user cannot see the difference
-    // between a tag "Test" and "Test ".
-    const QString tagText = text.simplified();
-    if (tagText.isEmpty()) {
-        removeNewTagItem();
-        return;
-    }
-
-    // Check whether the new tag already exists. If this
-    // is the case, remove the new tag item.
-    const int count = m_tagsList->count();
-    for (int i = 0; i < count; ++i) {
-        const QListWidgetItem* item = m_tagsList->item(i);
-        const bool remove = (item->text() == tagText) &&
-                            ((m_newTagItem == 0) || (m_newTagItem != item));
-        if (remove) {
-            m_tagsList->scrollToItem(item);
-            removeNewTagItem();
-            return;
-        }
-    }
-
-    // There is no tag in the list with the the passed text.
-    if (m_newTagItem == 0) {
-        m_newTagItem = new QListWidgetItem(tagText, m_tagsList);
-    } else {
-        m_newTagItem->setText(tagText);
-    }
-    m_newTagItem->setData(Qt::UserRole, tagText);
-    m_newTagItem->setCheckState(Qt::Checked);
-    m_tagsList->scrollToItem(m_newTagItem);
-}
-
-void KEditTagsDialog::slotItemEntered(QListWidgetItem* item)
-{
-    // align the delete-button to stay on the right border
-    // of the item
-    const QRect rect = m_tagsList->visualItemRect(item);
-    const int size = rect.height();
-    const int x = rect.right() - size;
-    const int y = rect.top();
-    m_deleteButton->move(x, y);
-    m_deleteButton->resize(size, size);
-
-    m_deleteCandidate = item;
-    m_deleteButtonTimer->start();
-}
-
-void KEditTagsDialog::showDeleteButton()
-{
-    m_deleteButton->show();
-}
-
-void KEditTagsDialog::deleteTag()
-{
-    Q_ASSERT(m_deleteCandidate != 0);
-    const QString text = i18nc("@info",
-                               "Should the tag <resource>%1</resource> really be deleted for all files?",
-                               m_deleteCandidate->text());
-    const QString caption = i18nc("@title", "Delete tag");
-    const KGuiItem deleteItem(i18nc("@action:button", "Delete"), KIcon("edit-delete"));
-    const KGuiItem cancelItem(i18nc("@action:button", "Cancel"), KIcon("dialog-cancel"));
-    if (KMessageBox::warningYesNo(this, text, caption, deleteItem, cancelItem) == KMessageBox::Yes) {
-        const QString label = m_deleteCandidate->data(Qt::UserRole).toString();
-        Nepomuk::Tag tag(label);
-        tag.remove();
-
-        delete m_deleteCandidate;
-        m_deleteCandidate = 0;
-    }
-}
-
-void KEditTagsDialog::loadTags()
-{
-    // load all available tags and mark those tags as checked
-    // that have been passed to the KEditTagsDialog
-    const QList<Nepomuk::Tag> tags = Nepomuk::Tag::allTags();
-    foreach (const Nepomuk::Tag& tag, tags) {
-        const QString label = tag.genericLabel();
-
-        QListWidgetItem* item = new QListWidgetItem(label, m_tagsList);
-        item->setData(Qt::UserRole, label);
-
-        bool check = false;
-        foreach (const Nepomuk::Tag& selectedTag, m_tags) {
-            if (selectedTag.label() == label) {
-                check = true;
-                break;
-            }
-        }
-        item->setCheckState(check ? Qt::Checked : Qt::Unchecked);
-    }
-}
-
-void KEditTagsDialog::removeNewTagItem()
-{
-    if (m_newTagItem != 0) {
-        const int row = m_tagsList->row(m_newTagItem);
-        m_tagsList->takeItem(row);
-        delete m_newTagItem;
-        m_newTagItem = 0;
-    }
-}
-
-#include "kedittagsdialog_p.moc"
diff --git a/src/panels/information/kedittagsdialog_p.h b/src/panels/information/kedittagsdialog_p.h
deleted file mode 100644 (file)
index c8bea88..0000000
+++ /dev/null
@@ -1,78 +0,0 @@
-/*****************************************************************************
- * Copyright (C) 2009 by Peter Penz <peter.penz@gmx.at>                      *
- *                                                                           *
- * This library is free software; you can redistribute it and/or             *
- * modify it under the terms of the GNU Library General Public               *
- * License version 2 as published by the Free Software Foundation.           *
- *                                                                           *
- * This library 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         *
- * Library General Public License for more details.                          *
- *                                                                           *
- * You should have received a copy of the GNU Library General Public License *
- * along with this library; see the file COPYING.LIB.  If not, write to      *
- * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,      *
- * Boston, MA 02110-1301, USA.                                               *
- *****************************************************************************/
-
-#ifndef KEDIT_TAGS_DIALOG_H
-#define KEDIT_TAGS_DIALOG_H
-
-#include <kdialog.h>
-#include <nepomuk/tag.h>
-
-class KLineEdit;
-class QListWidget;
-class QListWidgetItem;
-class QPushButton;
-class QTimer;
-
-/**
- * @brief Dialog to edit a list of Nepomuk tags.
- *
- * It is possible for the user to add existing tags,
- * create new tags or to remove tags.
- *
- * @see KMetaDataConfigurationDialog
- */
-class KEditTagsDialog : public KDialog
-{
-    Q_OBJECT
-
-public:
-    KEditTagsDialog(const QList<Nepomuk::Tag>& tags,
-                    QWidget* parent = 0,
-                    Qt::WFlags flags = 0);
-
-    virtual ~KEditTagsDialog();
-
-    QList<Nepomuk::Tag> tags() const;
-
-    virtual bool eventFilter(QObject* watched, QEvent* event);
-
-protected slots:
-    virtual void slotButtonClicked(int button);
-
-private slots:
-    void slotTextEdited(const QString& text);
-    void slotItemEntered(QListWidgetItem* item);
-    void showDeleteButton();
-    void deleteTag();
-
-private:
-    void loadTags();
-    void removeNewTagItem();
-
-private:
-    QList<Nepomuk::Tag> m_tags;
-    QListWidget* m_tagsList;
-    QListWidgetItem* m_newTagItem;
-    QListWidgetItem* m_deleteCandidate;
-    KLineEdit* m_newTagEdit;
-
-    QPushButton* m_deleteButton;
-    QTimer* m_deleteButtonTimer;
-};
-
-#endif
diff --git a/src/panels/information/kloadmetadatathread.cpp b/src/panels/information/kloadmetadatathread.cpp
deleted file mode 100644 (file)
index 374cded..0000000
+++ /dev/null
@@ -1,193 +0,0 @@
-/*****************************************************************************
- * Copyright (C) 2009-2010 by Peter Penz <peter.penz@gmx.at>                 *
- * Copyright (C) 2009 by Sebastian Trueg <trueg@kde.org>                     *
- *                                                                           *
- * This library is free software; you can redistribute it and/or             *
- * modify it under the terms of the GNU Library General Public               *
- * License version 2 as published by the Free Software Foundation.           *
- *                                                                           *
- * This library 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         *
- * Library General Public License for more details.                          *
- *                                                                           *
- * You should have received a copy of the GNU Library General Public License *
- * along with this library; see the file COPYING.LIB.  If not, write to      *
- * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,      *
- * Boston, MA 02110-1301, USA.                                               *
- *****************************************************************************/
-
-#include "kloadmetadatathread_p.h"
-
-#include <kconfig.h>
-#include <kconfiggroup.h>
-#include <kfilemetainfo.h>
-#include <kfilemetainfoitem.h>
-#include <kglobal.h>
-#include <klocale.h>
-#include "kmetadatamodel.h"
-#include <kprotocolinfo.h>
-
-#include <nepomuk/resource.h>
-#include <nepomuk/resourcemanager.h>
-
-KLoadMetaDataThread::KLoadMetaDataThread(KMetaDataModel* model) :
-    m_model(model),
-    m_data(),
-    m_urls(),
-    m_canceled(false)
-{
-    Q_ASSERT(model != 0);
-}
-
-KLoadMetaDataThread::~KLoadMetaDataThread()
-{
-}
-
-void KLoadMetaDataThread::load(const KUrl::List& urls)
-{
-    m_urls = urls;
-    m_canceled = false;
-    start();
-}
-
-QHash<KUrl, Nepomuk::Variant> KLoadMetaDataThread::data() const
-{
-    return m_data;
-}
-
-void KLoadMetaDataThread::cancel()
-{
-    // Setting m_canceled to true will cancel KLoadMetaDataThread::run()
-    // as soon as run() gets the chance to check m_cancel.
-    m_canceled = true;
-}
-
-void KLoadMetaDataThread::cancelAndDelete()
-{
-    if (isFinished()) {
-        Q_ASSERT(!isRunning());
-        deleteLater();
-    } else {
-        connect(this, SIGNAL(finished()), this, SLOT(slotFinished()));
-        // Setting m_canceled to true will cancel KLoadMetaDataThread::run()
-        // as soon as run() gets the chance to check m_cancel.
-        m_canceled = true;
-        // Afterwards the thread will delete itself
-        // asynchronously inside slotFinished().
-    }
-}
-
-void KLoadMetaDataThread::run()
-{
-    KConfig config("kmetainformationrc", KConfig::NoGlobals);
-    KConfigGroup settings = config.group("Show");
-
-    unsigned int rating = 0;
-    QString comment;
-    QList<Nepomuk::Tag> tags;
-
-    bool first = true;
-    foreach (const KUrl& url, m_urls) {
-        if (m_canceled) {
-            return;
-        }
-
-        Nepomuk::Resource file(url);
-        if (!file.isValid()) {
-            continue;
-        }
-
-        if (!first && (rating != file.rating())) {
-            rating = 0; // reset rating
-        } else if (first) {
-            rating = file.rating();
-        }
-
-        if (!first && (comment != file.description())) {
-            comment.clear(); // reset comment
-        } else if (first) {
-            comment = file.description();
-        }
-
-        if (!first && (tags != file.tags())) {
-            tags.clear(); // reset tags
-        } else if (first) {
-            tags = file.tags();
-        }
-
-        if (first && (m_urls.count() == 1)) {
-            // get cached meta data by checking the indexed files
-            QHash<QUrl, Nepomuk::Variant> variants = file.properties();
-            QHash<QUrl, Nepomuk::Variant>::const_iterator it = variants.constBegin();
-            while (it != variants.constEnd()) {
-                Nepomuk::Types::Property prop(it.key());
-                const QString uriString = prop.uri().toString();
-                if (settings.readEntry(uriString, true)) {
-                    m_data.insert(uriString, formatValue(it.value()));
-                }
-                ++it;
-            }
-
-            if (variants.isEmpty()) {
-                // the file has not been indexed, query the meta data
-                // directly from the file
-                KFileMetaInfo metaInfo(m_urls.first());
-                const QHash<QString, KFileMetaInfoItem> metaInfoItems = metaInfo.items();
-                foreach (const KFileMetaInfoItem& metaInfoItem, metaInfoItems) {
-                    const QString uriString = metaInfoItem.name();
-                    if (settings.readEntry(uriString, true)) {
-                        const Nepomuk::Variant value(metaInfoItem.value());
-                        m_data.insert(uriString, formatValue(value));
-                    }
-                }
-            }
-        }
-
-        first = false;
-    }
-
-    const bool isNepomukActivated = (Nepomuk::ResourceManager::instance()->init() == 0);
-    if (isNepomukActivated) {
-        m_data.insert(KUrl("kfileitem#rating"), rating);
-        m_data.insert(KUrl("kfileitem#comment"), comment);
-
-        QList<Nepomuk::Variant> tagVariants;
-        foreach (const Nepomuk::Tag& tag, tags) {
-            tagVariants.append(Nepomuk::Variant(tag));
-        }
-        m_data.insert(KUrl("kfileitem#tags"), tagVariants);
-    }
-
-    m_data.unite(m_model->loadData());
-}
-
-void KLoadMetaDataThread::slotFinished()
-{
-    deleteLater();
-}
-
-QString  KLoadMetaDataThread::formatValue(const Nepomuk::Variant& value)
-{
-    if (value.isDateTime()) {
-        return KGlobal::locale()->formatDateTime(value.toDateTime(), KLocale::FancyLongDate);
-    }
-
-    if (value.isResource() || value.isResourceList()) {
-        QStringList links;
-        foreach(const Nepomuk::Resource& res, value.toResourceList()) {
-            if (KProtocolInfo::isKnownProtocol(res.resourceUri())) {
-                links << QString::fromLatin1("<a href=\"%1\">%2</a>")
-                         .arg(KUrl(res.resourceUri()).url())
-                         .arg(res.genericLabel());
-            } else {
-                links << res.genericLabel();
-            }
-        }
-        return links.join(QLatin1String(";\n"));
-    }
-
-    return value.toString();
-}
-
-#include "kloadmetadatathread_p.moc"
diff --git a/src/panels/information/kloadmetadatathread_p.h b/src/panels/information/kloadmetadatathread_p.h
deleted file mode 100644 (file)
index d61d601..0000000
+++ /dev/null
@@ -1,97 +0,0 @@
-/*****************************************************************************
- * Copyright (C) 2009-2010 by Peter Penz <peter.penz@gmx.at>                 *
- *                                                                           *
- * This library is free software; you can redistribute it and/or             *
- * modify it under the terms of the GNU Library General Public               *
- * License version 2 as published by the Free Software Foundation.           *
- *                                                                           *
- * This library 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         *
- * Library General Public License for more details.                          *
- *                                                                           *
- * You should have received a copy of the GNU Library General Public License *
- * along with this library; see the file COPYING.LIB.  If not, write to      *
- * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,      *
- * Boston, MA 02110-1301, USA.                                               *
- *****************************************************************************/
-
-#ifndef KLOADMETADATATHREAD_H
-#define KLOADMETADATATHREAD_H
-
-#define DISABLE_NEPOMUK_LEGACY
-#include <nepomuk/property.h>
-#include <nepomuk/tag.h>
-#include <nepomuk/variant.h>
-
-#include <kurl.h>
-#include <QList>
-#include <QThread>
-
-class KMetaDataModel;
-
-/**
- * Loads the meta data of files that are
- * required by the widget KMetaDataWidget.
- */
-class KLoadMetaDataThread : public QThread
-{
-    Q_OBJECT
-
-public:
-    KLoadMetaDataThread(KMetaDataModel* model);
-    virtual ~KLoadMetaDataThread();
-
-    /**
-     * Starts the thread and loads the meta data for
-     * the files given by \p urls. After receiving
-     * the signal finished(), the method KLoadMetaDataThread::data()
-     * provides the loaded meta data.
-     */
-    void load(const KUrl::List& urls);
-
-    /**
-     * Returns the meta data for the URLs given
-     * by KLoadMetaDataThread::load(). The method only provides
-     * valid results after the signal finished() has been
-     * emitted.
-     */
-    QHash<KUrl, Nepomuk::Variant> data() const;
-
-    /**
-     * Tells the thread that it should cancel as soon
-     * as possible. It is undefined when the thread
-     * gets cancelled. The signal finished() will emitted
-     * after the cancelling has been done.mergedIt
-     */
-    void cancel();
-
-    /**
-     * Cancels the thread and assures that the thread deletes
-     * itself as soon as the cancelling has been successful. In
-     * opposite to QThread::wait() the caller of cancelAndDelete()
-     * will not be blocked.
-     */
-    void cancelAndDelete();
-
-    /** @see QThread::run() */
-    virtual void run();
-
-private slots:
-    void slotFinished();
-
-private:
-    /**
-     * Temporary helper method until there is a proper formatting facility in Nepomuk.
-     * Here we simply handle the most common formatting situations that do not look nice
-     * when using Nepomuk::Variant::toString().
-     */
-    QString formatValue(const Nepomuk::Variant& value);
-
-private:
-    KMetaDataModel* m_model;
-    QHash<KUrl, Nepomuk::Variant> m_data;
-    KUrl::List m_urls;
-    bool m_canceled;
-};
-#endif
diff --git a/src/panels/information/kmetadataconfigurationdialog.cpp b/src/panels/information/kmetadataconfigurationdialog.cpp
deleted file mode 100644 (file)
index e80a38e..0000000
+++ /dev/null
@@ -1,264 +0,0 @@
-/*****************************************************************************
- * Copyright (C) 2009 by Peter Penz <peter.penz@gmx.at>                      *
- *                                                                           *
- * This library is free software; you can redistribute it and/or             *
- * modify it under the terms of the GNU Library General Public               *
- * License version 2 as published by the Free Software Foundation.           *
- *                                                                           *
- * This library 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         *
- * Library General Public License for more details.                          *
- *                                                                           *
- * You should have received a copy of the GNU Library General Public License *
- * along with this library; see the file COPYING.LIB.  If not, write to      *
- * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,      *
- * Boston, MA 02110-1301, USA.                                               *
- *****************************************************************************/
-
-#include "kmetadataconfigurationdialog.h"
-
-
-#include <kfilemetainfo.h>
-#include <kfilemetainfoitem.h>
-#include "kmetadatamodel.h"
-#include "kmetadatawidget.h"
-#include "knfotranslator_p.h"
-#include <klocale.h>
-
-#include <config-nepomuk.h>
-#ifdef HAVE_NEPOMUK
-    #define DISABLE_NEPOMUK_LEGACY
-    #include <nepomuk/resource.h>
-    #include <nepomuk/resourcemanager.h>
-    #include <nepomuk/property.h>
-    #include <nepomuk/variant.h>
-#endif
-
-#include <QLabel>
-#include <QListWidget>
-#include <QVBoxLayout>
-
-class KMetaDataConfigurationDialog::Private
-{
-public:
-    Private(KMetaDataConfigurationDialog* parent, KMetaDataWidget* metaDataWidget);
-    ~Private();
-
-    void init();
-    void loadMetaData();
-    void addItem(const KUrl& uri);
-
-    void slotLoadingFinished();
-
-    int m_visibleDataTypes;
-    QLabel* m_descriptionLabel;
-    KMetaDataWidget* m_metaDataWidget;
-    QListWidget* m_metaDataList;
-
-private:
-    KMetaDataConfigurationDialog* const q;
-};
-
-KMetaDataConfigurationDialog::Private::Private(KMetaDataConfigurationDialog* parent,
-                                               KMetaDataWidget* metaDataWidget) :
-    q(parent)
-{
-    m_visibleDataTypes = 0;
-    m_metaDataWidget = metaDataWidget;
-
-    q->setCaption(i18nc("@title:window", "Configure Shown Data"));
-    q->setButtons(KDialog::Ok | KDialog::Cancel);
-    q->setDefaultButton(KDialog::Ok);
-
-    QWidget* mainWidget = new QWidget(q);
-    QVBoxLayout* topLayout = new QVBoxLayout(mainWidget);
-
-    m_descriptionLabel = new QLabel(i18nc("@label::textbox",
-                                          "Configure which data should "
-                                          "be shown"), q);
-    m_descriptionLabel->setWordWrap(true);
-
-    m_metaDataList = new QListWidget(q);
-    m_metaDataList->setSelectionMode(QAbstractItemView::NoSelection);
-    m_metaDataList->setSortingEnabled(true);
-
-    topLayout->addWidget(m_descriptionLabel);
-    topLayout->addWidget(m_metaDataList);
-
-    q->setMainWidget(mainWidget);
-
-    loadMetaData();
-
-    const KConfigGroup dialogConfig(KGlobal::config(), "Nepomuk KMetaDataConfigurationDialog");
-    q->restoreDialogSize(dialogConfig);
-}
-
-KMetaDataConfigurationDialog::Private::~Private()
-{
-    KConfigGroup dialogConfig(KGlobal::config(), "Nepomuk KMetaDataConfigurationDialog");
-    q->saveDialogSize(dialogConfig, KConfigBase::Persistent);
-}
-
-void KMetaDataConfigurationDialog::Private::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.
-    KMetaDataWidget::MetaDataTypes visibleDataTypes = KMetaDataWidget::TypeData |
-                                                      KMetaDataWidget::SizeData |
-                                                      KMetaDataWidget::ModifiedData |
-                                                      KMetaDataWidget::OwnerData |
-                                                      KMetaDataWidget::PermissionsData |
-                                                      KMetaDataWidget::RatingData |
-                                                      KMetaDataWidget::TagsData |
-                                                      KMetaDataWidget::CommentData;
-    if (m_metaDataWidget != 0) {
-        visibleDataTypes = m_metaDataWidget->visibleDataTypes();
-    }
-
-    typedef QPair<QString, QString> FixedItem;
-    QList<FixedItem> fixedItems;
-    if (visibleDataTypes & KMetaDataWidget::TypeData) {
-        fixedItems.append(FixedItem("kfileitem#type", i18nc("@item::inlistbox", "Type")));
-    }
-    if (visibleDataTypes & KMetaDataWidget::SizeData) {
-        fixedItems.append(FixedItem("kfileitem#size", i18nc("@item::inlistbox", "Size")));
-    }
-    if (visibleDataTypes & KMetaDataWidget::ModifiedData) {
-        fixedItems.append(FixedItem("kfileitem#modified", i18nc("@item::inlistbox", "Modified")));
-    }
-    if (visibleDataTypes & KMetaDataWidget::OwnerData) {
-        fixedItems.append(FixedItem("kfileitem#owner", i18nc("@item::inlistbox", "Owner")));
-    }
-    if (visibleDataTypes & KMetaDataWidget::PermissionsData) {
-        fixedItems.append(FixedItem("kfileitem#permissions", i18nc("@item::inlistbox", "Permissions")));
-    }
-
-    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);
-    }
-
-#ifdef HAVE_NEPOMUK
-    if ((m_metaDataWidget == 0) || (m_metaDataWidget->items().count() != 1)) {
-        return;
-    }
-
-    // Get all meta information labels that are available for
-    // the currently shown file item and add them to the list.
-    KMetaDataModel* model = m_metaDataWidget->model();
-    if (model != 0) {
-        const QHash<KUrl, Nepomuk::Variant> data = model->data();
-        QHash<KUrl, Nepomuk::Variant>::const_iterator it = data.constBegin();
-        while (it != data.constEnd()) {
-            addItem(it.key());
-            ++it;
-        }
-    }
-#endif
-}
-
-void KMetaDataConfigurationDialog::Private::addItem(const KUrl& uri)
-{
-    // Meta information provided by Nepomuk that is already
-    // available from KFileItem as "fixed item" (see above)
-    // should not be shown as second entry.
-    static const char* const hiddenProperties[] = {
-        "http://www.semanticdesktop.org/ontologies/2007/01/19/nie#comment",         // = fixed item kfileitem#comment
-        "http://www.semanticdesktop.org/ontologies/2007/01/19/nie#contentSize",     // = fixed item kfileitem#size
-        "http://www.semanticdesktop.org/ontologies/2007/01/19/nie#lastModified",    // = fixed item kfileitem#modified
-        "http://www.semanticdesktop.org/ontologies/2007/01/19/nie#plainTextContent" // hide this property always
-        "http://www.semanticdesktop.org/ontologies/2007/01/19/nie#mimeType",        // = fixed item kfileitem#type
-        "http://www.semanticdesktop.org/ontologies/2007/03/22/nfo#fileName",        // hide this property always
-        "http://www.w3.org/1999/02/22-rdf-syntax-ns#type",                          // = fixed item kfileitem#type
-        0 // mandatory last entry
-    };
-
-    int i = 0;
-    const QString key = uri.url();
-    while (hiddenProperties[i] != 0) {
-        if (key == QLatin1String(hiddenProperties[i])) {
-            // the item is hidden
-            return;
-        }
-        ++i;
-    }
-
-    // the item is not hidden, add it to the list
-    KConfig config("kmetainformationrc", KConfig::NoGlobals);
-    KConfigGroup settings = config.group("Show");
-
-    const QString label = (m_metaDataWidget == 0)
-                          ? KNfoTranslator::instance().translation(uri)
-                          : m_metaDataWidget->label(uri);
-
-    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);
-}
-
-KMetaDataConfigurationDialog::KMetaDataConfigurationDialog(QWidget* parent,
-                                                           Qt::WFlags flags) :
-    KDialog(parent, flags),
-    d(new Private(this, 0))
-{
-}
-
-KMetaDataConfigurationDialog::KMetaDataConfigurationDialog(KMetaDataWidget* metaDataWidget,
-                                                           QWidget* parent,
-                                                           Qt::WFlags flags) :
-    KDialog(parent, flags),
-    d(new Private(this, metaDataWidget))
-{
-}
-
-KMetaDataConfigurationDialog::~KMetaDataConfigurationDialog()
-{
-    delete d;
-}
-
-void KMetaDataConfigurationDialog::slotButtonClicked(int button)
-{
-    if (button == KDialog::Ok) {
-        KConfig config("kmetainformationrc", KConfig::NoGlobals);
-        KConfigGroup showGroup = config.group("Show");
-
-        const int count = d->m_metaDataList->count();
-        for (int i = 0; i < count; ++i) {
-            QListWidgetItem* item = d->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();
-
-        if (d->m_metaDataWidget != 0) {
-            // trigger an update
-            d->m_metaDataWidget->setVisibleDataTypes(d->m_metaDataWidget->visibleDataTypes());
-        }
-        accept();
-    } else {
-        KDialog::slotButtonClicked(button);
-    }
-}
-
-void KMetaDataConfigurationDialog::setDescription(const QString& description)
-{
-    d->m_descriptionLabel->setText(description);
-}
-
-QString KMetaDataConfigurationDialog::description() const
-{
-    return d->m_descriptionLabel->text();
-}
-
-#include "kmetadataconfigurationdialog.moc"
diff --git a/src/panels/information/kmetadataconfigurationdialog.h b/src/panels/information/kmetadataconfigurationdialog.h
deleted file mode 100644 (file)
index 02ac11d..0000000
+++ /dev/null
@@ -1,70 +0,0 @@
-/*****************************************************************************
- * Copyright (C) 2009 by Peter Penz <peter.penz@gmx.at>                      *
- *                                                                           *
- * This library is free software; you can redistribute it and/or             *
- * modify it under the terms of the GNU Library General Public               *
- * License version 2 as published by the Free Software Foundation.           *
- *                                                                           *
- * This library 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         *
- * Library General Public License for more details.                          *
- *                                                                           *
- * You should have received a copy of the GNU Library General Public License *
- * along with this library; see the file COPYING.LIB.  If not, write to      *
- * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,      *
- * Boston, MA 02110-1301, USA.                                               *
- *****************************************************************************/
-
-#ifndef KMETA_DATA_CONFIGURATION_DIALOG_H
-#define KMETA_DATA_CONFIGURATION_DIALOG_H
-
-#include <kdialog.h>
-
-class KMetaDataWidget;
-
-/**
- * @brief Dialog which allows to configure which meta data should be shown.
- * @see KMetaDataWidget
- */
-class KMetaDataConfigurationDialog : public KDialog
-{
-    Q_OBJECT
-
-public:
-    /**
-     * Allows to configure the visibility of all available meta
-     * data.
-     */
-    KMetaDataConfigurationDialog(QWidget* parent = 0,
-                                 Qt::WFlags flags = 0);
-
-    /**
-     * Allows to configure the visibility of the meta data
-     * shown by the meta data widget. The number of offered
-     * meta data is optimized for the set of file items
-     * that are applied to the meta data widget.
-     */
-    KMetaDataConfigurationDialog(KMetaDataWidget* metaDataWidget,
-                                 QWidget* parent = 0,
-                                 Qt::WFlags flags = 0);
-
-    /**
-     * Sets the description that is shown above the list
-     * of meta data. Per default the translated text for
-     * "Configure which data should be shown." is set.
-     */
-    void setDescription(const QString& description);
-    QString description() const;
-
-    virtual ~KMetaDataConfigurationDialog();
-
-protected slots:
-    virtual void slotButtonClicked(int button);
-
-private:
-    class Private;
-    Private* d;
-};
-
-#endif
diff --git a/src/panels/information/kmetadatamodel.cpp b/src/panels/information/kmetadatamodel.cpp
deleted file mode 100644 (file)
index 6a1898b..0000000
+++ /dev/null
@@ -1,156 +0,0 @@
-/*****************************************************************************
- * Copyright (C) 2010 by Peter Penz <peter.penz@gmx.at>                      *
- *                                                                           *
- * This library is free software; you can redistribute it and/or             *
- * modify it under the terms of the GNU Library General Public               *
- * License version 2 as published by the Free Software Foundation.           *
- *                                                                           *
- * This library 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         *
- * Library General Public License for more details.                          *
- *                                                                           *
- * You should have received a copy of the GNU Library General Public License *
- * along with this library; see the file COPYING.LIB.  If not, write to      *
- * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,      *
- * Boston, MA 02110-1301, USA.                                               *
- *****************************************************************************/
-
-#include "kmetadatamodel.h"
-
-#include <kfileitem.h>
-#include "kloadmetadatathread_p.h"
-#include <kurl.h>
-
-class KMetaDataModel::Private
-{
-
-public:
-    Private(KMetaDataModel* parent);
-    ~Private();
-
-    void slotLoadingFinished();
-
-    QList<KFileItem> m_fileItems;
-#ifdef HAVE_NEPOMUK
-    QHash<KUrl, Nepomuk::Variant> m_data;
-
-    QList<KLoadMetaDataThread*> m_metaDataThreads;
-    KLoadMetaDataThread* m_latestMetaDataThread;
-#endif
-
-private:
-    KMetaDataModel* const q;
-};
-
-KMetaDataModel::Private::Private(KMetaDataModel* parent) :
-    m_fileItems(),
-#ifdef HAVE_NEPOMUK
-    m_data(),
-    m_metaDataThreads(),
-    m_latestMetaDataThread(0),
-#endif
-    q(parent)
-{
-}
-
-KMetaDataModel::Private::~Private()
-{
-}
-
-KMetaDataModel::KMetaDataModel(QObject* parent) :
-    QObject(parent),
-    d(new Private(this))
-{
-}
-
-KMetaDataModel::~KMetaDataModel()
-{
-    delete d;
-}
-
-void KMetaDataModel::Private::slotLoadingFinished()
-{
-#ifdef HAVE_NEPOMUK
-    // The thread that has emitted the finished() signal
-    // will get deleted and removed from m_metaDataThreads.
-    const int threadsCount = m_metaDataThreads.count();
-    for (int i = 0; i < threadsCount; ++i) {
-        KLoadMetaDataThread* thread = m_metaDataThreads[i];
-        if (thread == q->sender()) {
-            m_metaDataThreads.removeAt(i);
-            if (thread != m_latestMetaDataThread) {
-                // Ignore data of older threads, as the data got
-                // obsolete by m_latestMetaDataThread.
-                thread->deleteLater();
-                return;
-            }
-        }
-    }
-
-    m_data = m_latestMetaDataThread->data();
-    m_latestMetaDataThread->deleteLater();
-#endif
-
-    emit q->loadingFinished();
-}
-
-void KMetaDataModel::setItems(const KFileItemList& items)
-{
-    d->m_fileItems = items;
-
-#ifdef HAVE_NEPOMUK
-    QList<KUrl> urls;
-    foreach (const KFileItem& item, items) {
-        const KUrl url = item.nepomukUri();
-        if (url.isValid()) {
-            urls.append(url);
-        }
-    }
-
-    // Cancel all threads that have not emitted a finished() signal.
-    // The deleting of those threads is done in slotLoadingFinished().
-    foreach (KLoadMetaDataThread* thread, d->m_metaDataThreads) {
-        thread->cancel();
-    }
-
-    // create a new thread that will provide the meeta data for the items
-    d->m_latestMetaDataThread = new KLoadMetaDataThread(this);
-    connect(d->m_latestMetaDataThread, SIGNAL(finished()), this, SLOT(slotLoadingFinished()));
-    d->m_latestMetaDataThread->load(urls);
-    d->m_metaDataThreads.append(d->m_latestMetaDataThread);
-#endif
-}
-
-QString KMetaDataModel::group(const KUrl& metaDataUri) const
-{
-    QString group; // return value
-
-    const QString uri = metaDataUri.url();
-    if (uri == QLatin1String("http://www.semanticdesktop.org/ontologies/2007/03/22/nfo#width")) {
-        group = QLatin1String("0sizeA");
-    } else if (uri == QLatin1String("http://www.semanticdesktop.org/ontologies/2007/03/22/nfo#height")) {
-        group = QLatin1String("0sizeB");
-    }
-
-    return group;
-}
-
-KFileItemList KMetaDataModel::items() const
-{
-    return d->m_fileItems;
-}
-
-#ifdef HAVE_NEPOMUK
-QHash<KUrl, Nepomuk::Variant> KMetaDataModel::data() const
-{
-    return d->m_data;
-}
-
-QHash<KUrl, Nepomuk::Variant> KMetaDataModel::loadData() const
-{
-    return QHash<KUrl, Nepomuk::Variant>();
-}
-#endif
-
-#include "kmetadatamodel.moc"
diff --git a/src/panels/information/kmetadatamodel.h b/src/panels/information/kmetadatamodel.h
deleted file mode 100644 (file)
index ad8099d..0000000
+++ /dev/null
@@ -1,113 +0,0 @@
-/*****************************************************************************
- * Copyright (C) 2010 by Peter Penz <peter.penz@gmx.at>                      *
- *                                                                           *
- * This library is free software; you can redistribute it and/or             *
- * modify it under the terms of the GNU Library General Public               *
- * License version 2 as published by the Free Software Foundation.           *
- *                                                                           *
- * This library 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         *
- * Library General Public License for more details.                          *
- *                                                                           *
- * You should have received a copy of the GNU Library General Public License *
- * along with this library; see the file COPYING.LIB.  If not, write to      *
- * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,      *
- * Boston, MA 02110-1301, USA.                                               *
- *****************************************************************************/
-
-#ifndef KMETADATAMODEL_H
-#define KMETADATAMODEL_H
-
-#include <kurl.h>
-
-#include <QHash>
-#include <QObject>
-#include <QString>
-
-#include <config-nepomuk.h>
-#ifdef HAVE_NEPOMUK
-    #define DISABLE_NEPOMUK_LEGACY
-    #include <nepomuk/variant.h>
-#endif
-
-class KFileItemList;
-class KUrl;
-
-/**
- * @brief Provides the data for the KMetaDataWidget.
- *
- * The default implementation provides all meta data
- * that are available due to Strigi and Nepomuk. If custom
- * meta data should be added, the method KMetaDataModel::loadData()
- * must be overwritten.
- *
- * @see KMetaDataWidget
- */
-class KMetaDataModel : public QObject
-{
-    Q_OBJECT
-
-public:
-    explicit KMetaDataModel(QObject* parent = 0);
-    virtual ~KMetaDataModel();
-
-    /**
-     * Sets the items, where the meta data should be
-     * requested. The loading of the meta data is done
-     * asynchronously. The signal loadingFinished() is
-     * emitted, as soon as the loading has been finished.
-     * The meta data can be retrieved by
-     * KMetaDataModel::data() afterwards.
-     */
-    void setItems(const KFileItemList& items);
-    KFileItemList items() const;
-
-    /**
-     * @return Returns the name of the group the meta data indicated
-     *         by \p metaDataUri belongs to. All meta data items are
-     *         sorted by the group. Items within the group are sorted
-     *         by their translated labels. The group name is not shown
-     *         to the user interface and does not need to get translated.
-     */
-    virtual QString group(const KUrl& metaDataUri) const;
-
-#ifdef HAVE_NEPOMUK
-    /**
-     * @return Meta data for the items that have been set by
-     *         KMetaDataModel::setItems(). The method should
-     *         be invoked after the signal loadingFinished() has
-     *         been received (otherwise no data will be returned).
-     */
-    QHash<KUrl, Nepomuk::Variant> data() const;
-
-protected:
-    /**
-     * Implement this method if custom meta data should be retrieved
-     * and added to the list returned by KMetaDataModel::data().
-     * Use KMetaDataModel::items() to get the list of items, where
-     * the meta data should be requested. The method is invoked in
-     * a custom thread context, so that the user interface won't get
-     * blocked if the operation takes longer. The default implementation
-     * returns an empty list.
-     */
-    virtual QHash<KUrl, Nepomuk::Variant> loadData() const;
-#endif
-
-signals:
-    /**
-     * Is emitted after the loading triggered by KMetaDataModel::setItems()
-     * has been finished.
-     */
-    void loadingFinished();
-
-private:
-    class Private;
-    Private* d;
-
-    Q_PRIVATE_SLOT(d, void slotLoadingFinished())
-
-    friend class KLoadMetaDataThread; // invokes KMetaDataObject::loadData()
-};
-
-#endif
diff --git a/src/panels/information/kmetadatawidget.cpp b/src/panels/information/kmetadatawidget.cpp
deleted file mode 100644 (file)
index 654962a..0000000
+++ /dev/null
@@ -1,791 +0,0 @@
-/*****************************************************************************
- * Copyright (C) 2008 by Sebastian Trueg <trueg@kde.org>                     *
- * Copyright (C) 2009-2010 by Peter Penz <peter.penz@gmx.at>                 *
- *                                                                           *
- * This library is free software; you can redistribute it and/or             *
- * modify it under the terms of the GNU Library General Public               *
- * License version 2 as published by the Free Software Foundation.           *
- *                                                                           *
- * This library 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         *
- * Library General Public License for more details.                          *
- *                                                                           *
- * You should have received a copy of the GNU Library General Public License *
- * along with this library; see the file COPYING.LIB.  If not, write to      *
- * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,      *
- * Boston, MA 02110-1301, USA.                                               *
- *****************************************************************************/
-
-#include "kmetadatawidget.h"
-
-#include <kconfig.h>
-#include <kconfiggroup.h>
-#include <kfileitem.h>
-#include <kglobalsettings.h>
-#include <kglobal.h>
-#include <klocale.h>
-#include "kmetadatamodel.h"
-#include "knfotranslator_p.h"
-
-#include <QEvent>
-#include <QFontMetrics>
-#include <QGridLayout>
-#include <QLabel>
-#include <QList>
-#include <QString>
-
-#include <config-nepomuk.h>
-#ifdef HAVE_NEPOMUK
-    #define DISABLE_NEPOMUK_LEGACY
-
-    #include "kcommentwidget_p.h"
-    #include "ktaggingwidget_p.h"
-
-    #include <nepomuk/kratingwidget.h>
-    #include <nepomuk/resource.h>
-    #include <nepomuk/resourcemanager.h>
-    #include <nepomuk/property.h>
-    #include <nepomuk/tag.h>
-    #include "nepomukmassupdatejob_p.h"
-
-    #include <QMutex>
-    #include <QSpacerItem>
-    #include <QThread>
-#else
-    namespace Nepomuk
-    {
-        typedef int Tag;
-    }
-#endif
-
-class KMetaDataWidget::Private
-{
-public:
-    struct Row
-    {
-        QLabel* label;
-        QLabel* defaultValueWidget;
-        QWidget* customValueWidget;
-    };
-
-    Private(KMetaDataWidget* parent);
-    ~Private();
-
-    void addRow(QLabel* label, QLabel* valueWidget);
-    void setCustomValueWidget(int rowIndex, QWidget* valueWidget);
-    void setRowVisible(QWidget* valueWidget, bool visible);
-
-    /**
-     * Initializes the configuration file "kmetainformationrc"
-     * with proper default settings for the first start in
-     * an uninitialized environment.
-     */
-    void initMetaInfoSettings();
-
-    /**
-     * 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);
-    void slotCommentChanged(const QString& comment);
-
-    void slotMetaDataUpdateDone();
-    void slotLinkActivated(const QString& link);
-
-    void slotTagActivated(const Nepomuk::Tag& tag);
-
-#ifdef HAVE_NEPOMUK
-    /**
-     * Disables the metadata widget and starts the job that
-     * changes the meta data asynchronously. After the job
-     * has been finished, the metadata widget gets enabled again.
-     */
-    void startChangeDataJob(KJob* job);
-
-    QList<KUrl> sortedKeys(const QHash<KUrl, Nepomuk::Variant>& data) const;
-    QList<Nepomuk::Resource> resourceList() const;
-#endif
-
-    bool m_sizeVisible;
-    bool m_readOnly;
-    bool m_nepomukActivated;
-    int m_fixedRowCount;
-    MetaDataTypes m_visibleDataTypes;
-    QList<KFileItem> m_fileItems;
-    QList<Row> m_rows;
-
-    KMetaDataModel* m_model;
-
-    QGridLayout* m_gridLayout;
-
-    QLabel* m_typeInfo;
-    QLabel* m_sizeLabel;
-    QLabel* m_sizeInfo;
-    QLabel* m_modifiedInfo;
-    QLabel* m_ownerInfo;
-    QLabel* m_permissionsInfo;
-
-#ifdef HAVE_NEPOMUK
-    KRatingWidget* m_ratingWidget;
-    KTaggingWidget* m_taggingWidget;
-    KCommentWidget* m_commentWidget;
-#endif
-
-private:
-    KMetaDataWidget* const q;
-};
-
-KMetaDataWidget::Private::Private(KMetaDataWidget* parent) :
-    m_sizeVisible(true),
-    m_readOnly(false),
-    m_nepomukActivated(false),
-    m_fixedRowCount(0),
-    m_visibleDataTypes(TypeData | SizeData | ModifiedData | OwnerData |
-                PermissionsData | RatingData | TagsData | CommentData),
-    m_fileItems(),
-    m_rows(),
-    m_model(0),
-    m_gridLayout(0),
-    m_typeInfo(0),
-    m_sizeLabel(0),
-    m_sizeInfo(0),
-    m_modifiedInfo(0),
-    m_ownerInfo(0),
-    m_permissionsInfo(0),
-#ifdef HAVE_NEPOMUK
-    m_ratingWidget(0),
-    m_taggingWidget(0),
-    m_commentWidget(0),
-#endif
-    q(parent)
-{
-    const QFontMetrics fontMetrics(KGlobalSettings::smallestReadableFont());
-
-    m_gridLayout = new QGridLayout(parent);
-    m_gridLayout->setMargin(0);
-    m_gridLayout->setSpacing(fontMetrics.height() / 4);
-
-    m_typeInfo = new QLabel(parent);
-    m_sizeLabel = new QLabel(parent);
-    m_sizeInfo = new QLabel(parent);
-    m_modifiedInfo = new QLabel(parent);
-    m_ownerInfo = new QLabel(parent);
-    m_permissionsInfo = new QLabel(parent);
-
-#ifdef HAVE_NEPOMUK
-    m_nepomukActivated = (Nepomuk::ResourceManager::instance()->init() == 0);
-    if (m_nepomukActivated) {
-        m_ratingWidget = new KRatingWidget(parent);
-        m_ratingWidget->setFixedHeight(fontMetrics.height());
-        const Qt::Alignment align = (parent->layoutDirection() == Qt::LeftToRight) ?
-                                    Qt::AlignLeft : Qt::AlignRight;
-        m_ratingWidget->setAlignment(align);
-        connect(m_ratingWidget, SIGNAL(ratingChanged(unsigned int)),
-                q, SLOT(slotRatingChanged(unsigned int)));
-        m_ratingWidget->setVisible(false);
-
-        m_taggingWidget = new KTaggingWidget(parent);
-        connect(m_taggingWidget, SIGNAL(tagsChanged(const QList<Nepomuk::Tag>&)),
-                q, SLOT(slotTagsChanged(const QList<Nepomuk::Tag>&)));
-        connect(m_taggingWidget, SIGNAL(tagActivated(const Nepomuk::Tag&)),
-                q, SLOT(slotTagActivated(const Nepomuk::Tag&)));
-        m_taggingWidget->setVisible(false);
-
-        m_commentWidget = new KCommentWidget(parent);
-        connect(m_commentWidget, SIGNAL(commentChanged(const QString&)),
-                q, SLOT(slotCommentChanged(const QString&)));
-        m_commentWidget->setVisible(false);
-    }
-#endif
-
-    initMetaInfoSettings();
-}
-
-KMetaDataWidget::Private::~Private()
-{
-}
-
-void KMetaDataWidget::Private::addRow(QLabel* label, QLabel* valueWidget)
-{
-    Row row;
-    row.label = label;
-    row.defaultValueWidget = valueWidget;
-    row.customValueWidget = 0;
-    m_rows.append(row);
-
-    const QFont smallFont = KGlobalSettings::smallestReadableFont();
-    // use a brighter color for the label and a small font size
-    QPalette palette = label->palette();
-    const QPalette::ColorRole role = q->foregroundRole();
-    QColor textColor = palette.color(role);
-    textColor.setAlpha(128);
-    palette.setColor(role, textColor);
-    label->setPalette(palette);
-    label->setForegroundRole(role);
-    label->setFont(smallFont);
-    label->setWordWrap(true);
-    label->setAlignment(Qt::AlignTop | Qt::AlignRight);
-
-    valueWidget->setForegroundRole(role);
-    valueWidget->setFont(smallFont);
-    valueWidget->setWordWrap(true);
-    valueWidget->setAlignment(Qt::AlignTop | Qt::AlignLeft);
-
-    // add the row to grid layout
-    const int rowIndex = m_rows.count() - 1;
-    m_gridLayout->addWidget(label, rowIndex, 0, Qt::AlignRight);
-    const int spacerWidth = QFontMetrics(smallFont).size(Qt::TextSingleLine, " ").width();
-    m_gridLayout->addItem(new QSpacerItem(spacerWidth, 1), rowIndex, 1);
-    m_gridLayout->addWidget(valueWidget, rowIndex, 2, Qt::AlignLeft);
-}
-
-void KMetaDataWidget::Private::setCustomValueWidget(int rowIndex, QWidget* valueWidget)
-{
-    Row& row = m_rows[rowIndex];
-
-    if (valueWidget == 0) {
-        // remove current custom value widget from the grid and replace it
-        // by the default value widget
-        if (row.customValueWidget != 0) {
-            row.customValueWidget->setVisible(false);
-            m_gridLayout->removeWidget(row.customValueWidget);
-        }
-        m_gridLayout->addWidget(row.defaultValueWidget, rowIndex, 2, Qt::AlignLeft);
-        row.defaultValueWidget->setVisible(true);
-    } else {
-        // remove the default value widget from the grid and replace it
-        // by the custom value widget
-        row.defaultValueWidget->setVisible(false);
-        m_gridLayout->removeWidget(row.defaultValueWidget);
-        m_gridLayout->addWidget(valueWidget, rowIndex, 2, Qt::AlignLeft);
-        valueWidget->setVisible(true);
-    }
-
-    row.customValueWidget = valueWidget;
-}
-
-void KMetaDataWidget::Private::setRowVisible(QWidget* valueWidget, bool visible)
-{
-    foreach (const Row& row, m_rows) {
-        const bool found = (row.defaultValueWidget == valueWidget) ||
-                           (row.customValueWidget == valueWidget);
-        if (found) {
-            row.label->setVisible(visible);
-            if (row.customValueWidget != 0) {
-                row.customValueWidget->setVisible(visible);
-                row.defaultValueWidget->setVisible(false);
-            } else {
-                row.defaultValueWidget->setVisible(visible);
-            }
-            return;
-        }
-    }
-}
-
-void KMetaDataWidget::Private::initMetaInfoSettings()
-{
-    const int currentVersion = 3; // increase version, if the blacklist of disabled
-                                  // properties should be updated
-
-    KConfig config("kmetainformationrc", KConfig::NoGlobals);
-    if (config.group("Misc").readEntry("version", 0) < currentVersion) {
-        // The resource file is read the first time. Assure
-        // that some meta information is disabled per default.
-
-        // clear old info
-        config.deleteGroup("Show");
-        KConfigGroup settings = config.group("Show");
-
-        static const char* const disabledProperties[] = {
-            "http://www.semanticdesktop.org/ontologies/2007/01/19/nie#comment",
-            "http://www.semanticdesktop.org/ontologies/2007/01/19/nie#contentSize",
-            "http://www.semanticdesktop.org/ontologies/2007/01/19/nie#depends",
-            "http://www.semanticdesktop.org/ontologies/2007/01/19/nie#isPartOf",
-            "http://www.semanticdesktop.org/ontologies/2007/01/19/nie#lastModified",
-            "http://www.semanticdesktop.org/ontologies/2007/01/19/nie#mimeType",
-            "http://www.semanticdesktop.org/ontologies/2007/01/19/nie#plainTextContent",
-            "http://www.semanticdesktop.org/ontologies/2007/01/19/nie#url",
-            "http://www.semanticdesktop.org/ontologies/2007/03/22/nfo#averageBitrate",
-            "http://www.semanticdesktop.org/ontologies/2007/03/22/nfo#channels",
-            "http://www.semanticdesktop.org/ontologies/2007/03/22/nfo#fileName",
-            "http://www.semanticdesktop.org/ontologies/2007/05/10/nexif#apertureValue",
-            "http://www.semanticdesktop.org/ontologies/2007/05/10/nexif#exposureBiasValue",
-            "http://www.semanticdesktop.org/ontologies/2007/05/10/nexif#exposureTime",
-            "http://www.semanticdesktop.org/ontologies/2007/05/10/nexif#flash",
-            "http://www.semanticdesktop.org/ontologies/2007/05/10/nexif#focalLength",
-            "http://www.semanticdesktop.org/ontologies/2007/05/10/nexif#focalLengthIn35mmFilm",
-            "http://www.semanticdesktop.org/ontologies/2007/05/10/nexif#isoSpeedRatings",
-            "http://www.semanticdesktop.org/ontologies/2007/05/10/nexif#make",
-            "http://www.semanticdesktop.org/ontologies/2007/05/10/nexif#meteringMode",
-            "http://www.semanticdesktop.org/ontologies/2007/05/10/nexif#model",
-            "http://www.semanticdesktop.org/ontologies/2007/05/10/nexif#orientation",
-            "http://www.semanticdesktop.org/ontologies/2007/05/10/nexif#whiteBalance",
-            "http://www.semanticdesktop.org/ontologies/2007/08/15/nao#description",
-            "http://www.semanticdesktop.org/ontologies/2007/08/15/nao#hasTag",
-            "http://www.semanticdesktop.org/ontologies/2007/08/15/nao#lastModified",
-            "http://www.semanticdesktop.org/ontologies/2007/08/15/nao#numericRating",
-            "http://www.w3.org/1999/02/22-rdf-syntax-ns#type",
-            "kfileitem#owner",
-            "kfileitem#permissions",
-            0 // mandatory last entry
-        };
-
-        for (int i = 0; disabledProperties[i] != 0; ++i) {
-            settings.writeEntry(disabledProperties[i], false);
-        }
-
-        // mark the group as initialized
-        config.group("Misc").writeEntry("version", currentVersion);
-    }
-}
-
-void KMetaDataWidget::Private::updateRowsVisibility()
-{
-    KConfig config("kmetainformationrc", KConfig::NoGlobals);
-    KConfigGroup settings = config.group("Show");
-
-    setRowVisible(m_typeInfo,
-                  (m_visibleDataTypes & KMetaDataWidget::TypeData) &&
-                  settings.readEntry("kfileitem#type", true));
-
-    // Cache in m_sizeVisible whether the size should be shown. This
-    // is necessary as the size is temporary hidden when the target
-    // file item is a directory.
-    m_sizeVisible = (m_visibleDataTypes & KMetaDataWidget::SizeData) &&
-                      settings.readEntry("kfileitem#size", true);
-    bool visible = m_sizeVisible;
-    if (visible && (m_fileItems.count() == 1)) {
-        // don't show the size information, if one directory is shown
-        const KFileItem item = m_fileItems.first();
-        visible = !item.isNull() && !item.isDir();
-    }
-    setRowVisible(m_sizeInfo, visible);
-
-    setRowVisible(m_modifiedInfo,
-                  (m_visibleDataTypes & KMetaDataWidget::ModifiedData) &&
-                  settings.readEntry("kfileitem#modified", true));
-
-    setRowVisible(m_ownerInfo,
-                  (m_visibleDataTypes & KMetaDataWidget::OwnerData) &&
-                  settings.readEntry("kfileitem#owner", true));
-
-    setRowVisible(m_permissionsInfo,
-                  (m_visibleDataTypes & KMetaDataWidget::PermissionsData) &&
-                  settings.readEntry("kfileitem#permissions", true));
-
-#ifdef HAVE_NEPOMUK
-    if (m_nepomukActivated) {
-        setRowVisible(m_ratingWidget,
-                      (m_visibleDataTypes & KMetaDataWidget::RatingData) &&
-                      settings.readEntry("kfileitem#rating", true));
-
-        setRowVisible(m_taggingWidget,
-                      (m_visibleDataTypes & KMetaDataWidget::TagsData) &&
-                      settings.readEntry("kfileitem#tags", true));
-
-        setRowVisible(m_commentWidget,
-                      (m_visibleDataTypes & KMetaDataWidget::CommentData) &&
-                      settings.readEntry("kfileitem#comment", true));
-    }
-#endif
-}
-
-void KMetaDataWidget::Private::slotLoadingFinished()
-{
-#ifdef HAVE_NEPOMUK
-    // Show the remaining meta information as text. The number
-    // of required rows may very. Existing rows are reused to
-    // prevent flickering and to increase the performance.
-    int rowIndex = m_fixedRowCount;
-
-    const QHash<KUrl, Nepomuk::Variant> data = m_model->data();
-    const QList<KUrl> keys = sortedKeys(data);
-
-    foreach (const KUrl& key, keys) {
-        const Nepomuk::Variant value = data[key];
-        const QString itemLabel = q->label(key);
-
-        const bool valueApplied = q->setValue(key, value);
-        if (rowIndex >= m_rows.count()) {
-            // a new row must get created
-            QLabel* label = new QLabel(itemLabel, q);
-            QLabel* valueWidget = new QLabel(q);
-            connect(valueWidget, SIGNAL(linkActivated(QString)),
-                    q, SLOT(slotLinkActivated(QString)));
-            addRow(label, valueWidget);
-        }
-
-        Q_ASSERT(m_rows[rowIndex].label != 0);
-        Q_ASSERT(m_rows[rowIndex].defaultValueWidget != 0);
-
-        // set label
-        m_rows[rowIndex].label->setText(itemLabel);
-
-        // set value
-        if (valueApplied) {
-            setCustomValueWidget(rowIndex, q->valueWidget(key));
-        } else {
-            QLabel* valueWidget = m_rows[rowIndex].defaultValueWidget;
-            valueWidget->setText(value.toString());
-            setCustomValueWidget(rowIndex, 0);
-        }
-        ++rowIndex;
-    }
-
-    // remove rows that are not needed anymore
-    for (int i = m_rows.count() - 1; i >= rowIndex; --i) {
-        delete m_rows[i].label;
-        delete m_rows[i].defaultValueWidget;
-        m_rows.pop_back();
-    }
-#endif
-
-    q->updateGeometry();
-}
-
-void KMetaDataWidget::Private::slotRatingChanged(unsigned int rating)
-{
-#ifdef HAVE_NEPOMUK
-    Nepomuk::MassUpdateJob* job =
-        Nepomuk::MassUpdateJob::rateResources(resourceList(), rating);
-    startChangeDataJob(job);
-#else
-    Q_UNUSED(rating);
-#endif
-}
-
-void KMetaDataWidget::Private::slotTagsChanged(const QList<Nepomuk::Tag>& tags)
-{
-#ifdef HAVE_NEPOMUK
-    m_taggingWidget->setTags(tags);
-
-    Nepomuk::MassUpdateJob* job =
-        Nepomuk::MassUpdateJob::tagResources(resourceList(), tags);
-    startChangeDataJob(job);
-#else
-    Q_UNUSED(tags);
-#endif
-}
-
-void KMetaDataWidget::Private::slotCommentChanged(const QString& comment)
-{
-#ifdef HAVE_NEPOMUK
-    Nepomuk::MassUpdateJob* job =
-        Nepomuk::MassUpdateJob::commentResources(resourceList(), comment);
-    startChangeDataJob(job);
-#else
-    Q_UNUSED(comment);
-#endif
-}
-
-void KMetaDataWidget::Private::slotTagActivated(const Nepomuk::Tag& tag)
-{
-#ifdef HAVE_NEPOMUK
-    emit q->urlActivated(tag.resourceUri());
-#else
-    Q_UNUSED(tag);
-#endif
-}
-
-void KMetaDataWidget::Private::slotMetaDataUpdateDone()
-{
-#ifdef HAVE_NEPOMUK
-    q->setEnabled(true);
-#endif
-}
-
-void KMetaDataWidget::Private::slotLinkActivated(const QString& link)
-{
-    emit q->urlActivated(KUrl(link));
-}
-
-#ifdef HAVE_NEPOMUK
-void KMetaDataWidget::Private::startChangeDataJob(KJob* job)
-{
-    connect(job, SIGNAL(result(KJob*)),
-            q, SLOT(slotMetaDataUpdateDone()));
-    q->setEnabled(false); // no updates during execution
-    job->start();
-}
-
-QList<KUrl> KMetaDataWidget::Private::sortedKeys(const QHash<KUrl, Nepomuk::Variant>& data) const
-{
-    // Create a map, where the translated label prefixed with the
-    // sort priority acts as key. The data of each entry is the URI
-    // of the data. By this the all URIs are sorted by the sort priority
-    // and sub sorted by the translated labels.
-    QMap<QString, KUrl> map;
-    QHash<KUrl, Nepomuk::Variant>::const_iterator hashIt = data.constBegin();
-    while (hashIt != data.constEnd()) {
-        const KUrl uri = hashIt.key();
-
-        QString key = q->model()->group(uri);
-        key += q->label(uri);
-
-        map.insert(key, uri);
-        ++hashIt;
-    }
-
-    // Apply the URIs from the map to the list that will get returned.
-    // The list will then be alphabetically ordered by the translated labels of the URIs.
-    QList<KUrl> list;
-    QMap<QString, KUrl>::const_iterator mapIt = map.constBegin();
-    while (mapIt != map.constEnd()) {
-        list.append(mapIt.value());
-        ++mapIt;
-    }
-
-    return list;
-}
-
-QList<Nepomuk::Resource> KMetaDataWidget::Private::resourceList() const
-{
-    QList<Nepomuk::Resource> list;
-    foreach (const KFileItem& item, m_fileItems) {
-        const KUrl url = item.url();
-        list.append(Nepomuk::Resource(url));
-    }
-    return list;
-}
-#endif
-
-KMetaDataWidget::KMetaDataWidget(QWidget* parent) :
-    QWidget(parent),
-    d(new Private(this))
-{
-}
-
-KMetaDataWidget::~KMetaDataWidget()
-{
-    delete d;
-}
-
-void KMetaDataWidget::setItem(const KFileItem& item)
-{
-    // update values for "type", "size", "modified",
-    // "owner" and "permissions" synchronously
-    d->m_sizeLabel->setText(i18nc("@label", "Size"));
-    if (item.isDir()) {
-        d->m_typeInfo->setText(i18nc("@label", "Folder"));
-        d->setRowVisible(d->m_sizeInfo, false);
-    } else {
-        d->m_typeInfo->setText(item.mimeComment());
-        d->m_sizeInfo->setText(KIO::convertSize(item.size()));
-        d->setRowVisible(d->m_sizeInfo, d->m_sizeVisible);
-    }
-    d->m_modifiedInfo->setText(KGlobal::locale()->formatDateTime(item.time(KFileItem::ModificationTime), KLocale::FancyLongDate));
-    d->m_ownerInfo->setText(item.user());
-    d->m_permissionsInfo->setText(item.permissionsString());
-
-    setItems(KFileItemList() << item);
-}
-
-void KMetaDataWidget::setItems(const KFileItemList& items)
-{
-    d->m_fileItems = items;
-    if (d->m_model != 0) {
-        d->m_model->setItems(items);
-    }
-
-    if (items.count() > 1) {
-        // calculate the size of all items and show this
-        // information to the user
-        d->m_sizeLabel->setText(i18nc("@label", "Total Size:"));
-        d->setRowVisible(d->m_sizeInfo, d->m_sizeVisible);
-
-        quint64 totalSize = 0;
-        foreach (const KFileItem& item, items) {
-            if (!item.isDir() && !item.isLink()) {
-                totalSize += item.size();
-            }
-        }
-        d->m_sizeInfo->setText(KIO::convertSize(totalSize));
-    }
-}
-
-void KMetaDataWidget::setItem(const KUrl& url)
-{
-    KFileItem item(KFileItem::Unknown, KFileItem::Unknown, url);
-    item.refresh();
-    setItem(item);
-}
-
-void KMetaDataWidget::setItems(const QList<KUrl>& urls)
-{
-    KFileItemList items;
-    foreach (const KUrl& url, urls) {
-        KFileItem item(KFileItem::Unknown, KFileItem::Unknown, url);
-        item.refresh();
-        items.append(item);
-    }
-    setItems(items);
-}
-
-KFileItemList KMetaDataWidget::items() const
-{
-    return d->m_fileItems;
-}
-
-void KMetaDataWidget::setModel(KMetaDataModel* model)
-{
-    if (d->m_model != 0) {
-        disconnect(d->m_model, SIGNAL(loadingFinished()));
-    }
-    d->m_model = model;
-    connect(d->m_model, SIGNAL(loadingFinished()), this, SLOT(slotLoadingFinished()));
-}
-
-KMetaDataModel* KMetaDataWidget::model() const
-{
-    return d->m_model;
-}
-
-void KMetaDataWidget::setReadOnly(bool readOnly)
-{
-    d->m_readOnly = readOnly;
-#ifdef HAVE_NEPOMUK
-    // TODO: encapsulate this code as part of a metadata-model for KDE 4.5
-    if (d->m_taggingWidget)
-        d->m_taggingWidget->setReadOnly(readOnly);
-    if (d->m_commentWidget)
-        d->m_commentWidget->setReadOnly(readOnly);
-#endif
-}
-
-bool KMetaDataWidget::isReadOnly() const
-{
-    return d->m_readOnly;
-}
-
-void KMetaDataWidget::setVisibleDataTypes(MetaDataTypes data)
-{
-    d->m_visibleDataTypes = data;
-    d->updateRowsVisibility();
-}
-
-KMetaDataWidget::MetaDataTypes KMetaDataWidget::visibleDataTypes() const
-{
-    return d->m_visibleDataTypes;
-}
-
-QSize KMetaDataWidget::sizeHint() const
-{
-    const int fixedWidth = 200;
-
-    int height = d->m_gridLayout->margin() * 2 +
-                 d->m_gridLayout->spacing() * (d->m_rows.count() - 1);
-
-    foreach (const Private::Row& row, d->m_rows) {
-        QWidget* valueWidget = row.defaultValueWidget;
-        if (valueWidget != 0) {
-            if (row.customValueWidget != 0) {
-                valueWidget = row.customValueWidget;
-            }
-
-            int rowHeight = valueWidget->heightForWidth(fixedWidth / 2);
-            if (rowHeight <= 0) {
-                rowHeight = valueWidget->sizeHint().height();
-            }
-            height += rowHeight;
-        }
-    }
-
-    return QSize(fixedWidth, height);
-}
-
-QString KMetaDataWidget::label(const KUrl& metaDataUri) const
-{
-    QString label;
-    const QString uri = metaDataUri.url();
-    if (uri == QLatin1String("kfileitem#rating")) {
-        label = i18nc("@label", "Rating");
-    } else if (uri == QLatin1String("kfileitem#tags")) {
-        label = i18nc("@label", "Tags");
-    } else if (uri == QLatin1String("kfileitem#comment")) {
-        label = i18nc("@label", "Comment");
-    } else {
-        label = KNfoTranslator::instance().translation(metaDataUri);
-    }
-
-    return label;
-}
-
-#ifdef HAVE_NEPOMUK
-QWidget* KMetaDataWidget::valueWidget(const KUrl& metaDataUri) const
-{
-    QWidget* widget = 0;
-
-    if (d->m_nepomukActivated) {
-        const QString uri = metaDataUri.url();
-        if (uri == QLatin1String("kfileitem#rating")) {
-            widget = d->m_ratingWidget;
-        } else if (uri == QLatin1String("kfileitem#tags")) {
-            widget = d->m_taggingWidget;
-        } else if (uri == QLatin1String("kfileitem#comment")) {
-            widget = d->m_commentWidget;
-        }
-    }
-
-    return widget;
-}
-
-bool KMetaDataWidget::setValue(const KUrl& metaDataUri, const Nepomuk::Variant& value)
-{
-    if (d->m_nepomukActivated) {
-        QWidget* widget = valueWidget(metaDataUri);
-        if (widget == d->m_ratingWidget) {
-            d->m_ratingWidget->setRating(value.toInt());
-            return true;
-        }
-
-        if (widget == d->m_taggingWidget) {
-            QList<Nepomuk::Variant> variants = value.toVariantList();
-            QList<Nepomuk::Tag> tags;
-            foreach (const Nepomuk::Variant& variant, variants) {
-                const Nepomuk::Resource resource = variant.toResource();
-                tags.append(static_cast<Nepomuk::Tag>(resource));
-            }
-            d->m_taggingWidget->setTags(tags);
-            return true;
-        }
-
-        if (widget == d->m_commentWidget) {
-            d->m_commentWidget->setText(value.toString());
-            return true;
-        }
-    }
-    return false;
-}
-#endif
-
-bool KMetaDataWidget::event(QEvent* event)
-{
-    if (event->type() == QEvent::Polish) {
-        // The adding of rows is not done in the constructor. This allows the
-        // client of KMetaDataWidget to set a proper foreground role which
-        // will be respected by the rows.
-
-        d->addRow(new QLabel(i18nc("@label file type", "Type"), this), d->m_typeInfo);
-        d->addRow(d->m_sizeLabel, d->m_sizeInfo);
-        d->addRow(new QLabel(i18nc("@label", "Modified"), this), d->m_modifiedInfo);
-        d->addRow(new QLabel(i18nc("@label", "Owner"), this), d->m_ownerInfo);
-        d->addRow(new QLabel(i18nc("@label", "Permissions"), this), d->m_permissionsInfo);
-
-        // The current number of rows represents meta data, that will be shown for
-        // all files. Dynamic meta data will be appended after those rows (see
-        // slotLoadingFinished()).
-        d->m_fixedRowCount = d->m_rows.count();
-
-        d->updateRowsVisibility();
-    }
-
-    return QWidget::event(event);
-}
-
-#include "kmetadatawidget.moc"
diff --git a/src/panels/information/kmetadatawidget.h b/src/panels/information/kmetadatawidget.h
deleted file mode 100644 (file)
index a31c70e..0000000
+++ /dev/null
@@ -1,202 +0,0 @@
-/*****************************************************************************
- * Copyright (C) 2008 by Sebastian Trueg <trueg@kde.org>                     *
- * Copyright (C) 2009-2010 by Peter Penz <peter.penz@gmx.at>                 *
- *                                                                           *
- * This library is free software; you can redistribute it and/or             *
- * modify it under the terms of the GNU Library General Public               *
- * License version 2 as published by the Free Software Foundation.           *
- *                                                                           *
- * This library 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         *
- * Library General Public License for more details.                          *
- *                                                                           *
- * You should have received a copy of the GNU Library General Public License *
- * along with this library; see the file COPYING.LIB.  If not, write to      *
- * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,      *
- * Boston, MA 02110-1301, USA.                                               *
- *****************************************************************************/
-
-#ifndef KMETADATAWIDGET_H
-#define KMETADATAWIDGET_H
-
-#include <kfileitem.h>
-
-#include <QList>
-#include <QWidget>
-
-#include <config-nepomuk.h>
-#ifdef HAVE_NEPOMUK
-    #define DISABLE_NEPOMUK_LEGACY
-    #include <nepomuk/variant.h>
-#endif
-
-class KMetaDataModel;
-class KUrl;
-
-/**
- * @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. The changes are stored automatically by the
- * meta data widget.
- *
- * To show more than basic meta data, the meta data widget
- * must be provided with a meta data model
- * (see KMetaDataWidget::setModel()).
- *
- * Per default most meta data values are shown as labels.
- * However it is possible to adjust KMetaDataWidget to use
- * custom widgets for showing and modifying meta data (e. g.
- * like done already for the rating, tags or comments). The
- * following steps are necessary:
- * - Derive a custom widget from KMetaDataWidget.
- * - Create the custom widgets in the constructor and
- *   make them invisible per default.
- * - Implement the methods valueWidget(), setValue() and
- *   (optionally) label() by accessing the custom widgets.
- */
-class KMetaDataWidget : public QWidget
-{
-    Q_OBJECT
-
-public:
-    /**
-     * Allows to specify which general data types should be shown
-     * by the meta data widget.
-     * @see KMetaDataWidget::setVisibleDataTypes()
-     * @see KMetaDataWidget::visibleDataTypes()
-     */
-    enum MetaDataType
-    {
-        None = 0,
-        TypeData = 1,
-        SizeData = 2,
-        ModifiedData = 4,
-        OwnerData =  8,
-        PermissionsData = 16,
-        RatingData = 32,
-        TagsData = 64,
-        CommentData = 128
-    };
-    Q_DECLARE_FLAGS(MetaDataTypes, MetaDataType)
-
-    explicit KMetaDataWidget(QWidget* parent = 0);
-    virtual ~KMetaDataWidget();
-
-    /**
-     * 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);
-
-    /**
-     * Convenience method for KMetaDataWidget::setItem(const KFileItem&),
-     * if the application has only an URL and no file item.
-     * For performance reason it is recommended to use this convenience
-     * method only if the application does not have a file item already.
-     */
-    void setItem(const KUrl& url);
-
-    /**
-     * Convenience method for KMetaDataWidget::setItems(const KFileItemList&),
-     * if the application has only URLs and no file items.
-     * For performance reason it is recommended to use this convenience
-     * method only if the application does not have a file items already.
-     */
-    void setItems(const QList<KUrl>& urls);
-
-    KFileItemList items() const;
-
-    /**
-     * Sets the used model which provides the data for the widget.
-     * One model can be shared by several meta data widgets.
-     */
-    void setModel(KMetaDataModel* model);
-    KMetaDataModel* model() const;
-
-    /**
-     * If set to true, data like comment, tag or rating cannot be changed by the user.
-     * Per default read-only is disabled.
-     */
-    void setReadOnly(bool readOnly);
-    bool isReadOnly() const;
-
-    /**
-     * Specifies which kind of data types should be shown (@see KMetaDataWidget::Data).
-     * Example: metaDataWidget->setVisibleDataTypes(KMetaDataWidget::TypeData | KMetaDataWidget::ModifiedData);
-     * Per default all data types are shown.
-     */
-    void setVisibleDataTypes(MetaDataTypes data);
-
-    /**
-     * Returns which kind of data is shown (@see KMetaDataWidget::Data).
-     * Example: if (metaDataWidget->shownData() & KMetaDataWidget::TypeData) ...
-     */
-    MetaDataTypes visibleDataTypes() const;
-
-    /** @see QWidget::sizeHint() */
-    virtual QSize sizeHint() const;
-
-    /**
-     * @return Translated string for the label of the meta data represented
-     *         by \p metaDataUri. If no custom translation is provided, the
-     *         base implementation must be invoked.
-     */
-    virtual QString label(const KUrl& metaDataUri) const;
-
-Q_SIGNALS:
-    void urlActivated(const KUrl& url);
-
-protected:
-#ifdef HAVE_NEPOMUK
-    /**
-     * @return Pointer to the custom value-widget that should be used
-     *         to show the meta data represented by \p metaDataUri. If 0
-     *         is returned, the meta data will be shown inside a label
-     *         as fallback. If no custom value widget is used for the
-     *         given URI, the base implementation must be invoked.
-     */
-    virtual QWidget* valueWidget(const KUrl& metaDataUri) const;
-
-    /**
-     * Sets the value of a custom value-widget to \p value. If the meta data
-     * represented by \p metaDataUri is not shown by a custom value-widget (see
-     * KMetaDataWidget::valueWidget()), then the base implementation must be
-     * invoked.
-     * @return True, if a custom value-widget is available, where the value got applied.
-     */
-    virtual bool setValue(const KUrl& metaDataUri, const Nepomuk::Variant& value);
-#endif
-
-    virtual bool event(QEvent* event);
-
-private:
-    class Private;
-    Private* d;
-
-    Q_PRIVATE_SLOT(d, void slotLoadingFinished())
-    Q_PRIVATE_SLOT(d, void slotRatingChanged(unsigned int rating))
-    Q_PRIVATE_SLOT(d, void slotTagsChanged(const QList<Nepomuk::Tag>& tags))
-    Q_PRIVATE_SLOT(d, void slotCommentChanged(const QString& comment))
-    Q_PRIVATE_SLOT(d, void slotMetaDataUpdateDone())
-    Q_PRIVATE_SLOT(d, void slotLinkActivated(const QString& link))
-    Q_PRIVATE_SLOT(d, void slotTagActivated(const Nepomuk::Tag& tag))
-};
-
-Q_DECLARE_OPERATORS_FOR_FLAGS(KMetaDataWidget::MetaDataTypes)
-
-#endif
diff --git a/src/panels/information/knfotranslator.cpp b/src/panels/information/knfotranslator.cpp
deleted file mode 100644 (file)
index 2c09329..0000000
+++ /dev/null
@@ -1,115 +0,0 @@
-/*****************************************************************************
- * Copyright (C) 2010 by Peter Penz <peter.penz@gmx.at>                      *
- *                                                                           *
- * This library is free software; you can redistribute it and/or             *
- * modify it under the terms of the GNU Library General Public               *
- * License version 2 as published by the Free Software Foundation.           *
- *                                                                           *
- * This library 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         *
- * Library General Public License for more details.                          *
- *                                                                           *
- * You should have received a copy of the GNU Library General Public License *
- * along with this library; see the file COPYING.LIB.  If not, write to      *
- * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,      *
- * Boston, MA 02110-1301, USA.                                               *
- *****************************************************************************/
-
-#include "knfotranslator_p.h"
-#include <klocale.h>
-#include <kstandarddirs.h>
-
-#include <kurl.h>
-
-struct TranslationTuple {
-    const char* const key;
-    const char* const value;
-};
-
-// TODO: a lot of NFO's are missing yet
-static const TranslationTuple g_translations[] = {
-    { "http://www.semanticdesktop.org/ontologies/2007/01/19/nie#comment", I18N_NOOP2("@label", "Comment") },
-    { "http://www.semanticdesktop.org/ontologies/2007/01/19/nie#contentCreated", I18N_NOOP2("@label creation date", "Created") },
-    { "http://www.semanticdesktop.org/ontologies/2007/01/19/nie#contentSize", I18N_NOOP2("@label file content size", "Size") },
-    { "http://www.semanticdesktop.org/ontologies/2007/01/19/nie#depends", I18N_NOOP2("@label file depends from", "Depends") },
-    { "http://www.semanticdesktop.org/ontologies/2007/01/19/nie#isPartOf", I18N_NOOP2("@label parent directory", "Part of") },
-    { "http://www.semanticdesktop.org/ontologies/2007/01/19/nie#lastModified", I18N_NOOP2("@label modified date of file", "Modified") },
-    { "http://www.semanticdesktop.org/ontologies/2007/01/19/nie#mimeType", I18N_NOOP2("@label", "MIME Type") },
-    { "http://www.semanticdesktop.org/ontologies/2007/01/19/nie#plainTextContent", I18N_NOOP2("@label", "Content") },
-    { "http://www.semanticdesktop.org/ontologies/2007/01/19/nie#title", I18N_NOOP2("@label music title", "Title") },
-    { "http://www.semanticdesktop.org/ontologies/2007/01/19/nie#url", I18N_NOOP2("@label file URL", "Location") },
-    { "http://www.semanticdesktop.org/ontologies/2007/03/22/nco#creator", I18N_NOOP2("@label", "Creator") },
-    { "http://www.semanticdesktop.org/ontologies/2007/03/22/nfo#averageBitrate", I18N_NOOP2("@label", "Average Bitrate") },
-    { "http://www.semanticdesktop.org/ontologies/2007/03/22/nfo#channels", I18N_NOOP2("@label", "Channels") },
-    { "http://www.semanticdesktop.org/ontologies/2007/03/22/nfo#characterCount", I18N_NOOP2("@label number of characters", "Characters") },
-    { "http://www.semanticdesktop.org/ontologies/2007/03/22/nfo#codec",  I18N_NOOP2("@label", "Codec") },
-    { "http://www.semanticdesktop.org/ontologies/2007/03/22/nfo#colorDepth", I18N_NOOP2("@label", "Color Depth") },
-    { "http://www.semanticdesktop.org/ontologies/2007/03/22/nfo#fileName", I18N_NOOP2("@label", "Filename") },
-    { "http://www.semanticdesktop.org/ontologies/2007/03/22/nfo#height", I18N_NOOP2("@label", "Height") },
-    { "http://www.semanticdesktop.org/ontologies/2007/03/22/nfo#interlaceMode", I18N_NOOP2("@label", "Interlace Mode") },
-    { "http://www.semanticdesktop.org/ontologies/2007/03/22/nfo#lineCount", I18N_NOOP2("@label number of lines", "Lines") },
-    { "http://www.semanticdesktop.org/ontologies/2007/03/22/nfo#programmingLanguage", I18N_NOOP2("@label", "Programming Language") },
-    { "http://www.semanticdesktop.org/ontologies/2007/03/22/nfo#sampleRate", I18N_NOOP2("@label", "Sample Rate") },
-    { "http://www.semanticdesktop.org/ontologies/2007/03/22/nfo#width", I18N_NOOP2("@label", "Width") },
-    { "http://www.semanticdesktop.org/ontologies/2007/03/22/nfo#wordCount", I18N_NOOP2("@label number of words", "Words") },
-    { "http://www.semanticdesktop.org/ontologies/2007/05/10/nexif#apertureValue", I18N_NOOP2("@label EXIF aperture value", "Aperture") },
-    { "http://www.semanticdesktop.org/ontologies/2007/05/10/nexif#exposureBiasValue", I18N_NOOP2("@label EXIF", "Exposure Bias Value") },
-    { "http://www.semanticdesktop.org/ontologies/2007/05/10/nexif#exposureTime", I18N_NOOP2("@label EXIF", "Exposure Time") },
-    { "http://www.semanticdesktop.org/ontologies/2007/05/10/nexif#flash", I18N_NOOP2("@label EXIF", "Flash") },
-    { "http://www.semanticdesktop.org/ontologies/2007/05/10/nexif#focalLength", I18N_NOOP2("@label EXIF", "Focal Length") },
-    { "http://www.semanticdesktop.org/ontologies/2007/05/10/nexif#focalLengthIn35mmFilm", I18N_NOOP2("@label EXIF", "Focal Length 35 mm") },
-    { "http://www.semanticdesktop.org/ontologies/2007/05/10/nexif#isoSpeedRatings", I18N_NOOP2("@label EXIF", "ISO Speed Ratings") },
-    { "http://www.semanticdesktop.org/ontologies/2007/05/10/nexif#make", I18N_NOOP2("@label EXIF", "Make") },
-    { "http://www.semanticdesktop.org/ontologies/2007/05/10/nexif#meteringMode", I18N_NOOP2("@label EXIF", "Metering Mode") },
-    { "http://www.semanticdesktop.org/ontologies/2007/05/10/nexif#model", I18N_NOOP2("@label EXIF", "Model") },
-    { "http://www.semanticdesktop.org/ontologies/2007/05/10/nexif#orientation", I18N_NOOP2("@label EXIF", "Orientation") },
-    { "http://www.semanticdesktop.org/ontologies/2007/05/10/nexif#whiteBalance", I18N_NOOP2("@label EXIF", "White Balance") },
-    { "http://www.semanticdesktop.org/ontologies/2009/02/19/nmm#genre",  I18N_NOOP2("@label music genre", "Genre") },
-    { "http://www.semanticdesktop.org/ontologies/2009/02/19/nmm#musicAlbum", I18N_NOOP2("@label music album", "Album") },
-    { "http://www.semanticdesktop.org/ontologies/2009/02/19/nmm#trackNumber", I18N_NOOP2("@label music track number", "Track") },
-    { "http://www.w3.org/1999/02/22-rdf-syntax-ns#type", I18N_NOOP2("@label file type", "Type") },
-    { 0, 0 } // mandatory last entry
-};
-
-class KNfoTranslatorSingleton
-{
-public:
-    KNfoTranslator instance;
-};
-K_GLOBAL_STATIC(KNfoTranslatorSingleton, s_nfoTranslator)
-
-KNfoTranslator& KNfoTranslator::instance()
-{
-    return s_nfoTranslator->instance;
-}
-
-QString KNfoTranslator::translation(const KUrl& uri) const
-{
-    const QString key = uri.url();
-    if (m_hash.contains(key)) {
-        return m_hash.value(key);
-    }
-
-    // fallback if the URI is not translated
-    QString translation;
-    const int index = key.indexOf(QChar('#'));
-    if (index >= 0) {
-        translation = key.right(key.size() - index - 1);
-    }
-    return translation;
-}
-
-KNfoTranslator::KNfoTranslator() :
-    m_hash()
-{
-    const TranslationTuple* tuple = &g_translations[0];
-    while (tuple->key != 0) {
-        m_hash.insert(tuple->key, i18n(tuple->value));
-        ++tuple;
-    }
-}
-
-KNfoTranslator::~KNfoTranslator()
-{
-}
diff --git a/src/panels/information/knfotranslator_p.h b/src/panels/information/knfotranslator_p.h
deleted file mode 100644 (file)
index def13f7..0000000
+++ /dev/null
@@ -1,47 +0,0 @@
-/*****************************************************************************
- * Copyright (C) 2010 by Peter Penz <peter.penz@gmx.at>                      *
- *                                                                           *
- * This library is free software; you can redistribute it and/or             *
- * modify it under the terms of the GNU Library General Public               *
- * License version 2 as published by the Free Software Foundation.           *
- *                                                                           *
- * This library 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         *
- * Library General Public License for more details.                          *
- *                                                                           *
- * You should have received a copy of the GNU Library General Public License *
- * along with this library; see the file COPYING.LIB.  If not, write to      *
- * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,      *
- * Boston, MA 02110-1301, USA.                                               *
- *****************************************************************************/
-
-#ifndef KNFOTRANSLATOR_H
-#define KNFOTRANSLATOR_H
-
-#include <QHash>
-#include <QString>
-
-class KUrl;
-
-/**
- * @brief Returns translations for Nepomuk File Ontology URIs.
- *
- * See http://www.semanticdesktop.org/ontologies/nfo/.
- */
-class KNfoTranslator
-{
-public:
-    static KNfoTranslator& instance();
-    QString translation(const KUrl& uri) const;
-
-protected:
-    KNfoTranslator();
-    virtual ~KNfoTranslator();
-    friend class KNfoTranslatorSingleton;
-
-private:
-    QHash<QString, QString> m_hash;
-};
-
-#endif // KNFO_TRANSLATOR_H
diff --git a/src/panels/information/ktaggingwidget.cpp b/src/panels/information/ktaggingwidget.cpp
deleted file mode 100644 (file)
index ea17c62..0000000
+++ /dev/null
@@ -1,153 +0,0 @@
-/*****************************************************************************
- * Copyright (C) 2009 by Peter Penz <peter.penz@gmx.at>                      *
- *                                                                           *
- * This library is free software; you can redistribute it and/or             *
- * modify it under the terms of the GNU Library General Public               *
- * License version 2 as published by the Free Software Foundation.           *
- *                                                                           *
- * This library 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         *
- * Library General Public License for more details.                          *
- *                                                                           *
- * You should have received a copy of the GNU Library General Public License *
- * along with this library; see the file COPYING.LIB.  If not, write to      *
- * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,      *
- * Boston, MA 02110-1301, USA.                                               *
- *****************************************************************************/
-
-#include "ktaggingwidget_p.h"
-
-#include "kedittagsdialog_p.h"
-
-#include <kglobalsettings.h>
-#include <klocale.h>
-#include <kurl.h>
-
-#include <QEvent>
-#include <QLabel>
-#include <QVBoxLayout>
-
-KTaggingWidget::KTaggingWidget(QWidget* parent) :
-    QWidget(parent),
-    m_readOnly(false),
-    m_label(0),
-    m_tags(),
-    m_tagsText()
-{
-    m_label = new QLabel(this);
-    m_label->setFont(KGlobalSettings::smallestReadableFont());
-    m_label->setWordWrap(true);
-    m_label->setAlignment(Qt::AlignTop);
-    connect(m_label, SIGNAL(linkActivated(const QString&)), this, SLOT(slotLinkActivated(const QString&)));
-
-    QVBoxLayout* layout = new QVBoxLayout(this);
-    layout->setMargin(0);
-    layout->addWidget(m_label);
-
-    setTags(QList<Nepomuk::Tag>());
-}
-
-KTaggingWidget::~KTaggingWidget()
-{
-}
-
-void KTaggingWidget::setTags(const QList<Nepomuk::Tag>& tags)
-{
-    m_tags = tags;
-
-    m_tagsText.clear();
-    bool first = true;
-    foreach (const Nepomuk::Tag& tag, m_tags) {
-        if (!first) {
-            m_tagsText += ", ";
-        }
-        if (m_readOnly) {
-            m_tagsText += tag.genericLabel();
-        } else {
-            // use the text color for the tag-links, to create a visual difference
-            // to the semantically different "Change..." link
-            const QColor linkColor = palette().text().color();
-            const char* link = "<a style=\"color:%1;\" href=\"%2\">%3</a>";
-            m_tagsText += QString::fromLatin1(link).arg(linkColor.name(),
-                                                        KUrl(tag.resourceUri()).url(),
-                                                        tag.genericLabel());
-        }
-        first = false;
-    }
-
-    QString text;
-    if (m_tagsText.isEmpty()) {
-        if (m_readOnly) {
-            text = "-";
-        } else {
-            text = "<a href=\"changeTags\">" + i18nc("@label", "Add Tags...") + "</a>";
-        }
-    } else {
-        if (m_readOnly) {
-            text = m_tagsText;
-        } else {
-            text += m_tagsText + " <a href=\"changeTags\">" + i18nc("@label", "Change...") + "</a>";
-        }
-    }
-    m_label->setText(text);
-}
-
-QList<Nepomuk::Tag> KTaggingWidget::tags() const
-{
-    return m_tags;
-}
-
-void KTaggingWidget::setReadOnly(bool readOnly)
-{
-    m_readOnly = readOnly;
-    setTags(m_tags);
-}
-
-bool KTaggingWidget::isReadOnly() const
-{
-    return m_readOnly;
-}
-
-bool KTaggingWidget::event(QEvent* event)
-{
-    if (event->type() == QEvent::Polish) {
-        m_label->setForegroundRole(foregroundRole());
-    }
-    return QWidget::event(event);
-}
-
-void KTaggingWidget::slotLinkActivated(const QString& link)
-{
-    if (link != QLatin1String("changeTags")) {
-        emit tagActivated(Nepomuk::Tag(KUrl(link)));
-        return;
-    }
-
-    KEditTagsDialog dialog(m_tags, this, Qt::Dialog);
-    KConfigGroup dialogConfig(KGlobal::config(), "Nepomuk KEditTagsDialog");
-    dialog.restoreDialogSize(dialogConfig);
-
-    if (dialog.exec() == QDialog::Accepted) {
-        const QList<Nepomuk::Tag> oldTags = m_tags;
-        m_tags = dialog.tags();
-
-        if (oldTags.count() != m_tags.count()) {
-            emit tagsChanged(m_tags);
-        } else {
-            // The number of tags is equal. Check whether the
-            // content of the tags are also equal:
-            const int tagsCount = m_tags.count();
-            for (int i = 0; i < tagsCount; ++i) {
-                if (oldTags[i].genericLabel() != m_tags[i].genericLabel()) {
-                    // at least one tag has been changed
-                    emit tagsChanged(m_tags);
-                    break;
-                }
-            }
-        }
-    }
-    dialog.saveDialogSize(dialogConfig, KConfigBase::Persistent);
-}
-
-#include "ktaggingwidget_p.moc"
diff --git a/src/panels/information/ktaggingwidget_p.h b/src/panels/information/ktaggingwidget_p.h
deleted file mode 100644 (file)
index dfa23ea..0000000
+++ /dev/null
@@ -1,67 +0,0 @@
-/*****************************************************************************
- * Copyright (C) 2009 by Peter Penz <peter.penz@gmx.at>                      *
- *                                                                           *
- * This library is free software; you can redistribute it and/or             *
- * modify it under the terms of the GNU Library General Public               *
- * License version 2 as published by the Free Software Foundation.           *
- *                                                                           *
- * This library 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         *
- * Library General Public License for more details.                          *
- *                                                                           *
- * You should have received a copy of the GNU Library General Public License *
- * along with this library; see the file COPYING.LIB.  If not, write to      *
- * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,      *
- * Boston, MA 02110-1301, USA.                                               *
- *****************************************************************************/
-
-#ifndef TAGGING_WIDGET_H
-#define TAGGING_WIDGET_H
-
-#include <nepomuk/tag.h>
-#include <QString>
-#include <QWidget>
-
-class QLabel;
-
-/**
- * @brief Allows to edit and show tags as part of KMetaDataWidget.
- */
-class KTaggingWidget : public QWidget
-{
-    Q_OBJECT
-
-public:
-    KTaggingWidget(QWidget* parent);
-    virtual ~KTaggingWidget();
-
-    void setTags(const QList<Nepomuk::Tag>& tags);
-    QList<Nepomuk::Tag> tags() const;
-
-    /**
-     * If set to true, the tags cannot be changed by the user.
-     * Per default read-only is disabled.
-     */
-    // TODO: provide common interface class for metadatawidgets
-    void setReadOnly(bool readOnly);
-    bool isReadOnly() const;
-
-signals:
-    void tagsChanged(const QList<Nepomuk::Tag>& tags);
-    void tagActivated(const Nepomuk::Tag& tag);
-
-protected:
-    virtual bool event(QEvent* event);
-
-private slots:
-    void slotLinkActivated(const QString& link);
-
-private:
-    bool m_readOnly;
-    QLabel* m_label;
-    QList<Nepomuk::Tag> m_tags;
-    QString m_tagsText;
-};
-
-#endif
diff --git a/src/panels/information/nepomukmassupdatejob.cpp b/src/panels/information/nepomukmassupdatejob.cpp
deleted file mode 100644 (file)
index 8e38130..0000000
+++ /dev/null
@@ -1,149 +0,0 @@
-/***************************************************************************
- *   Copyright (C) 2008 by Sebastian Trueg <trueg@kde.org>                 *
- *                                                                         *
- *   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 "nepomukmassupdatejob_p.h"
-
-#include <klocale.h>
-
-#include <nepomuk/tag.h>
-#include <nepomuk/tools.h>
-
-
-Nepomuk::MassUpdateJob::MassUpdateJob(QObject* parent)
-    : KJob(parent),
-      m_index(-1)
-{
-    setCapabilities(Killable|Suspendable);
-    connect(&m_processTimer, SIGNAL(timeout()),
-             this, SLOT(slotNext()));
-}
-
-Nepomuk::MassUpdateJob::~MassUpdateJob()
-{
-}
-
-void Nepomuk::MassUpdateJob::setFiles(const KUrl::List& urls)
-{
-    m_resources.clear();
-    foreach(const KUrl &url, urls){
-        m_resources.append(Resource(url));
-    }
-    setTotalAmount(KJob::Files, m_resources.count());
-}
-
-void Nepomuk::MassUpdateJob::setResources(const QList<Nepomuk::Resource>& rl)
-{
-    m_resources = rl;
-    setTotalAmount(KJob::Files, m_resources.count());
-}
-
-void Nepomuk::MassUpdateJob::setProperties(const QList<QPair<QUrl,Nepomuk::Variant> >& props)
-{
-    m_properties = props;
-}
-
-void Nepomuk::MassUpdateJob::start()
-{
-    if (m_index < 0){
-        emit description(this, i18nc("@info:progress", "Changing annotations"));
-        m_index = 0;
-        m_processTimer.start();
-    }
-}
-
-
-bool Nepomuk::MassUpdateJob::doKill()
-{
-    if (m_index > 0){
-        m_processTimer.stop();
-        m_index = -1;
-        return true;
-    } else {
-        return false;
-    }
-}
-
-bool Nepomuk::MassUpdateJob::doSuspend()
-{
-    m_processTimer.stop();
-    return true;
-}
-
-bool Nepomuk::MassUpdateJob::doResume()
-{
-    if (m_index > 0){
-        m_processTimer.start();
-        return true;
-    } else {
-        return false;
-    }
-}
-
-void Nepomuk::MassUpdateJob::slotNext()
-{
-    if (!isSuspended()) {
-        if (m_index < m_resources.count()){
-            Nepomuk::Resource& res = m_resources[m_index];
-            for (int i = 0; i < m_properties.count(); ++i){
-                res.setProperty(m_properties[i].first, m_properties[i].second);
-            }
-            ++m_index;
-            setProcessedAmount(KJob::Files, m_index);
-        } else if (m_index >= m_resources.count()) {
-            m_index = -1;
-            m_processTimer.stop();
-            emitResult();
-        }
-    }
-}
-
-Nepomuk::MassUpdateJob* Nepomuk::MassUpdateJob::tagResources(const QList<Nepomuk::Resource>& rl,
-                                                             const QList<Nepomuk::Tag>& tags)
-{
-    Nepomuk::MassUpdateJob* job = new Nepomuk::MassUpdateJob();
-    job->setResources(rl);
-    job->setProperties(QList<QPair<QUrl,Nepomuk::Variant> >() <<
-                       qMakePair(QUrl(Nepomuk::Resource::tagUri()),
-                       Nepomuk::Variant(convertResourceList<Tag>(tags))));
-    return job;
-}
-
-Nepomuk::MassUpdateJob* Nepomuk::MassUpdateJob::rateResources(const QList<Nepomuk::Resource>& rl,
-                                                              unsigned int rating)
-{
-    Nepomuk::MassUpdateJob* job = new Nepomuk::MassUpdateJob();
-    job->setResources(rl);
-    job->setProperties(QList<QPair<QUrl,Nepomuk::Variant> >() <<
-                       qMakePair(QUrl(Nepomuk::Resource::ratingUri()),
-                       Nepomuk::Variant(rating)));
-    return job;
-}
-
-Nepomuk::MassUpdateJob* Nepomuk::MassUpdateJob::commentResources(const QList<Nepomuk::Resource>& rl,
-                                                                 const QString& comment)
-{
-    Nepomuk::MassUpdateJob* job = new Nepomuk::MassUpdateJob();
-    job->setResources(rl);
-    job->setProperties(QList<QPair<QUrl,Nepomuk::Variant> >() <<
-                       qMakePair(QUrl(Nepomuk::Resource::descriptionUri()),
-                       Nepomuk::Variant(comment)));
-    return job;
-}
-
-#include "nepomukmassupdatejob_p.moc"
diff --git a/src/panels/information/nepomukmassupdatejob_p.h b/src/panels/information/nepomukmassupdatejob_p.h
deleted file mode 100644 (file)
index 659fbd4..0000000
+++ /dev/null
@@ -1,85 +0,0 @@
-/***************************************************************************
- *   Copyright (C) 2008 by Sebastian Trueg <trueg@kde.org>                 *
- *                                                                         *
- *   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 NEPOMUK_MASS_UPDATE_JOB_H
-#define NEPOMUK_MASS_UPDATE_JOB_H
-
-#include <kjob.h>
-#include <kurl.h>
-
-#include <QtCore/QList>
-#include <QtCore/QPair>
-#include <QtCore/QTimer>
-
-#include <nepomuk/resource.h>
-#include <nepomuk/variant.h>
-
-
-namespace Nepomuk {
-    class MassUpdateJob : public KJob
-    {
-        Q_OBJECT
-
-    public:
-        MassUpdateJob(QObject* parent = 0);
-        virtual ~MassUpdateJob();
-
-        /**
-         * Set a list of files to change
-         * This has the same effect as using setResources
-         * with a list of manually created resources.
-         */
-        void setFiles(const KUrl::List& urls);
-
-        /**
-         * Set a list of resources to change.
-         */
-        void setResources(const QList<Nepomuk::Resource>&);
-
-        /**
-         * Set the properties to change in the mass update.
-         */
-        void setProperties(const QList<QPair<QUrl,Nepomuk::Variant> >& props);
-
-        /**
-         * Actually start the job.
-         */
-        void start();
-
-        static MassUpdateJob* tagResources(const QList<Nepomuk::Resource>&, const QList<Nepomuk::Tag>& tags);
-        static MassUpdateJob* commentResources(const QList<Nepomuk::Resource>&, const QString& comment);
-        static MassUpdateJob* rateResources(const QList<Nepomuk::Resource>&, unsigned int rating);
-
-    protected:
-        bool doKill();
-        bool doSuspend();
-        bool doResume();
-
-    private Q_SLOTS:
-        void slotNext();
-
-    private:
-        QList<Nepomuk::Resource> m_resources;
-        QList<QPair<QUrl,Nepomuk::Variant> > m_properties;
-        int m_index;
-        QTimer m_processTimer;
-    };
-}
-
-#endif
index 2e558b7cbf0069894c0613337bff2d38918e6cab..3335ab2d5acf5f4a6290ac3b16610c690c41489c 100644 (file)
@@ -23,8 +23,6 @@
 #include "dolphinsettings.h"
 #include "dolphin_generalsettings.h"
 
-#include "panels/information/kmetadataconfigurationdialog.h"
-
 #include <viewproperties.h>
 
 #include <kdialog.h>
@@ -194,13 +192,14 @@ void BehaviorSettingsPage::updateConfigureButton()
 
 void BehaviorSettingsPage::configureToolTips()
 {
-    KMetaDataConfigurationDialog* dialog = new KMetaDataConfigurationDialog();
-    dialog->setDescription(i18nc("@label::textbox",
-                                 "Configure which data should be shown in the tooltip."));
-    dialog->setAttribute(Qt::WA_DeleteOnClose);
-    dialog->show();
-    dialog->raise();
-    dialog->activateWindow();
+    // TODO:
+    //KFileMetaDataConfigurationDialog* dialog = new KFileMetaDataConfigurationDialog();
+    //dialog->setDescription(i18nc("@label::textbox",
+    //                             "Configure which data should be shown in the tooltip."));
+    //dialog->setAttribute(Qt::WA_DeleteOnClose);
+    //dialog->show();
+    //dialog->raise();
+    //dialog->activateWindow();
 }
 
 void BehaviorSettingsPage::loadSettings()
index bcb3d60cdfbb79e6f06cab657afdee8e74c00b02..32f3e799b1735fb2f076c965e7d9e58e72c784ca 100644 (file)
 #include "dolphinmodel.h"
 #include "dolphinsortfilterproxymodel.h"
 
+#include <kfilemetadatawidget.h>
 #include <kicon.h>
 #include <kio/previewjob.h>
 #include <kseparator.h>
 
-#include "panels/information/kmetadatamodel.h"
-#include "panels/information/kmetadatawidget.h"
 #include "tooltips/ktooltip.h"
 
 #include <QApplication>
@@ -262,10 +261,9 @@ QWidget* ToolTipManager::createTipContent(const QPixmap& pixmap) const
     nameLabel->setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Fixed);
 
     // add meta data
-    KMetaDataWidget* metaDataWidget = new KMetaDataWidget(tipContent);
-    metaDataWidget->setModel(new KMetaDataModel(tipContent));
+    KFileMetaDataWidget* metaDataWidget = new KFileMetaDataWidget(tipContent);
     metaDataWidget->setForegroundRole(QPalette::ToolTipText);
-    metaDataWidget->setItem(m_item);
+    metaDataWidget->setItems(KFileItemList() << m_item);
     metaDataWidget->setSizePolicy(QSizePolicy::Fixed, QSizePolicy::Fixed);
     metaDataWidget->setReadOnly(true);
 
index ca212c97d8aebeca698312b9a7de36bd3ddba620..0cd5b93e15ad129d5f4e73a8477d6380bf1234ac 100644 (file)
@@ -86,14 +86,4 @@ bool UpdateItemStatesThread::retrievedItems() const
     return m_retrievedItems;
 }
 
-void UpdateItemStatesThread::deleteWhenFinished()
-{
-    connect(this, SIGNAL(finished()), this, SLOT(slotFinished()));
-}
-
-void UpdateItemStatesThread::slotFinished()
-{
-    deleteLater();
-}
-
 #include "updateitemstatesthread.moc"
index bee5c02c0d10019300d9359335634b3d95c5b364..a687827c97703368d3b18d8587f8b7206dc24351 100644 (file)
@@ -50,14 +50,9 @@ public:
 
     bool retrievedItems() const;
 
-    void deleteWhenFinished();
-
 protected:
     virtual void run();
 
-private slots:
-    void slotFinished();
-
 private:
     bool m_retrievedItems;
     KVersionControlPlugin* m_plugin;
index ebe59e049af49847e4f3c1351e2445046df9cf8e..f47f474845471a39ad34e4f1b0b2abc173ae610f 100644 (file)
 #include <QMutexLocker>
 #include <QTimer>
 
+/*
+ * Maintains a list of pending threads, that get regulary checked
+ * whether they are finished and hence can get deleted. QThread::wait()
+ * is never used to prevent any blocking of the user interface.
+ */
+struct PendingThreadsSingleton
+{
+    QList<UpdateItemStatesThread*> list;
+};
+K_GLOBAL_STATIC(PendingThreadsSingleton, s_pendingThreads)
+
+
 VersionControlObserver::VersionControlObserver(QAbstractItemView* view) :
     QObject(view),
     m_pendingItemStatesUpdate(false),
@@ -74,14 +86,22 @@ VersionControlObserver::VersionControlObserver(QAbstractItemView* view) :
 VersionControlObserver::~VersionControlObserver()
 {
     if (m_updateItemStatesThread != 0) {
-        disconnect(m_updateItemStatesThread, SIGNAL(finished()),
-                   this, SLOT(applyUpdatedItemStates()));
         if (m_updateItemStatesThread->isFinished()) {
             delete m_updateItemStatesThread;
+            m_updateItemStatesThread = 0;
         } else {
-            m_updateItemStatesThread->deleteWhenFinished();
+            // The version controller gets deleted, while a thread still
+            // is working to get the version information. To avoid a blocking
+            // user interface, no waiting for the finished() signal of the thread is
+            // done. Instead the thread will be remembered inside the global
+            // list s_pendingThreads, which will checked regulary. The thread does
+            // not work on shared data that is part of the VersionController instance,
+            // so skipping the waiting is save.
+            disconnect(m_updateItemStatesThread, SIGNAL(finished()),
+                       this, SLOT(slotThreadFinished()));
+            s_pendingThreads->list.append(m_updateItemStatesThread);
+            m_updateItemStatesThread = 0;
         }
-        m_updateItemStatesThread = 0;
     }
 
     m_plugin->disconnect();
@@ -123,6 +143,19 @@ void VersionControlObserver::silentDirectoryVerification()
 
 void VersionControlObserver::verifyDirectory()
 {
+    if (!s_pendingThreads->list.isEmpty()) {
+        // Try to cleanup pending threads (see explanation in destructor)
+        QList<UpdateItemStatesThread*>::iterator it = s_pendingThreads->list.begin();
+        while (it != s_pendingThreads->list.end()) {
+            if ((*it)->isFinished()) {
+                (*it)->deleteLater();
+                it = s_pendingThreads->list.erase(it);
+            } else {
+                ++it;
+            }
+        }
+    }
+
     KUrl versionControlUrl = m_dirLister->url();
     if (!versionControlUrl.isLocalFile()) {
         return;
@@ -177,11 +210,9 @@ void VersionControlObserver::verifyDirectory()
     }
 }
 
-void VersionControlObserver::applyUpdatedItemStates()
+void VersionControlObserver::slotThreadFinished()
 {
     if (m_plugin == 0) {
-        // The signal finished() has been emitted, but the thread has been marked
-        // as invalid in the meantime. Just ignore the signal in this case.
         return;
     }
 
@@ -214,7 +245,7 @@ void VersionControlObserver::applyUpdatedItemStates()
         // operation has been completed because of the icon emblems.
         emit operationCompletedMessage(QString());
     }
-    
+
     if (m_pendingItemStatesUpdate) {
         m_pendingItemStatesUpdate = false;
         updateItemStates();
@@ -227,11 +258,11 @@ void VersionControlObserver::updateItemStates()
     if (m_updateItemStatesThread == 0) {
         m_updateItemStatesThread = new UpdateItemStatesThread();
         connect(m_updateItemStatesThread, SIGNAL(finished()),
-                this, SLOT(applyUpdatedItemStates()));
+                this, SLOT(slotThreadFinished()));
     }
     if (m_updateItemStatesThread->isRunning()) {
         // An update is currently ongoing. Wait until the thread has finished
-        // the update (see applyUpdatedItemStates()).
+        // the update (see slotThreadFinished()).
         m_pendingItemStatesUpdate = true;
         return;
     }
@@ -243,7 +274,7 @@ void VersionControlObserver::updateItemStates()
             emit infoMessage(i18nc("@info:status", "Updating version information..."));
         }
         m_updateItemStatesThread->setData(m_plugin, itemStates);
-        m_updateItemStatesThread->start(); // applyUpdatedItemStates() is called when finished
+        m_updateItemStatesThread->start(); // slotThreadFinished() is called when finished
     }
 }
 
index 2d1cd02b324bed46e50965ee4317a6c307f2e2e5..08bb234b39625abb95d9e44405d8d974bcbbf66c 100644 (file)
@@ -93,7 +93,12 @@ private slots:
     void silentDirectoryVerification();    
 
     void verifyDirectory();
-    void applyUpdatedItemStates();
+
+    /**
+     * Is invoked if the thread m_updateItemStatesThread has been finished
+     * and applys the item states.
+     */
+    void slotThreadFinished();
     
 private:
     struct ItemState