summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorMichele Calgaro <[email protected]>2020-03-28 23:43:25 +0900
committerMichele Calgaro <[email protected]>2020-03-28 23:43:25 +0900
commitfd098d95326611bee6450e153a65cee0a5666c29 (patch)
treeb48d1d9f474e1f5c4c6b5fe9daa63520663174f3 /src
parentbce0b6b20578e7e6b3da987ccc23bdf07bc79a72 (diff)
downloadtdedocker-fd098d95326611bee6450e153a65cee0a5666c29.tar.gz
tdedocker-fd098d95326611bee6450e153a65cee0a5666c29.zip
1) Additional work on tq app -> tde app translation (tq -> TDE actions)
2) Added "Quit All" command to popup menu. Signed-off-by: Michele Calgaro <[email protected]>
Diffstat (limited to 'src')
-rw-r--r--src/customtraylabel.cpp100
-rw-r--r--src/customtraylabel.h22
-rw-r--r--src/main.cpp2
-rw-r--r--src/traylabelmgr.cpp15
-rw-r--r--src/traylabelmgr.h3
5 files changed, 63 insertions, 79 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)
diff --git a/src/customtraylabel.h b/src/customtraylabel.h
index 244ebc2..8206a52 100644
--- a/src/customtraylabel.h
+++ b/src/customtraylabel.h
@@ -23,12 +23,12 @@
#define _CUSTOMTRAYLABEL_H
#include <tqobject.h>
-#include <tqaction.h>
+#include <tdeactionclasses.h>
#include "qtraylabel.h"
-class TQStringList;
-class TQPopupMenu;
class TDEPopupMenu;
+class TDEToggleAction;
+class TQStringList;
class TQString;
class TQSettings;
class TQWidget;
@@ -46,17 +46,10 @@ public:
bool saveState(TDEConfig *config);
bool restoreState(TDEConfig *config);
- bool isDockWhenObscured(void) const { return mDockWhenObscured->isOn(); }
-
void setAppName(const TQString& name);
public slots:
- // overridden to update our menu
- void setDockWhenMinimized(bool dwm);
- void setDockWhenFocusLost(bool dfl) { mDockWhenFocusLost->setOn(dfl); }
- void setSkipTaskbar(bool skip);
-
- void setDockWhenObscured(bool dock) { mDockWhenObscured->setOn(dock); }
+ void setDockWhenObscured(bool dock) { mDockWhenObscured->setChecked(dock); }
void enableSessionManagement(bool sm);
protected:
@@ -78,10 +71,11 @@ private slots:
private:
void installMenu();
bool mUndockWhenDead;
- TQPopupMenu *mMainMenu;
+ TDEPopupMenu *mMainMenu;
TDEPopupMenu *mOptionsMenu;
- TQAction *mDockOnRestore, *mBalloonTimeout, *mSkipTaskbar, *mDockWhenMinimized,
- *mDockWhenObscured, *mSessionManagement, *mDockWhenFocusLost;
+ TDEToggleAction *mSessionManagement, *mDockWhenObscured, *mDockIfMinimized,
+ *mDockWhenFocusLost, *mSkipTaskbar;
+ TDEAction *mBalloonTimeout;
int mShowId;
};
diff --git a/src/main.cpp b/src/main.cpp
index dc9bf5e..d10215d 100644
--- a/src/main.cpp
+++ b/src/main.cpp
@@ -70,7 +70,7 @@ static const TDECmdLineOptions options[] =
int main(int argc, char *argv[])
{
TDEAboutData about("tdedocker", I18N_NOOP("tdedocker"), "1.3",
- I18N_NOOP("Docks any application into the system tray\nNOTE: Use -d for all startup scripts."), TDEAboutData::License_GPL);
+ I18N_NOOP("Docks any application into the system tray."), TDEAboutData::License_GPL);
about.addAuthor("John Schember", I18N_NOOP("Original KDocker maintainer"), "[email protected]");
about.addAuthor("Girish Ramakrishnan", I18N_NOOP("Original KDocker developer"), "[email protected]");
diff --git a/src/traylabelmgr.cpp b/src/traylabelmgr.cpp
index 29aa0f4..54e8fbd 100644
--- a/src/traylabelmgr.cpp
+++ b/src/traylabelmgr.cpp
@@ -137,10 +137,23 @@ void TrayLabelMgr::dockAnother()
t->dock();
}
+// Close all the windows and quit
+void TrayLabelMgr::quitAll()
+{
+ TRACE("quitAll: number of tray labels = %i", mTrayLabels.count());
+ TQPtrListIterator<TQTrayLabel> it(mTrayLabels);
+ TQTrayLabel *t;
+ while ((t = it.current()) != 0)
+ {
+ ++it;
+ t->close();
+ }
+}
+
// Undock all the windows
void TrayLabelMgr::undockAll()
{
- TRACE("Number of tray labels = %i", mTrayLabels.count());
+ TRACE("undockAll: number of tray labels = %i", mTrayLabels.count());
TQPtrListIterator<TQTrayLabel> it(mTrayLabels);
TQTrayLabel *t;
while ((t = it.current()) != 0)
diff --git a/src/traylabelmgr.h b/src/traylabelmgr.h
index d5fdb9e..3d54cbd 100644
--- a/src/traylabelmgr.h
+++ b/src/traylabelmgr.h
@@ -52,8 +52,9 @@ public:
bool isWindowDocked(Window w);
public slots:
- void undockAll();
void dockAnother();
+ void quitAll();
+ void undockAll();
private slots:
void startup();