Author: jflesch
Date: 2007-01-26 19:53:21 +0000 (Fri, 26 Jan 2007)
New Revision: 11620

Modified:
   trunk/apps/Thaw/src/thaw/plugins/index/FileManagementHelper.java
   trunk/apps/Thaw/src/thaw/plugins/index/IndexTree.java
Log:
fix the toolbar behavior for the index tab

Modified: trunk/apps/Thaw/src/thaw/plugins/index/FileManagementHelper.java
===================================================================
--- trunk/apps/Thaw/src/thaw/plugins/index/FileManagementHelper.java    
2007-01-26 19:39:11 UTC (rev 11619)
+++ trunk/apps/Thaw/src/thaw/plugins/index/FileManagementHelper.java    
2007-01-26 19:53:21 UTC (rev 11620)
@@ -114,7 +114,7 @@
                public void setTarget(final Vector target) {
                        boolean isOk;

-                       isOk = true;
+                       isOk = false;

                        this.target = target;

@@ -123,8 +123,9 @@
                                     it.hasNext(); ) {
                                        final thaw.plugins.index.File file = 
(thaw.plugins.index.File)it.next();

-                                       if (file.getLocalPath() == null) {
-                                               isOk = false;
+                                       if (file.getLocalPath() != null
+                                           && file.getTransfer(queueManager) 
== null) {
+                                               isOk = true;
                                                break;
                                        }
                                }
@@ -148,7 +149,8 @@
                for (final Iterator it = files.iterator();
                     it.hasNext();) {
                        final thaw.plugins.index.File file = 
(thaw.plugins.index.File)it.next();
-                       file.insertOnFreenet(queueManager);
+                       if (file.getLocalPath() != null)
+                               file.insertOnFreenet(queueManager);
                }

                if (indexBrowser != null)
@@ -173,7 +175,7 @@
                public void setTarget(final Vector target) {
                        boolean isOk;

-                       isOk = true;
+                       isOk = false;
                        this.target = target;

                        if (target != null) {
@@ -181,14 +183,15 @@
                                     it.hasNext(); ) {
                                        final thaw.plugins.index.File file = 
(thaw.plugins.index.File)it.next();

-                                       if (file.getLocalPath() == null) {
-                                               isOk = false;
+                                       if (file.getLocalPath() != null
+                                           && file.getTransfer(queueManager) 
== null) {
+                                               isOk = true;
                                                break;
                                        }
                                }
                        }

-                       actionSource.setEnabled((target != null) && 
(target.size() != 0) && isOk);
+                       actionSource.setEnabled((target != null) && isOk);
                }

                public void actionPerformed(final ActionEvent e) {
@@ -207,7 +210,9 @@
                for (final Iterator it = files.iterator();
                     it.hasNext();) {
                        final thaw.plugins.index.File file = 
(thaw.plugins.index.File)it.next();
-                       file.recalculateCHK(queueManager);
+
+                       if (file.getLocalPath() != null)
+                               file.recalculateCHK(queueManager);
                }

                if (indexBrowser != null) {

Modified: trunk/apps/Thaw/src/thaw/plugins/index/IndexTree.java
===================================================================
--- trunk/apps/Thaw/src/thaw/plugins/index/IndexTree.java       2007-01-26 
19:39:11 UTC (rev 11619)
+++ trunk/apps/Thaw/src/thaw/plugins/index/IndexTree.java       2007-01-26 
19:53:21 UTC (rev 11620)
@@ -356,12 +356,11 @@
                        action.setTarget(selectedNode);
                }

-               toolbarModifier.displayButtonsInTheToolbar();

                // Notify observers

                setChanged();
-               notifyObservers(selectedNode);
+               notifyObservers(selectedNode); /* will make the toolbar visible 
*/
        }


@@ -446,6 +445,8 @@

                }

+               toolbarModifier.displayButtonsInTheToolbar();
+
                setChanged();
                notifyObservers(selectedNode);
        }


Reply via email to