author | zautrix <zautrix> | 2004-09-16 15:13:40 (UTC) |
---|---|---|
committer | zautrix <zautrix> | 2004-09-16 15:13:40 (UTC) |
commit | 02e7ae4983679a787834277176a031286a8310c2 (patch) (unidiff) | |
tree | ea7e33e59b86b8fed2b033609d1018a9f245baff /kmicromail | |
parent | 68b1f3bce4b6e89bb343b965256537d93e63f7be (diff) | |
download | kdepimpi-02e7ae4983679a787834277176a031286a8310c2.zip kdepimpi-02e7ae4983679a787834277176a031286a8310c2.tar.gz kdepimpi-02e7ae4983679a787834277176a031286a8310c2.tar.bz2 |
Foldername fixes
-rw-r--r-- | kmicromail/accountitem.cpp | 2 | ||||
-rw-r--r-- | kmicromail/libmailwrapper/mailwrapper.cpp | 7 | ||||
-rw-r--r-- | kmicromail/libmailwrapper/mailwrapper.h | 2 |
3 files changed, 6 insertions, 5 deletions
diff --git a/kmicromail/accountitem.cpp b/kmicromail/accountitem.cpp index 59c8abb..12d047a 100644 --- a/kmicromail/accountitem.cpp +++ b/kmicromail/accountitem.cpp | |||
@@ -114,769 +114,769 @@ void POP3viewItem::disconnect() | |||
114 | child = child->nextSibling(); | 114 | child = child->nextSibling(); |
115 | delete tmp; | 115 | delete tmp; |
116 | } | 116 | } |
117 | wrapper->logout(); | 117 | wrapper->logout(); |
118 | } | 118 | } |
119 | 119 | ||
120 | void POP3viewItem::setOnOffline() | 120 | void POP3viewItem::setOnOffline() |
121 | { | 121 | { |
122 | if (!account->getOffline()) | 122 | if (!account->getOffline()) |
123 | { | 123 | { |
124 | disconnect(); | 124 | disconnect(); |
125 | } | 125 | } |
126 | account->setOffline(!account->getOffline()); | 126 | account->setOffline(!account->getOffline()); |
127 | account->save(); | 127 | account->save(); |
128 | SETPIX(PIXMAP_POP3FOLDER); | 128 | SETPIX(PIXMAP_POP3FOLDER); |
129 | refresh(); | 129 | refresh(); |
130 | } | 130 | } |
131 | 131 | ||
132 | void POP3viewItem::contextMenuSelected(int which) | 132 | void POP3viewItem::contextMenuSelected(int which) |
133 | { | 133 | { |
134 | switch (which) | 134 | switch (which) |
135 | { | 135 | { |
136 | case 0: | 136 | case 0: |
137 | disconnect(); | 137 | disconnect(); |
138 | break; | 138 | break; |
139 | case 1: | 139 | case 1: |
140 | setOnOffline(); | 140 | setOnOffline(); |
141 | break; | 141 | break; |
142 | case GET_NEW_MAILS: // daunlood | 142 | case GET_NEW_MAILS: // daunlood |
143 | if (account->getOffline()) | 143 | if (account->getOffline()) |
144 | setOnOffline(); | 144 | setOnOffline(); |
145 | AccountView*bl = accountView(); | 145 | AccountView*bl = accountView(); |
146 | if (!bl) return; | 146 | if (!bl) return; |
147 | AccountViewItem* in = findSubItem( "inbox" , 0); | 147 | AccountViewItem* in = findSubItem( "inbox" , 0); |
148 | if ( ! in ) | 148 | if ( ! in ) |
149 | return; | 149 | return; |
150 | bl->downloadMailsInbox(in->getFolder() ,getWrapper()); | 150 | bl->downloadMailsInbox(in->getFolder() ,getWrapper()); |
151 | setOnOffline(); | 151 | setOnOffline(); |
152 | break; | 152 | break; |
153 | } | 153 | } |
154 | } | 154 | } |
155 | 155 | ||
156 | POP3folderItem::~POP3folderItem() | 156 | POP3folderItem::~POP3folderItem() |
157 | {} | 157 | {} |
158 | 158 | ||
159 | POP3folderItem::POP3folderItem( const FolderP&folderInit, POP3viewItem *parent , QListViewItem*after ) | 159 | POP3folderItem::POP3folderItem( const FolderP&folderInit, POP3viewItem *parent , QListViewItem*after ) |
160 | : AccountViewItem(folderInit,parent,after ) | 160 | : AccountViewItem(folderInit,parent,after ) |
161 | { | 161 | { |
162 | pop3 = parent; | 162 | pop3 = parent; |
163 | if (folder->getDisplayName().lower()!="inbox") | 163 | if (folder->getDisplayName().lower()!="inbox") |
164 | { | 164 | { |
165 | setPixmap( 0, PIXMAP_POP3FOLDER ); | 165 | setPixmap( 0, PIXMAP_POP3FOLDER ); |
166 | } | 166 | } |
167 | else | 167 | else |
168 | { | 168 | { |
169 | setPixmap( 0, PIXMAP_INBOXFOLDER); | 169 | setPixmap( 0, PIXMAP_INBOXFOLDER); |
170 | } | 170 | } |
171 | setText( 0, folder->getDisplayName() ); | 171 | setText( 0, folder->getDisplayName() ); |
172 | } | 172 | } |
173 | 173 | ||
174 | void POP3folderItem::refresh(QValueList<RecMailP>&target) | 174 | void POP3folderItem::refresh(QValueList<RecMailP>&target) |
175 | { | 175 | { |
176 | if (folder->may_select()) | 176 | if (folder->may_select()) |
177 | pop3->getWrapper()->listMessages( folder->getName(),target ); | 177 | pop3->getWrapper()->listMessages( folder->getName(),target ); |
178 | } | 178 | } |
179 | 179 | ||
180 | RECBODYP POP3folderItem::fetchBody(const RecMailP&aMail) | 180 | RECBODYP POP3folderItem::fetchBody(const RecMailP&aMail) |
181 | { | 181 | { |
182 | return pop3->getWrapper()->fetchBody(aMail); | 182 | return pop3->getWrapper()->fetchBody(aMail); |
183 | } | 183 | } |
184 | 184 | ||
185 | QPopupMenu * POP3folderItem::getContextMenu() | 185 | QPopupMenu * POP3folderItem::getContextMenu() |
186 | { | 186 | { |
187 | QPopupMenu *m = new QPopupMenu(0); | 187 | QPopupMenu *m = new QPopupMenu(0); |
188 | if (m) | 188 | if (m) |
189 | { | 189 | { |
190 | m->insertItem(QObject::tr("Refresh header list",contextName),0); | 190 | m->insertItem(QObject::tr("Refresh header list",contextName),0); |
191 | m->insertItem(QObject::tr("Delete all mails",contextName),1); | 191 | m->insertItem(QObject::tr("Delete all mails",contextName),1); |
192 | m->insertItem(QObject::tr("Move/Copie all mails",contextName),2); | 192 | m->insertItem(QObject::tr("Move/Copie all mails",contextName),2); |
193 | } | 193 | } |
194 | return m; | 194 | return m; |
195 | } | 195 | } |
196 | 196 | ||
197 | void POP3folderItem::downloadMails() | 197 | void POP3folderItem::downloadMails() |
198 | { | 198 | { |
199 | AccountView*bl = pop3->accountView(); | 199 | AccountView*bl = pop3->accountView(); |
200 | if (!bl) return; | 200 | if (!bl) return; |
201 | bl->downloadMails(folder,pop3->getWrapper()); | 201 | bl->downloadMails(folder,pop3->getWrapper()); |
202 | } | 202 | } |
203 | 203 | ||
204 | void POP3folderItem::contextMenuSelected(int which) | 204 | void POP3folderItem::contextMenuSelected(int which) |
205 | { | 205 | { |
206 | AccountView * view = (AccountView*)listView(); | 206 | AccountView * view = (AccountView*)listView(); |
207 | switch (which) | 207 | switch (which) |
208 | { | 208 | { |
209 | case 0: | 209 | case 0: |
210 | /* must be 'cause pop3 lists are cached */ | 210 | /* must be 'cause pop3 lists are cached */ |
211 | pop3->getWrapper()->logout(); | 211 | pop3->getWrapper()->logout(); |
212 | view->refreshCurrent(); | 212 | view->refreshCurrent(); |
213 | break; | 213 | break; |
214 | case 1: | 214 | case 1: |
215 | deleteAllMail(pop3->getWrapper(),folder); | 215 | deleteAllMail(pop3->getWrapper(),folder); |
216 | break; | 216 | break; |
217 | case 2: | 217 | case 2: |
218 | downloadMails(); | 218 | downloadMails(); |
219 | break; | 219 | break; |
220 | default: | 220 | default: |
221 | break; | 221 | break; |
222 | } | 222 | } |
223 | } | 223 | } |
224 | 224 | ||
225 | /** | 225 | /** |
226 | * NNTP Account stuff | 226 | * NNTP Account stuff |
227 | */ | 227 | */ |
228 | NNTPviewItem::NNTPviewItem( NNTPaccount *a, AccountView *parent ) | 228 | NNTPviewItem::NNTPviewItem( NNTPaccount *a, AccountView *parent ) |
229 | : AccountViewItem( parent ) | 229 | : AccountViewItem( parent ) |
230 | { | 230 | { |
231 | account = a; | 231 | account = a; |
232 | wrapper = AbstractMail::getWrapper( account ); | 232 | wrapper = AbstractMail::getWrapper( account ); |
233 | //FIXME | 233 | //FIXME |
234 | SETPIX(PIXMAP_POP3FOLDER); | 234 | SETPIX(PIXMAP_POP3FOLDER); |
235 | #if 0 | 235 | #if 0 |
236 | if (!account->getOffline()) | 236 | if (!account->getOffline()) |
237 | { | 237 | { |
238 | setPixmap( 0, ); | 238 | setPixmap( 0, ); |
239 | } | 239 | } |
240 | else | 240 | else |
241 | { | 241 | { |
242 | setPixmap( 0, PIXMAP_OFFLINE ); | 242 | setPixmap( 0, PIXMAP_OFFLINE ); |
243 | } | 243 | } |
244 | #endif | 244 | #endif |
245 | setText( 0, account->getAccountName() ); | 245 | setText( 0, account->getAccountName() ); |
246 | setOpen( true ); | 246 | setOpen( true ); |
247 | } | 247 | } |
248 | 248 | ||
249 | NNTPviewItem::~NNTPviewItem() | 249 | NNTPviewItem::~NNTPviewItem() |
250 | { | 250 | { |
251 | delete wrapper; | 251 | delete wrapper; |
252 | } | 252 | } |
253 | 253 | ||
254 | AbstractMail *NNTPviewItem::getWrapper() | 254 | AbstractMail *NNTPviewItem::getWrapper() |
255 | { | 255 | { |
256 | return wrapper; | 256 | return wrapper; |
257 | } | 257 | } |
258 | 258 | ||
259 | void NNTPviewItem::refresh( QValueList<RecMailP> & ) | 259 | void NNTPviewItem::refresh( QValueList<RecMailP> & ) |
260 | { | 260 | { |
261 | refresh(); | 261 | refresh(); |
262 | } | 262 | } |
263 | 263 | ||
264 | void NNTPviewItem::refresh() | 264 | void NNTPviewItem::refresh() |
265 | { | 265 | { |
266 | if (account->getOffline()) return; | 266 | if (account->getOffline()) return; |
267 | QValueList<FolderP> *folders = wrapper->listFolders(); | 267 | QValueList<FolderP> *folders = wrapper->listFolders(); |
268 | 268 | ||
269 | QListViewItem *child = firstChild(); | 269 | QListViewItem *child = firstChild(); |
270 | while ( child ) | 270 | while ( child ) |
271 | { | 271 | { |
272 | QListViewItem *tmp = child; | 272 | QListViewItem *tmp = child; |
273 | child = child->nextSibling(); | 273 | child = child->nextSibling(); |
274 | delete tmp; | 274 | delete tmp; |
275 | } | 275 | } |
276 | QValueList<FolderP>::ConstIterator it; | 276 | QValueList<FolderP>::ConstIterator it; |
277 | QListViewItem*item = 0; | 277 | QListViewItem*item = 0; |
278 | for ( it = folders->begin(); it!=folders->end(); ++it) | 278 | for ( it = folders->begin(); it!=folders->end(); ++it) |
279 | { | 279 | { |
280 | item = new NNTPfolderItem( (*it), this , item ); | 280 | item = new NNTPfolderItem( (*it), this , item ); |
281 | item->setSelectable( (*it)->may_select()); | 281 | item->setSelectable( (*it)->may_select()); |
282 | } | 282 | } |
283 | delete folders; | 283 | delete folders; |
284 | } | 284 | } |
285 | 285 | ||
286 | RECBODYP NNTPviewItem::fetchBody( const RecMailP &mail ) | 286 | RECBODYP NNTPviewItem::fetchBody( const RecMailP &mail ) |
287 | { | 287 | { |
288 | 288 | ||
289 | return wrapper->fetchBody( mail ); | 289 | return wrapper->fetchBody( mail ); |
290 | } | 290 | } |
291 | 291 | ||
292 | QPopupMenu * NNTPviewItem::getContextMenu() | 292 | QPopupMenu * NNTPviewItem::getContextMenu() |
293 | { | 293 | { |
294 | QPopupMenu *m = new QPopupMenu(0); | 294 | QPopupMenu *m = new QPopupMenu(0); |
295 | if (m) | 295 | if (m) |
296 | { | 296 | { |
297 | if (!account->getOffline()) | 297 | if (!account->getOffline()) |
298 | { | 298 | { |
299 | m->insertItem(QObject::tr("Disconnect",contextName),0); | 299 | m->insertItem(QObject::tr("Disconnect",contextName),0); |
300 | m->insertItem(QObject::tr("Set offline",contextName),1); | 300 | m->insertItem(QObject::tr("Set offline",contextName),1); |
301 | m->insertItem(QObject::tr("(Un-)Subscribe groups",contextName),2); | 301 | m->insertItem(QObject::tr("(Un-)Subscribe groups",contextName),2); |
302 | } | 302 | } |
303 | else | 303 | else |
304 | { | 304 | { |
305 | m->insertItem(QObject::tr("Set online",contextName),1); | 305 | m->insertItem(QObject::tr("Set online",contextName),1); |
306 | } | 306 | } |
307 | } | 307 | } |
308 | return m; | 308 | return m; |
309 | } | 309 | } |
310 | 310 | ||
311 | void NNTPviewItem::subscribeGroups() | 311 | void NNTPviewItem::subscribeGroups() |
312 | { | 312 | { |
313 | NNTPGroupsDlg dlg(account); | 313 | NNTPGroupsDlg dlg(account); |
314 | dlg.showMaximized(); | 314 | dlg.showMaximized(); |
315 | if ( dlg.exec()== QDialog::Accepted ){ | 315 | if ( dlg.exec()== QDialog::Accepted ){ |
316 | refresh(); | 316 | refresh(); |
317 | } | 317 | } |
318 | } | 318 | } |
319 | 319 | ||
320 | void NNTPviewItem::disconnect() | 320 | void NNTPviewItem::disconnect() |
321 | { | 321 | { |
322 | QListViewItem *child = firstChild(); | 322 | QListViewItem *child = firstChild(); |
323 | while ( child ) | 323 | while ( child ) |
324 | { | 324 | { |
325 | QListViewItem *tmp = child; | 325 | QListViewItem *tmp = child; |
326 | child = child->nextSibling(); | 326 | child = child->nextSibling(); |
327 | delete tmp; | 327 | delete tmp; |
328 | } | 328 | } |
329 | wrapper->logout(); | 329 | wrapper->logout(); |
330 | } | 330 | } |
331 | 331 | ||
332 | void NNTPviewItem::setOnOffline() | 332 | void NNTPviewItem::setOnOffline() |
333 | { | 333 | { |
334 | if (!account->getOffline()) | 334 | if (!account->getOffline()) |
335 | { | 335 | { |
336 | disconnect(); | 336 | disconnect(); |
337 | } | 337 | } |
338 | account->setOffline(!account->getOffline()); | 338 | account->setOffline(!account->getOffline()); |
339 | account->save(); | 339 | account->save(); |
340 | //FIXME | 340 | //FIXME |
341 | SETPIX(PIXMAP_POP3FOLDER); | 341 | SETPIX(PIXMAP_POP3FOLDER); |
342 | refresh(); | 342 | refresh(); |
343 | } | 343 | } |
344 | 344 | ||
345 | void NNTPviewItem::contextMenuSelected(int which) | 345 | void NNTPviewItem::contextMenuSelected(int which) |
346 | { | 346 | { |
347 | switch (which) | 347 | switch (which) |
348 | { | 348 | { |
349 | case 0: | 349 | case 0: |
350 | disconnect(); | 350 | disconnect(); |
351 | break; | 351 | break; |
352 | case 1: | 352 | case 1: |
353 | setOnOffline(); | 353 | setOnOffline(); |
354 | break; | 354 | break; |
355 | case 2: | 355 | case 2: |
356 | subscribeGroups(); | 356 | subscribeGroups(); |
357 | break; | 357 | break; |
358 | } | 358 | } |
359 | } | 359 | } |
360 | 360 | ||
361 | NNTPfolderItem::~NNTPfolderItem() | 361 | NNTPfolderItem::~NNTPfolderItem() |
362 | {} | 362 | {} |
363 | 363 | ||
364 | NNTPfolderItem::NNTPfolderItem( const FolderP &folderInit, NNTPviewItem *parent , QListViewItem*after ) | 364 | NNTPfolderItem::NNTPfolderItem( const FolderP &folderInit, NNTPviewItem *parent , QListViewItem*after ) |
365 | : AccountViewItem( folderInit, parent,after ) | 365 | : AccountViewItem( folderInit, parent,after ) |
366 | { | 366 | { |
367 | nntp = parent; | 367 | nntp = parent; |
368 | if (folder->getDisplayName().lower()!="inbox") | 368 | if (folder->getDisplayName().lower()!="inbox") |
369 | { | 369 | { |
370 | setPixmap( 0, PIXMAP_POP3FOLDER ); | 370 | setPixmap( 0, PIXMAP_POP3FOLDER ); |
371 | } | 371 | } |
372 | else | 372 | else |
373 | { | 373 | { |
374 | setPixmap( 0, PIXMAP_INBOXFOLDER); | 374 | setPixmap( 0, PIXMAP_INBOXFOLDER); |
375 | } | 375 | } |
376 | setText( 0, folder->getDisplayName() ); | 376 | setText( 0, folder->getDisplayName() ); |
377 | } | 377 | } |
378 | 378 | ||
379 | void NNTPfolderItem::refresh(QValueList<RecMailP>&target) | 379 | void NNTPfolderItem::refresh(QValueList<RecMailP>&target) |
380 | { | 380 | { |
381 | if (folder->may_select()) | 381 | if (folder->may_select()) |
382 | nntp->getWrapper()->listMessages( folder->getName(),target ); | 382 | nntp->getWrapper()->listMessages( folder->getName(),target ); |
383 | } | 383 | } |
384 | 384 | ||
385 | RECBODYP NNTPfolderItem::fetchBody(const RecMailP&aMail) | 385 | RECBODYP NNTPfolderItem::fetchBody(const RecMailP&aMail) |
386 | { | 386 | { |
387 | return nntp->getWrapper()->fetchBody(aMail); | 387 | return nntp->getWrapper()->fetchBody(aMail); |
388 | } | 388 | } |
389 | 389 | ||
390 | QPopupMenu * NNTPfolderItem::getContextMenu() | 390 | QPopupMenu * NNTPfolderItem::getContextMenu() |
391 | { | 391 | { |
392 | QPopupMenu *m = new QPopupMenu(0); | 392 | QPopupMenu *m = new QPopupMenu(0); |
393 | if (m) | 393 | if (m) |
394 | { | 394 | { |
395 | m->insertItem(QObject::tr("Refresh header list",contextName),0); | 395 | m->insertItem(QObject::tr("Refresh header list",contextName),0); |
396 | m->insertItem(QObject::tr("Copy all postings",contextName),1); | 396 | m->insertItem(QObject::tr("Copy all postings",contextName),1); |
397 | } | 397 | } |
398 | return m; | 398 | return m; |
399 | } | 399 | } |
400 | 400 | ||
401 | void NNTPfolderItem::downloadMails() | 401 | void NNTPfolderItem::downloadMails() |
402 | { | 402 | { |
403 | AccountView*bl = nntp->accountView(); | 403 | AccountView*bl = nntp->accountView(); |
404 | if (!bl) return; | 404 | if (!bl) return; |
405 | bl->downloadMails(folder,nntp->getWrapper()); | 405 | bl->downloadMails(folder,nntp->getWrapper()); |
406 | } | 406 | } |
407 | 407 | ||
408 | void NNTPfolderItem::contextMenuSelected(int which) | 408 | void NNTPfolderItem::contextMenuSelected(int which) |
409 | { | 409 | { |
410 | AccountView * view = (AccountView*)listView(); | 410 | AccountView * view = (AccountView*)listView(); |
411 | switch (which) | 411 | switch (which) |
412 | { | 412 | { |
413 | case 0: | 413 | case 0: |
414 | /* must be 'cause pop3 lists are cached */ | 414 | /* must be 'cause pop3 lists are cached */ |
415 | nntp->getWrapper()->logout(); | 415 | nntp->getWrapper()->logout(); |
416 | view->refreshCurrent(); | 416 | view->refreshCurrent(); |
417 | break; | 417 | break; |
418 | case 1: | 418 | case 1: |
419 | downloadMails(); | 419 | downloadMails(); |
420 | break; | 420 | break; |
421 | default: | 421 | default: |
422 | break; | 422 | break; |
423 | } | 423 | } |
424 | } | 424 | } |
425 | 425 | ||
426 | /** | 426 | /** |
427 | * IMAP Account stuff | 427 | * IMAP Account stuff |
428 | */ | 428 | */ |
429 | IMAPviewItem::IMAPviewItem( IMAPaccount *a, AccountView *parent ) | 429 | IMAPviewItem::IMAPviewItem( IMAPaccount *a, AccountView *parent ) |
430 | : AccountViewItem( parent ) | 430 | : AccountViewItem( parent ) |
431 | { | 431 | { |
432 | account = a; | 432 | account = a; |
433 | wrapper = AbstractMail::getWrapper( account ); | 433 | wrapper = AbstractMail::getWrapper( account ); |
434 | SETPIX(PIXMAP_IMAPFOLDER); | 434 | SETPIX(PIXMAP_IMAPFOLDER); |
435 | setText( 0, account->getAccountName() ); | 435 | setText( 0, account->getAccountName() ); |
436 | setOpen( true ); | 436 | setOpen( true ); |
437 | } | 437 | } |
438 | 438 | ||
439 | IMAPviewItem::~IMAPviewItem() | 439 | IMAPviewItem::~IMAPviewItem() |
440 | { | 440 | { |
441 | delete wrapper; | 441 | delete wrapper; |
442 | } | 442 | } |
443 | 443 | ||
444 | AbstractMail *IMAPviewItem::getWrapper() | 444 | AbstractMail *IMAPviewItem::getWrapper() |
445 | { | 445 | { |
446 | return wrapper; | 446 | return wrapper; |
447 | } | 447 | } |
448 | 448 | ||
449 | void IMAPviewItem::refresh(QValueList<RecMailP>&) | 449 | void IMAPviewItem::refresh(QValueList<RecMailP>&) |
450 | { | 450 | { |
451 | refreshFolders(false); | 451 | refreshFolders(false); |
452 | } | 452 | } |
453 | 453 | ||
454 | const QStringList&IMAPviewItem::subFolders() | 454 | const QStringList&IMAPviewItem::subFolders() |
455 | { | 455 | { |
456 | return currentFolders; | 456 | return currentFolders; |
457 | } | 457 | } |
458 | 458 | ||
459 | void IMAPviewItem::refreshFolders(bool force) | 459 | void IMAPviewItem::refreshFolders(bool force) |
460 | { | 460 | { |
461 | if (childCount()>0 && force==false) return; | 461 | if (childCount()>0 && force==false) return; |
462 | if (account->getOffline()) return; | 462 | if (account->getOffline()) return; |
463 | 463 | ||
464 | removeChilds(); | 464 | removeChilds(); |
465 | currentFolders.clear(); | 465 | currentFolders.clear(); |
466 | QValueList<FolderP> * folders = wrapper->listFolders(); | 466 | QValueList<FolderP> * folders = wrapper->listFolders(); |
467 | 467 | ||
468 | QValueList<FolderP>::Iterator it; | 468 | QValueList<FolderP>::Iterator it; |
469 | QListViewItem*item = 0; | 469 | QListViewItem*item = 0; |
470 | QListViewItem*titem = 0; | 470 | QListViewItem*titem = 0; |
471 | QString fname,del,search; | 471 | QString fname,del,search; |
472 | int pos; | 472 | int pos; |
473 | 473 | ||
474 | for ( it = folders->begin(); it!=folders->end(); ++it) | 474 | for ( it = folders->begin(); it!=folders->end(); ++it) |
475 | { | 475 | { |
476 | if ((*it)->getDisplayName().lower()=="inbox") | 476 | if ((*it)->getDisplayName().lower()=="inbox") |
477 | { | 477 | { |
478 | item = new IMAPfolderItem( (*it), this , item ); | 478 | item = new IMAPfolderItem( (*it), this , item ); |
479 | folders->remove(it); | 479 | folders->remove(it); |
480 | break; | 480 | break; |
481 | } | 481 | } |
482 | } | 482 | } |
483 | for ( it = folders->begin(); it!=folders->end(); ++it) | 483 | for ( it = folders->begin(); it!=folders->end(); ++it) |
484 | { | 484 | { |
485 | fname = (*it)->getDisplayName(); | 485 | fname = (*it)->getDisplayName(); |
486 | currentFolders.append((*it)->getName()); | 486 | currentFolders.append((*it)->getName()); |
487 | pos = fname.findRev((*it)->Separator()); | 487 | pos = fname.findRev((*it)->Separator()); |
488 | if (pos != -1) | 488 | if (pos != -1) |
489 | { | 489 | { |
490 | fname = fname.left(pos); | 490 | fname = fname.left(pos); |
491 | } | 491 | } |
492 | IMAPfolderItem*pitem = (IMAPfolderItem*)findSubItem(fname); | 492 | IMAPfolderItem*pitem = (IMAPfolderItem*)findSubItem(fname); |
493 | if (pitem) | 493 | if (pitem) |
494 | { | 494 | { |
495 | titem = item; | 495 | titem = item; |
496 | item = new IMAPfolderItem( (*it),pitem,pitem->firstChild(),this); | 496 | item = new IMAPfolderItem( (*it),pitem,pitem->firstChild(),this); |
497 | /* setup the short name */ | 497 | /* setup the short name */ |
498 | item->setText(0,(*it)->getDisplayName().right((*it)->getDisplayName().length()-pos-1)); | 498 | item->setText(0,(*it)->getDisplayName().mid(pos+1)); |
499 | item = titem; | 499 | item = titem; |
500 | } | 500 | } |
501 | else | 501 | else |
502 | { | 502 | { |
503 | item = new IMAPfolderItem( (*it), this , item ); | 503 | item = new IMAPfolderItem( (*it), this , item ); |
504 | } | 504 | } |
505 | } | 505 | } |
506 | delete folders; | 506 | delete folders; |
507 | } | 507 | } |
508 | 508 | ||
509 | QPopupMenu * IMAPviewItem::getContextMenu() | 509 | QPopupMenu * IMAPviewItem::getContextMenu() |
510 | { | 510 | { |
511 | QPopupMenu *m = new QPopupMenu(0); | 511 | QPopupMenu *m = new QPopupMenu(0); |
512 | if (m) | 512 | if (m) |
513 | { | 513 | { |
514 | if (!account->getOffline()) | 514 | if (!account->getOffline()) |
515 | { | 515 | { |
516 | m->insertItem(QObject::tr("Refresh folder list",contextName),0); | 516 | m->insertItem(QObject::tr("Refresh folder list",contextName),0); |
517 | m->insertItem(QObject::tr("Create new folder",contextName),1); | 517 | m->insertItem(QObject::tr("Create new folder",contextName),1); |
518 | m->insertSeparator(); | 518 | m->insertSeparator(); |
519 | m->insertItem(QObject::tr("Disconnect",contextName),2); | 519 | m->insertItem(QObject::tr("Disconnect",contextName),2); |
520 | m->insertItem(QObject::tr("Set offline",contextName),3); | 520 | m->insertItem(QObject::tr("Set offline",contextName),3); |
521 | m->insertSeparator(); | 521 | m->insertSeparator(); |
522 | m->insertItem(QObject::tr("Get new messages",contextName),GET_NEW_MAILS); | 522 | m->insertItem(QObject::tr("Get new messages",contextName),GET_NEW_MAILS); |
523 | } | 523 | } |
524 | else | 524 | else |
525 | { | 525 | { |
526 | m->insertItem(QObject::tr("Set online",contextName),3); | 526 | m->insertItem(QObject::tr("Set online",contextName),3); |
527 | m->insertSeparator(); | 527 | m->insertSeparator(); |
528 | m->insertItem(QObject::tr("Get new messages",contextName),GET_NEW_MAILS); | 528 | m->insertItem(QObject::tr("Get new messages",contextName),GET_NEW_MAILS); |
529 | } | 529 | } |
530 | } | 530 | } |
531 | return m; | 531 | return m; |
532 | } | 532 | } |
533 | 533 | ||
534 | void IMAPviewItem::createNewFolder() | 534 | void IMAPviewItem::createNewFolder() |
535 | { | 535 | { |
536 | Newmdirdlg ndirdlg; | 536 | Newmdirdlg ndirdlg; |
537 | 537 | ||
538 | ndirdlg.showMaximized(); | 538 | ndirdlg.showMaximized(); |
539 | if ( ndirdlg.exec() ) | 539 | if ( ndirdlg.exec() ) |
540 | { | 540 | { |
541 | QString ndir = ndirdlg.Newdir(); | 541 | QString ndir = ndirdlg.Newdir(); |
542 | bool makesubs = ndirdlg.subpossible(); | 542 | bool makesubs = ndirdlg.subpossible(); |
543 | QString delemiter = "/"; | 543 | QString delemiter = "/"; |
544 | IMAPfolderItem*item = (IMAPfolderItem*)firstChild(); | 544 | IMAPfolderItem*item = (IMAPfolderItem*)firstChild(); |
545 | if (item) | 545 | if (item) |
546 | { | 546 | { |
547 | delemiter = item->Delemiter(); | 547 | delemiter = item->Delemiter(); |
548 | } | 548 | } |
549 | if (wrapper->createMbox(ndir,0,delemiter,makesubs)) | 549 | if (wrapper->createMbox(ndir,0,delemiter,makesubs)) |
550 | { | 550 | { |
551 | refreshFolders(true); | 551 | refreshFolders(true); |
552 | } | 552 | } |
553 | } | 553 | } |
554 | } | 554 | } |
555 | 555 | ||
556 | void IMAPviewItem::contextMenuSelected(int id) | 556 | void IMAPviewItem::contextMenuSelected(int id) |
557 | { | 557 | { |
558 | 558 | ||
559 | switch (id) | 559 | switch (id) |
560 | { | 560 | { |
561 | case 0: | 561 | case 0: |
562 | refreshFolders(true); | 562 | refreshFolders(true); |
563 | break; | 563 | break; |
564 | case 1: | 564 | case 1: |
565 | createNewFolder(); | 565 | createNewFolder(); |
566 | break; | 566 | break; |
567 | case 2: | 567 | case 2: |
568 | removeChilds(); | 568 | removeChilds(); |
569 | wrapper->logout(); | 569 | wrapper->logout(); |
570 | break; | 570 | break; |
571 | case 3: | 571 | case 3: |
572 | if (account->getOffline()==false) | 572 | if (account->getOffline()==false) |
573 | { | 573 | { |
574 | removeChilds(); | 574 | removeChilds(); |
575 | wrapper->logout(); | 575 | wrapper->logout(); |
576 | } | 576 | } |
577 | account->setOffline(!account->getOffline()); | 577 | account->setOffline(!account->getOffline()); |
578 | account->save(); | 578 | account->save(); |
579 | SETPIX(PIXMAP_IMAPFOLDER); | 579 | SETPIX(PIXMAP_IMAPFOLDER); |
580 | refreshFolders(false); | 580 | refreshFolders(false); |
581 | break; | 581 | break; |
582 | case GET_NEW_MAILS: // daunlood | 582 | case GET_NEW_MAILS: // daunlood |
583 | { | 583 | { |
584 | if (account->getOffline()) { | 584 | if (account->getOffline()) { |
585 | contextMenuSelected( 3 ); | 585 | contextMenuSelected( 3 ); |
586 | } | 586 | } |
587 | AccountView*bl = accountView(); | 587 | AccountView*bl = accountView(); |
588 | if (!bl) return; | 588 | if (!bl) return; |
589 | AccountViewItem* in = findSubItem( "inbox" , 0); | 589 | AccountViewItem* in = findSubItem( "inbox" , 0); |
590 | if ( ! in ) | 590 | if ( ! in ) |
591 | return; | 591 | return; |
592 | bl->downloadMailsInbox(in->getFolder(),getWrapper()); | 592 | bl->downloadMailsInbox(in->getFolder(),getWrapper()); |
593 | } | 593 | } |
594 | break; | 594 | break; |
595 | default: | 595 | default: |
596 | break; | 596 | break; |
597 | } | 597 | } |
598 | } | 598 | } |
599 | 599 | ||
600 | RECBODYP IMAPviewItem::fetchBody(const RecMailP&) | 600 | RECBODYP IMAPviewItem::fetchBody(const RecMailP&) |
601 | { | 601 | { |
602 | return new RecBody(); | 602 | return new RecBody(); |
603 | } | 603 | } |
604 | 604 | ||
605 | bool IMAPviewItem::offline() | 605 | bool IMAPviewItem::offline() |
606 | { | 606 | { |
607 | return account->getOffline(); | 607 | return account->getOffline(); |
608 | } | 608 | } |
609 | 609 | ||
610 | IMAPfolderItem::IMAPfolderItem( const FolderP& folderInit, IMAPviewItem *parent , QListViewItem*after ) | 610 | IMAPfolderItem::IMAPfolderItem( const FolderP& folderInit, IMAPviewItem *parent , QListViewItem*after ) |
611 | : AccountViewItem( folderInit, parent , after ) | 611 | : AccountViewItem( folderInit, parent , after ) |
612 | { | 612 | { |
613 | imap = parent; | 613 | imap = parent; |
614 | if (folder->getDisplayName().lower()!="inbox") | 614 | if (folder->getDisplayName().lower()!="inbox") |
615 | { | 615 | { |
616 | setPixmap( 0, PIXMAP_IMAPFOLDER ); | 616 | setPixmap( 0, PIXMAP_IMAPFOLDER ); |
617 | } | 617 | } |
618 | else | 618 | else |
619 | { | 619 | { |
620 | setPixmap( 0, PIXMAP_INBOXFOLDER); | 620 | setPixmap( 0, PIXMAP_INBOXFOLDER); |
621 | } | 621 | } |
622 | setText( 0, folder->getDisplayName() ); | 622 | setText( 0, folder->getDisplayName() ); |
623 | } | 623 | } |
624 | 624 | ||
625 | IMAPfolderItem::IMAPfolderItem(const FolderP &folderInit, IMAPfolderItem *parent , QListViewItem*after, IMAPviewItem *master ) | 625 | IMAPfolderItem::IMAPfolderItem(const FolderP &folderInit, IMAPfolderItem *parent , QListViewItem*after, IMAPviewItem *master ) |
626 | : AccountViewItem(folderInit, parent,after ) | 626 | : AccountViewItem(folderInit, parent,after ) |
627 | { | 627 | { |
628 | imap = master; | 628 | imap = master; |
629 | if (folder->getDisplayName().lower()!="inbox") | 629 | if (folder->getDisplayName().lower()!="inbox") |
630 | { | 630 | { |
631 | setPixmap( 0, PIXMAP_IMAPFOLDER ); | 631 | setPixmap( 0, PIXMAP_IMAPFOLDER ); |
632 | } | 632 | } |
633 | else | 633 | else |
634 | { | 634 | { |
635 | setPixmap( 0, PIXMAP_INBOXFOLDER); | 635 | setPixmap( 0, PIXMAP_INBOXFOLDER); |
636 | } | 636 | } |
637 | setText( 0, folder->getDisplayName() ); | 637 | setText( 0, folder->getDisplayName() ); |
638 | } | 638 | } |
639 | 639 | ||
640 | IMAPfolderItem::~IMAPfolderItem() | 640 | IMAPfolderItem::~IMAPfolderItem() |
641 | {} | 641 | {} |
642 | 642 | ||
643 | const QString& IMAPfolderItem::Delemiter()const | 643 | const QString& IMAPfolderItem::Delemiter()const |
644 | { | 644 | { |
645 | return folder->Separator(); | 645 | return folder->Separator(); |
646 | } | 646 | } |
647 | 647 | ||
648 | void IMAPfolderItem::refresh(QValueList<RecMailP>&target) | 648 | void IMAPfolderItem::refresh(QValueList<RecMailP>&target) |
649 | { | 649 | { |
650 | if (folder->may_select()) | 650 | if (folder->may_select()) |
651 | { | 651 | { |
652 | imap->getWrapper()->listMessages( folder->getName(),target ); | 652 | imap->getWrapper()->listMessages( folder->getName(),target ); |
653 | } | 653 | } |
654 | else | 654 | else |
655 | { | 655 | { |
656 | target.clear(); | 656 | target.clear(); |
657 | } | 657 | } |
658 | } | 658 | } |
659 | 659 | ||
660 | RECBODYP IMAPfolderItem::fetchBody(const RecMailP&aMail) | 660 | RECBODYP IMAPfolderItem::fetchBody(const RecMailP&aMail) |
661 | { | 661 | { |
662 | return imap->getWrapper()->fetchBody(aMail); | 662 | return imap->getWrapper()->fetchBody(aMail); |
663 | } | 663 | } |
664 | 664 | ||
665 | QPopupMenu * IMAPfolderItem::getContextMenu() | 665 | QPopupMenu * IMAPfolderItem::getContextMenu() |
666 | { | 666 | { |
667 | QPopupMenu *m = new QPopupMenu(0); | 667 | QPopupMenu *m = new QPopupMenu(0); |
668 | if (m) | 668 | if (m) |
669 | { | 669 | { |
670 | if (folder->may_select()) | 670 | if (folder->may_select()) |
671 | { | 671 | { |
672 | m->insertItem(QObject::tr("Refresh header list",contextName),0); | 672 | m->insertItem(QObject::tr("Refresh header list",contextName),0); |
673 | m->insertItem(QObject::tr("Move/Copie all mails",contextName),4); | 673 | m->insertItem(QObject::tr("Move/Copie all mails",contextName),4); |
674 | m->insertItem(QObject::tr("Delete all mails",contextName),1); | 674 | m->insertItem(QObject::tr("Delete all mails",contextName),1); |
675 | } | 675 | } |
676 | if (folder->no_inferior()==false) | 676 | if (folder->no_inferior()==false) |
677 | { | 677 | { |
678 | m->insertItem(QObject::tr("Create new subfolder",contextName),2); | 678 | m->insertItem(QObject::tr("Create new subfolder",contextName),2); |
679 | } | 679 | } |
680 | if (folder->getDisplayName().lower()!="inbox") | 680 | if (folder->getDisplayName().lower()!="inbox") |
681 | { | 681 | { |
682 | m->insertItem(QObject::tr("Delete folder",contextName),3); | 682 | m->insertItem(QObject::tr("Delete folder",contextName),3); |
683 | } | 683 | } |
684 | } | 684 | } |
685 | return m; | 685 | return m; |
686 | } | 686 | } |
687 | 687 | ||
688 | void IMAPfolderItem::createNewFolder() | 688 | void IMAPfolderItem::createNewFolder() |
689 | { | 689 | { |
690 | Newmdirdlg ndirdlg; | 690 | Newmdirdlg ndirdlg; |
691 | ndirdlg.showMaximized(); | 691 | ndirdlg.showMaximized(); |
692 | if ( ndirdlg.exec() ) | 692 | if ( ndirdlg.exec() ) |
693 | { | 693 | { |
694 | QString ndir = ndirdlg.Newdir(); | 694 | QString ndir = ndirdlg.Newdir(); |
695 | bool makesubs = ndirdlg.subpossible(); | 695 | bool makesubs = ndirdlg.subpossible(); |
696 | QString delemiter = Delemiter(); | 696 | QString delemiter = Delemiter(); |
697 | if (imap->wrapper->createMbox(ndir,folder,delemiter,makesubs)) | 697 | if (imap->wrapper->createMbox(ndir,folder,delemiter,makesubs)) |
698 | { | 698 | { |
699 | imap->refreshFolders(true); | 699 | imap->refreshFolders(true); |
700 | } | 700 | } |
701 | } | 701 | } |
702 | } | 702 | } |
703 | 703 | ||
704 | void IMAPfolderItem::deleteFolder() | 704 | void IMAPfolderItem::deleteFolder() |
705 | { | 705 | { |
706 | int yesno = QMessageBox::warning(0,QObject::tr("Delete folder",contextName), | 706 | int yesno = QMessageBox::warning(0,QObject::tr("Delete folder",contextName), |
707 | QObject::tr("<center>Realy delete folder <br><b>%1</b><br>and all if it content?</center>",contextName).arg(folder->getDisplayName()), | 707 | QObject::tr("<center>Realy delete folder <br><b>%1</b><br>and all if it content?</center>",contextName).arg(folder->getDisplayName()), |
708 | QObject::tr("Yes",contextName), | 708 | QObject::tr("Yes",contextName), |
709 | QObject::tr("No",contextName),QString::null,1,1); | 709 | QObject::tr("No",contextName),QString::null,1,1); |
710 | 710 | ||
711 | if (yesno == 0) | 711 | if (yesno == 0) |
712 | { | 712 | { |
713 | if (imap->getWrapper()->deleteMbox(folder)) | 713 | if (imap->getWrapper()->deleteMbox(folder)) |
714 | { | 714 | { |
715 | QListView*v=listView(); | 715 | QListView*v=listView(); |
716 | IMAPviewItem * box = imap; | 716 | IMAPviewItem * box = imap; |
717 | /* be carefull - after that this object is destroyd so don't use | 717 | /* be carefull - after that this object is destroyd so don't use |
718 | * any member of it after that call!!*/ | 718 | * any member of it after that call!!*/ |
719 | imap->refreshFolders(true); | 719 | imap->refreshFolders(true); |
720 | if (v) | 720 | if (v) |
721 | { | 721 | { |
722 | v->setSelected(box,true); | 722 | v->setSelected(box,true); |
723 | } | 723 | } |
724 | } | 724 | } |
725 | } | 725 | } |
726 | } | 726 | } |
727 | 727 | ||
728 | void IMAPfolderItem::downloadMails() | 728 | void IMAPfolderItem::downloadMails() |
729 | { | 729 | { |
730 | AccountView*bl = imap->accountView(); | 730 | AccountView*bl = imap->accountView(); |
731 | if (!bl) return; | 731 | if (!bl) return; |
732 | bl->downloadMails(folder,imap->getWrapper()); | 732 | bl->downloadMails(folder,imap->getWrapper()); |
733 | } | 733 | } |
734 | 734 | ||
735 | void IMAPfolderItem::contextMenuSelected(int id) | 735 | void IMAPfolderItem::contextMenuSelected(int id) |
736 | { | 736 | { |
737 | 737 | ||
738 | AccountView * view = (AccountView*)listView(); | 738 | AccountView * view = (AccountView*)listView(); |
739 | switch(id) | 739 | switch(id) |
740 | { | 740 | { |
741 | case 0: | 741 | case 0: |
742 | view->refreshCurrent(); | 742 | view->refreshCurrent(); |
743 | break; | 743 | break; |
744 | case 1: | 744 | case 1: |
745 | deleteAllMail(imap->getWrapper(),folder); | 745 | deleteAllMail(imap->getWrapper(),folder); |
746 | break; | 746 | break; |
747 | case 2: | 747 | case 2: |
748 | createNewFolder(); | 748 | createNewFolder(); |
749 | break; | 749 | break; |
750 | case 3: | 750 | case 3: |
751 | deleteFolder(); | 751 | deleteFolder(); |
752 | break; | 752 | break; |
753 | case 4: | 753 | case 4: |
754 | downloadMails(); | 754 | downloadMails(); |
755 | break; | 755 | break; |
756 | default: | 756 | default: |
757 | break; | 757 | break; |
758 | } | 758 | } |
759 | } | 759 | } |
760 | 760 | ||
761 | /** | 761 | /** |
762 | * MH Account stuff | 762 | * MH Account stuff |
763 | */ | 763 | */ |
764 | /* MH is a little bit different - the top folder can contains messages other than in IMAP and | 764 | /* MH is a little bit different - the top folder can contains messages other than in IMAP and |
765 | POP3 and MBOX */ | 765 | POP3 and MBOX */ |
766 | MHviewItem::MHviewItem( const QString&aPath, AccountView *parent ) | 766 | MHviewItem::MHviewItem( const QString&aPath, AccountView *parent ) |
767 | : AccountViewItem( parent ) | 767 | : AccountViewItem( parent ) |
768 | { | 768 | { |
769 | m_Path = aPath; | 769 | m_Path = aPath; |
770 | /* be carefull - the space within settext is wanted - thats why the string twice */ | 770 | /* be carefull - the space within settext is wanted - thats why the string twice */ |
771 | wrapper = AbstractMail::getWrapper( m_Path,"Local Folders"); | 771 | wrapper = AbstractMail::getWrapper( m_Path,"Local Folders"); |
772 | setPixmap( 0, PIXMAP_LOCALFOLDER ); | 772 | setPixmap( 0, PIXMAP_LOCALFOLDER ); |
773 | setText( 0, " Local Folders" ); | 773 | setText( 0, " Local Folders" ); |
774 | setOpen( true ); | 774 | setOpen( true ); |
775 | folder = 0; | 775 | folder = 0; |
776 | } | 776 | } |
777 | 777 | ||
778 | MHviewItem::~MHviewItem() | 778 | MHviewItem::~MHviewItem() |
779 | { | 779 | { |
780 | delete wrapper; | 780 | delete wrapper; |
781 | } | 781 | } |
782 | 782 | ||
783 | AbstractMail *MHviewItem::getWrapper() | 783 | AbstractMail *MHviewItem::getWrapper() |
784 | { | 784 | { |
785 | return wrapper; | 785 | return wrapper; |
786 | } | 786 | } |
787 | 787 | ||
788 | void MHviewItem::refresh( QValueList<RecMailP> & target) | 788 | void MHviewItem::refresh( QValueList<RecMailP> & target) |
789 | { | 789 | { |
790 | refresh(false); | 790 | refresh(false); |
791 | getWrapper()->listMessages( "",target ); | 791 | getWrapper()->listMessages( "",target ); |
792 | } | 792 | } |
793 | 793 | ||
794 | void MHviewItem::refresh(bool force) | 794 | void MHviewItem::refresh(bool force) |
795 | { | 795 | { |
796 | if (childCount()>0 && force==false) return; | 796 | if (childCount()>0 && force==false) return; |
797 | removeChilds(); | 797 | removeChilds(); |
798 | currentFolders.clear(); | 798 | currentFolders.clear(); |
799 | QValueList<FolderP> *folders = wrapper->listFolders(); | 799 | QValueList<FolderP> *folders = wrapper->listFolders(); |
800 | QValueList<FolderP>::ConstIterator it; | 800 | QValueList<FolderP>::ConstIterator it; |
801 | MHfolderItem*item = 0; | 801 | MHfolderItem*item = 0; |
802 | MHfolderItem*pmaster = 0; | 802 | MHfolderItem*pmaster = 0; |
803 | QString fname = ""; | 803 | QString fname = ""; |
804 | int pos; | 804 | int pos; |
805 | for ( it = folders->begin(); it!=folders->end(); ++it) | 805 | for ( it = folders->begin(); it!=folders->end(); ++it) |
806 | { | 806 | { |
807 | fname = (*it)->getDisplayName(); | 807 | fname = (*it)->getDisplayName(); |
808 | /* this folder itself */ | 808 | /* this folder itself */ |
809 | if (fname=="/") | 809 | if (fname=="/") |
810 | { | 810 | { |
811 | currentFolders.append(fname); | 811 | currentFolders.append(fname); |
812 | folder = (*it); | 812 | folder = (*it); |
813 | continue; | 813 | continue; |
814 | } | 814 | } |
815 | currentFolders.append(fname); | 815 | currentFolders.append(fname); |
816 | pos = fname.findRev("/"); | 816 | pos = fname.findRev("/"); |
817 | if (pos > 0) | 817 | if (pos > 0) |
818 | { | 818 | { |
819 | fname = fname.left(pos); | 819 | fname = fname.left(pos); |
820 | pmaster = (MHfolderItem*)findSubItem(fname); | 820 | pmaster = (MHfolderItem*)findSubItem(fname); |
821 | } | 821 | } |
822 | else | 822 | else |
823 | { | 823 | { |
824 | pmaster = 0; | 824 | pmaster = 0; |
825 | } | 825 | } |
826 | if (pmaster) | 826 | if (pmaster) |
827 | { | 827 | { |
828 | item = new MHfolderItem( (*it), pmaster, item, this ); | 828 | item = new MHfolderItem( (*it), pmaster, item, this ); |
829 | } | 829 | } |
830 | else | 830 | else |
831 | { | 831 | { |
832 | item = new MHfolderItem( (*it), this , item ); | 832 | item = new MHfolderItem( (*it), this , item ); |
833 | } | 833 | } |
834 | item->setSelectable((*it)->may_select()); | 834 | item->setSelectable((*it)->may_select()); |
835 | } | 835 | } |
836 | delete folders; | 836 | delete folders; |
837 | } | 837 | } |
838 | 838 | ||
839 | RECBODYP MHviewItem::fetchBody( const RecMailP &mail ) | 839 | RECBODYP MHviewItem::fetchBody( const RecMailP &mail ) |
840 | { | 840 | { |
841 | 841 | ||
842 | return wrapper->fetchBody( mail ); | 842 | return wrapper->fetchBody( mail ); |
843 | } | 843 | } |
844 | 844 | ||
845 | QPopupMenu * MHviewItem::getContextMenu() | 845 | QPopupMenu * MHviewItem::getContextMenu() |
846 | { | 846 | { |
847 | QPopupMenu *m = new QPopupMenu(0); | 847 | QPopupMenu *m = new QPopupMenu(0); |
848 | if (m) | 848 | if (m) |
849 | { | 849 | { |
850 | m->insertItem(QObject::tr("Refresh folder list",contextName),0); | 850 | m->insertItem(QObject::tr("Refresh folder list",contextName),0); |
851 | m->insertItem(QObject::tr("Create new folder",contextName),1); | 851 | m->insertItem(QObject::tr("Create new folder",contextName),1); |
852 | m->insertItem(QObject::tr("Delete all mails",contextName),2); | 852 | m->insertItem(QObject::tr("Delete all mails",contextName),2); |
853 | m->insertItem(QObject::tr("Move/Copie all mails",contextName),3); | 853 | m->insertItem(QObject::tr("Move/Copie all mails",contextName),3); |
854 | } | 854 | } |
855 | return m; | 855 | return m; |
856 | } | 856 | } |
857 | 857 | ||
858 | void MHviewItem::createFolder() | 858 | void MHviewItem::createFolder() |
859 | { | 859 | { |
860 | Newmdirdlg ndirdlg(0,0,true); | 860 | Newmdirdlg ndirdlg(0,0,true); |
861 | ndirdlg.showMaximized(); | 861 | ndirdlg.showMaximized(); |
862 | if ( ndirdlg.exec() ) | 862 | if ( ndirdlg.exec() ) |
863 | { | 863 | { |
864 | QString ndir = ndirdlg.Newdir(); | 864 | QString ndir = ndirdlg.Newdir(); |
865 | if (wrapper->createMbox(ndir)) | 865 | if (wrapper->createMbox(ndir)) |
866 | { | 866 | { |
867 | refresh(true); | 867 | refresh(true); |
868 | } | 868 | } |
869 | } | 869 | } |
870 | } | 870 | } |
871 | 871 | ||
872 | void MHviewItem::downloadMails() | 872 | void MHviewItem::downloadMails() |
873 | { | 873 | { |
874 | AccountView*bl = accountView(); | 874 | AccountView*bl = accountView(); |
875 | if (!bl) return; | 875 | if (!bl) return; |
876 | bl->downloadMails(folder,getWrapper()); | 876 | bl->downloadMails(folder,getWrapper()); |
877 | } | 877 | } |
878 | 878 | ||
879 | QStringList MHviewItem::subFolders() | 879 | QStringList MHviewItem::subFolders() |
880 | { | 880 | { |
881 | return currentFolders; | 881 | return currentFolders; |
882 | } | 882 | } |
diff --git a/kmicromail/libmailwrapper/mailwrapper.cpp b/kmicromail/libmailwrapper/mailwrapper.cpp index 9400649..2ee1ab3 100644 --- a/kmicromail/libmailwrapper/mailwrapper.cpp +++ b/kmicromail/libmailwrapper/mailwrapper.cpp | |||
@@ -1,180 +1,181 @@ | |||
1 | #include <stdlib.h> | 1 | #include <stdlib.h> |
2 | #include <sys/stat.h> | 2 | #include <sys/stat.h> |
3 | #include <sys/types.h> | 3 | #include <sys/types.h> |
4 | #include <unistd.h> | 4 | #include <unistd.h> |
5 | #include <fcntl.h> | 5 | #include <fcntl.h> |
6 | #include <string.h> | 6 | #include <string.h> |
7 | #include <qdir.h> | 7 | #include <qdir.h> |
8 | 8 | ||
9 | #include "mailwrapper.h" | 9 | #include "mailwrapper.h" |
10 | //#include "logindialog.h" | 10 | //#include "logindialog.h" |
11 | //#include "defines.h" | 11 | //#include "defines.h" |
12 | 12 | ||
13 | #define UNDEFINED 64 | 13 | #define UNDEFINED 64 |
14 | #define MAXLINE 76 | 14 | #define MAXLINE 76 |
15 | #define UTF16MASK 0x03FFUL | 15 | #define UTF16MASK 0x03FFUL |
16 | #define UTF16SHIFT 10 | 16 | #define UTF16SHIFT 10 |
17 | #define UTF16BASE 0x10000UL | 17 | #define UTF16BASE 0x10000UL |
18 | #define UTF16HIGHSTART 0xD800UL | 18 | #define UTF16HIGHSTART 0xD800UL |
19 | #define UTF16HIGHEND 0xDBFFUL | 19 | #define UTF16HIGHEND 0xDBFFUL |
20 | #define UTF16LOSTART 0xDC00UL | 20 | #define UTF16LOSTART 0xDC00UL |
21 | #define UTF16LOEND 0xDFFFUL | 21 | #define UTF16LOEND 0xDFFFUL |
22 | 22 | ||
23 | 23 | ||
24 | using namespace Opie::Core; | 24 | using namespace Opie::Core; |
25 | Attachment::Attachment( QString lnk ) | 25 | Attachment::Attachment( QString lnk ) |
26 | { | 26 | { |
27 | doc = lnk; | 27 | doc = lnk; |
28 | size = QFileInfo( doc ).size(); | 28 | size = QFileInfo( doc ).size(); |
29 | mPix = SmallIcon( "files" ); | 29 | mPix = SmallIcon( "files" ); |
30 | } | 30 | } |
31 | 31 | ||
32 | Folder::Folder(const QString&tmp_name, const QString&sep ) | 32 | Folder::Folder(const QString&tmp_name, const QString&sep ) |
33 | { | 33 | { |
34 | name = tmp_name; | 34 | name = tmp_name; |
35 | nameDisplay = name; | 35 | nameDisplay = name; |
36 | separator = sep; | 36 | separator = sep; |
37 | prefix = ""; | 37 | prefix = ""; |
38 | } | 38 | } |
39 | 39 | ||
40 | Folder::~Folder() | 40 | Folder::~Folder() |
41 | { | 41 | { |
42 | } | 42 | } |
43 | 43 | ||
44 | const QString& Folder::Separator()const | 44 | const QString& Folder::Separator()const |
45 | { | 45 | { |
46 | return separator; | 46 | return separator; |
47 | } | 47 | } |
48 | 48 | ||
49 | IMAPFolder::IMAPFolder(const QString&name,const QString&sep, bool select,bool no_inf, const QString&aprefix ) | 49 | IMAPFolder::IMAPFolder(const QString&t_name,const QString&sep, bool select,bool no_inf, const QString&aprefix ) |
50 | : Folder( name,sep ),m_MaySelect(select),m_NoInferior(no_inf) | 50 | : Folder( t_name,sep ),m_MaySelect(select),m_NoInferior(no_inf) |
51 | { | 51 | { |
52 | // Decode IMAP foldername | 52 | // Decode IMAP foldername |
53 | nameDisplay = IMAPFolder::decodeFolderName( name ); | 53 | nameDisplay = IMAPFolder::decodeFolderName( t_name ); |
54 | name = nameDisplay ; | ||
54 | /* | 55 | /* |
55 | odebug << "folder " + name + " - displayed as " + nameDisplay << oendl; | 56 | odebug << "folder " + name + " - displayed as " + nameDisplay << oendl; |
56 | */ | 57 | */ |
57 | prefix = aprefix; | 58 | prefix = aprefix; |
58 | 59 | ||
59 | if (prefix.length()>0) { | 60 | if (prefix.length()>0) { |
60 | if (nameDisplay.startsWith(prefix) && nameDisplay.length()>prefix.length()) { | 61 | if (nameDisplay.startsWith(prefix) && nameDisplay.length()>prefix.length()) { |
61 | nameDisplay=nameDisplay.right(nameDisplay.length()-prefix.length()); | 62 | nameDisplay=nameDisplay.right(nameDisplay.length()-prefix.length()); |
62 | } | 63 | } |
63 | } | 64 | } |
64 | } | 65 | } |
65 | 66 | ||
66 | IMAPFolder::~IMAPFolder() | 67 | IMAPFolder::~IMAPFolder() |
67 | { | 68 | { |
68 | } | 69 | } |
69 | 70 | ||
70 | static unsigned char base64chars[] = | 71 | static unsigned char base64chars[] = |
71 | "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+,"; | 72 | "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+,"; |
72 | 73 | ||
73 | /** | 74 | /** |
74 | * Decodes base64 encoded parts of the imapfolder name | 75 | * Decodes base64 encoded parts of the imapfolder name |
75 | * Code taken from kde cvs: kdebase/kioslave/imap4/rfcdecoder.cc | 76 | * Code taken from kde cvs: kdebase/kioslave/imap4/rfcdecoder.cc |
76 | */ | 77 | */ |
77 | QString IMAPFolder::decodeFolderName( const QString &name ) | 78 | QString IMAPFolder::decodeFolderName( const QString &name ) |
78 | { | 79 | { |
79 | unsigned char c, i, bitcount; | 80 | unsigned char c, i, bitcount; |
80 | unsigned long ucs4, utf16, bitbuf; | 81 | unsigned long ucs4, utf16, bitbuf; |
81 | unsigned char base64[256], utf8[6]; | 82 | unsigned char base64[256], utf8[6]; |
82 | unsigned long srcPtr = 0; | 83 | unsigned long srcPtr = 0; |
83 | QCString dst = ""; | 84 | QCString dst = ""; |
84 | QCString src = name.ascii(); | 85 | QCString src = name.ascii(); |
85 | 86 | ||
86 | /* initialize modified base64 decoding table */ | 87 | /* initialize modified base64 decoding table */ |
87 | memset(base64, UNDEFINED, sizeof(base64)); | 88 | memset(base64, UNDEFINED, sizeof(base64)); |
88 | for (i = 0; i < sizeof(base64chars); ++i) { | 89 | for (i = 0; i < sizeof(base64chars); ++i) { |
89 | base64[(int)base64chars[i]] = i; | 90 | base64[(int)base64chars[i]] = i; |
90 | } | 91 | } |
91 | 92 | ||
92 | /* loop until end of string */ | 93 | /* loop until end of string */ |
93 | while (srcPtr < src.length ()) { | 94 | while (srcPtr < src.length ()) { |
94 | c = src[srcPtr++]; | 95 | c = src[srcPtr++]; |
95 | /* deal with literal characters and &- */ | 96 | /* deal with literal characters and &- */ |
96 | if (c != '&' || src[srcPtr] == '-') { | 97 | if (c != '&' || src[srcPtr] == '-') { |
97 | /* encode literally */ | 98 | /* encode literally */ |
98 | dst += c; | 99 | dst += c; |
99 | /* skip over the '-' if this is an &- sequence */ | 100 | /* skip over the '-' if this is an &- sequence */ |
100 | if (c == '&') | 101 | if (c == '&') |
101 | srcPtr++; | 102 | srcPtr++; |
102 | } else { | 103 | } else { |
103 | /* convert modified UTF-7 -> UTF-16 -> UCS-4 -> UTF-8 -> HEX */ | 104 | /* convert modified UTF-7 -> UTF-16 -> UCS-4 -> UTF-8 -> HEX */ |
104 | bitbuf = 0; | 105 | bitbuf = 0; |
105 | bitcount = 0; | 106 | bitcount = 0; |
106 | ucs4 = 0; | 107 | ucs4 = 0; |
107 | while ((c = base64[(unsigned char) src[srcPtr]]) != UNDEFINED) { | 108 | while ((c = base64[(unsigned char) src[srcPtr]]) != UNDEFINED) { |
108 | ++srcPtr; | 109 | ++srcPtr; |
109 | bitbuf = (bitbuf << 6) | c; | 110 | bitbuf = (bitbuf << 6) | c; |
110 | bitcount += 6; | 111 | bitcount += 6; |
111 | /* enough bits for a UTF-16 character? */ | 112 | /* enough bits for a UTF-16 character? */ |
112 | if (bitcount >= 16) { | 113 | if (bitcount >= 16) { |
113 | bitcount -= 16; | 114 | bitcount -= 16; |
114 | utf16 = (bitcount ? bitbuf >> bitcount : bitbuf) & 0xffff; | 115 | utf16 = (bitcount ? bitbuf >> bitcount : bitbuf) & 0xffff; |
115 | /* convert UTF16 to UCS4 */ | 116 | /* convert UTF16 to UCS4 */ |
116 | if (utf16 >= UTF16HIGHSTART && utf16 <= UTF16HIGHEND) { | 117 | if (utf16 >= UTF16HIGHSTART && utf16 <= UTF16HIGHEND) { |
117 | ucs4 = (utf16 - UTF16HIGHSTART) << UTF16SHIFT; | 118 | ucs4 = (utf16 - UTF16HIGHSTART) << UTF16SHIFT; |
118 | continue; | 119 | continue; |
119 | } else if (utf16 >= UTF16LOSTART && utf16 <= UTF16LOEND) { | 120 | } else if (utf16 >= UTF16LOSTART && utf16 <= UTF16LOEND) { |
120 | ucs4 += utf16 - UTF16LOSTART + UTF16BASE; | 121 | ucs4 += utf16 - UTF16LOSTART + UTF16BASE; |
121 | } else { | 122 | } else { |
122 | ucs4 = utf16; | 123 | ucs4 = utf16; |
123 | } | 124 | } |
124 | /* convert UTF-16 range of UCS4 to UTF-8 */ | 125 | /* convert UTF-16 range of UCS4 to UTF-8 */ |
125 | if (ucs4 <= 0x7fUL) { | 126 | if (ucs4 <= 0x7fUL) { |
126 | utf8[0] = ucs4; | 127 | utf8[0] = ucs4; |
127 | i = 1; | 128 | i = 1; |
128 | } else if (ucs4 <= 0x7ffUL) { | 129 | } else if (ucs4 <= 0x7ffUL) { |
129 | utf8[0] = 0xc0 | (ucs4 >> 6); | 130 | utf8[0] = 0xc0 | (ucs4 >> 6); |
130 | utf8[1] = 0x80 | (ucs4 & 0x3f); | 131 | utf8[1] = 0x80 | (ucs4 & 0x3f); |
131 | i = 2; | 132 | i = 2; |
132 | } else if (ucs4 <= 0xffffUL) { | 133 | } else if (ucs4 <= 0xffffUL) { |
133 | utf8[0] = 0xe0 | (ucs4 >> 12); | 134 | utf8[0] = 0xe0 | (ucs4 >> 12); |
134 | utf8[1] = 0x80 | ((ucs4 >> 6) & 0x3f); | 135 | utf8[1] = 0x80 | ((ucs4 >> 6) & 0x3f); |
135 | utf8[2] = 0x80 | (ucs4 & 0x3f); | 136 | utf8[2] = 0x80 | (ucs4 & 0x3f); |
136 | i = 3; | 137 | i = 3; |
137 | } else { | 138 | } else { |
138 | utf8[0] = 0xf0 | (ucs4 >> 18); | 139 | utf8[0] = 0xf0 | (ucs4 >> 18); |
139 | utf8[1] = 0x80 | ((ucs4 >> 12) & 0x3f); | 140 | utf8[1] = 0x80 | ((ucs4 >> 12) & 0x3f); |
140 | utf8[2] = 0x80 | ((ucs4 >> 6) & 0x3f); | 141 | utf8[2] = 0x80 | ((ucs4 >> 6) & 0x3f); |
141 | utf8[3] = 0x80 | (ucs4 & 0x3f); | 142 | utf8[3] = 0x80 | (ucs4 & 0x3f); |
142 | i = 4; | 143 | i = 4; |
143 | } | 144 | } |
144 | /* copy it */ | 145 | /* copy it */ |
145 | for (c = 0; c < i; ++c) { | 146 | for (c = 0; c < i; ++c) { |
146 | dst += utf8[c]; | 147 | dst += utf8[c]; |
147 | } | 148 | } |
148 | } | 149 | } |
149 | } | 150 | } |
150 | /* skip over trailing '-' in modified UTF-7 encoding */ | 151 | /* skip over trailing '-' in modified UTF-7 encoding */ |
151 | if (src[srcPtr] == '-') | 152 | if (src[srcPtr] == '-') |
152 | ++srcPtr; | 153 | ++srcPtr; |
153 | } | 154 | } |
154 | } | 155 | } |
155 | 156 | ||
156 | return QString::fromUtf8( dst.data() ); | 157 | return QString::fromUtf8( dst.data() ); |
157 | } | 158 | } |
158 | 159 | ||
159 | Mail::Mail() | 160 | Mail::Mail() |
160 | :Opie::Core::ORefCount(),name(""), mail(""), to(""), cc(""), bcc(""), reply(""), subject(""), message("") | 161 | :Opie::Core::ORefCount(),name(""), mail(""), to(""), cc(""), bcc(""), reply(""), subject(""), message("") |
161 | { | 162 | { |
162 | } | 163 | } |
163 | 164 | ||
164 | MHFolder::MHFolder(const QString&disp_name,const QString&mbox) | 165 | MHFolder::MHFolder(const QString&disp_name,const QString&mbox) |
165 | : Folder( disp_name,"/" ) | 166 | : Folder( disp_name,"/" ) |
166 | { | 167 | { |
167 | separator = "/"; | 168 | separator = "/"; |
168 | name = mbox; | 169 | name = mbox; |
169 | if (!disp_name.startsWith("/") && disp_name.length()>0) | 170 | if (!disp_name.startsWith("/") && disp_name.length()>0) |
170 | name+="/"; | 171 | name+="/"; |
171 | name+=disp_name; | 172 | name+=disp_name; |
172 | if (disp_name.length()==0) { | 173 | if (disp_name.length()==0) { |
173 | nameDisplay = separator; | 174 | nameDisplay = separator; |
174 | } | 175 | } |
175 | prefix = mbox; | 176 | prefix = mbox; |
176 | } | 177 | } |
177 | 178 | ||
178 | MHFolder::~MHFolder() | 179 | MHFolder::~MHFolder() |
179 | { | 180 | { |
180 | } | 181 | } |
diff --git a/kmicromail/libmailwrapper/mailwrapper.h b/kmicromail/libmailwrapper/mailwrapper.h index cefe64e..2ba908b 100644 --- a/kmicromail/libmailwrapper/mailwrapper.h +++ b/kmicromail/libmailwrapper/mailwrapper.h | |||
@@ -1,128 +1,128 @@ | |||
1 | #ifndef MAILWRAPPER_H | 1 | #ifndef MAILWRAPPER_H |
2 | #define MAILWRAPPER_H | 2 | #define MAILWRAPPER_H |
3 | 3 | ||
4 | #include <qpe/applnk.h> | 4 | #include <qpe/applnk.h> |
5 | 5 | ||
6 | #include <qbitarray.h> | 6 | #include <qbitarray.h> |
7 | #include <qdatetime.h> | 7 | #include <qdatetime.h> |
8 | #include <qfileinfo.h> | 8 | #include <qfileinfo.h> |
9 | #include <kiconloader.h> | 9 | #include <kiconloader.h> |
10 | 10 | ||
11 | #include "settings.h" | 11 | #include "settings.h" |
12 | 12 | ||
13 | #include <opie2/osmartpointer.h> | 13 | #include <opie2/osmartpointer.h> |
14 | /* | 14 | /* |
15 | class Attachment | 15 | class Attachment |
16 | { | 16 | { |
17 | public: | 17 | public: |
18 | Attachment( DocLnk lnk ); | 18 | Attachment( DocLnk lnk ); |
19 | virtual ~Attachment(){} | 19 | virtual ~Attachment(){} |
20 | const QString getFileName()const{ return doc.file(); } | 20 | const QString getFileName()const{ return doc.file(); } |
21 | const QString getName()const{ return doc.name(); } | 21 | const QString getName()const{ return doc.name(); } |
22 | const QString getMimeType()const{ return doc.type(); } | 22 | const QString getMimeType()const{ return doc.type(); } |
23 | const QPixmap getPixmap()const{ return doc.pixmap(); } | 23 | const QPixmap getPixmap()const{ return doc.pixmap(); } |
24 | const int getSize()const { return size; } | 24 | const int getSize()const { return size; } |
25 | DocLnk getDocLnk() { return doc; } | 25 | DocLnk getDocLnk() { return doc; } |
26 | 26 | ||
27 | protected: | 27 | protected: |
28 | DocLnk doc; | 28 | DocLnk doc; |
29 | int size; | 29 | int size; |
30 | 30 | ||
31 | }; | 31 | }; |
32 | */ | 32 | */ |
33 | 33 | ||
34 | class Attachment | 34 | class Attachment |
35 | { | 35 | { |
36 | public: | 36 | public: |
37 | Attachment( QString lnk ); | 37 | Attachment( QString lnk ); |
38 | virtual ~Attachment(){} | 38 | virtual ~Attachment(){} |
39 | const QString getFileName()const{ return doc; } | 39 | const QString getFileName()const{ return doc; } |
40 | const QString getName()const{ return QFileInfo( doc ).baseName (); } | 40 | const QString getName()const{ return QFileInfo( doc ).baseName (); } |
41 | const QString getMimeType()const{ return QFileInfo( doc ).extension(false); } | 41 | const QString getMimeType()const{ return QFileInfo( doc ).extension(false); } |
42 | const QPixmap getPixmap()const{ return mPix; } | 42 | const QPixmap getPixmap()const{ return mPix; } |
43 | const int getSize()const { return size; } | 43 | const int getSize()const { return size; } |
44 | QString getDocLnk() { return doc; } | 44 | QString getDocLnk() { return doc; } |
45 | 45 | ||
46 | protected: | 46 | protected: |
47 | QPixmap mPix; | 47 | QPixmap mPix; |
48 | QString doc; | 48 | QString doc; |
49 | int size; | 49 | int size; |
50 | 50 | ||
51 | }; | 51 | }; |
52 | 52 | ||
53 | class Mail:public Opie::Core::ORefCount | 53 | class Mail:public Opie::Core::ORefCount |
54 | { | 54 | { |
55 | public: | 55 | public: |
56 | Mail(); | 56 | Mail(); |
57 | /* Possible that this destructor must not be declared virtual | 57 | /* Possible that this destructor must not be declared virtual |
58 | * 'cause it seems that it will never have some child classes. | 58 | * 'cause it seems that it will never have some child classes. |
59 | * in this case this object will not get a virtual table -> memory and | 59 | * in this case this object will not get a virtual table -> memory and |
60 | * speed will be a little bit better? | 60 | * speed will be a little bit better? |
61 | */ | 61 | */ |
62 | virtual ~Mail(){} | 62 | virtual ~Mail(){} |
63 | void addAttachment( Attachment *att ) { attList.append( att ); } | 63 | void addAttachment( Attachment *att ) { attList.append( att ); } |
64 | const QList<Attachment>& getAttachments()const { return attList; } | 64 | const QList<Attachment>& getAttachments()const { return attList; } |
65 | void removeAttachment( Attachment *att ) { attList.remove( att ); } | 65 | void removeAttachment( Attachment *att ) { attList.remove( att ); } |
66 | const QString&getName()const { return name; } | 66 | const QString&getName()const { return name; } |
67 | void setName( QString s ) { name = s; } | 67 | void setName( QString s ) { name = s; } |
68 | const QString&getMail()const{ return mail; } | 68 | const QString&getMail()const{ return mail; } |
69 | void setMail( const QString&s ) { mail = s; } | 69 | void setMail( const QString&s ) { mail = s; } |
70 | const QString&getTo()const{ return to; } | 70 | const QString&getTo()const{ return to; } |
71 | void setTo( const QString&s ) { to = s; } | 71 | void setTo( const QString&s ) { to = s; } |
72 | const QString&getCC()const{ return cc; } | 72 | const QString&getCC()const{ return cc; } |
73 | void setCC( const QString&s ) { cc = s; } | 73 | void setCC( const QString&s ) { cc = s; } |
74 | const QString&getBCC()const { return bcc; } | 74 | const QString&getBCC()const { return bcc; } |
75 | void setBCC( const QString&s ) { bcc = s; } | 75 | void setBCC( const QString&s ) { bcc = s; } |
76 | const QString&getMessage()const { return message; } | 76 | const QString&getMessage()const { return message; } |
77 | void setMessage( const QString&s ) { message = s; } | 77 | void setMessage( const QString&s ) { message = s; } |
78 | const QString&getSubject()const { return subject; } | 78 | const QString&getSubject()const { return subject; } |
79 | void setSubject( const QString&s ) { subject = s; } | 79 | void setSubject( const QString&s ) { subject = s; } |
80 | const QString&getReply()const{ return reply; } | 80 | const QString&getReply()const{ return reply; } |
81 | void setReply( const QString&a ) { reply = a; } | 81 | void setReply( const QString&a ) { reply = a; } |
82 | void setInreply(const QStringList&list){m_in_reply_to = list;} | 82 | void setInreply(const QStringList&list){m_in_reply_to = list;} |
83 | const QStringList&Inreply()const{return m_in_reply_to;} | 83 | const QStringList&Inreply()const{return m_in_reply_to;} |
84 | 84 | ||
85 | private: | 85 | private: |
86 | QList<Attachment> attList; | 86 | QList<Attachment> attList; |
87 | QString name, mail, to, cc, bcc, reply, subject, message; | 87 | QString name, mail, to, cc, bcc, reply, subject, message; |
88 | QStringList m_in_reply_to; | 88 | QStringList m_in_reply_to; |
89 | }; | 89 | }; |
90 | 90 | ||
91 | class Folder:public Opie::Core::ORefCount | 91 | class Folder:public Opie::Core::ORefCount |
92 | { | 92 | { |
93 | public: | 93 | public: |
94 | Folder( const QString&init_name,const QString&sep ); | 94 | Folder( const QString&init_name,const QString&sep ); |
95 | virtual ~Folder(); | 95 | virtual ~Folder(); |
96 | const QString&getDisplayName()const { return nameDisplay; } | 96 | const QString&getDisplayName()const { return nameDisplay; } |
97 | const QString&getName()const { return name; } | 97 | const QString&getName()const { return name; } |
98 | const QString&getPrefix()const{return prefix; } | 98 | const QString&getPrefix()const{return prefix; } |
99 | virtual bool may_select()const{return true;} | 99 | virtual bool may_select()const{return true;} |
100 | virtual bool no_inferior()const{return true;} | 100 | virtual bool no_inferior()const{return true;} |
101 | const QString&Separator()const; | 101 | const QString&Separator()const; |
102 | 102 | ||
103 | protected: | 103 | protected: |
104 | QString nameDisplay, name, separator,prefix; | 104 | QString nameDisplay, name, separator,prefix; |
105 | }; | 105 | }; |
106 | 106 | ||
107 | typedef Opie::Core::OSmartPointer<Folder> FolderP; | 107 | typedef Opie::Core::OSmartPointer<Folder> FolderP; |
108 | 108 | ||
109 | class MHFolder : public Folder | 109 | class MHFolder : public Folder |
110 | { | 110 | { |
111 | public: | 111 | public: |
112 | MHFolder(const QString&disp_name,const QString&mbox); | 112 | MHFolder(const QString&disp_name,const QString&mbox); |
113 | virtual ~MHFolder(); | 113 | virtual ~MHFolder(); |
114 | }; | 114 | }; |
115 | 115 | ||
116 | class IMAPFolder : public Folder | 116 | class IMAPFolder : public Folder |
117 | { | 117 | { |
118 | public: | 118 | public: |
119 | IMAPFolder(const QString&name, const QString&sep, bool select=true,bool noinf=false,const QString&prefix="" ); | 119 | IMAPFolder(const QString&name, const QString&sep, bool select=true,bool noinf=false,const QString&prefix="" ); |
120 | virtual ~IMAPFolder(); | 120 | virtual ~IMAPFolder(); |
121 | virtual bool may_select()const{return m_MaySelect;} | 121 | virtual bool may_select()const{return m_MaySelect;} |
122 | virtual bool no_inferior()const{return m_NoInferior;} | 122 | virtual bool no_inferior()const{return m_NoInferior;} |
123 | private: | ||
124 | static QString decodeFolderName( const QString &name ); | 123 | static QString decodeFolderName( const QString &name ); |
124 | private: | ||
125 | bool m_MaySelect,m_NoInferior; | 125 | bool m_MaySelect,m_NoInferior; |
126 | }; | 126 | }; |
127 | 127 | ||
128 | #endif | 128 | #endif |