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
Discover
Commits
4a874a63
Commit
4a874a63
authored
Feb 23, 2022
by
Aleix Pol Gonzalez
🐧
Committed by
Aleix Pol Gonzalez
Feb 23, 2022
Browse files
flatpak: Do not emit about upgradeable packages that were just created
(cherry picked from commit
a3d93b54
)
parent
3cb9e7b8
Pipeline
#141532
passed with stage
in 1 minute and 53 seconds
Changes
4
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
libdiscover/backends/FlatpakBackend/FlatpakBackend.cpp
View file @
4a874a63
...
...
@@ -349,8 +349,10 @@ QString refToBundleId(FlatpakRef *ref)
+
flatpak_ref_get_branch
(
ref
);
}
FlatpakResource
*
FlatpakBackend
::
getAppForInstalledRef
(
FlatpakInstallation
*
installation
,
FlatpakInstalledRef
*
ref
)
const
FlatpakResource
*
FlatpakBackend
::
getAppForInstalledRef
(
FlatpakInstallation
*
installation
,
FlatpakInstalledRef
*
ref
,
bool
*
freshResource
)
const
{
if
(
freshResource
)
*
freshResource
=
false
;
const
QString
origin
=
QString
::
fromUtf8
(
flatpak_installed_ref_get_origin
(
ref
));
auto
source
=
findSource
(
installation
,
origin
);
if
(
source
)
{
...
...
@@ -410,6 +412,9 @@ FlatpakResource *FlatpakBackend::getAppForInstalledRef(FlatpakInstallation *inst
resource
->
setState
(
AbstractResource
::
Installed
);
source
->
addResource
(
resource
);
if
(
freshResource
)
*
freshResource
=
true
;
Q_ASSERT
(
resource
->
uniqueId
()
==
idForInstalledRef
(
ref
,
{})
||
resource
->
uniqueId
()
==
idForInstalledRef
(
ref
,
{
".desktop"
}));
return
resource
;
}
...
...
@@ -1287,12 +1292,13 @@ ResultsStream *FlatpakBackend::search(const AbstractResourcesBackend::Filters &f
for
(
auto
it
=
refs
.
constBegin
(),
itEnd
=
refs
.
constEnd
();
it
!=
itEnd
;
++
it
)
{
resources
.
reserve
(
resources
.
size
()
+
it
->
size
());
for
(
auto
ref
:
qAsConst
(
it
.
value
()))
{
auto
resource
=
getAppForInstalledRef
(
it
.
key
(),
ref
);
bool
fresh
;
auto
resource
=
getAppForInstalledRef
(
it
.
key
(),
ref
,
&
fresh
);
#if FLATPAK_CHECK_VERSION(1, 1, 2)
resource
->
setAvailableVersion
(
QString
::
fromUtf8
(
flatpak_installed_ref_get_appdata_version
(
ref
)));
#endif
g_object_unref
(
ref
);
resource
->
setState
(
AbstractResource
::
Upgradeable
);
resource
->
setState
(
AbstractResource
::
Upgradeable
,
!
fresh
);
updateAppSize
(
resource
);
if
(
resource
->
resourceType
()
==
FlatpakResource
::
Runtime
)
{
resources
.
prepend
(
resource
);
...
...
libdiscover/backends/FlatpakBackend/FlatpakBackend.h
View file @
4a874a63
...
...
@@ -64,7 +64,7 @@ public:
void
addSourceFromFlatpakRepo
(
const
QUrl
&
url
,
ResultsStream
*
stream
);
void
addAppFromFlatpakBundle
(
const
QUrl
&
url
,
ResultsStream
*
stream
);
void
addAppFromFlatpakRef
(
const
QUrl
&
url
,
ResultsStream
*
stream
);
FlatpakResource
*
getAppForInstalledRef
(
FlatpakInstallation
*
flatpakInstallation
,
FlatpakInstalledRef
*
ref
)
const
;
FlatpakResource
*
getAppForInstalledRef
(
FlatpakInstallation
*
flatpakInstallation
,
FlatpakInstalledRef
*
ref
,
bool
*
freshResource
=
nullptr
)
const
;
FlatpakSourcesBackend
*
sources
()
const
{
...
...
libdiscover/backends/FlatpakBackend/FlatpakResource.cpp
View file @
4a874a63
...
...
@@ -537,12 +537,12 @@ void FlatpakResource::setRuntime(const QString &runtime)
setPropertyState
(
RequiredRuntime
,
AlreadyKnown
);
}
void
FlatpakResource
::
setState
(
AbstractResource
::
State
state
)
void
FlatpakResource
::
setState
(
AbstractResource
::
State
state
,
bool
shouldEmit
)
{
if
(
m_state
!=
state
)
{
m_state
=
state
;
if
(
qobject_cast
<
FlatpakBackend
*>
(
backend
())
->
isTracked
(
this
))
{
if
(
shouldEmit
&&
qobject_cast
<
FlatpakBackend
*>
(
backend
())
->
isTracked
(
this
))
{
Q_EMIT
stateChanged
();
}
}
...
...
libdiscover/backends/FlatpakBackend/FlatpakResource.h
View file @
4a874a63
...
...
@@ -149,7 +149,7 @@ public:
void
setPropertyState
(
PropertyKind
kind
,
PropertyState
state
);
void
setResourceFile
(
const
QUrl
&
url
);
void
setRuntime
(
const
QString
&
runtime
);
void
setState
(
State
state
);
void
setState
(
State
state
,
bool
shouldEmit
=
false
);
void
setType
(
ResourceType
type
);
void
setResourceLocation
(
const
QUrl
&
location
)
{
...
...
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