icon in popup, plasmoid exposes icon and title

This commit is contained in:
Marco Martin 2013-02-14 11:15:14 +01:00
parent dc814d02d2
commit 21d96f9dbf
3 changed files with 37 additions and 3 deletions

View File

@ -107,6 +107,26 @@ QString AppletInterface::currentActivity() const
return applet()->containment()->activity();
}
QString AppletInterface::icon() const
{
return applet()->icon();
}
QString AppletInterface::title() const
{
return applet()->title();
}
void AppletInterface::setTitle(const QString &title)
{
if (applet()->title() == title) {
return;
}
applet()->setTitle(title);
emit titleChanged();
}
bool AppletInterface::isBusy() const
{
return m_busy;

View File

@ -52,6 +52,9 @@ class AppletInterface : public QQuickItem
Q_ENUMS(ThemeColors)
Q_ENUMS(ItemStatus)
Q_PROPERTY(QString title READ title WRITE setTitle NOTIFY titleChanged)
//TODO: writable icon
Q_PROPERTY(QString icon READ icon CONSTANT)
Q_PROPERTY(FormFactor formFactor READ formFactor NOTIFY formFactorChanged)
Q_PROPERTY(Location location READ location NOTIFY locationChanged)
Q_PROPERTY(QString currentActivity READ currentActivity NOTIFY contextChanged)
@ -170,6 +173,11 @@ enum IntervalAlignment {
//PROPERTY ACCESSORS-------------------------------------------------------------------
QString icon() const;
QString title() const;
void setTitle(const QString &title);
FormFactor formFactor() const;
Location location() const;
@ -203,6 +211,7 @@ Q_SIGNALS:
void configNeedsSaving();
//PROPERTY change notifiers--------------
void titleChanged();
void formFactorChanged();
void locationChanged();
void contextChanged();

View File

@ -20,12 +20,17 @@ import QtQuick 2.0
import org.kde.plasma.core 0.1 as PlasmaCore
Rectangle {
id: root
color: "darkgreen"
PlasmaCore.IconItem {
id: icon
source: plasmoid.icon ? plasmoid.icon : "plasma"
active: mouseArea.containsMouse
MouseArea {
id: mouseArea
anchors.fill: parent
hoverEnabled: true
onClicked: plasmoid.expanded = !plasmoid.expanded
}
}