Author: jflesch
Date: 2007-05-01 17:09:04 +0000 (Tue, 01 May 2007)
New Revision: 13085
Modified:
trunk/apps/Thaw/src/thaw/core/Core.java
trunk/apps/Thaw/src/thaw/core/Logger.java
trunk/apps/Thaw/src/thaw/core/SplashScreen.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/AutoRefresh.java
trunk/apps/Thaw/src/thaw/plugins/index/File.java
trunk/apps/Thaw/src/thaw/plugins/index/Index.java
trunk/apps/Thaw/src/thaw/plugins/index/IndexBrowserPanel.java
trunk/apps/Thaw/src/thaw/plugins/index/IndexConfigPanel.java
trunk/apps/Thaw/src/thaw/plugins/index/IndexFolder.java
trunk/apps/Thaw/src/thaw/plugins/index/IndexManagementHelper.java
trunk/apps/Thaw/src/thaw/plugins/index/IndexRoot.java
trunk/apps/Thaw/src/thaw/plugins/index/Link.java
Log:
Add two option : One to fetch the indexes with a positive revision, and one to
not fetch the comments
Modified: trunk/apps/Thaw/src/thaw/core/Core.java
===================================================================
--- trunk/apps/Thaw/src/thaw/core/Core.java 2007-05-01 15:58:57 UTC (rev
13084)
+++ trunk/apps/Thaw/src/thaw/core/Core.java 2007-05-01 17:09:04 UTC (rev
13085)
@@ -112,6 +112,7 @@
if(!initConfig())
return false;
+
splashScreen.setProgressionAndStatus(10, "Applying look and
feel ...");
if (!initializeLookAndFeel())
return false;
Modified: trunk/apps/Thaw/src/thaw/core/Logger.java
===================================================================
--- trunk/apps/Thaw/src/thaw/core/Logger.java 2007-05-01 15:58:57 UTC (rev
13084)
+++ trunk/apps/Thaw/src/thaw/core/Logger.java 2007-05-01 17:09:04 UTC (rev
13085)
@@ -22,7 +22,7 @@
* 2 or more is recommanded.
* 4 or more is unhealthy
*/
- public final static int LOG_LEVEL = 5;
+ public final static int LOG_LEVEL = 3;
private static Vector logListeners = null;
Modified: trunk/apps/Thaw/src/thaw/core/SplashScreen.java
===================================================================
--- trunk/apps/Thaw/src/thaw/core/SplashScreen.java 2007-05-01 15:58:57 UTC
(rev 13084)
+++ trunk/apps/Thaw/src/thaw/core/SplashScreen.java 2007-05-01 17:09:04 UTC
(rev 13085)
@@ -17,7 +17,7 @@
public final static int SIZE_X = 500;
public final static int SIZE_Y = 150;
- public final static int NMB_ICONS = 10;
+ public final static int NMB_ICONS = 13;
public JDialog splashScreen;
public JProgressBar progressBar;
@@ -91,6 +91,8 @@
}
+
+
/**
* @param progress In percent
*/
Modified: trunk/apps/Thaw/src/thaw/i18n/source.thaw_fr.properties
===================================================================
--- trunk/apps/Thaw/src/thaw/i18n/source.thaw_fr.properties 2007-05-01
15:58:57 UTC (rev 13084)
+++ trunk/apps/Thaw/src/thaw/i18n/source.thaw_fr.properties 2007-05-01
17:09:04 UTC (rev 13085)
@@ -402,8 +402,10 @@
thaw.plugin.signature.nickname=Pseudo
thaw.plugin.signature.trustLevel=Status
-thaw.plugin.signature.isDup=Est un duplicata ?
+thaw.plugin.signature.isDup=Pseudo d?j? utilis? ?
+thaw.plugin.signature.duplicata=PSEUDO DEJA UTILIS?
+
thaw.plugin.signature.addIdentity=Generer une nouvelle identit?
thaw.plugin.signature.removeIdentity=Supprimer l'identit? s?lectionn?e
@@ -443,7 +445,7 @@
thaw.plugin.transferLogs.date=Date
thaw.plugin.transferLogs.message=Message
thaw.plugin.transferLogs.key=Clef
-thaw.plugin.transferLogs.isDup=Est-ce que la clef est dupliqu?e ?
+thaw.plugin.transferLogs.isDup=Est-ce que la clef a d?j? ?t? vue ?
thaw.plugin.transferLogs.download.added=T?l?chargement ajout?
thaw.plugin.transferLogs.download.failed=T?l?chargement ?chou?
Modified: trunk/apps/Thaw/src/thaw/i18n/thaw.properties
===================================================================
--- trunk/apps/Thaw/src/thaw/i18n/thaw.properties 2007-05-01 15:58:57 UTC
(rev 13084)
+++ trunk/apps/Thaw/src/thaw/i18n/thaw.properties 2007-05-01 17:09:04 UTC
(rev 13085)
@@ -351,6 +351,13 @@
thaw.plugin.index.comment.moderate=Moderate
thaw.plugin.index.comment.unmoderate=Unmoderate
+thaw.plugin.index.fetchNegative=Always download of the latest versions of the
indexes at each refresh
+thaw.plugin.index.fetchComments=Fetch the comments
+
+thaw.plugin.index.warningNonNegative=Warning ! Downloading comments without
having the latest versions of the indexes may result in receiving spams !
+
+# Peer monitor
+
thaw.plugin.peerMonitor.peerMonitor=Connection
thaw.plugin.peerMonitor.yourReference=Your reference:
thaw.plugin.peerMonitor.copyReference=Copy your reference to the clipboard
@@ -406,14 +413,14 @@
thaw.plugin.signature.nickname=Nickname
thaw.plugin.signature.trustLevel=Status
-thaw.plugin.signature.isDup=Is a duplicate ?
+thaw.plugin.signature.isDup=Nick already used ?
thaw.plugin.signature.addIdentity=Generate a new identity
thaw.plugin.signature.removeIdentity=Delete the selected identity
thaw.plugin.signature.enterNick=Enter a nickname :
-thaw.plugin.signature.duplicata=DUPLICATE
+thaw.plugin.signature.duplicata=NICK ALREADY USED
thaw.plugin.signature.trustLevel.trustLevel=Status
thaw.plugin.signature.trustLevel.dev=MATRIX ARCHITECT
@@ -452,7 +459,7 @@
thaw.plugin.transferLogs.date=Date
thaw.plugin.transferLogs.message=Message
thaw.plugin.transferLogs.key=Key
-thaw.plugin.transferLogs.isDup=Is the key duplicated ?
+thaw.plugin.transferLogs.isDup=has the key already been seen ?
thaw.plugin.transferLogs.download.added=Download added
thaw.plugin.transferLogs.download.failed=Download failed
Modified: trunk/apps/Thaw/src/thaw/i18n/thaw_fr.properties
===================================================================
--- trunk/apps/Thaw/src/thaw/i18n/thaw_fr.properties 2007-05-01 15:58:57 UTC
(rev 13084)
+++ trunk/apps/Thaw/src/thaw/i18n/thaw_fr.properties 2007-05-01 17:09:04 UTC
(rev 13085)
@@ -402,8 +402,10 @@
thaw.plugin.signature.nickname=Pseudo
thaw.plugin.signature.trustLevel=Status
-thaw.plugin.signature.isDup=Est un duplicata ?
+thaw.plugin.signature.isDup=Pseudo d\u00e9j\u00e0 utilis\u00e9 ?
+thaw.plugin.signature.duplicata=PSEUDO DEJA UTILIS\u00c9
+
thaw.plugin.signature.addIdentity=Generer une nouvelle identit\u00e9
thaw.plugin.signature.removeIdentity=Supprimer l'identit\u00e9
s\u00e9lectionn\u00e9e
@@ -443,7 +445,7 @@
thaw.plugin.transferLogs.date=Date
thaw.plugin.transferLogs.message=Message
thaw.plugin.transferLogs.key=Clef
-thaw.plugin.transferLogs.isDup=Est-ce que la clef est dupliqu\u00e9e ?
+thaw.plugin.transferLogs.isDup=Est-ce que la clef a d\u00e9j\u00e0
\u00e9t\u00e9 vue ?
thaw.plugin.transferLogs.download.added=T\u00e9l\u00e9chargement ajout\u00e9
thaw.plugin.transferLogs.download.failed=T\u00e9l\u00e9chargement
\u00e9chou\u00e9
Modified: trunk/apps/Thaw/src/thaw/plugins/index/AutoRefresh.java
===================================================================
--- trunk/apps/Thaw/src/thaw/plugins/index/AutoRefresh.java 2007-05-01
15:58:57 UTC (rev 13084)
+++ trunk/apps/Thaw/src/thaw/plugins/index/AutoRefresh.java 2007-05-01
17:09:04 UTC (rev 13085)
@@ -112,6 +112,7 @@
Logger.debug(this, "Index unavailable on
freenet -> not updated");
index = new Index(browserPanel.getDb(),
+ config,
results.getInt("id"),
null,
results.getString("publicKey"),
results.getInt("revision"),
Modified: trunk/apps/Thaw/src/thaw/plugins/index/File.java
===================================================================
--- trunk/apps/Thaw/src/thaw/plugins/index/File.java 2007-05-01 15:58:57 UTC
(rev 13084)
+++ trunk/apps/Thaw/src/thaw/plugins/index/File.java 2007-05-01 17:09:04 UTC
(rev 13085)
@@ -374,7 +374,7 @@
public boolean isModifiable() {
if (parent == null) {
Logger.debug(this, "isModifiable() => new
Index().isModifiable()");
- return (new Index(db, parentId)).isModifiable();
+ return (new Index(db, null, parentId)).isModifiable();
}
return parent.isModifiable();
}
Modified: trunk/apps/Thaw/src/thaw/plugins/index/Index.java
===================================================================
--- trunk/apps/Thaw/src/thaw/plugins/index/Index.java 2007-05-01 15:58:57 UTC
(rev 13084)
+++ trunk/apps/Thaw/src/thaw/plugins/index/Index.java 2007-05-01 17:09:04 UTC
(rev 13085)
@@ -55,6 +55,7 @@
import thaw.core.I18n;
import thaw.core.Logger;
+import thaw.core.Config;
import thaw.fcp.FreenetURIHelper;
import thaw.fcp.FCPClientGet;
@@ -95,7 +96,9 @@
private int lastCommentRev = 0;
private int nmbFailedCommentFetching = 0;
+ private Config config;
+
/**
* @deprecated Just don't use it !
*/
@@ -103,16 +106,19 @@
db = null;
}
- public Index(Hsqldb db, int id) {
+ public Index(Hsqldb db, Config config, int id) {
this.db = db;
+ this.config = config;
this.id = id;
}
/**
* Use it when you can have these infos easily ; else let the index do
the job
*/
- public Index(Hsqldb db, int id, TreeNode parentNode, String publicKey,
int rev, String privateKey, String displayName, boolean hasChanged, boolean
newComment) {
- this(db, id);
+ public Index(Hsqldb db, Config config, int id, TreeNode parentNode,
+ String publicKey, int rev, String privateKey, String
displayName,
+ boolean hasChanged, boolean newComment) {
+ this(db, config, id);
this.parentNode = parentNode;
this.privateKey = privateKey;
this.publicKey = publicKey;
@@ -774,9 +780,15 @@
if (key.startsWith("USK")) {
- int negRev = 0;
+ int negRev = FreenetURIHelper.getUSKRevision(key);
- if ((negRev = FreenetURIHelper.getUSKRevision(key)) >
0) {
+ boolean fetchNeg = true;
+
+ if (config != null &&
config.getValue("indexFetchNegative") != null)
+ fetchNeg =
Boolean.valueOf(config.getValue("indexFetchNegative"));
+
+ if ((fetchNeg && negRev > 0)
+ || (!fetchNeg && negRev < 0)) {
negRev = -1 * negRev;
key = FreenetURIHelper.changeUSKRevision(key,
negRev, 0);
}
@@ -833,9 +845,14 @@
if (path != null) {
loadXML(path);
- if (getCommentPublicKey() != null)
+ boolean loadComm = true;
+
+ if (config != null &&
config.getValue("indexFetchComments") != null)
+ loadComm =
Boolean.valueOf(config.getValue("indexFetchComments"));
+
+ if (getCommentPublicKey() != null &&
loadComm) {
loadComments(queueManager);
- else if (indexTree != null)
+ } else if (indexTree != null)
indexTree.removeUpdatingIndex(this);
} else
Logger.error(this, "No path specified
in transfer ?!");
Modified: trunk/apps/Thaw/src/thaw/plugins/index/IndexBrowserPanel.java
===================================================================
--- trunk/apps/Thaw/src/thaw/plugins/index/IndexBrowserPanel.java
2007-05-01 15:58:57 UTC (rev 13084)
+++ trunk/apps/Thaw/src/thaw/plugins/index/IndexBrowserPanel.java
2007-05-01 17:09:04 UTC (rev 13085)
@@ -107,6 +107,10 @@
return db;
}
+ public Config getConfig() {
+ return config;
+ }
+
public Tables getTables() {
return tables;
}
Modified: trunk/apps/Thaw/src/thaw/plugins/index/IndexConfigPanel.java
===================================================================
--- trunk/apps/Thaw/src/thaw/plugins/index/IndexConfigPanel.java
2007-05-01 15:58:57 UTC (rev 13084)
+++ trunk/apps/Thaw/src/thaw/plugins/index/IndexConfigPanel.java
2007-05-01 17:09:04 UTC (rev 13085)
@@ -16,6 +16,9 @@
import thaw.core.I18n;
import thaw.core.Logger;
+import thaw.gui.WarningWindow;
+
+
public class IndexConfigPanel implements ActionListener {
private ConfigWindow configWindow;
private Config config;
@@ -28,6 +31,9 @@
private JCheckBox loadOnTheFly;
+ private JCheckBox fetchNegative;
+ private JCheckBox fetchComments;
+
private JButton editBlackList;
private IndexBrowserPanel indexBrowser;
@@ -52,8 +58,6 @@
loadOnTheFly = new
JCheckBox(I18n.getMessage("thaw.plugin.index.loadOnTheFly"));
- resetValues();
-
autorefreshActivated.addActionListener(this);
configWindow.getOkButton().addActionListener(this);
configWindow.getCancelButton().addActionListener(this);
@@ -66,7 +70,10 @@
editBlackListPanel.add(new JLabel(""), BorderLayout.CENTER);
editBlackListPanel.add(editBlackList, BorderLayout.EAST);
+ fetchNegative = new
JCheckBox(I18n.getMessage("thaw.plugin.index.fetchNegative"));
+ fetchComments = new
JCheckBox(I18n.getMessage("thaw.plugin.index.fetchComments"));
+
panel.add(autorefreshActivated);
panel.add(refreshIntervalLabel);
panel.add(refreshInterval);
@@ -77,8 +84,12 @@
if
(Boolean.valueOf(config.getValue("advancedMode")).booleanValue()) {
panel.add(new JLabel(" "));
panel.add(loadOnTheFly);
+ panel.add(fetchNegative);
+ panel.add(fetchComments);
}
+ resetValues();
+
updateTextFieldState();
}
@@ -106,6 +117,8 @@
int refreshIntervalInt = AutoRefresh.DEFAULT_INTERVAL;
int nmbIndexInt = AutoRefresh.DEFAULT_INDEX_NUMBER;
boolean loadOnTheFlyBoolean = false;
+ boolean fetchNegativeBoolean = true;
+ boolean fetchCommentsBoolean = true;
try {
if (config.getValue("indexAutoRefreshActivated") !=
null) {
@@ -125,6 +138,14 @@
loadOnTheFlyBoolean =
Boolean.valueOf(config.getValue("loadIndexTreeOnTheFly")).booleanValue();
}
+ if (config.getValue("indexFetchNegative") != null) {
+ fetchNegativeBoolean =
Boolean.valueOf(config.getValue("indexFetchNegative"));
+ }
+
+ if (config.getValue("indexFetchComments") != null) {
+ fetchCommentsBoolean =
Boolean.valueOf(config.getValue("indexFetchComments"));
+ }
+
} catch(NumberFormatException e) {
Logger.error(this, "Error while parsing config !");
}
@@ -134,6 +155,8 @@
refreshInterval.setText(Integer.toString(refreshIntervalInt));
indexPerRefresh.setText(Integer.toString(nmbIndexInt));
loadOnTheFly.setSelected(loadOnTheFlyBoolean);
+ fetchNegative.setSelected(fetchNegativeBoolean);
+ fetchComments.setSelected(fetchCommentsBoolean);
}
@@ -146,6 +169,16 @@
indexPerRefresh.getText());
config.setValue("loadIndexTreeOnTheFly",
Boolean.toString(loadOnTheFly.isSelected()));
+ config.setValue("indexFetchNegative",
+ Boolean.toString(fetchNegative.isSelected()));
+ config.setValue("indexFetchComments",
+ Boolean.toString(fetchComments.isSelected()));
+
+ if (!fetchNegative.isSelected()
+ && fetchComments.isSelected()) {
+ new WarningWindow((thaw.core.MainWindow)null,
+
I18n.getMessage("thaw.plugin.index.warningNonNegative"));
+ }
}
public void actionPerformed(ActionEvent e) {
Modified: trunk/apps/Thaw/src/thaw/plugins/index/IndexFolder.java
===================================================================
--- trunk/apps/Thaw/src/thaw/plugins/index/IndexFolder.java 2007-05-01
15:58:57 UTC (rev 13084)
+++ trunk/apps/Thaw/src/thaw/plugins/index/IndexFolder.java 2007-05-01
17:09:04 UTC (rev 13085)
@@ -18,6 +18,7 @@
import org.w3c.dom.NodeList;
import thaw.core.Logger;
+import thaw.core.Config;
import thaw.fcp.FCPQueueManager;
import thaw.plugins.Hsqldb;
@@ -27,6 +28,8 @@
private static final long serialVersionUID = 2L;
private Hsqldb db;
+ private Config config;
+
private int id;
private TreeNode parentNode = null;
@@ -38,8 +41,11 @@
- public IndexFolder(final Hsqldb db, final int id, boolean loadOnTheFly)
{
+ public IndexFolder(final Hsqldb db, Config config,
+ final int id,
+ boolean loadOnTheFly) {
this.id = id;
+ this.config = config;
this.db = db;
this.loadOnTheFly = loadOnTheFly;
}
@@ -47,8 +53,9 @@
/**
* @param parentNode only required if in a tree
*/
- public IndexFolder(final Hsqldb db, final int id, TreeNode parentNode,
String name, boolean loadOnTheFly) {
- this(db, id, loadOnTheFly);
+ public IndexFolder(final Hsqldb db, Config config,
+ final int id, TreeNode parentNode, String name,
boolean loadOnTheFly) {
+ this(db, config, id, loadOnTheFly);
this.parentNode = parentNode;
this.name = name;
@@ -72,12 +79,15 @@
IndexTreeNode n;
if (folder) {
- n = new IndexFolder(db, set.getInt("id"), this,
set.getString("name"), loadOnTheFly);
+ n = new IndexFolder(db, config,
+ set.getInt("id"), this,
+ set.getString("name"),
loadOnTheFly);
if (!loadOnTheFly) /* => load immediatly */
((IndexFolder)n).loadChildren();
}
else
- n = new Index(db, set.getInt("id"), this,
set.getString("publicKey"),
+ n = new Index(db, config,
+ set.getInt("id"), this,
set.getString("publicKey"),
set.getInt("revision"),
set.getString("privateKey"),
set.getString("displayName"),
set.getBoolean("newRev"),
set.getBoolean("newComment"));
@@ -341,9 +351,10 @@
IndexTreeNode node;
if (index)
- node = new Index(db, target_id);
+ node = new Index(db, config, target_id);
else
- node = new IndexFolder(db, target_id,
false);
+ node = new IndexFolder(db, config,
+ target_id,
false);
children.remove(node);
}
@@ -782,7 +793,8 @@
while(set.next()) {
- (new Index(db,
set.getInt("indexId"))).insertOnFreenet(observer, indexBrowser, queueManager);
+ (new Index(db, config,
+
set.getInt("indexId"))).insertOnFreenet(observer, indexBrowser, queueManager);
i++;
}
@@ -827,9 +839,9 @@
/* TODO : give publickey too immediatly
*/
if (rev < 0)
- (new Index(db,
indexId)).downloadFromFreenet(observer, indexTree, queueManager);
+ (new Index(db, config,
indexId)).downloadFromFreenet(observer, indexTree, queueManager);
else
- (new Index(db,
indexId)).downloadFromFreenet(observer, indexTree, queueManager, rev);
+ (new Index(db, config,
indexId)).downloadFromFreenet(observer, indexTree, queueManager, rev);
i++;
}
Modified: trunk/apps/Thaw/src/thaw/plugins/index/IndexManagementHelper.java
===================================================================
--- trunk/apps/Thaw/src/thaw/plugins/index/IndexManagementHelper.java
2007-05-01 15:58:57 UTC (rev 13084)
+++ trunk/apps/Thaw/src/thaw/plugins/index/IndexManagementHelper.java
2007-05-01 17:09:04 UTC (rev 13085)
@@ -228,7 +228,8 @@
st.execute();
- Index index = new Index(db, id,
(TreeNode)getTarget(),
+ Index index = new Index(db,
getIndexBrowserPanel().getConfig(),
+ id,
(TreeNode)getTarget(),
sskGenerator.getPublicKey(), 0, sskGenerator.getPrivateKey(),
name, false,
false);
@@ -668,7 +669,8 @@
st.execute();
- index = new Index(db, id, parent,
+ index = new Index(db, indexBrowser.getConfig(),
+ id, parent,
publicKey, revision,
privateKey,
name, false, false);
@@ -748,7 +750,8 @@
st.execute();
- folder = new IndexFolder(indexBrowser.getDb(),
nextId, target, name, false);
+ folder = new IndexFolder(indexBrowser.getDb(),
indexBrowser.getConfig(),
+ nextId, target, name,
false);
} catch(SQLException e) {
Logger.error(new IndexManagementHelper(),
"Error while creating folder: "+e.toString());
Modified: trunk/apps/Thaw/src/thaw/plugins/index/IndexRoot.java
===================================================================
--- trunk/apps/Thaw/src/thaw/plugins/index/IndexRoot.java 2007-05-01
15:58:57 UTC (rev 13084)
+++ trunk/apps/Thaw/src/thaw/plugins/index/IndexRoot.java 2007-05-01
17:09:04 UTC (rev 13085)
@@ -24,7 +24,7 @@
final IndexBrowserPanel indexBrowser,
final String name,
final boolean loadOnTheFly) {
- super(indexBrowser.getDb(), -1, loadOnTheFly);
+ super(indexBrowser.getDb(), indexBrowser.getConfig(), -1,
loadOnTheFly);
mainWindow = indexBrowser.getMainWindow();
Modified: trunk/apps/Thaw/src/thaw/plugins/index/Link.java
===================================================================
--- trunk/apps/Thaw/src/thaw/plugins/index/Link.java 2007-05-01 15:58:57 UTC
(rev 13084)
+++ trunk/apps/Thaw/src/thaw/plugins/index/Link.java 2007-05-01 17:09:04 UTC
(rev 13085)
@@ -167,7 +167,7 @@
if (parentId < 0)
return null;
- return new Index(db, parentId);
+ return new Index(db, null, parentId);
}
public int getParentId() {