Accepting request 254433 from KDE:Frameworks5

Update to 5.3.0

OBS-URL: https://build.opensuse.org/request/show/254433
OBS-URL: https://build.opensuse.org/package/show/openSUSE:Factory/kio?expand=0&rev=11
This commit is contained in:
Stephan Kulow 2014-10-07 13:59:43 +00:00 committed by Git OBS Bridge
commit f15e5dcf3f
7 changed files with 27 additions and 496 deletions

View File

@ -1,352 +0,0 @@
From ed705a319e671631e17f74ac2fbc84d102f45a09 Mon Sep 17 00:00:00 2001
From: Mathias Tillman <master.homer@gmail.com>
Date: Sun, 14 Sep 2014 16:39:44 +0200
Subject: [PATCH 1/1] Add new KIO job, KIO::fileSystemFreeSpace, that allows
you to get a filesystem's total and available space.
REVIEW: 120134
---
src/core/CMakeLists.txt | 2 +
src/core/commands_p.h | 3 +-
src/core/filesystemfreespacejob.cpp | 88 +++++++++++++++++++++++++++++++++++++
src/core/filesystemfreespacejob.h | 73 ++++++++++++++++++++++++++++++
src/core/slavebase.cpp | 20 ++++++++-
src/core/slavebase.h | 3 +-
src/ioslaves/file/file.cpp | 31 +++++++++++++
src/ioslaves/file/file.h | 5 +++
8 files changed, 221 insertions(+), 4 deletions(-)
create mode 100644 src/core/filesystemfreespacejob.cpp
create mode 100644 src/core/filesystemfreespacejob.h
diff --git a/src/core/CMakeLists.txt b/src/core/CMakeLists.txt
index f1f8848..7043e49 100644
--- a/src/core/CMakeLists.txt
+++ b/src/core/CMakeLists.txt
@@ -66,6 +66,7 @@ set(kiocore_SRCS
statjob.cpp
storedtransferjob.cpp
transferjob.cpp
+ filesystemfreespacejob.cpp
scheduler.cpp
slaveconfig.cpp
kprotocolmanager.cpp
@@ -194,6 +195,7 @@ ecm_generate_headers(KIOCore_CamelCase_HEADERS
AuthInfo
DavJob
DesktopExecParser
+ FileSystemFreeSpaceJob
PREFIX KIO
REQUIRED_HEADERS KIO_namespaced_HEADERS
diff --git a/src/core/commands_p.h b/src/core/commands_p.h
index 4b6bfa2..a8ddeba 100644
--- a/src/core/commands_p.h
+++ b/src/core/commands_p.h
@@ -63,7 +63,8 @@ enum Command {
CMD_WRITE = 91,
CMD_SEEK = 92,
CMD_CLOSE = 93,
- CMD_HOST_INFO = 94
+ CMD_HOST_INFO = 94,
+ CMD_FILESYSTEMFREESPACE = 95
// Add new ones here once a release is done, to avoid breaking binary compatibility.
// Note that protocol-specific commands shouldn't be added here, but should use special.
};
diff --git a/src/core/filesystemfreespacejob.cpp b/src/core/filesystemfreespacejob.cpp
new file mode 100644
index 0000000..2b85ad2
--- /dev/null
+++ b/src/core/filesystemfreespacejob.cpp
@@ -0,0 +1,88 @@
+/* This file is part of the KDE libraries
+ Copyright (C) 2000 Stephan Kulow <coolo@kde.org>
+ 2000-2009 David Faure <faure@kde.org>
+ 2014 Mathias Tillman <master.homer@gmail.com>
+
+ 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.
+*/
+
+#include "filesystemfreespacejob.h"
+#include "job.h"
+#include "job_p.h"
+#include <slave.h>
+
+using namespace KIO;
+
+class KIO::FileSystemFreeSpaceJobPrivate: public SimpleJobPrivate
+{
+public:
+ FileSystemFreeSpaceJobPrivate(const QUrl &url, int command, const QByteArray &packedArgs)
+ : SimpleJobPrivate(url, command, packedArgs)
+ { }
+
+ /**
+ * @internal
+ * Called by the scheduler when a @p slave gets to
+ * work on this job.
+ * @param slave the slave that starts working on this job
+ */
+ void start(Slave *slave) Q_DECL_OVERRIDE;
+
+ Q_DECLARE_PUBLIC(FileSystemFreeSpaceJob)
+
+ static inline FileSystemFreeSpaceJob *newJob(const QUrl &url, int command, const QByteArray &packedArgs)
+ {
+ FileSystemFreeSpaceJob *job = new FileSystemFreeSpaceJob(*new FileSystemFreeSpaceJobPrivate(url, command, packedArgs));
+ job->setUiDelegate(KIO::createDefaultJobUiDelegate());
+ return job;
+ }
+};
+
+FileSystemFreeSpaceJob::FileSystemFreeSpaceJob(FileSystemFreeSpaceJobPrivate &dd)
+ : SimpleJob(dd)
+{
+}
+
+FileSystemFreeSpaceJob::~FileSystemFreeSpaceJob()
+{
+}
+
+void FileSystemFreeSpaceJobPrivate::start(Slave *slave)
+{
+ Q_Q(FileSystemFreeSpaceJob);
+ SimpleJobPrivate::start(slave);
+}
+
+void FileSystemFreeSpaceJob::slotFinished()
+{
+ Q_D(FileSystemFreeSpaceJob);
+
+ KIO::filesize_t total = queryMetaData("total").toULongLong();
+ KIO::filesize_t available = queryMetaData("available").toULongLong();
+
+ emit result(this, total, available);
+
+ // Return slave to the scheduler
+ SimpleJob::slotFinished();
+}
+
+KIO::FileSystemFreeSpaceJob *KIO::fileSystemFreeSpace(const QUrl &url)
+{
+ KIO_ARGS << url;
+ return FileSystemFreeSpaceJobPrivate::newJob(url, CMD_FILESYSTEMFREESPACE, packedArgs);
+}
+
+#include "moc_filesystemfreespacejob.cpp"
diff --git a/src/core/filesystemfreespacejob.h b/src/core/filesystemfreespacejob.h
new file mode 100644
index 0000000..9754d5f
--- /dev/null
+++ b/src/core/filesystemfreespacejob.h
@@ -0,0 +1,73 @@
+/* This file is part of the KDE libraries
+ Copyright (C) 2000 Stephan Kulow <coolo@kde.org>
+ 2000-2009 David Faure <faure@kde.org>
+ 2014 Mathias Tillman <master.homer@gmail.com>
+
+ 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 FILESYSTEMFREESPACEJOB_H
+#define FILESYSTEMFREESPACEJOB_H
+
+#include "kiocore_export.h"
+#include "simplejob.h"
+
+namespace KIO
+{
+
+class FileSystemFreeSpaceJobPrivate;
+/**
+ * A KIO job that retrieves the total and available size of a filesystem.
+ * @since 5.3
+ */
+class KIOCORE_EXPORT FileSystemFreeSpaceJob : public SimpleJob
+{
+
+ Q_OBJECT
+
+public:
+ ~FileSystemFreeSpaceJob();
+
+Q_SIGNALS:
+ /**
+ * Signals the result
+ * @param job the job that is redirected
+ * @param size total amount of space
+ * @param available amount of free space
+ */
+ void result(KIO::Job *job, KIO::filesize_t size, KIO::filesize_t available);
+
+protected Q_SLOTS:
+ void slotFinished() Q_DECL_OVERRIDE;
+
+public:
+ FileSystemFreeSpaceJob(FileSystemFreeSpaceJobPrivate &dd);
+
+private:
+ Q_DECLARE_PRIVATE(FileSystemFreeSpaceJob)
+};
+
+/**
+ * Get a filesystem's total and available space.
+ *
+ * @param url Url to the filesystem.
+ * @return the job handling the operation.
+ */
+KIOCORE_EXPORT FileSystemFreeSpaceJob *fileSystemFreeSpace(const QUrl &url);
+
+}
+
+#endif /* FILESYSTEMFREESPACEJOB_H */
diff --git a/src/core/slavebase.cpp b/src/core/slavebase.cpp
index 7280996..01844f5 100644
--- a/src/core/slavebase.cpp
+++ b/src/core/slavebase.cpp
@@ -1261,6 +1261,16 @@ void SlaveBase::dispatch(int command, const QByteArray &data)
d->verifyState("multiGet()");
d->m_state = d->Idle;
} break;
+ case CMD_FILESYSTEMFREESPACE: {
+ stream >> url;
+
+ void *data = static_cast<void *>(&url);
+
+ d->m_state = d->InsideMethod;
+ virtual_hook(GetFileSystemFreeSpace, data);
+ d->verifyState("fileSystemFreeSpace()");
+ d->m_state = d->Idle;
+ } break;
default: {
// Some command we don't understand.
// Just ignore it, it may come from some future version of KDE.
@@ -1387,9 +1397,15 @@ void SlaveBase::send(int cmd, const QByteArray &arr)
}
}
-void SlaveBase::virtual_hook(int, void *)
+void SlaveBase::virtual_hook(int id, void *data)
{
- /*BASE::virtual_hook( id, data );*/
+ Q_UNUSED(data);
+
+ switch(id) {
+ case GetFileSystemFreeSpace: {
+ error(ERR_UNSUPPORTED_ACTION, unsupportedActionErrorString(mProtocol, CMD_FILESYSTEMFREESPACE));
+ } break;
+ }
}
void SlaveBase::lookupHost(const QString &host)
diff --git a/src/core/slavebase.h b/src/core/slavebase.h
index 3b7aefa..d1d94de 100644
--- a/src/core/slavebase.h
+++ b/src/core/slavebase.h
@@ -932,7 +932,8 @@ protected:
MetaData mIncomingMetaData;
enum VirtualFunctionId {
- AppConnectionMade = 0
+ AppConnectionMade = 0,
+ GetFileSystemFreeSpace = 1 // KF6 TODO: Turn into a virtual method
};
virtual void virtual_hook(int id, void *data);
diff --git a/src/ioslaves/file/file.cpp b/src/ioslaves/file/file.cpp
index 9eef9eb..1a2a767 100644
--- a/src/ioslaves/file/file.cpp
+++ b/src/ioslaves/file/file.cpp
@@ -33,6 +33,8 @@
#include <QDirIterator>
#include <qplatformdefs.h>
+#include <KDiskFreeSpaceInfo>
+
#include "kioglobal_p.h"
#include <assert.h>
@@ -1298,3 +1300,32 @@ bool FileProtocol::deleteRecursive(const QString &path)
return true;
}
+void FileProtocol::fileSystemFreeSpace(const QUrl &url)
+{
+ if (url.isLocalFile()) {
+ const KDiskFreeSpaceInfo spaceInfo = KDiskFreeSpaceInfo::freeSpaceInfo(url.toLocalFile());
+ if (spaceInfo.isValid()) {
+ setMetaData(QString::fromLatin1("total"), QString::number(spaceInfo.size()));
+ setMetaData(QString::fromLatin1("available"), QString::number(spaceInfo.available()));
+
+ finished();
+ } else {
+ error(KIO::ERR_COULD_NOT_STAT, url.url());
+ }
+ } else {
+ error(KIO::ERR_UNSUPPORTED_PROTOCOL, url.url());
+ }
+}
+
+void FileProtocol::virtual_hook(int id, void *data)
+{
+ switch(id) {
+ case SlaveBase::GetFileSystemFreeSpace: {
+ QUrl *url = static_cast<QUrl *>(data);
+ fileSystemFreeSpace(*url);
+ } break;
+ default: {
+ SlaveBase::virtual_hook(id, data);
+ } break;
+ }
+}
diff --git a/src/ioslaves/file/file.h b/src/ioslaves/file/file.h
index a6e3c3f..d966ac1 100644
--- a/src/ioslaves/file/file.h
+++ b/src/ioslaves/file/file.h
@@ -84,6 +84,9 @@ public:
static bool isExtendedACL(acl_t acl);
#endif
+protected:
+ void virtual_hook(int id, void *data) Q_DECL_OVERRIDE;
+
private:
bool createUDSEntry(const QString &filename, const QByteArray &path, KIO::UDSEntry &entry,
short int details);
@@ -92,6 +95,8 @@ private:
QString getGroupName(KGroupId gid) const;
bool deleteRecursive(const QString &path);
+ void fileSystemFreeSpace(const QUrl &url); // KF6 TODO: Turn into virtual method in SlaveBase
+
private:
mutable QHash<KUserId, QString> mUsercache;
mutable QHash<KGroupId, QString> mGroupcache;
--
2.1.0

View File

@ -1,52 +0,0 @@
From ae87a7d6999fc6ad90ab300dd8ea0c9c68c02bd4 Mon Sep 17 00:00:00 2001
From: Maarten De Meyer <de.meyer.maarten@gmail.com>
Date: Mon, 8 Sep 2014 23:58:55 +0200
Subject: [PATCH 1/2] Fix thumbnails for mimetype groups.
KService::mimeTypes cannot handle mimetype groups. ex: text/*
Go back to KService::serviceTypes and remove 'ThumbCreator' entries.
REVIEW: 119958
---
src/widgets/previewjob.cpp | 17 +++++++++++------
1 file changed, 11 insertions(+), 6 deletions(-)
diff --git a/src/widgets/previewjob.cpp b/src/widgets/previewjob.cpp
index 55a3fb7..ca47934 100644
--- a/src/widgets/previewjob.cpp
+++ b/src/widgets/previewjob.cpp
@@ -268,20 +268,25 @@ void PreviewJobPrivate::startPreview()
protocols.append(p);
}
foreach (const QString &protocol, protocols) {
- const QStringList mtypes = (*it)->mimeTypes();
+ // We cannot use mimeTypes() here, it doesn't support groups such as: text/*
+ const QStringList mtypes = (*it)->serviceTypes();
// Add supported mimetype for this protocol
QStringList &_ms = m_remoteProtocolPlugins[protocol];
foreach (const QString &_m, mtypes) {
- protocolMap[protocol].insert(_m, *it);
- if (!_ms.contains(_m)) {
- _ms.append(_m);
+ if (_m != QLatin1String("ThumbCreator")) {
+ protocolMap[protocol].insert(_m, *it);
+ if (!_ms.contains(_m)) {
+ _ms.append(_m);
+ }
}
}
}
if (enabledPlugins.contains((*it)->desktopEntryName())) {
- const QStringList mimeTypes = (*it)->mimeTypes();
+ const QStringList mimeTypes = (*it)->serviceTypes();
for (QStringList::ConstIterator mt = mimeTypes.constBegin(); mt != mimeTypes.constEnd(); ++mt) {
- mimeMap.insert(*mt, *it);
+ if (*mt != QLatin1String("ThumbCreator")) {
+ mimeMap.insert(*mt, *it);
+ }
}
}
}
--
2.1.0

View File

@ -1,77 +0,0 @@
From 5a5aa4b1786e793f457ad5a88a4e49d7469a92fa Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Luk=C3=A1=C5=A1=20Tinkl?= <lukas@kde.org>
Date: Tue, 9 Sep 2014 22:49:27 +0200
Subject: [PATCH 2/2] Fix relative paths being turned into http urls by
fromUserInput.
Reviewed-By: (well, written by) David Faure.
---
src/filewidgets/kfilewidget.cpp | 24 ++++++++++++++++++++----
1 file changed, 20 insertions(+), 4 deletions(-)
diff --git a/src/filewidgets/kfilewidget.cpp b/src/filewidgets/kfilewidget.cpp
index 42320e3..58dd92e 100644
--- a/src/filewidgets/kfilewidget.cpp
+++ b/src/filewidgets/kfilewidget.cpp
@@ -325,6 +325,22 @@ static bool containsProtocolSection(const QString &string)
return false;
}
+// this string-to-url conversion function handles relative paths, full paths and URLs
+// without the http-prepending that QUrl::fromUserInput does.
+static QUrl urlFromString(const QString& str)
+{
+ if (QDir::isAbsolutePath(str)) {
+ return QUrl::fromLocalFile(str);
+ }
+ QUrl url(str);
+ if (url.isRelative()) {
+ url.clear();
+ url.setPath(str);
+ }
+ return url;
+}
+
+
KFileWidget::KFileWidget(const QUrl &_startDir, QWidget *parent)
: QWidget(parent), d(new KFileWidgetPrivate(this))
{
@@ -909,7 +925,7 @@ void KFileWidget::slotOk()
containsProtocolSection(locationEditCurrentText))) {
QString fileName;
- QUrl url = QUrl::fromUserInput(locationEditCurrentText);
+ QUrl url = urlFromString(locationEditCurrentText);
if (d->operationMode == Opening) {
KIO::StatJob *statJob = KIO::stat(url, KIO::HideProgressInfo);
KJobWidgets::setWindow(statJob, this);
@@ -1447,7 +1463,7 @@ void KFileWidgetPrivate::_k_urlEntered(const QUrl &url)
bool blocked = locationEdit->blockSignals(true);
if (keepLocation) {
- QUrl currentUrl = QUrl::fromUserInput(filename);
+ QUrl currentUrl = urlFromString(filename);
locationEdit->changeUrl(0, QIcon::fromTheme(KIO::iconNameForUrl(currentUrl)), currentUrl);
locationEdit->lineEdit()->setModified(true);
}
@@ -1494,7 +1510,7 @@ void KFileWidgetPrivate::_k_enterUrl(const QString &url)
{
// qDebug();
- _k_enterUrl(QUrl::fromUserInput(KUrlCompletion::replacedPath(url, true, true)));
+ _k_enterUrl(urlFromString(KUrlCompletion::replacedPath(url, true, true)));
}
bool KFileWidgetPrivate::toOverwrite(const QUrl &url)
@@ -1677,7 +1693,7 @@ QList<QUrl> KFileWidgetPrivate::tokenize(const QString &line) const
urls.append(u);
}
} else {
- urls << QUrl::fromUserInput(line);
+ urls << QUrl::fromLocalFile(line);
}
return urls;
--
2.1.0

View File

@ -1,3 +0,0 @@
version https://git-lfs.github.com/spec/v1
oid sha256:f7be3026dbf32efb6245ca4443cec2c0be52e0b303e396cbb70c2e09834046db
size 2253536

3
kio-5.3.0.tar.xz Normal file
View File

@ -0,0 +1,3 @@
version https://git-lfs.github.com/spec/v1
oid sha256:073c2249281cc40f463de043fedf2da333dbc8c4a6d5f4a153cf3d3008d4f097
size 2306760

View File

@ -1,3 +1,22 @@
-------------------------------------------------------------------
Sat Oct 4 17:59:52 UTC 2014 - hrvoje.senjan@gmail.com
- Update to 5.3.0
* Now includes kio_trash
* Add new KIO job, KIO::fileSystemFreeSpace, that allows you to
get a filesystem's total and available space.
* kshorturifilter: Remove redundant forward slashes from
the beginning of an URI
* Add searchprovider definitions for the qwant search engine
* File dialog: fix relative paths being turned into HTTP URLs
* Fix thumbnails for mimetype groups.
* For more details please see:
https://www.kde.org/announcements/kde-frameworks-5.3.0.php
- Drop patches merged upstream:
0001-Add-new-KIO-job-KIO-fileSystemFreeSpace-that-allows-.patch,
0001-Fix-thumbnails-for-mimetype-groups.patch and
0002-Fix-relative-paths-being-turned-into-http-urls-by-fr.patch
------------------------------------------------------------------- -------------------------------------------------------------------
Fri Sep 26 01:00:06 UTC 2014 - hrvoje.senjan@gmail.com Fri Sep 26 01:00:06 UTC 2014 - hrvoje.senjan@gmail.com

View File

@ -17,11 +17,11 @@
Name: kio Name: kio
Version: 5.2.0 Version: 5.3.0
Release: 0 Release: 0
%define kf5_version %{version} %define kf5_version %{version}
BuildRequires: cmake >= 2.8.12 BuildRequires: cmake >= 2.8.12
BuildRequires: extra-cmake-modules >= 1.2.0 BuildRequires: extra-cmake-modules >= 1.3.0
BuildRequires: fdupes BuildRequires: fdupes
BuildRequires: karchive-devel >= %{kf5_version} BuildRequires: karchive-devel >= %{kf5_version}
BuildRequires: kbookmarks-devel >= %{kf5_version} BuildRequires: kbookmarks-devel >= %{kf5_version}
@ -66,12 +66,6 @@ Group: System/GUI/KDE
Url: http://www.kde.org Url: http://www.kde.org
Source: http://download.kde.org/stable/frameworks/%{version}/%{name}-%{version}.tar.xz Source: http://download.kde.org/stable/frameworks/%{version}/%{name}-%{version}.tar.xz
Source1: baselibs.conf Source1: baselibs.conf
# PATCH-FIX-UPSTREAM 0001-Fix-thumbnails-for-mimetype-groups.patch -- https://git.reviewboard.kde.org/r/119958/
Patch0: 0001-Fix-thumbnails-for-mimetype-groups.patch
# PATCH-FIX-UPSTREAM 0002-Fix-relative-paths-being-turned-into-http-urls-by-fr.patch
Patch1: 0002-Fix-relative-paths-being-turned-into-http-urls-by-fr.patch
# PATCH-FIX-UPSTREAM 0001-Add-new-KIO-job-KIO-fileSystemFreeSpace-that-allows-.patch
Patch2: 0001-Add-new-KIO-job-KIO-fileSystemFreeSpace-that-allows-.patch
BuildRoot: %{_tmppath}/%{name}-%{version}-build BuildRoot: %{_tmppath}/%{name}-%{version}-build
%description %description
@ -101,9 +95,6 @@ Development files.
%lang_package %lang_package
%prep %prep
%setup -q %setup -q
%patch0 -p1
%patch1 -p1
%patch2 -p1
%build %build
%cmake_kf5 -d build %cmake_kf5 -d build
@ -113,7 +104,8 @@ Development files.
%kf5_makeinstall -C build %kf5_makeinstall -C build
%fdupes -s %{buildroot} %fdupes -s %{buildroot}
%find_lang %{name}5 %find_lang %{name}5 %{name}5.lang
%find_lang kcm_webshortcuts %{name}5.lang
%post -p /sbin/ldconfig %post -p /sbin/ldconfig
@ -124,6 +116,7 @@ Development files.
%files %files
%defattr(-,root,root) %defattr(-,root,root)
%doc COPYING* README* %doc COPYING* README*
%{_kf5_bindir}/ktrash5
%{_kf5_bindir}/ktelnetservice5 %{_kf5_bindir}/ktelnetservice5
%{_kf5_bindir}/kmailservice5 %{_kf5_bindir}/kmailservice5
%{_kf5_libdir}/libKF5KIOCore.so.* %{_kf5_libdir}/libKF5KIOCore.so.*