[Telepathy-commits] [telepathy-qt4/master] PendingConnection: Return ConnectionPtr on connection() method.
Andre Moreira Magalhaes (andrunko)
andre.magalhaes at collabora.co.uk
Wed Mar 18 10:14:38 PDT 2009
---
TelepathyQt4/Client/pending-connection.cpp | 10 +++++-----
TelepathyQt4/Client/pending-connection.h | 3 +--
examples/roster/roster-window.h | 5 ++---
tests/pinocchio/cm-basics.cpp | 2 +-
4 files changed, 9 insertions(+), 11 deletions(-)
diff --git a/TelepathyQt4/Client/pending-connection.cpp b/TelepathyQt4/Client/pending-connection.cpp
index aafcbf4..d5e4f62 100644
--- a/TelepathyQt4/Client/pending-connection.cpp
+++ b/TelepathyQt4/Client/pending-connection.cpp
@@ -56,7 +56,7 @@ struct PendingConnection::Private
}
ConnectionManager *manager;
- QSharedPointer<Connection> connection;
+ ConnectionPtr connection;
QString serviceName;
QDBusObjectPath objectPath;
};
@@ -114,18 +114,18 @@ ConnectionManager *PendingConnection::manager() const
*
* \return Connection object.
*/
-QSharedPointer<Connection> PendingConnection::connection() const
+ConnectionPtr PendingConnection::connection() const
{
if (!isFinished()) {
warning() << "PendingConnection::connection called before finished, returning 0";
- return QSharedPointer<Connection>();
+ return ConnectionPtr();
} else if (!isValid()) {
warning() << "PendingConnection::connection called when not valid, returning 0";
- return QSharedPointer<Connection>();
+ return ConnectionPtr();
}
if (!mPriv->connection) {
- mPriv->connection = QSharedPointer<Connection>(
+ mPriv->connection = ConnectionPtr(
new Connection(mPriv->manager->dbusConnection(),
mPriv->serviceName, mPriv->objectPath.path()));
}
diff --git a/TelepathyQt4/Client/pending-connection.h b/TelepathyQt4/Client/pending-connection.h
index 680f579..766c975 100644
--- a/TelepathyQt4/Client/pending-connection.h
+++ b/TelepathyQt4/Client/pending-connection.h
@@ -29,7 +29,6 @@
#include <TelepathyQt4/Client/Connection>
#include <TelepathyQt4/Client/PendingOperation>
-#include <QSharedPointer>
#include <QString>
#include <QVariantMap>
@@ -51,7 +50,7 @@ public:
ConnectionManager *manager() const;
- QSharedPointer<Connection> connection() const;
+ ConnectionPtr connection() const;
QString serviceName() const;
diff --git a/examples/roster/roster-window.h b/examples/roster/roster-window.h
index 51e0a03..431f2af 100644
--- a/examples/roster/roster-window.h
+++ b/examples/roster/roster-window.h
@@ -22,13 +22,12 @@
#define _TelepathyQt4_examples_roster_roster_window_h_HEADER_GUARD_
#include <QMainWindow>
-#include <QSharedPointer>
#include <TelepathyQt4/Client/Contact>
+#include <TelepathyQt4/Client/Connection>
namespace Telepathy {
namespace Client {
-class Connection;
class ConnectionManager;
class PendingOperation;
}
@@ -71,7 +70,7 @@ private:
bool checkExists = false);
Telepathy::Client::ConnectionManager *mCM;
- QSharedPointer<Telepathy::Client::Connection> mConn;
+ Telepathy::Client::ConnectionPtr mConn;
QString mUsername;
QString mPassword;
QAction *mAuthAction;
diff --git a/tests/pinocchio/cm-basics.cpp b/tests/pinocchio/cm-basics.cpp
index 12e29b7..794e759 100644
--- a/tests/pinocchio/cm-basics.cpp
+++ b/tests/pinocchio/cm-basics.cpp
@@ -137,7 +137,7 @@ void TestCmBasics::testBasics()
SLOT(expectSuccessfulCall(Telepathy::Client::PendingOperation *)));
QCOMPARE(mLoop->exec(), 0);
- QVERIFY(!pconn->connection().isNull());
+ QVERIFY(pconn->connection());
}
--
1.5.6.5
More information about the telepathy-commits
mailing list