From 56b5bbc99fc0179022aba3c7a847b71122963801 Mon Sep 17 00:00:00 2001 From: =?utf8?q?David=20=E2=80=98Bombe=E2=80=99=20Roden?= Date: Wed, 13 Jan 2010 22:33:49 +0100 Subject: [PATCH] Show a warning when the user wants to quit and copied an URI before that. --- src/de/todesbaum/jsite/gui/ProjectInsertPage.java | 14 ++++++++++++++ src/de/todesbaum/jsite/gui/ProjectPage.java | 14 ++++++++++++++ src/de/todesbaum/jsite/i18n/jSite.properties | 1 + src/de/todesbaum/jsite/i18n/jSite_de.properties | 1 + src/de/todesbaum/jsite/main/Main.java | 3 +++ 5 files changed, 33 insertions(+) diff --git a/src/de/todesbaum/jsite/gui/ProjectInsertPage.java b/src/de/todesbaum/jsite/gui/ProjectInsertPage.java index 3b852a9..2cedd5b 100644 --- a/src/de/todesbaum/jsite/gui/ProjectInsertPage.java +++ b/src/de/todesbaum/jsite/gui/ProjectInsertPage.java @@ -83,6 +83,9 @@ public class ProjectInsertPage extends TWizardPage implements InsertListener, Cl /** The number of inserted blocks. */ private volatile int insertedBlocks; + /** Whether the “copy URI to clipboard” button was used. */ + private boolean uriCopied; + /** * Creates a new progress insert wizard page. * @@ -250,6 +253,16 @@ public class ProjectInsertPage extends TWizardPage implements InsertListener, Cl projectInserter.setTempDirectory(tempDirectory); } + /** + * Returns whether the “copy URI to clipboard” button was used. + * + * @return {@code true} if an URI was copied to clipboard, {@code false} + * otherwise + */ + public boolean wasUriCopied() { + return uriCopied; + } + // // INTERFACE InsertListener // @@ -352,6 +365,7 @@ public class ProjectInsertPage extends TWizardPage implements InsertListener, Cl * Copies the request URI of the project to the clipboard. */ private void actionCopyURI() { + uriCopied = true; Clipboard clipboard = Toolkit.getDefaultToolkit().getSystemClipboard(); clipboard.setContents(new StringSelection(requestURITextField.getText()), this); } diff --git a/src/de/todesbaum/jsite/gui/ProjectPage.java b/src/de/todesbaum/jsite/gui/ProjectPage.java index c24f7bf..756c450 100644 --- a/src/de/todesbaum/jsite/gui/ProjectPage.java +++ b/src/de/todesbaum/jsite/gui/ProjectPage.java @@ -131,6 +131,9 @@ public class ProjectPage extends TWizardPage implements ListSelectionListener, D /** The project path textfield. */ private JTextField projectPathTextField; + /** Whether the “copy URI to clipboard” action was used. */ + private boolean uriCopied; + /** * Creates a new project page. * @@ -473,6 +476,16 @@ public class ProjectPage extends TWizardPage implements ListSelectionListener, D } /** + * Returns whether the “copy URI to clipboard” button was used. + * + * @return {@code true} if the “copy URI to clipboard” button was used, + * {@code false} otherwise + */ + public boolean wasUriCopied() { + return uriCopied; + } + + /** * Updates the currently selected project with changed information from a * textfield. * @@ -591,6 +604,7 @@ public class ProjectPage extends TWizardPage implements ListSelectionListener, D Project selectedProject = (Project) projectList.getSelectedValue(); Clipboard clipboard = Toolkit.getDefaultToolkit().getSystemClipboard(); clipboard.setContents(new StringSelection(selectedProject.getFinalRequestURI(0)), this); + uriCopied = true; } } diff --git a/src/de/todesbaum/jsite/i18n/jSite.properties b/src/de/todesbaum/jsite/i18n/jSite.properties index d5e16e2..3333977 100644 --- a/src/de/todesbaum/jsite/i18n/jSite.properties +++ b/src/de/todesbaum/jsite/i18n/jSite.properties @@ -125,6 +125,7 @@ jsite.project.warning.no-local-path=No local path

You did no jsite.project.warning.no-path=No freesite path

You did not specify a freesite path.
It is not possible to continue without one. jsite.project.warning.generate-new-key=Generate new key?

If you generate a new key, your site will be published
under that new key. Any trust that other users put
in the old key of your site will be gone! jsite.project.warning.reset-edition=Reset edition?

Resetting the edition can lead to insert failures
and lots of confusion if you have not changed
the path or the keys of the project! +jsite.project.warning.use-clipboard-now=URI copied

Please note that it is possible that quitting jSite
now will empty the clipboard. Please use the
copied URI immediately in another window! jsite.project-files.heading=Project Files jsite.project-files.description=On this page you can specify parameters for the files within the project, such as
externally generated keys or MIME types, if the automatic detection failed. diff --git a/src/de/todesbaum/jsite/i18n/jSite_de.properties b/src/de/todesbaum/jsite/i18n/jSite_de.properties index 033ef06..83c7f1c 100644 --- a/src/de/todesbaum/jsite/i18n/jSite_de.properties +++ b/src/de/todesbaum/jsite/i18n/jSite_de.properties @@ -125,6 +125,7 @@ jsite.project.warning.no-local-path=Kein lokaler Pfad

Sie ha jsite.project.warning.no-path=Kein Freesite-Pfad

Sie haben keinen Pfad f\u00fcr die Freesite angegeben.
Es ist nicht m\u00f6glich, ohne einen Freesite-Pfad weiter zu machen. jsite.project.warning.generate-new-key=Neues Schl\u00fcsselpaar generieren?

Wenn Sie das Schl\u00fcsselpaar f\u00fcr das Projekt \u00e4ndern,
wird sich die URI f\u00fcr Ihr Projekt ebenfalls
\u00e4ndern, und jegliches Vertrauen, dass andere
Benutzer in das alte Schl\u00fcsselpaar hatten, wird
verloren gehen! jsite.project.warning.reset-edition=Edition zur\u00fccksetzen?

Das Zur\u00fccksetzen der Editionsnummer kann zum
Fehlschlagen des Einf\u00fcgens f\u00fchren, wenn sich nicht
auch die URI oder der Pfad des Projekts ge\u00e4ndert haben! +jsite.project.warning.use-clipboard-now=Anfrage-URI kopiert

Bitte beachten Sie, dass die Zwischenablage nach dem
Beenden von jSite eventuell nicht mehr die kopierte
URI enth\u00e4lt. Bitte f\u00fcgen Sie sie daher schleunigst in
ein anderes Programm ein! jsite.project-files.heading=Projektdateien jsite.project-files.description=Auf dieser Seite k\u00f6nnen Parameter f\u00fcr die einzelnen Dateien dieses Projekts angegeben werden, z.B.
extern erstellte Schl\u00fcssel oder der korrekte MIME-Typ, wenn er nicht automatisch richtig erkannt wurde. diff --git a/src/de/todesbaum/jsite/main/Main.java b/src/de/todesbaum/jsite/main/Main.java index f59e29c..f74da36 100644 --- a/src/de/todesbaum/jsite/main/Main.java +++ b/src/de/todesbaum/jsite/main/Main.java @@ -593,6 +593,9 @@ public class Main implements ActionListener, ListSelectionListener, WizardListen * {@inheritDoc} */ public void wizardQuitPressed(TWizard wizard) { + if (((ProjectPage) pages.get(PageType.PAGE_PROJECTS)).wasUriCopied() || ((ProjectInsertPage) pages.get(PageType.PAGE_INSERT_PROJECT)).wasUriCopied()) { + JOptionPane.showMessageDialog(wizard, I18n.getMessage("jsite.project.warning.use-clipboard-now")); + } if (JOptionPane.showConfirmDialog(wizard, I18n.getMessage("jsite.quit.question"), null, JOptionPane.OK_CANCEL_OPTION, JOptionPane.QUESTION_MESSAGE) == JOptionPane.OK_OPTION) { if (saveConfiguration()) { System.exit(0); -- 2.7.4