Guest User

git_diff_bug5352_notification

a guest
Mar 13th, 2012
38
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. diff --git a/tbb/tbb.js b/tbb/tbb.js
  2. index fb203e3..38ff2a9 100644
  3. --- a/tbb/tbb.js
  4. +++ b/tbb/tbb.js
  5. @@ -29,7 +29,9 @@ var tbb = {
  6. // Show a popup when tor's started so that users wait for the new
  7. // Firefox, so that they don't open a firefox themselves and think they
  8. // are using tor when they are not?
  9. + if(this.tab.getSetting("DontShowTrayBox", "false") != "true"){
  10. torControl["authenticated()"].connect(this, this.showWaitDialog);
  11. + }
  12. torControl["authenticated()"].connect(this, this.startSubProcess);
  13. },
  14.  
  15. @@ -61,6 +63,12 @@ var tbb = {
  16. if(groupBox == null) {
  17. return this.tab;
  18. }
  19. +
  20. + var trayBox = this.widget.children()[findWidget(this.widget, "TrayShowBox")];
  21. + if(groupBox == null) {
  22. + return this.tab;
  23. + }
  24. +
  25.  
  26. this.btnSave = this.widget.children()[findWidget(this.widget, "btnSave")];
  27. if(this.btnSave != null) {
  28. @@ -99,6 +107,15 @@ var tbb = {
  29. if(this.tab.getSetting("DontShowCloseDialog", "false") != "true")
  30. this.chkShowDialog.setCheckState(Qt.Checked);
  31. }
  32. +
  33. + this.chkTrayShow = trayBox.children()[findWidget(trayBox, "chkTrayShow")];
  34. + if(this.chkTrayShow != null) {
  35. + if(this.tab.getSetting("DontShowTrayBox", "false") != "true")
  36. + this.chkTrayShow.setCheckState(Qt.Checked);
  37. + }
  38. +
  39. +
  40. +
  41.  
  42. this.lblHost = portInfo.children()[findWidget(portInfo, "lblHost")];
  43. this.lblHost.text = this.host;
  44. @@ -113,6 +130,7 @@ var tbb = {
  45. this.tab.saveSetting(this.BrowserExecutable, this.lineExecutable.text);
  46. this.tab.saveSetting(this.BrowserDirectory, this.lineDirectory.text);
  47. this.tab.saveSetting("DontShowCloseDialog", String(this.chkShowDialog.checkState() != Qt.Checked));
  48. + this.tab.saveSetting("DontShowTrayBox", String(this.chkTrayShow.checkState() != Qt.Checked));
  49. },
  50.  
  51. onSubProcessFinished: function(exitCode, exitStatus) {
  52. @@ -192,8 +210,7 @@ var tbb = {
  53.  
  54. this.browserProcess.setEnvironment(this.updateBrowserEnv());
  55.  
  56. - var browserExecutable = QDir.toNativeSeparators(browserDirectory + "/App/Firefox/" +
  57. - browserDirectoryFilename);
  58. + var browserExecutable = QDir.toNativeSeparators(browserDirectoryFilename);
  59.  
  60. var profileDir = QDir.toNativeSeparators(browserDirectory + "/Data/profile");
  61. var browserDirObj = new QDir(browserDirectory);
  62. @@ -204,7 +221,7 @@ var tbb = {
  63. this.copy_dir(browserDirectory + "/App/DefaultData/profile", browserDirectory + "/Data/profile");
  64. }
  65.  
  66. - /* Copy the plugins directory if it's not already there */
  67. + /* Copy the plugins directory if it's not already there; Do we have any /App/DefaultData/plugins directory ? */
  68. if (!browserDirObj.exists("Data/plugins")) {
  69. browserDirObj.mkpath("Data/plugins");
  70. this.copy_dir(browserDirectory + "/App/DefaultData/plugins", browserDirectory + "/Data/plugins");
  71. @@ -304,11 +321,19 @@ var tbb = {
  72.  
  73. showWaitDialog: function() {
  74. if(QSystemTrayIcon.supportsMessages()) {
  75. + if (this.browserProcess.state() == QProcess.Running) {
  76. + var tray = new QSystemTrayIcon();
  77. + tray.show();
  78. + tray.showMessage("Notification", "Firefox is already running. If the TOR network is reestablished, feel free to surf.",
  79. + QSystemTrayIcon.Warning, 40000);
  80. + } else
  81. + {
  82. var tray = new QSystemTrayIcon();
  83. tray.show();
  84. - tray.showMessage("Remember",
  85. + tray.showMessage("Remember",
  86. "Please wait a few seconds, a Tor enabled Firefox will start right away...",
  87. - QSystemTrayIcon.Warning, 40000);
  88. + QSystemTrayIcon.Warning, 40000);
  89. + }
  90. } else
  91. vdebug("Doesn't support messages!");
  92. },
  93. diff --git a/tbb/tbb.ui b/tbb/tbb.ui
  94. index 16f7f31..f9b0ec9 100644
  95. --- a/tbb/tbb.ui
  96. +++ b/tbb/tbb.ui
  97. @@ -112,6 +112,22 @@
  98. </layout>
  99. </widget>
  100. </item>
  101. + <item row="3" column="0" colspan="2">
  102. + <widget class="QGroupBox" name="TrayShowBox">
  103. + <property name="title">
  104. + <string>Tray Notifications</string>
  105. + </property>
  106. + <layout class="QGridLayout" name="gridLayout_3">
  107. + <item row="0" column="0">
  108. + <widget class="QCheckBox" name="chkTrayShow">
  109. + <property name="text">
  110. + <string>Show tray notifications for Firefox</string>
  111. + </property>
  112. + </widget>
  113. + </item>
  114. + </layout>
  115. + </widget>
  116. + </item>
  117. <item row="4" column="1">
  118. <widget class="QPushButton" name="btnSave">
  119. <property name="text">
RAW Paste Data