Diffstat (limited to 'kmicromail/libmailwrapper/abstractmail.cpp') (more/less context) (ignore whitespace changes)
-rw-r--r-- | kmicromail/libmailwrapper/abstractmail.cpp | 30 |
1 files changed, 16 insertions, 14 deletions
diff --git a/kmicromail/libmailwrapper/abstractmail.cpp b/kmicromail/libmailwrapper/abstractmail.cpp index 870985e..746d2ae 100644 --- a/kmicromail/libmailwrapper/abstractmail.cpp +++ b/kmicromail/libmailwrapper/abstractmail.cpp | |||
@@ -5,19 +5,21 @@ | |||
5 | #include "nntpwrapper.h" | 5 | #include "nntpwrapper.h" |
6 | #include "mhwrapper.h" | 6 | #include "mhwrapper.h" |
7 | #include "mailtypes.h" | 7 | #include "mailtypes.h" |
8 | #include <qpe/global.h> | 8 | #include <qpe/global.h> |
9 | 9 | ||
10 | 10 | ||
11 | #include <qprogressbar.h> | 11 | #include <q3progressbar.h> |
12 | #include <qapplication.h> | 12 | #include <qapplication.h> |
13 | #include <qmessagebox.h> | 13 | #include <qmessagebox.h> |
14 | //Added by qt3to4: | ||
15 | #include <Q3ValueList> | ||
14 | #include <klocale.h> | 16 | #include <klocale.h> |
15 | #include <kdecore/kstandarddirs.h> | 17 | #include <kdecore/kstandarddirs.h> |
16 | #include <qfile.h> | 18 | #include <qfile.h> |
17 | #include <qtextstream.h> | 19 | #include <q3textstream.h> |
18 | #include <stdlib.h> | 20 | #include <stdlib.h> |
19 | #include <libetpan/mailmime_content.h> | 21 | #include <libetpan/mailmime_content.h> |
20 | #include <libetpan/mailmime.h> | 22 | #include <libetpan/mailmime.h> |
21 | 23 | ||
22 | using namespace Opie::Core; | 24 | using namespace Opie::Core; |
23 | AbstractMail* AbstractMail::getWrapper(IMAPaccount *a) | 25 | AbstractMail* AbstractMail::getWrapper(IMAPaccount *a) |
@@ -108,16 +110,16 @@ QString AbstractMail::convert_String(const char*text) | |||
108 | } | 110 | } |
109 | 111 | ||
110 | /* cp & paste from launcher */ | 112 | /* cp & paste from launcher */ |
111 | QString AbstractMail::gen_attachment_id() | 113 | QString AbstractMail::gen_attachment_id() |
112 | { | 114 | { |
113 | QFile file( "/proc/sys/kernel/random/uuid" ); | 115 | QFile file( "/proc/sys/kernel/random/uuid" ); |
114 | if (!file.open(IO_ReadOnly ) ) | 116 | if (!file.open(QIODevice::ReadOnly ) ) |
115 | return QString::null; | 117 | return QString::null; |
116 | 118 | ||
117 | QTextStream stream(&file); | 119 | Q3TextStream stream(&file); |
118 | 120 | ||
119 | return "{" + stream.read().stripWhiteSpace() + "}"; | 121 | return "{" + stream.read().stripWhiteSpace() + "}"; |
120 | } | 122 | } |
121 | 123 | ||
122 | int AbstractMail::createMbox(const QString&,const FolderP&,const QString& ,bool) | 124 | int AbstractMail::createMbox(const QString&,const FolderP&,const QString& ,bool) |
123 | { | 125 | { |
@@ -135,22 +137,22 @@ QString AbstractMail::defaultLocalfolder() | |||
135 | QString AbstractMail::draftFolder() | 137 | QString AbstractMail::draftFolder() |
136 | { | 138 | { |
137 | return QString("Drafts"); | 139 | return QString("Drafts"); |
138 | } | 140 | } |
139 | 141 | ||
140 | /* temporary - will be removed when implemented in all classes */ | 142 | /* temporary - will be removed when implemented in all classes */ |
141 | void AbstractMail::deleteMails(const QString &,const QValueList<Opie::Core::OSmartPointer<RecMail> > &) | 143 | void AbstractMail::deleteMails(const QString &,const Q3ValueList<Opie::Core::OSmartPointer<RecMail> > &) |
142 | { | 144 | { |
143 | } | 145 | } |
144 | void AbstractMail::deleteMailList(const QValueList<RecMailP>&target) | 146 | void AbstractMail::deleteMailList(const Q3ValueList<RecMailP>&target) |
145 | { | 147 | { |
146 | //qDebug("AbstractMail::deleteMailList:: Please reimplement! "); | 148 | //qDebug("AbstractMail::deleteMailList:: Please reimplement! "); |
147 | // this is currently re-implemented in pop3wrapper and imapwrapper | 149 | // this is currently re-implemented in pop3wrapper and imapwrapper |
148 | int iii = 0; | 150 | int iii = 0; |
149 | int count = target.count(); | 151 | int count = target.count(); |
150 | QProgressBar wid ( count ); | 152 | Q3ProgressBar wid ( count ); |
151 | wid.setCaption( i18n("Deleting ...")); | 153 | wid.setCaption( i18n("Deleting ...")); |
152 | wid.show(); | 154 | wid.show(); |
153 | while (iii < count ) { | 155 | while (iii < count ) { |
154 | Global::statusMessage(i18n("Delete message %1 of %2").arg(iii).arg(count)); | 156 | Global::statusMessage(i18n("Delete message %1 of %2").arg(iii).arg(count)); |
155 | wid.setProgress( iii ); | 157 | wid.setProgress( iii ); |
156 | wid.raise(); | 158 | wid.raise(); |
@@ -174,26 +176,26 @@ void AbstractMail::downloadNewMails(const FolderP&fromFolder, AbstractMail*targe | |||
174 | if ( !targetMail->createMbox(lfName)) | 176 | if ( !targetMail->createMbox(lfName)) |
175 | { | 177 | { |
176 | QMessageBox::critical(0,i18n("Error creating new Folder"), | 178 | QMessageBox::critical(0,i18n("Error creating new Folder"), |
177 | i18n("Error while creating new folder\n%1\n\nCancelling action.").arg(lfName)); | 179 | i18n("Error while creating new folder\n%1\n\nCancelling action.").arg(lfName)); |
178 | return; | 180 | return; |
179 | } | 181 | } |
180 | QValueList<RecMailP> t; | 182 | Q3ValueList<RecMailP> t; |
181 | listMessages(fromFolder->getName(),t,acc->getMaxMailSize() ); | 183 | listMessages(fromFolder->getName(),t,acc->getMaxMailSize() ); |
182 | if ( t.count() == 0 ) { | 184 | if ( t.count() == 0 ) { |
183 | qDebug("There are no new messages %s", fromFolder->getName().latin1()); | 185 | qDebug("There are no new messages %s", fromFolder->getName().latin1()); |
184 | Global::statusMessage(i18n("There are no new messages")); | 186 | Global::statusMessage(i18n("There are no new messages")); |
185 | return; | 187 | return; |
186 | } | 188 | } |
187 | Global::statusMessage(i18n("%1 :Downloading mails..."). arg(acc->getAccountName())); | 189 | Global::statusMessage(i18n("%1 :Downloading mails..."). arg(acc->getAccountName())); |
188 | qDebug(i18n("%1 :Downloading mails..."). arg(acc->getAccountName())); | 190 | qDebug(i18n("%1 :Downloading mails..."). arg(acc->getAccountName())); |
189 | qApp->processEvents(); | 191 | qApp->processEvents(); |
190 | QValueList<RecMailP> e; | 192 | Q3ValueList<RecMailP> e; |
191 | targetMail->listMessages(lfName,e,acc->getMaxMailSize() ); | 193 | targetMail->listMessages(lfName,e,acc->getMaxMailSize() ); |
192 | //qDebug("target has mails %d ", e.count()); | 194 | //qDebug("target has mails %d ", e.count()); |
193 | QValueList<RecMailP> n; | 195 | Q3ValueList<RecMailP> n; |
194 | int iii = 0; | 196 | int iii = 0; |
195 | int count = t.count(); | 197 | int count = t.count(); |
196 | while (iii < count ) { | 198 | while (iii < count ) { |
197 | RecMailP r = (*t.at( iii )); | 199 | RecMailP r = (*t.at( iii )); |
198 | bool found = false; | 200 | bool found = false; |
199 | int jjj = 0; | 201 | int jjj = 0; |
@@ -218,38 +220,38 @@ void AbstractMail::downloadNewMails(const FolderP&fromFolder, AbstractMail*targe | |||
218 | return; | 220 | return; |
219 | } | 221 | } |
220 | mvcpMailList( n,lfName,targetMail,!acc->getLeaveOnServer()); | 222 | mvcpMailList( n,lfName,targetMail,!acc->getLeaveOnServer()); |
221 | Global::statusMessage(i18n("Downloaded %1 messages").arg(n.count())); | 223 | Global::statusMessage(i18n("Downloaded %1 messages").arg(n.count())); |
222 | 224 | ||
223 | #if 0 | 225 | #if 0 |
224 | QValueList<RecMailP> t; | 226 | Q3ValueList<RecMailP> t; |
225 | listMessages(fromFolder->getName(),t, maxSizeInKb); | 227 | listMessages(fromFolder->getName(),t, maxSizeInKb); |
226 | mvcpMailList( t,targetFolder,targetWrapper,moveit); | 228 | mvcpMailList( t,targetFolder,targetWrapper,moveit); |
227 | #endif | 229 | #endif |
228 | 230 | ||
229 | } | 231 | } |
230 | void AbstractMail::mvcpAllMails(const FolderP&fromFolder, | 232 | void AbstractMail::mvcpAllMails(const FolderP&fromFolder, |
231 | const QString&targetFolder,AbstractMail*targetWrapper,bool moveit, int maxSizeInKb) | 233 | const QString&targetFolder,AbstractMail*targetWrapper,bool moveit, int maxSizeInKb) |
232 | { | 234 | { |
233 | QValueList<RecMailP> t; | 235 | Q3ValueList<RecMailP> t; |
234 | listMessages(fromFolder->getName(),t, maxSizeInKb); | 236 | listMessages(fromFolder->getName(),t, maxSizeInKb); |
235 | mvcpMailList( t,targetFolder,targetWrapper,moveit); | 237 | mvcpMailList( t,targetFolder,targetWrapper,moveit); |
236 | 238 | ||
237 | } | 239 | } |
238 | void AbstractMail::mvcpMailList(const QValueList<RecMailP>& t, | 240 | void AbstractMail::mvcpMailList(const Q3ValueList<RecMailP>& t, |
239 | const QString&targetFolder,AbstractMail*targetWrapper,bool moveit) | 241 | const QString&targetFolder,AbstractMail*targetWrapper,bool moveit) |
240 | { | 242 | { |
241 | encodedString*st = 0; | 243 | encodedString*st = 0; |
242 | int iii = 0; | 244 | int iii = 0; |
243 | int count = t.count(); | 245 | int count = t.count(); |
244 | if ( count == 0 ) | 246 | if ( count == 0 ) |
245 | return; | 247 | return; |
246 | // wel, processevents is qite strange, we need a widget for getting | 248 | // wel, processevents is qite strange, we need a widget for getting |
247 | // Global::statusMessage(i18n("Copy2 message %1").arg(iii)); displaye | 249 | // Global::statusMessage(i18n("Copy2 message %1").arg(iii)); displaye |
248 | 250 | ||
249 | QProgressBar wid ( count ); | 251 | Q3ProgressBar wid ( count ); |
250 | wid.setCaption( i18n("Copying...")); | 252 | wid.setCaption( i18n("Copying...")); |
251 | wid.show(); | 253 | wid.show(); |
252 | while (iii < count ) { | 254 | while (iii < count ) { |
253 | Global::statusMessage(i18n("Copy message %1 of %2").arg(iii).arg(count)); | 255 | Global::statusMessage(i18n("Copy message %1 of %2").arg(iii).arg(count)); |
254 | wid.setProgress( iii ); | 256 | wid.setProgress( iii ); |
255 | wid.raise(); | 257 | wid.raise(); |