[-]
[+]
|
Changed |
baloo-widgets.spec
|
|
[-]
[+]
|
Changed |
baloo-widgets-5.0.90.tar.xz/src/CMakeLists.txt
^
|
@@ -16,6 +16,7 @@
groupedlineedit.cpp
querybuilder.cpp
querybuildercompleter.cpp
+ filefetchjob.cpp
)
add_library(KF5BalooWidgets ${widgets_SRCS})
@@ -34,7 +35,7 @@
KF5::Completion
KF5::FileMetaData
KF5::WidgetsAddons
- KF5::BalooFiles
+ KF5::Baloo
KF5::BalooNaturalQueryParser
KF5::CoreAddons
KF5::ConfigGui
|
[-]
[+]
|
Added |
baloo-widgets-5.0.90.tar.xz/src/filefetchjob.cpp
^
|
@@ -0,0 +1,87 @@
+/*
+ * <one line to give the library's name and an idea of what it does.>
+ * Copyright (C) 2014 Vishesh Handa <me@vhanda.in>
+ *
+ * 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 "filefetchjob.h"
+
+#include <QTimer>
+#include <Baloo/File>
+
+#include <KFileMetaData/UserMetaData>
+#include <KFileMetaData/PropertyInfo>
+
+using namespace Baloo;
+
+FileFetchJob::FileFetchJob(const QStringList& urls, QObject* parent)
+ : KJob(parent)
+ , m_urls(urls)
+{
+}
+
+void FileFetchJob::start()
+{
+ QTimer::singleShot(0, this, SLOT(doStart()));
+}
+
+static QVariantMap convertPropertyMap(const KFileMetaData::PropertyMap& propMap)
+{
+ QVariantMap map;
+ KFileMetaData::PropertyMap::const_iterator it = propMap.constBegin();
+ for (; it != propMap.constEnd(); it++) {
+ KFileMetaData::PropertyInfo pi(it.key());
+ map.insertMulti(pi.name(), it.value());
+ }
+
+ return map;
+}
+
+void FileFetchJob::doStart()
+{
+ for (const QString& filePath : m_urls) {
+ Baloo::File file(filePath);
+ file.load();
+
+ QVariantMap prop = convertPropertyMap(file.properties());
+
+ KFileMetaData::UserMetaData md(filePath);
+ QStringList tags = md.tags();
+ if (!tags.isEmpty()) {
+ prop.insert("tags", tags);
+ }
+
+ int rating = md.rating();
+ if (rating) {
+ prop.insert("rating", rating);
+ }
+
+ QString comment = md.userComment();
+ if (!comment.isEmpty()) {
+ prop.insert("userComment", comment);
+ }
+
+ m_data << prop;
+ }
+
+ emitResult();
+}
+
+QList<QVariantMap> Baloo::FileFetchJob::data() const
+{
+ return m_data;
+}
|
[-]
[+]
|
Added |
baloo-widgets-5.0.90.tar.xz/src/filefetchjob.h
^
|
@@ -0,0 +1,48 @@
+/*
+ * <one line to give the library's name and an idea of what it does.>
+ * Copyright (C) 2014 Vishesh Handa <me@vhanda.in>
+ *
+ * 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 BALOO_FILEFETCHJOB_H
+#define BALOO_FILEFETCHJOB_H
+
+#include <KJob>
+#include <QVariantMap>
+
+namespace Baloo {
+
+class FileFetchJob : public KJob
+{
+ Q_OBJECT
+public:
+ FileFetchJob(const QStringList& urls, QObject* parent = 0);
+
+ QList<QVariantMap> data() const;
+
+ virtual void start();
+
+private Q_SLOTS:
+ void doStart();
+
+private:
+ QStringList m_urls;
+ QList<QVariantMap> m_data;
+};
+}
+
+#endif // BALOO_FILEFETCHJOB_H
|
[-]
[+]
|
Changed |
baloo-widgets-5.0.90.tar.xz/src/filemetadataconfigwidget.cpp
^
|
@@ -74,8 +74,7 @@
m_provider = new FileMetaDataProvider(q);
m_provider->setReadOnly(true);
- connect(m_provider, SIGNAL(loadingFinished()),
- q, SLOT(slotLoadingFinished()));
+ connect(m_provider, SIGNAL(loadingFinished()), q, SLOT(slotLoadingFinished()));
}
FileMetaDataConfigWidget::Private::~Private()
|
[-]
[+]
|
Changed |
baloo-widgets-5.0.90.tar.xz/src/filemetadataprovider.cpp
^
|
@@ -22,9 +22,8 @@
#include "tagwidget.h"
#include "kcommentwidget_p.h"
#include "indexeddataretriever.h"
+#include "filefetchjob.h"
-#include <Baloo/FileFetchJob>
-#include <Baloo/File>
#include <Baloo/IndexerConfig>
#include <KFileMetaData/PropertyInfo>
@@ -163,40 +162,16 @@
}
namespace {
- QVariantMap convertPropertyMap(const KFileMetaData::PropertyMap& propMap)
- {
- QVariantMap map;
- KFileMetaData::PropertyMap::const_iterator it = propMap.constBegin();
- for (; it != propMap.constEnd(); it++) {
- KFileMetaData::PropertyInfo pi(it.key());
- map.insertMulti(pi.name(), it.value());
- }
-
- return map;
- }
}
void FileMetaDataProvider::Private::slotFileFetchFinished(KJob* job)
{
- Baloo::FileFetchJob* fetchJob = static_cast<Baloo::FileFetchJob*>(job);
- QList<Baloo::File> files = fetchJob->files();
+ FileFetchJob* fetchJob = static_cast<FileFetchJob*>(job);
+ QList<QVariantMap> files = fetchJob->data();
if (files.size() == 1) {
- Baloo::File file = files.first();
- m_data = convertPropertyMap(file.properties());
+ m_data = files.first();
insertBasicData();
-
- if (file.rating()) {
- m_data.insert("rating", file.rating());
- }
-
- if (!file.tags().isEmpty()) {
- m_data.insert("tags", file.tags());
- }
-
- if (!file.userComment().isEmpty()) {
- m_data.insert("userComment", file.userComment());
- }
}
else {
//
@@ -204,28 +179,16 @@
//
QSet<QString> allProperties;
QList<QVariantMap> propertyList;
- foreach (const Baloo::File& file, files) {
- QVariantMap properties = convertPropertyMap(file.properties());
- if (file.rating()) {
- properties.insert("rating", file.rating());
- }
-
- if (!file.tags().isEmpty()) {
- properties.insert("tags", file.tags());
- }
-
- if (!file.userComment().isEmpty()) {
- properties.insert("userComment", file.userComment());
- }
- propertyList << properties;
- allProperties.unite(properties.uniqueKeys().toSet());
+ foreach (const QVariantMap& fileData, files) {
+ propertyList << fileData;
+ allProperties.unite(fileData.uniqueKeys().toSet());
}
// Special handling for certain properties
- totalPropertyAndInsert("duration", propertyList, allProperties );
- totalPropertyAndInsert("characterCount", propertyList, allProperties );
- totalPropertyAndInsert("wordCount", propertyList, allProperties );
- totalPropertyAndInsert("lineCount", propertyList, allProperties );
+ totalPropertyAndInsert("duration", propertyList, allProperties);
+ totalPropertyAndInsert("characterCount", propertyList, allProperties);
+ totalPropertyAndInsert("wordCount", propertyList, allProperties);
+ totalPropertyAndInsert("lineCount", propertyList, allProperties);
foreach (const QString& propUri, allProperties) {
foreach (const QVariantMap& map, propertyList) {
@@ -288,7 +251,7 @@
} else {
m_data.insert("kfileitem#size", format.formatByteSize(item.size()));
}
-
+
m_data.insert("kfileitem#type", item.mimeComment());
m_data.insert("kfileitem#modified", format.formatRelativeDateTime(item.time(KFileItem::ModificationTime), QLocale::LongFormat) );
m_data.insert("kfileitem#owner", item.user());
|
[-]
[+]
|
Changed |
baloo-widgets-5.0.90.tar.xz/src/indexeddataretriever.cpp
^
|
@@ -47,7 +47,7 @@
m_process = new QProcess(this);
m_process->setReadChannel(QProcess::StandardOutput);
- connect( m_process, SIGNAL(finished(int)), this, SLOT(slotIndexedFile(int)) );
+ connect(m_process, static_cast<void (QProcess::*)(int)>(&QProcess::finished), this, &IndexedDataRetriever::slotIndexedFile);
m_process->start(exe, QStringList() << m_url);
}
|
[-]
[+]
|
Changed |
baloo-widgets-5.0.90.tar.xz/src/kedittagsdialog.cpp
^
|
@@ -69,8 +69,7 @@
QLabel* newTagLabel = new QLabel(i18nc("@label", "Create new tag:"));
m_newTagEdit = new QLineEdit(this);
m_newTagEdit->setClearButtonEnabled(true);
- connect(m_newTagEdit, SIGNAL(textEdited(QString)),
- this, SLOT(slotTextEdited(QString)));
+ connect(m_newTagEdit, &QLineEdit::textEdited, this, &KEditTagsDialog::slotTextEdited);
QHBoxLayout* newTagLayout = new QHBoxLayout();
newTagLayout->addWidget(newTagLabel);
@@ -161,7 +160,7 @@
void KEditTagsDialog::loadTags()
{
Baloo::TagListJob* job = new Baloo::TagListJob();
- connect(job, SIGNAL(finished(KJob*)), this, SLOT(slotTagsLoaded(KJob*)));
+ connect(job, &Baloo::TagListJob::finished, this, &KEditTagsDialog::slotTagsLoaded);
job->start();
}
|
[-]
[+]
|
Changed |
baloo-widgets-5.0.90.tar.xz/src/querybuilder.cpp
^
|
@@ -54,10 +54,8 @@
d->completer = new QueryBuilderCompleter(this);
d->parsing_enabled = true;
- connect(this, SIGNAL(textChanged()),
- this, SLOT(reparse()));
- connect(d->completer, SIGNAL(proposalSelected(CompletionProposal*,QString)),
- this, SLOT(proposalSelected(CompletionProposal*,QString)));
+ connect(this, &QueryBuilder::textChanged, this, &QueryBuilder::reparse);
+ connect(d->completer, &QueryBuilderCompleter::proposalSelected, this, &QueryBuilder::proposalSelected);
}
void QueryBuilder::setParsingEnabled(bool enable)
@@ -181,4 +179,3 @@
setCursorPosition(put_cursor_at);
}
-#include "querybuilder.moc"
|
[-]
[+]
|
Changed |
baloo-widgets-5.0.90.tar.xz/src/querybuildercompleter.cpp
^
|
@@ -48,8 +48,7 @@
parent->installEventFilter(this);
- connect(this, SIGNAL(itemActivated(QListWidgetItem*)),
- this, SLOT(proposalActivated(QListWidgetItem*)));
+ connect(this, &QueryBuilderCompleter::itemActivated, this, &QueryBuilderCompleter::proposalActivated);
// Load the list of all the valid property names
int lastProperty = KFileMetaData::Property::LastProperty;
@@ -276,4 +275,3 @@
return rs;
}
-#include "querybuildercompleter.moc"
|
[-]
[+]
|
Changed |
baloo-widgets-5.0.90.tar.xz/src/widgetfactory.cpp
^
|
@@ -1,6 +1,5 @@
/*
- <one line to give the library's name and an idea of what it does.>
- Copyright (C) 2012 Vishesh Handa <me@vhanda.in>
+ Copyright (C) 2012-2014 Vishesh Handa <vhanda@kde.org>
Code largely copied/adapted from KFileMetadataProvider
Copyright (C) 2010 by Peter Penz <peter.penz@gmx.at>
@@ -26,7 +25,7 @@
#include "kcommentwidget_p.h"
#include "KRatingWidget"
-#include <Baloo/FileModifyjob>
+#include <KFileMetaData/UserMetaData>
#include <QtWidgets/QLabel>
#include <QtCore/QTime>
@@ -104,11 +103,10 @@
if (dt.isValid()) {
QTime time = dt.time();
if (!time.hour() && !time.minute() && !time.second()){
- valueString = form.formatRelativeDate(dt.date(), QLocale::LongFormat);
- }
- else{
- valueString = form.formatRelativeDateTime(dt, QLocale::LongFormat);
- }
+ valueString = form.formatRelativeDate(dt.date(), QLocale::LongFormat);
+ } else {
+ valueString = form.formatRelativeDateTime(dt, QLocale::LongFormat);
+ }
}
else {
switch (value.type()) {
@@ -139,10 +137,8 @@
tagWidget->setReadyOnly(m_readOnly);
tagWidget->setSelectedTags(tags);
- connect(tagWidget, SIGNAL(selectionChanged(QStringList)),
- this, SLOT(slotTagsChanged(QStringList)));
- connect(tagWidget, SIGNAL(tagClicked(QString)),
- this, SLOT(slotTagClicked(QString)));
+ connect(tagWidget, &TagWidget::selectionChanged, this, &WidgetFactory::slotTagsChanged);
+ connect(tagWidget, &TagWidget::tagClicked, this, &WidgetFactory::slotTagClicked);
m_tagWidget = tagWidget;
m_prevTags = tags;
@@ -156,8 +152,7 @@
commentWidget->setText(comment);
commentWidget->setReadOnly(m_readOnly);
- connect(commentWidget, SIGNAL(commentChanged(QString)),
- this, SLOT(slotCommentChanged(QString)));
+ connect(commentWidget, &KCommentWidget::commentChanged, this, &WidgetFactory::slotCommentChanged);
m_commentWidget = commentWidget;
@@ -174,8 +169,7 @@
const QFontMetrics metrics(parent->font());
ratingWidget->setPixmapSize(metrics.height());
- connect(ratingWidget, SIGNAL(ratingChanged(uint)),
- this, SLOT(slotRatingChanged(uint)));
+ connect(ratingWidget, static_cast<void (KRatingWidget::*)(uint)>(&KRatingWidget::ratingChanged), this, &WidgetFactory::slotRatingChanged);
m_ratingWidget = ratingWidget;
@@ -217,7 +211,7 @@
valueWidget->setWordWrap(true);
valueWidget->setAlignment(Qt::AlignTop | Qt::AlignLeft);
valueWidget->setText(m_readOnly ? plainText(value) : value);
- connect(valueWidget, SIGNAL(linkActivated(QString)), this, SLOT(slotLinkActivated(QString)));
+ connect(valueWidget, &ValueWidget::linkActivated, this, &WidgetFactory::slotLinkActivated);
return valueWidget;
}
@@ -228,41 +222,43 @@
void WidgetFactory::slotCommentChanged(const QString& comment)
{
- KJob* job = Baloo::FileModifyJob::modifyUserComment(m_items, comment);
- startChangeDataJob(job);
+ for (const QString& filePath : m_items) {
+ KFileMetaData::UserMetaData md(filePath);
+ md.setUserComment(comment);
+ }
+ emit dataChangeStarted();
+ emit dataChangeFinished();
}
void WidgetFactory::slotRatingChanged(uint rating)
{
- KJob* job = Baloo::FileModifyJob::modifyRating(m_items, rating);
- startChangeDataJob(job);
+ for (const QString& filePath : m_items) {
+ KFileMetaData::UserMetaData md(filePath);
+ md.setRating(rating);
+ }
+ emit dataChangeStarted();
+ emit dataChangeFinished();
}
void WidgetFactory::slotTagsChanged(const QStringList& tags)
{
if (m_tagWidget) {
- KJob* job = Baloo::FileModifyJob::modifyTags(m_items, tags);
+ for (const QString& filePath : m_items) {
+ KFileMetaData::UserMetaData md(filePath);
+ md.setTags(tags);
+ }
// FIXME: vHanda : Remove the tags that are no longer applicable
// When multiple tags are selected one doesn't want to loose the old tags
// of any of the resources. Unless specifically removed.
// QSet<Tag> removedTags = m_prevTags.toSet().subtract( tags.toSet() );
// Remove these tags!
-
- m_prevTags = tags;
- startChangeDataJob(job);
+ // m_prevTags = tags;
+ emit dataChangeStarted();
+ emit dataChangeFinished();
}
}
-void WidgetFactory::startChangeDataJob(KJob* job)
-{
- connect(job, SIGNAL(result(KJob*)),
- this, SIGNAL(dataChangeFinished()));
-
- emit dataChangeStarted();
- job->start();
-}
-
//
// Notifications
//
|
[-]
[+]
|
Changed |
baloo-widgets-5.0.90.tar.xz/src/widgetfactory.h
^
|
@@ -67,8 +67,6 @@
QWidget* createCommentWidget(const QString& comment, QWidget* parent);
QWidget* createValueWidget(const QString& value, QWidget* parent);
- void startChangeDataJob(KJob* job);
-
TagWidget* m_tagWidget;
KRatingWidget* m_ratingWidget;
KCommentWidget* m_commentWidget;
|
[-]
[+]
|
Changed |
baloo-widgets-5.0.90.tar.xz/test/CMakeLists.txt
^
|
@@ -1,6 +1,6 @@
add_executable(tagwidgetapp tagwidgetapp.cpp tagwidgettest.cpp)
target_link_libraries(tagwidgetapp
- KF5::BalooFiles
+ KF5::Baloo
KF5::BalooWidgets
Qt5::Widgets
Qt5::Core
@@ -8,7 +8,7 @@
add_executable(metadatawidgetapp metadatawidgetapp.cpp metadatawidgettest.cpp)
target_link_libraries(metadatawidgetapp
- KF5::BalooFiles
+ KF5::Baloo
KF5::BalooWidgets
Qt5::Widgets
Qt5::Core
@@ -16,7 +16,7 @@
add_executable(metadataconfigwidgetapp metadataconfigwidgetapp.cpp)
target_link_libraries(metadataconfigwidgetapp
- KF5::BalooFiles
+ KF5::Baloo
KF5::BalooWidgets
Qt5::Widgets
Qt5::Core
|