2 // Copyright (C) 1998 Matthias Hoelzer <hoelzer@kde.org>
3 // Copyright (C) 2002 David Faure <faure@kde.org>
4 // Copyright (C) 2005 Brad Hards <bradh@frogmouth.net>
6 // This program is free software; you can redistribute it and/or modify
7 // it under the terms of the GNU General Public License as published by
8 // the Free Software Foundation; either version 2 of the License, or
9 // (at your option) any later version.
11 // This program is distributed in the hope that it will be useful,
12 // but WITHOUT ANY WARRANTY; without even the7 implied warranty of
13 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 // GNU General Public License for more details.
16 // You should have received a copy of the GNU General Public License
17 // along with this program; if not, write to the Free Software
18 // Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
25 #include <kmessagebox.h>
26 #include <kapplication.h>
27 #include <kpassivepopup.h>
28 #include <krecentdocument.h>
29 #include <kcmdlineargs.h>
30 #include <kaboutdata.h>
31 #include <kfiledialog.h>
32 #include <kicondialog.h>
33 #include <kdirselectdialog.h>
34 #include <kcolordialog.h>
35 #include <kwindowsystem.h>
37 #include <QtCore/QTimer>
38 #include <QtGui/QDesktopWidget>
42 #if defined Q_WS_X11 && ! defined K_WS_QTONLY
47 #include <QtGui/QFileDialog>
53 // this class hooks into the eventloop and outputs the id
54 // of shown dialogs or makes the dialog transient for other winids.
55 // Will destroy itself on app exit.
56 class WinIdEmbedder
: public QObject
59 WinIdEmbedder(bool printID
, WId winId
):
60 QObject(kapp
), print(printID
), id(winId
)
63 kapp
->installEventFilter(this);
66 bool eventFilter(QObject
*o
, QEvent
*e
);
72 bool WinIdEmbedder::eventFilter(QObject
*o
, QEvent
*e
)
74 if (e
->type() == QEvent::Show
&& o
->isWidgetType()
75 && o
->inherits("KDialog"))
77 QWidget
*w
= static_cast<QWidget
*>(o
);
79 cout
<< "winId: " << w
->winId() << endl
;
81 KWindowSystem::setMainWindow(w
, id
);
82 deleteLater(); // WinIdEmbedder is not needed anymore after the first dialog was shown
85 return QObject::eventFilter(o
, e
);
88 static void outputStringList(const QStringList
&list
, bool separateOutput
)
90 if ( separateOutput
) {
91 for ( QStringList::ConstIterator it
= list
.begin(); it
!= list
.end(); ++it
) {
92 cout
<< (*it
).toLocal8Bit().data() << endl
;
95 for ( QStringList::ConstIterator it
= list
.begin(); it
!= list
.end(); ++it
) {
96 cout
<< (*it
).toLocal8Bit().data() << " ";
102 static int directCommand(KCmdLineArgs
*args
)
105 bool separateOutput
= false;
106 bool printWId
= args
->isSet("print-winid");
107 QString defaultEntry
;
110 KCmdLineArgs
*qtargs
= KCmdLineArgs::parsedArgs("qt"); // --title is a qt option
111 if(qtargs
->isSet("title")) {
112 title
= qtargs
->getOption("title");
116 if (args
->isSet("separate-output"))
118 separateOutput
= true;
122 bool attach
= args
->isSet("attach");
125 winid
= reinterpret_cast<WId
>(args
->getOption("attach").toLong(&attach
, 0)); //C style parsing. If the string begins with "0x", base 16 is used; if the string begins with "0", base 8 is used; otherwise, base 10 is used.
127 winid
= args
->getOption("attach").toLong(&attach
, 0); //C style parsing. If the string begins with "0x", base 16 is used; if the string begins with "0", base 8 is used; otherwise, base 10 is used.
129 } else if(args
->isSet("embed")) {
130 /* KDialog originally used --embed for attaching the dialog box. However this is misleading and so we changed to --attach.
131 * For consistancy, we silently map --embed to --attach */
134 winid
= reinterpret_cast<WId
>(args
->getOption("embed").toLong(&attach
, 0)); //C style parsing. If the string begins with "0x", base 16 is used; if the string begins with "0", base 8 is used; otherwise, base 10 is used.
136 winid
= args
->getOption("embed").toLong(&attach
, 0); //C style parsing. If the string begins with "0x", base 16 is used; if the string begins with "0", base 8 is used; otherwise, base 10 is used.
140 if (printWId
|| attach
)
142 (void)new WinIdEmbedder(printWId
, winid
);
145 // --yesno and other message boxes
146 KMessageBox::DialogType type
= (KMessageBox::DialogType
) 0;
148 if (args
->isSet("yesno")) {
150 type
= KMessageBox::QuestionYesNo
;
152 else if (args
->isSet("yesnocancel")) {
153 option
= "yesnocancel";
154 type
= KMessageBox::QuestionYesNoCancel
;
156 else if (args
->isSet("warningyesno")) {
157 option
= "warningyesno";
158 type
= KMessageBox::WarningYesNo
;
160 else if (args
->isSet("warningcontinuecancel")) {
161 option
= "warningcontinuecancel";
162 type
= KMessageBox::WarningContinueCancel
;
164 else if (args
->isSet("warningyesnocancel")) {
165 option
= "warningyesnocancel";
166 type
= KMessageBox::WarningYesNoCancel
;
168 else if (args
->isSet("sorry")) {
170 type
= KMessageBox::Sorry
;
172 else if (args
->isSet("error")) {
174 type
= KMessageBox::Error
;
176 else if (args
->isSet("msgbox")) {
178 type
= KMessageBox::Information
;
181 if ( !option
.isEmpty() )
183 KConfig
* dontagaincfg
= NULL
;
185 QString dontagain
; // QString()
186 if (args
->isSet("dontagain"))
188 QString value
= args
->getOption("dontagain");
189 QStringList values
= value
.split( ':', QString::SkipEmptyParts
);
190 if( values
.count() == 2 )
192 dontagaincfg
= new KConfig( values
[ 0 ] );
193 KMessageBox::setDontShowAskAgainConfig( dontagaincfg
);
194 dontagain
= values
[ 1 ];
197 qDebug( "Incorrect --dontagain!" );
201 QString text
= args
->getOption( option
);
203 while ((pos
= text
.indexOf( QLatin1String("\\n") )) >= 0)
205 text
.replace(pos
, 2, QLatin1String("\n"));
208 if ( type
== KMessageBox::WarningContinueCancel
) {
209 /* TODO configurable button texts*/
210 ret
= KMessageBox::messageBox( 0, type
, text
, title
, KStandardGuiItem::cont(),
211 KStandardGuiItem::no(), KStandardGuiItem::cancel(), dontagain
);
213 ret
= KMessageBox::messageBox( 0, type
, text
, title
/*, TODO configurable button texts*/,
214 KStandardGuiItem::yes(), KStandardGuiItem::no(), KStandardGuiItem::cancel(), dontagain
);
217 // ret is 1 for Ok, 2 for Cancel, 3 for Yes, 4 for No and 5 for Continue.
218 // We want to return 0 for ok, yes and continue, 1 for no and 2 for cancel
219 return (ret
== KMessageBox::Ok
|| ret
== KMessageBox::Yes
|| ret
== KMessageBox::Continue
) ? 0
220 : ( ret
== KMessageBox::No
? 1 : 2 );
223 // --inputbox text [init]
224 if (args
->isSet("inputbox"))
229 if (args
->count() > 0)
232 bool retcode
= Widgets::inputBox(0, title
, args
->getOption("inputbox"), init
, result
);
233 cout
<< result
.toLocal8Bit().data() << endl
;
234 return retcode
? 0 : 1;
239 if (args
->isSet("password"))
242 bool retcode
= Widgets::passwordBox(0, title
, args
->getOption("password"), result
);
243 cout
<< qPrintable(result
) << endl
;
244 return retcode
? 0 : 1;
248 if (args
->isSet("passivepopup"))
251 if (args
->count() > 0)
252 duration
= 1000 * args
->arg(0).toInt();
255 KPassivePopup
*popup
= KPassivePopup::message( KPassivePopup::Boxed
, // style
257 args
->getOption("passivepopup"),
258 QPixmap() /* do not crash 0*/, // icon
259 (QWidget
*)0UL, // parent
261 KDialog::centerOnScreen( popup
);
262 QTimer
*timer
= new QTimer();
263 QObject::connect( timer
, SIGNAL( timeout() ), kapp
, SLOT( quit() ) );
264 QObject::connect( popup
, SIGNAL( clicked() ), kapp
, SLOT( quit() ) );
265 timer
->setSingleShot( true );
266 timer
->start( duration
);
270 KCmdLineArgs
*args
= KCmdLineArgs::parsedArgs("kde");
271 if (args
&& args
->isSet("geometry"))
272 geometry
= args
->getOption("geometry");
273 if ( !geometry
.isEmpty()) {
276 int m
= XParseGeometry( geometry
.toLatin1(), &x
, &y
, (unsigned int*)&w
, (unsigned int*)&h
);
277 if ( (m
& XNegative
) )
278 x
= KApplication::desktop()->width() + x
- w
;
279 if ( (m
& YNegative
) )
280 y
= KApplication::desktop()->height() + y
- h
;
281 popup
->setAnchor( QPoint(x
, y
) );
288 // --textbox file [width] [height]
289 if (args
->isSet("textbox"))
294 if (args
->count() == 2) {
295 w
= args
->arg(0).toInt();
296 h
= args
->arg(1).toInt();
299 return Widgets::textBox(0, w
, h
, title
, args
->getOption("textbox"));
302 // --textinputbox file [width] [height]
303 if (args
->isSet("textinputbox"))
308 if (args
->count() == 4) {
309 w
= args
->arg(2).toInt();
310 h
= args
->arg(3).toInt();
314 list
.append(args
->getOption("textinputbox"));
316 if (args
->count() >= 1) {
317 for (int i
= 0; i
< args
->count(); i
++)
318 list
.append(args
->arg(i
));
322 int ret
= Widgets::textInputBox(0, w
, h
, title
, list
, result
);
323 cout
<< qPrintable(result
) << endl
;
327 // --combobox <text> [tag item] [tag item] ..."
328 if (args
->isSet("combobox")) {
330 if (args
->count() >= 2) {
331 for (int i
= 0; i
< args
->count(); i
++) {
332 list
.append(args
->arg(i
));
334 QString text
= args
->getOption("combobox");
335 if (args
->isSet("default")) {
336 defaultEntry
= args
->getOption("default");
339 bool retcode
= Widgets::comboBox(0, title
, text
, list
, defaultEntry
, result
);
340 cout
<< result
.toLocal8Bit().data() << endl
;
341 return retcode
? 0 : 1;
346 // --menu text [tag item] [tag item] ...
347 if (args
->isSet("menu")) {
349 if (args
->count() >= 2) {
350 for (int i
= 0; i
< args
->count(); i
++) {
351 list
.append(args
->arg(i
));
353 QString text
= args
->getOption("menu");
354 if (args
->isSet("default")) {
355 defaultEntry
= args
->getOption("default");
358 bool retcode
= Widgets::listBox(0, title
, text
, list
, defaultEntry
, result
);
359 if (1 == retcode
) { // OK was selected
360 cout
<< result
.toLocal8Bit().data() << endl
;
362 return retcode
? 0 : 1;
367 // --checklist text [tag item status] [tag item status] ...
368 if (args
->isSet("checklist")) {
370 if (args
->count() >= 3) {
371 for (int i
= 0; i
< args
->count(); i
++) {
372 list
.append(args
->arg(i
));
375 QString text
= args
->getOption("checklist");
378 bool retcode
= Widgets::checkList(0, title
, text
, list
, separateOutput
, result
);
380 for (int i
=0; i
<result
.count(); i
++)
381 if (!result
.at(i
).toLocal8Bit().isEmpty()) {
382 cout
<< result
.at(i
).toLocal8Bit().data() << endl
;
384 exit( retcode
? 0 : 1 );
389 // --radiolist text width height menuheight [tag item status]
390 if (args
->isSet("radiolist")) {
392 if (args
->count() >= 3) {
393 for (int i
= 0; i
< args
->count(); i
++) {
394 list
.append(args
->arg(i
));
397 QString text
= args
->getOption("radiolist");
399 bool retcode
= Widgets::radioBox(0, title
, text
, list
, result
);
400 cout
<< result
.toLocal8Bit().data() << endl
;
401 exit( retcode
? 0 : 1 );
406 // getopenfilename [startDir] [filter]
407 if (args
->isSet("getopenfilename")) {
410 startDir
= args
->getOption("getopenfilename");
411 if (args
->count() >= 1) {
412 filter
= args
->arg(0);
414 KFileDialog
dlg( startDir
, filter
, 0 );
415 dlg
.setOperationMode( KFileDialog::Opening
);
417 if (args
->isSet("multiple")) {
418 dlg
.setMode(KFile::Files
| KFile::LocalOnly
);
420 dlg
.setMode(KFile::File
| KFile::LocalOnly
);
422 Widgets::handleXGeometry(&dlg
);
423 kapp
->setTopWidget( &dlg
);
424 dlg
.setCaption(title
.isNull() ? i18n("Open") : title
);
427 if (args
->isSet("multiple")) {
428 QStringList result
= dlg
.selectedFiles();
429 if ( !result
.isEmpty() ) {
430 outputStringList( result
, separateOutput
);
434 QString result
= dlg
.selectedFile();
435 if (!result
.isEmpty()) {
436 cout
<< result
.toLocal8Bit().data() << endl
;
440 return 1; // canceled
444 // getsaveurl [startDir] [filter]
445 // getsavefilename [startDir] [filter]
446 if ( (args
->isSet("getsavefilename") ) || (args
->isSet("getsaveurl") ) ) {
449 if ( args
->isSet("getsavefilename") ) {
450 startDir
= args
->getOption("getsavefilename");
452 startDir
= args
->getOption("getsaveurl");
454 if (args
->count() >= 1) {
455 filter
= args
->arg(0);
457 // copied from KFileDialog::getSaveFileName(), so we can add geometry
458 bool specialDir
= ( startDir
.at(0) == ':' );
459 KFileDialog
dlg( specialDir
? startDir
: QString(), filter
, 0 );
461 dlg
.setSelection( startDir
);
462 dlg
.setOperationMode( KFileDialog::Saving
);
463 Widgets::handleXGeometry(&dlg
);
464 kapp
->setTopWidget( &dlg
);
465 dlg
.setCaption(title
.isNull() ? i18n("Save As") : title
);
468 if ( args
->isSet("getsaveurl") ) {
469 KUrl result
= dlg
.selectedUrl();
470 if ( result
.isValid()) {
472 cout
<< result
.url().toLocal8Bit().data() << endl
;
475 } else { // getsavefilename
476 QString result
= dlg
.selectedFile();
477 if (!result
.isEmpty()) {
478 KRecentDocument::add(result
);
479 cout
<< result
.toLocal8Bit().data() << endl
;
483 return 1; // canceled
486 // getexistingdirectory [startDir]
487 if (args
->isSet("getexistingdirectory")) {
489 startDir
= args
->getOption("getexistingdirectory");
492 result
= QFileDialog::getExistingDirectory( 0, title
, startDir
,
493 QFileDialog::DontResolveSymlinks
|
494 QFileDialog::ShowDirsOnly
);
497 KDirSelectDialog
myDialog( startDir
, true, 0 );
499 kapp
->setTopWidget( &myDialog
);
501 Widgets::handleXGeometry(&myDialog
);
502 if ( !title
.isNull() )
503 myDialog
.setCaption( title
);
505 if ( myDialog
.exec() == QDialog::Accepted
)
506 url
= myDialog
.url();
511 if (!result
.isEmpty()) {
512 cout
<< result
.toLocal8Bit().data() << endl
;
515 return 1; // canceled
518 // getopenurl [startDir] [filter]
519 if (args
->isSet("getopenurl")) {
522 startDir
= args
->getOption("getopenurl");
523 if (args
->count() >= 1) {
524 filter
= args
->arg(0);
526 KFileDialog
dlg( startDir
, filter
, 0 );
527 dlg
.setOperationMode( KFileDialog::Opening
);
529 if (args
->isSet("multiple")) {
530 dlg
.setMode(KFile::Files
);
532 dlg
.setMode(KFile::File
);
534 Widgets::handleXGeometry(&dlg
);
535 kapp
->setTopWidget( &dlg
);
536 dlg
.setCaption(title
.isNull() ? i18n("Open") : title
);
539 if (args
->isSet("multiple")) {
540 KUrl::List result
= dlg
.selectedUrls();
541 if ( !result
.isEmpty() ) {
542 outputStringList( result
.toStringList(), separateOutput
);
546 KUrl result
= dlg
.selectedUrl();
547 if (!result
.isEmpty()) {
548 cout
<< result
.url().toLocal8Bit().data() << endl
;
552 return 1; // canceled
555 // geticon [group] [context]
556 if (args
->isSet("geticon")) {
557 QString groupStr
, contextStr
;
558 groupStr
= args
->getOption("geticon");
559 if (args
->count() >= 1) {
560 contextStr
= args
->arg(0);
562 KIconLoader::Group group
= KIconLoader::NoGroup
;
563 if ( groupStr
== QLatin1String( "Desktop" ) )
564 group
= KIconLoader::Desktop
;
565 else if ( groupStr
== QLatin1String( "Toolbar" ) )
566 group
= KIconLoader::Toolbar
;
567 else if ( groupStr
== QLatin1String( "MainToolbar" ) )
568 group
= KIconLoader::MainToolbar
;
569 else if ( groupStr
== QLatin1String( "Small" ) )
570 group
= KIconLoader::Small
;
571 else if ( groupStr
== QLatin1String( "Panel" ) )
572 group
= KIconLoader::Panel
;
573 else if ( groupStr
== QLatin1String( "User" ) )
574 group
= KIconLoader::User
;
575 KIconLoader::Context context
= KIconLoader::Any
;
576 // From kicontheme.cpp
577 if ( contextStr
== QLatin1String( "Devices" ) )
578 context
= KIconLoader::Device
;
579 else if ( contextStr
== QLatin1String( "MimeTypes" ) )
580 context
= KIconLoader::MimeType
;
581 else if ( contextStr
== QLatin1String( "FileSystems" ) )
582 context
= KIconLoader::FileSystem
;
583 else if ( contextStr
== QLatin1String( "Applications" ) )
584 context
= KIconLoader::Application
;
585 else if ( contextStr
== QLatin1String( "Actions" ) )
586 context
= KIconLoader::Action
;
588 KIconDialog
dlg((QWidget
*)0L);
589 kapp
->setTopWidget( &dlg
);
590 dlg
.setup( group
, context
);
592 dlg
.setCaption(title
);
593 Widgets::handleXGeometry(&dlg
);
595 QString result
= dlg
.openDialog();
597 if (!result
.isEmpty()) {
598 cout
<< result
.toLocal8Bit().data() << endl
;
601 return 1; // canceled
604 // --progressbar text totalsteps
605 if (args
->isSet("progressbar"))
607 cout
<< "org.kde.kdialog-" << getpid() << " /ProgressDialog" << endl
;
612 int totalsteps
= 100;
613 QString text
= args
->getOption("progressbar");
615 if (args
->count() == 1)
616 totalsteps
= args
->arg(0).toInt();
618 return Widgets::progressBar(0, title
, text
, totalsteps
) ? 1 : 0;
622 if (args
->isSet("getcolor")) {
623 KColorDialog
dlg((QWidget
*)0L, true);
625 if (args
->isSet("default")) {
626 defaultEntry
= args
->getOption("default");
627 dlg
.setColor(defaultEntry
);
629 Widgets::handleXGeometry(&dlg
);
630 kapp
->setTopWidget(&dlg
);
631 dlg
.setCaption(title
.isNull() ? i18n("Choose Color") : title
);
633 if (dlg
.exec() == KColorDialog::Accepted
) {
635 if (dlg
.color().isValid()) {
636 result
= dlg
.color().name();
638 result
= dlg
.defaultColor().name();
640 cout
<< result
.toLocal8Bit().data() << endl
;
643 return 1; // cancelled
645 if (args
->isSet("slider"))
650 QString text
= args
->getOption( "slider" );
651 if ( args
->count() == 3 )
653 miniValue
= args
->arg(0).toInt();
654 maxValue
= args
->arg( 1 ).toInt();
655 step
= args
->arg( 2 ).toInt();
659 bool returnCode
= Widgets::slider(0, title
, text
, miniValue
, maxValue
, step
, result
);
661 cout
<< result
<< endl
;
664 if (args
->isSet("calendar"))
666 QString text
= args
->getOption( "calendar" );
669 bool returnCode
= Widgets::calendar(0, title
, text
, result
);
671 cout
<< result
.toString().toLocal8Bit().data() << endl
;
675 KCmdLineArgs::usage();
676 return -2; // NOTREACHED
680 int main(int argc
, char *argv
[])
682 KAboutData
aboutData( "kdialog", 0, ki18n("KDialog"),
683 "1.0", ki18n( "KDialog can be used to show nice dialog boxes from shell scripts" ),
684 KAboutData::License_GPL
,
685 ki18n("(C) 2000, Nick Thompson"));
686 aboutData
.addAuthor(ki18n("David Faure"), ki18n("Current maintainer"),"faure@kde.org");
687 aboutData
.addAuthor(ki18n("Brad Hards"), KLocalizedString(), "bradh@frogmouth.net");
688 aboutData
.addAuthor(ki18n("Nick Thompson"),KLocalizedString(), 0/*"nickthompson@lucent.com" bounces*/);
689 aboutData
.addAuthor(ki18n("Matthias Hölzer"),KLocalizedString(),"hoelzer@kde.org");
690 aboutData
.addAuthor(ki18n("David Gümbel"),KLocalizedString(),"david.guembel@gmx.net");
691 aboutData
.addAuthor(ki18n("Richard Moore"),KLocalizedString(),"rich@kde.org");
692 aboutData
.addAuthor(ki18n("Dawit Alemayehu"),KLocalizedString(),"adawit@kde.org");
693 aboutData
.setProgramIconName("system-run");
696 KCmdLineArgs::init(argc
, argv
, &aboutData
);
698 KCmdLineOptions options
;
699 options
.add("yesno <text>", ki18n("Question message box with yes/no buttons"));
700 options
.add("yesnocancel <text>", ki18n("Question message box with yes/no/cancel buttons"));
701 options
.add("warningyesno <text>", ki18n("Warning message box with yes/no buttons"));
702 options
.add("warningcontinuecancel <text>", ki18n("Warning message box with continue/cancel buttons"));
703 options
.add("warningyesnocancel <text>", ki18n("Warning message box with yes/no/cancel buttons"));
704 options
.add("sorry <text>", ki18n("'Sorry' message box"));
705 options
.add("error <text>", ki18n("'Error' message box"));
706 options
.add("msgbox <text>", ki18n("Message Box dialog"));
707 options
.add("inputbox <text> <init>", ki18n("Input Box dialog"));
708 options
.add("password <text>", ki18n("Password dialog"));
709 options
.add("textbox <file> [width] [height]", ki18n("Text Box dialog"));
710 options
.add("textinputbox <text> <init> [width] [height]", ki18n("Text Input Box dialog"));
711 options
.add("combobox <text> [tag item] [tag item] ...", ki18n("ComboBox dialog"));
712 options
.add("menu <text> [tag item] [tag item] ...", ki18n("Menu dialog"));
713 options
.add("checklist <text> [tag item status] ...", ki18n("Check List dialog"));
714 options
.add("radiolist <text> [tag item status] ...", ki18n("Radio List dialog"));
715 options
.add("passivepopup <text> <timeout>", ki18n("Passive Popup"));
716 options
.add("getopenfilename [startDir] [filter]", ki18n("File dialog to open an existing file"));
717 options
.add("getsavefilename [startDir] [filter]", ki18n("File dialog to save a file"));
718 options
.add("getexistingdirectory [startDir]", ki18n("File dialog to select an existing directory"));
719 options
.add("getopenurl [startDir] [filter]", ki18n("File dialog to open an existing URL"));
720 options
.add("getsaveurl [startDir] [filter]", ki18n("File dialog to save a URL"));
721 options
.add("geticon [group] [context]", ki18n("Icon chooser dialog"));
722 options
.add("progressbar <text> [totalsteps]", ki18n("Progress bar dialog, returns a D-Bus reference for communication"));
723 options
.add("getcolor", ki18n("Color dialog to select a color"));
724 // TODO gauge stuff, reading values from stdin
725 options
.add("title <text>", ki18n("Dialog title"));
726 options
.add("default <text>", ki18n("Default entry to use for combobox, menu and color"));
727 options
.add("multiple", ki18n("Allows the --getopenurl and --getopenfilename options to return multiple files"));
728 options
.add("separate-output", ki18n("Return list items on separate lines (for checklist option and file open with --multiple)"));
729 options
.add("print-winid", ki18n("Outputs the winId of each dialog"));
730 options
.add("dontagain <file:entry>", ki18n("Config file and option name for saving the \"do-not-show/ask-again\" state"));
731 options
.add( "slider <text> [minvalue] [maxvalue] [step]", ki18n( "Slider dialogbox, returns value selected" ) );
732 options
.add( "calendar <text>", ki18n( "Calendar dialogbox, return selected date" ) );
733 /* kdialog originally used --embed for attaching the dialog box. However this is misleading and so we changed to --attach.
734 * For backwards compatibility, we silently map --embed to --attach */
735 options
.add("attach <winid>", ki18n("Makes the dialog transient for an X app specified by winid"));
736 options
.add("embed <winid>");
738 options
.add("+[arg]", ki18n("Arguments - depending on main option"));
740 KCmdLineArgs::addCmdLineOptions( options
); // Add our own options.
744 KCmdLineArgs
*args
= KCmdLineArgs::parsedArgs();
746 // execute direct kdialog command
747 return directCommand(args
);