[tor-commits] [vidalia-plugins/master] Bug 5352: option to switch off notifications about firefox starting.

chiiph at torproject.org chiiph at torproject.org
Thu Apr 5 19:50:25 UTC 2012


commit bea98c70ab5a130e7d3cad308dd37094ee879294
Author: Boris Skegin <boris.skegin.de at gmail.com>
Date:   Sat Mar 31 14:13:14 2012 +0200

    Bug 5352: option to switch off notifications about firefox starting.
---
 tbb/tbb.js |   37 +++++++++++++++++++++++++++++--------
 tbb/tbb.ui |   16 ++++++++++++++++
 2 files changed, 45 insertions(+), 8 deletions(-)

diff --git a/tbb/tbb.js b/tbb/tbb.js
index 5bd3dda..db8ac42 100644
--- a/tbb/tbb.js
+++ b/tbb/tbb.js
@@ -66,6 +66,11 @@ var tbb = {
             return this.tab;
         }
 
+        var trayBox = this.widget.children()[findWidget(this.widget, "TrayShowBox")];
+        if(groupBox == null) {
+            return this.tab;
+        }
+
         this.btnSave = this.widget.children()[findWidget(this.widget, "btnSave")];
         if(this.btnSave != null) {
             this.btnSave["clicked()"].connect(this, this.saveSettings);
@@ -104,6 +109,12 @@ var tbb = {
                 this.chkShowDialog.setCheckState(Qt.Checked);
         }
 
+        this.chkTrayShow = trayBox.children()[findWidget(trayBox, "chkTrayShow")];
+        if(this.chkTrayShow != null) {
+            if(this.tab.getSetting("DontShowTrayBox", "false") != "true")
+                this.chkTrayShow.setCheckState(Qt.Checked);
+        }
+
         this.lblHost = portInfo.children()[findWidget(portInfo, "lblHost")];
         this.lblHost.text = this.host;
         this.lblControl = portInfo.children()[findWidget(portInfo, "lblControl")];
@@ -117,6 +128,7 @@ var tbb = {
         this.tab.saveSetting(this.BrowserExecutable, this.lineExecutable.text);
         this.tab.saveSetting(this.BrowserDirectory, this.lineDirectory.text);
         this.tab.saveSetting("DontShowCloseDialog", String(this.chkShowDialog.checkState() != Qt.Checked));
+        this.tab.saveSetting("DontShowTrayBox", String(this.chkTrayShow.checkState() != Qt.Checked));
     },
 
     onSubProcessFinished: function(exitCode, exitStatus) {
@@ -134,7 +146,7 @@ var tbb = {
             }
             var dontshow = this.tab.getSetting("DontShowCloseDialog", "false");
             if(dontshow != "true") { // I hate javascript
-	              this.showCloseDialog();
+                this.showCloseDialog();
             }
         }
 
@@ -325,13 +337,22 @@ var tbb = {
     },
 
     showWaitDialog: function() {
-        if(QSystemTrayIcon.supportsMessages()) {
-			      VidaliaMainWindow.
-                trayMessage("Remember",
-                            "Please wait a few seconds, a Tor enabled Firefox will start right away...",
-                            QSystemTrayIcon.Warning, 40000);
-        } else
-            vdebug("Doesn't support messages!");
+        if (this.chkTrayShow.checkState() == Qt.Checked) {
+            if(QSystemTrayIcon.supportsMessages()) {
+               if (this.browserProcess.state() == QProcess.Running) {
+                   VidaliaMainWindow.
+                       trayMessage("Notification",
+                                   "Firefox is already running. If the Tor network is reestablished, feel free to surf.",
+                                   QSystemTrayIcon.Warning, 40000);
+               } else {
+                  VidaliaMainWindow.
+                      trayMessage("Remember",
+                                  "Please wait a few seconds, a Tor enabled Firefox will start right away...",
+                                  QSystemTrayIcon.Warning, 40000);
+               }
+            } else
+               vdebug("Doesn't support messages!");
+        }
     },
 
     showCloseDialog: function() {
diff --git a/tbb/tbb.ui b/tbb/tbb.ui
index 16f7f31..0379c0e 100644
--- a/tbb/tbb.ui
+++ b/tbb/tbb.ui
@@ -112,6 +112,22 @@
      </layout>
     </widget>
    </item>
+   <item row="3" column="0" colspan="2">
+    <widget class="QGroupBox" name="TrayShowBox">
+     <property name="title">
+      <string>Tray Notifications</string>
+     </property>
+     <layout class="QGridLayout" name="gridLayout_3">
+      <item row="0" column="0">
+       <widget class="QCheckBox" name="chkTrayShow">
+        <property name="text">
+         <string>Show tray notifications for Firefox</string>
+        </property>
+       </widget>
+      </item>
+     </layout>
+    </widget>
+   </item>
    <item row="4" column="1">
     <widget class="QPushButton" name="btnSave">
      <property name="text">



More information about the tor-commits mailing list