From jflesch at freenetproject.org Sat Feb 2 21:54:52 2008 From: jflesch at freenetproject.org (jflesch at freenetproject.org) Date: Sat, 2 Feb 2008 21:54:52 +0000 (UTC) Subject: [Thaw-dev] r17482 - trunk/apps/Thaw/src/thaw/plugins/miniFrost/frostKSK Message-ID: <20080202215452.B117E391E35@freenetproject.org> Author: jflesch Date: 2008-02-02 21:54:52 +0000 (Sat, 02 Feb 2008) New Revision: 17482 Modified: trunk/apps/Thaw/src/thaw/plugins/miniFrost/frostKSK/KSKBoardFactory.java trunk/apps/Thaw/src/thaw/plugins/miniFrost/frostKSK/SSKBoardFactory.java Log: MiniFrost: When starting, compress the interval of invalid slots (can take a very long time, the first time, atm) Modified: trunk/apps/Thaw/src/thaw/plugins/miniFrost/frostKSK/KSKBoardFactory.java =================================================================== --- trunk/apps/Thaw/src/thaw/plugins/miniFrost/frostKSK/KSKBoardFactory.java 2008-02-02 21:21:16 UTC (rev 17481) +++ trunk/apps/Thaw/src/thaw/plugins/miniFrost/frostKSK/KSKBoardFactory.java 2008-02-02 21:54:52 UTC (rev 17482) @@ -8,6 +8,7 @@ import java.util.HashMap; import java.util.Iterator; import java.util.Date; +import java.util.Stack; import thaw.core.Core; import thaw.core.Logger; @@ -82,6 +83,14 @@ if (core.getConfig().getValue(configOption) == null) core.getConfig().setValue(configOption, "true"); } + + if (core.getSplashScreen() != null) + core.getSplashScreen().setStatus("MiniFrost : Compacting frost invalid slots list ..."); + + recompactInvalidSlots(db, core); + + if (core.getSplashScreen() != null) + core.getSplashScreen().setStatus("MiniFrost : Loading ..."); boardsHashMap = new HashMap(); @@ -619,4 +628,121 @@ public String toString() { return I18n.getMessage("thaw.plugin.miniFrost.FrostKSK"); } + + + private void recompactInvalidSlots(Hsqldb db, int boardId, java.sql.Date date) + throws SQLException { + + /*** Preparing statements ***/ + PreparedStatement select, update, delete; + + /* we select them 2 by 2 */ + select = db.getConnection().prepareStatement("SELECT id, minRev, maxRev FROM frostKSKinvalidSlots WHERE date = ? AND boardId = ? ORDER BY minRev LIMIT 2 OFFSET ?"); + select.setDate(1, date); + select.setInt(2, boardId); + + update = db.getConnection().prepareStatement("UPDATE frostKSKinvalidSlots SET minRev = ?, maxRev = ? WHERE id = ?"); + delete = db.getConnection().prepareStatement("DELETE FROM frostKSKinvalidSlots WHERE id = ?"); + + /*** Compacting ***/ + + int pos = 0; + boolean stop = false; + + int[] id = new int[2]; + int[] min = new int[2]; + int[] max = new int[2]; + + while(!stop) { + + /* selecting 2 elements */ + select.setInt(3, pos); + + ResultSet set = select.executeQuery(); + + for (int i = 0 ; i < 2 ; i++) { + if (!set.next()) { + stop = true; + break; + } + + id[i] = set.getInt("id"); + min[i] = set.getInt("minRev"); + max[i] = set.getInt("maxRev"); + } + + if (stop) { + /* can't select the two elements => we stop */ + break; + } + + /* checking if we can put them together */ + + if (max[0] + 1 <= min[1]) { + /* if yes => we put them together */ + update.setInt(1, min[0]); + update.setInt(2, max[1]); + update.setInt(3, id[0]); + update.execute(); + + delete.setInt(1, id[1]); + delete.execute(); + } else { + /* if no => we continue our progression */ + pos++; + } + } + } + + + private void recompactInvalidSlots(Hsqldb db, int boardId) + throws SQLException { + + Stack dates = new Stack(); + + PreparedStatement st = db.getConnection().prepareStatement("SELECT DISTINCT date FROM frostKSKinvalidSlots"); + + ResultSet set = st.executeQuery(); + + while(set.next()) { + dates.push(set.getDate("date")); + } + + while(!dates.empty()) { + recompactInvalidSlots(db, boardId, (java.sql.Date)dates.pop()); + } + } + + protected void recompactInvalidSlots(Hsqldb db, Core core) { + synchronized(db.dbLock) { + try { + PreparedStatement st; + Stack boardIds = new Stack(); + Stack boardNames = new Stack(); + + st = db.getConnection().prepareStatement("SELECT id, name FROM frostKSKBoards"); + + ResultSet set = st.executeQuery(); + + while(set.next()) { + boardIds.push(new Integer(set.getInt("id"))); + boardNames.push(set.getString("name")); + } + + while(!boardIds.empty() && !boardNames.empty()) { + + String name = (String)boardNames.pop(); + Logger.info(this, "Compacting invalid slots for board '"+name+"'"); + if (core.getSplashScreen() != null) + core.getSplashScreen().setStatus("MiniFrost : Compacting frost invalid slots list for the board '"+name+"' ..."); + + recompactInvalidSlots(db, ((Integer)boardIds.pop()).intValue()); + } + + } catch(SQLException e) { + Logger.error(this, "SQLException while compacting the invalid slots: "+e.toString()); + e.printStackTrace(); + } + } + } } Modified: trunk/apps/Thaw/src/thaw/plugins/miniFrost/frostKSK/SSKBoardFactory.java =================================================================== --- trunk/apps/Thaw/src/thaw/plugins/miniFrost/frostKSK/SSKBoardFactory.java 2008-02-02 21:21:16 UTC (rev 17481) +++ trunk/apps/Thaw/src/thaw/plugins/miniFrost/frostKSK/SSKBoardFactory.java 2008-02-02 21:54:52 UTC (rev 17482) @@ -237,5 +237,10 @@ public String toString() { return I18n.getMessage("thaw.plugin.miniFrost.FrostSSK"); } + + protected void recompactInvalidSlots(Hsqldb db, Core core) { + /* done by KSKBoardFactory */ + /* \_o< */ + } } From jflesch at freenetproject.org Sun Feb 3 14:42:34 2008 From: jflesch at freenetproject.org (jflesch at freenetproject.org) Date: Sun, 3 Feb 2008 14:42:34 +0000 (UTC) Subject: [Thaw-dev] r17503 - in trunk/apps/Thaw: images src/thaw/gui src/thaw/i18n src/thaw/plugins src/thaw/plugins/index Message-ID: <20080203144234.446DE4796E3@freenetproject.org> Author: jflesch Date: 2008-02-03 14:42:33 +0000 (Sun, 03 Feb 2008) New Revision: 17503 Added: trunk/apps/Thaw/images/min-trust.png trunk/apps/Thaw/images/trust.png trunk/apps/Thaw/src/thaw/plugins/WebOfTrust.java Modified: trunk/apps/Thaw/src/thaw/gui/IconBox.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/IndexTree.java Log: Indexbrowser : Change the order of some options in the rightclick menu Added: trunk/apps/Thaw/images/min-trust.png =================================================================== (Binary files differ) Property changes on: trunk/apps/Thaw/images/min-trust.png ___________________________________________________________________ Name: svn:mime-type + application/octet-stream Added: trunk/apps/Thaw/images/trust.png =================================================================== (Binary files differ) Property changes on: trunk/apps/Thaw/images/trust.png ___________________________________________________________________ Name: svn:mime-type + application/octet-stream Modified: trunk/apps/Thaw/src/thaw/gui/IconBox.java =================================================================== --- trunk/apps/Thaw/src/thaw/gui/IconBox.java 2008-02-03 00:20:53 UTC (rev 17502) +++ trunk/apps/Thaw/src/thaw/gui/IconBox.java 2008-02-03 14:42:33 UTC (rev 17503) @@ -175,6 +175,9 @@ public static ImageIcon miniFrostGmailView; public static ImageIcon miniFrostOutlookView; + + public static ImageIcon trust; + public static ImageIcon minTrust; /** @@ -321,6 +324,8 @@ IconBox.web = IconBox.loadIcon("images/web.png"); IconBox.miniFrostGmailView = IconBox.loadIcon("images/miniFrost-view-gmail.png"); IconBox.miniFrostOutlookView = IconBox.loadIcon("images/miniFrost-view-outlook.png"); + IconBox.trust = IconBox.loadIcon("images/trust.png"); + IconBox.minTrust = IconBox.loadIcon("images/min-trust.png"); } } Modified: trunk/apps/Thaw/src/thaw/i18n/source.thaw_fr.properties =================================================================== --- trunk/apps/Thaw/src/thaw/i18n/source.thaw_fr.properties 2008-02-03 00:20:53 UTC (rev 17502) +++ trunk/apps/Thaw/src/thaw/i18n/source.thaw_fr.properties 2008-02-03 14:42:33 UTC (rev 17503) @@ -709,3 +709,5 @@ thaw.plugin.index.treeRebuilder.finished=R?paration de l'arbre finie thaw.plugin.index.treeRebuilder.failed=La r?paration de l'arbre a ?chou? :( +## Web of Trust +thaw.plugin.wot=Toile de confiance Modified: trunk/apps/Thaw/src/thaw/i18n/thaw.properties =================================================================== --- trunk/apps/Thaw/src/thaw/i18n/thaw.properties 2008-02-03 00:20:53 UTC (rev 17502) +++ trunk/apps/Thaw/src/thaw/i18n/thaw.properties 2008-02-03 14:42:33 UTC (rev 17503) @@ -717,3 +717,8 @@ thaw.plugin.index.treeRebuilder=Index tree rebuilder thaw.plugin.index.treeRebuilder.finished=Index tree rebuilding finished thaw.plugin.index.treeRebuilder.failed=Index tree rebuilding failed ! :( + +## Web of trust + +thaw.plugin.wot=Web of Trust + Modified: trunk/apps/Thaw/src/thaw/i18n/thaw_fr.properties =================================================================== --- trunk/apps/Thaw/src/thaw/i18n/thaw_fr.properties 2008-02-03 00:20:53 UTC (rev 17502) +++ trunk/apps/Thaw/src/thaw/i18n/thaw_fr.properties 2008-02-03 14:42:33 UTC (rev 17503) @@ -709,3 +709,5 @@ thaw.plugin.index.treeRebuilder.finished=R\u00e9paration de l'arbre finie thaw.plugin.index.treeRebuilder.failed=La r\u00e9paration de l'arbre a \u00e9chou\u00e9 :( +## Web of Trust +thaw.plugin.wot=Toile de confiance Added: trunk/apps/Thaw/src/thaw/plugins/WebOfTrust.java =================================================================== --- trunk/apps/Thaw/src/thaw/plugins/WebOfTrust.java (rev 0) +++ trunk/apps/Thaw/src/thaw/plugins/WebOfTrust.java 2008-02-03 14:42:33 UTC (rev 17503) @@ -0,0 +1,32 @@ +package thaw.plugins; + +import javax.swing.ImageIcon; + +import thaw.core.Core; +import thaw.core.Plugin; +import thaw.core.I18n; + +public class WebOfTrust implements Plugin { + + public WebOfTrust() { + + } + + public ImageIcon getIcon() { + return thaw.gui.IconBox.trust; + } + + public String getNameForUser() { + return I18n.getMessage("thaw.plugin.wot"); + } + + public boolean run(Core core) { + + return false; + } + + public void stop() { + + } + +} Modified: trunk/apps/Thaw/src/thaw/plugins/index/IndexTree.java =================================================================== --- trunk/apps/Thaw/src/thaw/plugins/index/IndexTree.java 2008-02-03 00:20:53 UTC (rev 17502) +++ trunk/apps/Thaw/src/thaw/plugins/index/IndexTree.java 2008-02-03 14:42:33 UTC (rev 17503) @@ -176,7 +176,21 @@ indexFolderActions.add(new IndexManagementHelper.NodeNameDisplayer(item)); indexFolderMenu.addSeparator(); + + item = new JMenuItem(I18n.getMessage("thaw.plugin.index.addAlreadyExistingIndex"), + IconBox.minIndexReadOnly); + indexFolderMenu.add(item); + indexFolderActions.add(new IndexManagementHelper.IndexReuser(queueManager, indexBrowser, item)); + item = new JMenuItem(I18n.getMessage("thaw.plugin.index.addCategory"), + IconBox.minFolderNew); + indexFolderMenu.add(item); + indexFolderActions.add(new IndexManagementHelper.IndexFolderAdder(indexBrowser, item)); + + item = new JMenuItem(I18n.getMessage("thaw.plugin.index.createIndex"), IconBox.minIndexNew); + indexFolderMenu.add(item); + indexFolderActions.add(new IndexManagementHelper.IndexCreator(queueManager, indexBrowser, item)); + item = new JMenuItem(I18n.getMessage("thaw.plugin.index.downloadIndexes"), IconBox.minRefreshAction); indexFolderMenu.add(item); @@ -193,21 +207,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); - indexFolderActions.add(new IndexManagementHelper.IndexReuser(queueManager, indexBrowser, item)); - item = new JMenuItem(I18n.getMessage("thaw.plugin.index.addCategory"), - IconBox.minFolderNew); - indexFolderMenu.add(item); - indexFolderActions.add(new IndexManagementHelper.IndexFolderAdder(indexBrowser, item)); - - item = new JMenuItem(I18n.getMessage("thaw.plugin.index.createIndex"), IconBox.minIndexNew); - indexFolderMenu.add(item); - indexFolderActions.add(new IndexManagementHelper.IndexCreator(queueManager, indexBrowser, item)); - item = new JMenuItem(I18n.getMessage("thaw.plugin.index.rename")); indexFolderMenu.add(item); indexFolderActions.add(new IndexManagementHelper.IndexRenamer(indexBrowser, item)); From jflesch at freenetproject.org Tue Feb 5 16:56:43 2008 From: jflesch at freenetproject.org (jflesch at freenetproject.org) Date: Tue, 5 Feb 2008 16:56:43 +0000 (UTC) Subject: [Thaw-dev] r17547 - in trunk/apps/Thaw/src/thaw: core i18n plugins plugins/signatures plugins/webOfTrust Message-ID: <20080205165643.A931147B81B@freenetproject.org> Author: jflesch Date: 2008-02-05 16:56:43 +0000 (Tue, 05 Feb 2008) New Revision: 17547 Added: trunk/apps/Thaw/src/thaw/plugins/webOfTrust/ trunk/apps/Thaw/src/thaw/plugins/webOfTrust/WebOfTrustConfigTab.java Modified: trunk/apps/Thaw/src/thaw/core/Config.java trunk/apps/Thaw/src/thaw/core/Core.java trunk/apps/Thaw/src/thaw/core/Logger.java trunk/apps/Thaw/src/thaw/core/PluginManager.java trunk/apps/Thaw/src/thaw/i18n/source.thaw_fr.properties trunk/apps/Thaw/src/thaw/i18n/thaw.properties trunk/apps/Thaw/src/thaw/plugins/Signatures.java trunk/apps/Thaw/src/thaw/plugins/WebOfTrust.java trunk/apps/Thaw/src/thaw/plugins/signatures/DatabaseManager.java Log: Implement the config tab for the web of trust (does almost nothing atm) Modified: trunk/apps/Thaw/src/thaw/core/Config.java =================================================================== --- trunk/apps/Thaw/src/thaw/core/Config.java 2008-02-05 09:22:17 UTC (rev 17546) +++ trunk/apps/Thaw/src/thaw/core/Config.java 2008-02-05 16:56:43 UTC (rev 17547) @@ -78,7 +78,8 @@ String currentValue = getValue(key); if ( (currentValue != null && !currentValue.equals(value)) - || (currentValue == null && value != null ) ) { + || (currentValue == null && value != null) + || (currentValue != null && value == null) ) { /* we get the plugin list to reload */ Vector pluginList = (Vector)listeners.get(key); @@ -100,7 +101,10 @@ } /* and to finish, we set the value */ - parameters.put(key, value); + if (value != null) + parameters.put(key, value); + else + parameters.remove(key); } } Modified: trunk/apps/Thaw/src/thaw/core/Core.java =================================================================== --- trunk/apps/Thaw/src/thaw/core/Core.java 2008-02-05 09:22:17 UTC (rev 17546) +++ trunk/apps/Thaw/src/thaw/core/Core.java 2008-02-05 16:56:43 UTC (rev 17547) @@ -421,8 +421,13 @@ lookAndFeel = theme; + /* the recommandation is to set the lnf before displaying the first window */ + /* but I had more bugs with the GTK lnf when I followed the recommandation than + * when I didn't. So now I only change it when the main window is already displayed :p */ - if (mainWindow.getMainFrame().isVisible()) + if (mainWindow != null + && mainWindow.getMainFrame() != null + && mainWindow.getMainFrame().isVisible()) reallySetTheme(lookAndFeel); } @@ -444,8 +449,9 @@ if (splashScreen != null) splashScreen.rebuild(); } catch (final Exception e) { - Logger.warning(this, "Exception while setting the L&F : " + e.getMessage()); - Logger.warning(this, "Using the default lookAndFeel"); + Logger.warning(this, "Exception while setting the L&F : " + e.toString() + " ; " + e.getMessage()); + e.printStackTrace(); + Logger.warning(this, "Will use the default lookAndFeel"); } return true; Modified: trunk/apps/Thaw/src/thaw/core/Logger.java =================================================================== --- trunk/apps/Thaw/src/thaw/core/Logger.java 2008-02-05 09:22:17 UTC (rev 17546) +++ trunk/apps/Thaw/src/thaw/core/Logger.java 2008-02-05 16:56:43 UTC (rev 17547) @@ -16,7 +16,7 @@ public final static int LOG_LEVEL_DEBUG = 4; public final static int LOG_LEVEL_VERBOSE = 5; - private static int LOG_LEVEL = 2; + private static int LOG_LEVEL = 3; public final static String[] PREFIXES = new String[] { Modified: trunk/apps/Thaw/src/thaw/core/PluginManager.java =================================================================== --- trunk/apps/Thaw/src/thaw/core/PluginManager.java 2008-02-05 09:22:17 UTC (rev 17546) +++ trunk/apps/Thaw/src/thaw/core/PluginManager.java 2008-02-05 16:56:43 UTC (rev 17547) @@ -31,6 +31,7 @@ "thaw.plugins.ThemeSelector", "thaw.plugins.Hsqldb", "thaw.plugins.Signatures", + "thaw.plugins.WebOfTrust", "thaw.plugins.IndexBrowser", "thaw.plugins.IndexExporter", "thaw.plugins.IndexTreeRebuilder", Modified: trunk/apps/Thaw/src/thaw/i18n/source.thaw_fr.properties =================================================================== --- trunk/apps/Thaw/src/thaw/i18n/source.thaw_fr.properties 2008-02-05 09:22:17 UTC (rev 17546) +++ trunk/apps/Thaw/src/thaw/i18n/source.thaw_fr.properties 2008-02-05 16:56:43 UTC (rev 17547) @@ -711,3 +711,9 @@ ## Web of Trust thaw.plugin.wot=Toile de confiance +thaw.plugin.wot.activated=Activer la toile de confiance +thaw.plugin.wot.usedIdentity=Identit? utilis?e pour publier la liste de confiances +thaw.plugin.wot.usedIdentity.none=[Ne pas publier la liste de confiance] +thaw.plugin.wot.numberOfRefresh=Nombre de liste de confiances ? rafraichir simultan?ment + + Modified: trunk/apps/Thaw/src/thaw/i18n/thaw.properties =================================================================== --- trunk/apps/Thaw/src/thaw/i18n/thaw.properties 2008-02-05 09:22:17 UTC (rev 17546) +++ trunk/apps/Thaw/src/thaw/i18n/thaw.properties 2008-02-05 16:56:43 UTC (rev 17547) @@ -721,4 +721,9 @@ ## Web of trust thaw.plugin.wot=Web of Trust +thaw.plugin.wot.activated=Activate the web of trust +thaw.plugin.wot.usedIdentity=Identity used to publish your trust list +thaw.plugin.wot.usedIdentity.none=[Don't publish the trust list] +thaw.plugin.wot.numberOfRefresh=Number of trust list to refresh simultaneously + Modified: trunk/apps/Thaw/src/thaw/plugins/Signatures.java =================================================================== --- trunk/apps/Thaw/src/thaw/plugins/Signatures.java 2008-02-05 09:22:17 UTC (rev 17546) +++ trunk/apps/Thaw/src/thaw/plugins/Signatures.java 2008-02-05 16:56:43 UTC (rev 17547) @@ -116,16 +116,20 @@ used--; - if (used == 0) + if (used == 0) { db.unregisterChild(this); + db = null; + } } public void realStop() { used--; - if (used == 0) + if (used == 0) { db.unregisterChild(this); + db = null; + } } public String getNameForUser() { Modified: trunk/apps/Thaw/src/thaw/plugins/WebOfTrust.java =================================================================== --- trunk/apps/Thaw/src/thaw/plugins/WebOfTrust.java 2008-02-05 09:22:17 UTC (rev 17546) +++ trunk/apps/Thaw/src/thaw/plugins/WebOfTrust.java 2008-02-05 16:56:43 UTC (rev 17547) @@ -3,14 +3,67 @@ import javax.swing.ImageIcon; import thaw.core.Core; -import thaw.core.Plugin; +import thaw.core.Logger; import thaw.core.I18n; +import thaw.plugins.Hsqldb; +import thaw.plugins.Signatures; +import thaw.plugins.webOfTrust.WebOfTrustConfigTab; -public class WebOfTrust implements Plugin { +public class WebOfTrust extends thaw.core.LibraryPlugin { + private Core core; + private Hsqldb db; + private Signatures sigs; - public WebOfTrust() { + private WebOfTrustConfigTab configTab = null; + + private int used = 0; + + public WebOfTrust() { used = 0; } + + private boolean loadDeps(Core core) { + /* Hsqldb */ + if(core.getPluginManager().getPlugin("thaw.plugins.Hsqldb") == null) { + Logger.info(this, "Loading Hsqldb plugin"); + if(core.getPluginManager().loadPlugin("thaw.plugins.Hsqldb") == null + || !core.getPluginManager().runPlugin("thaw.plugins.Hsqldb")) { + Logger.error(this, "Unable to load thaw.plugins.Hsqldb !"); + return false; + } + } + + db = (Hsqldb)core.getPluginManager().getPlugin("thaw.plugins.Hsqldb"); + db.registerChild(this); + + /* Signatures */ + if(core.getPluginManager().getPlugin("thaw.plugins.Signatures") == null) { + Logger.info(this, "Loading Signatures plugin"); + + if(core.getPluginManager().loadPlugin("thaw.plugins.Signatures") == null + || !core.getPluginManager().runPlugin("thaw.plugins.Signatures")) { + Logger.error(this, "Unable to load thaw.plugins.Signatures !"); + return false; + } + } + + sigs = (Signatures)core.getPluginManager().getPlugin("thaw.plugins.Signatures"); + sigs.registerChild(this); + + return true; } + + private boolean unloadDeps(Core core) { + + if (sigs != null) + sigs.unregisterChild(this); + if (db != null) + db.unregisterChild(this); + + sigs = null; + db = null; + + return true; + } public ImageIcon getIcon() { return thaw.gui.IconBox.trust; @@ -21,12 +74,48 @@ } public boolean run(Core core) { + core.getConfig().addListener("wotActivated", this); + core.getConfig().addListener("wotIdentityUsed", this); + core.getConfig().addListener("wotNumberOfRefresh", this); - return false; + used++; + + this.core = core; + + if (!loadDeps(core)) + return false; + + configTab = new WebOfTrustConfigTab(core.getConfigWindow(), + core.getConfig(), db); + + core.getConfigWindow().addTab(I18n.getMessage("thaw.plugin.wot"), + thaw.gui.IconBox.minTrust, + configTab.getPanel()); + + return true; } public void stop() { + used--; + + if (configTab != null) { + core.getConfigWindow().removeTab(configTab.getPanel()); + configTab = null; + } + + if (used == 0) + unloadDeps(core); + } + public void realStart() { + used++; } + public void realStop() { + used--; + + if (used == 0) + unloadDeps(core); + } + } Modified: trunk/apps/Thaw/src/thaw/plugins/signatures/DatabaseManager.java =================================================================== --- trunk/apps/Thaw/src/thaw/plugins/signatures/DatabaseManager.java 2008-02-05 09:22:17 UTC (rev 17546) +++ trunk/apps/Thaw/src/thaw/plugins/signatures/DatabaseManager.java 2008-02-05 16:56:43 UTC (rev 17547) @@ -102,7 +102,7 @@ } - /* dropTables is not implements because signatures may be VERY important */ + /* dropTables is not implemented because signatures may be VERY important */ /* (anyway, because of the foreign key, it would probably fail */ protected static boolean convertDatabase_1_to_2(Hsqldb db) { Added: trunk/apps/Thaw/src/thaw/plugins/webOfTrust/WebOfTrustConfigTab.java =================================================================== --- trunk/apps/Thaw/src/thaw/plugins/webOfTrust/WebOfTrustConfigTab.java (rev 0) +++ trunk/apps/Thaw/src/thaw/plugins/webOfTrust/WebOfTrustConfigTab.java 2008-02-05 16:56:43 UTC (rev 17547) @@ -0,0 +1,124 @@ +package thaw.plugins.webOfTrust; + +import java.awt.event.ActionEvent; +import java.awt.event.ActionListener; +import java.util.Iterator; +import java.util.Observable; +import java.util.Observer; +import java.util.Vector; + +import javax.swing.JCheckBox; +import javax.swing.JLabel; +import javax.swing.JPanel; +import javax.swing.JComboBox; + +import thaw.core.Config; +import thaw.core.I18n; +import thaw.plugins.Hsqldb; +import thaw.plugins.signatures.Identity; + +public class WebOfTrustConfigTab implements Observer, ActionListener { + private thaw.core.ConfigWindow configWindow; + private Config config; + private Hsqldb db; + + private JPanel panel; + private JCheckBox activated; + private JComboBox identityUsed; + private JComboBox numberOfRefresh; + + public WebOfTrustConfigTab(thaw.core.ConfigWindow configWindow, + Config config, Hsqldb db) { + this.configWindow = configWindow; + this.config = config; + this.db = db; + + panel = new JPanel(new java.awt.GridLayout(15, 1)); + + activated = new JCheckBox(I18n.getMessage("thaw.plugin.wot.activated")); + panel.add(activated); + + panel.add(new JLabel("")); + panel.add(new JLabel(I18n.getMessage("thaw.plugin.wot.usedIdentity"))); + + identityUsed = new JComboBox(); + panel.add(identityUsed); + + panel.add(new JLabel("")); + panel.add(new JLabel(I18n.getMessage("thaw.plugin.wot.numberOfRefresh"))); + + numberOfRefresh = new JComboBox(); + for (int i = 0 ; i <= 100 ; i++) + numberOfRefresh.addItem(new Integer(i)); + panel.add(numberOfRefresh); + + resetContentOfIdentitySelector(); + reloadSettings(); + readActivated(); + + activated.addActionListener(this); + configWindow.addObserver(this); + } + + private void resetContentOfIdentitySelector() { + Vector identities = Identity.getYourIdentities(db); + + identityUsed.removeAllItems(); + identityUsed.addItem(I18n.getMessage("thaw.plugin.wot.usedIdentity.none")); + + for (Iterator it = identities.iterator(); + it.hasNext();) { + identityUsed.addItem(it.next().toString()); + } + } + + protected void reloadSettings() { + /* default values */ + activated.setSelected(true); + numberOfRefresh.setSelectedItem(new Integer(10)); + identityUsed.setSelectedItem(I18n.getMessage("thaw.plugin.wot.usedIdentity.none")); + + /* loading values */ + if (config.getValue("wotActivated") != null) + activated.setSelected(Boolean.valueOf(config.getValue("wotActivated")).booleanValue()); + if (config.getValue("wotIdentityUsed") != null) + identityUsed.setSelectedItem(config.getValue("wotIdentityUsed")); + if (config.getValue("wotNumberOfRefresh") != null) + numberOfRefresh.setSelectedItem(new Integer(config.getValue("wotNumberOfRefresh"))); + } + + protected void saveSettings() { + config.setValue("wotActivated", Boolean.valueOf(activated.isSelected()).toString()); + + if (identityUsed.getSelectedIndex() <= 0) + config.setValue("wotIdentityUsed", null); + else + config.setValue("wotIdentityUsed", identityUsed.getSelectedItem().toString()); + + config.setValue("wotNumberOfRefresh", numberOfRefresh.getSelectedItem().toString()); + } + + private void readActivated() { + boolean s = activated.isSelected(); + + identityUsed.setEnabled(s); + numberOfRefresh.setEnabled(s); + } + + public JPanel getPanel() { + return panel; + } + + public void update(Observable o, Object param) { + if (param == configWindow.getOkButton()) + saveSettings(); + + resetContentOfIdentitySelector(); + reloadSettings(); + readActivated(); + } + + public void actionPerformed(ActionEvent e) { + readActivated(); + } +} From jflesch at freenetproject.org Wed Feb 6 02:18:48 2008 From: jflesch at freenetproject.org (jflesch at freenetproject.org) Date: Wed, 6 Feb 2008 02:18:48 +0000 (UTC) Subject: [Thaw-dev] r17586 - in trunk/apps/Thaw/src/thaw: core i18n plugins/signatures Message-ID: <20080206021848.B1DB148154F@freenetproject.org> Author: jflesch Date: 2008-02-06 02:18:48 +0000 (Wed, 06 Feb 2008) New Revision: 17586 Modified: trunk/apps/Thaw/src/thaw/core/Logger.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/signatures/Identity.java Log: Add two new trust levels to minifrost + change the colors used Modified: trunk/apps/Thaw/src/thaw/core/Logger.java =================================================================== --- trunk/apps/Thaw/src/thaw/core/Logger.java 2008-02-06 01:17:48 UTC (rev 17585) +++ trunk/apps/Thaw/src/thaw/core/Logger.java 2008-02-06 02:18:48 UTC (rev 17586) @@ -16,7 +16,7 @@ public final static int LOG_LEVEL_DEBUG = 4; public final static int LOG_LEVEL_VERBOSE = 5; - private static int LOG_LEVEL = 3; + private static int LOG_LEVEL = 2; public final static String[] PREFIXES = new String[] { Modified: trunk/apps/Thaw/src/thaw/i18n/source.thaw_fr.properties =================================================================== --- trunk/apps/Thaw/src/thaw/i18n/source.thaw_fr.properties 2008-02-06 01:17:48 UTC (rev 17585) +++ trunk/apps/Thaw/src/thaw/i18n/source.thaw_fr.properties 2008-02-06 02:18:48 UTC (rev 17586) @@ -511,11 +511,13 @@ thaw.plugin.signature.trustLevel.trustLevel=Status thaw.plugin.signature.trustLevel.dev=ARCHITECTE DE LA MATRICE +thaw.plugin.signature.trustLevel.trustworthy=FIABLE thaw.plugin.signature.trustLevel.good=BON thaw.plugin.signature.trustLevel.observe=EN OBSERVATION -thaw.plugin.signature.trustLevel.check=VALIDE +thaw.plugin.signature.trustLevel.check=SIGN? thaw.plugin.signature.trustLevel.bad=MAUVAIS thaw.plugin.signature.trustLevel.evil=DIABOLIQUE +thaw.plugin.signature.trustLevel.asshole=CONNARD thaw.plugin.signature.trustLevel.none=non-sign? thaw.plugin.signature.trustLevel.me=MOI Modified: trunk/apps/Thaw/src/thaw/i18n/thaw.properties =================================================================== --- trunk/apps/Thaw/src/thaw/i18n/thaw.properties 2008-02-06 01:17:48 UTC (rev 17585) +++ trunk/apps/Thaw/src/thaw/i18n/thaw.properties 2008-02-06 02:18:48 UTC (rev 17586) @@ -512,11 +512,13 @@ thaw.plugin.signature.trustLevel.trustLevel=Status thaw.plugin.signature.trustLevel.dev=MATRIX ARCHITECT +thaw.plugin.signature.trustLevel.trustworthy=TRUSTWORTHY thaw.plugin.signature.trustLevel.good=GOOD thaw.plugin.signature.trustLevel.observe=OBSERVE -thaw.plugin.signature.trustLevel.check=CHECK +thaw.plugin.signature.trustLevel.check=SIGNED thaw.plugin.signature.trustLevel.bad=BAD thaw.plugin.signature.trustLevel.evil=EVIL +thaw.plugin.signature.trustLevel.asshole=ASSHOLE thaw.plugin.signature.trustLevel.none=non-signed thaw.plugin.signature.trustLevel.me=ME Modified: trunk/apps/Thaw/src/thaw/i18n/thaw_fr.properties =================================================================== --- trunk/apps/Thaw/src/thaw/i18n/thaw_fr.properties 2008-02-06 01:17:48 UTC (rev 17585) +++ trunk/apps/Thaw/src/thaw/i18n/thaw_fr.properties 2008-02-06 02:18:48 UTC (rev 17586) @@ -511,11 +511,13 @@ thaw.plugin.signature.trustLevel.trustLevel=Status thaw.plugin.signature.trustLevel.dev=ARCHITECTE DE LA MATRICE +thaw.plugin.signature.trustLevel.trustworthy=FIABLE thaw.plugin.signature.trustLevel.good=BON thaw.plugin.signature.trustLevel.observe=EN OBSERVATION -thaw.plugin.signature.trustLevel.check=VALIDE +thaw.plugin.signature.trustLevel.check=SIGN\u00c9 thaw.plugin.signature.trustLevel.bad=MAUVAIS thaw.plugin.signature.trustLevel.evil=DIABOLIQUE +thaw.plugin.signature.trustLevel.asshole=CONNARD thaw.plugin.signature.trustLevel.none=non-sign\u00e9 thaw.plugin.signature.trustLevel.me=MOI @@ -711,3 +713,9 @@ ## Web of Trust thaw.plugin.wot=Toile de confiance +thaw.plugin.wot.activated=Activer la toile de confiance +thaw.plugin.wot.usedIdentity=Identit\u00e9 utilis\u00e9e pour publier la liste de confiances +thaw.plugin.wot.usedIdentity.none=[Ne pas publier la liste de confiance] +thaw.plugin.wot.numberOfRefresh=Nombre de liste de confiances \u00e0 rafraichir simultan\u00e9ment + + Modified: trunk/apps/Thaw/src/thaw/plugins/signatures/Identity.java =================================================================== --- trunk/apps/Thaw/src/thaw/plugins/signatures/Identity.java 2008-02-06 01:17:48 UTC (rev 17585) +++ trunk/apps/Thaw/src/thaw/plugins/signatures/Identity.java 2008-02-06 02:18:48 UTC (rev 17586) @@ -24,39 +24,47 @@ public final static int[] trustLevelInt = { 100, 10, + 5, 1, 0, -1, + -5, -10 }; public final static String[] trustLevelStr = { I18n.getMessage("thaw.plugin.signature.trustLevel.dev"), + I18n.getMessage("thaw.plugin.signature.trustLevel.trustworthy"), I18n.getMessage("thaw.plugin.signature.trustLevel.good"), I18n.getMessage("thaw.plugin.signature.trustLevel.observe"), I18n.getMessage("thaw.plugin.signature.trustLevel.check"), I18n.getMessage("thaw.plugin.signature.trustLevel.bad"), - I18n.getMessage("thaw.plugin.signature.trustLevel.evil") + I18n.getMessage("thaw.plugin.signature.trustLevel.evil"), + I18n.getMessage("thaw.plugin.signature.trustLevel.asshole") }; public final static String[] trustLevelUserStr= { + I18n.getMessage("thaw.plugin.signature.trustLevel.trustworthy"), I18n.getMessage("thaw.plugin.signature.trustLevel.good"), I18n.getMessage("thaw.plugin.signature.trustLevel.observe"), I18n.getMessage("thaw.plugin.signature.trustLevel.check"), I18n.getMessage("thaw.plugin.signature.trustLevel.bad"), - I18n.getMessage("thaw.plugin.signature.trustLevel.evil") + I18n.getMessage("thaw.plugin.signature.trustLevel.evil"), + I18n.getMessage("thaw.plugin.signature.trustLevel.asshole") }; public final static Color[] trustLevelColor = { Color.BLUE, - new java.awt.Color(0, 128, 0), /* light green */ - new java.awt.Color(0, 175, 0), /* green */ + new Color(0, 200, 0), /* light green */ + new Color(0, 150, 0), + new Color(0, 80, 0), /* green */ Color.BLACK, - new java.awt.Color(175, 0, 0), /* moderatly red */ - Color.RED + new Color(125, 0, 0), /* moderatly red */ + new Color(200, 0, 0), + new Color(255, 0, 0) }; - public final static Color trustLevelColorMe = new Color(0, 128, 0); + public final static Color trustLevelColorMe = new Color(127, 127, 255) /* weird color */; private Hsqldb db; From jflesch at freenetproject.org Wed Feb 6 02:33:47 2008 From: jflesch at freenetproject.org (jflesch at freenetproject.org) Date: Wed, 6 Feb 2008 02:33:47 +0000 (UTC) Subject: [Thaw-dev] r17587 - in trunk/apps/Thaw/src/thaw: i18n plugins/signatures Message-ID: <20080206023347.1AB99391D78@freenetproject.org> Author: jflesch Date: 2008-02-06 02:33:46 +0000 (Wed, 06 Feb 2008) New Revision: 17587 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/signatures/SigConfigTab.java Log: Signatures, fix : when an action is done on multiple identities, apply it on all the identities ! Modified: trunk/apps/Thaw/src/thaw/i18n/source.thaw_fr.properties =================================================================== --- trunk/apps/Thaw/src/thaw/i18n/source.thaw_fr.properties 2008-02-06 02:18:48 UTC (rev 17586) +++ trunk/apps/Thaw/src/thaw/i18n/source.thaw_fr.properties 2008-02-06 02:33:46 UTC (rev 17587) @@ -523,6 +523,8 @@ thaw.plugin.signature.import=Importer une ou plusieurs identit?(s) thaw.plugin.signature.export=Exporter l'identit? selectionn?e +thaw.plugin.signature.trustList.export=Export +thaw.plugin.signature.trustList.import=Import thaw.plugin.signature.ignoreLowerThan=Ignorer les signatures avec un status inf?rieur ? Modified: trunk/apps/Thaw/src/thaw/i18n/thaw.properties =================================================================== --- trunk/apps/Thaw/src/thaw/i18n/thaw.properties 2008-02-06 02:18:48 UTC (rev 17586) +++ trunk/apps/Thaw/src/thaw/i18n/thaw.properties 2008-02-06 02:33:46 UTC (rev 17587) @@ -527,6 +527,8 @@ thaw.plugin.signature.export=Export selected identity thaw.plugin.signature.setOriginal=Set as original +thaw.plugin.signature.trustList.export=Export +thaw.plugin.signature.trustList.import=Import thaw.plugin.signature.ignoreLowerThan=Ignore signatures with a status lower than Modified: trunk/apps/Thaw/src/thaw/i18n/thaw_fr.properties =================================================================== --- trunk/apps/Thaw/src/thaw/i18n/thaw_fr.properties 2008-02-06 02:18:48 UTC (rev 17586) +++ trunk/apps/Thaw/src/thaw/i18n/thaw_fr.properties 2008-02-06 02:33:46 UTC (rev 17587) @@ -523,6 +523,8 @@ thaw.plugin.signature.import=Importer une ou plusieurs identit\u00e9(s) thaw.plugin.signature.export=Exporter l'identit\u00e9 selectionn\u00e9e +thaw.plugin.signature.trustList.export=Export +thaw.plugin.signature.trustList.import=Import thaw.plugin.signature.ignoreLowerThan=Ignorer les signatures avec un status inf\u00e9rieur \u00e0 Modified: trunk/apps/Thaw/src/thaw/plugins/signatures/SigConfigTab.java =================================================================== --- trunk/apps/Thaw/src/thaw/plugins/signatures/SigConfigTab.java 2008-02-06 02:18:48 UTC (rev 17586) +++ trunk/apps/Thaw/src/thaw/plugins/signatures/SigConfigTab.java 2008-02-06 02:33:46 UTC (rev 17587) @@ -558,33 +558,32 @@ return; } - int row = table.getSelectedRow(); + int[] rows = table.getSelectedRows(); - if (row < 0) - return; + for (int i = 0 ; i < rows.length ; i++) { + int row = rows[i]; - Identity target = model.getIdentity(row); + if (row < 0) + continue; - if (target == null) - return; + Identity target = model.getIdentity(row); + if (target == null) + continue; - if (e.getSource() == setOriginal) { - target.setOriginal(); - updateList(); + if (e.getSource() == setOriginal) { + target.setOriginal(); - return; - } + updateList(); + } else if (e.getSource() instanceof JButton) { + JButton bt = (JButton)e.getSource(); - if (e.getSource() instanceof JButton) { - JButton bt = (JButton)e.getSource(); + target.setTrustLevel(bt.getText()); - target.setTrustLevel(bt.getText()); - - updateList(); - return; + updateList(); + } } } } From jflesch at freenetproject.org Wed Feb 6 03:02:01 2008 From: jflesch at freenetproject.org (jflesch at freenetproject.org) Date: Wed, 6 Feb 2008 03:02:01 +0000 (UTC) Subject: [Thaw-dev] r17588 - in trunk/apps/Thaw/src/thaw: core i18n plugins/signatures Message-ID: <20080206030201.C575D3A06C4@freenetproject.org> Author: jflesch Date: 2008-02-06 03:02:01 +0000 (Wed, 06 Feb 2008) New Revision: 17588 Modified: trunk/apps/Thaw/src/thaw/core/ConfigWindow.java trunk/apps/Thaw/src/thaw/core/Core.java trunk/apps/Thaw/src/thaw/core/MainWindow.java trunk/apps/Thaw/src/thaw/core/ThawThread.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/signatures/SigConfigTab.java Log: Core: Stop nicely Swing instead of calling System.exit(0); ... Modified: trunk/apps/Thaw/src/thaw/core/ConfigWindow.java =================================================================== --- trunk/apps/Thaw/src/thaw/core/ConfigWindow.java 2008-02-06 02:33:46 UTC (rev 17587) +++ trunk/apps/Thaw/src/thaw/core/ConfigWindow.java 2008-02-06 03:02:01 UTC (rev 17588) @@ -116,6 +116,8 @@ if (v) configWin.repaint(); + else if (core.isStopping()) + configWin.dispose(); } public boolean addTab(final String name, final java.awt.Component panel) { Modified: trunk/apps/Thaw/src/thaw/core/Core.java =================================================================== --- trunk/apps/Thaw/src/thaw/core/Core.java 2008-02-06 02:33:46 UTC (rev 17587) +++ trunk/apps/Thaw/src/thaw/core/Core.java 2008-02-06 03:02:01 UTC (rev 17588) @@ -553,6 +553,7 @@ Logger.info(this, "Hidding main window ..."); mainWindow.setVisible(false); + configWindow.setVisible(false); Logger.info(this, "Stopping plugins ..."); pluginManager.stopPlugins(); Modified: trunk/apps/Thaw/src/thaw/core/MainWindow.java =================================================================== --- trunk/apps/Thaw/src/thaw/core/MainWindow.java 2008-02-06 02:33:46 UTC (rev 17587) +++ trunk/apps/Thaw/src/thaw/core/MainWindow.java 2008-02-06 03:02:01 UTC (rev 17588) @@ -210,6 +210,7 @@ mainWindow.setExtendedState(Integer.parseInt(core.getConfig().getValue("mainWindowState"))); } + mainWindow.setDefaultCloseOperation(JFrame.DISPOSE_ON_CLOSE); } @@ -235,6 +236,9 @@ if (!v || !core.isStopping()) { mainWindow.setVisible(v); } + + if (!v && core.isStopping()) + mainWindow.dispose(); } @@ -531,12 +535,7 @@ Integer.toString(mainWindow.getExtendedState())); } - if(core == null) { - Logger.error(this, "Warning, no ref to core, exiting brutaly"); - System.exit(0); - } else { - core.exit(); - } + core.exit(); } Modified: trunk/apps/Thaw/src/thaw/core/ThawThread.java =================================================================== --- trunk/apps/Thaw/src/thaw/core/ThawThread.java 2008-02-06 02:33:46 UTC (rev 17587) +++ trunk/apps/Thaw/src/thaw/core/ThawThread.java 2008-02-06 03:02:01 UTC (rev 17588) @@ -42,12 +42,7 @@ Logger.info(this, "Thread '"+name+"' finished"); if (threads.size() == 0) { - Logger.notice(this, "All threads are stopped"); - - if (allowFullStop) { - Logger.notice(this, "Halting Thaw"); - System.exit(0); - } + Logger.notice(this, "All Thaw threads are stopped"); } } @@ -66,8 +61,7 @@ synchronized(threads) { if (allowFullStop) { if (threads.size() == 0) { - Logger.notice(null, "All threads are stopped => Halting Thaw"); - System.exit(0); + Logger.notice(null, "All Thaw threads are stopped."); } } } Modified: trunk/apps/Thaw/src/thaw/i18n/source.thaw_fr.properties =================================================================== --- trunk/apps/Thaw/src/thaw/i18n/source.thaw_fr.properties 2008-02-06 02:33:46 UTC (rev 17587) +++ trunk/apps/Thaw/src/thaw/i18n/source.thaw_fr.properties 2008-02-06 03:02:01 UTC (rev 17588) @@ -86,7 +86,9 @@ thaw.common.autodetect=Auto-detecter +thaw.common.close=Fermer thaw.common.closeTab=Fermer cette tabulation +thaw.common.closeWin=Fermer cette fen?tre thaw.common.apply=Appliquer @@ -523,9 +525,12 @@ thaw.plugin.signature.import=Importer une ou plusieurs identit?(s) thaw.plugin.signature.export=Exporter l'identit? selectionn?e -thaw.plugin.signature.trustList.export=Export -thaw.plugin.signature.trustList.import=Import +thaw.plugin.signature.trustList.export.short=Exporter +thaw.plugin.signature.trustList.export.long=Exporter votre liste de confiance +thaw.plugin.signature.trustList.import.short=Importer +thaw.plugin.signature.trustList.import.long=Import une liste de confiance (peut remplacer certains de vos choix) + thaw.plugin.signature.ignoreLowerThan=Ignorer les signatures avec un status inf?rieur ? Modified: trunk/apps/Thaw/src/thaw/i18n/thaw.properties =================================================================== --- trunk/apps/Thaw/src/thaw/i18n/thaw.properties 2008-02-06 02:33:46 UTC (rev 17587) +++ trunk/apps/Thaw/src/thaw/i18n/thaw.properties 2008-02-06 03:02:01 UTC (rev 17588) @@ -83,6 +83,7 @@ thaw.common.paste=Paste +thaw.common.close=Close thaw.common.closeTab=Close this tab thaw.common.closeWin=Close the window @@ -527,8 +528,10 @@ thaw.plugin.signature.export=Export selected identity thaw.plugin.signature.setOriginal=Set as original -thaw.plugin.signature.trustList.export=Export -thaw.plugin.signature.trustList.import=Import +thaw.plugin.signature.trustList.export.short=Export +thaw.plugin.signature.trustList.export.long=Export your trust list +thaw.plugin.signature.trustList.import.short=Import +thaw.plugin.signature.trustList.import.long=Import a trust list (may replace some of your current choice) thaw.plugin.signature.ignoreLowerThan=Ignore signatures with a status lower than Modified: trunk/apps/Thaw/src/thaw/i18n/thaw_fr.properties =================================================================== --- trunk/apps/Thaw/src/thaw/i18n/thaw_fr.properties 2008-02-06 02:33:46 UTC (rev 17587) +++ trunk/apps/Thaw/src/thaw/i18n/thaw_fr.properties 2008-02-06 03:02:01 UTC (rev 17588) @@ -523,9 +523,12 @@ thaw.plugin.signature.import=Importer une ou plusieurs identit\u00e9(s) thaw.plugin.signature.export=Exporter l'identit\u00e9 selectionn\u00e9e -thaw.plugin.signature.trustList.export=Export -thaw.plugin.signature.trustList.import=Import +thaw.plugin.signature.trustList.export.short=Exporter +thaw.plugin.signature.trustList.export.long=Exporter votre liste de confiance +thaw.plugin.signature.trustList.import.short=Importer +thaw.plugin.signature.trustList.import.long=Import une liste de confiance (peut remplacer certains de vos choix) + thaw.plugin.signature.ignoreLowerThan=Ignorer les signatures avec un status inf\u00e9rieur \u00e0 Modified: trunk/apps/Thaw/src/thaw/plugins/signatures/SigConfigTab.java =================================================================== --- trunk/apps/Thaw/src/thaw/plugins/signatures/SigConfigTab.java 2008-02-06 02:33:46 UTC (rev 17587) +++ trunk/apps/Thaw/src/thaw/plugins/signatures/SigConfigTab.java 2008-02-06 03:02:01 UTC (rev 17588) @@ -154,6 +154,9 @@ else if (param == configWindow.getCancelButton()) reset(); } + + + /************************ YOUR IDENTITIES ********************************/ protected class YourIdentitiesPanel implements ActionListener { @@ -223,7 +226,7 @@ dialog.getContentPane().add(southPanel, BorderLayout.SOUTH); - + dialog.setDefaultCloseOperation(JDialog.DISPOSE_ON_CLOSE); dialog.setSize(500, 300); dialog.setVisible(true); } @@ -365,17 +368,18 @@ if (e.getSource() == closeWindow) { dialog.setVisible(false); + dialog.dispose(); } } } + + + /********************* OTHER IDENTITIES **********************************/ protected class IdentityModel extends javax.swing.table.AbstractTableModel { - /** - * - */ private static final long serialVersionUID = -7614528570324908651L; public String[] columnNames = { @@ -436,10 +440,6 @@ protected class OtherIdentitiesRenderer extends thaw.gui.Table.DefaultRenderer { - - /** - * - */ private static final long serialVersionUID = 5405210731032136559L; private IdentityModel model; @@ -479,7 +479,7 @@ private JButton close; private JButton setOriginal; - private Vector buttons; + private JButton exportButton, importButton; public OtherIdentitiesPanel() { @@ -505,24 +505,33 @@ JPanel eastPanel = new JPanel(new BorderLayout()); - JPanel buttonsPanel = new JPanel(new GridLayout(Identity.trustLevelInt.length +1, 1)); + JPanel buttonsPanel = new JPanel(new GridLayout(Identity.trustLevelInt.length +4, 1)); - buttons = new Vector(); - for (int i = 0 ; i < Identity.trustLevelInt.length ; i++) { if (Identity.trustLevelInt[i] < 100) { JButton button = new JButton(Identity.trustLevelStr[i]); buttonsPanel.add(button); - buttons.add(button); button.addActionListener(this); } } + buttonsPanel.add(new JLabel("")); setOriginal = new JButton(I18n.getMessage("thaw.plugin.signature.setOriginal")); - buttonsPanel.add(new JLabel("")); buttonsPanel.add(setOriginal); - buttons.add(setOriginal); setOriginal.addActionListener(this); + + buttonsPanel.add(new JLabel("")); + exportButton = new JButton(I18n.getMessage("thaw.plugin.signature.trustList.export.short"), + IconBox.minExportAction); + exportButton.setToolTipText(I18n.getMessage("thaw.plugin.signature.trustList.export.long")); + exportButton.addActionListener(this); + buttonsPanel.add(exportButton); + + importButton = new JButton(I18n.getMessage("thaw.plugin.signature.trustList.import.short"), + IconBox.minImportAction); + importButton.setToolTipText(I18n.getMessage("thaw.plugin.signature.trustList.import.long")); + importButton.addActionListener(this); + buttonsPanel.add(importButton); JPanel eastTopPanel = new JPanel(); @@ -532,7 +541,9 @@ JPanel eastBottomPanel = new JPanel(); - close = new JButton(IconBox.minClose); + close = new JButton(I18n.getMessage("thaw.common.close"), + IconBox.minClose); + close.setToolTipText(I18n.getMessage("thaw.common.closeWin")); close.addActionListener(this); eastBottomPanel.add(close); @@ -542,7 +553,8 @@ dialog.getContentPane().add(eastPanel, BorderLayout.EAST); updateList(); - + + dialog.setDefaultCloseOperation(JDialog.DISPOSE_ON_CLOSE); dialog.setSize(640, 500); dialog.setVisible(true); } @@ -555,6 +567,7 @@ if (e.getSource() == close) { dialog.setVisible(false); + dialog.dispose(); return; } @@ -577,6 +590,10 @@ updateList(); + } else if (e.getSource() == exportButton) { + + } else if (e.getSource() == importButton) { + } else if (e.getSource() instanceof JButton) { JButton bt = (JButton)e.getSource(); @@ -593,9 +610,7 @@ public void actionPerformed(ActionEvent e) { if (e.getSource() == yourIdentitiesButton) { new YourIdentitiesPanel(); - } - - if (e.getSource() == otherIdentitiesButton) { + } else if (e.getSource() == otherIdentitiesButton) { new OtherIdentitiesPanel(); } } From jflesch at freenetproject.org Wed Feb 6 19:43:40 2008 From: jflesch at freenetproject.org (jflesch at freenetproject.org) Date: Wed, 6 Feb 2008 19:43:40 +0000 (UTC) Subject: [Thaw-dev] r17608 - trunk/apps/Thaw/src/thaw/plugins/miniFrost/frostKSK Message-ID: <20080206194340.111294793D6@freenetproject.org> Author: jflesch Date: 2008-02-06 19:43:39 +0000 (Wed, 06 Feb 2008) New Revision: 17608 Modified: trunk/apps/Thaw/src/thaw/plugins/miniFrost/frostKSK/KSKMessage.java Log: MiniFrost : Arh, I'm stupid, I was checking protocol error codes instead of the getFailed codes ... Modified: trunk/apps/Thaw/src/thaw/plugins/miniFrost/frostKSK/KSKMessage.java =================================================================== --- trunk/apps/Thaw/src/thaw/plugins/miniFrost/frostKSK/KSKMessage.java 2008-02-06 19:32:02 UTC (rev 17607) +++ trunk/apps/Thaw/src/thaw/plugins/miniFrost/frostKSK/KSKMessage.java 2008-02-06 19:43:39 UTC (rev 17608) @@ -99,16 +99,17 @@ int code = get.getGetFailedCode(); - if (get.getProtocolErrorCode() == 21 /* Too big */ - || get.getProtocolErrorCode() == 28 /* All data not found */) { + if (code == 21 /* Too big */ + || code == 28 /* All data not found */) { Logger.warning(this, "MiniFrost: Invalid key: "+key); successfullyDownloaded = true; board.addInvalidSlot(date, rev); - } else if (get.getProtocolErrorCode() == 4 - || code == 20) { + } else if (get.getProtocolErrorCode() == 4 /* URI parse error */ + || get.getProtocolErrorCode() == 20 /* URL parse error */ + || code == 20 /* Invalid URI */) { Logger.warning(this, "MiniFrost: Invalid key: "+key); successfullyDownloaded = true; } else if (get.getProtocolErrorCode() >= 0) { From jflesch at freenetproject.org Wed Feb 6 23:05:55 2008 From: jflesch at freenetproject.org (jflesch at freenetproject.org) Date: Wed, 6 Feb 2008 23:05:55 +0000 (UTC) Subject: [Thaw-dev] r17619 - in trunk/apps/Thaw/src/thaw/plugins: index signatures Message-ID: <20080206230555.C734E390B0B@freenetproject.org> Author: jflesch Date: 2008-02-06 23:05:55 +0000 (Wed, 06 Feb 2008) New Revision: 17619 Modified: trunk/apps/Thaw/src/thaw/plugins/index/IndexParser.java trunk/apps/Thaw/src/thaw/plugins/signatures/Identity.java trunk/apps/Thaw/src/thaw/plugins/signatures/SigConfigTab.java Log: Signatures : allow import/export of the trust list (not compatible with frost !) Modified: trunk/apps/Thaw/src/thaw/plugins/index/IndexParser.java =================================================================== --- trunk/apps/Thaw/src/thaw/plugins/index/IndexParser.java 2008-02-06 22:57:10 UTC (rev 17618) +++ trunk/apps/Thaw/src/thaw/plugins/index/IndexParser.java 2008-02-06 23:05:55 UTC (rev 17619) @@ -127,7 +127,7 @@ } - public Element getXMLHeader(final Document xmlDoc) { + private Element getXMLHeader(final Document xmlDoc) { final Element header = xmlDoc.createElement("header"); final Element title = xmlDoc.createElement("title"); @@ -182,7 +182,7 @@ } - public Element getXMLLinks(final Document xmlDoc) { + private Element getXMLLinks(final Document xmlDoc) { final Element linksEl = xmlDoc.createElement("indexes"); LinkContainer[] links = index.getLinkList(); @@ -203,7 +203,7 @@ } - public Element getXMLFileList(final Document xmlDoc) { + private Element getXMLFileList(final Document xmlDoc) { final Element filesEl = xmlDoc.createElement("files"); FileContainer[] files = index.getFileList(); @@ -242,7 +242,7 @@ } - public Element getXMLCommentInfos(final Document xmlDoc) { + private Element getXMLCommentInfos(final Document xmlDoc) { final Element infos = xmlDoc.createElement("comments"); infos.setAttribute("publicKey", index.getCommentPublicKey()); @@ -264,7 +264,7 @@ } - /*********** INDEX LOADING **************/ + /**************************** INDEX LOADING *******************************/ public void loadXML(final String filePath) { @@ -273,7 +273,7 @@ /** - * @param clean if set to false, will do a merge + * @param clean if set to false, will do a merge (won't call purgeIndex()) */ public void loadXML(final String filePath, boolean clean) { try { @@ -289,7 +289,7 @@ } - public class IndexHandler extends DefaultHandler { + protected class IndexHandler extends DefaultHandler { private boolean clean = true; public IndexHandler() { @@ -301,12 +301,6 @@ } /** - * @see org.xml.sax.ContentHandler#setDocumentLocator(org.xml.sax.Locator) - */ - public void setDocumentLocator(Locator value) { - } - - /** * Called when parsing is started * @see org.xml.sax.ContentHandler#startDocument() */ @@ -315,26 +309,6 @@ index.purgeIndex(); } - /** - * Called when starting to parse in a specific name space - * @param prefix name space prefix - * @param URI name space URI - * @see org.xml.sax.ContentHandler#startPrefixMapping(java.lang.String, java.lang.String) - */ - public void startPrefixMapping(String prefix, String URI) throws SAXException { - /* \_o< */ - } - - /** - * @param prefix name space prefix - * @see org.xml.sax.ContentHandler#endPrefixMapping(java.lang.String) - */ - public void endPrefixMapping(String prefix) throws SAXException { - /* \_o< */ - } - - - private boolean ownerTag = false; private boolean privateKeyTag = false; private boolean dateTag = false; @@ -538,23 +512,7 @@ } - public void ignorableWhitespace(char[] ch, int start, int end) throws SAXException { - - } - - public void processingInstruction(String target, String data) throws SAXException { - - } - /** - * @see org.xml.sax.ContentHandler#skippedEntity(java.lang.String) - */ - public void skippedEntity(String arg0) throws SAXException { - - } - - - /** * Called when parsing is finished * @see org.xml.sax.ContentHandler#endDocument() */ Modified: trunk/apps/Thaw/src/thaw/plugins/signatures/Identity.java =================================================================== --- trunk/apps/Thaw/src/thaw/plugins/signatures/Identity.java 2008-02-06 22:57:10 UTC (rev 17618) +++ trunk/apps/Thaw/src/thaw/plugins/signatures/Identity.java 2008-02-06 23:05:55 UTC (rev 17619) @@ -124,7 +124,14 @@ hash = frostCrypt.digest(publicKey); } + + protected void setDb(Hsqldb db) { + this.db = db; + } + protected void setId(int id) { + this.id = id; + } private static void initFrostCrypt() { if (frostCrypt == null) @@ -611,7 +618,11 @@ return current; } - + /** + * Frost format + * @param file + * @return + */ public boolean exportIdentity(File file) { Document doc = XMLTools.createDomDocument(); @@ -621,7 +632,9 @@ identityEl.appendChild(makeCDATA(doc, "name", toString())); identityEl.appendChild(makeCDATA(doc, "key", publicKey)); - identityEl.appendChild(makeCDATA(doc, "privKey", privateKey)); + + if (privateKey != null) + identityEl.appendChild(makeCDATA(doc, "privKey", privateKey)); root.appendChild(identityEl); doc.appendChild(root); @@ -656,19 +669,26 @@ return null; } - - public static Identity importIdentity(Hsqldb db, File file) { + /** + * Frost format + * @param db + * @param file + * @return Vector + */ + public static Vector importIdentity(Hsqldb db, File file) { + Vector ids = new Vector(); + try { Document doc = null; try { doc = XMLTools.parseXmlFile(file, false); } catch(Exception ex) { // xml format error - Logger.warning(ex, "Invalid Xml"); + Logger.error(ex, "Invalid Xml"); return null; } if( doc == null ) { - Logger.warning(null, + Logger.error(null, "Error: couldn't parse XML Document - " + "File name: '" + file.getName() + "'"); return null; @@ -680,7 +700,7 @@ if (l == null) { Logger.error(null, "No identity to import"); - return null; + return ids; } for (Iterator it = l.iterator(); @@ -697,6 +717,8 @@ publicKey, privateKey, false, 10); identity.insert(); + + ids.add(identity); } } catch(Exception e) { @@ -706,7 +728,7 @@ return null; } - return null; + return ids; } public boolean equals(Object o) { Modified: trunk/apps/Thaw/src/thaw/plugins/signatures/SigConfigTab.java =================================================================== --- trunk/apps/Thaw/src/thaw/plugins/signatures/SigConfigTab.java 2008-02-06 22:57:10 UTC (rev 17618) +++ trunk/apps/Thaw/src/thaw/plugins/signatures/SigConfigTab.java 2008-02-06 23:05:55 UTC (rev 17619) @@ -400,6 +400,10 @@ final TableModelEvent event = new TableModelEvent(this); fireTableChanged(event); } + + public Vector getIdentities() { + return identities; + } public int getRowCount() { if (identities == null) @@ -470,7 +474,7 @@ } - protected class OtherIdentitiesPanel implements ActionListener { + protected class OtherIdentitiesPanel implements ActionListener, TrustListParser.TrustListContainer { private JDialog dialog; private IdentityModel model; @@ -566,9 +570,37 @@ public void actionPerformed(ActionEvent e) { if (e.getSource() == close) { + dialog.setVisible(false); dialog.dispose(); return; + + } else if (e.getSource() == exportButton) { + + FileChooser chooser = new FileChooser(I18n.getMessage("thaw.plugin.signature.trustList.export.long")); + chooser.setDirectoryOnly(false); + chooser.setDialogType(javax.swing.JFileChooser.SAVE_DIALOG); + + File file = chooser.askOneFile(); + + TrustListParser.exportTrustList(model.getIdentities(), file); + + return; + + } else if (e.getSource() == importButton) { + + FileChooser chooser = new FileChooser(I18n.getMessage("thaw.plugin.signature.trustList.import.long")); + chooser.setDirectoryOnly(false); + chooser.setDialogType(javax.swing.JFileChooser.OPEN_DIALOG); + + File file = chooser.askOneFile(); + + synchronized(db.dbLock) { + TrustListParser.importTrustList(this, file); + updateList(); + } + + return; } int[] rows = table.getSelectedRows(); @@ -590,10 +622,6 @@ updateList(); - } else if (e.getSource() == exportButton) { - - } else if (e.getSource() == importButton) { - } else if (e.getSource() instanceof JButton) { JButton bt = (JButton)e.getSource(); @@ -603,6 +631,14 @@ } } } + + /** + * called back by the trust list parser when importing + */ + public void updateIdentity(Identity importedId) { + Identity id = Identity.getIdentity(db, importedId.getNick(), importedId.getPublicKey(), true /* create if doesn't exist */); + id.setTrustLevel(importedId.getTrustLevel()); + } } From jflesch at freenetproject.org Wed Feb 6 23:08:29 2008 From: jflesch at freenetproject.org (jflesch at freenetproject.org) Date: Wed, 6 Feb 2008 23:08:29 +0000 (UTC) Subject: [Thaw-dev] r17620 - trunk/apps/Thaw/src/thaw/plugins/signatures Message-ID: <20080206230829.A6EDB47BC41@freenetproject.org> Author: jflesch Date: 2008-02-06 23:08:29 +0000 (Wed, 06 Feb 2008) New Revision: 17620 Added: trunk/apps/Thaw/src/thaw/plugins/signatures/TrustListParser.java Log: Forgot a file ... Added: trunk/apps/Thaw/src/thaw/plugins/signatures/TrustListParser.java =================================================================== --- trunk/apps/Thaw/src/thaw/plugins/signatures/TrustListParser.java (rev 0) +++ trunk/apps/Thaw/src/thaw/plugins/signatures/TrustListParser.java 2008-02-06 23:08:29 UTC (rev 17620) @@ -0,0 +1,285 @@ +package thaw.plugins.signatures; + +import java.io.File; +import java.io.FileOutputStream; +import java.util.Vector; +import java.util.Iterator; + +import thaw.core.Logger; + +/* DOM */ + +import javax.xml.parsers.DocumentBuilder; +import javax.xml.parsers.DocumentBuilderFactory; +import javax.xml.transform.OutputKeys; +import javax.xml.transform.Transformer; +import javax.xml.transform.TransformerFactory; +import javax.xml.transform.dom.DOMSource; +import javax.xml.transform.stream.StreamResult; + +import org.w3c.dom.DOMImplementation; +import org.w3c.dom.Document; +import org.w3c.dom.Element; + +/* SAX */ + +import org.xml.sax.*; +import org.xml.sax.helpers.DefaultHandler; + +import javax.xml.parsers.SAXParserFactory; +import javax.xml.parsers.SAXParser; + +import java.io.FileInputStream; + + +public class TrustListParser { + private TrustListParser() { + + } + + /*********************** EXPORT ******************************/ + + public static boolean exportTrustList(Vector identities, File outputFile) { + try { + FileOutputStream out = new FileOutputStream(outputFile); + + StreamResult streamResult; + + streamResult = new StreamResult(out); + + Document xmlDoc; + + final DocumentBuilderFactory xmlFactory = DocumentBuilderFactory.newInstance(); + DocumentBuilder xmlBuilder; + + try { + xmlBuilder = xmlFactory.newDocumentBuilder(); + } catch(final javax.xml.parsers.ParserConfigurationException e) { + Logger.error(new TrustListParser(), "Unable to generate the index because : "+e.toString()); + return false; + } + + final DOMImplementation impl = xmlBuilder.getDOMImplementation(); + + xmlDoc = impl.createDocument(null, "trustList", null); + + final Element rootEl = xmlDoc.getDocumentElement(); + + /**** DOM Tree generation ****/ + fillInRootElement(identities, rootEl, xmlDoc); + + + /* Serialization */ + final DOMSource domSource = new DOMSource(xmlDoc); + final TransformerFactory transformFactory = TransformerFactory.newInstance(); + + Transformer serializer; + + try { + serializer = transformFactory.newTransformer(); + } catch(final javax.xml.transform.TransformerConfigurationException e) { + Logger.error(new TrustListParser(), "Unable to save index because: "+e.toString()); + return false; + } + + serializer.setOutputProperty(OutputKeys.ENCODING,"UTF-8"); + serializer.setOutputProperty(OutputKeys.INDENT,"yes"); + + /* final step */ + try { + serializer.transform(domSource, streamResult); + } catch(final javax.xml.transform.TransformerException e) { + Logger.error(new TrustListParser(), "Unable to save index because: "+e.toString()); + return false; + } + + out.close(); + + return true; + } catch(java.io.FileNotFoundException e) { + Logger.error(new TrustListParser(), "File not found exception ?!"); + } catch(java.io.IOException e) { + Logger.error(new TrustListParser(), "IOException while generating the index: "+e.toString()); + } + + return false; + } + + /** + * Use it only if you know what you're doing + * @param identities + * @param rootEl + * @param xmlDoc + * @return + */ + public static boolean fillInRootElement(Vector identities, Element rootEl, Document xmlDoc) { + //rootEl.appendChild(getXMLHeader(xmlDoc)); + + for (Iterator it = identities.iterator(); + it.hasNext();) { + Identity id = (Identity)it.next(); + + if (id.getTrustLevel() != 0 /* no just 'SIGNED' */ + && id.getTrustLevel() != Identity.trustLevelInt[0]) /* and no dev */ + rootEl.appendChild(getXMLIdentity(id, xmlDoc)); + } + + return true; + } + + private static Element getXMLIdentity(Identity id, Document xmlDoc) { + Element idEl = xmlDoc.createElement("identity"); + + Element nickEl = xmlDoc.createElement("nick"); + nickEl.appendChild(xmlDoc.createTextNode(id.getNick())); + idEl.appendChild(nickEl); + + Element publicKeyEl = xmlDoc.createElement("publicKey"); + publicKeyEl.appendChild(xmlDoc.createTextNode(id.getPublicKey())); + idEl.appendChild(publicKeyEl); + + Element trustLevelEl = xmlDoc.createElement("trustLevel"); + trustLevelEl.appendChild(xmlDoc.createTextNode(Integer.toString(id.getTrustLevel()*10))); + idEl.appendChild(trustLevelEl); + + return idEl; + } + + + + /*********************** IMPORT ****************************************/ + + public static interface TrustListContainer { + /** + * Identity is used here just as a container. + * no ref to the db was provided to these identity + * @param i + */ + public void updateIdentity(Identity i); + } + + + /** + * public so you can override it if you want + * @author jflesch + */ + public static class TrustListHandler extends DefaultHandler { + private TrustListContainer container; + + public TrustListHandler(TrustListContainer container) { + this.container = container; + } + + public void startDocument() throws SAXException { } + + private boolean nickTag = false; + private boolean publicKeyTag = false; + private boolean trustLevelTag = false; + + private String nick = null; + private String publicKey = null; + private String trustLevel = null; + + public void startElement(String nameSpaceURI, String localName, + String rawName, Attributes attrs) throws SAXException { + if (rawName == null) { + rawName = localName; + } + + if (rawName == null) + return; + + if ("identity".equals(rawName)) { + nickTag = false; + publicKeyTag = false; + trustLevelTag = false; + nick = null; + publicKey = null; + trustLevel = null; + } else if ("nick".equals(rawName)) { + nickTag = true; + } else if ("publicKey".equals(rawName)) { + publicKeyTag = true; + } else if ("trustLevel".equals(rawName)) { + trustLevelTag = true; + } + } + + + /** + * Called when a closing tag is met + * @see org.xml.sax.ContentHandler#endElement(java.lang.String, java.lang.String, java.lang.String) + */ + public void endElement(String nameSpaceURI, String localName, + String rawName) throws SAXException { + if (rawName == null) { + rawName = localName; + } + + if (rawName == null) + return; + + if ("identity".equals(rawName)) { + if (nick != null && publicKey != null && trustLevel != null) { + Identity i = new Identity(null, -1, nick, publicKey, null, false, Integer.parseInt(trustLevel)/10); + container.updateIdentity(i); + } + publicKey = null; + } else if ("nick".equals(rawName)) { + nickTag = false; + } else if ("publicKey".equals(rawName)) { + publicKeyTag = false; + } else if ("trustLevel".equals(rawName)) { + trustLevelTag = false; + } + } + + public void characters(char[] ch, int start, int end) throws SAXException { + String txt = new String(ch, start, end); + + if (nickTag) + nick = txt; + else if (publicKeyTag) + publicKey = txt; + else if (trustLevelTag) + trustLevel = txt; + } + + public void endDocument() throws SAXException { + + } + } + + public static void importTrustList(TrustListContainer container, File inputFile) { + importTrustList(new TrustListHandler(container), inputFile); + } + + public static void importTrustList(TrustListHandler handler, File inputFile) { + try { + FileInputStream stream = new FileInputStream(inputFile); + + // Use the default (non-validating) parser + SAXParserFactory factory = SAXParserFactory.newInstance(); + + // Parse the input + SAXParser saxParser = factory.newSAXParser(); + + Logger.notice(handler, "Parsing index ..."); + saxParser.parse(stream, handler); + Logger.notice(handler, "Parsing done"); + + stream.close(); + } catch(final java.io.FileNotFoundException e) { + Logger.error(new TrustListParser(), "Unable to load XML: FileNotFoundException ('"+inputFile.getPath()+"') ! : "+e.toString()); + } catch(java.io.IOException e) { + Logger.error(new TrustListParser(), "IOException while parsing the index: "+e.toString()); + } catch(javax.xml.parsers.ParserConfigurationException e) { + Logger.notice(new TrustListParser(), "Error (1) while parsing index: "+e.toString()); + } catch(org.xml.sax.SAXException e) { + Logger.notice(new TrustListParser(), "Error (2) while parsing index: "+e.toString()); + } catch(Exception e) { + Logger.notice(new TrustListParser(), "Error (4) while parsing index: "+e.toString()); + } + } + +} From jflesch at freenetproject.org Thu Feb 7 01:52:57 2008 From: jflesch at freenetproject.org (jflesch at freenetproject.org) Date: Thu, 7 Feb 2008 01:52:57 +0000 (UTC) Subject: [Thaw-dev] r17640 - in trunk/apps/Thaw: images src/thaw/core src/thaw/fcp src/thaw/gui src/thaw/i18n src/thaw/plugins src/thaw/plugins/nodeConfigurator Message-ID: <20080207015257.D8001391CAF@freenetproject.org> Author: jflesch Date: 2008-02-07 01:52:57 +0000 (Thu, 07 Feb 2008) New Revision: 17640 Added: trunk/apps/Thaw/images/min-plugins.png trunk/apps/Thaw/src/thaw/fcp/FCPGetConfig.java trunk/apps/Thaw/src/thaw/plugins/NodeConfigurator.java trunk/apps/Thaw/src/thaw/plugins/nodeConfigurator/ trunk/apps/Thaw/src/thaw/plugins/nodeConfigurator/NodeConfiguratorTab.java Modified: trunk/apps/Thaw/src/thaw/core/ConfigWindow.java trunk/apps/Thaw/src/thaw/core/PluginManager.java trunk/apps/Thaw/src/thaw/fcp/FCPMessage.java trunk/apps/Thaw/src/thaw/gui/IconBox.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 Log: New plugin : NodeConfigurator : allows to browse through the node configuration Added: trunk/apps/Thaw/images/min-plugins.png =================================================================== (Binary files differ) Property changes on: trunk/apps/Thaw/images/min-plugins.png ___________________________________________________________________ Name: svn:mime-type + application/octet-stream Modified: trunk/apps/Thaw/src/thaw/core/ConfigWindow.java =================================================================== --- trunk/apps/Thaw/src/thaw/core/ConfigWindow.java 2008-02-07 01:19:08 UTC (rev 17639) +++ trunk/apps/Thaw/src/thaw/core/ConfigWindow.java 2008-02-07 01:52:57 UTC (rev 17640) @@ -78,7 +78,7 @@ //tabs.setSize(600, 360); //okButton.setSize(100, 40); - configWin.setSize(600, 470); + configWin.setSize(700, 470); //configWin.setResizable(false); okButton.addActionListener(this); @@ -98,8 +98,8 @@ removeTab( pluginConfigPanel.getPanel() ); addTab("Thaw", IconBox.blueBunny, thawConfigPanel.getPanel()); - addTab(I18n.getMessage("thaw.common.node"), IconBox.minConnectAction, nodeConfigPanel.getPanel()); - addTab(I18n.getMessage("thaw.common.plugins"), IconBox.minSettings, pluginConfigPanel.getPanel()); + addTab(I18n.getMessage("thaw.config.nodeConnection"), IconBox.minConnectAction, nodeConfigPanel.getPanel()); + addTab(I18n.getMessage("thaw.common.plugins"), IconBox.minPlugins, pluginConfigPanel.getPanel()); } Modified: trunk/apps/Thaw/src/thaw/core/PluginManager.java =================================================================== --- trunk/apps/Thaw/src/thaw/core/PluginManager.java 2008-02-07 01:19:08 UTC (rev 17639) +++ trunk/apps/Thaw/src/thaw/core/PluginManager.java 2008-02-07 01:52:57 UTC (rev 17640) @@ -38,6 +38,7 @@ "thaw.plugins.MiniFrost", "thaw.plugins.Restarter", "thaw.plugins.TransferLogs", + "thaw.plugins.NodeConfigurator", "thaw.plugins.MDns", "thaw.plugins.IndexWebGrapher", "thaw.plugins.SqlConsole", Added: trunk/apps/Thaw/src/thaw/fcp/FCPGetConfig.java =================================================================== --- trunk/apps/Thaw/src/thaw/fcp/FCPGetConfig.java (rev 0) +++ trunk/apps/Thaw/src/thaw/fcp/FCPGetConfig.java 2008-02-07 01:52:57 UTC (rev 17640) @@ -0,0 +1,157 @@ +package thaw.fcp; + +import java.util.Observer; +import java.util.Observable; +import java.util.Hashtable; +import java.util.Enumeration; + +public class FCPGetConfig extends Observable implements FCPQuery, Observer { + private FCPQueueManager queueManager; + + private final boolean withCurrent; + private final boolean withShortDescription; + private final boolean withLongDescription; + private final boolean withDefaults; + private final boolean withSortOrder; + private final boolean withExpertFlag; + private final boolean withForceWriteFlag; + + public FCPGetConfig(boolean withCurrent, boolean withShortDescription, + boolean withLongDescription, boolean withDefaults, + boolean withSortOrder, boolean withExpertFlag, + boolean withForceWriteFlag) { + this.withCurrent = withCurrent; + this.withShortDescription = withShortDescription; + this.withLongDescription = withLongDescription; + this.withDefaults = withDefaults; + this.withSortOrder = withSortOrder; + this.withExpertFlag = withExpertFlag; + this.withForceWriteFlag = withForceWriteFlag; + } + + public int getQueryType() { + return 0; + } + + public boolean start(FCPQueueManager queueManager) { + this.queueManager = queueManager; + + queueManager.getQueryManager().addObserver(this); + + FCPMessage msg = new FCPMessage(); + msg.setMessageName("GetConfig"); + + msg.setValue("WithCurrent", Boolean.toString(withCurrent)); + msg.setValue("WithShortDescription", Boolean.toString(withShortDescription)); + msg.setValue("WithLongDescription", Boolean.toString(withLongDescription)); + msg.setValue("WithDefaults", Boolean.toString(withDefaults)); + msg.setValue("WithSortOrder", Boolean.toString(withSortOrder)); + msg.setValue("WithExpertFlag", Boolean.toString(withExpertFlag)); + msg.setValue("WithForceWriteFlag", Boolean.toString(withForceWriteFlag)); + + queueManager.getQueryManager().writeMessage(msg); + + return true; + } + + public boolean stop(FCPQueueManager queueManager) { + queueManager.getQueryManager().deleteObserver(this); + + return true; + } + + public class ConfigSetting implements Comparable { + private final String name; + private final String shortName; + private String current; + private String shortDesc; + private String longDesc; + private String defaultValue; + private int sortOrder; + private boolean expertFlag; + private boolean forceWriteFlag; + + public ConfigSetting(String name) { + this.name = name; + + int dotPos = name.indexOf('.'); + + shortName = name.substring(dotPos+1); + } + + public void setElement(String element, String value) { + element = element.toLowerCase(); + + if ("current".equals(element)) + current = value; + else if ("shortdescription".equals(element)) + shortDesc = value; + else if ("longdescription".equals(element)) + longDesc = value; + else if ("default".equals(element)) + defaultValue = value; + else if ("sortorder".equals(element)) + sortOrder = Integer.parseInt(value); + else if ("expertflag".equals(element)) + expertFlag = Boolean.valueOf(value).booleanValue(); + else if ("forcewriteflag".equals(element)) + forceWriteFlag = Boolean.valueOf(value).booleanValue(); + else + thaw.core.Logger.warning(this, "Unknow element '"+element+"' : '"+value+"' !"); + } + + public String getName() { return name; } + public String getCurrent() { return current; } + public String getShortDesc() { return shortDesc; } + public String getLongDesc() { return longDesc; } + public String getDefault() { return defaultValue; } + public int getSortOrder() { return sortOrder; } + public boolean getExpertFlag() { return expertFlag; } + public boolean getForceWriteFlag() { return forceWriteFlag; } + + public int compareTo(Object o) { + return new Integer(sortOrder).compareTo( new Integer(((ConfigSetting)o).getSortOrder()) ); + } + + public String toString() { return shortName; } + } + + public void update(Observable o, Object param) { + if (param == null || !(param instanceof FCPMessage)) + return; + + FCPMessage msg = (FCPMessage)param; + + if (!"ConfigData".equals(msg.getMessageName())) + return; + + Hashtable fields = msg.getValues(); + Hashtable configSettings = new Hashtable(); + + for (Enumeration keysEnum = fields.keys(); + keysEnum.hasMoreElements(); ) { + + String key = (String)keysEnum.nextElement(); + String value = (String)fields.get(key); + + int firstPointPos = key.indexOf('.'); + + String element = key.substring(0, firstPointPos); + String name = key.substring(firstPointPos+1); + + ConfigSetting setting = null; + + if ( (setting = (ConfigSetting)configSettings.get(name)) == null) { + setting = new ConfigSetting(name); + configSettings.put(name, setting); + } + + setting.setElement(element, value); + } + + setChanged(); + notifyObservers(configSettings); + + stop(queueManager); + } +} Modified: trunk/apps/Thaw/src/thaw/fcp/FCPMessage.java =================================================================== --- trunk/apps/Thaw/src/thaw/fcp/FCPMessage.java 2008-02-07 01:19:08 UTC (rev 17639) +++ trunk/apps/Thaw/src/thaw/fcp/FCPMessage.java 2008-02-07 01:52:57 UTC (rev 17640) @@ -50,15 +50,13 @@ /* Line not containing '=' (like "Data" or "EndMessage") are ignored */ if("".equals( lines[i] ) || !(lines[i].indexOf("=") >= 0)) continue; + + int equalPos = lines[i].indexOf('='); + + String name = lines[i].substring(0, equalPos); + String value = lines[i].substring(equalPos+1); - final String[] affectation = lines[i].split("="); - - if(affectation.length < 2) { - Logger.warning(this, "Malformed message"); - continue; - } - - setValue(affectation[0], affectation[1]); + setValue(name, value); } Modified: trunk/apps/Thaw/src/thaw/gui/IconBox.java =================================================================== --- trunk/apps/Thaw/src/thaw/gui/IconBox.java 2008-02-07 01:19:08 UTC (rev 17639) +++ trunk/apps/Thaw/src/thaw/gui/IconBox.java 2008-02-07 01:52:57 UTC (rev 17640) @@ -178,6 +178,8 @@ public static ImageIcon trust; public static ImageIcon minTrust; + + public static ImageIcon minPlugins; /** @@ -326,6 +328,7 @@ IconBox.miniFrostOutlookView = IconBox.loadIcon("images/miniFrost-view-outlook.png"); IconBox.trust = IconBox.loadIcon("images/trust.png"); IconBox.minTrust = IconBox.loadIcon("images/min-trust.png"); + IconBox.minPlugins = IconBox.loadIcon("images/min-plugins.png"); } } Modified: trunk/apps/Thaw/src/thaw/i18n/source.thaw_fr.properties =================================================================== --- trunk/apps/Thaw/src/thaw/i18n/source.thaw_fr.properties 2008-02-07 01:19:08 UTC (rev 17639) +++ trunk/apps/Thaw/src/thaw/i18n/source.thaw_fr.properties 2008-02-07 01:52:57 UTC (rev 17640) @@ -161,7 +161,9 @@ thaw.config.downloadLocally=T??l??charger les fichiers depuis la node +thaw.config.nodeConnection=Connexion ?? la node + ## Plugins thaw.plugin.queueWatcher=Transferts @@ -725,4 +727,13 @@ thaw.plugin.wot.usedIdentity.none=[Ne pas publier la liste de confiance] thaw.plugin.wot.numberOfRefresh=Nombre de liste de confiances ?? rafraichir simultan??ment +## node configurator +thaw.plugin.nodeConfig=Configuration de la node +thaw.plugin.nodeConfig.categories=Categories +thaw.plugin.nodeConfig.settings=R??glages +thaw.plugin.nodeConfig.description=Description +thaw.plugin.nodeConfig.value=Valeur actuelle +thaw.plugin.nodeConfig.default=Valeur par d??faut +thaw.plugin.nodeConfig.reload=Recharger les valeurs + Modified: trunk/apps/Thaw/src/thaw/i18n/thaw.properties =================================================================== --- trunk/apps/Thaw/src/thaw/i18n/thaw.properties 2008-02-07 01:19:08 UTC (rev 17639) +++ trunk/apps/Thaw/src/thaw/i18n/thaw.properties 2008-02-07 01:52:57 UTC (rev 17640) @@ -158,6 +158,7 @@ thaw.config.downloadLocally=Download files from the node +thaw.config.nodeConnection=Connection to the node ######## Plugins @@ -733,4 +734,14 @@ thaw.plugin.wot.usedIdentity.none=[Don't publish the trust list] thaw.plugin.wot.numberOfRefresh=Number of trust list to refresh simultaneously +##?Node configurator +thaw.plugin.nodeConfig=Node configuration + +thaw.plugin.nodeConfig=Configuration de la node +thaw.plugin.nodeConfig.categories=Categories +thaw.plugin.nodeConfig.settings=Settings +thaw.plugin.nodeConfig.description=Description +thaw.plugin.nodeConfig.value=Current Value +thaw.plugin.nodeConfig.default=Value by default +thaw.plugin.nodeConfig.reload=Reload values Modified: trunk/apps/Thaw/src/thaw/i18n/thaw_fr.properties =================================================================== --- trunk/apps/Thaw/src/thaw/i18n/thaw_fr.properties 2008-02-07 01:19:08 UTC (rev 17639) +++ trunk/apps/Thaw/src/thaw/i18n/thaw_fr.properties 2008-02-07 01:52:57 UTC (rev 17640) @@ -86,7 +86,9 @@ thaw.common.autodetect=Auto-detecter +thaw.common.close=Fermer thaw.common.closeTab=Fermer cette tabulation +thaw.common.closeWin=Fermer cette fen\u00eatre thaw.common.apply=Appliquer @@ -159,7 +161,9 @@ thaw.config.downloadLocally=T\u00e9l\u00e9charger les fichiers depuis la node +thaw.config.nodeConnection=Connexion \u00e0 la node + ## Plugins thaw.plugin.queueWatcher=Transferts @@ -723,4 +727,13 @@ thaw.plugin.wot.usedIdentity.none=[Ne pas publier la liste de confiance] thaw.plugin.wot.numberOfRefresh=Nombre de liste de confiances \u00e0 rafraichir simultan\u00e9ment +## node configurator +thaw.plugin.nodeConfig=Configuration de la node +thaw.plugin.nodeConfig.categories=Categories +thaw.plugin.nodeConfig.settings=R\u00e9glages +thaw.plugin.nodeConfig.description=Description +thaw.plugin.nodeConfig.value=Valeur actuelle +thaw.plugin.nodeConfig.default=Valeur par d\u00e9faut +thaw.plugin.nodeConfig.reload=Recharger les valeurs + Added: trunk/apps/Thaw/src/thaw/plugins/NodeConfigurator.java =================================================================== --- trunk/apps/Thaw/src/thaw/plugins/NodeConfigurator.java (rev 0) +++ trunk/apps/Thaw/src/thaw/plugins/NodeConfigurator.java 2008-02-07 01:52:57 UTC (rev 17640) @@ -0,0 +1,50 @@ +package thaw.plugins; + +import javax.swing.ImageIcon; + +import thaw.core.Core; +import thaw.core.I18n; +import thaw.core.Plugin; + +import thaw.plugins.nodeConfigurator.*; + +public class NodeConfigurator implements Plugin { + private Core core; + private NodeConfiguratorTab configTab; + + public NodeConfigurator() { } + + public ImageIcon getIcon() { + return thaw.gui.IconBox.settings; + } + + public String getNameForUser() { + return thaw.core.I18n.getMessage("thaw.plugin.nodeConfig"); + } + + public boolean run(Core core) { + this.core = core; + + core.getConfig().addListener("advancedMode", this); + + boolean advanced = Boolean.valueOf(core.getConfig().getValue("advancedMode")).booleanValue(); + + configTab = new NodeConfiguratorTab(advanced, core.getQueueManager()); + + core.getConfigWindow().addTab(I18n.getMessage("thaw.plugin.nodeConfig"), + thaw.gui.IconBox.minSettings, + configTab.getPanel()); + + configTab.refresh(); + + return true; + } + + public void stop() { + if (configTab != null) { + core.getConfigWindow().removeTab(configTab.getPanel()); + configTab = null; + } + } + +} Added: trunk/apps/Thaw/src/thaw/plugins/nodeConfigurator/NodeConfiguratorTab.java =================================================================== --- trunk/apps/Thaw/src/thaw/plugins/nodeConfigurator/NodeConfiguratorTab.java (rev 0) +++ trunk/apps/Thaw/src/thaw/plugins/nodeConfigurator/NodeConfiguratorTab.java 2008-02-07 01:52:57 UTC (rev 17640) @@ -0,0 +1,249 @@ +package thaw.plugins.nodeConfigurator; + +import javax.swing.JPanel; +import javax.swing.JList; +import javax.swing.JTextField; +import javax.swing.JTextArea; +import javax.swing.JScrollPane; +import javax.swing.JLabel; +import javax.swing.JButton; +import javax.swing.event.ListSelectionEvent; +import javax.swing.event.ListSelectionListener; +import javax.swing.ListSelectionModel; + +import java.awt.BorderLayout; +import java.awt.GridLayout; + +import java.awt.event.ActionEvent; +import java.awt.event.ActionListener; + +import java.util.Observer; +import java.util.Observable; +import java.util.Hashtable; +import java.util.Enumeration; +import java.util.Vector; +import java.util.Iterator; + +import thaw.core.Config; +import thaw.core.I18n; +import thaw.fcp.FCPGetConfig; +import thaw.fcp.FCPQueueManager; + +public class NodeConfiguratorTab implements Observer, ActionListener, ListSelectionListener { + private FCPQueueManager queueManager; + private boolean advanced; + + private JPanel panel; + + private JButton reload; + + private JList categoryChoice; + private JList settingChoice; + private JTextArea descriptionArea; + private JTextField valueField; + private JTextField defaultField; + + private JButton applyButton; + + public final static int COLUMNS_WIDTH = 125; + public final static int GRAY = 240; + + private Hashtable categories = null; + private Vector categoryNames = null; + + public NodeConfiguratorTab(boolean advanced, FCPQueueManager queueManager) { + this.advanced = advanced; + this.queueManager = queueManager; + + JScrollPane sc; + + panel = new JPanel(new BorderLayout(5, 5)); + + /* reload */ + JPanel reloadPanel = new JPanel(new BorderLayout()); + reload = new JButton(I18n.getMessage("thaw.plugin.nodeConfig.reload")); + reload.addActionListener(this); + reloadPanel.add(reload, BorderLayout.WEST); + reloadPanel.add(new JLabel(""), BorderLayout.EAST); + + panel.add(reloadPanel, BorderLayout.NORTH); + + /* categories */ + JPanel categoryPanel = new JPanel(new BorderLayout(0, 0)); + categoryPanel.add(new JLabel(I18n.getMessage("thaw.plugin.nodeConfig.categories")), BorderLayout.NORTH); + categoryChoice = new JList(); + categoryChoice.setSelectionMode(ListSelectionModel.SINGLE_SELECTION); + categoryChoice.addListSelectionListener(this); + categoryPanel.add(sc = new JScrollPane(categoryChoice), BorderLayout.CENTER); + sc.setPreferredSize(new java.awt.Dimension(COLUMNS_WIDTH, COLUMNS_WIDTH)); + + panel.add(categoryPanel, BorderLayout.WEST); + + JPanel subPanel = new JPanel(new BorderLayout(5, 5)); + + /* settings */ + JPanel settingsPanel = new JPanel(new BorderLayout(0, 0)); + settingsPanel.add(new JLabel(I18n.getMessage("thaw.plugin.nodeConfig.settings")), BorderLayout.NORTH); + settingChoice = new JList(); + settingChoice.addListSelectionListener(this); + settingsPanel.add(sc = new JScrollPane(settingChoice), BorderLayout.CENTER); + sc.setPreferredSize(new java.awt.Dimension(COLUMNS_WIDTH*2, COLUMNS_WIDTH*2)); + + subPanel.add(settingsPanel, BorderLayout.WEST); + + + JPanel descAndValuePanel = new JPanel(new GridLayout(2, 1)); + + /* description */ + JPanel descPanel = new JPanel(new BorderLayout(0, 0)); + descPanel.add(new JLabel(I18n.getMessage("thaw.plugin.nodeConfig.description")), BorderLayout.NORTH); + descriptionArea = new JTextArea(); + descriptionArea.setEditable(false); + descriptionArea.setBackground(new java.awt.Color(GRAY, GRAY, GRAY)); + descriptionArea.setLineWrap(true); + descriptionArea.setWrapStyleWord(true); + descPanel.add(new JScrollPane(descriptionArea), BorderLayout.CENTER); + descAndValuePanel.add(descPanel); + + JPanel valueAndButtonsPanel = new JPanel(new BorderLayout(0, 0)); + + /* value */ + JPanel valuePanel = new JPanel(new GridLayout(4, 0)); + valuePanel.add(new JLabel(I18n.getMessage("thaw.plugin.nodeConfig.default"))); + defaultField = new JTextField(); + defaultField.setEditable(false); + defaultField.setBackground(new java.awt.Color(GRAY, GRAY, GRAY)); + valuePanel.add(defaultField); + valuePanel.add(new JLabel(I18n.getMessage("thaw.plugin.nodeConfig.value"))); + valueField = new JTextField(); + valueField.addActionListener(this); + valuePanel.add(valueField); + + valueAndButtonsPanel.add(valuePanel, BorderLayout.NORTH); + + /* button(s) */ + applyButton = new JButton(I18n.getMessage("thaw.common.apply")); + applyButton.addActionListener(this); + + valueAndButtonsPanel.add(new JLabel(""), BorderLayout.CENTER); + valueAndButtonsPanel.add(applyButton, BorderLayout.SOUTH); + + descAndValuePanel.add(valueAndButtonsPanel); + + subPanel.add(descAndValuePanel, BorderLayout.CENTER); + + panel.add(subPanel, BorderLayout.CENTER); + + } + + public JPanel getPanel() { + return panel; + } + + public void refresh() { + FCPGetConfig getConfig = new FCPGetConfig(true /* current */, false /* with short desc */, + true /* with long desc */, true /* with defaults */, + true /* with sort order */, true /* with expert flag */, + false /* with force write flag */); + getConfig.addObserver(this); + getConfig.start(queueManager); + } + + private void refreshDisplay() { + categoryChoice.removeListSelectionListener(this); + categoryChoice.setListData(categoryNames); + categoryChoice.addListSelectionListener(this); + + settingChoice.removeListSelectionListener(this); + settingChoice.setListData(new Vector()); + settingChoice.addListSelectionListener(this); + + descriptionArea.setText(""); + valueField.setText(""); + defaultField.setText(""); + } + + public void actionPerformed(ActionEvent e) { + if (e.getSource() == applyButton || e.getSource() == valueField) { + + } else if (e.getSource() == reload) { + refresh(); + } + } + + public void valueChanged(ListSelectionEvent e) { + if (e.getSource() == categoryChoice) { + + synchronized(categories) { + + String catName = (String)categoryChoice.getSelectedValue(); + + settingChoice.removeListSelectionListener(this); + settingChoice.setListData((Vector)categories.get(catName)); + settingChoice.addListSelectionListener(this); + + descriptionArea.setText(""); + valueField.setText(""); + defaultField.setText(""); + + } + + } else if (e.getSource() == settingChoice) { + + FCPGetConfig.ConfigSetting setting = (FCPGetConfig.ConfigSetting)settingChoice.getSelectedValue(); + descriptionArea.setText(setting.getLongDesc()); + valueField.setText(setting.getCurrent()); + defaultField.setText(setting.getDefault()); + } + } + + public void update(Observable o, Object param) { + if (param == null || !(param instanceof Hashtable)) + return; + + Hashtable configSettings = (Hashtable)param; + + /* will restructure the data */ + categories = new Hashtable(); + categoryNames = new Vector(); + + synchronized(categories) { + + /* first : sort them by category */ + + for (Enumeration keyEnum = configSettings.keys(); + keyEnum.hasMoreElements();) { + + String name = (String)keyEnum.nextElement(); + FCPGetConfig.ConfigSetting setting = (FCPGetConfig.ConfigSetting)configSettings.get(name); + + if (setting.getExpertFlag() && !advanced) + continue; + + int dotPos = name.indexOf('.'); + String categoryName = name.substring(0, dotPos); + + Vector categorySettings = (Vector)categories.get(categoryName); + if (categorySettings == null) { + categoryNames.add(categoryName); + categorySettings = new Vector(); + categories.put(categoryName, categorySettings); + } + + categorySettings.add(setting); + } + + /* second : sort them by sortOrder */ + + for (Enumeration keyEnum = categories.keys(); + keyEnum.hasMoreElements();) { + String catName = (String)keyEnum.nextElement(); + Vector categorySettings = (Vector)categories.get(catName); + + java.util.Collections.sort(categorySettings); + } + + refreshDisplay(); + } + } +} From jflesch at freenetproject.org Thu Feb 7 02:02:59 2008 From: jflesch at freenetproject.org (jflesch at freenetproject.org) Date: Thu, 7 Feb 2008 02:02:59 +0000 (UTC) Subject: [Thaw-dev] r17641 - in trunk/apps/Thaw/src/thaw: fcp plugins/nodeConfigurator Message-ID: <20080207020259.B6150391C53@freenetproject.org> Author: jflesch Date: 2008-02-07 02:02:59 +0000 (Thu, 07 Feb 2008) New Revision: 17641 Added: trunk/apps/Thaw/src/thaw/fcp/FCPModifyConfig.java Modified: trunk/apps/Thaw/src/thaw/fcp/FCPGetConfig.java trunk/apps/Thaw/src/thaw/plugins/nodeConfigurator/NodeConfiguratorTab.java Log: Modified: trunk/apps/Thaw/src/thaw/fcp/FCPGetConfig.java =================================================================== --- trunk/apps/Thaw/src/thaw/fcp/FCPGetConfig.java 2008-02-07 01:52:57 UTC (rev 17640) +++ trunk/apps/Thaw/src/thaw/fcp/FCPGetConfig.java 2008-02-07 02:02:59 UTC (rev 17641) @@ -148,10 +148,10 @@ setting.setElement(element, value); } + + stop(queueManager); setChanged(); notifyObservers(configSettings); - - stop(queueManager); } } Added: trunk/apps/Thaw/src/thaw/fcp/FCPModifyConfig.java =================================================================== --- trunk/apps/Thaw/src/thaw/fcp/FCPModifyConfig.java (rev 0) +++ trunk/apps/Thaw/src/thaw/fcp/FCPModifyConfig.java 2008-02-07 02:02:59 UTC (rev 17641) @@ -0,0 +1,29 @@ +package thaw.fcp; + +public class FCPModifyConfig implements FCPQuery { + private String name, value; + + public FCPModifyConfig(String name, String newValue) { + this.name = name; + this.value = newValue; + } + + public int getQueryType() { + return 0; + } + + public boolean start(FCPQueueManager queueManager) { + FCPMessage msg = new FCPMessage(); + msg.setMessageName("ModifyConfig"); + msg.setValue(name, value); + + queueManager.getQueryManager().writeMessage(msg); + + return true; + } + + public boolean stop(FCPQueueManager queueManager) { + return false; + } + +} Modified: trunk/apps/Thaw/src/thaw/plugins/nodeConfigurator/NodeConfiguratorTab.java =================================================================== --- trunk/apps/Thaw/src/thaw/plugins/nodeConfigurator/NodeConfiguratorTab.java 2008-02-07 01:52:57 UTC (rev 17640) +++ trunk/apps/Thaw/src/thaw/plugins/nodeConfigurator/NodeConfiguratorTab.java 2008-02-07 02:02:59 UTC (rev 17641) @@ -22,11 +22,10 @@ import java.util.Hashtable; import java.util.Enumeration; import java.util.Vector; -import java.util.Iterator; -import thaw.core.Config; import thaw.core.I18n; import thaw.fcp.FCPGetConfig; +import thaw.fcp.FCPModifyConfig; import thaw.fcp.FCPQueueManager; public class NodeConfiguratorTab implements Observer, ActionListener, ListSelectionListener { @@ -166,6 +165,16 @@ public void actionPerformed(ActionEvent e) { if (e.getSource() == applyButton || e.getSource() == valueField) { + FCPGetConfig.ConfigSetting setting = (FCPGetConfig.ConfigSetting)settingChoice.getSelectedValue(); + + String name = setting.getName(); + String value = valueField.getText(); + + FCPModifyConfig modifConf = new FCPModifyConfig(name, value); + modifConf.start(queueManager); + + refresh(); + } else if (e.getSource() == reload) { refresh(); } From jflesch at freenetproject.org Thu Feb 7 02:26:05 2008 From: jflesch at freenetproject.org (jflesch at freenetproject.org) Date: Thu, 7 Feb 2008 02:26:05 +0000 (UTC) Subject: [Thaw-dev] r17642 - trunk/apps/Thaw/src/thaw/plugins/nodeConfigurator Message-ID: <20080207022605.33F6047A070@freenetproject.org> Author: jflesch Date: 2008-02-07 02:26:04 +0000 (Thu, 07 Feb 2008) New Revision: 17642 Modified: trunk/apps/Thaw/src/thaw/plugins/nodeConfigurator/NodeConfiguratorTab.java Log: Node configurator : use a combobox (true|false) instead of a text field when the default value is "true" or "false" Modified: trunk/apps/Thaw/src/thaw/plugins/nodeConfigurator/NodeConfiguratorTab.java =================================================================== --- trunk/apps/Thaw/src/thaw/plugins/nodeConfigurator/NodeConfiguratorTab.java 2008-02-07 02:02:59 UTC (rev 17641) +++ trunk/apps/Thaw/src/thaw/plugins/nodeConfigurator/NodeConfiguratorTab.java 2008-02-07 02:26:04 UTC (rev 17642) @@ -2,6 +2,7 @@ import javax.swing.JPanel; import javax.swing.JList; +import javax.swing.JComboBox; import javax.swing.JTextField; import javax.swing.JTextArea; import javax.swing.JScrollPane; @@ -39,9 +40,15 @@ private JList categoryChoice; private JList settingChoice; private JTextArea descriptionArea; + private JTextField valueField; + private JComboBox valueSelecter; + private boolean selecter = false; + private JTextField defaultField; + private JPanel valuePanel; + private JButton applyButton; public final static int COLUMNS_WIDTH = 125; @@ -49,6 +56,9 @@ private Hashtable categories = null; private Vector categoryNames = null; + + private final static String trueStr = I18n.getMessage("thaw.common.true"); + private final static String falseStr = I18n.getMessage("thaw.common.false"); public NodeConfiguratorTab(boolean advanced, FCPQueueManager queueManager) { this.advanced = advanced; @@ -107,7 +117,7 @@ JPanel valueAndButtonsPanel = new JPanel(new BorderLayout(0, 0)); /* value */ - JPanel valuePanel = new JPanel(new GridLayout(4, 0)); + valuePanel = new JPanel(new GridLayout(4, 0)); valuePanel.add(new JLabel(I18n.getMessage("thaw.plugin.nodeConfig.default"))); defaultField = new JTextField(); defaultField.setEditable(false); @@ -115,9 +125,15 @@ valuePanel.add(defaultField); valuePanel.add(new JLabel(I18n.getMessage("thaw.plugin.nodeConfig.value"))); valueField = new JTextField(); - valueField.addActionListener(this); valuePanel.add(valueField); + selecter = false; + + valueSelecter = new JComboBox(new String[] { + trueStr, + falseStr + }); + valueAndButtonsPanel.add(valuePanel, BorderLayout.NORTH); /* button(s) */ @@ -156,20 +172,51 @@ settingChoice.removeListSelectionListener(this); settingChoice.setListData(new Vector()); settingChoice.addListSelectionListener(this); + + displayField(); descriptionArea.setText(""); valueField.setText(""); defaultField.setText(""); } + + private void displaySelecter() { + if (!selecter) { + valuePanel.remove(valueField); + valuePanel.add(valueSelecter); + selecter = true; + panel.revalidate(); + } + } + + private void displayField() { + if (selecter) { + valuePanel.remove(valueSelecter); + valuePanel.add(valueField); + selecter = false; + panel.revalidate(); + } + } public void actionPerformed(ActionEvent e) { - if (e.getSource() == applyButton || e.getSource() == valueField) { + if (e.getSource() == applyButton) { FCPGetConfig.ConfigSetting setting = (FCPGetConfig.ConfigSetting)settingChoice.getSelectedValue(); String name = setting.getName(); - String value = valueField.getText(); + String value; + + if (!selecter) + value = valueField.getText(); + else { + String selected = (String)valueSelecter.getSelectedItem(); + if (trueStr == selected) + value = "true"; + else + value = "false"; + } + FCPModifyConfig modifConf = new FCPModifyConfig(name, value); modifConf.start(queueManager); @@ -190,6 +237,8 @@ settingChoice.removeListSelectionListener(this); settingChoice.setListData((Vector)categories.get(catName)); settingChoice.addListSelectionListener(this); + + displayField(); descriptionArea.setText(""); valueField.setText(""); @@ -200,8 +249,24 @@ } else if (e.getSource() == settingChoice) { FCPGetConfig.ConfigSetting setting = (FCPGetConfig.ConfigSetting)settingChoice.getSelectedValue(); - descriptionArea.setText(setting.getLongDesc()); - valueField.setText(setting.getCurrent()); + descriptionArea.setText(setting.getLongDesc()); + + if ("false".equals(setting.getDefault()) + || "true".equals(setting.getDefault())) { + + displaySelecter(); + + if ("true".equals(setting.getCurrent())) + valueSelecter.setSelectedItem(trueStr); + else + valueSelecter.setSelectedItem(falseStr); + + } else { + + displayField(); + valueField.setText(setting.getCurrent()); + } + defaultField.setText(setting.getDefault()); } } From jflesch at freenetproject.org Thu Feb 7 02:31:09 2008 From: jflesch at freenetproject.org (jflesch at freenetproject.org) Date: Thu, 7 Feb 2008 02:31:09 +0000 (UTC) Subject: [Thaw-dev] r17643 - trunk/apps/Thaw/src/thaw/plugins/nodeConfigurator Message-ID: <20080207023109.B3E2E47BC41@freenetproject.org> Author: jflesch Date: 2008-02-07 02:31:09 +0000 (Thu, 07 Feb 2008) New Revision: 17643 Modified: trunk/apps/Thaw/src/thaw/plugins/nodeConfigurator/NodeConfiguratorTab.java Log: Node configurator : fix column sizes Modified: trunk/apps/Thaw/src/thaw/plugins/nodeConfigurator/NodeConfiguratorTab.java =================================================================== --- trunk/apps/Thaw/src/thaw/plugins/nodeConfigurator/NodeConfiguratorTab.java 2008-02-07 02:26:04 UTC (rev 17642) +++ trunk/apps/Thaw/src/thaw/plugins/nodeConfigurator/NodeConfiguratorTab.java 2008-02-07 02:31:09 UTC (rev 17643) @@ -96,7 +96,7 @@ settingChoice = new JList(); settingChoice.addListSelectionListener(this); settingsPanel.add(sc = new JScrollPane(settingChoice), BorderLayout.CENTER); - sc.setPreferredSize(new java.awt.Dimension(COLUMNS_WIDTH*2, COLUMNS_WIDTH*2)); + sc.setPreferredSize(new java.awt.Dimension((int)(COLUMNS_WIDTH*1.5), (int)(COLUMNS_WIDTH*1.5))); subPanel.add(settingsPanel, BorderLayout.WEST); From jflesch at freenetproject.org Thu Feb 7 20:46:54 2008 From: jflesch at freenetproject.org (jflesch at freenetproject.org) Date: Thu, 7 Feb 2008 20:46:54 +0000 (UTC) Subject: [Thaw-dev] r17678 - in trunk/apps/Thaw: . src/thaw/core src/thaw/plugins Message-ID: <20080207204654.0633647898E@freenetproject.org> Author: jflesch Date: 2008-02-07 20:46:53 +0000 (Thu, 07 Feb 2008) New Revision: 17678 Added: trunk/apps/Thaw/README.distrib.txt trunk/apps/Thaw/README.txt Removed: trunk/apps/Thaw/readme.txt Modified: trunk/apps/Thaw/src/thaw/core/Main.java trunk/apps/Thaw/src/thaw/plugins/Signatures.java Log: Add a readme explaining how to compile Thaw without including its dependencies in the .jar (will need a build.xml update) Added: trunk/apps/Thaw/README.distrib.txt =================================================================== --- trunk/apps/Thaw/README.distrib.txt (rev 0) +++ trunk/apps/Thaw/README.distrib.txt 2008-02-07 20:46:53 UTC (rev 17678) @@ -0,0 +1,24 @@ +Notes for the people wanting to bundle Thaw in a distribution +============================================================= + +You can specify to ant where it must look for Thaw dependencies: + +% ant \ + -Djmdns.location=[pathToJmdns]/jmdns.jar \ + -Dhsqldb.location=[pathToHsqldb]/hsqldb.jar \ + -Dbouncycastle.location=[pathToBouncyCastle]/BouncyCastle.jar + + +And you can compile a version of Thaw not including all its dependencies +by specifying the target 'jar-nodeps'. + +So in the end, you can use the following line to compile Thaw: + + +% ant \ + -Djmdns.location=[pathToJmdns]/jmdns.jar \ + -Dhsqldb.location=[pathToHsqldb]/hsqldb.jar \ + -Dbouncycastle.location=[pathToBouncyCastle]/BouncyCastle.jar \ + jar-nodeps + +If you use the target "jar-nodeps", the final .jar will be bin/Thaw-light.jar Copied: trunk/apps/Thaw/README.txt (from rev 17547, trunk/apps/Thaw/readme.txt) =================================================================== --- trunk/apps/Thaw/README.txt (rev 0) +++ trunk/apps/Thaw/README.txt 2008-02-07 20:46:53 UTC (rev 17678) @@ -0,0 +1,69 @@ +COPYRIGHT +========= + +Thaw copyright is held by Freenet Project Incorporated. Thaw is +distributed under the GPLv2 license. You can find it in a file called +"gpl.txt" in the folder "licenses". This file is included in every +.jar files of Thaw. + +---------------- + +Thaw, Freenet coffe machine +Copyright (C) 2007 Freenet Project Incorporated + +This program is free software: you can redistribute it and/or modify +it under the terms of the GNU General Public License as published by +the Free Software Foundation, either version 3 of the License, or +(at your option) any later version. + +This program is distributed in the hope that it will be useful, +but WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +GNU General Public License for more details. + +You should have received a copy of the GNU General Public License +along with this program. If not, see . + +--------------- + +COMPILATION +=========== + +In order to compile Thaw, you need to obtain the latest version of hsqldb.jar. + +Here is a link to the current (06/11/2006) version of hsqldb: +http://switch.dl.sourceforge.net/sourceforge/hsqldb/hsqldb_1_8_0_4.zip + +Extract the zip, and copy "hsqldb/lib/hsqldb.jar" to "Thaw/lib". + +You need also BouncyCastle: +* Download the provider for the JDK 1.4 +* Rename the file to BouncyCastle.jar +* Put this .jar in lib/ + +and jmDNS: +* download the jar and put it in lib/ +* (expected filename : jmdns.jar) + +To compile: + $ ant + +To build the jar file: + $ ant jar + +To build the javadoc: + $ ant javadoc + + +RUNNING +======= + +With Unix / Linux / etc: +$ cd lib ; java -jar Thaw.jar +or +$ ant run + + +With Windows: +err ... we will see that later ... + Deleted: trunk/apps/Thaw/readme.txt =================================================================== --- trunk/apps/Thaw/readme.txt 2008-02-07 20:23:12 UTC (rev 17677) +++ trunk/apps/Thaw/readme.txt 2008-02-07 20:46:53 UTC (rev 17678) @@ -1,69 +0,0 @@ -COPYRIGHT -========= - -Thaw copyright is held by Freenet Project Incorporated. Thaw is -distributed under the GPLv2 license. You can find it in a file called -"gpl.txt" in the folder "licenses". This file is included in every -.jar files of Thaw. - ----------------- - -Thaw, Freenet coffe machine -Copyright (C) 2007 Freenet Project Incorporated - -This program is free software: you can redistribute it and/or modify -it under the terms of the GNU General Public License as published by -the Free Software Foundation, either version 3 of the License, or -(at your option) any later version. - -This program is distributed in the hope that it will be useful, -but WITHOUT ANY WARRANTY; without even the implied warranty of -MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -GNU General Public License for more details. - -You should have received a copy of the GNU General Public License -along with this program. If not, see . - ---------------- - -COMPILATION -=========== - -In order to compile Thaw, you need to obtain the latest version of hsqldb.jar. - -Here is a link to the current (06/11/2006) version of hsqldb: -http://switch.dl.sourceforge.net/sourceforge/hsqldb/hsqldb_1_8_0_4.zip - -Extract the zip, and copy "hsqldb/lib/hsqldb.jar" to "Thaw/lib". - -You need also BouncyCastle: -* Download the provider for the JDK 1.4 -* Rename the file to BouncyCastle.jar -* Put this .jar in lib/ - -and jmDNS: -* download the jar and put it in lib/ -* (expected filename : jmdns.jar) - -To compile: - $ ant - -To build the jar file: - $ ant jar - -To build the javadoc: - $ ant javadoc - - -RUNNING -======= - -With Unix / Linux / etc: -$ cd lib ; java -jar Thaw.jar -or -$ ant run - - -With Windows: -err ... we will see that later ... - Modified: trunk/apps/Thaw/src/thaw/core/Main.java =================================================================== --- trunk/apps/Thaw/src/thaw/core/Main.java 2008-02-07 20:23:12 UTC (rev 17677) +++ trunk/apps/Thaw/src/thaw/core/Main.java 2008-02-07 20:46:53 UTC (rev 17678) @@ -179,9 +179,9 @@ return; } catch(java.io.IOException e) { - Logger.error(this, "Can't extract '"+src+"' because : "+e.toString()); + Logger.warning(this, "Can't extract '"+src+"' because : "+e.toString()); if (e.getCause() != null) - Logger.error(this, "Cause : "+e.getCause().toString()); + Logger.warning(this, "Cause : "+e.getCause().toString()); e.printStackTrace(); } Modified: trunk/apps/Thaw/src/thaw/plugins/Signatures.java =================================================================== --- trunk/apps/Thaw/src/thaw/plugins/Signatures.java 2008-02-07 20:23:12 UTC (rev 17677) +++ trunk/apps/Thaw/src/thaw/plugins/Signatures.java 2008-02-07 20:46:53 UTC (rev 17678) @@ -1,5 +1,7 @@ package thaw.plugins; +import java.util.Iterator; +import java.util.HashSet; import thaw.core.I18n; import thaw.core.Core; @@ -139,4 +141,22 @@ public javax.swing.ImageIcon getIcon() { return IconBox.identity; } + + + public static interface SignaturesObserver { + public void publicIdentityAdded(Identity i); + public void privateIdentityAdded(Identity i); + public void trustLevelUpdated(Identity i); + /* we never remove identities ? ... hmmmm */ + } + + private static HashSet observers = new HashSet(); + + public void addObserver(SignaturesObserver o) { + + } + + public void removeObserver(SignaturesObserver o) { + + } } From jflesch at freenetproject.org Thu Feb 7 20:48:16 2008 From: jflesch at freenetproject.org (jflesch at freenetproject.org) Date: Thu, 7 Feb 2008 20:48:16 +0000 (UTC) Subject: [Thaw-dev] r17679 - trunk/apps/Thaw Message-ID: <20080207204816.82A593C0E6B@freenetproject.org> Author: jflesch Date: 2008-02-07 20:48:16 +0000 (Thu, 07 Feb 2008) New Revision: 17679 Modified: trunk/apps/Thaw/README.distrib.txt Log: Add a note to the previous readme file Modified: trunk/apps/Thaw/README.distrib.txt =================================================================== --- trunk/apps/Thaw/README.distrib.txt 2008-02-07 20:46:53 UTC (rev 17678) +++ trunk/apps/Thaw/README.distrib.txt 2008-02-07 20:48:16 UTC (rev 17679) @@ -22,3 +22,10 @@ jar-nodeps If you use the target "jar-nodeps", the final .jar will be bin/Thaw-light.jar + +To start Thaw-light, you will have to specify where each dependency is located: + +% java \ + -cp [pathToJmdns]/jmdns.jar:[pathToHsqldb]/hsqldb.jar:[pathToBouncyCastle]/BouncyCastle.jar \ + -jar Thaw.jar + From jflesch at freenetproject.org Thu Feb 7 20:53:12 2008 From: jflesch at freenetproject.org (jflesch at freenetproject.org) Date: Thu, 7 Feb 2008 20:53:12 +0000 (UTC) Subject: [Thaw-dev] r17680 - trunk/apps/Thaw Message-ID: <20080207205312.53443392C02@freenetproject.org> Author: jflesch Date: 2008-02-07 20:53:12 +0000 (Thu, 07 Feb 2008) New Revision: 17680 Modified: trunk/apps/Thaw/README.distrib.txt Log: Fix a minor mistake in README.distrib.txt Modified: trunk/apps/Thaw/README.distrib.txt =================================================================== --- trunk/apps/Thaw/README.distrib.txt 2008-02-07 20:48:16 UTC (rev 17679) +++ trunk/apps/Thaw/README.distrib.txt 2008-02-07 20:53:12 UTC (rev 17680) @@ -27,5 +27,4 @@ % java \ -cp [pathToJmdns]/jmdns.jar:[pathToHsqldb]/hsqldb.jar:[pathToBouncyCastle]/BouncyCastle.jar \ - -jar Thaw.jar - + -jar Thaw-light.jar From toad at freenetproject.org Thu Feb 7 22:29:55 2008 From: toad at freenetproject.org (toad at freenetproject.org) Date: Thu, 7 Feb 2008 22:29:55 +0000 (UTC) Subject: [Thaw-dev] r17681 - trunk/apps/Thaw Message-ID: <20080207222955.2A95D390A25@freenetproject.org> Author: toad Date: 2008-02-07 22:29:54 +0000 (Thu, 07 Feb 2008) New Revision: 17681 Modified: trunk/apps/Thaw/build.xml Log: Patch from jflesch to update a couple of text strings and add a new target to generate a non-bundled jar: Here it is :) As you will see, it only modifies some texts and add an ant target, so it won't change at all the emu build process for Thaw :) Modified: trunk/apps/Thaw/build.xml =================================================================== --- trunk/apps/Thaw/build.xml 2008-02-07 20:53:12 UTC (rev 17680) +++ trunk/apps/Thaw/build.xml 2008-02-07 22:29:54 UTC (rev 17681) @@ -18,19 +18,19 @@ + message="You need to download jmdns.jar from http://sourceforge.net/projects/jmdns/ and to put it in lib/ or set the ant property 'jmdns.location' to the correct path (filename included) " /> + message="You need to download hsqldb.jar from http://sourceforge.net/projects/hsqldb/ and to put it in lib/ or set the ant property 'hsqldb.location' to the correct path (filename included)" /> + message="You need to download the bouncycastle provider for the JDK 1.4 from http://bouncycastle.org/latest_releases.html and put it in lib/ with the name BouncyCastle.jar. or set the ant property 'bouncycastle.location' to the correct path (filename included)" /> @@ -91,6 +91,27 @@ + + + + + + + + + + + + + + + + + + + + + From jflesch at freenetproject.org Sun Feb 10 04:14:17 2008 From: jflesch at freenetproject.org (jflesch at freenetproject.org) Date: Sun, 10 Feb 2008 04:14:17 +0000 (UTC) Subject: [Thaw-dev] r17771 - trunk/apps/Thaw/src/thaw/plugins/index Message-ID: <20080210041417.ED89847AAC3@freenetproject.org> Author: jflesch Date: 2008-02-10 04:14:17 +0000 (Sun, 10 Feb 2008) New Revision: 17771 Modified: trunk/apps/Thaw/src/thaw/plugins/index/UnknownIndexList.java Log: IndexBrowser : Fix a minor graphical bug at the check box below the unknown index list Modified: trunk/apps/Thaw/src/thaw/plugins/index/UnknownIndexList.java =================================================================== --- trunk/apps/Thaw/src/thaw/plugins/index/UnknownIndexList.java 2008-02-10 03:51:06 UTC (rev 17770) +++ trunk/apps/Thaw/src/thaw/plugins/index/UnknownIndexList.java 2008-02-10 04:14:17 UTC (rev 17771) @@ -68,7 +68,7 @@ I18n.getMessage("thaw.plugin.index.autoSorting"), true); autoSorting.addActionListener(this); - panel.add(new JScrollPane(autoSorting), BorderLayout.SOUTH); + panel.add(new JScrollPane(autoSorting, JScrollPane.VERTICAL_SCROLLBAR_NEVER, JScrollPane.HORIZONTAL_SCROLLBAR_ALWAYS), BorderLayout.SOUTH); JButton button; From jflesch at freenetproject.org Sun Feb 10 04:30:42 2008 From: jflesch at freenetproject.org (jflesch at freenetproject.org) Date: Sun, 10 Feb 2008 04:30:42 +0000 (UTC) Subject: [Thaw-dev] r17772 - trunk/apps/Thaw/src/thaw/plugins/index Message-ID: <20080210043042.104DA47AEE8@freenetproject.org> Author: jflesch Date: 2008-02-10 04:30:41 +0000 (Sun, 10 Feb 2008) New Revision: 17772 Modified: trunk/apps/Thaw/src/thaw/plugins/index/UnknownIndexList.java Log: Remove the useless scrollbar below the unknown index list Modified: trunk/apps/Thaw/src/thaw/plugins/index/UnknownIndexList.java =================================================================== --- trunk/apps/Thaw/src/thaw/plugins/index/UnknownIndexList.java 2008-02-10 04:14:17 UTC (rev 17771) +++ trunk/apps/Thaw/src/thaw/plugins/index/UnknownIndexList.java 2008-02-10 04:30:41 UTC (rev 17772) @@ -68,7 +68,7 @@ I18n.getMessage("thaw.plugin.index.autoSorting"), true); autoSorting.addActionListener(this); - panel.add(new JScrollPane(autoSorting, JScrollPane.VERTICAL_SCROLLBAR_NEVER, JScrollPane.HORIZONTAL_SCROLLBAR_ALWAYS), BorderLayout.SOUTH); + panel.add(new JScrollPane(autoSorting, JScrollPane.VERTICAL_SCROLLBAR_NEVER, JScrollPane.HORIZONTAL_SCROLLBAR_NEVER), BorderLayout.SOUTH); JButton button; From jflesch at freenetproject.org Mon Feb 11 00:41:54 2008 From: jflesch at freenetproject.org (jflesch at freenetproject.org) Date: Mon, 11 Feb 2008 00:41:54 +0000 (UTC) Subject: [Thaw-dev] r17773 - in trunk/apps/Thaw/src/thaw: i18n plugins plugins/miniFrost Message-ID: <20080211004154.8699B47898E@freenetproject.org> Author: jflesch Date: 2008-02-11 00:41:54 +0000 (Mon, 11 Feb 2008) New Revision: 17773 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/MiniFrost.java trunk/apps/Thaw/src/thaw/plugins/miniFrost/MessageTreeTable.java trunk/apps/Thaw/src/thaw/plugins/miniFrost/MiniFrostConfigTab.java Log: MiniFrost: Minor change in the layout Modified: trunk/apps/Thaw/src/thaw/i18n/source.thaw_fr.properties =================================================================== --- trunk/apps/Thaw/src/thaw/i18n/source.thaw_fr.properties 2008-02-10 04:30:41 UTC (rev 17772) +++ trunk/apps/Thaw/src/thaw/i18n/source.thaw_fr.properties 2008-02-11 00:41:54 UTC (rev 17773) @@ -668,7 +668,7 @@ thaw.plugin.miniFrost.modifyRegexp=Modifier les r?gles de filtrage -thaw.plugin.miniFrost.seeTree=Arbre de messages +thaw.plugin.miniFrost.seeTree=Afficher les messages sous forme d'arbre thaw.plugin.miniFrost.archiveAfter=Archiver automatiquement les messages apr?s: thaw.plugin.miniFrost.deleteAfter=Effacer automatiquement les messages apr?s: Modified: trunk/apps/Thaw/src/thaw/i18n/thaw.properties =================================================================== --- trunk/apps/Thaw/src/thaw/i18n/thaw.properties 2008-02-10 04:30:41 UTC (rev 17772) +++ trunk/apps/Thaw/src/thaw/i18n/thaw.properties 2008-02-11 00:41:54 UTC (rev 17773) @@ -673,7 +673,7 @@ thaw.plugin.miniFrost.invalidRegexp=One of your regexp is invalid : X thaw.plugin.miniFrost.modifyRegexp=Modify the filtering rules -thaw.plugin.miniFrost.seeTree=Message tree +thaw.plugin.miniFrost.seeTree=Display messages as a tree thaw.plugin.miniFrost.archiveAfter=Automatically archive the messages after: thaw.plugin.miniFrost.deleteAfter=Automatically delete the messages after: Modified: trunk/apps/Thaw/src/thaw/i18n/thaw_fr.properties =================================================================== --- trunk/apps/Thaw/src/thaw/i18n/thaw_fr.properties 2008-02-10 04:30:41 UTC (rev 17772) +++ trunk/apps/Thaw/src/thaw/i18n/thaw_fr.properties 2008-02-11 00:41:54 UTC (rev 17773) @@ -668,7 +668,7 @@ thaw.plugin.miniFrost.modifyRegexp=Modifier les r\u00e8gles de filtrage -thaw.plugin.miniFrost.seeTree=Arbre de messages +thaw.plugin.miniFrost.seeTree=Afficher les messages sous forme d'arbre thaw.plugin.miniFrost.archiveAfter=Archiver automatiquement les messages apr\u00e8s: thaw.plugin.miniFrost.deleteAfter=Effacer automatiquement les messages apr\u00e8s: Modified: trunk/apps/Thaw/src/thaw/plugins/MiniFrost.java =================================================================== --- trunk/apps/Thaw/src/thaw/plugins/MiniFrost.java 2008-02-10 04:30:41 UTC (rev 17772) +++ trunk/apps/Thaw/src/thaw/plugins/MiniFrost.java 2008-02-11 00:41:54 UTC (rev 17773) @@ -19,6 +19,7 @@ public class MiniFrost implements thaw.core.Plugin, ChangeListener { public final static int DEFAULT_ARCHIVE_AFTER = 7; /* days */ public final static int DEFAULT_DELETE_AFTER = 60; /* days */ + public final static boolean DISPLAY_AS_TREE = true; private Core core; private Hsqldb hsqldb; @@ -46,6 +47,7 @@ core.getConfig().addListener("miniFrostArchiveAfter", this); core.getConfig().addListener("miniFrostDeleteAfter", this); core.getConfig().addListener("miniFrostView", this); + core.getConfig().addListener("checkbox_miniFrost_seeTree", this); if (!loadDeps() || !initFactories() Modified: trunk/apps/Thaw/src/thaw/plugins/miniFrost/MessageTreeTable.java =================================================================== --- trunk/apps/Thaw/src/thaw/plugins/miniFrost/MessageTreeTable.java 2008-02-10 04:30:41 UTC (rev 17772) +++ trunk/apps/Thaw/src/thaw/plugins/miniFrost/MessageTreeTable.java 2008-02-11 00:41:54 UTC (rev 17773) @@ -48,6 +48,7 @@ import thaw.gui.IconBox; import thaw.core.I18n; import thaw.core.Logger; +import thaw.plugins.MiniFrost; import thaw.plugins.signatures.Identity; import thaw.plugins.miniFrost.interfaces.Author; @@ -130,7 +131,7 @@ private int orderBy; private boolean desc; - private CheckBox seeTree; + private boolean tree; private CheckBox seeUnsigned; private JComboBox minTrustLevel; private int minTrustLevelInt; @@ -263,33 +264,25 @@ true); seeUnsigned.addActionListener(this); - seeTree = new CheckBox(mainPanel.getConfig(), - "miniFrost_seeTree", - I18n.getMessage("thaw.plugin.miniFrost.seeTree"), - true); - seeTree.addActionListener(this); + tree = MiniFrost.DISPLAY_AS_TREE; + + if (mainPanel.getConfig().getValue("checkbox_miniFrost_seeTree") != null) { + tree = Boolean.valueOf(mainPanel.getConfig().getValue("checkbox_miniFrost_seeTree")).booleanValue(); + } - JPanel southWestPanel = new JPanel(new GridLayout(2, 1)); - southWestPanel.add(new JLabel("")); - southWestPanel.add(seeTree); - - JPanel southEastPanel = new JPanel(new GridLayout(2, 1)); - - JPanel southEastPanelTop = new JPanel(new GridLayout(1, 3, 5, 5)); + JPanel southWestPanel = new JPanel(new GridLayout(1, 3, 5, 5)); //southEastPanelTop.add(new JLabel(I18n.getMessage("thaw.plugin.miniFrost.seeMessages"))); - southEastPanelTop.add(seeUnsigned); - southEastPanelTop.add(seeArchived); - southEastPanelTop.add(seeRead); + southWestPanel.add(seeUnsigned); + southWestPanel.add(seeArchived); + southWestPanel.add(seeRead); - southEastPanel.add(southEastPanelTop); - southEastPanel.add(minTrustLevelPanel); JPanel southPanel = new JPanel(new BorderLayout(5, 5)); southPanel.add(southWestPanel, BorderLayout.WEST); southPanel.add(new JLabel(""), BorderLayout.CENTER); - southPanel.add(southEastPanel, BorderLayout.EAST); + southPanel.add(minTrustLevelPanel, BorderLayout.EAST); panel.add(southPanel, BorderLayout.SOUTH); @@ -590,7 +583,7 @@ return checkBoxRenderer; } - if (value instanceof MessageNode && seeTree.isSelected()) { + if (value instanceof MessageNode && tree) { return messageNodeTree.getTableCellRendererComponent(table, value, isSelected, @@ -948,7 +941,7 @@ Vector rootNodes; - if (seeTree.isSelected()) { + if (tree) { /** Filling in messageNodeHashtable **/ Hashtable messageNodeHashtable = new Hashtable(msgs.size()); @@ -1186,7 +1179,6 @@ if (e.getSource() == seeUnsigned || e.getSource() == minTrustLevel || e.getSource() == seeArchived - || e.getSource() == seeTree || e.getSource() == seeRead) { minTrustLevelInt = Identity.getTrustLevel((String)(minTrustLevel.getSelectedItem())); Modified: trunk/apps/Thaw/src/thaw/plugins/miniFrost/MiniFrostConfigTab.java =================================================================== --- trunk/apps/Thaw/src/thaw/plugins/miniFrost/MiniFrostConfigTab.java 2008-02-10 04:30:41 UTC (rev 17772) +++ trunk/apps/Thaw/src/thaw/plugins/miniFrost/MiniFrostConfigTab.java 2008-02-11 00:41:54 UTC (rev 17773) @@ -1,5 +1,6 @@ package thaw.plugins.miniFrost; +import javax.swing.JCheckBox; import javax.swing.JPanel; import javax.swing.JLabel; import javax.swing.JComboBox; @@ -50,10 +51,11 @@ private JRadioButton gmailView; private JRadioButton outlookView; + private JCheckBox treeCheckBox; public MiniFrostConfigTab(Config config, - ConfigWindow configWindow, - RegexpBlacklist regexpBlacklist) { + ConfigWindow configWindow, + RegexpBlacklist regexpBlacklist) { this.config = config; this.configWindow = configWindow; this.regexpBlacklist = regexpBlacklist; @@ -74,6 +76,8 @@ archiveAfter.addItem(Integer.toString(i)+ " "+I18n.getMessage("thaw.plugin.miniFrost.days")); deleteAfter.addItem( Integer.toString(i)+ " "+I18n.getMessage("thaw.plugin.miniFrost.days")); } + + treeCheckBox = new JCheckBox(I18n.getMessage("thaw.plugin.miniFrost.seeTree")); panel.add(new JLabel(I18n.getMessage("thaw.plugin.miniFrost.maxBoardsRefreshed"))); panel.add(maxBoards); @@ -83,6 +87,10 @@ panel.add(new JLabel(I18n.getMessage("thaw.plugin.miniFrost.deleteAfter"))); panel.add(deleteAfter); + + panel.add(new JLabel("")); + panel.add(treeCheckBox); + panel.add(new JLabel("")); JPanel regexpPanel = new JPanel(new BorderLayout()); regexpPanel.add(new JLabel(""), BorderLayout.CENTER); @@ -99,7 +107,7 @@ JPanel southPanel = new JPanel(new BorderLayout()); southPanel.add(new JLabel(I18n.getMessage("thaw.plugin.miniFrost.views")), - BorderLayout.NORTH); + BorderLayout.NORTH); ButtonGroup buttonGroup = new ButtonGroup(); @@ -113,13 +121,13 @@ gmailPanel.add(gmailView, BorderLayout.NORTH); gmailPanel.add(new JLabel(IconBox.miniFrostGmailView, - JLabel.LEFT), - BorderLayout.CENTER); + JLabel.LEFT), + BorderLayout.CENTER); outlookPanel.add(outlookView, BorderLayout.NORTH); outlookPanel.add(new JLabel(IconBox.miniFrostOutlookView, - JLabel.LEFT), - BorderLayout.CENTER); + JLabel.LEFT), + BorderLayout.CENTER); buttonGroup.add(gmailView); @@ -140,8 +148,8 @@ public void display() { configWindow.addObserver(this); configWindow.addTab(I18n.getMessage("thaw.plugin.miniFrost"), - thaw.gui.IconBox.minReadComments, - globalPanel); + thaw.gui.IconBox.minReadComments, + globalPanel); } @@ -198,6 +206,14 @@ gmailView.setSelected(false); outlookView.setSelected(true); } + + boolean s = MiniFrost.DISPLAY_AS_TREE; + + if (config.getValue("checkbox_miniFrost_seeTree") != null) { + s = Boolean.valueOf(config.getValue("checkbox_miniFrost_seeTree")).booleanValue(); + } + + treeCheckBox.setSelected(s); } @@ -221,6 +237,9 @@ config.setValue("miniFrostView", (gmailView.isSelected() ? "0" : "1")); + + config.setValue("checkbox_miniFrost_seeTree", + Boolean.toString(treeCheckBox.isSelected())); } else if (param == configWindow.getCancelButton()) { From jflesch at freenetproject.org Mon Feb 11 16:17:12 2008 From: jflesch at freenetproject.org (jflesch at freenetproject.org) Date: Mon, 11 Feb 2008 16:17:12 +0000 (UTC) Subject: [Thaw-dev] r17777 - trunk/apps/Thaw/src/thaw/plugins/miniFrost Message-ID: <20080211161712.CD2B4479341@freenetproject.org> Author: jflesch Date: 2008-02-11 16:17:12 +0000 (Mon, 11 Feb 2008) New Revision: 17777 Modified: trunk/apps/Thaw/src/thaw/plugins/miniFrost/MiniFrostConfigTab.java Log: MiniFrost: fix layout in the config tab Modified: trunk/apps/Thaw/src/thaw/plugins/miniFrost/MiniFrostConfigTab.java =================================================================== --- trunk/apps/Thaw/src/thaw/plugins/miniFrost/MiniFrostConfigTab.java 2008-02-11 13:02:26 UTC (rev 17776) +++ trunk/apps/Thaw/src/thaw/plugins/miniFrost/MiniFrostConfigTab.java 2008-02-11 16:17:12 UTC (rev 17777) @@ -62,7 +62,7 @@ globalPanel = new JPanel(new BorderLayout(10, 10)); - JPanel panel = new JPanel(new GridLayout(10, 1)); + JPanel panel = new JPanel(new GridLayout(11, 1)); maxBoards = new JComboBox(); From jflesch at freenetproject.org Tue Feb 12 18:35:06 2008 From: jflesch at freenetproject.org (jflesch at freenetproject.org) Date: Tue, 12 Feb 2008 18:35:06 +0000 (UTC) Subject: [Thaw-dev] r17842 - in trunk/apps/Thaw/src/thaw: core fcp i18n plugins plugins/index plugins/mDns plugins/miniFrost plugins/miniFrost/frostKSK plugins/signatures plugins/webOfTrust Message-ID: <20080212183506.DC2263908C1@freenetproject.org> Author: jflesch Date: 2008-02-12 18:35:06 +0000 (Tue, 12 Feb 2008) New Revision: 17842 Added: trunk/apps/Thaw/src/thaw/plugins/webOfTrust/TrustListUploader.java Modified: trunk/apps/Thaw/src/thaw/core/ConfigWindow.java trunk/apps/Thaw/src/thaw/core/Core.java trunk/apps/Thaw/src/thaw/fcp/FCPClientPut.java trunk/apps/Thaw/src/thaw/fcp/FCPGenerateSSK.java trunk/apps/Thaw/src/thaw/i18n/source.thaw_fr.properties trunk/apps/Thaw/src/thaw/i18n/thaw.properties trunk/apps/Thaw/src/thaw/plugins/Signatures.java trunk/apps/Thaw/src/thaw/plugins/WebOfTrust.java trunk/apps/Thaw/src/thaw/plugins/index/IndexConfigDialog.java trunk/apps/Thaw/src/thaw/plugins/index/IndexManagementHelper.java trunk/apps/Thaw/src/thaw/plugins/mDns/MDNSDiscoveryPanel.java trunk/apps/Thaw/src/thaw/plugins/miniFrost/BoardSelecter.java trunk/apps/Thaw/src/thaw/plugins/miniFrost/DraftPanel.java trunk/apps/Thaw/src/thaw/plugins/miniFrost/MessageTreeTable.java trunk/apps/Thaw/src/thaw/plugins/miniFrost/fr