Hello community, here is the log from the commit of package kfilemetadata5 for openSUSE:Factory checked in at 2015-10-19 22:24:30 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ 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 2015-09-24 07:11:34.000000000 +0200 +++ /work/SRC/openSUSE:Factory/.kfilemetadata5.new/kfilemetadata5.changes 2015-10-19 22:24:31.000000000 +0200 @@ -1,0 +2,8 @@ +Mon Oct 5 17:37:15 UTC 2015 - hrvoje.sen...@gmail.com + +- Update to 5.15.0 + * Implement windows usermetadata + * For more details please see: + https://www.kde.org/announcements/kde-frameworks-5.15.0.php + +------------------------------------------------------------------- Old: ---- kfilemetadata-5.14.0.tar.xz New: ---- kfilemetadata-5.15.0.tar.xz ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Other differences: ------------------ ++++++ kfilemetadata5.spec ++++++ --- /var/tmp/diff_new_pack.Y35wra/_old 2015-10-19 22:24:32.000000000 +0200 +++ /var/tmp/diff_new_pack.Y35wra/_new 2015-10-19 22:24:32.000000000 +0200 @@ -17,9 +17,9 @@ %bcond_without lang -%define _tar_path 5.14 +%define _tar_path 5.15 Name: kfilemetadata5 -Version: 5.14.0 +Version: 5.15.0 Release: 0 %define kf5_version %{version} Summary: Extract Metadata ++++++ kfilemetadata-5.14.0.tar.xz -> kfilemetadata-5.15.0.tar.xz ++++++ diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/kfilemetadata-5.14.0/CMakeLists.txt new/kfilemetadata-5.15.0/CMakeLists.txt --- old/kfilemetadata-5.14.0/CMakeLists.txt 2015-09-05 11:00:05.000000000 +0200 +++ new/kfilemetadata-5.15.0/CMakeLists.txt 2015-10-05 10:04:29.000000000 +0200 @@ -3,7 +3,7 @@ project(kfilemetadata) include(FeatureSummary) -find_package(ECM 5.14.0 NO_MODULE) +find_package(ECM 5.15.0 NO_MODULE) set_package_properties(ECM PROPERTIES TYPE REQUIRED DESCRIPTION "Extra CMake Modules." URL "https://projects.kde.org/projects/kdesupport/extra-cmake-modules") feature_summary(WHAT REQUIRED_PACKAGES_NOT_FOUND FATAL_ON_MISSING_REQUIRED_PACKAGES) @@ -17,8 +17,8 @@ include(ECMSetupVersion) include(ECMGenerateHeaders) -set(KF5_VERSION "5.14.0") # handled by release scripts -set(KF5_DEP_VERSION "5.14.0") # handled by release scripts +set(KF5_VERSION "5.15.0") # handled by release scripts +set(KF5_DEP_VERSION "5.15.0") # handled by release scripts ecm_setup_version(${KF5_VERSION} VARIABLE_PREFIX KFILEMETADATA diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/kfilemetadata-5.14.0/po/nb/kfilemetadata.po new/kfilemetadata-5.15.0/po/nb/kfilemetadata.po --- old/kfilemetadata-5.14.0/po/nb/kfilemetadata.po 2015-09-05 11:00:05.000000000 +0200 +++ new/kfilemetadata-5.15.0/po/nb/kfilemetadata.po 2015-10-05 10:04:29.000000000 +0200 @@ -1,5 +1,3 @@ -# Translation of kfilemetadata to Norwegian Bokmål -# # Bjørn Steensrud <bjor...@skogkatt.homelinux.org>, 2014. msgid "" msgstr "" diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/kfilemetadata-5.14.0/po/nn/kfilemetadata.po new/kfilemetadata-5.15.0/po/nn/kfilemetadata.po --- old/kfilemetadata-5.14.0/po/nn/kfilemetadata.po 1970-01-01 01:00:00.000000000 +0100 +++ new/kfilemetadata-5.15.0/po/nn/kfilemetadata.po 2015-10-05 10:04:29.000000000 +0200 @@ -0,0 +1,348 @@ +# Karl Ove Hufthammer <k...@huftis.org>, 2015. +msgid "" +msgstr "" +"Project-Id-Version: \n" +"Report-Msgid-Bugs-To: http://bugs.kde.org\n" +"POT-Creation-Date: 2015-04-18 09:10+0000\n" +"PO-Revision-Date: 2015-09-12 19:08+0100\n" +"Last-Translator: Karl Ove Hufthammer <k...@huftis.org>\n" +"Language-Team: Norwegian Nynorsk <i18n...@lister.ping.uio.no>\n" +"Language: nn\n" +"MIME-Version: 1.0\n" +"Content-Type: text/plain; charset=UTF-8\n" +"Content-Transfer-Encoding: 8bit\n" +"Plural-Forms: nplurals=2; plural=n != 1;\n" +"X-Generator: Lokalize 2.0\n" +"X-Environment: kde\n" +"X-Accelerator-Marker: &\n" +"X-Text-Markup: kde4\n" + +#: src/propertyinfo.cpp:47 +msgctxt "@label music album" +msgid "Album" +msgstr "Album" + +#: src/propertyinfo.cpp:53 +msgctxt "@label" +msgid "Album Artist" +msgstr "Albumartist" + +#: src/propertyinfo.cpp:59 +msgctxt "@label" +msgid "Artist" +msgstr "Artist" + +#: src/propertyinfo.cpp:65 +msgctxt "@label" +msgid "Aspect Ratio" +msgstr "" + +#: src/propertyinfo.cpp:71 +msgctxt "@label" +msgid "Author" +msgstr "" + +#: src/propertyinfo.cpp:77 +msgctxt "@label" +msgid "Bitrate" +msgstr "" + +#: src/propertyinfo.cpp:83 +msgctxt "@label" +msgid "Channels" +msgstr "" + +#: src/propertyinfo.cpp:89 +msgctxt "@label" +msgid "Comment" +msgstr "" + +#: src/propertyinfo.cpp:96 +msgctxt "@label" +msgid "Composer" +msgstr "" + +#: src/propertyinfo.cpp:103 +msgctxt "@label" +msgid "Copyright" +msgstr "" + +#: src/propertyinfo.cpp:110 +msgctxt "@label" +msgid "Creation Date" +msgstr "" + +#: src/propertyinfo.cpp:116 +msgctxt "@label" +msgid "Duration" +msgstr "" + +#: src/propertyinfo.cpp:127 +msgctxt "@label" +msgid "Frame Rate" +msgstr "" + +#: src/propertyinfo.cpp:133 +msgctxt "@label" +msgid "Software used to Generate the document" +msgstr "" + +#: src/propertyinfo.cpp:140 +msgctxt "@label music genre" +msgid "Genre" +msgstr "" + +#: src/propertyinfo.cpp:147 +msgctxt "@label" +msgid "Height" +msgstr "" + +#: src/propertyinfo.cpp:153 +msgctxt "@label EXIF" +msgid "Image Date Time" +msgstr "" + +#: src/propertyinfo.cpp:159 +msgctxt "@label EXIF" +msgid "Image Make" +msgstr "" + +#: src/propertyinfo.cpp:166 +msgctxt "@label EXIF" +msgid "Image Model" +msgstr "" + +#: src/propertyinfo.cpp:173 +msgctxt "@label EXIF" +msgid "Image Orientation" +msgstr "" + +#: src/propertyinfo.cpp:179 +msgctxt "@label" +msgid "Keywords" +msgstr "" + +#: src/propertyinfo.cpp:186 +msgctxt "@label" +msgid "Language" +msgstr "" + +#: src/propertyinfo.cpp:193 +msgctxt "@label number of lines" +msgid "Line Count" +msgstr "" + +#: src/propertyinfo.cpp:199 +msgctxt "@label" +msgid "Lyricist" +msgstr "" + +#: src/propertyinfo.cpp:206 +msgctxt "@label" +msgid "Page Count" +msgstr "" + +#: src/propertyinfo.cpp:212 +msgctxt "@label EXIF" +msgid "Photo Aperture Value" +msgstr "" + +#: src/propertyinfo.cpp:218 +msgctxt "@label EXIF" +msgid "Photo Original Date Time" +msgstr "" + +#: src/propertyinfo.cpp:224 +msgctxt "@label EXIF" +msgid "Photo Exposure Bias" +msgstr "" + +#: src/propertyinfo.cpp:230 +msgctxt "@label EXIF" +msgid "Photo Exposure Time" +msgstr "" + +#: src/propertyinfo.cpp:236 +msgctxt "@label EXIF" +msgid "Photo Flash" +msgstr "" + +#: src/propertyinfo.cpp:242 +msgctxt "@label EXIF" +msgid "Photo F Number" +msgstr "" + +#: src/propertyinfo.cpp:248 +msgctxt "@label EXIF" +msgid "Photo Focal Length" +msgstr "" + +#: src/propertyinfo.cpp:254 +msgctxt "@label EXIF" +msgid "Photo Focal Length 35mm" +msgstr "" + +#: src/propertyinfo.cpp:260 +msgctxt "@label EXIF" +msgid "Photo GPS Latitude" +msgstr "" + +#: src/propertyinfo.cpp:266 +msgctxt "@label EXIF" +msgid "Photo GPS Longitude" +msgstr "" + +#: src/propertyinfo.cpp:272 +msgctxt "@label EXIF" +msgid "Photo GPS Altitude" +msgstr "" + +#: src/propertyinfo.cpp:278 +msgctxt "@label EXIF" +msgid "Photo ISO Speed Rating" +msgstr "" + +#: src/propertyinfo.cpp:284 +msgctxt "@label EXIF" +msgid "Photo Metering Mode" +msgstr "" + +#: src/propertyinfo.cpp:290 +msgctxt "@label EXIF" +msgid "Photo X Dimension" +msgstr "" + +#: src/propertyinfo.cpp:296 +msgctxt "@label EXIF" +msgid "Photo Y Dimension" +msgstr "" + +#: src/propertyinfo.cpp:302 +msgctxt "@label EXIF" +msgid "Photo Saturation" +msgstr "" + +#: src/propertyinfo.cpp:308 +msgctxt "@label EXIF" +msgid "Photo Sharpness" +msgstr "" + +#: src/propertyinfo.cpp:314 +msgctxt "@label EXIF" +msgid "Photo White Balance" +msgstr "" + +#: src/propertyinfo.cpp:320 +msgctxt "@label" +msgid "Publisher" +msgstr "" + +#: src/propertyinfo.cpp:326 +msgctxt "@label" +msgid "Release Year" +msgstr "" + +#: src/propertyinfo.cpp:332 +msgctxt "@label" +msgid "Sample Rate" +msgstr "" + +#: src/propertyinfo.cpp:338 +msgctxt "@label" +msgid "Subject" +msgstr "" + +#: src/propertyinfo.cpp:345 +msgctxt "@label" +msgid "Title" +msgstr "" + +#: src/propertyinfo.cpp:351 +msgctxt "@label music track number" +msgid "Track Number" +msgstr "" + +#: src/propertyinfo.cpp:357 +msgctxt "@label" +msgid "Width" +msgstr "" + +#: src/propertyinfo.cpp:363 +msgctxt "@label number of words" +msgid "Word Count" +msgstr "" + +#: src/propertyinfo.cpp:370 +msgctxt "@label number of translatable strings" +msgid "Translatable Units" +msgstr "" + +#: src/propertyinfo.cpp:377 +msgctxt "@label number of translated strings" +msgid "Translations" +msgstr "" + +#: src/propertyinfo.cpp:385 +msgctxt "@label number of fuzzy translated strings" +msgid "Draft Translations" +msgstr "" + +#: src/propertyinfo.cpp:392 +msgctxt "@label translation author" +msgid "Author" +msgstr "" + +#: src/propertyinfo.cpp:399 +msgctxt "@label translations last update" +msgid "Last Update" +msgstr "" + +#: src/propertyinfo.cpp:406 +msgctxt "@label date of template creation8" +msgid "Template Creation" +msgstr "" + +#: src/typeinfo.cpp:47 +msgctxt "@label" +msgid "Archive" +msgstr "" + +#: src/typeinfo.cpp:52 +msgctxt "@label" +msgid "Audio" +msgstr "" + +#: src/typeinfo.cpp:57 +msgctxt "@label" +msgid "Document" +msgstr "" + +#: src/typeinfo.cpp:62 +msgctxt "@label" +msgid "Image" +msgstr "" + +#: src/typeinfo.cpp:67 +msgctxt "@label" +msgid "Presentation" +msgstr "" + +#: src/typeinfo.cpp:72 +msgctxt "@label" +msgid "Spreadsheet" +msgstr "" + +#: src/typeinfo.cpp:77 +msgctxt "@label" +msgid "Text" +msgstr "" + +#: src/typeinfo.cpp:82 +msgctxt "@label" +msgid "Video" +msgstr "" + +#: src/typeinfo.cpp:87 +msgctxt "@label" +msgid "Folder" +msgstr "" diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/kfilemetadata-5.14.0/src/extractors/poextractor.cpp new/kfilemetadata-5.15.0/src/extractors/poextractor.cpp --- old/kfilemetadata-5.14.0/src/extractors/poextractor.cpp 2015-09-05 11:00:05.000000000 +0200 +++ new/kfilemetadata-5.15.0/src/extractors/poextractor.cpp 2015-10-05 10:04:29.000000000 +0200 @@ -49,7 +49,7 @@ state = WHITESPACE; } -void POExtractor::handleComment(const char* data, uint32_t length) +void POExtractor::handleComment(const char* data, quint32 length) { state = COMMENT; if (length >= 8 && strncmp(data, "#, fuzzy", 8) == 0) { // could be better @@ -57,7 +57,7 @@ } } -void POExtractor::handleLine(const char* data, uint32_t length) +void POExtractor::handleLine(const char* data, quint32 length) { if (state == ERROR) return; if (state == WHITESPACE) { diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/kfilemetadata-5.14.0/src/extractors/poextractor.h new/kfilemetadata-5.15.0/src/extractors/poextractor.h --- old/kfilemetadata-5.14.0/src/extractors/poextractor.h 2015-09-05 11:00:05.000000000 +0200 +++ new/kfilemetadata-5.15.0/src/extractors/poextractor.h 2015-10-05 10:04:29.000000000 +0200 @@ -43,8 +43,8 @@ private: void endMessage(); - void handleComment(const char* data, uint32_t length); - void handleLine(const char* data, uint32_t length); + void handleComment(const char* data, quint32 length); + void handleLine(const char* data, quint32 length); enum PoState {COMMENT, MSGCTXT, MSGID, MSGID_PLURAL, MSGSTR, MSGSTR_PLURAL, diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/kfilemetadata-5.14.0/src/usermetadata.cpp new/kfilemetadata-5.15.0/src/usermetadata.cpp --- old/kfilemetadata-5.14.0/src/usermetadata.cpp 2015-09-05 11:00:05.000000000 +0200 +++ new/kfilemetadata-5.15.0/src/usermetadata.cpp 2015-10-05 10:04:29.000000000 +0200 @@ -19,7 +19,6 @@ #include "usermetadata.h" #include "xattr_p.h" -#include <errno.h> #include <QSet> @@ -107,9 +106,7 @@ bool UserMetaData::hasAttribute(const QString& key) { - k_getxattr(d->filePath, QStringLiteral("user.") + key, 0); - - return (errno != ENOATTR); + return k_hasAttribute(d->filePath, QStringLiteral("user.") + key); } QString UserMetaData::attribute(const QString& key) @@ -122,8 +119,5 @@ bool UserMetaData::isSupported() const { - QString value; - k_getxattr(d->filePath, QStringLiteral("user.test"), &value); - - return (errno != ENOTSUP); + return k_isSupported(d->filePath); } diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/kfilemetadata-5.14.0/src/xattr_p.h new/kfilemetadata-5.15.0/src/xattr_p.h --- old/kfilemetadata-5.14.0/src/xattr_p.h 2015-09-05 11:00:05.000000000 +0200 +++ new/kfilemetadata-5.15.0/src/xattr_p.h 2015-10-05 10:04:29.000000000 +0200 @@ -24,17 +24,26 @@ #include <QByteArray> #include <QFile> #include <QString> +#include <QDebug> +#include <QFileInfo> +#include <QDir> #if defined(Q_OS_LINUX) || defined(__GLIBC__) #include <sys/types.h> #include <sys/xattr.h> #include <attr/xattr.h> +#include <errno.h> #elif defined(Q_OS_MAC) #include <sys/types.h> #include <sys/xattr.h> +#include <errno.h> #elif defined(Q_OS_FREEBSD) || defined(Q_OS_NETBSD) #include <sys/types.h> #include <sys/extattr.h> +#include <errno.h> +#elif defined(Q_OS_WIN) +#include <windows.h> +#define ssize_t SSIZE_T #endif inline ssize_t k_getxattr(const QString& path, const QString& name, QString* value) @@ -52,6 +61,16 @@ 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); +#elif defined(Q_OS_WIN) + const QString fullADSName = path + QLatin1Char(':') + name; + HANDLE hFile = ::CreateFileW(reinterpret_cast<const WCHAR*>(fullADSName.utf16()), GENERIC_READ, FILE_SHARE_READ, NULL, + OPEN_EXISTING, FILE_FLAG_SEQUENTIAL_SCAN, NULL); + + if(!hFile) return 0; + + LARGE_INTEGER lsize; + lsize.LowPart = GetFileSize(hFile, (DWORD*)&lsize.HighPart); + ssize_t size = (qint64)lsize.QuadPart; #else const ssize_t size = 0; #endif @@ -71,11 +90,16 @@ 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); +#elif defined(Q_OS_WIN) + ssize_t r = 0; + // should we care about attributes longer than 2GiB? - unix xattr are restricted to much lower values + ::ReadFile(hFile, data.data(), size, (DWORD*)&r, NULL); + CloseHandle(hFile); #else const ssize_t r = 0; #endif - *value = QString::fromUtf8(data); + if(value) *value = QString::fromUtf8(data); return r; } @@ -99,6 +123,32 @@ #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; +#elif defined(Q_OS_WIN) + const QString fullADSName = path + QLatin1Char(':') + name; + HANDLE hFile = ::CreateFileW(reinterpret_cast<const WCHAR*>(fullADSName.utf16()), GENERIC_WRITE, FILE_SHARE_READ, NULL, + CREATE_ALWAYS, FILE_ATTRIBUTE_NORMAL | FILE_FLAG_SEQUENTIAL_SCAN, NULL); + + if(!hFile) return -1; + + DWORD count = 0; + + if(!::WriteFile(hFile, attributeValue, valueSize, &count, NULL)) { + DWORD dw = GetLastError(); + TCHAR msg[1024]; + FormatMessage( + FORMAT_MESSAGE_ALLOCATE_BUFFER | + FORMAT_MESSAGE_FROM_SYSTEM | + FORMAT_MESSAGE_IGNORE_INSERTS, + NULL, + dw, + MAKELANGID(LANG_NEUTRAL, SUBLANG_DEFAULT), + (LPTSTR) &msg, + 0, NULL ); + qWarning() << "failed to write to ADS:" << msg; + } + + CloseHandle(hFile); + return count; #else return -1; #endif @@ -119,10 +169,68 @@ return removexattr(encodedPath, attributeName, XATTR_NOFOLLOW ); #elif defined(Q_OS_FREEBSD) || defined(Q_OS_NETBSD) return extattr_delete_file (encodedPath, EXTATTR_NAMESPACE_USER, attributeName); + #elif defined(Q_OS_WIN) + const QString fullADSName = path + QLatin1Char(':') + name; + int ret = (DeleteFileW(reinterpret_cast<const WCHAR*>(fullADSName.utf16()))) ? 0 : -1; + return ret; #else return -1; #endif } +inline bool k_hasAttribute(const QString& path, const QString& name) +{ +#if defined(Q_OS_WIN) + // enumerate all streams: + const QString streamName = QStringLiteral(":") + name + QStringLiteral(":$DATA"); + HANDLE hFile = ::CreateFileW(reinterpret_cast<const WCHAR*>(path.utf16()), GENERIC_READ, FILE_SHARE_READ, NULL, + OPEN_EXISTING, FILE_FLAG_SEQUENTIAL_SCAN, NULL); + + if(!hFile) { + return false; + } + FILE_STREAM_INFO* fi = new FILE_STREAM_INFO[256]; + if(GetFileInformationByHandleEx(hFile, FileStreamInfo, fi, 256 * sizeof(FILE_STREAM_INFO))) { + if(QString::fromUtf16((ushort*)fi->StreamName, fi->StreamNameLength / sizeof(ushort)) == streamName) { + delete[] fi; + CloseHandle(hFile); + return true; + } + FILE_STREAM_INFO* p = fi; + do { + p = (FILE_STREAM_INFO*) ((char*)p + p->NextEntryOffset); + if(QString::fromUtf16((ushort*)p->StreamName, p->StreamNameLength / sizeof(ushort)) == streamName) { + delete[] fi; + CloseHandle(hFile); + return true; + } + } while(p->NextEntryOffset != NULL); + } + delete[] fi; + CloseHandle(hFile); + return false; +#else + k_getxattr(path, name, 0); + return (errno != ENOATTR); +#endif +} + +inline bool k_isSupported(const QString& path) +{ + QString value; +#if defined(Q_OS_LINUX) || defined(Q_OS_MAC) || defined(Q_OS_FREEBSD) || defined(Q_OS_NETBSD) + k_getxattr(path, QStringLiteral("user.test"), &value); + return (errno != ENOTSUP); +#elif defined(Q_OS_WIN) + QFileInfo f(path); + const QString drive = QString(f.absolutePath().left(2)) + QStringLiteral("\\"); + WCHAR szFSName[MAX_PATH]; + DWORD dwVolFlags; + ::GetVolumeInformationW(reinterpret_cast<const WCHAR*>(drive.utf16()), NULL, 0, NULL, NULL, &dwVolFlags, szFSName, MAX_PATH); + return ((dwVolFlags & FILE_NAMED_STREAMS) && _wcsicmp(szFSName, L"NTFS") == 0); +#else + return false; +#endif +} #endif // KFILEMETADATA_XATTR_P_H