Diffstat (limited to 'noncore/net/mail/opiemail.cpp') (more/less context) (ignore whitespace changes)
-rw-r--r-- | noncore/net/mail/opiemail.cpp | 23 |
1 files changed, 20 insertions, 3 deletions
diff --git a/noncore/net/mail/opiemail.cpp b/noncore/net/mail/opiemail.cpp index 61e7dc4..d95b3c9 100644 --- a/noncore/net/mail/opiemail.cpp +++ b/noncore/net/mail/opiemail.cpp | |||
@@ -168,36 +168,39 @@ void OpieMail::slotDeleteMail() | |||
168 | if (!mailView->currentItem()) return; | 168 | if (!mailView->currentItem()) return; |
169 | RecMail mail = ((MailListViewItem*)mailView->currentItem() )->data(); | 169 | RecMail mail = ((MailListViewItem*)mailView->currentItem() )->data(); |
170 | 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 ) | 170 | 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 ) |
171 | { | 171 | { |
172 | mail.Wrapper()->deleteMail( mail ); | 172 | mail.Wrapper()->deleteMail( mail ); |
173 | folderView->refreshCurrent(); | 173 | folderView->refreshCurrent(); |
174 | } | 174 | } |
175 | } | 175 | } |
176 | 176 | ||
177 | void OpieMail::mailHold(int button, QListViewItem *item,const QPoint&,int ) | 177 | void OpieMail::mailHold(int button, QListViewItem *item,const QPoint&,int ) |
178 | { | 178 | { |
179 | if (!mailView->currentItem()) return; | 179 | if (!mailView->currentItem()) return; |
180 | RecMail mail = ((MailListViewItem*)mailView->currentItem() )->data(); | 180 | MAILLIB::ATYPE mailtype = ((MailListViewItem*)mailView->currentItem() )->wrapperType(); |
181 | /* just the RIGHT button - or hold on pda */ | 181 | /* just the RIGHT button - or hold on pda */ |
182 | if (button!=2) {return;} | 182 | if (button!=2) {return;} |
183 | qDebug("Event right/hold"); | 183 | qDebug("Event right/hold"); |
184 | if (!item) return; | 184 | if (!item) return; |
185 | QPopupMenu *m = new QPopupMenu(0); | 185 | QPopupMenu *m = new QPopupMenu(0); |
186 | if (m) | 186 | if (m) |
187 | { | 187 | { |
188 | if (mail.Wrapper()->getType()==MAILLIB::A_NNTP) { | 188 | if (mailtype==MAILLIB::A_NNTP) { |
189 | m->insertItem(tr("Read this posting"),this,SLOT(displayMail())); | 189 | m->insertItem(tr("Read this posting"),this,SLOT(displayMail())); |
190 | // m->insertItem(tr("Copy this posting"),this,SLOT(slotMoveCopyMail())); | 190 | // m->insertItem(tr("Copy this posting"),this,SLOT(slotMoveCopyMail())); |
191 | } else { | 191 | } else { |
192 | if (folderView->currentisDraft()) { | ||
193 | m->insertItem(tr("Edit this mail"),this,SLOT(reEditMail())); | ||
194 | } | ||
192 | m->insertItem(tr("Read this mail"),this,SLOT(displayMail())); | 195 | m->insertItem(tr("Read this mail"),this,SLOT(displayMail())); |
193 | m->insertItem(tr("Delete this mail"),this,SLOT(slotDeleteMail())); | 196 | m->insertItem(tr("Delete this mail"),this,SLOT(slotDeleteMail())); |
194 | m->insertItem(tr("Copy/Move this mail"),this,SLOT(slotMoveCopyMail())); | 197 | m->insertItem(tr("Copy/Move this mail"),this,SLOT(slotMoveCopyMail())); |
195 | } | 198 | } |
196 | m->setFocus(); | 199 | m->setFocus(); |
197 | m->exec( QPoint( QCursor::pos().x(), QCursor::pos().y()) ); | 200 | m->exec( QPoint( QCursor::pos().x(), QCursor::pos().y()) ); |
198 | delete m; | 201 | delete m; |
199 | } | 202 | } |
200 | } | 203 | } |
201 | 204 | ||
202 | void OpieMail::slotShowFolders( bool show ) | 205 | void OpieMail::slotShowFolders( bool show ) |
203 | { | 206 | { |
@@ -222,25 +225,29 @@ void OpieMail::refreshMailView(QList<RecMail>*list) | |||
222 | { | 225 | { |
223 | item = new MailListViewItem(mailView,item); | 226 | item = new MailListViewItem(mailView,item); |
224 | item->storeData(*(list->at(i))); | 227 | item->storeData(*(list->at(i))); |
225 | item->showEntry(); | 228 | item->showEntry(); |
226 | } | 229 | } |
227 | } | 230 | } |
228 | 231 | ||
229 | void OpieMail::mailLeftClicked(int button, QListViewItem *item,const QPoint&,int ) | 232 | void OpieMail::mailLeftClicked(int button, QListViewItem *item,const QPoint&,int ) |
230 | { | 233 | { |
231 | /* just LEFT button - or tap with stylus on pda */ | 234 | /* just LEFT button - or tap with stylus on pda */ |
232 | if (button!=1) return; | 235 | if (button!=1) return; |
233 | if (!item) return; | 236 | if (!item) return; |
234 | displayMail(); | 237 | if (folderView->currentisDraft()) { |
238 | reEditMail(); | ||
239 | } else { | ||
240 | displayMail(); | ||
241 | } | ||
235 | } | 242 | } |
236 | 243 | ||
237 | void OpieMail::slotMoveCopyMail() | 244 | void OpieMail::slotMoveCopyMail() |
238 | { | 245 | { |
239 | if (!mailView->currentItem()) return; | 246 | if (!mailView->currentItem()) return; |
240 | RecMail mail = ((MailListViewItem*)mailView->currentItem() )->data(); | 247 | RecMail mail = ((MailListViewItem*)mailView->currentItem() )->data(); |
241 | AbstractMail*targetMail = 0; | 248 | AbstractMail*targetMail = 0; |
242 | QString targetFolder = ""; | 249 | QString targetFolder = ""; |
243 | Selectstore sels; | 250 | Selectstore sels; |
244 | folderView->setupFolderselect(&sels); | 251 | folderView->setupFolderselect(&sels); |
245 | if (!sels.exec()) return; | 252 | if (!sels.exec()) return; |
246 | targetMail = sels.currentMail(); | 253 | targetMail = sels.currentMail(); |
@@ -250,12 +257,22 @@ void OpieMail::slotMoveCopyMail() | |||
250 | { | 257 | { |
251 | return; | 258 | return; |
252 | } | 259 | } |
253 | if (sels.newFolder() && !targetMail->createMbox(targetFolder)) | 260 | if (sels.newFolder() && !targetMail->createMbox(targetFolder)) |
254 | { | 261 | { |
255 | QMessageBox::critical(0,tr("Error creating new Folder"), | 262 | QMessageBox::critical(0,tr("Error creating new Folder"), |
256 | tr("<center>Error while creating<br>new folder - breaking.</center>")); | 263 | tr("<center>Error while creating<br>new folder - breaking.</center>")); |
257 | return; | 264 | return; |
258 | } | 265 | } |
259 | mail.Wrapper()->mvcpMail(mail,targetFolder,targetMail,sels.moveMails()); | 266 | mail.Wrapper()->mvcpMail(mail,targetFolder,targetMail,sels.moveMails()); |
260 | folderView->refreshCurrent(); | 267 | folderView->refreshCurrent(); |
261 | } | 268 | } |
269 | |||
270 | void OpieMail::reEditMail() | ||
271 | { | ||
272 | if (!mailView->currentItem()) return; | ||
273 | |||
274 | ComposeMail compose( settings, this, 0, true , WStyle_ContextHelp ); | ||
275 | compose.reEditMail(((MailListViewItem*)mailView->currentItem() )->data()); | ||
276 | compose.slotAdjustColumns(); | ||
277 | QPEApplication::execDialog( &compose ); | ||
278 | } | ||