From 8599a203eb8a0f8d237f19e101739ed297d3c2d6 Mon Sep 17 00:00:00 2001 From: James Smith Date: Mon, 28 Sep 2015 00:52:48 -0600 Subject: [PATCH 1/2] Fix stale account properties. --- TelepathyQt/account.cpp | 40 ++++++++++++++++++++-------------------- 1 file changed, 20 insertions(+), 20 deletions(-) diff --git TelepathyQt/account.cpp TelepathyQt/account.cpp index f6635e1..26c0766 100644 --- TelepathyQt/account.cpp +++ TelepathyQt/account.cpp @@ -4277,16 +4277,16 @@ void Account::Private::updateProperties(const QVariantMap &props) debug() << " Service Name:" << parent->serviceName(); /* use parent->serviceName() here as if the service name is empty we are going to use the * protocol name */ - emit parent->serviceNameChanged(parent->serviceName()); parent->notify("serviceName"); + emit parent->serviceNameChanged(parent->serviceName()); /* if we had a profile and the service changed, it means the profile also changed */ if (parent->isReady(Account::FeatureProfile)) { /* service name changed, let's recreate profile */ profileChanged = true; profile.reset(); - emit parent->profileChanged(parent->profile()); parent->notify("profile"); + emit parent->profileChanged(parent->profile()); } } @@ -4294,8 +4294,8 @@ void Account::Private::updateProperties(const QVariantMap &props) displayName != qdbus_cast(props[QLatin1String("DisplayName")])) { displayName = qdbus_cast(props[QLatin1String("DisplayName")]); debug() << " Display Name:" << displayName; - emit parent->displayNameChanged(displayName); parent->notify("displayName"); + emit parent->displayNameChanged(displayName); } if ((props.contains(QLatin1String("Icon")) && @@ -4309,8 +4309,8 @@ void Account::Private::updateProperties(const QVariantMap &props) QString newIconName = parent->iconName(); if (oldIconName != newIconName) { debug() << " Icon:" << newIconName; - emit parent->iconNameChanged(newIconName); parent->notify("iconName"); + emit parent->iconNameChanged(newIconName); } } @@ -4318,32 +4318,32 @@ void Account::Private::updateProperties(const QVariantMap &props) nickname != qdbus_cast(props[QLatin1String("Nickname")])) { nickname = qdbus_cast(props[QLatin1String("Nickname")]); debug() << " Nickname:" << nickname; - emit parent->nicknameChanged(nickname); parent->notify("nickname"); + emit parent->nicknameChanged(nickname); } if (props.contains(QLatin1String("NormalizedName")) && normalizedName != qdbus_cast(props[QLatin1String("NormalizedName")])) { normalizedName = qdbus_cast(props[QLatin1String("NormalizedName")]); debug() << " Normalized Name:" << normalizedName; - emit parent->normalizedNameChanged(normalizedName); parent->notify("normalizedName"); + emit parent->normalizedNameChanged(normalizedName); } if (props.contains(QLatin1String("Valid")) && valid != qdbus_cast(props[QLatin1String("Valid")])) { valid = qdbus_cast(props[QLatin1String("Valid")]); debug() << " Valid:" << (valid ? "true" : "false"); - emit parent->validityChanged(valid); parent->notify("valid"); + emit parent->validityChanged(valid); } if (props.contains(QLatin1String("Enabled")) && enabled != qdbus_cast(props[QLatin1String("Enabled")])) { enabled = qdbus_cast(props[QLatin1String("Enabled")]); debug() << " Enabled:" << (enabled ? "true" : "false"); - emit parent->stateChanged(enabled); parent->notify("enabled"); + emit parent->stateChanged(enabled); } if (props.contains(QLatin1String("ConnectAutomatically")) && @@ -4352,8 +4352,8 @@ void Account::Private::updateProperties(const QVariantMap &props) connectsAutomatically = qdbus_cast(props[QLatin1String("ConnectAutomatically")]); debug() << " Connects Automatically:" << (connectsAutomatically ? "true" : "false"); - emit parent->connectsAutomaticallyPropertyChanged(connectsAutomatically); parent->notify("connectsAutomatically"); + emit parent->connectsAutomaticallyPropertyChanged(connectsAutomatically); } if (props.contains(QLatin1String("HasBeenOnline")) && @@ -4364,17 +4364,17 @@ void Account::Private::updateProperties(const QVariantMap &props) // don't emit firstOnline unless we're already ready, that would be // misleading - we'd emit it just before any already-used account // became ready + parent->notify("hasBeenOnline"); if (parent->isReady(Account::FeatureCore)) { emit parent->firstOnline(); } - parent->notify("hasBeenOnline"); } if (props.contains(QLatin1String("Parameters")) && parameters != qdbus_cast(props[QLatin1String("Parameters")])) { parameters = qdbus_cast(props[QLatin1String("Parameters")]); - emit parent->parametersChanged(parameters); parent->notify("parameters"); + emit parent->parametersChanged(parameters); } if (props.contains(QLatin1String("AutomaticPresence")) && @@ -4384,8 +4384,8 @@ void Account::Private::updateProperties(const QVariantMap &props) props[QLatin1String("AutomaticPresence")])); debug() << " Automatic Presence:" << automaticPresence.type() << "-" << automaticPresence.status(); - emit parent->automaticPresenceChanged(automaticPresence); parent->notify("automaticPresence"); + emit parent->automaticPresenceChanged(automaticPresence); } if (props.contains(QLatin1String("CurrentPresence")) && @@ -4395,10 +4395,10 @@ void Account::Private::updateProperties(const QVariantMap &props) props[QLatin1String("CurrentPresence")])); debug() << " Current Presence:" << currentPresence.type() << "-" << currentPresence.status(); - emit parent->currentPresenceChanged(currentPresence); parent->notify("currentPresence"); - emit parent->onlinenessChanged(parent->isOnline()); + emit parent->currentPresenceChanged(currentPresence); parent->notify("online"); + emit parent->onlinenessChanged(parent->isOnline()); } if (props.contains(QLatin1String("RequestedPresence")) && @@ -4408,8 +4408,8 @@ void Account::Private::updateProperties(const QVariantMap &props) props[QLatin1String("RequestedPresence")])); debug() << " Requested Presence:" << requestedPresence.type() << "-" << requestedPresence.status(); - emit parent->requestedPresenceChanged(requestedPresence); parent->notify("requestedPresence"); + emit parent->requestedPresenceChanged(requestedPresence); } if (props.contains(QLatin1String("ChangingPresence")) && @@ -4418,8 +4418,8 @@ void Account::Private::updateProperties(const QVariantMap &props) changingPresence = qdbus_cast( props[QLatin1String("ChangingPresence")]); debug() << " Changing Presence:" << changingPresence; - emit parent->changingPresence(changingPresence); parent->notify("changingPresence"); + emit parent->changingPresence(changingPresence); } if (props.contains(QLatin1String("Connection"))) { @@ -4512,9 +4512,9 @@ void Account::Private::updateProperties(const QVariantMap &props) checkCapabilitiesChanged(profileChanged); - emit parent->connectionStatusChanged(connectionStatus); parent->notify("connectionError"); parent->notify("connectionErrorDetails"); + emit parent->connectionStatusChanged(connectionStatus); } else { connectionStatusChanged = false; } @@ -4546,9 +4546,9 @@ bool Account::Private::processConnQueue() debug() << "Dropping connection for account" << parent->objectPath(); connection.reset(); - emit parent->connectionChanged(connection); parent->notify("connection"); parent->notify("connectionObjectPath"); + emit parent->connectionChanged(connection); } connObjPathQueue.dequeue(); @@ -4657,8 +4657,8 @@ void Account::gotAvatar(QDBusPendingCallWatcher *watcher) mPriv->readinessHelper->setIntrospectCompleted(FeatureAvatar, true); } - emit avatarChanged(mPriv->avatar); notify("avatar"); + emit avatarChanged(mPriv->avatar); } else { // check if the feature is already there, and for some reason retrieveAvatar // failed when called the second time @@ -4737,9 +4737,9 @@ void Account::onConnectionBuilt(PendingOperation *op) if (!mPriv->connection.isNull()) { mPriv->connection.reset(); - emit connectionChanged(mPriv->connection); notify("connection"); notify("connectionObjectPath"); + emit connectionChanged(mPriv->connection); } } else { ConnectionPtr prevConn = mPriv->connection; -- 2.10.2 From e6e6701940a618949ee1601ccbb28b1b80a101f3 Mon Sep 17 00:00:00 2001 From: "James D. Smith" Date: Tue, 13 Dec 2016 20:57:19 -0700 Subject: [PATCH 2/2] Change the order that the presence-related properties occur in. --- TelepathyQt/account.cpp | 90 ++++++++++++++++++++++++------------------------- 1 file changed, 45 insertions(+), 45 deletions(-) diff --git TelepathyQt/account.cpp TelepathyQt/account.cpp index 26c0766..f165551 100644 --- TelepathyQt/account.cpp +++ TelepathyQt/account.cpp @@ -4377,51 +4377,6 @@ void Account::Private::updateProperties(const QVariantMap &props) emit parent->parametersChanged(parameters); } - if (props.contains(QLatin1String("AutomaticPresence")) && - automaticPresence.barePresence() != qdbus_cast( - props[QLatin1String("AutomaticPresence")])) { - automaticPresence = Presence(qdbus_cast( - props[QLatin1String("AutomaticPresence")])); - debug() << " Automatic Presence:" << automaticPresence.type() << - "-" << automaticPresence.status(); - parent->notify("automaticPresence"); - emit parent->automaticPresenceChanged(automaticPresence); - } - - if (props.contains(QLatin1String("CurrentPresence")) && - currentPresence.barePresence() != qdbus_cast( - props[QLatin1String("CurrentPresence")])) { - currentPresence = Presence(qdbus_cast( - props[QLatin1String("CurrentPresence")])); - debug() << " Current Presence:" << currentPresence.type() << - "-" << currentPresence.status(); - parent->notify("currentPresence"); - emit parent->currentPresenceChanged(currentPresence); - parent->notify("online"); - emit parent->onlinenessChanged(parent->isOnline()); - } - - if (props.contains(QLatin1String("RequestedPresence")) && - requestedPresence.barePresence() != qdbus_cast( - props[QLatin1String("RequestedPresence")])) { - requestedPresence = Presence(qdbus_cast( - props[QLatin1String("RequestedPresence")])); - debug() << " Requested Presence:" << requestedPresence.type() << - "-" << requestedPresence.status(); - parent->notify("requestedPresence"); - emit parent->requestedPresenceChanged(requestedPresence); - } - - if (props.contains(QLatin1String("ChangingPresence")) && - changingPresence != qdbus_cast( - props[QLatin1String("ChangingPresence")])) { - changingPresence = qdbus_cast( - props[QLatin1String("ChangingPresence")]); - debug() << " Changing Presence:" << changingPresence; - parent->notify("changingPresence"); - emit parent->changingPresence(changingPresence); - } - if (props.contains(QLatin1String("Connection"))) { QString path = qdbus_cast(props[QLatin1String("Connection")]).path(); if (path.isEmpty()) { @@ -4524,6 +4479,51 @@ void Account::Private::updateProperties(const QVariantMap &props) if (!connectionStatusChanged && profileChanged) { checkCapabilitiesChanged(profileChanged); } + + if (props.contains(QLatin1String("RequestedPresence")) && + requestedPresence.barePresence() != qdbus_cast( + props[QLatin1String("RequestedPresence")])) { + requestedPresence = Presence(qdbus_cast( + props[QLatin1String("RequestedPresence")])); + debug() << " Requested Presence:" << requestedPresence.type() << + "-" << requestedPresence.status(); + parent->notify("requestedPresence"); + emit parent->requestedPresenceChanged(requestedPresence); + } + + if (props.contains(QLatin1String("ChangingPresence")) && + changingPresence != qdbus_cast( + props[QLatin1String("ChangingPresence")])) { + changingPresence = qdbus_cast( + props[QLatin1String("ChangingPresence")]); + debug() << " Changing Presence:" << changingPresence; + parent->notify("changingPresence"); + emit parent->changingPresence(changingPresence); + } + + if (props.contains(QLatin1String("CurrentPresence")) && + currentPresence.barePresence() != qdbus_cast( + props[QLatin1String("CurrentPresence")])) { + currentPresence = Presence(qdbus_cast( + props[QLatin1String("CurrentPresence")])); + debug() << " Current Presence:" << currentPresence.type() << + "-" << currentPresence.status(); + parent->notify("currentPresence"); + emit parent->currentPresenceChanged(currentPresence); + parent->notify("online"); + emit parent->onlinenessChanged(parent->isOnline()); + } + + if (props.contains(QLatin1String("AutomaticPresence")) && + automaticPresence.barePresence() != qdbus_cast( + props[QLatin1String("AutomaticPresence")])) { + automaticPresence = Presence(qdbus_cast( + props[QLatin1String("AutomaticPresence")])); + debug() << " Automatic Presence:" << automaticPresence.type() << + "-" << automaticPresence.status(); + parent->notify("automaticPresence"); + emit parent->automaticPresenceChanged(automaticPresence); + } } void Account::Private::retrieveAvatar() -- 2.10.2