[Author Prev][Author Next][Thread Prev][Thread Next][Author Index][Thread Index]

[tor-commits] [vidalia/alpha] Hide mainwindow with shortcut Ctrl+W if systray is available



commit 82c3d4b3856d2897b93b4a34a2994ffe9863c3ca
Author: Tomás Touceda <chiiph@xxxxxxxxxxxxxx>
Date:   Tue Jul 3 19:59:54 2012 -0300

    Hide mainwindow with shortcut Ctrl+W if systray is available
---
 changes/bug5495            |    2 ++
 src/vidalia/MainWindow.cpp |    7 +++++++
 src/vidalia/MainWindow.h   |    3 ++-
 3 files changed, 11 insertions(+), 1 deletions(-)

diff --git a/changes/bug5495 b/changes/bug5495
new file mode 100644
index 0000000..5d50307
--- /dev/null
+++ b/changes/bug5495
@@ -0,0 +1,2 @@
+  New features:
+  o Hide window with Ctrl+W shortcut. Resolves ticket 5495.
diff --git a/src/vidalia/MainWindow.cpp b/src/vidalia/MainWindow.cpp
index 3ddfb35..2ea816e 100644
--- a/src/vidalia/MainWindow.cpp
+++ b/src/vidalia/MainWindow.cpp
@@ -217,6 +217,10 @@ MainWindow::createActions()
   _actionExit = new QAction(QIcon(IMG_EXIT), tr("Exit"), this);
   _actionDebugDialog = new QAction(tr("Debug output"), this);
   _actionPanic = new QAction(QIcon(IMG_EXIT), tr("Panic!"), this);
+  _actionHide = new QAction(tr("Hide"), this);
+  if (QSystemTrayIcon::isSystemTrayAvailable()) {
+    _actionHide->setShortcut(QKeySequence(tr("Ctrl+W")));
+  }
 }
 
 /** Creates the menu bar */
@@ -235,6 +239,7 @@ MainWindow::createMenuBar()
   torMenu->addAction(_actionReloadConfig);
 #endif
   torMenu->addSeparator();
+  torMenu->addAction(_actionHide);
   torMenu->addAction(_actionExit);
 
   QMenu *actionsMenu = menu->addMenu(tr("Actions"));
@@ -446,6 +451,8 @@ MainWindow::createConnections()
 
   connect(_actionPanic, SIGNAL(triggered()), this, SLOT(panic()));
 
+  connect(_actionHide, SIGNAL(triggered()), this, SLOT(hide()));
+
   /* Catch signals when the application is running or shutting down */
   connect(vApp, SIGNAL(running()), this, SLOT(running()));
   connect(vApp, SIGNAL(aboutToQuit()), this, SLOT(aboutToQuit()));
diff --git a/src/vidalia/MainWindow.h b/src/vidalia/MainWindow.h
index 50a84c0..4bb3ef8 100644
--- a/src/vidalia/MainWindow.h
+++ b/src/vidalia/MainWindow.h
@@ -56,7 +56,7 @@ public:
 
 public slots:
   /** Shows or hides this window. **/
-  virtual void setVisible(bool visible);
+  virtual void setVisible(bool visible = false);
   /** Display a message in the application system tray icon */
   void trayMessage(const QString &title, const QString &msg,
                    QSystemTrayIcon::MessageIcon icon = QSystemTrayIcon::Information,
@@ -307,6 +307,7 @@ private:
   QAction *_actionExit;
   QAction *_actionDebugDialog;
   QAction *_actionPanic;
+  QAction *_actionHide;
 
   QMenu _reattachMenu; /**< Menu used to handle tab re-attaching */
   QAction *_dummy; /**< Dummy action to display when there are no more tabs */

_______________________________________________
tor-commits mailing list
tor-commits@xxxxxxxxxxxxxxxxxxxx
https://lists.torproject.org/cgi-bin/mailman/listinfo/tor-commits