author | zautrix <zautrix> | 2004-09-10 19:57:55 (UTC) |
---|---|---|
committer | zautrix <zautrix> | 2004-09-10 19:57:55 (UTC) |
commit | cebdd6de7481514ad5ea0517f7a2e8f4db422be5 (patch) (unidiff) | |
tree | 0b29859b5bbfdcb702724c3b0c721f22b0d0e666 /kmicromail/libmailwrapper/pop3wrapper.cpp | |
parent | 157120031b77a3d9f10d780a66b6441dac1399fa (diff) | |
download | kdepimpi-cebdd6de7481514ad5ea0517f7a2e8f4db422be5.zip kdepimpi-cebdd6de7481514ad5ea0517f7a2e8f4db422be5.tar.gz kdepimpi-cebdd6de7481514ad5ea0517f7a2e8f4db422be5.tar.bz2 |
Added status info when deleting mails
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 | |||
@@ -121,21 +121,21 @@ void POP3wrapper::login() | |||
121 | QString server,user, pass; | 121 | QString server,user, pass; |
122 | uint16_t port; | 122 | uint16_t port; |
123 | int err = MAILPOP3_NO_ERROR; | 123 | int err = MAILPOP3_NO_ERROR; |
124 | 124 | ||
125 | server = account->getServer().latin1(); | 125 | server = account->getServer().latin1(); |
126 | port = account->getPort().toUInt(); | 126 | port = account->getPort().toUInt(); |
127 | 127 | ||
128 | if ( account->getUser().isEmpty() || account->getPassword().isEmpty() ) { | 128 | if ( account->getUser().isEmpty() || account->getPassword().isEmpty() ) { |
129 | qApp->processEvents(); | ||
129 | LoginDialog login( account->getUser(), account->getPassword(), NULL, 0, true ); | 130 | LoginDialog login( account->getUser(), account->getPassword(), NULL, 0, true ); |
130 | login.show(); | 131 | login.show(); |
131 | if ( QDialog::Accepted == login.exec() ) { | 132 | if ( QDialog::Accepted == login.exec() ) { |
132 | // ok | 133 | // ok |
133 | qDebug("ok "); | ||
134 | user = login.getUser(); | 134 | user = login.getUser(); |
135 | pass = login.getPassword(); | 135 | pass = login.getPassword(); |
136 | } else { | 136 | } else { |
137 | // cancel | 137 | // cancel |
138 | ; // odebug << "POP3: Login canceled" << oendl; | 138 | ; // odebug << "POP3: Login canceled" << oendl; |
139 | return; | 139 | return; |
140 | } | 140 | } |
141 | } else { | 141 | } else { |
@@ -160,17 +160,17 @@ void POP3wrapper::login() | |||
160 | //(ssl?CONNECTION_TYPE_TLS:CONNECTION_TYPE_PLAIN); | 160 | //(ssl?CONNECTION_TYPE_TLS:CONNECTION_TYPE_PLAIN); |
161 | 161 | ||
162 | pop3_mailstorage_init(m_pop3,(char*)server.latin1(), port, NULL, conntype, POP3_AUTH_TYPE_PLAIN, | 162 | pop3_mailstorage_init(m_pop3,(char*)server.latin1(), port, NULL, conntype, POP3_AUTH_TYPE_PLAIN, |
163 | (char*)user.latin1(),(char*)pass.latin1(),0,0,0); | 163 | (char*)user.latin1(),(char*)pass.latin1(),0,0,0); |
164 | 164 | ||
165 | err = mailstorage_connect(m_pop3); | 165 | err = mailstorage_connect(m_pop3); |
166 | if (err != MAIL_NO_ERROR) { | 166 | if (err != MAIL_NO_ERROR) { |
167 | ; // odebug << QString( "FEHLERNUMMER %1" ).arg( err ) << oendl; | 167 | ; // odebug << QString( "FEHLERNUMMER %1" ).arg( err ) << oendl; |
168 | Global::statusMessage(tr("Error initializing folder")); | 168 | Global::statusMessage(tr("Error %1 initializing folder").arg( err )); |
169 | mailstorage_free(m_pop3); | 169 | mailstorage_free(m_pop3); |
170 | m_pop3 = 0; | 170 | m_pop3 = 0; |
171 | } else { | 171 | } else { |
172 | mailsession * session = m_pop3->sto_session; | 172 | mailsession * session = m_pop3->sto_session; |
173 | mailpop3 * mail = ( ( pop3_session_state_data * )session->sess_data )->pop3_session; | 173 | mailpop3 * mail = ( ( pop3_session_state_data * )session->sess_data )->pop3_session; |
174 | if (mail) { | 174 | if (mail) { |
175 | mail->pop3_progr_fun = &pop3_progress; | 175 | mail->pop3_progr_fun = &pop3_progress; |
176 | } | 176 | } |
@@ -195,34 +195,21 @@ QValueList<Opie::Core::OSmartPointer<Folder> >* POP3wrapper::listFolders() { | |||
195 | 195 | ||
196 | void POP3wrapper::deleteMailList(const QValueList<RecMailP>&target) | 196 | void POP3wrapper::deleteMailList(const QValueList<RecMailP>&target) |
197 | { | 197 | { |
198 | login(); | 198 | login(); |
199 | if (!m_pop3) | 199 | if (!m_pop3) |
200 | return; | 200 | return; |
201 | int iii = 0; | 201 | int iii = 0; |
202 | int count = target.count(); | 202 | int count = target.count(); |
203 | QProgressBar bar( count,0 ); | 203 | QWidget wid; |
204 | bar.setCaption (("Removing mails - close to abort!") ); | 204 | wid.show(); |
205 | int w = 300; | ||
206 | if ( QApplication::desktop()->width() < 320 ) | ||
207 | w = 220; | ||
208 | int h = bar.sizeHint().height() ; | ||
209 | int dw = QApplication::desktop()->width(); | ||
210 | int dh = QApplication::desktop()->height(); | ||
211 | bar.setGeometry( (dw-w)/2, (dh - h )/2 ,w,h ); | ||
212 | bar.show(); | ||
213 | int modulo = (count/10)+1; | ||
214 | int incCounter = 0; | ||
215 | while (iii < count ) { | 205 | while (iii < count ) { |
216 | if ( ! bar.isVisible() ) | 206 | Global::statusMessage(tr("Delete message %1 of %2").arg(iii).arg(count)); |
217 | return ; | 207 | wid.raise(); |
218 | if ( incCounter % modulo == 0 ) | ||
219 | bar.setProgress( incCounter ); | ||
220 | ++incCounter; | ||
221 | qApp->processEvents(); | 208 | qApp->processEvents(); |
222 | //qDebug("delete "); | 209 | //qDebug("delete "); |
223 | RecMailP mail = (*target.at( iii )); | 210 | RecMailP mail = (*target.at( iii )); |
224 | int err = mailsession_remove_message(m_pop3->sto_session,mail->getNumber()); | 211 | int err = mailsession_remove_message(m_pop3->sto_session,mail->getNumber()); |
225 | if (err != MAIL_NO_ERROR) { | 212 | if (err != MAIL_NO_ERROR) { |
226 | Global::statusMessage(tr("Error deleting mail")); | 213 | Global::statusMessage(tr("Error deleting mail")); |
227 | } | 214 | } |
228 | ++iii; | 215 | ++iii; |
@@ -247,35 +234,23 @@ int POP3wrapper::deleteAllMail(const FolderP&) { | |||
247 | int res = 1; | 234 | int res = 1; |
248 | 235 | ||
249 | uint32_t result = 0; | 236 | uint32_t result = 0; |
250 | int err = mailsession_messages_number(m_pop3->sto_session,NULL,&result); | 237 | int err = mailsession_messages_number(m_pop3->sto_session,NULL,&result); |
251 | if (err != MAIL_NO_ERROR) { | 238 | if (err != MAIL_NO_ERROR) { |
252 | Global::statusMessage(tr("Error getting folder info")); | 239 | Global::statusMessage(tr("Error getting folder info")); |
253 | return 0; | 240 | return 0; |
254 | } | 241 | } |
255 | QProgressBar bar( result,0 ); | 242 | QWidget wid; |
256 | bar.setCaption (("Deleting mails - close to abort!") ); | 243 | wid.show(); |
257 | int w = 300; | 244 | for (unsigned int i = 0; i < result; ++i) { |
258 | if ( QApplication::desktop()->width() < 320 ) | 245 | Global::statusMessage(tr("Delete message %1 of %2").arg(i).arg(result)); |
259 | w = 220; | 246 | wid.raise(); |
260 | int h = bar.sizeHint().height() ; | ||
261 | int dw = QApplication::desktop()->width(); | ||
262 | int dh = QApplication::desktop()->height(); | ||
263 | bar.setGeometry( (dw-w)/2, (dh - h )/2 ,w,h ); | ||
264 | bar.show(); | ||
265 | int modulo = (result/10)+1; | ||
266 | int incCounter = 0; | ||
267 | for (unsigned int i = 0; i < result; ++i) { | ||
268 | if ( ! bar.isVisible() ) | ||
269 | return 0; | ||
270 | if ( incCounter % modulo == 0 ) | ||
271 | bar.setProgress( incCounter ); | ||
272 | ++incCounter; | ||
273 | qApp->processEvents(); | 247 | qApp->processEvents(); |
248 | |||
274 | err = mailsession_remove_message(m_pop3->sto_session,i+1); | 249 | err = mailsession_remove_message(m_pop3->sto_session,i+1); |
275 | if (err != MAIL_NO_ERROR) { | 250 | if (err != MAIL_NO_ERROR) { |
276 | Global::statusMessage(tr("Error deleting mail %1").arg(i+1)); | 251 | Global::statusMessage(tr("Error deleting mail %1").arg(i+1)); |
277 | res=0; | 252 | res=0; |
278 | } | 253 | } |
279 | break; | 254 | break; |
280 | } | 255 | } |
281 | return res; | 256 | return res; |