[Telepathy-commits] [telepathy-qt4/master] Fixed coding style on ConnectionManager.
Andre Moreira Magalhaes (andrunko)
andre.magalhaes at collabora.co.uk
Tue Jan 6 12:31:27 PST 2009
---
TelepathyQt4/Client/connection-manager-internal.h | 14 ++--
TelepathyQt4/Client/connection-manager.cpp | 93 ++++++---------------
TelepathyQt4/Client/connection-manager.h | 10 +-
3 files changed, 40 insertions(+), 77 deletions(-)
diff --git a/TelepathyQt4/Client/connection-manager-internal.h b/TelepathyQt4/Client/connection-manager-internal.h
index 41fe395..a44c721 100644
--- a/TelepathyQt4/Client/connection-manager-internal.h
+++ b/TelepathyQt4/Client/connection-manager-internal.h
@@ -45,8 +45,8 @@ public:
Private(const QString &name, ConnectionManager *parent);
~Private();
- static QString makeBusName(const QString& name);
- static QString makeObjectPath(const QString& name);
+ static QString makeBusName(const QString &name);
+ static QString makeObjectPath(const QString &name);
ProtocolInfo *protocol(const QString &protocolName);
@@ -59,7 +59,7 @@ public:
class PendingReady;
class PendingNames;
- ConnectionManagerInterface* baseInterface;
+ ConnectionManagerInterface *baseInterface;
QString name;
bool ready;
QQueue<void (Private::*)()> introspectQueue;
@@ -70,12 +70,13 @@ public:
PendingReady *pendingReady;
private Q_SLOTS:
- void onGetParametersReturn(QDBusPendingCallWatcher*);
- void onListProtocolsReturn(QDBusPendingCallWatcher*);
- void onGetAllConnectionManagerReturn(QDBusPendingCallWatcher*);
+ void onGetParametersReturn(QDBusPendingCallWatcher *);
+ void onListProtocolsReturn(QDBusPendingCallWatcher *);
+ void onGetAllConnectionManagerReturn(QDBusPendingCallWatcher *);
void continueIntrospection();
};
+
class ConnectionManager::Private::PendingReady : public PendingOperation
{
// ConnectionManager::Private is a friend so it can call finished() etc.
@@ -85,6 +86,7 @@ public:
PendingReady(ConnectionManager *parent);
};
+
class ConnectionManager::Private::PendingNames : public PendingStringList
{
Q_OBJECT
diff --git a/TelepathyQt4/Client/connection-manager.cpp b/TelepathyQt4/Client/connection-manager.cpp
index dedc58c..40a98e4 100644
--- a/TelepathyQt4/Client/connection-manager.cpp
+++ b/TelepathyQt4/Client/connection-manager.cpp
@@ -57,36 +57,30 @@ ProtocolParameter::ProtocolParameter(const QString &name,
{
}
-
ProtocolParameter::~ProtocolParameter()
{
}
-
bool ProtocolParameter::isRequired() const
{
return mFlags & ConnMgrParamFlagRequired;
}
-
bool ProtocolParameter::isSecret() const
{
return mFlags & ConnMgrParamFlagSecret;
}
-
bool ProtocolParameter::requiredForRegistration() const
{
return mFlags & ConnMgrParamFlagRegister;
}
-
bool ProtocolParameter::operator==(const ProtocolParameter &other) const
{
return (mName == other.name());
}
-
bool ProtocolParameter::operator==(const QString &name) const
{
return (mName == name);
@@ -98,7 +92,6 @@ struct ProtocolInfo::Private
ProtocolParameterList params;
};
-
ProtocolInfo::ProtocolInfo(const QString &cmName, const QString &name)
: mPriv(new Private()),
mCmName(cmName),
@@ -106,7 +99,6 @@ ProtocolInfo::ProtocolInfo(const QString &cmName, const QString &name)
{
}
-
ProtocolInfo::~ProtocolInfo()
{
Q_FOREACH (ProtocolParameter *param, mPriv->params) {
@@ -114,13 +106,11 @@ ProtocolInfo::~ProtocolInfo()
}
}
-
const ProtocolParameterList &ProtocolInfo::parameters() const
{
return mPriv->params;
}
-
bool ProtocolInfo::hasParameter(const QString &name) const
{
Q_FOREACH (ProtocolParameter *param, mPriv->params) {
@@ -131,22 +121,22 @@ bool ProtocolInfo::hasParameter(const QString &name) const
return false;
}
-
bool ProtocolInfo::canRegister() const
{
return hasParameter(QLatin1String("register"));
}
-
void ProtocolInfo::addParameter(const ParamSpec &spec)
{
QVariant defaultValue;
- if (spec.flags & ConnMgrParamFlagHasDefault)
+ if (spec.flags & ConnMgrParamFlagHasDefault) {
defaultValue = spec.defaultValue.variant();
+ }
uint flags = spec.flags;
- if (spec.name.endsWith("password"))
+ if (spec.name.endsWith("password")) {
flags |= Telepathy::ConnMgrParamFlagSecret;
+ }
ProtocolParameter *param = new ProtocolParameter(spec.name,
QDBusSignature(spec.signature),
@@ -162,7 +152,6 @@ ConnectionManager::Private::PendingReady::PendingReady(ConnectionManager *parent
{
}
-
ConnectionManager::Private::PendingNames::PendingNames(const QDBusConnection &bus)
: PendingStringList(),
mBus(bus)
@@ -172,7 +161,6 @@ ConnectionManager::Private::PendingNames::PendingNames(const QDBusConnection &bu
QTimer::singleShot(0, this, SLOT(continueProcessing()));
}
-
void ConnectionManager::Private::PendingNames::onCallFinished(QDBusPendingCallWatcher *watcher)
{
QDBusPendingReply<QStringList> reply = *watcher;
@@ -189,7 +177,6 @@ void ConnectionManager::Private::PendingNames::onCallFinished(QDBusPendingCallWa
watcher->deleteLater();
}
-
void ConnectionManager::Private::PendingNames::continueProcessing()
{
if (!mMethodsQueue.isEmpty()) {
@@ -203,7 +190,6 @@ void ConnectionManager::Private::PendingNames::continueProcessing()
}
}
-
void ConnectionManager::Private::PendingNames::invokeMethod(const QLatin1String &method)
{
QDBusPendingCall call = mBus.interface()->asyncCallWithArgumentList(
@@ -214,7 +200,6 @@ void ConnectionManager::Private::PendingNames::invokeMethod(const QLatin1String
SLOT(onCallFinished(QDBusPendingCallWatcher *)));
}
-
void ConnectionManager::Private::PendingNames::parseResult(const QStringList &names)
{
Q_FOREACH (const QString name, names) {
@@ -224,11 +209,10 @@ void ConnectionManager::Private::PendingNames::parseResult(const QStringList &na
}
}
-
ConnectionManager::Private::Private(const QString &name, ConnectionManager *parent)
: QObject(parent),
baseInterface(new ConnectionManagerInterface(parent->dbusConnection(),
- parent->busName(), parent->objectPath(), parent)),
+ parent->busName(), parent->objectPath(), parent)),
name(name),
ready(false),
pendingReady(0)
@@ -239,29 +223,25 @@ ConnectionManager::Private::Private(const QString &name, ConnectionManager *pare
QTimer::singleShot(0, this, SLOT(continueIntrospection()));
}
-
ConnectionManager::Private::~Private()
{
- Q_FOREACH (ProtocolInfo* info, protocols) {
+ Q_FOREACH (ProtocolInfo *info, protocols) {
delete info;
}
}
-
-QString ConnectionManager::Private::makeBusName(const QString& name)
+QString ConnectionManager::Private::makeBusName(const QString &name)
{
return QString::fromAscii(
TELEPATHY_CONNECTION_MANAGER_BUS_NAME_BASE).append(name);
}
-
-QString ConnectionManager::Private::makeObjectPath(const QString& name)
+QString ConnectionManager::Private::makeObjectPath(const QString &name)
{
return QString::fromAscii(
TELEPATHY_CONNECTION_MANAGER_OBJECT_PATH_BASE).append(name);
}
-
ProtocolInfo *ConnectionManager::Private::protocol(const QString &protocolName)
{
Q_FOREACH (ProtocolInfo *info, protocols) {
@@ -272,7 +252,6 @@ ProtocolInfo *ConnectionManager::Private::protocol(const QString &protocolName)
return NULL;
}
-
bool ConnectionManager::Private::checkConfigFile()
{
ManagerFile f(name);
@@ -316,47 +295,42 @@ void ConnectionManager::Private::callReadConfig()
continueIntrospection();
}
-
void ConnectionManager::Private::callGetAll()
{
debug() << "Calling Properties::GetAll(ConnectionManager)";
- ConnectionManager *cm = static_cast<ConnectionManager*>(parent());
- QDBusPendingCallWatcher* watcher = new QDBusPendingCallWatcher(
+ ConnectionManager *cm = static_cast<ConnectionManager *>(parent());
+ QDBusPendingCallWatcher *watcher = new QDBusPendingCallWatcher(
cm->propertiesInterface()->GetAll(
TELEPATHY_INTERFACE_CONNECTION_MANAGER), this);
connect(watcher,
- SIGNAL(finished(QDBusPendingCallWatcher*)),
- SLOT(onGetAllConnectionManagerReturn(QDBusPendingCallWatcher*)));
+ SIGNAL(finished(QDBusPendingCallWatcher *)),
+ SLOT(onGetAllConnectionManagerReturn(QDBusPendingCallWatcher *)));
}
-
void ConnectionManager::Private::callGetParameters()
{
QString protocol = getParametersQueue.dequeue();
protocolQueue.enqueue(protocol);
- debug() << "Calling ConnectionManager::GetParameters(" <<
- protocol << ")";
- QDBusPendingCallWatcher* watcher = new QDBusPendingCallWatcher(
+ debug() << "Calling ConnectionManager::GetParameters(" << protocol << ")";
+ QDBusPendingCallWatcher *watcher = new QDBusPendingCallWatcher(
baseInterface->GetParameters(protocol), this);
connect(watcher,
- SIGNAL(finished(QDBusPendingCallWatcher*)),
- SLOT(onGetParametersReturn(QDBusPendingCallWatcher*)));
+ SIGNAL(finished(QDBusPendingCallWatcher *)),
+ SLOT(onGetParametersReturn(QDBusPendingCallWatcher *)));
}
-
void ConnectionManager::Private::callListProtocols()
{
debug() << "Calling ConnectionManager::ListProtocols";
- QDBusPendingCallWatcher* watcher = new QDBusPendingCallWatcher(
+ QDBusPendingCallWatcher *watcher = new QDBusPendingCallWatcher(
baseInterface->ListProtocols(), this);
connect(watcher,
- SIGNAL(finished(QDBusPendingCallWatcher*)),
- SLOT(onListProtocolsReturn(QDBusPendingCallWatcher*)));
+ SIGNAL(finished(QDBusPendingCallWatcher *)),
+ SLOT(onListProtocolsReturn(QDBusPendingCallWatcher *)));
}
-
void ConnectionManager::Private::onGetAllConnectionManagerReturn(
- QDBusPendingCallWatcher* watcher)
+ QDBusPendingCallWatcher *watcher)
{
QDBusPendingReply<QVariantMap> reply = *watcher;
QVariantMap props;
@@ -378,9 +352,8 @@ void ConnectionManager::Private::onGetAllConnectionManagerReturn(
continueIntrospection();
}
-
void ConnectionManager::Private::onListProtocolsReturn(
- QDBusPendingCallWatcher* watcher)
+ QDBusPendingCallWatcher *watcher)
{
QDBusPendingReply<QStringList> reply = *watcher;
QStringList protocolsNames;
@@ -404,9 +377,8 @@ void ConnectionManager::Private::onListProtocolsReturn(
continueIntrospection();
}
-
void ConnectionManager::Private::onGetParametersReturn(
- QDBusPendingCallWatcher* watcher)
+ QDBusPendingCallWatcher *watcher)
{
QDBusPendingReply<ParamSpecList> reply = *watcher;
ParamSpecList parameters;
@@ -422,7 +394,7 @@ void ConnectionManager::Private::onGetParametersReturn(
reply.error().name() << ": " << reply.error().message();
}
- Q_FOREACH (const ParamSpec& spec, parameters) {
+ Q_FOREACH (const ParamSpec &spec, parameters) {
debug() << "Parameter" << spec.name << "has flags" << spec.flags
<< "and signature" << spec.signature;
@@ -431,7 +403,6 @@ void ConnectionManager::Private::onGetParametersReturn(
continueIntrospection();
}
-
void ConnectionManager::Private::continueIntrospection()
{
if (!ready) {
@@ -451,7 +422,7 @@ void ConnectionManager::Private::continueIntrospection()
}
-ConnectionManager::ConnectionManager(const QString& name, QObject* parent)
+ConnectionManager::ConnectionManager(const QString &name, QObject *parent)
: StatelessDBusProxy(QDBusConnection::sessionBus(),
Private::makeBusName(name), Private::makeObjectPath(name),
parent),
@@ -459,34 +430,29 @@ ConnectionManager::ConnectionManager(const QString& name, QObject* parent)
{
}
-
-ConnectionManager::ConnectionManager(const QDBusConnection& bus,
- const QString& name, QObject* parent)
+ConnectionManager::ConnectionManager(const QDBusConnection &bus,
+ const QString &name, QObject *parent)
: StatelessDBusProxy(bus, Private::makeBusName(name),
Private::makeObjectPath(name), parent),
mPriv(new Private(name, this))
{
}
-
ConnectionManager::~ConnectionManager()
{
delete mPriv;
}
-
QString ConnectionManager::name() const
{
return mPriv->name;
}
-
QStringList ConnectionManager::interfaces() const
{
return mPriv->interfaces;
}
-
QStringList ConnectionManager::supportedProtocols() const
{
QStringList protocols;
@@ -496,19 +462,16 @@ QStringList ConnectionManager::supportedProtocols() const
return protocols;
}
-
const ProtocolInfoList &ConnectionManager::protocols() const
{
return mPriv->protocols;
}
-
bool ConnectionManager::isReady() const
{
return mPriv->ready;
}
-
// TODO: We don't actually consider anything during initial setup to be
// fatal, so the documentation isn't completely true.
PendingOperation *ConnectionManager::becomeReady()
@@ -524,14 +487,12 @@ PendingOperation *ConnectionManager::becomeReady()
return mPriv->pendingReady;
}
-
PendingStringList *ConnectionManager::listNames(const QDBusConnection &bus)
{
return new ConnectionManager::Private::PendingNames(bus);
}
-
-ConnectionManagerInterface* ConnectionManager::baseInterface() const
+ConnectionManagerInterface *ConnectionManager::baseInterface() const
{
return mPriv->baseInterface;
}
diff --git a/TelepathyQt4/Client/connection-manager.h b/TelepathyQt4/Client/connection-manager.h
index c93c30e..4823c61 100644
--- a/TelepathyQt4/Client/connection-manager.h
+++ b/TelepathyQt4/Client/connection-manager.h
@@ -179,9 +179,9 @@ class ConnectionManager : public StatelessDBusProxy,
Q_OBJECT
public:
- ConnectionManager(const QString& name, QObject* parent = 0);
- ConnectionManager(const QDBusConnection& bus,
- const QString& name, QObject* parent = 0);
+ ConnectionManager(const QString &name, QObject *parent = 0);
+ ConnectionManager(const QDBusConnection &bus,
+ const QString &name, QObject *parent = 0);
virtual ~ConnectionManager();
@@ -199,7 +199,7 @@ public:
* <code>check</code> parameter is not provided, and the interface is
* always assumed to be present.
*/
- inline DBus::PropertiesInterface* propertiesInterface() const
+ inline DBus::PropertiesInterface *propertiesInterface() const
{
return OptionalInterfaceFactory::interface<DBus::PropertiesInterface>(
*baseInterface());
@@ -239,7 +239,7 @@ protected:
* \return A pointer to the existing ConnectionManagerInterface for this
* ConnectionManager
*/
- ConnectionManagerInterface* baseInterface() const;
+ ConnectionManagerInterface *baseInterface() const;
private:
Q_DISABLE_COPY(ConnectionManager);
--
1.5.6.5
More information about the Telepathy-commits
mailing list