Author: jflesch
Date: 2007-05-22 18:39:56 +0000 (Tue, 22 May 2007)
New Revision: 13309

Modified:
   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/Comment.java
   trunk/apps/Thaw/src/thaw/plugins/index/Index.java
   trunk/apps/Thaw/src/thaw/plugins/index/IndexManagementHelper.java
Log:
Display a popup when a comment insertion failed, asking to retry

Modified: trunk/apps/Thaw/src/thaw/i18n/source.thaw_fr.properties
===================================================================
--- trunk/apps/Thaw/src/thaw/i18n/source.thaw_fr.properties     2007-05-22 
18:19:59 UTC (rev 13308)
+++ trunk/apps/Thaw/src/thaw/i18n/source.thaw_fr.properties     2007-05-22 
18:39:56 UTC (rev 13309)
@@ -200,7 +200,10 @@
 thaw.plugin.restarter.restartFatals=Red?marrer aussi les t?l?chargements 
?chou?s de mani?re fatale


+## Errors
+thaw.error.title=Erreur

+
 ## Warnings
 thaw.warning.title=Attention
 thaw.warning.isWriting=Attention ! Thaw est entrain d'?changer des donn?es 
avec le noeud.\nIl serait plus sage de vous d?connecter quand Thaw aura fini 
ses ?changes.\n?tes-vous s?r de vouloir vous d?connecter ?
@@ -348,6 +351,8 @@
 thaw.plugin.index.comment.moderate=Moderer
 thaw.plugin.index.comment.unmoderate=D?mod?rer

+thaw.plugin.index.comment.failed=L'envoi de votre commentaire a ?chou?. 
Ressayer ?
+
 thaw.plugin.index.mustReinsert=Vous devez r?inserer l'index pour que les 
changements fassent effet

 thaw.plugin.index.fetchNegative=Toujours t?l?charger les derni?res versions 
des indexes ? chaque rafraichissement

Modified: trunk/apps/Thaw/src/thaw/i18n/thaw.properties
===================================================================
--- trunk/apps/Thaw/src/thaw/i18n/thaw.properties       2007-05-22 18:19:59 UTC 
(rev 13308)
+++ trunk/apps/Thaw/src/thaw/i18n/thaw.properties       2007-05-22 18:39:56 UTC 
(rev 13309)
@@ -201,6 +201,9 @@
 thaw.plugin.restarter.restartFatals=Restart also fataly failed downloads


+## Errors
+thaw.error.title=Error
+
 ## Warnings
 thaw.warning.title=Warning
 thaw.warning.isWriting=Warning ! Thaw is exchanging data with the node.\nIt 
would be better to disconnect when thaw will finish.\nAre you sure that you 
want to disconnect ?
@@ -358,6 +361,8 @@
 thaw.plugin.index.comment.moderate=Moderate
 thaw.plugin.index.comment.unmoderate=Unmoderate

+thaw.plugin.index.comment.failed=Comment sending has failed. Retry ?
+
 thaw.plugin.index.fetchNegative=Always download of the latest versions of the 
indexes at each refresh
 thaw.plugin.index.fetchComments=Fetch the comments


Modified: trunk/apps/Thaw/src/thaw/i18n/thaw_fr.properties
===================================================================
--- trunk/apps/Thaw/src/thaw/i18n/thaw_fr.properties    2007-05-22 18:19:59 UTC 
(rev 13308)
+++ trunk/apps/Thaw/src/thaw/i18n/thaw_fr.properties    2007-05-22 18:39:56 UTC 
(rev 13309)
@@ -200,7 +200,10 @@
 thaw.plugin.restarter.restartFatals=Red\u00e9marrer aussi les 
t\u00e9l\u00e9chargements \u00e9chou\u00e9s de mani\u00e8re fatale


+## Errors
+thaw.error.title=Erreur

+
 ## Warnings
 thaw.warning.title=Attention
 thaw.warning.isWriting=Attention ! Thaw est entrain d'\u00e9changer des 
donn\u00e9es avec le noeud.\nIl serait plus sage de vous d\u00e9connecter quand 
Thaw aura fini ses \u00e9changes.\n\u00cates-vous s\u00fbr de vouloir vous 
d\u00e9connecter ?
@@ -348,6 +351,8 @@
 thaw.plugin.index.comment.moderate=Moderer
 thaw.plugin.index.comment.unmoderate=D\u00e9mod\u00e9rer

+thaw.plugin.index.comment.failed=L'envoi de votre commentaire a 
\u00e9chou\u00e9. Ressayer ?
+
 thaw.plugin.index.mustReinsert=Vous devez r\u00e9inserer l'index pour que les 
changements fassent effet

 thaw.plugin.index.fetchNegative=Toujours t\u00e9l\u00e9charger les 
derni\u00e8res versions des indexes \u00e0 chaque rafraichissement

Modified: trunk/apps/Thaw/src/thaw/plugins/index/Comment.java
===================================================================
--- trunk/apps/Thaw/src/thaw/plugins/index/Comment.java 2007-05-22 18:19:59 UTC 
(rev 13308)
+++ trunk/apps/Thaw/src/thaw/plugins/index/Comment.java 2007-05-22 18:39:56 UTC 
(rev 13309)
@@ -21,6 +21,7 @@
 import javax.swing.JButton;
 import javax.swing.BorderFactory;
 import javax.swing.JScrollPane;
+import javax.swing.JOptionPane;

 import java.awt.GridLayout;
 import java.awt.BorderLayout;
@@ -82,6 +83,7 @@

 import thaw.core.Config;
 import thaw.core.Logger;
+import thaw.core.MainWindow; /* used for warning popups */
 import thaw.core.I18n;

 import thaw.fcp.FreenetURIHelper;
@@ -452,15 +454,16 @@


        private FCPQueueManager queueManager;
+       private MainWindow      mainWindow;

-
        /**
         * @param privateKey must be an SSK without anything useless
         */
-       public boolean insertComment(FCPQueueManager queueManager) {
+       public boolean insertComment(FCPQueueManager queueManager, MainWindow 
mainWindow) {
                String privateKey = index.getCommentPrivateKey();

                this.queueManager = queueManager;
+               this.mainWindow   = mainWindow;

                java.io.File xmlFile = writeCommentToFile();

@@ -817,7 +820,24 @@
                                if (put.isFinished() && put.isSuccessful()) {
                                        if (put.stop(queueManager))
                                                queueManager.remove(put);
-                                       /* because the PersistentPut message 
sent by the node problably made it added to the queueManager  by the 
QueueLoader*/
+                                       /* because the PersistentPut message 
sent by the node problably made it
+                                        * added to the queueManager  by the 
QueueLoader*/
+                               } else if (put.isFinished() && 
!put.isSuccessful()) {
+                                       int ret = 
JOptionPane.showOptionDialog(mainWindow.getMainFrame(),
+                                                                              
I18n.getMessage("thaw.plugin.index.comment.failed"),
+                                                                              
I18n.getMessage("thaw.error.title"),
+                                                                              
JOptionPane.YES_NO_OPTION,
+                                                                              
JOptionPane.ERROR_MESSAGE,
+                                                                              
null,
+                                                                              
null,
+                                                                              
null);
+                                       if (ret == JOptionPane.YES_OPTION) {
+                                               /* we stop */
+                                               if (put.stop(queueManager))
+                                                       
queueManager.remove(put);
+                                               /* and we restart */
+                                               insertComment(queueManager, 
mainWindow);
+                                       }
                                }
                        }


Modified: trunk/apps/Thaw/src/thaw/plugins/index/Index.java
===================================================================
--- trunk/apps/Thaw/src/thaw/plugins/index/Index.java   2007-05-22 18:19:59 UTC 
(rev 13308)
+++ trunk/apps/Thaw/src/thaw/plugins/index/Index.java   2007-05-22 18:39:56 UTC 
(rev 13309)
@@ -56,6 +56,7 @@
 import thaw.core.I18n;
 import thaw.core.Logger;
 import thaw.core.Config;
+import thaw.core.MainWindow;

 import thaw.fcp.FreenetURIHelper;
 import thaw.fcp.FCPClientGet;
@@ -1926,7 +1927,7 @@
        }


-       public boolean postComment(FCPQueueManager queueManager, Identity 
author, String msg) {
+       public boolean postComment(FCPQueueManager queueManager, MainWindow 
mainWindow, Identity author, String msg) {
                String privKey;

                if ((privKey = getCommentPrivateKey()) == null) {
@@ -1935,7 +1936,7 @@

                Comment comment = new Comment(db, this, -1, author, msg);

-               return comment.insertComment(queueManager);
+               return comment.insertComment(queueManager, mainWindow);
        }



Modified: trunk/apps/Thaw/src/thaw/plugins/index/IndexManagementHelper.java
===================================================================
--- trunk/apps/Thaw/src/thaw/plugins/index/IndexManagementHelper.java   
2007-05-22 18:19:59 UTC (rev 13308)
+++ trunk/apps/Thaw/src/thaw/plugins/index/IndexManagementHelper.java   
2007-05-22 18:39:56 UTC (rev 13309)
@@ -1658,6 +1658,7 @@
                                        }

                                        
((Index)getTarget()).postComment(getQueueManager(),
+                                                                        
getIndexBrowserPanel().getMainWindow(),
                                                                         i,
                                                                         
textArea.getText().trim());
                                }


Reply via email to