Author: jflesch
Date: 2007-07-29 20:22:20 +0000 (Sun, 29 Jul 2007)
New Revision: 14430

Modified:
   trunk/apps/Thaw/src/thaw/fcp/FCPClientPut.java
   trunk/apps/Thaw/src/thaw/i18n/source.thaw_fr.properties
   trunk/apps/Thaw/src/thaw/i18n/thaw.properties
   trunk/apps/Thaw/src/thaw/i18n/thaw_fr.properties
   trunk/apps/Thaw/src/thaw/plugins/index/Index.java
   trunk/apps/Thaw/src/thaw/plugins/index/IndexBrowserPanel.java
   trunk/apps/Thaw/src/thaw/plugins/index/IndexTree.java
   trunk/apps/Thaw/src/thaw/plugins/miniFrost/MessagePanel.java
   trunk/apps/Thaw/src/thaw/plugins/miniFrost/frostKSK/KSKAuthor.java
   trunk/apps/Thaw/src/thaw/plugins/miniFrost/frostKSK/KSKBoard.java
   trunk/apps/Thaw/src/thaw/plugins/miniFrost/frostKSK/KSKDraft.java
   trunk/apps/Thaw/src/thaw/plugins/miniFrost/interfaces/Author.java
   trunk/apps/Thaw/src/thaw/plugins/signatures/SigConfigTab.java
Log:
Warn of some events through the tray icon

Modified: trunk/apps/Thaw/src/thaw/fcp/FCPClientPut.java
===================================================================
--- trunk/apps/Thaw/src/thaw/fcp/FCPClientPut.java      2007-07-29 18:53:22 UTC 
(rev 14429)
+++ trunk/apps/Thaw/src/thaw/fcp/FCPClientPut.java      2007-07-29 20:22:20 UTC 
(rev 14430)
@@ -60,6 +60,9 @@

        private SHA256Computer sha;

+
+       private int putFailedCode = -1;
+
        /**
         * To resume query from file. (see core.QueueKeeper)
         */
@@ -183,7 +186,7 @@

        public boolean start(final FCPQueueManager queueManager) {
                this.queueManager = queueManager;
-
+               putFailedCode = -1;
                identifier = null;

                if((localFile != null) && (localFile.length() <= 0)) {
@@ -652,6 +655,8 @@
                                finished = true;
                                fatal = true;

+                               putFailedCode = 
Integer.parseInt(msg.getValue("Code"));
+
                                status = "Failed 
("+msg.getValue("CodeDescription")+")";

                                if((msg.getValue("Fatal") != null) &&
@@ -1088,4 +1093,12 @@
                setChanged();
                notifyObservers();
        }
+
+
+       /**
+        * @return -1 if none
+        */
+       public int getPutFailedCode() {
+               return putFailedCode;
+       }
 }

Modified: trunk/apps/Thaw/src/thaw/i18n/source.thaw_fr.properties
===================================================================
--- trunk/apps/Thaw/src/thaw/i18n/source.thaw_fr.properties     2007-07-29 
18:53:22 UTC (rev 14429)
+++ trunk/apps/Thaw/src/thaw/i18n/source.thaw_fr.properties     2007-07-29 
20:22:20 UTC (rev 14430)
@@ -391,6 +391,8 @@
 thaw.plugin.index.numberOfLinks=Nombre de liens :
 thaw.plugin.index.insertionDate=Inser? le :

+thaw.plugin.index.newRev=Index 'X' mis ? jour ? la r?vision 'Y'
+
 # Peer monitor

 thaw.plugin.peerMonitor.peerMonitor=Connexion
@@ -572,3 +574,8 @@
 thaw.plugin.miniFrost.hideStatusBelow=Cacher les status inf?rieurs ?:
 thaw.plugin.miniFrost.seeUnsigned=Voir les messages non-sign?s

+thaw.plugin.miniFrost.DUP=(DUP)
+
+thaw.plugin.miniFrost.newMsgAnnounce=X nouveaux messages sur la board 'Y'
+thaw.plugin.miniFrost.messageSent=Message sur la board 'X' envoy?
+

Modified: trunk/apps/Thaw/src/thaw/i18n/thaw.properties
===================================================================
--- trunk/apps/Thaw/src/thaw/i18n/thaw.properties       2007-07-29 18:53:22 UTC 
(rev 14429)
+++ trunk/apps/Thaw/src/thaw/i18n/thaw.properties       2007-07-29 20:22:20 UTC 
(rev 14430)
@@ -402,7 +402,9 @@
 thaw.plugin.index.numberOfLinks=Number of links :
 thaw.plugin.index.insertionDate=Inserted :

+thaw.plugin.index.newRev=Index 'X' updated to the revision 'Y'

+
 # Peer monitor

 thaw.plugin.peerMonitor.peerMonitor=Connection
@@ -587,3 +589,8 @@
 thaw.plugin.miniFrost.seeUnsigned=See unsigned messages

 thaw.plugin.miniFrost.anonymous=Anonymous
+
+thaw.plugin.miniFrost.DUP=(DUP)
+
+thaw.plugin.miniFrost.newMsgAnnounce=X new messages on the board 'Y'
+thaw.plugin.miniFrost.messageSent=Message to the board 'X' sent

Modified: trunk/apps/Thaw/src/thaw/i18n/thaw_fr.properties
===================================================================
--- trunk/apps/Thaw/src/thaw/i18n/thaw_fr.properties    2007-07-29 18:53:22 UTC 
(rev 14429)
+++ trunk/apps/Thaw/src/thaw/i18n/thaw_fr.properties    2007-07-29 20:22:20 UTC 
(rev 14430)
@@ -97,6 +97,10 @@

 thaw.common.pleaseWait=Veuillez patienter ...

+thaw.common.unstable.linux=(May CRASH with Linux)
+
+
+
 ## Errors
 thaw.error.idAlreadyUsed=Impossible de se connecter. Notre identifiant est 
d\u00e9j\u00e0 utilis\u00e9 par un autre client connect\u00e9 au noeud.

@@ -568,3 +572,4 @@
 thaw.plugin.miniFrost.hideStatusBelow=Cacher les status inf\u00e9rieurs \u00e0:
 thaw.plugin.miniFrost.seeUnsigned=Voir les messages non-sign\u00e9s

+thaw.plugin.miniFrost.DUP=(DUP)

Modified: trunk/apps/Thaw/src/thaw/plugins/index/Index.java
===================================================================
--- trunk/apps/Thaw/src/thaw/plugins/index/Index.java   2007-07-29 18:53:22 UTC 
(rev 14429)
+++ trunk/apps/Thaw/src/thaw/plugins/index/Index.java   2007-07-29 20:22:20 UTC 
(rev 14430)
@@ -856,7 +856,20 @@
        }


+       public void useTrayIconToNotifyNewRev() {
+               if (indexTree == null)
+                       return;

+               String announcement = 
I18n.getMessage("thaw.plugin.index.newRev");
+               announcement = announcement.replaceAll("X", toString(false));
+               announcement = announcement.replaceAll("Y", 
Integer.toString(getRevision()));
+
+               
thaw.plugins.TrayIcon.popMessage(indexTree.getIndexBrowserPanel().getCore().getPluginManager(),
+                                                
I18n.getMessage("thaw.plugin.index.browser"),
+                                                announcement);
+       }
+
+
        public void update(Observable o, Object param) {
                if (o instanceof FCPClientGet) {
                        FCPClientGet get = (FCPClientGet)o;
@@ -872,8 +885,10 @@
                                        setPublicKey(key, newRev);
                                }

-                               if (oldRev < newRev)
+                               if (oldRev < newRev) {
                                        setHasChangedFlag(true);
+                                       useTrayIconToNotifyNewRev();
+                               }

                                String path = get.getPath();


Modified: trunk/apps/Thaw/src/thaw/plugins/index/IndexBrowserPanel.java
===================================================================
--- trunk/apps/Thaw/src/thaw/plugins/index/IndexBrowserPanel.java       
2007-07-29 18:53:22 UTC (rev 14429)
+++ trunk/apps/Thaw/src/thaw/plugins/index/IndexBrowserPanel.java       
2007-07-29 20:22:20 UTC (rev 14430)
@@ -35,10 +35,11 @@
        private FCPQueueManager queueManager;
        private Config config;
        private MainWindow mainWindow;
+       private Core core;

-
        public IndexBrowserPanel(final Hsqldb db, final Core core) {
                this.db = db;
+               this.core = core;
                this.queueManager = core.getQueueManager();
                this.config       = core.getConfig();
                this.mainWindow   = core.getMainWindow();
@@ -78,6 +79,11 @@
        }


+       public Core getCore() {
+               return core;
+       }
+
+
        public void restoreState() {
                if (config.getValue("indexBrowserPanelSplitPosition") != null)
                        
split.setDividerLocation(Integer.parseInt(config.getValue("indexBrowserPanelSplitPosition")));

Modified: trunk/apps/Thaw/src/thaw/plugins/index/IndexTree.java
===================================================================
--- trunk/apps/Thaw/src/thaw/plugins/index/IndexTree.java       2007-07-29 
18:53:22 UTC (rev 14429)
+++ trunk/apps/Thaw/src/thaw/plugins/index/IndexTree.java       2007-07-29 
20:22:20 UTC (rev 14430)
@@ -407,7 +407,11 @@
        }


+       public IndexBrowserPanel getIndexBrowserPanel() {
+               return indexBrowser;
+       }

+
        /**
         * Used by IndexBrowserPanel when the visibility changed
         */

Modified: trunk/apps/Thaw/src/thaw/plugins/miniFrost/MessagePanel.java
===================================================================
--- trunk/apps/Thaw/src/thaw/plugins/miniFrost/MessagePanel.java        
2007-07-29 18:53:22 UTC (rev 14429)
+++ trunk/apps/Thaw/src/thaw/plugins/miniFrost/MessagePanel.java        
2007-07-29 20:22:20 UTC (rev 14430)
@@ -152,7 +152,7 @@

                        this.author = author;

-                       nick = new JLabel(author.toString());
+                       nick = new JLabel(author.toString(false));

                        add(nick, BorderLayout.CENTER);


Modified: trunk/apps/Thaw/src/thaw/plugins/miniFrost/frostKSK/KSKAuthor.java
===================================================================
--- trunk/apps/Thaw/src/thaw/plugins/miniFrost/frostKSK/KSKAuthor.java  
2007-07-29 18:53:22 UTC (rev 14429)
+++ trunk/apps/Thaw/src/thaw/plugins/miniFrost/frostKSK/KSKAuthor.java  
2007-07-29 20:22:20 UTC (rev 14430)
@@ -1,9 +1,9 @@
 package thaw.plugins.miniFrost.frostKSK;

 import thaw.plugins.signatures.Identity;
+import thaw.core.I18n;


-
 public class KSKAuthor
        implements thaw.plugins.miniFrost.interfaces.Author {

@@ -21,9 +21,16 @@
        }

        public String toString() {
-               if (identity != null)
-                       return identity.toString();
+               return toString(true);
+       }

+       public String toString(boolean noDup) {
+               if (identity != null) {
+                       if (noDup || !identity.isDup())
+                               return identity.toString();
+                       return I18n.getMessage("thaw.plugin.miniFrost.DUP")+" 
"+identity.toString();
+               }
+
                return nick;
        }
 }

Modified: trunk/apps/Thaw/src/thaw/plugins/miniFrost/frostKSK/KSKBoard.java
===================================================================
--- trunk/apps/Thaw/src/thaw/plugins/miniFrost/frostKSK/KSKBoard.java   
2007-07-29 18:53:22 UTC (rev 14429)
+++ trunk/apps/Thaw/src/thaw/plugins/miniFrost/frostKSK/KSKBoard.java   
2007-07-29 20:22:20 UTC (rev 14430)
@@ -11,6 +11,7 @@
 import java.util.Calendar;

 import thaw.core.Logger;
+import thaw.core.I18n;
 import thaw.plugins.Hsqldb;

 import thaw.plugins.signatures.Identity;
@@ -430,6 +431,16 @@
                        Logger.error(this, "Unable to update the lastUpdate 
date :"+e.toString());
                }

+               if (newMsgs > 0) {
+                       String announce = 
I18n.getMessage("thaw.plugin.miniFrost.newMsgAnnounce");
+                       announce = announce.replaceAll("X", 
Integer.toString(newMsgs));
+                       announce = announce.replaceAll("Y", toString());
+
+                       
thaw.plugins.TrayIcon.popMessage(factory.getCore().getPluginManager(),
+                                                        "MiniFrost",
+                                                        announce);
+               }
+
                refreshing = false;
                notifyChange();
        }

Modified: trunk/apps/Thaw/src/thaw/plugins/miniFrost/frostKSK/KSKDraft.java
===================================================================
--- trunk/apps/Thaw/src/thaw/plugins/miniFrost/frostKSK/KSKDraft.java   
2007-07-29 18:53:22 UTC (rev 14429)
+++ trunk/apps/Thaw/src/thaw/plugins/miniFrost/frostKSK/KSKDraft.java   
2007-07-29 20:22:20 UTC (rev 14430)
@@ -9,6 +9,7 @@

 import thaw.core.Logger;
 import thaw.plugins.miniFrost.interfaces.Board;
+import thaw.core.I18n;


 public class KSKDraft
@@ -198,14 +199,29 @@

                                fileToInsert.delete();

+                               Logger.info(this, "Message sent.");
+
+                               String announce = 
I18n.getMessage("thaw.plugin.miniFrost.messageSent");
+                               announce = announce.replaceAll("X", 
board.toString());
+
+                               
thaw.plugins.TrayIcon.popMessage(board.getFactory().getCore().getPluginManager(),
+                                                                "MiniFrost",
+                                                                announce);
+
+
                        } else if (put.isFinished() && !put.isSuccessful()) {
+                               if (put.getPutFailedCode() != 9) { /* 
!Collision */
+                                       Logger.error(this, "Can't insert the 
message on the board '"+
+                                                    board.toString()+"' ; 
Code: "+Integer.toString(put.getPutFailedCode()));
+                                       return;
+                               }
+
                                put.deleteObserver(this);
                                put.stop(queueManager);
                                queueManager.remove(put);

                                revUsed = board.getNextNonDownloadedRev(date, 
revUsed);
                                startInsertion();
-
                        }
                }


Modified: trunk/apps/Thaw/src/thaw/plugins/miniFrost/interfaces/Author.java
===================================================================
--- trunk/apps/Thaw/src/thaw/plugins/miniFrost/interfaces/Author.java   
2007-07-29 18:53:22 UTC (rev 14429)
+++ trunk/apps/Thaw/src/thaw/plugins/miniFrost/interfaces/Author.java   
2007-07-29 20:22:20 UTC (rev 14430)
@@ -10,11 +10,20 @@
        public Identity getIdentity();

        /**
+        * must return the value of toString(true)
+        * @see toString(boolean)
+        */
+       public String toString();
+
+       /**
         * Name of the author
         * - Signed: Author@[hash of the public key]
         * - Unsigned: Author
         * '@' in the author name must be replaced
         * by a '_'
+        *
+        * @param noDup if set to True, returns just the nick ; else it can 
specify
+        *              if the nick is a duplicate or not
         */
-       public String toString();
+       public String toString(boolean noDup);
 }

Modified: trunk/apps/Thaw/src/thaw/plugins/signatures/SigConfigTab.java
===================================================================
--- trunk/apps/Thaw/src/thaw/plugins/signatures/SigConfigTab.java       
2007-07-29 18:53:22 UTC (rev 14429)
+++ trunk/apps/Thaw/src/thaw/plugins/signatures/SigConfigTab.java       
2007-07-29 20:22:20 UTC (rev 14430)
@@ -468,7 +468,7 @@

                        updateList();

-                       dialog.setSize(640, 300);
+                       dialog.setSize(640, 500);
                        dialog.setVisible(true);
                }



Reply via email to