Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Enhancement] Support for OO.org .oxt dictionary files #251

Open
GoogleCodeExporter opened this issue Mar 14, 2015 · 3 comments
Open

[Enhancement] Support for OO.org .oxt dictionary files #251

GoogleCodeExporter opened this issue Mar 14, 2015 · 3 comments

Comments

@GoogleCodeExporter
Copy link

It's a "simple" zip file containing the .dic and .aff files we need (aside
from many other files).

Original issue reported on code.google.com by st.loeffler on 8 Dec 2009 at 8:44

@GoogleCodeExporter
Copy link
Author

The attached patch should implement this feature.

When the dictionary list is created, all .oxt files are searched for .dic and 
.aff
files. If some are found the languages are added to the list of supported 
languages.
When a language supported through an .oxt file is selected, the necessary .dic 
and
.aff files are extracted to a temporary folder and the hunspell object is 
initialized
with those files.

Notes:
* The patch adds two new files (ZipArchive.h & ZipArchive.cpp); those must be 
svn add'ed
* ZipArchive depends explicitly on zlib because the built-in decompression 
mechanisms
of Qt aren't enough. Since Qt links to zlib itself, this should not be a 
problem,
though. In the worst case some definitions (include paths/libs) have to be 
added to
TeXworks.pro
* Currently, the zip file is only searched for corresponding .dic and .aff 
files. The
manifest is not read or parsed, and it is implicitly assumed that the files are
compatible with hunspell. Such checks could be added in the future.
* The dictionaries found in .oxt files are simply appended to the list of 
languages.
No sorting and no merging with existing entries is performed. If dictionaries 
for the
same language are found both as stand-alone versions and inside a .oxt file, the
stand-alone versions take precedence.
* Currently, no safety measures are implemented when the files are extracted to 
a
temporary folder. This means they will overwrite whatever may be there with the 
same
name.

Original comment by st.loeffler on 8 Dec 2009 at 2:10

Attachments:

@GoogleCodeExporter
Copy link
Author

The attached patch should handle endianness correctly. It also adds compression
capabilities (i.e., the ZipArchive class can create .zip files). This may come 
in
handy for project support (e.g. to bundle several files into one compressed 
one).

To test the compression feature, e.g. add the following lines to TWApp::init():
    ZipArchive za("test.zip");
    za.open(QIODevice::WriteOnly);
    za.putFile("test/abc/def/test.txt", QByteArray("123"));
    za.close();
and #include ZipArchive.h. If you run Tw, it should create a file test.zip 
containing
severa folders which ultimately contain a file "test.txt" with the content 
"123".
Again, endianness should be respected (though tests on Mac are very welcome).

Original comment by st.loeffler on 12 Apr 2010 at 7:35

Attachments:

@GoogleCodeExporter
Copy link
Author

I forgot to add a warning notice for programmers to ZipArchive.h. Please add the
following comment (or something similar) to ZipArchive::putFile():
    // Make sure that filename is properly encoded. Don't use already encoded
    // UTF-8 strings, as they would be encoded a second time, resulting in chaos.
    // If you use verbatim (C) data, write QString::fromUtf8("some string")
    // instead of simply QString("some string"), assuming your source file is
    // UTF-8 encoded.

Original comment by st.loeffler on 13 Apr 2010 at 5:20

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants