D25580: [System Tray] Unified data model for System Tray items

Nicolas Fella noreply at phabricator.kde.org
Sun Dec 8 22:01:36 GMT 2019


nicolasfella added a comment.


  Looks very good in general. A few style nitpicks

INLINE COMMENTS

> ConfigEntries.qml:68
>          var list = [];
> -        for (var i = 0; i < statusNotifierModel.count; ++i) {
> -            var item = statusNotifierModel.get(i);
> -            list.push({
> -                "index": i,
> -                "taskId": item.Id,
> -                "name": item.Title,
> -                "iconName": item.IconName,
> -                "icon": item.Icon
> -            });
> -        }
> -        var lastIndex = list.length;
> -        for (var i = 0; i < plasmoid.applets.length; ++i) {
> -            var item = plasmoid.applets[i]
> +        for (var i = 0; i < systemTrayModel.count; i++) {
> +            var item = systemTrayModel.get(i);

You can try doing

  for (item of systemTrayModel) {
  ]

But I don't know if that will work

> systemtraymodel.cpp:60
> +
> +    roles.insert(static_cast<int>(BaseRole::ItemType), QByteArrayLiteral("itemType"));
> +    roles.insert(static_cast<int>(BaseRole::ItemId), QByteArrayLiteral("itemId"));

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

> systemtraymodel.cpp:74
> +    QStandardItem *dataItem = nullptr;
> +    for (int i = 0; i < rowCount(); i++) {
> +        QStandardItem *currentItem = item(i);

This could be a candidate for std::find_if

> systemtraymodel.cpp:153
> +{
> +    if (!m_services.contains(source)) {
> +        Plasma::Service *service = m_dataEngine->serviceForSource(source);

if (contains) {

  return stuff

}

otherStuff()

> systemtraymodel.h:77
> +        Title,
> +        TitleChanged,
> +        ToolTipChanged,

What's the purpose of the *Changed roles?

REPOSITORY
  R120 Plasma Workspace

REVISION DETAIL
  https://phabricator.kde.org/D25580

To: kmaterka, #plasma, broulik, ngraham
Cc: plasma-devel, nicolasfella, anthonyfieroni, LeGast00n, The-Feren-OS-Dev, jraleigh, fbampaloukas, GB_2, ragreen, ZrenBot, ngraham, alexeymin, himcesjf, lesliezhai, ali-mohamed, jensreuterberg, abetts, sebas, apol, ahiemstra, mart
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.kde.org/pipermail/plasma-devel/attachments/20191208/46bb3e86/attachment-0001.html>


More information about the Plasma-devel mailing list