X-Git-Url: http://git.sourceforge.jp/view?p=neighbornote%2FNeighborNote.git;a=blobdiff_plain;f=src%2Fcx%2Ffbn%2Fnevernote%2FGlobal.java;h=0090c4d2e9c4f60b09abc60b23bb40ab1ab3dd58;hp=3a124b58374abd65dd7eff2dc3bc462ad021da9c;hb=e0f4bf85ac8b198688d389818ed3f93ffd375c18;hpb=a45def57488852d6c41e1f809ceac748b6a92322 diff --git a/src/cx/fbn/nevernote/Global.java b/src/cx/fbn/nevernote/Global.java index 3a124b5..0090c4d 100644 --- a/src/cx/fbn/nevernote/Global.java +++ b/src/cx/fbn/nevernote/Global.java @@ -28,7 +28,6 @@ import java.util.ArrayList; import java.util.Calendar; import java.util.HashMap; import java.util.List; -import java.util.concurrent.ArrayBlockingQueue; import com.evernote.edam.type.Accounting; import com.evernote.edam.type.PrivilegeLevel; @@ -47,39 +46,31 @@ import cx.fbn.nevernote.gui.ShortcutKeys; import cx.fbn.nevernote.utilities.ApplicationLogger; public class Global { - public static String version = "0.88"; + public static String version = "0.90"; public static String username = ""; public static String password = ""; - public static int mainThreadId=0; - private static ArrayBlockingQueue mainThreadWaiter = new ArrayBlockingQueue(1); + + public static final int mainThreadId=0; - public static int syncThreadId=1; - private static ArrayBlockingQueue syncThreadWaiter = new ArrayBlockingQueue(1); + public static final int syncThreadId=1; - public static int tagCounterThreadId=2; - private static ArrayBlockingQueue tagCounterThreadWaiter = new ArrayBlockingQueue(1); + public static final int tagCounterThreadId=2; - public static int trashCounterThreadId=3; // This should always be the highest thread ID - private static ArrayBlockingQueue trashCounterThreadWaiter = new ArrayBlockingQueue(1); + public static final int trashCounterThreadId=3; // This should always be the highest thread ID - public static int indexThreadId=4; // Thread for indexing words - private static ArrayBlockingQueue indexThreadWaiter = new ArrayBlockingQueue(1); + public static final int indexThreadId=4; // Thread for indexing words - public static int saveThreadId=5; // Thread used for processing data to saving content - private static ArrayBlockingQueue saveThreadWaiter = new ArrayBlockingQueue(1); + public static final int saveThreadId=5; // Thread used for processing data to saving content - public static int notebookCounterThreadId=6; // Notebook Thread - private static ArrayBlockingQueue notebookCounterThreadWaiter = new ArrayBlockingQueue(1); + public static final int notebookCounterThreadId=6; // Notebook Thread - public static int indexThread03Id=7; // unused - private static ArrayBlockingQueue indexThread03ThreadWaiter = new ArrayBlockingQueue(1); + public static final int indexThread03Id=7; // unused - public static int indexThread04Id=8; // unused - private static ArrayBlockingQueue indexThread04ThreadWaiter = new ArrayBlockingQueue(1); + public static final int indexThread04Id=8; // unused + + public static final int dbThreadId=9; // This should always be the highest thread ID - public static int dbThreadId=9; // This should always be the highest thread ID - public static HashMap passwordSafe = new HashMap(); public static List passwordRemember = new ArrayList(); @@ -121,14 +112,11 @@ public class Global { public static String attachmentNameDelimeter = "------"; public static String databaseName = new String("NeverNote"); - public static String indexDatabaseName = new String("IndexDatabase.db"); public static DateAttributeFilterTable createdSinceFilter; public static DateAttributeFilterTable createdBeforeFilter; public static DateAttributeFilterTable changedSinceFilter; public static DateAttributeFilterTable changedBeforeFilter; public static ContainsAttributeFilterTable containsFilter; -// public static DBLock dbLock; -// public static DBLock indexLock; public static ApplicationLogger logger; PrintStream stdoutStream; public static QPalette originalPalette; @@ -151,14 +139,14 @@ public class Global { settings = new QSettings("fbn.cx", startupConfig.getName()); disableViewing = startupConfig.getDisableViewing(); - fileManager = new FileManager(startupConfig.getHomeDirPath()); + fileManager = new FileManager(startupConfig.getHomeDirPath(), startupConfig.getProgramDirPath()); getServer(); settings.beginGroup("General"); String regex = (String) settings.value("regex", "[,\\s]+"); setWordRegex(regex); - String wordString = settings.value("wordLength", "4").toString(); + String wordString = settings.value("minimumWordLength", "4").toString(); Integer wordLen = new Integer(wordString); Global.minimumWordCount = wordLen; settings.endGroup(); @@ -170,8 +158,6 @@ public class Global { keepRunning = true; disableUploads = disableUploads(); enableCarriageReturnFix = enableCarriageReturnFix(); -// dbLock = new DBLock(); -// indexLock = new DBLock(); logger = new ApplicationLogger("global.log"); shortcutKeys = new ShortcutKeys(); mimicEvernoteInterface = getMimicEvernoteInterface(); @@ -517,6 +503,23 @@ public class Global { settings.setValue("pdfPreview", "false"); settings.endGroup(); } + public static boolean newNoteWithSelectedTags() { + settings.beginGroup("General"); + String text = (String)settings.value("newNoteWithSelectedTags", "false"); + settings.endGroup(); + if (text.equalsIgnoreCase("true")) + return true; + else + return false; + } + public static void setNewNoteWithSelectedTags(boolean val) { + settings.beginGroup("General"); + if (val) + settings.setValue("newNoteWithSelectedTags", "true"); + else + settings.setValue("newNoteWithSelectedTags", "false"); + settings.endGroup(); + } public static void setMinimumWordLength(int len) { settings.beginGroup("General"); settings.setValue("minimumWordLength", len); @@ -898,72 +901,6 @@ public class Global { settings.endGroup(); } - public static void dbWait() { - // Global.dbThreadWait.wait(Global.dbThreadWaitMutex); - } - public static void dbContinue() { -// Global.dbThreadWait.wakeAll(); - } - - public static synchronized void dbClientWait(int id) { - if (id == mainThreadId) { - try {mainThreadWaiter.take(); } catch (InterruptedException e) {e.printStackTrace();} - } - if (id == syncThreadId) { - try {syncThreadWaiter.take();} catch (InterruptedException e) {e.printStackTrace();} - } - if (id == tagCounterThreadId) { - try {tagCounterThreadWaiter.take();} catch (InterruptedException e) {e.printStackTrace();} - } - if (id == trashCounterThreadId) { - try {trashCounterThreadWaiter.take();} catch (InterruptedException e) {e.printStackTrace();} - } - if (id == indexThreadId) { - try {indexThreadWaiter.take();} catch (InterruptedException e) {e.printStackTrace();} - } - if (id == saveThreadId) { - try {saveThreadWaiter.take();} catch (InterruptedException e) {e.printStackTrace();} - } - if (id == notebookCounterThreadId) { - try {notebookCounterThreadWaiter.take();} catch (InterruptedException e) {e.printStackTrace();} - } - if (id == indexThread03Id) { - try {indexThread03ThreadWaiter.take();} catch (InterruptedException e) {e.printStackTrace();} - } - if (id == indexThread04Id) { - try {indexThread04ThreadWaiter.take();} catch (InterruptedException e) {e.printStackTrace();} - } - } - public static void dbClientContinue(int id) { - if (id == mainThreadId) { - try { mainThreadWaiter.put(true); } catch (InterruptedException e) { e.printStackTrace();} - } - if (id == syncThreadId) { - try { syncThreadWaiter.put(true); } catch (InterruptedException e) { e.printStackTrace();} - } - if (id == tagCounterThreadId) { - try { tagCounterThreadWaiter.put(true); } catch (InterruptedException e) { e.printStackTrace();} - } - if (id == trashCounterThreadId) { - try { trashCounterThreadWaiter.put(true); } catch (InterruptedException e) { e.printStackTrace();} - } - if (id == indexThreadId) { - try { indexThreadWaiter.put(true); } catch (InterruptedException e) { e.printStackTrace();} - } - if (id == saveThreadId) { - try { saveThreadWaiter.put(true); } catch (InterruptedException e) { e.printStackTrace();} - } - if (id == notebookCounterThreadId) { - try { notebookCounterThreadWaiter.put(true); } catch (InterruptedException e) { e.printStackTrace();} - } - if (id == indexThread03Id) { - try { indexThread03ThreadWaiter.put(true); } catch (InterruptedException e) { e.printStackTrace();} - } - if (id == indexThread04Id) { - try { indexThread04ThreadWaiter.put(true); } catch (InterruptedException e) { e.printStackTrace();} - } - } - public static void saveState(String name, QByteArray state) { settings.beginGroup("SaveState"); settings.setValue(name, state);