author | zautrix <zautrix> | 2004-09-01 10:23:29 (UTC) |
---|---|---|
committer | zautrix <zautrix> | 2004-09-01 10:23:29 (UTC) |
commit | 6cefbdc9c8f3f3001373f10715361e2740c45395 (patch) (unidiff) | |
tree | cb2c36f57620e698913c27ca4ebe59e4a7c9d46e /kmicromail/libmailwrapper | |
parent | b9257cb225cd29bab5d96fcdaf557926603ee587 (diff) | |
download | kdepimpi-6cefbdc9c8f3f3001373f10715361e2740c45395.zip kdepimpi-6cefbdc9c8f3f3001373f10715361e2740c45395.tar.gz kdepimpi-6cefbdc9c8f3f3001373f10715361e2740c45395.tar.bz2 |
Mail fixes and libetpan updated
-rw-r--r-- | kmicromail/libmailwrapper/abstractmail.cpp | 58 | ||||
-rw-r--r-- | kmicromail/libmailwrapper/imapwrapper.cpp | 46 | ||||
-rw-r--r-- | kmicromail/libmailwrapper/pop3wrapper.cpp | 47 | ||||
-rw-r--r-- | kmicromail/libmailwrapper/pop3wrapper.h | 2 |
4 files changed, 136 insertions, 17 deletions
diff --git a/kmicromail/libmailwrapper/abstractmail.cpp b/kmicromail/libmailwrapper/abstractmail.cpp index 3998abd..3b0ca1f 100644 --- a/kmicromail/libmailwrapper/abstractmail.cpp +++ b/kmicromail/libmailwrapper/abstractmail.cpp | |||
@@ -8,4 +8,6 @@ | |||
8 | 8 | ||
9 | 9 | ||
10 | #include <qprogressbar.h> | ||
11 | #include <qapplication.h> | ||
10 | 12 | ||
11 | #include <kdecore/kstandarddirs.h> | 13 | #include <kdecore/kstandarddirs.h> |
@@ -141,6 +143,31 @@ void AbstractMail::deleteMails(const QString &,const QValueList<Opie::Core::OSma | |||
141 | void AbstractMail::deleteMailList(const QValueList<RecMailP>&target) | 143 | void AbstractMail::deleteMailList(const QValueList<RecMailP>&target) |
142 | { | 144 | { |
143 | qDebug("AbstractMail::deleteMailList:: Please reimplement! "); | 145 | //qDebug("AbstractMail::deleteMailList:: Please reimplement! "); |
144 | 146 | // this is currently re-implemented in pop3wrapper and imapwrapper | |
147 | int iii = 0; | ||
148 | int count = target.count(); | ||
149 | QProgressBar bar( count,0 ); | ||
150 | bar.setCaption (("Removing mails - close to abort!") ); | ||
151 | int w = 300; | ||
152 | if ( QApplication::desktop()->width() < 320 ) | ||
153 | w = 220; | ||
154 | int h = bar.sizeHint().height() ; | ||
155 | int dw = QApplication::desktop()->width(); | ||
156 | int dh = QApplication::desktop()->height(); | ||
157 | bar.setGeometry( (dw-w)/2, (dh - h )/2 ,w,h ); | ||
158 | bar.show(); | ||
159 | int modulo = (count/10)+1; | ||
160 | int incCounter = 0; | ||
161 | while (iii < count ) { | ||
162 | if ( ! bar.isVisible() ) | ||
163 | return ; | ||
164 | if ( incCounter % modulo == 0 ) | ||
165 | bar.setProgress( incCounter ); | ||
166 | ++incCounter; | ||
167 | qApp->processEvents(); | ||
168 | RecMailP mail = (*target.at( iii )); | ||
169 | deleteMail(mail); | ||
170 | ++iii; | ||
171 | } | ||
145 | } | 172 | } |
146 | void AbstractMail::mvcpAllMails(const FolderP&fromFolder, | 173 | void AbstractMail::mvcpAllMails(const FolderP&fromFolder, |
@@ -155,9 +182,31 @@ void AbstractMail::mvcpMailList(const QValueList<RecMailP>& t, | |||
155 | const QString&targetFolder,AbstractMail*targetWrapper,bool moveit) | 182 | const QString&targetFolder,AbstractMail*targetWrapper,bool moveit) |
156 | { | 183 | { |
157 | |||
158 | encodedString*st = 0; | 184 | encodedString*st = 0; |
159 | int iii = 0; | 185 | int iii = 0; |
160 | int count = t.count(); | 186 | int count = t.count(); |
187 | if ( count == 0 ) | ||
188 | return; | ||
189 | |||
190 | QProgressBar bar( count,0 ); | ||
191 | bar.setCaption (("Copying mails - close to abort!") ); | ||
192 | int w = 300; | ||
193 | if ( QApplication::desktop()->width() < 320 ) | ||
194 | w = 220; | ||
195 | int h = bar.sizeHint().height() ; | ||
196 | int dw = QApplication::desktop()->width(); | ||
197 | int dh = QApplication::desktop()->height(); | ||
198 | bar.setGeometry( (dw-w)/2, (dh - h )/2 ,w,h ); | ||
199 | bar.show(); | ||
200 | int modulo = (count/10)+1; | ||
201 | int incCounter = 0; | ||
161 | while (iii < count ) { | 202 | while (iii < count ) { |
203 | if ( ! bar.isVisible() ) | ||
204 | return ; | ||
205 | if ( incCounter % modulo == 0 ) | ||
206 | bar.setProgress( incCounter ); | ||
207 | ++incCounter; | ||
208 | bar.raise(); | ||
209 | qApp->processEvents(); | ||
210 | //qDebug("copy "); | ||
162 | RecMailP r = (*t.at( iii )); | 211 | RecMailP r = (*t.at( iii )); |
163 | st = fetchRawBody(r); | 212 | st = fetchRawBody(r); |
@@ -167,5 +216,6 @@ void AbstractMail::mvcpMailList(const QValueList<RecMailP>& t, | |||
167 | } | 216 | } |
168 | ++iii; | 217 | ++iii; |
169 | } | 218 | } |
219 | bar.hide(); | ||
170 | if (moveit) { | 220 | if (moveit) { |
171 | deleteMailList( t ); | 221 | deleteMailList( t ); |
diff --git a/kmicromail/libmailwrapper/imapwrapper.cpp b/kmicromail/libmailwrapper/imapwrapper.cpp index bb8bbfc..11d3343 100644 --- a/kmicromail/libmailwrapper/imapwrapper.cpp +++ b/kmicromail/libmailwrapper/imapwrapper.cpp | |||
@@ -7,4 +7,5 @@ | |||
7 | #include "mailtypes.h" | 7 | #include "mailtypes.h" |
8 | #include "logindialog.h" | 8 | #include "logindialog.h" |
9 | #include <qprogressbar.h> | ||
9 | 10 | ||
10 | using namespace Opie::Core; | 11 | using namespace Opie::Core; |
@@ -872,4 +873,5 @@ void IMAPwrapper::fillBodyFields(RecPartP&target_part,mailimap_body_fields*which | |||
872 | void IMAPwrapper::deleteMailList(const QValueList<RecMailP>&target) | 873 | void IMAPwrapper::deleteMailList(const QValueList<RecMailP>&target) |
873 | { | 874 | { |
875 | //#if 0 | ||
874 | mailimap_flag_list*flist; | 876 | mailimap_flag_list*flist; |
875 | mailimap_set *set; | 877 | mailimap_set *set; |
@@ -877,4 +879,5 @@ void IMAPwrapper::deleteMailList(const QValueList<RecMailP>&target) | |||
877 | int err; | 879 | int err; |
878 | login(); | 880 | login(); |
881 | //#endif | ||
879 | if (!m_imap) { | 882 | if (!m_imap) { |
880 | return; | 883 | return; |
@@ -882,9 +885,29 @@ void IMAPwrapper::deleteMailList(const QValueList<RecMailP>&target) | |||
882 | int iii = 0; | 885 | int iii = 0; |
883 | int count = target.count(); | 886 | int count = target.count(); |
884 | qDebug("imap remove count %d ", count); | 887 | // qDebug("imap remove count %d ", count); |
888 | |||
889 | QProgressBar bar( count,0 ); | ||
890 | bar.setCaption (("Removing mails - close to abort!") ); | ||
891 | int w = 300; | ||
892 | if ( QApplication::desktop()->width() < 320 ) | ||
893 | w = 220; | ||
894 | int h = bar.sizeHint().height() ; | ||
895 | int dw = QApplication::desktop()->width(); | ||
896 | int dh = QApplication::desktop()->height(); | ||
897 | bar.setGeometry( (dw-w)/2, (dh - h )/2 ,w,h ); | ||
898 | bar.show(); | ||
899 | int modulo = (count/10)+1; | ||
900 | int incCounter = 0; | ||
901 | |||
885 | while (iii < count ) { | 902 | while (iii < count ) { |
886 | qDebug("IMAP remove %d ", iii); | 903 | if ( ! bar.isVisible() ) |
904 | return ; | ||
905 | if ( incCounter % modulo == 0 ) | ||
906 | bar.setProgress( incCounter ); | ||
907 | ++incCounter; | ||
908 | qApp->processEvents(); | ||
887 | RecMailP mail = (*target.at( iii )); | 909 | RecMailP mail = (*target.at( iii )); |
888 | 910 | //#if 0 | |
911 | //qDebug("IMAP remove %d %d ", iii, mail->getNumber() ); | ||
889 | err = selectMbox(mail->getMbox()); | 912 | err = selectMbox(mail->getMbox()); |
890 | if ( err != MAILIMAP_NO_ERROR ) { | 913 | if ( err != MAILIMAP_NO_ERROR ) { |
@@ -906,10 +929,17 @@ void IMAPwrapper::deleteMailList(const QValueList<RecMailP>&target) | |||
906 | /* should we realy do that at this moment? */ | 929 | /* should we realy do that at this moment? */ |
907 | 930 | ||
931 | // err = mailimap_expunge(m_imap); | ||
932 | //if (err != MAILIMAP_NO_ERROR) { | ||
933 | // Global::statusMessage(tr("Error deleting mails: %s").arg(m_imap->imap_response)); | ||
934 | // } | ||
935 | //#endif | ||
936 | //deleteMail( mail); | ||
937 | ++iii; | ||
938 | } | ||
939 | //qDebug("Deleting imap mails... "); | ||
908 | err = mailimap_expunge(m_imap); | 940 | err = mailimap_expunge(m_imap); |
909 | if (err != MAILIMAP_NO_ERROR) { | 941 | if (err != MAILIMAP_NO_ERROR) { |
910 | Global::statusMessage(tr("error deleting mail: %s").arg(m_imap->imap_response)); | 942 | Global::statusMessage(tr("Error deleting mails: %s").arg(m_imap->imap_response)); |
911 | } | 943 | } |
912 | ++iii; | ||
913 | } | ||
914 | } | 944 | } |
915 | void IMAPwrapper::deleteMail(const RecMailP&mail) | 945 | void IMAPwrapper::deleteMail(const RecMailP&mail) |
@@ -946,5 +976,5 @@ void IMAPwrapper::deleteMail(const RecMailP&mail) | |||
946 | Global::statusMessage(tr("error deleting mail: %s").arg(m_imap->imap_response)); | 976 | Global::statusMessage(tr("error deleting mail: %s").arg(m_imap->imap_response)); |
947 | } | 977 | } |
948 | qDebug("IMAPwrapper::deleteMail "); | 978 | //qDebug("IMAPwrapper::deleteMail 2"); |
949 | 979 | ||
950 | } | 980 | } |
@@ -1190,5 +1220,5 @@ void IMAPwrapper::mvcpAllMails(const FolderP&fromFolder, | |||
1190 | mailimap_set_free( set ); | 1220 | mailimap_set_free( set ); |
1191 | if ( err != MAILIMAP_NO_ERROR ) { | 1221 | if ( err != MAILIMAP_NO_ERROR ) { |
1192 | QString error_msg = tr("error copy mails: %1").arg(m_imap->imap_response); | 1222 | QString error_msg = tr("Error copy mails: %1").arg(m_imap->imap_response); |
1193 | Global::statusMessage(error_msg); | 1223 | Global::statusMessage(error_msg); |
1194 | // odebug << error_msg << oendl; | 1224 | // odebug << error_msg << oendl; |
diff --git a/kmicromail/libmailwrapper/pop3wrapper.cpp b/kmicromail/libmailwrapper/pop3wrapper.cpp index 7a84b30..0e6612c 100644 --- a/kmicromail/libmailwrapper/pop3wrapper.cpp +++ b/kmicromail/libmailwrapper/pop3wrapper.cpp | |||
@@ -9,4 +9,6 @@ | |||
9 | #include <qpe/global.h> | 9 | #include <qpe/global.h> |
10 | #include <qfile.h> | 10 | #include <qfile.h> |
11 | #include <qprogressbar.h> | ||
12 | #include <qapplication.h> | ||
11 | 13 | ||
12 | /* we don't fetch messages larger than 5 MB */ | 14 | /* we don't fetch messages larger than 5 MB */ |
@@ -194,5 +196,5 @@ QValueList<Opie::Core::OSmartPointer<Folder> >* POP3wrapper::listFolders() { | |||
194 | } | 196 | } |
195 | 197 | ||
196 | void POP3wrapper::deleteMailList(QValueList<RecMailP>&target) | 198 | void POP3wrapper::deleteMailList(const QValueList<RecMailP>&target) |
197 | { | 199 | { |
198 | login(); | 200 | login(); |
@@ -200,10 +202,29 @@ void POP3wrapper::deleteMailList(QValueList<RecMailP>&target) | |||
200 | return; | 202 | return; |
201 | int iii = 0; | 203 | int iii = 0; |
202 | int count = target.count(); | 204 | int count = target.count(); |
203 | while (iii < count ) { | 205 | QProgressBar bar( count,0 ); |
206 | bar.setCaption (("Removing mails - close to abort!") ); | ||
207 | int w = 300; | ||
208 | if ( QApplication::desktop()->width() < 320 ) | ||
209 | w = 220; | ||
210 | int h = bar.sizeHint().height() ; | ||
211 | int dw = QApplication::desktop()->width(); | ||
212 | int dh = QApplication::desktop()->height(); | ||
213 | bar.setGeometry( (dw-w)/2, (dh - h )/2 ,w,h ); | ||
214 | bar.show(); | ||
215 | int modulo = (count/10)+1; | ||
216 | int incCounter = 0; | ||
217 | while (iii < count ) { | ||
218 | if ( ! bar.isVisible() ) | ||
219 | return ; | ||
220 | if ( incCounter % modulo == 0 ) | ||
221 | bar.setProgress( incCounter ); | ||
222 | ++incCounter; | ||
223 | qApp->processEvents(); | ||
224 | //qDebug("delete "); | ||
204 | RecMailP mail = (*target.at( iii )); | 225 | RecMailP mail = (*target.at( iii )); |
205 | int err = mailsession_remove_message(m_pop3->sto_session,mail->getNumber()); | 226 | int err = mailsession_remove_message(m_pop3->sto_session,mail->getNumber()); |
206 | if (err != MAIL_NO_ERROR) { | 227 | if (err != MAIL_NO_ERROR) { |
207 | Global::statusMessage(tr("error deleting mail")); | 228 | Global::statusMessage(tr("Error deleting mail")); |
208 | } | 229 | } |
209 | ++iii; | 230 | ++iii; |
@@ -234,5 +255,23 @@ int POP3wrapper::deleteAllMail(const FolderP&) { | |||
234 | return 0; | 255 | return 0; |
235 | } | 256 | } |
257 | QProgressBar bar( result,0 ); | ||
258 | bar.setCaption (("Deleting mails - close to abort!") ); | ||
259 | int w = 300; | ||
260 | if ( QApplication::desktop()->width() < 320 ) | ||
261 | w = 220; | ||
262 | int h = bar.sizeHint().height() ; | ||
263 | int dw = QApplication::desktop()->width(); | ||
264 | int dh = QApplication::desktop()->height(); | ||
265 | bar.setGeometry( (dw-w)/2, (dh - h )/2 ,w,h ); | ||
266 | bar.show(); | ||
267 | int modulo = (result/10)+1; | ||
268 | int incCounter = 0; | ||
236 | for (unsigned int i = 0; i < result; ++i) { | 269 | for (unsigned int i = 0; i < result; ++i) { |
270 | if ( ! bar.isVisible() ) | ||
271 | return 0; | ||
272 | if ( incCounter % modulo == 0 ) | ||
273 | bar.setProgress( incCounter ); | ||
274 | ++incCounter; | ||
275 | qApp->processEvents(); | ||
237 | err = mailsession_remove_message(m_pop3->sto_session,i+1); | 276 | err = mailsession_remove_message(m_pop3->sto_session,i+1); |
238 | if (err != MAIL_NO_ERROR) { | 277 | if (err != MAIL_NO_ERROR) { |
diff --git a/kmicromail/libmailwrapper/pop3wrapper.h b/kmicromail/libmailwrapper/pop3wrapper.h index ee754a4..7c70942 100644 --- a/kmicromail/libmailwrapper/pop3wrapper.h +++ b/kmicromail/libmailwrapper/pop3wrapper.h | |||
@@ -25,6 +25,6 @@ public: | |||
25 | 25 | ||
26 | virtual void deleteMail(const RecMailP&mail); | 26 | virtual void deleteMail(const RecMailP&mail); |
27 | virtual void deleteMailList(const QValueList<RecMailP>&target); | ||
27 | virtual void answeredMail(const RecMailP&mail); | 28 | virtual void answeredMail(const RecMailP&mail); |
28 | virtual void deleteMailList(QValueList<RecMailP>&target); | ||
29 | virtual int deleteAllMail(const Opie::Core::OSmartPointer<Folder>&); | 29 | virtual int deleteAllMail(const Opie::Core::OSmartPointer<Folder>&); |
30 | 30 | ||