kdecore/util/klauncher_iface.h - why oh why?

Thiago Macieira thiago at kde.org
Tue Apr 7 17:27:04 BST 2009


Em Terça-feira 07 Abril 2009, às 16:38:04, Lubos Lunak escreveu:
> src/src/kdelibs/kdecore/util/klauncher_iface.h:
>     inline QDBusReply<void> autoStart(int phase)
>     {
>         QList<QVariant> argumentList;
>         argumentList << qVariantFromValue(phase);
>         return callWithArgumentList(QDBus::Block,
> QLatin1String("autoStart"), argumentList);
>     }
>
> build/kdebase/workspace/ksmserver/klauncher_interface.h:
>     inline QDBusPendingReply<> autoStart(int phase)
>     {
>         QList<QVariant> argumentList;
>         argumentList << qVariantFromValue(phase);
>         return asyncCallWithArgumentList(QLatin1String("autoStart"),
> argumentList);
>     }
>
> Hint: Return type. First one is from qdbusxml2cpp v0.6, the second v0.7.
> Since 0.6 was part of e.g. Qt-4.2.2, this is apparently not supposed to
> produce something stable in time.
>
>  Thiago: Can something like this happen again?

Yes.

qdbusxml2cpp output is source-compatible only. It's not meant to be used in 
public API, which is why the klauncher interface is hand-edited to include the 
KDECORE_EXPORT macro.

The mistake was to not rename the class.

But I didn't foresee binary incompatible changes in 2006. I only expected the 
interface to grow in a binary-compatible way (addition of new methods). The 
QDBusReply<void> to QDBusPendingReply<> is a Qt 4.5 innovation. In 2006, I 
expected to add an overload (or another function) that would take a QObject 
and a slot to receive the parameter.

I blame Olivier for giving me the idea of making it like QFuture :-)

>  But I guess that either way this leaves only the option of making
> ksmserver use the kdecore version and revisit this for KDE5.

There's another option: to pass the -c ClassName to qdbusxml2cpp in ksmserver 
to produce a class with a different name.

See the output of:
qdbus org.kde.klauncher /KLauncher Introspect | \
	qdbusxml2cpp -c Foo -p - /dev/stdin org.kde.KLauncher

(the typedefs will conflict only if you #include both files)

-- 
Thiago Macieira - thiago (AT) macieira.info - thiago (AT) kde.org
  Senior Product Manager - Nokia, Qt Software
      PGP/GPG: 0x6EF45358; fingerprint:
      E067 918B B660 DBD1 105C  966C 33F5 F005 6EF4 5358
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 189 bytes
Desc: This is a digitally signed message part.
URL: <http://mail.kde.org/pipermail/kde-core-devel/attachments/20090407/18f5e53a/attachment.sig>


More information about the kde-core-devel mailing list