diff options
author | Andre Moreira Magalhaes (andrunko) <andre.magalhaes@collabora.co.uk> | 2012-04-13 14:04:27 -0300 |
---|---|---|
committer | Andre Moreira Magalhaes (andrunko) <andre.magalhaes@collabora.co.uk> | 2012-04-13 14:13:03 -0300 |
commit | 37fde05498e2f6df1c3b9b705444f4c7f3025327 (patch) | |
tree | f42f048096952eaffd84148a3f83c4058838c96d | |
parent | 93625b67732094b922791280848d70077f1c5d1b (diff) |
qt-svc-gen.py: Properly generate adaptee methods/signals/properties names in lowerCamelCase.
Also renamed all places using vCard to vcard for consistency as the generated code will generate
vcard for VCard when appropriate.
-rw-r--r-- | TelepathyQt/base-protocol-internal.h | 6 | ||||
-rw-r--r-- | TelepathyQt/base-protocol.cpp | 62 | ||||
-rw-r--r-- | TelepathyQt/base-protocol.h | 6 | ||||
-rw-r--r-- | TelepathyQt/contact-manager.cpp | 6 | ||||
-rw-r--r-- | TelepathyQt/contact.cpp | 4 | ||||
-rw-r--r-- | TelepathyQt/manager-file.cpp | 4 | ||||
-rw-r--r-- | TelepathyQt/protocol-info.cpp | 22 | ||||
-rw-r--r-- | TelepathyQt/svc-channel.xml | 38 | ||||
-rw-r--r-- | TelepathyQt/svc-connection-manager.xml | 13 | ||||
-rw-r--r-- | TelepathyQt/svc-connection.xml | 29 | ||||
-rw-r--r-- | examples/cm/protocol.cpp | 2 | ||||
-rw-r--r-- | tests/dbus/base-protocol.cpp | 30 | ||||
-rw-r--r-- | tools/qt-svc-gen.py | 17 |
13 files changed, 159 insertions, 80 deletions
diff --git a/TelepathyQt/base-protocol-internal.h b/TelepathyQt/base-protocol-internal.h index fc152fc6..ae622fd3 100644 --- a/TelepathyQt/base-protocol-internal.h +++ b/TelepathyQt/base-protocol-internal.h @@ -41,7 +41,7 @@ class TP_QT_NO_EXPORT BaseProtocol::Adaptee : public QObject Q_PROPERTY(Tp::ParamSpecList parameters READ parameters) Q_PROPERTY(QStringList connectionInterfaces READ connectionInterfaces) Q_PROPERTY(Tp::RequestableChannelClassList requestableChannelClasses READ requestableChannelClasses) - Q_PROPERTY(QString vCardField READ vCardField) + Q_PROPERTY(QString vcardField READ vcardField) Q_PROPERTY(QString englishName READ englishName) Q_PROPERTY(QString icon READ icon) Q_PROPERTY(QStringList authenticationTypes READ authenticationTypes) @@ -54,7 +54,7 @@ public: QStringList connectionInterfaces() const; ParamSpecList parameters() const; RequestableChannelClassList requestableChannelClasses() const; - QString vCardField() const; + QString vcardField() const; QString englishName() const; QString icon() const; QStringList authenticationTypes() const; @@ -83,7 +83,7 @@ public: QStringList addressableURISchemes() const; private Q_SLOTS: - void normalizeVCardAddress(const QString &vCardField, const QString &vCardAddress, + void normalizeVCardAddress(const QString &vcardField, const QString &vcardAddress, const Tp::Service::ProtocolInterfaceAddressingAdaptor::NormalizeVCardAddressContextPtr &context); void normalizeContactURI(const QString &uri, const Tp::Service::ProtocolInterfaceAddressingAdaptor::NormalizeContactURIContextPtr &context); diff --git a/TelepathyQt/base-protocol.cpp b/TelepathyQt/base-protocol.cpp index 4764bd42..70120f22 100644 --- a/TelepathyQt/base-protocol.cpp +++ b/TelepathyQt/base-protocol.cpp @@ -59,7 +59,7 @@ struct TP_QT_NO_EXPORT BaseProtocol::Private QStringList connInterfaces; ProtocolParameterList parameters; RequestableChannelClassSpecList rccSpecs; - QString vCardField; + QString vcardField; QString englishName; QString iconName; QStringList authTypes; @@ -114,9 +114,9 @@ RequestableChannelClassList BaseProtocol::Adaptee::requestableChannelClasses() c return mProtocol->requestableChannelClasses().bareClasses(); } -QString BaseProtocol::Adaptee::vCardField() const +QString BaseProtocol::Adaptee::vcardField() const { - return mProtocol->vCardField(); + return mProtocol->vcardField(); } QString BaseProtocol::Adaptee::englishName() const @@ -231,7 +231,7 @@ QVariantMap BaseProtocol::immutableProperties() const ret.insert(TP_QT_IFACE_PROTOCOL + QLatin1String(".RequestableChannelClasses"), QVariant::fromValue(mPriv->adaptee->requestableChannelClasses())); ret.insert(TP_QT_IFACE_PROTOCOL + QLatin1String(".VCardField"), - QVariant::fromValue(mPriv->adaptee->vCardField())); + QVariant::fromValue(mPriv->adaptee->vcardField())); ret.insert(TP_QT_IFACE_PROTOCOL + QLatin1String(".EnglishName"), QVariant::fromValue(mPriv->adaptee->englishName())); ret.insert(TP_QT_IFACE_PROTOCOL + QLatin1String(".Icon"), @@ -360,25 +360,25 @@ void BaseProtocol::setRequestableChannelClasses(const RequestableChannelClassSpe } /** - * Return the name of the vCard field that has been set with setVCardField(). + * Return the name of the vcard field that has been set with setVCardField(). * * This is exposed as the VCardField property of this Protocol object on - * the bus and represents the name of the most common vCard field used for + * the bus and represents the name of the most common vcard field used for * this protocol's contact identifiers, normalized to lower case. * * This property is immutable and cannot change after this Protocol * object has been registered on the bus with registerObject(). * - * \return The name of the vCard field that has been set with setVCardField(). + * \return The name of the vcard field that has been set with setVCardField(). * \sa setVCardField() */ -QString BaseProtocol::vCardField() const +QString BaseProtocol::vcardField() const { - return mPriv->vCardField; + return mPriv->vcardField; } /** - * Set the name of the most common vCard field used for + * Set the name of the most common vcard field used for * this protocol's contact identifiers, normalized to lower case. * * For example, this would be x-jabber for Jabber/XMPP @@ -387,17 +387,17 @@ QString BaseProtocol::vCardField() const * This property is immutable and cannot change after this Protocol * object has been registered on the bus with registerObject(). * - * \param vCardField The name of the vCard field to set. - * \sa vCardField() + * \param vcardField The name of the vcard field to set. + * \sa vcardField() */ -void BaseProtocol::setVCardField(const QString &vCardField) +void BaseProtocol::setVCardField(const QString &vcardField) { if (isRegistered()) { warning() << "BaseProtocol::setVCardField: cannot change property after " "registration, immutable property"; return; } - mPriv->vCardField = vCardField; + mPriv->vcardField = vcardField; } /** @@ -747,13 +747,13 @@ QStringList BaseProtocolAddressingInterface::Adaptee::addressableURISchemes() co return mInterface->addressableUriSchemes(); } -void BaseProtocolAddressingInterface::Adaptee::normalizeVCardAddress(const QString& vCardField, - const QString& vCardAddress, +void BaseProtocolAddressingInterface::Adaptee::normalizeVCardAddress(const QString& vcardField, + const QString& vcardAddress, const Tp::Service::ProtocolInterfaceAddressingAdaptor::NormalizeVCardAddressContextPtr &context) { DBusError error; QString normalizedAddress; - normalizedAddress = mInterface->normalizeVCardAddress(vCardField, vCardAddress, &error); + normalizedAddress = mInterface->normalizeVCardAddress(vcardField, vcardAddress, &error); if (normalizedAddress.isEmpty()) { context->setFinishedWithError(error.name(), error.message()); return; @@ -828,14 +828,14 @@ QVariantMap BaseProtocolAddressingInterface::immutableProperties() const } /** - * Return the list of addressable vCard fields that have been set with + * Return the list of addressable vcard fields that have been set with * setAddressableVCardFields(). * * This list is exposed as the AddressableVCardFields property of this - * interface on the bus and represents the vCard fields that can be used + * interface on the bus and represents the vcard fields that can be used * to request a contact for this protocol, normalized to lower case. * - * \return The list of addressable VCard fields that have been set with + * \return The list of addressable vcard fields that have been set with * setAddressableVCardFields(). * \sa setAddressableVCardFields() */ @@ -845,11 +845,11 @@ QStringList BaseProtocolAddressingInterface::addressableVCardFields() const } /** - * Set the list of vCard fields that can be used to request a contact for this protocol. + * Set the list of vcard fields that can be used to request a contact for this protocol. * * All the field names should be normalized to lower case. * - * \param vcardFields The list of vCard fields to set. + * \param vcardFields The list of vcard fields to set. * \sa addressableVCardFields() */ void BaseProtocolAddressingInterface::setAddressableVCardFields(const QStringList &vcardFields) @@ -887,7 +887,7 @@ void BaseProtocolAddressingInterface::setAddressableUriSchemes(const QStringList /** * Set a callback that will be called from a client to normalize a given - * vCard address. + * vcard address. * * This callback will be called when the NormalizeVCardAddress method * on the Protocol.Interface.Addressing D-Bus interface has been called. @@ -902,27 +902,27 @@ void BaseProtocolAddressingInterface::setNormalizeVCardAddressCallback( } /** - * Return a normalized version of the given \a vCardAddress, which corresponds - * to the given \a vCardField, by calling the callback that has been set + * Return a normalized version of the given \a vcardAddress, which corresponds + * to the given \a vcardField, by calling the callback that has been set * with setNormalizeVCardAddressCallback(). * - * \param vCardField The vCard field of the address we are normalizing. - * \param vCardAddress The address to normalize, which is assumed to belong to a contact. + * \param vcardField The vcard field of the address we are normalizing. + * \param vcardAddress The address to normalize, which is assumed to belong to a contact. * \param error A pointer to a DBusError instance where any possible error * will be stored. - * \return A normalized version of the given \a vCardAddress, or an empty + * \return A normalized version of the given \a vcardAddress, or an empty * string if no callback to do the normalization has been set with * setNormalizeVCardAddressCallback(). * \sa setNormalizeVCardAddressCallback() */ -QString BaseProtocolAddressingInterface::normalizeVCardAddress(const QString &vCardField, - const QString &vCardAddress, DBusError *error) +QString BaseProtocolAddressingInterface::normalizeVCardAddress(const QString &vcardField, + const QString &vcardAddress, DBusError *error) { if (!mPriv->normalizeVCardAddressCb.isValid()) { error->set(TP_QT_ERROR_NOT_IMPLEMENTED, QLatin1String("Not implemented")); return QString(); } - return mPriv->normalizeVCardAddressCb(vCardField, vCardAddress, error); + return mPriv->normalizeVCardAddressCb(vcardField, vcardAddress, error); } /** diff --git a/TelepathyQt/base-protocol.h b/TelepathyQt/base-protocol.h index c1a691ec..0526d653 100644 --- a/TelepathyQt/base-protocol.h +++ b/TelepathyQt/base-protocol.h @@ -87,8 +87,8 @@ public: RequestableChannelClassSpecList requestableChannelClasses() const; void setRequestableChannelClasses(const RequestableChannelClassSpecList &rccSpecs); - QString vCardField() const; - void setVCardField(const QString &vCardField); + QString vcardField() const; + void setVCardField(const QString &vcardField); QString englishName() const; void setEnglishName(const QString &englishName); @@ -176,7 +176,7 @@ public: typedef Callback3<QString, const QString &, const QString &, DBusError*> NormalizeVCardAddressCallback; void setNormalizeVCardAddressCallback(const NormalizeVCardAddressCallback &cb); - QString normalizeVCardAddress(const QString &vCardField, const QString &vCardAddress, DBusError *error); + QString normalizeVCardAddress(const QString &vcardField, const QString &vcardAddress, DBusError *error); typedef Callback2<QString, const QString &, DBusError*> NormalizeContactUriCallback; void setNormalizeContactUriCallback(const NormalizeContactUriCallback &cb); diff --git a/TelepathyQt/contact-manager.cpp b/TelepathyQt/contact-manager.cpp index ec3e7787..573ab036 100644 --- a/TelepathyQt/contact-manager.cpp +++ b/TelepathyQt/contact-manager.cpp @@ -1084,14 +1084,14 @@ PendingContacts *ContactManager::contactsForIdentifiers(const QStringList &ident } /** - * Request contacts and enable their \a features using a given field in their vCards. + * Request contacts and enable their \a features using a given field in their vcards. * * This method requires Connection::FeatureCore to be ready. * - * \param vcardField The vCard field of the addresses we are requesting. + * \param vcardField The vcard field of the addresses we are requesting. * Supported fields can be found in ProtocolInfo::addressableVCardFields(). * \param vcardAddresses The addresses to get contacts for. The address types must match - * the given vCard field. + * the given vcard field. * \param features The Contact features to enable. * \return A PendingContacts, which will emit PendingContacts::finished * when the contacts are retrieved or an error occurred. diff --git a/TelepathyQt/contact.cpp b/TelepathyQt/contact.cpp index c18b726f..fe7ffa7a 100644 --- a/TelepathyQt/contact.cpp +++ b/TelepathyQt/contact.cpp @@ -396,11 +396,11 @@ QString Contact::alias() const } /** - * Return the various vCard addresses that identify this contact. + * Return the various vcard addresses that identify this contact. * * This method requires Contact::FeatureAddresses to be ready. * - * \return The vCard addresses identifying this contact. + * \return The vcard addresses identifying this contact. * \sa ContactManager::contactsForVCardAddresses(), uris() */ QMap<QString, QString> Contact::vcardAddresses() const diff --git a/TelepathyQt/manager-file.cpp b/TelepathyQt/manager-file.cpp index 0b938c18..f41d9550 100644 --- a/TelepathyQt/manager-file.cpp +++ b/TelepathyQt/manager-file.cpp @@ -462,11 +462,11 @@ ParamSpecList ManagerFile::parameters(const QString &protocol) const } /** - * Return the name of the most common vCard field used for the given \a protocol's + * Return the name of the most common vcard field used for the given \a protocol's * contact identifiers, normalized to lower case. * * \param protocol Name of the protocol to look for. - * \return The most common vCard field used for the given protocol's contact + * \return The most common vcard field used for the given protocol's contact * identifiers, or an empty string if there is no such field or the * protocol is not defined. */ diff --git a/TelepathyQt/protocol-info.cpp b/TelepathyQt/protocol-info.cpp index 24d2fc62..7eb2fb43 100644 --- a/TelepathyQt/protocol-info.cpp +++ b/TelepathyQt/protocol-info.cpp @@ -231,21 +231,21 @@ ConnectionCapabilities ProtocolInfo::capabilities() const } /** - * Return the name of the most common vCard field used for this protocol's + * Return the name of the most common vcard field used for this protocol's * contact identifiers, normalized to lower case. * * One valid use of this field is to answer the question: given a contact's - * vCard containing an X-JABBER field, how can you communicate with the contact? + * vcard containing an X-JABBER field, how can you communicate with the contact? * By iterating through protocols looking for an x-jabber VCardField, one can * build up a list of protocols that handle x-jabber, then offer the user a list * of accounts for those protocols and/or the option to create a new account for * one of those protocols. * It is not necessarily valid to interpret contacts' identifiers as values of - * this vCard field. For instance, telepathy-sofiasip supports contacts whose + * this vcard field. For instance, telepathy-sofiasip supports contacts whose * identifiers are of the form sip:jenny@example.com or tel:8675309, which would - * not normally both be represented by any single vCard field. + * not normally both be represented by any single vcard field. * - * \return The most common vCard field used for this protocol's contact + * \return The most common vcard field used for this protocol's contact * identifiers, or an empty string if there is no such field. */ QString ProtocolInfo::vcardField() const @@ -327,10 +327,10 @@ AvatarSpec ProtocolInfo::avatarRequirements() const } /** - * Return the vCard fields that can be used to request a contact with on this protocol, + * Return the vcard fields that can be used to request a contact with on this protocol, * normalized to lower case. * - * \return The vCard fields normalized to lower case. + * \return The vcard fields normalized to lower case. * \sa addressableUriSchemes() */ QStringList ProtocolInfo::addressableVCardFields() const @@ -360,15 +360,15 @@ QStringList ProtocolInfo::addressableUriSchemes() const /** * Attempt to normalize the given \a vcardAddress. * - * For example, a vCard TEL field formatted as +1 (206) 555 1234, + * For example, a vcard TEL field formatted as +1 (206) 555 1234, * could be normalized to +12065551234. * - * If a vCard address X would be normalized to Y, a successful ContactManager + * If a vcard address X would be normalized to Y, a successful ContactManager * contact request using ContactManager::contactsForVCardAddresses() for - * vCard address X would result in a contact with Y reported as an + * vcard address X would result in a contact with Y reported as an * address that can identify it in Contact::vcardAddresses(). * - * \param vcardField The vCard field the \a vcardAddress belongs to. + * \param vcardField The vcard field the \a vcardAddress belongs to. * \param vcardAddress The address to normalize. * \return A PendingString which will emit PendingString::finished * when the address has been normalized or an error occurred. diff --git a/TelepathyQt/svc-channel.xml b/TelepathyQt/svc-channel.xml new file mode 100644 index 00000000..d4e8e6e2 --- /dev/null +++ b/TelepathyQt/svc-channel.xml @@ -0,0 +1,38 @@ +<tp:spec + xmlns:tp="http://telepathy.freedesktop.org/wiki/DbusSpec#extensions-v0" + xmlns:xi="http://www.w3.org/2001/XInclude"> + +<tp:title>Channel interfaces</tp:title> + +<xi:include href="../spec/Channel.xml"/> + +<xi:include href="../spec/Channel_Type_Call.xml"/> +<xi:include href="../spec/Channel_Type_Contact_Search.xml"/> +<xi:include href="../spec/Channel_Type_DBus_Tube.xml"/> +<xi:include href="../spec/Channel_Type_File_Transfer.xml"/> +<xi:include href="../spec/Channel_Type_Room_List.xml"/> +<xi:include href="../spec/Channel_Type_Server_Authentication.xml"/> +<xi:include href="../spec/Channel_Type_Server_TLS_Connection.xml"/> +<xi:include href="../spec/Channel_Type_Streamed_Media.xml"/> +<xi:include href="../spec/Channel_Type_Stream_Tube.xml"/> +<xi:include href="../spec/Channel_Type_Text.xml"/> + +<xi:include href="../spec/Channel_Interface_Anonymity.xml"/> +<xi:include href="../spec/Channel_Interface_Captcha_Authentication.xml"/> +<xi:include href="../spec/Channel_Interface_Call_State.xml"/> +<xi:include href="../spec/Channel_Interface_Chat_State.xml"/> +<xi:include href="../spec/Channel_Interface_Conference.xml"/> +<xi:include href="../spec/Channel_Interface_Destroyable.xml"/> +<xi:include href="../spec/Channel_Interface_DTMF.xml"/> +<xi:include href="../spec/Channel_Interface_File_Transfer_Metadata.xml"/> +<xi:include href="../spec/Channel_Interface_Group.xml"/> +<xi:include href="../spec/Channel_Interface_Hold.xml"/> +<xi:include href="../spec/Channel_Interface_Media_Signalling.xml"/> +<xi:include href="../spec/Channel_Interface_Messages.xml"/> +<xi:include href="../spec/Channel_Interface_Password.xml"/> +<xi:include href="../spec/Channel_Interface_SASL_Authentication.xml"/> +<xi:include href="../spec/Channel_Interface_Securable.xml"/> +<xi:include href="../spec/Channel_Interface_Service_Point.xml"/> +<xi:include href="../spec/Channel_Interface_SMS.xml"/> + +</tp:spec> diff --git a/TelepathyQt/svc-connection-manager.xml b/TelepathyQt/svc-connection-manager.xml new file mode 100644 index 00000000..278309e2 --- /dev/null +++ b/TelepathyQt/svc-connection-manager.xml @@ -0,0 +1,13 @@ +<tp:spec + xmlns:tp="http://telepathy.freedesktop.org/wiki/DbusSpec#extensions-v0" + xmlns:xi="http://www.w3.org/2001/XInclude"> + +<tp:title>Connection Manager interfaces</tp:title> + +<xi:include href="../spec/Connection_Manager.xml"/> +<xi:include href="../spec/Protocol.xml"/> +<xi:include href="../spec/Protocol_Interface_Addressing.xml"/> +<xi:include href="../spec/Protocol_Interface_Avatars.xml"/> +<xi:include href="../spec/Protocol_Interface_Presence.xml"/> + +</tp:spec> diff --git a/TelepathyQt/svc-connection.xml b/TelepathyQt/svc-connection.xml new file mode 100644 index 00000000..28bbb1fc --- /dev/null +++ b/TelepathyQt/svc-connection.xml @@ -0,0 +1,29 @@ +<tp:spec + xmlns:tp="http://telepathy.freedesktop.org/wiki/DbusSpec#extensions-v0" + xmlns:xi="http://www.w3.org/2001/XInclude"> + +<tp:title>Connection interfaces</tp:title> + +<xi:include href="../spec/Connection.xml"/> + +<xi:include href="../spec/Connection_Interface_Addressing.xml"/> +<xi:include href="../spec/Connection_Interface_Aliasing.xml"/> +<xi:include href="../spec/Connection_Interface_Anonymity.xml"/> +<xi:include href="../spec/Connection_Interface_Avatars.xml"/> +<xi:include href="../spec/Connection_Interface_Balance.xml"/> +<xi:include href="../spec/Connection_Interface_Cellular.xml"/> +<xi:include href="../spec/Connection_Interface_Client_Types.xml"/> +<xi:include href="../spec/Connection_Interface_Contacts.xml"/> +<xi:include href="../spec/Connection_Interface_Contact_Blocking.xml"/> +<xi:include href="../spec/Connection_Interface_Contact_Capabilities.xml"/> +<xi:include href="../spec/Connection_Interface_Contact_Groups.xml"/> +<xi:include href="../spec/Connection_Interface_Contact_Info.xml"/> +<xi:include href="../spec/Connection_Interface_Contact_List.xml"/> +<xi:include href="../spec/Connection_Interface_Location.xml"/> +<xi:include href="../spec/Connection_Interface_Mail_Notification.xml"/> +<xi:include href="../spec/Connection_Interface_Power_Saving.xml"/> +<xi:include href="../spec/Connection_Interface_Requests.xml"/> +<xi:include href="../spec/Connection_Interface_Service_Point.xml"/> +<xi:include href="../spec/Connection_Interface_Simple_Presence.xml"/> + +</tp:spec> diff --git a/examples/cm/protocol.cpp b/examples/cm/protocol.cpp index 08e4a3b5..0eab84f1 100644 --- a/examples/cm/protocol.cpp +++ b/examples/cm/protocol.cpp @@ -104,7 +104,7 @@ QString Protocol::normalizeContact(const QString &contactId, Tp::DBusError *erro return QString(); } -QString Protocol::normalizeVCardAddress(const QString &vCardField, const QString vCardAddress, +QString Protocol::normalizeVCardAddress(const QString &vcardField, const QString vcardAddress, Tp::DBusError *error) { error->set(QLatin1String("NormalizeVCardAddress.Error.Test"), QLatin1String("")); diff --git a/tests/dbus/base-protocol.cpp b/tests/dbus/base-protocol.cpp index c73c46f4..40b188cf 100644 --- a/tests/dbus/base-protocol.cpp +++ b/tests/dbus/base-protocol.cpp @@ -33,8 +33,8 @@ private: static QString identifyAccountCb(const QVariantMap ¶meters, Tp::DBusError *error); static QString normalizeContactCb(const QString &contactId, Tp::DBusError *error); - static QString normalizeVCardAddressCb(const QString &vCardField, - const QString &vCardAddress, Tp::DBusError *error); + static QString normalizeVCardAddressCb(const QString &vcardField, + const QString &vcardAddress, Tp::DBusError *error); static QString normalizeContactUriCb(const QString &uri, Tp::DBusError *error); }; @@ -165,11 +165,11 @@ QString TestBaseProtocolCM::normalizeContactCb(const QString &contactId, Tp::DBu return contactId.toLower(); } -QString TestBaseProtocolCM::normalizeVCardAddressCb(const QString &vCardField, - const QString &vCardAddress, Tp::DBusError *error) +QString TestBaseProtocolCM::normalizeVCardAddressCb(const QString &vcardField, + const QString &vcardAddress, Tp::DBusError *error) { - if (vCardField == QLatin1String("x-jabber")) { - return vCardAddress.toLower() + QLatin1String("@wonderland"); + if (vcardField == QLatin1String("x-jabber")) { + return vcardAddress.toLower() + QLatin1String("@wonderland"); } else { error->set(TP_QT_ERROR_NOT_IMPLEMENTED, QLatin1String("Invalid VCard field")); return QString(); @@ -214,7 +214,7 @@ void TestBaseProtocol::protocolObjectSvcSideCb(TestBaseProtocolCMPtr &cm) //basic properties QCOMPARE(protocol->name(), QLatin1String("example")); - QCOMPARE(protocol->vCardField(), QLatin1String("x-telepathy-example")); + QCOMPARE(protocol->vcardField(), QLatin1String("x-telepathy-example")); QCOMPARE(protocol->englishName(), QLatin1String("Test CM")); QCOMPARE(protocol->iconName(), QLatin1String("im-icq")); QCOMPARE(protocol->connectionInterfaces(), QStringList() << @@ -414,10 +414,10 @@ void TestBaseProtocol::addressingIfaceSvcSideCb(TestBaseProtocolCMPtr &cm) QVERIFY(uriSchemes.contains(QLatin1String("xmpp"))); QVERIFY(uriSchemes.contains(QLatin1String("tel"))); - QStringList vCardFields = iface->addressableVCardFields(); - QCOMPARE(vCardFields.size(), 2); - QVERIFY(vCardFields.contains(QLatin1String("x-jabber"))); - QVERIFY(vCardFields.contains(QLatin1String("tel"))); + QStringList vcardFields = iface->addressableVCardFields(); + QCOMPARE(vcardFields.size(), 2); + QVERIFY(vcardFields.contains(QLatin1String("x-jabber"))); + QVERIFY(vcardFields.contains(QLatin1String("tel"))); //no immutable properties QVERIFY(iface->immutableProperties().isEmpty()); @@ -467,10 +467,10 @@ void TestBaseProtocol::addressingIfaceClientSide() QVERIFY(uriSchemes.contains(QLatin1String("xmpp"))); QVERIFY(uriSchemes.contains(QLatin1String("tel"))); - QStringList vCardFields = protocol.addressableVCardFields(); - QCOMPARE(vCardFields.size(), 2); - QVERIFY(vCardFields.contains(QLatin1String("x-jabber"))); - QVERIFY(vCardFields.contains(QLatin1String("tel"))); + QStringList vcardFields = protocol.addressableVCardFields(); + QCOMPARE(vcardFields.size(), 2); + QVERIFY(vcardFields.contains(QLatin1String("x-jabber"))); + QVERIFY(vcardFields.contains(QLatin1String("tel"))); //methods PendingString *str = protocol.normalizeVCardAddress(QLatin1String("x-jabber"), diff --git a/tools/qt-svc-gen.py b/tools/qt-svc-gen.py index 1763c81b..58b77bb7 100644 --- a/tools/qt-svc-gen.py +++ b/tools/qt-svc-gen.py @@ -33,17 +33,16 @@ def to_lower_camel_case(s): i = 0 for c in s: - if not c.isupper(): + if c == '_': break i += 1 ret = s - if i == 1: - ret = s[0:i].lower() + s[i:] - elif i == len(s): + if i == len(s): return s.lower() else: - ret = s[0:i-1].lower() + s[i-1:] + ret = s[0:i].lower() + s[i:] + ret = ret.replace('_', '') return ret class Generator(object): @@ -437,7 +436,7 @@ Q_SIGNALS: // SIGNALS def do_prop(self, ifacename, prop): name = prop.getAttribute('name') - adaptee_name = to_lower_camel_case(name) + adaptee_name = to_lower_camel_case(prop.getAttribute('tp:name-for-bindings')) access = prop.getAttribute('access') gettername = name settername = None @@ -511,7 +510,7 @@ void %(ifacename)s::%(settername)s(const %(type)s &newValue) def do_method(self, ifacename, method): name = method.getAttribute('name') - adaptee_name = to_lower_camel_case(name) + adaptee_name = to_lower_camel_case(method.getAttribute('tp:name-for-bindings')) args = get_by_path(method, 'arg') argnames, argdocstrings, argbindings = extract_arg_or_member_info(args, self.custom_lists, self.externals, self.typesnamespace, self.refs, ' * ') @@ -662,7 +661,7 @@ void %(ifacename)s::%(settername)s(const %(type)s &newValue) def do_signal(self, signal): name = signal.getAttribute('name') - adaptee_name = to_lower_camel_case(name) + adaptee_name = to_lower_camel_case(signal.getAttribute('tp:name-for-bindings')) argnames, argdocstrings, argbindings = extract_arg_or_member_info(get_by_path(signal, 'arg'), self.custom_lists, self.externals, self.typesnamespace, self.refs, ' * ') params = ', '.join(['%s %s' % (binding.inarg, param_name) for binding, param_name in zip(argbindings, argnames)]) @@ -702,7 +701,7 @@ void %(ifacename)s::%(settername)s(const %(type)s &newValue) def do_signals_connect(self, signals): for signal in signals: name = signal.getAttribute('name') - adaptee_name = to_lower_camel_case(name) + adaptee_name = to_lower_camel_case(signal.getAttribute('tp:name-for-bindings')) _, _, argbindings = extract_arg_or_member_info(get_by_path(signal, 'arg'), self.custom_lists, self.externals, self.typesnamespace, self.refs, ' * ') |