chewing / chewing-editor

Cross platform chewing user phrase editor
https://chewing.im/
GNU General Public License v2.0
31 stars 52 forks source link

Fix phrases import not working problem, close #187 #193

Closed PeterDaveHello closed 8 years ago

coveralls commented 8 years ago

Coverage Status

Coverage remained the same at 93.714% when pulling b8e235a652bbc49fbdc2250d0723fbb116a911ec on PeterDaveHello:fix-phrases-import into 50c105e5ef002eb85fa5e2b0ff144f612ab4ca4b on chewing:master.

hunghw commented 8 years ago

It works.

PeterDaveHello commented 8 years ago

I'm also wondering if we need to increase import_count even we bypass importUserphrase(), so updated to this:

diff --git a/src/view/ChewingEditor.cpp b/src/view/ChewingEditor.cpp
index b1c1961..ad8aa8f 100644
--- a/src/view/ChewingEditor.cpp
+++ b/src/view/ChewingEditor.cpp
@@ -125,8 +125,10 @@ void ChewingEditor::finishFileSelection(const QString& file)
     switch (dialogType_) {
     case DIALOG_IMPORT:
         // Do nothing after the first trigger
-        if(import_count++ == 1)
+        if (import_count == 0) {
             importUserphrase(file);
+            import_count++;
+        }

         qDebug() << "import_count = " << import_count;
coveralls commented 8 years ago

Coverage Status

Coverage remained the same at 93.714% when pulling eb565ddbbebae4e74bb76fb998a7877f6b14ae83 on PeterDaveHello:fix-phrases-import into 50c105e5ef002eb85fa5e2b0ff144f612ab4ca4b on chewing:master.

robert501128 commented 8 years ago

It works in my environment (Ubuntu 14.04, fcitx-chewing). And if(import_count==0) makes more sense.

czchen commented 8 years ago

Thanks for your contributions.

PeterDaveHello commented 8 years ago

For the previous double trigger problem, maybe we should find out the reason why it been triggered twice, not just bypass it.

david50407 commented 8 years ago

@PeterDaveHello It might be Qt's problem, reference here: https://bugreports.qt.io/browse/QTBUG-38985

PeterDaveHello commented 8 years ago

I'll take a look at it, thanks.