Bug 320074 - KMail uses a wrong autocorrection filename
Summary: KMail uses a wrong autocorrection filename
Status: RESOLVED FIXED
Alias: None
Product: kmail2
Classification: Applications
Component: general (show other bugs)
Version: 4.10.2
Platform: Ubuntu Linux
: NOR normal
Target Milestone: ---
Assignee: kdepim bugs
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2013-05-21 04:02 UTC by André Marcelo Alvarenga
Modified: 2013-06-07 21:44 UTC (History)
1 user (show)

See Also:
Latest Commit:
Version Fixed In: 4.11


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description André Marcelo Alvarenga 2013-05-21 04:02:10 UTC
I'm using pt_BR language in my system.

I was testing the autocorrection feature in KMail, but when I add any Find/Replace words using 'Configure KMail->Compositor->Autocorrection->Advanced Autocorrection', the program save a custom-pt.xml file in  /home/user/.kde/share/apps/autocorrect/ folder. This is not correct, since I'm using pt_BR language (should be custom-pt_BR.xml)

In Advanced Autocorrection tab there is the option: "Replacement and exception for language:" set as "Brazilian Portuguese".

Works if I change the language and return to "Brazilian Portuguese" again.


More tests:

I put two different files in /usr/share/kde4/apps/autocorrect (pt.xml and pt_BR.xml).
KMail is using pt.xml instead of pt_BR.xml, but works if I change the language and return to "Brazilian Portuguese" again.

Reproducible: Always

Steps to Reproduce:
1. Set language to pt_BR
2. Run KMail and open "Configurações->Configurar o KMail..." 
3. Choose "Compositor" and "Correção automática" tab
3. Choose "Correção automática avançada" tab
4. Enable "Habilitar substituição de palavras" option
5. Type any words in "Localizar" and "Substituir" fields
6. Click on "Adicionar" button
7. Click on "Aplicar" or "OK" buttons
8. See the created file in /home/user/.kde/share/apps/autocorrect/ folder. (custom-pt.xml, instead of custom-pt_BR.xml)
Comment 1 Laurent Montel 2013-05-23 17:56:23 UTC
wierd. Will look at it soon
Comment 2 Laurent Montel 2013-05-26 19:54:35 UTC
In identity which language do you use as autocorrection ?
Comment 3 André Marcelo Alvarenga 2013-05-27 01:46:48 UTC
(In reply to comment #2)
> In identity which language do you use as autocorrection ?

when I wrote the bug report, autocorrect language was empty (not defined), since I was running KDE in a virtual machine.

Changing to Brazilian Portuguese (Português do Brasil), I deleted /home/user/.kde/share/apps/autocorrect/custom-pt_BR.xml file and tested again, but the problem remains.

KMail is still using:

/usr/share/kde4/apps/autocorrect/pt.xml

instead of:

/usr/share/kde4/apps/autocorrect/pt_BR.xml

I'm not a developer and maybe I'm wrong, but see this part of the code:

/calligra/plugins/textediting/autocorrection/Autocorrect.cpp

Line: 743

    Q_FOREACH(const QString& path, folders)
    {
        if (!m_autocorrectLang.isEmpty())
            fname = KGlobal::dirs()->findResource("data", path + "autocorrect/" + m_autocorrectLang + ".xml");
        if (m_autocorrectLang != "all_languages") {
            if (fname.isEmpty() && !kdelang.isEmpty())
                fname = KGlobal::dirs()->findResource("data", path + "autocorrect/" + kdelang + ".xml");
            if (fname.isEmpty() && kdelang.contains("_")) {
                kdelang.remove( QRegExp( "_.*" ) );
                fname = KGlobal::dirs()->findResource("data", path + "autocorrect/" + kdelang + ".xml");
            }
        }

        if(!fname.isEmpty()) {
            readAutocorrectXmlEntry(fname, false);
            break;
        }
    }

This is correct?
Comment 4 Laurent Montel 2013-05-27 05:29:15 UTC
calligra ?:) kmail ?:)
it's not the same code.
I can't reproduce for the moment your problem. Here it works fine when I use pt_BR
Will continue to investigate it
Comment 5 André Marcelo Alvarenga 2013-05-27 11:17:53 UTC
(In reply to comment #4)
> calligra ?:) kmail ?:)
> it's not the same code.
> I can't reproduce for the moment your problem. Here it works fine when I use
> pt_BR
> Will continue to investigate it

I thought KMail wore the same code Calligra autocorrection plugin, sorry.

However, there is a similar code in kdepim/messagecomposer/autocorrection/composerautocorrection.cpp.

I will try a screencast with the problem.
Comment 6 André Marcelo Alvarenga 2013-06-06 03:33:17 UTC
I recorded a screencast with the problem:

http://youtu.be/XZyoQ_goDjU
Comment 7 Laurent Montel 2013-06-06 05:43:27 UTC
Thanks  for screencast.
Yes there is a bug in your system.
When it select pt.xml in your .emailidentities which is "Autocorrection Language" entry ?
Comment 8 Laurent Montel 2013-06-06 06:02:00 UTC
Git commit 86b9f742a7c12dd0ad7c30de98e47de52ebc1f21 by Montel Laurent.
Committed on 06/06/2013 at 08:01.
Pushed by mlaurent into branch 'master'.

Fix Bug 320074 - KMail uses a wrong autocorrection filename

FIXED-IN: 4.11

M  +8    -1    messagecomposer/autocorrection/composerautocorrectionwidget.cpp
M  +1    -0    messagecomposer/autocorrection/composerautocorrectionwidget.h

http://commits.kde.org/kdepim/86b9f742a7c12dd0ad7c30de98e47de52ebc1f21
Comment 9 André Marcelo Alvarenga 2013-06-07 21:44:46 UTC
It's working now.

Thanks for fixing.