diff options
Diffstat (limited to 'kdialog')
-rw-r--r-- | kdialog/kdialog.cpp | 62 | ||||
-rw-r--r-- | kdialog/progressdialog.h | 2 | ||||
-rw-r--r-- | kdialog/tdelistboxdialog.h | 2 | ||||
-rw-r--r-- | kdialog/widgets.cpp | 34 |
4 files changed, 56 insertions, 44 deletions
diff --git a/kdialog/kdialog.cpp b/kdialog/kdialog.cpp index fa2512077..5d2c90ae2 100644 --- a/kdialog/kdialog.cpp +++ b/kdialog/kdialog.cpp @@ -48,7 +48,7 @@ #include <kicondialog.h> #include <kdirselectdialog.h> -#if defined Q_WS_X11 && ! defined K_WS_QTONLY +#if defined TQ_WS_X11 && ! defined K_WS_QTONLY #include <netwm.h> #endif @@ -56,9 +56,9 @@ using namespace std; -#if defined(Q_WS_X11) +#if defined(TQ_WS_X11) extern "C" { int XSetTransientForHint( Display *, unsigned long, unsigned long ); } -#endif // Q_WS_X11 +#endif // TQ_WS_X11 static TDECmdLineOptions options[] = { @@ -95,6 +95,7 @@ static TDECmdLineOptions options[] = { "separate-output", I18N_NOOP("Return list items on separate lines (for checklist option and file open with --multiple)"), 0 }, { "print-winid", I18N_NOOP("Outputs the winId of each dialog"), 0 }, { "embed <winid>", I18N_NOOP("Makes the dialog transient for an X app specified by winid"), 0 }, + { "attach <winid>", I18N_NOOP("Alias for --embed <winid>"), 0 }, { "dontagain <file:entry>", I18N_NOOP("Config file and option name for saving the \"dont-show/ask-again\" state"), 0 }, { "+[arg]", I18N_NOOP("Arguments - depending on main option"), 0 }, @@ -125,10 +126,10 @@ bool WinIdEmbedder::eventFilter(TQObject *o, TQEvent *e) if (e->type() == TQEvent::Show && o->isWidgetType() && o->inherits("KDialog")) { - TQWidget *w = TQT_TQWIDGET(o); + TQWidget *w = static_cast<TQWidget*>(o); if (print) cout << "winId: " << w->winId() << endl; -#ifdef Q_WS_X11 +#ifdef TQ_WS_X11 if (id) XSetTransientForHint(w->x11Display(), w->winId(), id); #endif @@ -155,9 +156,9 @@ static void outputStringList(TQStringList list, bool separateOutput) static int directCommand(TDECmdLineArgs *args) { TQString title; - bool separateOutput = FALSE; + bool separateOutput = false; bool printWId = args->isSet("print-winid"); - bool embed = args->isSet("embed"); + bool embed = args->isSet("embed") || args->isSet("attach"); TQString defaultEntry; // --title text @@ -169,16 +170,27 @@ static int directCommand(TDECmdLineArgs *args) // --separate-output if (args->isSet("separate-output")) { - separateOutput = TRUE; + separateOutput = true; } if (printWId || embed) { WId id = 0; if (embed) { bool ok; - long l = args->getOption("embed").toLong(&ok); + long l = 0; + if (args->isSet("embed")) + { + l = args->getOption("embed").toLong(&ok); + } + else if (args->isSet("attach")) + { + l = args->getOption("attach").toLong(&ok); + } + if (ok) - id = (WId)l; + { + id = (WId)l; + } } (void)new WinIdEmbedder(printWId, id); } @@ -301,15 +313,15 @@ static int directCommand(TDECmdLineArgs *args) 0, // name duration ); TQTimer *timer = new TQTimer(); - TQObject::connect( timer, TQT_SIGNAL( timeout() ), kapp, TQT_SLOT( quit() ) ); - TQObject::connect( popup, TQT_SIGNAL( clicked() ), kapp, TQT_SLOT( quit() ) ); - timer->start( duration, TRUE ); + TQObject::connect( timer, TQ_SIGNAL( timeout() ), tdeApp, TQ_SLOT( quit() ) ); + TQObject::connect( popup, TQ_SIGNAL( clicked() ), tdeApp, TQ_SLOT( quit() ) ); + timer->start( duration, true ); -#ifdef Q_WS_X11 - if ( ! kapp->geometryArgument().isEmpty()) { +#ifdef TQ_WS_X11 + if ( ! tdeApp->geometryArgument().isEmpty()) { int x, y; int w, h; - int m = XParseGeometry( kapp->geometryArgument().latin1(), &x, &y, (unsigned int*)&w, (unsigned int*)&h); + int m = XParseGeometry( tdeApp->geometryArgument().latin1(), &x, &y, (unsigned int*)&w, (unsigned int*)&h); if ( (m & XNegative) ) x = TDEApplication::desktop()->width() + x - w; if ( (m & YNegative) ) @@ -317,7 +329,7 @@ static int directCommand(TDECmdLineArgs *args) popup->setAnchor( TQPoint(x, y) ); } #endif - kapp->exec(); + tdeApp->exec(); return 0; } @@ -457,10 +469,10 @@ static int directCommand(TDECmdLineArgs *args) dlg.setMode(KFile::File | KFile::LocalOnly); } Widgets::handleXGeometry(&dlg); - kapp->setTopWidget( &dlg ); + tdeApp->setTopWidget( &dlg ); dlg.setCaption(title.isNull() ? i18n("Open") : title); dlg.exec(); - + if (args->isSet("multiple")) { TQStringList result = dlg.selectedFiles(); if ( !result.isEmpty() ) { @@ -498,7 +510,7 @@ static int directCommand(TDECmdLineArgs *args) dlg.setSelection( startDir ); dlg.setOperationMode( KFileDialog::Saving ); Widgets::handleXGeometry(&dlg); - kapp->setTopWidget( &dlg ); + tdeApp->setTopWidget( &dlg ); dlg.setCaption(title.isNull() ? i18n("Save As") : title); dlg.exec(); @@ -525,7 +537,7 @@ static int directCommand(TDECmdLineArgs *args) TQString startDir; startDir = TQString::fromLocal8Bit(args->getOption("getexistingdirectory")); TQString result; -#ifdef Q_WS_WIN +#ifdef TQ_WS_WIN result = TQFileDialog::getExistingDirectory(startDir, 0, "getExistingDirectory", title, true, true); #else @@ -533,7 +545,7 @@ static int directCommand(TDECmdLineArgs *args) KDirSelectDialog myDialog( startDir, true, 0, "kdirselect dialog", true ); - kapp->setTopWidget( &myDialog ); + tdeApp->setTopWidget( &myDialog ); Widgets::handleXGeometry(&myDialog); if ( !title.isNull() ) @@ -569,10 +581,10 @@ static int directCommand(TDECmdLineArgs *args) dlg.setMode(KFile::File); } Widgets::handleXGeometry(&dlg); - kapp->setTopWidget( &dlg ); + tdeApp->setTopWidget( &dlg ); dlg.setCaption(title.isNull() ? i18n("Open") : title); dlg.exec(); - + if (args->isSet("multiple")) { KURL::List result = dlg.selectedURLs(); if ( !result.isEmpty() ) { @@ -637,7 +649,7 @@ static int directCommand(TDECmdLineArgs *args) context = TDEIcon::StatusIcon; TDEIconDialog dlg(0, "icon dialog"); - kapp->setTopWidget( &dlg ); + tdeApp->setTopWidget( &dlg ); dlg.setup( group, context); if (!title.isNull()) dlg.setCaption(title); diff --git a/kdialog/progressdialog.h b/kdialog/progressdialog.h index cdfca1ccb..1cf090081 100644 --- a/kdialog/progressdialog.h +++ b/kdialog/progressdialog.h @@ -24,7 +24,7 @@ class ProgressDialog : public KProgressDialog, virtual public ProgressDialogIface { - Q_OBJECT + TQ_OBJECT public: ProgressDialog(TQWidget* parent = 0, const TQString& caption = TQString::null, const TQString& text = TQString::null, int totalSteps = 100); diff --git a/kdialog/tdelistboxdialog.h b/kdialog/tdelistboxdialog.h index a93e7d002..3ade107f0 100644 --- a/kdialog/tdelistboxdialog.h +++ b/kdialog/tdelistboxdialog.h @@ -25,7 +25,7 @@ class TDEListBoxDialog : public KDialogBase { - Q_OBJECT + TQ_OBJECT public: diff --git a/kdialog/widgets.cpp b/kdialog/widgets.cpp index f68acfe4f..8a92a5dd3 100644 --- a/kdialog/widgets.cpp +++ b/kdialog/widgets.cpp @@ -35,17 +35,17 @@ #include <tqvbox.h> #include <tqfile.h> -#if defined Q_WS_X11 && ! defined K_WS_QTONLY +#if defined TQ_WS_X11 && ! defined K_WS_QTONLY #include <netwm.h> #endif void Widgets::handleXGeometry(TQWidget * dlg) { -#ifdef Q_WS_X11 - if ( ! kapp->geometryArgument().isEmpty()) { +#ifdef TQ_WS_X11 + if ( ! tdeApp->geometryArgument().isEmpty()) { int x, y; int w, h; - int m = XParseGeometry( kapp->geometryArgument().latin1(), &x, &y, (unsigned int*)&w, (unsigned int*)&h); + int m = XParseGeometry( tdeApp->geometryArgument().latin1(), &x, &y, (unsigned int*)&w, (unsigned int*)&h); if ( (m & XNegative) ) x = TDEApplication::desktop()->width() + x - w; if ( (m & YNegative) ) @@ -69,7 +69,7 @@ bool Widgets::passwordBox(TQWidget *parent, const TQString& title, const TQStrin { KPasswordDialog dlg( KPasswordDialog::Password, false, 0, parent ); - kapp->setTopWidget( &dlg ); + tdeApp->setTopWidget( &dlg ); dlg.setCaption(title); dlg.setPrompt(text); @@ -83,12 +83,12 @@ bool Widgets::passwordBox(TQWidget *parent, const TQString& title, const TQStrin int Widgets::textBox(TQWidget *parent, int width, int height, const TQString& title, const TQString& file) { -// KTextBox dlg(parent, 0, TRUE, width, height, file); +// KTextBox dlg(parent, 0, true, width, height, file); KDialogBase dlg( parent, 0, true, title, KDialogBase::Ok, KDialogBase::Ok ); - kapp->setTopWidget( &dlg ); + tdeApp->setTopWidget( &dlg ); KTextEdit *edit = new KTextEdit( dlg.makeVBoxMainWidget() ); - edit->setReadOnly(TRUE); + edit->setReadOnly(true); TQFile f(file); if (!f.open(IO_ReadOnly)) @@ -116,10 +116,10 @@ int Widgets::textBox(TQWidget *parent, int width, int height, const TQString& ti int Widgets::textInputBox(TQWidget *parent, int width, int height, const TQString& title, const TQStringList& args, TQCString &result) { -// KTextBox dlg(parent, 0, TRUE, width, height, file); +// KTextBox dlg(parent, 0, true, width, height, file); KDialogBase dlg( parent, 0, true, title, KDialogBase::Ok, KDialogBase::Ok ); - kapp->setTopWidget( &dlg ); + tdeApp->setTopWidget( &dlg ); TQVBox* vbox = dlg.makeVBoxMainWidget(); if( args.count() > 0 ) @@ -129,7 +129,7 @@ int Widgets::textInputBox(TQWidget *parent, int width, int height, const TQStrin } KTextEdit *edit = new KTextEdit( vbox ); - edit->setReadOnly(FALSE); + edit->setReadOnly(false); edit->setTextFormat( TQt::PlainText ); edit->setFocus(); @@ -152,7 +152,7 @@ bool Widgets::comboBox(TQWidget *parent, const TQString& title, const TQString& KDialogBase dlg( parent, 0, true, title, KDialogBase::Ok|KDialogBase::Cancel, KDialogBase::Ok ); - kapp->setTopWidget( &dlg ); + tdeApp->setTopWidget( &dlg ); dlg.setCaption(title); TQVBox* vbox = dlg.makeVBoxMainWidget(); @@ -177,7 +177,7 @@ bool Widgets::listBox(TQWidget *parent, const TQString& title, const TQString& t { TDEListBoxDialog box(text,parent); - kapp->setTopWidget( &box ); + tdeApp->setTopWidget( &box ); box.setCaption(title); for (unsigned int i = 0; i+1<args.count(); i += 2) { @@ -205,7 +205,7 @@ bool Widgets::checkList(TQWidget *parent, const TQString& title, const TQString& TQListBox &table = box.getTable(); - kapp->setTopWidget( &box ); + tdeApp->setTopWidget( &box ); box.setCaption(title); for (unsigned int i=0; i+2<args.count(); i += 3) { @@ -214,7 +214,7 @@ bool Widgets::checkList(TQWidget *parent, const TQString& title, const TQString& } table.insertStringList(entries); - table.setMultiSelection(TRUE); + table.setMultiSelection(true); table.setCurrentItem(0); // This is to circumvent a Qt bug for (unsigned int i=0; i+2<args.count(); i += 3) { @@ -249,7 +249,7 @@ bool Widgets::radioBox(TQWidget *parent, const TQString& title, const TQString& TQListBox &table = box.getTable(); - kapp->setTopWidget( &box ); + tdeApp->setTopWidget( &box ); box.setCaption(title); for (unsigned int i=0; i+2<args.count(); i += 3) { @@ -274,7 +274,7 @@ bool Widgets::radioBox(TQWidget *parent, const TQString& title, const TQString& bool Widgets::progressBar(TQWidget *parent, const TQString& title, const TQString& text, int totalSteps) { ProgressDialog dlg( parent, title, text, totalSteps ); - kapp->setTopWidget( &dlg ); + tdeApp->setTopWidget( &dlg ); dlg.setCaption( title ); handleXGeometry(&dlg); dlg.exec(); |