-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 | |||
@@ -59,16 +59,38 @@ void KApplication::showFile(QString caption, QString fn) | |||
59 | } | 59 | } |
60 | QTextStream ts( &file ); | 60 | QTextStream ts( &file ); |
61 | text = ts.read(); | 61 | text = ts.read(); |
62 | file.close(); | 62 | file.close(); |
63 | KApplication::showText( caption, text ); | 63 | KApplication::showText( caption, text ); |
64 | 64 | ||
65 | } | 65 | } |
66 | 66 | ||
67 | bool KApplication::convert2latin1(QString fileName) | ||
68 | { | ||
69 | QString text; | ||
70 | QFile file( fileName ); | ||
71 | if (!file.open( IO_ReadOnly ) ) { | ||
72 | return false; | ||
73 | |||
74 | } | ||
75 | QTextStream ts( &file ); | ||
76 | ts.setEncoding( QTextStream::UnicodeUTF8 ); | ||
77 | text = ts.read(); | ||
78 | file.close(); | ||
79 | if (!file.open( IO_WriteOnly ) ) { | ||
80 | return false; | ||
81 | } | ||
82 | QTextStream tsIn( &file ); | ||
83 | tsIn.setEncoding( QTextStream::Latin1 ); | ||
84 | tsIn << text.latin1(); | ||
85 | file.close(); | ||
86 | |||
87 | |||
88 | } | ||
67 | void KApplication::showText(QString caption, QString text) | 89 | void KApplication::showText(QString caption, QString text) |
68 | { | 90 | { |
69 | QDialog dia( 0, "name", true ); ; | 91 | QDialog dia( 0, "name", true ); ; |
70 | dia.setCaption( caption ); | 92 | dia.setCaption( caption ); |
71 | QVBoxLayout* lay = new QVBoxLayout( &dia ); | 93 | QVBoxLayout* lay = new QVBoxLayout( &dia ); |
72 | lay->setSpacing( 3 ); | 94 | lay->setSpacing( 3 ); |
73 | lay->setMargin( 3 ); | 95 | lay->setMargin( 3 ); |
74 | QTextBrowser tb ( &dia ); | 96 | QTextBrowser tb ( &dia ); |
diff --git a/microkde/kapplication.h b/microkde/kapplication.h index 79cdb33..41546a0 100644 --- a/microkde/kapplication.h +++ b/microkde/kapplication.h | |||
@@ -15,12 +15,13 @@ class KApplication | |||
15 | * @param length Generate a string of this length. | 15 | * @param length Generate a string of this length. |
16 | * @return the random string | 16 | * @return the random string |
17 | */ | 17 | */ |
18 | static QString randomString(int length); | 18 | static QString randomString(int length); |
19 | static int execDialog( QDialog* ); | 19 | static int execDialog( QDialog* ); |
20 | static void showLicence(); | 20 | static void showLicence(); |
21 | static void showFile(QString caption, QString file); | 21 | static void showFile(QString caption, QString file); |
22 | static void showText(QString caption, QString text); | 22 | static void showText(QString caption, QString text); |
23 | static bool convert2latin1(QString file); | ||
23 | }; | 24 | }; |
24 | 25 | ||
25 | 26 | ||
26 | #endif | 27 | #endif |