[-]
[+]
|
Changed |
kservice.spec
|
|
[-]
[+]
|
Changed |
kservice-5.10.0.tar.xz/CMakeLists.txt
^
|
@@ -4,7 +4,7 @@
project(KService)
# ECM setup
-find_package(ECM 5.9.0 REQUIRED NO_MODULE)
+find_package(ECM 5.10.0 REQUIRED NO_MODULE)
set(CMAKE_MODULE_PATH ${ECM_MODULE_PATH} ${ECM_KDE_MODULE_DIR} ${CMAKE_CURRENT_SOURCE_DIR}/cmake )
include(KDEInstallDirs)
@@ -15,8 +15,8 @@
include(FeatureSummary)
include(GenerateExportHeader)
-set(KF5_VERSION "5.9.0") # handled by release scripts
-set(KF5_DEP_VERSION "5.9.0") # handled by release scripts
+set(KF5_VERSION "5.10.0") # handled by release scripts
+set(KF5_DEP_VERSION "5.10.0") # handled by release scripts
ecm_setup_version(${KF5_VERSION}
VARIABLE_PREFIX KSERVICE
|
[-]
[+]
|
Changed |
kservice-5.10.0.tar.xz/autotests/fakeplugin.desktop
^
|
@@ -109,6 +109,8 @@
Keywords[fi]=sana1;sana2
Keywords[gl]=palabra1;palabra2
Keywords[it]=parola1;parola2
+Keywords[ko]=word1;word2
+Keywords[nb]=ord1;ord2
Keywords[nl]=woord1;woord2
Keywords[pl]=słowo1;słowo2
Keywords[pt]=palavra1;palavra2
@@ -136,6 +138,8 @@
X-KDE-Keywords[fi]=sana3,sana4
X-KDE-Keywords[gl]=palabra3,palabra4
X-KDE-Keywords[it]=parola3,parola4
+X-KDE-Keywords[ko]=word3,word4
+X-KDE-Keywords[nb]=ord3;ord4
X-KDE-Keywords[nl]=woord3,woord4
X-KDE-Keywords[pl]=słowo3,słowo4
X-KDE-Keywords[pt]=palavra3,palavra4
|
[-]
[+]
|
Changed |
kservice-5.10.0.tar.xz/autotests/kmimeassociationstest.cpp
^
|
@@ -112,35 +112,25 @@
qputenv("XDG_CURRENT_DESKTOP", "KDE");
m_localConfig = QStandardPaths::writableLocation(QStandardPaths::GenericConfigLocation) + QLatin1Char('/');
+ QDir(m_localConfig).removeRecursively();
+ QVERIFY(QDir().mkpath(m_localConfig));
m_localApps = QStandardPaths::writableLocation(QStandardPaths::ApplicationsLocation) + QLatin1Char('/');
-
- bool mustUpdateKSycoca = false;
-
- if (QFile::exists(m_localConfig + "/mimeapps.list")) {
- QFile::remove(m_localConfig + "/mimeapps.list");
- mustUpdateKSycoca = true;
- }
+ QDir(m_localApps).removeRecursively();
+ QVERIFY(QDir().mkpath(m_localApps));
+ QString cacheDir = QStandardPaths::writableLocation(QStandardPaths::CacheLocation) + QLatin1Char('/');
+ QDir(cacheDir).removeRecursively();
// Create fake application (associated with text/plain in mimeapps.list)
fakeTextApplication = m_localApps + "faketextapplication.desktop";
- if (!QFile::exists(fakeTextApplication)) {
- mustUpdateKSycoca = true;
- writeAppDesktopFile(fakeTextApplication, QStringList() << "text/plain");
- }
+ writeAppDesktopFile(fakeTextApplication, QStringList() << "text/plain");
// Create fake application (associated with text/plain in mimeapps.list)
fakeTextApplicationPrefixed = m_localApps + "fakepfx/faketextapplicationpfx.desktop";
- if (!QFile::exists(fakeTextApplicationPrefixed)) {
- mustUpdateKSycoca = true;
- writeAppDesktopFile(fakeTextApplicationPrefixed, QStringList() << "text/plain");
- }
+ writeAppDesktopFile(fakeTextApplicationPrefixed, QStringList() << "text/plain");
// A fake "default" application for text/plain (high initial preference, but not in mimeapps.list)
fakeDefaultTextApplication = m_localApps + "fakedefaulttextapplication.desktop";
- if (!QFile::exists(fakeDefaultTextApplication)) {
- mustUpdateKSycoca = true;
- writeAppDesktopFile(fakeDefaultTextApplication, QStringList() << "text/plain", 9);
- }
+ writeAppDesktopFile(fakeDefaultTextApplication, QStringList() << "text/plain", 9);
// An app (like emacs) listing explicitly the derived mimetype (c-src); not in mimeapps.list
// This interacted badly with mimeapps.list listing another app for text/plain, but the
@@ -149,39 +139,22 @@
//
// Also include aliases (msword), to check they don't cancel each other out.
fakeCSrcApplication = m_localApps + "fakecsrcmswordapplication.desktop";
- if (!QFile::exists(fakeCSrcApplication)) {
- mustUpdateKSycoca = true;
- writeAppDesktopFile(fakeCSrcApplication, QStringList() << "text/plain" << "text/c-src" << "application/vnd.ms-word" << "application/msword", 8);
- }
+ writeAppDesktopFile(fakeCSrcApplication, QStringList() << "text/plain" << "text/c-src" << "application/vnd.ms-word" << "application/msword", 8);
fakeJpegApplication = m_localApps + "fakejpegapplication.desktop";
- if (!QFile::exists(fakeJpegApplication)) {
- mustUpdateKSycoca = true;
- writeAppDesktopFile(fakeJpegApplication, QStringList() << "image/jpeg");
- }
+ writeAppDesktopFile(fakeJpegApplication, QStringList() << "image/jpeg");
fakeArkApplication = m_localApps + "fakearkapplication.desktop";
- if (!QFile::exists(fakeArkApplication)) {
- mustUpdateKSycoca = true;
- writeAppDesktopFile(fakeArkApplication, QStringList() << "application/zip");
- }
+ writeAppDesktopFile(fakeArkApplication, QStringList() << "application/zip");
fakeHtmlApplication = m_localApps + "fakehtmlapplication.desktop";
- if (!QFile::exists(fakeHtmlApplication)) {
- mustUpdateKSycoca = true;
- writeAppDesktopFile(fakeHtmlApplication, QStringList() << "text/html");
- }
+ writeAppDesktopFile(fakeHtmlApplication, QStringList() << "text/html");
fakeHtmlApplicationPrefixed = m_localApps + "fakepfx/fakehtmlapplicationpfx.desktop";
- if (!QFile::exists(fakeHtmlApplicationPrefixed)) {
- mustUpdateKSycoca = true;
- writeAppDesktopFile(fakeHtmlApplicationPrefixed, QStringList() << "text/html");
- }
-
- if (mustUpdateKSycoca || !KSycoca::isAvailable()) {
- // Update ksycoca in ~/.kde-unit-test after creating the above
- runKBuildSycoca();
- }
+ writeAppDesktopFile(fakeHtmlApplicationPrefixed, QStringList() << "text/html");
+
+ // Update ksycoca in ~/.kde-unit-test after creating the above
+ runKBuildSycoca();
// Create factory on the heap and don't delete it. This must happen after
// Sycoca is built, in case it did not exist before.
|
[-]
[+]
|
Changed |
kservice-5.10.0.tar.xz/autotests/kservicetest.cpp
^
|
@@ -26,6 +26,7 @@
#include <kconfiggroup.h>
#include <kdesktopfile.h>
#include <ksycoca.h>
+#include <../src/services/kserviceutil_p.h>
#include <kservicegroup.h>
#include <kservicetypetrader.h>
@@ -802,3 +803,17 @@
QCOMPARE(info.property("X-KDE-TestList").value<QStringList>().size(), 2);
}
+
+void KServiceTest::testCompleteBaseName()
+{
+ QCOMPARE(KServiceUtilPrivate::completeBaseName("/home/x/.qttest/share/kservices5/fakepart2.desktop"), QString("fakepart2"));
+ // dots in filename before .desktop extension:
+ QCOMPARE(KServiceUtilPrivate::completeBaseName("/home/x/.qttest/share/kservices5/org.kde.fakeapp.desktop"), QString("org.kde.fakeapp"));
+}
+
+void KServiceTest::testEntryPathToName()
+{
+ QCOMPARE(KService("c.desktop").name(), QString("c"));
+ QCOMPARE(KService("a.b.c.desktop").name(), QString("a.b.c")); // dots in filename before .desktop extension
+ QCOMPARE(KService("/hallo/a.b.c.desktop").name(), QString("a.b.c"));
+}
|
[-]
[+]
|
Changed |
kservice-5.10.0.tar.xz/autotests/kservicetest.h
^
|
@@ -49,6 +49,8 @@
void testThreads();
void testOperatorKPluginName();
void testKPluginInfoQuery();
+ void testCompleteBaseName();
+ void testEntryPathToName();
private:
void createFakeService();
|
[-]
[+]
|
Changed |
kservice-5.10.0.tar.xz/src/services/kservice.cpp
^
|
@@ -40,6 +40,7 @@
#include "kservicefactory.h"
#include "kservicetypefactory.h"
+#include "kserviceutil_p.h"
QDataStream &operator<<(QDataStream &s, const KService::ServiceTypeAndPreference &st)
{
@@ -146,15 +147,9 @@
return;
}
- QString _name = entryPath;
- int pos = _name.lastIndexOf(QLatin1Char('/'));
- if (pos != -1) {
- _name = _name.mid(pos + 1);
- }
- pos = _name.indexOf(QLatin1Char('.'));
- if (pos != -1) {
- _name.truncate(pos);
- }
+ // entryPath To desktopEntryName
+ // (e.g. "/home/x/.qttest/share/kservices5/fakepart2.desktop" --> "fakepart2")
+ QString _name = KServiceUtilPrivate::completeBaseName(entryPath);
m_strIcon = config->readIcon();
entryMap.remove(QStringLiteral("Icon"));
|
[-]
[+]
|
Changed |
kservice-5.10.0.tar.xz/src/services/kservice_p.h
^
|
@@ -42,6 +42,7 @@
}
void init(const KDesktopFile *config, KService *q);
+
void parseActions(const KDesktopFile *config, KService *q);
void load(QDataStream &);
virtual void save(QDataStream &);
|
[-]
[+]
|
Added |
kservice-5.10.0.tar.xz/src/services/kserviceutil_p.h
^
|
@@ -0,0 +1,50 @@
+/* This file is part of the KDE project
+ Copyright (C) 2015 Gregor Mi <codestruct@posteo.org>
+
+ This library is free software; you can redistribute it and/or
+ modify it under the terms of the GNU Library General Public
+ License version 2 as published by the Free Software Foundation.
+
+ 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 KSERVICEUTIL_P_H
+#define KSERVICEUTIL_P_H
+
+#include <QString>
+
+class KServiceUtilPrivate
+{
+public:
+ /**
+ * Lightweight implementation of QFileInfo::completeBaseName.
+ *
+ * Returns the complete base name of the file without the path.
+ * The complete base name consists of all characters in the file up to (but not including) the last '.' character.
+ *
+ * Example: "/tmp/archive.tar.gz" --> "archive.tar"
+ */
+ static QString completeBaseName(const QString& filepath)
+ {
+ QString name = filepath;
+ int pos = name.lastIndexOf(QLatin1Char('/'));
+ if (pos != -1) {
+ name = name.mid(pos + 1);
+ }
+ pos = name.lastIndexOf(QLatin1Char('.'));
+ if (pos != -1) {
+ name.truncate(pos);
+ }
+ return name;
+ }
+};
+
+#endif
|
[-]
[+]
|
Changed |
kservice.yaml
^
|
@@ -1,5 +1,5 @@
Name : kservice
-Version : 5.9.0
+Version : 5.10.0
Release : 2
Group : System/Base
License : GPLv2+
|