[jsword-svn] r1109 - in trunk: bibledesktop/src/main/java/org/crosswire/bibledesktop/book/install jsword/src/main/java/org/crosswire/jsword/book jsword/src/main/java/org/crosswire/jsword/book/basic jsword/src/main/java/org/crosswire/jsword/book/sword
dmsmith at crosswire.org
dmsmith at crosswire.org
Mon Jul 24 16:40:45 MST 2006
Author: dmsmith
Date: 2006-07-24 16:40:27 -0700 (Mon, 24 Jul 2006)
New Revision: 1109
Modified:
trunk/bibledesktop/src/main/java/org/crosswire/bibledesktop/book/install/BookTreeCellRenderer.java
trunk/bibledesktop/src/main/java/org/crosswire/bibledesktop/book/install/EditSitePane.java
trunk/bibledesktop/src/main/java/org/crosswire/bibledesktop/book/install/SitePane.java
trunk/bibledesktop/src/main/java/org/crosswire/bibledesktop/book/install/SitesPane.java
trunk/jsword/src/main/java/org/crosswire/jsword/book/Book.java
trunk/jsword/src/main/java/org/crosswire/jsword/book/BookMetaData.java
trunk/jsword/src/main/java/org/crosswire/jsword/book/basic/AbstractBook.java
trunk/jsword/src/main/java/org/crosswire/jsword/book/basic/AbstractBookMetaData.java
trunk/jsword/src/main/java/org/crosswire/jsword/book/sword/ConfigEntryTable.java
trunk/jsword/src/main/java/org/crosswire/jsword/book/sword/SwordBookMetaData.java
Log:
Made unlock more friendly.
It now lets you retry and it trims whitespace.
Modified: trunk/bibledesktop/src/main/java/org/crosswire/bibledesktop/book/install/BookTreeCellRenderer.java
===================================================================
--- trunk/bibledesktop/src/main/java/org/crosswire/bibledesktop/book/install/BookTreeCellRenderer.java 2006-07-24 21:15:38 UTC (rev 1108)
+++ trunk/bibledesktop/src/main/java/org/crosswire/bibledesktop/book/install/BookTreeCellRenderer.java 2006-07-24 23:40:27 UTC (rev 1109)
@@ -51,12 +51,12 @@
{
Book book = (Book) obj;
setLeafIcon(BookIcon.getIcon(book));
-
+
if (book.isQuestionable())
{
tooltip = Msg.BOOK_QUESTIONABLE.toString();
}
-
+
if (!book.isSupported())
{
tooltip = Msg.BOOK_UNSUPPORTED.toString();
Modified: trunk/bibledesktop/src/main/java/org/crosswire/bibledesktop/book/install/EditSitePane.java
===================================================================
--- trunk/bibledesktop/src/main/java/org/crosswire/bibledesktop/book/install/EditSitePane.java 2006-07-24 21:15:38 UTC (rev 1108)
+++ trunk/bibledesktop/src/main/java/org/crosswire/bibledesktop/book/install/EditSitePane.java 2006-07-24 23:40:27 UTC (rev 1109)
@@ -31,8 +31,6 @@
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import java.awt.event.KeyEvent;
-import java.awt.event.WindowAdapter;
-import java.awt.event.WindowEvent;
import javax.swing.BorderFactory;
import javax.swing.JButton;
@@ -43,7 +41,6 @@
import javax.swing.JList;
import javax.swing.JOptionPane;
import javax.swing.JPanel;
-import javax.swing.JRootPane;
import javax.swing.JScrollPane;
import javax.swing.JSeparator;
import javax.swing.JSplitPane;
Modified: trunk/bibledesktop/src/main/java/org/crosswire/bibledesktop/book/install/SitePane.java
===================================================================
--- trunk/bibledesktop/src/main/java/org/crosswire/bibledesktop/book/install/SitePane.java 2006-07-24 21:15:38 UTC (rev 1108)
+++ trunk/bibledesktop/src/main/java/org/crosswire/bibledesktop/book/install/SitePane.java 2006-07-24 23:40:27 UTC (rev 1109)
@@ -332,10 +332,14 @@
Book book = getBook(last);
String unlockKey =
- JOptionPane.showInputDialog(this,
+ (String) JOptionPane.showInputDialog(this,
Msg.UNLOCK_BOOK.toString(new Object[] {book.getName()}),
Msg.UNLOCK_TITLE.toString(),
- JOptionPane.QUESTION_MESSAGE);
+ JOptionPane.QUESTION_MESSAGE,
+ null,
+ null,
+ book.getUnlockKey());
+
if (unlockKey != null && unlockKey.length() > 0)
{
book.unlock(unlockKey);
@@ -491,7 +495,7 @@
boolean canInstall = bookSelected && book.isSupported();
IndexManager imanager = IndexManagerFactory.getIndexManager();
actions.getAction(DELETE).setEnabled(bookSelected && book.getDriver().isDeletable(book));
- actions.getAction(UNLOCK).setEnabled(bookSelected && book.isLocked());
+ actions.getAction(UNLOCK).setEnabled(bookSelected && book.isEnciphered());
actions.getAction(UNINDEX).setEnabled(bookSelected && imanager.isIndexed(book));
actions.getAction(INSTALL).setEnabled(canInstall);
actions.getAction(INSTALL_SEARCH).setEnabled(canInstall && book.getBookCategory() == BookCategory.BIBLE);
Modified: trunk/bibledesktop/src/main/java/org/crosswire/bibledesktop/book/install/SitesPane.java
===================================================================
--- trunk/bibledesktop/src/main/java/org/crosswire/bibledesktop/book/install/SitesPane.java 2006-07-24 21:15:38 UTC (rev 1108)
+++ trunk/bibledesktop/src/main/java/org/crosswire/bibledesktop/book/install/SitesPane.java 2006-07-24 23:40:27 UTC (rev 1109)
@@ -35,7 +35,6 @@
import javax.swing.JDialog;
import javax.swing.JOptionPane;
import javax.swing.JPanel;
-import javax.swing.JRootPane;
import javax.swing.JTabbedPane;
import org.crosswire.common.progress.swing.JobsProgressBar;
Modified: trunk/jsword/src/main/java/org/crosswire/jsword/book/Book.java
===================================================================
--- trunk/jsword/src/main/java/org/crosswire/jsword/book/Book.java 2006-07-24 21:15:38 UTC (rev 1108)
+++ trunk/jsword/src/main/java/org/crosswire/jsword/book/Book.java 2006-07-24 23:40:27 UTC (rev 1109)
@@ -180,6 +180,13 @@
boolean unlock(String unlockKey);
/**
+ * Gets the unlock key for the module.
+ *
+ * @return the unlock key, if any, null otherwise.
+ */
+ public String getUnlockKey();
+
+ /**
* Indicate whether this book is questionable. A book may
* be deemed questionable if it's quality or content has not
* been confirmed.
Modified: trunk/jsword/src/main/java/org/crosswire/jsword/book/BookMetaData.java
===================================================================
--- trunk/jsword/src/main/java/org/crosswire/jsword/book/BookMetaData.java 2006-07-24 21:15:38 UTC (rev 1108)
+++ trunk/jsword/src/main/java/org/crosswire/jsword/book/BookMetaData.java 2006-07-24 23:40:27 UTC (rev 1109)
@@ -137,6 +137,13 @@
boolean unlock(String unlockKey);
/**
+ * Gets the unlock key for the module.
+ *
+ * @return the unlock key, if any, null otherwise.
+ */
+ public String getUnlockKey();
+
+ /**
* Indicate whether this book is questionable. A book may
* be deemed questionable if it's quality or content has not
* been confirmed.
Modified: trunk/jsword/src/main/java/org/crosswire/jsword/book/basic/AbstractBook.java
===================================================================
--- trunk/jsword/src/main/java/org/crosswire/jsword/book/basic/AbstractBook.java 2006-07-24 21:15:38 UTC (rev 1108)
+++ trunk/jsword/src/main/java/org/crosswire/jsword/book/basic/AbstractBook.java 2006-07-24 23:40:27 UTC (rev 1109)
@@ -251,6 +251,14 @@
}
/* (non-Javadoc)
+ * @see org.crosswire.jsword.book.BookMetaData#getUnlockKey()
+ */
+ public String getUnlockKey()
+ {
+ return bmd.getUnlockKey();
+ }
+
+ /* (non-Javadoc)
* @see org.crosswire.jsword.book.BookMetaData#isQuestionable()
*/
public boolean isQuestionable()
Modified: trunk/jsword/src/main/java/org/crosswire/jsword/book/basic/AbstractBookMetaData.java
===================================================================
--- trunk/jsword/src/main/java/org/crosswire/jsword/book/basic/AbstractBookMetaData.java 2006-07-24 21:15:38 UTC (rev 1108)
+++ trunk/jsword/src/main/java/org/crosswire/jsword/book/basic/AbstractBookMetaData.java 2006-07-24 23:40:27 UTC (rev 1109)
@@ -142,6 +142,14 @@
}
/* (non-Javadoc)
+ * @see org.crosswire.jsword.book.BookMetaData#getUnlockKey()
+ */
+ public String getUnlockKey()
+ {
+ return null;
+ }
+
+ /* (non-Javadoc)
* @see org.crosswire.jsword.book.BookMetaData#isQuestionable()
*/
public boolean isQuestionable()
Modified: trunk/jsword/src/main/java/org/crosswire/jsword/book/sword/ConfigEntryTable.java
===================================================================
--- trunk/jsword/src/main/java/org/crosswire/jsword/book/sword/ConfigEntryTable.java 2006-07-24 21:15:38 UTC (rev 1108)
+++ trunk/jsword/src/main/java/org/crosswire/jsword/book/sword/ConfigEntryTable.java 2006-07-24 23:40:27 UTC (rev 1109)
@@ -169,12 +169,17 @@
/**
* Unlocks a book with the given key.
+ * The key is trimmed of any leading or trailing whitespace.
*
* @param unlockKey the key to try
* @return true if the unlock key worked.
*/
public boolean unlock(String unlockKey)
{
+ if (unlockKey != null)
+ {
+ unlockKey = unlockKey.trim();
+ }
add(ConfigEntryType.CIPHER_KEY, unlockKey);
if (configFile != null)
{
@@ -191,6 +196,16 @@
}
/**
+ * Gets the unlock key for the module.
+ *
+ * @return the unlock key, if any, null otherwise.
+ */
+ public String getUnlockKey()
+ {
+ return (String) getValue(ConfigEntryType.CIPHER_KEY);
+ }
+
+ /**
* Returns an Enumeration of all the keys found in the config file.
*/
public Set getKeys()
Modified: trunk/jsword/src/main/java/org/crosswire/jsword/book/sword/SwordBookMetaData.java
===================================================================
--- trunk/jsword/src/main/java/org/crosswire/jsword/book/sword/SwordBookMetaData.java 2006-07-24 21:15:38 UTC (rev 1108)
+++ trunk/jsword/src/main/java/org/crosswire/jsword/book/sword/SwordBookMetaData.java 2006-07-24 23:40:27 UTC (rev 1109)
@@ -132,6 +132,14 @@
}
/* (non-Javadoc)
+ * @see org.crosswire.jsword.book.BookMetaData#getUnlockKey()
+ */
+ public String getUnlockKey()
+ {
+ return cet.getUnlockKey();
+ }
+
+ /* (non-Javadoc)
* @see org.crosswire.jsword.book.BookMetaData#getName()
*/
public String getName()
More information about the jsword-svn
mailing list