summaryrefslogtreecommitdiffstats
path: root/kdialog/kdialog.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'kdialog/kdialog.cpp')
-rw-r--r--kdialog/kdialog.cpp62
1 files changed, 37 insertions, 25 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);