kDebug and the Application object
Michael Jansen
kde at michael-jansen.biz
Sun Apr 13 15:27:00 BST 2008
Hi
I just stumbled upon the following behavior.
Given the following code
int main (int argc, char *argv[])
{
KAboutData aboutData(
// The program name used internally.
"testcase",
// The message catalog name
// If null, program name is used instead.
0,
// A displayable program name string.
ki18n("TestCase"),
// The program version string.
"1.0",
// Short description of what the app does.
ki18n(""),
// The license this code is released under
KAboutData::License_GPL,
// Copyright Statement
ki18n("(c) 2007"),
// Optional text shown in the About box.
// Can contain any information desired.
ki18n("Some text..."));
KCmdLineArgs::init( argc, argv, &aboutData );
kWarning() << "Application starts";
KApplication app;
kWarning() << "Application starts";
KGuiItem yesButton( i18n( "Hello" ), QString(),
i18n( "This is a tooltip" ),
i18n( "This is a WhatsThis help text." ) );
KMessageBox::questionYesNo( 0, i18n( "Hello World" ),
i18n( "Hello" ), yesButton );
}
i get
<unknown program name>(11138)/ main: Application starts
testcase(11138) main: Application starts
So kDebug learns the application name sometime during the creation of the
application object. That behavior is not documented for kDebug() and friends.
I think it should be if that is indeed the correct behavior.
I stumbled upon that with an KUniqueApplication doing some checks before
starting the application and giving some info's to the user.
What am is supposed to do. I ported the printf calls used to kDebug thinking
that would be correct. Should i go back to printf and friends or is there a
way to set the application name earlier?
Mike
--
Michael Jansen
Available for contract work ( Development / Configuration Management )
http://www.michael-jansen.biz
More information about the kde-core-devel
mailing list