From 5219aa465d7ab3a3c92731e4817885ac4d084128 Mon Sep 17 00:00:00 2001 From: Rmys Date: Thu, 15 Jul 2021 13:11:36 +0300 Subject: [PATCH] kio rebuild --- ...1-Fix-thumbnails-for-mimetype-groups.patch | 52 ----- ...hs-being-turned-into-http-urls-by-fr.patch | 77 -------- desktop/kde/framework/kio/files/352776.patch | 66 ------- .../kde/framework/kio/files/8ad69215.patch | 53 +++++ .../kio/files/kpropertiesdialog.patch | 187 ------------------ desktop/kde/framework/kio/pspec.xml | 2 +- 6 files changed, 54 insertions(+), 383 deletions(-) delete mode 100755 desktop/kde/framework/kio/files/0001-Fix-thumbnails-for-mimetype-groups.patch delete mode 100755 desktop/kde/framework/kio/files/0002-Fix-relative-paths-being-turned-into-http-urls-by-fr.patch delete mode 100755 desktop/kde/framework/kio/files/352776.patch create mode 100644 desktop/kde/framework/kio/files/8ad69215.patch delete mode 100644 desktop/kde/framework/kio/files/kpropertiesdialog.patch diff --git a/desktop/kde/framework/kio/files/0001-Fix-thumbnails-for-mimetype-groups.patch b/desktop/kde/framework/kio/files/0001-Fix-thumbnails-for-mimetype-groups.patch deleted file mode 100755 index 5dc3083626..0000000000 --- a/desktop/kde/framework/kio/files/0001-Fix-thumbnails-for-mimetype-groups.patch +++ /dev/null @@ -1,52 +0,0 @@ -From ae87a7d6999fc6ad90ab300dd8ea0c9c68c02bd4 Mon Sep 17 00:00:00 2001 -From: Maarten De Meyer -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 - diff --git a/desktop/kde/framework/kio/files/0002-Fix-relative-paths-being-turned-into-http-urls-by-fr.patch b/desktop/kde/framework/kio/files/0002-Fix-relative-paths-being-turned-into-http-urls-by-fr.patch deleted file mode 100755 index a959d5d3e8..0000000000 --- a/desktop/kde/framework/kio/files/0002-Fix-relative-paths-being-turned-into-http-urls-by-fr.patch +++ /dev/null @@ -1,77 +0,0 @@ -From 5a5aa4b1786e793f457ad5a88a4e49d7469a92fa Mon Sep 17 00:00:00 2001 -From: =?UTF-8?q?Luk=C3=A1=C5=A1=20Tinkl?= -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 KFileWidgetPrivate::tokenize(const QString &line) const - urls.append(u); - } - } else { -- urls << QUrl::fromUserInput(line); -+ urls << QUrl::fromLocalFile(line); - } - - return urls; --- -2.1.0 - diff --git a/desktop/kde/framework/kio/files/352776.patch b/desktop/kde/framework/kio/files/352776.patch deleted file mode 100755 index aa8db35ef9..0000000000 --- a/desktop/kde/framework/kio/files/352776.patch +++ /dev/null @@ -1,66 +0,0 @@ -From 248941a0f4b4792b6935546da1c1e6bdda61846e Mon Sep 17 00:00:00 2001 -From: Fabian Vogt -Date: Thu, 11 Jan 2018 22:07:45 +0100 -Subject: 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 - -Reviewed By: 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 7965ab8..15b8ab8 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()); -+ } - } - } - --- -cgit v0.11.2 - diff --git a/desktop/kde/framework/kio/files/8ad69215.patch b/desktop/kde/framework/kio/files/8ad69215.patch new file mode 100644 index 0000000000..cdccada57d --- /dev/null +++ b/desktop/kde/framework/kio/files/8ad69215.patch @@ -0,0 +1,53 @@ +From 8ad6921524c92a0cf1b58336b3ce29e159e83b7d Mon Sep 17 00:00:00 2001 +From: David Edmundson +Date: Wed, 14 Jul 2021 17:06:59 +0100 +Subject: [PATCH] Fix selecting binaries from component chooser KCM + +In the kcmshell for a component chooser we use the open with dialog to +select services for various scheme handlers. + +If you select a binary instead of a .desktop file a temporary .desktop +file is created in ~/.local/share/applications + +This is in the format +Exec=someBinary +MimeType=x-scheme-handler/http + +When we then use this application for launching KIO::DesktopExecParser +then (sort of correctly) determines that that the chosen service cannot +handle the http scheme because even though it is a scheme handler it +does not have a "%u" in the exec line. + +This leads to us potentially loading websites via kioclient or kio-fuse. + +Testing done: + - kcmshell5 component chooser + - web browser -> other -> type "/usr/bin/firefox" + - kde-open5 http://kde.org + - Previously this gave a local URL, now it is correct +--- + src/widgets/kopenwithdialog.cpp | 8 ++++++++ + 1 file changed, 8 insertions(+) + +diff --git a/src/widgets/kopenwithdialog.cpp b/src/widgets/kopenwithdialog.cpp +index 1831878ca..31295044d 100644 +--- a/src/widgets/kopenwithdialog.cpp ++++ b/src/widgets/kopenwithdialog.cpp +@@ -1088,6 +1088,14 @@ bool KOpenWithDialogPrivate::checkAccept() + KConfigGroup cg = desktopFile.desktopGroup(); + cg.writeEntry("Type", "Application"); + cg.writeEntry("Name", initialServiceName); ++ ++ // if we select a binary for a scheme handler, then it's safe to assume it can handle URLs ++ if (qMimeType.startsWith(QLatin1String("x-scheme-handler/"))) { ++ if (!typedExec.contains(QLatin1String("%u"), Qt::CaseInsensitive) && !typedExec.contains(QLatin1String("%f"), Qt::CaseInsensitive)) { ++ fullExec += QStringLiteral(" %u"); ++ } ++ } ++ + cg.writeEntry("Exec", fullExec); + cg.writeEntry("NoDisplay", true); // don't make it appear in the K menu + if (terminal->isChecked()) { +-- +GitLab + diff --git a/desktop/kde/framework/kio/files/kpropertiesdialog.patch b/desktop/kde/framework/kio/files/kpropertiesdialog.patch deleted file mode 100644 index 94f6dadb9e..0000000000 --- a/desktop/kde/framework/kio/files/kpropertiesdialog.patch +++ /dev/null @@ -1,187 +0,0 @@ -diff -Nuar a/src/widgets/kpropertiesdialog.cpp b/src/widgets/kpropertiesdialog.cpp ---- a/src/widgets/kpropertiesdialog.cpp 2018-11-03 21:02:08.000000000 +0300 -+++ b/src/widgets/kpropertiesdialog.cpp 2018-08-04 14:23:09.000000000 +0300 -@@ -80,6 +80,7 @@ - #include - #include - #include -+#include - - #if HAVE_POSIX_ACL - extern "C" { -@@ -774,10 +775,9 @@ - QString mimeType; - QString oldFileName; - KLineEdit *m_lined; -- QLabel *m_fileNameLabel = nullptr; -- QGridLayout *m_grid = nullptr; - - QWidget *iconArea; -+ QWidget *nameArea; - - QLabel *m_sizeLabel; - QPushButton *m_sizeDetermineButton; -@@ -849,7 +849,6 @@ - vbl->setMargin(0); - vbl->setObjectName(QStringLiteral("vbl")); - QGridLayout *grid = new QGridLayout(); // unknown rows -- d->m_grid = grid; - grid->setColumnStretch(0, 0); - grid->setColumnStretch(1, 0); - grid->setColumnStretch(2, 1); -@@ -980,24 +979,30 @@ - iconLabel->setAlignment(Qt::AlignCenter); - int bsize = 66 + 2 * iconLabel->style()->pixelMetric(QStyle::PM_ButtonMargin); - iconLabel->setFixedSize(bsize, bsize); -- iconLabel->setPixmap(QIcon::fromTheme(iconStr).pixmap(48)); -+ iconLabel->setPixmap(KIconLoader::global()->loadIcon(iconStr, KIconLoader::Desktop, 48)); - d->iconArea = iconLabel; - } - grid->addWidget(d->iconArea, curRow, 0, Qt::AlignCenter); - -- KFileItemListProperties itemList(KFileItemList() << item); -- if (d->bMultiple || isTrash || hasRoot || !(d->m_bFromTemplate || itemList.supportsMoving())) { -- setFileNameReadOnly(true); -+ if (d->bMultiple || isTrash || hasRoot) { -+ QLabel *lab = new QLabel(d->m_frame); - if (d->bMultiple) { -- d->m_fileNameLabel->setText(KIO::itemsSummaryString(iFileCount + iDirCount, iFileCount, iDirCount, 0, false)); -+ lab->setText(KIO::itemsSummaryString(iFileCount + iDirCount, iFileCount, iDirCount, 0, false)); -+ } else { -+ lab->setText(filename); - } -- -+ d->nameArea = lab; - } else { - d->m_lined = new KLineEdit(d->m_frame); - d->m_lined->setObjectName("KFilePropsPlugin::nameLineEdit"); - d->m_lined->setText(filename); -+ d->nameArea = d->m_lined; - d->m_lined->setFocus(); - -+ //if we don't have permissions to rename, we need to make "m_lined" read only. -+ KFileItemListProperties itemList(KFileItemList() << item); -+ setFileNameReadOnly(!itemList.supportsMoving()); -+ - // Enhanced rename: Don't highlight the file extension. - QString extension = db.suffixForFileName(filename); - if (!extension.isEmpty()) { -@@ -1011,9 +1016,9 @@ - - connect(d->m_lined, SIGNAL(textChanged(QString)), - this, SLOT(nameFileChanged(QString))); -- grid->addWidget(d->m_lined, curRow, 2); - } -- ++curRow; -+ -+ grid->addWidget(d->nameArea, curRow++, 2); - - KSeparator *sep = new KSeparator(Qt::Horizontal, d->m_frame); - grid->addWidget(sep, curRow, 0, 1, 3); -@@ -1158,30 +1163,13 @@ - - if (isLocal) { - KMountPoint::Ptr mp = KMountPoint::currentMountPoints().findByPath(url.toLocalFile()); -- -- l = new QLabel(i18n("File System:"), d->m_frame); -- grid->addWidget(l, curRow, 0, Qt::AlignRight); -- -- l = new QLabel(d->m_frame); -- grid->addWidget(l, curRow++, 2); -- l->setTextInteractionFlags(Qt::TextSelectableByMouse | Qt::TextSelectableByKeyboard); -- l->setText(mp->mountType()); -- -- if (mp) { -+ if (mp && mp->mountPoint() != QLatin1String("/")) { - l = new QLabel(i18n("Mounted on:"), d->m_frame); - grid->addWidget(l, curRow, 0, Qt::AlignRight); - - l = new KSqueezedTextLabel(mp->mountPoint(), d->m_frame); - l->setTextInteractionFlags(Qt::TextSelectableByMouse | Qt::TextSelectableByKeyboard); - grid->addWidget(l, curRow++, 2); -- -- l = new QLabel(i18n("Mounted from:"), d->m_frame); -- grid->addWidget(l, curRow, 0, Qt::AlignRight); -- -- l = new QLabel(d->m_frame); -- grid->addWidget(l, curRow++, 2); -- l->setTextInteractionFlags(Qt::TextSelectableByMouse | Qt::TextSelectableByKeyboard); -- l->setText(mp->mountedFrom()); - } - } - -@@ -1219,15 +1207,12 @@ - - void KFilePropsPlugin::setFileNameReadOnly(bool ro) - { -- Q_ASSERT(ro); // false isn't supported -- if (ro && !d->m_fileNameLabel) { -- Q_ASSERT(!d->m_bFromTemplate); -- delete d->m_lined; -- d->m_lined = nullptr; -- d->m_fileNameLabel = new QLabel(d->m_frame); -- d->m_fileNameLabel->setTextInteractionFlags(Qt::TextSelectableByMouse | Qt::TextSelectableByKeyboard); -- d->m_fileNameLabel->setText(d->oldName); // will get overwritten if d->bMultiple -- d->m_grid->addWidget(d->m_fileNameLabel, 0, 2); -+ if (d->m_lined && !d->m_bFromTemplate) { -+ d->m_lined->setReadOnly(ro); -+ if (ro) { -+ // Don't put the initial focus on the line edit when it is ro -+ properties->buttonBox()->button(QDialogButtonBox::Ok)->setFocus(); -+ } - } - } - -@@ -1390,8 +1375,8 @@ - - // qDebug() << "KFilePropsPlugin::applyChanges"; - -- if (d->m_lined) { -- QString n = d->m_lined->text(); -+ if (qobject_cast(d->nameArea)) { -+ QString n = ((QLineEdit *) d->nameArea)->text(); - // Remove trailing spaces (#4345) - while (! n.isEmpty() && n[n.length() - 1].isSpace()) { - n.truncate(n.length() - 1); -@@ -1682,6 +1667,8 @@ - d->cbRecursive = nullptr; - d->grpCombo = nullptr; d->grpEdit = nullptr; - d->usrEdit = nullptr; -+ QString path = properties->url().path(); -+ QString fname = properties->url().fileName(); - bool isLocal = properties->url().isLocalFile(); - bool isTrash = (properties->url().scheme() == QLatin1String("trash")); - KUser myself(KUser::UseEffectiveUID); -@@ -1707,6 +1694,7 @@ - KFileItemList::const_iterator it = items.begin(); - const KFileItemList::const_iterator kend = items.end(); - for (++it /*no need to check the first one again*/; it != kend; ++it) { -+ const QUrl url = (*it).url(); - if (!d->isIrregular) - d->isIrregular |= isIrregular((*it).permissions(), - (*it).isDir() == isDir, -@@ -1884,6 +1872,7 @@ - /*** Set Group ***/ - - QStringList groupList; -+ QByteArray strUser; - KUser user(KUser::UseEffectiveUID); - const bool isMyGroup = user.groupNames().contains(d->strGroup); - -@@ -2783,7 +2772,7 @@ - - const QString checksum = cachedChecksum(algorithm); - -- // Checksum already in cache. -+ // Checksum alread in cache. - if (!checksum.isEmpty()) { - const bool isMatch = (checksum == input); - if (isMatch) { -@@ -3113,7 +3102,7 @@ - const QUrl url = job->mostLocalUrl(); - - if (!url.isLocalFile()) { -- KMessageBox::sorry(nullptr, i18n("Could not save properties. Only entries on local file systems are supported.")); -+ //FIXME: 4.2 add this: KMessageBox::sorry(0, i18n("Could not save properties. Only entries on local file systems are supported.")); - return; - } diff --git a/desktop/kde/framework/kio/pspec.xml b/desktop/kde/framework/kio/pspec.xml index b616b535b1..b97acf17e6 100755 --- a/desktop/kde/framework/kio/pspec.xml +++ b/desktop/kde/framework/kio/pspec.xml @@ -57,7 +57,7 @@ kded-devel - + 8ad69215.patch