Hello community, here is the log from the commit of package kfilemetadata5 for openSUSE:Factory checked in at 2014-10-15 08:50:54 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Comparing /work/SRC/openSUSE:Factory/kfilemetadata5 (Old) and /work/SRC/openSUSE:Factory/.kfilemetadata5.new (New) ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Package is "kfilemetadata5" Changes: -------- --- /work/SRC/openSUSE:Factory/kfilemetadata5/kfilemetadata5.changes 2014-10-01 11:22:43.000000000 +0200 +++ /work/SRC/openSUSE:Factory/.kfilemetadata5.new/kfilemetadata5.changes 2014-10-15 08:50:59.000000000 +0200 @@ -1,0 +2,8 @@ +Thu Oct 9 21:24:28 UTC 2014 - hrvoje.sen...@gmail.com + +- Update to 5.1 Final: + * Bugfixes since RC1 + * For more details please see: + https://www.kde.org/announcements/plasma-5.1.0.php + +------------------------------------------------------------------- Old: ---- kfilemetadata-5.0.95.tar.xz New: ---- kfilemetadata-5.1.0.1.tar.xz ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Other differences: ------------------ ++++++ kfilemetadata5.spec ++++++ --- /var/tmp/diff_new_pack.7cwSwa/_old 2014-10-15 08:51:00.000000000 +0200 +++ /var/tmp/diff_new_pack.7cwSwa/_new 2014-10-15 08:51:00.000000000 +0200 @@ -17,13 +17,13 @@ Name: kfilemetadata5 -Version: 5.0.95 +Version: 5.1.0 Release: 0 Summary: Extract Metadata License: GPL-2.0+ and LGPL-2.1+ and LGPL-3.0 Group: Development/Libraries/KDE Url: http://www.kde.org/ -Source: kfilemetadata-%{version}.tar.xz +Source: kfilemetadata-%{version}.1.tar.xz Source1: baselibs.conf BuildRequires: extra-cmake-modules >= 1.0.0 BuildRequires: karchive-devel >= 5.0.0 ++++++ kfilemetadata-5.0.95.tar.xz -> kfilemetadata-5.1.0.1.tar.xz ++++++ diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/kfilemetadata-5.0.95/CMakeLists.txt new/kfilemetadata-5.1.0/CMakeLists.txt --- old/kfilemetadata-5.0.95/CMakeLists.txt 2014-09-25 20:40:08.000000000 +0200 +++ new/kfilemetadata-5.1.0/CMakeLists.txt 2014-10-14 12:54:10.000000000 +0200 @@ -1,5 +1,5 @@ project(kfilemetadata) -set(PROJECT_VERSION "5.0.95") +set(PROJECT_VERSION "5.1.0") cmake_minimum_required(VERSION 2.8.12) diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/kfilemetadata-5.0.95/src/CMakeLists.txt new/kfilemetadata-5.1.0/src/CMakeLists.txt --- old/kfilemetadata-5.0.95/src/CMakeLists.txt 2014-09-25 20:40:08.000000000 +0200 +++ new/kfilemetadata-5.1.0/src/CMakeLists.txt 2014-10-09 13:53:16.000000000 +0200 @@ -6,6 +6,7 @@ extractorcollection.cpp propertyinfo.cpp typeinfo.cpp + usermetadata.cpp ) add_library(KF5::FileMetaData ALIAS KF5FileMetaData) @@ -38,6 +39,7 @@ PropertyInfo Types TypeInfo + UserMetaData PREFIX kfilemetadata REQUIRED_HEADERS KF5FileMetaData_HEADERS diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/kfilemetadata-5.0.95/src/usermetadata.cpp new/kfilemetadata-5.1.0/src/usermetadata.cpp --- old/kfilemetadata-5.0.95/src/usermetadata.cpp 1970-01-01 01:00:00.000000000 +0100 +++ new/kfilemetadata-5.1.0/src/usermetadata.cpp 2014-10-09 13:53:16.000000000 +0200 @@ -0,0 +1,157 @@ +/* + * Copyright (C) 2014 Vishesh Handa <m...@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 "usermetadata.h" +#include "xattr_p.h" + +#include <QSet> + +using namespace KFileMetaData; + +class UserMetaData::Private { +public: + QString filePath; +}; + +UserMetaData::UserMetaData(const QString& filePath) + : d(new Private) +{ + d->filePath = filePath; +} + +UserMetaData::UserMetaData(const UserMetaData& rhs) + : d(new Private(*rhs.d)) +{ +} + +UserMetaData::~UserMetaData() +{ + delete d; +} + +const UserMetaData& UserMetaData::operator=(const UserMetaData& rhs) +{ + d->filePath = rhs.d->filePath; + return *this; +} + +QString UserMetaData::filePath() const +{ + return d->filePath; +} + +void UserMetaData::addTag(const QString& tag) +{ + QSet<QString> tagSet = tags().toSet(); + tagSet << tag; + + setTags(tagSet.toList()); +} + +void UserMetaData::addTags(const QStringList& tagList) +{ + QSet<QString> tagSet = tags().toSet(); + tagSet.unite(tagList.toSet()); + + setTags(tagSet.toList()); +} + +void UserMetaData::setTags(const QStringList& tags) +{ + k_setxattr(d->filePath, QStringLiteral("user.xdg.tags"), tags.join(", ")); +} + +void UserMetaData::removeTag(const QString& tag) +{ + QSet<QString> tagSet = tags().toSet(); + tagSet.remove(tag); + + setTags(tagSet.toList()); +} + +void UserMetaData::removeTags(const QStringList& tagList) +{ + QSet<QString> tagSet = tags().toSet(); + tagSet.subtract(tagList.toSet()); + + setTags(tagSet.toList()); + +} + +QStringList UserMetaData::tags() const +{ + QString value; + + k_getxattr(d->filePath, QStringLiteral("user.xdg.tags"), &value); + return value.split(QLatin1Char(','), QString::SkipEmptyParts); +} + +int UserMetaData::rating() const +{ + QString value; + + k_getxattr(d->filePath, QStringLiteral("user.baloo.rating"), &value); + return value.toInt(); +} + +void UserMetaData::setRating(int rating) +{ + k_setxattr(d->filePath, QStringLiteral("user.baloo.rating"), QString::number(rating)); +} + +QString UserMetaData::userComment() const +{ + QString value; + k_getxattr(d->filePath, QStringLiteral("user.xdg.comment"), &value); + + return value; +} + +void UserMetaData::setUserComment(const QString& userComment) +{ + k_setxattr(d->filePath, QStringLiteral("user.xdg.comment"), userComment); +} + +void UserMetaData::setAttribute(const QString& key, const QString& value) +{ + k_setxattr(d->filePath, QStringLiteral("user") + key, value); +} + +bool UserMetaData::hasAttribute(const QString& key) +{ + k_getxattr(d->filePath, QStringLiteral("user") + key, 0); + + return (errno != ENODATA); +} + +QString UserMetaData::attribute(const QString& key) +{ + QString value; + k_getxattr(d->filePath, QStringLiteral("user") + key, &value); + + return value; +} + +bool UserMetaData::isSupported() const +{ + QString value; + k_getxattr(d->filePath, QStringLiteral("user.test"), &value); + + return (errno == ENOTSUP); +} diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/kfilemetadata-5.0.95/src/usermetadata.h new/kfilemetadata-5.1.0/src/usermetadata.h --- old/kfilemetadata-5.0.95/src/usermetadata.h 1970-01-01 01:00:00.000000000 +0100 +++ new/kfilemetadata-5.1.0/src/usermetadata.h 2014-10-09 13:53:16.000000000 +0200 @@ -0,0 +1,66 @@ +/* + * <one line to give the library's name and an idea of what it does.> + * Copyright (C) 2014 Vishesh Handa <m...@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 KFILEMETADATA_USERMETADATA_H +#define KFILEMETADATA_USERMETADATA_H + +#include "kfilemetadata_export.h" +#include <QStringList> + +namespace KFileMetaData { + +class KFILEMETADATA_EXPORT UserMetaData { +public: + UserMetaData(const QString &filePath); + UserMetaData(const UserMetaData &rhs); + virtual ~UserMetaData(); + + const UserMetaData& operator =(const UserMetaData& rhs); + + QString filePath() const; + bool isSupported() const; + + void setTags(const QStringList& tags); + void addTags(const QStringList& tags); + void addTag(const QString& tag); + void removeTags(const QStringList& tags); + void removeTag(const QString& tag); + + QStringList tags() const; + + int rating() const; + void setRating(int rating); + + QString userComment() const; + void setUserComment(const QString& userComment); + + QString attribute(const QString& name); + void setAttribute(const QString& name, const QString& value); + bool hasAttribute(const QString& name); + + // FIXME: Error handling? +private: + class Private; + Private *d; +}; + +} + +#endif // KFILEMETADATA_USERMETADATA_H diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/kfilemetadata-5.0.95/src/xattr_p.h new/kfilemetadata-5.1.0/src/xattr_p.h --- old/kfilemetadata-5.0.95/src/xattr_p.h 1970-01-01 01:00:00.000000000 +0100 +++ new/kfilemetadata-5.1.0/src/xattr_p.h 2014-10-09 13:53:16.000000000 +0200 @@ -0,0 +1,127 @@ +/* + * This file is part of the KDE Baloo Project + * Copyright (C) 2014 Raphael Kubo da Costa <rak...@freebsd.org> + * + * 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 KFILEMETADATA_XATTR_P_H +#define KFILEMETADATA_XATTR_P_H + +#include <QByteArray> +#include <QFile> +#include <QString> + +#if defined(Q_OS_LINUX) || defined(__GLIBC__) +#include <sys/types.h> +#include <sys/xattr.h> +#elif defined(Q_OS_MAC) +#include <sys/types.h> +#include <sys/xattr.h> +#elif defined(Q_OS_FREEBSD) || defined(Q_OS_NETBSD) +#include <sys/types.h> +#include <sys/extattr.h> +#endif + +inline ssize_t k_getxattr(const QString& path, const QString& name, QString* value) +{ + const QByteArray p = QFile::encodeName(path); + const char* encodedPath = p.constData(); + + const QByteArray n = name.toUtf8(); + const char* attributeName = n.constData(); + + // First get the size of the data we are going to get to reserve the right amount of space. +#if defined(Q_OS_LINUX) || (defined(__GLIBC__) && !defined(__stub_getxattr)) + const ssize_t size = getxattr(encodedPath, attributeName, NULL, 0); +#elif defined(Q_OS_MAC) + const ssize_t size = getxattr(encodedPath, attributeName, NULL, 0, 0, 0); +#elif defined(Q_OS_FREEBSD) || defined(Q_OS_NETBSD) + const ssize_t size = extattr_get_file(encodedPath, EXTATTR_NAMESPACE_USER, attributeName, NULL, 0); +#else + const ssize_t size = 0; +#endif + + if (size <= 0) { + if (value) { + value->clear(); + } + return size; + } + + QByteArray data(size, Qt::Uninitialized); + +#if defined(Q_OS_LINUX) || (defined(__GLIBC__) && !defined(__stub_getxattr)) + const ssize_t r = getxattr(encodedPath, attributeName, data.data(), size); +#elif defined(Q_OS_MAC) + const ssize_t r = getxattr(encodedPath, attributeName, data.data(), size, 0, 0); +#elif defined(Q_OS_FREEBSD) || defined(Q_OS_NETBSD) + const ssize_t r = extattr_get_file(encodedPath, EXTATTR_NAMESPACE_USER, attributeName, data.data(), size); +#else + const ssize_t r = 0; +#endif + + *value = QString::fromUtf8(data); + return r; +} + +inline int k_setxattr(const QString& path, const QString& name, const QString& value) +{ + const QByteArray p = QFile::encodeName(path); + const char* encodedPath = p.constData(); + + const QByteArray n = name.toUtf8(); + const char* attributeName = n.constData(); + + const QByteArray v = value.toUtf8(); + const void* attributeValue = v.constData(); + + const size_t valueSize = v.size(); + +#if defined(Q_OS_LINUX) || (defined(__GLIBC__) && !defined(__stub_setxattr)) + return setxattr(encodedPath, attributeName, attributeValue, valueSize, 0); +#elif defined(Q_OS_MAC) + return setxattr(encodedPath, attributeName, attributeValue, valueSize, 0, 0); +#elif defined(Q_OS_FREEBSD) || defined(Q_OS_NETBSD) + const ssize_t count = extattr_set_file(encodedPath, EXTATTR_NAMESPACE_USER, attributeName, attributeValue, valueSize); + return count == -1 ? -1 : 0; +#else + return -1; +#endif +} + + +inline int k_removexattr(const QString& path, const QString& name) +{ + const QByteArray p = QFile::encodeName(path); + const char* encodedPath = p.constData(); + + const QByteArray n = name.toUtf8(); + const char* attributeName = n.constData(); + + #if defined(Q_OS_LINUX) || (defined(__GLIBC__) && !defined(__stub_removexattr)) + return removexattr(encodedPath, attributeName); + #elif defined(Q_OS_MAC) + return removexattr(encodedPath, attributeName, XATTR_NOFOLLOW ); + #elif defined(Q_OS_FREEBSD) || defined(Q_OS_NETBSD) + return extattr_delete_file (encodedPath, EXTATTR_NAMESPACE_USER, attributeName); + #else + return -1; + #endif + +} + +#endif // KFILEMETADATA_XATTR_P_H -- To unsubscribe, e-mail: opensuse-commit+unsubscr...@opensuse.org For additional commands, e-mail: opensuse-commit+h...@opensuse.org