author | Michael Krelin <hacker@klever.net> | 2007-07-04 11:23:42 (UTC) |
---|---|---|
committer | Michael Krelin <hacker@klever.net> | 2007-07-04 11:23:42 (UTC) |
commit | a08aff328d4393031d5ba7d622c2b05705a89d73 (patch) (unidiff) | |
tree | 8ee90d686081c52e7c69b5ce946e9b1a7d690001 /kaddressbook/keywidget.cpp | |
parent | 11edc920afe4f274c0964436633aa632c8288a40 (diff) | |
download | kdepimpi-a08aff328d4393031d5ba7d622c2b05705a89d73.zip kdepimpi-a08aff328d4393031d5ba7d622c2b05705a89d73.tar.gz kdepimpi-a08aff328d4393031d5ba7d622c2b05705a89d73.tar.bz2 |
initial public commit of qt4 portp1
-rw-r--r-- | kaddressbook/keywidget.cpp | 28 |
1 files changed, 15 insertions, 13 deletions
diff --git a/kaddressbook/keywidget.cpp b/kaddressbook/keywidget.cpp index c117d34..8ebee19 100644 --- a/kaddressbook/keywidget.cpp +++ b/kaddressbook/keywidget.cpp | |||
@@ -28,6 +28,8 @@ | |||
28 | #include <qlabel.h> | 28 | #include <qlabel.h> |
29 | #include <qlayout.h> | 29 | #include <qlayout.h> |
30 | #include <qpushbutton.h> | 30 | #include <qpushbutton.h> |
31 | //Added by qt3to4: | ||
32 | #include <Q3GridLayout> | ||
31 | 33 | ||
32 | #ifndef KAB_EMBEDDED | 34 | #ifndef KAB_EMBEDDED |
33 | #include <kaccelmanager.h> | 35 | #include <kaccelmanager.h> |
@@ -36,7 +38,7 @@ | |||
36 | #else //KAB_EMBEDDED | 38 | #else //KAB_EMBEDDED |
37 | #include <qmap.h> | 39 | #include <qmap.h> |
38 | #include <qmessagebox.h> | 40 | #include <qmessagebox.h> |
39 | #include <qtextstream.h> | 41 | #include <q3textstream.h> |
40 | #include <kurl.h> | 42 | #include <kurl.h> |
41 | #endif //KAB_EMBEDDED | 43 | #endif //KAB_EMBEDDED |
42 | 44 | ||
@@ -52,7 +54,7 @@ | |||
52 | KeyWidget::KeyWidget( QWidget *parent, const char *name ) | 54 | KeyWidget::KeyWidget( QWidget *parent, const char *name ) |
53 | : QWidget( parent, name ) | 55 | : QWidget( parent, name ) |
54 | { | 56 | { |
55 | QGridLayout *layout = new QGridLayout( this, 2, 2, KDialog::marginHint(), | 57 | Q3GridLayout *layout = new Q3GridLayout( this, 2, 2, KDialog::marginHint(), |
56 | KDialog::spacingHint() ); | 58 | KDialog::spacingHint() ); |
57 | 59 | ||
58 | QLabel *label = new QLabel( i18n( "Keys:" ), this ); | 60 | QLabel *label = new QLabel( i18n( "Keys:" ), this ); |
@@ -136,7 +138,7 @@ void KeyWidget::addKey() | |||
136 | QString tmpFile; | 138 | QString tmpFile; |
137 | if ( KIO::NetAccess::download( url, tmpFile ) ) { | 139 | if ( KIO::NetAccess::download( url, tmpFile ) ) { |
138 | QFile file( tmpFile ); | 140 | QFile file( tmpFile ); |
139 | if ( !file.open( IO_ReadOnly ) ) { | 141 | if ( !file.open( QIODevice::ReadOnly ) ) { |
140 | QString text( i18n( "<qt>Unable to open file <b>%1</b>.</qt>" ) ); | 142 | QString text( i18n( "<qt>Unable to open file <b>%1</b>.</qt>" ) ); |
141 | KMessageBox::error( this, text.arg( url.url() ) ); | 143 | KMessageBox::error( this, text.arg( url.url() ) ); |
142 | return; | 144 | return; |
@@ -152,7 +154,7 @@ void KeyWidget::addKey() | |||
152 | 154 | ||
153 | { | 155 | { |
154 | QFile file( keyfile ); | 156 | QFile file( keyfile ); |
155 | if ( !file.open( IO_ReadOnly ) ) { | 157 | if ( !file.open( QIODevice::ReadOnly ) ) { |
156 | QString text( i18n( "<qt>Unable to open file <b>%1</b>.</qt>" ) ); | 158 | QString text( i18n( "<qt>Unable to open file <b>%1</b>.</qt>" ) ); |
157 | QString caption( i18n( "Error" ) ); | 159 | QString caption( i18n( "Error" ) ); |
158 | QMessageBox::critical( this, caption, text.arg( keyfile ) ); | 160 | QMessageBox::critical( this, caption, text.arg( keyfile ) ); |
@@ -163,10 +165,10 @@ void KeyWidget::addKey() | |||
163 | 165 | ||
164 | 166 | ||
165 | 167 | ||
166 | QTextStream s( &file ); | 168 | Q3TextStream s( &file ); |
167 | QString data; | 169 | QString data; |
168 | 170 | ||
169 | s.setEncoding( QTextStream::UnicodeUTF8 ); | 171 | s.setEncoding( Q3TextStream::UnicodeUTF8 ); |
170 | s >> data; | 172 | s >> data; |
171 | file.close(); | 173 | file.close(); |
172 | 174 | ||
@@ -221,8 +223,8 @@ void KeyWidget::exportKey() | |||
221 | KURL url = KFileDialog::getSaveURL(); | 223 | KURL url = KFileDialog::getSaveURL(); |
222 | 224 | ||
223 | KTempFile tempFile; | 225 | KTempFile tempFile; |
224 | QTextStream *s = tempFile.textStream(); | 226 | Q3TextStream *s = tempFile.textStream(); |
225 | s->setEncoding( QTextStream::UnicodeUTF8 ); | 227 | s->setEncoding( Q3TextStream::UnicodeUTF8 ); |
226 | (*s) << key.textData(); | 228 | (*s) << key.textData(); |
227 | tempFile.close(); | 229 | tempFile.close(); |
228 | 230 | ||
@@ -235,15 +237,15 @@ void KeyWidget::exportKey() | |||
235 | return; | 237 | return; |
236 | 238 | ||
237 | QFile file( keyfile ); | 239 | QFile file( keyfile ); |
238 | if ( !file.open( IO_ReadWrite ) ) { | 240 | if ( !file.open( QIODevice::ReadWrite ) ) { |
239 | QString text( i18n( "<qt>Unable to open file <b>%1</b>.</qt>" ) ); | 241 | QString text( i18n( "<qt>Unable to open file <b>%1</b>.</qt>" ) ); |
240 | QString caption( i18n( "Error" ) ); | 242 | QString caption( i18n( "Error" ) ); |
241 | QMessageBox::critical( this, caption, text.arg( keyfile ) ); | 243 | QMessageBox::critical( this, caption, text.arg( keyfile ) ); |
242 | return; | 244 | return; |
243 | } | 245 | } |
244 | 246 | ||
245 | QTextStream s( &file ); | 247 | Q3TextStream s( &file ); |
246 | s.setEncoding( QTextStream::UnicodeUTF8 ); | 248 | s.setEncoding( Q3TextStream::UnicodeUTF8 ); |
247 | s << key.textData(); | 249 | s << key.textData(); |
248 | file.close(); | 250 | file.close(); |
249 | 251 | ||
@@ -272,6 +274,6 @@ void KeyWidget::updateKeyCombo() | |||
272 | mExportButton->setEnabled( state ); | 274 | mExportButton->setEnabled( state ); |
273 | } | 275 | } |
274 | 276 | ||
275 | #ifndef KAB_EMBEDDED | 277 | #ifndef KAB_EMBEDDED_ |
276 | #include "keywidget.moc" | 278 | #include "moc_keywidget.cpp" |
277 | #endif //KAB_EMBEDDED | 279 | #endif //KAB_EMBEDDED |