summaryrefslogtreecommitdiffstats
path: root/src/customtraylabel.cpp
diff options
context:
space:
mode:
authorSlávek Banko <slavek.banko@axis.cz>2018-09-06 02:04:50 +0200
committerSlávek Banko <slavek.banko@axis.cz>2018-09-06 02:04:50 +0200
commit1a36f79cf4aedaad3ce55e1ed79bde71d19141b3 (patch)
treef643d506ae1f945ac0b4b0b4b8dea6662d08b57e /src/customtraylabel.cpp
parent9cbe9f0f8b67fc7d0f158ee4d74956c932c76b8b (diff)
downloadtdedocker-1a36f79cf4aedaad3ce55e1ed79bde71d19141b3.tar.gz
tdedocker-1a36f79cf4aedaad3ce55e1ed79bde71d19141b3.zip
Initial TQt conversion
Signed-off-by: Slávek Banko <slavek.banko@axis.cz>
Diffstat (limited to 'src/customtraylabel.cpp')
-rw-r--r--src/customtraylabel.cpp106
1 files changed, 53 insertions, 53 deletions
diff --git a/src/customtraylabel.cpp b/src/customtraylabel.cpp
index 757df2f..abf02c1 100644
--- a/src/customtraylabel.cpp
+++ b/src/customtraylabel.cpp
@@ -19,14 +19,14 @@
// $Id: customtraylabel.cpp,v 1.14 2005/06/21 10:04:35 cs19713 Exp $
-#include <qsettings.h>
-#include <qpopupmenu.h>
-#include <qmessagebox.h>
-#include <qfiledialog.h>
-#include <qinputdialog.h>
-#include <qaction.h>
-#include <qtimer.h>
-#include <qsize.h>
+#include <tqsettings.h>
+#include <tqpopupmenu.h>
+#include <tqmessagebox.h>
+#include <tqfiledialog.h>
+#include <tqinputdialog.h>
+#include <tqaction.h>
+#include <tqtimer.h>
+#include <tqsize.h>
#include <stdlib.h>
#include <kiconloader.h>
@@ -38,15 +38,15 @@
#include "traylabelmgr.h"
#include "kdocker.h"
-CustomTrayLabel::CustomTrayLabel(Window w, QWidget* p, const QString& t)
- : QTrayLabel(w, p, t), mUndockWhenDead(false)
+CustomTrayLabel::CustomTrayLabel(Window w, TQWidget* p, const TQString& t)
+ : TQTrayLabel(w, p, t), mUndockWhenDead(false)
{
installMenu();
}
-CustomTrayLabel::CustomTrayLabel(const QStringList& argv, pid_t pid,
- QWidget* parent)
- : QTrayLabel(argv, pid, parent), mUndockWhenDead(false)
+CustomTrayLabel::CustomTrayLabel(const TQStringList& argv, pid_t pid,
+ TQWidget* parent)
+ : TQTrayLabel(argv, pid, parent), mUndockWhenDead(false)
{
installMenu();
}
@@ -56,18 +56,18 @@ CustomTrayLabel::CustomTrayLabel(const QStringList& argv, pid_t pid,
*/
void CustomTrayLabel::installMenu()
{
- QPixmap kdocker_png(KGlobal::iconLoader()->loadIcon("kdocker", KIcon::NoGroup, KIcon::SizeSmall));
+ TQPixmap kdocker_png(KGlobal::iconLoader()->loadIcon("kdocker", KIcon::NoGroup, KIcon::SizeSmall));
setIcon(kdocker_png);
TrayLabelMgr *tlMgr = TrayLabelMgr::instance();
- mOptionsMenu = new QPopupMenu(this);
- mSessionManagement = new QAction(i18n("Dock when session restored"), 0, this);
+ mOptionsMenu = new TQPopupMenu(this);
+ mSessionManagement = new TQAction(i18n("Dock when session restored"), 0, this);
mSessionManagement->setToggleAction(true);
connect(mSessionManagement, SIGNAL(toggled(bool)),
this, SLOT(enableSessionManagement(bool)));
mSessionManagement->addTo(mOptionsMenu);
- mAutoLaunch = new QAction(i18n("Launch on startup"), 0, this);
+ mAutoLaunch = new TQAction(i18n("Launch on startup"), 0, this);
mAutoLaunch->setToggleAction(true);
connect(mAutoLaunch, SIGNAL(activated()),
this, SLOT(slotSetLaunchOnStartup()));
@@ -75,37 +75,37 @@ void CustomTrayLabel::installMenu()
mOptionsMenu->insertItem(i18n("Set Icon"), this, SLOT(setCustomIcon()));
- mBalloonTimeout = new QAction(i18n("Set balloon timeout"), 0, this);
+ mBalloonTimeout = new TQAction(i18n("Set balloon timeout"), 0, this);
connect(mBalloonTimeout, SIGNAL(activated()),
this, SLOT(slotSetBalloonTimeout()));
mBalloonTimeout->addTo(mOptionsMenu);
- mDockWhenObscured = new QAction(i18n("Dock when obscured"), 0, this);
+ mDockWhenObscured = new TQAction(i18n("Dock when obscured"), 0, this);
mDockWhenObscured->setToggleAction(true);
connect(mDockWhenObscured, SIGNAL(toggled(bool)),
this, SLOT(setDockWhenObscured(bool)));
mDockWhenObscured->addTo(mOptionsMenu);
- mDockWhenMinimized = new QAction(i18n("Dock when minimized"), 0, this);
+ mDockWhenMinimized = new TQAction(i18n("Dock when minimized"), 0, this);
mDockWhenMinimized->setToggleAction(true);
connect(mDockWhenMinimized, SIGNAL(toggled(bool)),
this, SLOT(setDockWhenMinimized(bool)));
mDockWhenMinimized->addTo(mOptionsMenu);
- mDockWhenFocusLost = new QAction(i18n("Dock when focus lost"), 0, this);
+ mDockWhenFocusLost = new TQAction(i18n("Dock when focus lost"), 0, this);
mDockWhenFocusLost->setToggleAction(true);
connect(mDockWhenFocusLost, SIGNAL(toggled(bool)),
this, SLOT(setDockWhenFocusLost(bool)));
mDockWhenFocusLost->addTo(mOptionsMenu);
- mSkipTaskbar = new QAction(i18n("Skip taskbar"), 0, this);
+ mSkipTaskbar = new TQAction(i18n("Skip taskbar"), 0, this);
mSkipTaskbar->setToggleAction(true);
connect(mSkipTaskbar, SIGNAL(toggled(bool)),
this, SLOT(setSkipTaskbar(bool)));
mSkipTaskbar->addTo(mOptionsMenu);
- mMainMenu = new QPopupMenu(this);
- mMainMenu->insertItem(QIconSet(kdocker_png),
+ mMainMenu = new TQPopupMenu(this);
+ mMainMenu->insertItem(TQIconSet(kdocker_png),
i18n("About KDocker"), tlMgr, SLOT(about()));
mMainMenu->insertSeparator();
mMainMenu->insertItem(i18n("Options"), mOptionsMenu);
@@ -113,10 +113,10 @@ void CustomTrayLabel::installMenu()
mMainMenu->insertItem(i18n("Undock All"), tlMgr, SLOT(undockAll()));
mMainMenu->insertSeparator();
- mShowId = mMainMenu->insertItem(QString("Show/Hide [untitled]"),
+ mShowId = mMainMenu->insertItem(TQString("Show/Hide [untitled]"),
this, SLOT(toggleShow()));
- mMainMenu->insertItem(QString(i18n("Undock")), this, SLOT(undock()));
- mMainMenu->insertItem(QString(i18n("Close")), this, SLOT(close()));
+ mMainMenu->insertItem(TQString(i18n("Undock")), this, SLOT(undock()));
+ mMainMenu->insertItem(TQString(i18n("Close")), this, SLOT(close()));
connect(mMainMenu, SIGNAL(aboutToShow()), this, SLOT(updateMenu()));
@@ -132,20 +132,20 @@ void CustomTrayLabel::installMenu()
/*
* Session Management
*/
-bool CustomTrayLabel::restoreState(QSettings& settings)
+bool CustomTrayLabel::restoreState(TQSettings& settings)
{
mAutoLaunch->setOn(settings.readBoolEntry("/LaunchOnStartup"));
setDockWhenObscured(settings.readBoolEntry("/DockWhenObscured"));
TRACE("AutoLaunch=%i DWM=%i DWO=%i", isLaunchOnStartup(),
isDockWhenMinimized(), isDockWhenObscured());
- return QTrayLabel::restoreState(settings);
+ return TQTrayLabel::restoreState(settings);
}
-bool CustomTrayLabel::saveState(QSettings& settings)
+bool CustomTrayLabel::saveState(TQSettings& settings)
{
if (!mSessionManagement->isOn()) return false;
- QTrayLabel::saveState(settings);
+ TQTrayLabel::saveState(settings);
settings.writeEntry("/LaunchOnStartup", isLaunchOnStartup());
settings.writeEntry("/DockWhenObscured", isDockWhenObscured());
TRACE("AutoLaunch=%i DWM=%i DWO=%i", isLaunchOnStartup(),
@@ -177,23 +177,23 @@ static bool which(const char *app)
// Overridden to update our menu
void CustomTrayLabel::setDockWhenMinimized(bool dwm)
{
- QTrayLabel::setDockWhenMinimized(dwm);
+ TQTrayLabel::setDockWhenMinimized(dwm);
mDockWhenMinimized->setOn(isDockWhenMinimized());
}
void CustomTrayLabel::setSkipTaskbar(bool skip)
{
- QTrayLabel::setSkipTaskbar(skip);
+ TQTrayLabel::setSkipTaskbar(skip);
mSkipTaskbar->setOn(isSkippingTaskbar());
}
-void CustomTrayLabel::setAppName(const QString& name)
+void CustomTrayLabel::setAppName(const TQString& name)
{
- QTrayLabel::setAppName(name.lower());
+ TQTrayLabel::setAppName(name.lower());
}
/*
- * This function is called when QTrayLabel wants to know whether it can
+ * This function is called when TQTrayLabel wants to know whether it can
* unsubscribe from root window. This is because it doesnt know if someone
* else is interested in root window events
*/
@@ -205,16 +205,16 @@ bool CustomTrayLabel::canUnsubscribeFromRoot(void)
// Get icon from user, load it and if successful load it.
void CustomTrayLabel::setCustomIcon(void)
{
- QString icon;
+ TQString icon;
while (true)
{
// Nag the user to give us a valid icon or press cancel
- icon = QFileDialog::getOpenFileName();
+ icon = TQFileDialog::getOpenFileName();
if (icon.isNull()) return; // user cancelled
- if (!QPixmap(icon).isNull()) break;
+ if (!TQPixmap(icon).isNull()) break;
TRACE("Attempting to set icon to %s", icon.latin1());
- QMessageBox::critical(this, i18n("KDocker"),
+ TQMessageBox::critical(this, i18n("KDocker"),
i18n("%1 is not a valid icon").arg(icon));
}
@@ -225,7 +225,7 @@ void CustomTrayLabel::setCustomIcon(void)
void CustomTrayLabel::slotSetBalloonTimeout(void)
{
bool ok;
- int timeout = QInputDialog::getInteger(i18n("KDocker"),
+ int timeout = TQInputDialog::getInteger(i18n("KDocker"),
i18n("Enter balloon timeout (secs). 0 to disable ballooning"),
balloonTimeout()/1000, 0, 60, 1, &ok);
@@ -243,7 +243,7 @@ void CustomTrayLabel::slotSetLaunchOnStartup()
{
TRACE("%i", mAutoLaunch->isOn());
if (!mAutoLaunch->isOn()) return;
- QString app = appName();
+ TQString app = appName();
TRACE("Validating %s", app.latin1());
@@ -258,7 +258,7 @@ void CustomTrayLabel::slotSetLaunchOnStartup()
}
// Request user to provide file name himself
- if (QMessageBox::critical(NULL, i18n("KDocker"),
+ if (TQMessageBox::critical(NULL, i18n("KDocker"),
i18n("\"%1\" is not a valid executable "
"or was not found in your $PATH").arg(app),
i18n("Select program"), i18n("Cancel")) == 1)
@@ -267,7 +267,7 @@ void CustomTrayLabel::slotSetLaunchOnStartup()
return; // cancelled
}
- app = QFileDialog::getOpenFileName();
+ app = TQFileDialog::getOpenFileName();
if (app.isNull())
{
TRACE("Disabling auto launch");
@@ -280,9 +280,9 @@ void CustomTrayLabel::slotSetLaunchOnStartup()
// Called when we are just about to display the menu
void CustomTrayLabel::updateMenu(void)
{
- QString title = appClass(); // + "(" + appTitle() + ")";
- mMainMenu->changeItem(mShowId, QIconSet(*pixmap()),
- QString((isWithdrawn() ? i18n("Show %1") : i18n("Hide %1")).arg(title)));
+ TQString title = appClass(); // + "(" + appTitle() + ")";
+ mMainMenu->changeItem(mShowId, TQIconSet(*pixmap()),
+ TQString((isWithdrawn() ? i18n("Show %1") : i18n("Hide %1")).arg(title)));
}
void CustomTrayLabel::mapEvent(void)
@@ -295,7 +295,7 @@ void CustomTrayLabel::mapEvent(void)
* the window. So we disable it for sometime and reanable.
*/
mDockWhenObscured->setOn(false);
- QTimer::singleShot(800, mDockWhenObscured, SLOT(toggle()));
+ TQTimer::singleShot(800, mDockWhenObscured, SLOT(toggle()));
TRACE("Turning off DWO for some time");
}
}
@@ -312,9 +312,9 @@ void CustomTrayLabel::focusLostEvent()
if (mDockWhenFocusLost->isOn()) withdraw();
}
-void CustomTrayLabel::mouseReleaseEvent(QMouseEvent * ev)
+void CustomTrayLabel::mouseReleaseEvent(TQMouseEvent * ev)
{
- if (ev->button() == Qt::RightButton)
+ if (ev->button() == TQt::RightButton)
mMainMenu->popup(ev->globalPos());
else
toggleShow();
@@ -323,7 +323,7 @@ void CustomTrayLabel::mouseReleaseEvent(QMouseEvent * ev)
void CustomTrayLabel::destroyEvent(void)
{
mUndockWhenDead = true;
- QTrayLabel::destroyEvent();
+ TQTrayLabel::destroyEvent();
}
void CustomTrayLabel::processDead(void)
@@ -353,9 +353,9 @@ bool CustomTrayLabel::canDockWindow(Window w)
return !(TrayLabelMgr::instance()->isWindowDocked(w));
}
-void CustomTrayLabel::dropEvent(QDropEvent *)
+void CustomTrayLabel::dropEvent(TQDropEvent *)
{
- QMessageBox::information(NULL, "KDocker",
+ TQMessageBox::information(NULL, "KDocker",
i18n("You cannot drop an item into the tray icon. Drop it on the window\n"
"that is brought in front when you hover the item over the tray icon"));
}