Author: jflesch
Date: 2007-12-03 01:08:37 +0000 (Mon, 03 Dec 2007)
New Revision: 16210

Modified:
   trunk/apps/Thaw/src/thaw/core/ConfigWindow.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/IndexManagementHelper.java
   trunk/apps/Thaw/src/thaw/plugins/index/IndexTree.java
Log:
Make it possible to add a whole index folder at once to the index blacklist

Modified: trunk/apps/Thaw/src/thaw/core/ConfigWindow.java
===================================================================
--- trunk/apps/Thaw/src/thaw/core/ConfigWindow.java     2007-12-02 22:44:19 UTC 
(rev 16209)
+++ trunk/apps/Thaw/src/thaw/core/ConfigWindow.java     2007-12-03 01:08:37 UTC 
(rev 16210)
@@ -243,7 +243,7 @@
                                dialog.getContentPane().add(new 
JLabel(I18n.getMessage("thaw.common.pleaseWait"),
                                                                       
JLabel.CENTER));

-                               dialog.setUndecorated(true);
+                               //dialog.setUndecorated(true);
                                dialog.setResizable(false);

                                dialog.setSize(150, 30);

Modified: trunk/apps/Thaw/src/thaw/i18n/source.thaw_fr.properties
===================================================================
--- trunk/apps/Thaw/src/thaw/i18n/source.thaw_fr.properties     2007-12-02 
22:44:19 UTC (rev 16209)
+++ trunk/apps/Thaw/src/thaw/i18n/source.thaw_fr.properties     2007-12-03 
01:08:37 UTC (rev 16210)
@@ -105,7 +105,7 @@

 ## Errors
 thaw.error.idAlreadyUsed=Impossible de se connecter. Notre identifiant est 
d??j?? utilis?? par un autre client connect?? au noeud.
-thaw.error.obsolete=D?sol?, clef obsol?te.
+thaw.error.obsolete=D???sol???, clef obsol???te.


 ## Menus
@@ -283,16 +283,16 @@

 thaw.plugin.index.yourIndexes=Vos indexes

-thaw.plugin.index.addIndex=Ajouter un index de fichier
-thaw.plugin.index.addIndexesFromLink=Ajouter ces indexes ?? votre liste
-thaw.plugin.index.createIndex=Cr??er un nouvel index de fichiers
+thaw.plugin.index.addIndex=Ajouter un index
+thaw.plugin.index.addIndexesFromLink=Ajouter ces indexes
+thaw.plugin.index.createIndex=Cr??er un index
 thaw.plugin.index.addCategory=Creer un dossier
 thaw.plugin.index.rename=Renommer
 thaw.plugin.index.delete=Effacer
-thaw.plugin.index.insertIndex=[R??]inserer cet index sur Freenet
-thaw.plugin.index.insertIndexes=[R??]inserer ces indexes sur Freenet
-thaw.plugin.index.downloadIndex=Mettre ?? jour cet index depuis Freenet
-thaw.plugin.index.downloadIndexes=Mettre ?? jour ces indexes depuis Freenet
+thaw.plugin.index.insertIndex=[R??]inserer cet index
+thaw.plugin.index.insertIndexes=[R??]inserer ces indexes
+thaw.plugin.index.downloadIndex=Rafra??chir
+thaw.plugin.index.downloadIndexes=Rafra??chir
 thaw.plugin.index.copyKey=Copier la clef de l'index dans le presse-papier
 thaw.plugin.index.copyKeys=Copier les clefs des indexes dans le presse-papier
 thaw.plugin.index.copyPrivateKey=Copier la clef priv??e de cet index dans le 
presse-papier
@@ -305,7 +305,7 @@
 thaw.plugin.index.newCategory=Nouveau dossier
 thaw.plugin.index.newIndex=Nouvel index

-thaw.plugin.index.addAlreadyExistingIndex=Ajouter un index d??j?? existant
+thaw.plugin.index.addAlreadyExistingIndex=Ajouter un index

 thaw.plugin.index.indexSettings=R??glages de l'index

@@ -315,9 +315,9 @@
 thaw.plugin.index.search.label=Chercher dans le dossier ou l'index 
s??lectionn??:
 thaw.plugin.index.search.apply=Chercher

-thaw.plugin.index.addFilesWithInserting=Inserer un ou plusieurs fichier(s) sur 
Freenet et les ajouter ?? cet index
-thaw.plugin.index.addFilesWithoutInserting=Ajouter un ou plusieurs fichier(s) 
?? cet index
-thaw.plugin.index.addLink=Ajouter un lien vers un autre index
+thaw.plugin.index.addFilesWithInserting=Inserer et ajouter un ou plusieurs 
fichier(s)
+thaw.plugin.index.addFilesWithoutInserting=Ajouter un ou plusieurs fichier(s)
+thaw.plugin.index.addLink=Ajouter un lien

 thaw.plugin.index.insert=Inserer


Modified: trunk/apps/Thaw/src/thaw/i18n/thaw.properties
===================================================================
--- trunk/apps/Thaw/src/thaw/i18n/thaw.properties       2007-12-02 22:44:19 UTC 
(rev 16209)
+++ trunk/apps/Thaw/src/thaw/i18n/thaw.properties       2007-12-03 01:08:37 UTC 
(rev 16210)
@@ -290,9 +290,9 @@

 thaw.plugin.index.yourIndexes=Your indexes

-thaw.plugin.index.addIndex=Add a file index
-thaw.plugin.index.addIndexesFromLink=Add these indexes to your list
-thaw.plugin.index.createIndex=Create a new file index
+thaw.plugin.index.addIndex=Add an index
+thaw.plugin.index.addIndexesFromLink=Add these indexes
+thaw.plugin.index.createIndex=Create an index
 thaw.plugin.index.addCategory=Create a folder
 thaw.plugin.index.rename=Rename
 thaw.plugin.index.delete=Delete
@@ -312,7 +312,7 @@
 thaw.plugin.index.newCategory=New folder
 thaw.plugin.index.newIndex=New index

-thaw.plugin.index.addAlreadyExistingIndex=Add an already existing index
+thaw.plugin.index.addAlreadyExistingIndex=Add an index

 thaw.plugin.index.indexSettings=Index settings
 thaw.plugin.index.indexKey=Index key:
@@ -321,9 +321,9 @@
 thaw.plugin.index.search.label=Search in the selected folder or index:
 thaw.plugin.index.search.apply=Search

-thaw.plugin.index.addFilesWithInserting=Insert file(s) on Freenet and add them 
to this index
-thaw.plugin.index.addFilesWithoutInserting=Add file(s) to this index
-thaw.plugin.index.addLink=Add a link to another index
+thaw.plugin.index.addFilesWithInserting=Insert and add file(s)
+thaw.plugin.index.addFilesWithoutInserting=Add file(s)
+thaw.plugin.index.addLink=Add a link

 thaw.plugin.index.insert=Insert


Modified: trunk/apps/Thaw/src/thaw/i18n/thaw_fr.properties
===================================================================
--- trunk/apps/Thaw/src/thaw/i18n/thaw_fr.properties    2007-12-02 22:44:19 UTC 
(rev 16209)
+++ trunk/apps/Thaw/src/thaw/i18n/thaw_fr.properties    2007-12-03 01:08:37 UTC 
(rev 16210)
@@ -105,6 +105,7 @@

 ## Errors
 thaw.error.idAlreadyUsed=Impossible de se connecter. Notre identifiant est 
d\u00e9j\u00e0 utilis\u00e9 par un autre client connect\u00e9 au noeud.
+thaw.error.obsolete=D\ufffdsol\ufffd, clef obsol\ufffdte.


 ## Menus
@@ -282,16 +283,16 @@

 thaw.plugin.index.yourIndexes=Vos indexes

-thaw.plugin.index.addIndex=Ajouter un index de fichier
-thaw.plugin.index.addIndexesFromLink=Ajouter ces indexes \u00e0 votre liste
-thaw.plugin.index.createIndex=Cr\u00e9er un nouvel index de fichiers
+thaw.plugin.index.addIndex=Ajouter un index
+thaw.plugin.index.addIndexesFromLink=Ajouter ces indexes
+thaw.plugin.index.createIndex=Cr\u00e9er un index
 thaw.plugin.index.addCategory=Creer un dossier
 thaw.plugin.index.rename=Renommer
 thaw.plugin.index.delete=Effacer
-thaw.plugin.index.insertIndex=[R\u00e9]inserer cet index sur Freenet
-thaw.plugin.index.insertIndexes=[R\u00e9]inserer ces indexes sur Freenet
-thaw.plugin.index.downloadIndex=Mettre \u00e0 jour cet index depuis Freenet
-thaw.plugin.index.downloadIndexes=Mettre \u00e0 jour ces indexes depuis Freenet
+thaw.plugin.index.insertIndex=[R\u00e9]inserer cet index
+thaw.plugin.index.insertIndexes=[R\u00e9]inserer ces indexes
+thaw.plugin.index.downloadIndex=Rafra\u00eechir
+thaw.plugin.index.downloadIndexes=Rafra\u00eechir
 thaw.plugin.index.copyKey=Copier la clef de l'index dans le presse-papier
 thaw.plugin.index.copyKeys=Copier les clefs des indexes dans le presse-papier
 thaw.plugin.index.copyPrivateKey=Copier la clef priv\u00e9e de cet index dans 
le presse-papier
@@ -304,7 +305,7 @@
 thaw.plugin.index.newCategory=Nouveau dossier
 thaw.plugin.index.newIndex=Nouvel index

-thaw.plugin.index.addAlreadyExistingIndex=Ajouter un index d\u00e9j\u00e0 
existant
+thaw.plugin.index.addAlreadyExistingIndex=Ajouter un index

 thaw.plugin.index.indexSettings=R\u00e9glages de l'index

@@ -314,9 +315,9 @@
 thaw.plugin.index.search.label=Chercher dans le dossier ou l'index 
s\u00e9lectionn\u00e9:
 thaw.plugin.index.search.apply=Chercher

-thaw.plugin.index.addFilesWithInserting=Inserer un ou plusieurs fichier(s) sur 
Freenet et les ajouter \u00e0 cet index
-thaw.plugin.index.addFilesWithoutInserting=Ajouter un ou plusieurs fichier(s) 
\u00e0 cet index
-thaw.plugin.index.addLink=Ajouter un lien vers un autre index
+thaw.plugin.index.addFilesWithInserting=Inserer et ajouter un ou plusieurs 
fichier(s)
+thaw.plugin.index.addFilesWithoutInserting=Ajouter un ou plusieurs fichier(s)
+thaw.plugin.index.addLink=Ajouter un lien

 thaw.plugin.index.insert=Inserer


Modified: trunk/apps/Thaw/src/thaw/plugins/index/IndexManagementHelper.java
===================================================================
--- trunk/apps/Thaw/src/thaw/plugins/index/IndexManagementHelper.java   
2007-12-02 22:44:19 UTC (rev 16209)
+++ trunk/apps/Thaw/src/thaw/plugins/index/IndexManagementHelper.java   
2007-12-03 01:08:37 UTC (rev 16210)
@@ -1100,14 +1100,36 @@
                }

                public void setTarget(final IndexTreeNode node) {
-                       if (node != null && node instanceof Index)
+                       if (node != null)
                                super.setTarget(node);
                        else
                                super.setTarget(null);
                }
+               
+               private void blackListRecursivly(Hsqldb db, IndexFolder target) 
{
+                       /* A nicer way would be to ask directly to the database 
the index who
+                        * are children of this folder, but I'm a lazy bastard.
+                        */
+                       java.util.Enumeration targetChildren = 
target.children();
+                       
+                       while (targetChildren.hasMoreElements()) {
+                               Object o = targetChildren.nextElement();
+                               
+                               if (o instanceof Index) {
+                                       BlackList.addToBlackList(db, 
((Index)o).getPublicKey());
+                               } else if (o instanceof IndexFolder) {
+                                       blackListRecursivly(db, (IndexFolder)o);
+                               }
+                       }
+               }

                public void apply() {
-                       BlackList.addToBlackList(indexBrowser.getDb(), 
getTarget().getPublicKey());
+                       if (getTarget() instanceof IndexFolder) {
+                               blackListRecursivly(indexBrowser.getDb(), 
(IndexFolder)getTarget());
+                       } else if (getTarget() instanceof Index) {
+                               BlackList.addToBlackList(indexBrowser.getDb(), 
getTarget().getPublicKey());
+                       }
+                       
                        super.apply();
                        indexBrowser.getBlackList().updateList();
                }

Modified: trunk/apps/Thaw/src/thaw/plugins/index/IndexTree.java
===================================================================
--- trunk/apps/Thaw/src/thaw/plugins/index/IndexTree.java       2007-12-02 
22:44:19 UTC (rev 16209)
+++ trunk/apps/Thaw/src/thaw/plugins/index/IndexTree.java       2007-12-03 
01:08:37 UTC (rev 16210)
@@ -193,7 +193,7 @@
                item = new 
JMenuItem(I18n.getMessage("thaw.plugin.index.sortAlphabetically"));
                indexFolderMenu.add(item);
                indexFolderActions.add(new 
IndexManagementHelper.IndexFolderReorderer(indexBrowser, item));
-
+               
                item = new 
JMenuItem(I18n.getMessage("thaw.plugin.index.addAlreadyExistingIndex"),
                                     IconBox.minIndexReadOnly);
                indexFolderMenu.add(item);
@@ -212,6 +212,11 @@
                indexFolderMenu.add(item);
                indexFolderActions.add(new 
IndexManagementHelper.IndexRenamer(indexBrowser, item));

+               item = new 
JMenuItem(I18n.getMessage("thaw.plugin.index.addToBlackList"),
+                                                       IconBox.minStop);
+               indexFolderMenu.add(item);
+               indexAndFileActions.add(new 
IndexManagementHelper.IndexBlackLister(indexBrowser, item));
+               
                item = new 
JMenuItem(I18n.getMessage("thaw.plugin.index.delete"), IconBox.minDelete);
                indexFolderMenu.add(item);
                indexFolderActions.add(new 
IndexManagementHelper.IndexDeleter(indexBrowser, item));


Reply via email to