check for slot existence before connecting or disconnecting
since this is a blind connect to a slot that may exist or not exist, the new syntax can't be used, but check for the slot existence before attempting a connection BUG:354751
This commit is contained in:
parent
4519c25d5c
commit
c8b9b852ef
@ -83,14 +83,8 @@ void PlasmaComponentsPlugin::registerTypes(const char *uri)
|
||||
{
|
||||
Q_ASSERT(uri == QLatin1String("org.kde.plasma.components"));
|
||||
|
||||
//platform specific c++ components
|
||||
const QString target = KDeclarative::KDeclarative::componentsTarget();
|
||||
if (target == KDeclarative::KDeclarative::defaultComponentsTarget()) {
|
||||
qmlRegisterType<QMenuProxy>(uri, 2, 0, "Menu");
|
||||
qmlRegisterType<QMenuItem>(uri, 2, 0, "MenuItem");
|
||||
} else {
|
||||
// qmlRegisterType<FullScreenSheet>(uri, 2, 0, "Sheet");
|
||||
}
|
||||
|
||||
qmlRegisterType<Plasma::QRangeModel>(uri, 2, 0, "RangeModel");
|
||||
|
||||
|
@ -131,8 +131,10 @@ void DataContainer::connectVisualization(QObject *visualization, uint pollingInt
|
||||
disconnect(relay, SIGNAL(dataUpdated(QString,Plasma::DataEngine::Data)),
|
||||
visualization, SLOT(dataUpdated(QString,Plasma::DataEngine::Data)));
|
||||
//modelChanged is always emitted by the dataSource since there is no polling there
|
||||
if (visualization->metaObject()->indexOfMethod(QMetaObject::normalizedSignature("modelChanged(QString,QAbstractItemModel*)"))) {
|
||||
disconnect(this, SIGNAL(modelChanged(QString,QAbstractItemModel*)),
|
||||
visualization, SLOT(modelChanged(QString,QAbstractItemModel*)));
|
||||
}
|
||||
//relay->isUnused();
|
||||
}
|
||||
} else if (pollingInterval < 1) {
|
||||
@ -144,9 +146,11 @@ void DataContainer::connectVisualization(QObject *visualization, uint pollingInt
|
||||
} else {
|
||||
disconnect(this, SIGNAL(dataUpdated(QString,Plasma::DataEngine::Data)),
|
||||
visualization, SLOT(dataUpdated(QString,Plasma::DataEngine::Data)));
|
||||
if (visualization->metaObject()->indexOfMethod(QMetaObject::normalizedSignature("modelChanged(QString,QAbstractItemModel*)"))) {
|
||||
disconnect(this, SIGNAL(modelChanged(QString,QAbstractItemModel*)),
|
||||
visualization, SLOT(modelChanged(QString,QAbstractItemModel*)));
|
||||
}
|
||||
}
|
||||
} else {
|
||||
connect(visualization, SIGNAL(destroyed(QObject*)),
|
||||
this, SLOT(disconnectVisualization(QObject*))); //, Qt::QueuedConnection);
|
||||
@ -174,10 +178,12 @@ void DataContainer::connectVisualization(QObject *visualization, uint pollingInt
|
||||
connect(relay, SIGNAL(dataUpdated(QString,Plasma::DataEngine::Data)),
|
||||
visualization, SLOT(dataUpdated(QString,Plasma::DataEngine::Data)));
|
||||
//modelChanged is always emitted by the dataSource since there is no polling there
|
||||
if (visualization->metaObject()->indexOfMethod(QMetaObject::normalizedSignature("modelChanged(QString,QAbstractItemModel*)"))) {
|
||||
connect(this, SIGNAL(modelChanged(QString,QAbstractItemModel*)),
|
||||
visualization, SLOT(modelChanged(QString,QAbstractItemModel*)));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void DataContainer::setStorageEnabled(bool store)
|
||||
{
|
||||
@ -305,8 +311,10 @@ void DataContainer::disconnectVisualization(QObject *visualization)
|
||||
// it is connected directly to the DataContainer itself
|
||||
disconnect(this, SIGNAL(dataUpdated(QString,Plasma::DataEngine::Data)),
|
||||
visualization, SLOT(dataUpdated(QString,Plasma::DataEngine::Data)));
|
||||
if (visualization->metaObject()->indexOfMethod(QMetaObject::normalizedSignature("modelChanged(QString,QAbstractItemModel*)"))) {
|
||||
disconnect(this, SIGNAL(modelChanged(QString,QAbstractItemModel*)),
|
||||
visualization, SLOT(modelChanged(QString,QAbstractItemModel*)));
|
||||
}
|
||||
} else {
|
||||
SignalRelay *relay = objIt.value();
|
||||
|
||||
@ -317,10 +325,12 @@ void DataContainer::disconnectVisualization(QObject *visualization)
|
||||
disconnect(relay, SIGNAL(dataUpdated(QString,Plasma::DataEngine::Data)),
|
||||
visualization, SLOT(dataUpdated(QString,Plasma::DataEngine::Data)));
|
||||
//modelChanged is always emitted by the dataSource since there is no polling there
|
||||
if (visualization->metaObject()->indexOfMethod(QMetaObject::normalizedSignature("modelChanged(QString,QAbstractItemModel*)"))) {
|
||||
disconnect(this, SIGNAL(modelChanged(QString,QAbstractItemModel*)),
|
||||
visualization, SLOT(modelChanged(QString,QAbstractItemModel*)));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
d->relayObjects.erase(objIt);
|
||||
d->checkUsage();
|
||||
|
Loading…
Reference in New Issue
Block a user