Skip to content
GitLab
Menu
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
azubieta
plasma-appimage-integration
Commits
4c17136c
Verified
Commit
4c17136c
authored
Aug 05, 2019
by
azubieta
Browse files
Add uninstall command
parent
18f5bd1e
Changes
5
Hide whitespace changes
Inline
Side-by-side
res/AppImage Services.conf
View file @
4c17136c
...
...
@@ -4,3 +4,6 @@ RemoveCommandArgs=remove %1
UpdateCommand
=
plasma
-
appimage
-
integration
UpdateCommandArgs
=
update
%
1
UninstallCommand
=
plasma
-
appimage
-
integration
UninstallCommandArgs
=
uninstall
%
1
src/bin/CMakeLists.txt
View file @
4c17136c
...
...
@@ -4,6 +4,7 @@ add_executable(
UpdateJob.cpp
RemoveJob.cpp
InstallJob.cpp
UninstallJob.cpp
)
target_link_libraries
(
plasma-appimage-integration appimageservices-interfaces KF5::KIOWidgets KF5::I18n KF5::Notifications
)
...
...
src/bin/UninstallJob.cpp
0 → 100644
View file @
4c17136c
// libraries
#include
<QtCore/QTimer>
#include
<QtCore/QDebug>
#include
<KI18n/KLocalizedString>
#include
<utility>
// local
#include
"UninstallJob.h"
UninstallJob
::
UninstallJob
(
QString
target
,
QObject
*
parent
)
:
KJob
(
parent
),
target
(
std
::
move
(
target
))
{}
void
UninstallJob
::
start
()
{
process
.
setProgram
(
"pkexec"
);
process
.
setArguments
({
"appimage-services"
,
"uninstall"
,
target
});
qDebug
()
<<
"calling pkexec appimage-services install "
<<
target
;
connect
(
&
process
,
SIGNAL
(
finished
(
int
)),
this
,
SLOT
(
onProcessFinished
(
int
)));
description
(
this
,
i18n
(
"Uninstalling Application"
),
qMakePair
<
QString
,
QString
>
(
i18nc
(
"The AppImage being uninstalled"
,
"Source"
),
target
));
process
.
start
();
}
void
UninstallJob
::
onProcessFinished
(
int
exitCode
)
{
qDebug
()
<<
exitCode
;
qDebug
()
<<
process
.
errorString
();
if
(
exitCode
!=
0
)
{
setError
(
exitCode
);
setErrorText
(
process
.
readAllStandardError
());
}
// notify result delayed
QTimer
::
singleShot
(
1000
,
this
,
&
UninstallJob
::
emitResult
);
}
src/bin/UninstallJob.h
0 → 100644
View file @
4c17136c
#pragma once
// libraries
#include
<KJob>
#include
<QtCore/QProcess>
class
UninstallJob
:
public
KJob
{
Q_OBJECT
public:
explicit
UninstallJob
(
QString
target
,
QObject
*
parent
=
nullptr
);
void
start
()
override
;
protected
slots
:
void
onProcessFinished
(
int
exitCode
);
private:
QString
target
;
QProcess
process
;
};
src/bin/main.cpp
View file @
4c17136c
...
...
@@ -12,6 +12,7 @@
#include
"UpdateJob.h"
#include
"RemoveJob.h"
#include
"InstallJob.h"
#include
"UninstallJob.h"
QString
parseTarget
(
QCommandLineParser
&
parser
)
{
...
...
@@ -59,6 +60,13 @@ void executeInstallCommand(const QString& target) {
job
->
start
();
}
void
executeUninstallCommand
(
const
QString
&
target
)
{
KJob
*
job
=
new
UninstallJob
(
target
);
KIO
::
getJobTracker
()
->
registerJob
(
job
);
job
->
start
();
}
int
main
(
int
argc
,
char
**
argv
)
{
QApplication
app
(
argc
,
argv
);
QApplication
::
setApplicationName
(
"plasma-appimage-integration"
);
...
...
@@ -94,6 +102,11 @@ int main(int argc, char** argv) {
QString
target
=
parseTarget
(
parser
);
executeInstallCommand
(
target
);
}
if
(
command
==
"uninstall"
)
{
QString
target
=
parseTarget
(
parser
);
executeUninstallCommand
(
target
);
}
return
QApplication
::
exec
();
}
...
...
Write
Preview
Supports
Markdown
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