author | zautrix <zautrix> | 2004-08-31 21:01:18 (UTC) |
---|---|---|
committer | zautrix <zautrix> | 2004-08-31 21:01:18 (UTC) |
commit | 3f5c51234c8068f3d4826a2a0066648ace21a19f (patch) (unidiff) | |
tree | 91b76c1c7ddec6628c573e409070070747d99feb /kmicromail/opiemail.cpp | |
parent | 95f8d4f1de557bd25ae38807d970208399cec5d1 (diff) | |
download | kdepimpi-3f5c51234c8068f3d4826a2a0066648ace21a19f.zip kdepimpi-3f5c51234c8068f3d4826a2a0066648ace21a19f.tar.gz kdepimpi-3f5c51234c8068f3d4826a2a0066648ace21a19f.tar.bz2 |
Enhancements of kopiemail
-rw-r--r-- | kmicromail/opiemail.cpp | 44 |
1 files changed, 44 insertions, 0 deletions
diff --git a/kmicromail/opiemail.cpp b/kmicromail/opiemail.cpp index d522ad0..3fbdcec 100644 --- a/kmicromail/opiemail.cpp +++ b/kmicromail/opiemail.cpp | |||
@@ -1,24 +1,25 @@ | |||
1 | // CHANGED 2004-09-31 Lutz Rogowski | ||
1 | // CHANGED 2004-08-06 Lutz Rogowski | 2 | // CHANGED 2004-08-06 Lutz Rogowski |
2 | 3 | ||
3 | #include "settingsdialog.h" | 4 | #include "settingsdialog.h" |
4 | #include "opiemail.h" | 5 | #include "opiemail.h" |
5 | #include "editaccounts.h" | 6 | #include "editaccounts.h" |
6 | #include "composemail.h" | 7 | #include "composemail.h" |
7 | #include "mailistviewitem.h" | 8 | #include "mailistviewitem.h" |
8 | #include "viewmail.h" | 9 | #include "viewmail.h" |
9 | #include "selectstore.h" | 10 | #include "selectstore.h" |
10 | #include "selectsmtp.h" | 11 | #include "selectsmtp.h" |
11 | 12 | ||
12 | #include <qmessagebox.h> | 13 | #include <qmessagebox.h> |
13 | 14 | ||
14 | #include <qpe/qpeapplication.h> | 15 | #include <qpe/qpeapplication.h> |
15 | #include <libmailwrapper/smtpwrapper.h> | 16 | #include <libmailwrapper/smtpwrapper.h> |
16 | #include <libmailwrapper/mailtypes.h> | 17 | #include <libmailwrapper/mailtypes.h> |
17 | #include <libmailwrapper/abstractmail.h> | 18 | #include <libmailwrapper/abstractmail.h> |
18 | /* OPIE */ | 19 | /* OPIE */ |
19 | //#include <qpe/resource.h> | 20 | //#include <qpe/resource.h> |
20 | #include <qpe/qpeapplication.h> | 21 | #include <qpe/qpeapplication.h> |
21 | 22 | ||
22 | /* QT */ | 23 | /* QT */ |
23 | 24 | ||
24 | using namespace Opie::Core; | 25 | using namespace Opie::Core; |
@@ -257,48 +258,49 @@ void OpieMail::clearSelection() | |||
257 | 258 | ||
258 | } | 259 | } |
259 | 260 | ||
260 | void OpieMail::mailHold(int button, QListViewItem *item,const QPoint&,int ) | 261 | void OpieMail::mailHold(int button, QListViewItem *item,const QPoint&,int ) |
261 | { | 262 | { |
262 | if (!mailView->currentItem()) return; | 263 | if (!mailView->currentItem()) return; |
263 | MAILLIB::ATYPE mailtype = ((MailListViewItem*)mailView->currentItem() )->wrapperType(); | 264 | MAILLIB::ATYPE mailtype = ((MailListViewItem*)mailView->currentItem() )->wrapperType(); |
264 | /* just the RIGHT button - or hold on pda */ | 265 | /* just the RIGHT button - or hold on pda */ |
265 | if (button!=2) {return;} | 266 | if (button!=2) {return;} |
266 | if (!item) return; | 267 | if (!item) return; |
267 | QPopupMenu *m = new QPopupMenu(0); | 268 | QPopupMenu *m = new QPopupMenu(0); |
268 | if (m) | 269 | if (m) |
269 | { | 270 | { |
270 | if (mailtype==MAILLIB::A_NNTP) { | 271 | if (mailtype==MAILLIB::A_NNTP) { |
271 | m->insertItem(tr("Read this posting"),this,SLOT(displayMail())); | 272 | m->insertItem(tr("Read this posting"),this,SLOT(displayMail())); |
272 | // m->insertItem(tr("Copy this posting"),this,SLOT(slotMoveCopyMail())); | 273 | // m->insertItem(tr("Copy this posting"),this,SLOT(slotMoveCopyMail())); |
273 | } else { | 274 | } else { |
274 | if (folderView->currentisDraft()) { | 275 | if (folderView->currentisDraft()) { |
275 | m->insertItem(tr("Edit this mail"),this,SLOT(reEditMail())); | 276 | m->insertItem(tr("Edit this mail"),this,SLOT(reEditMail())); |
276 | } | 277 | } |
277 | m->insertItem(tr("Read this mail"),this,SLOT(displayMail())); | 278 | m->insertItem(tr("Read this mail"),this,SLOT(displayMail())); |
278 | m->insertItem(tr("Copy/Move this mail"),this,SLOT(slotMoveCopyMail())); | 279 | m->insertItem(tr("Copy/Move this mail"),this,SLOT(slotMoveCopyMail())); |
279 | m->insertItem(tr("Delete this mail"),this,SLOT(slotDeleteMail())); | 280 | m->insertItem(tr("Delete this mail"),this,SLOT(slotDeleteMail())); |
280 | m->insertSeparator(); | 281 | m->insertSeparator(); |
282 | m->insertItem(tr("Copy/Move all selected mail"),this,SLOT(slotMoveCopyAllMail())); | ||
281 | m->insertItem(tr("Delete all selected mails"),this,SLOT(slotDeleteAllMail())); | 283 | m->insertItem(tr("Delete all selected mails"),this,SLOT(slotDeleteAllMail())); |
282 | m->insertItem(tr("Clear selection"),this,SLOT(clearSelection())); | 284 | m->insertItem(tr("Clear selection"),this,SLOT(clearSelection())); |
283 | } | 285 | } |
284 | m->setFocus(); | 286 | m->setFocus(); |
285 | m->exec( QPoint( QCursor::pos().x(), QCursor::pos().y()) ); | 287 | m->exec( QPoint( QCursor::pos().x(), QCursor::pos().y()) ); |
286 | delete m; | 288 | delete m; |
287 | } | 289 | } |
288 | } | 290 | } |
289 | 291 | ||
290 | void OpieMail::slotShowFolders( bool show ) | 292 | void OpieMail::slotShowFolders( bool show ) |
291 | { | 293 | { |
292 | if ( show && folderView->isHidden() ) | 294 | if ( show && folderView->isHidden() ) |
293 | { | 295 | { |
294 | folderView->show(); | 296 | folderView->show(); |
295 | } | 297 | } |
296 | else if ( !show && !folderView->isHidden() ) | 298 | else if ( !show && !folderView->isHidden() ) |
297 | { | 299 | { |
298 | folderView->hide(); | 300 | folderView->hide(); |
299 | } | 301 | } |
300 | } | 302 | } |
301 | 303 | ||
302 | void OpieMail::refreshMailView(const QValueList<RecMailP>&list) | 304 | void OpieMail::refreshMailView(const QValueList<RecMailP>&list) |
303 | { | 305 | { |
304 | MailListViewItem*item = 0; | 306 | MailListViewItem*item = 0; |
@@ -331,34 +333,76 @@ void OpieMail::slotMoveCopyMail() | |||
331 | if (!mailView->currentItem()) return; | 333 | if (!mailView->currentItem()) return; |
332 | RecMailP mail = ((MailListViewItem*)mailView->currentItem() )->data(); | 334 | RecMailP mail = ((MailListViewItem*)mailView->currentItem() )->data(); |
333 | AbstractMail*targetMail = 0; | 335 | AbstractMail*targetMail = 0; |
334 | QString targetFolder = ""; | 336 | QString targetFolder = ""; |
335 | Selectstore sels; | 337 | Selectstore sels; |
336 | folderView->setupFolderselect(&sels); | 338 | folderView->setupFolderselect(&sels); |
337 | if (!sels.exec()) return; | 339 | if (!sels.exec()) return; |
338 | targetMail = sels.currentMail(); | 340 | targetMail = sels.currentMail(); |
339 | targetFolder = sels.currentFolder(); | 341 | targetFolder = sels.currentFolder(); |
340 | if ( (mail->Wrapper()==targetMail && mail->getMbox()==targetFolder) || | 342 | if ( (mail->Wrapper()==targetMail && mail->getMbox()==targetFolder) || |
341 | targetFolder.isEmpty()) | 343 | targetFolder.isEmpty()) |
342 | { | 344 | { |
343 | return; | 345 | return; |
344 | } | 346 | } |
345 | if (sels.newFolder() && !targetMail->createMbox(targetFolder)) | 347 | if (sels.newFolder() && !targetMail->createMbox(targetFolder)) |
346 | { | 348 | { |
347 | QMessageBox::critical(0,tr("Error creating new Folder"), | 349 | QMessageBox::critical(0,tr("Error creating new Folder"), |
348 | tr("<center>Error while creating<br>new folder - breaking.</center>")); | 350 | tr("<center>Error while creating<br>new folder - breaking.</center>")); |
349 | return; | 351 | return; |
350 | } | 352 | } |
351 | mail->Wrapper()->mvcpMail(mail,targetFolder,targetMail,sels.moveMails()); | 353 | mail->Wrapper()->mvcpMail(mail,targetFolder,targetMail,sels.moveMails()); |
352 | folderView->refreshCurrent(); | 354 | folderView->refreshCurrent(); |
353 | } | 355 | } |
354 | 356 | ||
357 | void OpieMail::slotMoveCopyAllMail() | ||
358 | { | ||
359 | |||
360 | if (!mailView->currentItem()) return; | ||
361 | QValueList<RecMailP> t; | ||
362 | if ( QMessageBox::warning(this, tr("Copy/Move all selected mails"), tr("Do you really want to copy/move\nall selected mails?" ) , QMessageBox::Yes, QMessageBox::No ) == QMessageBox::Yes ) | ||
363 | { | ||
364 | MailListViewItem* item = (MailListViewItem*)mailView->firstChild (); | ||
365 | while ( item ) { | ||
366 | if ( item->isSelected() ) { | ||
367 | t.append( item->data() ); | ||
368 | } | ||
369 | item = (MailListViewItem*)item->nextSibling(); | ||
370 | } | ||
371 | } | ||
372 | else | ||
373 | return; | ||
374 | if ( t.count() == 0 ) | ||
375 | return; | ||
376 | RecMailP mail = t.first(); | ||
377 | AbstractMail*targetMail = 0; | ||
378 | QString targetFolder = ""; | ||
379 | Selectstore sels; | ||
380 | folderView->setupFolderselect(&sels); | ||
381 | if (!sels.exec()) return; | ||
382 | targetMail = sels.currentMail(); | ||
383 | targetFolder = sels.currentFolder(); | ||
384 | if ( (mail->Wrapper()==targetMail && mail->getMbox()==targetFolder) || | ||
385 | targetFolder.isEmpty()) | ||
386 | { | ||
387 | return; | ||
388 | } | ||
389 | if (sels.newFolder() && !targetMail->createMbox(targetFolder)) | ||
390 | { | ||
391 | QMessageBox::critical(0,tr("Error creating new Folder"), | ||
392 | tr("<center>Error while creating<br>new folder - breaking.</center>")); | ||
393 | return; | ||
394 | } | ||
395 | mail->Wrapper()->mvcpMailList(t,targetFolder,targetMail,sels.moveMails()); | ||
396 | folderView->refreshCurrent(); | ||
397 | } | ||
398 | |||
355 | void OpieMail::reEditMail() | 399 | void OpieMail::reEditMail() |
356 | { | 400 | { |
357 | if (!mailView->currentItem()) return; | 401 | if (!mailView->currentItem()) return; |
358 | 402 | ||
359 | ComposeMail compose( settings, this, 0, true , WStyle_ContextHelp ); | 403 | ComposeMail compose( settings, this, 0, true , WStyle_ContextHelp ); |
360 | compose.reEditMail(((MailListViewItem*)mailView->currentItem() )->data()); | 404 | compose.reEditMail(((MailListViewItem*)mailView->currentItem() )->data()); |
361 | compose.slotAdjustColumns(); | 405 | compose.slotAdjustColumns(); |
362 | compose.showMaximized(); | 406 | compose.showMaximized(); |
363 | compose.exec(); | 407 | compose.exec(); |
364 | } | 408 | } |