-rw-r--r-- | microkde/kapplication.cpp | 4 |
1 files changed, 3 insertions, 1 deletions
diff --git a/microkde/kapplication.cpp b/microkde/kapplication.cpp index d6f556d..21aa0a4 100644 --- a/microkde/kapplication.cpp +++ b/microkde/kapplication.cpp | |||
@@ -1,28 +1,29 @@ | |||
1 | #include <stdlib.h> | 1 | #include <stdlib.h> |
2 | #include <stdio.h> | 2 | #include <stdio.h> |
3 | 3 | ||
4 | #include "kapplication.h" | 4 | #include "kapplication.h" |
5 | #include "ktextedit.h" | ||
5 | #include <qapplication.h> | 6 | #include <qapplication.h> |
6 | #include <qstring.h> | 7 | #include <qstring.h> |
7 | #include <qfile.h> | 8 | #include <qfile.h> |
8 | #include <qtextstream.h> | 9 | #include <qtextstream.h> |
9 | #include <qdialog.h> | 10 | #include <qdialog.h> |
10 | #include <qlayout.h> | 11 | #include <qlayout.h> |
11 | #include <qtextbrowser.h> | 12 | #include <qtextbrowser.h> |
12 | 13 | ||
13 | int KApplication::random() | 14 | int KApplication::random() |
14 | { | 15 | { |
15 | return rand(); | 16 | return rand(); |
16 | } | 17 | } |
17 | 18 | ||
18 | //US | 19 | //US |
19 | QString KApplication::randomString(int length) | 20 | QString KApplication::randomString(int length) |
20 | { | 21 | { |
21 | if (length <=0 ) return QString::null; | 22 | if (length <=0 ) return QString::null; |
22 | 23 | ||
23 | QString str; | 24 | QString str; |
24 | while (length--) | 25 | while (length--) |
25 | { | 26 | { |
26 | int r=random() % 62; | 27 | int r=random() % 62; |
27 | r+=48; | 28 | r+=48; |
28 | if (r>57) r+=7; | 29 | if (r>57) r+=7; |
@@ -74,35 +75,36 @@ bool KApplication::convert2latin1(QString fileName) | |||
74 | return false; | 75 | return false; |
75 | 76 | ||
76 | } | 77 | } |
77 | QTextStream ts( &file ); | 78 | QTextStream ts( &file ); |
78 | ts.setEncoding( QTextStream::UnicodeUTF8 ); | 79 | ts.setEncoding( QTextStream::UnicodeUTF8 ); |
79 | text = ts.read(); | 80 | text = ts.read(); |
80 | file.close(); | 81 | file.close(); |
81 | if (!file.open( IO_WriteOnly ) ) { | 82 | if (!file.open( IO_WriteOnly ) ) { |
82 | return false; | 83 | return false; |
83 | } | 84 | } |
84 | QTextStream tsIn( &file ); | 85 | QTextStream tsIn( &file ); |
85 | tsIn.setEncoding( QTextStream::Latin1 ); | 86 | tsIn.setEncoding( QTextStream::Latin1 ); |
86 | tsIn << text.latin1(); | 87 | tsIn << text.latin1(); |
87 | file.close(); | 88 | file.close(); |
88 | 89 | ||
89 | 90 | ||
90 | } | 91 | } |
91 | void KApplication::showText(QString caption, QString text) | 92 | void KApplication::showText(QString caption, QString text) |
92 | { | 93 | { |
93 | QDialog dia( 0, "name", true ); ; | 94 | QDialog dia( 0, "name", true ); ; |
94 | dia.setCaption( caption ); | 95 | dia.setCaption( caption ); |
95 | QVBoxLayout* lay = new QVBoxLayout( &dia ); | 96 | QVBoxLayout* lay = new QVBoxLayout( &dia ); |
96 | lay->setSpacing( 3 ); | 97 | lay->setSpacing( 3 ); |
97 | lay->setMargin( 3 ); | 98 | lay->setMargin( 3 ); |
98 | QTextBrowser tb ( &dia ); | 99 | KTextEdit tb ( &dia ); |
100 | tb.setWordWrap( QMultiLineEdit::WidgetWidth ); | ||
99 | lay->addWidget( &tb ); | 101 | lay->addWidget( &tb ); |
100 | tb.setText( text ); | 102 | tb.setText( text ); |
101 | #ifdef DESKTOP_VERSION | 103 | #ifdef DESKTOP_VERSION |
102 | dia.resize( 640, 480); | 104 | dia.resize( 640, 480); |
103 | #else | 105 | #else |
104 | dia.showMaximized(); | 106 | dia.showMaximized(); |
105 | #endif | 107 | #endif |
106 | dia.exec(); | 108 | dia.exec(); |
107 | 109 | ||
108 | } | 110 | } |