summaryrefslogtreecommitdiffstats
path: root/src/customtraylabel.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/customtraylabel.cpp')
-rw-r--r--src/customtraylabel.cpp100
1 files changed, 38 insertions, 62 deletions
diff --git a/src/customtraylabel.cpp b/src/customtraylabel.cpp
index 5ad3459..a85f540 100644
--- a/src/customtraylabel.cpp
+++ b/src/customtraylabel.cpp
@@ -20,7 +20,6 @@
// $Id: customtraylabel.cpp,v 1.14 2005/06/21 10:04:35 cs19713 Exp $
#include <tqsettings.h>
-#include <tqpopupmenu.h>
#include <tdepopupmenu.h>
#include <tqfiledialog.h>
#include <tqinputdialog.h>
@@ -61,51 +60,38 @@ void CustomTrayLabel::installMenu()
TrayLabelMgr *tlMgr = TrayLabelMgr::instance();
mOptionsMenu = new TDEPopupMenu(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);
+ mSessionManagement = new TDEToggleAction(i18n("Dock when session restored"), 0, this);
+ connect(mSessionManagement, SIGNAL(toggled(bool)), this, SLOT(enableSessionManagement(bool)));
+ mSessionManagement->plug(mOptionsMenu);
mOptionsMenu->insertItem(i18n("Set Icon"), this, SLOT(setCustomIcon()));
- mBalloonTimeout = new TQAction(i18n("Set balloon timeout"), 0, this);
- connect(mBalloonTimeout, SIGNAL(activated()),
- this, SLOT(slotSetBalloonTimeout()));
- mBalloonTimeout->addTo(mOptionsMenu);
-
- 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 TQAction(i18n("Dock when minimized"), 0, this);
- mDockWhenMinimized->setToggleAction(true);
- connect(mDockWhenMinimized, SIGNAL(toggled(bool)),
- this, SLOT(setDockWhenMinimized(bool)));
- mDockWhenMinimized->addTo(mOptionsMenu);
-
- 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 TQAction(i18n("Skip taskbar"), 0, this);
- mSkipTaskbar->setToggleAction(true);
- connect(mSkipTaskbar, SIGNAL(toggled(bool)),
- this, SLOT(setSkipTaskbar(bool)));
- mSkipTaskbar->addTo(mOptionsMenu);
-
- mMainMenu = new TQPopupMenu(this);
+ mBalloonTimeout = new TDEAction(i18n("Set balloon timeout"), 0, this);
+ connect(mBalloonTimeout, SIGNAL(activated()), this, SLOT(slotSetBalloonTimeout()));
+ mBalloonTimeout->plug(mOptionsMenu);
+
+ mDockWhenObscured = new TDEToggleAction(i18n("Dock when obscured"), 0, this);
+ mDockWhenObscured->plug(mOptionsMenu);
+
+ mDockIfMinimized = new TDEToggleAction(i18n("Dock when minimized"), 0, this);
+ connect(mDockIfMinimized, SIGNAL(toggled(bool)), this, SLOT(setDockWhenMinimized(bool)));
+ mDockIfMinimized->plug(mOptionsMenu);
+
+ mDockWhenFocusLost = new TDEToggleAction(i18n("Dock when focus lost"), 0, this);
+ mDockWhenFocusLost->plug(mOptionsMenu);
+
+ mSkipTaskbar = new TDEToggleAction(i18n("Skip taskbar"), 0, this);
+ connect(mSkipTaskbar, SIGNAL(toggled(bool)), this, SLOT(setSkipTaskbar(bool)));
+ mSkipTaskbar->plug(mOptionsMenu);
+
+ mMainMenu = new TDEPopupMenu(this);
mMainMenu->insertItem(i18n("Options"), mOptionsMenu);
mMainMenu->insertItem(i18n("Dock Another"), tlMgr, SLOT(dockAnother()));
mMainMenu->insertItem(i18n("Undock All"), tlMgr, SLOT(undockAll()));
+ mMainMenu->insertItem(i18n("Quit All"), tlMgr, SLOT(quitAll()));
mMainMenu->insertSeparator();
- mShowId = mMainMenu->insertItem(TQString("Show/Hide [untitled]"),
- this, SLOT(toggleShow()));
+ mShowId = mMainMenu->insertItem(TQString("Show/Hide [untitled]"), this, SLOT(toggleShow()));
mMainMenu->insertItem(TQString(i18n("Undock")), this, SLOT(undock()));
mMainMenu->insertSeparator();
@@ -118,27 +104,27 @@ void CustomTrayLabel::installMenu()
// Apply defaults here
setDockWhenObscured(false);
enableSessionManagement(true);
- mDockWhenMinimized->setOn(isDockWhenMinimized());
- mSkipTaskbar->setOn(isSkippingTaskbar());
+ mDockIfMinimized->setChecked(isDockWhenMinimized());
+ mSkipTaskbar->setChecked(isSkippingTaskbar());
setAcceptDrops(true); // and you thought this function only installs the menu
}
void CustomTrayLabel::enableSessionManagement(bool sm)
{
- mSessionManagement->setOn(!appName().isEmpty() && sm);
+ mSessionManagement->setChecked(!appName().isEmpty() && sm);
}
// Session Management
bool CustomTrayLabel::restoreState(TDEConfig *config)
{
setDockWhenObscured(config->readBoolEntry("DockWhenObscured", false));
- TRACE("DWM=%i DWO=%i", isDockWhenMinimized(), isDockWhenObscured());
+ TRACE("DWM=%i DWO=%i", isDockWhenMinimized(), mDockWhenObscured->isChecked());
return TQTrayLabel::restoreState(config);
}
bool CustomTrayLabel::saveState(TDEConfig *config)
{
- if (!mSessionManagement->isOn())
+ if (!mSessionManagement->isChecked())
{
return false;
}
@@ -147,8 +133,8 @@ bool CustomTrayLabel::saveState(TDEConfig *config)
{
return false;
}
- config->writeEntry("DockWhenObscured", isDockWhenObscured());
- TRACE("WM=%i DWO=%i", isDockWhenMinimized(), isDockWhenObscured());
+ config->writeEntry("DockWhenObscured", mDockWhenObscured->isChecked());
+ TRACE("WM=%i DWO=%i", isDockWhenMinimized(), mDockWhenObscured->isChecked());
return true;
}
@@ -173,19 +159,6 @@ static bool which(const char *app)
return p != NULL;
}
-// Overridden to update our menu
-void CustomTrayLabel::setDockWhenMinimized(bool dwm)
-{
- TQTrayLabel::setDockWhenMinimized(dwm);
- mDockWhenMinimized->setOn(isDockWhenMinimized());
-}
-
-void CustomTrayLabel::setSkipTaskbar(bool skip)
-{
- TQTrayLabel::setSkipTaskbar(skip);
- mSkipTaskbar->setOn(isSkippingTaskbar());
-}
-
void CustomTrayLabel::setAppName(const TQString& name)
{
//FIXME HACK relies on window and application name being the same.
@@ -243,13 +216,13 @@ void CustomTrayLabel::updateMenu(void)
void CustomTrayLabel::mapEvent(void)
{
TRACE("mapEvent");
- if (mDockWhenObscured->isOn())
+ if (mDockWhenObscured->isChecked())
{
/*
* We get a obscured event for the time between the map and focus in of
* the window. So we disable it for sometime and reanable.
*/
- mDockWhenObscured->setOn(false);
+ mDockWhenObscured->setChecked(false);
TQTimer::singleShot(800, mDockWhenObscured, SLOT(toggle()));
TRACE("Turning off DWO for some time");
}
@@ -258,13 +231,16 @@ void CustomTrayLabel::mapEvent(void)
void CustomTrayLabel::obscureEvent(void)
{
TRACE("obscureEvent");
- if (mDockWhenObscured->isOn() && !isWithdrawn())
+ if (mDockWhenObscured->isChecked() && !isWithdrawn())
withdraw();
}
void CustomTrayLabel::focusLostEvent()
{
- if (mDockWhenFocusLost->isOn()) withdraw();
+ if (mDockWhenFocusLost->isChecked())
+ {
+ withdraw();
+ }
}
void CustomTrayLabel::mouseReleaseEvent(TQMouseEvent *ev)