-rw-r--r-- | noncore/net/mail/accountitem.cpp | 17 | ||||
-rw-r--r-- | noncore/net/mail/accountitem.h | 2 | ||||
-rw-r--r-- | noncore/net/mail/accountview.cpp | 7 | ||||
-rw-r--r-- | noncore/net/mail/accountview.h | 1 | ||||
-rw-r--r-- | noncore/net/mail/composemail.cpp | 90 | ||||
-rw-r--r-- | noncore/net/mail/composemail.h | 5 | ||||
-rw-r--r-- | noncore/net/mail/libmailwrapper/abstractmail.cpp | 23 | ||||
-rw-r--r-- | noncore/net/mail/libmailwrapper/abstractmail.h | 2 | ||||
-rw-r--r-- | noncore/net/mail/libmailwrapper/genericwrapper.cpp | 8 | ||||
-rw-r--r-- | noncore/net/mail/libmailwrapper/libmailwrapper.pro | 6 | ||||
-rw-r--r-- | noncore/net/mail/libmailwrapper/mailtypes.cpp | 1 | ||||
-rw-r--r-- | noncore/net/mail/libmailwrapper/storemail.cpp | 90 | ||||
-rw-r--r-- | noncore/net/mail/libmailwrapper/storemail.h | 29 | ||||
-rw-r--r-- | noncore/net/mail/mailistviewitem.cpp | 7 | ||||
-rw-r--r-- | noncore/net/mail/mailistviewitem.h | 2 | ||||
-rw-r--r-- | noncore/net/mail/nntpgroupsdlg.cpp | 2 | ||||
-rw-r--r-- | noncore/net/mail/opiemail.cpp | 21 | ||||
-rw-r--r-- | noncore/net/mail/opiemail.h | 1 |
18 files changed, 292 insertions, 22 deletions
diff --git a/noncore/net/mail/accountitem.cpp b/noncore/net/mail/accountitem.cpp index 0d636a4..396dcb7 100644 --- a/noncore/net/mail/accountitem.cpp +++ b/noncore/net/mail/accountitem.cpp | |||
@@ -914,7 +914,7 @@ void MHfolderItem::initName() | |||
914 | { | 914 | { |
915 | setPixmap( 0, PIXMAP_INBOXFOLDER); | 915 | setPixmap( 0, PIXMAP_INBOXFOLDER); |
916 | } | 916 | } else if (bName.lower() == "drafts") { |
917 | else | 917 | setPixmap(0, Resource::loadPixmap("inline/edit")); |
918 | { | 918 | } else { |
919 | setPixmap( 0, PIXMAP_MBOXFOLDER ); | 919 | setPixmap( 0, PIXMAP_MBOXFOLDER ); |
920 | } | 920 | } |
@@ -1024,4 +1024,10 @@ void MHfolderItem::contextMenuSelected(int which) | |||
1024 | } | 1024 | } |
1025 | 1025 | ||
1026 | bool MHfolderItem::isDraftfolder() | ||
1027 | { | ||
1028 | if (folder && folder->getName()==AbstractMail::defaultLocalfolder()+"/"+AbstractMail::draftFolder()) return true; | ||
1029 | return false; | ||
1030 | } | ||
1031 | |||
1026 | /** | 1032 | /** |
1027 | * Generic stuff | 1033 | * Generic stuff |
@@ -1128,2 +1134,7 @@ AccountViewItem*AccountViewItem::findSubItem(const QString&path,AccountViewItem* | |||
1128 | return pitem; | 1134 | return pitem; |
1129 | } | 1135 | } |
1136 | |||
1137 | bool AccountViewItem::isDraftfolder() | ||
1138 | { | ||
1139 | return false; | ||
1140 | } | ||
diff --git a/noncore/net/mail/accountitem.h b/noncore/net/mail/accountitem.h index f3c0f5d..eb3baa3 100644 --- a/noncore/net/mail/accountitem.h +++ b/noncore/net/mail/accountitem.h | |||
@@ -31,4 +31,5 @@ public: | |||
31 | virtual AccountView*accountView(); | 31 | virtual AccountView*accountView(); |
32 | virtual bool matchName(const QString&name)const; | 32 | virtual bool matchName(const QString&name)const; |
33 | virtual bool isDraftfolder(); | ||
33 | 34 | ||
34 | protected: | 35 | protected: |
@@ -194,4 +195,5 @@ public: | |||
194 | virtual void contextMenuSelected(int); | 195 | virtual void contextMenuSelected(int); |
195 | virtual Folder*getFolder(); | 196 | virtual Folder*getFolder(); |
197 | virtual bool isDraftfolder(); | ||
196 | 198 | ||
197 | protected: | 199 | protected: |
diff --git a/noncore/net/mail/accountview.cpp b/noncore/net/mail/accountview.cpp index 4375044..7938d4f 100644 --- a/noncore/net/mail/accountview.cpp +++ b/noncore/net/mail/accountview.cpp | |||
@@ -169,2 +169,9 @@ void AccountView::downloadMails(Folder*fromFolder,AbstractMail*fromWrapper) | |||
169 | refreshCurrent(); | 169 | refreshCurrent(); |
170 | } | 170 | } |
171 | |||
172 | bool AccountView::currentisDraft() | ||
173 | { | ||
174 | AccountViewItem *view = static_cast<AccountViewItem *>(currentItem()); | ||
175 | if (!view) return false; | ||
176 | return view->isDraftfolder(); | ||
177 | } | ||
diff --git a/noncore/net/mail/accountview.h b/noncore/net/mail/accountview.h index 9f92090..5000202 100644 --- a/noncore/net/mail/accountview.h +++ b/noncore/net/mail/accountview.h | |||
@@ -24,4 +24,5 @@ public: | |||
24 | virtual RecBody fetchBody(const RecMail&aMail); | 24 | virtual RecBody fetchBody(const RecMail&aMail); |
25 | virtual void downloadMails(Folder*fromFolder,AbstractMail*fromWrapper); | 25 | virtual void downloadMails(Folder*fromFolder,AbstractMail*fromWrapper); |
26 | virtual bool currentisDraft(); | ||
26 | 27 | ||
27 | public slots: | 28 | public slots: |
diff --git a/noncore/net/mail/composemail.cpp b/noncore/net/mail/composemail.cpp index b5cd75b..b9c9cbc 100644 --- a/noncore/net/mail/composemail.cpp +++ b/noncore/net/mail/composemail.cpp | |||
@@ -10,4 +10,7 @@ | |||
10 | 10 | ||
11 | #include <libmailwrapper/smtpwrapper.h> | 11 | #include <libmailwrapper/smtpwrapper.h> |
12 | #include <libmailwrapper/storemail.h> | ||
13 | #include <libmailwrapper/abstractmail.h> | ||
14 | #include <libmailwrapper/mailtypes.h> | ||
12 | 15 | ||
13 | ComposeMail::ComposeMail( Settings *s, QWidget *parent, const char *name, bool modal, WFlags flags ) | 16 | ComposeMail::ComposeMail( Settings *s, QWidget *parent, const char *name, bool modal, WFlags flags ) |
@@ -125,5 +128,5 @@ void ComposeMail::pickAddressReply() | |||
125 | } | 128 | } |
126 | 129 | ||
127 | void ComposeMail::fillValues( int current ) | 130 | void ComposeMail::fillValues( int ) |
128 | { | 131 | { |
129 | #if 0 | 132 | #if 0 |
@@ -186,24 +189,25 @@ void ComposeMail::accept() | |||
186 | smtpAccounts.at( smtpAccountBox->currentItem() )->getAccountName() ); | 189 | smtpAccounts.at( smtpAccountBox->currentItem() )->getAccountName() ); |
187 | #endif | 190 | #endif |
188 | Mail *mail = new Mail(); | 191 | Mail mail; |
189 | 192 | ||
190 | SMTPaccount *smtp = smtpAccounts.at( smtpAccountBox->currentItem() ); | 193 | SMTPaccount *smtp = smtpAccounts.at( smtpAccountBox->currentItem() ); |
191 | mail->setMail(fromBox->currentText()); | 194 | mail.setMail(fromBox->currentText()); |
192 | 195 | ||
193 | if ( !toLine->text().isEmpty() ) { | 196 | if ( !toLine->text().isEmpty() ) { |
194 | mail->setTo( toLine->text() ); | 197 | mail.setTo( toLine->text() ); |
195 | } else { | 198 | } else { |
196 | qDebug( "No Reciever spezified -> returning" ); | 199 | QMessageBox::warning(0,tr("Sending mail"), |
200 | tr("No Receiver spezified" ) ); | ||
197 | return; | 201 | return; |
198 | } | 202 | } |
199 | mail->setName(senderNameEdit->text()); | 203 | mail.setName(senderNameEdit->text()); |
200 | mail->setCC( ccLine->text() ); | 204 | mail.setCC( ccLine->text() ); |
201 | mail->setBCC( bccLine->text() ); | 205 | mail.setBCC( bccLine->text() ); |
202 | mail->setReply( replyLine->text() ); | 206 | mail.setReply( replyLine->text() ); |
203 | mail->setSubject( subjectLine->text() ); | 207 | mail.setSubject( subjectLine->text() ); |
204 | if (!m_replyid.isEmpty()) { | 208 | if (!m_replyid.isEmpty()) { |
205 | QStringList ids; | 209 | QStringList ids; |
206 | ids.append(m_replyid); | 210 | ids.append(m_replyid); |
207 | mail->setInreply(ids); | 211 | mail.setInreply(ids); |
208 | } | 212 | } |
209 | QString txt = message->text(); | 213 | QString txt = message->text(); |
@@ -213,17 +217,75 @@ void ComposeMail::accept() | |||
213 | } | 217 | } |
214 | qDebug(txt); | 218 | qDebug(txt); |
215 | mail->setMessage( txt ); | 219 | mail.setMessage( txt ); |
216 | AttachViewItem *it = (AttachViewItem *) attList->firstChild(); | 220 | AttachViewItem *it = (AttachViewItem *) attList->firstChild(); |
217 | while ( it != NULL ) { | 221 | while ( it != NULL ) { |
218 | mail->addAttachment( it->getAttachment() ); | 222 | mail.addAttachment( it->getAttachment() ); |
219 | it = (AttachViewItem *) it->nextSibling(); | 223 | it = (AttachViewItem *) it->nextSibling(); |
220 | } | 224 | } |
221 | 225 | ||
222 | SMTPwrapper wrapper( smtp ); | 226 | SMTPwrapper wrapper( smtp ); |
223 | wrapper.sendMail( *mail,checkBoxLater->isChecked() ); | 227 | wrapper.sendMail( mail,checkBoxLater->isChecked() ); |
224 | 228 | ||
225 | QDialog::accept(); | 229 | QDialog::accept(); |
226 | } | 230 | } |
227 | 231 | ||
232 | void ComposeMail::reject() | ||
233 | { | ||
234 | int yesno = QMessageBox::warning(0,tr("Store message"), | ||
235 | tr("Store message into drafts?"), | ||
236 | tr("Yes"), | ||
237 | tr("No"),QString::null,0,1); | ||
238 | |||
239 | if (yesno == 0) { | ||
240 | Mail mail; | ||
241 | mail.setMail(fromBox->currentText()); | ||
242 | mail.setTo( toLine->text() ); | ||
243 | mail.setName(senderNameEdit->text()); | ||
244 | mail.setCC( ccLine->text() ); | ||
245 | mail.setBCC( bccLine->text() ); | ||
246 | mail.setReply( replyLine->text() ); | ||
247 | mail.setSubject( subjectLine->text() ); | ||
248 | if (!m_replyid.isEmpty()) { | ||
249 | QStringList ids; | ||
250 | ids.append(m_replyid); | ||
251 | mail.setInreply(ids); | ||
252 | } | ||
253 | QString txt = message->text(); | ||
254 | if ( !sigMultiLine->text().isEmpty() ) { | ||
255 | txt.append( "\n--\n" ); | ||
256 | txt.append( sigMultiLine->text() ); | ||
257 | } | ||
258 | qDebug(txt); | ||
259 | mail.setMessage( txt ); | ||
260 | |||
261 | /* only use the default drafts folder name! */ | ||
262 | Storemail wrapper(AbstractMail::draftFolder()); | ||
263 | wrapper.storeMail(mail); | ||
264 | |||
265 | AttachViewItem *it = (AttachViewItem *) attList->firstChild(); | ||
266 | /* attachments we will ignore! */ | ||
267 | if ( it != NULL ) { | ||
268 | QMessageBox::warning(0,tr("Store message"), | ||
269 | tr("<center>Attachments will not be stored in \"Draft\" folder</center>")); | ||
270 | } | ||
271 | } | ||
272 | QDialog::reject(); | ||
273 | } | ||
274 | |||
275 | ComposeMail::~ComposeMail() | ||
276 | { | ||
277 | } | ||
278 | |||
279 | void ComposeMail::reEditMail(const RecMail¤t) | ||
280 | { | ||
281 | RecMail data = current; | ||
282 | message->setText(data.Wrapper()->fetchBody(current).Bodytext()); | ||
283 | subjectLine->setText( data.getSubject()); | ||
284 | toLine->setText(data.To().join(",")); | ||
285 | ccLine->setText(data.CC().join(",")); | ||
286 | bccLine->setText(data.Bcc().join(",")); | ||
287 | replyLine->setText(data.Replyto()); | ||
288 | } | ||
289 | |||
228 | AttachViewItem::AttachViewItem( QListView *parent, Attachment *att ) | 290 | AttachViewItem::AttachViewItem( QListView *parent, Attachment *att ) |
229 | : QListViewItem( parent ) | 291 | : QListViewItem( parent ) |
diff --git a/noncore/net/mail/composemail.h b/noncore/net/mail/composemail.h index 886fb1d..1b9fc79 100644 --- a/noncore/net/mail/composemail.h +++ b/noncore/net/mail/composemail.h | |||
@@ -26,4 +26,5 @@ protected: | |||
26 | }; | 26 | }; |
27 | 27 | ||
28 | class RecMail; | ||
28 | 29 | ||
29 | class ComposeMail : public ComposeMailUI | 30 | class ComposeMail : public ComposeMailUI |
@@ -33,4 +34,7 @@ class ComposeMail : public ComposeMailUI | |||
33 | public: | 34 | public: |
34 | ComposeMail( Settings *s, QWidget *parent = 0, const char *name = 0, bool modal = false, WFlags flags = 0 ); | 35 | ComposeMail( Settings *s, QWidget *parent = 0, const char *name = 0, bool modal = false, WFlags flags = 0 ); |
36 | virtual ~ComposeMail(); | ||
37 | |||
38 | void reEditMail(const RecMail¤t); | ||
35 | 39 | ||
36 | public slots: | 40 | public slots: |
@@ -44,4 +48,5 @@ public slots: | |||
44 | protected slots: | 48 | protected slots: |
45 | void accept(); | 49 | void accept(); |
50 | void reject(); | ||
46 | 51 | ||
47 | private slots: | 52 | private slots: |
diff --git a/noncore/net/mail/libmailwrapper/abstractmail.cpp b/noncore/net/mail/libmailwrapper/abstractmail.cpp index 9960f88..d71d35c 100644 --- a/noncore/net/mail/libmailwrapper/abstractmail.cpp +++ b/noncore/net/mail/libmailwrapper/abstractmail.cpp | |||
@@ -32,4 +32,22 @@ AbstractMail* AbstractMail::getWrapper(const QString&a,const QString&name) | |||
32 | } | 32 | } |
33 | 33 | ||
34 | AbstractMail* AbstractMail::getWrapper(Account*a) | ||
35 | { | ||
36 | if (!a) return 0; | ||
37 | switch (a->getType()) { | ||
38 | case MAILLIB::A_IMAP: | ||
39 | return new IMAPwrapper((IMAPaccount*)a); | ||
40 | break; | ||
41 | case MAILLIB::A_POP3: | ||
42 | return new POP3wrapper((POP3account*)a); | ||
43 | break; | ||
44 | case MAILLIB::A_NNTP: | ||
45 | return new NNTPwrapper((NNTPaccount*)a); | ||
46 | break; | ||
47 | default: | ||
48 | return 0; | ||
49 | } | ||
50 | } | ||
51 | |||
34 | encodedString* AbstractMail::decode_String(const encodedString*text,const QString&enc) | 52 | encodedString* AbstractMail::decode_String(const encodedString*text,const QString&enc) |
35 | { | 53 | { |
@@ -106,4 +124,9 @@ QString AbstractMail::defaultLocalfolder() | |||
106 | } | 124 | } |
107 | 125 | ||
126 | QString AbstractMail::draftFolder() | ||
127 | { | ||
128 | return QString("Drafts"); | ||
129 | } | ||
130 | |||
108 | /* temporary - will be removed when implemented in all classes */ | 131 | /* temporary - will be removed when implemented in all classes */ |
109 | void AbstractMail::deleteMails(const QString &,QList<RecMail> &) | 132 | void AbstractMail::deleteMails(const QString &,QList<RecMail> &) |
diff --git a/noncore/net/mail/libmailwrapper/abstractmail.h b/noncore/net/mail/libmailwrapper/abstractmail.h index 442ebfe..d377452 100644 --- a/noncore/net/mail/libmailwrapper/abstractmail.h +++ b/noncore/net/mail/libmailwrapper/abstractmail.h | |||
@@ -55,6 +55,8 @@ public: | |||
55 | /* mbox only! */ | 55 | /* mbox only! */ |
56 | static AbstractMail* getWrapper(const QString&a,const QString&name="Local Folders"); | 56 | static AbstractMail* getWrapper(const QString&a,const QString&name="Local Folders"); |
57 | static AbstractMail* getWrapper(Account*a); | ||
57 | 58 | ||
58 | static QString defaultLocalfolder(); | 59 | static QString defaultLocalfolder(); |
60 | static QString draftFolder(); | ||
59 | 61 | ||
60 | virtual MAILLIB::ATYPE getType()const=0; | 62 | virtual MAILLIB::ATYPE getType()const=0; |
diff --git a/noncore/net/mail/libmailwrapper/genericwrapper.cpp b/noncore/net/mail/libmailwrapper/genericwrapper.cpp index 137a6ef..ffa049f 100644 --- a/noncore/net/mail/libmailwrapper/genericwrapper.cpp +++ b/noncore/net/mail/libmailwrapper/genericwrapper.cpp | |||
@@ -451,4 +451,11 @@ void Genericwrapper::parseList(QList<RecMail> &target,mailsession*session,const | |||
451 | } | 451 | } |
452 | 452 | ||
453 | if (single_fields.fld_reply_to) { | ||
454 | QStringList t = parseAddressList(single_fields.fld_reply_to->rt_addr_list); | ||
455 | if (t.count()>0) { | ||
456 | mail->setReplyto(t[0]); | ||
457 | } | ||
458 | } | ||
459 | #if 0 | ||
453 | refs = single_fields.fld_references; | 460 | refs = single_fields.fld_references; |
454 | if (refs && refs->mid_list && clist_count(refs->mid_list)) { | 461 | if (refs && refs->mid_list && clist_count(refs->mid_list)) { |
@@ -456,4 +463,5 @@ void Genericwrapper::parseList(QList<RecMail> &target,mailsession*session,const | |||
456 | mail->setReplyto(QString(text)); | 463 | mail->setReplyto(QString(text)); |
457 | } | 464 | } |
465 | #endif | ||
458 | if (single_fields.fld_in_reply_to && single_fields.fld_in_reply_to->mid_list && | 466 | if (single_fields.fld_in_reply_to && single_fields.fld_in_reply_to->mid_list && |
459 | clist_count(single_fields.fld_in_reply_to->mid_list)) { | 467 | clist_count(single_fields.fld_in_reply_to->mid_list)) { |
diff --git a/noncore/net/mail/libmailwrapper/libmailwrapper.pro b/noncore/net/mail/libmailwrapper/libmailwrapper.pro index cb1e573..d28079e 100644 --- a/noncore/net/mail/libmailwrapper/libmailwrapper.pro +++ b/noncore/net/mail/libmailwrapper/libmailwrapper.pro | |||
@@ -16,5 +16,6 @@ HEADERS = mailwrapper.h \ | |||
16 | mhwrapper.h \ | 16 | mhwrapper.h \ |
17 | nntpwrapper.h \ | 17 | nntpwrapper.h \ |
18 | generatemail.h | 18 | generatemail.h \ |
19 | storemail.h | ||
19 | 20 | ||
20 | SOURCES = imapwrapper.cpp \ | 21 | SOURCES = imapwrapper.cpp \ |
@@ -32,5 +33,6 @@ SOURCES = imapwrapper.cpp \ | |||
32 | mhwrapper.cpp \ | 33 | mhwrapper.cpp \ |
33 | nntpwrapper.cpp \ | 34 | nntpwrapper.cpp \ |
34 | generatemail.cpp | 35 | generatemail.cpp \ |
36 | storemail.cpp | ||
35 | 37 | ||
36 | INTERFACES = logindialogui.ui \ | 38 | INTERFACES = logindialogui.ui \ |
diff --git a/noncore/net/mail/libmailwrapper/mailtypes.cpp b/noncore/net/mail/libmailwrapper/mailtypes.cpp index e4646d9..49b3caa 100644 --- a/noncore/net/mail/libmailwrapper/mailtypes.cpp +++ b/noncore/net/mail/libmailwrapper/mailtypes.cpp | |||
@@ -37,4 +37,5 @@ void RecMail::copy_old(const RecMail&old) | |||
37 | in_reply_to = old.in_reply_to; | 37 | in_reply_to = old.in_reply_to; |
38 | references = old.references; | 38 | references = old.references; |
39 | replyto = old.replyto; | ||
39 | } | 40 | } |
40 | 41 | ||
diff --git a/noncore/net/mail/libmailwrapper/storemail.cpp b/noncore/net/mail/libmailwrapper/storemail.cpp new file mode 100644 index 0000000..53101f8 --- a/dev/null +++ b/noncore/net/mail/libmailwrapper/storemail.cpp | |||
@@ -0,0 +1,90 @@ | |||
1 | #include "storemail.h" | ||
2 | #include "mailwrapper.h" | ||
3 | #include "settings.h" | ||
4 | #include "abstractmail.h" | ||
5 | |||
6 | #include <libetpan/libetpan.h> | ||
7 | |||
8 | #include <qstring.h> | ||
9 | |||
10 | #include <stdlib.h> | ||
11 | |||
12 | Storemail::Storemail(Account*aAccount,const QString&aFolder) | ||
13 | : Generatemail() | ||
14 | { | ||
15 | wrapper = 0; | ||
16 | m_Account = aAccount; | ||
17 | m_tfolder = aFolder; | ||
18 | wrapper = AbstractMail::getWrapper(m_Account); | ||
19 | if (wrapper) { | ||
20 | wrapper->createMbox(m_tfolder); | ||
21 | } | ||
22 | } | ||
23 | |||
24 | Storemail::Storemail(const QString&dir,const QString&aFolder) | ||
25 | : Generatemail() | ||
26 | { | ||
27 | wrapper = 0; | ||
28 | m_Account = 0; | ||
29 | m_tfolder = aFolder; | ||
30 | wrapper = AbstractMail::getWrapper(dir); | ||
31 | if (wrapper) { | ||
32 | wrapper->createMbox(m_tfolder); | ||
33 | } | ||
34 | } | ||
35 | |||
36 | Storemail::Storemail(const QString&aFolder) | ||
37 | : Generatemail() | ||
38 | { | ||
39 | wrapper = 0; | ||
40 | m_Account = 0; | ||
41 | m_tfolder = aFolder; | ||
42 | wrapper = AbstractMail::getWrapper(AbstractMail::defaultLocalfolder()); | ||
43 | if (wrapper) { | ||
44 | wrapper->createMbox(m_tfolder); | ||
45 | } | ||
46 | } | ||
47 | |||
48 | Storemail::~Storemail() | ||
49 | { | ||
50 | } | ||
51 | |||
52 | int Storemail::storeMail(const Mail&mail) | ||
53 | { | ||
54 | if (!wrapper) return 0; | ||
55 | int ret = 1; | ||
56 | |||
57 | mailmime * mimeMail = 0; | ||
58 | mimeMail = createMimeMail(mail ); | ||
59 | if ( mimeMail == NULL ) { | ||
60 | qDebug( "storeMail: error creating mime mail" ); | ||
61 | return 0; | ||
62 | } | ||
63 | char *data; | ||
64 | size_t size; | ||
65 | data = 0; | ||
66 | |||
67 | mailmessage * msg = 0; | ||
68 | msg = mime_message_init(mimeMail); | ||
69 | mime_message_set_tmpdir(msg,getenv( "HOME" )); | ||
70 | int r = mailmessage_fetch(msg,&data,&size); | ||
71 | mime_message_detach_mime(msg); | ||
72 | mailmessage_free(msg); | ||
73 | msg = 0; | ||
74 | if (r != MAIL_NO_ERROR || !data) { | ||
75 | qDebug("Error fetching mime..."); | ||
76 | ret = 0; | ||
77 | } | ||
78 | |||
79 | if (ret) { | ||
80 | wrapper->storeMessage(data,size,m_tfolder); | ||
81 | } | ||
82 | |||
83 | if (data) { | ||
84 | free(data); | ||
85 | } | ||
86 | if (mimeMail) { | ||
87 | mailmime_free( mimeMail ); | ||
88 | } | ||
89 | return ret; | ||
90 | } | ||
diff --git a/noncore/net/mail/libmailwrapper/storemail.h b/noncore/net/mail/libmailwrapper/storemail.h new file mode 100644 index 0000000..872c981 --- a/dev/null +++ b/noncore/net/mail/libmailwrapper/storemail.h | |||
@@ -0,0 +1,29 @@ | |||
1 | #ifndef __STORE_MAIL_H | ||
2 | #define __STORE_MAIL_H | ||
3 | |||
4 | #include <qpe/applnk.h> | ||
5 | |||
6 | #include "generatemail.h" | ||
7 | |||
8 | class Account; | ||
9 | class Mail; | ||
10 | class AbstractMail; | ||
11 | |||
12 | class Storemail : public Generatemail | ||
13 | { | ||
14 | Q_OBJECT | ||
15 | public: | ||
16 | Storemail(Account*aAccount,const QString&aFolder); | ||
17 | Storemail(const QString&dir,const QString&aFolder); | ||
18 | Storemail(const QString&aFolder); | ||
19 | virtual ~Storemail(); | ||
20 | |||
21 | int storeMail(const Mail&mail); | ||
22 | |||
23 | protected: | ||
24 | Account* m_Account; | ||
25 | QString m_tfolder; | ||
26 | AbstractMail*wrapper; | ||
27 | }; | ||
28 | |||
29 | #endif | ||
diff --git a/noncore/net/mail/mailistviewitem.cpp b/noncore/net/mail/mailistviewitem.cpp index f224dc3..75633ef 100644 --- a/noncore/net/mail/mailistviewitem.cpp +++ b/noncore/net/mail/mailistviewitem.cpp | |||
@@ -1,3 +1,4 @@ | |||
1 | #include "mailistviewitem.h" | 1 | #include "mailistviewitem.h" |
2 | #include <libmailwrapper/abstractmail.h> | ||
2 | #include <qtextstream.h> | 3 | #include <qtextstream.h> |
3 | #include <qpe/resource.h> | 4 | #include <qpe/resource.h> |
@@ -64,2 +65,8 @@ const RecMail& MailListViewItem::data()const | |||
64 | return mail_data; | 65 | return mail_data; |
65 | } | 66 | } |
67 | |||
68 | MAILLIB::ATYPE MailListViewItem::wrapperType() | ||
69 | { | ||
70 | if (!mail_data.Wrapper()) return MAILLIB::A_UNDEFINED; | ||
71 | return mail_data.Wrapper()->getType(); | ||
72 | } | ||
diff --git a/noncore/net/mail/mailistviewitem.h b/noncore/net/mail/mailistviewitem.h index 3b352a2..f736de0 100644 --- a/noncore/net/mail/mailistviewitem.h +++ b/noncore/net/mail/mailistviewitem.h | |||
@@ -4,4 +4,5 @@ | |||
4 | #include <qlistview.h> | 4 | #include <qlistview.h> |
5 | #include <libmailwrapper/mailtypes.h> | 5 | #include <libmailwrapper/mailtypes.h> |
6 | #include <libmailwrapper/maildefines.h> | ||
6 | 7 | ||
7 | class MailListViewItem:public QListViewItem | 8 | class MailListViewItem:public QListViewItem |
@@ -14,4 +15,5 @@ public: | |||
14 | const RecMail&data()const; | 15 | const RecMail&data()const; |
15 | void showEntry(); | 16 | void showEntry(); |
17 | MAILLIB::ATYPE wrapperType(); | ||
16 | 18 | ||
17 | protected: | 19 | protected: |
diff --git a/noncore/net/mail/nntpgroupsdlg.cpp b/noncore/net/mail/nntpgroupsdlg.cpp index 752ce3c..c94d9fa 100644 --- a/noncore/net/mail/nntpgroupsdlg.cpp +++ b/noncore/net/mail/nntpgroupsdlg.cpp | |||
@@ -7,5 +7,5 @@ | |||
7 | 7 | ||
8 | NNTPGroupsDlg::NNTPGroupsDlg(NNTPaccount *account,QWidget * parent, const char * name) | 8 | NNTPGroupsDlg::NNTPGroupsDlg(NNTPaccount *account,QWidget * parent, const char * name) |
9 | : QDialog(parent,name,true) | 9 | : QDialog(parent,name,true,WStyle_ContextHelp) |
10 | { | 10 | { |
11 | setCaption(tr("Subscribed newsgroups")); | 11 | setCaption(tr("Subscribed newsgroups")); |
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 | |||
@@ -178,5 +178,5 @@ 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;} |
@@ -186,8 +186,11 @@ void OpieMail::mailHold(int button, QListViewItem *item,const QPoint&,int ) | |||
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())); |
@@ -232,6 +235,10 @@ void OpieMail::mailLeftClicked(int button, QListViewItem *item,const QPoint&,int | |||
232 | if (button!=1) return; | 235 | if (button!=1) return; |
233 | if (!item) return; | 236 | if (!item) return; |
237 | if (folderView->currentisDraft()) { | ||
238 | reEditMail(); | ||
239 | } else { | ||
234 | displayMail(); | 240 | displayMail(); |
235 | } | 241 | } |
242 | } | ||
236 | 243 | ||
237 | void OpieMail::slotMoveCopyMail() | 244 | void OpieMail::slotMoveCopyMail() |
@@ -260,2 +267,12 @@ void OpieMail::slotMoveCopyMail() | |||
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 | } | ||
diff --git a/noncore/net/mail/opiemail.h b/noncore/net/mail/opiemail.h index 5821856..88c7ea1 100644 --- a/noncore/net/mail/opiemail.h +++ b/noncore/net/mail/opiemail.h | |||
@@ -31,4 +31,5 @@ protected slots: | |||
31 | virtual void mailLeftClicked( int, QListViewItem *,const QPoint&,int ); | 31 | virtual void mailLeftClicked( int, QListViewItem *,const QPoint&,int ); |
32 | virtual void slotMoveCopyMail(); | 32 | virtual void slotMoveCopyMail(); |
33 | virtual void reEditMail(); | ||
33 | 34 | ||
34 | private: | 35 | private: |