author | alwin <alwin> | 2004-03-10 22:44:44 (UTC) |
---|---|---|
committer | alwin <alwin> | 2004-03-10 22:44:44 (UTC) |
commit | 9454ac48a53f3b49e03288311b71436ccacd2d04 (patch) (unidiff) | |
tree | e05d40f575c87431d84c5ac374ff8ce656e6a419 | |
parent | a72855867dedd2b4c16f703fa104b5c6175ce484 (diff) | |
download | opie-9454ac48a53f3b49e03288311b71436ccacd2d04.zip opie-9454ac48a53f3b49e03288311b71436ccacd2d04.tar.gz opie-9454ac48a53f3b49e03288311b71436ccacd2d04.tar.bz2 |
some bugfixes
When edit a mail to send and cancel is pressed the mail can stored in a draft
folder and later edit again. This moment we will not store attachments into
drafts.
-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 | 25 | ||||
-rw-r--r-- | noncore/net/mail/libmailwrapper/abstractmail.cpp | 23 | ||||
-rw-r--r-- | noncore/net/mail/libmailwrapper/abstractmail.h | 10 | ||||
-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 | 6 | ||||
-rw-r--r-- | noncore/net/mail/nntpgroupsdlg.cpp | 2 | ||||
-rw-r--r-- | noncore/net/mail/opiemail.cpp | 23 | ||||
-rw-r--r-- | noncore/net/mail/opiemail.h | 1 |
18 files changed, 309 insertions, 39 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 | |||
@@ -915,5 +915,5 @@ void MHfolderItem::initName() | |||
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 ); |
@@ -1025,2 +1025,8 @@ void MHfolderItem::contextMenuSelected(int which) | |||
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 | /** |
@@ -1129 +1135,6 @@ AccountViewItem*AccountViewItem::findSubItem(const QString&path,AccountViewItem* | |||
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 | |||
@@ -32,2 +32,3 @@ public: | |||
32 | virtual bool matchName(const QString&name)const; | 32 | virtual bool matchName(const QString&name)const; |
33 | virtual bool isDraftfolder(); | ||
33 | 34 | ||
@@ -195,2 +196,3 @@ public: | |||
195 | virtual Folder*getFolder(); | 196 | virtual Folder*getFolder(); |
197 | virtual bool isDraftfolder(); | ||
196 | 198 | ||
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 | |||
@@ -170 +170,8 @@ void AccountView::downloadMails(Folder*fromFolder,AbstractMail*fromWrapper) | |||
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 | |||
@@ -25,2 +25,3 @@ public: | |||
25 | virtual void downloadMails(Folder*fromFolder,AbstractMail*fromWrapper); | 25 | virtual void downloadMails(Folder*fromFolder,AbstractMail*fromWrapper); |
26 | virtual bool currentisDraft(); | ||
26 | 27 | ||
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 | |||
@@ -11,2 +11,5 @@ | |||
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 | ||
@@ -126,3 +129,3 @@ void ComposeMail::pickAddressReply() | |||
126 | 129 | ||
127 | void ComposeMail::fillValues( int current ) | 130 | void ComposeMail::fillValues( int ) |
128 | { | 131 | { |
@@ -187,18 +190,19 @@ void ComposeMail::accept() | |||
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()) { |
@@ -206,3 +210,3 @@ void ComposeMail::accept() | |||
206 | ids.append(m_replyid); | 210 | ids.append(m_replyid); |
207 | mail->setInreply(ids); | 211 | mail.setInreply(ids); |
208 | } | 212 | } |
@@ -214,6 +218,6 @@ void ComposeMail::accept() | |||
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(); |
@@ -222,3 +226,3 @@ void ComposeMail::accept() | |||
222 | SMTPwrapper wrapper( smtp ); | 226 | SMTPwrapper wrapper( smtp ); |
223 | wrapper.sendMail( *mail,checkBoxLater->isChecked() ); | 227 | wrapper.sendMail( mail,checkBoxLater->isChecked() ); |
224 | 228 | ||
@@ -227,2 +231,60 @@ void ComposeMail::accept() | |||
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 ) |
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 | |||
@@ -15,11 +15,11 @@ class AddressPicker : public AddressPickerUI | |||
15 | { | 15 | { |
16 | Q_OBJECT | 16 | Q_OBJECT |
17 | 17 | ||
18 | public: | 18 | public: |
19 | AddressPicker( QWidget *parent = 0, const char *name = 0, bool modal = false, WFlags flags = 0 ); | 19 | AddressPicker( QWidget *parent = 0, const char *name = 0, bool modal = false, WFlags flags = 0 ); |
20 | static QString getNames(); | 20 | static QString getNames(); |
21 | 21 | ||
22 | protected: | 22 | protected: |
23 | QString selectedNames; | 23 | QString selectedNames; |
24 | void accept(); | 24 | void accept(); |
25 | 25 | ||
@@ -27,2 +27,3 @@ protected: | |||
27 | 27 | ||
28 | class RecMail; | ||
28 | 29 | ||
@@ -31,5 +32,8 @@ class ComposeMail : public ComposeMailUI | |||
31 | Q_OBJECT | 32 | Q_OBJECT |
32 | 33 | ||
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 | ||
@@ -45,3 +49,4 @@ protected slots: | |||
45 | void accept(); | 49 | void accept(); |
46 | 50 | void reject(); | |
51 | |||
47 | private slots: | 52 | private slots: |
@@ -64,8 +69,8 @@ class AttachViewItem : public QListViewItem | |||
64 | { | 69 | { |
65 | public: | 70 | public: |
66 | AttachViewItem( QListView *parent, Attachment *att ); | 71 | AttachViewItem( QListView *parent, Attachment *att ); |
67 | Attachment *getAttachment() { return attachment; } | 72 | Attachment *getAttachment() { return attachment; } |
68 | 73 | ||
69 | private: | 74 | private: |
70 | Attachment *attachment; | 75 | Attachment *attachment; |
71 | 76 | ||
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 | |||
@@ -33,2 +33,20 @@ AbstractMail* AbstractMail::getWrapper(const QString&a,const QString&name) | |||
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) |
@@ -107,2 +125,7 @@ QString AbstractMail::defaultLocalfolder() | |||
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 */ |
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 | |||
@@ -42,6 +42,6 @@ public: | |||
42 | 42 | ||
43 | virtual void cleanMimeCache(){}; | 43 | virtual void cleanMimeCache(){}; |
44 | /* mail box methods */ | 44 | /* mail box methods */ |
45 | /* parameter is the box to create. | 45 | /* parameter is the box to create. |
46 | * if the implementing subclass has prefixes, | 46 | * if the implementing subclass has prefixes, |
47 | * them has to be appended automatic. | 47 | * them has to be appended automatic. |
@@ -50,3 +50,3 @@ public: | |||
50 | virtual void logout()=0; | 50 | virtual void logout()=0; |
51 | 51 | ||
52 | static AbstractMail* getWrapper(IMAPaccount *a); | 52 | static AbstractMail* getWrapper(IMAPaccount *a); |
@@ -56,5 +56,7 @@ public: | |||
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(); |
59 | 60 | static QString draftFolder(); | |
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 | |||
@@ -452,2 +452,9 @@ void Genericwrapper::parseList(QList<RecMail> &target,mailsession*session,const | |||
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; |
@@ -457,2 +464,3 @@ void Genericwrapper::parseList(QList<RecMail> &target,mailsession*session,const | |||
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 && |
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 | |||
@@ -17,3 +17,4 @@ HEADERS = mailwrapper.h \ | |||
17 | nntpwrapper.h \ | 17 | nntpwrapper.h \ |
18 | generatemail.h | 18 | generatemail.h \ |
19 | storemail.h | ||
19 | 20 | ||
@@ -33,3 +34,4 @@ SOURCES = imapwrapper.cpp \ | |||
33 | nntpwrapper.cpp \ | 34 | nntpwrapper.cpp \ |
34 | generatemail.cpp | 35 | generatemail.cpp \ |
36 | storemail.cpp | ||
35 | 37 | ||
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 | |||
@@ -38,2 +38,3 @@ void RecMail::copy_old(const RecMail&old) | |||
38 | references = old.references; | 38 | references = old.references; |
39 | replyto = old.replyto; | ||
39 | } | 40 | } |
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,2 +1,3 @@ | |||
1 | #include "mailistviewitem.h" | 1 | #include "mailistviewitem.h" |
2 | #include <libmailwrapper/abstractmail.h> | ||
2 | #include <qtextstream.h> | 3 | #include <qtextstream.h> |
@@ -65 +66,7 @@ const RecMail& MailListViewItem::data()const | |||
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 | |||
@@ -5,2 +5,3 @@ | |||
5 | #include <libmailwrapper/mailtypes.h> | 5 | #include <libmailwrapper/mailtypes.h> |
6 | #include <libmailwrapper/maildefines.h> | ||
6 | 7 | ||
@@ -11,3 +12,3 @@ public: | |||
11 | virtual ~MailListViewItem(){} | 12 | virtual ~MailListViewItem(){} |
12 | 13 | ||
13 | void storeData(const RecMail&data); | 14 | void storeData(const RecMail&data); |
@@ -15,3 +16,4 @@ public: | |||
15 | void showEntry(); | 16 | void showEntry(); |
16 | 17 | MAILLIB::ATYPE wrapperType(); | |
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 | |||
@@ -8,3 +8,3 @@ | |||
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 | { |
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 | |||
@@ -179,3 +179,3 @@ void OpieMail::mailHold(int button, QListViewItem *item,const QPoint&,int ) | |||
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 */ |
@@ -187,3 +187,3 @@ void OpieMail::mailHold(int button, QListViewItem *item,const QPoint&,int ) | |||
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())); |
@@ -191,2 +191,5 @@ void OpieMail::mailHold(int button, QListViewItem *item,const QPoint&,int ) | |||
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())); |
@@ -233,3 +236,7 @@ void OpieMail::mailLeftClicked(int button, QListViewItem *item,const QPoint&,int | |||
233 | if (!item) return; | 236 | if (!item) return; |
234 | displayMail(); | 237 | if (folderView->currentisDraft()) { |
238 | reEditMail(); | ||
239 | } else { | ||
240 | displayMail(); | ||
241 | } | ||
235 | } | 242 | } |
@@ -261 +268,11 @@ void OpieMail::slotMoveCopyMail() | |||
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 | |||
@@ -32,2 +32,3 @@ protected slots: | |||
32 | virtual void slotMoveCopyMail(); | 32 | virtual void slotMoveCopyMail(); |
33 | virtual void reEditMail(); | ||
33 | 34 | ||