Skip to content
GitLab
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
Plasma
Plasma Workspace
Commits
665836f5
Commit
665836f5
authored
Sep 19, 2020
by
Alexander Lohnau
💬
Browse files
Simplify runners using new methods
parent
cb8e1f7b
Changes
10
Hide whitespace changes
Inline
Side-by-side
runners/calculator/calculatorrunner.cpp
View file @
665836f5
...
...
@@ -284,6 +284,7 @@ void CalculatorRunner::match(Plasma::RunnerContext &context)
}
match
.
setData
(
result
);
match
.
setId
(
term
);
match
.
setActions
(
actions
().
values
());
context
.
addMatch
(
match
);
}
}
...
...
@@ -343,13 +344,6 @@ void CalculatorRunner::run(const Plasma::RunnerContext &context, const Plasma::Q
}
}
QList
<
QAction
*>
CalculatorRunner
::
actionsForMatch
(
const
Plasma
::
QueryMatch
&
match
)
{
Q_UNUSED
(
match
)
return
actions
().
values
();
}
QMimeData
*
CalculatorRunner
::
mimeDataForMatch
(
const
Plasma
::
QueryMatch
&
match
)
{
//qDebug();
...
...
runners/calculator/calculatorrunner.h
View file @
665836f5
...
...
@@ -43,7 +43,6 @@ class CalculatorRunner : public Plasma::AbstractRunner
protected
Q_SLOTS
:
void
run
(
const
Plasma
::
RunnerContext
&
context
,
const
Plasma
::
QueryMatch
&
match
)
override
;
QList
<
QAction
*>
actionsForMatch
(
const
Plasma
::
QueryMatch
&
match
)
override
;
QMimeData
*
mimeDataForMatch
(
const
Plasma
::
QueryMatch
&
match
)
override
;
private:
...
...
runners/kill/killrunner.cpp
View file @
665836f5
...
...
@@ -134,6 +134,7 @@ void KillRunner::match(Plasma::RunnerContext &context)
match
.
setIconName
(
QStringLiteral
(
"application-exit"
));
match
.
setData
(
pid
);
match
.
setId
(
name
);
match
.
setActions
(
m_actionList
);
// Set the relevance
switch
(
m_sorting
)
{
...
...
@@ -181,11 +182,4 @@ void KillRunner::run(const Plasma::RunnerContext &context, const Plasma::QueryMa
killAction
.
execute
();
}
QList
<
QAction
*>
KillRunner
::
actionsForMatch
(
const
Plasma
::
QueryMatch
&
match
)
{
Q_UNUSED
(
match
)
return
m_actionList
;
}
#include
"killrunner.moc"
runners/kill/killrunner.h
View file @
665836f5
...
...
@@ -45,7 +45,6 @@ public:
void
match
(
Plasma
::
RunnerContext
&
context
)
override
;
void
run
(
const
Plasma
::
RunnerContext
&
context
,
const
Plasma
::
QueryMatch
&
match
)
override
;
QList
<
QAction
*>
actionsForMatch
(
const
Plasma
::
QueryMatch
&
match
)
override
;
void
reloadConfiguration
()
override
;
private
Q_SLOTS
:
...
...
runners/recentdocuments/recentdocuments.cpp
View file @
665836f5
...
...
@@ -96,6 +96,9 @@ void RecentDocuments::match(Plasma::RunnerContext &context)
match
.
setIconName
(
KIO
::
iconNameForUrl
(
url
));
match
.
setRelevance
(
relevance
);
match
.
setData
(
QVariant
(
url
));
if
(
url
.
isLocalFile
())
{
match
.
setActions
(
actions
().
values
());
}
match
.
setText
(
name
);
QString
destUrlString
=
KShell
::
tildeCollapse
(
url
.
adjusted
(
QUrl
::
RemoveFilename
).
path
());
...
...
@@ -120,16 +123,6 @@ void RecentDocuments::run(const Plasma::RunnerContext &context, const Plasma::Qu
run
->
setRunExecutables
(
false
);
}
QList
<
QAction
*>
RecentDocuments
::
actionsForMatch
(
const
Plasma
::
QueryMatch
&
match
)
{
const
QUrl
url
=
match
.
data
().
toUrl
();
if
(
url
.
isLocalFile
())
{
return
actions
().
values
();
}
return
{};
}
QMimeData
*
RecentDocuments
::
mimeDataForMatch
(
const
Plasma
::
QueryMatch
&
match
)
{
QMimeData
*
result
=
new
QMimeData
();
...
...
runners/recentdocuments/recentdocuments.h
View file @
665836f5
...
...
@@ -35,7 +35,6 @@ class RecentDocuments : public Plasma::AbstractRunner {
void
run
(
const
Plasma
::
RunnerContext
&
context
,
const
Plasma
::
QueryMatch
&
match
)
override
;
private
Q_SLOTS
:
QList
<
QAction
*>
actionsForMatch
(
const
Plasma
::
QueryMatch
&
match
)
override
;
QMimeData
*
mimeDataForMatch
(
const
Plasma
::
QueryMatch
&
match
)
override
;
};
...
...
runners/shell/shellrunner.cpp
View file @
665836f5
...
...
@@ -71,6 +71,7 @@ void ShellRunner::match(Plasma::RunnerContext &context)
match
.
setText
(
i18n
(
"Run %1"
,
term
));
match
.
setData
(
QVariantList
({
command
,
envs
}));
match
.
setRelevance
(
0.7
);
match
.
setActions
(
m_actionList
);
context
.
addMatch
(
match
);
}
}
...
...
@@ -88,13 +89,6 @@ void ShellRunner::run(const Plasma::RunnerContext &context, const Plasma::QueryM
job
->
start
();
}
QList
<
QAction
*>
ShellRunner
::
actionsForMatch
(
const
Plasma
::
QueryMatch
&
match
)
{
Q_UNUSED
(
match
)
return
m_actionList
;
}
bool
ShellRunner
::
parseENVVariables
(
const
QString
&
query
,
QStringList
&
envs
,
QString
&
command
)
{
const
static
QRegularExpression
envRegex
=
QRegularExpression
(
QStringLiteral
(
"^.+=.+$"
));
...
...
runners/shell/shellrunner.h
View file @
665836f5
...
...
@@ -35,7 +35,6 @@ class ShellRunner : public Plasma::AbstractRunner
void
match
(
Plasma
::
RunnerContext
&
context
)
override
;
void
run
(
const
Plasma
::
RunnerContext
&
context
,
const
Plasma
::
QueryMatch
&
action
)
override
;
QList
<
QAction
*>
actionsForMatch
(
const
Plasma
::
QueryMatch
&
match
)
override
;
private:
bool
parseENVVariables
(
const
QString
&
query
,
QStringList
&
envs
,
QString
&
command
);
...
...
runners/webshortcuts/webshortcutrunner.cpp
View file @
665836f5
...
...
@@ -95,7 +95,7 @@ void WebshortcutRunner::configurePrivateBrowsingActions()
m_privateAction
=
action
;
const
QString
actionText
=
containsPrivate
?
i18n
(
"Search in private window"
)
:
i18n
(
"Search in incognito window"
);
const
QIcon
icon
=
QIcon
::
fromTheme
(
QStringLiteral
(
"view-private"
),
QIcon
::
fromTheme
(
QStringLiteral
(
"view-hidden"
)));
addAction
(
QStringLiteral
(
"privateSearch"
),
icon
,
actionText
);
m_match
.
setActions
({
addAction
(
QStringLiteral
(
"privateSearch"
),
icon
,
actionText
)
})
;
return
;
}
}
...
...
@@ -146,12 +146,6 @@ void WebshortcutRunner::match(Plasma::RunnerContext &context)
context
.
addMatch
(
m_match
);
}
QList
<
QAction
*>
WebshortcutRunner
::
actionsForMatch
(
const
Plasma
::
QueryMatch
&
match
)
{
Q_UNUSED
(
match
)
return
actions
().
values
();
}
void
WebshortcutRunner
::
run
(
const
Plasma
::
RunnerContext
&
context
,
const
Plasma
::
QueryMatch
&
match
)
{
QUrl
location
;
...
...
runners/webshortcuts/webshortcutrunner.h
View file @
665836f5
...
...
@@ -30,7 +30,6 @@ class WebshortcutRunner : public Plasma::AbstractRunner
~
WebshortcutRunner
()
override
;
void
match
(
Plasma
::
RunnerContext
&
context
)
override
;
QList
<
QAction
*>
actionsForMatch
(
const
Plasma
::
QueryMatch
&
match
)
override
;
void
run
(
const
Plasma
::
RunnerContext
&
context
,
const
Plasma
::
QueryMatch
&
match
)
override
;
private
Q_SLOTS
:
...
...
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment