[System Tray] Unified data model for System Tray items
Needs ReviewPublic

Authored by kmaterka on Wed, Nov 27, 9:10 PM.

Details

Reviewers
broulik
ngraham
Group Reviewers
Plasma
Summary

Currently there are two different sources of SystemTray items:

  • Plasmoids
  • Status Notifier

Thi change adds new model that holds both Plasmoids and SNIs.

Test Plan

Add/disable applets. Start/stop SNI app.

Diff Detail

Repository
R120 Plasma Workspace
Branch
master
Lint
No Linters Available
Unit
No Unit Test Coverage
Build Status
Buildable 19671
Build 19689: arc lint + arc unit
kmaterka requested review of this revision.Wed, Nov 27, 9:10 PM
kmaterka created this revision.

This is a simplified version of D23413 needed for the D22176 to move forward.

Looks very good in general. A few style nitpicks

applets/systemtray/package/contents/ui/ConfigEntries.qml
68–72

You can try doing

for (item of systemTrayModel) {
]

But I don't know if that will work

applets/systemtray/systemtraymodel.cpp
61

roles.insert(ItemType, ...) should be enough

75

This could be a candidate for std::find_if

154

if (contains) {

return stuff

}

otherStuff()

applets/systemtray/systemtraymodel.h
78

What's the purpose of the *Changed roles?

kmaterka marked 5 inline comments as done.Tue, Dec 10, 9:11 PM
kmaterka added inline comments.
applets/systemtray/package/contents/ui/ConfigEntries.qml
68–72

Unfortunately model is not iterable. This code will be removed in D22176 anyway.

applets/systemtray/systemtraymodel.cpp
61

I'm using enum class instead of simple enum, so explicit cast is required.

75

It would be nice, but does QStandardItemModel have an iterator?

154

OK, changed.

applets/systemtray/systemtraymodel.h
78

All of these roles are copied from StatusNotifierItemSource. It might be an overkill to support all.
I don't know exactly what was the intention to use "*Changed" roles, there is only one comment: // record what has changed. I found usages in old KDE4 code:

./kde4/kde-workspace/plasma-workspace/applets/systemtray/plugin/protocols/dbussystemtray/dbussystemtraytask.cpp

void DBusSystemTrayTask::dataUpdated(const QString &taskName, const Plasma::DataEngine::Data &properties)
{
    // ....
    if (properties["TitleChanged"].toBool() || becomeValid) {
        QString title = properties["Title"].toString();
        // ...
    }
    // ...
kmaterka updated this revision to Diff 71231.Tue, Dec 10, 9:11 PM
kmaterka marked 5 inline comments as done.

Review fix

kmaterka updated this revision to Diff 71232.Tue, Dec 10, 9:18 PM

Review fix