Let kquitapp fail verbosely
Aaron J. Seigo
aseigo at kde.org
Mon May 26 05:42:36 BST 2008
On Saturday 24 May 2008, Stefan Monov wrote:
> those are used throughout KDE), so I picked what's nicest - cerr. ;)
> Also I'm unsure whether the toLocal8bit conversion is needed.
> Can I commit?
+ if (interface.lastError().type() == QDBusError::ServiceUnknown)
+ {
+ std::cerr << i18n("%1: no application quitted",
args->arg(0)).toLocal8Bit().data() << std::endl;
+ }
this is a good thing to add imho. i would, however, probably write it
something like the following 100% untested and uncompiled code:
QDBusInterface interface(service, path);
if (!interface.isValid()) {
kFatal() << i18n("Application \"%1\" could not be found using service
\"%2\" and path \"%3\".").arg(args.arg(0), service, path);
}
interface.call("quit");
QDBusError error = interface.lastError();
if (error.type() != QDBusError::NoError) {
kFatal() << i18n("Quitting application \"%1\" failed. Error reported was:
\n\n \"%2: %3\"").arg(args.arg(0), error.name(), error.message());
}
return 0;
the kFatal's will quit the app with a non-zero return.. but yeah.. good thing
to add in any case.
--
Aaron J. Seigo
humru othro a kohnu se
GPG Fingerprint: 8B8B 2209 0C6F 7C47 B1EA EE75 D6B7 2EB1 A7F1 DB43
KDE core developer sponsored by Trolltech
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 194 bytes
Desc: This is a digitally signed message part.
URL: <http://mail.kde.org/pipermail/kde-core-devel/attachments/20080525/8096eeb2/attachment.sig>
More information about the kde-core-devel
mailing list