-rw-r--r-- | microkde/kapplication.cpp | 3 |
1 files changed, 2 insertions, 1 deletions
diff --git a/microkde/kapplication.cpp b/microkde/kapplication.cpp index 21aa0a4..f05b91b 100644 --- a/microkde/kapplication.cpp +++ b/microkde/kapplication.cpp | |||
@@ -40,71 +40,72 @@ int KApplication::execDialog( QDialog* d ) | |||
40 | else | 40 | else |
41 | ;//d->resize( 800, 600 ); | 41 | ;//d->resize( 800, 600 ); |
42 | return d->exec(); | 42 | return d->exec(); |
43 | } | 43 | } |
44 | void KApplication::showLicence() | 44 | void KApplication::showLicence() |
45 | { | 45 | { |
46 | KApplication::showFile( "KDE-Pim/Pi licence", "kdepim/licence.txt" ); | 46 | KApplication::showFile( "KDE-Pim/Pi licence", "kdepim/licence.txt" ); |
47 | } | 47 | } |
48 | 48 | ||
49 | void KApplication::showFile(QString caption, QString fn) | 49 | void KApplication::showFile(QString caption, QString fn) |
50 | { | 50 | { |
51 | QString text; | 51 | QString text; |
52 | QString fileName; | 52 | QString fileName; |
53 | #ifndef DESKTOP_VERSION | 53 | #ifndef DESKTOP_VERSION |
54 | fileName = getenv("QPEDIR"); | 54 | fileName = getenv("QPEDIR"); |
55 | fileName += "/pics/" + fn ; | 55 | fileName += "/pics/" + fn ; |
56 | #else | 56 | #else |
57 | fileName = qApp->applicationDirPath () + "/" + fn; | 57 | fileName = qApp->applicationDirPath () + "/" + fn; |
58 | #endif | 58 | #endif |
59 | QFile file( fileName ); | 59 | QFile file( fileName ); |
60 | if (!file.open( IO_ReadOnly ) ) { | 60 | if (!file.open( IO_ReadOnly ) ) { |
61 | return ; | 61 | return ; |
62 | } | 62 | } |
63 | QTextStream ts( &file ); | 63 | QTextStream ts( &file ); |
64 | text = ts.read(); | 64 | text = ts.read(); |
65 | file.close(); | 65 | file.close(); |
66 | KApplication::showText( caption, text ); | 66 | KApplication::showText( caption, text ); |
67 | 67 | ||
68 | } | 68 | } |
69 | 69 | ||
70 | bool KApplication::convert2latin1(QString fileName) | 70 | bool KApplication::convert2latin1(QString fileName) |
71 | { | 71 | { |
72 | QString text; | 72 | QString text; |
73 | QFile file( fileName ); | 73 | QFile file( fileName ); |
74 | if (!file.open( IO_ReadOnly ) ) { | 74 | if (!file.open( IO_ReadOnly ) ) { |
75 | return false; | 75 | return false; |
76 | 76 | ||
77 | } | 77 | } |
78 | QTextStream ts( &file ); | 78 | QTextStream ts( &file ); |
79 | ts.setEncoding( QTextStream::UnicodeUTF8 ); | 79 | ts.setEncoding( QTextStream::UnicodeUTF8 ); |
80 | text = ts.read(); | 80 | text = ts.read(); |
81 | file.close(); | 81 | file.close(); |
82 | if (!file.open( IO_WriteOnly ) ) { | 82 | if (!file.open( IO_WriteOnly ) ) { |
83 | return false; | 83 | return false; |
84 | } | 84 | } |
85 | QTextStream tsIn( &file ); | 85 | QTextStream tsIn( &file ); |
86 | tsIn.setEncoding( QTextStream::Latin1 ); | 86 | tsIn.setEncoding( QTextStream::Latin1 ); |
87 | tsIn << text.latin1(); | 87 | tsIn << text.latin1(); |
88 | file.close(); | 88 | file.close(); |
89 | return true; | ||
89 | 90 | ||
90 | 91 | ||
91 | } | 92 | } |
92 | void KApplication::showText(QString caption, QString text) | 93 | void KApplication::showText(QString caption, QString text) |
93 | { | 94 | { |
94 | QDialog dia( 0, "name", true ); ; | 95 | QDialog dia( 0, "name", true ); ; |
95 | dia.setCaption( caption ); | 96 | dia.setCaption( caption ); |
96 | QVBoxLayout* lay = new QVBoxLayout( &dia ); | 97 | QVBoxLayout* lay = new QVBoxLayout( &dia ); |
97 | lay->setSpacing( 3 ); | 98 | lay->setSpacing( 3 ); |
98 | lay->setMargin( 3 ); | 99 | lay->setMargin( 3 ); |
99 | KTextEdit tb ( &dia ); | 100 | KTextEdit tb ( &dia ); |
100 | tb.setWordWrap( QMultiLineEdit::WidgetWidth ); | 101 | tb.setWordWrap( QMultiLineEdit::WidgetWidth ); |
101 | lay->addWidget( &tb ); | 102 | lay->addWidget( &tb ); |
102 | tb.setText( text ); | 103 | tb.setText( text ); |
103 | #ifdef DESKTOP_VERSION | 104 | #ifdef DESKTOP_VERSION |
104 | dia.resize( 640, 480); | 105 | dia.resize( 640, 480); |
105 | #else | 106 | #else |
106 | dia.showMaximized(); | 107 | dia.showMaximized(); |
107 | #endif | 108 | #endif |
108 | dia.exec(); | 109 | dia.exec(); |
109 | 110 | ||
110 | } | 111 | } |