Bug 57040 - Title option doesn't work
Summary: Title option doesn't work
Status: RESOLVED FIXED
Alias: None
Product: kdialog
Classification: Applications
Component: general (show other bugs)
Version: unspecified
Platform: Compiled Sources Linux
: NOR normal
Target Milestone: ---
Assignee: David Faure
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2003-04-09 12:22 UTC by Jason
Modified: 2003-04-09 12:48 UTC (History)
0 users

See Also:
Latest Commit:
Version Fixed In:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Jason 2003-04-09 12:22:05 UTC
Version:            (using KDE Devel)
Installed from:    Compiled sources
Compiler:          gcc 3.2 
OS:          Linux

Have just been playing around with kdialog and discovered the --title option doesn't set the title on the message box. For example:

kdialog --title "Fortune Cookie" --msgbox "`fortune`"

displays the fortune cookie, but does not display "Fortune Cookie" in the title bar". The test script also exhibits this behaviour.

Using KDE 3_1_BRANCH
Comment 1 David Faure 2003-04-09 12:48:16 UTC
Subject: kdebase/kdialog

CVS commit by faure: 

--title is filtered out by Qt, let's use --caption instead
CCMAIL: 57040-done@bugs.kde.org


  M +4 -4      kdialog.cpp   1.9
  M +7 -7      test   1.2


--- kdebase/kdialog/kdialog.cpp  #1.8:1.9
@@ -67,5 +67,5 @@ static KCmdLineOptions options[] =
 
 
-    { "title <text>", I18N_NOOP("Dialog title"), 0 },
+    { "caption <text>", I18N_NOOP("Dialog caption (title)"), 0 },
     { "separate-output", I18N_NOOP("Return list items on separate lines (for checklist option)"), 0 },
 
@@ -89,8 +89,8 @@ int directCommand(KCmdLineArgs *args)
     bool separateOutput = FALSE;
 
-    // --title text
-    if (args->isSet("title"))
+    // --caption text
+    if (args->isSet("caption"))
     {
-      title = QString::fromLocal8Bit(args->getOption("title"));
+      title = QString::fromLocal8Bit(args->getOption("caption"));
       cout << title.local8Bit().data() << endl;
     }

--- kdebase/kdialog/test  #1.1.1.1:1.2
@@ -1,4 +1,4 @@
 echo "yesno box:"
-kdialog --title "This is a yesno box" --yesno "Choose: yes or no"
+kdialog --caption "This is a yesno box" --yesno "Choose: yes or no"
 if [ $? = 0 ]; then
   echo " your choice was: yes"
@@ -8,8 +8,8 @@
 
 echo "message box:"
-kdialog --title "This is a message" --msgbox "Well, this is it:\nthe message"
+kdialog --caption "This is a message" --msgbox "Well, this is it:\nthe message"
 
 echo "input box:"
-kdialog --title "This is a input box" --inputbox "What is your name" "Joe User"
+kdialog --caption "This is a input box" --inputbox "What is your name" "Joe User"
 if [ $? = 0 ]; then
   echo " you accepted"
@@ -19,12 +19,12 @@
 
 echo "text box:"
-kdialog --title "This is a text box" --textbox widgets.h 400 300
+kdialog --caption "This is a text box" --textbox widgets.h 400 300
 
 echo "menu:"
-kdialog --title "This is a menu" --menu "Choose one of these" a English b German c French d Spanish
+kdialog --caption "This is a menu" --menu "Choose one of these" a English b German c French d Spanish
 
 echo "checklist:"
-kdialog --title "This is a checklist" --checklist "Choose some of these" a English on  b German off  c French off d Spanish on
+kdialog --caption "This is a checklist" --checklist "Choose some of these" a English on  b German off  c French off d Spanish on
 
 echo "radiolist:"
-kdialog --title "This is a radiolist" --radiolist "Choose one of these" a English off b German off c French on d Spanish off
+kdialog --caption "This is a radiolist" --radiolist "Choose one of these" a English off b German off c French on d Spanish off


Comment 2 David Faure 2003-04-09 13:05:52 UTC
Subject: kdebase/kdialog

CVS commit by faure: 

Thanks Waldo, that's even better. Make --title work.
CCMAIL: 57040@bugs.kde.org


  M +5 -6      kdialog.cpp   1.10
  M +7 -7      test   1.3


--- kdebase/kdialog/kdialog.cpp  #1.9:1.10
@@ -67,5 +67,5 @@ static KCmdLineOptions options[] =
 
 
-    { "caption <text>", I18N_NOOP("Dialog caption (title)"), 0 },
+    { "title <text>", I18N_NOOP("Dialog title"), 0 },
     { "separate-output", I18N_NOOP("Return list items on separate lines (for checklist option)"), 0 },
 
@@ -89,9 +89,8 @@ int directCommand(KCmdLineArgs *args)
     bool separateOutput = FALSE;
 
-    // --caption text
-    if (args->isSet("caption"))
-    {
-      title = QString::fromLocal8Bit(args->getOption("caption"));
-      cout << title.local8Bit().data() << endl;
+    // --title text
+    KCmdLineArgs *qtargs = KCmdLineArgs::parsedArgs("qt"); // --title is a qt option
+    if(qtargs->isSet("title")) {
+      title = QFile::decodeName(qtargs->getOption("title"));
     }
 

--- kdebase/kdialog/test  #1.2:1.3
@@ -1,4 +1,4 @@
 echo "yesno box:"
-kdialog --caption "This is a yesno box" --yesno "Choose: yes or no"
+kdialog --title "This is a yesno box" --yesno "Choose: yes or no"
 if [ $? = 0 ]; then
   echo " your choice was: yes"
@@ -8,8 +8,8 @@
 
 echo "message box:"
-kdialog --caption "This is a message" --msgbox "Well, this is it:\nthe message"
+kdialog --title "This is a message" --msgbox "Well, this is it:\nthe message"
 
 echo "input box:"
-kdialog --caption "This is a input box" --inputbox "What is your name" "Joe User"
+kdialog --title "This is a input box" --inputbox "What is your name" "Joe User"
 if [ $? = 0 ]; then
   echo " you accepted"
@@ -19,12 +19,12 @@
 
 echo "text box:"
-kdialog --caption "This is a text box" --textbox widgets.h 400 300
+kdialog --title "This is a text box" --textbox widgets.h 400 300
 
 echo "menu:"
-kdialog --caption "This is a menu" --menu "Choose one of these" a English b German c French d Spanish
+kdialog --title "This is a menu" --menu "Choose one of these" a English b German c French d Spanish
 
 echo "checklist:"
-kdialog --caption "This is a checklist" --checklist "Choose some of these" a English on  b German off  c French off d Spanish on
+kdialog --title "This is a checklist" --checklist "Choose some of these" a English on  b German off  c French off d Spanish on
 
 echo "radiolist:"
-kdialog --caption "This is a radiolist" --radiolist "Choose one of these" a English off b German off c French on d Spanish off
+kdialog --title "This is a radiolist" --radiolist "Choose one of these" a English off b German off c French on d Spanish off


Comment 3 Jason 2003-04-09 13:16:05 UTC
Subject: Re:  Title option doesn't work

On Wednesday 09 April 2003 11:48 am, you wrote:
> ------- Additional Comments From faure@kde.org  2003-04-09 12:48 -------
> Subject: kdebase/kdialog
>
> CVS commit by faure:
>
> --title is filtered out by Qt, let's use --caption instead

That's why I couldn't figure out why if (args->isSet("title"))  would never go 
true. An extremely quick fix, thanks! 

I'll test as soon as it gets to the cvs mirror.

:-)