void DBusSystemTrayTask::dataUpdated(const QString &taskName, const Plasma::DataEngine::Data &properties)
{
    Q_UNUSED(taskName);

    const QString oldTypeId = m_typeId;

    QString cat = properties["Category"].toString();
    if (!cat.isEmpty()) {
        int index = metaObject()->indexOfEnumerator("Category");
        int key = metaObject()->enumerator(index).keyToValue(cat.toLatin1());

        if (key != -1) {
            setCategory((Task::Category)key);
        }
    }

    if (properties["TitleChanged"].toBool()) {
        QString m_title = properties["Title"].toString();
        if (!m_title.isEmpty()) {
            m_name = m_title;

            if (m_typeId.isEmpty()) {
                m_typeId = m_title;
            }
        }
    }

    /*
    kDebug() << m_name
    << "status:" << properties["StatusChanged"].toBool() << "title:" <<  properties["TitleChanged"].toBool()
    << "icons:" << properties["IconsChanged"].toBool() << "tooltip:" << properties["ToolTipChanged"].toBool();
    */

    QString id = properties["Id"].toString();
    if (!id.isEmpty()) {
        m_typeId = id;
    }

    if (properties["IconsChanged"].toBool()) {
        syncIcons(properties);
    }

    if (properties["StatusChanged"].toBool()) {
        syncStatus(properties["Status"].toString());
    }

    if (properties["ToolTipChanged"].toBool()) {
        syncToolTip(properties["ToolTipTitle"].toString(),
                    properties["ToolTipSubTitle"].toString(),
                    properties["ToolTipIcon"].value<QIcon>());
    }

    foreach (QGraphicsWidget *widget, widgetsByHost()) {
        DBusSystemTrayWidget *iconWidget = qobject_cast<DBusSystemTrayWidget *>(widget);
        if (iconWidget) {
            iconWidget->setItemIsMenu(properties["ItemIsMenu"].toBool());
        }
    }
Beispiel #2
0
void LauncherBase::fsmSyncedEntry()
{
    syncStatus();
}