Accepting request 576540 from KDE:Frameworks5

KDE Frameworks 5.43.0

OBS-URL: https://build.opensuse.org/request/show/576540
OBS-URL: https://build.opensuse.org/package/show/openSUSE:Factory/kio?expand=0&rev=60
This commit is contained in:
Dominique Leuenberger 2018-02-16 20:31:49 +00:00 committed by Git OBS Bridge
commit 212212b9e9
8 changed files with 213 additions and 197 deletions

View File

@ -0,0 +1,125 @@
From 8d73867b3d4339ec026f92c4c2e89c265249aeb2 Mon Sep 17 00:00:00 2001
From: Jaime Torres <jtamate@gmail.com>
Date: Wed, 7 Feb 2018 19:02:16 +0100
Subject: Don't stat(/etc/localtime) between read() and write() copying files
Summary:
CCBUG: 384561
Unfortunately, QDateTime::currentDateTime() checks /etc/localtime
each time it is called.
Chaning to QElapsedTime, no check of /etc/localtime.
Reproducing bug 384561, the strace of file.so was something like:
read(), stat(/etc/localtime), stat(/etc/localtime),
stat(/etc/localtime), stat(/etc/localtime), stat(/etc/localtime),
write(), read() ......
Now it is: read(), write()
It also reduces the cpu in io/wait around 10% in a debug build.
Test Plan:
kio tests work as before
desktop: works in dolphin
Reviewers: #frameworks, fvogt, dfaure
Reviewed By: dfaure
Subscribers: fvogt, ngraham
Tags: #frameworks
Differential Revision: https://phabricator.kde.org/D9983
---
src/core/slavebase.cpp | 27 ++++++++++++++-------------
1 file changed, 14 insertions(+), 13 deletions(-)
diff --git a/src/core/slavebase.cpp b/src/core/slavebase.cpp
index 4f8a5da..5e8effb 100644
--- a/src/core/slavebase.cpp
+++ b/src/core/slavebase.cpp
@@ -80,7 +80,7 @@ class SlaveBasePrivate
{
public:
SlaveBase *q;
- SlaveBasePrivate(SlaveBase *owner): q(owner), m_passwdServerClient(nullptr)
+ SlaveBasePrivate(SlaveBase *owner): q(owner), nextTimeoutMsecs(0), m_passwdServerClient(nullptr)
{
if (!qEnvironmentVariableIsEmpty("KIOSLAVE_ENABLE_TESTMODE")) {
QStandardPaths::enableTestMode(true);
@@ -110,8 +110,9 @@ public:
KConfigGroup *configGroup;
QUrl onHoldUrl;
- QDateTime lastTimeout;
- QDateTime nextTimeout;
+ QElapsedTimer lastTimeout;
+ QElapsedTimer nextTimeout;
+ qint64 nextTimeoutMsecs;
KIO::filesize_t totalSize;
KRemoteEncoding *remotefile;
enum { Idle, InsideMethod, FinishedCalled, ErrorCalled } m_state;
@@ -273,9 +274,9 @@ SlaveBase::~SlaveBase()
void SlaveBase::dispatchLoop()
{
while (!d->exit_loop) {
- if (d->nextTimeout.isValid() && (d->nextTimeout < QDateTime::currentDateTime())) {
+ if (d->nextTimeout.isValid() && (d->nextTimeout.hasExpired(d->nextTimeoutMsecs))) {
QByteArray data = d->timeoutData;
- d->nextTimeout = QDateTime();
+ d->nextTimeout.invalidate();
d->timeoutData = QByteArray();
special(data);
}
@@ -284,7 +285,7 @@ void SlaveBase::dispatchLoop()
int ms = -1;
if (d->nextTimeout.isValid()) {
- ms = qMax<int>(QDateTime::currentDateTime().msecsTo(d->nextTimeout), 1);
+ ms = qMax<int>(d->nextTimeout.elapsed() - d->nextTimeoutMsecs, 1);
}
int ret = -1;
@@ -529,13 +530,11 @@ void SlaveBase::processedSize(KIO::filesize_t _bytes)
{
bool emitSignal = false;
- QDateTime now = QDateTime::currentDateTime();
-
if (_bytes == d->totalSize) {
emitSignal = true;
} else {
if (d->lastTimeout.isValid()) {
- emitSignal = d->lastTimeout.msecsTo(now) >= 100; // emit size 10 times a second
+ emitSignal = d->lastTimeout.hasExpired(100); // emit size 10 times a second
} else {
emitSignal = true;
}
@@ -544,7 +543,7 @@ void SlaveBase::processedSize(KIO::filesize_t _bytes)
if (emitSignal) {
KIO_DATA << KIO_FILESIZE_T(_bytes);
send(INF_PROCESSED_SIZE, data);
- d->lastTimeout = now;
+ d->lastTimeout.start();
}
// d->processed_size = _bytes;
@@ -1046,11 +1045,13 @@ int SlaveBase::readData(QByteArray &buffer)
void SlaveBase::setTimeoutSpecialCommand(int timeout, const QByteArray &data)
{
if (timeout > 0) {
- d->nextTimeout = QDateTime::currentDateTime().addSecs(timeout);
+ d->nextTimeoutMsecs = timeout*1000; // from seconds to miliseconds
+ d->nextTimeout.start();
} else if (timeout == 0) {
- d->nextTimeout = QDateTime::currentDateTime().addSecs(1); // Immediate timeout
+ d->nextTimeoutMsecs = 1000; // Immediate timeout
+ d->nextTimeout.start();
} else {
- d->nextTimeout = QDateTime(); // Canceled
+ d->nextTimeout.invalidate(); // Canceled
}
d->timeoutData = data;
--
cgit v0.11.2

View File

@ -1,64 +0,0 @@
From fe2ce8fd25ceeb65e5889084e068de93c783ef62 Mon Sep 17 00:00:00 2001
From: Fabian Vogt <fabian@ritter-vogt.de>
Date: Thu, 11 Jan 2018 22:07:45 +0100
Subject: [PATCH] Fix KFilePreviewGenerator::LayoutBlocker
Summary:
QAbstractItemViews does layout in a timer event handler, to avoid unnecessary
layout calculations. Changes which cause a relayout only start the timer.
LayoutBlocker has the restriction that it only works if the event loop is not
entered during its lifetime. Without an event loop there's no expensive
relayout anyway, making the LayoutBlocker pointless in such cases.
LayoutBlocker works by changing the uniformItemSizes property of the QListView
to true and in the destructor back to the original value again. Those changes
do not trigger a relayout in QListView, so if the QListView did a layout with
uniformItemSizes set to true, it stays that way.
Fix it by triggering a relayout in ~LayoutBlocker.
This got exposed by a change in Qt, which results in QListView doing a relayout
while the LayoutBlocker is active.
BUG: 352776
Test Plan: kfilewidgettest_gui has proper item sizes now.
Reviewers: #frameworks, dfaure
Tags: #frameworks
Differential Revision: https://phabricator.kde.org/D9830
---
src/filewidgets/kfilepreviewgenerator.cpp | 10 ++++++----
1 file changed, 6 insertions(+), 4 deletions(-)
diff --git a/src/filewidgets/kfilepreviewgenerator.cpp b/src/filewidgets/kfilepreviewgenerator.cpp
index 7965ab84..15b8ab84 100644
--- a/src/filewidgets/kfilepreviewgenerator.cpp
+++ b/src/filewidgets/kfilepreviewgenerator.cpp
@@ -70,10 +70,7 @@
*
* QListView does not invoke QItemDelegate::sizeHint() when the
* uniformItemSize property has been set to true, so this property is
- * set before exchanging a block of icons. It is important to reset
- * it again before the event loop is entered, otherwise QListView
- * would not get the correct size hints after dispatching the layoutChanged()
- * signal.
+ * set before exchanging a block of icons.
*/
class KFilePreviewGenerator::LayoutBlocker
{
@@ -92,6 +89,11 @@ public:
{
if (m_view != nullptr) {
m_view->setUniformItemSizes(m_uniformSizes);
+ /* The QListView did the layout with uniform item
+ * sizes, so trigger a relayout with the expected sizes. */
+ if (!m_uniformSizes) {
+ m_view->setGridSize(m_view->gridSize());
+ }
}
}
--
2.15.1

View File

@ -0,0 +1,54 @@
From 0f8c2d7922ca130971ac3a83ed86d8e552171389 Mon Sep 17 00:00:00 2001
From: Igor Janssen <alaves17@gmail.com>
Date: Sat, 10 Feb 2018 09:48:52 -0700
Subject: Fix bug #382437 "Regression in kdialog causes wrong file extension"
Summary:
BUG: 382437
One cause of the bug is commit at plasma-integration:
0dafb9403266d6064074250d44b74dc0db946cfb
//Make sure we always set a default mime filter in save mode
KFileWidget::setMimeFilter() documentation says a default mime filter
should be set if the dialog is being open in save mode.
Without a default filter, the dialog uses a custom item (created by
concatenating all the mime type filters) as default. This is not useful
because it means an additional click for the user to select a filter that can
actually be useful.
If the initiallySelectedMimeTypeFilter() is empty, we use the first mime
filter as fallback.//
Chrome opens kdialog with 2 mime types: application/octet-stream (means any file) and (for example) image/jpeg. But application/octet-stream is associated with *.bin extension. When you choose this mime extention becomes *.bin. That commit does this mime default (it's first).
This patch blocks changing extention to bin for "application/octet-stream" selected.
Test Plan: Tested with Google Chrome. Used Open/Save dialogs for files.
Reviewers: #plasma, dfaure
Reviewed By: dfaure
Subscribers: ngraham, aacid, broulik, plasma-devel, #frameworks
Tags: #frameworks, #plasma
Differential Revision: https://phabricator.kde.org/D10114
---
src/filewidgets/kfilewidget.cpp | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)
diff --git a/src/filewidgets/kfilewidget.cpp b/src/filewidgets/kfilewidget.cpp
index aeb8dea..39c09b8 100644
--- a/src/filewidgets/kfilewidget.cpp
+++ b/src/filewidgets/kfilewidget.cpp
@@ -2258,7 +2258,8 @@ void KFileWidgetPrivate::updateAutoSelectExtension()
}
}
- if (!currentExtension.isEmpty() && extensionList.contains(QLatin1String("*.") + currentExtension)) {
+ if ((!currentExtension.isEmpty() && extensionList.contains(QLatin1String("*.") + currentExtension))
+ || filter == QStringLiteral("application/octet-stream")) {
extension = QLatin1Char('.') + currentExtension;
} else {
extension = defaultExtension;
--
cgit v0.11.2

View File

@ -1,126 +0,0 @@
From bd5b09c1d126158b4ce155ef5106234b9e8068d4 Mon Sep 17 00:00:00 2001
From: Fabian Vogt <fabian@ritter-vogt.de>
Date: Sat, 13 Jan 2018 18:46:50 +0100
Subject: [PATCH] Fix overlap of the first item in KFilePlacesView
Summary:
The first item overlapped both the section header and the item
below. This was caused by taking the spacing wrongly into account.
Additionally, the paint function's option's rect was not moved correctly,
as the unmodified option.rect was used in some places.
Test Plan: https://i.imgur.com/LJuACt2.png -> https://i.imgur.com/nYpdoXn.png
Reviewers: #frameworks, dfaure, renatoo
Tags: #frameworks
Differential Revision: https://phabricator.kde.org/D9863
---
src/filewidgets/kfileplacesview.cpp | 45 +++++++++++++++++++------------------
1 file changed, 23 insertions(+), 22 deletions(-)
Index: kio-5.42.0/src/filewidgets/kfileplacesview.cpp
===================================================================
--- kio-5.42.0.orig/src/filewidgets/kfileplacesview.cpp
+++ kio-5.42.0/src/filewidgets/kfileplacesview.cpp
@@ -170,10 +170,9 @@ void KFilePlacesViewDelegate::paint(QPai
drawSectionHeader(painter, opt, index);
}
+ // Move the target rect to the actual item rect
const int headerHeight = sectionHeaderHeight();
- const int headerSpace = (headerHeight / 2) + qMax(2, m_view->spacing());
- painter->translate(0, headerSpace);
- opt.rect.translate(0, headerSpace);
+ opt.rect.translate(0, headerHeight);
opt.rect.setHeight(opt.rect.height() - headerHeight);
}
@@ -193,22 +192,22 @@ void KFilePlacesViewDelegate::paint(QPai
QApplication::style()->drawPrimitive(QStyle::PE_PanelItemViewItem, &opt, painter);
const KFilePlacesModel *placesModel = static_cast<const KFilePlacesModel *>(index.model());
- bool isLTR = option.direction == Qt::LeftToRight;
+ bool isLTR = opt.direction == Qt::LeftToRight;
QIcon icon = index.model()->data(index, Qt::DecorationRole).value<QIcon>();
- QPixmap pm = icon.pixmap(m_iconSize, m_iconSize, (option.state & QStyle::State_Selected) && (option.state & QStyle::State_Active) ? QIcon::Selected : QIcon::Normal);
- QPoint point(isLTR ? option.rect.left() + LATERAL_MARGIN
- : option.rect.right() - LATERAL_MARGIN - m_iconSize, option.rect.top() + (option.rect.height() - m_iconSize) / 2);
+ QPixmap pm = icon.pixmap(m_iconSize, m_iconSize, (opt.state & QStyle::State_Selected) && (opt.state & QStyle::State_Active) ? QIcon::Selected : QIcon::Normal);
+ QPoint point(isLTR ? opt.rect.left() + LATERAL_MARGIN
+ : opt.rect.right() - LATERAL_MARGIN - m_iconSize, opt.rect.top() + (opt.rect.height() - m_iconSize) / 2);
painter->drawPixmap(point, pm);
- if (option.state & QStyle::State_Selected) {
+ if (opt.state & QStyle::State_Selected) {
QPalette::ColorGroup cg = QPalette::Active;
- if (!(option.state & QStyle::State_Enabled)) {
+ if (!(opt.state & QStyle::State_Enabled)) {
cg = QPalette::Disabled;
- } else if (!(option.state & QStyle::State_Active)) {
+ } else if (!(opt.state & QStyle::State_Active)) {
cg = QPalette::Inactive;
}
- painter->setPen(option.palette.color(cg, QPalette::HighlightedText));
+ painter->setPen(opt.palette.color(cg, QPalette::HighlightedText));
}
QRect rectText;
@@ -225,10 +224,10 @@ void KFilePlacesViewDelegate::paint(QPai
painter->save();
painter->setOpacity(painter->opacity() * contentsOpacity(index));
- int height = option.fontMetrics.height() + CAPACITYBAR_HEIGHT;
- rectText = QRect(isLTR ? m_iconSize + LATERAL_MARGIN * 2 + option.rect.left()
- : 0, option.rect.top() + (option.rect.height() / 2 - height / 2), option.rect.width() - m_iconSize - LATERAL_MARGIN * 2, option.fontMetrics.height());
- painter->drawText(rectText, Qt::AlignLeft | Qt::AlignTop, option.fontMetrics.elidedText(index.model()->data(index).toString(), Qt::ElideRight, rectText.width()));
+ int height = opt.fontMetrics.height() + CAPACITYBAR_HEIGHT;
+ rectText = QRect(isLTR ? m_iconSize + LATERAL_MARGIN * 2 + opt.rect.left()
+ : 0, opt.rect.top() + (opt.rect.height() / 2 - height / 2), opt.rect.width() - m_iconSize - LATERAL_MARGIN * 2, opt.fontMetrics.height());
+ painter->drawText(rectText, Qt::AlignLeft | Qt::AlignTop, opt.fontMetrics.elidedText(index.model()->data(index).toString(), Qt::ElideRight, rectText.width()));
QRect capacityRect(isLTR ? rectText.x() : LATERAL_MARGIN, rectText.bottom() - 1, rectText.width() - LATERAL_MARGIN, CAPACITYBAR_HEIGHT);
KCapacityBar capacityBar(KCapacityBar::DrawTextInline);
capacityBar.setValue((info.used() * 100) / info.size());
@@ -241,9 +240,9 @@ void KFilePlacesViewDelegate::paint(QPai
}
}
- rectText = QRect(isLTR ? m_iconSize + LATERAL_MARGIN * 2 + option.rect.left()
- : 0, option.rect.top(), option.rect.width() - m_iconSize - LATERAL_MARGIN * 2, option.rect.height());
- painter->drawText(rectText, Qt::AlignLeft | Qt::AlignVCenter, option.fontMetrics.elidedText(index.model()->data(index).toString(), Qt::ElideRight, rectText.width()));
+ rectText = QRect(isLTR ? m_iconSize + LATERAL_MARGIN * 2 + opt.rect.left()
+ : 0, opt.rect.top(), opt.rect.width() - m_iconSize - LATERAL_MARGIN * 2, opt.rect.height());
+ painter->drawText(rectText, Qt::AlignLeft | Qt::AlignVCenter, opt.fontMetrics.elidedText(index.model()->data(index).toString(), Qt::ElideRight, rectText.width()));
if (drawCapacityBar && contentsOpacity(index) > 0) {
painter->restore();
@@ -434,12 +433,14 @@ void KFilePlacesViewDelegate::drawSectio
QRect textRect(option.rect);
textRect.setLeft(textRect.left() + 3);
- textRect.setY(textRect.y() + qMax(2, m_view->spacing()));
+ /* Take spacing into account:
+ The spacing to the previous section compensates for the spacing to the first item.*/
+ textRect.setY(textRect.y() /* + qMax(2, m_view->spacing()) - qMax(2, m_view->spacing())*/);
textRect.setHeight(sectionHeaderHeight());
painter->save();
- // based on dolphoin colors
+ // based on dolphin colors
const QColor c1 = textColor(option);
const QColor c2 = baseColor(option);
QColor penColor = mixedColor(c1, c2, 60);
@@ -473,8 +474,8 @@ QColor KFilePlacesViewDelegate::mixedCol
int KFilePlacesViewDelegate::sectionHeaderHeight() const
{
- return QApplication::fontMetrics().height() +
- (qMax(2, m_view->spacing()) * 2);
+ // Account for the spacing between header and item
+ return QApplication::fontMetrics().height() + qMax(2, m_view->spacing());
}

View File

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

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

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

View File

@ -1,3 +1,26 @@
-------------------------------------------------------------------
Tue Feb 13 16:52:12 UTC 2018 - alarrosa@suse.com
- Add patch to fix a problem that made kio copy files too slowly (kde#384561)
* 0001-Dont-stat-etc-localtime-between-read-and-write.patch
- Add patch to fix kdialog writing files with .bin extension in chrome
when downloading files (kde#382437)
* 0001-Fix-bug-382437-Regression-in-kdialog-causes-wrong-file-ext.patch
-------------------------------------------------------------------
Mon Feb 12 23:42:09 CET 2018 - lbeltrame@kde.org
- Update to 5.43.0
* New feature release
* For more details please see:
* https://www.kde.org/announcements/kde-frameworks-5.43.0.php
- Changes since 5.42.0:
* Too many changes to list here
- Dropped patches, now upstream:
* 0001-Fix-KFilePreviewGenerator-LayoutBlocker.patch
* fix-overlap-of-first-item-in-kfileplacesview.patch
-------------------------------------------------------------------
Tue Jan 16 22:50:18 CET 2018 - lbeltrame@kde.org

View File

@ -17,9 +17,9 @@
%bcond_without lang
%define _tar_path 5.42
%define _tar_path 5.43
Name: kio
Version: 5.42.0
Version: 5.43.0
Release: 0
%define kf5_version %{version}
# Full KF5 version (e.g. 5.33.0)
@ -35,9 +35,9 @@ Source1: baselibs.conf
# PATCH-FIX-OPENSUSE kio_help-fallback-to-kde4-docs.patch -- allow kio_help to see into kde4 documentation, needed especially for khelpcenter5
Patch0: kio_help-fallback-to-kde4-docs.patch
# PATCH-FIX-UPSTREAM
Patch1: 0001-Fix-KFilePreviewGenerator-LayoutBlocker.patch
Patch1: 0001-Dont-stat-etc-localtime-between-read-and-write.patch
# PATCH-FIX-UPSTREAM
Patch2: fix-overlap-of-first-item-in-kfileplacesview.patch
Patch2: 0001-Fix-bug-382437-Regression-in-kdialog-causes-wrong-file-ext.patch
BuildRequires: cmake >= 3.0
BuildRequires: extra-cmake-modules >= %{_kf5_bugfix_version}
BuildRequires: fdupes
@ -138,6 +138,10 @@ Development files.
%install
%kf5_makeinstall -C build
%fdupes %{buildroot}
rm %{buildroot}%{_kf5_sysconfdir}/dbus-1/system.d/org.kde.kio.file.conf
rm %{buildroot}%{_kf5_libdir}/libexec/kauth/file_helper
rm %{buildroot}%{_kf5_sharedir}/dbus-1/system-services/org.kde.kio.file.service
rm %{buildroot}%{_kf5_sharedir}/polkit-1/actions/org.kde.kio.file.policy
%if %{with lang}
%find_lang %{name} --with-man --all-name