OSDN Git Service

ノートコンテンツをwordテーブルに登録しないように変更。
[neighbornote/NeighborNote.git] / src / cx / fbn / nevernote / NeverNote.java
index 4ae7d8f..1607030 100644 (file)
@@ -453,8 +453,8 @@ public class NeverNote extends QMainWindow{
                indexThread = new QThread(indexRunner, "Index Thread");
         indexRunner.indexAttachmentsLocally = Global.indexAttachmentsLocally();
         indexRunner.indexImageRecognition = Global.indexImageRecognition();
-        indexRunner.indexNoteBody = Global.indexNoteBody();
-        indexRunner.indexNoteTitle = Global.indexNoteTitle();
+//        indexRunner.indexNoteBody = Global.indexNoteBody();
+//        indexRunner.indexNoteTitle = Global.indexNoteTitle();
         indexRunner.specialIndexCharacters = Global.getSpecialIndexCharacters();
                indexThread.start();
                
@@ -600,12 +600,25 @@ public class NeverNote extends QMainWindow{
                tabBrowser = new TabBrowserWidget(this);
                tabBrowser.setStyleSheet("QTabBar::tab{width:150px;}");
                tabBrowser.setMovable(true);
+               TabBrowse tab = new TabBrowse(conn, tabBrowser, cbObserver);
+               browserWindow = tab.getBrowserWindow();
+               int index = tabBrowser.addNewTab(tab, "");
+               tabWindows.put(index, tab);
                tabBrowser.setTabsClosable(true);
                tabBrowser.currentChanged.connect(this, "tabWindowChanged(int)");
                tabBrowser.tabCloseRequested.connect(this, "tabWindowClosing(int)");
                
+               noteDirty = new HashMap<Integer, Boolean>();
+               noteDirty.put(index, false);
+               
                inkNote = new HashMap<Integer, Boolean>();
                readOnly = new HashMap<Integer, Boolean>();
+
+               // ICHANGED
+               // 履歴記録のハッシュマップを初期化
+               historyGuids.put(index, new ArrayList<String>());
+               historyPosition.put(index, 0);
+               fromHistory.put(index, false);
                
         mainLeftRightSplitter.addWidget(leftSplitter1);
         mainLeftRightSplitter.addWidget(browserIndexSplitter);
@@ -779,60 +792,21 @@ public class NeverNote extends QMainWindow{
                trayIcon.setToolTip(tr("NeighborNote"));
                trayIcon.setContextMenu(trayMenu);
                trayIcon.activated.connect(this, "trayActivated(com.trolltech.qt.gui.QSystemTrayIcon$ActivationReason)");
-               
-               // 前回のタブを復元
-               noteTableView.load(true);
-               HashMap<Integer, String> tabs = new HashMap<Integer, String>();
-               if (Global.getLastViewedTabs() != null) {
-                       tabs.putAll(Global.getLastViewedTabs());
-               }
-               
-               Collection<String>              guids = tabs.values();
-               Iterator<String>                guidIterator = guids.iterator();
-               Collection<Integer>             indexes = tabs.keySet();
-               Iterator<Integer>               indexIterator = indexes.iterator();
-               noteDirty = new HashMap<Integer, Boolean>();
-               
-               while (guidIterator.hasNext()) {
-                       String guid = guidIterator.next();
-                       int tabIndex = indexIterator.next();
-                       
-                       currentNoteGuid = guid;
-                       noteDirty.put(tabIndex, false);
-                       if (!currentNoteGuid.trim().equals("")) {
-                               currentNote = conn.getNoteTable().getNote(currentNoteGuid, true, true, false, false, true);
-                               if (currentNote != null) {
-                                       openTabEditor(guid, tabIndex);
-                               }
-                       }
-               }
-               
-               // タブが0個だったら作る
-               if (tabBrowser.count() <= 0) {
-                       TabBrowse tab = new TabBrowse(conn, tabBrowser, cbObserver);
-                       browserWindow = tab.getBrowserWindow();
-                       tabBrowser.currentChanged.disconnect();
-                       int index = tabBrowser.addNewTab(tab, "");
-                       tabBrowser.currentChanged.connect(this, "tabWindowChanged(int)");
-                       tabWindows.put(index, tab);
-                       noteDirty.put(index, false);
-                       
-                       // 履歴記録のハッシュマップを初期化
-                       historyGuids.put(index, new ArrayList<String>());
-                       historyPosition.put(index, 0);
-                       fromHistory.put(index, false);
-               }
-               
+
+               currentNoteGuid="";
                currentNoteGuid = Global.getLastViewedNoteGuid();
-               if (currentNoteGuid.trim().equals("")) {
+               if (currentNoteGuid.equals(""))
                        currentNote = new Note();
-               } else {
-                       currentNote = conn.getNoteTable().getNote(currentNoteGuid, true,true,false,false,true);
-               }
                
-               // タブのフォーカスをlastViewedTabIndexに移す
-               if (tabBrowser.count() >= 2) {
-                       tabBrowser.setCurrentIndex(Global.getLastViewedTabIndex());
+               // ICHANGED
+               /* 上に移動したので要らない
+               historyGuids = new ArrayList<String>();
+               historyPosition = 0;
+               fromHistory = false;
+               */
+               
+               if (!currentNoteGuid.trim().equals("")) {
+                       currentNote = conn.getNoteTable().getNote(currentNoteGuid, true,true,false,false,true);
                }
                
                noteIndexUpdated(true);
@@ -942,8 +916,7 @@ public class NeverNote extends QMainWindow{
        }
                
                if (Global.checkVersionUpgrade()) {
-                       // ICHANGED TODO とりあえず封印
-                       // checkForUpdates();
+                       checkForUpdates();
                }
                
                // ICHANGED
@@ -1304,23 +1277,6 @@ public class NeverNote extends QMainWindow{
                
                Global.saveWindowMaximized(isMaximized());
                Global.saveCurrentNoteGuid(currentNoteGuid);
-               Global.saveLastViewedTabIndex(tabBrowser.currentIndex());
-               
-               // 開いていたタブ群をsettingsに保存しておく
-               Collection<TabBrowse>           tabBrowsers = tabWindows.values();
-               Iterator<TabBrowse>                     tabIterator = tabBrowsers.iterator();
-               Collection<Integer>                     tabIndexes = tabWindows.keySet();
-               Iterator<Integer>                       indexIterator = tabIndexes.iterator();
-               HashMap<Integer, String>        tabs = new HashMap<Integer, String>();
-               while (tabIterator.hasNext()) {
-                       TabBrowse tab = tabIterator.next();
-                       int index = indexIterator.next();
-                       if (tab.getBrowserWindow() != null && tab.getBrowserWindow().getNote() != null) {
-                               String guid = tab.getBrowserWindow().getNote().getGuid();
-                               tabs.put(index, guid);
-                       }
-               }
-               Global.saveLastViewedTabs(tabs);
                        
                int sortCol = noteTableView.proxyModel.sortColumn();
                int sortOrder = noteTableView.proxyModel.sortOrder().value();
@@ -1496,7 +1452,7 @@ public class NeverNote extends QMainWindow{
                saveNoteColumnPositions();
                saveNoteIndexWidth();
                showColumns();
-        ConfigDialog settings = new ConfigDialog(this);
+        ConfigDialog settings = new ConfigDialog(this, conn);
         String dateFormat = Global.getDateFormat();
         String timeFormat = Global.getTimeFormat();
         
@@ -1505,8 +1461,8 @@ public class NeverNote extends QMainWindow{
         
         settings.exec();
         indexRunner.indexAttachmentsLocally = Global.indexAttachmentsLocally();
-        indexRunner.indexNoteBody = Global.indexNoteBody();
-        indexRunner.indexNoteTitle = Global.indexNoteTitle();
+//        indexRunner.indexNoteBody = Global.indexNoteBody();
+//        indexRunner.indexNoteTitle = Global.indexNoteTitle();
         indexRunner.specialIndexCharacters = Global.getSpecialIndexCharacters();
         indexRunner.indexImageRecognition = Global.indexImageRecognition();
         if (Global.showTrayIcon() || Global.minimizeOnClose())
@@ -4833,36 +4789,17 @@ public class NeverNote extends QMainWindow{
                        conn.getHistoryTable().addHistory("rensoItemClick", prevCurrentNoteGuid, rensoNotePressedItemGuid);
                }
        }
-       
-       private void openTabEditor(String guid) {
-               openTabEditor(guid, -1);
-       }
 
-       // オーバーロード insertIndex < 0 ならば普通に追加
-       private void openTabEditor(String guid, int insertIndex) {
+       // ICHANGED
+       private void openTabEditor(String guid) {
+               
                Note note = conn.getNoteTable().getNote(guid, true, true, false, true, true);
                // 新しいタブエディタを作成
                TabBrowse newBrowser = new TabBrowse(conn, tabBrowser, cbObserver);
                showEditorButtons(newBrowser.getBrowserWindow());
                
                String noteTitle = note.getTitle();
-               int index;
-               // 最初のタブだけ、追加後に自動的にフォーカスが移ってしまうので、一度切断する
-               if (tabBrowser.count() == 0) {
-                       tabBrowser.currentChanged.disconnect();
-                       if (insertIndex < 0) {
-                               index = tabBrowser.addNewTab(newBrowser, noteTitle);
-                       } else {
-                               index = tabBrowser.insertNewTab(insertIndex, newBrowser, noteTitle);
-                       }
-                       tabBrowser.currentChanged.connect(this, "tabWindowChanged(int)");
-               } else {
-                       if (insertIndex < 0) {
-                               index = tabBrowser.addNewTab(newBrowser, noteTitle);
-                       } else {
-                               index = tabBrowser.insertNewTab(insertIndex, newBrowser, noteTitle);
-                       }
-               }
+               int index = tabBrowser.addNewTab(newBrowser, noteTitle);
                tabWindows.put(index, newBrowser);
                noteDirty.put(index, false);
                
@@ -4898,8 +4835,6 @@ public class NeverNote extends QMainWindow{
                                addBrowseHistory();
                        }
                }
-               
-               rensoNoteList.refreshRensoNoteList(currentNoteGuid);
        }
 
        // ICHANGED タブが閉じられた
@@ -5734,12 +5669,6 @@ public class NeverNote extends QMainWindow{
        // IFIXED こいつのせいで、ノート追加時にcurrentNoteGuidが更新されないので消す
        // noteTableView.clearSelection();
        
-       refreshEvernoteNote(true);
-       listManager.countNotebookResults(listManager.getNoteIndex());
-       browserWindow.titleLabel.setFocus();
-       browserWindow.titleLabel.selectAll();
-//     notebookTree.updateCounts(listManager.getNotebookIndex(), listManager.getNotebookCounter());
-       
        // ICHANGED 新規に作成したノートとそれまで開いていたノートの関連性を追加
        if (prevCurrentNoteGuid != null && !prevCurrentNoteGuid.equals("")) {
                if (currentNoteGuid != null && !currentNoteGuid.equals("")) {
@@ -5747,6 +5676,12 @@ public class NeverNote extends QMainWindow{
                }
        }
        
+       refreshEvernoteNote(true);
+       listManager.countNotebookResults(listManager.getNoteIndex());
+       browserWindow.titleLabel.setFocus();
+       browserWindow.titleLabel.selectAll();
+//     notebookTree.updateCounts(listManager.getNotebookIndex(), listManager.getNotebookCounter());
+       
        // If the window is hidden, then we want to popup this in an external window & 
        if (!isVisible())
                listDoubleClick();
@@ -7695,7 +7630,7 @@ public class NeverNote extends QMainWindow{
                                String tableGuid = (String) ix.values().toArray()[0];
                                if (tableGuid.equals(rensoNotePressedItemGuid)) {
                                        noteTableView.selectRow(i);
-                                       return;
+                                       break;
                                }
                        }
                }