import org.apache.log4j.Level;
import org.apache.log4j.Logger;
-import org.apache.thrift.TException;
import org.h2.tools.ChangeFileEncryption;
import com.evernote.edam.error.EDAMNotFoundException;
import com.evernote.edam.type.SavedSearch;
import com.evernote.edam.type.Tag;
import com.evernote.edam.type.User;
+import com.evernote.thrift.TException;
import com.trolltech.qt.QThread;
import com.trolltech.qt.core.QByteArray;
import com.trolltech.qt.core.QDateTime;
import com.trolltech.qt.gui.QCursor;
import com.trolltech.qt.gui.QDesktopServices;
import com.trolltech.qt.gui.QDialog;
-import com.trolltech.qt.gui.QDockWidget;
import com.trolltech.qt.gui.QFileDialog;
import com.trolltech.qt.gui.QFileDialog.AcceptMode;
import com.trolltech.qt.gui.QFileDialog.FileMode;
import cx.fbn.nevernote.gui.MainMenuBar;
import cx.fbn.nevernote.gui.NotebookTreeWidget;
import cx.fbn.nevernote.gui.RensoNoteList;
+import cx.fbn.nevernote.gui.RensoNoteListDock;
import cx.fbn.nevernote.gui.SavedSearchTreeWidget;
import cx.fbn.nevernote.gui.SearchPanel;
import cx.fbn.nevernote.gui.TabBrowse;
import cx.fbn.nevernote.xml.ImportData;
import cx.fbn.nevernote.xml.ImportEnex;
import cx.fbn.nevernote.xml.NoteFormatter;
+//import org.apache.thrift.TException;
public class NeverNote extends QMainWindow{
int tagDeadCount=0; // number of consecutive dead times for the tag thread
int trashDeadCount=0; // number of consecutive dead times for the trash thread
int saveThreadDeadCount=0; // number of consecutive dead times for the save thread
+ int enRelatedNotesThreadDeadCount=0; // number of consecutive dead times for the EvernoteRelatedNotes Thread
boolean disableTagThreadCheck=false;
boolean disableNotebookThreadCheck=false;
boolean disableTrashThreadCheck=false;
boolean disableSaveThreadCheck=false;
boolean disableSyncThreadCheck=false;
boolean disableIndexThreadCheck=false;
+ boolean disableENRelatedNotesThreadCheck=false;
HashMap<String, String> noteCache; // Cash of note content
HashMap<String, Boolean> readOnlyCache; // List of cashe notes that are read-only
// ICHANGED
private final TabBrowserWidget tabBrowser; // ブラウザウィンドウをタブ化
private final HashMap<Integer, TabBrowse> tabWindows; // タブウィンドウ
- private final RensoNoteList rensoNoteList; // 連想ノートリスト
- private final QDockWidget rensoNoteListDock; // 連想ノートリストドックウィジェット
+ private final RensoNoteListDock rensoNoteListDock; // 連想ノートリストドックウィジェット
ClipBoardObserver cbObserver;
String rensoNotePressedItemGuid;
indexThread = new QThread(indexRunner, "Index Thread");
indexRunner.indexAttachmentsLocally = Global.indexAttachmentsLocally();
indexRunner.indexImageRecognition = Global.indexImageRecognition();
- indexRunner.indexNoteBody = Global.indexNoteBody();
- indexRunner.indexNoteTitle = Global.indexNoteTitle();
- indexRunner.specialIndexCharacters = Global.getSpecialIndexCharacters();
+// indexRunner.indexNoteBody = Global.indexNoteBody();
+// indexRunner.indexNoteTitle = Global.indexNoteTitle();
+// indexRunner.specialIndexCharacters = Global.getSpecialIndexCharacters();
indexThread.start();
synchronizeAnimationTimer = new QTimer();
tabBrowser = new TabBrowserWidget(this);
tabBrowser.setStyleSheet("QTabBar::tab{width:150px;}");
tabBrowser.setMovable(true);
+ tabBrowser.setTabsClosable(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)");
// ICHANGED
// 連想ノートリストをセットアップ
- rensoNoteList = new RensoNoteList(conn, this);
- rensoNoteList.itemPressed.connect(this,
- "rensoNoteItemPressed(QListWidgetItem)");
- rensoNoteListDock = new QDockWidget(tr("Renso Note List"), this);
- rensoNoteListDock.setWidget(rensoNoteList);
+ rensoNoteListDock = new RensoNoteListDock(conn, this, syncRunner, iconPath, tr("Renso Note List"));
addDockWidget(DockWidgetArea.RightDockWidgetArea, rensoNoteListDock);
if (Global.getListView() == Global.View_List_Wide) {
}
if (Global.checkVersionUpgrade()) {
- // ICHANGED TODO とりあえず封印
- // checkForUpdates();
+ checkForUpdates();
}
// ICHANGED
saveNote();
listManager.stop();
saveWindowState();
+
+ // 連想ノートリストのEvernote関連ノート取得スレッドを終了
+ rensoNoteListDock.getRensoNoteList().stopThread();
if (tempFiles != null)
tempFiles.clear();
saveNoteColumnPositions();
saveNoteIndexWidth();
showColumns();
- ConfigDialog settings = new ConfigDialog(this);
+ ConfigDialog settings = new ConfigDialog(this, conn);
String dateFormat = Global.getDateFormat();
String timeFormat = Global.getTimeFormat();
settings.exec();
indexRunner.indexAttachmentsLocally = Global.indexAttachmentsLocally();
- indexRunner.indexNoteBody = Global.indexNoteBody();
- indexRunner.indexNoteTitle = Global.indexNoteTitle();
- indexRunner.specialIndexCharacters = Global.getSpecialIndexCharacters();
+// indexRunner.indexNoteBody = Global.indexNoteBody();
+// indexRunner.indexNoteTitle = Global.indexNoteTitle();
+// indexRunner.specialIndexCharacters = Global.getSpecialIndexCharacters();
indexRunner.indexImageRecognition = Global.indexImageRecognition();
if (Global.showTrayIcon() || Global.minimizeOnClose())
trayIcon.show();
status.setTagCount(listManager.getTagIndex().size());
status.setResourceCount(conn.getNoteTable().noteResourceTable.getResourceCount());
status.setWordCount(conn.getWordsTable().getWordCount());
+ status.setHistoryCount(conn.getHistoryTable().getHistoryCount());
+ status.setRensoClickCount(conn.getHistoryTable().getRensoClickCount());
waitCursor(false);
status.exec();
}
// ICHANGED
// 連想ノートリストを更新
- rensoNoteList.refreshRensoNoteList(currentNoteGuid);
+ rensoNoteListDock.getRensoNoteList().refreshRensoNoteList(currentNoteGuid);
waitCursor(false);
logger.log(logger.HIGH, "Leaving NeverNote.noteTableSelection");
fromHistory.remove(i + 1);
}
+ // タブが残り1つになったら、閉じるボタンを消す
+ if (tabBrowser.count() == 1) {
+ tabBrowser.hideTabCloseButton(0);
+ }
+
// タブの閉じるボタンを押すと、tabWindowClosingより先にtabWindowChangedが呼ばれてしまうので、手動で呼びなおす
tabWindowChanged(tabBrowser.currentIndex());
}
// 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("")) {
}
}
+ 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();
} else
indexThreadDeadCount=0;
-
+ if (!rensoNoteListDock.getRensoNoteList().getEnRelatedNotesThread().isAlive()) {
+ enRelatedNotesThreadDeadCount++;
+ if (enRelatedNotesThreadDeadCount > MAX && !disableENRelatedNotesThreadCheck) {
+ QMessageBox.information(this, tr("A thread has died."), tr("It appears as the Evernote Related Notes thread has died. I recommend "+
+ "checking stopping NeighborNote, saving the logs for later viewing, and restarting. Sorry."));
+ disableENRelatedNotesThreadCheck = true;
+ }
+ } else
+ enRelatedNotesThreadDeadCount=0;
}
private void thumbnailTimer() {
refreshEvernoteNote(true);
// 連想ノートリストを更新
- rensoNoteList.refreshRensoNoteList(currentNoteGuid);
+ rensoNoteListDock.getRensoNoteList().refreshRensoNoteList(currentNoteGuid);
}
// ICHANGD
private void rensoNoteItemPressed(QListWidgetItem current) {
logger.log(logger.HIGH, "Nevernote.rensoNoteSelectionChangeに入った");
- rensoNotePressedItemGuid = rensoNoteList.getNoteGuid(current);
+ rensoNotePressedItemGuid = rensoNoteListDock.getRensoNoteList().getNoteGuid(current);
// 右クリックだったら終了
if (QApplication.mouseButtons().isSet(MouseButton.RightButton)) {
String tableGuid = (String) ix.values().toArray()[0];
if (tableGuid.equals(rensoNotePressedItemGuid)) {
noteTableView.selectRow(i);
- return;
+ break;
}
}
}
// 除外ノートテーブルに追加
conn.getExcludedTable().addExclusion(guid, currentNoteGuid);
- rensoNoteList.refreshRensoNoteList(currentNoteGuid);
+ rensoNoteListDock.getRensoNoteList().refreshRensoNoteList(currentNoteGuid);
}
// ICHANGED
// スター付きノートテーブルに追加
conn.getStaredTable().addStaredItem(currentNoteGuid, guid);
- rensoNoteList.refreshRensoNoteList(currentNoteGuid);
+ rensoNoteListDock.getRensoNoteList().refreshRensoNoteList(currentNoteGuid);
}
// ICHANGED
// スター付きノートテーブルから削除
conn.getStaredTable().removeStaredItem(currentNoteGuid, guid);
- rensoNoteList.refreshRensoNoteList(currentNoteGuid);
+ rensoNoteListDock.getRensoNoteList().refreshRensoNoteList(currentNoteGuid);
}
// ICHANGED
fromHistory.put(from, fromHistory.get(to));
fromHistory.put(to, fromHist);
}
+
+ // 連想ノートリストのgetter
+ public RensoNoteList getRensoNoteList() {
+ return rensoNoteListDock.getRensoNoteList();
+ }
}