[-]
[+]
|
Deleted |
baloo-widgets-5.6.0.tar.xz/.emacs-dirvars
|
@@ -1,14 +0,0 @@
-;; -*- emacs-lisp -*-
-;;
-;; This file is processed by the dirvars emacs package. Each variable
-;; setting below is performed when this dirvars file is loaded.
-;;
-indent-tabs-mode: nil
-tab-width: 8
-c-basic-offset: 4
-evaluate: (c-set-offset 'innamespace '4)
-kde-emacs-after-parent-string: ""
-evaluate: (c-set-offset 'inline-open '0)
-kdab-qt-version: 4
-kdab-jump-project-name: kde
-magic-parens-mode: nil
|
[-]
[+]
|
Changed |
baloo-widgets-5.6.0.tar.xz/Messages.sh
^
|
@@ -1,5 +1,5 @@
#!bin/sh
-$EXTRACTRC `find . -name \*.rc -o -name \*.ui -o -name \*.kcfg` >> rc.cpp
-$XGETTEXT `find . -name \*.cc -o -name \*.cpp -o -name \*.h -o -name \*.qml` -o $podir/baloowidgets.pot
+$EXTRACTRC `find . -name \*.rc -o -name \*.ui -o -name \*.kcfg | grep -v "/src/naturalqueryparser/"` >> rc.cpp
+$XGETTEXT `find . -name \*.cc -o -name \*.cpp -o -name \*.h -o -name \*.qml | grep -v "/src/naturalqueryparser/"` -o $podir/baloowidgets.pot
rm -f rc.cpp
|
[-]
[+]
|
Changed |
baloo-widgets-5.6.0.tar.xz/src/CMakeLists.txt
^
|
@@ -1,5 +1,5 @@
-add_definitions(-DTRANSLATION_DOMAIN=\"baloowidgets\")
add_subdirectory(naturalqueryparser)
+add_definitions(-DTRANSLATION_DOMAIN=\"baloowidgets\")
set(widgets_SRCS
kblocklayout.cpp
|
[-]
[+]
|
Changed |
baloo-widgets-5.6.0.tar.xz/src/filemetadataconfigwidget.cpp
^
|
@@ -19,7 +19,7 @@
*****************************************************************************/
#include "filemetadataconfigwidget.h"
-#include "filemetadataprovider_p.h"
+#include "filemetadataprovider.h"
#include <KConfig>
#include <KConfigGroup>
|
[-]
[+]
|
Changed |
baloo-widgets-5.6.0.tar.xz/src/filemetadataprovider.cpp
^
|
@@ -18,22 +18,16 @@
* Boston, MA 02110-1301, USA. *
*****************************************************************************/
-#include "filemetadataprovider_p.h"
-#include "tagwidget.h"
-#include "kcommentwidget_p.h"
+#include "filemetadataprovider.h"
#include "indexeddataretriever.h"
#include "filefetchjob.h"
-#include <Baloo/IndexerConfig>
-
#include <KFileMetaData/PropertyInfo>
-#include <KFileItem>
#include <KLocalizedString>
-#include <KRatingWidget>
#include <KFormat>
-#include <QtWidgets/QLabel>
-#include <QtCore/QTimer>
+#include <QTimer>
+#include <QDebug>
// Required includes for subDirectoriesCount():
#ifdef Q_WS_WIN
@@ -45,57 +39,6 @@
using namespace Baloo;
-class FileMetaDataProvider::Private
-{
-
-public:
- Private(FileMetaDataProvider* parent);
- ~Private();
-
- void slotLoadingFinished(KJob* job);
- void slotFileFetchFinished(KJob* job);
-
- void insertBasicData();
- void insertEditableData();
-
- /**
- * Checks for the existance of \p uri in \p allProperties, and accordingly
- * inserts the total integer value of that property in m_data. On completion
- * it removes \p uri from \p allProperties
- */
- void totalPropertyAndInsert(const QString& prop, const QList<QVariantMap>& resources,
- QSet<QString>& allProperties);
-
- /*
- * @return The number of subdirectories for the directory \a path.
- */
- static int subDirectoriesCount(const QString &path);
-
- bool m_readOnly;
-
- /// Set to true when the file has been specially indexed and does not exist in the db
- bool m_realTimeIndexing;
- QList<KFileItem> m_fileItems;
-
- QVariantMap m_data;
- Baloo::IndexerConfig m_config;
-private:
- FileMetaDataProvider* const q;
-};
-
-FileMetaDataProvider::Private::Private(FileMetaDataProvider* parent) :
- m_readOnly(false),
- m_realTimeIndexing(false),
- m_fileItems(),
- m_data(),
- q(parent)
-{
-}
-
-FileMetaDataProvider::Private::~Private()
-{
-}
-
namespace {
QVariant intersect(const QVariant& v1, const QVariant& v2) {
if( !v1.isValid() || !v2.isValid() )
@@ -136,11 +79,30 @@
return QVariant();
}
+
+ /**
+ * The standard QMap::unite will contain the key multiple times if both \p v1 and \p v2
+ * contain the same key.
+ *
+ * This will only take the key from \p v2 into account
+ */
+ QVariantMap unite(const QVariantMap& v1, const QVariantMap& v2)
+ {
+ QVariantMap v(v1);
+ QMapIterator<QString, QVariant> it(v2);
+ while (it.hasNext()) {
+ it.next();
+
+ v[it.key()] = it.value();
+ }
+
+ return v;
+ }
}
-void FileMetaDataProvider::Private::totalPropertyAndInsert(const QString& prop,
- const QList<QVariantMap>& resources,
- QSet<QString>& allProperties)
+void FileMetaDataProvider::totalPropertyAndInsert(const QString& prop,
+ const QList<QVariantMap>& resources,
+ QSet<QString>& allProperties)
{
if( allProperties.contains( prop ) ) {
int total = 0;
@@ -161,10 +123,7 @@
}
}
-namespace {
-}
-
-void FileMetaDataProvider::Private::slotFileFetchFinished(KJob* job)
+void FileMetaDataProvider::slotFileFetchFinished(KJob* job)
{
FileFetchJob* fetchJob = static_cast<FileFetchJob*>(job);
QList<QVariantMap> files = fetchJob->data();
@@ -218,21 +177,18 @@
insertEditableData();
- emit q->loadingFinished();
+ emit loadingFinished();
}
-void FileMetaDataProvider::Private::slotLoadingFinished(KJob* job)
+void FileMetaDataProvider::slotLoadingFinished(KJob* job)
{
IndexedDataRetriever* ret = dynamic_cast<IndexedDataRetriever*>(job);
- m_data.unite(ret->data());
+ unite(m_data, ret->data());
- insertBasicData();
- insertEditableData();
-
- emit q->loadingFinished();
+ emit loadingFinished();
}
-void FileMetaDataProvider::Private::insertBasicData()
+void FileMetaDataProvider::insertBasicData()
{
KFormat format;
if (m_fileItems.count() == 1) {
@@ -258,22 +214,37 @@
m_data.insert("kfileitem#permissions", item.permissionsString());
}
else if (m_fileItems.count() > 1) {
- // Calculate the size of all items
- quint64 totalSize = 0;
- foreach (const KFileItem& item, m_fileItems) {
- if (!item.isDir() && !item.isLink()) {
- totalSize += item.size();
- }
+ // If all directories
+ bool allDirectories = true;
+ for (const KFileItem& item : m_fileItems) {
+ allDirectories &= item.isDir();
}
- m_data.insert("kfileitem#totalSize", format.formatByteSize(totalSize));
- // When we have more than 1 item, the basic data should be emitted before
- // the Resource data, cause the ResourceData might take considerable time
- emit q->loadingFinished();
+ if (allDirectories) {
+ int count = 0;
+ for (const KFileItem& item : m_fileItems) {
+ count += subDirectoriesCount(item.url().path());
+ }
+
+ if (count) {
+ const QString itemCountString = i18ncp("@item:intable", "%1 item", "%1 items", count);
+ m_data.insert("kfileitem#totalSize", itemCountString);
+ }
+ }
+ else {
+ // Calculate the size of all items
+ quint64 totalSize = 0;
+ for (const KFileItem& item : m_fileItems) {
+ if (!item.isDir() && !item.isLink()) {
+ totalSize += item.size();
+ }
+ }
+ m_data.insert("kfileitem#totalSize", format.formatByteSize(totalSize));
+ }
}
}
|
[-]
[+]
|
Added |
baloo-widgets-5.6.0.tar.xz/src/filemetadataprovider.h
^
|
@@ -0,0 +1,147 @@
+/*****************************************************************************
+ * 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 as published by the Free Software Foundation; either *
+ * version 2 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 *
+ * 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 _BALOO_FILEMETADATAMODEL_H
+#define _BALOO_FILEMETADATAMODEL_H
+
+#include <QObject>
+#include <QString>
+#include <QVariant>
+
+#include <KFileItem>
+#include <Baloo/IndexerConfig>
+
+namespace Baloo {
+
+/**
+ * @brief Provides the data for the MetaDataWidget.
+ *
+ * The default implementation provides all meta data
+ * that are available due to Nepomuk. If custom
+ * meta data should be added, the method KFileMetaDataProvider::loadData()
+ * must be overwritten.
+ *
+ * @see FileMetaDataWidget
+ */
+class FileMetaDataProvider : public QObject
+{
+ Q_OBJECT
+
+public:
+ explicit FileMetaDataProvider(QObject* parent = 0);
+ virtual ~FileMetaDataProvider();
+
+ /**
+ * 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
+ * KFileMetaDataProvider::data() afterwards. The label for
+ * each item can be retrieved by KFileMetaDataProvider::label().
+ */
+ void setItems(const KFileItemList& items);
+ KFileItemList items() const;
+
+ /**
+ * If set to true, data such as the comment, tag or rating cannot be changed by the user.
+ * Per default read-only is disabled. The method readOnlyChanged() can be overwritten
+ * to react on the change.
+ */
+ void setReadOnly(bool readOnly);
+ bool isReadOnly() 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 QString& metaDataLabel) const;
+
+ /**
+ * Meta data items are sorted alphabetically by their translated
+ * label per default. However it is possible to provide an internal
+ * prefix to the label, so that specific items are grouped together.
+ * For example it makes sense that the meta data for 'width' and 'height'
+ * of an image are shown below each other. By adding a common prefix,
+ * a grouping is done.
+ * @return Returns the name of the group the meta data indicated
+ * by \p label belongs to. Per default an empty string
+ * is returned.
+ */
+ virtual QString group(const QString& label) const;
+
+ /**
+ * @return Meta data for the items that have been set by
+ * KFileMetaDataProvider::setItems(). The method should
+ * be invoked after the signal loadingFinished() has
+ * been received (otherwise no data will be returned).
+ */
+ QVariantMap data() const;
+
+ /**
+ * Returns true if the items do not exist in the database and
+ * have just been indexed. This means, that we should not allow
+ * others to search through these items cause they do not exist
+ * in the database.
+ */
+ bool realTimeIndexing();
+
+Q_SIGNALS:
+ /**
+ * Is emitted after the loading triggered by KFileMetaDataProvider::setItems()
+ * has been finished.
+ *
+ * Can be emitted multiple times to indicate data changes
+ */
+ void loadingFinished();
+
+private Q_SLOTS:
+ void slotLoadingFinished(KJob* job);
+ void slotFileFetchFinished(KJob* job);
+
+ void insertBasicData();
+ void insertEditableData();
+
+private:
+ /**
+ * Checks for the existance of \p uri in \p allProperties, and accordingly
+ * inserts the total integer value of that property in m_data. On completion
+ * it removes \p uri from \p allProperties
+ */
+ void totalPropertyAndInsert(const QString& prop, const QList<QVariantMap>& resources,
+ QSet<QString>& allProperties);
+
+ /*
+ * @return The number of subdirectories for the directory \a path.
+ */
+ static int subDirectoriesCount(const QString &path);
+
+ bool m_readOnly;
+
+ /// Set to true when the file has been specially indexed and does not exist in the db
+ bool m_realTimeIndexing;
+ QList<KFileItem> m_fileItems;
+
+ QVariantMap m_data;
+ Baloo::IndexerConfig m_config;
+};
+
+}
+#endif
|
[-]
[+]
|
Deleted |
baloo-widgets-5.6.0.tar.xz/src/filemetadataprovider_p.h
^
|
@@ -1,127 +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 as published by the Free Software Foundation; either *
- * version 2 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 *
- * 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 _BALOO_FILEMETADATAMODEL_H
-#define _BALOO_FILEMETADATAMODEL_H
-
-#include <QtCore/QObject>
-#include <QtCore/QString>
-#include <QtCore/QVariant>
-
-class KFileItemList;
-class KProcess;
-class QWidget;
-
-namespace Baloo {
-
-class ResourceLoader;
-/**
- * @brief Provides the data for the MetaDataWidget.
- *
- * The default implementation provides all meta data
- * that are available due to Nepomuk. If custom
- * meta data should be added, the method KFileMetaDataProvider::loadData()
- * must be overwritten.
- *
- * @see FileMetaDataWidget
- */
-class FileMetaDataProvider : public QObject
-{
- Q_OBJECT
-
-public:
- explicit FileMetaDataProvider(QObject* parent = 0);
- virtual ~FileMetaDataProvider();
-
- /**
- * 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
- * KFileMetaDataProvider::data() afterwards. The label for
- * each item can be retrieved by KFileMetaDataProvider::label().
- */
- void setItems(const KFileItemList& items);
- KFileItemList items() const;
-
- /**
- * If set to true, data such as the comment, tag or rating cannot be changed by the user.
- * Per default read-only is disabled. The method readOnlyChanged() can be overwritten
- * to react on the change.
- */
- void setReadOnly(bool readOnly);
- bool isReadOnly() 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 QString& metaDataLabel) const;
-
- /**
- * Meta data items are sorted alphabetically by their translated
- * label per default. However it is possible to provide an internal
- * prefix to the label, so that specific items are grouped together.
- * For example it makes sense that the meta data for 'width' and 'height'
- * of an image are shown below each other. By adding a common prefix,
- * a grouping is done.
- * @return Returns the name of the group the meta data indicated
- * by \p label belongs to. Per default an empty string
- * is returned.
- */
- virtual QString group(const QString& label) const;
-
- /**
- * @return Meta data for the items that have been set by
- * KFileMetaDataProvider::setItems(). The method should
- * be invoked after the signal loadingFinished() has
- * been received (otherwise no data will be returned).
- */
- QVariantMap data() const;
-
- /**
- * Returns true if the items do not exist in the database and
- * have just been indexed. This means, that we should not allow
- * others to search through these items cause they do not exist
- * in the database.
- */
- bool realTimeIndexing();
-
-Q_SIGNALS:
- /**
- * Is emitted after the loading triggered by KFileMetaDataProvider::setItems()
- * has been finished.
- *
- * Can be emitted multiple times to indicate data changes
- */
- void loadingFinished();
-
-private:
- class Private;
- Private* const d;
-
- Q_PRIVATE_SLOT(d, void slotFileFetchFinished(KJob* job))
- Q_PRIVATE_SLOT(d, void slotLoadingFinished(KJob* job))
- Q_PRIVATE_SLOT(d, void insertBasicData())
-};
-
-}
-#endif
|
[-]
[+]
|
Changed |
baloo-widgets-5.6.0.tar.xz/src/filemetadatawidget.cpp
^
|
@@ -24,7 +24,7 @@
#include "filemetadatawidget.h"
#include "metadatafilter.h"
#include "widgetfactory.h"
-#include "filemetadataprovider_p.h"
+#include "filemetadataprovider.h"
#include <KFileItem>
#include <KFileMetaData/UserMetaData>
@@ -241,6 +241,7 @@
xAttrSuppored &= md.isSupported();
}
}
+ setReadOnly(!xAttrSuppored);
d->m_provider->setItems(localItemsList);
d->m_widgetFactory->setItems(list);
|
[-]
[+]
|
Changed |
baloo-widgets-5.6.0.tar.xz/src/indexeddataretriever.cpp
^
|
@@ -20,6 +20,7 @@
#include "indexeddataretriever.h"
+#include <QDataStream>
#include <QProcess>
#include <QFileInfo>
#include <QStandardPaths>
|
[-]
[+]
|
Changed |
baloo-widgets-5.6.0.tar.xz/src/naturalqueryparser/CMakeLists.txt
^
|
@@ -37,6 +37,8 @@
EXPORT_NAME BalooNaturalQueryParser
)
+target_include_directories(KF5BalooNaturalQueryParser INTERFACE "$<INSTALL_INTERFACE:${KF5_INCLUDE_INSTALL_DIR}/BalooWidgets>")
+
generate_export_header(KF5BalooNaturalQueryParser BASE_NAME BALOO_NATURALQUERYPARSER EXPORT_FILE_NAME naturalqueryparser_export.h)
ecm_generate_headers(KF5BalooNaturalQueryParser_CamelCase_HEADERS
HEADER_NAMES
@@ -53,13 +55,13 @@
install(FILES
${CMAKE_CURRENT_BINARY_DIR}/naturalqueryparser_export.h
${KF5BalooNaturalQueryParser_HEADERS}
- DESTINATION ${KF5_INCLUDE_INSTALL_DIR}/Baloo/baloo
+ DESTINATION ${KF5_INCLUDE_INSTALL_DIR}/BalooWidgets/baloo
COMPONENT Devel
)
install(FILES
${KF5BalooNaturalQueryParser_CamelCase_HEADERS}
- DESTINATION ${KF5_INCLUDE_INSTALL_DIR}/Baloo/Baloo
+ DESTINATION ${KF5_INCLUDE_INSTALL_DIR}/BalooWidgets/Baloo
COMPONENT Devel
)
|
[-]
[+]
|
Changed |
baloo-widgets-5.6.0.tar.xz/src/widgetfactory.cpp
^
|
@@ -115,7 +115,7 @@
QString valueString;
if (prop == "duration"){
- valueString = form.formatDuration(value.toInt());
+ valueString = form.formatDuration(value.toInt() * 1000);
}
else {
// Check if Date/DateTime
@@ -256,15 +256,21 @@
if (m_tagWidget) {
for (const QString& filePath : m_items) {
KFileMetaData::UserMetaData md(filePath);
- md.setTags(tags);
+
+ // When multiple tags are selected one doesn't want to loose the old tags
+ // of any of the resources. Unless specifically removed.
+ QStringList newTags = md.tags() + tags;
+ newTags.removeDuplicates();
+
+ for (const QString& tag : m_prevTags) {
+ if (!tags.contains(tag)) {
+ newTags.removeAll(tag);
+ }
+ }
+ md.setTags(newTags);
}
- // 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;
+ m_prevTags = tags;
emit dataChangeStarted();
emit dataChangeFinished();
}
|