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
e859bdf5
Commit
e859bdf5
authored
Jan 09, 2018
by
Nathaniel Graham
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Revert "Improve snap support"
This reverts commit
1a34987a
.
parent
8f6233ab
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
12 additions
and
3 deletions
+12
-3
libdiscover/backends/SnapBackend/SnapBackend.cpp
libdiscover/backends/SnapBackend/SnapBackend.cpp
+10
-2
libdiscover/backends/SnapBackend/SnapBackend.h
libdiscover/backends/SnapBackend/SnapBackend.h
+2
-1
No files found.
libdiscover/backends/SnapBackend/SnapBackend.cpp
View file @
e859bdf5
...
...
@@ -46,6 +46,15 @@ SnapBackend::SnapBackend(QObject* parent)
,
m_updater
(
new
StandardBackendUpdater
(
this
))
,
m_reviews
(
new
SnapReviewsBackend
(
this
))
{
{
auto
request
=
m_client
.
connect
();
request
->
runSync
();
m_valid
=
request
->
error
()
==
QSnapdRequest
::
NoError
;
if
(
!
m_valid
)
{
qWarning
()
<<
"snap problem at initialize:"
<<
request
->
errorString
();
return
;
}
}
connect
(
m_reviews
,
&
SnapReviewsBackend
::
ratingsReady
,
this
,
&
AbstractResourcesBackend
::
emitRatingsReady
);
//make sure we populate the installed resources first
...
...
@@ -67,7 +76,7 @@ ResultsStream * SnapBackend::search(const AbstractResourcesBackend::Filters& fil
return
voidStream
();
}
else
if
(
filters
.
state
>=
AbstractResource
::
Installed
)
{
return
populate
(
m_client
.
list
(),
AbstractResource
::
Installed
);
}
else
if
(
!
filters
.
search
.
isEmpty
())
{
}
else
{
return
populate
(
m_client
.
find
(
QSnapdClient
::
FindFlag
::
None
,
filters
.
search
),
AbstractResource
::
None
);
}
return
voidStream
();
...
...
@@ -84,7 +93,6 @@ ResultsStream* SnapBackend::populate(T* job, AbstractResource::State state)
auto
stream
=
new
ResultsStream
(
QStringLiteral
(
"Snap-populate"
));
connect
(
job
,
&
QSnapdFindRequest
::
complete
,
stream
,
[
stream
,
this
,
state
,
job
]()
{
static_assert
(
std
::
is_base_of
<
QSnapdRequest
,
T
>::
value
,
"we can only populate QSnapdRequest"
);
QSet
<
SnapResource
*>
higher
=
kFilter
<
QSet
<
SnapResource
*>>
(
m_resources
,
[
state
](
AbstractResource
*
res
){
return
res
->
state
()
>=
state
;
});
QVector
<
AbstractResource
*>
ret
;
...
...
libdiscover/backends/SnapBackend/SnapBackend.h
View file @
e859bdf5
...
...
@@ -43,7 +43,7 @@ public:
int
updatesCount
()
const
override
;
AbstractBackendUpdater
*
backendUpdater
()
const
override
;
AbstractReviewsBackend
*
reviewsBackend
()
const
override
;
bool
isValid
()
const
override
{
return
true
;
}
bool
isValid
()
const
override
{
return
m_valid
;
}
QList
<
QAction
*>
messageActions
()
const
override
{
return
{};
}
Transaction
*
installApplication
(
AbstractResource
*
app
)
override
;
...
...
@@ -64,6 +64,7 @@ private:
StandardBackendUpdater
*
m_updater
;
SnapReviewsBackend
*
m_reviews
;
bool
m_valid
=
true
;
bool
m_fetching
=
false
;
QSnapdClient
m_client
;
};
...
...
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