diff options
author | tpearson <tpearson@283d02a7-25f6-0310-bc7c-ecb5cbfe19da> | 2011-05-08 19:29:16 +0000 |
---|---|---|
committer | tpearson <tpearson@283d02a7-25f6-0310-bc7c-ecb5cbfe19da> | 2011-05-08 19:29:16 +0000 |
commit | 7a92d5c79f247b98a50500822fdc4c391a1b1f41 (patch) | |
tree | 7e2eb6f7e2bd93b1b92acfc8b14f2dab5d2adcc9 | |
parent | 7b227bd6ed94b3972dc84667dd5c726fa488c6e8 (diff) | |
download | kgtk-qt3-7a92d5c79f247b98a50500822fdc4c391a1b1f41.tar.gz kgtk-qt3-7a92d5c79f247b98a50500822fdc4c391a1b1f41.zip |
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
-rw-r--r-- | common/common.h | 6 | ||||
-rw-r--r-- | gtk2/kgtk2.c | 18 | ||||
-rw-r--r-- | kdialogd3/kdialogd.cpp | 116 | ||||
-rw-r--r-- | kdialogd3/kdialogd.h | 44 | ||||
-rw-r--r-- | qt3/kqt3.cpp | 316 |
5 files changed, 252 insertions, 248 deletions
diff --git a/common/common.h b/common/common.h index ca246b9..61769f3 100644 --- a/common/common.h +++ b/common/common.h @@ -55,7 +55,7 @@ static const char * getPidFileName() #ifdef __KDIALOGD_H__ // We are kdialogd - so create socket folder if it does not exist... sprintf(pidfile, "%s/%s%s", tmp, PID_DIR, user); - KStandardDirs::makeDir(QString::fromAscii(pidfile)); + KStandardDirs::makeDir(TQString::fromAscii(pidfile)); #endif /* CPD: TODO get dispaly number! */ @@ -95,7 +95,7 @@ static const char * getSockName() #ifdef __KDIALOGD_H__ // We are kdialogd - so create socket folder if it does not exist... sprintf(sock, "%s/%s%s", tmp, SOCK_DIR, user); - KStandardDirs::makeDir(QString::fromAscii(sock)); + KStandardDirs::makeDir(TQString::fromAscii(sock)); #endif /* CPD: TODO get dispaly number! */ @@ -166,7 +166,7 @@ static int writeBlock(int fd, const char *pData, int size) #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. To this en, a lockfile is created,and used to guard around the critical sections diff --git a/gtk2/kgtk2.c b/gtk2/kgtk2.c index d0457c5..84941dd 100644 --- a/gtk2/kgtk2.c +++ b/gtk2/kgtk2.c @@ -149,7 +149,7 @@ static const gchar *getAppName(const gchar *app) const gchar *a=app ? app : kgtk_get_app_name(getpid()); 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 */ if(a && 0==strcmp(a, "java")) a=kgtk_get_app_name(getppid()); @@ -249,7 +249,7 @@ static gboolean sendMessage(GtkWidget *widget, Operation op, GSList **res, gchar if(widget->parent) { #ifdef KGTK_DEBUG - printf("KGTK::Dialog has a parent!\n"); + printf("KGTK::Dialog has a tqparent!\n"); #endif xid=GDK_WINDOW_XID(gtk_widget_get_toplevel(widget->parent)); } @@ -543,7 +543,7 @@ typedef struct _GtkFilePath GtkFilePath; typedef struct _GtkFileSystemModel GtkFileSystemModel; struct _GtkFileFilter { - GtkObject parent_instance; + GtkObject tqparent_instance; gchar *name; GSList *rules; @@ -632,7 +632,7 @@ RowType; static GtkWidget * kgtk_file_chooser_dialog_new_valist (const gchar *title, - GtkWindow *parent, + GtkWindow *tqparent, GtkFileChooserAction action, const gchar *backend, const gchar *first_button_text, @@ -648,8 +648,8 @@ kgtk_file_chooser_dialog_new_valist (const gchar *title, "file-system-backend", backend, NULL); - if (parent) - gtk_window_set_transient_for (GTK_WINDOW (result), parent); + if (tqparent) + gtk_window_set_transient_for (GTK_WINDOW (result), tqparent); 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 static gchar *modifyFilter(const char *filter) { @@ -1737,7 +1737,7 @@ void g_signal_stop_emission_by_name(gpointer instance, const gchar *detailed_sig #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, ...) { @@ -1748,7 +1748,7 @@ GtkWidget * gtk_file_chooser_dialog_new(const gchar *title, GtkWindow *parent, va_list varargs; 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); #ifdef KGTK_DEBUG diff --git a/kdialogd3/kdialogd.cpp b/kdialogd3/kdialogd.cpp index 7e7adde..b7a84c7 100644 --- a/kdialogd3/kdialogd.cpp +++ b/kdialogd3/kdialogd.cpp @@ -4,7 +4,7 @@ #include <iostream> #include <kdiroperator.h> #include <kuniqueapplication.h> -#include <qsocketnotifier.h> +#include <tqsocketnotifier.h> #include <kio/netaccess.h> #include <kmessagebox.h> #include <klocale.h> @@ -22,7 +22,7 @@ #include <ksockaddr.h> #include <kdebug.h> #include <kdeversion.h> -#include <qtimer.h> +#include <tqtimer.h> #ifdef KDIALOGD_APP #include <kcmdlineargs.h> #include <kaboutdata.h> @@ -38,9 +38,9 @@ KConfig *KDialogD::theirConfig=NULL; #define DEFAULT_TIMEOUT 30 #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 @@ -121,7 +121,7 @@ static int createSocket() 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()), end(urls.end()); @@ -132,7 +132,7 @@ static void urls2Local(KURL::List &urls, QStringList &items, QWidget *parent) else { #if KDE_IS_VERSION(3, 5, 0) - KURL url(KIO::NetAccess::mostLocalURL(*it, parent)); + KURL url(KIO::NetAccess::mostLocalURL(*it, tqparent)); if(url.isLocalFile()) items.append(url.path()); @@ -144,8 +144,8 @@ static void urls2Local(KURL::List &urls, QStringList &items, QWidget *parent) } } -KDialogD::KDialogD(QObject *parent) - : QObject(parent), +KDialogD::KDialogD(TQObject *tqparent) + : TQObject(tqparent), #ifdef KDIALOGD_APP itsTimer(NULL), itsTimeoutVal(DEFAULT_TIMEOUT), @@ -172,8 +172,8 @@ KDialogD::KDialogD(QObject *parent) if(!theirConfig) theirConfig=new KConfig("kdialogdrc", false, false); - connect(new QSocketNotifier(itsFd, QSocketNotifier::Read, this), - SIGNAL(activated(int)), this, SLOT(newConnection())); + connect(new TQSocketNotifier(itsFd, TQSocketNotifier::Read, this), + TQT_SIGNAL(activated(int)), this, TQT_SLOT(newConnection())); #ifdef KDIALOGD_APP if(theirConfig->hasGroup(CFG_TIMEOUT_GROUP)) @@ -182,12 +182,12 @@ KDialogD::KDialogD(QObject *parent) itsTimeoutVal=theirConfig->readNumEntry(CFG_TIMEOUT_KEY, DEFAULT_TIMEOUT); if(itsTimeoutVal<0) itsTimeoutVal=DEFAULT_TIMEOUT; - theirConfig->setGroup(QString::null); + theirConfig->setGroup(TQString()); } kdDebug() << "Timeout:" << itsTimeoutVal << endl; 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 } } @@ -216,7 +216,7 @@ void KDialogD::newConnection() if(readBlock(connectedFD, (char *)&appNameLen, 4)) { bool ok=true; - QCString appName; + TQCString appName; if(0==appNameLen) appName="Generic"; @@ -234,8 +234,8 @@ void KDialogD::newConnection() itsTimer->stop(); #endif connect(new KDialogDClient(connectedFD, appName, this), - SIGNAL(error(KDialogDClient *)), - this, SLOT(deleteConnection(KDialogDClient *))); + TQT_SIGNAL(error(KDialogDClient *)), + this, TQT_SLOT(deleteConnection(KDialogDClient *))); } } } @@ -272,16 +272,16 @@ void KDialogD::timeout() #endif } -KDialogDClient::KDialogDClient(int sock, const QString &an, QObject *parent) - : QObject(parent), +KDialogDClient::KDialogDClient(int sock, const TQString &an, TQObject *tqparent) + : TQObject(tqparent), itsFd(sock), itsDlg(NULL), itsAccepted(false), itsAppName(an) { kdDebug() << "new client..." << itsAppName << " (" << itsFd << ")" << endl; - connect(new QSocketNotifier(itsFd, QSocketNotifier::Read, this), SIGNAL(activated(int)), this, SLOT(read())); - connect(new QSocketNotifier(itsFd, QSocketNotifier::Exception, this), SIGNAL(activated(int)), this, SLOT(close())); + connect(new TQSocketNotifier(itsFd, TQSocketNotifier::Read, this), TQT_SIGNAL(activated(int)), this, TQT_SLOT(read())); + connect(new TQSocketNotifier(itsFd, TQSocketNotifier::Exception, this), TQT_SIGNAL(activated(int)), this, TQT_SLOT(close())); } KDialogDClient::~KDialogDClient() @@ -316,7 +316,7 @@ void KDialogDClient::read() return; char request; - QString caption; + TQString caption; unsigned int xid=0; 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) { - QString intialFolder; + TQString intialFolder; if(readString(intialFolder)) { @@ -352,7 +352,7 @@ void KDialogDClient::read() } else { - QString intialFolder, + TQString intialFolder, filter; char overW=0; @@ -379,20 +379,20 @@ void KDialogDClient::finished() // // * 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 - // * 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 // 'accepted' value there, and check for that after the dialog is finished. kdDebug() << "finished" << endl; - if(itsDlg && !(itsAccepted || QDialog::Accepted==itsDlg->result())) + if(itsDlg && !(itsAccepted || TQDialog::Accepted==itsDlg->result())) cancel(); } -void KDialogDClient::ok(const QStringList &items) +void KDialogDClient::ok(const TQStringList &items) { kdDebug() << "ok" << endl; int num=items.count(); - QStringList::ConstIterator it(items.begin()), + TQStringList::ConstIterator it(items.begin()), end(items.end()); 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); return ::readBlock(itsFd, buffer.data(), size); } -bool KDialogDClient::readString(QString &str) +bool KDialogDClient::readString(TQString &str) { int size; if(!readData((char *)&size, 4)) return false; - QCString buffer; + TQCString buffer; buffer.resize(size); if(!readData(buffer.data(), size)) return false; - str=QString::fromUtf8(buffer.data()); + str=TQString::fromUtf8(buffer.data()); 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; 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; itsDlg=d; @@ -471,7 +471,7 @@ void KDialogDClient::initDialog(const QString &caption, KDialogBase *d, unsigned KWin::setState(itsDlg->winId(), NET::Modal); KWin::WindowInfo wi(KWin::windowInfo(xid, NET::WMGeometry, NET::WM2UserTime)); - QRect geom(wi.geometry()); + TQRect geom(wi.tqgeometry()); int rx=geom.x(), ry=geom.y(); @@ -505,14 +505,14 @@ void KDialogDClient::initDialog(const QString &caption, KDialogBase *d, unsigned #endif } - connect(itsDlg, SIGNAL(ok(const QStringList &)), this, SLOT(ok(const QStringList &))); - connect(itsDlg, SIGNAL(finished()), this, SLOT(finished())); + connect(itsDlg, TQT_SIGNAL(ok(const TQStringList &)), this, TQT_SLOT(ok(const TQStringList &))); + connect(itsDlg, TQT_SIGNAL(finished()), this, TQT_SLOT(finished())); itsDlg->show(); } -KDialogDFileDialog::KDialogDFileDialog(QString &an, Operation op, const QString &startDir, - const QString &filter, bool confirmOw) - : KFileDialog(startDir.isEmpty() || "~"==startDir ? QDir::homeDirPath() : startDir, +KDialogDFileDialog::KDialogDFileDialog(TQString &an, Operation op, const TQString &startDir, + const TQString &filter, bool confirmOw) + : KFileDialog(startDir.isEmpty() || "~"==startDir ? TQDir::homeDirPath() : startDir, filter, NULL, NULL, false), itsConfirmOw(confirmOw), itsAppName(an) @@ -539,9 +539,9 @@ KDialogDFileDialog::KDialogDFileDialog(QString &an, Operation op, const QString if(KDialogD::config()) { - QString oldGrp(KDialogD::config()->group()), + TQString oldGrp(KDialogD::config()->group()), grp(groupName(itsAppName)); - QSize defaultSize(600, 400); + TQSize defaultSize(600, 400); readConfig(KDialogD::config(), grp); KDialogD::config()->setGroup(grp); @@ -559,12 +559,12 @@ void KDialogDFileDialog::accept() void KDialogDFileDialog::slotOk() { - setResult(QDialog::Accepted); + setResult(TQDialog::Accepted); KFileDialog::slotOk(); kdDebug() << "KDialogDFileDialog::slotOk" << endl; KURL::List urls; - QStringList items; + TQStringList items; bool good=true; if(mode()&KFile::Files) @@ -586,14 +586,14 @@ void KDialogDFileDialog::slotOk() good=!KIO::NetAccess::exists(urls.first(), false, this) || KMessageBox::Continue==KMessageBox::warningContinueCancel(this, i18n("File %1 exists.\nDo you want to replace it?") - .arg(urls.first().prettyURL()), + .tqarg(urls.first().prettyURL()), i18n("File Exists"), - KGuiItem(i18n("Replace"), "filesaveas"), QString::null, + KGuiItem(i18n("Replace"), "filesaveas"), TQString(), KMessageBox::Notify|KMessageBox::PlainCaption); if(good) { - QString filter(currentFilter()); + TQString filter(currentFilter()); if(!filter.isEmpty()) items.append(filter); @@ -603,7 +603,7 @@ void KDialogDFileDialog::slotOk() KFileDialog::accept(); } else - setResult(QDialog::Rejected); + setResult(TQDialog::Rejected); } } @@ -613,7 +613,7 @@ KDialogDFileDialog::~KDialogDFileDialog() if(KDialogD::config()) { - QString oldGrp(KDialogD::config()->group()), + TQString oldGrp(KDialogD::config()->group()), grp(groupName(itsAppName)); writeConfig(KDialogD::config(), grp); @@ -623,20 +623,20 @@ KDialogDFileDialog::~KDialogDFileDialog() } } -KDialogDDirSelectDialog::KDialogDDirSelectDialog(QString &an, const QString &startDir, bool localOnly, - QWidget *parent, const char *name, bool modal) +KDialogDDirSelectDialog::KDialogDDirSelectDialog(TQString &an, const TQString &startDir, bool localOnly, + TQWidget *tqparent, const char *name, bool modal) : KDirSelectDialog(startDir.isEmpty() || "~"==startDir - ? QDir::homeDirPath() : startDir, - localOnly, parent, name, modal), + ? TQDir::homeDirPath() : startDir, + localOnly, tqparent, name, modal), itsAppName(an) { kdDebug() << "startDir:" << startDir << endl; if(KDialogD::config()) { - QString oldGrp(KDialogD::config()->group()), + TQString oldGrp(KDialogD::config()->group()), grp(groupName(itsAppName, false)); - QSize defaultSize(600, 400); + TQSize defaultSize(600, 400); //readConfig(KDialogD::config(), grp); KDialogD::config()->setGroup(grp); @@ -651,7 +651,7 @@ KDialogDDirSelectDialog::~KDialogDDirSelectDialog() if(KDialogD::config()) { - QString oldGrp(KDialogD::config()->group()), + TQString oldGrp(KDialogD::config()->group()), grp(groupName(itsAppName, false)); //writeConfig(KDialogD::config(), grp); @@ -666,7 +666,7 @@ void KDialogDDirSelectDialog::slotOk() kdDebug() << "KDialogDDirSelectDialog::slotOk" << endl; KURL::List urls; - QStringList items; + TQStringList items; urls.append(url()); urls2Local(urls, items, this); @@ -704,13 +704,13 @@ int main(int argc, char **argv) #else extern "C" { - KDE_EXPORT KDEDModule *create_kdialogd(const QCString &obj) + KDE_EXPORT KDEDModule *create_kdialogd(const TQCString &obj) { return new KDialogDKDED(obj); } }; -KDialogDKDED::KDialogDKDED(const QCString &obj) +KDialogDKDED::KDialogDKDED(const TQCString &obj) : KDEDModule(obj) { new KDialogD(this); diff --git a/kdialogd3/kdialogd.h b/kdialogd3/kdialogd.h index 7e50580..f317443 100644 --- a/kdialogd3/kdialogd.h +++ b/kdialogd3/kdialogd.h @@ -9,7 +9,7 @@ #include "config.h" #ifdef KDIALOGD_APP -class QTimer; +class TQTimer; #else #include <kdedmodule.h> #endif @@ -19,10 +19,11 @@ class KConfig; class KDialogDFileDialog : public KFileDialog { Q_OBJECT + TQ_OBJECT 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); virtual ~KDialogDFileDialog(); @@ -33,23 +34,24 @@ class KDialogDFileDialog : public KFileDialog signals: - void ok(const QStringList &items); + void ok(const TQStringList &items); private: bool itsConfirmOw; - QString &itsAppName; + TQString &itsAppName; }; class KDialogDDirSelectDialog : public KDirSelectDialog { Q_OBJECT + TQ_OBJECT public: - KDialogDDirSelectDialog(QString &an, const QString &startDir = QString::null, + KDialogDDirSelectDialog(TQString &an, const TQString &startDir = TQString(), bool localOnly = false, - QWidget *parent = 0L, + TQWidget *tqparent = 0L, const char *name = 0, bool modal = false); virtual ~KDialogDDirSelectDialog(); @@ -59,27 +61,28 @@ class KDialogDDirSelectDialog : public KDirSelectDialog signals: - void ok(const QStringList &items); + void ok(const TQStringList &items); private: - QString &itsAppName; + TQString &itsAppName; }; -class KDialogDClient : public QObject +class KDialogDClient : public TQObject { Q_OBJECT + TQ_OBJECT public: - KDialogDClient(int sock, const QString &an, QObject *parent); + KDialogDClient(int sock, const TQString &an, TQObject *tqparent); virtual ~KDialogDClient(); public slots: void read(); void close(); - void ok(const QStringList &items); + void ok(const TQStringList &items); void finished(); signals: @@ -89,28 +92,29 @@ class KDialogDClient : public QObject private: 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 writeData(const char *buffer, int size) { return writeBlock(itsFd, buffer, size); } - bool readString(QString &str); - bool writeString(const QString &str); - void initDialog(const QString &caption, KDialogBase *d, unsigned int xid); + bool readString(TQString &str); + bool writeString(const TQString &str); + void initDialog(const TQString &caption, KDialogBase *d, unsigned int xid); private: int itsFd; KDialogBase *itsDlg; bool itsAccepted; - QString itsAppName; + TQString itsAppName; }; -class KDialogD : public QObject +class KDialogD : public TQObject { Q_OBJECT + TQ_OBJECT public: - KDialogD(QObject *parent=0L); + KDialogD(TQObject *tqparent=0L); virtual ~KDialogD(); public slots: @@ -124,7 +128,7 @@ class KDialogD : public QObject private: #ifdef KDIALOGD_APP - QTimer *itsTimer; + TQTimer *itsTimer; int itsTimeoutVal; #endif int itsFd, @@ -138,7 +142,7 @@ class KDialogDKDED : public KDEDModule { public: - KDialogDKDED(const QCString &obj); + KDialogDKDED(const TQCString &obj); }; #endif diff --git a/qt3/kqt3.cpp b/qt3/kqt3.cpp index 833b01d..d738b29 100644 --- a/qt3/kqt3.cpp +++ b/qt3/kqt3.cpp @@ -23,7 +23,7 @@ * ************************************************************************/ -#define KQT_OVERLOAD_NON_STATIC_FILEDIALOGS +#define KTQT_OVERLOAD_NON_STATIC_FILEDIALOGS #define _GNU_SOURCE #include <dlfcn.h> @@ -39,20 +39,20 @@ #include <errno.h> #include <string.h> #include <sys/types.h> -#include <qstring.h> -#include <qstringlist.h> -#include <qwidget.h> -#include <qapplication.h> -#ifdef KQT_OVERLOAD_NON_STATIC_FILEDIALOGS -#include <qcombobox.h> -#include <qlineedit.h> -#include <qobjectlist.h> +#include <tqstring.h> +#include <tqstringlist.h> +#include <tqwidget.h> +#include <tqapplication.h> +#ifdef KTQT_OVERLOAD_NON_STATIC_FILEDIALOGS +#include <tqcombobox.h> +#include <tqlineedit.h> +#include <tqobjectlist.h> #define private public // HACK HACK HACK!!! #endif -#include <qfiledialog.h> -#include <qthread.h> -#include <qnamespace.h> -#include <qeventloop.h> +#include <tqfiledialog.h> +#include <tqthread.h> +#include <tqnamespace.h> +#include <tqeventloop.h> #include "connect.h" #include "config.h" #include "mangled.h" @@ -93,16 +93,16 @@ static char * getAppNameFromPid(int pid) return appName; } -static const char * getAppName(bool useQt=true) +static const char * getAppName(bool useTQt=true) { static const char *appName=NULL; 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; - // 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 if(a && 0==strcmp(a, "java")) a=getAppNameFromPid(getppid()); @@ -112,13 +112,13 @@ static const char * getAppName(bool useQt=true) appName=a && (slash=strrchr(a, '/')) && '\0'!=slash[1] ? &(slash[1]) - : a ? a : "QtApp"; + : a ? a : "TQtApp"; } return appName; } -int QApplication::exec() +int TQApplication::exec() { static bool init=false; @@ -135,19 +135,19 @@ int QApplication::exec() return (int)realFunction(this); }; -static QString qt2KdeFilter(const QString &f) +static TQString qt2KdeFilter(const TQString &f) { - QString filter; - QTextOStream str(&filter); - QStringList list(QStringList::split(";;", f)); - QStringList::Iterator it(list.begin()), + TQString filter; + TQTextOStream str(&filter); + TQStringList list(TQStringList::split(";;", f)); + TQStringList::Iterator it(list.begin()), end(list.end()); bool first=true; for(; it!=end; ++it) { - int ob=(*it).findRev('('), - cb=(*it).findRev(')'); + int ob=(*it).tqfindRev('('), + cb=(*it).tqfindRev(')'); if(-1!=cb && ob<cb) { @@ -162,17 +162,17 @@ static QString qt2KdeFilter(const QString &f) return filter; } -static void kde2QtFilter(const QString &orig, QString *sel) +static void kde2TQtFilter(const TQString &orig, TQString *sel) { if(sel) { - QStringList list(QStringList::split(";;", orig)); - QStringList::Iterator it(list.begin()), + TQStringList list(TQStringList::split(";;", orig)); + TQStringList::Iterator it(list.begin()), end(list.end()); int pos; 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).length()>=sel->length()+pos && (')'==(*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 KQT_USE_QFILEDIALOG_PRIVATE +#ifdef KTQT_OVERLOAD_NON_STATIC_FILEDIALOGS +#ifdef KTQT_USE_TQFILEDIALOG_PRIVATE // HACK HACK HACK!!! -// KGtk versions <=0.9.1 used this copied QFileDialogPrivate to access the file filters -// newer versions walk the file dialogs children... -class QFileDialogPrivate { +// KGtk versions <=0.9.1 used this copied TQFileDialogPrivate to access the file filters +// newer versions walk the file dialogs tqchildren... +class TQFileDialogPrivate { public: - ~QFileDialogPrivate(); + ~TQFileDialogPrivate(); - QStringList history; + TQStringList history; - bool geometryDirty; - QComboBox * paths; - QComboBox * types; + bool tqgeometryDirty; + TQComboBox * paths; + TQComboBox * types; }; #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) { - QTextOStream str(&filter); + TQTextOStream str(&filter); for(int i=0; i<dlg->d->types->count(); ++i) { if(i) 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)"; else str << dlg->d->types->text(i); @@ -224,25 +224,25 @@ static const QString getFilters(QFileDialog *dlg, bool scribusSave=false) #else if(dlg) { - const QObjectList *children=((QObject *)dlg)->children(); + const TQObjectList tqchildren=((TQObject *)dlg)->childrenListObject(); - if(children) + if(!tqchildren.isEmpty()) { - QObjectList::ConstIterator it(children->begin()), - end(children->end()); + TQObjectList::ConstIterator it(tqchildren.begin()), + end(tqchildren.end()); 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); - QTextOStream str(&filter); + TQComboBox *types=(TQComboBox *)(*it); + TQTextOStream str(&filter); for(int i=0; i<types->count(); ++i) { if(i) 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)"; else str << types->text(i); @@ -257,31 +257,31 @@ static const QString getFilters(QFileDialog *dlg, bool scribusSave=false) return filter; } -static QString getCurrentFileName(QFileDialog *dlg) +static TQString getCurrentFileName(TQFileDialog *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()), - end(children->end()); + TQObjectList::ConstIterator it(tqchildren.begin()), + end(tqchildren.end()); for(; it!=end; ++it) - if(::qt_cast<QLineEdit *>(*it)) // && 0==qstrcmp((*it)->name(), "name/filter editor")) - return ((QLineEdit *)(*it))->text(); + if(::tqqt_cast<TQLineEdit *>(*it)) // && 0==qstrcmp((*it)->name(), "name/filter editor")) + 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) d.remove(slashPos+1, d.length()); @@ -290,9 +290,9 @@ static QString getDir(const QString &f) } #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; 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); } -class KQtDialog : public QDialog +class KTQtDialog : public TQDialog { public: - KQtDialog(QWidget *parent) : QDialog(parent, "kqt", true, WStyle_NoBorder|WX11BypassWM) + KTQtDialog(TQWidget *tqparent) : TQDialog(tqparent, "kqt", true, WStyle_NoBorder|WX11BypassWM) { resize(1, 1); setWindowOpacity(0.0); @@ -317,37 +317,37 @@ class KQtDialog : public QDialog move(32768, 32768); } -/* void r() { QDialog::reject(); }*/ +/* void r() { TQDialog::reject(); }*/ }; -class KQtThread : public QThread +class KTQtThread : public TQThread { 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); 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); if(!readBlock(fd, buffer.data(), size)) return false; - str=QString::fromUtf8(buffer.data()); + str=TQString::fromUtf8(buffer.data()); return true; } void run() { - QString buffer; + TQString buffer; int num=0; if(readBlock(fd, (char *)&num, 4)) @@ -381,23 +381,23 @@ class KQtThread : public QThread else kdialogdError=true; - QApplication::postEvent(dialog, new QCloseEvent); + TQApplication::postEvent(dialog, new TQCloseEvent); } - KQtDialog *dialog; + KTQtDialog *dialog; bool kdialogdError; - QStringList &res; - QString &selFilter; + TQStringList &res; + TQString &selFilter; int fd; }; -static bool sendMessage(QWidget *parent, Operation op, QStringList &res, QString &selFilter, - const QString &title, const QString &p1, const QString *p2, bool ow) +static bool sendMessage(TQWidget *tqparent, Operation op, TQStringList &res, TQString &selFilter, + const TQString &title, const TQString &p1, const TQString *p2, bool ow) { if(connectToKDialogD(getAppName())) { 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) && writeBlock(kdialogdSocket, (char *)&xid, 4) && @@ -406,8 +406,8 @@ static bool sendMessage(QWidget *parent, Operation op, QStringList &res, QString (p2? writeString(kdialogdSocket, *p2) : true) && (OP_FILE_SAVE==op ? writeBool(kdialogdSocket, ow) : true)) { - KQtDialog dlg(parent); - KQtThread thread(res, selFilter, kdialogdSocket, &dlg); + KTQtDialog dlg(tqparent); + KTQtThread thread(res, selFilter, kdialogdSocket, &dlg); thread.start(); dlg.exec(); @@ -424,7 +424,7 @@ static bool sendMessage(QWidget *parent, Operation op, QStringList &res, QString return false; } -static QString getTitle(const QString &title, Operation op) +static TQString getTitle(const TQString &title, Operation op) { if(!title.isEmpty()) return title; @@ -432,13 +432,13 @@ static QString getTitle(const QString &title, Operation op) return "."; } -static bool openKdeDialog(QWidget *widget, const QString &title, const QString &p1, const QString *p2, - Operation op, QStringList &res, QString *selFilter, bool ow=false) +static bool openKdeDialog(TQWidget *widget, const TQString &title, const TQString &p1, const TQString *p2, + 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); - // 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) /*useKde=false*/; else if(selFilter) @@ -468,98 +468,98 @@ static bool kqtInit() return useKde; } -static QString lastDir; +static TQString lastDir; -static void storeLastDir(const QString &f) +static void storeLastDir(const TQString &f) { lastDir=f; - int slashPos(lastDir.findRev('/')); + int slashPos(lastDir.tqfindRev('/')); if(slashPos!=-1) 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; } -QString QFileDialog::getOpenFileName(const QString &initially, const QString &filter, - QWidget *parent, const char *name, const QString &caption, - QString *selectedFilter, bool resolveSymlinks) +TQString TQFileDialog::getOpenFileName(const TQString &initially, const TQString &filter, + TQWidget *tqparent, const char *name, const TQString &caption, + TQString *selectedFilter, bool resolveSymlinks) { - QStringList res; - QString f(qt2KdeFilter(filter)); + TQStringList res; + TQString f(qt2KdeFilter(filter)); 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); - QString fn(res.first()); + kde2TQtFilter(filter, selectedFilter); + TQString fn(res.first()); storeLastDir(fn); return fn; } - return QString::null; + return TQString(); } -QString QFileDialog::getSaveFileName(const QString &initially, const QString &filter, QWidget *parent, - const char *name, const QString &caption, - QString *selectedFilter, bool resolveSymlinks) +TQString TQFileDialog::getSaveFileName(const TQString &initially, const TQString &filter, TQWidget *tqparent, + const char *name, const TQString &caption, + TQString *selectedFilter, bool resolveSymlinks) { - QStringList res; - QString f(qt2KdeFilter(filter)); + TQStringList res; + TQString f(qt2KdeFilter(filter)); 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); - QString fn(res.first()); + kde2TQtFilter(filter, selectedFilter); + TQString fn(res.first()); storeLastDir(fn); return fn; } - return QString::null; + return TQString(); } -QString QFileDialog::getExistingDirectory(const QString &dir, QWidget *parent, const char *name, - const QString &caption, bool dirOnly, bool resolveSymlinks) +TQString TQFileDialog::getExistingDirectory(const TQString &dir, TQWidget *tqparent, const char *name, + const TQString &caption, bool dirOnly, bool resolveSymlinks) { - QStringList res; - QString dummy; + TQStringList res; + TQString dummy; kqtInit(); - return openKdeDialog(parent, caption, dir, NULL, OP_FOLDER, res, &dummy) + return openKdeDialog(tqparent, caption, dir, NULL, OP_FOLDER, res, &dummy) ? res.first() - : QString::null; + : TQString(); } -QStringList QFileDialog::getOpenFileNames(const QString &filter, const QString &dir, QWidget *parent, - const char *name, const QString &caption, - QString *selectedFilter, bool resolveSymlinks) +TQStringList TQFileDialog::getOpenFileNames(const TQString &filter, const TQString &dir, TQWidget *tqparent, + const char *name, const TQString &caption, + TQString *selectedFilter, bool resolveSymlinks) { - QStringList res; - QString f(qt2KdeFilter(filter)); + TQStringList res; + TQString f(qt2KdeFilter(filter)); 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()) { - kde2QtFilter(filter, selectedFilter); + kde2TQtFilter(filter, selectedFilter); storeLastDir(res.first()); } return res; } -#ifdef KQT_OVERLOAD_NON_STATIC_FILEDIALOGS -static QString getFile(const QString &f) +#ifdef KTQT_OVERLOAD_NON_STATIC_FILEDIALOGS +static TQString getFile(const TQString &f) { - QString d(f); + TQString d(f); - int slashPos=d.findRev('/'); + int slashPos=d.tqfindRev('/'); if(slashPos!=-1) d.remove(0, slashPos+1); @@ -567,70 +567,70 @@ static QString getFile(const QString &f) 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(); - QString dir, + const TQDir *dirp=that->dir(); + TQString dir, selectedFilter, file, - initialDir(dirp ? dirp->absPath() : QDir::homeDirPath()); - QStringList files; + initialDir(dirp ? dirp->absPath() : TQDir::homeDirPath()); + TQStringList files; if(dirp) delete dirp; - QApplication::eventLoop()->processEvents(QEventLoop::ExcludeUserInput, 1); + TQApplication::eventLoop()->processEvents(TQEventLoop::ExcludeUserInput, 1); switch(that->mode()) { - case QFileDialog::Directory: - case QFileDialog::DirectoryOnly: - dir=QFileDialog::getExistingDirectory(initialDir, parentWidget(), NULL, + case TQFileDialog::Directory: + case TQFileDialog::DirectoryOnly: + dir=TQFileDialog::getExistingDirectory(initialDir, tqparentWidget(), NULL, caption(), true, true); if(!dir.isEmpty()) - res=QDialog::Accepted; + res=TQDialog::Accepted; break; - case QFileDialog::AnyFile: + case TQFileDialog::AnyFile: { - QString app(getFile(qApp->argv()[0])), + TQString app(getFile(tqApp->argv()[0])), initialFile(getCurrentFileName(that)); if(!initialFile.isEmpty()) - initialDir=initialDir+QChar('/')+initialFile; + initialDir=initialDir+TQChar('/')+initialFile; - file=QFileDialog::getSaveFileName(initialDir, + file=TQFileDialog::getSaveFileName(initialDir, getFilters(that, "scribus"==app || "scribus-ng"==app), - parentWidget(), NULL, caption(), &selectedFilter, + tqparentWidget(), NULL, caption(), &selectedFilter, true); if(!file.isEmpty()) - res=QDialog::Accepted; + res=TQDialog::Accepted; break; } - case QFileDialog::ExistingFile: - file=QFileDialog::getOpenFileName(initialDir, getFilters(that), parentWidget(), + case TQFileDialog::ExistingFile: + file=TQFileDialog::getOpenFileName(initialDir, getFilters(that), tqparentWidget(), NULL, caption(), &selectedFilter, true); if(!file.isEmpty()) - res=QDialog::Accepted; + res=TQDialog::Accepted; break; - case QFileDialog::ExistingFiles: - files=QFileDialog::getOpenFileNames(getFilters(that), initialDir, parentWidget(), + case TQFileDialog::ExistingFiles: + files=TQFileDialog::getOpenFileNames(getFilters(that), initialDir, tqparentWidget(), NULL, caption(), &selectedFilter, true); if(files.count()) - res=QDialog::Accepted; + res=TQDialog::Accepted; break; } - if(QDialog::Accepted==res) + if(TQDialog::Accepted==res) { if(file.isEmpty() && files.count()) file=files.first(); @@ -645,16 +645,16 @@ int QDialog::exec() if(files.count() && that->nameEdit) { - QStringList::Iterator it(files.begin()), + TQStringList::Iterator it(files.begin()), end(files.end()); - QString filesStr; - QTextOStream str(&filesStr); + TQString filesStr; + TQTextOStream str(&filesStr); for(; it!=end; ++it) str << "\"" << (*it) << "\" "; that->nameEdit->setText(filesStr); } - QApplication::eventLoop()->processEvents(QEventLoop::ExcludeUserInput, 1); + TQApplication::eventLoop()->processEvents(TQEventLoop::ExcludeUserInput, 1); } } else |