┌   ┐
54
└   ┘

summaryrefslogtreecommitdiff
path: root/src/panels/information/kmetadatamodel.cpp
diff options
context:
space:
mode:
authorPeter Penz <[email protected]>2010-03-22 22:23:02 +0000
committerPeter Penz <[email protected]>2010-03-22 22:23:02 +0000
commitcaf017c2fefa8280046b02cfd071a118f2909ced (patch)
treea17f5bd569830806d679c7aedf103861ff9b2507 /src/panels/information/kmetadatamodel.cpp
parent622acabf23b6c8c3badab6a8c2e93e0ae8963f1b (diff)
Use KFileMetaDataWidget from kdelibs. Still open: Provide dialog which wraps KFileMetaDataConfigurationWidget.
svn path=/trunk/KDE/kdebase/apps/; revision=1106465
Diffstat (limited to 'src/panels/information/kmetadatamodel.cpp')
-rw-r--r--src/panels/information/kmetadatamodel.cpp156
1 files changed, 0 insertions, 156 deletions
diff --git a/src/panels/information/kmetadatamodel.cpp b/src/panels/information/kmetadatamodel.cpp
deleted file mode 100644
index 6a1898b1f..000000000
--- a/src/panels/information/kmetadatamodel.cpp
+++ /dev/null
@@ -1,156 +0,0 @@
-/*****************************************************************************
- * Copyright (C) 2010 by Peter Penz <[email protected]> *
- * *
- * 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"