Merge branch 'master' into plasma/declarative
This commit is contained in:
commit
c2220c96f5
@ -142,11 +142,6 @@ DataModel::DataModel(QObject* parent)
|
||||
this, SIGNAL(countChanged()));
|
||||
connect(this, SIGNAL(modelReset()),
|
||||
this, SIGNAL(countChanged()));
|
||||
|
||||
m_roleNamesTimer = new QTimer(this);
|
||||
m_roleNamesTimer->setSingleShot(true);
|
||||
connect(m_roleNamesTimer, SIGNAL(timeout()),
|
||||
this, SLOT(syncRoleNames()));
|
||||
}
|
||||
|
||||
DataModel::~DataModel()
|
||||
@ -285,11 +280,6 @@ void DataModel::setItems(const QString &sourceName, const QVariantList &list)
|
||||
setRoleNames(m_roleNames);
|
||||
}
|
||||
|
||||
m_roleNamesTimer->start(0);
|
||||
}
|
||||
|
||||
void DataModel::syncRoleNames()
|
||||
{
|
||||
setRoleNames(m_roleNames);
|
||||
|
||||
//make the declarative view reload everything,
|
||||
|
@ -137,13 +137,11 @@ Q_SIGNALS:
|
||||
private Q_SLOTS:
|
||||
void dataUpdated(const QString &sourceName, const Plasma::DataEngine::Data &data);
|
||||
void removeSource(const QString &sourceName);
|
||||
void syncRoleNames();
|
||||
|
||||
private:
|
||||
DataSource *m_dataSource;
|
||||
QString m_keyRoleFilter;
|
||||
QString m_sourceFilter;
|
||||
QTimer *m_roleNamesTimer;
|
||||
QMap<QString, QVector<QVariant> > m_items;
|
||||
QHash<int, QByteArray> m_roleNames;
|
||||
QHash<QString, int> m_roleIds;
|
||||
|
@ -40,7 +40,7 @@ DataSource::DataSource(QObject* parent)
|
||||
connect(this, SIGNAL(engineChanged()),
|
||||
this, SLOT(setupData()));
|
||||
connect(this, SIGNAL(connectedSourcesChanged()),
|
||||
this, SLOT(setupData()));
|
||||
this, SLOT(setupData()), Qt::QueuedConnection);
|
||||
connect(this, SIGNAL(intervalChanged()),
|
||||
this, SLOT(setupData()));
|
||||
}
|
||||
@ -96,7 +96,8 @@ void DataSource::setupData()
|
||||
m_dataEngine->disconnectSource(source, this);
|
||||
}
|
||||
}
|
||||
//FIXME: delete all?
|
||||
|
||||
qDeleteAll(m_services);
|
||||
m_services.clear();
|
||||
|
||||
m_dataEngine = dataEngine(m_engine);
|
||||
@ -145,6 +146,8 @@ void DataSource::dataUpdated(const QString &sourceName, const Plasma::DataEngine
|
||||
|
||||
emit dataChanged();
|
||||
emit newData(sourceName, data);
|
||||
} else if (m_dataEngine) {
|
||||
m_dataEngine->disconnectSource(sourceName, this);
|
||||
}
|
||||
}
|
||||
|
||||
@ -157,12 +160,17 @@ void DataSource::removeSource(const QString &source)
|
||||
emit sourceDisconnected(source);
|
||||
emit connectedSourcesChanged();
|
||||
}
|
||||
|
||||
if (m_dataEngine) {
|
||||
m_connectedSources.removeAll(source);
|
||||
m_newSources.removeAll(source);
|
||||
m_oldSources.removeAll(source);
|
||||
//TODO: delete it?
|
||||
m_services.remove(source);
|
||||
|
||||
QHash<QString, Plasma::Service *>::iterator it = m_services.find(source);
|
||||
if (it != m_services.end()) {
|
||||
delete it.value();
|
||||
m_services.erase(it);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -108,7 +108,7 @@ private:
|
||||
QStringList m_oldSources;
|
||||
QStringList m_newSources;
|
||||
Changes m_changes;
|
||||
QHash <QString, Plasma::Service *> m_services;
|
||||
QHash<QString, Plasma::Service *> m_services;
|
||||
};
|
||||
Q_DECLARE_OPERATORS_FOR_FLAGS(DataSource::Changes)
|
||||
}
|
||||
|
@ -48,6 +48,7 @@ AppletInterface::AppletInterface(AbstractJsAppletScript *parent)
|
||||
connect(this, SIGNAL(releaseVisualFocus()), applet(), SIGNAL(releaseVisualFocus()));
|
||||
connect(this, SIGNAL(configNeedsSaving()), applet(), SIGNAL(configNeedsSaving()));
|
||||
connect(applet(), SIGNAL(immutabilityChanged(Plasma::ImmutabilityType)), this, SIGNAL(immutableChanged()));
|
||||
connect(applet(), SIGNAL(newStatus(Plasma::ItemStatus)), this, SIGNAL(statusChanged()));
|
||||
}
|
||||
|
||||
AppletInterface::~AppletInterface()
|
||||
@ -383,6 +384,16 @@ QString AppletInterface::associatedApplication() const
|
||||
return applet()->associatedApplication();
|
||||
}
|
||||
|
||||
void AppletInterface::setStatus(const AppletInterface::ItemStatus &status)
|
||||
{
|
||||
applet()->setStatus((Plasma::ItemStatus)status);
|
||||
}
|
||||
|
||||
AppletInterface::ItemStatus AppletInterface::status() const
|
||||
{
|
||||
return (AppletInterface::ItemStatus)((int)(applet()->status()));
|
||||
}
|
||||
|
||||
void AppletInterface::gc()
|
||||
{
|
||||
QTimer::singleShot(0, m_appletScriptEngine, SLOT(collectGarbage()));
|
||||
|
@ -64,6 +64,7 @@ class AppletInterface : public QObject
|
||||
Q_ENUMS(AnimationDirection)
|
||||
Q_ENUMS(IntervalAlignment)
|
||||
Q_ENUMS(ThemeColors)
|
||||
Q_ENUMS(ItemStatus)
|
||||
Q_PROPERTY(AspectRatioMode aspectRatioMode READ aspectRatioMode WRITE setAspectRatioMode)
|
||||
Q_PROPERTY(FormFactor formFactor READ formFactor NOTIFY formFactorChanged)
|
||||
Q_PROPERTY(Location location READ location NOTIFY locationChanged)
|
||||
@ -75,6 +76,7 @@ class AppletInterface : public QObject
|
||||
Q_PROPERTY(bool immutable READ immutable NOTIFY immutableChanged)
|
||||
Q_PROPERTY(bool userConfiguring READ userConfiguring) // @since 4.5
|
||||
Q_PROPERTY(int apiVersion READ apiVersion CONSTANT)
|
||||
Q_PROPERTY(ItemStatus status READ status WRITE setStatus NOTIFY statusChanged)
|
||||
Q_PROPERTY(QRectF rect READ rect)
|
||||
Q_PROPERTY(QSizeF size READ size)
|
||||
Q_PROPERTY(QString associatedApplication WRITE setAssociatedApplication READ associatedApplication)
|
||||
@ -128,6 +130,14 @@ enum AspectRatioMode {
|
||||
FixedSize = 4 /** The applet cannot be resized */
|
||||
};
|
||||
|
||||
enum ItemStatus {
|
||||
UnknownStatus = 0, /**< The status is unknown **/
|
||||
PassiveStatus = 1, /**< The Item is passive **/
|
||||
ActiveStatus = 2, /**< The Item is active **/
|
||||
NeedsAttentionStatus = 3, /**< The Item needs attention **/
|
||||
AcceptingInputStatus = 4 /**< The Item is accepting input **/
|
||||
};
|
||||
|
||||
//From Qt namespace
|
||||
enum QtModifiers {
|
||||
QtNoModifier = Qt::NoModifier,
|
||||
@ -220,6 +230,7 @@ enum IntervalAlignment {
|
||||
AlignToMinute,
|
||||
AlignToHour
|
||||
};
|
||||
|
||||
//-------------------------------------------------------------------
|
||||
|
||||
Q_INVOKABLE void gc();
|
||||
@ -289,6 +300,9 @@ enum IntervalAlignment {
|
||||
void setAssociatedApplication(const QString &string);
|
||||
QString associatedApplication() const;
|
||||
|
||||
void setStatus(const ItemStatus &status);
|
||||
ItemStatus status() const;
|
||||
|
||||
Q_SIGNALS:
|
||||
void releaseVisualFocus();
|
||||
void configNeedsSaving();
|
||||
@ -297,6 +311,7 @@ Q_SIGNALS:
|
||||
void locationChanged();
|
||||
void contextChanged();
|
||||
void immutableChanged();
|
||||
void statusChanged();
|
||||
|
||||
protected:
|
||||
AbstractJsAppletScript *m_appletScriptEngine;
|
||||
|
Loading…
Reference in New Issue
Block a user