Diffstat (limited to 'kmicromail/libmailwrapper/pop3wrapper.cpp') (more/less context) (ignore whitespace changes)
-rw-r--r-- | kmicromail/libmailwrapper/pop3wrapper.cpp | 49 |
1 files changed, 12 insertions, 37 deletions
diff --git a/kmicromail/libmailwrapper/pop3wrapper.cpp b/kmicromail/libmailwrapper/pop3wrapper.cpp index f430121..8d2f778 100644 --- a/kmicromail/libmailwrapper/pop3wrapper.cpp +++ b/kmicromail/libmailwrapper/pop3wrapper.cpp @@ -117,29 +117,29 @@ void POP3wrapper::login() /* we'll hold the line */ if ( m_pop3 != NULL ) return; QString server,user, pass; uint16_t port; int err = MAILPOP3_NO_ERROR; server = account->getServer().latin1(); port = account->getPort().toUInt(); if ( account->getUser().isEmpty() || account->getPassword().isEmpty() ) { + qApp->processEvents(); LoginDialog login( account->getUser(), account->getPassword(), NULL, 0, true ); login.show(); if ( QDialog::Accepted == login.exec() ) { // ok - qDebug("ok "); user = login.getUser(); pass = login.getPassword(); } else { // cancel ; // odebug << "POP3: Login canceled" << oendl; return; } } else { user = account->getUser(); pass = account->getPassword(); } // bool ssl = account->getSSL(); @@ -156,25 +156,25 @@ void POP3wrapper::login() } else if ( conntypeset == 0 ) { conntype = CONNECTION_TYPE_TRY_STARTTLS; } //(ssl?CONNECTION_TYPE_TLS:CONNECTION_TYPE_PLAIN); pop3_mailstorage_init(m_pop3,(char*)server.latin1(), port, NULL, conntype, POP3_AUTH_TYPE_PLAIN, (char*)user.latin1(),(char*)pass.latin1(),0,0,0); err = mailstorage_connect(m_pop3); if (err != MAIL_NO_ERROR) { ; // odebug << QString( "FEHLERNUMMER %1" ).arg( err ) << oendl; - Global::statusMessage(tr("Error initializing folder")); + Global::statusMessage(tr("Error %1 initializing folder").arg( err )); mailstorage_free(m_pop3); m_pop3 = 0; } else { mailsession * session = m_pop3->sto_session; mailpop3 * mail = ( ( pop3_session_state_data * )session->sess_data )->pop3_session; if (mail) { mail->pop3_progr_fun = &pop3_progress; } } } void POP3wrapper::logout() @@ -191,42 +191,29 @@ QValueList<Opie::Core::OSmartPointer<Folder> >* POP3wrapper::listFolders() { FolderP inb=new Folder("INBOX","/"); folders->append(inb); return folders; } void POP3wrapper::deleteMailList(const QValueList<RecMailP>&target) { login(); if (!m_pop3) return; int iii = 0; int count = target.count(); - QProgressBar bar( count,0 ); - bar.setCaption (("Removing mails - close to abort!") ); - int w = 300; - if ( QApplication::desktop()->width() < 320 ) - w = 220; - int h = bar.sizeHint().height() ; - int dw = QApplication::desktop()->width(); - int dh = QApplication::desktop()->height(); - bar.setGeometry( (dw-w)/2, (dh - h )/2 ,w,h ); - bar.show(); - int modulo = (count/10)+1; - int incCounter = 0; + QWidget wid; + wid.show(); while (iii < count ) { - if ( ! bar.isVisible() ) - return ; - if ( incCounter % modulo == 0 ) - bar.setProgress( incCounter ); - ++incCounter; + Global::statusMessage(tr("Delete message %1 of %2").arg(iii).arg(count)); + wid.raise(); qApp->processEvents(); //qDebug("delete "); RecMailP mail = (*target.at( iii )); int err = mailsession_remove_message(m_pop3->sto_session,mail->getNumber()); if (err != MAIL_NO_ERROR) { Global::statusMessage(tr("Error deleting mail")); } ++iii; } } void POP3wrapper::deleteMail(const RecMailP&mail) { login(); @@ -243,43 +230,31 @@ void POP3wrapper::answeredMail(const RecMailP&) {} int POP3wrapper::deleteAllMail(const FolderP&) { login(); if (!m_pop3) return 0; int res = 1; uint32_t result = 0; int err = mailsession_messages_number(m_pop3->sto_session,NULL,&result); if (err != MAIL_NO_ERROR) { Global::statusMessage(tr("Error getting folder info")); return 0; } - QProgressBar bar( result,0 ); - bar.setCaption (("Deleting mails - close to abort!") ); - int w = 300; - if ( QApplication::desktop()->width() < 320 ) - w = 220; - int h = bar.sizeHint().height() ; - int dw = QApplication::desktop()->width(); - int dh = QApplication::desktop()->height(); - bar.setGeometry( (dw-w)/2, (dh - h )/2 ,w,h ); - bar.show(); - int modulo = (result/10)+1; - int incCounter = 0; - for (unsigned int i = 0; i < result; ++i) { - if ( ! bar.isVisible() ) - return 0; - if ( incCounter % modulo == 0 ) - bar.setProgress( incCounter ); - ++incCounter; + QWidget wid; + wid.show(); + for (unsigned int i = 0; i < result; ++i) { + Global::statusMessage(tr("Delete message %1 of %2").arg(i).arg(result)); + wid.raise(); qApp->processEvents(); + err = mailsession_remove_message(m_pop3->sto_session,i+1); if (err != MAIL_NO_ERROR) { Global::statusMessage(tr("Error deleting mail %1").arg(i+1)); res=0; } break; } return res; } void POP3wrapper::statusFolder(folderStat&target_stat,const QString&) { login(); |