Implement cancelling the insert when the “cancel” button is pressed.
authorDavid ‘Bombe’ Roden <bombe@freenetproject.org>
Thu, 17 Jun 2010 17:54:19 +0000 (19:54 +0200)
committerDavid ‘Bombe’ Roden <bombe@freenetproject.org>
Thu, 17 Jun 2010 18:00:47 +0000 (20:00 +0200)
src/de/todesbaum/jsite/gui/ProjectInsertPage.java
src/de/todesbaum/jsite/main/Main.java

index 86305aa..b722ceb 100644 (file)
@@ -206,7 +206,7 @@ public class ProjectInsertPage extends TWizardPage implements InsertListener, Cl
        public void pageAdded(TWizard wizard) {
                this.wizard.setPreviousName(I18n.getMessage("jsite.wizard.previous"));
                this.wizard.setPreviousEnabled(false);
-               this.wizard.setNextName(I18n.getMessage("jsite.wizard.next"));
+               this.wizard.setNextName(I18n.getMessage("jsite.general.cancel"));
                this.wizard.setQuitName(I18n.getMessage("jsite.wizard.quit"));
        }
 
@@ -215,7 +215,6 @@ public class ProjectInsertPage extends TWizardPage implements InsertListener, Cl
         */
        public void startInsert() {
                running = true;
-               wizard.setNextEnabled(false);
                copyURIAction.setEnabled(false);
                progressBar.setValue(0);
                progressBar.setString(I18n.getMessage("jsite.insert.starting"));
@@ -400,6 +399,7 @@ public class ProjectInsertPage extends TWizardPage implements InsertListener, Cl
                        public void run() {
                                progressBar.setValue(progressBar.getMaximum());
                                progressBar.setString(I18n.getMessage("jsite.insert.done") + " (" + getTransferRate() + " " + I18n.getMessage("jsite.insert.k-per-s") + ")");
+                               wizard.setNextName(I18n.getMessage("jsite.wizard.next"));
                                wizard.setNextEnabled(true);
                                wizard.setQuitEnabled(true);
                        }
index 09b6a5d..442b16d 100644 (file)
@@ -540,9 +540,14 @@ public class Main implements ActionListener, ListSelectionListener, WizardListen
                        nodeMenu.setEnabled(false);
                        optionsPreferencesAction.setEnabled(false);
                } else if ("page.project.insert".equals(pageName)) {
-                       showPage(PageType.PAGE_PROJECTS);
-                       nodeMenu.setEnabled(true);
-                       optionsPreferencesAction.setEnabled(true);
+                       ProjectInsertPage projectInsertPage = (ProjectInsertPage) pages.get(PageType.PAGE_INSERT_PROJECT);
+                       if (projectInsertPage.isRunning()) {
+                               projectInsertPage.stopInsert();
+                       } else {
+                               showPage(PageType.PAGE_PROJECTS);
+                               nodeMenu.setEnabled(true);
+                               optionsPreferencesAction.setEnabled(true);
+                       }
                } else if ("page.preferences".equals(pageName)) {
                        showPage(PageType.PAGE_PROJECTS);
                        optionsPreferencesAction.setEnabled(true);