summaryrefslogtreecommitdiff
path: root/noncore/apps/tinykate/libkate/kateconfig.cpp
Unidiff
Diffstat (limited to 'noncore/apps/tinykate/libkate/kateconfig.cpp') (more/less context) (show whitespace changes)
-rw-r--r--noncore/apps/tinykate/libkate/kateconfig.cpp29
1 files changed, 17 insertions, 12 deletions
diff --git a/noncore/apps/tinykate/libkate/kateconfig.cpp b/noncore/apps/tinykate/libkate/kateconfig.cpp
index 96f91fb..782b629 100644
--- a/noncore/apps/tinykate/libkate/kateconfig.cpp
+++ b/noncore/apps/tinykate/libkate/kateconfig.cpp
@@ -15,29 +15,34 @@
15** 15**
16** Contact info@trolltech.com if any conditions of this licensing are 16** Contact info@trolltech.com if any conditions of this licensing are
17** not clear to you. 17** not clear to you.
18** 18**
19**********************************************************************/ 19**********************************************************************/
20 20
21#define QTOPIA_INTERNAL_LANGLIST
22#include "kateconfig.h"
23
24/* OPIE */
25#include <opie2/odebug.h>
26#include <qpe/global.h>
27
28/* QT */
21#include <qdir.h> 29#include <qdir.h>
22#include <qmessagebox.h> 30#include <qmessagebox.h>
23#if QT_VERSION <= 230 && defined(QT_NO_CODECS) 31#if QT_VERSION <= 230 && defined(QT_NO_CODECS)
24#include <qtextcodec.h> 32#include <qtextcodec.h>
25#endif 33#endif
26#include <qtextstream.h> 34#include <qtextstream.h>
27 35
36/* STD */
28#include <sys/stat.h> 37#include <sys/stat.h>
29#include <sys/types.h> 38#include <sys/types.h>
30#include <fcntl.h> 39#include <fcntl.h>
31#include <stdlib.h> 40#include <stdlib.h>
32#include <unistd.h> 41#include <unistd.h>
33 42
34#define QTOPIA_INTERNAL_LANGLIST
35#include "kateconfig.h"
36#include <qpe/global.h>
37
38 43
39/*! 44/*!
40 \internal 45 \internal
41*/ 46*/
42QString KateConfig::configFilename(const QString& name, Domain d) 47QString KateConfig::configFilename(const QString& name, Domain d)
43{ 48{
@@ -90,13 +95,13 @@ QString KateConfig::configFilename(const QString& name, Domain d)
90 95
91 In the File Domain, \a name is an absolute filename. 96 In the File Domain, \a name is an absolute filename.
92*/ 97*/
93KateConfig::KateConfig( const QString &name, Domain domain ) 98KateConfig::KateConfig( const QString &name, Domain domain )
94 : filename( configFilename(name,domain) ) 99 : filename( configFilename(name,domain) )
95{ 100{
96 qWarning("KateConfig constructor\n"); 101 owarn << "KateConfig constructor\n" << oendl;
97 git = groups.end(); 102 git = groups.end();
98 read(); 103 read();
99 QStringList l = Global::languageList(); 104 QStringList l = Global::languageList();
100 lang = l[0]; 105 lang = l[0];
101 glang = l[1]; 106 glang = l[1];
102} 107}
@@ -115,13 +120,13 @@ KateConfig::KateConfig ( const QString &name, bool what )
115 120
116/*! 121/*!
117 Writes any changes to disk and destroys the in-memory object. 122 Writes any changes to disk and destroys the in-memory object.
118*/ 123*/
119KateConfig::~KateConfig() 124KateConfig::~KateConfig()
120{ 125{
121 qWarning("KateConfig destructor\n"); 126 owarn << "KateConfig destructor\n" << oendl;
122 if ( changed ) 127 if ( changed )
123 write(); 128 write();
124} 129}
125 130
126/*! 131/*!
127 Returns whether the current group has an entry called \a key. 132 Returns whether the current group has an entry called \a key.
@@ -169,13 +174,13 @@ void KateConfig::writeEntry( const QString &key, const char* value )
169 174
170 \sa readEntry() 175 \sa readEntry()
171*/ 176*/
172void KateConfig::writeEntry( const QString &key, const QString &value ) 177void KateConfig::writeEntry( const QString &key, const QString &value )
173{ 178{
174 if ( git == groups.end() ) { 179 if ( git == groups.end() ) {
175 qWarning( "no group set" ); 180 owarn << "no group set" << oendl;
176 return; 181 return;
177 } 182 }
178 if ( (*git)[key] != value ) { 183 if ( (*git)[key] != value ) {
179 ( *git ).insert( key, value ); 184 ( *git ).insert( key, value );
180 changed = TRUE; 185 changed = TRUE;
181 } 186 }
@@ -229,13 +234,13 @@ static QString decipher(const QString& cipher)
229 234
230 \sa readEntry() 235 \sa readEntry()
231*/ 236*/
232void KateConfig::writeEntryCrypt( const QString &key, const QString &value ) 237void KateConfig::writeEntryCrypt( const QString &key, const QString &value )
233{ 238{
234 if ( git == groups.end() ) { 239 if ( git == groups.end() ) {
235 qWarning( "no group set" ); 240 owarn << "no group set" << oendl;
236 return; 241 return;
237 } 242 }
238 QString evalue = encipher(value); 243 QString evalue = encipher(value);
239 if ( (*git)[key] != evalue ) { 244 if ( (*git)[key] != evalue ) {
240 ( *git ).insert( key, evalue ); 245 ( *git ).insert( key, evalue );
241 changed = TRUE; 246 changed = TRUE;
@@ -318,13 +323,13 @@ void KateConfig::writeEntry( const QString &key, const QFont &val )
318 there is no such entry. 323 there is no such entry.
319*/ 324*/
320 325
321void KateConfig::removeEntry( const QString &key ) 326void KateConfig::removeEntry( const QString &key )
322{ 327{
323 if ( git == groups.end() ) { 328 if ( git == groups.end() ) {
324 qWarning( "no group set" ); 329 owarn << "no group set" << oendl;
325 return; 330 return;
326 } 331 }
327 ( *git ).remove( key ); 332 ( *git ).remove( key );
328 changed = TRUE; 333 changed = TRUE;
329} 334}
330 335
@@ -394,13 +399,13 @@ QString KateConfig::readEntryCrypt( const QString &key, const QString &deflt )
394 \internal 399 \internal
395 For compatibility, non-const version. 400 For compatibility, non-const version.
396*/ 401*/
397QString KateConfig::readEntryDirect( const QString &key, const QString &deflt ) 402QString KateConfig::readEntryDirect( const QString &key, const QString &deflt )
398{ 403{
399 if ( git == groups.end() ) { 404 if ( git == groups.end() ) {
400 //qWarning( "no group set" ); 405 //owarn << "no group set" << oendl;
401 return deflt; 406 return deflt;
402 } 407 }
403 KateConfigGroup::ConstIterator it = ( *git ).find( key ); 408 KateConfigGroup::ConstIterator it = ( *git ).find( key );
404 if ( it != ( *git ).end() ) 409 if ( it != ( *git ).end() )
405 return *it; 410 return *it;
406 else 411 else
@@ -497,13 +502,13 @@ QValueList<int> KateConfig::readIntListEntry( const QString &key ) const
497/*! 502/*!
498 Removes all entries from the current group. 503 Removes all entries from the current group.
499*/ 504*/
500void KateConfig::clearGroup() 505void KateConfig::clearGroup()
501{ 506{
502 if ( git == groups.end() ) { 507 if ( git == groups.end() ) {
503 qWarning( "no group set" ); 508 owarn << "no group set" << oendl;
504 return; 509 return;
505 } 510 }
506 if ( !(*git).isEmpty() ) { 511 if ( !(*git).isEmpty() ) {
507 ( *git ).clear(); 512 ( *git ).clear();
508 changed = TRUE; 513 changed = TRUE;
509 } 514 }
@@ -518,13 +523,13 @@ void KateConfig::write( const QString &fn )
518 if ( !fn.isEmpty() ) 523 if ( !fn.isEmpty() )
519 filename = fn; 524 filename = fn;
520 strNewFile = filename + ".new"; 525 strNewFile = filename + ".new";
521 526
522 QFile f( strNewFile ); 527 QFile f( strNewFile );
523 if ( !f.open( IO_WriteOnly|IO_Raw ) ) { 528 if ( !f.open( IO_WriteOnly|IO_Raw ) ) {
524 qWarning( "could not open for writing `%s'", strNewFile.latin1() ); 529 owarn << "could not open for writing `" << strNewFile << "'" << oendl;
525 git = groups.end(); 530 git = groups.end();
526 return; 531 return;
527 } 532 }
528 533
529 QString str; 534 QString str;
530 QCString cstr; 535 QCString cstr;