New translation: Italian. Minor Improvements in mmap Import
8 /////////////////////////////////////////////////////////////////
10 /////////////////////////////////////////////////////////////////
11 SimpleSettings::SimpleSettings()
16 SimpleSettings::~SimpleSettings()
20 void SimpleSettings::clear()
26 void SimpleSettings::readSettings (const QString &path)
29 if (!loadStringFromDisk(path,s))
31 qWarning ("SimpleSettings::readSettings() Couldn't read "+path);
35 lines=QStringList::split (QRegExp("\n"),s,false);
37 QStringList::Iterator it=lines.begin();
38 while (it !=lines.end() )
41 keylist.append((*it).left(i));
42 valuelist.append((*it).right((*it).length()-i-1));
47 void SimpleSettings::writeSettings (const QString &path)
50 QStringList::Iterator itk=keylist.begin();
51 QStringList::Iterator itv=valuelist.begin();
53 // First search for value in settings saved in map
54 while (itk !=keylist.end() )
56 s+=*itk+"="+*itv+"\n";
60 if (!saveStringToDisk(path,s))
61 qWarning ("SimpleSettings::writeSettings() Couldn't write "+path);
64 QString SimpleSettings::readEntry (const QString &key)
66 QStringList::Iterator itk=keylist.begin();
67 QStringList::Iterator itv=valuelist.begin();
69 // First search for value in settings saved in map
70 while (itk !=keylist.end() )
77 qWarning ("SimpleSettings::readEntry() Couldn't find key "+key);
81 void SimpleSettings::setEntry (const QString &key, const QString &value)
83 QStringList::Iterator itk=keylist.begin();
84 QStringList::Iterator itv=valuelist.begin();
88 // Search for existing entry first
89 while (itk !=keylist.end() )
104 // If no entry exists, append a new one
105 keylist.append (key);
106 valuelist.append (value);
112 /////////////////////////////////////////////////////////////////
114 /////////////////////////////////////////////////////////////////
120 Settings::~Settings()
124 void Settings::clear()
131 void Settings::clearLocal(const QString &s)
133 QStringList::Iterator itp=pathlist.begin();
134 QStringList::Iterator itk=keylist.begin();
135 QStringList::Iterator itv=valuelist.begin();
137 while (itp !=pathlist.end() )
139 if ((*itk).startsWith (s))
141 itp=pathlist.remove (itp);
142 itk=keylist.remove (itk);
143 itv=valuelist.remove (itv);
153 QString Settings::readLocalEntry ( const QString &fpath, const QString & key, const QString & def = QString::null )
155 QStringList::Iterator itp=pathlist.begin();
156 QStringList::Iterator itk=keylist.begin();
157 QStringList::Iterator itv=valuelist.begin();
159 // First search for value in settings saved in map
160 while (itp !=pathlist.end() )
162 if (*itp == fpath && *itk == key)
169 // Fall back to global vym settings
171 return readEntry (key,def, &ok);
174 void Settings::setLocalEntry (const QString &fpath, const QString &key, const QString &value)
176 QStringList::Iterator itp=pathlist.begin();
177 QStringList::Iterator itk=keylist.begin();
178 QStringList::Iterator itv=valuelist.begin();
180 if (!fpath.isEmpty() && !key.isEmpty() && !value.isEmpty() )
182 // Search for existing entry first
183 while (itp !=pathlist.end() )
185 if (*itp == fpath && *itk == key)
195 // If no entry exists, append a new one
196 pathlist.append (fpath);
197 keylist.append (key);
198 valuelist.append (value);
202 QString Settings::getXMLData (const QString &fpath)
205 QStringList::Iterator itp=pathlist.begin();
206 QStringList::Iterator itk=keylist.begin();
207 QStringList::Iterator itv=valuelist.begin();
209 while (itp !=pathlist.end() )
212 if (!(*itv).isEmpty())
215 attribut ("key",*itk)
216 +attribut ("value",*itv)