TQt4 port kgtk-qt3

This enables compilation under both Qt3 and Qt4


git-svn-id: svn://anonsvn.kde.org/home/kde/branches/trinity/applications/kgtk-qt3@1230933 283d02a7-25f6-0310-bc7c-ecb5cbfe19da
v3.5.13-sru
tpearson 14 years ago
parent 7b227bd6ed
commit 7a92d5c79f

@ -55,7 +55,7 @@ static const char * getPidFileName()
#ifdef __KDIALOGD_H__ #ifdef __KDIALOGD_H__
// We are kdialogd - so create socket folder if it does not exist... // We are kdialogd - so create socket folder if it does not exist...
sprintf(pidfile, "%s/%s%s", tmp, PID_DIR, user); sprintf(pidfile, "%s/%s%s", tmp, PID_DIR, user);
KStandardDirs::makeDir(QString::fromAscii(pidfile)); KStandardDirs::makeDir(TQString::fromAscii(pidfile));
#endif #endif
/* CPD: TODO get dispaly number! */ /* CPD: TODO get dispaly number! */
@ -95,7 +95,7 @@ static const char * getSockName()
#ifdef __KDIALOGD_H__ #ifdef __KDIALOGD_H__
// We are kdialogd - so create socket folder if it does not exist... // We are kdialogd - so create socket folder if it does not exist...
sprintf(sock, "%s/%s%s", tmp, SOCK_DIR, user); sprintf(sock, "%s/%s%s", tmp, SOCK_DIR, user);
KStandardDirs::makeDir(QString::fromAscii(sock)); KStandardDirs::makeDir(TQString::fromAscii(sock));
#endif #endif
/* CPD: TODO get dispaly number! */ /* CPD: TODO get dispaly number! */
@ -166,7 +166,7 @@ static int writeBlock(int fd, const char *pData, int size)
#ifdef KDIALOGD_APP #ifdef KDIALOGD_APP
/* /*
So that kdailogd can terminate when the last app exits, need a way of synchronising the Gtk/Qt So that kdailogd can terminate when the last app exits, need a way of synchronising the Gtk/TQt
apps that may wish to connect, and the removal of the socket. apps that may wish to connect, and the removal of the socket.
To this en, a lockfile is created,and used to guard around the critical sections To this en, a lockfile is created,and used to guard around the critical sections

@ -149,7 +149,7 @@ static const gchar *getAppName(const gchar *app)
const gchar *a=app ? app : kgtk_get_app_name(getpid()); const gchar *a=app ? app : kgtk_get_app_name(getpid());
gchar *slash; gchar *slash;
/* Was the cmdline app java? if so, try to use its parent name - just in case /* Was the cmdline app java? if so, try to use its tqparent name - just in case
its run from a shell script, etc. - e.g. as eclipse does */ its run from a shell script, etc. - e.g. as eclipse does */
if(a && 0==strcmp(a, "java")) if(a && 0==strcmp(a, "java"))
a=kgtk_get_app_name(getppid()); a=kgtk_get_app_name(getppid());
@ -249,7 +249,7 @@ static gboolean sendMessage(GtkWidget *widget, Operation op, GSList **res, gchar
if(widget->parent) if(widget->parent)
{ {
#ifdef KGTK_DEBUG #ifdef KGTK_DEBUG
printf("KGTK::Dialog has a parent!\n"); printf("KGTK::Dialog has a tqparent!\n");
#endif #endif
xid=GDK_WINDOW_XID(gtk_widget_get_toplevel(widget->parent)); xid=GDK_WINDOW_XID(gtk_widget_get_toplevel(widget->parent));
} }
@ -543,7 +543,7 @@ typedef struct _GtkFilePath GtkFilePath;
typedef struct _GtkFileSystemModel GtkFileSystemModel; typedef struct _GtkFileSystemModel GtkFileSystemModel;
struct _GtkFileFilter struct _GtkFileFilter
{ {
GtkObject parent_instance; GtkObject tqparent_instance;
gchar *name; gchar *name;
GSList *rules; GSList *rules;
@ -632,7 +632,7 @@ RowType;
static GtkWidget * static GtkWidget *
kgtk_file_chooser_dialog_new_valist (const gchar *title, kgtk_file_chooser_dialog_new_valist (const gchar *title,
GtkWindow *parent, GtkWindow *tqparent,
GtkFileChooserAction action, GtkFileChooserAction action,
const gchar *backend, const gchar *backend,
const gchar *first_button_text, const gchar *first_button_text,
@ -648,8 +648,8 @@ kgtk_file_chooser_dialog_new_valist (const gchar *title,
"file-system-backend", backend, "file-system-backend", backend,
NULL); NULL);
if (parent) if (tqparent)
gtk_window_set_transient_for (GTK_WINDOW (result), parent); gtk_window_set_transient_for (GTK_WINDOW (result), tqparent);
while (button_text) while (button_text)
{ {
@ -764,7 +764,7 @@ static void freeHash(void *hash)
} }
} }
/* Some Gtk apps have filter pattern *.[Pp][Nn][Gg] - wherease Qt/KDE prefer *.png */ /* Some Gtk apps have filter pattern *.[Pp][Nn][Gg] - wherease TQt/KDE prefer *.png */
#define MAX_PATTERN_LEN 64 #define MAX_PATTERN_LEN 64
static gchar *modifyFilter(const char *filter) static gchar *modifyFilter(const char *filter)
{ {
@ -1737,7 +1737,7 @@ void g_signal_stop_emission_by_name(gpointer instance, const gchar *detailed_sig
#endif #endif
} }
GtkWidget * gtk_file_chooser_dialog_new(const gchar *title, GtkWindow *parent, GtkWidget * gtk_file_chooser_dialog_new(const gchar *title, GtkWindow *tqparent,
GtkFileChooserAction action, const gchar *first_button_text, GtkFileChooserAction action, const gchar *first_button_text,
...) ...)
{ {
@ -1748,7 +1748,7 @@ GtkWidget * gtk_file_chooser_dialog_new(const gchar *title, GtkWindow *parent,
va_list varargs; va_list varargs;
va_start(varargs, first_button_text); va_start(varargs, first_button_text);
dlg=kgtk_file_chooser_dialog_new_valist(title, parent, action, NULL, first_button_text, varargs); dlg=kgtk_file_chooser_dialog_new_valist(title, tqparent, action, NULL, first_button_text, varargs);
va_end(varargs); va_end(varargs);
#ifdef KGTK_DEBUG #ifdef KGTK_DEBUG

@ -4,7 +4,7 @@
#include <iostream> #include <iostream>
#include <kdiroperator.h> #include <kdiroperator.h>
#include <kuniqueapplication.h> #include <kuniqueapplication.h>
#include <qsocketnotifier.h> #include <tqsocketnotifier.h>
#include <kio/netaccess.h> #include <kio/netaccess.h>
#include <kmessagebox.h> #include <kmessagebox.h>
#include <klocale.h> #include <klocale.h>
@ -22,7 +22,7 @@
#include <ksockaddr.h> #include <ksockaddr.h>
#include <kdebug.h> #include <kdebug.h>
#include <kdeversion.h> #include <kdeversion.h>
#include <qtimer.h> #include <tqtimer.h>
#ifdef KDIALOGD_APP #ifdef KDIALOGD_APP
#include <kcmdlineargs.h> #include <kcmdlineargs.h>
#include <kaboutdata.h> #include <kaboutdata.h>
@ -38,9 +38,9 @@ KConfig *KDialogD::theirConfig=NULL;
#define DEFAULT_TIMEOUT 30 #define DEFAULT_TIMEOUT 30
#endif #endif
static QString groupName(const QString &app, bool fileDialog=true) static TQString groupName(const TQString &app, bool fileDialog=true)
{ {
return QString(fileDialog ? "KFileDialog " : "KDirSelectDialog ")+app; return TQString(fileDialog ? "KFileDialog " : "KDirSelectDialog ")+app;
} }
// from kdebase/kdesu // from kdebase/kdesu
@ -121,7 +121,7 @@ static int createSocket()
return sockitsFd; return sockitsFd;
} }
static void urls2Local(KURL::List &urls, QStringList &items, QWidget *parent) static void urls2Local(KURL::List &urls, TQStringList &items, TQWidget *tqparent)
{ {
KURL::List::Iterator it(urls.begin()), KURL::List::Iterator it(urls.begin()),
end(urls.end()); end(urls.end());
@ -132,7 +132,7 @@ static void urls2Local(KURL::List &urls, QStringList &items, QWidget *parent)
else else
{ {
#if KDE_IS_VERSION(3, 5, 0) #if KDE_IS_VERSION(3, 5, 0)
KURL url(KIO::NetAccess::mostLocalURL(*it, parent)); KURL url(KIO::NetAccess::mostLocalURL(*it, tqparent));
if(url.isLocalFile()) if(url.isLocalFile())
items.append(url.path()); items.append(url.path());
@ -144,8 +144,8 @@ static void urls2Local(KURL::List &urls, QStringList &items, QWidget *parent)
} }
} }
KDialogD::KDialogD(QObject *parent) KDialogD::KDialogD(TQObject *tqparent)
: QObject(parent), : TQObject(tqparent),
#ifdef KDIALOGD_APP #ifdef KDIALOGD_APP
itsTimer(NULL), itsTimer(NULL),
itsTimeoutVal(DEFAULT_TIMEOUT), itsTimeoutVal(DEFAULT_TIMEOUT),
@ -172,8 +172,8 @@ KDialogD::KDialogD(QObject *parent)
if(!theirConfig) if(!theirConfig)
theirConfig=new KConfig("kdialogdrc", false, false); theirConfig=new KConfig("kdialogdrc", false, false);
connect(new QSocketNotifier(itsFd, QSocketNotifier::Read, this), connect(new TQSocketNotifier(itsFd, TQSocketNotifier::Read, this),
SIGNAL(activated(int)), this, SLOT(newConnection())); TQT_SIGNAL(activated(int)), this, TQT_SLOT(newConnection()));
#ifdef KDIALOGD_APP #ifdef KDIALOGD_APP
if(theirConfig->hasGroup(CFG_TIMEOUT_GROUP)) if(theirConfig->hasGroup(CFG_TIMEOUT_GROUP))
@ -182,12 +182,12 @@ KDialogD::KDialogD(QObject *parent)
itsTimeoutVal=theirConfig->readNumEntry(CFG_TIMEOUT_KEY, DEFAULT_TIMEOUT); itsTimeoutVal=theirConfig->readNumEntry(CFG_TIMEOUT_KEY, DEFAULT_TIMEOUT);
if(itsTimeoutVal<0) if(itsTimeoutVal<0)
itsTimeoutVal=DEFAULT_TIMEOUT; itsTimeoutVal=DEFAULT_TIMEOUT;
theirConfig->setGroup(QString::null); theirConfig->setGroup(TQString());
} }
kdDebug() << "Timeout:" << itsTimeoutVal << endl; kdDebug() << "Timeout:" << itsTimeoutVal << endl;
if(itsTimeoutVal) if(itsTimeoutVal)
connect(itsTimer=new QTimer(this), SIGNAL(timeout()), this, SLOT(timeout())); connect(itsTimer=new TQTimer(this), TQT_SIGNAL(timeout()), this, TQT_SLOT(timeout()));
#endif #endif
} }
} }
@ -216,7 +216,7 @@ void KDialogD::newConnection()
if(readBlock(connectedFD, (char *)&appNameLen, 4)) if(readBlock(connectedFD, (char *)&appNameLen, 4))
{ {
bool ok=true; bool ok=true;
QCString appName; TQCString appName;
if(0==appNameLen) if(0==appNameLen)
appName="Generic"; appName="Generic";
@ -234,8 +234,8 @@ void KDialogD::newConnection()
itsTimer->stop(); itsTimer->stop();
#endif #endif
connect(new KDialogDClient(connectedFD, appName, this), connect(new KDialogDClient(connectedFD, appName, this),
SIGNAL(error(KDialogDClient *)), TQT_SIGNAL(error(KDialogDClient *)),
this, SLOT(deleteConnection(KDialogDClient *))); this, TQT_SLOT(deleteConnection(KDialogDClient *)));
} }
} }
} }
@ -272,16 +272,16 @@ void KDialogD::timeout()
#endif #endif
} }
KDialogDClient::KDialogDClient(int sock, const QString &an, QObject *parent) KDialogDClient::KDialogDClient(int sock, const TQString &an, TQObject *tqparent)
: QObject(parent), : TQObject(tqparent),
itsFd(sock), itsFd(sock),
itsDlg(NULL), itsDlg(NULL),
itsAccepted(false), itsAccepted(false),
itsAppName(an) itsAppName(an)
{ {
kdDebug() << "new client..." << itsAppName << " (" << itsFd << ")" << endl; kdDebug() << "new client..." << itsAppName << " (" << itsFd << ")" << endl;
connect(new QSocketNotifier(itsFd, QSocketNotifier::Read, this), SIGNAL(activated(int)), this, SLOT(read())); connect(new TQSocketNotifier(itsFd, TQSocketNotifier::Read, this), TQT_SIGNAL(activated(int)), this, TQT_SLOT(read()));
connect(new QSocketNotifier(itsFd, QSocketNotifier::Exception, this), SIGNAL(activated(int)), this, SLOT(close())); connect(new TQSocketNotifier(itsFd, TQSocketNotifier::Exception, this), TQT_SIGNAL(activated(int)), this, TQT_SLOT(close()));
} }
KDialogDClient::~KDialogDClient() KDialogDClient::~KDialogDClient()
@ -316,7 +316,7 @@ void KDialogDClient::read()
return; return;
char request; char request;
QString caption; TQString caption;
unsigned int xid=0; unsigned int xid=0;
if(!itsDlg && readData(&request, 1) && request>=(char)OP_FILE_OPEN && request<=(char)OP_FOLDER && if(!itsDlg && readData(&request, 1) && request>=(char)OP_FILE_OPEN && request<=(char)OP_FOLDER &&
@ -341,7 +341,7 @@ void KDialogDClient::read()
if(OP_FOLDER==(Operation)request) if(OP_FOLDER==(Operation)request)
{ {
QString intialFolder; TQString intialFolder;
if(readString(intialFolder)) if(readString(intialFolder))
{ {
@ -352,7 +352,7 @@ void KDialogDClient::read()
} }
else else
{ {
QString intialFolder, TQString intialFolder,
filter; filter;
char overW=0; char overW=0;
@ -379,20 +379,20 @@ void KDialogDClient::finished()
// //
// * finished is emitted when a dialog is ok'ed/cancel'ed/closed // * finished is emitted when a dialog is ok'ed/cancel'ed/closed
// * if the user just closes the dialog - neither ok nor cancel are emitted // * if the user just closes the dialog - neither ok nor cancel are emitted
// * the dir select dialog doesnt seem to set the QDialog result parameter // * the dir select dialog doesnt seem to set the TQDialog result parameter
// when it is accepted - so for this reason if ok is clicked we store an // when it is accepted - so for this reason if ok is clicked we store an
// 'accepted' value there, and check for that after the dialog is finished. // 'accepted' value there, and check for that after the dialog is finished.
kdDebug() << "finished" << endl; kdDebug() << "finished" << endl;
if(itsDlg && !(itsAccepted || QDialog::Accepted==itsDlg->result())) if(itsDlg && !(itsAccepted || TQDialog::Accepted==itsDlg->result()))
cancel(); cancel();
} }
void KDialogDClient::ok(const QStringList &items) void KDialogDClient::ok(const TQStringList &items)
{ {
kdDebug() << "ok" << endl; kdDebug() << "ok" << endl;
int num=items.count(); int num=items.count();
QStringList::ConstIterator it(items.begin()), TQStringList::ConstIterator it(items.begin()),
end(items.end()); end(items.end());
bool error=!writeData((char *)&num, 4); bool error=!writeData((char *)&num, 4);
@ -424,39 +424,39 @@ void KDialogDClient::cancel()
} }
} }
bool KDialogDClient::readData(QCString &buffer, int size) bool KDialogDClient::readData(TQCString &buffer, int size)
{ {
buffer.resize(size); buffer.resize(size);
return ::readBlock(itsFd, buffer.data(), size); return ::readBlock(itsFd, buffer.data(), size);
} }
bool KDialogDClient::readString(QString &str) bool KDialogDClient::readString(TQString &str)
{ {
int size; int size;
if(!readData((char *)&size, 4)) if(!readData((char *)&size, 4))
return false; return false;
QCString buffer; TQCString buffer;
buffer.resize(size); buffer.resize(size);
if(!readData(buffer.data(), size)) if(!readData(buffer.data(), size))
return false; return false;
str=QString::fromUtf8(buffer.data()); str=TQString::fromUtf8(buffer.data());
return true; return true;
} }
bool KDialogDClient::writeString(const QString &str) bool KDialogDClient::writeString(const TQString &str)
{ {
QCString utf8(str.utf8()); TQCString utf8(str.utf8());
int size=utf8.length()+1; int size=utf8.length()+1;
return writeData((char *)&size, 4) && writeData(utf8.data(), size); return writeData((char *)&size, 4) && writeData(utf8.data(), size);
} }
void KDialogDClient::initDialog(const QString &caption, KDialogBase *d, unsigned int xid) void KDialogDClient::initDialog(const TQString &caption, KDialogBase *d, unsigned int xid)
{ {
itsAccepted=false; itsAccepted=false;
itsDlg=d; itsDlg=d;
@ -471,7 +471,7 @@ void KDialogDClient::initDialog(const QString &caption, KDialogBase *d, unsigned
KWin::setState(itsDlg->winId(), NET::Modal); KWin::setState(itsDlg->winId(), NET::Modal);
KWin::WindowInfo wi(KWin::windowInfo(xid, NET::WMGeometry, NET::WM2UserTime)); KWin::WindowInfo wi(KWin::windowInfo(xid, NET::WMGeometry, NET::WM2UserTime));
QRect geom(wi.geometry()); TQRect geom(wi.tqgeometry());
int rx=geom.x(), int rx=geom.x(),
ry=geom.y(); ry=geom.y();
@ -505,14 +505,14 @@ void KDialogDClient::initDialog(const QString &caption, KDialogBase *d, unsigned
#endif #endif
} }
connect(itsDlg, SIGNAL(ok(const QStringList &)), this, SLOT(ok(const QStringList &))); connect(itsDlg, TQT_SIGNAL(ok(const TQStringList &)), this, TQT_SLOT(ok(const TQStringList &)));
connect(itsDlg, SIGNAL(finished()), this, SLOT(finished())); connect(itsDlg, TQT_SIGNAL(finished()), this, TQT_SLOT(finished()));
itsDlg->show(); itsDlg->show();
} }
KDialogDFileDialog::KDialogDFileDialog(QString &an, Operation op, const QString &startDir, KDialogDFileDialog::KDialogDFileDialog(TQString &an, Operation op, const TQString &startDir,
const QString &filter, bool confirmOw) const TQString &filter, bool confirmOw)
: KFileDialog(startDir.isEmpty() || "~"==startDir ? QDir::homeDirPath() : startDir, : KFileDialog(startDir.isEmpty() || "~"==startDir ? TQDir::homeDirPath() : startDir,
filter, NULL, NULL, false), filter, NULL, NULL, false),
itsConfirmOw(confirmOw), itsConfirmOw(confirmOw),
itsAppName(an) itsAppName(an)
@ -539,9 +539,9 @@ KDialogDFileDialog::KDialogDFileDialog(QString &an, Operation op, const QString
if(KDialogD::config()) if(KDialogD::config())
{ {
QString oldGrp(KDialogD::config()->group()), TQString oldGrp(KDialogD::config()->group()),
grp(groupName(itsAppName)); grp(groupName(itsAppName));
QSize defaultSize(600, 400); TQSize defaultSize(600, 400);
readConfig(KDialogD::config(), grp); readConfig(KDialogD::config(), grp);
KDialogD::config()->setGroup(grp); KDialogD::config()->setGroup(grp);
@ -559,12 +559,12 @@ void KDialogDFileDialog::accept()
void KDialogDFileDialog::slotOk() void KDialogDFileDialog::slotOk()
{ {
setResult(QDialog::Accepted); setResult(TQDialog::Accepted);
KFileDialog::slotOk(); KFileDialog::slotOk();
kdDebug() << "KDialogDFileDialog::slotOk" << endl; kdDebug() << "KDialogDFileDialog::slotOk" << endl;
KURL::List urls; KURL::List urls;
QStringList items; TQStringList items;
bool good=true; bool good=true;
if(mode()&KFile::Files) if(mode()&KFile::Files)
@ -586,14 +586,14 @@ void KDialogDFileDialog::slotOk()
good=!KIO::NetAccess::exists(urls.first(), false, this) || good=!KIO::NetAccess::exists(urls.first(), false, this) ||
KMessageBox::Continue==KMessageBox::warningContinueCancel(this, KMessageBox::Continue==KMessageBox::warningContinueCancel(this,
i18n("File %1 exists.\nDo you want to replace it?") i18n("File %1 exists.\nDo you want to replace it?")
.arg(urls.first().prettyURL()), .tqarg(urls.first().prettyURL()),
i18n("File Exists"), i18n("File Exists"),
KGuiItem(i18n("Replace"), "filesaveas"), QString::null, KGuiItem(i18n("Replace"), "filesaveas"), TQString(),
KMessageBox::Notify|KMessageBox::PlainCaption); KMessageBox::Notify|KMessageBox::PlainCaption);
if(good) if(good)
{ {
QString filter(currentFilter()); TQString filter(currentFilter());
if(!filter.isEmpty()) if(!filter.isEmpty())
items.append(filter); items.append(filter);
@ -603,7 +603,7 @@ void KDialogDFileDialog::slotOk()
KFileDialog::accept(); KFileDialog::accept();
} }
else else
setResult(QDialog::Rejected); setResult(TQDialog::Rejected);
} }
} }
@ -613,7 +613,7 @@ KDialogDFileDialog::~KDialogDFileDialog()
if(KDialogD::config()) if(KDialogD::config())
{ {
QString oldGrp(KDialogD::config()->group()), TQString oldGrp(KDialogD::config()->group()),
grp(groupName(itsAppName)); grp(groupName(itsAppName));
writeConfig(KDialogD::config(), grp); writeConfig(KDialogD::config(), grp);
@ -623,20 +623,20 @@ KDialogDFileDialog::~KDialogDFileDialog()
} }
} }
KDialogDDirSelectDialog::KDialogDDirSelectDialog(QString &an, const QString &startDir, bool localOnly, KDialogDDirSelectDialog::KDialogDDirSelectDialog(TQString &an, const TQString &startDir, bool localOnly,
QWidget *parent, const char *name, bool modal) TQWidget *tqparent, const char *name, bool modal)
: KDirSelectDialog(startDir.isEmpty() || "~"==startDir : KDirSelectDialog(startDir.isEmpty() || "~"==startDir
? QDir::homeDirPath() : startDir, ? TQDir::homeDirPath() : startDir,
localOnly, parent, name, modal), localOnly, tqparent, name, modal),
itsAppName(an) itsAppName(an)
{ {
kdDebug() << "startDir:" << startDir << endl; kdDebug() << "startDir:" << startDir << endl;
if(KDialogD::config()) if(KDialogD::config())
{ {
QString oldGrp(KDialogD::config()->group()), TQString oldGrp(KDialogD::config()->group()),
grp(groupName(itsAppName, false)); grp(groupName(itsAppName, false));
QSize defaultSize(600, 400); TQSize defaultSize(600, 400);
//readConfig(KDialogD::config(), grp); //readConfig(KDialogD::config(), grp);
KDialogD::config()->setGroup(grp); KDialogD::config()->setGroup(grp);
@ -651,7 +651,7 @@ KDialogDDirSelectDialog::~KDialogDDirSelectDialog()
if(KDialogD::config()) if(KDialogD::config())
{ {
QString oldGrp(KDialogD::config()->group()), TQString oldGrp(KDialogD::config()->group()),
grp(groupName(itsAppName, false)); grp(groupName(itsAppName, false));
//writeConfig(KDialogD::config(), grp); //writeConfig(KDialogD::config(), grp);
@ -666,7 +666,7 @@ void KDialogDDirSelectDialog::slotOk()
kdDebug() << "KDialogDDirSelectDialog::slotOk" << endl; kdDebug() << "KDialogDDirSelectDialog::slotOk" << endl;
KURL::List urls; KURL::List urls;
QStringList items; TQStringList items;
urls.append(url()); urls.append(url());
urls2Local(urls, items, this); urls2Local(urls, items, this);
@ -704,13 +704,13 @@ int main(int argc, char **argv)
#else #else
extern "C" extern "C"
{ {
KDE_EXPORT KDEDModule *create_kdialogd(const QCString &obj) KDE_EXPORT KDEDModule *create_kdialogd(const TQCString &obj)
{ {
return new KDialogDKDED(obj); return new KDialogDKDED(obj);
} }
}; };
KDialogDKDED::KDialogDKDED(const QCString &obj) KDialogDKDED::KDialogDKDED(const TQCString &obj)
: KDEDModule(obj) : KDEDModule(obj)
{ {
new KDialogD(this); new KDialogD(this);

@ -9,7 +9,7 @@
#include "config.h" #include "config.h"
#ifdef KDIALOGD_APP #ifdef KDIALOGD_APP
class QTimer; class TQTimer;
#else #else
#include <kdedmodule.h> #include <kdedmodule.h>
#endif #endif
@ -19,10 +19,11 @@ class KConfig;
class KDialogDFileDialog : public KFileDialog class KDialogDFileDialog : public KFileDialog
{ {
Q_OBJECT Q_OBJECT
TQ_OBJECT
public: public:
KDialogDFileDialog(QString &an, Operation op, const QString& startDir, const QString& filter, KDialogDFileDialog(TQString &an, Operation op, const TQString& startDir, const TQString& filter,
bool confirmOw); bool confirmOw);
virtual ~KDialogDFileDialog(); virtual ~KDialogDFileDialog();
@ -33,23 +34,24 @@ class KDialogDFileDialog : public KFileDialog
signals: signals:
void ok(const QStringList &items); void ok(const TQStringList &items);
private: private:
bool itsConfirmOw; bool itsConfirmOw;
QString &itsAppName; TQString &itsAppName;
}; };
class KDialogDDirSelectDialog : public KDirSelectDialog class KDialogDDirSelectDialog : public KDirSelectDialog
{ {
Q_OBJECT Q_OBJECT
TQ_OBJECT
public: public:
KDialogDDirSelectDialog(QString &an, const QString &startDir = QString::null, KDialogDDirSelectDialog(TQString &an, const TQString &startDir = TQString(),
bool localOnly = false, bool localOnly = false,
QWidget *parent = 0L, TQWidget *tqparent = 0L,
const char *name = 0, bool modal = false); const char *name = 0, bool modal = false);
virtual ~KDialogDDirSelectDialog(); virtual ~KDialogDDirSelectDialog();
@ -59,27 +61,28 @@ class KDialogDDirSelectDialog : public KDirSelectDialog
signals: signals:
void ok(const QStringList &items); void ok(const TQStringList &items);
private: private:
QString &itsAppName; TQString &itsAppName;
}; };
class KDialogDClient : public QObject class KDialogDClient : public TQObject
{ {
Q_OBJECT Q_OBJECT
TQ_OBJECT
public: public:
KDialogDClient(int sock, const QString &an, QObject *parent); KDialogDClient(int sock, const TQString &an, TQObject *tqparent);
virtual ~KDialogDClient(); virtual ~KDialogDClient();
public slots: public slots:
void read(); void read();
void close(); void close();
void ok(const QStringList &items); void ok(const TQStringList &items);
void finished(); void finished();
signals: signals:
@ -89,28 +92,29 @@ class KDialogDClient : public QObject
private: private:
void cancel(); void cancel();
bool readData(QCString &buffer, int size); bool readData(TQCString &buffer, int size);
bool readData(char *buffer, int size) { return readBlock(itsFd, buffer, size); } bool readData(char *buffer, int size) { return readBlock(itsFd, buffer, size); }
bool writeData(const char *buffer, int size) { return writeBlock(itsFd, buffer, size); } bool writeData(const char *buffer, int size) { return writeBlock(itsFd, buffer, size); }
bool readString(QString &str); bool readString(TQString &str);
bool writeString(const QString &str); bool writeString(const TQString &str);
void initDialog(const QString &caption, KDialogBase *d, unsigned int xid); void initDialog(const TQString &caption, KDialogBase *d, unsigned int xid);
private: private:
int itsFd; int itsFd;
KDialogBase *itsDlg; KDialogBase *itsDlg;
bool itsAccepted; bool itsAccepted;
QString itsAppName; TQString itsAppName;
}; };
class KDialogD : public QObject class KDialogD : public TQObject
{ {
Q_OBJECT Q_OBJECT
TQ_OBJECT
public: public:
KDialogD(QObject *parent=0L); KDialogD(TQObject *tqparent=0L);
virtual ~KDialogD(); virtual ~KDialogD();
public slots: public slots:
@ -124,7 +128,7 @@ class KDialogD : public QObject
private: private:
#ifdef KDIALOGD_APP #ifdef KDIALOGD_APP
QTimer *itsTimer; TQTimer *itsTimer;
int itsTimeoutVal; int itsTimeoutVal;
#endif #endif
int itsFd, int itsFd,
@ -138,7 +142,7 @@ class KDialogDKDED : public KDEDModule
{ {
public: public:
KDialogDKDED(const QCString &obj); KDialogDKDED(const TQCString &obj);
}; };
#endif #endif

@ -23,7 +23,7 @@
* *
************************************************************************/ ************************************************************************/
#define KQT_OVERLOAD_NON_STATIC_FILEDIALOGS #define KTQT_OVERLOAD_NON_STATIC_FILEDIALOGS
#define _GNU_SOURCE #define _GNU_SOURCE
#include <dlfcn.h> #include <dlfcn.h>
@ -39,20 +39,20 @@
#include <errno.h> #include <errno.h>
#include <string.h> #include <string.h>
#include <sys/types.h> #include <sys/types.h>
#include <qstring.h> #include <tqstring.h>
#include <qstringlist.h> #include <tqstringlist.h>
#include <qwidget.h> #include <tqwidget.h>
#include <qapplication.h> #include <tqapplication.h>
#ifdef KQT_OVERLOAD_NON_STATIC_FILEDIALOGS #ifdef KTQT_OVERLOAD_NON_STATIC_FILEDIALOGS
#include <qcombobox.h> #include <tqcombobox.h>
#include <qlineedit.h> #include <tqlineedit.h>
#include <qobjectlist.h> #include <tqobjectlist.h>
#define private public // HACK HACK HACK!!! #define private public // HACK HACK HACK!!!
#endif #endif
#include <qfiledialog.h> #include <tqfiledialog.h>
#include <qthread.h> #include <tqthread.h>
#include <qnamespace.h> #include <tqnamespace.h>
#include <qeventloop.h> #include <tqeventloop.h>
#include "connect.h" #include "connect.h"
#include "config.h" #include "config.h"
#include "mangled.h" #include "mangled.h"
@ -93,16 +93,16 @@ static char * getAppNameFromPid(int pid)
return appName; return appName;
} }
static const char * getAppName(bool useQt=true) static const char * getAppName(bool useTQt=true)
{ {
static const char *appName=NULL; static const char *appName=NULL;
if(!appName) if(!appName)
{ {
const char *a=useQt && qApp ? qApp->argv()[0] : getAppNameFromPid(getpid()); const char *a=useTQt && tqApp ? tqApp->argv()[0] : getAppNameFromPid(getpid());
const char *slash; const char *slash;
// Was the cmdline app java? if so, try to use its parent name - just in case // Was the cmdline app java? if so, try to use its tqparent name - just in case
// its run from a shell script, etc. - e.g. as eclipse does // its run from a shell script, etc. - e.g. as eclipse does
if(a && 0==strcmp(a, "java")) if(a && 0==strcmp(a, "java"))
a=getAppNameFromPid(getppid()); a=getAppNameFromPid(getppid());
@ -112,13 +112,13 @@ static const char * getAppName(bool useQt=true)
appName=a && (slash=strrchr(a, '/')) && '\0'!=slash[1] appName=a && (slash=strrchr(a, '/')) && '\0'!=slash[1]
? &(slash[1]) ? &(slash[1])
: a ? a : "QtApp"; : a ? a : "TQtApp";
} }
return appName; return appName;
} }
int QApplication::exec() int TQApplication::exec()
{ {
static bool init=false; static bool init=false;
@ -135,19 +135,19 @@ int QApplication::exec()
return (int)realFunction(this); return (int)realFunction(this);
}; };
static QString qt2KdeFilter(const QString &f) static TQString qt2KdeFilter(const TQString &f)
{ {
QString filter; TQString filter;
QTextOStream str(&filter); TQTextOStream str(&filter);
QStringList list(QStringList::split(";;", f)); TQStringList list(TQStringList::split(";;", f));
QStringList::Iterator it(list.begin()), TQStringList::Iterator it(list.begin()),
end(list.end()); end(list.end());
bool first=true; bool first=true;
for(; it!=end; ++it) for(; it!=end; ++it)
{ {
int ob=(*it).findRev('('), int ob=(*it).tqfindRev('('),
cb=(*it).findRev(')'); cb=(*it).tqfindRev(')');
if(-1!=cb && ob<cb) if(-1!=cb && ob<cb)
{ {
@ -162,17 +162,17 @@ static QString qt2KdeFilter(const QString &f)
return filter; return filter;
} }
static void kde2QtFilter(const QString &orig, QString *sel) static void kde2TQtFilter(const TQString &orig, TQString *sel)
{ {
if(sel) if(sel)
{ {
QStringList list(QStringList::split(";;", orig)); TQStringList list(TQStringList::split(";;", orig));
QStringList::Iterator it(list.begin()), TQStringList::Iterator it(list.begin()),
end(list.end()); end(list.end());
int pos; int pos;
for(; it!=end; ++it) for(; it!=end; ++it)
if(-1!=(pos=(*it).find(*sel)) && pos>0 && if(-1!=(pos=(*it).tqfind(*sel)) && pos>0 &&
('('==(*it)[pos-1] || ' '==(*it)[pos-1]) && ('('==(*it)[pos-1] || ' '==(*it)[pos-1]) &&
(*it).length()>=sel->length()+pos && (*it).length()>=sel->length()+pos &&
(')'==(*it)[pos+sel->length()] || ' '==(*it)[pos+sel->length()])) (')'==(*it)[pos+sel->length()] || ' '==(*it)[pos+sel->length()]))
@ -183,39 +183,39 @@ static void kde2QtFilter(const QString &orig, QString *sel)
} }
} }
#ifdef KQT_OVERLOAD_NON_STATIC_FILEDIALOGS #ifdef KTQT_OVERLOAD_NON_STATIC_FILEDIALOGS
#ifdef KQT_USE_QFILEDIALOG_PRIVATE #ifdef KTQT_USE_TQFILEDIALOG_PRIVATE
// HACK HACK HACK!!! // HACK HACK HACK!!!
// KGtk versions <=0.9.1 used this copied QFileDialogPrivate to access the file filters // KGtk versions <=0.9.1 used this copied TQFileDialogPrivate to access the file filters
// newer versions walk the file dialogs children... // newer versions walk the file dialogs tqchildren...
class QFileDialogPrivate { class TQFileDialogPrivate {
public: public:
~QFileDialogPrivate(); ~TQFileDialogPrivate();
QStringList history; TQStringList history;
bool geometryDirty; bool tqgeometryDirty;
QComboBox * paths; TQComboBox * paths;
QComboBox * types; TQComboBox * types;
}; };
#endif #endif
static const QString getFilters(QFileDialog *dlg, bool scribusSave=false) static const TQString getFilters(TQFileDialog *dlg, bool scribusSave=false)
{ {
QString filter; TQString filter;
#if KQT_USE_QFILEDIALOG_PRIVATE #if KTQT_USE_TQFILEDIALOG_PRIVATE
if(dlg && dlg->d && dlg->d->types) if(dlg && dlg->d && dlg->d->types)
{ {
QTextOStream str(&filter); TQTextOStream str(&filter);
for(int i=0; i<dlg->d->types->count(); ++i) for(int i=0; i<dlg->d->types->count(); ++i)
{ {
if(i) if(i)
str << ";;"; str << ";;";
if(scribusSave && -1!=dlg->d->types->text(i).find("(*.sla *.sla.gz *.scd *scd.gz)")) if(scribusSave && -1!=dlg->d->types->text(i).tqfind("(*.sla *.sla.gz *.scd *scd.gz)"))
str << "Compressed Documents (*.sla.gz *scd.gz);;Documents (*.sla *.scd)"; str << "Compressed Documents (*.sla.gz *scd.gz);;Documents (*.sla *.scd)";
else else
str << dlg->d->types->text(i); str << dlg->d->types->text(i);
@ -224,25 +224,25 @@ static const QString getFilters(QFileDialog *dlg, bool scribusSave=false)
#else #else
if(dlg) if(dlg)
{ {
const QObjectList *children=((QObject *)dlg)->children(); const TQObjectList tqchildren=((TQObject *)dlg)->childrenListObject();
if(children) if(!tqchildren.isEmpty())
{ {
QObjectList::ConstIterator it(children->begin()), TQObjectList::ConstIterator it(tqchildren.begin()),
end(children->end()); end(tqchildren.end());
for(; it!=end; ++it) for(; it!=end; ++it)
if(::qt_cast<QComboBox *>(*it) && 0==qstrcmp((*it)->name(), "file types")) if(::tqqt_cast<TQComboBox *>(*it) && 0==qstrcmp((*it)->name(), "file types"))
{ {
QComboBox *types=(QComboBox *)(*it); TQComboBox *types=(TQComboBox *)(*it);
QTextOStream str(&filter); TQTextOStream str(&filter);
for(int i=0; i<types->count(); ++i) for(int i=0; i<types->count(); ++i)
{ {
if(i) if(i)
str << ";;"; str << ";;";
if(scribusSave && -1!=types->text(i).find("(*.sla *.sla.gz *.scd *scd.gz)")) if(scribusSave && -1!=types->text(i).tqfind("(*.sla *.sla.gz *.scd *scd.gz)"))
str << "Compressed Documents (*.sla.gz *scd.gz);;Documents (*.sla *.scd)"; str << "Compressed Documents (*.sla.gz *scd.gz);;Documents (*.sla *.scd)";
else else
str << types->text(i); str << types->text(i);
@ -257,31 +257,31 @@ static const QString getFilters(QFileDialog *dlg, bool scribusSave=false)
return filter; return filter;
} }
static QString getCurrentFileName(QFileDialog *dlg) static TQString getCurrentFileName(TQFileDialog *dlg)
{ {
if(dlg) if(dlg)
{ {
const QObjectList *children=((QObject *)dlg)->children(); const TQObjectList tqchildren=((TQObject *)dlg)->childrenListObject();
if(children) if(!tqchildren.isEmpty())
{ {
QObjectList::ConstIterator it(children->begin()), TQObjectList::ConstIterator it(tqchildren.begin()),
end(children->end()); end(tqchildren.end());
for(; it!=end; ++it) for(; it!=end; ++it)
if(::qt_cast<QLineEdit *>(*it)) // && 0==qstrcmp((*it)->name(), "name/filter editor")) if(::tqqt_cast<TQLineEdit *>(*it)) // && 0==qstrcmp((*it)->name(), "name/filter editor"))
return ((QLineEdit *)(*it))->text(); return ((TQLineEdit *)(*it))->text();
} }
} }
return QString(); return TQString();
} }
static QString getDir(const QString &f) static TQString getDir(const TQString &f)
{ {
QString d(f); TQString d(f);
int slashPos=d.findRev('/'); int slashPos=d.tqfindRev('/');
if(slashPos!=-1) if(slashPos!=-1)
d.remove(slashPos+1, d.length()); d.remove(slashPos+1, d.length());
@ -290,9 +290,9 @@ static QString getDir(const QString &f)
} }
#endif #endif
static bool writeString(int fd, const QString &str) static bool writeString(int fd, const TQString &str)
{ {
QCString utf8(str.utf8()); TQCString utf8(str.utf8());
int size=utf8.length()+1; int size=utf8.length()+1;
return writeBlock(fd, (char *)&size, 4) && writeBlock(fd, utf8.data(), size); return writeBlock(fd, (char *)&size, 4) && writeBlock(fd, utf8.data(), size);
@ -305,11 +305,11 @@ static bool writeBool(int fd, bool b)
return writeBlock(fd, (char *)&bv, 1); return writeBlock(fd, (char *)&bv, 1);
} }
class KQtDialog : public QDialog class KTQtDialog : public TQDialog
{ {
public: public:
KQtDialog(QWidget *parent) : QDialog(parent, "kqt", true, WStyle_NoBorder|WX11BypassWM) KTQtDialog(TQWidget *tqparent) : TQDialog(tqparent, "kqt", true, WStyle_NoBorder|WX11BypassWM)
{ {
resize(1, 1); resize(1, 1);
setWindowOpacity(0.0); setWindowOpacity(0.0);
@ -317,37 +317,37 @@ class KQtDialog : public QDialog
move(32768, 32768); move(32768, 32768);
} }
/* void r() { QDialog::reject(); }*/ /* void r() { TQDialog::reject(); }*/
}; };
class KQtThread : public QThread class KTQtThread : public TQThread
{ {
public: public:
KQtThread(QStringList &l, QString &s, int f, KQtDialog *dlg) : dialog(dlg), kdialogdError(false), res(l), selFilter(s), fd(f) KTQtThread(TQStringList &l, TQString &s, int f, KTQtDialog *dlg) : dialog(dlg), kdialogdError(false), res(l), selFilter(s), fd(f)
{ } { }
bool readData(QCString &buffer, int size) bool readData(TQCString &buffer, int size)
{ {
buffer.resize(size); buffer.resize(size);
return ::readBlock(fd, buffer.data(), size); return ::readBlock(fd, buffer.data(), size);
} }
bool readString(QString &str, int size) bool readString(TQString &str, int size)
{ {
QCString buffer; TQCString buffer;
buffer.resize(size); buffer.resize(size);
if(!readBlock(fd, buffer.data(), size)) if(!readBlock(fd, buffer.data(), size))
return false; return false;
str=QString::fromUtf8(buffer.data()); str=TQString::fromUtf8(buffer.data());
return true; return true;
} }
void run() void run()
{ {
QString buffer; TQString buffer;
int num=0; int num=0;
if(readBlock(fd, (char *)&num, 4)) if(readBlock(fd, (char *)&num, 4))
@ -381,23 +381,23 @@ class KQtThread : public QThread
else else
kdialogdError=true; kdialogdError=true;
QApplication::postEvent(dialog, new QCloseEvent); TQApplication::postEvent(dialog, new TQCloseEvent);
} }
KQtDialog *dialog; KTQtDialog *dialog;
bool kdialogdError; bool kdialogdError;
QStringList &res; TQStringList &res;
QString &selFilter; TQString &selFilter;
int fd; int fd;
}; };
static bool sendMessage(QWidget *parent, Operation op, QStringList &res, QString &selFilter, static bool sendMessage(TQWidget *tqparent, Operation op, TQStringList &res, TQString &selFilter,
const QString &title, const QString &p1, const QString *p2, bool ow) const TQString &title, const TQString &p1, const TQString *p2, bool ow)
{ {
if(connectToKDialogD(getAppName())) if(connectToKDialogD(getAppName()))
{ {
char o=(char)op; char o=(char)op;
int xid=parent ? parent->topLevelWidget()->winId() : qApp->activeWindow()->winId(); int xid=tqparent ? tqparent->tqtopLevelWidget()->winId() : tqApp->activeWindow()->winId();
if(writeBlock(kdialogdSocket, &o, 1) && if(writeBlock(kdialogdSocket, &o, 1) &&
writeBlock(kdialogdSocket, (char *)&xid, 4) && writeBlock(kdialogdSocket, (char *)&xid, 4) &&
@ -406,8 +406,8 @@ static bool sendMessage(QWidget *parent, Operation op, QStringList &res, QString
(p2? writeString(kdialogdSocket, *p2) : true) && (p2? writeString(kdialogdSocket, *p2) : true) &&
(OP_FILE_SAVE==op ? writeBool(kdialogdSocket, ow) : true)) (OP_FILE_SAVE==op ? writeBool(kdialogdSocket, ow) : true))
{ {
KQtDialog dlg(parent); KTQtDialog dlg(tqparent);
KQtThread thread(res, selFilter, kdialogdSocket, &dlg); KTQtThread thread(res, selFilter, kdialogdSocket, &dlg);
thread.start(); thread.start();
dlg.exec(); dlg.exec();
@ -424,7 +424,7 @@ static bool sendMessage(QWidget *parent, Operation op, QStringList &res, QString
return false; return false;
} }
static QString getTitle(const QString &title, Operation op) static TQString getTitle(const TQString &title, Operation op)
{ {
if(!title.isEmpty()) if(!title.isEmpty())
return title; return title;
@ -432,13 +432,13 @@ static QString getTitle(const QString &title, Operation op)
return "."; return ".";
} }
static bool openKdeDialog(QWidget *widget, const QString &title, const QString &p1, const QString *p2, static bool openKdeDialog(TQWidget *widget, const TQString &title, const TQString &p1, const TQString *p2,
Operation op, QStringList &res, QString *selFilter, bool ow=false) Operation op, TQStringList &res, TQString *selFilter, bool ow=false)
{ {
QString filter; TQString filter;
bool rv=sendMessage(widget, op, res, filter, getTitle(title, op), p1, p2, ow); bool rv=sendMessage(widget, op, res, filter, getTitle(title, op), p1, p2, ow);
// If we failed to talk to, or start kdialogd, then dont keep trying - just fall back to Qt // If we failed to talk to, or start kdialogd, then dont keep trying - just fall back to TQt
if(!rv) if(!rv)
/*useKde=false*/; /*useKde=false*/;
else if(selFilter) else if(selFilter)
@ -468,98 +468,98 @@ static bool kqtInit()
return useKde; return useKde;
} }
static QString lastDir; static TQString lastDir;
static void storeLastDir(const QString &f) static void storeLastDir(const TQString &f)
{ {
lastDir=f; lastDir=f;
int slashPos(lastDir.findRev('/')); int slashPos(lastDir.tqfindRev('/'));
if(slashPos!=-1) if(slashPos!=-1)
lastDir.remove(slashPos+1, lastDir.length()); lastDir.remove(slashPos+1, lastDir.length());
} }
static const QString & startDir(const QString &d) static const TQString & startDir(const TQString &d)
{ {
return d.isEmpty() ? lastDir : d; return d.isEmpty() ? lastDir : d;
} }
QString QFileDialog::getOpenFileName(const QString &initially, const QString &filter, TQString TQFileDialog::getOpenFileName(const TQString &initially, const TQString &filter,
QWidget *parent, const char *name, const QString &caption, TQWidget *tqparent, const char *name, const TQString &caption,
QString *selectedFilter, bool resolveSymlinks) TQString *selectedFilter, bool resolveSymlinks)
{ {
QStringList res; TQStringList res;
QString f(qt2KdeFilter(filter)); TQString f(qt2KdeFilter(filter));
kqtInit(); kqtInit();
if(openKdeDialog(parent, caption, startDir(initially), &f, OP_FILE_OPEN, res, selectedFilter)) if(openKdeDialog(tqparent, caption, startDir(initially), &f, OP_FILE_OPEN, res, selectedFilter))
{ {
kde2QtFilter(filter, selectedFilter); kde2TQtFilter(filter, selectedFilter);
QString fn(res.first()); TQString fn(res.first());
storeLastDir(fn); storeLastDir(fn);
return fn; return fn;
} }
return QString::null; return TQString();
} }
QString QFileDialog::getSaveFileName(const QString &initially, const QString &filter, QWidget *parent, TQString TQFileDialog::getSaveFileName(const TQString &initially, const TQString &filter, TQWidget *tqparent,
const char *name, const QString &caption, const char *name, const TQString &caption,
QString *selectedFilter, bool resolveSymlinks) TQString *selectedFilter, bool resolveSymlinks)
{ {
QStringList res; TQStringList res;
QString f(qt2KdeFilter(filter)); TQString f(qt2KdeFilter(filter));
kqtInit(); kqtInit();
if (openKdeDialog(parent, caption, startDir(initially), &f, OP_FILE_SAVE, res, selectedFilter)) if (openKdeDialog(tqparent, caption, startDir(initially), &f, OP_FILE_SAVE, res, selectedFilter))
{ {
kde2QtFilter(filter, selectedFilter); kde2TQtFilter(filter, selectedFilter);
QString fn(res.first()); TQString fn(res.first());
storeLastDir(fn); storeLastDir(fn);
return fn; return fn;
} }
return QString::null; return TQString();
} }
QString QFileDialog::getExistingDirectory(const QString &dir, QWidget *parent, const char *name, TQString TQFileDialog::getExistingDirectory(const TQString &dir, TQWidget *tqparent, const char *name,
const QString &caption, bool dirOnly, bool resolveSymlinks) const TQString &caption, bool dirOnly, bool resolveSymlinks)
{ {
QStringList res; TQStringList res;
QString dummy; TQString dummy;
kqtInit(); kqtInit();
return openKdeDialog(parent, caption, dir, NULL, OP_FOLDER, res, &dummy) return openKdeDialog(tqparent, caption, dir, NULL, OP_FOLDER, res, &dummy)
? res.first() ? res.first()
: QString::null; : TQString();
} }
QStringList QFileDialog::getOpenFileNames(const QString &filter, const QString &dir, QWidget *parent, TQStringList TQFileDialog::getOpenFileNames(const TQString &filter, const TQString &dir, TQWidget *tqparent,
const char *name, const QString &caption, const char *name, const TQString &caption,
QString *selectedFilter, bool resolveSymlinks) TQString *selectedFilter, bool resolveSymlinks)
{ {
QStringList res; TQStringList res;
QString f(qt2KdeFilter(filter)); TQString f(qt2KdeFilter(filter));
kqtInit(); kqtInit();
openKdeDialog(parent, caption, startDir(dir), &f, OP_FILE_OPEN_MULTIPLE, res, selectedFilter); openKdeDialog(tqparent, caption, startDir(dir), &f, OP_FILE_OPEN_MULTIPLE, res, selectedFilter);
if(res.count()) if(res.count())
{ {
kde2QtFilter(filter, selectedFilter); kde2TQtFilter(filter, selectedFilter);
storeLastDir(res.first()); storeLastDir(res.first());
} }
return res; return res;
} }
#ifdef KQT_OVERLOAD_NON_STATIC_FILEDIALOGS #ifdef KTQT_OVERLOAD_NON_STATIC_FILEDIALOGS
static QString getFile(const QString &f) static TQString getFile(const TQString &f)
{ {
QString d(f); TQString d(f);
int slashPos=d.findRev('/'); int slashPos=d.tqfindRev('/');
if(slashPos!=-1) if(slashPos!=-1)
d.remove(0, slashPos+1); d.remove(0, slashPos+1);
@ -567,70 +567,70 @@ static QString getFile(const QString &f)
return d; return d;
} }
int QDialog::exec() int TQDialog::exec()
{ {
int res=QDialog::Rejected; int res=TQDialog::Rejected;
if(inherits("QFileDialog")) if(inherits("TQFileDialog"))
{ {
QFileDialog *that=(QFileDialog *)this; TQFileDialog *that=(TQFileDialog *)this;
const QDir *dirp=that->dir(); const TQDir *dirp=that->dir();
QString dir, TQString dir,
selectedFilter, selectedFilter,
file, file,
initialDir(dirp ? dirp->absPath() : QDir::homeDirPath()); initialDir(dirp ? dirp->absPath() : TQDir::homeDirPath());
QStringList files; TQStringList files;
if(dirp) if(dirp)
delete dirp; delete dirp;
QApplication::eventLoop()->processEvents(QEventLoop::ExcludeUserInput, 1); TQApplication::eventLoop()->processEvents(TQEventLoop::ExcludeUserInput, 1);
switch(that->mode()) switch(that->mode())
{ {
case QFileDialog::Directory: case TQFileDialog::Directory:
case QFileDialog::DirectoryOnly: case TQFileDialog::DirectoryOnly:
dir=QFileDialog::getExistingDirectory(initialDir, parentWidget(), NULL, dir=TQFileDialog::getExistingDirectory(initialDir, tqparentWidget(), NULL,
caption(), true, true); caption(), true, true);
if(!dir.isEmpty()) if(!dir.isEmpty())
res=QDialog::Accepted; res=TQDialog::Accepted;
break; break;
case QFileDialog::AnyFile: case TQFileDialog::AnyFile:
{ {
QString app(getFile(qApp->argv()[0])), TQString app(getFile(tqApp->argv()[0])),
initialFile(getCurrentFileName(that)); initialFile(getCurrentFileName(that));
if(!initialFile.isEmpty()) if(!initialFile.isEmpty())
initialDir=initialDir+QChar('/')+initialFile; initialDir=initialDir+TQChar('/')+initialFile;
file=QFileDialog::getSaveFileName(initialDir, file=TQFileDialog::getSaveFileName(initialDir,
getFilters(that, "scribus"==app || getFilters(that, "scribus"==app ||
"scribus-ng"==app), "scribus-ng"==app),
parentWidget(), NULL, caption(), &selectedFilter, tqparentWidget(), NULL, caption(), &selectedFilter,
true); true);
if(!file.isEmpty()) if(!file.isEmpty())
res=QDialog::Accepted; res=TQDialog::Accepted;
break; break;
} }
case QFileDialog::ExistingFile: case TQFileDialog::ExistingFile:
file=QFileDialog::getOpenFileName(initialDir, getFilters(that), parentWidget(), file=TQFileDialog::getOpenFileName(initialDir, getFilters(that), tqparentWidget(),
NULL, caption(), &selectedFilter, true); NULL, caption(), &selectedFilter, true);
if(!file.isEmpty()) if(!file.isEmpty())
res=QDialog::Accepted; res=TQDialog::Accepted;
break; break;
case QFileDialog::ExistingFiles: case TQFileDialog::ExistingFiles:
files=QFileDialog::getOpenFileNames(getFilters(that), initialDir, parentWidget(), files=TQFileDialog::getOpenFileNames(getFilters(that), initialDir, tqparentWidget(),
NULL, caption(), &selectedFilter, true); NULL, caption(), &selectedFilter, true);
if(files.count()) if(files.count())
res=QDialog::Accepted; res=TQDialog::Accepted;
break; break;
} }
if(QDialog::Accepted==res) if(TQDialog::Accepted==res)
{ {
if(file.isEmpty() && files.count()) if(file.isEmpty() && files.count())
file=files.first(); file=files.first();
@ -645,16 +645,16 @@ int QDialog::exec()
if(files.count() && that->nameEdit) if(files.count() && that->nameEdit)
{ {
QStringList::Iterator it(files.begin()), TQStringList::Iterator it(files.begin()),
end(files.end()); end(files.end());
QString filesStr; TQString filesStr;
QTextOStream str(&filesStr); TQTextOStream str(&filesStr);
for(; it!=end; ++it) for(; it!=end; ++it)
str << "\"" << (*it) << "\" "; str << "\"" << (*it) << "\" ";
that->nameEdit->setText(filesStr); that->nameEdit->setText(filesStr);
} }
QApplication::eventLoop()->processEvents(QEventLoop::ExcludeUserInput, 1); TQApplication::eventLoop()->processEvents(TQEventLoop::ExcludeUserInput, 1);
} }
} }
else else

Loading…
Cancel
Save