summaryrefslogtreecommitdiffabout
path: root/kmicromail/opiemail.cpp
Unidiff
Diffstat (limited to 'kmicromail/opiemail.cpp') (more/less context) (ignore whitespace changes)
-rw-r--r--kmicromail/opiemail.cpp9
1 files changed, 6 insertions, 3 deletions
diff --git a/kmicromail/opiemail.cpp b/kmicromail/opiemail.cpp
index 153c7c0..e088b9e 100644
--- a/kmicromail/opiemail.cpp
+++ b/kmicromail/opiemail.cpp
@@ -1,405 +1,408 @@
1// CHANGED 2004-09-31 Lutz Rogowski 1// CHANGED 2004-09-31 Lutz Rogowski
2// CHANGED 2004-08-06 Lutz Rogowski 2// CHANGED 2004-08-06 Lutz Rogowski
3 3
4#include "koprefsdialog.h"
5#include <libkdepim/externalapphandler.h>
6#include <libkdepim/kpimglobalprefs.h>
7#ifdef MINIKDE_KDIALOG_H
8#undef MINIKDE_KDIALOG_H
9#endif
4#include "settingsdialog.h" 10#include "settingsdialog.h"
5#include "opiemail.h" 11#include "opiemail.h"
6#include "editaccounts.h" 12#include "editaccounts.h"
7#include "composemail.h" 13#include "composemail.h"
8#include "mailistviewitem.h" 14#include "mailistviewitem.h"
9#include "viewmail.h" 15#include "viewmail.h"
10#include "selectstore.h" 16#include "selectstore.h"
11#include "selectsmtp.h" 17#include "selectsmtp.h"
12#include "accountitem.h" 18#include "accountitem.h"
13#include "koprefsdialog.h"
14#include "klocale.h" 19#include "klocale.h"
15 20
16#include <qmessagebox.h> 21#include <qmessagebox.h>
17#include <qtimer.h> 22#include <qtimer.h>
18#include <qcursor.h> 23#include <qcursor.h>
19#include <qregexp.h> 24#include <qregexp.h>
20#include <libkdepim/externalapphandler.h>
21#include <libkdepim/kpimglobalprefs.h>
22 25
23#ifdef DESKTOP_VERSION 26#ifdef DESKTOP_VERSION
24#include <qapplication.h> 27#include <qapplication.h>
25#else 28#else
26#include <qpe/qpeapplication.h> 29#include <qpe/qpeapplication.h>
27#endif 30#endif
28#include <libmailwrapper/smtpwrapper.h> 31#include <libmailwrapper/smtpwrapper.h>
29#include <libmailwrapper/mailtypes.h> 32#include <libmailwrapper/mailtypes.h>
30#include <libmailwrapper/abstractmail.h> 33#include <libmailwrapper/abstractmail.h>
31/* OPIE */ 34/* OPIE */
32//#include <qpe/resource.h> 35//#include <qpe/resource.h>
33//#include <qpe/qpeapplication.h> 36//#include <qpe/qpeapplication.h>
34 37
35/* QT */ 38/* QT */
36 39
37//using namespace Opie::Core; 40//using namespace Opie::Core;
38 41
39OpieMail::OpieMail( QWidget *parent, const char *name ) 42OpieMail::OpieMail( QWidget *parent, const char *name )
40 : MainWindow( parent, name) //, WStyle_ContextHelp ) 43 : MainWindow( parent, name) //, WStyle_ContextHelp )
41{ 44{
42 settings = new Settings(); 45 settings = new Settings();
43 46
44 folderView->populate( settings->getAccounts() ); 47 folderView->populate( settings->getAccounts() );
45 48
46} 49}
47 50
48OpieMail::~OpieMail() 51OpieMail::~OpieMail()
49{ 52{
50 if (settings) delete settings; 53 if (settings) delete settings;
51} 54}
52 55
53void OpieMail::appMessage(const QCString &msg, const QByteArray &data) 56void OpieMail::appMessage(const QCString &msg, const QByteArray &data)
54{ 57{
55 58
56} 59}
57#include <stdlib.h> 60#include <stdlib.h>
58void OpieMail::message(const QCString &msg, const QByteArray &data) 61void OpieMail::message(const QCString &msg, const QByteArray &data)
59{ 62{
60 // copied from old mail2 63 // copied from old mail2
61 static int ii = 0; 64 static int ii = 0;
62 //qDebug("QCOP CALL ############################# %d ", ii); 65 //qDebug("QCOP CALL ############################# %d ", ii);
63 //QString mess ( msg ); 66 //QString mess ( msg );
64 //qDebug("Message = %s ",mess.latin1()); 67 //qDebug("Message = %s ",mess.latin1());
65 ++ii; 68 ++ii;
66 //qDebug("KM:appMessage %d *%s* %x", ii, msg.data(), this); 69 //qDebug("KM:appMessage %d *%s* %x", ii, msg.data(), this);
67 70
68 mPendingEmail = QString::null; 71 mPendingEmail = QString::null;
69 mPendingName = QString::null; 72 mPendingName = QString::null;
70 if (msg == "writeMail(QString,QString)") 73 if (msg == "writeMail(QString,QString)")
71 { 74 {
72 //qDebug("writeMail(QString,QString) "); 75 //qDebug("writeMail(QString,QString) ");
73 QDataStream stream(data,IO_ReadOnly); 76 QDataStream stream(data,IO_ReadOnly);
74 stream >> mPendingName >> mPendingEmail; 77 stream >> mPendingName >> mPendingEmail;
75 // removing the whitespaces at beginning and end is needed! 78 // removing the whitespaces at beginning and end is needed!
76 QTimer::singleShot ( 50, this, SLOT(slotComposeMail() ) ); 79 QTimer::singleShot ( 50, this, SLOT(slotComposeMail() ) );
77 } 80 }
78 else if (msg == "newMail()") 81 else if (msg == "newMail()")
79 { 82 {
80 //qDebug("slotComposeMail() "); 83 //qDebug("slotComposeMail() ");
81 // we cannot call slotComposeMail(); directly, because may be executing a QCOP call 84 // we cannot call slotComposeMail(); directly, because may be executing a QCOP call
82 // and a QCOP call does not like a processevents in his execution 85 // and a QCOP call does not like a processevents in his execution
83 // with the Qtimer we call slotComposeMail() after we reached the main event loop 86 // with the Qtimer we call slotComposeMail() after we reached the main event loop
84 QTimer::singleShot ( 50, this, SLOT(slotComposeMail() ) ); 87 QTimer::singleShot ( 50, this, SLOT(slotComposeMail() ) );
85 // slotComposeMail(); 88 // slotComposeMail();
86 } 89 }
87 else if (msg == "newMail(QString)") 90 else if (msg == "newMail(QString)")
88 { 91 {
89 //qDebug(" newMail(QString)"); 92 //qDebug(" newMail(QString)");
90 QDataStream stream(data,IO_ReadOnly); 93 QDataStream stream(data,IO_ReadOnly);
91 stream >> mPendingName; 94 stream >> mPendingName;
92 // the format is 95 // the format is
93 // NAME <EMAIL>:SUBJECT 96 // NAME <EMAIL>:SUBJECT
94 QTimer::singleShot ( 50, this, SLOT(slotComposeMail() ) ); 97 QTimer::singleShot ( 50, this, SLOT(slotComposeMail() ) );
95 } else { 98 } else {
96 mPendingData = data; 99 mPendingData = data;
97 mPendingMessage = msg; 100 mPendingMessage = msg;
98 QTimer::singleShot ( 50, this, SLOT(slotExtAppHandler() ) ); 101 QTimer::singleShot ( 50, this, SLOT(slotExtAppHandler() ) );
99 } 102 }
100 103
101 //qDebug("END OpieMail::message "); 104 //qDebug("END OpieMail::message ");
102} 105}
103void OpieMail::slotExtAppHandler() 106void OpieMail::slotExtAppHandler()
104{ 107{
105 ExternalAppHandler::instance()->appMessage ( mPendingMessage, mPendingData ); 108 ExternalAppHandler::instance()->appMessage ( mPendingMessage, mPendingData );
106} 109}
107void OpieMail::slotwriteMail2(const QString& namemail ) 110void OpieMail::slotwriteMail2(const QString& namemail )
108{ 111{
109 //qDebug("OpieMail::slotwriteMail2 "); 112 //qDebug("OpieMail::slotwriteMail2 ");
110 //qApp->processEvents(); 113 //qApp->processEvents();
111 ComposeMail compose( settings, this, 0, true ); 114 ComposeMail compose( settings, this, 0, true );
112 if ( !namemail.isEmpty() ) { 115 if ( !namemail.isEmpty() ) {
113 QString to = namemail; 116 QString to = namemail;
114 if ( namemail.find( " <") > 1 ) { 117 if ( namemail.find( " <") > 1 ) {
115 to = "\"" +to.replace( QRegExp( " <"), "\" <") ; 118 to = "\"" +to.replace( QRegExp( " <"), "\" <") ;
116 } else 119 } else
117 if ( namemail.find( "<") > 1 ) { 120 if ( namemail.find( "<") > 1 ) {
118 to = "\"" +to.replace( QRegExp( "<"), "\" <") ; 121 to = "\"" +to.replace( QRegExp( "<"), "\" <") ;
119 } 122 }
120 int sub = to.find( ">:"); 123 int sub = to.find( ">:");
121 if ( sub > 0 ) { 124 if ( sub > 0 ) {
122 compose.setTo( to.left(sub+1) ); 125 compose.setTo( to.left(sub+1) );
123 compose.setSubject( to.mid(sub+2) ); 126 compose.setSubject( to.mid(sub+2) );
124 } else 127 } else
125 compose.setTo( to ); 128 compose.setTo( to );
126 } 129 }
127 compose.slotAdjustColumns(); 130 compose.slotAdjustColumns();
128 compose.showMaximized(); 131 compose.showMaximized();
129 compose.exec(); 132 compose.exec();
130 raise(); 133 raise();
131 //qDebug("retttich "); 134 //qDebug("retttich ");
132} 135}
133void OpieMail::slotwriteMail(const QString&name,const QString&email) 136void OpieMail::slotwriteMail(const QString&name,const QString&email)
134{ 137{
135 // qDebug("OpieMail::slotwriteMail "); 138 // qDebug("OpieMail::slotwriteMail ");
136 ComposeMail compose( settings, this, 0, true ); 139 ComposeMail compose( settings, this, 0, true );
137 if (!email.isEmpty()) 140 if (!email.isEmpty())
138 { 141 {
139 if (!name.isEmpty()) 142 if (!name.isEmpty())
140 { 143 {
141 compose.setTo("\"" + name + "\"" + " " + "<"+ email + ">"); 144 compose.setTo("\"" + name + "\"" + " " + "<"+ email + ">");
142 } 145 }
143 else 146 else
144 { 147 {
145 compose.setTo(email); 148 compose.setTo(email);
146 } 149 }
147 } 150 }
148 compose.slotAdjustColumns(); 151 compose.slotAdjustColumns();
149 compose.showMaximized(); 152 compose.showMaximized();
150 compose.exec(); 153 compose.exec();
151 raise(); 154 raise();
152} 155}
153 156
154void OpieMail::slotComposeMail() 157void OpieMail::slotComposeMail()
155{ 158{
156 if ( mPendingEmail == QString::null && mPendingName == QString::null) 159 if ( mPendingEmail == QString::null && mPendingName == QString::null)
157 slotwriteMail2( QString () ); 160 slotwriteMail2( QString () );
158 else { 161 else {
159 if ( mPendingEmail == QString::null ) 162 if ( mPendingEmail == QString::null )
160 slotwriteMail2( mPendingName ); 163 slotwriteMail2( mPendingName );
161 else 164 else
162 slotwriteMail( mPendingName, mPendingEmail ); 165 slotwriteMail( mPendingName, mPendingEmail );
163 } 166 }
164 //slotwriteMail(0l,0l); 167 //slotwriteMail(0l,0l);
165} 168}
166 169
167void OpieMail::slotSendQueued() 170void OpieMail::slotSendQueued()
168{ 171{
169 SMTPaccount *smtp = 0; 172 SMTPaccount *smtp = 0;
170 173
171 QList<Account> list = settings->getAccounts(); 174 QList<Account> list = settings->getAccounts();
172 QList<SMTPaccount> smtpList; 175 QList<SMTPaccount> smtpList;
173 smtpList.setAutoDelete(false); 176 smtpList.setAutoDelete(false);
174 Account *it; 177 Account *it;
175 for ( it = list.first(); it; it = list.next() ) 178 for ( it = list.first(); it; it = list.next() )
176 { 179 {
177 if ( it->getType() == MAILLIB::A_SMTP ) 180 if ( it->getType() == MAILLIB::A_SMTP )
178 { 181 {
179 smtp = static_cast<SMTPaccount *>(it); 182 smtp = static_cast<SMTPaccount *>(it);
180 smtpList.append(smtp); 183 smtpList.append(smtp);
181 } 184 }
182 } 185 }
183 if (smtpList.count()==0) 186 if (smtpList.count()==0)
184 { 187 {
185 QMessageBox::information(0,i18n("Info"),i18n("Define a smtp account first!\n")); 188 QMessageBox::information(0,i18n("Info"),i18n("Define a smtp account first!\n"));
186 return; 189 return;
187 } 190 }
188 if (smtpList.count()==1) 191 if (smtpList.count()==1)
189 { 192 {
190 smtp = smtpList.at(0); 193 smtp = smtpList.at(0);
191 } 194 }
192 else 195 else
193 { 196 {
194 smtp = 0; 197 smtp = 0;
195 selectsmtp selsmtp; 198 selectsmtp selsmtp;
196 selsmtp.setSelectionlist(&smtpList); 199 selsmtp.setSelectionlist(&smtpList);
197 selsmtp.showMaximized(); 200 selsmtp.showMaximized();
198 if ( selsmtp.exec() == QDialog::Accepted ) 201 if ( selsmtp.exec() == QDialog::Accepted )
199 { 202 {
200 smtp = selsmtp.selected_smtp(); 203 smtp = selsmtp.selected_smtp();
201 } 204 }
202 } 205 }
203 if (smtp) 206 if (smtp)
204 { 207 {
205 SMTPwrapper * wrap = new SMTPwrapper(smtp); 208 SMTPwrapper * wrap = new SMTPwrapper(smtp);
206 if ( wrap->flushOutbox() ) 209 if ( wrap->flushOutbox() )
207 { 210 {
208 QMessageBox::information(0,i18n("Info"),i18n("Mail queue flushed")); 211 QMessageBox::information(0,i18n("Info"),i18n("Mail queue flushed"));
209 } 212 }
210 delete wrap; 213 delete wrap;
211 } 214 }
212} 215}
213 216
214void OpieMail::slotSearchMails() 217void OpieMail::slotSearchMails()
215{ 218{
216 qDebug("OpieMail::slotSearchMails():not implemented "); 219 qDebug("OpieMail::slotSearchMails():not implemented ");
217} 220}
218 221
219void OpieMail::slotEditSettings() 222void OpieMail::slotEditSettings()
220{ 223{
221#if 0 224#if 0
222 SettingsDialog settingsDialog( this, 0, true, WStyle_ContextHelp ); 225 SettingsDialog settingsDialog( this, 0, true, WStyle_ContextHelp );
223 settingsDialog.showMaximized(); 226 settingsDialog.showMaximized();
224 settingsDialog.exec(); 227 settingsDialog.exec();
225#endif 228#endif
226 KOPrefsDialog settingsDialog( this, "koprefs", true ); 229 KOPrefsDialog settingsDialog( this, "koprefs", true );
227 settingsDialog.showMaximized(); 230 settingsDialog.showMaximized();
228 settingsDialog.exec(); 231 settingsDialog.exec();
229} 232}
230 233
231void OpieMail::slotEditAccounts() 234void OpieMail::slotEditAccounts()
232{ 235{
233 EditAccounts eaDialog( settings, this, 0, true ); 236 EditAccounts eaDialog( settings, this, 0, true );
234 eaDialog.slotAdjustColumns(); 237 eaDialog.slotAdjustColumns();
235 eaDialog.showMaximized(); 238 eaDialog.showMaximized();
236 eaDialog.exec(); 239 eaDialog.exec();
237 if ( settings ) delete settings; 240 if ( settings ) delete settings;
238 settings = new Settings(); 241 settings = new Settings();
239 242
240 folderView->populate( settings->getAccounts() ); 243 folderView->populate( settings->getAccounts() );
241} 244}
242 245
243void OpieMail::displayMail() 246void OpieMail::displayMail()
244{ 247{
245 QListViewItem*item = mailView->currentItem(); 248 QListViewItem*item = mailView->currentItem();
246 if (!item) return; 249 if (!item) return;
247 RecMailP mail = ((MailListViewItem*)item)->data(); 250 RecMailP mail = ((MailListViewItem*)item)->data();
248 RecBodyP body = folderView->fetchBody(mail); 251 RecBodyP body = folderView->fetchBody(mail);
249 ViewMail readMail( this,"", Qt::WType_Modal ); 252 ViewMail readMail( this,"", Qt::WType_Modal );
250 readMail.setBody( body ); 253 readMail.setBody( body );
251 readMail.setMail( mail ); 254 readMail.setMail( mail );
252 readMail.showMaximized(); 255 readMail.showMaximized();
253 readMail.exec(); 256 readMail.exec();
254 257
255 if ( readMail.deleted ) 258 if ( readMail.deleted )
256 { 259 {
257 folderView->refreshCurrent(); 260 folderView->refreshCurrent();
258 } 261 }
259 else 262 else
260 { 263 {
261 ( (MailListViewItem*)item )->setPixmap( 0, QPixmap() ); 264 ( (MailListViewItem*)item )->setPixmap( 0, QPixmap() );
262 } 265 }
263} 266}
264void OpieMail::slotGetAllMail() 267void OpieMail::slotGetAllMail()
265{ 268{
266 QListViewItem * item = folderView->firstChild(); 269 QListViewItem * item = folderView->firstChild();
267 while ( item ){ 270 while ( item ){
268 ((AccountViewItem *)item)->contextMenuSelected( 101 ); 271 ((AccountViewItem *)item)->contextMenuSelected( 101 );
269 item = item->nextSibling (); 272 item = item->nextSibling ();
270 } 273 }
271} 274}
272void OpieMail::slotGetMail() 275void OpieMail::slotGetMail()
273{ 276{
274 QListViewItem * item = folderView->currentItem(); 277 QListViewItem * item = folderView->currentItem();
275 if ( ! item ) return; 278 if ( ! item ) return;
276 ((AccountViewItem *)item)->contextMenuSelected( 101 ); 279 ((AccountViewItem *)item)->contextMenuSelected( 101 );
277} 280}
278void OpieMail::slotDeleteMail() 281void OpieMail::slotDeleteMail()
279{ 282{
280 if (!mailView->currentItem()) return; 283 if (!mailView->currentItem()) return;
281 RecMailP mail = ((MailListViewItem*)mailView->currentItem() )->data(); 284 RecMailP mail = ((MailListViewItem*)mailView->currentItem() )->data();
282 if ( QMessageBox::warning(this, i18n("Delete Mail"), QString( i18n("<p>Do you really want to delete this mail? <br><br>" ) + mail->getFrom() + " - " + mail->getSubject() ) , QMessageBox::Yes, QMessageBox::No ) == QMessageBox::Yes ) 285 if ( QMessageBox::warning(this, i18n("Delete Mail"), QString( i18n("<p>Do you really want to delete this mail? <br><br>" ) + mail->getFrom() + " - " + mail->getSubject() ) , QMessageBox::Yes, QMessageBox::No ) == QMessageBox::Yes )
283 { 286 {
284 mail->Wrapper()->deleteMail( mail ); 287 mail->Wrapper()->deleteMail( mail );
285 folderView->refreshCurrent(); 288 folderView->refreshCurrent();
286 } 289 }
287} 290}
288void OpieMail::slotDeleteAllMail() 291void OpieMail::slotDeleteAllMail()
289{ 292{
290 293
291 QValueList<RecMailP> t; 294 QValueList<RecMailP> t;
292 if ( QMessageBox::warning(this, i18n("Delete All Mails"), i18n("Do you really want to delete\nall selected mails?" ) , QMessageBox::Yes, QMessageBox::No ) == QMessageBox::Yes ) 295 if ( QMessageBox::warning(this, i18n("Delete All Mails"), i18n("Do you really want to delete\nall selected mails?" ) , QMessageBox::Yes, QMessageBox::No ) == QMessageBox::Yes )
293 { 296 {
294 MailListViewItem* item = (MailListViewItem*)mailView->firstChild (); 297 MailListViewItem* item = (MailListViewItem*)mailView->firstChild ();
295 while ( item ) { 298 while ( item ) {
296 if ( item->isSelected() ) { 299 if ( item->isSelected() ) {
297 t.append( item->data() ); 300 t.append( item->data() );
298 } 301 }
299 item = (MailListViewItem*)item->nextSibling(); 302 item = (MailListViewItem*)item->nextSibling();
300 } 303 }
301 } 304 }
302 else 305 else
303 return; 306 return;
304 if ( t.count() == 0 ) 307 if ( t.count() == 0 )
305 return; 308 return;
306 RecMailP mail = t.first(); 309 RecMailP mail = t.first();
307 mail->Wrapper()->deleteMailList(t); 310 mail->Wrapper()->deleteMailList(t);
308 folderView->refreshCurrent(); 311 folderView->refreshCurrent();
309 312
310 313
311} 314}
312void OpieMail::clearSelection() 315void OpieMail::clearSelection()
313{ 316{
314 mailView->clearSelection(); 317 mailView->clearSelection();
315 318
316} 319}
317 320
318void OpieMail::mailHold(int button, QListViewItem *item,const QPoint&,int ) 321void OpieMail::mailHold(int button, QListViewItem *item,const QPoint&,int )
319{ 322{
320 if (!mailView->currentItem()) return; 323 if (!mailView->currentItem()) return;
321 MAILLIB::ATYPE mailtype = ((MailListViewItem*)mailView->currentItem() )->wrapperType(); 324 MAILLIB::ATYPE mailtype = ((MailListViewItem*)mailView->currentItem() )->wrapperType();
322 /* just the RIGHT button - or hold on pda */ 325 /* just the RIGHT button - or hold on pda */
323 if (button!=2) {return;} 326 if (button!=2) {return;}
324 if (!item) return; 327 if (!item) return;
325 QPopupMenu *m = new QPopupMenu(0); 328 QPopupMenu *m = new QPopupMenu(0);
326 if (m) 329 if (m)
327 { 330 {
328 if (mailtype==MAILLIB::A_NNTP) { 331 if (mailtype==MAILLIB::A_NNTP) {
329 m->insertItem(i18n("Read this posting"),this,SLOT(displayMail())); 332 m->insertItem(i18n("Read this posting"),this,SLOT(displayMail()));
330 m->insertItem(i18n("Copy this posting"),this,SLOT(slotMoveCopyMail())); 333 m->insertItem(i18n("Copy this posting"),this,SLOT(slotMoveCopyMail()));
331 m->insertSeparator(); 334 m->insertSeparator();
332 m->insertItem(i18n("Copy all selected postings"),this,SLOT(slotMoveCopyAllMail())); 335 m->insertItem(i18n("Copy all selected postings"),this,SLOT(slotMoveCopyAllMail()));
333 m->insertItem(i18n("Clear selection"),this,SLOT(clearSelection())); 336 m->insertItem(i18n("Clear selection"),this,SLOT(clearSelection()));
334 } else { 337 } else {
335 if (folderView->currentisDraft()) { 338 if (folderView->currentisDraft()) {
336 m->insertItem(i18n("Edit this mail"),this,SLOT(reEditMail())); 339 m->insertItem(i18n("Edit this mail"),this,SLOT(reEditMail()));
337 } 340 }
338 m->insertItem(i18n("Read this mail"),this,SLOT(displayMail())); 341 m->insertItem(i18n("Read this mail"),this,SLOT(displayMail()));
339 m->insertItem(i18n("Move/Copy this mail"),this,SLOT(slotMoveCopyMail())); 342 m->insertItem(i18n("Move/Copy this mail"),this,SLOT(slotMoveCopyMail()));
340 m->insertItem(i18n("Delete this mail"),this,SLOT(slotDeleteMail())); 343 m->insertItem(i18n("Delete this mail"),this,SLOT(slotDeleteMail()));
341 m->insertSeparator(); 344 m->insertSeparator();
342 m->insertItem(i18n("Move/Copy all selected mail"),this,SLOT(slotMoveCopyAllMail())); 345 m->insertItem(i18n("Move/Copy all selected mail"),this,SLOT(slotMoveCopyAllMail()));
343 m->insertItem(i18n("Delete all selected mails"),this,SLOT(slotDeleteAllMail())); 346 m->insertItem(i18n("Delete all selected mails"),this,SLOT(slotDeleteAllMail()));
344 m->insertItem(i18n("Clear selection"),this,SLOT(clearSelection())); 347 m->insertItem(i18n("Clear selection"),this,SLOT(clearSelection()));
345 } 348 }
346 m->setFocus(); 349 m->setFocus();
347 m->exec( QPoint( QCursor::pos().x(), QCursor::pos().y()) ); 350 m->exec( QPoint( QCursor::pos().x(), QCursor::pos().y()) );
348 delete m; 351 delete m;
349 } 352 }
350} 353}
351 354
352void OpieMail::slotShowFolders( bool show ) 355void OpieMail::slotShowFolders( bool show )
353{ 356{
354 if ( show && folderView->isHidden() ) 357 if ( show && folderView->isHidden() )
355 { 358 {
356 folderView->show(); 359 folderView->show();
357 } 360 }
358 else if ( !show && !folderView->isHidden() ) 361 else if ( !show && !folderView->isHidden() )
359 { 362 {
360 folderView->hide(); 363 folderView->hide();
361 } 364 }
362} 365}
363 366
364void OpieMail::refreshMailView(const QValueList<RecMailP>&list) 367void OpieMail::refreshMailView(const QValueList<RecMailP>&list)
365{ 368{
366 MailListViewItem*item = 0; 369 MailListViewItem*item = 0;
367 mailView->clear(); 370 mailView->clear();
368 371
369 QValueList<RecMailP>::ConstIterator it; 372 QValueList<RecMailP>::ConstIterator it;
370 for (it = list.begin(); it != list.end();++it) 373 for (it = list.begin(); it != list.end();++it)
371 { 374 {
372 item = new MailListViewItem(mailView,item); 375 item = new MailListViewItem(mailView,item);
373 item->storeData((*it)); 376 item->storeData((*it));
374 item->showEntry(); 377 item->showEntry();
375 } 378 }
376} 379}
377 380
378void OpieMail::mailLeftClicked( QListViewItem *item ) 381void OpieMail::mailLeftClicked( QListViewItem *item )
379{ 382{
380 mailView->clearSelection(); 383 mailView->clearSelection();
381 /* just LEFT button - or tap with stylus on pda */ 384 /* just LEFT button - or tap with stylus on pda */
382 //if (button!=1) return; 385 //if (button!=1) return;
383 if (!item) return; 386 if (!item) return;
384 if (folderView->currentisDraft()) { 387 if (folderView->currentisDraft()) {
385 reEditMail(); 388 reEditMail();
386 } else { 389 } else {
387 displayMail(); 390 displayMail();
388 } 391 }
389} 392}
390 393
391void OpieMail::slotMoveCopyMail() 394void OpieMail::slotMoveCopyMail()
392{ 395{
393 if (!mailView->currentItem()) return; 396 if (!mailView->currentItem()) return;
394 RecMailP mail = ((MailListViewItem*)mailView->currentItem() )->data(); 397 RecMailP mail = ((MailListViewItem*)mailView->currentItem() )->data();
395 AbstractMail*targetMail = 0; 398 AbstractMail*targetMail = 0;
396 QString targetFolder = ""; 399 QString targetFolder = "";
397 Selectstore sels; 400 Selectstore sels;
398 folderView->setupFolderselect(&sels); 401 folderView->setupFolderselect(&sels);
399 if (!sels.exec()) return; 402 if (!sels.exec()) return;
400 targetMail = sels.currentMail(); 403 targetMail = sels.currentMail();
401 targetFolder = sels.currentFolder(); 404 targetFolder = sels.currentFolder();
402 if ( (mail->Wrapper()==targetMail && mail->getMbox()==targetFolder) || 405 if ( (mail->Wrapper()==targetMail && mail->getMbox()==targetFolder) ||
403 targetFolder.isEmpty()) 406 targetFolder.isEmpty())
404 { 407 {
405 return; 408 return;