summaryrefslogtreecommitdiffabout
path: root/kmicromail
authorzautrix <zautrix>2005-02-28 18:16:03 (UTC)
committer zautrix <zautrix>2005-02-28 18:16:03 (UTC)
commit27466d3bc668e7a4c4bdedb6f407e14844908347 (patch) (unidiff)
treeecc5f637b7430d34161a267bd4047cdd0de056f3 /kmicromail
parent16575cca67c9047de72530080dfeb5793a66c935 (diff)
downloadkdepimpi-27466d3bc668e7a4c4bdedb6f407e14844908347.zip
kdepimpi-27466d3bc668e7a4c4bdedb6f407e14844908347.tar.gz
kdepimpi-27466d3bc668e7a4c4bdedb6f407e14844908347.tar.bz2
ompi fixes
Diffstat (limited to 'kmicromail') (more/less context) (ignore whitespace changes)
-rw-r--r--kmicromail/editaccounts.cpp12
-rw-r--r--kmicromail/opiemail.cpp8
-rw-r--r--kmicromail/selectsmtp.cpp2
3 files changed, 16 insertions, 6 deletions
diff --git a/kmicromail/editaccounts.cpp b/kmicromail/editaccounts.cpp
index 8253c91..f1075c0 100644
--- a/kmicromail/editaccounts.cpp
+++ b/kmicromail/editaccounts.cpp
@@ -128,554 +128,566 @@ void EditAccounts::slotNewAccount( const QString &type )
128 POP3account *account = new POP3account(); 128 POP3account *account = new POP3account();
129 POP3config pop3( account, this, 0, true, WStyle_ContextHelp ); 129 POP3config pop3( account, this, 0, true, WStyle_ContextHelp );
130 if ( QDialog::Accepted == KApplication::execDialog( &pop3 ) ) 130 if ( QDialog::Accepted == KApplication::execDialog( &pop3 ) )
131 { 131 {
132 settings->addAccount( account ); 132 settings->addAccount( account );
133 account->save(); 133 account->save();
134 slotFillLists(); 134 slotFillLists();
135 } 135 }
136 else 136 else
137 { 137 {
138 account->remove(); 138 account->remove();
139 } 139 }
140 } 140 }
141 else if ( type.compare( i18n("SMTP") ) == 0 ) 141 else if ( type.compare( i18n("SMTP") ) == 0 )
142 { 142 {
143 SMTPaccount *account = new SMTPaccount(); 143 SMTPaccount *account = new SMTPaccount();
144 SMTPconfig smtp( account, this, 0, true, WStyle_ContextHelp ); 144 SMTPconfig smtp( account, this, 0, true, WStyle_ContextHelp );
145 if ( QDialog::Accepted == KApplication::execDialog( &smtp ) ) 145 if ( QDialog::Accepted == KApplication::execDialog( &smtp ) )
146 { 146 {
147 settings->addAccount( account ); 147 settings->addAccount( account );
148 account->save(); 148 account->save();
149 slotFillLists(); 149 slotFillLists();
150 150
151 } 151 }
152 else 152 else
153 { 153 {
154 account->remove(); 154 account->remove();
155 } 155 }
156 } 156 }
157 else if ( type.compare( i18n("NNTP") ) == 0 ) 157 else if ( type.compare( i18n("NNTP") ) == 0 )
158 { 158 {
159 NNTPaccount *account = new NNTPaccount(); 159 NNTPaccount *account = new NNTPaccount();
160 NNTPconfig nntp( account, this, 0, true, WStyle_ContextHelp ); 160 NNTPconfig nntp( account, this, 0, true, WStyle_ContextHelp );
161 if ( QDialog::Accepted == KApplication::execDialog( &nntp ) ) 161 if ( QDialog::Accepted == KApplication::execDialog( &nntp ) )
162 { 162 {
163 settings->addAccount( account ); 163 settings->addAccount( account );
164 account->save(); 164 account->save();
165 slotFillLists(); 165 slotFillLists();
166 } 166 }
167 else 167 else
168 { 168 {
169 account->remove(); 169 account->remove();
170 } 170 }
171 } 171 }
172} 172}
173 173
174void EditAccounts::slotEditAccount( Account *account ) 174void EditAccounts::slotEditAccount( Account *account )
175{ 175{
176 if ( account->getType() == MAILLIB::A_IMAP ) 176 if ( account->getType() == MAILLIB::A_IMAP )
177 { 177 {
178 IMAPaccount *imapAcc = static_cast<IMAPaccount *>(account); 178 IMAPaccount *imapAcc = static_cast<IMAPaccount *>(account);
179 IMAPconfig imap( imapAcc, this, 0, true, WStyle_ContextHelp ); 179 IMAPconfig imap( imapAcc, this, 0, true, WStyle_ContextHelp );
180 if ( QDialog::Accepted == KApplication::execDialog( &imap ) ) 180 if ( QDialog::Accepted == KApplication::execDialog( &imap ) )
181 { 181 {
182 slotFillLists(); 182 slotFillLists();
183 } 183 }
184 } 184 }
185 else if ( account->getType()==MAILLIB::A_POP3 ) 185 else if ( account->getType()==MAILLIB::A_POP3 )
186 { 186 {
187 POP3account *pop3Acc = static_cast<POP3account *>(account); 187 POP3account *pop3Acc = static_cast<POP3account *>(account);
188 POP3config pop3( pop3Acc, this, 0, true, WStyle_ContextHelp ); 188 POP3config pop3( pop3Acc, this, 0, true, WStyle_ContextHelp );
189 if ( QDialog::Accepted == KApplication::execDialog( &pop3 ) ) 189 if ( QDialog::Accepted == KApplication::execDialog( &pop3 ) )
190 { 190 {
191 slotFillLists(); 191 slotFillLists();
192 } 192 }
193 } 193 }
194 else if ( account->getType()==MAILLIB::A_SMTP ) 194 else if ( account->getType()==MAILLIB::A_SMTP )
195 { 195 {
196 SMTPaccount *smtpAcc = static_cast<SMTPaccount *>(account); 196 SMTPaccount *smtpAcc = static_cast<SMTPaccount *>(account);
197 SMTPconfig smtp( smtpAcc, this, 0, true, WStyle_ContextHelp ); 197 SMTPconfig smtp( smtpAcc, this, 0, true, WStyle_ContextHelp );
198 if ( QDialog::Accepted == KApplication::execDialog( &smtp ) ) 198 if ( QDialog::Accepted == KApplication::execDialog( &smtp ) )
199 { 199 {
200 slotFillLists(); 200 slotFillLists();
201 } 201 }
202 } 202 }
203 else if ( account->getType()==MAILLIB::A_NNTP) 203 else if ( account->getType()==MAILLIB::A_NNTP)
204 { 204 {
205 NNTPaccount *nntpAcc = static_cast<NNTPaccount *>(account); 205 NNTPaccount *nntpAcc = static_cast<NNTPaccount *>(account);
206 NNTPconfig nntp( nntpAcc, this, 0, true, WStyle_ContextHelp ); 206 NNTPconfig nntp( nntpAcc, this, 0, true, WStyle_ContextHelp );
207 if ( QDialog::Accepted == KApplication::execDialog( &nntp ) ) 207 if ( QDialog::Accepted == KApplication::execDialog( &nntp ) )
208 { 208 {
209 slotFillLists(); 209 slotFillLists();
210 } 210 }
211 } 211 }
212} 212}
213 213
214void EditAccounts::slotDeleteAccount( Account *account ) 214void EditAccounts::slotDeleteAccount( Account *account )
215{ 215{
216 if ( QMessageBox::information( this, i18n( "Question" ), 216 if ( QMessageBox::information( this, i18n( "Question" ),
217 i18n( "<p>Do you really want to delete the selected Account?</p>" ), 217 i18n( "<p>Do you really want to delete the selected Account?</p>" ),
218 i18n( "Yes" ), i18n( "No" ) ) == 0 ) 218 i18n( "Yes" ), i18n( "No" ) ) == 0 )
219 { 219 {
220 settings->delAccount( account ); 220 settings->delAccount( account );
221 slotFillLists(); 221 slotFillLists();
222 } 222 }
223} 223}
224 224
225void EditAccounts::slotEditMail() 225void EditAccounts::slotEditMail()
226{ 226{
227 if ( !mailList->currentItem() ) 227 if ( !mailList->currentItem() )
228 { 228 {
229 QMessageBox::information( this, i18n( "Error" ), 229 QMessageBox::information( this, i18n( "Error" ),
230 i18n( "<p>Please select an account.</p>" ), 230 i18n( "<p>Please select an account.</p>" ),
231 i18n( "Ok" ) ); 231 i18n( "Ok" ) );
232 return; 232 return;
233 } 233 }
234 234
235 Account *a = ((AccountListItem *) mailList->currentItem())->getAccount(); 235 Account *a = ((AccountListItem *) mailList->currentItem())->getAccount();
236 slotEditAccount( a ); 236 slotEditAccount( a );
237} 237}
238 238
239void EditAccounts::slotDeleteMail() 239void EditAccounts::slotDeleteMail()
240{ 240{
241 if ( !mailList->currentItem() ) 241 if ( !mailList->currentItem() )
242 { 242 {
243 QMessageBox::information( this, i18n( "Error" ), 243 QMessageBox::information( this, i18n( "Error" ),
244 i18n( "<p>Please select an account.</p>" ), 244 i18n( "<p>Please select an account.</p>" ),
245 i18n( "Ok" ) ); 245 i18n( "Ok" ) );
246 return; 246 return;
247 } 247 }
248 248
249 Account *a = ((AccountListItem *) mailList->currentItem())->getAccount(); 249 Account *a = ((AccountListItem *) mailList->currentItem())->getAccount();
250 slotDeleteAccount( a ); 250 slotDeleteAccount( a );
251} 251}
252 252
253void EditAccounts::slotNewNews() 253void EditAccounts::slotNewNews()
254{ 254{
255 slotNewAccount( "NNTP" ); 255 slotNewAccount( "NNTP" );
256} 256}
257 257
258void EditAccounts::slotEditNews() 258void EditAccounts::slotEditNews()
259{ 259{
260 if ( !newsList->currentItem() ) 260 if ( !newsList->currentItem() )
261 { 261 {
262 QMessageBox::information( this, i18n( "Error" ), 262 QMessageBox::information( this, i18n( "Error" ),
263 i18n( "<p>Please select an account.</p>" ), 263 i18n( "<p>Please select an account.</p>" ),
264 i18n( "Ok" ) ); 264 i18n( "Ok" ) );
265 return; 265 return;
266 } 266 }
267 267
268 Account *a = ((AccountListItem *) newsList->currentItem())->getAccount(); 268 Account *a = ((AccountListItem *) newsList->currentItem())->getAccount();
269 slotEditAccount( a ); 269 slotEditAccount( a );
270} 270}
271 271
272void EditAccounts::slotDeleteNews() 272void EditAccounts::slotDeleteNews()
273{ 273{
274 if ( !newsList->currentItem() ) 274 if ( !newsList->currentItem() )
275 { 275 {
276 QMessageBox::information( this, i18n( "Error" ), 276 QMessageBox::information( this, i18n( "Error" ),
277 i18n( "<p>Please select an account.</p>" ), 277 i18n( "<p>Please select an account.</p>" ),
278 i18n( "Ok" ) ); 278 i18n( "Ok" ) );
279 return; 279 return;
280 } 280 }
281 281
282 Account *a = ((AccountListItem *) newsList->currentItem())->getAccount(); 282 Account *a = ((AccountListItem *) newsList->currentItem())->getAccount();
283 slotDeleteAccount( a ); 283 slotDeleteAccount( a );
284} 284}
285 285
286void EditAccounts::slotAdjustColumns() 286void EditAccounts::slotAdjustColumns()
287{ 287{
288 int currPage = configTab->currentPageIndex(); 288 int currPage = configTab->currentPageIndex();
289 289
290 configTab->showPage( mailTab ); 290 configTab->showPage( mailTab );
291 mailList->setColumnWidth( 0, mailList->visibleWidth() - 50 ); 291 mailList->setColumnWidth( 0, mailList->visibleWidth() - 50 );
292 mailList->setColumnWidth( 1, 50 ); 292 mailList->setColumnWidth( 1, 50 );
293 293
294 configTab->showPage( newsTab ); 294 configTab->showPage( newsTab );
295 newsList->setColumnWidth( 0, newsList->visibleWidth() ); 295 newsList->setColumnWidth( 0, newsList->visibleWidth() );
296 296
297 configTab->setCurrentPage( currPage ); 297 configTab->setCurrentPage( currPage );
298} 298}
299 299
300void EditAccounts::accept() 300void EditAccounts::accept()
301{ 301{
302 settings->saveAccounts(); 302 settings->saveAccounts();
303 303
304 QDialog::accept(); 304 QDialog::accept();
305} 305}
306 306
307/** 307/**
308 * SelectMailType 308 * SelectMailType
309 */ 309 */
310 310
311SelectMailType::SelectMailType( QString *selection, QWidget *parent, const char *name, bool modal, WFlags flags ) 311SelectMailType::SelectMailType( QString *selection, QWidget *parent, const char *name, bool modal, WFlags flags )
312 : SelectMailTypeUI( parent, name, modal, flags ) 312 : SelectMailTypeUI( parent, name, modal, flags )
313{ 313{
314 selected = selection; 314 selected = selection;
315 selected->replace( 0, selected->length(), typeBox->currentText() ); 315 selected->replace( 0, selected->length(), typeBox->currentText() );
316 connect( typeBox, SIGNAL( activated(const QString&) ), SLOT( slotSelection(const QString&) ) ); 316 connect( typeBox, SIGNAL( activated(const QString&) ), SLOT( slotSelection(const QString&) ) );
317} 317}
318 318
319void SelectMailType::slotSelection( const QString &sel ) 319void SelectMailType::slotSelection( const QString &sel )
320{ 320{
321 selected->replace( 0, selected->length(), sel ); 321 selected->replace( 0, selected->length(), sel );
322} 322}
323 323
324/** 324/**
325 * IMAPconfig 325 * IMAPconfig
326 */ 326 */
327 327
328IMAPconfig::IMAPconfig( IMAPaccount *account, QWidget *parent, const char *name, bool modal, WFlags flags ) 328IMAPconfig::IMAPconfig( IMAPaccount *account, QWidget *parent, const char *name, bool modal, WFlags flags )
329 : IMAPconfigUI( parent, name, modal, flags ) 329 : IMAPconfigUI( parent, name, modal, flags )
330{ 330{
331 data = account; 331 data = account;
332 332
333 fillValues(); 333 fillValues();
334 334
335 connect( ComboBox1, SIGNAL( activated(int) ), SLOT( slotConnectionToggle(int) ) ); 335 connect( ComboBox1, SIGNAL( activated(int) ), SLOT( slotConnectionToggle(int) ) );
336 ComboBox1->insertItem( "Only if available", 0 ); 336 ComboBox1->insertItem( "Only if available", 0 );
337 ComboBox1->insertItem( "Always, Negotiated", 1 ); 337 ComboBox1->insertItem( "Always, Negotiated", 1 );
338 ComboBox1->insertItem( "Connect on secure port", 2 ); 338 ComboBox1->insertItem( "Connect on secure port", 2 );
339 ComboBox1->insertItem( "Run command instead", 3 ); 339 ComboBox1->insertItem( "Run command instead", 3 );
340 CommandEdit->hide(); 340 CommandEdit->hide();
341 ComboBox1->setCurrentItem( data->ConnectionType() ); 341 ComboBox1->setCurrentItem( data->ConnectionType() );
342} 342}
343 343
344void IMAPconfig::slotConnectionToggle( int index ) 344void IMAPconfig::slotConnectionToggle( int index )
345{ 345{
346 if ( index == 2 ) 346 if ( index == 2 )
347 { 347 {
348 portLine->setText( IMAP_SSL_PORT ); 348 portLine->setText( IMAP_SSL_PORT );
349 } 349 }
350 else if ( index == 3 ) 350 else if ( index == 3 )
351 { 351 {
352 portLine->setText( IMAP_PORT ); 352 portLine->setText( IMAP_PORT );
353 CommandEdit->show(); 353 CommandEdit->show();
354 } 354 }
355 else 355 else
356 { 356 {
357 portLine->setText( IMAP_PORT ); 357 portLine->setText( IMAP_PORT );
358 } 358 }
359} 359}
360 360
361void IMAPconfig::fillValues() 361void IMAPconfig::fillValues()
362{ 362{
363 accountLine->setText( data->getAccountName() ); 363 accountLine->setText( data->getAccountName() );
364 serverLine->setText( data->getServer() ); 364 serverLine->setText( data->getServer() );
365 portLine->setText( data->getPort() ); 365 portLine->setText( data->getPort() );
366 ComboBox1->setCurrentItem( data->ConnectionType() ); 366 ComboBox1->setCurrentItem( data->ConnectionType() );
367 userLine->setText( data->getUser() ); 367 userLine->setText( data->getUser() );
368 passLine->setText( data->getPassword() ); 368 passLine->setText( data->getPassword() );
369 prefixLine->setText(data->getPrefix()); 369 prefixLine->setText(data->getPrefix());
370 localFolder->setText( data->getLocalFolder() ); 370 localFolder->setText( data->getLocalFolder() );
371 int max = data->getMaxMailSize() ; 371 int max = data->getMaxMailSize() ;
372 if ( max ) { 372 if ( max ) {
373 CheckBoxDown->setChecked( true ); 373 CheckBoxDown->setChecked( true );
374 SpinBoxDown->setValue ( max ); 374 SpinBoxDown->setValue ( max );
375 } else { 375 } else {
376 CheckBoxDown->setChecked( false ); 376 CheckBoxDown->setChecked( false );
377 SpinBoxDown->setValue ( 5 ); 377 SpinBoxDown->setValue ( 5 );
378 } 378 }
379 CheckBoxLeaveOn->setChecked( data->getLeaveOnServer() ); 379 CheckBoxLeaveOn->setChecked( data->getLeaveOnServer() );
380} 380}
381 381
382void IMAPconfig::accept() 382void IMAPconfig::accept()
383{ 383{
384 if ( localFolder->text().contains("/") ||localFolder->text().contains("\\") ) {
385 QMessageBox::information( this, i18n( "Error" ),
386 i18n( "No paths allowed in\nlocal folder settings.\nPlease specify a folder\nname or leave empty\nto create local folder\nwith account name\nautomatically." ),
387 i18n( "Ok" ) );
388 return;
389 }
384 data->setAccountName( accountLine->text() ); 390 data->setAccountName( accountLine->text() );
385 data->setServer( serverLine->text() ); 391 data->setServer( serverLine->text() );
386 data->setPort( portLine->text() ); 392 data->setPort( portLine->text() );
387 data->setConnectionType( ComboBox1->currentItem() ); 393 data->setConnectionType( ComboBox1->currentItem() );
388 data->setUser( userLine->text() ); 394 data->setUser( userLine->text() );
389 data->setPassword( passLine->text() ); 395 data->setPassword( passLine->text() );
390 data->setPrefix(prefixLine->text()); 396 data->setPrefix(prefixLine->text());
391 data->setLocalFolder( localFolder->text() ); 397 data->setLocalFolder( localFolder->text() );
392 data->setMaxMailSize( CheckBoxDown->isChecked()?SpinBoxDown->value():0 ) ; 398 data->setMaxMailSize( CheckBoxDown->isChecked()?SpinBoxDown->value():0 ) ;
393 data->setLeaveOnServer( CheckBoxLeaveOn->isChecked() ); 399 data->setLeaveOnServer( CheckBoxLeaveOn->isChecked() );
394 400
395 QDialog::accept(); 401 QDialog::accept();
396} 402}
397 403
398/** 404/**
399 * POP3config 405 * POP3config
400 */ 406 */
401 407
402POP3config::POP3config( POP3account *account, QWidget *parent, const char *name, bool modal, WFlags flags ) 408POP3config::POP3config( POP3account *account, QWidget *parent, const char *name, bool modal, WFlags flags )
403 : POP3configUI( parent, name, modal, flags ) 409 : POP3configUI( parent, name, modal, flags )
404{ 410{
405 data = account; 411 data = account;
406 fillValues(); 412 fillValues();
407 413
408 connect( ComboBox1, SIGNAL( activated(int) ), SLOT( slotConnectionToggle(int) ) ); 414 connect( ComboBox1, SIGNAL( activated(int) ), SLOT( slotConnectionToggle(int) ) );
409 ComboBox1->insertItem( "Only if available", 0 ); 415 ComboBox1->insertItem( "Only if available", 0 );
410 ComboBox1->insertItem( "Always, Negotiated", 1 ); 416 ComboBox1->insertItem( "Always, Negotiated", 1 );
411 ComboBox1->insertItem( "Connect on secure port", 2 ); 417 ComboBox1->insertItem( "Connect on secure port", 2 );
412 ComboBox1->insertItem( "Run command instead", 3 ); 418 ComboBox1->insertItem( "Run command instead", 3 );
413 CommandEdit->hide(); 419 CommandEdit->hide();
414 ComboBox1->setCurrentItem( data->ConnectionType() ); 420 ComboBox1->setCurrentItem( data->ConnectionType() );
415} 421}
416 422
417void POP3config::slotConnectionToggle( int index ) 423void POP3config::slotConnectionToggle( int index )
418{ 424{
419 // 2 is ssl connection 425 // 2 is ssl connection
420 if ( index == 2 ) 426 if ( index == 2 )
421 { 427 {
422 portLine->setText( POP3_SSL_PORT ); 428 portLine->setText( POP3_SSL_PORT );
423 } 429 }
424 else if ( index == 3 ) 430 else if ( index == 3 )
425 { 431 {
426 portLine->setText( POP3_PORT ); 432 portLine->setText( POP3_PORT );
427 CommandEdit->show(); 433 CommandEdit->show();
428 } 434 }
429 else 435 else
430 { 436 {
431 portLine->setText( POP3_PORT ); 437 portLine->setText( POP3_PORT );
432 } 438 }
433} 439}
434 440
435void POP3config::fillValues() 441void POP3config::fillValues()
436{ 442{
437 accountLine->setText( data->getAccountName() ); 443 accountLine->setText( data->getAccountName() );
438 serverLine->setText( data->getServer() ); 444 serverLine->setText( data->getServer() );
439 portLine->setText( data->getPort() ); 445 portLine->setText( data->getPort() );
440 ComboBox1->setCurrentItem( data->ConnectionType() ); 446 ComboBox1->setCurrentItem( data->ConnectionType() );
441 userLine->setText( data->getUser() ); 447 userLine->setText( data->getUser() );
442 passLine->setText( data->getPassword() ); 448 passLine->setText( data->getPassword() );
443 localFolder->setText( data->getLocalFolder() ); 449 localFolder->setText( data->getLocalFolder() );
444 int max = data->getMaxMailSize() ; 450 int max = data->getMaxMailSize() ;
445 if ( max ) { 451 if ( max ) {
446 CheckBoxDown->setChecked( true ); 452 CheckBoxDown->setChecked( true );
447 SpinBoxDown->setValue ( max ); 453 SpinBoxDown->setValue ( max );
448 } else { 454 } else {
449 CheckBoxDown->setChecked( false ); 455 CheckBoxDown->setChecked( false );
450 SpinBoxDown->setValue ( 5 ); 456 SpinBoxDown->setValue ( 5 );
451 } 457 }
452 CheckBoxLeaveOn->setChecked( data->getLeaveOnServer() ); 458 CheckBoxLeaveOn->setChecked( data->getLeaveOnServer() );
453} 459}
454 460
455void POP3config::accept() 461void POP3config::accept()
456{ 462{
463 if ( localFolder->text().contains("/") ||localFolder->text().contains("\\") ) {
464 QMessageBox::information( this, i18n( "Error" ),
465 i18n( "No paths allowed in\nlocal folder settings.\nPlease specify a folder\nname or leave empty\nto create local folder\nwith account name\nautomatically." ),
466 i18n( "Ok" ) );
467 return;
468 }
457 data->setAccountName( accountLine->text() ); 469 data->setAccountName( accountLine->text() );
458 data->setServer( serverLine->text() ); 470 data->setServer( serverLine->text() );
459 data->setPort( portLine->text() ); 471 data->setPort( portLine->text() );
460 data->setConnectionType( ComboBox1->currentItem() ); 472 data->setConnectionType( ComboBox1->currentItem() );
461 data->setUser( userLine->text() ); 473 data->setUser( userLine->text() );
462 data->setPassword( passLine->text() ); 474 data->setPassword( passLine->text() );
463 data->setLocalFolder( localFolder->text() ); 475 data->setLocalFolder( localFolder->text() );
464 data->setMaxMailSize( CheckBoxDown->isChecked()?SpinBoxDown->value():0 ) ; 476 data->setMaxMailSize( CheckBoxDown->isChecked()?SpinBoxDown->value():0 ) ;
465 data->setLeaveOnServer( CheckBoxLeaveOn->isChecked() ); 477 data->setLeaveOnServer( CheckBoxLeaveOn->isChecked() );
466 478
467 QDialog::accept(); 479 QDialog::accept();
468} 480}
469 481
470/** 482/**
471 * SMTPconfig 483 * SMTPconfig
472 */ 484 */
473 485
474SMTPconfig::SMTPconfig( SMTPaccount *account, QWidget *parent, const char *name, bool modal, WFlags flags ) 486SMTPconfig::SMTPconfig( SMTPaccount *account, QWidget *parent, const char *name, bool modal, WFlags flags )
475 : SMTPconfigUI( parent, name, modal, flags ) 487 : SMTPconfigUI( parent, name, modal, flags )
476{ 488{
477 data = account; 489 data = account;
478 490
479 connect( loginBox, SIGNAL( toggled(bool) ), userLine, SLOT( setEnabled(bool) ) ); 491 connect( loginBox, SIGNAL( toggled(bool) ), userLine, SLOT( setEnabled(bool) ) );
480 connect( loginBox, SIGNAL( toggled(bool) ), passLine, SLOT( setEnabled(bool) ) ); 492 connect( loginBox, SIGNAL( toggled(bool) ), passLine, SLOT( setEnabled(bool) ) );
481 493
482 fillValues(); 494 fillValues();
483 QIconSet icon; 495 QIconSet icon;
484 //icon = SmallIcon("fileexport"); 496 //icon = SmallIcon("fileexport");
485 icon = SmallIcon("fileopen"); 497 icon = SmallIcon("fileopen");
486 SignaturButton->setText(""); 498 SignaturButton->setText("");
487 SignaturButton->setIconSet (icon ) ; 499 SignaturButton->setIconSet (icon ) ;
488 SignaturButton->setMaximumSize ( SignaturButton->sizeHint().height()+4,SignaturButton->sizeHint().height()) ; 500 SignaturButton->setMaximumSize ( SignaturButton->sizeHint().height()+4,SignaturButton->sizeHint().height()) ;
489 connect( SignaturButton, SIGNAL( clicked() ), this, SLOT( chooseSig() ) ); 501 connect( SignaturButton, SIGNAL( clicked() ), this, SLOT( chooseSig() ) );
490 connect( ComboBox1, SIGNAL( activated(int) ), SLOT( slotConnectionToggle(int) ) ); 502 connect( ComboBox1, SIGNAL( activated(int) ), SLOT( slotConnectionToggle(int) ) );
491 ComboBox1->insertItem( "Only if available", 0 ); 503 ComboBox1->insertItem( "Only if available", 0 );
492 ComboBox1->insertItem( "Always, Negotiated", 1 ); 504 ComboBox1->insertItem( "Always, Negotiated", 1 );
493 ComboBox1->insertItem( "Connect on secure port", 2 ); 505 ComboBox1->insertItem( "Connect on secure port", 2 );
494 ComboBox1->insertItem( "Run command instead", 3 ); 506 ComboBox1->insertItem( "Run command instead", 3 );
495 CommandEdit->hide(); 507 CommandEdit->hide();
496 ComboBox1->setCurrentItem( data->ConnectionType() ); 508 ComboBox1->setCurrentItem( data->ConnectionType() );
497} 509}
498void SMTPconfig::chooseSig() 510void SMTPconfig::chooseSig()
499{ 511{
500 QString lnk = KFileDialog::getOpenFileName( "", "Choose Signatur File", this ); 512 QString lnk = KFileDialog::getOpenFileName( "", "Choose Signatur File", this );
501 if ( !lnk.isEmpty() ) { 513 if ( !lnk.isEmpty() ) {
502 SignaturEdit->setText( lnk ); 514 SignaturEdit->setText( lnk );
503 } 515 }
504} 516}
505void SMTPconfig::slotConnectionToggle( int index ) 517void SMTPconfig::slotConnectionToggle( int index )
506{ 518{
507 // 2 is ssl connection 519 // 2 is ssl connection
508 if ( index == 2 ) 520 if ( index == 2 )
509 { 521 {
510 portLine->setText( SMTP_SSL_PORT ); 522 portLine->setText( SMTP_SSL_PORT );
511 } 523 }
512 else if ( index == 3 ) 524 else if ( index == 3 )
513 { 525 {
514 portLine->setText( SMTP_PORT ); 526 portLine->setText( SMTP_PORT );
515 CommandEdit->show(); 527 CommandEdit->show();
516 } 528 }
517 else 529 else
518 { 530 {
519 portLine->setText( SMTP_PORT ); 531 portLine->setText( SMTP_PORT );
520 } 532 }
521} 533}
522 534
523void SMTPconfig::fillValues() 535void SMTPconfig::fillValues()
524{ 536{
525 accountLine->setText( data->getAccountName() ); 537 accountLine->setText( data->getAccountName() );
526 serverLine->setText( data->getServer() ); 538 serverLine->setText( data->getServer() );
527 portLine->setText( data->getPort() ); 539 portLine->setText( data->getPort() );
528 ComboBox1->setCurrentItem( data->ConnectionType() ); 540 ComboBox1->setCurrentItem( data->ConnectionType() );
529 loginBox->setChecked( data->getLogin() ); 541 loginBox->setChecked( data->getLogin() );
530 userLine->setText( data->getUser() ); 542 userLine->setText( data->getUser() );
531 passLine->setText( data->getPassword() ); 543 passLine->setText( data->getPassword() );
532 SignaturEdit->setText( data->getSigFile() ); 544 SignaturEdit->setText( data->getSigFile() );
533} 545}
534 546
535void SMTPconfig::accept() 547void SMTPconfig::accept()
536{ 548{
537 data->setAccountName( accountLine->text() ); 549 data->setAccountName( accountLine->text() );
538 data->setServer( serverLine->text() ); 550 data->setServer( serverLine->text() );
539 data->setPort( portLine->text() ); 551 data->setPort( portLine->text() );
540 data->setConnectionType( ComboBox1->currentItem() ); 552 data->setConnectionType( ComboBox1->currentItem() );
541 data->setLogin( loginBox->isChecked() ); 553 data->setLogin( loginBox->isChecked() );
542 data->setUser( userLine->text() ); 554 data->setUser( userLine->text() );
543 data->setPassword( passLine->text() ); 555 data->setPassword( passLine->text() );
544 data->setSigFile( SignaturEdit->text() ); 556 data->setSigFile( SignaturEdit->text() );
545 557
546 QDialog::accept(); 558 QDialog::accept();
547} 559}
548 560
549/** 561/**
550 * NNTPconfig 562 * NNTPconfig
551 */ 563 */
552 564
553NNTPconfig::NNTPconfig( NNTPaccount *account, QWidget *parent, const char *name, bool modal, WFlags flags ) 565NNTPconfig::NNTPconfig( NNTPaccount *account, QWidget *parent, const char *name, bool modal, WFlags flags )
554 : NNTPconfigUI( parent, name, modal, flags ) 566 : NNTPconfigUI( parent, name, modal, flags )
555{ 567{
556 data = account; 568 data = account;
557 569
558 connect( loginBox, SIGNAL( toggled(bool) ), userLine, SLOT( setEnabled(bool) ) ); 570 connect( loginBox, SIGNAL( toggled(bool) ), userLine, SLOT( setEnabled(bool) ) );
559 connect( loginBox, SIGNAL( toggled(bool) ), passLine, SLOT( setEnabled(bool) ) ); 571 connect( loginBox, SIGNAL( toggled(bool) ), passLine, SLOT( setEnabled(bool) ) );
560 connect( GetNGButton, SIGNAL( clicked() ), this, SLOT( slotGetNG() ) ); 572 connect( GetNGButton, SIGNAL( clicked() ), this, SLOT( slotGetNG() ) );
561 connect( ShowSubcribed, SIGNAL( clicked() ), this, SLOT( slotShowSub() ) ); 573 connect( ShowSubcribed, SIGNAL( clicked() ), this, SLOT( slotShowSub() ) );
562 connect( FilterButton, SIGNAL( clicked() ), this, SLOT( slotShowFilter() ) ); 574 connect( FilterButton, SIGNAL( clicked() ), this, SLOT( slotShowFilter() ) );
563 fillValues(); 575 fillValues();
564 576
565 connect( sslBox, SIGNAL( toggled(bool) ), SLOT( slotSSL(bool) ) ); 577 connect( sslBox, SIGNAL( toggled(bool) ), SLOT( slotSSL(bool) ) );
566} 578}
567 579
568void NNTPconfig::slotShowSub() 580void NNTPconfig::slotShowSub()
569{ 581{
570 save(); 582 save();
571 data->save(); 583 data->save();
572 ListViewGroups->clear(); 584 ListViewGroups->clear();
573 for ( QStringList::Iterator it = subscribedGroups.begin(); it != subscribedGroups.end(); ++it ) { 585 for ( QStringList::Iterator it = subscribedGroups.begin(); it != subscribedGroups.end(); ++it ) {
574 QCheckListItem *item; 586 QCheckListItem *item;
575 item = new QCheckListItem( ListViewGroups, (*it), QCheckListItem::CheckBox ); 587 item = new QCheckListItem( ListViewGroups, (*it), QCheckListItem::CheckBox );
576 item->setOn( true ); 588 item->setOn( true );
577 } 589 }
578 topLevelWidget()->setCaption( i18n("%1 groups subscribed").arg( subscribedGroups.count())); 590 topLevelWidget()->setCaption( i18n("%1 groups subscribed").arg( subscribedGroups.count()));
579} 591}
580void NNTPconfig::slotShowFilter() 592void NNTPconfig::slotShowFilter()
581{ 593{
582 save(); 594 save();
583 data->save(); 595 data->save();
584 ListViewGroups->clear(); 596 ListViewGroups->clear();
585 int count = 0; 597 int count = 0;
586 for ( QStringList::Iterator it = allGroups.begin(); it != allGroups.end(); ++it ) { 598 for ( QStringList::Iterator it = allGroups.begin(); it != allGroups.end(); ++it ) {
587 QCheckListItem *item; 599 QCheckListItem *item;
588 if ( GroupFilter->text().isEmpty() || (*it).find( GroupFilter->text() ) >= 0 ) { 600 if ( GroupFilter->text().isEmpty() || (*it).find( GroupFilter->text() ) >= 0 ) {
589 item = new QCheckListItem( ListViewGroups, (*it), QCheckListItem::CheckBox ); 601 item = new QCheckListItem( ListViewGroups, (*it), QCheckListItem::CheckBox );
590 ++count; 602 ++count;
591 if ( subscribedGroups.contains( (*it) ) >= 1 ) { 603 if ( subscribedGroups.contains( (*it) ) >= 1 ) {
592 item->setOn( true ); 604 item->setOn( true );
593 } 605 }
594 } 606 }
595 } 607 }
596 topLevelWidget()->setCaption( i18n("Filter found %1 groups").arg( count)); 608 topLevelWidget()->setCaption( i18n("Filter found %1 groups").arg( count));
597} 609}
598void NNTPconfig::slotGetNG() { 610void NNTPconfig::slotGetNG() {
599 save(); 611 save();
600 data->save(); 612 data->save();
601 topLevelWidget()->setCaption( i18n("Fetching group list...")); 613 topLevelWidget()->setCaption( i18n("Fetching group list..."));
602 qApp->processEvents(); 614 qApp->processEvents();
603 NNTPwrapper* tmp = new NNTPwrapper( data ); 615 NNTPwrapper* tmp = new NNTPwrapper( data );
604 allGroups = tmp->listAllNewsgroups(); 616 allGroups = tmp->listAllNewsgroups();
605 topLevelWidget()->setCaption( i18n("Downloaded %1 group names").arg( allGroups.count())); 617 topLevelWidget()->setCaption( i18n("Downloaded %1 group names").arg( allGroups.count()));
606 618
607 ListViewGroups->clear(); 619 ListViewGroups->clear();
608 620
609 for ( QStringList::Iterator it = allGroups.begin(); it != allGroups.end(); ++it ) { 621 for ( QStringList::Iterator it = allGroups.begin(); it != allGroups.end(); ++it ) {
610 QCheckListItem *item; 622 QCheckListItem *item;
611 item = new QCheckListItem( ListViewGroups, (*it), QCheckListItem::CheckBox ); 623 item = new QCheckListItem( ListViewGroups, (*it), QCheckListItem::CheckBox );
612 if ( subscribedGroups.contains( (*it) ) >= 1 ) { 624 if ( subscribedGroups.contains( (*it) ) >= 1 ) {
613 item->setOn( true ); 625 item->setOn( true );
614 626
615 } 627 }
616 } 628 }
617 delete tmp; 629 delete tmp;
618} 630}
619 631
620void NNTPconfig::slotSSL( bool enabled ) 632void NNTPconfig::slotSSL( bool enabled )
621{ 633{
622 if ( enabled ) 634 if ( enabled )
623 { 635 {
624 portLine->setText( NNTP_SSL_PORT ); 636 portLine->setText( NNTP_SSL_PORT );
625 } 637 }
626 else 638 else
627 { 639 {
628 portLine->setText( NNTP_PORT ); 640 portLine->setText( NNTP_PORT );
629 } 641 }
630} 642}
631 643
632void NNTPconfig::fillValues() 644void NNTPconfig::fillValues()
633{ 645{
634 accountLine->setText( data->getAccountName() ); 646 accountLine->setText( data->getAccountName() );
635 serverLine->setText( data->getServer() ); 647 serverLine->setText( data->getServer() );
636 portLine->setText( data->getPort() ); 648 portLine->setText( data->getPort() );
637 sslBox->setChecked( data->getSSL() ); 649 sslBox->setChecked( data->getSSL() );
638 loginBox->setChecked( data->getLogin() ); 650 loginBox->setChecked( data->getLogin() );
639 userLine->setText( data->getUser() ); 651 userLine->setText( data->getUser() );
640 passLine->setText( data->getPassword() ); 652 passLine->setText( data->getPassword() );
641 subscribedGroups = data->getGroups(); 653 subscribedGroups = data->getGroups();
642 /* don't forget that - you will overwrite values if user clicks cancel! */ 654 /* don't forget that - you will overwrite values if user clicks cancel! */
643 for ( QStringList::Iterator it = subscribedGroups.begin(); it != subscribedGroups.end(); ++it ) { 655 for ( QStringList::Iterator it = subscribedGroups.begin(); it != subscribedGroups.end(); ++it ) {
644 QCheckListItem *item; 656 QCheckListItem *item;
645 item = new QCheckListItem( ListViewGroups, (*it), QCheckListItem::CheckBox ); 657 item = new QCheckListItem( ListViewGroups, (*it), QCheckListItem::CheckBox );
646 item->setOn( true ); 658 item->setOn( true );
647 } 659 }
648} 660}
649 661
650void NNTPconfig::save() 662void NNTPconfig::save()
651{ 663{
652 data->setAccountName( accountLine->text() ); 664 data->setAccountName( accountLine->text() );
653 data->setServer( serverLine->text() ); 665 data->setServer( serverLine->text() );
654 data->setPort( portLine->text() ); 666 data->setPort( portLine->text() );
655 data->setSSL( sslBox->isChecked() ); 667 data->setSSL( sslBox->isChecked() );
656 data->setLogin( loginBox->isChecked() ); 668 data->setLogin( loginBox->isChecked() );
657 data->setUser( userLine->text() ); 669 data->setUser( userLine->text() );
658 data->setPassword( passLine->text() ); 670 data->setPassword( passLine->text() );
659 671
660 QListViewItemIterator list_it( ListViewGroups ); 672 QListViewItemIterator list_it( ListViewGroups );
661 673
662 for ( ; list_it.current(); ++list_it ) { 674 for ( ; list_it.current(); ++list_it ) {
663 675
664 if ( ( (QCheckListItem*)list_it.current() )->isOn() ) { 676 if ( ( (QCheckListItem*)list_it.current() )->isOn() ) {
665 if ( subscribedGroups.contains( list_it.current()->text(0) ) < 1 ) 677 if ( subscribedGroups.contains( list_it.current()->text(0) ) < 1 )
666 subscribedGroups.append( list_it.current()->text(0) ); 678 subscribedGroups.append( list_it.current()->text(0) );
667 } else { 679 } else {
668 if ( subscribedGroups.contains( list_it.current()->text(0) ) >= 1 ) 680 if ( subscribedGroups.contains( list_it.current()->text(0) ) >= 1 )
669 subscribedGroups.remove( list_it.current()->text(0) ); 681 subscribedGroups.remove( list_it.current()->text(0) );
670 } 682 }
671 683
672 } 684 }
673 data->setGroups( subscribedGroups ); 685 data->setGroups( subscribedGroups );
674} 686}
675 687
676void NNTPconfig::accept() 688void NNTPconfig::accept()
677{ 689{
678 save(); 690 save();
679 QDialog::accept(); 691 QDialog::accept();
680} 692}
681 693
diff --git a/kmicromail/opiemail.cpp b/kmicromail/opiemail.cpp
index 197f7ec..b701446 100644
--- a/kmicromail/opiemail.cpp
+++ b/kmicromail/opiemail.cpp
@@ -1,480 +1,478 @@
1// CHANGED 2004-09-31 Lutz Rogowski 1// CHANGED 2004-09-31 Lutz Rogowski
2// CHANGED 2004-08-06 Lutz Rogowski 2// CHANGED 2004-08-06 Lutz Rogowski
3 3
4 4
5#define protected public 5#define protected public
6#include <qwidget.h> 6#include <qwidget.h>
7#undef protected 7#undef protected
8#include "koprefsdialog.h" 8#include "koprefsdialog.h"
9#include <kapplication.h> 9#include <kapplication.h>
10#include <libkdepim/externalapphandler.h> 10#include <libkdepim/externalapphandler.h>
11#include <libkdepim/kpimglobalprefs.h> 11#include <libkdepim/kpimglobalprefs.h>
12#ifdef MINIKDE_KDIALOG_H 12#ifdef MINIKDE_KDIALOG_H
13#undef MINIKDE_KDIALOG_H 13#undef MINIKDE_KDIALOG_H
14#endif 14#endif
15#include "settingsdialog.h" 15#include "settingsdialog.h"
16#include "opiemail.h" 16#include "opiemail.h"
17#include "editaccounts.h" 17#include "editaccounts.h"
18#include "composemail.h" 18#include "composemail.h"
19#include "mailistviewitem.h" 19#include "mailistviewitem.h"
20#include "viewmail.h" 20#include "viewmail.h"
21#include "selectstore.h" 21#include "selectstore.h"
22#include "selectsmtp.h" 22#include "selectsmtp.h"
23#include "accountitem.h" 23#include "accountitem.h"
24#include "accountview.h" 24#include "accountview.h"
25#include "klocale.h" 25#include "klocale.h"
26 26
27#include <qmessagebox.h> 27#include <qmessagebox.h>
28#include <qtimer.h> 28#include <qtimer.h>
29#include <qcursor.h> 29#include <qcursor.h>
30#include <qtextbrowser.h> 30#include <qtextbrowser.h>
31#include <qregexp.h> 31#include <qregexp.h>
32#include <qpe/global.h> 32#include <qpe/global.h>
33 33
34#ifdef DESKTOP_VERSION 34#ifdef DESKTOP_VERSION
35#include <qapplication.h> 35#include <qapplication.h>
36#else 36#else
37#include <qpe/qpeapplication.h> 37#include <qpe/qpeapplication.h>
38#endif 38#endif
39#include <libmailwrapper/smtpwrapper.h> 39#include <libmailwrapper/smtpwrapper.h>
40#include <libmailwrapper/mailtypes.h> 40#include <libmailwrapper/mailtypes.h>
41#include <libmailwrapper/abstractmail.h> 41#include <libmailwrapper/abstractmail.h>
42#include "koprefs.h" 42#include "koprefs.h"
43 43
44//using namespace Opie::Core; 44//using namespace Opie::Core;
45 45
46OpieMail::OpieMail( QWidget *parent, const char *name ) 46OpieMail::OpieMail( QWidget *parent, const char *name )
47 : MainWindow( parent, name) //, WStyle_ContextHelp ) 47 : MainWindow( parent, name) //, WStyle_ContextHelp )
48{ 48{
49 mCurrentComposer = 0; 49 mCurrentComposer = 0;
50 settings = new Settings(); 50 settings = new Settings();
51 tb = 0; 51 tb = 0;
52 setIcon(SmallIcon( "kmicromail" ) ); 52 setIcon(SmallIcon( "kmicromail" ) );
53 folderView->populate( settings->getAccounts() ); 53 folderView->populate( settings->getAccounts() );
54 connect(ExternalAppHandler::instance(), SIGNAL(receivedNameEmailUidListEvent(const QString&, const QStringList&, const QStringList&, const QStringList&)), 54 connect(ExternalAppHandler::instance(), SIGNAL(receivedNameEmailUidListEvent(const QString&, const QStringList&, const QStringList&, const QStringList&)),
55 this, SLOT(insertAttendees(const QString&, const QStringList&, const QStringList&, const QStringList&))); 55 this, SLOT(insertAttendees(const QString&, const QStringList&, const QStringList&, const QStringList&)));
56} 56}
57 57
58OpieMail::~OpieMail() 58OpieMail::~OpieMail()
59{ 59{
60 if (settings) delete settings; 60 if (settings) delete settings;
61 if ( tb ) 61 if ( tb )
62 delete tb; 62 delete tb;
63} 63}
64 64
65void OpieMail::appMessage(const QCString &msg, const QByteArray &data) 65void OpieMail::appMessage(const QCString &msg, const QByteArray &data)
66{ 66{
67 67
68} 68}
69#include <stdlib.h> 69#include <stdlib.h>
70void OpieMail::message(const QCString &msg, const QByteArray &data) 70void OpieMail::message(const QCString &msg, const QByteArray &data)
71{ 71{
72 // copied from old mail2 72 // copied from old mail2
73 static int ii = 0; 73 static int ii = 0;
74 //qDebug("QCOP CALL ############################# %d ", ii); 74 //qDebug("QCOP CALL ############################# %d ", ii);
75 //QString mess ( msg ); 75 //QString mess ( msg );
76 //qDebug("Message = %s ",mess.latin1()); 76 //qDebug("Message = %s ",mess.latin1());
77 ++ii; 77 ++ii;
78 //qDebug("KM:appMessage %d *%s* %x", ii, msg.data(), this); 78 //qDebug("KM:appMessage %d *%s* %x", ii, msg.data(), this);
79 79
80 mPendingEmail = QString::null; 80 mPendingEmail = QString::null;
81 mPendingName = QString::null; 81 mPendingName = QString::null;
82 if (msg == "writeMail(QString,QString)") 82 if (msg == "writeMail(QString,QString)")
83 { 83 {
84 //qDebug("writeMail(QString,QString) "); 84 //qDebug("writeMail(QString,QString) ");
85 QDataStream stream(data,IO_ReadOnly); 85 QDataStream stream(data,IO_ReadOnly);
86 stream >> mPendingName >> mPendingEmail; 86 stream >> mPendingName >> mPendingEmail;
87 // removing the whitespaces at beginning and end is needed! 87 // removing the whitespaces at beginning and end is needed!
88 QTimer::singleShot ( 50, this, SLOT(slotComposeMail() ) ); 88 QTimer::singleShot ( 50, this, SLOT(slotComposeMail() ) );
89 } 89 }
90 else if (msg == "newMail()") 90 else if (msg == "newMail()")
91 { 91 {
92 //qDebug("slotComposeMail() "); 92 //qDebug("slotComposeMail() ");
93 // we cannot call slotComposeMail(); directly, because may be executing a QCOP call 93 // we cannot call slotComposeMail(); directly, because may be executing a QCOP call
94 // and a QCOP call does not like a processevents in his execution 94 // and a QCOP call does not like a processevents in his execution
95 // with the Qtimer we call slotComposeMail() after we reached the main event loop 95 // with the Qtimer we call slotComposeMail() after we reached the main event loop
96 QTimer::singleShot ( 50, this, SLOT(slotComposeMail() ) ); 96 QTimer::singleShot ( 50, this, SLOT(slotComposeMail() ) );
97 // slotComposeMail(); 97 // slotComposeMail();
98 } 98 }
99 else if (msg == "newMail(QString)") 99 else if (msg == "newMail(QString)")
100 { 100 {
101 //qDebug(" newMail(QString)"); 101 //qDebug(" newMail(QString)");
102 QDataStream stream(data,IO_ReadOnly); 102 QDataStream stream(data,IO_ReadOnly);
103 stream >> mPendingName; 103 stream >> mPendingName;
104 // the format is 104 // the format is
105 // NAME <EMAIL>:SUBJECT 105 // NAME <EMAIL>:SUBJECT
106 QTimer::singleShot ( 50, this, SLOT(slotComposeMail() ) ); 106 QTimer::singleShot ( 50, this, SLOT(slotComposeMail() ) );
107 } else { 107 } else {
108 mPendingData = data; 108 mPendingData = data;
109 mPendingMessage = msg; 109 mPendingMessage = msg;
110 QTimer::singleShot ( 50, this, SLOT(slotExtAppHandler() ) ); 110 QTimer::singleShot ( 50, this, SLOT(slotExtAppHandler() ) );
111 } 111 }
112 112
113 //qDebug("END OpieMail::message "); 113 //qDebug("END OpieMail::message ");
114} 114}
115void OpieMail::slotExtAppHandler() 115void OpieMail::slotExtAppHandler()
116{ 116{
117 ExternalAppHandler::instance()->appMessage ( mPendingMessage, mPendingData ); 117 ExternalAppHandler::instance()->appMessage ( mPendingMessage, mPendingData );
118} 118}
119void OpieMail::slotwriteMail2(const QString& namemail ) 119void OpieMail::slotwriteMail2(const QString& namemail )
120{ 120{
121 //qDebug("OpieMail::slotwriteMail2 "); 121 //qDebug("OpieMail::slotwriteMail2 ");
122 //qApp->processEvents(); 122 //qApp->processEvents();
123 ComposeMail compose( settings, this, 0, true ); 123 ComposeMail compose( settings, this, 0, true );
124 if ( !namemail.isEmpty() ) { 124 if ( !namemail.isEmpty() ) {
125 QString to = namemail; 125 QString to = namemail;
126 if ( namemail.find( " <") > 1 ) { 126 if ( namemail.find( " <") > 1 ) {
127 to = "\"" +to.replace( QRegExp( " <"), "\" <") ; 127 to = "\"" +to.replace( QRegExp( " <"), "\" <") ;
128 } else 128 } else
129 if ( namemail.find( "<") > 1 ) { 129 if ( namemail.find( "<") > 1 ) {
130 to = "\"" +to.replace( QRegExp( "<"), "\" <") ; 130 to = "\"" +to.replace( QRegExp( "<"), "\" <") ;
131 } 131 }
132 int sub = to.find( ">:"); 132 int sub = to.find( ">:");
133 if ( sub > 0 ) { 133 if ( sub > 0 ) {
134 compose.setTo( to.left(sub+1) ); 134 compose.setTo( to.left(sub+1) );
135 compose.setSubject( to.mid(sub+2) ); 135 compose.setSubject( to.mid(sub+2) );
136 } else 136 } else
137 compose.setTo( to ); 137 compose.setTo( to );
138 } 138 }
139 compose.slotAdjustColumns(); 139 compose.slotAdjustColumns();
140#ifndef DESKTOP_VERSION 140#ifndef DESKTOP_VERSION
141 compose.showMaximized(); 141 compose.showMaximized();
142#endif 142#endif
143 mCurrentComposer = &compose; 143 mCurrentComposer = &compose;
144 compose.exec(); 144 compose.exec();
145 mCurrentComposer = 0; 145 mCurrentComposer = 0;
146 folderView->refreshOutgoing(); 146 folderView->refreshOutgoing();
147 raise(); 147 raise();
148 //qDebug("retttich "); 148 //qDebug("retttich ");
149} 149}
150void OpieMail::slotwriteMail(const QString&name,const QString&email) 150void OpieMail::slotwriteMail(const QString&name,const QString&email)
151{ 151{
152 // qDebug("OpieMail::slotwriteMail "); 152 // qDebug("OpieMail::slotwriteMail ");
153 ComposeMail compose( settings, this, 0, true ); 153 ComposeMail compose( settings, this, 0, true );
154 if (!email.isEmpty()) 154 if (!email.isEmpty())
155 { 155 {
156 if (!name.isEmpty()) 156 if (!name.isEmpty())
157 { 157 {
158 compose.setTo("\"" + name + "\"" + " " + "<"+ email + ">"); 158 compose.setTo("\"" + name + "\"" + " " + "<"+ email + ">");
159 } 159 }
160 else 160 else
161 { 161 {
162 compose.setTo(email); 162 compose.setTo(email);
163 } 163 }
164 } 164 }
165 compose.slotAdjustColumns(); 165 compose.slotAdjustColumns();
166#ifndef DESKTOP_VERSION 166#ifndef DESKTOP_VERSION
167 compose.showMaximized(); 167 compose.showMaximized();
168#endif 168#endif
169 169
170 mCurrentComposer = &compose; 170 mCurrentComposer = &compose;
171 compose.exec(); 171 compose.exec();
172 mCurrentComposer = 0; 172 mCurrentComposer = 0;
173 folderView->refreshOutgoing(); 173 folderView->refreshOutgoing();
174 raise(); 174 raise();
175} 175}
176 176
177void OpieMail::slotComposeMail() 177void OpieMail::slotComposeMail()
178{ 178{
179 if ( mPendingEmail == QString::null && mPendingName == QString::null) 179 if ( mPendingEmail == QString::null && mPendingName == QString::null)
180 slotwriteMail2( QString () ); 180 slotwriteMail2( QString () );
181 else { 181 else {
182 if ( mPendingEmail == QString::null ) 182 if ( mPendingEmail == QString::null )
183 slotwriteMail2( mPendingName ); 183 slotwriteMail2( mPendingName );
184 else 184 else
185 slotwriteMail( mPendingName, mPendingEmail ); 185 slotwriteMail( mPendingName, mPendingEmail );
186 } 186 }
187 //slotwriteMail(0l,0l); 187 //slotwriteMail(0l,0l);
188} 188}
189 189
190void OpieMail::slotSendQueued() 190void OpieMail::slotSendQueued()
191{ 191{
192 SMTPaccount *smtp = 0; 192 SMTPaccount *smtp = 0;
193 193
194 QList<Account> list = settings->getAccounts(); 194 QList<Account> list = settings->getAccounts();
195 QList<SMTPaccount> smtpList; 195 QList<SMTPaccount> smtpList;
196 smtpList.setAutoDelete(false); 196 smtpList.setAutoDelete(false);
197 Account *it; 197 Account *it;
198 for ( it = list.first(); it; it = list.next() ) 198 for ( it = list.first(); it; it = list.next() )
199 { 199 {
200 if ( it->getType() == MAILLIB::A_SMTP ) 200 if ( it->getType() == MAILLIB::A_SMTP )
201 { 201 {
202 smtp = static_cast<SMTPaccount *>(it); 202 smtp = static_cast<SMTPaccount *>(it);
203 smtpList.append(smtp); 203 smtpList.append(smtp);
204 } 204 }
205 } 205 }
206 if (smtpList.count()==0) 206 if (smtpList.count()==0)
207 { 207 {
208 QMessageBox::information(0,i18n("Info"),i18n("Define a smtp account first!\n")); 208 QMessageBox::information(0,i18n("Info"),i18n("Define a smtp\n account first!\n"));
209 return; 209 return;
210 } 210 }
211 if ( QMessageBox::warning(this, i18n("Sending all mails"), i18n("Do you really want to send\nall queued mails?" ) , QMessageBox::Yes, QMessageBox::No ) == QMessageBox::No ) 211 if ( QMessageBox::warning(this, i18n("Sending all mails"), i18n("Do you really want to\nsend all queued mails?" ) , QMessageBox::Yes, QMessageBox::No ) == QMessageBox::No )
212 return; 212 return;
213 if (smtpList.count()==1) 213 if (smtpList.count()==1)
214 { 214 {
215 smtp = smtpList.at(0); 215 smtp = smtpList.at(0);
216 } 216 }
217 else 217 else
218 { 218 {
219 smtp = 0; 219 smtp = 0;
220 selectsmtp selsmtp; 220 selectsmtp selsmtp;
221 selsmtp.setSelectionlist(&smtpList); 221 selsmtp.setSelectionlist(&smtpList);
222#ifndef DESKTOP_VERSION 222 selsmtp.resize( selsmtp.sizeHint() );
223 selsmtp.showMaximized();
224#endif
225 if ( selsmtp.exec() == QDialog::Accepted ) 223 if ( selsmtp.exec() == QDialog::Accepted )
226 { 224 {
227 smtp = selsmtp.selected_smtp(); 225 smtp = selsmtp.selected_smtp();
228 } 226 }
229 } 227 }
230 if (smtp) 228 if (smtp)
231 { 229 {
232 230
233 Global::statusMessage("Sending mails...!"); 231 Global::statusMessage("Sending mails...!");
234 SMTPwrapper * wrap = new SMTPwrapper(smtp); 232 SMTPwrapper * wrap = new SMTPwrapper(smtp);
235 if ( wrap->flushOutbox() ) 233 if ( wrap->flushOutbox() )
236 { 234 {
237 Global::statusMessage("Mails sent!"); 235 Global::statusMessage("Mails sent!");
238 } 236 }
239 delete wrap; 237 delete wrap;
240 } 238 }
241 folderView->refreshOutgoing(); 239 folderView->refreshOutgoing();
242} 240}
243 241
244void OpieMail::slotSearchMails() 242void OpieMail::slotSearchMails()
245{ 243{
246 qDebug("OpieMail::slotSearchMails():not implemented "); 244 qDebug("OpieMail::slotSearchMails():not implemented ");
247} 245}
248 246
249void OpieMail::slotEditSettings() 247void OpieMail::slotEditSettings()
250{ 248{
251 249
252 KOPrefsDialog settingsDialog( this, "koprefs", true ); 250 KOPrefsDialog settingsDialog( this, "koprefs", true );
253#ifndef DESKTOP_VERSION 251#ifndef DESKTOP_VERSION
254 settingsDialog.showMaximized(); 252 settingsDialog.showMaximized();
255#endif 253#endif
256 settingsDialog.exec(); 254 settingsDialog.exec();
257 255
258 slotSetCodec( KOPrefs::instance()->mCurrentCodec ); 256 slotSetCodec( KOPrefs::instance()->mCurrentCodec );
259 // KApplication::execDialog(settingsDialog); 257 // KApplication::execDialog(settingsDialog);
260} 258}
261 259
262void OpieMail::slotEditAccounts() 260void OpieMail::slotEditAccounts()
263{ 261{
264 EditAccounts eaDialog( settings, this, 0, true ); 262 EditAccounts eaDialog( settings, this, 0, true );
265 eaDialog.slotAdjustColumns(); 263 eaDialog.slotAdjustColumns();
266#ifndef DESKTOP_VERSION 264#ifndef DESKTOP_VERSION
267 eaDialog.showMaximized(); 265 eaDialog.showMaximized();
268#endif 266#endif
269 eaDialog.exec(); 267 eaDialog.exec();
270 if ( settings ) delete settings; 268 if ( settings ) delete settings;
271 settings = new Settings(); 269 settings = new Settings();
272 270
273 folderView->populate( settings->getAccounts() ); 271 folderView->populate( settings->getAccounts() );
274} 272}
275void OpieMail::replyMail() 273void OpieMail::replyMail()
276{ 274{
277 275
278 QListViewItem*item = mailView->currentItem(); 276 QListViewItem*item = mailView->currentItem();
279 if (!item) return; 277 if (!item) return;
280 RecMailP mail = ((MailListViewItem*)item)->data(); 278 RecMailP mail = ((MailListViewItem*)item)->data();
281 RecBodyP body = folderView->fetchBody(mail); 279 RecBodyP body = folderView->fetchBody(mail);
282 280
283 QString rtext; 281 QString rtext;
284 rtext += QString("* %1 wrote on %2:\n") // no i18n on purpose 282 rtext += QString("* %1 wrote on %2:\n") // no i18n on purpose
285 .arg( mail->getFrom()) 283 .arg( mail->getFrom())
286 .arg( mail->getDate()); 284 .arg( mail->getDate());
287 285
288 QString text = body->Bodytext(); 286 QString text = body->Bodytext();
289 QStringList lines = QStringList::split(QRegExp("\\n"), text); 287 QStringList lines = QStringList::split(QRegExp("\\n"), text);
290 QStringList::Iterator it; 288 QStringList::Iterator it;
291 for (it = lines.begin(); it != lines.end(); it++) 289 for (it = lines.begin(); it != lines.end(); it++)
292 { 290 {
293 rtext += "> " + *it + "\n"; 291 rtext += "> " + *it + "\n";
294 } 292 }
295 rtext += "\n"; 293 rtext += "\n";
296 294
297 QString prefix; 295 QString prefix;
298 if ( mail->getSubject().find(QRegExp("^Re: .*$")) != -1) prefix = ""; 296 if ( mail->getSubject().find(QRegExp("^Re: .*$")) != -1) prefix = "";
299 else prefix = "Re: "; // no i18n on purpose 297 else prefix = "Re: "; // no i18n on purpose
300 298
301 Settings *settings = new Settings(); 299 Settings *settings = new Settings();
302 ComposeMail composer( settings ,this, 0, true); 300 ComposeMail composer( settings ,this, 0, true);
303 if (mail->Replyto().isEmpty()) { 301 if (mail->Replyto().isEmpty()) {
304 composer.setTo( mail->getFrom()); 302 composer.setTo( mail->getFrom());
305 } else { 303 } else {
306 composer.setTo( mail->Replyto()); 304 composer.setTo( mail->Replyto());
307 } 305 }
308 composer.setSubject( prefix + mail->getSubject()); 306 composer.setSubject( prefix + mail->getSubject());
309 composer.setMessage( rtext ); 307 composer.setMessage( rtext );
310 composer.setInReplyTo( mail->Msgid()); 308 composer.setInReplyTo( mail->Msgid());
311 composer.setCharset( body->getCharset() ); 309 composer.setCharset( body->getCharset() );
312 310
313 mCurrentComposer = &composer; 311 mCurrentComposer = &composer;
314 if ( QDialog::Accepted == KApplication::execDialog( &composer ) ) 312 if ( QDialog::Accepted == KApplication::execDialog( &composer ) )
315 { 313 {
316 mail->Wrapper()->answeredMail(mail); 314 mail->Wrapper()->answeredMail(mail);
317 } 315 }
318 mCurrentComposer = 0; 316 mCurrentComposer = 0;
319 folderView->refreshOutgoing(); 317 folderView->refreshOutgoing();
320 delete settings; 318 delete settings;
321 319
322} 320}
323void OpieMail::closeViewMail(ViewMail * vm) 321void OpieMail::closeViewMail(ViewMail * vm)
324{ 322{
325 vm->hide(); 323 vm->hide();
326} 324}
327 325
328void OpieMail::slotDownloadMail( ) 326void OpieMail::slotDownloadMail( )
329{ 327{
330 QListViewItem*item = mailView->currentItem(); 328 QListViewItem*item = mailView->currentItem();
331 if (!item ) { 329 if (!item ) {
332 Global::statusMessage("Error: No item slected!"); 330 Global::statusMessage("Error: No item slected!");
333 return; 331 return;
334 } 332 }
335 RecMailP mail = ((MailListViewItem*)item)->data(); 333 RecMailP mail = ((MailListViewItem*)item)->data();
336 Account * acc = mail->Wrapper()->getAccount(); 334 Account * acc = mail->Wrapper()->getAccount();
337 if ( !acc ) { 335 if ( !acc ) {
338 Global::statusMessage("Mail is already stored locally!"); 336 Global::statusMessage("Mail is already stored locally!");
339 return; 337 return;
340 } 338 }
341 QString lfName = acc->getLocalFolder(); 339 QString lfName = acc->getLocalFolder();
342 //qDebug("local folder " + lfName ); 340 //qDebug("local folder " + lfName );
343 if ( lfName.isEmpty() ) 341 if ( lfName.isEmpty() )
344 lfName = acc->getAccountName(); 342 lfName = acc->getAccountName();
345 AbstractMail* targetMail = folderView->allAccounts()[0]->getWrapper(); 343 AbstractMail* targetMail = folderView->allAccounts()[0]->getWrapper();
346 //qDebug("target %d %d ",targetMail,mail->Wrapper() ); 344 //qDebug("target %d %d ",targetMail,mail->Wrapper() );
347 if ( targetMail == mail->Wrapper() ) { 345 if ( targetMail == mail->Wrapper() ) {
348 Global::statusMessage("Mail is already locally stored!"); 346 Global::statusMessage("Mail is already locally stored!");
349 return; 347 return;
350 } 348 }
351 if ( !targetMail->createMbox(lfName)) { 349 if ( !targetMail->createMbox(lfName)) {
352 Global::statusMessage("Error creating folder!"); 350 Global::statusMessage("Error creating folder!");
353 return; 351 return;
354 } 352 }
355 Global::statusMessage("Fetching mail...please wait!"); 353 Global::statusMessage("Fetching mail...please wait!");
356 qApp->processEvents(); 354 qApp->processEvents();
357 encodedString*st = 0; 355 encodedString*st = 0;
358 st = mail->Wrapper()->fetchRawBody(mail); 356 st = mail->Wrapper()->fetchRawBody(mail);
359 if ( st ) { 357 if ( st ) {
360 targetMail->storeMessage(st->Content(),st->Length(),lfName); 358 targetMail->storeMessage(st->Content(),st->Length(),lfName);
361 Global::statusMessage("Mail stored in "+ lfName); 359 Global::statusMessage("Mail stored in "+ lfName);
362 delete st; 360 delete st;
363 } else { 361 } else {
364 Global::statusMessage("Error: Cannot fetch mail!"); 362 Global::statusMessage("Error: Cannot fetch mail!");
365 } 363 }
366} 364}
367 365
368 366
369void OpieMail::deleteAndDisplayNextMail(ViewMail * vm) 367void OpieMail::deleteAndDisplayNextMail(ViewMail * vm)
370{ 368{
371 QListViewItem*item = mailView->currentItem(); 369 QListViewItem*item = mailView->currentItem();
372 if (!item ) { 370 if (!item ) {
373 closeViewMail(vm); 371 closeViewMail(vm);
374 return; 372 return;
375 } 373 }
376 RecMailP mail = ((MailListViewItem*)item)->data(); 374 RecMailP mail = ((MailListViewItem*)item)->data();
377 mail->Wrapper()->deleteMail( mail ); 375 mail->Wrapper()->deleteMail( mail );
378 item = item->itemBelow(); 376 item = item->itemBelow();
379 if (!item ) { 377 if (!item ) {
380 closeViewMail(vm); 378 closeViewMail(vm);
381 return; 379 return;
382 } 380 }
383 mailView->setCurrentItem(item); 381 mailView->setCurrentItem(item);
384 mail = ((MailListViewItem*)item)->data(); 382 mail = ((MailListViewItem*)item)->data();
385 RecBodyP body = folderView->fetchBody(mail); 383 RecBodyP body = folderView->fetchBody(mail);
386 vm->setBody( body ); 384 vm->setBody( body );
387 vm->setMail( mail ); 385 vm->setMail( mail );
388} 386}
389void OpieMail::displayNextMail(ViewMail * vm) 387void OpieMail::displayNextMail(ViewMail * vm)
390{ 388{
391 QListViewItem*item = mailView->currentItem(); 389 QListViewItem*item = mailView->currentItem();
392 if (!item) return; 390 if (!item) return;
393 ( (MailListViewItem*)item )->setPixmap( 0, QPixmap() ); 391 ( (MailListViewItem*)item )->setPixmap( 0, QPixmap() );
394 item = item->itemBelow(); 392 item = item->itemBelow();
395 if (!item) { 393 if (!item) {
396 vm->setCaption(i18n("End of List" )); 394 vm->setCaption(i18n("End of List" ));
397 return; 395 return;
398 } 396 }
399 mailView->setCurrentItem(item); 397 mailView->setCurrentItem(item);
400 RecMailP mail = ((MailListViewItem*)item)->data(); 398 RecMailP mail = ((MailListViewItem*)item)->data();
401 RecBodyP body = folderView->fetchBody(mail); 399 RecBodyP body = folderView->fetchBody(mail);
402 vm->setBody( body ); 400 vm->setBody( body );
403 vm->setMail( mail ); 401 vm->setMail( mail );
404} 402}
405void OpieMail::displayMail() 403void OpieMail::displayMail()
406{ 404{
407 QListViewItem*item = mailView->currentItem(); 405 QListViewItem*item = mailView->currentItem();
408 if (!item) return; 406 if (!item) return;
409 RecMailP mail = ((MailListViewItem*)item)->data(); 407 RecMailP mail = ((MailListViewItem*)item)->data();
410 RecBodyP body = folderView->fetchBody(mail); 408 RecBodyP body = folderView->fetchBody(mail);
411 ViewMail readMail( this,"", Qt::WType_Modal ); 409 ViewMail readMail( this,"", Qt::WType_Modal );
412 readMail.setBody( body ); 410 readMail.setBody( body );
413 readMail.setMail( mail ); 411 readMail.setMail( mail );
414#ifndef DESKTOP_VERSION 412#ifndef DESKTOP_VERSION
415 readMail.showMaximized(); 413 readMail.showMaximized();
416#else 414#else
417 readMail.resize( 640, 480); 415 readMail.resize( 640, 480);
418#endif 416#endif
419 connect( &readMail,SIGNAL( showNextMail(ViewMail *) ), this, SLOT( displayNextMail(ViewMail *) ) ); 417 connect( &readMail,SIGNAL( showNextMail(ViewMail *) ), this, SLOT( displayNextMail(ViewMail *) ) );
420 connect( &readMail,SIGNAL( deleteAndDisplayNextMail(ViewMail *) ), this, SLOT(deleteAndDisplayNextMail(ViewMail *) ) ); 418 connect( &readMail,SIGNAL( deleteAndDisplayNextMail(ViewMail *) ), this, SLOT(deleteAndDisplayNextMail(ViewMail *) ) );
421 connect( &readMail,SIGNAL( signalDownloadMail() ), this, SLOT( slotDownloadMail() ) ); 419 connect( &readMail,SIGNAL( signalDownloadMail() ), this, SLOT( slotDownloadMail() ) );
422 420
423 readMail.exec(); 421 readMail.exec();
424 422
425 if ( readMail.deleted ) 423 if ( readMail.deleted )
426 { 424 {
427 folderView->refreshCurrent(); 425 folderView->refreshCurrent();
428 } 426 }
429 else 427 else
430 { 428 {
431 QListViewItem*item = mailView->currentItem(); 429 QListViewItem*item = mailView->currentItem();
432 if (item) 430 if (item)
433 ( (MailListViewItem*)item )->setPixmap( 0, QPixmap() ); 431 ( (MailListViewItem*)item )->setPixmap( 0, QPixmap() );
434 } 432 }
435} 433}
436void OpieMail::slotGetAllMail() 434void OpieMail::slotGetAllMail()
437{ 435{
438 QListViewItem * item = folderView->firstChild(); 436 QListViewItem * item = folderView->firstChild();
439 while ( item ){ 437 while ( item ){
440 ((AccountViewItem *)item)->contextMenuSelected( 101 ); 438 ((AccountViewItem *)item)->contextMenuSelected( 101 );
441 item = item->nextSibling (); 439 item = item->nextSibling ();
442 } 440 }
443} 441}
444void OpieMail::slotGetMail() 442void OpieMail::slotGetMail()
445{ 443{
446 QListViewItem * item = folderView->currentItem(); 444 QListViewItem * item = folderView->currentItem();
447 if ( ! item ) return; 445 if ( ! item ) return;
448 ((AccountViewItem *)item)->contextMenuSelected( 101 ); 446 ((AccountViewItem *)item)->contextMenuSelected( 101 );
449} 447}
450void OpieMail::slotDeleteMail() 448void OpieMail::slotDeleteMail()
451{ 449{
452 if (!mailView->currentItem()) return; 450 if (!mailView->currentItem()) return;
453 RecMailP mail = ((MailListViewItem*)mailView->currentItem() )->data(); 451 RecMailP mail = ((MailListViewItem*)mailView->currentItem() )->data();
454 if ( QMessageBox::warning(this, i18n("Delete Mail"), QString( i18n("<p>Do you really want to delete this mail? <br><br>" ) + mail->getFrom() + " - " + mail->getSubject() ) , QMessageBox::Yes, QMessageBox::No ) == QMessageBox::Yes ) 452 if ( QMessageBox::warning(this, i18n("Delete Mail"), QString( i18n("<p>Do you really want to delete this mail? <br><br>" ) + mail->getFrom() + " - " + mail->getSubject() ) , QMessageBox::Yes, QMessageBox::No ) == QMessageBox::Yes )
455 { 453 {
456 mail->Wrapper()->deleteMail( mail ); 454 mail->Wrapper()->deleteMail( mail );
457 folderView->refreshCurrent(); 455 folderView->refreshCurrent();
458 } 456 }
459} 457}
460void OpieMail::slotDeleteAllMail() 458void OpieMail::slotDeleteAllMail()
461{ 459{
462 460
463 QValueList<RecMailP> t; 461 QValueList<RecMailP> t;
464 if ( QMessageBox::warning(this, i18n("Delete All Mails"), i18n("Do you really want to delete\nall selected mails?" ) , QMessageBox::Yes, QMessageBox::No ) == QMessageBox::Yes ) 462 if ( QMessageBox::warning(this, i18n("Delete All Mails"), i18n("Do you really want to delete\nall selected mails?" ) , QMessageBox::Yes, QMessageBox::No ) == QMessageBox::Yes )
465 { 463 {
466 MailListViewItem* item = (MailListViewItem*)mailView->firstChild (); 464 MailListViewItem* item = (MailListViewItem*)mailView->firstChild ();
467 while ( item ) { 465 while ( item ) {
468 if ( item->isSelected() ) { 466 if ( item->isSelected() ) {
469 t.append( item->data() ); 467 t.append( item->data() );
470 } 468 }
471 item = (MailListViewItem*)item->nextSibling(); 469 item = (MailListViewItem*)item->nextSibling();
472 } 470 }
473 } 471 }
474 else 472 else
475 return; 473 return;
476 if ( t.count() == 0 ) 474 if ( t.count() == 0 )
477 return; 475 return;
478 RecMailP mail = t.first(); 476 RecMailP mail = t.first();
479 mail->Wrapper()->deleteMailList(t); 477 mail->Wrapper()->deleteMailList(t);
480 folderView->refreshCurrent(); 478 folderView->refreshCurrent();
diff --git a/kmicromail/selectsmtp.cpp b/kmicromail/selectsmtp.cpp
index ff8b524..10b6d79 100644
--- a/kmicromail/selectsmtp.cpp
+++ b/kmicromail/selectsmtp.cpp
@@ -1,64 +1,64 @@
1#include "selectsmtp.h" 1#include "selectsmtp.h"
2#include <libmailwrapper/mailwrapper.h> 2#include <libmailwrapper/mailwrapper.h>
3 3
4#include <qcombobox.h> 4#include <qcombobox.h>
5#include <qcheckbox.h> 5#include <qcheckbox.h>
6#include <qmessagebox.h> 6#include <qmessagebox.h>
7#include <qpushbutton.h> 7#include <qpushbutton.h>
8#include <qlineedit.h> 8#include <qlineedit.h>
9#include <qlabel.h> 9#include <qlabel.h>
10#include <qtabwidget.h> 10#include <qtabwidget.h>
11#include <qlistview.h> 11#include <qlistview.h>
12#include <klocale.h> 12#include <klocale.h>
13selectsmtp::selectsmtp(QWidget* parent, const char* name, bool modal, WFlags fl) 13selectsmtp::selectsmtp(QWidget* parent, const char* name, bool modal, WFlags fl)
14 : selectstoreui(parent,name,modal,fl) 14 : selectstoreui(parent,name,modal,fl)
15{ 15{
16 //m_smtpList.setAutoDelete(false); 16 //m_smtpList.setAutoDelete(false);
17 m_smtpList = 0; 17 m_smtpList = 0;
18 //headlabel->setText(i18n("<center>Select SMTP account to use</center>")); 18 //headlabel->setText(i18n("<center>Select SMTP account to use</center>"));
19 headlabel->hide(); 19 headlabel->hide();
20 folderSelection->hide(); 20 folderSelection->hide();
21 folderLabel->hide(); 21 folderLabel->hide();
22 accountlabel->setText("<center>SMTP Accounts</center>"); 22 //accountlabel->setText(i18n("SMTP\nAccount:"));
23 Line1->hide(); 23 Line1->hide();
24 newFoldersel->hide(); 24 newFoldersel->hide();
25 newFolderedit->hide(); 25 newFolderedit->hide();
26 newFolderLabel->hide(); 26 newFolderLabel->hide();
27 Line2->hide(); 27 Line2->hide();
28 selMove->hide(); 28 selMove->hide();
29 m_current_smtp = 0; 29 m_current_smtp = 0;
30 setCaption(i18n("Select SMTP Account")); 30 setCaption(i18n("Select SMTP Account"));
31} 31}
32 32
33selectsmtp::~selectsmtp() 33selectsmtp::~selectsmtp()
34{ 34{
35} 35}
36 36
37void selectsmtp::slotAccountselected(int which) 37void selectsmtp::slotAccountselected(int which)
38{ 38{
39 if (!m_smtpList || (unsigned)which>=m_smtpList->count() || which < 0) { 39 if (!m_smtpList || (unsigned)which>=m_smtpList->count() || which < 0) {
40 m_current_smtp = 0; 40 m_current_smtp = 0;
41 return; 41 return;
42 } 42 }
43 m_current_smtp = m_smtpList->at(which); 43 m_current_smtp = m_smtpList->at(which);
44} 44}
45 45
46void selectsmtp::setSelectionlist(QList<SMTPaccount>*list) 46void selectsmtp::setSelectionlist(QList<SMTPaccount>*list)
47{ 47{
48 m_smtpList = list; 48 m_smtpList = list;
49 accountSelection->clear(); 49 accountSelection->clear();
50 if (!m_smtpList || m_smtpList->count()==0) { 50 if (!m_smtpList || m_smtpList->count()==0) {
51 accountSelection->setEnabled(false); 51 accountSelection->setEnabled(false);
52 return; 52 return;
53 } 53 }
54 accountSelection->setEnabled(true); 54 accountSelection->setEnabled(true);
55 for (unsigned i = 0; m_smtpList!=0 && i < m_smtpList->count(); ++i) { 55 for (unsigned i = 0; m_smtpList!=0 && i < m_smtpList->count(); ++i) {
56 accountSelection->insertItem( m_smtpList->at(i)->getAccountName()); 56 accountSelection->insertItem( m_smtpList->at(i)->getAccountName());
57 } 57 }
58 m_current_smtp = m_smtpList->at(0); 58 m_current_smtp = m_smtpList->at(0);
59} 59}
60 60
61SMTPaccount*selectsmtp::selected_smtp() 61SMTPaccount*selectsmtp::selected_smtp()
62{ 62{
63 return m_current_smtp; 63 return m_current_smtp;
64} 64}