summaryrefslogtreecommitdiffabout
path: root/kmicromail/opiemail.cpp
Unidiff
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,364 +1,408 @@
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
24using namespace Opie::Core; 25using namespace Opie::Core;
25 26
26OpieMail::OpieMail( QWidget *parent, const char *name, WFlags flags ) 27OpieMail::OpieMail( QWidget *parent, const char *name, WFlags flags )
27 : MainWindow( parent, name) //, WStyle_ContextHelp ) 28 : MainWindow( parent, name) //, WStyle_ContextHelp )
28{ 29{
29 settings = new Settings(); 30 settings = new Settings();
30 31
31 folderView->populate( settings->getAccounts() ); 32 folderView->populate( settings->getAccounts() );
32 33
33} 34}
34 35
35OpieMail::~OpieMail() 36OpieMail::~OpieMail()
36{ 37{
37 if (settings) delete settings; 38 if (settings) delete settings;
38} 39}
39 40
40void OpieMail::appMessage(const QCString &msg, const QByteArray &data) 41void OpieMail::appMessage(const QCString &msg, const QByteArray &data)
41{ 42{
42 43
43} 44}
44#include <stdlib.h> 45#include <stdlib.h>
45void OpieMail::message(const QCString &msg, const QByteArray &data) 46void OpieMail::message(const QCString &msg, const QByteArray &data)
46{ 47{
47 // copied from old mail2 48 // copied from old mail2
48 static int ii = 0; 49 static int ii = 0;
49 50
50 // block second call 51 // block second call
51 if ( ii < 2 ) { 52 if ( ii < 2 ) {
52 ++ii; 53 ++ii;
53 if ( ii > 1 ) { 54 if ( ii > 1 ) {
54 qDebug("qcop call blocked "); 55 qDebug("qcop call blocked ");
55 return; 56 return;
56 } 57 }
57 } 58 }
58 //qDebug("KM:appMessage %d *%s* %x", ii, msg.data(), this); 59 //qDebug("KM:appMessage %d *%s* %x", ii, msg.data(), this);
59 if (msg == "writeMail(QString,QString)") 60 if (msg == "writeMail(QString,QString)")
60 { 61 {
61 QDataStream stream(data,IO_ReadOnly); 62 QDataStream stream(data,IO_ReadOnly);
62 QString name, email; 63 QString name, email;
63 stream >> name >> email; 64 stream >> name >> email;
64 // removing the whitespaces at beginning and end is needed! 65 // removing the whitespaces at beginning and end is needed!
65 slotwriteMail(name.stripWhiteSpace(),email.stripWhiteSpace()); 66 slotwriteMail(name.stripWhiteSpace(),email.stripWhiteSpace());
66 } 67 }
67 else if (msg == "newMail()") 68 else if (msg == "newMail()")
68 { 69 {
69 slotComposeMail(); 70 slotComposeMail();
70 } 71 }
71 else if (msg == "newMail(QString)") 72 else if (msg == "newMail(QString)")
72 { 73 {
73 QDataStream stream(data,IO_ReadOnly); 74 QDataStream stream(data,IO_ReadOnly);
74 QString nameemail; 75 QString nameemail;
75 stream >> nameemail; 76 stream >> nameemail;
76 // the format is 77 // the format is
77 // NAME <EMAIL>:SUBJECT 78 // NAME <EMAIL>:SUBJECT
78 //qDebug("message %s ", nameemail.latin1()); 79 //qDebug("message %s ", nameemail.latin1());
79 80
80 slotwriteMail2( nameemail ); 81 slotwriteMail2( nameemail );
81 } 82 }
82} 83}
83void OpieMail::slotwriteMail2(const QString& namemail ) 84void OpieMail::slotwriteMail2(const QString& namemail )
84{ 85{
85 // qDebug("OpieMail::slotwriteMail2 "); 86 // qDebug("OpieMail::slotwriteMail2 ");
86 qApp->processEvents(); 87 qApp->processEvents();
87 ComposeMail compose( settings, this, 0, true ); 88 ComposeMail compose( settings, this, 0, true );
88 if ( !namemail.isEmpty() ) { 89 if ( !namemail.isEmpty() ) {
89 QString to = namemail; 90 QString to = namemail;
90 if ( namemail.find( " <") > 1 ) { 91 if ( namemail.find( " <") > 1 ) {
91 to = "\"" +to.replace( QRegExp( " <"), "\" <") ; 92 to = "\"" +to.replace( QRegExp( " <"), "\" <") ;
92 } else 93 } else
93 if ( namemail.find( "<") > 1 ) { 94 if ( namemail.find( "<") > 1 ) {
94 to = "\"" +to.replace( QRegExp( "<"), "\" <") ; 95 to = "\"" +to.replace( QRegExp( "<"), "\" <") ;
95 } 96 }
96 int sub = to.find( ">:"); 97 int sub = to.find( ">:");
97 if ( sub > 0 ) { 98 if ( sub > 0 ) {
98 compose.setTo( to.left(sub+1) ); 99 compose.setTo( to.left(sub+1) );
99 compose.setSubject( to.mid(sub+2) ); 100 compose.setSubject( to.mid(sub+2) );
100 } else 101 } else
101 compose.setTo( to ); 102 compose.setTo( to );
102 } 103 }
103 compose.slotAdjustColumns(); 104 compose.slotAdjustColumns();
104 compose.showMaximized(); 105 compose.showMaximized();
105 compose.exec(); 106 compose.exec();
106 //qDebug("retttich "); 107 //qDebug("retttich ");
107} 108}
108void OpieMail::slotwriteMail(const QString&name,const QString&email) 109void OpieMail::slotwriteMail(const QString&name,const QString&email)
109{ 110{
110 // qDebug("OpieMail::slotwriteMail "); 111 // qDebug("OpieMail::slotwriteMail ");
111 ComposeMail compose( settings, this, 0, true , WStyle_ContextHelp ); 112 ComposeMail compose( settings, this, 0, true , WStyle_ContextHelp );
112 if (!email.isEmpty()) 113 if (!email.isEmpty())
113 { 114 {
114 if (!name.isEmpty()) 115 if (!name.isEmpty())
115 { 116 {
116 compose.setTo("\"" + name + "\"" + " " + "<"+ email + ">"); 117 compose.setTo("\"" + name + "\"" + " " + "<"+ email + ">");
117 } 118 }
118 else 119 else
119 { 120 {
120 compose.setTo(email); 121 compose.setTo(email);
121 } 122 }
122 } 123 }
123 compose.slotAdjustColumns(); 124 compose.slotAdjustColumns();
124 compose.showMaximized(); 125 compose.showMaximized();
125 compose.exec(); 126 compose.exec();
126} 127}
127 128
128void OpieMail::slotComposeMail() 129void OpieMail::slotComposeMail()
129{ 130{
130 slotwriteMail2( QString () ); 131 slotwriteMail2( QString () );
131 //slotwriteMail(0l,0l); 132 //slotwriteMail(0l,0l);
132} 133}
133 134
134void OpieMail::slotSendQueued() 135void OpieMail::slotSendQueued()
135{ 136{
136 SMTPaccount *smtp = 0; 137 SMTPaccount *smtp = 0;
137 138
138 QList<Account> list = settings->getAccounts(); 139 QList<Account> list = settings->getAccounts();
139 QList<SMTPaccount> smtpList; 140 QList<SMTPaccount> smtpList;
140 smtpList.setAutoDelete(false); 141 smtpList.setAutoDelete(false);
141 Account *it; 142 Account *it;
142 for ( it = list.first(); it; it = list.next() ) 143 for ( it = list.first(); it; it = list.next() )
143 { 144 {
144 if ( it->getType() == MAILLIB::A_SMTP ) 145 if ( it->getType() == MAILLIB::A_SMTP )
145 { 146 {
146 smtp = static_cast<SMTPaccount *>(it); 147 smtp = static_cast<SMTPaccount *>(it);
147 smtpList.append(smtp); 148 smtpList.append(smtp);
148 } 149 }
149 } 150 }
150 if (smtpList.count()==0) 151 if (smtpList.count()==0)
151 { 152 {
152 QMessageBox::information(0,tr("Info"),tr("Define a smtp account first!\n")); 153 QMessageBox::information(0,tr("Info"),tr("Define a smtp account first!\n"));
153 return; 154 return;
154 } 155 }
155 if (smtpList.count()==1) 156 if (smtpList.count()==1)
156 { 157 {
157 smtp = smtpList.at(0); 158 smtp = smtpList.at(0);
158 } 159 }
159 else 160 else
160 { 161 {
161 smtp = 0; 162 smtp = 0;
162 selectsmtp selsmtp; 163 selectsmtp selsmtp;
163 selsmtp.setSelectionlist(&smtpList); 164 selsmtp.setSelectionlist(&smtpList);
164 selsmtp.showMaximized(); 165 selsmtp.showMaximized();
165 if ( selsmtp.exec() == QDialog::Accepted ) 166 if ( selsmtp.exec() == QDialog::Accepted )
166 { 167 {
167 smtp = selsmtp.selected_smtp(); 168 smtp = selsmtp.selected_smtp();
168 } 169 }
169 } 170 }
170 if (smtp) 171 if (smtp)
171 { 172 {
172 SMTPwrapper * wrap = new SMTPwrapper(smtp); 173 SMTPwrapper * wrap = new SMTPwrapper(smtp);
173 if ( wrap->flushOutbox() ) 174 if ( wrap->flushOutbox() )
174 { 175 {
175 QMessageBox::information(0,tr("Info"),tr("Mail queue flushed")); 176 QMessageBox::information(0,tr("Info"),tr("Mail queue flushed"));
176 } 177 }
177 delete wrap; 178 delete wrap;
178 } 179 }
179} 180}
180 181
181void OpieMail::slotSearchMails() 182void OpieMail::slotSearchMails()
182{ 183{
183 qDebug("OpieMail::slotSearchMails():not implemented "); 184 qDebug("OpieMail::slotSearchMails():not implemented ");
184} 185}
185 186
186void OpieMail::slotEditSettings() 187void OpieMail::slotEditSettings()
187{ 188{
188 SettingsDialog settingsDialog( this, 0, true, WStyle_ContextHelp ); 189 SettingsDialog settingsDialog( this, 0, true, WStyle_ContextHelp );
189 settingsDialog.showMaximized(); 190 settingsDialog.showMaximized();
190 settingsDialog.exec(); 191 settingsDialog.exec();
191} 192}
192 193
193void OpieMail::slotEditAccounts() 194void OpieMail::slotEditAccounts()
194{ 195{
195 EditAccounts eaDialog( settings, this, 0, true, WStyle_ContextHelp ); 196 EditAccounts eaDialog( settings, this, 0, true, WStyle_ContextHelp );
196 eaDialog.slotAdjustColumns(); 197 eaDialog.slotAdjustColumns();
197 eaDialog.showMaximized(); 198 eaDialog.showMaximized();
198 eaDialog.exec(); 199 eaDialog.exec();
199 if ( settings ) delete settings; 200 if ( settings ) delete settings;
200 settings = new Settings(); 201 settings = new Settings();
201 202
202 folderView->populate( settings->getAccounts() ); 203 folderView->populate( settings->getAccounts() );
203} 204}
204 205
205void OpieMail::displayMail() 206void OpieMail::displayMail()
206{ 207{
207 QListViewItem*item = mailView->currentItem(); 208 QListViewItem*item = mailView->currentItem();
208 if (!item) return; 209 if (!item) return;
209 RecMailP mail = ((MailListViewItem*)item)->data(); 210 RecMailP mail = ((MailListViewItem*)item)->data();
210 RecBodyP body = folderView->fetchBody(mail); 211 RecBodyP body = folderView->fetchBody(mail);
211 ViewMail readMail( this,"", Qt::WType_Modal | WStyle_ContextHelp ); 212 ViewMail readMail( this,"", Qt::WType_Modal | WStyle_ContextHelp );
212 readMail.setBody( body ); 213 readMail.setBody( body );
213 readMail.setMail( mail ); 214 readMail.setMail( mail );
214 readMail.showMaximized(); 215 readMail.showMaximized();
215 readMail.exec(); 216 readMail.exec();
216 217
217 if ( readMail.deleted ) 218 if ( readMail.deleted )
218 { 219 {
219 folderView->refreshCurrent(); 220 folderView->refreshCurrent();
220 } 221 }
221 else 222 else
222 { 223 {
223 ( (MailListViewItem*)item )->setPixmap( 0, QPixmap() ); 224 ( (MailListViewItem*)item )->setPixmap( 0, QPixmap() );
224 } 225 }
225} 226}
226 227
227void OpieMail::slotDeleteMail() 228void OpieMail::slotDeleteMail()
228{ 229{
229 if (!mailView->currentItem()) return; 230 if (!mailView->currentItem()) return;
230 RecMailP mail = ((MailListViewItem*)mailView->currentItem() )->data(); 231 RecMailP mail = ((MailListViewItem*)mailView->currentItem() )->data();
231 if ( QMessageBox::warning(this, tr("Delete Mail"), QString( tr("<p>Do you really want to delete this mail? <br><br>" ) + mail->getFrom() + " - " + mail->getSubject() ) , QMessageBox::Yes, QMessageBox::No ) == QMessageBox::Yes ) 232 if ( QMessageBox::warning(this, tr("Delete Mail"), QString( tr("<p>Do you really want to delete this mail? <br><br>" ) + mail->getFrom() + " - " + mail->getSubject() ) , QMessageBox::Yes, QMessageBox::No ) == QMessageBox::Yes )
232 { 233 {
233 mail->Wrapper()->deleteMail( mail ); 234 mail->Wrapper()->deleteMail( mail );
234 folderView->refreshCurrent(); 235 folderView->refreshCurrent();
235 } 236 }
236} 237}
237void OpieMail::slotDeleteAllMail() 238void OpieMail::slotDeleteAllMail()
238{ 239{
239 if (!mailView->currentItem()) return; 240 if (!mailView->currentItem()) return;
240 RecMailP mail = ((MailListViewItem*)mailView->currentItem() )->data(); 241 RecMailP mail = ((MailListViewItem*)mailView->currentItem() )->data();
241 if ( QMessageBox::warning(this, tr("Delete All Mails"), tr("Do you really want to delete\nall selected mails?" ) , QMessageBox::Yes, QMessageBox::No ) == QMessageBox::Yes ) 242 if ( QMessageBox::warning(this, tr("Delete All Mails"), tr("Do you really want to delete\nall selected mails?" ) , QMessageBox::Yes, QMessageBox::No ) == QMessageBox::Yes )
242 { 243 {
243 MailListViewItem* item = (MailListViewItem*)mailView->firstChild (); 244 MailListViewItem* item = (MailListViewItem*)mailView->firstChild ();
244 while ( item ) { 245 while ( item ) {
245 if ( item->isSelected() ) { 246 if ( item->isSelected() ) {
246 RecMailP mail = item->data(); 247 RecMailP mail = item->data();
247 mail->Wrapper()->deleteMail( mail ); 248 mail->Wrapper()->deleteMail( mail );
248 } 249 }
249 item = (MailListViewItem*)item->nextSibling(); 250 item = (MailListViewItem*)item->nextSibling();
250 } 251 }
251 folderView->refreshCurrent(); 252 folderView->refreshCurrent();
252 } 253 }
253} 254}
254void OpieMail::clearSelection() 255void OpieMail::clearSelection()
255{ 256{
256 mailView->clearSelection(); 257 mailView->clearSelection();
257 258
258} 259}
259 260
260void OpieMail::mailHold(int button, QListViewItem *item,const QPoint&,int ) 261void 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
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() )
297 { 299 {
298 folderView->hide(); 300 folderView->hide();
299 } 301 }
300} 302}
301 303
302void OpieMail::refreshMailView(const QValueList<RecMailP>&list) 304void OpieMail::refreshMailView(const QValueList<RecMailP>&list)
303{ 305{
304 MailListViewItem*item = 0; 306 MailListViewItem*item = 0;
305 mailView->clear(); 307 mailView->clear();
306 308
307 QValueList<RecMailP>::ConstIterator it; 309 QValueList<RecMailP>::ConstIterator it;
308 for (it = list.begin(); it != list.end();++it) 310 for (it = list.begin(); it != list.end();++it)
309 { 311 {
310 item = new MailListViewItem(mailView,item); 312 item = new MailListViewItem(mailView,item);
311 item->storeData((*it)); 313 item->storeData((*it));
312 item->showEntry(); 314 item->showEntry();
313 } 315 }
314} 316}
315 317
316void OpieMail::mailLeftClicked( QListViewItem *item ) 318void OpieMail::mailLeftClicked( QListViewItem *item )
317{ 319{
318 mailView->clearSelection(); 320 mailView->clearSelection();
319 /* just LEFT button - or tap with stylus on pda */ 321 /* just LEFT button - or tap with stylus on pda */
320 //if (button!=1) return; 322 //if (button!=1) return;
321 if (!item) return; 323 if (!item) return;
322 if (folderView->currentisDraft()) { 324 if (folderView->currentisDraft()) {
323 reEditMail(); 325 reEditMail();
324 } else { 326 } else {
325 displayMail(); 327 displayMail();
326 } 328 }
327} 329}
328 330
329void OpieMail::slotMoveCopyMail() 331void OpieMail::slotMoveCopyMail()
330{ 332{
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
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}