[Telepathy-commits] [telepathy-qt4/master] PendingOperation: remove bool from 'finished' signal
Simon McVittie
simon.mcvittie at collabora.co.uk
Tue Dec 2 09:12:28 PST 2008
As per review from gberg. It's equally easy for the recipient to use
op->isValid() or !op->isError(), so no need for an extra parameter
---
TelepathyQt4/cli-connection.cpp | 2 +-
TelepathyQt4/cli-pending-operation.cpp | 4 ++--
TelepathyQt4/cli-pending-operation.h | 6 +-----
tests/pinocchio/chan-basics.cpp | 8 ++++----
tests/pinocchio/conn-basics.cpp | 10 +++++-----
5 files changed, 13 insertions(+), 17 deletions(-)
diff --git a/TelepathyQt4/cli-connection.cpp b/TelepathyQt4/cli-connection.cpp
index 79688c8..7ae50b2 100644
--- a/TelepathyQt4/cli-connection.cpp
+++ b/TelepathyQt4/cli-connection.cpp
@@ -550,7 +550,7 @@ void PendingChannel::onCallFinished(QDBusPendingCallWatcher* watcher)
}
debug() << " Emitting finished()";
- emit finished(this, isValid());
+ emit finished(this);
watcher->deleteLater();
}
diff --git a/TelepathyQt4/cli-pending-operation.cpp b/TelepathyQt4/cli-pending-operation.cpp
index db5ddc4..181c2fe 100644
--- a/TelepathyQt4/cli-pending-operation.cpp
+++ b/TelepathyQt4/cli-pending-operation.cpp
@@ -125,6 +125,7 @@ QString PendingOperation::errorMessage() const
void PendingOperation::selfDestroyed(QObject* self)
{
// FIXME: signal finished with a synthetic error here?
+ // need to work out exactly what the life-cycle is first
}
@@ -148,14 +149,13 @@ void PendingVoidMethodCall::watcherFinished(QDBusPendingCallWatcher* watcher)
{
setError(watcher->error());
Q_ASSERT(isError());
- emit finished(this, false);
}
else
{
Q_ASSERT(isValid());
- emit finished(this, true);
}
+ emit finished(this);
deleteLater();
}
diff --git a/TelepathyQt4/cli-pending-operation.h b/TelepathyQt4/cli-pending-operation.h
index 526cd37..b370841 100644
--- a/TelepathyQt4/cli-pending-operation.h
+++ b/TelepathyQt4/cli-pending-operation.h
@@ -138,12 +138,8 @@ Q_SIGNALS:
*
* \param operation This operation object, from which further information
* may be obtained
- * \param successful true if the operation was successful (the same as
- * operation->isSuccessful())
*/
- // FIXME: would bool error be better? KJob only has error()
- void finished(Telepathy::Client::PendingOperation* operation,
- bool successful);
+ void finished(Telepathy::Client::PendingOperation* operation);
protected:
PendingOperation(DBusProxy* proxy);
diff --git a/tests/pinocchio/chan-basics.cpp b/tests/pinocchio/chan-basics.cpp
index 40b395e..3a23588 100644
--- a/tests/pinocchio/chan-basics.cpp
+++ b/tests/pinocchio/chan-basics.cpp
@@ -247,10 +247,10 @@ void TestChanBasics::testPendingChannel()
Telepathy::HandleTypeList,
mSubscribeHandle);
- QVERIFY(connect(pc, SIGNAL(finished(Telepathy::Client::PendingOperation*, bool)),
+ QVERIFY(connect(pc, SIGNAL(finished(Telepathy::Client::PendingOperation*)),
this, SLOT(expectPendingChannelFinished(Telepathy::Client::PendingOperation*))));
QCOMPARE(mLoop->exec(), 0);
- QVERIFY(disconnect(pc, SIGNAL(finished(Telepathy::Client::PendingOperation*, bool)),
+ QVERIFY(disconnect(pc, SIGNAL(finished(Telepathy::Client::PendingOperation*)),
this, SLOT(expectPendingChannelFinished(Telepathy::Client::PendingOperation*))));
QVERIFY(mChan);
@@ -307,10 +307,10 @@ void TestChanBasics::testPendingChannelError()
Telepathy::HandleTypeList,
31337);
- QVERIFY(connect(pc, SIGNAL(finished(Telepathy::Client::PendingOperation*, bool)),
+ QVERIFY(connect(pc, SIGNAL(finished(Telepathy::Client::PendingOperation*)),
this, SLOT(expectPendingChannelError(Telepathy::Client::PendingOperation*))));
QCOMPARE(mLoop->exec(), 0);
- QVERIFY(disconnect(pc, SIGNAL(finished(Telepathy::Client::PendingOperation*, bool)),
+ QVERIFY(disconnect(pc, SIGNAL(finished(Telepathy::Client::PendingOperation*)),
this, SLOT(expectPendingChannelError(Telepathy::Client::PendingOperation*))));
}
diff --git a/tests/pinocchio/conn-basics.cpp b/tests/pinocchio/conn-basics.cpp
index 47ea4c6..864f165 100644
--- a/tests/pinocchio/conn-basics.cpp
+++ b/tests/pinocchio/conn-basics.cpp
@@ -26,7 +26,7 @@ protected Q_SLOTS:
void expectNotYetConnected(uint);
void expectReady(uint);
void expectSuccessfulCall(QDBusPendingCallWatcher*);
- void expectSuccessfulCall(Telepathy::Client::PendingOperation*, bool);
+ void expectSuccessfulCall(Telepathy::Client::PendingOperation*);
private Q_SLOTS:
void initTestCase();
@@ -142,9 +142,9 @@ void TestConnBasics::testInitialIntrospection()
}
-void TestConnBasics::expectSuccessfulCall(PendingOperation* op, bool success)
+void TestConnBasics::expectSuccessfulCall(PendingOperation* op)
{
- if (!success) {
+ if (op->isError()) {
qWarning().nospace() << op->errorName()
<< ": " << op->errorMessage();
mLoop->exit(1);
@@ -248,9 +248,9 @@ void TestConnBasics::testConnect()
TELEPATHY_INTERFACE_CONNECTION_INTERFACE_CAPABILITIES)));
QVERIFY(connect(mConn->requestDisconnect(),
- SIGNAL(finished(Telepathy::Client::PendingOperation*, bool)),
+ SIGNAL(finished(Telepathy::Client::PendingOperation*)),
this,
- SLOT(expectSuccessfulCall(Telepathy::Client::PendingOperation*, bool))));
+ SLOT(expectSuccessfulCall(Telepathy::Client::PendingOperation*))));
QCOMPARE(mLoop->exec(), 0);
QCOMPARE(mConn->readiness(), Connection::ReadinessDead);
--
1.5.6.5
More information about the Telepathy-commits
mailing list