Initial TQt conversion

Signed-off-by: Slávek Banko <slavek.banko@axis.cz>
pull/1/head
Slávek Banko 6 years ago
parent 9cbe9f0f8b
commit 1a36f79cf4
No known key found for this signature in database
GPG Key ID: 608F5293A04BE668

@ -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/ 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++ LINK = g++
LFLAGS = 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 AR = ar cqs
RANLIB = RANLIB =
MOC = $(QTDIR)/bin/moc MOC = $(QTDIR)/bin/moc
@ -114,7 +114,7 @@ uicables: $(UICDECLS) $(UICIMPLS)
$(MOC): $(MOC):
( cd $(QTDIR)/src/moc && $(MAKE) ) ( 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) -o Makefile kdocker.pro
qmake: qmake:
@$(QMAKE) -o Makefile kdocker.pro @$(QMAKE) -o Makefile kdocker.pro

@ -19,14 +19,14 @@
// $Id: customtraylabel.cpp,v 1.14 2005/06/21 10:04:35 cs19713 Exp $ // $Id: customtraylabel.cpp,v 1.14 2005/06/21 10:04:35 cs19713 Exp $
#include <qsettings.h> #include <tqsettings.h>
#include <qpopupmenu.h> #include <tqpopupmenu.h>
#include <qmessagebox.h> #include <tqmessagebox.h>
#include <qfiledialog.h> #include <tqfiledialog.h>
#include <qinputdialog.h> #include <tqinputdialog.h>
#include <qaction.h> #include <tqaction.h>
#include <qtimer.h> #include <tqtimer.h>
#include <qsize.h> #include <tqsize.h>
#include <stdlib.h> #include <stdlib.h>
#include <kiconloader.h> #include <kiconloader.h>
@ -38,15 +38,15 @@
#include "traylabelmgr.h" #include "traylabelmgr.h"
#include "kdocker.h" #include "kdocker.h"
CustomTrayLabel::CustomTrayLabel(Window w, QWidget* p, const QString& t) CustomTrayLabel::CustomTrayLabel(Window w, TQWidget* p, const TQString& t)
: QTrayLabel(w, p, t), mUndockWhenDead(false) : TQTrayLabel(w, p, t), mUndockWhenDead(false)
{ {
installMenu(); installMenu();
} }
CustomTrayLabel::CustomTrayLabel(const QStringList& argv, pid_t pid, CustomTrayLabel::CustomTrayLabel(const TQStringList& argv, pid_t pid,
QWidget* parent) TQWidget* parent)
: QTrayLabel(argv, pid, parent), mUndockWhenDead(false) : TQTrayLabel(argv, pid, parent), mUndockWhenDead(false)
{ {
installMenu(); installMenu();
} }
@ -56,18 +56,18 @@ CustomTrayLabel::CustomTrayLabel(const QStringList& argv, pid_t pid,
*/ */
void CustomTrayLabel::installMenu() 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); setIcon(kdocker_png);
TrayLabelMgr *tlMgr = TrayLabelMgr::instance(); TrayLabelMgr *tlMgr = TrayLabelMgr::instance();
mOptionsMenu = new QPopupMenu(this); mOptionsMenu = new TQPopupMenu(this);
mSessionManagement = new QAction(i18n("Dock when session restored"), 0, this); mSessionManagement = new TQAction(i18n("Dock when session restored"), 0, this);
mSessionManagement->setToggleAction(true); mSessionManagement->setToggleAction(true);
connect(mSessionManagement, SIGNAL(toggled(bool)), connect(mSessionManagement, SIGNAL(toggled(bool)),
this, SLOT(enableSessionManagement(bool))); this, SLOT(enableSessionManagement(bool)));
mSessionManagement->addTo(mOptionsMenu); mSessionManagement->addTo(mOptionsMenu);
mAutoLaunch = new QAction(i18n("Launch on startup"), 0, this); mAutoLaunch = new TQAction(i18n("Launch on startup"), 0, this);
mAutoLaunch->setToggleAction(true); mAutoLaunch->setToggleAction(true);
connect(mAutoLaunch, SIGNAL(activated()), connect(mAutoLaunch, SIGNAL(activated()),
this, SLOT(slotSetLaunchOnStartup())); this, SLOT(slotSetLaunchOnStartup()));
@ -75,37 +75,37 @@ void CustomTrayLabel::installMenu()
mOptionsMenu->insertItem(i18n("Set Icon"), this, SLOT(setCustomIcon())); 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()), connect(mBalloonTimeout, SIGNAL(activated()),
this, SLOT(slotSetBalloonTimeout())); this, SLOT(slotSetBalloonTimeout()));
mBalloonTimeout->addTo(mOptionsMenu); mBalloonTimeout->addTo(mOptionsMenu);
mDockWhenObscured = new QAction(i18n("Dock when obscured"), 0, this); mDockWhenObscured = new TQAction(i18n("Dock when obscured"), 0, this);
mDockWhenObscured->setToggleAction(true); mDockWhenObscured->setToggleAction(true);
connect(mDockWhenObscured, SIGNAL(toggled(bool)), connect(mDockWhenObscured, SIGNAL(toggled(bool)),
this, SLOT(setDockWhenObscured(bool))); this, SLOT(setDockWhenObscured(bool)));
mDockWhenObscured->addTo(mOptionsMenu); mDockWhenObscured->addTo(mOptionsMenu);
mDockWhenMinimized = new QAction(i18n("Dock when minimized"), 0, this); mDockWhenMinimized = new TQAction(i18n("Dock when minimized"), 0, this);
mDockWhenMinimized->setToggleAction(true); mDockWhenMinimized->setToggleAction(true);
connect(mDockWhenMinimized, SIGNAL(toggled(bool)), connect(mDockWhenMinimized, SIGNAL(toggled(bool)),
this, SLOT(setDockWhenMinimized(bool))); this, SLOT(setDockWhenMinimized(bool)));
mDockWhenMinimized->addTo(mOptionsMenu); 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); mDockWhenFocusLost->setToggleAction(true);
connect(mDockWhenFocusLost, SIGNAL(toggled(bool)), connect(mDockWhenFocusLost, SIGNAL(toggled(bool)),
this, SLOT(setDockWhenFocusLost(bool))); this, SLOT(setDockWhenFocusLost(bool)));
mDockWhenFocusLost->addTo(mOptionsMenu); mDockWhenFocusLost->addTo(mOptionsMenu);
mSkipTaskbar = new QAction(i18n("Skip taskbar"), 0, this); mSkipTaskbar = new TQAction(i18n("Skip taskbar"), 0, this);
mSkipTaskbar->setToggleAction(true); mSkipTaskbar->setToggleAction(true);
connect(mSkipTaskbar, SIGNAL(toggled(bool)), connect(mSkipTaskbar, SIGNAL(toggled(bool)),
this, SLOT(setSkipTaskbar(bool))); this, SLOT(setSkipTaskbar(bool)));
mSkipTaskbar->addTo(mOptionsMenu); mSkipTaskbar->addTo(mOptionsMenu);
mMainMenu = new QPopupMenu(this); mMainMenu = new TQPopupMenu(this);
mMainMenu->insertItem(QIconSet(kdocker_png), mMainMenu->insertItem(TQIconSet(kdocker_png),
i18n("About KDocker"), tlMgr, SLOT(about())); i18n("About KDocker"), tlMgr, SLOT(about()));
mMainMenu->insertSeparator(); mMainMenu->insertSeparator();
mMainMenu->insertItem(i18n("Options"), mOptionsMenu); mMainMenu->insertItem(i18n("Options"), mOptionsMenu);
@ -113,10 +113,10 @@ void CustomTrayLabel::installMenu()
mMainMenu->insertItem(i18n("Undock All"), tlMgr, SLOT(undockAll())); mMainMenu->insertItem(i18n("Undock All"), tlMgr, SLOT(undockAll()));
mMainMenu->insertSeparator(); mMainMenu->insertSeparator();
mShowId = mMainMenu->insertItem(QString("Show/Hide [untitled]"), mShowId = mMainMenu->insertItem(TQString("Show/Hide [untitled]"),
this, SLOT(toggleShow())); this, SLOT(toggleShow()));
mMainMenu->insertItem(QString(i18n("Undock")), this, SLOT(undock())); mMainMenu->insertItem(TQString(i18n("Undock")), this, SLOT(undock()));
mMainMenu->insertItem(QString(i18n("Close")), this, SLOT(close())); mMainMenu->insertItem(TQString(i18n("Close")), this, SLOT(close()));
connect(mMainMenu, SIGNAL(aboutToShow()), this, SLOT(updateMenu())); connect(mMainMenu, SIGNAL(aboutToShow()), this, SLOT(updateMenu()));
@ -132,20 +132,20 @@ void CustomTrayLabel::installMenu()
/* /*
* Session Management * Session Management
*/ */
bool CustomTrayLabel::restoreState(QSettings& settings) bool CustomTrayLabel::restoreState(TQSettings& settings)
{ {
mAutoLaunch->setOn(settings.readBoolEntry("/LaunchOnStartup")); mAutoLaunch->setOn(settings.readBoolEntry("/LaunchOnStartup"));
setDockWhenObscured(settings.readBoolEntry("/DockWhenObscured")); setDockWhenObscured(settings.readBoolEntry("/DockWhenObscured"));
TRACE("AutoLaunch=%i DWM=%i DWO=%i", isLaunchOnStartup(), TRACE("AutoLaunch=%i DWM=%i DWO=%i", isLaunchOnStartup(),
isDockWhenMinimized(), isDockWhenObscured()); 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; if (!mSessionManagement->isOn()) return false;
QTrayLabel::saveState(settings); TQTrayLabel::saveState(settings);
settings.writeEntry("/LaunchOnStartup", isLaunchOnStartup()); settings.writeEntry("/LaunchOnStartup", isLaunchOnStartup());
settings.writeEntry("/DockWhenObscured", isDockWhenObscured()); settings.writeEntry("/DockWhenObscured", isDockWhenObscured());
TRACE("AutoLaunch=%i DWM=%i DWO=%i", isLaunchOnStartup(), TRACE("AutoLaunch=%i DWM=%i DWO=%i", isLaunchOnStartup(),
@ -177,23 +177,23 @@ static bool which(const char *app)
// Overridden to update our menu // Overridden to update our menu
void CustomTrayLabel::setDockWhenMinimized(bool dwm) void CustomTrayLabel::setDockWhenMinimized(bool dwm)
{ {
QTrayLabel::setDockWhenMinimized(dwm); TQTrayLabel::setDockWhenMinimized(dwm);
mDockWhenMinimized->setOn(isDockWhenMinimized()); mDockWhenMinimized->setOn(isDockWhenMinimized());
} }
void CustomTrayLabel::setSkipTaskbar(bool skip) void CustomTrayLabel::setSkipTaskbar(bool skip)
{ {
QTrayLabel::setSkipTaskbar(skip); TQTrayLabel::setSkipTaskbar(skip);
mSkipTaskbar->setOn(isSkippingTaskbar()); 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 * unsubscribe from root window. This is because it doesnt know if someone
* else is interested in root window events * 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. // Get icon from user, load it and if successful load it.
void CustomTrayLabel::setCustomIcon(void) void CustomTrayLabel::setCustomIcon(void)
{ {
QString icon; TQString icon;
while (true) while (true)
{ {
// Nag the user to give us a valid icon or press cancel // 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 (icon.isNull()) return; // user cancelled
if (!QPixmap(icon).isNull()) break; if (!TQPixmap(icon).isNull()) break;
TRACE("Attempting to set icon to %s", icon.latin1()); 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)); i18n("%1 is not a valid icon").arg(icon));
} }
@ -225,7 +225,7 @@ void CustomTrayLabel::setCustomIcon(void)
void CustomTrayLabel::slotSetBalloonTimeout(void) void CustomTrayLabel::slotSetBalloonTimeout(void)
{ {
bool ok; bool ok;
int timeout = QInputDialog::getInteger(i18n("KDocker"), int timeout = TQInputDialog::getInteger(i18n("KDocker"),
i18n("Enter balloon timeout (secs). 0 to disable ballooning"), i18n("Enter balloon timeout (secs). 0 to disable ballooning"),
balloonTimeout()/1000, 0, 60, 1, &ok); balloonTimeout()/1000, 0, 60, 1, &ok);
@ -243,7 +243,7 @@ void CustomTrayLabel::slotSetLaunchOnStartup()
{ {
TRACE("%i", mAutoLaunch->isOn()); TRACE("%i", mAutoLaunch->isOn());
if (!mAutoLaunch->isOn()) return; if (!mAutoLaunch->isOn()) return;
QString app = appName(); TQString app = appName();
TRACE("Validating %s", app.latin1()); TRACE("Validating %s", app.latin1());
@ -258,7 +258,7 @@ void CustomTrayLabel::slotSetLaunchOnStartup()
} }
// Request user to provide file name himself // 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 " i18n("\"%1\" is not a valid executable "
"or was not found in your $PATH").arg(app), "or was not found in your $PATH").arg(app),
i18n("Select program"), i18n("Cancel")) == 1) i18n("Select program"), i18n("Cancel")) == 1)
@ -267,7 +267,7 @@ void CustomTrayLabel::slotSetLaunchOnStartup()
return; // cancelled return; // cancelled
} }
app = QFileDialog::getOpenFileName(); app = TQFileDialog::getOpenFileName();
if (app.isNull()) if (app.isNull())
{ {
TRACE("Disabling auto launch"); TRACE("Disabling auto launch");
@ -280,9 +280,9 @@ void CustomTrayLabel::slotSetLaunchOnStartup()
// Called when we are just about to display the menu // Called when we are just about to display the menu
void CustomTrayLabel::updateMenu(void) void CustomTrayLabel::updateMenu(void)
{ {
QString title = appClass(); // + "(" + appTitle() + ")"; TQString title = appClass(); // + "(" + appTitle() + ")";
mMainMenu->changeItem(mShowId, QIconSet(*pixmap()), mMainMenu->changeItem(mShowId, TQIconSet(*pixmap()),
QString((isWithdrawn() ? i18n("Show %1") : i18n("Hide %1")).arg(title))); TQString((isWithdrawn() ? i18n("Show %1") : i18n("Hide %1")).arg(title)));
} }
void CustomTrayLabel::mapEvent(void) void CustomTrayLabel::mapEvent(void)
@ -295,7 +295,7 @@ void CustomTrayLabel::mapEvent(void)
* the window. So we disable it for sometime and reanable. * the window. So we disable it for sometime and reanable.
*/ */
mDockWhenObscured->setOn(false); mDockWhenObscured->setOn(false);
QTimer::singleShot(800, mDockWhenObscured, SLOT(toggle())); TQTimer::singleShot(800, mDockWhenObscured, SLOT(toggle()));
TRACE("Turning off DWO for some time"); TRACE("Turning off DWO for some time");
} }
} }
@ -312,9 +312,9 @@ void CustomTrayLabel::focusLostEvent()
if (mDockWhenFocusLost->isOn()) withdraw(); 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()); mMainMenu->popup(ev->globalPos());
else else
toggleShow(); toggleShow();
@ -323,7 +323,7 @@ void CustomTrayLabel::mouseReleaseEvent(QMouseEvent * ev)
void CustomTrayLabel::destroyEvent(void) void CustomTrayLabel::destroyEvent(void)
{ {
mUndockWhenDead = true; mUndockWhenDead = true;
QTrayLabel::destroyEvent(); TQTrayLabel::destroyEvent();
} }
void CustomTrayLabel::processDead(void) void CustomTrayLabel::processDead(void)
@ -353,9 +353,9 @@ bool CustomTrayLabel::canDockWindow(Window w)
return !(TrayLabelMgr::instance()->isWindowDocked(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" 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")); "that is brought in front when you hover the item over the tray icon"));
} }

@ -22,33 +22,33 @@
#ifndef _CUSTOMTRAYLABEL_H #ifndef _CUSTOMTRAYLABEL_H
#define _CUSTOMTRAYLABEL_H #define _CUSTOMTRAYLABEL_H
#include <qobject.h> #include <tqobject.h>
#include <qaction.h> #include <tqaction.h>
#include "qtraylabel.h" #include "qtraylabel.h"
class QStringList; class TQStringList;
class QPopupMenu; class TQPopupMenu;
class QString; class TQString;
class QSettings; class TQSettings;
class QWidget; class TQWidget;
class QDropEvent; class TQDropEvent;
class CustomTrayLabel : public QTrayLabel class CustomTrayLabel : public TQTrayLabel
{ {
Q_OBJECT Q_OBJECT
public: public:
CustomTrayLabel(Window w, QWidget* p = 0, const QString& t = QString::null); CustomTrayLabel(Window w, TQWidget* p = 0, const TQString& t = TQString::null);
CustomTrayLabel(const QStringList& argv, pid_t pid, QWidget* parent = 0); CustomTrayLabel(const TQStringList& argv, pid_t pid, TQWidget* parent = 0);
// Session management // Session management
bool saveState(QSettings& settings); bool saveState(TQSettings& settings);
bool restoreState(QSettings& settings); bool restoreState(TQSettings& settings);
bool isLaunchOnStartup(void) const { return mAutoLaunch->isOn(); } bool isLaunchOnStartup(void) const { return mAutoLaunch->isOn(); }
bool isDockWhenObscured(void) const { return mDockWhenObscured->isOn(); } bool isDockWhenObscured(void) const { return mDockWhenObscured->isOn(); }
void setAppName(const QString& name); void setAppName(const TQString& name);
public slots: public slots:
// overridden to update our menu // overridden to update our menu
@ -61,13 +61,13 @@ public slots:
void enableSessionManagement(bool sm) { mSessionManagement->setOn(sm); } void enableSessionManagement(bool sm) { mSessionManagement->setOn(sm); }
protected: protected:
void dropEvent(QDropEvent *ev); void dropEvent(TQDropEvent *ev);
bool canUnsubscribeFromRoot(void); bool canUnsubscribeFromRoot(void);
void mapEvent(void); void mapEvent(void);
void focusLostEvent(); void focusLostEvent();
void obscureEvent(void); void obscureEvent(void);
void destroyEvent(void); void destroyEvent(void);
void mouseReleaseEvent(QMouseEvent * ev); void mouseReleaseEvent(TQMouseEvent * ev);
bool canDockWindow(Window w); bool canDockWindow(Window w);
void processDead(void); void processDead(void);
@ -80,8 +80,8 @@ private slots:
private: private:
void installMenu(); void installMenu();
bool mUndockWhenDead; bool mUndockWhenDead;
QPopupMenu *mOptionsMenu, *mMainMenu; TQPopupMenu *mOptionsMenu, *mMainMenu;
QAction *mDockOnRestore, *mAutoLaunch, *mBalloonTimeout, *mSkipTaskbar, TQAction *mDockOnRestore, *mAutoLaunch, *mBalloonTimeout, *mSkipTaskbar,
*mDockWhenMinimized, *mDockWhenObscured, *mSessionManagement, *mDockWhenMinimized, *mDockWhenObscured, *mSessionManagement,
*mDockWhenFocusLost; *mDockWhenFocusLost;
int mShowId; int mShowId;

@ -19,13 +19,13 @@
// $Id: kdocker.cpp,v 1.24 2005/02/04 10:25:46 cs19713 Exp $ // $Id: kdocker.cpp,v 1.24 2005/02/04 10:25:46 cs19713 Exp $
#include <qsessionmanager.h> #include <tqsessionmanager.h>
#include <qdir.h> #include <tqdir.h>
#include <qfile.h> #include <tqfile.h>
#include <qtextcodec.h> #include <tqtextcodec.h>
#include <qtextstream.h> #include <tqtextstream.h>
#include <qtimer.h> #include <tqtimer.h>
#include <qstring.h> #include <tqstring.h>
#include <klocale.h> #include <klocale.h>
@ -39,11 +39,11 @@
#include <stdio.h> #include <stdio.h>
#include <stdlib.h> #include <stdlib.h>
// #define TMPFILE_PREFIX QString("/tmp/kdocker.") // #define TMPFILE_PREFIX TQString("/tmp/kdocker.")
#define TMPFILE_PREFIX QDir::homeDirPath() + "/.kdocker." #define TMPFILE_PREFIX TQDir::homeDirPath() + "/.kdocker."
KDocker::KDocker(int& argc, char** argv) KDocker::KDocker(int& argc, char** argv)
:QApplication(argc, argv), mTrayLabelMgr(0) :TQApplication(argc, argv), mTrayLabelMgr(0)
{ {
INIT_TRACE(); INIT_TRACE();
@ -65,13 +65,13 @@ KDocker::KDocker(int& argc, char** argv)
* selection owner. If someone else owns it, transfer control to that * selection owner. If someone else owns it, transfer control to that
* instance of KDocker * instance of KDocker
*/ */
Display *display = QPaintDevice::x11AppDisplay(); Display *display = TQPaintDevice::x11AppDisplay();
Atom kdocker = XInternAtom(display, "_KDOCKER_RUNNING", False); Atom kdocker = XInternAtom(display, "_KDOCKER_RUNNING", False);
Window prev_instance = XGetSelectionOwner(display, kdocker); Window prev_instance = XGetSelectionOwner(display, kdocker);
if (prev_instance == None) if (prev_instance == None)
{ {
mSelectionOwner = XCreateSimpleWindow(display, qt_xrootwin(), 1, 1, 1, mSelectionOwner = XCreateSimpleWindow(display, tqt_xrootwin(), 1, 1, 1,
1, 1, 1, 1); 1, 1, 1, 1);
XSetSelectionOwner(display, kdocker, mSelectionOwner, CurrentTime); XSetSelectionOwner(display, kdocker, mSelectionOwner, CurrentTime);
TRACE("Selection owner set to 0x%x", (unsigned) mSelectionOwner); TRACE("Selection owner set to 0x%x", (unsigned) mSelectionOwner);
@ -83,51 +83,51 @@ KDocker::KDocker(int& argc, char** argv)
void KDocker::printVersion(void) void KDocker::printVersion(void)
{ {
qDebug("Qt: %s", qVersion()); tqDebug("TQt: %s", tqVersion());
qDebug("KDocker: %s", KDOCKER_APP_VERSION); tqDebug("KDocker: %s", KDOCKER_APP_VERSION);
} }
// Prints the CLI arguments. Does not return // Prints the CLI arguments. Does not return
void KDocker::printUsage(char optopt) void KDocker::printUsage(char optopt)
{ {
if (optopt != 'h') qDebug("%s", i18n("kdocker: invalid option -- %1").arg(optopt).local8Bit().data()); if (optopt != 'h') tqDebug("%s", i18n("kdocker: invalid option -- %1").arg(optopt).local8Bit().data());
qDebug("%s", i18n("Usage: KDocker [options] command\n").local8Bit().data()); tqDebug("%s", i18n("Usage: KDocker [options] command\n").local8Bit().data());
qDebug("%s", i18n("Docks any application into the system tray\n").local8Bit().data()); tqDebug("%s", i18n("Docks any application into the system tray\n").local8Bit().data());
qDebug("%s", i18n("command \tCommand to execute\n").local8Bit().data()); tqDebug("%s", i18n("command \tCommand to execute\n").local8Bit().data());
qDebug("%s", i18n("Options").local8Bit().data()); tqDebug("%s", i18n("Options").local8Bit().data());
qDebug("%s", i18n("-a \tShow author information").local8Bit().data()); tqDebug("%s", i18n("-a \tShow author information").local8Bit().data());
qDebug("%s", i18n("-b \tDont warn about non-normal windows (blind mode)").local8Bit().data()); tqDebug("%s", i18n("-b \tDont warn about non-normal windows (blind mode)").local8Bit().data());
qDebug("%s", i18n("-d \tDisable session management").local8Bit().data()); tqDebug("%s", i18n("-d \tDisable session management").local8Bit().data());
qDebug("%s", i18n("-e \tEnable session management").local8Bit().data()); tqDebug("%s", i18n("-e \tEnable session management").local8Bit().data());
qDebug("%s", i18n("-f \tDock window that has the focus(active window)").local8Bit().data()); tqDebug("%s", i18n("-f \tDock window that has the focus(active window)").local8Bit().data());
qDebug("%s", i18n("-h \tDisplay this help").local8Bit().data()); tqDebug("%s", i18n("-h \tDisplay this help").local8Bit().data());
qDebug("%s", i18n("-i icon\tCustom dock Icon").local8Bit().data()); tqDebug("%s", i18n("-i icon\tCustom dock Icon").local8Bit().data());
qDebug("%s", i18n("-l \tLaunch on startup").local8Bit().data()); tqDebug("%s", i18n("-l \tLaunch on startup").local8Bit().data());
qDebug("%s", i18n("-m \tKeep application window mapped (dont hide on dock)").local8Bit().data()); tqDebug("%s", i18n("-m \tKeep application window mapped (dont hide on dock)").local8Bit().data());
qDebug("%s", i18n("-o \tDock when obscured").local8Bit().data()); tqDebug("%s", i18n("-o \tDock when obscured").local8Bit().data());
qDebug("%s", i18n("-p secs\tSet ballooning timeout (popup time)").local8Bit().data()); tqDebug("%s", i18n("-p secs\tSet ballooning timeout (popup time)").local8Bit().data());
qDebug("%s", i18n("-q \tDisable ballooning title changes (quiet)").local8Bit().data()); tqDebug("%s", i18n("-q \tDisable ballooning title changes (quiet)").local8Bit().data());
qDebug("%s", i18n("-t \tRemove this application from the task bar").local8Bit().data()); tqDebug("%s", i18n("-t \tRemove this application from the task bar").local8Bit().data());
qDebug("%s", i18n("-v \tDisplay version").local8Bit().data()); tqDebug("%s", i18n("-v \tDisplay version").local8Bit().data());
qDebug("%s", i18n("-w wid \tWindow id of the application to dock\n").local8Bit().data()); tqDebug("%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()); tqDebug("%s", i18n("NOTE: Use -d for all startup scripts.\n").local8Bit().data());
qDebug("%s", i18n("Bugs and wishes to gramakri@uiuc.edu").local8Bit().data()); tqDebug("%s", i18n("Bugs and wishes to gramakri@uiuc.edu").local8Bit().data());
qDebug("%s", i18n("Project information at http://kdocker.sourceforge.net").local8Bit().data()); tqDebug("%s", i18n("Project information at http://kdocker.sourceforge.net").local8Bit().data());
} }
void KDocker::notifyPreviousInstance(Window prevInstance) void KDocker::notifyPreviousInstance(Window prevInstance)
{ {
Display *display = QPaintDevice::x11AppDisplay(); Display *display = TQPaintDevice::x11AppDisplay();
TRACE("Notifying previous instance [%x]", (unsigned) prevInstance); TRACE("Notifying previous instance [%x]", (unsigned) prevInstance);
// Dump all arguments in temporary file // 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; 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 * 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 * our new instance
*/ */
bool KDocker::x11EventFilter(XEvent * event) bool KDocker::x11EventFilter(XEvent * event)
@ -179,7 +179,7 @@ bool KDocker::x11EventFilter(XEvent * event)
client->data.l[1], (unsigned) mSelectionOwner); client->data.l[1], (unsigned) mSelectionOwner);
char tmp[50]; char tmp[50];
struct stat buf; 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)) if (stat(tmp, &buf) || (getuid()!=buf.st_uid))
{ {
/* /*
@ -194,11 +194,11 @@ bool KDocker::x11EventFilter(XEvent * event)
unlink(tmp); unlink(tmp);
return TRUE; return TRUE;
} }
QFile f(tmp); TQFile f(tmp);
if (!f.open(IO_ReadOnly)) return TRUE; if (!f.open(IO_ReadOnly)) return TRUE;
QTextStream s(&f); TQTextStream s(&f);
QStringList argv; TQStringList argv;
while (!s.atEnd()) { QString x; s >> x; argv += x; } while (!s.atEnd()) { TQString x; s >> x; argv += x; }
f.close(); f.close();
unlink(tmp); // delete the tmp file unlink(tmp); // delete the tmp file
mTrayLabelMgr->processCommand(argv); mTrayLabelMgr->processCommand(argv);
@ -210,22 +210,22 @@ bool KDocker::x11EventFilter(XEvent * event)
/* /*
* XSMP Support * 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; discard_command << "rm" << sf;
sm.setDiscardCommand(discard_command); sm.setDiscardCommand(discard_command);
sm.setRestartHint(QSessionManager::RestartIfRunning); sm.setRestartHint(TQSessionManager::RestartIfRunning);
QStringList restart_command; TQStringList restart_command;
restart_command << this->argv()[0] restart_command << this->argv()[0]
<< "-session" << sm.sessionId(); << "-session" << sm.sessionId();
sm.setRestartCommand(restart_command); sm.setRestartCommand(restart_command);
TRACE("SessionFile=%s AppName=%s", sf.latin1(), this->argv()[0]); 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()); // sm.setRestartCommand(applicationFilePath());
} }

@ -22,14 +22,14 @@
#ifndef _KDOCKER_H #ifndef _KDOCKER_H
#define _KDOCKER_H #define _KDOCKER_H
#include <qapplication.h> #include <tqapplication.h>
#include <X11/Xlib.h> #include <X11/Xlib.h>
#define KDOCKER_APP_VERSION "1.3" #define KDOCKER_APP_VERSION "1.3"
class TrayLabelMgr; class TrayLabelMgr;
class KDocker : public QApplication class KDocker : public TQApplication
{ {
Q_OBJECT Q_OBJECT
@ -38,15 +38,15 @@ public:
TrayLabelMgr *trayLabelMgr(void) { return mTrayLabelMgr; } TrayLabelMgr *trayLabelMgr(void) { return mTrayLabelMgr; }
void dumpState(const QString &file); void dumpState(const TQString &file);
void printUsage(char optopt = 'h'); void printUsage(char optopt = 'h');
protected: protected:
bool x11EventFilter(XEvent * event); bool x11EventFilter(XEvent * event);
void saveState(QSessionManager &sm); void saveState(TQSessionManager &sm);
private: private:
QString saveSession(); TQString saveSession();
bool restoreSession(); bool restoreSession();
void notifyPreviousInstance(Window prevInstance); void notifyPreviousInstance(Window prevInstance);

@ -26,7 +26,7 @@
#include <klocale.h> #include <klocale.h>
#include <qdir.h> #include <tqdir.h>
#include "kdocker.h" #include "kdocker.h"
#include "traylabelmgr.h" #include "traylabelmgr.h"
#include "trace.h" #include "trace.h"
@ -36,12 +36,12 @@ static void sighandler(int sig)
{ {
if (sig == SIGUSR1) if (sig == SIGUSR1)
{ {
DUMP_TRACE(QDir::homeDirPath() + "/kdocker.trace"); DUMP_TRACE(TQDir::homeDirPath() + "/kdocker.trace");
return; return;
} }
qDebug("%s", i18n("Caught signal %1. Cleaning up.").arg(sig).local8Bit().data()); tqDebug("%s", i18n("Caught signal %1. Cleaning up.").arg(sig).local8Bit().data());
((KDocker *)qApp)->trayLabelMgr()->undockAll(); ((KDocker *)tqApp)->trayLabelMgr()->undockAll();
} }
int main(int argc, char *argv[]) int main(int argc, char *argv[])

@ -19,16 +19,16 @@
// $Id: qtraylabel.cpp,v 1.31 2005/06/21 10:04:36 cs19713 Exp $ // $Id: qtraylabel.cpp,v 1.31 2005/06/21 10:04:36 cs19713 Exp $
// Include all Qt includes before X // Include all TQt includes before X
#include <qstring.h> #include <tqstring.h>
#include <qevent.h> #include <tqevent.h>
#include <qpoint.h> #include <tqpoint.h>
#include <qtooltip.h> #include <tqtooltip.h>
#include <qtimer.h> #include <tqtimer.h>
#include <qimage.h> #include <tqimage.h>
#include <qpixmap.h> #include <tqpixmap.h>
#include <qfileinfo.h> #include <tqfileinfo.h>
#include <qapplication.h> #include <tqapplication.h>
#include "trace.h" #include "trace.h"
#include "qtraylabel.h" #include "qtraylabel.h"
@ -46,7 +46,7 @@
#include "util.h" #include "util.h"
void QTrayLabel::initialize(void) void TQTrayLabel::initialize(void)
{ {
mDocked = false; mDocked = false;
mWithdrawn = true; mWithdrawn = true;
@ -55,30 +55,30 @@ void QTrayLabel::initialize(void)
mDockWhenMinimized = true; mDockWhenMinimized = true;
mDesktop = 666; // setDockedWindow would set it a saner value mDesktop = 666; // setDockedWindow would set it a saner value
// Balloon's properties are set to match a Qt tool tip (see Qt source) // Balloon's properties are set to match a TQt tool tip (see TQt source)
mBalloon = new QLabel(0, "balloon", WType_TopLevel | WStyle_StaysOnTop | mBalloon = new TQLabel(0, "balloon", WType_TopLevel | WStyle_StaysOnTop |
WStyle_Customize | WStyle_NoBorder | WStyle_Customize | WStyle_NoBorder |
WStyle_Tool | WX11BypassWM); WStyle_Tool | WX11BypassWM);
mBalloon->setFont(QToolTip::font()); mBalloon->setFont(TQToolTip::font());
mBalloon->setPalette(QToolTip::palette()); mBalloon->setPalette(TQToolTip::palette());
mBalloon->setAlignment(Qt::AlignLeft | Qt::AlignTop); mBalloon->setAlignment(TQt::AlignLeft | TQt::AlignTop);
mBalloon->setAutoMask(FALSE); mBalloon->setAutoMask(FALSE);
mBalloon->setAutoResize(true); mBalloon->setAutoResize(true);
setAlignment(Qt::AlignCenter); setAlignment(TQt::AlignCenter);
setBackgroundMode(X11ParentRelative); setBackgroundMode(X11ParentRelative);
connect(&mRealityMonitor, SIGNAL(timeout()), this, SLOT(realityCheck())); connect(&mRealityMonitor, SIGNAL(timeout()), this, SLOT(realityCheck()));
setDockedWindow(mDockedWindow); setDockedWindow(mDockedWindow);
sysTrayStatus(QPaintDevice::x11AppDisplay(), &mSysTray); sysTrayStatus(TQPaintDevice::x11AppDisplay(), &mSysTray);
// Subscribe to system tray window notifications // Subscribe to system tray window notifications
if (mSysTray != None) if (mSysTray != None)
subscribe(QPaintDevice::x11AppDisplay(), mSysTray, subscribe(TQPaintDevice::x11AppDisplay(), mSysTray,
StructureNotifyMask, true); StructureNotifyMask, true);
} }
// Describe ourselves in a few words // Describe ourselves in a few words
const char *QTrayLabel::me(void) const const char *TQTrayLabel::me(void) const
{ {
static char temp[100]; static char temp[100];
snprintf(temp, sizeof(temp), "(%s,PID=%i,WID=0x%x)", snprintf(temp, sizeof(temp), "(%s,PID=%i,WID=0x%x)",
@ -86,23 +86,23 @@ const char *QTrayLabel::me(void) const
return temp; return temp;
} }
QTrayLabel::QTrayLabel(Window w, QWidget* parent, const QString& text) TQTrayLabel::TQTrayLabel(Window w, TQWidget* parent, const TQString& text)
:QLabel(parent, text.utf8(), WStyle_Customize | WStyle_NoBorder | WStyle_Tool), :TQLabel(parent, text.utf8(), WStyle_Customize | WStyle_NoBorder | WStyle_Tool),
mDockedWindow(w), mPid(0) mDockedWindow(w), mPid(0)
{ {
initialize(); initialize();
} }
QTrayLabel::QTrayLabel(const QStringList& pname, pid_t pid, QWidget* parent) TQTrayLabel::TQTrayLabel(const TQStringList& pname, pid_t pid, TQWidget* parent)
:QLabel(parent, "TrayLabel", WStyle_Customize | WStyle_NoBorder | WStyle_Tool), :TQLabel(parent, "TrayLabel", WStyle_Customize | WStyle_NoBorder | WStyle_Tool),
mDockedWindow(None), mProgName(pname), mPid(pid) mDockedWindow(None), mProgName(pname), mPid(pid)
{ {
if (pname[0].at(0) != '/' && pname[0].find('/', 1) > 0) 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(); initialize();
} }
QTrayLabel::~QTrayLabel() TQTrayLabel::~TQTrayLabel()
{ {
TRACE("%s Goodbye", me()); TRACE("%s Goodbye", me());
if (mDockedWindow == None) return; 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 * Scans the windows in the desktop and checks if a window exists that we might
* be interested in * be interested in
*/ */
void QTrayLabel::scanClients() void TQTrayLabel::scanClients()
{ {
Window r, parent, *children; Window r, parent, *children;
unsigned nchildren = 0; unsigned nchildren = 0;
Display *display = QPaintDevice::x11AppDisplay(); Display *display = TQPaintDevice::x11AppDisplay();
QString ename = QFileInfo(mProgName[0]).fileName(); // strip out the path 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); TRACE("%s nchildren=%i", me(), nchildren);
for(unsigned i=0; i<nchildren; i++) for(unsigned i=0; i<nchildren; i++)
{ {
@ -143,38 +143,38 @@ void QTrayLabel::scanClients()
* Do a reality check :). Note that this timer runs only when required. Does 3 * Do a reality check :). Note that this timer runs only when required. Does 3
* things, * things,
* 1) If the system tray had disappeared, checks for arrival of new system tray * 1) If the system tray had disappeared, checks for arrival of new system tray
* 2) Check root window subscription since it is overwritten by Qt (see below) * 2) Check root window subscription since it is overwritten by TQt (see below)
* 3) Checks health of the process whose windows we are docking * 3) Checks health of the process whose windows we are docking
*/ */
void QTrayLabel::realityCheck(void) void TQTrayLabel::realityCheck(void)
{ {
if (mSysTray == None) if (mSysTray == None)
{ {
// Check the system tray status if we were docked // Check the system tray status if we were docked
if (sysTrayStatus(QPaintDevice::x11AppDisplay(), &mSysTray) if (sysTrayStatus(TQPaintDevice::x11AppDisplay(), &mSysTray)
!= SysTrayPresent) return; // no luck != SysTrayPresent) return; // no luck
TRACE("%s System tray present", me()); TRACE("%s System tray present", me());
dock(); dock();
subscribe(QPaintDevice::x11AppDisplay(), mSysTray, subscribe(TQPaintDevice::x11AppDisplay(), mSysTray,
StructureNotifyMask, true); StructureNotifyMask, true);
mRealityMonitor.stop(); mRealityMonitor.stop();
return; return;
} }
/* /*
* I am not sure when, but Qt at some point in time overwrites our * I am not sure when, but TQt at some point in time overwrites our
* subscription (SubstructureNotifyMask) on the root window. So, we check * subscription (SubstructureNotifyMask) on the root window. So, we check
* the status of root window subscription periodically. Now, from the time * the status of root window subscription periodically. Now, from the time
* Qt overwrote our subscription to the time we discovered it, the * TQt overwrote our subscription to the time we discovered it, the
* window we are looking for could have been mapped and we would have never * window we are looking for could have been mapped and we would have never
* been informed (since Qt overrwrote the subscription). So we have to * been informed (since TQt overrwrote the subscription). So we have to
* scan existing client list and dock. I have never seen this happen * scan existing client list and dock. I have never seen this happen
* but I see it likely to happen during session restoration * but I see it likely to happen during session restoration
*/ */
Display *display = QPaintDevice::x11AppDisplay(); Display *display = TQPaintDevice::x11AppDisplay();
XWindowAttributes attr; XWindowAttributes attr;
XGetWindowAttributes(display, qt_xrootwin(), &attr); XGetWindowAttributes(display, tqt_xrootwin(), &attr);
if (!(attr.your_event_mask & SubstructureNotifyMask)) if (!(attr.your_event_mask & SubstructureNotifyMask))
{ {
@ -197,12 +197,12 @@ void QTrayLabel::realityCheck(void)
/* /*
* Sends a message to the WM to show this window on all the desktops * Sends a message to the WM to show this window on all the desktops
*/ */
void QTrayLabel::showOnAllDesktops(void) void TQTrayLabel::showOnAllDesktops(void)
{ {
TRACE("Showing on all desktops"); TRACE("Showing on all desktops");
Display *d = QPaintDevice::x11AppDisplay(); Display *d = TQPaintDevice::x11AppDisplay();
long l[5] = { -1, 0, 0, 0, 0 }; // -1 = all, 0 = Desktop1, 1 = Desktop2 ... long l[5] = { -1, 0, 0, 0, 0 }; // -1 = all, 0 = Desktop1, 1 = Desktop2 ...
sendMessage(d, qt_xrootwin(), mDockedWindow, "_NET_WM_DESKTOP", 32, sendMessage(d, tqt_xrootwin(), mDockedWindow, "_NET_WM_DESKTOP", 32,
SubstructureNotifyMask | SubstructureRedirectMask, l, sizeof(l)); SubstructureNotifyMask | SubstructureRedirectMask, l, sizeof(l));
} }
@ -218,7 +218,7 @@ const long SYSTEM_TRAY_CANCEL_MESSAGE = 2;
* 2. KDE 3.x and above - _KDE_NET_WM_SYSTEM_TRAY_WINDOW_FOR * 2. KDE 3.x and above - _KDE_NET_WM_SYSTEM_TRAY_WINDOW_FOR
* 3. Older KDE - KWM_DOCKWINDOW (Untested) * 3. Older KDE - KWM_DOCKWINDOW (Untested)
*/ */
void QTrayLabel::dock(void) void TQTrayLabel::dock(void)
{ {
TRACE("%s", me()); TRACE("%s", me());
mDocked = true; mDocked = true;
@ -231,7 +231,7 @@ void QTrayLabel::dock(void)
return; return;
} }
Display *display = QPaintDevice::x11AppDisplay(); Display *display = TQPaintDevice::x11AppDisplay();
Window wid = winId(); Window wid = winId();
// 1. GNOME and NET WM Specification // 1. GNOME and NET WM Specification
@ -264,7 +264,7 @@ void QTrayLabel::dock(void)
* working with with a delay of as little as 50ms. But since I * working with with a delay of as little as 50ms. But since I
* dont understand why this delay is required, I am justifiably paranoid * dont understand why this delay is required, I am justifiably paranoid
*/ */
QTimer::singleShot(500, this, SLOT(show())); TQTimer::singleShot(500, this, SLOT(show()));
// let the world know // let the world know
emit docked(this); emit docked(this);
@ -277,11 +277,11 @@ void QTrayLabel::dock(void)
* be used. It works but the system tray does not fill the void that we left * be used. It works but the system tray does not fill the void that we left
* in the tray. Looks like the system tray will resize only for DestroyEvents * in the tray. Looks like the system tray will resize only for DestroyEvents
*/ */
void QTrayLabel::undock(void) void TQTrayLabel::undock(void)
{ {
TRACE("%s stopping reality monitor", me()); TRACE("%s stopping reality monitor", me());
mRealityMonitor.stop(); mRealityMonitor.stop();
XUnmapWindow(QPaintDevice::x11AppDisplay(), winId()); XUnmapWindow(TQPaintDevice::x11AppDisplay(), winId());
emit undocked(this); emit undocked(this);
emit undocked(); emit undocked();
} }
@ -289,13 +289,13 @@ void QTrayLabel::undock(void)
/* /*
* Maps the window from the same place it was withdrawn from * Maps the window from the same place it was withdrawn from
*/ */
void QTrayLabel::map(void) void TQTrayLabel::map(void)
{ {
TRACE("%s", me()); TRACE("%s", me());
mWithdrawn = false; mWithdrawn = false;
if (mDockedWindow == None) return; if (mDockedWindow == None) return;
Display *display = QPaintDevice::x11AppDisplay(); Display *display = TQPaintDevice::x11AppDisplay();
if (mDesktop == -1) if (mDesktop == -1)
{ {
@ -306,7 +306,7 @@ void QTrayLabel::map(void)
* the WM 200ms to do that. We will override that value to -1 (all * the WM 200ms to do that. We will override that value to -1 (all
* desktops) on showOnAllDesktops(). * desktops) on showOnAllDesktops().
*/ */
QTimer::singleShot(200, this, SLOT(showOnAllDesktops())); TQTimer::singleShot(200, this, SLOT(showOnAllDesktops()));
} }
/* /*
@ -328,22 +328,22 @@ void QTrayLabel::map(void)
XSetWMNormalHints(display, mDockedWindow, &mSizeHint); XSetWMNormalHints(display, mDockedWindow, &mSizeHint);
// make it the active window // make it the active window
long l[5] = { None, CurrentTime, None, 0, 0 }; long l[5] = { None, CurrentTime, None, 0, 0 };
sendMessage(display, qt_xrootwin(), mDockedWindow, "_NET_ACTIVE_WINDOW", 32, sendMessage(display, tqt_xrootwin(), mDockedWindow, "_NET_ACTIVE_WINDOW", 32,
SubstructureNotifyMask | SubstructureRedirectMask, l, sizeof(l)); SubstructureNotifyMask | SubstructureRedirectMask, l, sizeof(l));
// skipTaskbar modifies _NET_WM_STATE. Make sure we dont override WMs value // skipTaskbar modifies _NET_WM_STATE. Make sure we dont override WMs value
QTimer::singleShot(230, this, SLOT(skipTaskbar())); TQTimer::singleShot(230, this, SLOT(skipTaskbar()));
// disable docking when minized for some time (since we went to Iconic state) // disable docking when minized for some time (since we went to Iconic state)
mDockWhenMinimized = !mDockWhenMinimized; mDockWhenMinimized = !mDockWhenMinimized;
QTimer::singleShot(230, this, SLOT(toggleDockWhenMinimized())); TQTimer::singleShot(230, this, SLOT(toggleDockWhenMinimized()));
} }
void QTrayLabel::withdraw(void) void TQTrayLabel::withdraw(void)
{ {
TRACE("%s", me()); TRACE("%s", me());
mWithdrawn = true; mWithdrawn = true;
if (mDockedWindow == None) return; if (mDockedWindow == None) return;
Display *display = QPaintDevice::x11AppDisplay(); Display *display = TQPaintDevice::x11AppDisplay();
int screen = DefaultScreen(display); int screen = DefaultScreen(display);
long dummy; long dummy;
@ -363,10 +363,10 @@ void QTrayLabel::withdraw(void)
memset(&ev, 0, sizeof(ev)); memset(&ev, 0, sizeof(ev));
ev.type = UnmapNotify; ev.type = UnmapNotify;
ev.display = display; ev.display = display;
ev.event = qt_xrootwin(); ev.event = tqt_xrootwin();
ev.window = mDockedWindow; ev.window = mDockedWindow;
ev.from_configure = false; ev.from_configure = false;
XSendEvent(display, qt_xrootwin(), False, XSendEvent(display, tqt_xrootwin(), False,
SubstructureRedirectMask|SubstructureNotifyMask, (XEvent *)&ev); SubstructureRedirectMask|SubstructureNotifyMask, (XEvent *)&ev);
XSync(display, False); XSync(display, False);
} }
@ -376,14 +376,14 @@ void QTrayLabel::withdraw(void)
* have _NET_WM_STATE_SKIP_TASKBAR. NET_WM_STATE needs to be updated * have _NET_WM_STATE_SKIP_TASKBAR. NET_WM_STATE needs to be updated
* carefully since it is a set of states. * carefully since it is a set of states.
*/ */
void QTrayLabel::skipTaskbar(void) void TQTrayLabel::skipTaskbar(void)
{ {
Atom __attribute__ ((unused)) type; Atom __attribute__ ((unused)) type;
int __attribute__ ((unused)) format; int __attribute__ ((unused)) format;
unsigned long __attribute__ ((unused)) left; unsigned long __attribute__ ((unused)) left;
Atom *data = NULL; Atom *data = NULL;
unsigned long nitems = 0, num_states = 0; unsigned long nitems = 0, num_states = 0;
Display *display = QPaintDevice::x11AppDisplay(); Display *display = TQPaintDevice::x11AppDisplay();
TRACE("%s", me()); TRACE("%s", me());
Atom _NET_WM_STATE = XInternAtom(display, "_NET_WM_STATE", True); Atom _NET_WM_STATE = XInternAtom(display, "_NET_WM_STATE", True);
@ -428,7 +428,7 @@ void QTrayLabel::skipTaskbar(void)
PropModeReplace, (unsigned char *) &old_states, nitems - 1); PropModeReplace, (unsigned char *) &old_states, nitems - 1);
} }
void QTrayLabel::setSkipTaskbar(bool skip) void TQTrayLabel::setSkipTaskbar(bool skip)
{ {
TRACE("%s Skip=%i", me(), skip); TRACE("%s Skip=%i", me(), skip);
mSkippingTaskbar = skip; mSkippingTaskbar = skip;
@ -439,13 +439,13 @@ void QTrayLabel::setSkipTaskbar(bool skip)
* Closes a window by sending _NET_CLOSE_WINDOW. For reasons best unknown we * Closes a window by sending _NET_CLOSE_WINDOW. For reasons best unknown we
* need to first map and then send the request. * need to first map and then send the request.
*/ */
void QTrayLabel::close(void) void TQTrayLabel::close(void)
{ {
TRACE("%s", me()); TRACE("%s", me());
Display *display = QPaintDevice::x11AppDisplay(); Display *display = TQPaintDevice::x11AppDisplay();
long l[5] = { 0, 0, 0, 0, 0 }; long l[5] = { 0, 0, 0, 0, 0 };
map(); map();
sendMessage(display, qt_xrootwin(), mDockedWindow, "_NET_CLOSE_WINDOW", 32, sendMessage(display, tqt_xrootwin(), mDockedWindow, "_NET_CLOSE_WINDOW", 32,
SubstructureNotifyMask | SubstructureRedirectMask, SubstructureNotifyMask | SubstructureRedirectMask,
l, sizeof(l)); l, sizeof(l));
} }
@ -453,10 +453,10 @@ void QTrayLabel::close(void)
/* /*
* Sets the tray icon. If the icon failed to load, we revert to application icon * Sets the tray icon. If the icon failed to load, we revert to application icon
*/ */
void QTrayLabel::setTrayIcon(const QString& icon) void TQTrayLabel::setTrayIcon(const TQString& icon)
{ {
mCustomIcon = icon; mCustomIcon = icon;
if (QPixmap(mCustomIcon).isNull()) mCustomIcon = QString::null; if (TQPixmap(mCustomIcon).isNull()) mCustomIcon = TQString::null;
TRACE("%s mCustomIcon=%s", me(), mCustomIcon.latin1()); TRACE("%s mCustomIcon=%s", me(), mCustomIcon.latin1());
updateIcon(); updateIcon();
} }
@ -467,7 +467,7 @@ void QTrayLabel::setTrayIcon(const QString& icon)
* B) Subscribe/Unsubscribe for root/w notifications as appropriate * B) Subscribe/Unsubscribe for root/w notifications as appropriate
* C) And of course, dock the window and apply some settings * C) And of course, dock the window and apply some settings
*/ */
void QTrayLabel::setDockedWindow(Window w) void TQTrayLabel::setDockedWindow(Window w)
{ {
TRACE("%s %s reality monitor", me(), TRACE("%s %s reality monitor", me(),
mDockedWindow==None ? "Starting" : "Stopping"); mDockedWindow==None ? "Starting" : "Stopping");
@ -479,7 +479,7 @@ void QTrayLabel::setDockedWindow(Window w)
if (mDockedWindow == None) mRealityMonitor.start(500); if (mDockedWindow == None) mRealityMonitor.start(500);
else mRealityMonitor.stop(); else mRealityMonitor.stop();
Display *d = QPaintDevice::x11AppDisplay(); Display *d = TQPaintDevice::x11AppDisplay();
// Subscribe for window or root window events // Subscribe for window or root window events
if (w == None) subscribe(d, None, SubstructureNotifyMask, true); if (w == None) subscribe(d, None, SubstructureNotifyMask, true);
@ -503,7 +503,7 @@ void QTrayLabel::setDockedWindow(Window w)
if (mWithdrawn) if (mWithdrawn)
// show the window for sometime before docking // show the window for sometime before docking
QTimer::singleShot(1000, this, SLOT(withdraw())); TQTimer::singleShot(1000, this, SLOT(withdraw()));
else map(); else map();
dock(); dock();
} }
@ -512,12 +512,12 @@ void QTrayLabel::setDockedWindow(Window w)
/* /*
* Balloon text. Overload this if you dont like the way things are ballooned * Balloon text. Overload this if you dont like the way things are ballooned
*/ */
void QTrayLabel::balloonText() void TQTrayLabel::balloonText()
{ {
TRACE("%s BalloonText=%s ToolTipText=%s", me(), TRACE("%s BalloonText=%s ToolTipText=%s", me(),
mBalloon->text().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 0 // I_GOT_NETWM_BALLOONING_TO_WORK
// if you can get NET WM ballooning to work let me know // if you can get NET WM ballooning to work let me know
static int id = 1; static int id = 1;
@ -538,28 +538,28 @@ void QTrayLabel::balloonText()
data += 20; data += 20;
} }
#else #else
// Manually do ballooning. See the Qt ToolTip code // Manually do ballooning. See the TQt ToolTip code
QString oldText = mBalloon->text(); TQString oldText = mBalloon->text();
mBalloon->setText(QToolTip::textFor(this)); mBalloon->setText(TQToolTip::textFor(this));
if (oldText.isEmpty()) return; // dont tool tip the first time if (oldText.isEmpty()) return; // dont tool tip the first time
QPoint p = mapToGlobal(QPoint(0, -1 - mBalloon->height())); TQPoint p = mapToGlobal(TQPoint(0, -1 - mBalloon->height()));
if (p.x() + mBalloon->width() > QApplication::desktop()->width()) if (p.x() + mBalloon->width() > TQApplication::desktop()->width())
p.setX(p.x() + width() - mBalloon->width()); p.setX(p.x() + width() - mBalloon->width());
if (p.y() < 0) p.setY(height() + 1); if (p.y() < 0) p.setY(height() + 1);
mBalloon->move(p); mBalloon->move(p);
mBalloon->show(); mBalloon->show();
QTimer::singleShot(mBalloonTimeout, mBalloon, SLOT(hide())); TQTimer::singleShot(mBalloonTimeout, mBalloon, SLOT(hide()));
#endif #endif
} }
/* /*
* Update the title in the menu. Balloon the title change if necessary * 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; char *window_name = NULL;
XFetchName(display, mDockedWindow, &window_name); XFetchName(display, mDockedWindow, &window_name);
@ -570,8 +570,8 @@ void QTrayLabel::handleTitleChange(void)
XClassHint ch; XClassHint ch;
if (XGetClassHint(display, mDockedWindow, &ch)) if (XGetClassHint(display, mDockedWindow, &ch))
{ {
if (ch.res_class) mClass = QString(ch.res_class); if (ch.res_class) mClass = TQString(ch.res_class);
else if (ch.res_name) mClass = QString(ch.res_name); else if (ch.res_name) mClass = TQString(ch.res_name);
if (ch.res_class) XFree(ch.res_class); if (ch.res_class) XFree(ch.res_class);
if (ch.res_name) XFree(ch.res_name); 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 * Overload this if you want a tool tip format that is different from the one
* below i.e "Title [Class]". * below i.e "Title [Class]".
*/ */
void QTrayLabel::updateTitle() void TQTrayLabel::updateTitle()
{ {
TRACE("%s", me()); TRACE("%s", me());
QString text = mTitle + " [" + mClass + "]"; TQString text = mTitle + " [" + mClass + "]";
QToolTip::remove(this); TQToolTip::remove(this);
QToolTip::add(this, text); TQToolTip::add(this, text);
if (mBalloonTimeout) balloonText(); if (mBalloonTimeout) balloonText();
} }
void QTrayLabel::handleIconChange(void) void TQTrayLabel::handleIconChange(void)
{ {
char **window_icon = NULL; char **window_icon = NULL;
TRACE("%s", me()); TRACE("%s", me());
if (mDockedWindow == None) return; if (mDockedWindow == None) return;
Display *display = QPaintDevice::x11AppDisplay(); Display *display = TQPaintDevice::x11AppDisplay();
XWMHints *wm_hints = XGetWMHints(display, mDockedWindow); XWMHints *wm_hints = XGetWMHints(display, mDockedWindow);
if (wm_hints != NULL) if (wm_hints != NULL)
{ {
@ -618,12 +618,12 @@ void QTrayLabel::handleIconChange(void)
wm_hints->icon_mask, NULL); wm_hints->icon_mask, NULL);
XFree(wm_hints); XFree(wm_hints);
} }
QImage image; TQImage image;
if (!window_icon) if (!window_icon)
{ {
image = KGlobal::iconLoader()->loadIcon("question", KIcon::NoGroup, KIcon::SizeMedium); 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); if (window_icon) XpmFree(window_icon);
mAppIcon = image.smoothScale(24, 24); // why? mAppIcon = image.smoothScale(24, 24); // why?
setMinimumSize(mAppIcon.size()); setMinimumSize(mAppIcon.size());
@ -635,19 +635,19 @@ void QTrayLabel::handleIconChange(void)
/* /*
* Overload this to possibly do operations on the pixmap before it is set * Overload this to possibly do operations on the pixmap before it is set
*/ */
void QTrayLabel::updateIcon() void TQTrayLabel::updateIcon()
{ {
TRACE("%s", me()); TRACE("%s", me());
setPixmap(mCustomIcon.isEmpty() ? mAppIcon : mCustomIcon); setPixmap(mCustomIcon.isEmpty() ? mAppIcon : mCustomIcon);
erase(); erase();
QPaintEvent pe(rect()); TQPaintEvent pe(rect());
paintEvent(&pe); paintEvent(&pe);
} }
/* /*
* Mouse activity on our label. RightClick = Menu. LeftClick = Toggle Map * 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()); emit clicked(ev->button(), ev->globalPos());
} }
@ -655,7 +655,7 @@ void QTrayLabel::mouseReleaseEvent(QMouseEvent * ev)
/* /*
* Track drag event * Track drag event
*/ */
void QTrayLabel::dragEnterEvent(QDragEnterEvent *ev) void TQTrayLabel::dragEnterEvent(TQDragEnterEvent *ev)
{ {
ev->accept(); ev->accept();
map(); map();
@ -664,7 +664,7 @@ void QTrayLabel::dragEnterEvent(QDragEnterEvent *ev)
/* /*
* Event dispatcher * Event dispatcher
*/ */
bool QTrayLabel::x11EventFilter(XEvent *ev) bool TQTrayLabel::x11EventFilter(XEvent *ev)
{ {
XAnyEvent *event = (XAnyEvent *)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); TRACE("%s Will analyze window 0x%x", me(), (int)((XMapEvent *)event)->window);
// Check if this window is the soulmate we are looking for // 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); Window w = XmuClientWindow(display, ((XMapEvent *) event)->window);
if (!isNormalWindow(display, w)) return FALSE; if (!isNormalWindow(display, w)) return FALSE;
if (!analyzeWindow(display, w, mPid, 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 // All right. Lets dock this baby
setDockedWindow(w); setDockedWindow(w);
return true; return true;
} }
void QTrayLabel::minimizeEvent(void) void TQTrayLabel::minimizeEvent(void)
{ {
TRACE("minimizeEvent"); TRACE("minimizeEvent");
if (mDockWhenMinimized) withdraw(); if (mDockWhenMinimized) withdraw();
} }
void QTrayLabel::destroyEvent(void) void TQTrayLabel::destroyEvent(void)
{ {
TRACE("%s destroyEvent", me()); TRACE("%s destroyEvent", me());
setDockedWindow(None); setDockedWindow(None);
if (!mPid) undock(); 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_NAME = XInternAtom(display, "WM_NAME", True);
static Atom WM_ICON = XInternAtom(display, "WM_ICON", True); static Atom WM_ICON = XInternAtom(display, "WM_ICON", True);
static Atom WM_STATE = XInternAtom(display, "WM_STATE", True); static Atom WM_STATE = XInternAtom(display, "WM_STATE", True);
@ -771,7 +771,7 @@ void QTrayLabel::propertyChangeEvent(Atom property)
} }
// Session Management // Session Management
bool QTrayLabel::saveState(QSettings &settings) bool TQTrayLabel::saveState(TQSettings &settings)
{ {
TRACE("%s saving state", me()); TRACE("%s saving state", me());
settings.writeEntry("/Application", mProgName.join(" ")); settings.writeEntry("/Application", mProgName.join(" "));
@ -783,7 +783,7 @@ bool QTrayLabel::saveState(QSettings &settings)
return true; return true;
} }
bool QTrayLabel::restoreState(QSettings &settings) bool TQTrayLabel::restoreState(TQSettings &settings)
{ {
TRACE("%s restoring state", me()); TRACE("%s restoring state", me());
mCustomIcon = settings.readEntry("/CustomIcon"); 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 * the application really shows itself up before we do a scan (the reason
* why we have 2s * why we have 2s
*/ */
if (!mPid) QTimer::singleShot(2000, this, SLOT(scanClients())); if (!mPid) TQTimer::singleShot(2000, this, SLOT(scanClients()));
return true; return true;
} }

@ -22,15 +22,15 @@
#ifndef _QTRAYLABEL_H #ifndef _QTRAYLABEL_H
#define _QTRAYLABEL_H #define _QTRAYLABEL_H
#include <qlabel.h> #include <tqlabel.h>
#include <qstring.h> #include <tqstring.h>
#include <qstringlist.h> #include <tqstringlist.h>
#include <qpixmap.h> #include <tqpixmap.h>
#include <qtimer.h> #include <tqtimer.h>
#include <qtextstream.h> #include <tqtextstream.h>
#include <qsettings.h> #include <tqsettings.h>
#include <qevent.h> #include <tqevent.h>
#include <qsize.h> #include <tqsize.h>
#include <X11/Xlib.h> #include <X11/Xlib.h>
#include <X11/Xutil.h> #include <X11/Xutil.h>
@ -39,18 +39,18 @@
#include <sys/types.h> #include <sys/types.h>
#include <unistd.h> #include <unistd.h>
class QMouseEvent; class TQMouseEvent;
class QDragEnterEvent; class TQDragEnterEvent;
class QPoint; class TQPoint;
class QTrayLabel : public QLabel class TQTrayLabel : public TQLabel
{ {
Q_OBJECT Q_OBJECT
public: public:
QTrayLabel(Window w, QWidget* p = 0, const QString& text = QString::null); TQTrayLabel(Window w, TQWidget* p = 0, const TQString& text = TQString::null);
QTrayLabel(const QStringList& argv, pid_t pid, QWidget* parent = 0); TQTrayLabel(const TQStringList& argv, pid_t pid, TQWidget* parent = 0);
virtual ~QTrayLabel(); virtual ~TQTrayLabel();
// Accessors // Accessors
Window dockedWindow(void) const { return mDockedWindow; } Window dockedWindow(void) const { return mDockedWindow; }
@ -59,18 +59,18 @@ public:
bool isWithdrawn(void) const { return mWithdrawn; } bool isWithdrawn(void) const { return mWithdrawn; }
bool isDockWhenMinimized(void) const { return mDockWhenMinimized; } bool isDockWhenMinimized(void) const { return mDockWhenMinimized; }
QString appName(void) const { return mProgName[0]; } TQString appName(void) const { return mProgName[0]; }
virtual void setAppName(const QString& prog) { mProgName[0] = prog; } virtual void setAppName(const TQString& prog) { mProgName[0] = prog; }
QString appClass(void) const { return mClass; } TQString appClass(void) const { return mClass; }
QString appTitle(void) const { return mTitle; } TQString appTitle(void) const { return mTitle; }
QPixmap appIcon(void) const { return mAppIcon; } TQPixmap appIcon(void) const { return mAppIcon; }
// Pass on all events through this interface // Pass on all events through this interface
bool x11EventFilter(XEvent * event); bool x11EventFilter(XEvent * event);
// Session Management // Session Management
virtual bool saveState(QSettings& settings); virtual bool saveState(TQSettings& settings);
virtual bool restoreState(QSettings& settings); virtual bool restoreState(TQSettings& settings);
public slots: public slots:
void dock(void); // puts us in the system tray void dock(void); // puts us in the system tray
@ -80,7 +80,7 @@ public slots:
void toggleShow(void) // convenience slot void toggleShow(void) // convenience slot
{ if (mWithdrawn) map(); else withdraw(); } { if (mWithdrawn) map(); else withdraw(); }
void close(void); // close the docked window 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 // and some property setters
virtual void setSkipTaskbar(bool skip); // skip the taskbar virtual void setSkipTaskbar(bool skip); // skip the taskbar
@ -91,20 +91,20 @@ protected slots:
void scanClients(void); // scans existing client connections void scanClients(void); // scans existing client connections
signals: signals:
void clicked(const ButtonState&, const QPoint&); void clicked(const ButtonState&, const TQPoint&);
void docked(QTrayLabel *); // emitted when we get docked void docked(TQTrayLabel *); // emitted when we get docked
void docked(void); // 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 void undocked(void); // emitted when we get undock
// window are monitoring dies // window are monitoring dies
void sysTrayDestroyed(void); // emitted when the system tray disappears void sysTrayDestroyed(void); // emitted when the system tray disappears
protected: protected:
// reimplement these event handlers in subclass as needed // reimplement these event handlers in subclass as needed
virtual void mouseReleaseEvent(QMouseEvent *event); virtual void mouseReleaseEvent(TQMouseEvent *event);
virtual void dragEnterEvent(QDragEnterEvent *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 updateIcon(void); // updates the icon
virtual void updateTitle(void); // sets the tooltip virtual void updateTitle(void); // sets the tooltip
virtual void balloonText(void); // balloons text virtual void balloonText(void); // balloons text
@ -140,19 +140,19 @@ private:
// Member variables // Member variables
long mDesktop; // desktop on which the window is being shown long mDesktop; // desktop on which the window is being shown
QLabel *mBalloon; // tooltip text simulator TQLabel *mBalloon; // tooltip text simulator
QString mCustomIcon; // CustomIcon of the docked application TQString mCustomIcon; // CustomIcon of the docked application
Window mDockedWindow; // the window which is being docked Window mDockedWindow; // the window which is being docked
int mBalloonTimeout; int mBalloonTimeout;
bool mDocked, mWithdrawn, mSkippingTaskbar; bool mDocked, mWithdrawn, mSkippingTaskbar;
bool mDockWhenMinimized; bool mDockWhenMinimized;
QString mTitle, mClass; // Title and hint of mDockedWindow TQString mTitle, mClass; // Title and hint of mDockedWindow
QPixmap mAppIcon; // The current app icon (may not be same as pixmap()) TQPixmap mAppIcon; // The current app icon (may not be same as pixmap())
XSizeHints mSizeHint; // SizeHint of mDockedWindow XSizeHints mSizeHint; // SizeHint of mDockedWindow
QTimer mRealityMonitor; // Helps us sync up with reality TQTimer mRealityMonitor; // Helps us sync up with reality
QStringList mProgName; // The program whose window we are docking TQStringList mProgName; // The program whose window we are docking
pid_t mPid; // The PID of program whose window we are docking pid_t mPid; // The PID of program whose window we are docking
Window mSysTray; // System tray window id Window mSysTray; // System tray window id

@ -1,12 +1,12 @@
#ifdef ENABLE_TRACING #ifdef ENABLE_TRACING
#include <qapplication.h> #include <tqapplication.h>
#include <qtextedit.h> #include <tqtextedit.h>
#include <qfile.h> #include <tqfile.h>
#include <stdio.h> #include <stdio.h>
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]); tracer->append(&msg[*msg == '~' ? 1 : 0]);
if (msg[0] != '~') if (msg[0] != '~')
@ -19,8 +19,8 @@ void TRACER(QtMsgType, const char *msg)
void INIT_TRACE() void INIT_TRACE()
{ {
if (tracer) return; // de javu if (tracer) return; // de javu
tracer = new QTextEdit(); tracer = new TQTextEdit();
tracer->setTextFormat(Qt::LogText); tracer->setTextFormat(TQt::LogText);
tracer->setMaxLogLines(10000); tracer->setMaxLogLines(10000);
tracer->resize(750, 300); tracer->resize(750, 300);
qInstallMsgHandler(TRACER); qInstallMsgHandler(TRACER);
@ -33,10 +33,10 @@ void SHOW_TRACE()
void DUMP_TRACE(const char *f) 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)) if (file.open(IO_WriteOnly))
{ {
QTextStream stream(&file); TQTextStream stream(&file);
stream << tracer->text(); stream << tracer->text();
} }
} }

@ -12,7 +12,7 @@
* WARNING: fmt has to be a static string * WARNING: fmt has to be a static string
*/ */
#define TRACE(fmt,args...) \ #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" #define SHOW_TRACE_TEXT "Show Trace"
@ -21,7 +21,7 @@
#define INIT_TRACE() #define INIT_TRACE()
#define TRACE(fmt, ...) #define TRACE(fmt, ...)
#define SHOW_TRACE() #define SHOW_TRACE()
#define SHOW_TRACE_TEXT QString::null #define SHOW_TRACE_TEXT TQString::null
#define DUMP_TRACE(file) #define DUMP_TRACE(file)
#endif // ENABLE_TRACING #endif // ENABLE_TRACING

@ -19,15 +19,15 @@
// $Id: traylabelmgr.cpp,v 1.10 2005/02/09 03:38:43 cs19713 Exp $ // $Id: traylabelmgr.cpp,v 1.10 2005/02/09 03:38:43 cs19713 Exp $
#include <qdir.h> #include <tqdir.h>
#include <qapplication.h> #include <tqapplication.h>
#include <qmessagebox.h> #include <tqmessagebox.h>
#include <qtimer.h> #include <tqtimer.h>
#include <qfile.h> #include <tqfile.h>
#include <qaction.h> #include <tqaction.h>
#include <qpopupmenu.h> #include <tqpopupmenu.h>
#include <qtextstream.h> #include <tqtextstream.h>
#include <qfiledialog.h> #include <tqfiledialog.h>
#include <klocale.h> #include <klocale.h>
@ -52,7 +52,7 @@ TrayLabelMgr* TrayLabelMgr::instance(void)
TrayLabelMgr::TrayLabelMgr() : mReady(false), mHiddenLabelsCount(0) TrayLabelMgr::TrayLabelMgr() : mReady(false), mHiddenLabelsCount(0)
{ {
// Set ourselves up to be called from the application loop // Set ourselves up to be called from the application loop
QTimer::singleShot(0, this, SLOT(startup())); TQTimer::singleShot(0, this, SLOT(startup()));
} }
TrayLabelMgr::~TrayLabelMgr() TrayLabelMgr::~TrayLabelMgr()
@ -62,11 +62,11 @@ TrayLabelMgr::~TrayLabelMgr()
void TrayLabelMgr::about(void) 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" i18n("Bugs/wishes to Girish Ramakrishnan (gramakri@uiuc.edu)\n"
"English translation by Girish (gramakri@uiuc.edu)\n\n" "English translation by Girish (gramakri@uiuc.edu)\n\n"
"http://kdocker.sourceforge.net for updates"), "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) 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 * stdout is a tty) OR if we are getting restored, wait for WAIT_TIME until
* the system tray shows up (before informing the user) * 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 (state != SysTrayPresent)
{ {
if (wait_time-- > 0 && do_wait) if (wait_time-- > 0 && do_wait)
{ {
TRACE("Will check sys tray status after 1 second"); TRACE("Will check sys tray status after 1 second");
QTimer::singleShot(1000, this, SLOT(startup())); TQTimer::singleShot(1000, this, SLOT(startup()));
return; return;
} }
if (QMessageBox::warning(NULL, i18n("KDocker"), if (TQMessageBox::warning(NULL, i18n("KDocker"),
i18n(state == SysTrayAbsent ? "No system tray found" i18n(state == SysTrayAbsent ? "No system tray found"
: "System tray appears to be hidden"), : "System tray appears to be hidden"),
QMessageBox::Abort, QMessageBox::Ignore) == QMessageBox::Abort) TQMessageBox::Abort, TQMessageBox::Ignore) == TQMessageBox::Abort)
{ {
qApp->quit(); tqApp->quit();
return; return;
} }
} }
@ -104,34 +104,34 @@ void TrayLabelMgr::startup(void)
// Things are fine or user with OK with the state of system tray // Things are fine or user with OK with the state of system tray
mReady = true; mReady = true;
bool ok = false; bool ok = false;
if (qApp->isSessionRestored()) ok = restoreSession(qApp->sessionId()); if (tqApp->isSessionRestored()) ok = restoreSession(tqApp->sessionId());
else ok = processCommand(qApp->argc(), qApp->argv()); else ok = processCommand(tqApp->argc(), tqApp->argv());
// Process the request Q from previous instances // Process the request Q from previous instances
TRACE("Request queue has %i requests", mRequestQ.count()); TRACE("Request queue has %i requests", mRequestQ.count());
for(unsigned i=0; i < mRequestQ.count(); i++) for(unsigned i=0; i < mRequestQ.count(); i++)
ok |= processCommand(mRequestQ[i]); ok |= processCommand(mRequestQ[i]);
if (!ok) qApp->quit(); if (!ok) tqApp->quit();
} }
// Initialize a QTrayLabel after its creation // Initialize a TQTrayLabel after its creation
void TrayLabelMgr::manageTrayLabel(QTrayLabel *t) void TrayLabelMgr::manageTrayLabel(TQTrayLabel *t)
{ {
connect(t, SIGNAL(destroyed(QObject *)), connect(t, SIGNAL(destroyed(TQObject *)),
this, SLOT(trayLabelDestroyed(QObject *))); this, SLOT(trayLabelDestroyed(TQObject *)));
connect(t, SIGNAL(undocked(QTrayLabel *)), t, SLOT(deleteLater())); 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) if (mTrayLabels.count() == 0)
connect(t, SIGNAL(sysTrayDestroyed()), this, SLOT(sysTrayDestroyed())); connect(t, SIGNAL(sysTrayDestroyed()), this, SLOT(sysTrayDestroyed()));
mTrayLabels.prepend(t); mTrayLabels.prepend(t);
TRACE("New QTrayLabel prepended. Count=%i", mTrayLabels.count()); TRACE("New TQTrayLabel prepended. Count=%i", mTrayLabels.count());
} }
void TrayLabelMgr::dockAnother() void TrayLabelMgr::dockAnother()
{ {
QTrayLabel *t = selectAndDock(); TQTrayLabel *t = selectAndDock();
if (t == NULL) return; if (t == NULL) return;
manageTrayLabel(t); manageTrayLabel(t);
t->withdraw(); t->withdraw();
@ -142,8 +142,8 @@ void TrayLabelMgr::dockAnother()
void TrayLabelMgr::undockAll() void TrayLabelMgr::undockAll()
{ {
TRACE("Number of tray labels = %i", mTrayLabels.count()); TRACE("Number of tray labels = %i", mTrayLabels.count());
QPtrListIterator<QTrayLabel> it(mTrayLabels); TQPtrListIterator<TQTrayLabel> it(mTrayLabels);
QTrayLabel *t; TQTrayLabel *t;
while ((t = it.current()) != 0) while ((t = it.current()) != 0)
{ {
++it; ++it;
@ -152,7 +152,7 @@ void TrayLabelMgr::undockAll()
} }
// Process the command line // Process the command line
bool TrayLabelMgr::processCommand(const QStringList& args) bool TrayLabelMgr::processCommand(const TQStringList& args)
{ {
if (!mReady) if (!mReady)
{ {
@ -186,7 +186,7 @@ bool TrayLabelMgr::processCommand(int argc, char** argv)
if (qstrcmp(argv[1], "-session") == 0) if (qstrcmp(argv[1], "-session") == 0)
{ {
TRACE("Restoring session %s (new instance request)", argv[2]); TRACE("Restoring session %s (new instance request)", argv[2]);
return restoreSession(QString(argv[2])); return restoreSession(TQString(argv[2]));
} }
int option; int option;
@ -206,7 +206,7 @@ bool TrayLabelMgr::processCommand(int argc, char** argv)
case '?': case '?':
return false; return false;
case 'a': case 'a':
qDebug("%s", i18n("Girish Ramakrishnan (gramakri@uiuc.edu)").local8Bit().data()); tqDebug("%s", i18n("Girish Ramakrishnan (gramakri@uiuc.edu)").local8Bit().data());
return false; return false;
case 'b': case 'b':
check_normality = false; check_normality = false;
@ -218,7 +218,7 @@ bool TrayLabelMgr::processCommand(int argc, char** argv)
enable_sm = true; enable_sm = true;
break; break;
case 'f': case 'f':
w = activeWindow(QPaintDevice::x11AppDisplay()); w = activeWindow(TQPaintDevice::x11AppDisplay());
TRACE("Active window is %i", (unsigned) w); TRACE("Active window is %i", (unsigned) w);
break; break;
case 'i': case 'i':
@ -247,9 +247,9 @@ bool TrayLabelMgr::processCommand(int argc, char** argv)
sscanf(optarg, "%x", (unsigned *) &w); sscanf(optarg, "%x", (unsigned *) &w);
else else
w = (Window) atoi(optarg); 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; return false;
} }
break; break;
@ -277,32 +277,32 @@ bool TrayLabelMgr::processCommand(int argc, char** argv)
/* /*
* Request user to make a window selection if necessary. Dock the window. * 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) if (w == None)
{ {
qDebug("%s", i18n("Select the application/window to dock with button1.").local8Bit().data()); tqDebug("%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("Click any other button to abort\n").local8Bit().data());
const char *err = NULL; 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; 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 * Abort should be the only option here really. "Ignore" is provided here
* for the curious user who wants to screw himself very badly * 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" i18n("The window you are attempting to dock does not seem to be a"
" normal window."), QMessageBox::Abort, " normal window."), TQMessageBox::Abort,
QMessageBox::Ignore) == QMessageBox::Abort) TQMessageBox::Ignore) == TQMessageBox::Abort)
return NULL; return NULL;
} }
@ -310,7 +310,7 @@ QTrayLabel *TrayLabelMgr::selectAndDock(Window w, bool checkNormality)
TRACE("0x%x is not docked", (unsigned) w); TRACE("0x%x is not docked", (unsigned) w);
QMessageBox::message(i18n("KDocker"), TQMessageBox::message(i18n("KDocker"),
i18n("This window is already docked.\n" i18n("This window is already docked.\n"
"Click on system tray icon to toggle docking.")); "Click on system tray icon to toggle docking."));
return NULL; return NULL;
@ -318,8 +318,8 @@ QTrayLabel *TrayLabelMgr::selectAndDock(Window w, bool checkNormality)
bool TrayLabelMgr::isWindowDocked(Window w) bool TrayLabelMgr::isWindowDocked(Window w)
{ {
QPtrListIterator<QTrayLabel> it(mTrayLabels); TQPtrListIterator<TQTrayLabel> it(mTrayLabels);
for(QTrayLabel *t; (t = it.current()); ++it) for(TQTrayLabel *t; (t = it.current()); ++it)
if (t->dockedWindow() == w) return true; if (t->dockedWindow() == w) return true;
return false; return false;
@ -330,7 +330,7 @@ bool TrayLabelMgr::isWindowDocked(Window w)
* notifications (for MapEvent on children). We will monitor these new windows * notifications (for MapEvent on children). We will monitor these new windows
* to make a pid to wid mapping (see HACKING for more details) * 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; pid_t pid = -1;
int filedes[2]; int filedes[2];
@ -338,9 +338,9 @@ QTrayLabel *TrayLabelMgr::dockApplication(char *argv[])
/* /*
* The pipe created here serves as a synchronization mechanism between the * 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 * 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); pipe(filedes);
@ -352,7 +352,7 @@ QTrayLabel *TrayLabelMgr::dockApplication(char *argv[])
if (execvp(argv[0], argv) == -1) 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 :( ::exit(0); // will become a zombie in some systems :(
return NULL; return NULL;
} }
@ -360,17 +360,17 @@ QTrayLabel *TrayLabelMgr::dockApplication(char *argv[])
if (pid == -1) if (pid == -1)
{ {
QMessageBox::critical(NULL, "KDocker", TQMessageBox::critical(NULL, "KDocker",
i18n("Failed to fork: %1").arg(strerror(errno))); i18n("Failed to fork: %1").arg(strerror(errno)));
return NULL; return NULL;
} }
QStringList cmd_line; TQStringList cmd_line;
for(int i=0;;i++) for(int i=0;;i++)
if (argv[i]) cmd_line << argv[i]; else break; if (argv[i]) cmd_line << argv[i]; else break;
QTrayLabel *label = new CustomTrayLabel(cmd_line, pid); TQTrayLabel *label = new CustomTrayLabel(cmd_line, pid);
qApp->syncX(); tqApp->syncX();
write(filedes[1], buf, sizeof(buf)); write(filedes[1], buf, sizeof(buf));
close(filedes[0]); close(filedes[0]);
close(filedes[1]); 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 * System Tray
*/ */
int TrayLabelMgr::hiddenLabelsCount(void) const int TrayLabelMgr::hiddenLabelsCount(void) const
{ {
QPtrListIterator<QTrayLabel> it(mTrayLabels); TQPtrListIterator<TQTrayLabel> it(mTrayLabels);
int count = 0; int count = 0;
for(QTrayLabel *t; (t=it.current()); ++it) for(TQTrayLabel *t; (t=it.current()); ++it)
if (t->dockedWindow() == None) ++count; if (t->dockedWindow() == None) ++count;
return count; return count;
} }
@ -396,11 +396,11 @@ int TrayLabelMgr::dockedLabelsCount(void) const
return mTrayLabels.count() - hiddenLabelsCount(); return mTrayLabels.count() - hiddenLabelsCount();
} }
void TrayLabelMgr::trayLabelDestroyed(QObject *t) void TrayLabelMgr::trayLabelDestroyed(TQObject *t)
{ {
bool reconnect = ((QObject *)mTrayLabels.getLast() == t); bool reconnect = ((TQObject *)mTrayLabels.getLast() == t);
mTrayLabels.removeRef((QTrayLabel*)t); mTrayLabels.removeRef((TQTrayLabel*)t);
if (mTrayLabels.isEmpty()) qApp->quit(); if (mTrayLabels.isEmpty()) tqApp->quit();
else if (reconnect) else if (reconnect)
{ {
TRACE("Reconnecting"); 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 * to not pop up a box when the user is logging out. So, we set ourselves
* up to notify user after 3 seconds. * up to notify user after 3 seconds.
*/ */
QTimer::singleShot(3000, this, SLOT(notifySysTrayAbsence())); TQTimer::singleShot(3000, this, SLOT(notifySysTrayAbsence()));
} }
void TrayLabelMgr::notifySysTrayAbsence() void TrayLabelMgr::notifySysTrayAbsence()
{ {
SysTrayState state = sysTrayStatus(QPaintDevice::x11AppDisplay()); SysTrayState state = sysTrayStatus(TQPaintDevice::x11AppDisplay());
if (state == SysTrayPresent) if (state == SysTrayPresent)
return; // So sweet of the systray to come back so soon 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("The System tray was hidden or removed"),
i18n("Undock All"), i18n("Ignore")) == 0) i18n("Undock All"), i18n("Ignore")) == 0)
undockAll(); undockAll();
@ -436,30 +436,30 @@ void TrayLabelMgr::notifySysTrayAbsence()
/* /*
* Session Management. Always return "true". Atleast, for now * 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; TQSettings settings;
settings.beginGroup(QString("/" + session_file)); settings.beginGroup(TQString("/" + session_file));
for(int i = 1;; i++) for(int i = 1;; i++)
{ {
settings.beginGroup(QString("/Instance") + QString("").setNum(i)); settings.beginGroup(TQString("/Instance") + TQString("").setNum(i));
QString pname = settings.readEntry("/Application"); TQString pname = settings.readEntry("/Application");
TRACE("Restoring Application[%s]", pname.latin1()); TRACE("Restoring Application[%s]", pname.latin1());
if (pname.isEmpty()) break; if (pname.isEmpty()) break;
if (settings.readBoolEntry("/LaunchOnStartup")) if (settings.readBoolEntry("/LaunchOnStartup"))
{ {
QStringList args("kdocker"); TQStringList args("kdocker");
args += QStringList::split(" ", pname); args += TQStringList::split(" ", pname);
TRACE("Triggering AutoLaunch"); TRACE("Triggering AutoLaunch");
if (!processCommand(args)) continue; if (!processCommand(args)) continue;
} }
else 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); tl->restoreState(settings);
settings.endGroup(); settings.endGroup();
} }
@ -467,51 +467,51 @@ bool TrayLabelMgr::restoreSession(const QString& sessionId)
return true; return true;
} }
QString TrayLabelMgr::saveSession(void) TQString TrayLabelMgr::saveSession(void)
{ {
QString session_file = "kdocker_" + qApp->sessionId(); TQString session_file = "kdocker_" + tqApp->sessionId();
QSettings settings; TQSettings settings;
settings.beginGroup(QString("/" + session_file)); settings.beginGroup(TQString("/" + session_file));
TRACE("Saving session"); TRACE("Saving session");
QPtrListIterator <QTrayLabel> it(mTrayLabels); TQPtrListIterator <TQTrayLabel> it(mTrayLabels);
QTrayLabel *t; TQTrayLabel *t;
int i = 1; int i = 1;
while ((t = it.current()) != 0) while ((t = it.current()) != 0)
{ {
++it; ++it;
TRACE("Saving instance %i", i); TRACE("Saving instance %i", i);
settings.beginGroup(QString("/Instance") + QString("").setNum(i)); settings.beginGroup(TQString("/Instance") + TQString("").setNum(i));
bool ok = t->saveState(settings); bool ok = t->saveState(settings);
settings.endGroup(); settings.endGroup();
if (ok) ++i; else TRACE("Saving of instance %i was skipped", i); if (ok) ++i; else TRACE("Saving of instance %i was skipped", i);
} }
// Aaaaaaaaaaaaaa......... // 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. * The logic and the code below is a bit fuzzy.
* a) Events about windows that are being docked need to be processed only by * 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 * b) Events about windows that are not docked but of interest (like
* SystemTray) need to be passed on to all QTrayLabel objects. * SystemTray) need to be passed on to all TQTrayLabel objects.
* c) When a QTrayLabel manages to find the window that is was looking for, we * c) When a TQTrayLabel manages to find the window that is was looking for, we
* need not process the event further * need not process the event further
*/ */
bool TrayLabelMgr::x11EventFilter(XEvent *ev) bool TrayLabelMgr::x11EventFilter(XEvent *ev)
{ {
QPtrListIterator<QTrayLabel> it(mTrayLabels); TQPtrListIterator<TQTrayLabel> it(mTrayLabels);
bool ret = false; bool ret = false;
// We pass on the event to all tray labels // 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(); Window w = t->dockedWindow();
bool res = t->x11EventFilter(ev); bool res = t->x11EventFilter(ev);

@ -21,29 +21,29 @@
#ifndef _TRAYLABELMGR_H #ifndef _TRAYLABELMGR_H
#define _TRAYLABELMGR_H #define _TRAYLABELMGR_H
#include <qobject.h> #include <tqobject.h>
#include <qptrlist.h> #include <tqptrlist.h>
#include <qvaluelist.h> #include <tqvaluelist.h>
#include <qstringlist.h> #include <tqstringlist.h>
#include "customtraylabel.h" #include "customtraylabel.h"
class CustomTrayLabel; class CustomTrayLabel;
class TrayLabelMgr : public QObject class TrayLabelMgr : public TQObject
{ {
Q_OBJECT Q_OBJECT
public: public:
static TrayLabelMgr* instance(); static TrayLabelMgr* instance();
static QString options(void) { return QString(mOptionString); } static TQString options(void) { return TQString(mOptionString); }
~TrayLabelMgr(); ~TrayLabelMgr();
QString saveSession(); TQString saveSession();
bool x11EventFilter(XEvent *); bool x11EventFilter(XEvent *);
bool processCommand(const QStringList& argv); bool processCommand(const TQStringList& argv);
int hiddenLabelsCount(void) const; int hiddenLabelsCount(void) const;
int dockedLabelsCount(void) const; int dockedLabelsCount(void) const;
bool isWindowDocked(Window w); bool isWindowDocked(Window w);
@ -55,21 +55,21 @@ public slots:
private slots: private slots:
void startup(); void startup();
void trayLabelDestroyed(QObject *); void trayLabelDestroyed(TQObject *);
void sysTrayDestroyed(void); void sysTrayDestroyed(void);
void notifySysTrayAbsence(); void notifySysTrayAbsence();
private: private:
TrayLabelMgr(); TrayLabelMgr();
bool processCommand(int argc, char** argv); bool processCommand(int argc, char** argv);
void manageTrayLabel(QTrayLabel *l); void manageTrayLabel(TQTrayLabel *l);
bool restoreSession(const QString& sessionId); bool restoreSession(const TQString& sessionId);
QTrayLabel *dockApplication(char *argv[]); TQTrayLabel *dockApplication(char *argv[]);
QTrayLabel *selectAndDock(Window w = None, bool checkNormality = true); TQTrayLabel *selectAndDock(Window w = None, bool checkNormality = true);
QPtrList<QTrayLabel> mTrayLabels; TQPtrList<TQTrayLabel> mTrayLabels;
QValueList<QStringList> mRequestQ; TQValueList<TQStringList> mRequestQ;
bool mReady; bool mReady;
int mHiddenLabelsCount; int mHiddenLabelsCount;

@ -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 * The Grand Window Analyzer. Checks if window w has a expected pid of epid
* or a expected name of ename * 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; XClassHint ch;
pid_t apid = pid(display, w); 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 // lets try the program name
if (XGetClassHint(display, w, &ch)) 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); TRACE("ResName [%s] matched", ch.res_name);
this_is_our_man = true; 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); TRACE("ResClass [%s] matched", ch.res_class);
this_is_our_man = true; this_is_our_man = true;
@ -192,7 +192,7 @@ bool analyzeWindow(Display *display, Window w, pid_t epid, const QString &ename)
// sheer desperation // sheer desperation
char *wm_name = NULL; char *wm_name = NULL;
XFetchName(display, w, &wm_name); 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); TRACE("WM_NAME [%s] matched", wm_name);
this_is_our_man = true; this_is_our_man = true;

@ -22,7 +22,7 @@
#ifndef _UTIL_H #ifndef _UTIL_H
#define _UTIL_H #define _UTIL_H
#include <qstring.h> #include <tqstring.h>
#include <X11/Xlib.h> #include <X11/Xlib.h>
#include <sys/types.h> #include <sys/types.h>
@ -32,7 +32,7 @@ extern pid_t pid(Display *display, Window w);
extern void sendMessage(Display *display, Window to, Window w, char *type, extern void sendMessage(Display *display, Window to, Window w, char *type,
int format, long mask, void *data, int size); int format, long mask, void *data, int size);
extern bool analyzeWindow(Display *display, Window w, pid_t epid, extern bool analyzeWindow(Display *display, Window w, pid_t epid,
const QString &ename); const TQString &ename);
extern Window activeWindow(Display *display); extern Window activeWindow(Display *display);
extern Window selectWindow(Display *display, const char **err = 0); extern Window selectWindow(Display *display, const char **err = 0);
extern void subscribe(Display *display, Window w, long mask, bool set); extern void subscribe(Display *display, Window w, long mask, bool set);

Loading…
Cancel
Save