chewing/chewing-editor

[Bug] Import feature doesn't work.

Closed this issue Β· 16 comments

Tested on a clean Ubuntu 16.04 LTS amd64 and Linuxmint Cinnamon 17.3 amd64 which is based on Ubuntu 14.04 LTS.

The export feature works well, but the import feature doesn't work here, it will open a window to let me choose the file to be imported, but after that, nothing happened, that's old, I'm not sure if it's a bug or it's my problem, I try to use a clean Ubuntu to reproduce this problem and it just happened.

You can use chewing-editor -d to enable debug mode to see if there is any error message.

@czchen Thanks, I will.

Here are some logs, I'm still tracing.

First time to click "File / Import" :

Debug: import_count =  0  (void ChewingEditor::selectImportFile() ChewingEditor.cpp:112)
Debug: dialogType_ =  11  (void ChewingEditor::execFileDialog(ChewingEditor::DialogType) ChewingEditor.cpp:80)

Second time (and after the second time) to click "File / Import" :

Debug: import_count =  0  (void ChewingEditor::selectImportFile() ChewingEditor.cpp:112)
Debug: dialogType_ =  0  (void ChewingEditor::execFileDialog(ChewingEditor::DialogType) ChewingEditor.cpp:80)

Double click to open a file:

Debug: dialogType_ =  0  (void ChewingEditor::finishFileSelection(const QString&) ChewingEditor.cpp:123)
Debug: import_count =  1  (void ChewingEditor::finishFileSelection(const QString&) ChewingEditor.cpp:131)

Click a file and then click open button:

Debug: dialogType_ =  0  (void ChewingEditor::finishFileSelection(const QString&) ChewingEditor.cpp:123)
Debug: import_count =  1  (void ChewingEditor::finishFileSelection(const QString&) ChewingEditor.cpp:131)

import_count = 1, but still didn't get any result in the screen.

Just note that even there are 4 phrases in total, the debug message of export still shows 1:

Debug: import_count =  0  (void ChewingEditor::selectImportFile() ChewingEditor.cpp:112)
Debug: dialogType_ =  0  (void ChewingEditor::execFileDialog(ChewingEditor::DialogType) ChewingEditor.cpp:80)
Debug: dialogType_ =  0  (void ChewingEditor::finishFileSelection(const QString&) ChewingEditor.cpp:123)
Debug: import_count =  1  (void ChewingEditor::finishFileSelection(const QString&) ChewingEditor.cpp:131)

The bug came from #187, revert cc5cd96 for #49 actually fix this problem.

@robert501128 @hwhung0111 would you please confirm that?

Which version do you use? From apt or build by yourself (from which commit)? Could you provide more information about the environment? And the import json file, please πŸ˜„

@david50407 build from 50c105e, on Ubuntu 14.04.4 LTS with qt 5.2.1, the json file:

{
    "userphrase": [
        {
            "bopomofo": "γ„Žγ„ Λ‡",
            "phrase": "考"
        },
        {
            "bopomofo": "ㄧ γ„•Λ‹ γ„“ γ„’γ„©γ„₯ˊ",
            "phrase": "δΈ€δΈ–δΉ‹ι›„"
        }
    ]
}

That seems you only trigger the dialog once.

BTW, #126 is trying to solve the problem in #49 that importing will trigger twice event,
And #126 says that Second trigger should be ignored but it skipped the first trigger in cc5cd96#diff-fe73a7ae7fac4644eebd943eeb1959c4R127
I'm going to fix this (by skipping the second trigger correctly), any other thoughts?

I actually have a patch for this problem, will send it now, just want to confirm the issue first.

Yes, I have the same problem on Ubuntu 14.04 /w Qt 5.4.2

I just sent the patch to #193, would you guys please help review it?

I had tried #193, and I think it fix the bug.

That seems you only trigger the dialog once.

BTW, #126 is trying to solve the problem in #49 that importing will trigger twice event,
And #126 says that Second trigger should be ignored but it skipped the first trigger in cc5cd96#diff-fe73a7ae7fac4644eebd943eeb1959c4R127
I'm going to fix this (by skipping the second trigger correctly), any other thoughts?

It was my bad in #126 for messing up import_count++ with ++import_count, thanks @david50407 for pointing out that.