Author: jflesch
Date: 2007-09-03 20:20:11 +0000 (Mon, 03 Sep 2007)
New Revision: 14943

Modified:
   trunk/apps/Thaw/src/thaw/plugins/index/Index.java
   trunk/apps/Thaw/src/thaw/plugins/index/IndexManagementHelper.java
   trunk/apps/Thaw/src/thaw/plugins/miniFrost/MessagePanel.java
   trunk/apps/Thaw/src/thaw/plugins/miniFrost/frostKSK/KSKBoardFactory.java
   trunk/apps/Thaw/src/thaw/plugins/miniFrost/frostKSK/SSKBoardFactory.java
Log:
Don't force the download of the latest version of an index if comments are not 
activated

Modified: trunk/apps/Thaw/src/thaw/plugins/index/Index.java
===================================================================
--- trunk/apps/Thaw/src/thaw/plugins/index/Index.java   2007-09-03 06:21:21 UTC 
(rev 14942)
+++ trunk/apps/Thaw/src/thaw/plugins/index/Index.java   2007-09-03 20:20:11 UTC 
(rev 14943)
@@ -954,7 +954,8 @@
                                                parser.loadXML(path);


-                                               if (!fetchingNegRev && 
mustFetchNegRev) {
+                                               if (!fetchingNegRev && 
mustFetchNegRev
+                                                   && getCommentPublicKey() != 
null) {
                                                        final java.io.File fl = 
new java.io.File(path);
                                                        fl.delete();


Modified: trunk/apps/Thaw/src/thaw/plugins/index/IndexManagementHelper.java
===================================================================
--- trunk/apps/Thaw/src/thaw/plugins/index/IndexManagementHelper.java   
2007-09-03 06:21:21 UTC (rev 14942)
+++ trunk/apps/Thaw/src/thaw/plugins/index/IndexManagementHelper.java   
2007-09-03 20:20:11 UTC (rev 14943)
@@ -400,8 +400,10 @@
                if (Index.isAlreadyKnown(indexBrowser.getDb(), publicKey, true) 
>= 0) {
                        String name = 
FreenetURIHelper.getFilenameFromKey(publicKey);

-                       if (name != null)
+                       if (name != null) {
+                               name = name.replaceAll(".frdx", "");
                                Logger.warning(new IndexManagementHelper(), 
"Index '"+name+"' already added");
+                       }

                        return null;
                }

Modified: trunk/apps/Thaw/src/thaw/plugins/miniFrost/MessagePanel.java
===================================================================
--- trunk/apps/Thaw/src/thaw/plugins/miniFrost/MessagePanel.java        
2007-09-03 06:21:21 UTC (rev 14942)
+++ trunk/apps/Thaw/src/thaw/plugins/miniFrost/MessagePanel.java        
2007-09-03 20:20:11 UTC (rev 14943)
@@ -330,7 +330,7 @@
                insidePanel = iPanel;

                panel.revalidate();
-
+               revalidate();
                panel.repaint();

                putScrollBarAtBottom();
@@ -342,26 +342,44 @@
        }


+       private class ScrollBarSetter implements Runnable {
+               public ScrollBarSetter() { }
+
+               public void run() {
+                       try {
+                               /* dirty way to have the expected result */
+                               Thread.sleep(100);
+                       } catch(InterruptedException e) {
+
+                       }
+
+                       scrollPane.getVerticalScrollBar().setUnitIncrement(15);
+
+                       int max = 
scrollPane.getVerticalScrollBar().getMaximum();
+                       int extent = 
scrollPane.getVerticalScrollBar().getVisibleAmount();
+                       int min = 
scrollPane.getVerticalScrollBar().getMinimum();
+                       int value = 
scrollPane.getVerticalScrollBar().getValue();
+
+                       Logger.debug(this, "ScrollBar: "
+                                    +"min : "+Integer.toString(min)
+                                    +" ; max : "+Integer.toString(max)
+                                    +" ; extent : "+Integer.toString(extent)
+                                    +" ; value : "+Integer.toString(value));
+
+                       scrollPane.getVerticalScrollBar().setValue(max);
+               }
+       }
+
+
        private void putScrollBarAtBottom() {
                int max = scrollPane.getVerticalScrollBar().getMaximum();
                scrollPane.getVerticalScrollBar().setValue(max);

                Runnable doScroll = new Runnable() {
                                public void run() {
-                                       
scrollPane.getVerticalScrollBar().setUnitIncrement(15);

-                                       int max = 
scrollPane.getVerticalScrollBar().getMaximum();
-                                       int extent = 
scrollPane.getVerticalScrollBar().getVisibleAmount();
-                                       int min = 
scrollPane.getVerticalScrollBar().getMinimum();
-                                       int value = 
scrollPane.getVerticalScrollBar().getValue();
-
-                                       Logger.debug(this, "ScrollBar: "
-                                                   +"min : 
"+Integer.toString(min)
-                                                   +" ; max : 
"+Integer.toString(max)
-                                                   +" ; extent : 
"+Integer.toString(extent)
-                                                   +" ; value : 
"+Integer.toString(value));
-
-                                       
scrollPane.getVerticalScrollBar().setValue(max);
+                                       Thread th = new Thread(new 
ScrollBarSetter());
+                                       th.start();
                                }
                        };

@@ -575,15 +593,15 @@

                public void actionPerformed(ActionEvent e) {

-                       if (e.getSource() == chkActions[2]
-                           || e.getSource() == indexActions[2]) { /* copy this 
key */
+                       if (e.getSource() == chkActions[3]
+                           || e.getSource() == indexActions[3]) { /* copy this 
key */

                                thaw.gui.GUIHelper.copyToClipboard(key);

-                       } else if (e.getSource() == chkActions[3]
-                                  || e.getSource() == indexActions[3]) { /* 
copy all keys */
+                       } else if (e.getSource() == chkActions[4]
+                                  || e.getSource() == indexActions[4]) { /* 
copy all keys */

-                               Vector v = ( (e.getSource() == indexActions[3]) 
?
+                               Vector v = ( (e.getSource() == indexActions[4]) 
?
                                             messagePanel.getIndexKeys() :
                                             messagePanel.getCHKKeys() );


Modified: 
trunk/apps/Thaw/src/thaw/plugins/miniFrost/frostKSK/KSKBoardFactory.java
===================================================================
--- trunk/apps/Thaw/src/thaw/plugins/miniFrost/frostKSK/KSKBoardFactory.java    
2007-09-03 06:21:21 UTC (rev 14942)
+++ trunk/apps/Thaw/src/thaw/plugins/miniFrost/frostKSK/KSKBoardFactory.java    
2007-09-03 20:20:11 UTC (rev 14943)
@@ -59,19 +59,27 @@


        public boolean init(Hsqldb db, Core core, MiniFrost plugin) {
+               return init(db, core, plugin, "frostKSKDatabaseVersion");
+       }
+
+       public boolean init(Hsqldb db, Core core, MiniFrost plugin, String 
configOption) {
                this.db = db;
                this.core = core;
                this.plugin = plugin;

-               boolean firstStart = 
(core.getConfig().getValue("frostKSKDatabaseVersion") == null);
+               boolean firstStart = (core.getConfig().getValue(configOption) 
== null);

                convertExistingTables();

                createTables();

-               if (firstStart)
+               if (firstStart) {
                        addDefaultBoards();

+                       if (core.getConfig().getValue(configOption) == null)
+                               core.getConfig().setValue(configOption, "true");
+               }
+
                boardsHashMap = new HashMap();

                return true;
@@ -222,9 +230,6 @@


        protected void createTables() {
-               if (core.getConfig().getValue("frostKSKDatabaseVersion") == 
null)
-                       core.getConfig().setValue("frostKSKDatabaseVersion", 
"3");
-
                sendQuery("CREATE CACHED TABLE frostKSKBoards ("
                          + "id INTEGER IDENTITY NOT NULL, "
                          + "name VARCHAR(128) NOT NULL, "
@@ -274,6 +279,9 @@
                          + "description VARCHAR(512) NULL, "
                          + "messageId INTEGER NOT NULL, "
                          + "FOREIGN KEY (messageId) REFERENCES 
frostKSKMessages (id))");
+
+               if (core.getConfig().getValue("frostKSKDatabaseVersion") == 
null)
+                       core.getConfig().setValue("frostKSKDatabaseVersion", 
"3");
        }



Modified: 
trunk/apps/Thaw/src/thaw/plugins/miniFrost/frostKSK/SSKBoardFactory.java
===================================================================
--- trunk/apps/Thaw/src/thaw/plugins/miniFrost/frostKSK/SSKBoardFactory.java    
2007-09-03 06:21:21 UTC (rev 14942)
+++ trunk/apps/Thaw/src/thaw/plugins/miniFrost/frostKSK/SSKBoardFactory.java    
2007-09-03 20:20:11 UTC (rev 14943)
@@ -58,7 +58,7 @@
                this.db = db;
                this.core = core;
                this.boards = new HashMap();
-               return super.init(db, core, plugin);
+               return super.init(db, core, plugin, "frostSSKInitialized");
        }

        protected void addDefaultBoards() {


Reply via email to