-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 @@ -64,6 +64,28 @@ 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) { QDialog dia( 0, "name", true ); ; diff --git a/microkde/kapplication.h b/microkde/kapplication.h index 79cdb33..41546a0 100644 --- a/microkde/kapplication.h +++ b/microkde/kapplication.h @@ -20,6 +20,7 @@ class KApplication static void showLicence(); static void showFile(QString caption, QString file); static void showText(QString caption, QString text); + static bool convert2latin1(QString file); }; |