Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Discover
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Service Desk
Milestones
Merge Requests
3
Merge Requests
3
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Operations
Operations
Incidents
Environments
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Plasma
Discover
Commits
59a93daa
Commit
59a93daa
authored
Jan 25, 2018
by
Aleix Pol Gonzalez
🐧
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Have PackageKit only execute files installed by the package
BUG: 389036
parent
759fbf2c
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
18 additions
and
7 deletions
+18
-7
libdiscover/backends/PackageKitBackend/AppPackageKitResource.cpp
...over/backends/PackageKitBackend/AppPackageKitResource.cpp
+18
-7
No files found.
libdiscover/backends/PackageKitBackend/AppPackageKitResource.cpp
View file @
59a93daa
...
...
@@ -31,6 +31,8 @@
#include <QStandardPaths>
#include <QDebug>
#include "config-paths.h"
#include <PackageKit/Daemon>
#include <utils.h>
AppPackageKitResource
::
AppPackageKitResource
(
const
AppStream
::
Component
&
data
,
const
QString
&
packageName
,
PackageKitBackend
*
parent
)
:
PackageKitResource
(
packageName
,
QString
(),
parent
)
...
...
@@ -182,12 +184,21 @@ void AppPackageKitResource::fetchChangelog()
void
AppPackageKitResource
::
invokeApplication
()
const
{
const
QStringList
exes
=
m_appdata
.
provided
(
AppStream
::
Provided
::
KindBinary
).
items
();
if
(
exes
.
isEmpty
())
{
const
auto
servicePath
=
QStandardPaths
::
locate
(
QStandardPaths
::
ApplicationsLocation
,
m_appdata
.
id
());
QProcess
::
startDetached
(
QStringLiteral
(
CMAKE_INSTALL_FULL_LIBEXECDIR_KF5
"/discover/runservice"
),
{
servicePath
});
}
else
{
QProcess
::
startDetached
(
exes
.
constFirst
());
}
auto
trans
=
PackageKit
::
Daemon
::
getFiles
({
installedPackageId
()});
connect
(
trans
,
&
PackageKit
::
Transaction
::
files
,
this
,
[
this
](
const
QString
&
/*packageID*/
,
const
QStringList
&
filenames
)
{
const
auto
allServices
=
QStandardPaths
::
locateAll
(
QStandardPaths
::
ApplicationsLocation
,
m_appdata
.
id
());
if
(
!
allServices
.
isEmpty
())
{
const
auto
packageServices
=
kFilter
<
QStringList
>
(
allServices
,
[
filenames
](
const
QString
&
file
)
{
return
filenames
.
contains
(
file
);
});
QProcess
::
startDetached
(
QStringLiteral
(
CMAKE_INSTALL_FULL_LIBEXECDIR_KF5
"/discover/runservice"
),
{
packageServices
});
}
else
{
const
QStringList
exes
=
m_appdata
.
provided
(
AppStream
::
Provided
::
KindBinary
).
items
();
const
auto
packageExecutables
=
kFilter
<
QStringList
>
(
allServices
,
[
filenames
](
const
QString
&
exe
)
{
return
filenames
.
contains
(
QLatin1Char
(
'/'
)
+
exe
);
});
if
(
packageExecutables
.
isEmpty
())
{
qWarning
()
<<
"Could not find any executables"
<<
exes
<<
filenames
;
return
;
}
QProcess
::
startDetached
(
exes
.
constFirst
());
}
});
}
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a 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