summaryrefslogtreecommitdiffabout
path: root/kmicromail/opiemail.cpp
authorzautrix <zautrix>2004-08-31 21:01:18 (UTC)
committer zautrix <zautrix>2004-08-31 21:01:18 (UTC)
commit3f5c51234c8068f3d4826a2a0066648ace21a19f (patch) (unidiff)
tree91b76c1c7ddec6628c573e409070070747d99feb /kmicromail/opiemail.cpp
parent95f8d4f1de557bd25ae38807d970208399cec5d1 (diff)
downloadkdepimpi-3f5c51234c8068f3d4826a2a0066648ace21a19f.zip
kdepimpi-3f5c51234c8068f3d4826a2a0066648ace21a19f.tar.gz
kdepimpi-3f5c51234c8068f3d4826a2a0066648ace21a19f.tar.bz2
Enhancements of kopiemail
Diffstat (limited to 'kmicromail/opiemail.cpp') (more/less context) (ignore whitespace changes)
-rw-r--r--kmicromail/opiemail.cpp44
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,16 +1,17 @@
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>
@@ -265,32 +266,33 @@ void OpieMail::mailHold(int button, QListViewItem *item,const QPoint&,int )
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
290void OpieMail::slotShowFolders( bool show ) 292void 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() )
@@ -339,26 +341,68 @@ void OpieMail::slotMoveCopyMail()
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
357void 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
355void OpieMail::reEditMail() 399void 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}