[Telepathy-commits] [telepathy-qt4/master] Account: Use QExplicitlySharedDataPointer for connections.
Andre Moreira Magalhaes (andrunko)
andre.magalhaes at collabora.co.uk
Wed Mar 18 09:42:20 PDT 2009
---
TelepathyQt4/Client/account.cpp | 11 +++++------
TelepathyQt4/Client/account.h | 4 ++--
TelepathyQt4/Client/connection.h | 2 ++
3 files changed, 9 insertions(+), 8 deletions(-)
diff --git a/TelepathyQt4/Client/account.cpp b/TelepathyQt4/Client/account.cpp
index 8565edf..cd8c52e 100644
--- a/TelepathyQt4/Client/account.cpp
+++ b/TelepathyQt4/Client/account.cpp
@@ -28,7 +28,6 @@
#include "TelepathyQt4/debug-internal.h"
#include <TelepathyQt4/Client/AccountManager>
-#include <TelepathyQt4/Client/Connection>
#include <TelepathyQt4/Client/ConnectionManager>
#include <TelepathyQt4/Client/PendingFailure>
#include <TelepathyQt4/Client/PendingReady>
@@ -100,7 +99,7 @@ struct Account::Private
Telepathy::SimplePresence automaticPresence;
Telepathy::SimplePresence currentPresence;
Telepathy::SimplePresence requestedPresence;
- QSharedPointer<Connection> connection;
+ ConnectionPtr connection;
};
Account::Private::Private(Account *parent, AccountManager *am)
@@ -520,15 +519,15 @@ bool Account::haveConnection() const
*
* \return Connection object, or 0 if an error occurred.
*/
-QSharedPointer<Connection> Account::connection() const
+ConnectionPtr Account::connection() const
{
if (mPriv->connectionObjectPath.isEmpty()) {
- return QSharedPointer<Connection>();
+ return ConnectionPtr();
}
QString objectPath = mPriv->connectionObjectPath;
QString serviceName = objectPath.mid(1).replace('/', '.');
if (!mPriv->connection) {
- mPriv->connection = QSharedPointer<Connection>(
+ mPriv->connection = ConnectionPtr(
new Connection(dbusConnection(), serviceName, objectPath));
}
return mPriv->connection;
@@ -877,7 +876,7 @@ void Account::Private::updateProperties(const QVariantMap &props)
}
if (connectionObjectPath != path) {
- connection.clear();
+ connection.reset();
connectionObjectPath = path;
emit parent->haveConnectionChanged(!path.isEmpty());
}
diff --git a/TelepathyQt4/Client/account.h b/TelepathyQt4/Client/account.h
index b7231f6..625c381 100644
--- a/TelepathyQt4/Client/account.h
+++ b/TelepathyQt4/Client/account.h
@@ -28,6 +28,7 @@
#include <TelepathyQt4/_gen/cli-account.h>
+#include <TelepathyQt4/Client/Connection>
#include <TelepathyQt4/Client/DBus>
#include <TelepathyQt4/Client/DBusProxy>
#include <TelepathyQt4/Client/OptionalInterfaceFactory>
@@ -37,7 +38,6 @@
#include <QExplicitlySharedDataPointer>
#include <QSet>
-#include <QSharedPointer>
#include <QString>
#include <QStringList>
#include <QVariantMap>
@@ -109,7 +109,7 @@ public:
Telepathy::ConnectionStatus connectionStatus() const;
Telepathy::ConnectionStatusReason connectionStatusReason() const;
bool haveConnection() const;
- QSharedPointer<Connection> connection() const;
+ ConnectionPtr connection() const;
Telepathy::SimplePresence automaticPresence() const;
PendingOperation *setAutomaticPresence(
diff --git a/TelepathyQt4/Client/connection.h b/TelepathyQt4/Client/connection.h
index 8f51465..61e7ce0 100644
--- a/TelepathyQt4/Client/connection.h
+++ b/TelepathyQt4/Client/connection.h
@@ -214,6 +214,8 @@ private:
Private *mPriv;
};
+typedef QExplicitlySharedDataPointer<Connection> ConnectionPtr;
+
} // Telepathy::Client
} // Telepathy
--
1.5.6.5
More information about the telepathy-commits
mailing list