OSDN Git Service

Fix tag completion problems created by prior feature to alter the behavior selection.
authorRandy Baumgarte <randy@fbn.cx>
Wed, 18 Aug 2010 13:48:26 +0000 (09:48 -0400)
committerRandy Baumgarte <randy@fbn.cx>
Sun, 22 Aug 2010 22:48:09 +0000 (18:48 -0400)
src/cx/fbn/nevernote/gui/BrowserWindow.java
src/cx/fbn/nevernote/gui/TagLineCompleter.java

index 0d640cd..91eb7d8 100644 (file)
@@ -48,7 +48,6 @@ import com.trolltech.qt.core.QFile;
 import com.trolltech.qt.core.QFileSystemWatcher;\r
 import com.trolltech.qt.core.QIODevice;\r
 import com.trolltech.qt.core.QMimeData;\r
-import com.trolltech.qt.core.QModelIndex;\r
 import com.trolltech.qt.core.QUrl;\r
 import com.trolltech.qt.gui.QApplication;\r
 import com.trolltech.qt.gui.QCalendarWidget;\r
@@ -511,6 +510,7 @@ public class BrowserWindow extends QWidget {
                setNote(null);\r
                browser.setContent(new QByteArray());\r
                tagEdit.setText("");\r
+               tagEdit.tagCompleter.reset();\r
                urlLabel.setText(tr("Source URL:"));\r
                titleLabel.setText("");\r
                logger.log(logger.EXTREME, "Exiting BrowserWindow.clear()");\r
@@ -560,6 +560,7 @@ public class BrowserWindow extends QWidget {
        public void setTag(String t) {\r
                saveTagList = t;\r
                tagEdit.setText(t);\r
+               tagEdit.tagCompleter.reset();\r
        }\r
 \r
        // Set the source URL\r
@@ -1294,8 +1295,7 @@ public class BrowserWindow extends QWidget {
        // Tag line has been modified by typing text\r
        @SuppressWarnings("unused")\r
        private void modifyTagsTyping() {\r
-               QModelIndex model = tagEdit.tagCompleter.currentIndex();\r
-               if (model != null) {\r
+               if (tagEdit.currentCompleterSelection != null && !tagEdit.currentCompleterSelection.equals("")) {\r
                        tagEdit.completeText(tagEdit.currentCompleterSelection);\r
                }\r
                \r
index 28271e3..cbab749 100644 (file)
@@ -31,6 +31,7 @@ public class TagLineCompleter extends QCompleter {
        private List<String>            currentTags;\r
        private QStringListModel        model;  \r
        private final TagLineEdit                       editor;\r
+       private String                          currentText;\r
        \r
        public TagLineCompleter(TagLineEdit e) {\r
                editor = e;\r
@@ -97,6 +98,14 @@ public class TagLineCompleter extends QCompleter {
        public void resetList() {\r
                currentTags.clear();\r
        }\r
+       \r
 \r
+       public String currentText() {\r
+               return currentText;\r
+       }\r
+       \r
+       public void reset() {\r
+               currentText = "";\r
+       }\r
 \r
 }\r