Merge branch 'f18' into f17

Conflicts:
	kdelibs.spec
This commit is contained in:
Rex Dieter 2012-12-28 13:04:34 -06:00
commit 7d2ab2359e
7 changed files with 41 additions and 502 deletions

3
.gitignore vendored
View File

@ -1,3 +1,2 @@
/kdelibs-4.8.5.tar.xz
/kdelibs-4.9.3.tar.xz
/kdelibs-4.9.4.tar.xz
/kdelibs-4.9.5.tar.xz

View File

@ -1,25 +0,0 @@
From 0820b3173aff4f0f3c803a9e75e726024da38ee5 Mon Sep 17 00:00:00 2001
From: David Faure <faure@kde.org>
Date: Thu, 6 Dec 2012 11:55:05 +0100
Subject: [PATCH] Fix crash when no service was selected (user clicked on
"Open With...")
---
kparts/browserrun.cpp | 2 +-
1 files changed, 1 insertions(+), 1 deletions(-)
diff --git a/kparts/browserrun.cpp b/kparts/browserrun.cpp
index 6d84800..6de0380 100644
--- a/kparts/browserrun.cpp
+++ b/kparts/browserrun.cpp
@@ -304,7 +304,7 @@ BrowserRun::NonEmbeddableResult BrowserRun::handleNonEmbeddable(const QString& _
this, SLOT(slotCopyToTempFileResult(KJob*)) );
return Delayed; // We'll continue after the job has finished
}
- if (selectedService) {
+ if (selectedService && question.selectedService()) {
*selectedService = question.selectedService();
// KRun will use this when starting an app
KRun::setPreferredService(question.selectedService()->desktopEntryName());
--
1.7.7

View File

@ -1,53 +0,0 @@
From 73283f1332e90fbb6fe0caa39a038cb16b83a54c Mon Sep 17 00:00:00 2001
From: David Faure <faure@kde.org>
Date: Wed, 5 Dec 2012 22:42:25 +0100
Subject: [PATCH] Revert "Also check parent mimetypes in
protocolForArchiveMimetype()."
This reverts commit 4f296cfbced2c4ad54beec8f500ed2d3fc04ee05.
It breaks opening odt and other zip-based files in external apps.
That's what I get for delegating the testing :-)
BUG: 311214
---
kio/kio/kprotocolmanager.cpp | 19 +------------------
1 files changed, 1 insertions(+), 18 deletions(-)
diff --git a/kio/kio/kprotocolmanager.cpp b/kio/kio/kprotocolmanager.cpp
index 3f1cadd..502a3e6 100644
--- a/kio/kio/kprotocolmanager.cpp
+++ b/kio/kio/kprotocolmanager.cpp
@@ -47,7 +47,6 @@
#include <ksharedconfig.h>
#include <kstandarddirs.h>
#include <kurl.h>
-#include <kmimetype.h>
#include <kmimetypetrader.h>
#include <kprotocolinfofactory.h>
@@ -1190,23 +1189,7 @@ QString KProtocolManager::protocolForArchiveMimetype( const QString& mimeType )
}
}
}
- const QString prot = d->protocolForArchiveMimetypes.value(mimeType);
- if (!prot.isEmpty())
- return prot;
-
- // Check parent mimetypes
- KMimeType::Ptr mime = KMimeType::mimeType(mimeType);
- if (mime) {
- const QStringList parentMimeTypes = mime->allParentMimeTypes();
- Q_FOREACH(const QString& parentMimeType, parentMimeTypes) {
- const QString res = d->protocolForArchiveMimetypes.value(parentMimeType);
- if (!res.isEmpty()) {
- return res;
- }
- }
- }
-
- return QString();
+ return d->protocolForArchiveMimetypes.value(mimeType);
}
#undef PRIVATE_DATA
--
1.7.7

View File

@ -0,0 +1,27 @@
diff -up kdelibs-4.9.4/solid/solid/backends/udisks2/udisksstorageaccess.cpp.solid_qt_no_debug_output kdelibs-4.9.4/solid/solid/backends/udisks2/udisksstorageaccess.cpp
--- kdelibs-4.9.4/solid/solid/backends/udisks2/udisksstorageaccess.cpp.solid_qt_no_debug_output 2012-12-12 14:52:52.199346662 -0600
+++ kdelibs-4.9.4/solid/solid/backends/udisks2/udisksstorageaccess.cpp 2012-12-12 15:44:40.854085494 -0600
@@ -341,9 +341,10 @@ bool StorageAccess::requestPassphrase()
QDBusReply<void> reply = soliduiserver.call("showPassphraseDialog", udi, returnService,
m_lastReturnObject, wId, appId);
m_passphraseRequested = reply.isValid();
+#ifndef QT_NO_DEBUG_STREAM
if (!m_passphraseRequested)
qWarning() << "Failed to call the SolidUiServer, D-Bus said:" << reply.error();
-
+#endif
return m_passphraseRequested;
}
diff -up kdelibs-4.9.4/solid/solid/CMakeLists.txt.solid_qt_no_debug_output kdelibs-4.9.4/solid/solid/CMakeLists.txt
--- kdelibs-4.9.4/solid/solid/CMakeLists.txt.solid_qt_no_debug_output 2012-12-12 14:52:52.194346712 -0600
+++ kdelibs-4.9.4/solid/solid/CMakeLists.txt 2012-12-12 14:52:52.203346619 -0600
@@ -240,7 +240,7 @@ if(NOT WIN32 AND NOT APPLE)
if ( WITH_SOLID_UDISKS2 )
message(STATUS "Building Solid UDisks2 backend." )
- add_definitions(-DWITH_SOLID_UDISKS2)
+ add_definitions(-DWITH_SOLID_UDISKS2 -DQT_NO_DEBUG_OUTPUT)
set(solid_LIB_SRCS ${solid_LIB_SRCS}
backends/udisks2/udisksmanager.cpp
backends/udisks2/udisksdevice.cpp

View File

@ -1,406 +0,0 @@
diff --git a/kfile/CMakeLists.txt b/kfile/CMakeLists.txt
index ceae140..c7c4d3d 100644
--- a/kfile/CMakeLists.txt
+++ b/kfile/CMakeLists.txt
@@ -20,6 +20,7 @@ set(kfile_LIB_SRCS
kfilefiltercombo.cpp
kfiletreeview.cpp
kfilewidget.cpp
+ kfileplacesdevicecache.cpp
kfileplacesitem.cpp
kfileplacesmodel.cpp
kfileplacessharedbookmarks.cpp
@@ -63,6 +64,7 @@ install( FILES
kdirselectdialog.h
kdirsortfilterproxymodel.h
kfilefiltercombo.h
+ kfileplacesdevicecache.h
kfileplacesmodel.h
kfileplacesview.h
kfilepreviewgenerator.h
diff --git a/kfile/kfileplacesdevicecache.cpp b/kfile/kfileplacesdevicecache.cpp
new file mode 100644
index 0000000..40f7242
--- /dev/null
+++ b/kfile/kfileplacesdevicecache.cpp
@@ -0,0 +1,174 @@
+/*
+ Copyright (C) 2012 Dan Vrátil <dvratil@redhat.com>
+
+ 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.
+*/
+
+#include "kfileplacesdevicecache.h"
+
+#include <QMutex>
+#include <QtConcurrentRun>
+#include <QFutureWatcher>
+#include <QTimer>
+
+#include <kprotocolinfo.h>
+#include <solid/predicate.h>
+#include <solid/device.h>
+#include <solid/devicenotifier.h>
+#include <solid/genericinterface.h>
+
+#include <kdebug.h>
+
+KFilePlacesDeviceCache* KFilePlacesDeviceCache::s_instance = 0;
+
+class KFilePlacesDeviceCache::Private
+{
+ public:
+ Private(KFilePlacesDeviceCache *parent):
+ queryRunning(false),
+ q(parent)
+ { }
+
+ ~Private()
+ { }
+
+ /* This method runs asynchronously in thread */
+ QSet<QString> listSolidDevicesAsync()
+ {
+ QSet<QString> udis;
+
+ kDebug() << "Querying Solid devices...";
+ const QList<Solid::Device>& deviceList = Solid::Device::listFromQuery(solidPredicate);
+ kDebug() << "Retrieved" << deviceList.count() << "devices";
+
+ Q_FOREACH (const Solid::Device& device, deviceList) {
+ if (solidPredicate.matches(device)) {
+ udis << device.udi();
+ }
+ }
+
+ return udis;
+ }
+
+ void _k_slotDeviceAdded(const QString &udi)
+ {
+ devicesCache << udi;
+
+ Q_EMIT q->deviceAdded(udi);
+ }
+
+ void _k_slotDeviceRemoved(const QString &udi)
+ {
+ if (!devicesCache.contains(udi)) {
+ return;
+ }
+
+ devicesCache.remove(udi);
+
+ Q_EMIT q->deviceRemoved(udi);
+ }
+
+ void _k_listSolidDevicesFinished()
+ {
+ Q_FOREACH (const QString& device, futureWatcher->result()) {
+ _k_slotDeviceAdded(device);
+ }
+
+ delete futureWatcher;
+ futureWatcher = 0;
+
+ queryRunning = false;
+ }
+
+ Solid::Predicate solidPredicate;
+
+ QFutureWatcher< QSet<QString> >* futureWatcher;
+
+ /* Static */
+ QSet<QString> devicesCache;
+ bool queryRunning;
+
+ KFilePlacesDeviceCache *q;
+};
+
+KFilePlacesDeviceCache::KFilePlacesDeviceCache():
+ QObject(),
+ d(new Private(this))
+{
+ Solid::DeviceNotifier* notifier = Solid::DeviceNotifier::instance();
+ connect(notifier, SIGNAL(deviceAdded(QString)), this, SLOT(_k_slotDeviceAdded(QString)));
+ connect(notifier, SIGNAL(deviceRemoved(QString)), this, SLOT(_k_slotDeviceRemoved(QString)));
+
+ QString predicate("[[[[ StorageVolume.ignored == false AND [ StorageVolume.usage == 'FileSystem' OR StorageVolume.usage == 'Encrypted' ]]"
+ " OR "
+ "[ IS StorageAccess AND StorageDrive.driveType == 'Floppy' ]]"
+ " OR "
+ "OpticalDisc.availableContent & 'Audio' ]"
+ " OR "
+ "StorageAccess.ignored == false ]");
+
+ if (KProtocolInfo::isKnownProtocol("mtp")) {
+ predicate.prepend("[");
+ predicate.append(" OR PortableMediaPlayer.supportedProtocols == 'mtp']");
+ }
+
+ d->solidPredicate = Solid::Predicate::fromString(predicate);
+}
+
+KFilePlacesDeviceCache* KFilePlacesDeviceCache::self()
+{
+ static QMutex mutex;
+
+ mutex.lock();
+ if (s_instance == 0) {
+ s_instance = new KFilePlacesDeviceCache();
+ }
+ mutex.unlock();
+
+ return s_instance;
+}
+
+KFilePlacesDeviceCache::~KFilePlacesDeviceCache()
+{
+ Solid::DeviceNotifier* notifier = Solid::DeviceNotifier::instance();
+ disconnect(notifier, SIGNAL(deviceAdded(QString)));
+ disconnect(notifier, SIGNAL(deviceRemoved(QString)));
+
+ delete d;
+}
+
+const Solid::Predicate& KFilePlacesDeviceCache::predicate() const
+{
+ return d->solidPredicate;
+}
+
+const QSet<QString>& KFilePlacesDeviceCache::devices() const
+{
+ kDebug();
+ if (d->devicesCache.isEmpty() && !d->queryRunning) {
+ d->queryRunning = true;
+ d->futureWatcher = new QFutureWatcher< QSet<QString> >;
+ connect(d->futureWatcher, SIGNAL(finished()), this, SLOT(_k_listSolidDevicesFinished()));
+
+ QFuture< QSet<QString> > future = QtConcurrent::run(d, &Private::listSolidDevicesAsync);
+ d->futureWatcher->setFuture(future);
+ }
+
+ return d->devicesCache;
+}
+
+
+
+#include "kfileplacesdevicecache.moc"
diff --git a/kfile/kfileplacesdevicecache.h b/kfile/kfileplacesdevicecache.h
new file mode 100644
index 0000000..7293d03
--- /dev/null
+++ b/kfile/kfileplacesdevicecache.h
@@ -0,0 +1,96 @@
+/*
+ Copyright (C) 2012 Dan Vrátil <dvratil@redhat.com>
+
+ 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 KFILEPLACESDEVICECACHE_H
+#define KFILEPLACESDEVICECACHE_H
+
+#include <kfile_export.h>
+
+#include <QObject>
+#include <QSet>
+
+#include <solid/predicate.h>
+
+/**
+ * @short Asynchronous cache for Solid devices
+ *
+ * Purpose of this cache is to load Solid devices asynchronously, because
+ * udisks2 backend can take quite a lot of time to enumerate devices, and
+ * since Solid does not have async API, the UI thread is blocked for too long.
+ *
+ * When libsolid2 with asynchronous API is available, this class can go away.
+ *
+ * The cache keeps itself up-to-date and notifies listeners when a
+ * new devices is added or removed.
+ */
+class KFILE_EXPORT KFilePlacesDeviceCache : public QObject
+{
+ Q_OBJECT
+
+public:
+ /**
+ * Returns a global instance of the cache
+ */
+ static KFilePlacesDeviceCache* self();
+
+ /**
+ * Returns list of Solid devices.
+ *
+ * This method always returns immediatelly. When there are no
+ * devices in the cache, it returns an empty list and will asynchronously
+ * query Solid for devices and will notify listeners by emitting
+ * deviceAdded() signal for each devices loaded.
+ */
+ const QSet<QString>& devices() const;
+
+ /**
+ * Returns Solid::Predicate used to obtain devices from Solid
+ */
+ const Solid::Predicate& predicate() const;
+
+Q_SIGNALS:
+ /**
+ * Emitted whenever a new device is discovered.
+ *
+ * @param udi UDI (Universal Device ID) of the newly discovered device
+ */
+ void deviceAdded(const QString& udi);
+
+ /**
+ * Emitted whenever a device is removed from system
+ *
+ * @param udi UDI (Universal Device ID) of the removed device
+ */
+ void deviceRemoved(const QString& udi);
+
+private:
+ Q_PRIVATE_SLOT(d, void _k_listSolidDevicesFinished())
+ Q_PRIVATE_SLOT(d, void _k_slotDeviceAdded(const QString&))
+ Q_PRIVATE_SLOT(d, void _k_slotDeviceRemoved(const QString&))
+
+ class Private;
+ Private * const d;
+ friend class Private;
+
+ explicit KFilePlacesDeviceCache();
+ virtual ~KFilePlacesDeviceCache();
+
+ static KFilePlacesDeviceCache* s_instance;
+};
+
+#endif // KFILEPLACESDEVICECACHE_H
diff --git a/kfile/kfileplacesmodel.cpp b/kfile/kfileplacesmodel.cpp
index 0192926..e0b01c6 100644
--- a/kfile/kfileplacesmodel.cpp
+++ b/kfile/kfileplacesmodel.cpp
@@ -20,6 +20,7 @@
#include "kfileplacesmodel.h"
#include "kfileplacesitem_p.h"
#include "kfileplacessharedbookmarks_p.h"
+#include "kfileplacesdevicecache.h"
#ifdef _WIN32_WCE
#include "Windows.h"
@@ -49,14 +50,12 @@
#include <kio/netaccess.h>
#include <kprotocolinfo.h>
-#include <solid/devicenotifier.h>
#include <solid/storageaccess.h>
#include <solid/storagedrive.h>
#include <solid/storagevolume.h>
#include <solid/opticaldrive.h>
#include <solid/opticaldisc.h>
#include <solid/portablemediaplayer.h>
-#include <solid/predicate.h>
class KFilePlacesModel::Private
{
@@ -74,7 +73,6 @@ public:
QSet<QString> availableDevices;
QMap<QObject*, QPersistentModelIndex> setupInProgress;
- Solid::Predicate predicate;
KBookmarkManager *bookmarkManager;
KFilePlacesSharedBookmarks * sharedBookmarks;
@@ -149,30 +147,12 @@ KFilePlacesModel::KFilePlacesModel(QObject *parent)
// create after, so if we have own places, they are added afterwards, in case of equal priorities
d->sharedBookmarks = new KFilePlacesSharedBookmarks(d->bookmarkManager);
- QString predicate("[[[[ StorageVolume.ignored == false AND [ StorageVolume.usage == 'FileSystem' OR StorageVolume.usage == 'Encrypted' ]]"
- " OR "
- "[ IS StorageAccess AND StorageDrive.driveType == 'Floppy' ]]"
- " OR "
- "OpticalDisc.availableContent & 'Audio' ]"
- " OR "
- "StorageAccess.ignored == false ]");
-
- if (KProtocolInfo::isKnownProtocol("mtp")) {
- predicate.prepend("[");
- predicate.append(" OR PortableMediaPlayer.supportedProtocols == 'mtp']");
- }
-
- d->predicate = Solid::Predicate::fromString(predicate);
-
- Q_ASSERT(d->predicate.isValid());
-
connect(d->bookmarkManager, SIGNAL(changed(QString,QString)),
this, SLOT(_k_reloadBookmarks()));
connect(d->bookmarkManager, SIGNAL(bookmarksChanged(QString)),
this, SLOT(_k_reloadBookmarks()));
- d->_k_reloadBookmarks();
- QTimer::singleShot(0, this, SLOT(_k_initDeviceList()));
+ d->_k_initDeviceList();
}
KFilePlacesModel::~KFilePlacesModel()
@@ -313,30 +293,21 @@ QModelIndex KFilePlacesModel::closestItem(const KUrl &url) const
void KFilePlacesModel::Private::_k_initDeviceList()
{
- Solid::DeviceNotifier *notifier = Solid::DeviceNotifier::instance();
-
- connect(notifier, SIGNAL(deviceAdded(QString)),
+ KFilePlacesDeviceCache *cache = KFilePlacesDeviceCache::self();
+ connect(cache, SIGNAL(deviceAdded(QString)),
q, SLOT(_k_deviceAdded(QString)));
- connect(notifier, SIGNAL(deviceRemoved(QString)),
+ connect(cache, SIGNAL(deviceRemoved(QString)),
q, SLOT(_k_deviceRemoved(QString)));
- const QList<Solid::Device> &deviceList = Solid::Device::listFromQuery(predicate);
-
- foreach(const Solid::Device &device, deviceList) {
- availableDevices << device.udi();
- }
+ availableDevices = cache->devices();
_k_reloadBookmarks();
}
void KFilePlacesModel::Private::_k_deviceAdded(const QString &udi)
{
- Solid::Device d(udi);
-
- if (predicate.matches(d)) {
- availableDevices << udi;
- _k_reloadBookmarks();
- }
+ availableDevices << udi;
+ _k_reloadBookmarks();
}
void KFilePlacesModel::Private::_k_deviceRemoved(const QString &udi)

View File

@ -24,8 +24,8 @@
%global dbusmenu_qt_version %(pkg-config --modversion dbusmenu-qt 2>/dev/null || echo %{dbusmenu_qt_ver})
Summary: KDE Libraries
Version: 4.9.4
Release: 5%{?dist}
Version: 4.9.5
Release: 1%{?dist}
Name: kdelibs
Epoch: 6
@ -124,10 +124,10 @@ Patch45: kdelibs-4.7.3-halectomy.patch
# udisks2 Solid backend
Patch47: kdelibs-udisks2-backend.patch
# cache to improve performance of apps using Solid with udisks2 (#868530)
# disable now, this patch causes new regression, backend devices are destroyed!
# the latest solid backend works fine without this patch
# Patch48: kdelibs-udisks2-kfileplacesdevicecache.patch
# limit solid qDebug spam
# http://bugzilla.redhat.com/882731
# TODO: could make uptreamable and conditional only on Release-type builds
Patch49: kdelibs-solid_qt_no_debug_output.patch
## upstreamable
# knewstuff2 variant of:
@ -164,9 +164,6 @@ Patch58: kdelibs-cmake_python3.patch
Patch59: kdelibs-4.9.3-kcm_ssl.patch
## upstream
Patch100: 0001-Revert-Also-check-parent-mimetypes-in-protocolForArc.patch
Patch101: 0001-Fix-crash-when-no-service-was-selected-user-clicked-.patch
Patch102: kdelibs-4.9.5-cdeject.patch
## security fix
# Not Upstreamed? why not ? -- Rex
@ -325,7 +322,7 @@ sed -i -e "s|@@VERSION_RELEASE@@|%{version}-%{release}|" kio/kio/kprotocolmanage
%if "%{?udisks}" == "udisks2"
%patch47 -p1 -b .udisks2backend
#patch48 -p1 -b .kfileplacesdevicescache
%patch49 -p1 -b .solid_qt_no_debug_output
%else
%patch45 -p1 -b .halectomy
%endif
@ -342,9 +339,6 @@ sed -i -e "s|@@VERSION_RELEASE@@|%{version}-%{release}|" kio/kio/kprotocolmanage
%patch59 -p1 -b .filter
# upstream patches
%patch100 -p1 -b .kio
%patch101 -p1 -b .crash
%patch102 -p1 -b .cdeject
# security fixes
%patch200 -p1 -b .CVE-2009-2702
@ -604,8 +598,11 @@ rm -rf %{buildroot}
%changelog
* Wed Dec 19 2012 Lukáš Tinkl <ltinkl@redhat.com> - 6:4.9.4-5
- Resolves: bz#888478 - Eject of CDs and DVDs fails
* Fri Dec 28 2012 Rex Dieter <rdieter@fedoraproject.org> 6:4.9.5-1
- 4.9.5
* Wed Dec 11 2012 Rex Dieter <rdieter@fedoraproject.org> 6:4.9.4-5
- Debug output in kdelibs-udisks2-backend.patch should be disabled (#882731)
* Thu Dec 06 2012 Than Ngo <than@redhat.com> - 6:4.9.4-4
- apply upstream patch to fix crash when no service was selected

View File

@ -1 +1 @@
ec4b28e42cdcb26ddba1c1075e02a166 kdelibs-4.9.4.tar.xz
2155d7ae075a1c7e9c6398b381c67177 kdelibs-4.9.5.tar.xz