Rearrange ConversationListModel to not set deviceID when it has been determined to be invalid

This commit is contained in:
Simon Redman 2019-05-05 12:11:23 -06:00
parent 4a4e06f12b
commit 9447d7e5de

View file

@ -70,9 +70,6 @@ void ConversationListModel::setDeviceId(const QString& deviceId)
m_conversationsInterface = nullptr;
}
m_deviceId = deviceId;
Q_EMIT deviceIdChanged();
// This method still gets called *with a valid deviceID* when the device is not connected while the component is setting up
// Detect that case and don't do anything.
DeviceDbusInterface device(deviceId);
@ -80,6 +77,9 @@ void ConversationListModel::setDeviceId(const QString& deviceId)
return;
}
m_deviceId = deviceId;
Q_EMIT deviceIdChanged();
m_conversationsInterface = new DeviceConversationsDbusInterface(deviceId, this);
connect(m_conversationsInterface, SIGNAL(conversationCreated(QVariantMap)), this, SLOT(handleCreatedConversation(QVariantMap)));
connect(m_conversationsInterface, SIGNAL(conversationUpdated(QVariantMap)), this, SLOT(handleConversationUpdated(QVariantMap)));