Author: jerome
Date: 2009-07-27 15:02:46 +0200 (Mon, 27 Jul 2009)
New Revision: 5174

Modified:
   
software_suite_v3/software/tool/tux_droid_browser/windows/trunk/tux_droid_browser/Unit1.dcu
   
software_suite_v3/software/tool/tux_droid_browser/windows/trunk/tux_droid_browser/Unit1.pas
Log:
* Registering balloon config.

Modified: 
software_suite_v3/software/tool/tux_droid_browser/windows/trunk/tux_droid_browser/Unit1.dcu
===================================================================
(Binary files differ)

Modified: 
software_suite_v3/software/tool/tux_droid_browser/windows/trunk/tux_droid_browser/Unit1.pas
===================================================================
--- 
software_suite_v3/software/tool/tux_droid_browser/windows/trunk/tux_droid_browser/Unit1.pas
 2009-07-27 10:24:53 UTC (rev 5173)
+++ 
software_suite_v3/software/tool/tux_droid_browser/windows/trunk/tux_droid_browser/Unit1.pas
 2009-07-27 13:02:46 UTC (rev 5174)
@@ -110,12 +110,17 @@
     procedure EmbeddedWB1DocumentComplete(ASender: TObject;
       const pDisp: IDispatch; var URL: OleVariant);
     procedure ConnectionCheckerTimer(Sender: TObject);
-    procedure AddSysTrayIcon;
+    procedure AddSysTrayIcon();
     procedure ShowBalloonTips(mess : string);
-    procedure DeleteSysTrayIcon;
+    procedure DeleteSysTrayIcon();
     procedure HideBalloonTips();
+    procedure setBalloonCanShow(showable : boolean);
 
+    function isBalloonCanShow() : boolean;
+    function GetAllUsersDir() : string;
+    function GetTuxDroidDataBaseDirectory() : string;
 
+
   private
     { D�clarations priv�es }
     IconData: TNewNotifyIconData;
@@ -170,8 +175,11 @@
 //Avoiding close action.
 procedure TForm1.FormCloseQuery(Sender: TObject; var CanClose: Boolean);
 begin
-  Form1.ShowBalloonTips('TuxBox 2.0 is now hidden in the tray icon' + 
slinebreak +
-                        'To open it again, please double-click the tray 
icon.');
+  if Form1.isBalloonCanShow() then
+    Form1.ShowBalloonTips('TuxBox 2.0 is now hidden in the tray icon' + 
slinebreak +
+                          'To open it again, please double-click the tray 
icon.' +
+                          slinebreak +
+                          'Click here to make this message disappear.');
   CanClose := False;
   Form1.Hide;
 end;
@@ -323,26 +331,9 @@
     PostMessage(Handle, WM_NULL, 0, 0);
   end
 
-
-  else if msg.LParam = NIN_BALLOONSHOW then
-    begin
-       //Sent when the balloon is shown
-    end
-
-  else if msg.LParam = NIN_BALLOONHIDE then
-    begin
-      //Sent when the balloon disappears
-    end
-
-  else if msg.LParam = NIN_BALLOONTIMEOUT then
-    begin
-      //Sent when the balloon is dismissed because of a timeout.
-
-    end
-
   else if msg.LParam = NIN_BALLOONUSERCLICK then
     begin
-      //Sent when the balloon is dismissed because the user clicked the mouse.
+      setBalloonCanShow(false);
     end
 
 end;
@@ -537,5 +528,71 @@
     ShowMessage('Tray icon deletion failed');
 end;
 
+
+{*
+* \brief Get the all users base directory.
+* \return A string.
+*}
+function TForm1.GetAllUsersDir : string;
+begin
+ result := GetEnvironmentVariable('ALLUSERSPROFILE');
+end;
+
+{ \brief Get the Tux Droid data base directory return A string.}
+function TForm1.GetTuxDroidDataBaseDirectory : string;
+begin
+ result := GetAllUsersDir + '\Kysoh\Tux Droid';
+end;
+
+
+{ Return true if the balloon can be showed. }
+function TForm1.isBalloonCanShow() : boolean;
+var
+  path : string;
+  res  : string;
+  F    : TextFile;
+begin
+  path := GetTuxDroidDataBaseDirectory + '\configurations\TuxBox2.0.conf';
+  if not FileExists(path) then
+    begin
+      //Creating state file.
+      Form1.setBalloonCanShow(true);
+      result := true;
+    end
+  else
+    begin
+      try
+        AssignFile(F, path);
+        reset(F);
+        readLn(F, res);
+        closeFile(F);
+        result := strtobool(res);
+      except
+      
+      end;
+    end;
+end;
+
+
+{ Set the balloon visible or not }
+procedure TForm1.setBalloonCanShow(showable : boolean);
+var
+  path   : string;
+  F : TextFile;
+begin
+  {$i+}
+  path := GetTuxDroidDataBaseDirectory + '\configurations\TuxBox2.0.conf';
+  try
+    AssignFile(F, path);
+    rewrite(F);
+    writeLn(F, booltostr(showable));
+    closeFile(F);
+  except
+
+  end;
+  {$i-}
+end;
+
+
 end.
 


------------------------------------------------------------------------------
_______________________________________________
Tux-droid-svn mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/tux-droid-svn

Reply via email to