From 1a36f79cf4aedaad3ce55e1ed79bde71d19141b3 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Sl=C3=A1vek=20Banko?= Date: Thu, 6 Sep 2018 02:04:50 +0200 Subject: [PATCH] Initial TQt conversion MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Slávek Banko --- Makefile | 4 +- src/customtraylabel.cpp | 106 ++++++++++----------- src/customtraylabel.h | 36 +++---- src/kdocker.cpp | 110 ++++++++++----------- src/kdocker.h | 10 +- src/main.cpp | 8 +- src/qtraylabel.cpp | 206 ++++++++++++++++++++-------------------- src/qtraylabel.h | 72 +++++++------- src/trace.cpp | 18 ++-- src/trace.h | 4 +- src/traylabelmgr.cpp | 184 +++++++++++++++++------------------ src/traylabelmgr.h | 30 +++--- src/util.cpp | 8 +- src/util.h | 4 +- 14 files changed, 400 insertions(+), 400 deletions(-) diff --git a/Makefile b/Makefile index 56b9d46..df4175b 100644 --- a/Makefile +++ b/Makefile @@ -19,7 +19,7 @@ YACCFLAGS= -d INCPATH = -I/usr/lib/qt-3.3/mkspecs/default -I. -I. -Isrc -I/usr/X11R6/include/X11 -I/usr/include/X11R6 -I$(QTDIR)/include -Itmp/ LINK = g++ LFLAGS = -LIBS = $(SUBLIBS) -L/usr/X11/lib -L/usr/X11R6/lib -L$(QTDIR)/lib -L/usr/X11R6/lib -lXpm -lXmu -lqt-mt -lXext -lX11 -lm +LIBS = $(SUBLIBS) -L/usr/X11/lib -L/usr/X11R6/lib -L$(QTDIR)/lib -L/usr/X11R6/lib -lXpm -lXmu -ltqt-mt -lXext -lX11 -lm AR = ar cqs RANLIB = MOC = $(QTDIR)/bin/moc @@ -114,7 +114,7 @@ uicables: $(UICDECLS) $(UICIMPLS) $(MOC): ( cd $(QTDIR)/src/moc && $(MAKE) ) -Makefile: kdocker.pro /usr/lib/qt-3.3/mkspecs/default/qmake.conf /usr/lib/qt-3.3/lib/libqt-mt.prl +Makefile: kdocker.pro /usr/lib/qt-3.3/mkspecs/default/qmake.conf /usr/lib/qt-3.3/lib/libtqt-mt.prl $(QMAKE) -o Makefile kdocker.pro qmake: @$(QMAKE) -o Makefile kdocker.pro diff --git a/src/customtraylabel.cpp b/src/customtraylabel.cpp index 757df2f..abf02c1 100644 --- a/src/customtraylabel.cpp +++ b/src/customtraylabel.cpp @@ -19,14 +19,14 @@ // $Id: customtraylabel.cpp,v 1.14 2005/06/21 10:04:35 cs19713 Exp $ -#include -#include -#include -#include -#include -#include -#include -#include +#include +#include +#include +#include +#include +#include +#include +#include #include #include @@ -38,15 +38,15 @@ #include "traylabelmgr.h" #include "kdocker.h" -CustomTrayLabel::CustomTrayLabel(Window w, QWidget* p, const QString& t) - : QTrayLabel(w, p, t), mUndockWhenDead(false) +CustomTrayLabel::CustomTrayLabel(Window w, TQWidget* p, const TQString& t) + : TQTrayLabel(w, p, t), mUndockWhenDead(false) { installMenu(); } -CustomTrayLabel::CustomTrayLabel(const QStringList& argv, pid_t pid, - QWidget* parent) - : QTrayLabel(argv, pid, parent), mUndockWhenDead(false) +CustomTrayLabel::CustomTrayLabel(const TQStringList& argv, pid_t pid, + TQWidget* parent) + : TQTrayLabel(argv, pid, parent), mUndockWhenDead(false) { installMenu(); } @@ -56,18 +56,18 @@ CustomTrayLabel::CustomTrayLabel(const QStringList& argv, pid_t pid, */ void CustomTrayLabel::installMenu() { - QPixmap kdocker_png(KGlobal::iconLoader()->loadIcon("kdocker", KIcon::NoGroup, KIcon::SizeSmall)); + TQPixmap kdocker_png(KGlobal::iconLoader()->loadIcon("kdocker", KIcon::NoGroup, KIcon::SizeSmall)); setIcon(kdocker_png); TrayLabelMgr *tlMgr = TrayLabelMgr::instance(); - mOptionsMenu = new QPopupMenu(this); - mSessionManagement = new QAction(i18n("Dock when session restored"), 0, this); + mOptionsMenu = new TQPopupMenu(this); + mSessionManagement = new TQAction(i18n("Dock when session restored"), 0, this); mSessionManagement->setToggleAction(true); connect(mSessionManagement, SIGNAL(toggled(bool)), this, SLOT(enableSessionManagement(bool))); mSessionManagement->addTo(mOptionsMenu); - mAutoLaunch = new QAction(i18n("Launch on startup"), 0, this); + mAutoLaunch = new TQAction(i18n("Launch on startup"), 0, this); mAutoLaunch->setToggleAction(true); connect(mAutoLaunch, SIGNAL(activated()), this, SLOT(slotSetLaunchOnStartup())); @@ -75,37 +75,37 @@ void CustomTrayLabel::installMenu() mOptionsMenu->insertItem(i18n("Set Icon"), this, SLOT(setCustomIcon())); - mBalloonTimeout = new QAction(i18n("Set balloon timeout"), 0, this); + mBalloonTimeout = new TQAction(i18n("Set balloon timeout"), 0, this); connect(mBalloonTimeout, SIGNAL(activated()), this, SLOT(slotSetBalloonTimeout())); mBalloonTimeout->addTo(mOptionsMenu); - mDockWhenObscured = new QAction(i18n("Dock when obscured"), 0, this); + mDockWhenObscured = new TQAction(i18n("Dock when obscured"), 0, this); mDockWhenObscured->setToggleAction(true); connect(mDockWhenObscured, SIGNAL(toggled(bool)), this, SLOT(setDockWhenObscured(bool))); mDockWhenObscured->addTo(mOptionsMenu); - mDockWhenMinimized = new QAction(i18n("Dock when minimized"), 0, this); + mDockWhenMinimized = new TQAction(i18n("Dock when minimized"), 0, this); mDockWhenMinimized->setToggleAction(true); connect(mDockWhenMinimized, SIGNAL(toggled(bool)), this, SLOT(setDockWhenMinimized(bool))); mDockWhenMinimized->addTo(mOptionsMenu); - mDockWhenFocusLost = new QAction(i18n("Dock when focus lost"), 0, this); + mDockWhenFocusLost = new TQAction(i18n("Dock when focus lost"), 0, this); mDockWhenFocusLost->setToggleAction(true); connect(mDockWhenFocusLost, SIGNAL(toggled(bool)), this, SLOT(setDockWhenFocusLost(bool))); mDockWhenFocusLost->addTo(mOptionsMenu); - mSkipTaskbar = new QAction(i18n("Skip taskbar"), 0, this); + mSkipTaskbar = new TQAction(i18n("Skip taskbar"), 0, this); mSkipTaskbar->setToggleAction(true); connect(mSkipTaskbar, SIGNAL(toggled(bool)), this, SLOT(setSkipTaskbar(bool))); mSkipTaskbar->addTo(mOptionsMenu); - mMainMenu = new QPopupMenu(this); - mMainMenu->insertItem(QIconSet(kdocker_png), + mMainMenu = new TQPopupMenu(this); + mMainMenu->insertItem(TQIconSet(kdocker_png), i18n("About KDocker"), tlMgr, SLOT(about())); mMainMenu->insertSeparator(); mMainMenu->insertItem(i18n("Options"), mOptionsMenu); @@ -113,10 +113,10 @@ void CustomTrayLabel::installMenu() mMainMenu->insertItem(i18n("Undock All"), tlMgr, SLOT(undockAll())); mMainMenu->insertSeparator(); - mShowId = mMainMenu->insertItem(QString("Show/Hide [untitled]"), + mShowId = mMainMenu->insertItem(TQString("Show/Hide [untitled]"), this, SLOT(toggleShow())); - mMainMenu->insertItem(QString(i18n("Undock")), this, SLOT(undock())); - mMainMenu->insertItem(QString(i18n("Close")), this, SLOT(close())); + mMainMenu->insertItem(TQString(i18n("Undock")), this, SLOT(undock())); + mMainMenu->insertItem(TQString(i18n("Close")), this, SLOT(close())); connect(mMainMenu, SIGNAL(aboutToShow()), this, SLOT(updateMenu())); @@ -132,20 +132,20 @@ void CustomTrayLabel::installMenu() /* * Session Management */ -bool CustomTrayLabel::restoreState(QSettings& settings) +bool CustomTrayLabel::restoreState(TQSettings& settings) { mAutoLaunch->setOn(settings.readBoolEntry("/LaunchOnStartup")); setDockWhenObscured(settings.readBoolEntry("/DockWhenObscured")); TRACE("AutoLaunch=%i DWM=%i DWO=%i", isLaunchOnStartup(), isDockWhenMinimized(), isDockWhenObscured()); - return QTrayLabel::restoreState(settings); + return TQTrayLabel::restoreState(settings); } -bool CustomTrayLabel::saveState(QSettings& settings) +bool CustomTrayLabel::saveState(TQSettings& settings) { if (!mSessionManagement->isOn()) return false; - QTrayLabel::saveState(settings); + TQTrayLabel::saveState(settings); settings.writeEntry("/LaunchOnStartup", isLaunchOnStartup()); settings.writeEntry("/DockWhenObscured", isDockWhenObscured()); TRACE("AutoLaunch=%i DWM=%i DWO=%i", isLaunchOnStartup(), @@ -177,23 +177,23 @@ static bool which(const char *app) // Overridden to update our menu void CustomTrayLabel::setDockWhenMinimized(bool dwm) { - QTrayLabel::setDockWhenMinimized(dwm); + TQTrayLabel::setDockWhenMinimized(dwm); mDockWhenMinimized->setOn(isDockWhenMinimized()); } void CustomTrayLabel::setSkipTaskbar(bool skip) { - QTrayLabel::setSkipTaskbar(skip); + TQTrayLabel::setSkipTaskbar(skip); mSkipTaskbar->setOn(isSkippingTaskbar()); } -void CustomTrayLabel::setAppName(const QString& name) +void CustomTrayLabel::setAppName(const TQString& name) { - QTrayLabel::setAppName(name.lower()); + TQTrayLabel::setAppName(name.lower()); } /* - * This function is called when QTrayLabel wants to know whether it can + * This function is called when TQTrayLabel wants to know whether it can * unsubscribe from root window. This is because it doesnt know if someone * else is interested in root window events */ @@ -205,16 +205,16 @@ bool CustomTrayLabel::canUnsubscribeFromRoot(void) // Get icon from user, load it and if successful load it. void CustomTrayLabel::setCustomIcon(void) { - QString icon; + TQString icon; while (true) { // Nag the user to give us a valid icon or press cancel - icon = QFileDialog::getOpenFileName(); + icon = TQFileDialog::getOpenFileName(); if (icon.isNull()) return; // user cancelled - if (!QPixmap(icon).isNull()) break; + if (!TQPixmap(icon).isNull()) break; TRACE("Attempting to set icon to %s", icon.latin1()); - QMessageBox::critical(this, i18n("KDocker"), + TQMessageBox::critical(this, i18n("KDocker"), i18n("%1 is not a valid icon").arg(icon)); } @@ -225,7 +225,7 @@ void CustomTrayLabel::setCustomIcon(void) void CustomTrayLabel::slotSetBalloonTimeout(void) { bool ok; - int timeout = QInputDialog::getInteger(i18n("KDocker"), + int timeout = TQInputDialog::getInteger(i18n("KDocker"), i18n("Enter balloon timeout (secs). 0 to disable ballooning"), balloonTimeout()/1000, 0, 60, 1, &ok); @@ -243,7 +243,7 @@ void CustomTrayLabel::slotSetLaunchOnStartup() { TRACE("%i", mAutoLaunch->isOn()); if (!mAutoLaunch->isOn()) return; - QString app = appName(); + TQString app = appName(); TRACE("Validating %s", app.latin1()); @@ -258,7 +258,7 @@ void CustomTrayLabel::slotSetLaunchOnStartup() } // Request user to provide file name himself - if (QMessageBox::critical(NULL, i18n("KDocker"), + if (TQMessageBox::critical(NULL, i18n("KDocker"), i18n("\"%1\" is not a valid executable " "or was not found in your $PATH").arg(app), i18n("Select program"), i18n("Cancel")) == 1) @@ -267,7 +267,7 @@ void CustomTrayLabel::slotSetLaunchOnStartup() return; // cancelled } - app = QFileDialog::getOpenFileName(); + app = TQFileDialog::getOpenFileName(); if (app.isNull()) { TRACE("Disabling auto launch"); @@ -280,9 +280,9 @@ void CustomTrayLabel::slotSetLaunchOnStartup() // Called when we are just about to display the menu void CustomTrayLabel::updateMenu(void) { - QString title = appClass(); // + "(" + appTitle() + ")"; - mMainMenu->changeItem(mShowId, QIconSet(*pixmap()), - QString((isWithdrawn() ? i18n("Show %1") : i18n("Hide %1")).arg(title))); + TQString title = appClass(); // + "(" + appTitle() + ")"; + mMainMenu->changeItem(mShowId, TQIconSet(*pixmap()), + TQString((isWithdrawn() ? i18n("Show %1") : i18n("Hide %1")).arg(title))); } void CustomTrayLabel::mapEvent(void) @@ -295,7 +295,7 @@ void CustomTrayLabel::mapEvent(void) * the window. So we disable it for sometime and reanable. */ mDockWhenObscured->setOn(false); - QTimer::singleShot(800, mDockWhenObscured, SLOT(toggle())); + TQTimer::singleShot(800, mDockWhenObscured, SLOT(toggle())); TRACE("Turning off DWO for some time"); } } @@ -312,9 +312,9 @@ void CustomTrayLabel::focusLostEvent() if (mDockWhenFocusLost->isOn()) withdraw(); } -void CustomTrayLabel::mouseReleaseEvent(QMouseEvent * ev) +void CustomTrayLabel::mouseReleaseEvent(TQMouseEvent * ev) { - if (ev->button() == Qt::RightButton) + if (ev->button() == TQt::RightButton) mMainMenu->popup(ev->globalPos()); else toggleShow(); @@ -323,7 +323,7 @@ void CustomTrayLabel::mouseReleaseEvent(QMouseEvent * ev) void CustomTrayLabel::destroyEvent(void) { mUndockWhenDead = true; - QTrayLabel::destroyEvent(); + TQTrayLabel::destroyEvent(); } void CustomTrayLabel::processDead(void) @@ -353,9 +353,9 @@ bool CustomTrayLabel::canDockWindow(Window w) return !(TrayLabelMgr::instance()->isWindowDocked(w)); } -void CustomTrayLabel::dropEvent(QDropEvent *) +void CustomTrayLabel::dropEvent(TQDropEvent *) { - QMessageBox::information(NULL, "KDocker", + TQMessageBox::information(NULL, "KDocker", i18n("You cannot drop an item into the tray icon. Drop it on the window\n" "that is brought in front when you hover the item over the tray icon")); } diff --git a/src/customtraylabel.h b/src/customtraylabel.h index c12bcc2..d7fa764 100644 --- a/src/customtraylabel.h +++ b/src/customtraylabel.h @@ -22,33 +22,33 @@ #ifndef _CUSTOMTRAYLABEL_H #define _CUSTOMTRAYLABEL_H -#include -#include +#include +#include #include "qtraylabel.h" -class QStringList; -class QPopupMenu; -class QString; -class QSettings; -class QWidget; -class QDropEvent; +class TQStringList; +class TQPopupMenu; +class TQString; +class TQSettings; +class TQWidget; +class TQDropEvent; -class CustomTrayLabel : public QTrayLabel +class CustomTrayLabel : public TQTrayLabel { Q_OBJECT public: - CustomTrayLabel(Window w, QWidget* p = 0, const QString& t = QString::null); - CustomTrayLabel(const QStringList& argv, pid_t pid, QWidget* parent = 0); + CustomTrayLabel(Window w, TQWidget* p = 0, const TQString& t = TQString::null); + CustomTrayLabel(const TQStringList& argv, pid_t pid, TQWidget* parent = 0); // Session management - bool saveState(QSettings& settings); - bool restoreState(QSettings& settings); + bool saveState(TQSettings& settings); + bool restoreState(TQSettings& settings); bool isLaunchOnStartup(void) const { return mAutoLaunch->isOn(); } bool isDockWhenObscured(void) const { return mDockWhenObscured->isOn(); } - void setAppName(const QString& name); + void setAppName(const TQString& name); public slots: // overridden to update our menu @@ -61,13 +61,13 @@ public slots: void enableSessionManagement(bool sm) { mSessionManagement->setOn(sm); } protected: - void dropEvent(QDropEvent *ev); + void dropEvent(TQDropEvent *ev); bool canUnsubscribeFromRoot(void); void mapEvent(void); void focusLostEvent(); void obscureEvent(void); void destroyEvent(void); - void mouseReleaseEvent(QMouseEvent * ev); + void mouseReleaseEvent(TQMouseEvent * ev); bool canDockWindow(Window w); void processDead(void); @@ -80,8 +80,8 @@ private slots: private: void installMenu(); bool mUndockWhenDead; - QPopupMenu *mOptionsMenu, *mMainMenu; - QAction *mDockOnRestore, *mAutoLaunch, *mBalloonTimeout, *mSkipTaskbar, + TQPopupMenu *mOptionsMenu, *mMainMenu; + TQAction *mDockOnRestore, *mAutoLaunch, *mBalloonTimeout, *mSkipTaskbar, *mDockWhenMinimized, *mDockWhenObscured, *mSessionManagement, *mDockWhenFocusLost; int mShowId; diff --git a/src/kdocker.cpp b/src/kdocker.cpp index b85198d..deb6143 100644 --- a/src/kdocker.cpp +++ b/src/kdocker.cpp @@ -19,13 +19,13 @@ // $Id: kdocker.cpp,v 1.24 2005/02/04 10:25:46 cs19713 Exp $ -#include -#include -#include -#include -#include -#include -#include +#include +#include +#include +#include +#include +#include +#include #include @@ -39,11 +39,11 @@ #include #include -// #define TMPFILE_PREFIX QString("/tmp/kdocker.") -#define TMPFILE_PREFIX QDir::homeDirPath() + "/.kdocker." +// #define TMPFILE_PREFIX TQString("/tmp/kdocker.") +#define TMPFILE_PREFIX TQDir::homeDirPath() + "/.kdocker." KDocker::KDocker(int& argc, char** argv) - :QApplication(argc, argv), mTrayLabelMgr(0) + :TQApplication(argc, argv), mTrayLabelMgr(0) { INIT_TRACE(); @@ -65,13 +65,13 @@ KDocker::KDocker(int& argc, char** argv) * selection owner. If someone else owns it, transfer control to that * instance of KDocker */ - Display *display = QPaintDevice::x11AppDisplay(); + Display *display = TQPaintDevice::x11AppDisplay(); Atom kdocker = XInternAtom(display, "_KDOCKER_RUNNING", False); Window prev_instance = XGetSelectionOwner(display, kdocker); if (prev_instance == None) { - mSelectionOwner = XCreateSimpleWindow(display, qt_xrootwin(), 1, 1, 1, + mSelectionOwner = XCreateSimpleWindow(display, tqt_xrootwin(), 1, 1, 1, 1, 1, 1, 1); XSetSelectionOwner(display, kdocker, mSelectionOwner, CurrentTime); TRACE("Selection owner set to 0x%x", (unsigned) mSelectionOwner); @@ -83,51 +83,51 @@ KDocker::KDocker(int& argc, char** argv) void KDocker::printVersion(void) { - qDebug("Qt: %s", qVersion()); - qDebug("KDocker: %s", KDOCKER_APP_VERSION); + tqDebug("TQt: %s", tqVersion()); + tqDebug("KDocker: %s", KDOCKER_APP_VERSION); } // Prints the CLI arguments. Does not return void KDocker::printUsage(char optopt) { - if (optopt != 'h') qDebug("%s", i18n("kdocker: invalid option -- %1").arg(optopt).local8Bit().data()); - - qDebug("%s", i18n("Usage: KDocker [options] command\n").local8Bit().data()); - qDebug("%s", i18n("Docks any application into the system tray\n").local8Bit().data()); - qDebug("%s", i18n("command \tCommand to execute\n").local8Bit().data()); - qDebug("%s", i18n("Options").local8Bit().data()); - qDebug("%s", i18n("-a \tShow author information").local8Bit().data()); - qDebug("%s", i18n("-b \tDont warn about non-normal windows (blind mode)").local8Bit().data()); - qDebug("%s", i18n("-d \tDisable session management").local8Bit().data()); - qDebug("%s", i18n("-e \tEnable session management").local8Bit().data()); - qDebug("%s", i18n("-f \tDock window that has the focus(active window)").local8Bit().data()); - qDebug("%s", i18n("-h \tDisplay this help").local8Bit().data()); - qDebug("%s", i18n("-i icon\tCustom dock Icon").local8Bit().data()); - qDebug("%s", i18n("-l \tLaunch on startup").local8Bit().data()); - qDebug("%s", i18n("-m \tKeep application window mapped (dont hide on dock)").local8Bit().data()); - qDebug("%s", i18n("-o \tDock when obscured").local8Bit().data()); - qDebug("%s", i18n("-p secs\tSet ballooning timeout (popup time)").local8Bit().data()); - qDebug("%s", i18n("-q \tDisable ballooning title changes (quiet)").local8Bit().data()); - qDebug("%s", i18n("-t \tRemove this application from the task bar").local8Bit().data()); - qDebug("%s", i18n("-v \tDisplay version").local8Bit().data()); - qDebug("%s", i18n("-w wid \tWindow id of the application to dock\n").local8Bit().data()); - - qDebug("%s", i18n("NOTE: Use -d for all startup scripts.\n").local8Bit().data()); - - qDebug("%s", i18n("Bugs and wishes to gramakri@uiuc.edu").local8Bit().data()); - qDebug("%s", i18n("Project information at http://kdocker.sourceforge.net").local8Bit().data()); + if (optopt != 'h') tqDebug("%s", i18n("kdocker: invalid option -- %1").arg(optopt).local8Bit().data()); + + tqDebug("%s", i18n("Usage: KDocker [options] command\n").local8Bit().data()); + tqDebug("%s", i18n("Docks any application into the system tray\n").local8Bit().data()); + tqDebug("%s", i18n("command \tCommand to execute\n").local8Bit().data()); + tqDebug("%s", i18n("Options").local8Bit().data()); + tqDebug("%s", i18n("-a \tShow author information").local8Bit().data()); + tqDebug("%s", i18n("-b \tDont warn about non-normal windows (blind mode)").local8Bit().data()); + tqDebug("%s", i18n("-d \tDisable session management").local8Bit().data()); + tqDebug("%s", i18n("-e \tEnable session management").local8Bit().data()); + tqDebug("%s", i18n("-f \tDock window that has the focus(active window)").local8Bit().data()); + tqDebug("%s", i18n("-h \tDisplay this help").local8Bit().data()); + tqDebug("%s", i18n("-i icon\tCustom dock Icon").local8Bit().data()); + tqDebug("%s", i18n("-l \tLaunch on startup").local8Bit().data()); + tqDebug("%s", i18n("-m \tKeep application window mapped (dont hide on dock)").local8Bit().data()); + tqDebug("%s", i18n("-o \tDock when obscured").local8Bit().data()); + tqDebug("%s", i18n("-p secs\tSet ballooning timeout (popup time)").local8Bit().data()); + tqDebug("%s", i18n("-q \tDisable ballooning title changes (quiet)").local8Bit().data()); + tqDebug("%s", i18n("-t \tRemove this application from the task bar").local8Bit().data()); + tqDebug("%s", i18n("-v \tDisplay version").local8Bit().data()); + tqDebug("%s", i18n("-w wid \tWindow id of the application to dock\n").local8Bit().data()); + + tqDebug("%s", i18n("NOTE: Use -d for all startup scripts.\n").local8Bit().data()); + + tqDebug("%s", i18n("Bugs and wishes to gramakri@uiuc.edu").local8Bit().data()); + tqDebug("%s", i18n("Project information at http://kdocker.sourceforge.net").local8Bit().data()); } void KDocker::notifyPreviousInstance(Window prevInstance) { - Display *display = QPaintDevice::x11AppDisplay(); + Display *display = TQPaintDevice::x11AppDisplay(); TRACE("Notifying previous instance [%x]", (unsigned) prevInstance); // Dump all arguments in temporary file - QFile f(TMPFILE_PREFIX + QString().setNum(getpid())); + TQFile f(TMPFILE_PREFIX + TQString().setNum(getpid())); if (!f.open(IO_WriteOnly)) return; - QTextStream s(&f); + TQTextStream s(&f); /* * Its normal to use KDocker in startup scripts. We could be getting restored @@ -163,7 +163,7 @@ void KDocker::notifyPreviousInstance(Window prevInstance) } /* - * The X11 Event filter called by Qt. Look out for ClientMessage events from + * The X11 Event filter called by TQt. Look out for ClientMessage events from * our new instance */ bool KDocker::x11EventFilter(XEvent * event) @@ -179,7 +179,7 @@ bool KDocker::x11EventFilter(XEvent * event) client->data.l[1], (unsigned) mSelectionOwner); char tmp[50]; struct stat buf; - sprintf(tmp, QString(TMPFILE_PREFIX "%ld").local8Bit(), client->data.l[1]); + sprintf(tmp, TQString(TMPFILE_PREFIX "%ld").local8Bit(), client->data.l[1]); if (stat(tmp, &buf) || (getuid()!=buf.st_uid)) { /* @@ -194,11 +194,11 @@ bool KDocker::x11EventFilter(XEvent * event) unlink(tmp); return TRUE; } - QFile f(tmp); + TQFile f(tmp); if (!f.open(IO_ReadOnly)) return TRUE; - QTextStream s(&f); - QStringList argv; - while (!s.atEnd()) { QString x; s >> x; argv += x; } + TQTextStream s(&f); + TQStringList argv; + while (!s.atEnd()) { TQString x; s >> x; argv += x; } f.close(); unlink(tmp); // delete the tmp file mTrayLabelMgr->processCommand(argv); @@ -210,22 +210,22 @@ bool KDocker::x11EventFilter(XEvent * event) /* * XSMP Support */ -void KDocker::saveState(QSessionManager &sm) +void KDocker::saveState(TQSessionManager &sm) { - QString sf = mTrayLabelMgr->saveSession(); + TQString sf = mTrayLabelMgr->saveSession(); - QStringList discard_command; + TQStringList discard_command; discard_command << "rm" << sf; sm.setDiscardCommand(discard_command); - sm.setRestartHint(QSessionManager::RestartIfRunning); - QStringList restart_command; + sm.setRestartHint(TQSessionManager::RestartIfRunning); + TQStringList restart_command; restart_command << this->argv()[0] << "-session" << sm.sessionId(); sm.setRestartCommand(restart_command); TRACE("SessionFile=%s AppName=%s", sf.latin1(), this->argv()[0]); - DUMP_TRACE(QDir::homeDirPath() + "/kdocker.trace"); + DUMP_TRACE(TQDir::homeDirPath() + "/kdocker.trace"); // sm.setRestartCommand(applicationFilePath()); } diff --git a/src/kdocker.h b/src/kdocker.h index f3126c3..ecfdbb7 100644 --- a/src/kdocker.h +++ b/src/kdocker.h @@ -22,14 +22,14 @@ #ifndef _KDOCKER_H #define _KDOCKER_H -#include +#include #include #define KDOCKER_APP_VERSION "1.3" class TrayLabelMgr; -class KDocker : public QApplication +class KDocker : public TQApplication { Q_OBJECT @@ -38,15 +38,15 @@ public: TrayLabelMgr *trayLabelMgr(void) { return mTrayLabelMgr; } - void dumpState(const QString &file); + void dumpState(const TQString &file); void printUsage(char optopt = 'h'); protected: bool x11EventFilter(XEvent * event); - void saveState(QSessionManager &sm); + void saveState(TQSessionManager &sm); private: - QString saveSession(); + TQString saveSession(); bool restoreSession(); void notifyPreviousInstance(Window prevInstance); diff --git a/src/main.cpp b/src/main.cpp index 0c3ad5b..0fbc859 100644 --- a/src/main.cpp +++ b/src/main.cpp @@ -26,7 +26,7 @@ #include -#include +#include #include "kdocker.h" #include "traylabelmgr.h" #include "trace.h" @@ -36,12 +36,12 @@ static void sighandler(int sig) { if (sig == SIGUSR1) { - DUMP_TRACE(QDir::homeDirPath() + "/kdocker.trace"); + DUMP_TRACE(TQDir::homeDirPath() + "/kdocker.trace"); return; } - qDebug("%s", i18n("Caught signal %1. Cleaning up.").arg(sig).local8Bit().data()); - ((KDocker *)qApp)->trayLabelMgr()->undockAll(); + tqDebug("%s", i18n("Caught signal %1. Cleaning up.").arg(sig).local8Bit().data()); + ((KDocker *)tqApp)->trayLabelMgr()->undockAll(); } int main(int argc, char *argv[]) diff --git a/src/qtraylabel.cpp b/src/qtraylabel.cpp index 2c528c1..0d790c9 100644 --- a/src/qtraylabel.cpp +++ b/src/qtraylabel.cpp @@ -19,16 +19,16 @@ // $Id: qtraylabel.cpp,v 1.31 2005/06/21 10:04:36 cs19713 Exp $ -// Include all Qt includes before X -#include -#include -#include -#include -#include -#include -#include -#include -#include +// Include all TQt includes before X +#include +#include +#include +#include +#include +#include +#include +#include +#include #include "trace.h" #include "qtraylabel.h" @@ -46,7 +46,7 @@ #include "util.h" -void QTrayLabel::initialize(void) +void TQTrayLabel::initialize(void) { mDocked = false; mWithdrawn = true; @@ -55,30 +55,30 @@ void QTrayLabel::initialize(void) mDockWhenMinimized = true; mDesktop = 666; // setDockedWindow would set it a saner value - // Balloon's properties are set to match a Qt tool tip (see Qt source) - mBalloon = new QLabel(0, "balloon", WType_TopLevel | WStyle_StaysOnTop | + // Balloon's properties are set to match a TQt tool tip (see TQt source) + mBalloon = new TQLabel(0, "balloon", WType_TopLevel | WStyle_StaysOnTop | WStyle_Customize | WStyle_NoBorder | WStyle_Tool | WX11BypassWM); - mBalloon->setFont(QToolTip::font()); - mBalloon->setPalette(QToolTip::palette()); - mBalloon->setAlignment(Qt::AlignLeft | Qt::AlignTop); + mBalloon->setFont(TQToolTip::font()); + mBalloon->setPalette(TQToolTip::palette()); + mBalloon->setAlignment(TQt::AlignLeft | TQt::AlignTop); mBalloon->setAutoMask(FALSE); mBalloon->setAutoResize(true); - setAlignment(Qt::AlignCenter); + setAlignment(TQt::AlignCenter); setBackgroundMode(X11ParentRelative); connect(&mRealityMonitor, SIGNAL(timeout()), this, SLOT(realityCheck())); setDockedWindow(mDockedWindow); - sysTrayStatus(QPaintDevice::x11AppDisplay(), &mSysTray); + sysTrayStatus(TQPaintDevice::x11AppDisplay(), &mSysTray); // Subscribe to system tray window notifications if (mSysTray != None) - subscribe(QPaintDevice::x11AppDisplay(), mSysTray, + subscribe(TQPaintDevice::x11AppDisplay(), mSysTray, StructureNotifyMask, true); } // Describe ourselves in a few words -const char *QTrayLabel::me(void) const +const char *TQTrayLabel::me(void) const { static char temp[100]; snprintf(temp, sizeof(temp), "(%s,PID=%i,WID=0x%x)", @@ -86,23 +86,23 @@ const char *QTrayLabel::me(void) const return temp; } -QTrayLabel::QTrayLabel(Window w, QWidget* parent, const QString& text) - :QLabel(parent, text.utf8(), WStyle_Customize | WStyle_NoBorder | WStyle_Tool), +TQTrayLabel::TQTrayLabel(Window w, TQWidget* parent, const TQString& text) + :TQLabel(parent, text.utf8(), WStyle_Customize | WStyle_NoBorder | WStyle_Tool), mDockedWindow(w), mPid(0) { initialize(); } -QTrayLabel::QTrayLabel(const QStringList& pname, pid_t pid, QWidget* parent) - :QLabel(parent, "TrayLabel", WStyle_Customize | WStyle_NoBorder | WStyle_Tool), +TQTrayLabel::TQTrayLabel(const TQStringList& pname, pid_t pid, TQWidget* parent) + :TQLabel(parent, "TrayLabel", WStyle_Customize | WStyle_NoBorder | WStyle_Tool), mDockedWindow(None), mProgName(pname), mPid(pid) { if (pname[0].at(0) != '/' && pname[0].find('/', 1) > 0) - mProgName[0] = QFileInfo(pname[0]).absFilePath(); // convert to absolute + mProgName[0] = TQFileInfo(pname[0]).absFilePath(); // convert to absolute initialize(); } -QTrayLabel::~QTrayLabel() +TQTrayLabel::~TQTrayLabel() { TRACE("%s Goodbye", me()); if (mDockedWindow == None) return; @@ -116,14 +116,14 @@ QTrayLabel::~QTrayLabel() * Scans the windows in the desktop and checks if a window exists that we might * be interested in */ -void QTrayLabel::scanClients() +void TQTrayLabel::scanClients() { Window r, parent, *children; unsigned nchildren = 0; - Display *display = QPaintDevice::x11AppDisplay(); - QString ename = QFileInfo(mProgName[0]).fileName(); // strip out the path + Display *display = TQPaintDevice::x11AppDisplay(); + TQString ename = TQFileInfo(mProgName[0]).fileName(); // strip out the path - XQueryTree(display, qt_xrootwin(), &r, &parent, &children, &nchildren); + XQueryTree(display, tqt_xrootwin(), &r, &parent, &children, &nchildren); TRACE("%s nchildren=%i", me(), nchildren); for(unsigned i=0; itext().latin1(), QToolTip::textFor(this).latin1()); + mBalloon->text().latin1(), TQToolTip::textFor(this).latin1()); - if (mBalloon->text() == QToolTip::textFor(this)) return; + if (mBalloon->text() == TQToolTip::textFor(this)) return; #if 0 // I_GOT_NETWM_BALLOONING_TO_WORK // if you can get NET WM ballooning to work let me know static int id = 1; @@ -538,28 +538,28 @@ void QTrayLabel::balloonText() data += 20; } #else - // Manually do ballooning. See the Qt ToolTip code - QString oldText = mBalloon->text(); - mBalloon->setText(QToolTip::textFor(this)); + // Manually do ballooning. See the TQt ToolTip code + TQString oldText = mBalloon->text(); + mBalloon->setText(TQToolTip::textFor(this)); if (oldText.isEmpty()) return; // dont tool tip the first time - QPoint p = mapToGlobal(QPoint(0, -1 - mBalloon->height())); - if (p.x() + mBalloon->width() > QApplication::desktop()->width()) + TQPoint p = mapToGlobal(TQPoint(0, -1 - mBalloon->height())); + if (p.x() + mBalloon->width() > TQApplication::desktop()->width()) p.setX(p.x() + width() - mBalloon->width()); if (p.y() < 0) p.setY(height() + 1); mBalloon->move(p); mBalloon->show(); - QTimer::singleShot(mBalloonTimeout, mBalloon, SLOT(hide())); + TQTimer::singleShot(mBalloonTimeout, mBalloon, SLOT(hide())); #endif } /* * Update the title in the menu. Balloon the title change if necessary */ -void QTrayLabel::handleTitleChange(void) +void TQTrayLabel::handleTitleChange(void) { - Display *display = QPaintDevice::x11AppDisplay(); + Display *display = TQPaintDevice::x11AppDisplay(); char *window_name = NULL; XFetchName(display, mDockedWindow, &window_name); @@ -570,8 +570,8 @@ void QTrayLabel::handleTitleChange(void) XClassHint ch; if (XGetClassHint(display, mDockedWindow, &ch)) { - if (ch.res_class) mClass = QString(ch.res_class); - else if (ch.res_name) mClass = QString(ch.res_name); + if (ch.res_class) mClass = TQString(ch.res_class); + else if (ch.res_name) mClass = TQString(ch.res_name); if (ch.res_class) XFree(ch.res_class); if (ch.res_name) XFree(ch.res_name); @@ -585,24 +585,24 @@ void QTrayLabel::handleTitleChange(void) * Overload this if you want a tool tip format that is different from the one * below i.e "Title [Class]". */ -void QTrayLabel::updateTitle() +void TQTrayLabel::updateTitle() { TRACE("%s", me()); - QString text = mTitle + " [" + mClass + "]"; - QToolTip::remove(this); - QToolTip::add(this, text); + TQString text = mTitle + " [" + mClass + "]"; + TQToolTip::remove(this); + TQToolTip::add(this, text); if (mBalloonTimeout) balloonText(); } -void QTrayLabel::handleIconChange(void) +void TQTrayLabel::handleIconChange(void) { char **window_icon = NULL; TRACE("%s", me()); if (mDockedWindow == None) return; - Display *display = QPaintDevice::x11AppDisplay(); + Display *display = TQPaintDevice::x11AppDisplay(); XWMHints *wm_hints = XGetWMHints(display, mDockedWindow); if (wm_hints != NULL) { @@ -618,12 +618,12 @@ void QTrayLabel::handleIconChange(void) wm_hints->icon_mask, NULL); XFree(wm_hints); } - QImage image; + TQImage image; if (!window_icon) { image = KGlobal::iconLoader()->loadIcon("question", KIcon::NoGroup, KIcon::SizeMedium); } - else image = QPixmap((const char **) window_icon).convertToImage(); + else image = TQPixmap((const char **) window_icon).convertToImage(); if (window_icon) XpmFree(window_icon); mAppIcon = image.smoothScale(24, 24); // why? setMinimumSize(mAppIcon.size()); @@ -635,19 +635,19 @@ void QTrayLabel::handleIconChange(void) /* * Overload this to possibly do operations on the pixmap before it is set */ -void QTrayLabel::updateIcon() +void TQTrayLabel::updateIcon() { TRACE("%s", me()); setPixmap(mCustomIcon.isEmpty() ? mAppIcon : mCustomIcon); erase(); - QPaintEvent pe(rect()); + TQPaintEvent pe(rect()); paintEvent(&pe); } /* * Mouse activity on our label. RightClick = Menu. LeftClick = Toggle Map */ -void QTrayLabel::mouseReleaseEvent(QMouseEvent * ev) +void TQTrayLabel::mouseReleaseEvent(TQMouseEvent * ev) { emit clicked(ev->button(), ev->globalPos()); } @@ -655,7 +655,7 @@ void QTrayLabel::mouseReleaseEvent(QMouseEvent * ev) /* * Track drag event */ -void QTrayLabel::dragEnterEvent(QDragEnterEvent *ev) +void TQTrayLabel::dragEnterEvent(TQDragEnterEvent *ev) { ev->accept(); map(); @@ -664,7 +664,7 @@ void QTrayLabel::dragEnterEvent(QDragEnterEvent *ev) /* * Event dispatcher */ -bool QTrayLabel::x11EventFilter(XEvent *ev) +bool TQTrayLabel::x11EventFilter(XEvent *ev) { XAnyEvent *event = (XAnyEvent *)ev; @@ -709,32 +709,32 @@ bool QTrayLabel::x11EventFilter(XEvent *ev) TRACE("%s Will analyze window 0x%x", me(), (int)((XMapEvent *)event)->window); // Check if this window is the soulmate we are looking for - Display *display = QPaintDevice::x11AppDisplay(); + Display *display = TQPaintDevice::x11AppDisplay(); Window w = XmuClientWindow(display, ((XMapEvent *) event)->window); if (!isNormalWindow(display, w)) return FALSE; if (!analyzeWindow(display, w, mPid, - QFileInfo(mProgName[0]).fileName().latin1())) return FALSE; + TQFileInfo(mProgName[0]).fileName().latin1())) return FALSE; // All right. Lets dock this baby setDockedWindow(w); return true; } -void QTrayLabel::minimizeEvent(void) +void TQTrayLabel::minimizeEvent(void) { TRACE("minimizeEvent"); if (mDockWhenMinimized) withdraw(); } -void QTrayLabel::destroyEvent(void) +void TQTrayLabel::destroyEvent(void) { TRACE("%s destroyEvent", me()); setDockedWindow(None); if (!mPid) undock(); } -void QTrayLabel::propertyChangeEvent(Atom property) +void TQTrayLabel::propertyChangeEvent(Atom property) { - Display *display = QPaintDevice::x11AppDisplay(); + Display *display = TQPaintDevice::x11AppDisplay(); static Atom WM_NAME = XInternAtom(display, "WM_NAME", True); static Atom WM_ICON = XInternAtom(display, "WM_ICON", True); static Atom WM_STATE = XInternAtom(display, "WM_STATE", True); @@ -771,7 +771,7 @@ void QTrayLabel::propertyChangeEvent(Atom property) } // Session Management -bool QTrayLabel::saveState(QSettings &settings) +bool TQTrayLabel::saveState(TQSettings &settings) { TRACE("%s saving state", me()); settings.writeEntry("/Application", mProgName.join(" ")); @@ -783,7 +783,7 @@ bool QTrayLabel::saveState(QSettings &settings) return true; } -bool QTrayLabel::restoreState(QSettings &settings) +bool TQTrayLabel::restoreState(TQSettings &settings) { TRACE("%s restoring state", me()); mCustomIcon = settings.readEntry("/CustomIcon"); @@ -802,7 +802,7 @@ bool QTrayLabel::restoreState(QSettings &settings) * the application really shows itself up before we do a scan (the reason * why we have 2s */ - if (!mPid) QTimer::singleShot(2000, this, SLOT(scanClients())); + if (!mPid) TQTimer::singleShot(2000, this, SLOT(scanClients())); return true; } diff --git a/src/qtraylabel.h b/src/qtraylabel.h index 1ae83bc..7fb645c 100644 --- a/src/qtraylabel.h +++ b/src/qtraylabel.h @@ -22,15 +22,15 @@ #ifndef _QTRAYLABEL_H #define _QTRAYLABEL_H -#include -#include -#include -#include -#include -#include -#include -#include -#include +#include +#include +#include +#include +#include +#include +#include +#include +#include #include #include @@ -39,18 +39,18 @@ #include #include -class QMouseEvent; -class QDragEnterEvent; -class QPoint; +class TQMouseEvent; +class TQDragEnterEvent; +class TQPoint; -class QTrayLabel : public QLabel +class TQTrayLabel : public TQLabel { Q_OBJECT public: - QTrayLabel(Window w, QWidget* p = 0, const QString& text = QString::null); - QTrayLabel(const QStringList& argv, pid_t pid, QWidget* parent = 0); - virtual ~QTrayLabel(); + TQTrayLabel(Window w, TQWidget* p = 0, const TQString& text = TQString::null); + TQTrayLabel(const TQStringList& argv, pid_t pid, TQWidget* parent = 0); + virtual ~TQTrayLabel(); // Accessors Window dockedWindow(void) const { return mDockedWindow; } @@ -59,18 +59,18 @@ public: bool isWithdrawn(void) const { return mWithdrawn; } bool isDockWhenMinimized(void) const { return mDockWhenMinimized; } - QString appName(void) const { return mProgName[0]; } - virtual void setAppName(const QString& prog) { mProgName[0] = prog; } - QString appClass(void) const { return mClass; } - QString appTitle(void) const { return mTitle; } - QPixmap appIcon(void) const { return mAppIcon; } + TQString appName(void) const { return mProgName[0]; } + virtual void setAppName(const TQString& prog) { mProgName[0] = prog; } + TQString appClass(void) const { return mClass; } + TQString appTitle(void) const { return mTitle; } + TQPixmap appIcon(void) const { return mAppIcon; } // Pass on all events through this interface bool x11EventFilter(XEvent * event); // Session Management - virtual bool saveState(QSettings& settings); - virtual bool restoreState(QSettings& settings); + virtual bool saveState(TQSettings& settings); + virtual bool restoreState(TQSettings& settings); public slots: void dock(void); // puts us in the system tray @@ -80,7 +80,7 @@ public slots: void toggleShow(void) // convenience slot { if (mWithdrawn) map(); else withdraw(); } void close(void); // close the docked window - void setTrayIcon(const QString& icon); // sets custom icon + void setTrayIcon(const TQString& icon); // sets custom icon // and some property setters virtual void setSkipTaskbar(bool skip); // skip the taskbar @@ -91,20 +91,20 @@ protected slots: void scanClients(void); // scans existing client connections signals: - void clicked(const ButtonState&, const QPoint&); - void docked(QTrayLabel *); // emitted when we get docked + void clicked(const ButtonState&, const TQPoint&); + void docked(TQTrayLabel *); // emitted when we get docked void docked(void); // emitted when we get docked - void undocked(QTrayLabel *); // emitted when we get undocked + void undocked(TQTrayLabel *); // emitted when we get undocked void undocked(void); // emitted when we get undock // window are monitoring dies void sysTrayDestroyed(void); // emitted when the system tray disappears protected: // reimplement these event handlers in subclass as needed - virtual void mouseReleaseEvent(QMouseEvent *event); - virtual void dragEnterEvent(QDragEnterEvent *event); + virtual void mouseReleaseEvent(TQMouseEvent *event); + virtual void dragEnterEvent(TQDragEnterEvent *event); - // the events that follow are events of the docked window (NOT QTrayLabel) + // the events that follow are events of the docked window (NOT TQTrayLabel) virtual void updateIcon(void); // updates the icon virtual void updateTitle(void); // sets the tooltip virtual void balloonText(void); // balloons text @@ -140,19 +140,19 @@ private: // Member variables long mDesktop; // desktop on which the window is being shown - QLabel *mBalloon; // tooltip text simulator - QString mCustomIcon; // CustomIcon of the docked application + TQLabel *mBalloon; // tooltip text simulator + TQString mCustomIcon; // CustomIcon of the docked application Window mDockedWindow; // the window which is being docked int mBalloonTimeout; bool mDocked, mWithdrawn, mSkippingTaskbar; bool mDockWhenMinimized; - QString mTitle, mClass; // Title and hint of mDockedWindow - QPixmap mAppIcon; // The current app icon (may not be same as pixmap()) + TQString mTitle, mClass; // Title and hint of mDockedWindow + TQPixmap mAppIcon; // The current app icon (may not be same as pixmap()) XSizeHints mSizeHint; // SizeHint of mDockedWindow - QTimer mRealityMonitor; // Helps us sync up with reality - QStringList mProgName; // The program whose window we are docking + TQTimer mRealityMonitor; // Helps us sync up with reality + TQStringList mProgName; // The program whose window we are docking pid_t mPid; // The PID of program whose window we are docking Window mSysTray; // System tray window id diff --git a/src/trace.cpp b/src/trace.cpp index c41247e..effcd64 100644 --- a/src/trace.cpp +++ b/src/trace.cpp @@ -1,12 +1,12 @@ #ifdef ENABLE_TRACING -#include -#include -#include +#include +#include +#include #include -static QTextEdit *tracer = NULL; +static TQTextEdit *tracer = NULL; -void TRACER(QtMsgType, const char *msg) +void TRACER(TQtMsgType, const char *msg) { tracer->append(&msg[*msg == '~' ? 1 : 0]); if (msg[0] != '~') @@ -19,8 +19,8 @@ void TRACER(QtMsgType, const char *msg) void INIT_TRACE() { if (tracer) return; // de javu - tracer = new QTextEdit(); - tracer->setTextFormat(Qt::LogText); + tracer = new TQTextEdit(); + tracer->setTextFormat(TQt::LogText); tracer->setMaxLogLines(10000); tracer->resize(750, 300); qInstallMsgHandler(TRACER); @@ -33,10 +33,10 @@ void SHOW_TRACE() void DUMP_TRACE(const char *f) { - QFile file(f); // Write the text to a file + TQFile file(f); // Write the text to a file if (file.open(IO_WriteOnly)) { - QTextStream stream(&file); + TQTextStream stream(&file); stream << tracer->text(); } } diff --git a/src/trace.h b/src/trace.h index b3425ec..15d69cb 100644 --- a/src/trace.h +++ b/src/trace.h @@ -12,7 +12,7 @@ * WARNING: fmt has to be a static string */ #define TRACE(fmt,args...) \ - do { qDebug("~%s - \t" fmt, __PRETTY_FUNCTION__, ##args); } while (0) + do { tqDebug("~%s - \t" fmt, __PRETTY_FUNCTION__, ##args); } while (0) #define SHOW_TRACE_TEXT "Show Trace" @@ -21,7 +21,7 @@ #define INIT_TRACE() #define TRACE(fmt, ...) #define SHOW_TRACE() - #define SHOW_TRACE_TEXT QString::null + #define SHOW_TRACE_TEXT TQString::null #define DUMP_TRACE(file) #endif // ENABLE_TRACING diff --git a/src/traylabelmgr.cpp b/src/traylabelmgr.cpp index cbc007f..61dfd7e 100644 --- a/src/traylabelmgr.cpp +++ b/src/traylabelmgr.cpp @@ -19,15 +19,15 @@ // $Id: traylabelmgr.cpp,v 1.10 2005/02/09 03:38:43 cs19713 Exp $ -#include -#include -#include -#include -#include -#include -#include -#include -#include +#include +#include +#include +#include +#include +#include +#include +#include +#include #include @@ -52,7 +52,7 @@ TrayLabelMgr* TrayLabelMgr::instance(void) TrayLabelMgr::TrayLabelMgr() : mReady(false), mHiddenLabelsCount(0) { // Set ourselves up to be called from the application loop - QTimer::singleShot(0, this, SLOT(startup())); + TQTimer::singleShot(0, this, SLOT(startup())); } TrayLabelMgr::~TrayLabelMgr() @@ -62,11 +62,11 @@ TrayLabelMgr::~TrayLabelMgr() void TrayLabelMgr::about(void) { - if (QMessageBox::information(NULL, i18n("About KDocker"), + if (TQMessageBox::information(NULL, i18n("About KDocker"), i18n("Bugs/wishes to Girish Ramakrishnan (gramakri@uiuc.edu)\n" "English translation by Girish (gramakri@uiuc.edu)\n\n" "http://kdocker.sourceforge.net for updates"), - QString::null, SHOW_TRACE_TEXT) == 1) SHOW_TRACE(); + TQString::null, SHOW_TRACE_TEXT) == 1) SHOW_TRACE(); } void TrayLabelMgr::startup(void) @@ -78,25 +78,25 @@ void TrayLabelMgr::startup(void) * stdout is a tty) OR if we are getting restored, wait for WAIT_TIME until * the system tray shows up (before informing the user) */ - static bool do_wait = !isatty(fileno(stdout)) || qApp->isSessionRestored(); + static bool do_wait = !isatty(fileno(stdout)) || tqApp->isSessionRestored(); - SysTrayState state = sysTrayStatus(QPaintDevice::x11AppDisplay()); + SysTrayState state = sysTrayStatus(TQPaintDevice::x11AppDisplay()); if (state != SysTrayPresent) { if (wait_time-- > 0 && do_wait) { TRACE("Will check sys tray status after 1 second"); - QTimer::singleShot(1000, this, SLOT(startup())); + TQTimer::singleShot(1000, this, SLOT(startup())); return; } - if (QMessageBox::warning(NULL, i18n("KDocker"), + if (TQMessageBox::warning(NULL, i18n("KDocker"), i18n(state == SysTrayAbsent ? "No system tray found" : "System tray appears to be hidden"), - QMessageBox::Abort, QMessageBox::Ignore) == QMessageBox::Abort) + TQMessageBox::Abort, TQMessageBox::Ignore) == TQMessageBox::Abort) { - qApp->quit(); + tqApp->quit(); return; } } @@ -104,34 +104,34 @@ void TrayLabelMgr::startup(void) // Things are fine or user with OK with the state of system tray mReady = true; bool ok = false; - if (qApp->isSessionRestored()) ok = restoreSession(qApp->sessionId()); - else ok = processCommand(qApp->argc(), qApp->argv()); + if (tqApp->isSessionRestored()) ok = restoreSession(tqApp->sessionId()); + else ok = processCommand(tqApp->argc(), tqApp->argv()); // Process the request Q from previous instances TRACE("Request queue has %i requests", mRequestQ.count()); for(unsigned i=0; i < mRequestQ.count(); i++) ok |= processCommand(mRequestQ[i]); - if (!ok) qApp->quit(); + if (!ok) tqApp->quit(); } -// Initialize a QTrayLabel after its creation -void TrayLabelMgr::manageTrayLabel(QTrayLabel *t) +// Initialize a TQTrayLabel after its creation +void TrayLabelMgr::manageTrayLabel(TQTrayLabel *t) { - connect(t, SIGNAL(destroyed(QObject *)), - this, SLOT(trayLabelDestroyed(QObject *))); - connect(t, SIGNAL(undocked(QTrayLabel *)), t, SLOT(deleteLater())); + connect(t, SIGNAL(destroyed(TQObject *)), + this, SLOT(trayLabelDestroyed(TQObject *))); + connect(t, SIGNAL(undocked(TQTrayLabel *)), t, SLOT(deleteLater())); - // All QTrayLabels will emit this signal. We just need one of them + // All TQTrayLabels will emit this signal. We just need one of them if (mTrayLabels.count() == 0) connect(t, SIGNAL(sysTrayDestroyed()), this, SLOT(sysTrayDestroyed())); mTrayLabels.prepend(t); - TRACE("New QTrayLabel prepended. Count=%i", mTrayLabels.count()); + TRACE("New TQTrayLabel prepended. Count=%i", mTrayLabels.count()); } void TrayLabelMgr::dockAnother() { - QTrayLabel *t = selectAndDock(); + TQTrayLabel *t = selectAndDock(); if (t == NULL) return; manageTrayLabel(t); t->withdraw(); @@ -142,8 +142,8 @@ void TrayLabelMgr::dockAnother() void TrayLabelMgr::undockAll() { TRACE("Number of tray labels = %i", mTrayLabels.count()); - QPtrListIterator it(mTrayLabels); - QTrayLabel *t; + TQPtrListIterator it(mTrayLabels); + TQTrayLabel *t; while ((t = it.current()) != 0) { ++it; @@ -152,7 +152,7 @@ void TrayLabelMgr::undockAll() } // Process the command line -bool TrayLabelMgr::processCommand(const QStringList& args) +bool TrayLabelMgr::processCommand(const TQStringList& args) { if (!mReady) { @@ -186,7 +186,7 @@ bool TrayLabelMgr::processCommand(int argc, char** argv) if (qstrcmp(argv[1], "-session") == 0) { TRACE("Restoring session %s (new instance request)", argv[2]); - return restoreSession(QString(argv[2])); + return restoreSession(TQString(argv[2])); } int option; @@ -206,7 +206,7 @@ bool TrayLabelMgr::processCommand(int argc, char** argv) case '?': return false; case 'a': - qDebug("%s", i18n("Girish Ramakrishnan (gramakri@uiuc.edu)").local8Bit().data()); + tqDebug("%s", i18n("Girish Ramakrishnan (gramakri@uiuc.edu)").local8Bit().data()); return false; case 'b': check_normality = false; @@ -218,7 +218,7 @@ bool TrayLabelMgr::processCommand(int argc, char** argv) enable_sm = true; break; case 'f': - w = activeWindow(QPaintDevice::x11AppDisplay()); + w = activeWindow(TQPaintDevice::x11AppDisplay()); TRACE("Active window is %i", (unsigned) w); break; case 'i': @@ -247,9 +247,9 @@ bool TrayLabelMgr::processCommand(int argc, char** argv) sscanf(optarg, "%x", (unsigned *) &w); else w = (Window) atoi(optarg); - if (!isValidWindowId(QPaintDevice::x11AppDisplay(), w)) + if (!isValidWindowId(TQPaintDevice::x11AppDisplay(), w)) { - qDebug("Window 0x%x invalid", (unsigned) w); + tqDebug("Window 0x%x invalid", (unsigned) w); return false; } break; @@ -277,32 +277,32 @@ bool TrayLabelMgr::processCommand(int argc, char** argv) /* * Request user to make a window selection if necessary. Dock the window. */ -QTrayLabel *TrayLabelMgr::selectAndDock(Window w, bool checkNormality) +TQTrayLabel *TrayLabelMgr::selectAndDock(Window w, bool checkNormality) { if (w == None) { - qDebug("%s", i18n("Select the application/window to dock with button1.").local8Bit().data()); - qDebug("%s", i18n("Click any other button to abort\n").local8Bit().data()); + tqDebug("%s", i18n("Select the application/window to dock with button1.").local8Bit().data()); + tqDebug("%s", i18n("Click any other button to abort\n").local8Bit().data()); const char *err = NULL; - if ((w = selectWindow(QPaintDevice::x11AppDisplay(), &err)) == None) + if ((w = selectWindow(TQPaintDevice::x11AppDisplay(), &err)) == None) { - if (err) QMessageBox::critical(NULL, i18n("KDocker"), i18n(err)); + if (err) TQMessageBox::critical(NULL, i18n("KDocker"), i18n(err)); return NULL; } } - if (checkNormality && !isNormalWindow(QPaintDevice::x11AppDisplay(), w)) + if (checkNormality && !isNormalWindow(TQPaintDevice::x11AppDisplay(), w)) { /* * Abort should be the only option here really. "Ignore" is provided here * for the curious user who wants to screw himself very badly */ - if (QMessageBox::warning(NULL, i18n("KDocker"), + if (TQMessageBox::warning(NULL, i18n("KDocker"), i18n("The window you are attempting to dock does not seem to be a" - " normal window."), QMessageBox::Abort, - QMessageBox::Ignore) == QMessageBox::Abort) + " normal window."), TQMessageBox::Abort, + TQMessageBox::Ignore) == TQMessageBox::Abort) return NULL; } @@ -310,7 +310,7 @@ QTrayLabel *TrayLabelMgr::selectAndDock(Window w, bool checkNormality) TRACE("0x%x is not docked", (unsigned) w); - QMessageBox::message(i18n("KDocker"), + TQMessageBox::message(i18n("KDocker"), i18n("This window is already docked.\n" "Click on system tray icon to toggle docking.")); return NULL; @@ -318,8 +318,8 @@ QTrayLabel *TrayLabelMgr::selectAndDock(Window w, bool checkNormality) bool TrayLabelMgr::isWindowDocked(Window w) { - QPtrListIterator it(mTrayLabels); - for(QTrayLabel *t; (t = it.current()); ++it) + TQPtrListIterator it(mTrayLabels); + for(TQTrayLabel *t; (t = it.current()); ++it) if (t->dockedWindow() == w) return true; return false; @@ -330,7 +330,7 @@ bool TrayLabelMgr::isWindowDocked(Window w) * notifications (for MapEvent on children). We will monitor these new windows * to make a pid to wid mapping (see HACKING for more details) */ -QTrayLabel *TrayLabelMgr::dockApplication(char *argv[]) +TQTrayLabel *TrayLabelMgr::dockApplication(char *argv[]) { pid_t pid = -1; int filedes[2]; @@ -338,9 +338,9 @@ QTrayLabel *TrayLabelMgr::dockApplication(char *argv[]) /* * The pipe created here serves as a synchronization mechanism between the - * parent and the child. QTrayLabel ctor keeps looking out for newly created + * parent and the child. TQTrayLabel ctor keeps looking out for newly created * windows. Need to make sure that the application is actually exec'ed only - * after we QTrayLabel is created (it requires pid of child) + * after we TQTrayLabel is created (it requires pid of child) */ pipe(filedes); @@ -352,7 +352,7 @@ QTrayLabel *TrayLabelMgr::dockApplication(char *argv[]) if (execvp(argv[0], argv) == -1) { - qDebug("%s", i18n("Failed to exec [%1]: %2").arg(argv[0]).arg(strerror(errno)).local8Bit().data()); + tqDebug("%s", i18n("Failed to exec [%1]: %2").arg(argv[0]).arg(strerror(errno)).local8Bit().data()); ::exit(0); // will become a zombie in some systems :( return NULL; } @@ -360,17 +360,17 @@ QTrayLabel *TrayLabelMgr::dockApplication(char *argv[]) if (pid == -1) { - QMessageBox::critical(NULL, "KDocker", + TQMessageBox::critical(NULL, "KDocker", i18n("Failed to fork: %1").arg(strerror(errno))); return NULL; } - QStringList cmd_line; + TQStringList cmd_line; for(int i=0;;i++) if (argv[i]) cmd_line << argv[i]; else break; - QTrayLabel *label = new CustomTrayLabel(cmd_line, pid); - qApp->syncX(); + TQTrayLabel *label = new CustomTrayLabel(cmd_line, pid); + tqApp->syncX(); write(filedes[1], buf, sizeof(buf)); close(filedes[0]); close(filedes[1]); @@ -378,14 +378,14 @@ QTrayLabel *TrayLabelMgr::dockApplication(char *argv[]) } /* - * Returns the number of QTrayLabels actually created but not show in the + * Returns the number of TQTrayLabels actually created but not show in the * System Tray */ int TrayLabelMgr::hiddenLabelsCount(void) const { - QPtrListIterator it(mTrayLabels); + TQPtrListIterator it(mTrayLabels); int count = 0; - for(QTrayLabel *t; (t=it.current()); ++it) + for(TQTrayLabel *t; (t=it.current()); ++it) if (t->dockedWindow() == None) ++count; return count; } @@ -396,11 +396,11 @@ int TrayLabelMgr::dockedLabelsCount(void) const return mTrayLabels.count() - hiddenLabelsCount(); } -void TrayLabelMgr::trayLabelDestroyed(QObject *t) +void TrayLabelMgr::trayLabelDestroyed(TQObject *t) { - bool reconnect = ((QObject *)mTrayLabels.getLast() == t); - mTrayLabels.removeRef((QTrayLabel*)t); - if (mTrayLabels.isEmpty()) qApp->quit(); + bool reconnect = ((TQObject *)mTrayLabels.getLast() == t); + mTrayLabels.removeRef((TQTrayLabel*)t); + if (mTrayLabels.isEmpty()) tqApp->quit(); else if (reconnect) { TRACE("Reconnecting"); @@ -417,17 +417,17 @@ void TrayLabelMgr::sysTrayDestroyed(void) * to not pop up a box when the user is logging out. So, we set ourselves * up to notify user after 3 seconds. */ - QTimer::singleShot(3000, this, SLOT(notifySysTrayAbsence())); + TQTimer::singleShot(3000, this, SLOT(notifySysTrayAbsence())); } void TrayLabelMgr::notifySysTrayAbsence() { - SysTrayState state = sysTrayStatus(QPaintDevice::x11AppDisplay()); + SysTrayState state = sysTrayStatus(TQPaintDevice::x11AppDisplay()); if (state == SysTrayPresent) return; // So sweet of the systray to come back so soon - if (QMessageBox::warning(NULL, i18n("KDocker"), + if (TQMessageBox::warning(NULL, i18n("KDocker"), i18n("The System tray was hidden or removed"), i18n("Undock All"), i18n("Ignore")) == 0) undockAll(); @@ -436,30 +436,30 @@ void TrayLabelMgr::notifySysTrayAbsence() /* * Session Management. Always return "true". Atleast, for now */ -bool TrayLabelMgr::restoreSession(const QString& sessionId) +bool TrayLabelMgr::restoreSession(const TQString& sessionId) { - QString session_file = "kdocker_" + sessionId; + TQString session_file = "kdocker_" + sessionId; - QSettings settings; - settings.beginGroup(QString("/" + session_file)); + TQSettings settings; + settings.beginGroup(TQString("/" + session_file)); for(int i = 1;; i++) { - settings.beginGroup(QString("/Instance") + QString("").setNum(i)); - QString pname = settings.readEntry("/Application"); + settings.beginGroup(TQString("/Instance") + TQString("").setNum(i)); + TQString pname = settings.readEntry("/Application"); TRACE("Restoring Application[%s]", pname.latin1()); if (pname.isEmpty()) break; if (settings.readBoolEntry("/LaunchOnStartup")) { - QStringList args("kdocker"); - args += QStringList::split(" ", pname); + TQStringList args("kdocker"); + args += TQStringList::split(" ", pname); TRACE("Triggering AutoLaunch"); if (!processCommand(args)) continue; } else - manageTrayLabel(new CustomTrayLabel(QStringList::split(" ", pname), 0)); + manageTrayLabel(new CustomTrayLabel(TQStringList::split(" ", pname), 0)); - QTrayLabel *tl = mTrayLabels.getFirst(); // the one that was created above + TQTrayLabel *tl = mTrayLabels.getFirst(); // the one that was created above tl->restoreState(settings); settings.endGroup(); } @@ -467,51 +467,51 @@ bool TrayLabelMgr::restoreSession(const QString& sessionId) return true; } -QString TrayLabelMgr::saveSession(void) +TQString TrayLabelMgr::saveSession(void) { - QString session_file = "kdocker_" + qApp->sessionId(); + TQString session_file = "kdocker_" + tqApp->sessionId(); - QSettings settings; - settings.beginGroup(QString("/" + session_file)); + TQSettings settings; + settings.beginGroup(TQString("/" + session_file)); TRACE("Saving session"); - QPtrListIterator it(mTrayLabels); - QTrayLabel *t; + TQPtrListIterator it(mTrayLabels); + TQTrayLabel *t; int i = 1; while ((t = it.current()) != 0) { ++it; TRACE("Saving instance %i", i); - settings.beginGroup(QString("/Instance") + QString("").setNum(i)); + settings.beginGroup(TQString("/Instance") + TQString("").setNum(i)); bool ok = t->saveState(settings); settings.endGroup(); if (ok) ++i; else TRACE("Saving of instance %i was skipped", i); } // Aaaaaaaaaaaaaa......... - settings.removeEntry(QString("/Instance") + QString("").setNum(i)); + settings.removeEntry(TQString("/Instance") + TQString("").setNum(i)); - return QDir::homeDirPath() + "/.qt/" + session_file + "rc"; + return TQDir::homeDirPath() + "/.qt/" + session_file + "rc"; } /* - * The X11 Event Filter. Pass on events to the QTrayLabels that we created. + * The X11 Event Filter. Pass on events to the TQTrayLabels that we created. * The logic and the code below is a bit fuzzy. * a) Events about windows that are being docked need to be processed only by - * the QTrayLabel object that is docking that window. + * the TQTrayLabel object that is docking that window. * b) Events about windows that are not docked but of interest (like - * SystemTray) need to be passed on to all QTrayLabel objects. - * c) When a QTrayLabel manages to find the window that is was looking for, we + * SystemTray) need to be passed on to all TQTrayLabel objects. + * c) When a TQTrayLabel manages to find the window that is was looking for, we * need not process the event further */ bool TrayLabelMgr::x11EventFilter(XEvent *ev) { - QPtrListIterator it(mTrayLabels); + TQPtrListIterator it(mTrayLabels); bool ret = false; // We pass on the event to all tray labels - for(QTrayLabel *t; (t = it.current()); ++it) + for(TQTrayLabel *t; (t = it.current()); ++it) { Window w = t->dockedWindow(); bool res = t->x11EventFilter(ev); diff --git a/src/traylabelmgr.h b/src/traylabelmgr.h index 016460f..8a27a6c 100644 --- a/src/traylabelmgr.h +++ b/src/traylabelmgr.h @@ -21,29 +21,29 @@ #ifndef _TRAYLABELMGR_H #define _TRAYLABELMGR_H -#include -#include -#include -#include +#include +#include +#include +#include #include "customtraylabel.h" class CustomTrayLabel; -class TrayLabelMgr : public QObject +class TrayLabelMgr : public TQObject { Q_OBJECT public: static TrayLabelMgr* instance(); - static QString options(void) { return QString(mOptionString); } + static TQString options(void) { return TQString(mOptionString); } ~TrayLabelMgr(); - QString saveSession(); + TQString saveSession(); bool x11EventFilter(XEvent *); - bool processCommand(const QStringList& argv); + bool processCommand(const TQStringList& argv); int hiddenLabelsCount(void) const; int dockedLabelsCount(void) const; bool isWindowDocked(Window w); @@ -55,21 +55,21 @@ public slots: private slots: void startup(); - void trayLabelDestroyed(QObject *); + void trayLabelDestroyed(TQObject *); void sysTrayDestroyed(void); void notifySysTrayAbsence(); private: TrayLabelMgr(); bool processCommand(int argc, char** argv); - void manageTrayLabel(QTrayLabel *l); - bool restoreSession(const QString& sessionId); + void manageTrayLabel(TQTrayLabel *l); + bool restoreSession(const TQString& sessionId); - QTrayLabel *dockApplication(char *argv[]); - QTrayLabel *selectAndDock(Window w = None, bool checkNormality = true); + TQTrayLabel *dockApplication(char *argv[]); + TQTrayLabel *selectAndDock(Window w = None, bool checkNormality = true); - QPtrList mTrayLabels; - QValueList mRequestQ; + TQPtrList mTrayLabels; + TQValueList mRequestQ; bool mReady; int mHiddenLabelsCount; diff --git a/src/util.cpp b/src/util.cpp index a8766b1..afbb578 100644 --- a/src/util.cpp +++ b/src/util.cpp @@ -158,7 +158,7 @@ void sendMessage(Display* display, Window to, Window w, char* type, * The Grand Window Analyzer. Checks if window w has a expected pid of epid * or a expected name of ename */ -bool analyzeWindow(Display *display, Window w, pid_t epid, const QString &ename) +bool analyzeWindow(Display *display, Window w, pid_t epid, const TQString &ename) { XClassHint ch; pid_t apid = pid(display, w); @@ -177,12 +177,12 @@ bool analyzeWindow(Display *display, Window w, pid_t epid, const QString &ename) // lets try the program name if (XGetClassHint(display, w, &ch)) { - if (QString(ch.res_name).find(ename, 0, FALSE) != -1) + if (TQString(ch.res_name).find(ename, 0, FALSE) != -1) { TRACE("ResName [%s] matched", ch.res_name); this_is_our_man = true; } - else if (QString(ch.res_class).find(ename, 0, FALSE) != -1) + else if (TQString(ch.res_class).find(ename, 0, FALSE) != -1) { TRACE("ResClass [%s] matched", ch.res_class); this_is_our_man = true; @@ -192,7 +192,7 @@ bool analyzeWindow(Display *display, Window w, pid_t epid, const QString &ename) // sheer desperation char *wm_name = NULL; XFetchName(display, w, &wm_name); - if (wm_name && (QString(wm_name).find(ename, 0, FALSE) != -1)) + if (wm_name && (TQString(wm_name).find(ename, 0, FALSE) != -1)) { TRACE("WM_NAME [%s] matched", wm_name); this_is_our_man = true; diff --git a/src/util.h b/src/util.h index 5d27cc1..f29e58a 100644 --- a/src/util.h +++ b/src/util.h @@ -22,7 +22,7 @@ #ifndef _UTIL_H #define _UTIL_H -#include +#include #include #include @@ -32,7 +32,7 @@ extern pid_t pid(Display *display, Window w); extern void sendMessage(Display *display, Window to, Window w, char *type, int format, long mask, void *data, int size); extern bool analyzeWindow(Display *display, Window w, pid_t epid, - const QString &ename); + const TQString &ename); extern Window activeWindow(Display *display); extern Window selectWindow(Display *display, const char **err = 0); extern void subscribe(Display *display, Window w, long mask, bool set);