[prev in list] [next in list] [prev in thread] [next in thread] 

List:       koffice
Subject:    Re: Qt help
From:       Stephan Kulow <coolo () kde ! org>
Date:       2000-07-12 9:33:32
[Download RAW message or body]

Troy Unrau wrote:
> 
> Greetings,
> 
> I am pulling, line by line from a file two pieces of corresponding data for
> the autocorrection in kword.
> 
> How do I take a QString that hold some data such as:
> "helo   hello"
> and derive two QStrings, one named find and the other replace containing
> those values?
You should not do that. You'll need spaces for the correction stuff soon
and then your format is dead. You could use a format like this to be
human readable:
"helo" => "hello" 
per line, but this overkill I'd say. Rather go with XML and use
<correctionlist>
  <correction from="helo" to="hello"/>
  ...
</correctionlist>

This is as readable and you shouldn't need QTextStream ;)

> 
> Is there another format I should be using in my files (I want them to be
> human readable) that would make this simpler, or should I be using something
> other than QTextStream to pull the data.
> 
> Thanks.
> 
> Just for anyone who cares,
> 
> I'm setting up the autocorrection database to be drawn from three seperate
> files.
> GlobalCorrections -- Contains (R), -->, etc. (in KDEDIR/share/...)
> I18NCorrections_(insert country symbol here) Contains language specific stuff.
> UserCorrections -- Can be added to be user (resides in .kde/share/....)
> 
There is no Global vs. User with KDE2 (as there is no KDEDIR). You only
do
QStringList allfiles = KGlobal::dirs()->findAllResources("appdata",
"corrections");
to get all correction files including the user given

And about the I18N, you would add 
allfiles += KGlobal::dirs()->findAllResources("appdata",
KGlobal::locale()->language() + "/corrections");

You also can do that in a loop and use insteadof ->language() the list
that
locale()->languageList() returns

Greetings, Stephan

-- 
... but you ain't had mine

[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic