Command line options stripped for KUniqueApplication

Urban Widmark urban.widmark at gmail.com
Thu May 26 20:10:07 BST 2011


The kde (and qt, kuniqueapp) command line options are stripped when
using the KUniqueApplication class (saveAppArgs()/loadAppArgs()). I
believe a KApplication never has them removed.

Some options are useful for an application to receive, even if it
already has an initial window. I am looking at this from wanting to be
able to do "konsole --geometry 80x60+0+0" and have it open a window of
that size and position. Classic X geometry is either pixels or
characters, and only the application itself can know what it wants (or
for konsole perhaps how to interpret a certain size, given the tabs
and menus it has).

Examples of options that can be useful per-window are --title
--caption --fg --bg --fn. Perhaps I missed some.


Is the reason for stripping options that they should only affect the
initial instance of a KUniqueApplication? If so could it be an
alternative to instead have those reading the options check if they
are the initial instance or not? That would allow users of the
KUniqueApplication class to make other choices when it makes sense to
them as well as making it more similar to a KApplication (as I
understand it). If that sounds reasonable I'll have a look and see
what that would require.

This behaviour also breaks the suggested replacement for
KApplication::geometryArgument() in kapplication.h:
    QString geometry;
    KCmdLineArgs *args = KCmdLineArgs::parsedArgs("kde");
    if (args && args->isSet("geometry"))
        geometry = args->getOption("geometry");


A fix suggested in http://bugs.kde.org/show_bug.cgi?id=165355
("KCmdLineArgs does not save/load --geometry and --title options") is
to pass some selected options across. To me that seems more
complicated and more likely to be wrong for some odd case. But if you
think this is better I'll have a look at doing this.




More information about the kde-core-devel mailing list