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
2
Merge Requests
2
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
832a9a8f
Commit
832a9a8f
authored
Jan 15, 2018
by
Aleix Pol Gonzalez
🐧
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Hardcode the state the snap is going to get
parent
e324fd7f
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
8 additions
and
5 deletions
+8
-5
libdiscover/backends/SnapBackend/SnapBackend.cpp
libdiscover/backends/SnapBackend/SnapBackend.cpp
+2
-2
libdiscover/backends/SnapBackend/SnapTransaction.cpp
libdiscover/backends/SnapBackend/SnapTransaction.cpp
+3
-2
libdiscover/backends/SnapBackend/SnapTransaction.h
libdiscover/backends/SnapBackend/SnapTransaction.h
+3
-1
No files found.
libdiscover/backends/SnapBackend/SnapBackend.cpp
View file @
832a9a8f
...
...
@@ -191,13 +191,13 @@ Transaction* SnapBackend::installApplication(AbstractResource* app, const AddonL
Transaction
*
SnapBackend
::
installApplication
(
AbstractResource
*
_app
)
{
auto
app
=
qobject_cast
<
SnapResource
*>
(
_app
);
return
new
SnapTransaction
(
app
,
m_client
.
install
(
app
->
packageName
()),
Transaction
::
InstallRole
);
return
new
SnapTransaction
(
app
,
m_client
.
install
(
app
->
packageName
()),
Transaction
::
InstallRole
,
AbstractResource
::
Installed
);
}
Transaction
*
SnapBackend
::
removeApplication
(
AbstractResource
*
_app
)
{
auto
app
=
qobject_cast
<
SnapResource
*>
(
_app
);
return
new
SnapTransaction
(
app
,
m_client
.
remove
(
app
->
packageName
()),
Transaction
::
RemoveRole
);
return
new
SnapTransaction
(
app
,
m_client
.
remove
(
app
->
packageName
()),
Transaction
::
RemoveRole
,
AbstractResource
::
None
);
}
QString
SnapBackend
::
displayName
()
const
...
...
libdiscover/backends/SnapBackend/SnapTransaction.cpp
View file @
832a9a8f
...
...
@@ -29,10 +29,11 @@
#include "libsnapclient/config-paths.h"
#include "utils.h"
SnapTransaction
::
SnapTransaction
(
SnapResource
*
app
,
QSnapdRequest
*
request
,
Role
role
)
SnapTransaction
::
SnapTransaction
(
SnapResource
*
app
,
QSnapdRequest
*
request
,
Role
role
,
AbstractResource
::
State
newState
)
:
Transaction
(
app
,
app
,
role
)
,
m_app
(
app
)
,
m_request
(
request
)
,
m_newState
(
newState
)
{
setStatus
(
DownloadingStatus
);
setCancellable
(
false
);
...
...
@@ -53,7 +54,7 @@ void SnapTransaction::finishTransaction()
qDebug
()
<<
"done!"
;
switch
(
m_request
->
error
())
{
case
QSnapdRequest
::
NoError
:
static_cast
<
SnapBackend
*>
(
m_app
->
backend
())
->
refreshStates
(
);
m_app
->
setState
(
m_newState
);
break
;
case
QSnapdRequest
::
AuthDataRequired
:
{
QProcess
*
p
=
new
QProcess
;
...
...
libdiscover/backends/SnapBackend/SnapTransaction.h
View file @
832a9a8f
...
...
@@ -21,6 +21,7 @@
#ifndef SNAPTRANSACTION_H
#define SNAPTRANSACTION_H
#include <resources/AbstractResource.h>
#include <Transaction/Transaction.h>
#include <QPointer>
...
...
@@ -31,7 +32,7 @@ class SnapTransaction : public Transaction
{
Q_OBJECT
public:
SnapTransaction
(
SnapResource
*
app
,
QSnapdRequest
*
request
,
Role
role
);
SnapTransaction
(
SnapResource
*
app
,
QSnapdRequest
*
request
,
Role
role
,
AbstractResource
::
State
newState
);
void
cancel
()
override
;
...
...
@@ -43,6 +44,7 @@ class SnapTransaction : public Transaction
SnapResource
*
const
m_app
;
const
QScopedPointer
<
QSnapdRequest
>
m_request
;
const
AbstractResource
::
State
m_newState
;
};
#endif // SNAPTRANSACTION_H
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