add properties for tooltips metadata

This commit is contained in:
Marco Martin 2014-02-06 18:49:28 +01:00
parent cab11dd7f8
commit ab140c8c1e
2 changed files with 60 additions and 0 deletions

View File

@ -171,6 +171,44 @@ void AppletInterface::setTitle(const QString &title)
emit titleChanged();
}
QString AppletInterface::toolTipMainText() const
{
if (m_toolTipMainText.isNull()) {
return title();
} else {
return m_toolTipMainText;
}
}
void AppletInterface::setToolTipMainText(const QString &text)
{
if (m_toolTipMainText == text) {
return;
}
m_toolTipMainText = text;
emit toolTipMainTextChanged();
}
QString AppletInterface::toolTipSubText() const
{
if (m_toolTipMainText.isNull()) {
return applet()->pluginInfo().comment();
} else {
return m_toolTipSubText;
}
}
void AppletInterface::setToolTipSubText(const QString &text)
{
if (m_toolTipSubText == text) {
return;
}
m_toolTipSubText = text;
emit toolTipSubTextChanged();
}
bool AppletInterface::isBusy() const
{
return m_busy;

View File

@ -67,6 +67,18 @@ class AppletInterface : public AppletQuickItem
*/
Q_PROPERTY(QString title READ title WRITE setTitle NOTIFY titleChanged)
/**
* Main title for the plasmoid tooltip or other means of quick information:
* it's the same as the title property by default, but it can be personalized
*/
Q_PROPERTY(QString toolTipMainText READ toolTipMainText WRITE setToolTipMainText NOTIFY toolTipMainTextChanged)
/**
* Description for the plasmoid tooltip or other means of quick information:
* it comes from the pluginifo comment by default, but it can be personalized
*/
Q_PROPERTY(QString toolTipSubText READ toolTipSubText WRITE setToolTipSubText NOTIFY toolTipSubTextChanged)
/**
* Icon to represent the plasmoid
*/
@ -230,6 +242,12 @@ public:
QString title() const;
void setTitle(const QString &title);
QString toolTipMainText() const;
void setToolTipMainText(const QString &text);
QString toolTipSubText() const;
void setToolTipSubText(const QString &text);
uint id() const;
Plasma::Types::FormFactor formFactor() const;
@ -278,6 +296,8 @@ Q_SIGNALS:
//PROPERTY change notifiers--------------
void iconChanged();
void titleChanged();
void toolTipMainTextChanged();
void toolTipSubTextChanged();
void formFactorChanged();
void locationChanged();
void contextChanged();
@ -307,6 +327,8 @@ private:
//UI-specific members ------------------
QString m_toolTipMainText;
QString m_toolTipSubText;
Plasma::Types::BackgroundHints m_backgroundHints;
bool m_busy : 1;
bool m_hideOnDeactivate : 1;