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
0c1c5a16
Commit
0c1c5a16
authored
Jan 08, 2018
by
Aleix Pol Gonzalez
🐧
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Use update-high as the updates page icon if there's security updates
BUG: 381170
parent
91fa0231
Changes
6
Hide whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
36 additions
and
4 deletions
+36
-4
discover/qml/DiscoverWindow.qml
discover/qml/DiscoverWindow.qml
+1
-1
libdiscover/backends/PackageKitBackend/PackageKitBackend.cpp
libdiscover/backends/PackageKitBackend/PackageKitBackend.cpp
+14
-3
libdiscover/backends/PackageKitBackend/PackageKitBackend.h
libdiscover/backends/PackageKitBackend/PackageKitBackend.h
+2
-0
libdiscover/resources/AbstractResourcesBackend.h
libdiscover/resources/AbstractResourcesBackend.h
+6
-0
libdiscover/resources/ResourcesModel.cpp
libdiscover/resources/ResourcesModel.cpp
+11
-0
libdiscover/resources/ResourcesModel.h
libdiscover/resources/ResourcesModel.h
+2
-0
No files found.
discover/qml/DiscoverWindow.qml
View file @
0c1c5a16
...
...
@@ -69,7 +69,7 @@ Kirigami.ApplicationWindow
}
TopLevelPageData
{
id
:
updateAction
iconName
:
ResourcesModel
.
updatesCount
>
0
?
"
update-low
"
:
"
update-none
"
iconName
:
ResourcesModel
.
updatesCount
>
0
?
ResourcesModel
.
hasSecurityUpdates
?
"
update-high
"
:
"
update-low
"
:
"
update-none
"
text
:
ResourcesModel
.
updatesCount
<=
0
?
(
ResourcesModel
.
isFetching
?
i18n
(
"
Checking for updates...
"
)
:
i18n
(
"
No Updates
"
)
)
:
i18nc
(
"
Update section name
"
,
"
Update (%1)
"
,
ResourcesModel
.
updatesCount
)
component
:
topUpdateComp
objectName
:
"
update
"
...
...
libdiscover/backends/PackageKitBackend/PackageKitBackend.cpp
View file @
0c1c5a16
...
...
@@ -246,6 +246,7 @@ void PackageKitBackend::fetchUpdates()
connect
(
tUpdates
,
&
PackageKit
::
Transaction
::
package
,
this
,
&
PackageKitBackend
::
addPackageToUpdate
);
connect
(
tUpdates
,
&
PackageKit
::
Transaction
::
errorCode
,
this
,
&
PackageKitBackend
::
transactionError
);
m_updatesPackageId
.
clear
();
m_hasSecurityUpdates
=
false
;
m_updater
->
setProgressing
(
true
);
}
...
...
@@ -417,6 +418,11 @@ ResultsStream * PackageKitBackend::findResourceByPackageName(const QUrl& url)
return
new
ResultsStream
(
QStringLiteral
(
"PackageKitStream-url"
),
pkg
?
QVector
<
AbstractResource
*>
{
pkg
}
:
QVector
<
AbstractResource
*>
{});
}
bool
PackageKitBackend
::
hasSecurityUpdates
()
const
{
return
m_hasSecurityUpdates
;
}
int
PackageKitBackend
::
updatesCount
()
const
{
return
m_updatesPackageId
.
count
();
...
...
@@ -478,10 +484,15 @@ QSet<AbstractResource*> PackageKitBackend::upgradeablePackages() const
void
PackageKitBackend
::
addPackageToUpdate
(
PackageKit
::
Transaction
::
Info
info
,
const
QString
&
packageId
,
const
QString
&
summary
)
{
if
(
info
!=
PackageKit
::
Transaction
::
InfoBlocked
)
{
m_updatesPackageId
+=
packageId
;
addPackage
(
info
,
packageId
,
summary
,
true
);
if
(
info
==
PackageKit
::
Transaction
::
InfoBlocked
)
{
return
;
}
if
(
info
==
PackageKit
::
Transaction
::
InfoSecurity
)
m_hasSecurityUpdates
=
true
;
m_updatesPackageId
+=
packageId
;
addPackage
(
info
,
packageId
,
summary
,
true
);
}
void
PackageKitBackend
::
getUpdatesFinished
(
PackageKit
::
Transaction
::
Exit
,
uint
)
...
...
libdiscover/backends/PackageKitBackend/PackageKitBackend.h
View file @
0c1c5a16
...
...
@@ -50,6 +50,7 @@ class DISCOVERCOMMON_EXPORT PackageKitBackend : public AbstractResourcesBackend
ResultsStream
*
search
(
const
AbstractResourcesBackend
::
Filters
&
search
)
override
;
ResultsStream
*
findResourceByPackageName
(
const
QUrl
&
search
)
override
;
int
updatesCount
()
const
override
;
bool
hasSecurityUpdates
()
const
override
;
Transaction
*
installApplication
(
AbstractResource
*
app
)
override
;
Transaction
*
installApplication
(
AbstractResource
*
app
,
const
AddonList
&
addons
)
override
;
...
...
@@ -107,6 +108,7 @@ class DISCOVERCOMMON_EXPORT PackageKitBackend : public AbstractResourcesBackend
QPointer
<
PackageKit
::
Transaction
>
m_refresher
;
int
m_isFetching
;
QSet
<
QString
>
m_updatesPackageId
;
bool
m_hasSecurityUpdates
=
false
;
QSet
<
PackageKitResource
*>
m_packagesToAdd
;
QSet
<
PackageKitResource
*>
m_packagesToDelete
;
QList
<
QAction
*>
m_messageActions
;
...
...
libdiscover/resources/AbstractResourcesBackend.h
View file @
0c1c5a16
...
...
@@ -76,6 +76,7 @@ class DISCOVERCOMMON_EXPORT AbstractResourcesBackend : public QObject
Q_PROPERTY
(
QString
displayName
READ
displayName
CONSTANT
)
Q_PROPERTY
(
AbstractReviewsBackend
*
reviewsBackend
READ
reviewsBackend
CONSTANT
)
Q_PROPERTY
(
int
updatesCount
READ
updatesCount
NOTIFY
updatesCountChanged
)
Q_PROPERTY
(
bool
hasSecurityUpdates
READ
hasSecurityUpdates
NOTIFY
updatesCountChanged
)
Q_PROPERTY
(
bool
isFetching
READ
isFetching
NOTIFY
fetchingChanged
)
Q_PROPERTY
(
QList
<
QAction
*>
messageActions
READ
messageActions
CONSTANT
)
public:
...
...
@@ -131,6 +132,11 @@ class DISCOVERCOMMON_EXPORT AbstractResourcesBackend : public QObject
*/
virtual
int
updatesCount
()
const
=
0
;
//FIXME: Probably provide a standard implementation?!
/**
* @returns whether either of the updates contains a security fix
*/
virtual
bool
hasSecurityUpdates
()
const
{
return
false
;
}
/**
* Tells whether the backend is fetching resources
*/
...
...
libdiscover/resources/ResourcesModel.cpp
View file @
0c1c5a16
...
...
@@ -174,6 +174,17 @@ int ResourcesModel::updatesCount() const
return
ret
;
}
bool
ResourcesModel
::
hasSecurityUpdates
()
const
{
bool
ret
=
false
;
foreach
(
AbstractResourcesBackend
*
backend
,
m_backends
)
{
ret
|=
backend
->
hasSecurityUpdates
();
}
return
ret
;
}
void
ResourcesModel
::
installApplication
(
AbstractResource
*
app
)
{
TransactionModel
::
global
()
->
addTransaction
(
app
->
backend
()
->
installApplication
(
app
));
...
...
libdiscover/resources/ResourcesModel.h
View file @
0c1c5a16
...
...
@@ -52,6 +52,7 @@ class DISCOVERCOMMON_EXPORT ResourcesModel : public QObject
{
Q_OBJECT
Q_PROPERTY
(
int
updatesCount
READ
updatesCount
NOTIFY
updatesCountChanged
)
Q_PROPERTY
(
bool
hasSecurityUpdates
READ
hasSecurityUpdates
NOTIFY
updatesCountChanged
)
Q_PROPERTY
(
bool
isFetching
READ
isFetching
NOTIFY
fetchingChanged
)
Q_PROPERTY
(
QVariantList
applicationBackends
READ
applicationBackendsVariant
NOTIFY
backendsChanged
)
Q_PROPERTY
(
AbstractResourcesBackend
*
currentApplicationBackend
READ
currentApplicationBackend
WRITE
setCurrentApplicationBackend
NOTIFY
currentApplicationBackendChanged
)
...
...
@@ -65,6 +66,7 @@ class DISCOVERCOMMON_EXPORT ResourcesModel : public QObject
QVector
<
AbstractResourcesBackend
*
>
backends
()
const
;
int
updatesCount
()
const
;
bool
hasSecurityUpdates
()
const
;
bool
isBusy
()
const
;
bool
isFetching
()
const
;
...
...
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