-rw-r--r-- | microkde/kapplication.cpp | 22 | ||||
-rw-r--r-- | microkde/kapplication.h | 1 |
2 files changed, 23 insertions, 0 deletions
diff --git a/microkde/kapplication.cpp b/microkde/kapplication.cpp index 98ef2f2..56c01af 100644 --- a/microkde/kapplication.cpp +++ b/microkde/kapplication.cpp @@ -66,2 +66,24 @@ void KApplication::showFile(QString caption, QString fn) +bool KApplication::convert2latin1(QString fileName) +{ + QString text; + QFile file( fileName ); + if (!file.open( IO_ReadOnly ) ) { + return false; + + } + QTextStream ts( &file ); + ts.setEncoding( QTextStream::UnicodeUTF8 ); + text = ts.read(); + file.close(); + if (!file.open( IO_WriteOnly ) ) { + return false; + } + QTextStream tsIn( &file ); + tsIn.setEncoding( QTextStream::Latin1 ); + tsIn << text.latin1(); + file.close(); + + +} void KApplication::showText(QString caption, QString text) diff --git a/microkde/kapplication.h b/microkde/kapplication.h index 79cdb33..41546a0 100644 --- a/microkde/kapplication.h +++ b/microkde/kapplication.h @@ -22,2 +22,3 @@ class KApplication static void showText(QString caption, QString text); + static bool convert2latin1(QString file); }; |