diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt --- a/src/CMakeLists.txt +++ b/src/CMakeLists.txt @@ -8,17 +8,16 @@ tagwidget.cpp kedittagsdialog.cpp tagcheckbox.cpp + filefetchjob.cpp filemetadatawidget.cpp filemetadataconfigwidget.cpp filemetadataprovider.cpp filemetadatautil.cpp - indexeddataretriever.cpp kcommentwidget.cpp keditcommentdialog.cpp metadatafilter.cpp ondemandextractor.cpp widgetfactory.cpp - filefetchjob.cpp ) ecm_qt_declare_logging_category( diff --git a/src/filemetadataprovider.h b/src/filemetadataprovider.h --- a/src/filemetadataprovider.h +++ b/src/filemetadataprovider.h @@ -111,7 +111,6 @@ void loadingFinished(); private Q_SLOTS: - void slotLoadingFinished(KJob* job); void slotFileFetchFinished(KJob* job); private: diff --git a/src/filemetadataprovider.cpp b/src/filemetadataprovider.cpp --- a/src/filemetadataprovider.cpp +++ b/src/filemetadataprovider.cpp @@ -19,7 +19,6 @@ *****************************************************************************/ #include "filemetadataprovider.h" -#include "indexeddataretriever.h" #include "filefetchjob.h" #include @@ -145,16 +144,6 @@ emit loadingFinished(); } -void FileMetaDataProvider::slotLoadingFinished(KJob* job) -{ - IndexedDataRetriever* ret = dynamic_cast(job); - m_data = unite(m_data, ret->data()); - m_readOnly = !ret->canEdit(); - - insertEditableData(); - emit loadingFinished(); -} - void FileMetaDataProvider::insertSingleFileBasicData() { // TODO: Handle case if remote URLs are used properly. isDir() does diff --git a/src/indexeddataretriever.h b/src/indexeddataretriever.h deleted file mode 100644 --- a/src/indexeddataretriever.h +++ /dev/null @@ -1,54 +0,0 @@ -/* - * - * Copyright (C) 2012 Vishesh Handa - * - * This library is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; either - * version 2.1 of the License, or (at your option) any later version. - * - * 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 - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with this library; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA - * - */ - -#ifndef INDEXEDDATARETRIEVER_H -#define INDEXEDDATARETRIEVER_H - -#include -#include "ondemandextractor.h" -#include - -namespace Baloo { - -class IndexedDataRetriever : public KJob -{ - Q_OBJECT -public: - explicit IndexedDataRetriever(const QString& fileUrl, QObject* parent = nullptr); - ~IndexedDataRetriever() override; - - void start() override; - - QVariantMap data() const; - bool canEdit() const; - -private Q_SLOTS: - void slotIndexedFile(QProcess::ExitStatus exitStatus); - -private: - QString m_url; - Private::OnDemandExtractor m_extractor; - QVariantMap m_data; - bool m_canEdit = false; -}; - -} - -#endif // INDEXEDDATARETRIEVER_H diff --git a/src/indexeddataretriever.cpp b/src/indexeddataretriever.cpp deleted file mode 100644 --- a/src/indexeddataretriever.cpp +++ /dev/null @@ -1,73 +0,0 @@ -/* - * - * Copyright (C) 2012 Vishesh Handa - * - * This library is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; either - * version 2.1 of the License, or (at your option) any later version. - * - * 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 - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with this library; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA - * - */ - -#include "indexeddataretriever.h" -#include "filemetadatautil_p.h" - -#include - -using namespace Baloo; - -IndexedDataRetriever::IndexedDataRetriever(const QString& fileUrl, QObject* parent): KJob(parent) -{ - QFileInfo fileInfo(fileUrl); - m_url = fileInfo.canonicalFilePath(); - m_canEdit = fileInfo.isWritable(); - - connect(&m_extractor, &Private::OnDemandExtractor::fileFinished, this, &IndexedDataRetriever::slotIndexedFile); -} - -IndexedDataRetriever::~IndexedDataRetriever() -{ -} - -void IndexedDataRetriever::start() -{ - m_extractor.process(m_url); - - KFileMetaData::UserMetaData umd(m_url); - if (umd.isSupported()) { - m_data = Baloo::Private::convertUserMetaData(umd); - m_canEdit &= true; - } else { - m_data.clear(); - m_canEdit &= false; - } -} - -void IndexedDataRetriever::slotIndexedFile(QProcess::ExitStatus status) -{ - if (status == QProcess::NormalExit) { - QVariantMap properties = Baloo::Private::toNamedVariantMap(m_extractor.properties()); - m_data.unite(properties); - } - - emitResult(); -} - -bool IndexedDataRetriever::canEdit() const -{ - return m_canEdit; -} - -QVariantMap IndexedDataRetriever::data() const -{ - return m_data; -}