Accepting request 258893 from KDE:Frameworks5

- Added
  0001-LocationRunner-Convert-case-insensitive-path-to-a-pr.patch (kde#333395)
  and 0002-Baloo-Runner-Lower-relevance-because-krunner-does-no.patch,
  make sure that applications are shown as top results in krunner
- Recommend lang subpackage
- Relax dependancies to plasma-framework private parts, and fix
  a blip moment, typo in package name

OBS-URL: https://build.opensuse.org/request/show/258893
OBS-URL: https://build.opensuse.org/package/show/openSUSE:Factory/plasma5-workspace?expand=0&rev=8
This commit is contained in:
Stephan Kulow 2014-10-31 08:39:48 +00:00 committed by Git OBS Bridge
commit cec010fe5e
4 changed files with 152 additions and 2 deletions

View File

@ -0,0 +1,80 @@
From 1ae78f08474878e60d086ea60e933d62228eac2f Mon Sep 17 00:00:00 2001
From: Vishesh Handa <me@vhanda.in>
Date: Fri, 17 Oct 2014 17:45:42 +0200
Subject: [PATCH 1/2] LocationRunner: Convert case insensitive path to a proper
one
BUG: 333395
FIXED-IN: 5.2
---
runners/locations/locationrunner.cpp | 40 ++++++++++++++++++++++++++++++++++++
1 file changed, 40 insertions(+)
diff --git a/runners/locations/locationrunner.cpp b/runners/locations/locationrunner.cpp
index 13035a9..0b79655 100644
--- a/runners/locations/locationrunner.cpp
+++ b/runners/locations/locationrunner.cpp
@@ -21,6 +21,7 @@
#include <QMimeData>
#include <QIcon>
#include <QUrl>
+#include <QDir>
#include <QDebug>
#include <KRun>
@@ -129,6 +130,43 @@ void LocationsRunner::match(Plasma::RunnerContext &context)
}
}
+static QString convertCaseInsensitivePath(const QString& path)
+{
+ // Split the string on /
+ QStringList dirNames = path.split(QDir::separator(), QString::SkipEmptyParts);
+
+ // Match folders
+ QDir dir("/");
+ for (int i = 0; i < dirNames.size() - 1; i++) {
+ QString dirName = dirNames[i];
+
+ bool foundMatch = false;
+ QStringList entries = dir.entryList(QDir::Dirs);
+ for (const QString& entry: entries) {
+ if (entry.compare(dirName, Qt::CaseInsensitive) == 0) {
+ foundMatch = dir.cd(entry);
+ if (foundMatch) {
+ break;
+ }
+ }
+ }
+
+ if (!foundMatch) {
+ return path;
+ }
+ }
+
+ QString finalName = dirNames.last();
+ QStringList entries = dir.entryList();
+ for (const QString& entry: entries) {
+ if (entry.compare(finalName, Qt::CaseInsensitive) == 0) {
+ return dir.absoluteFilePath(entry);
+ }
+ }
+
+ return path;
+}
+
void LocationsRunner::run(const Plasma::RunnerContext &context, const Plasma::QueryMatch &match)
{
Q_UNUSED(match)
@@ -139,6 +177,8 @@ void LocationsRunner::run(const Plasma::RunnerContext &context, const Plasma::Qu
return;
}
+ location = convertCaseInsensitivePath(location);
+
//qDebug() << "command: " << context.query();
//qDebug() << "url: " << location << data;
--
2.1.2

View File

@ -0,0 +1,50 @@
From 1fc19e8dfb8290ad7d21ba8f8913160f880a095b Mon Sep 17 00:00:00 2001
From: Vishesh Handa <me@vhanda.in>
Date: Tue, 21 Oct 2014 17:59:40 +0200
Subject: [PATCH 2/2] Baloo Runner: Lower relevance because krunner does not
know any better
The KRunner framework expects all runners to set a relevance for each
match, except that this relevance information is taken to globally sort
the results. So I can write a plugin which whose results will always be
on top. Yaye! </sarcasm>
Explicitly lower Baloo's relevance so that in general applications are
higher.
---
runners/baloo/baloosearchrunner.cpp | 12 +++++++++---
1 file changed, 9 insertions(+), 3 deletions(-)
diff --git a/runners/baloo/baloosearchrunner.cpp b/runners/baloo/baloosearchrunner.cpp
index 996f719..115abd0 100644
--- a/runners/baloo/baloosearchrunner.cpp
+++ b/runners/baloo/baloosearchrunner.cpp
@@ -99,7 +99,13 @@ void SearchRunner::match(Plasma::RunnerC
Baloo::ResultIterator it = query.exec();
- int relevance = 100;
+ // KRunner is absolutely retarded and allows plugins to set the global
+ // relevance levels. so Baloo should not set the relevance of results too
+ // high because then Applications will often appear after if the application
+ // runner has not a higher relevance. So stupid.
+ // Each runner plugin should not have to know about the others.
+ // Anyway, that's why we're starting with .75
+ float relevance = .75;
while (context.isValid() && it.next()) {
Plasma::QueryMatch match(this);
match.setIcon(QIcon::fromTheme(it.icon()));
@@ -108,8 +114,8 @@ void SearchRunner::match(Plasma::RunnerC
match.setData(it.url());
match.setType(Plasma::QueryMatch::PossibleMatch);
match.setMatchCategory(category);
- match.setRelevance(relevance * .01);
- relevance--;
+ match.setRelevance(relevance);
+ relevance -= 0.05;
QString url = it.url().toLocalFile();
if (url.startsWith(QDir::homePath())) {
--
2.1.2

View File

@ -1,3 +1,14 @@
-------------------------------------------------------------------
Wed Oct 22 23:27:48 UTC 2014 - hrvoje.senjan@gmail.com
- Added
0001-LocationRunner-Convert-case-insensitive-path-to-a-pr.patch (kde#333395)
and 0002-Baloo-Runner-Lower-relevance-because-krunner-does-no.patch,
make sure that applications are shown as top results in krunner
- Recommend lang subpackage
- Relax dependancies to plasma-framework private parts, and fix
a blip moment, typo in package name
-------------------------------------------------------------------
Thu Oct 9 21:24:39 UTC 2014 - hrvoje.senjan@gmail.com

View File

@ -32,6 +32,12 @@ Patch0: 0001-Rename-qdbus-in-startkde.patch
Patch1: create_kdehome.patch
# PATCH-FIX_OPENSUSE 0003-Remove-export-of-QT_PLUGIN_PATH.patch -- we install plugins to directory known to Qt5, so export just pollutes both Qt4 and Qt5 plugins
Patch2: 0003-Remove-export-of-QT_PLUGIN_PATH.patch
# PATCHES 100-1000 and above are from upstream 5.1 branch
# PATCHES 1000 and above are from upstream master/5.2 branch
# PATCH-FIX-UPSTREAM 0001-LocationRunner-Convert-case-insensitive-path-to-a-pr.patch -- kde#333395
Patch1000: 0001-LocationRunner-Convert-case-insensitive-path-to-a-pr.patch
# PATCH-FIX-UPSTREAM 0002-Baloo-Runner-Lower-relevance-because-krunner-does-no.patch -- make sure that applications are shown as top results in krunner
Patch1001: 0002-Baloo-Runner-Lower-relevance-because-krunner-does-no.patch
BuildRequires: alsa-devel
BuildRequires: baloo5-devel >= 5.0.0
BuildRequires: kactivities5-devel >= 5.0.0
@ -106,8 +112,8 @@ Requires: solid-imports
Requires: frameworkintegration-plugin
Requires: libkscreen2-plugin
# hardcode versions of plasma-framework-componets and plasma-framework-private packages, as upstream doesn't keep backwards compability there
%requires_eq plasma-framework-componets
%requires_eq plasma-framework-private
%requires_ge plasma-framework-components
%requires_ge plasma-framework-private
# de-facto even required...
Recommends: kactivities5
# we want wallpaper previews
@ -118,6 +124,7 @@ Recommends: phonon4qt5-backend
Recommends: systemsettings5
# so Qt4-only apps have some colors in tray
Recommends: sni-qt
Recommends: %{name}-lang
BuildRoot: %{_tmppath}/%{name}-%{version}-build
%description
@ -175,6 +182,8 @@ workspace. Development files.
%patch0 -p1
%patch1 -p1
%patch2 -p1
%patch1000 -p1
%patch1001 -p1
%build
%cmake_kf5 -d build -- -DKDE4_COMMON_PAM_SERVICE=xdm -DKDE_DEFAULT_HOME=.kde4 -DCMAKE_INSTALL_LOCALEDIR=share/locale/kf5