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