summaryrefslogtreecommitdiff
Unidiff
Diffstat (more/less context) (ignore whitespace changes)
-rw-r--r--noncore/net/mail/accountitem.cpp17
-rw-r--r--noncore/net/mail/accountitem.h2
-rw-r--r--noncore/net/mail/accountview.cpp7
-rw-r--r--noncore/net/mail/accountview.h1
-rw-r--r--noncore/net/mail/composemail.cpp90
-rw-r--r--noncore/net/mail/composemail.h25
-rw-r--r--noncore/net/mail/libmailwrapper/abstractmail.cpp23
-rw-r--r--noncore/net/mail/libmailwrapper/abstractmail.h10
-rw-r--r--noncore/net/mail/libmailwrapper/genericwrapper.cpp8
-rw-r--r--noncore/net/mail/libmailwrapper/libmailwrapper.pro6
-rw-r--r--noncore/net/mail/libmailwrapper/mailtypes.cpp1
-rw-r--r--noncore/net/mail/libmailwrapper/storemail.cpp90
-rw-r--r--noncore/net/mail/libmailwrapper/storemail.h29
-rw-r--r--noncore/net/mail/mailistviewitem.cpp7
-rw-r--r--noncore/net/mail/mailistviewitem.h6
-rw-r--r--noncore/net/mail/nntpgroupsdlg.cpp2
-rw-r--r--noncore/net/mail/opiemail.cpp23
-rw-r--r--noncore/net/mail/opiemail.h1
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
@@ -913,9 +913,9 @@ void MHfolderItem::initName()
913 else if (bName.lower() == "inbox") 913 else if (bName.lower() == "inbox")
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 }
921 setText( 0, bName ); 921 setText( 0, bName );
@@ -1023,6 +1023,12 @@ void MHfolderItem::contextMenuSelected(int which)
1023 } 1023 }
1024} 1024}
1025 1025
1026bool 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
1028 */ 1034 */
@@ -1127,3 +1133,8 @@ AccountViewItem*AccountViewItem::findSubItem(const QString&path,AccountViewItem*
1127 } 1133 }
1128 return pitem; 1134 return pitem;
1129} 1135}
1136
1137bool 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
@@ -30,6 +30,7 @@ public:
30 virtual void contextMenuSelected(int){} 30 virtual void contextMenuSelected(int){}
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
34protected: 35protected:
35 AccountViewItem*findSubItem(const QString&path,AccountViewItem*start=0); 36 AccountViewItem*findSubItem(const QString&path,AccountViewItem*start=0);
@@ -193,6 +194,7 @@ public:
193 virtual QPopupMenu * getContextMenu(); 194 virtual QPopupMenu * getContextMenu();
194 virtual void contextMenuSelected(int); 195 virtual void contextMenuSelected(int);
195 virtual Folder*getFolder(); 196 virtual Folder*getFolder();
197 virtual bool isDraftfolder();
196 198
197protected: 199protected:
198 void downloadMails(); 200 void downloadMails();
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
@@ -168,3 +168,10 @@ void AccountView::downloadMails(Folder*fromFolder,AbstractMail*fromWrapper)
168 fromWrapper->mvcpAllMails(fromFolder,targetFolder,targetMail,sels.moveMails()); 168 fromWrapper->mvcpAllMails(fromFolder,targetFolder,targetMail,sels.moveMails());
169 refreshCurrent(); 169 refreshCurrent();
170} 170}
171
172bool 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
@@ -23,6 +23,7 @@ public:
23 virtual void populate( QList<Account> list ); 23 virtual void populate( QList<Account> list );
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
27public slots: 28public slots:
28 virtual void refreshAll(); 29 virtual void refreshAll();
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
@@ -9,6 +9,9 @@
9#include "composemail.h" 9#include "composemail.h"
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
13ComposeMail::ComposeMail( Settings *s, QWidget *parent, const char *name, bool modal, WFlags flags ) 16ComposeMail::ComposeMail( Settings *s, QWidget *parent, const char *name, bool modal, WFlags flags )
14 : ComposeMailUI( parent, name, modal, flags ) 17 : ComposeMailUI( parent, name, modal, flags )
@@ -124,7 +127,7 @@ void ComposeMail::pickAddressReply()
124 pickAddress( replyLine ); 127 pickAddress( replyLine );
125} 128}
126 129
127void ComposeMail::fillValues( int current ) 130void ComposeMail::fillValues( int )
128{ 131{
129#if 0 132#if 0
130 SMTPaccount *smtp = smtpAccounts.at( current ); 133 SMTPaccount *smtp = smtpAccounts.at( current );
@@ -185,26 +188,27 @@ void ComposeMail::accept()
185 qDebug( "Sending Mail with " + 188 qDebug( "Sending Mail with " +
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();
210 if ( !sigMultiLine->text().isEmpty() ) { 214 if ( !sigMultiLine->text().isEmpty() ) {
@@ -212,19 +216,77 @@ void ComposeMail::accept()
212 txt.append( sigMultiLine->text() ); 216 txt.append( sigMultiLine->text() );
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
232void 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
275ComposeMail::~ComposeMail()
276{
277}
278
279void ComposeMail::reEditMail(const RecMail&current)
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
228AttachViewItem::AttachViewItem( QListView *parent, Attachment *att ) 290AttachViewItem::AttachViewItem( QListView *parent, Attachment *att )
229 : QListViewItem( parent ) 291 : QListViewItem( parent )
230{ 292{
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
@@ -13,25 +13,29 @@
13 13
14class AddressPicker : public AddressPickerUI 14class AddressPicker : public AddressPickerUI
15{ 15{
16 Q_OBJECT 16 Q_OBJECT
17 17
18public: 18public:
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
22protected: 22protected:
23 QString selectedNames; 23 QString selectedNames;
24 void accept(); 24 void accept();
25 25
26}; 26};
27 27
28class RecMail;
28 29
29class ComposeMail : public ComposeMailUI 30class ComposeMail : public ComposeMailUI
30{ 31{
31 Q_OBJECT 32 Q_OBJECT
32 33
33public: 34public:
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&current);
35 39
36public slots: 40public slots:
37 void slotAdjustColumns(); 41 void slotAdjustColumns();
@@ -43,7 +47,8 @@ public slots:
43 47
44protected slots: 48protected slots:
45 void accept(); 49 void accept();
46 50 void reject();
51
47private slots: 52private slots:
48 void fillValues( int current ); 53 void fillValues( int current );
49 void pickAddress( QLineEdit *line ); 54 void pickAddress( QLineEdit *line );
@@ -62,12 +67,12 @@ protected:
62 67
63class AttachViewItem : public QListViewItem 68class AttachViewItem : public QListViewItem
64{ 69{
65 public: 70public:
66 AttachViewItem( QListView *parent, Attachment *att ); 71 AttachViewItem( QListView *parent, Attachment *att );
67 Attachment *getAttachment() { return attachment; } 72 Attachment *getAttachment() { return attachment; }
68 73
69private: 74private:
70 Attachment *attachment; 75 Attachment *attachment;
71 76
72}; 77};
73 78
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
@@ -31,6 +31,24 @@ AbstractMail* AbstractMail::getWrapper(const QString&a,const QString&name)
31 return new MHwrapper(a,name); 31 return new MHwrapper(a,name);
32} 32}
33 33
34AbstractMail* 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
34encodedString* AbstractMail::decode_String(const encodedString*text,const QString&enc) 52encodedString* AbstractMail::decode_String(const encodedString*text,const QString&enc)
35{ 53{
36 qDebug("Decode string start"); 54 qDebug("Decode string start");
@@ -105,6 +123,11 @@ QString AbstractMail::defaultLocalfolder()
105 return f; 123 return f;
106} 124}
107 125
126QString 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 */
109void AbstractMail::deleteMails(const QString &,QList<RecMail> &) 132void AbstractMail::deleteMails(const QString &,QList<RecMail> &)
110{ 133{
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
@@ -40,23 +40,25 @@ public:
40 virtual void mvcpAllMails(Folder*fromFolder,const QString&targetFolder,AbstractMail*targetWrapper,bool moveit); 40 virtual void mvcpAllMails(Folder*fromFolder,const QString&targetFolder,AbstractMail*targetWrapper,bool moveit);
41 virtual void mvcpMail(const RecMail&mail,const QString&targetFolder,AbstractMail*targetWrapper,bool moveit); 41 virtual void mvcpMail(const RecMail&mail,const QString&targetFolder,AbstractMail*targetWrapper,bool moveit);
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.
48 */ 48 */
49 virtual int createMbox(const QString&,const Folder*parentfolder=0,const QString& delemiter="/",bool getsubfolder=false); 49 virtual int createMbox(const QString&,const Folder*parentfolder=0,const QString& delemiter="/",bool getsubfolder=false);
50 virtual void logout()=0; 50 virtual void logout()=0;
51 51
52 static AbstractMail* getWrapper(IMAPaccount *a); 52 static AbstractMail* getWrapper(IMAPaccount *a);
53 static AbstractMail* getWrapper(POP3account *a); 53 static AbstractMail* getWrapper(POP3account *a);
54 static AbstractMail* getWrapper(NNTPaccount *a); 54 static AbstractMail* getWrapper(NNTPaccount *a);
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();
59 60 static QString draftFolder();
61
60 virtual MAILLIB::ATYPE getType()const=0; 62 virtual MAILLIB::ATYPE getType()const=0;
61 virtual const QString&getName()const=0; 63 virtual const QString&getName()const=0;
62 64
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
@@ -450,11 +450,19 @@ void Genericwrapper::parseList(QList<RecMail> &target,mailsession*session,const
450 qDebug("Msgid == %s",mail->Msgid().latin1()); 450 qDebug("Msgid == %s",mail->Msgid().latin1());
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)) {
455 char * text = (char*)refs->mid_list->first->data; 462 char * text = (char*)refs->mid_list->first->data;
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)) {
460 mail->setInreply(parseInreplies(single_fields.fld_in_reply_to)); 468 mail->setInreply(parseInreplies(single_fields.fld_in_reply_to));
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
@@ -15,7 +15,8 @@ HEADERS = mailwrapper.h \
15 statusmail.h \ 15 statusmail.h \
16 mhwrapper.h \ 16 mhwrapper.h \
17 nntpwrapper.h \ 17 nntpwrapper.h \
18 generatemail.h 18 generatemail.h \
19 storemail.h
19 20
20SOURCES = imapwrapper.cpp \ 21SOURCES = imapwrapper.cpp \
21 mailwrapper.cpp \ 22 mailwrapper.cpp \
@@ -31,7 +32,8 @@ SOURCES = imapwrapper.cpp \
31 statusmail.cpp \ 32 statusmail.cpp \
32 mhwrapper.cpp \ 33 mhwrapper.cpp \
33 nntpwrapper.cpp \ 34 nntpwrapper.cpp \
34 generatemail.cpp 35 generatemail.cpp \
36 storemail.cpp
35 37
36INTERFACES = logindialogui.ui \ 38INTERFACES = logindialogui.ui \
37 sendmailprogressui.ui 39 sendmailprogressui.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
@@ -36,6 +36,7 @@ void RecMail::copy_old(const RecMail&old)
36 wrapper = old.wrapper; 36 wrapper = old.wrapper;
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
41void RecMail::init() 42void RecMail::init()
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
12Storemail::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
24Storemail::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
36Storemail::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
48Storemail::~Storemail()
49{
50}
51
52int 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
8class Account;
9class Mail;
10class AbstractMail;
11
12class Storemail : public Generatemail
13{
14 Q_OBJECT
15public:
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
23protected:
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,4 +1,5 @@
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>
4 5
@@ -63,3 +64,9 @@ const RecMail& MailListViewItem::data()const
63{ 64{
64 return mail_data; 65 return mail_data;
65} 66}
67
68MAILLIB::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
@@ -3,17 +3,19 @@
3 3
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
7class MailListViewItem:public QListViewItem 8class MailListViewItem:public QListViewItem
8{ 9{
9public: 10public:
10 MailListViewItem(QListView * parent, MailListViewItem * after ); 11 MailListViewItem(QListView * parent, MailListViewItem * after );
11 virtual ~MailListViewItem(){} 12 virtual ~MailListViewItem(){}
12 13
13 void storeData(const RecMail&data); 14 void storeData(const RecMail&data);
14 const RecMail&data()const; 15 const RecMail&data()const;
15 void showEntry(); 16 void showEntry();
16 17 MAILLIB::ATYPE wrapperType();
18
17protected: 19protected:
18 RecMail mail_data; 20 RecMail mail_data;
19}; 21};
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
@@ -6,7 +6,7 @@
6#include <qlayout.h> 6#include <qlayout.h>
7 7
8NNTPGroupsDlg::NNTPGroupsDlg(NNTPaccount *account,QWidget * parent, const char * name) 8NNTPGroupsDlg::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"));
12 m_Account = account; 12 m_Account = account;
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
@@ -177,7 +177,7 @@ void OpieMail::slotDeleteMail()
177void OpieMail::mailHold(int button, QListViewItem *item,const QPoint&,int ) 177void 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");
@@ -185,10 +185,13 @@ void OpieMail::mailHold(int button, QListViewItem *item,const QPoint&,int )
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()));
@@ -231,7 +234,11 @@ void OpieMail::mailLeftClicked(int button, QListViewItem *item,const QPoint&,int
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
237void OpieMail::slotMoveCopyMail() 244void OpieMail::slotMoveCopyMail()
@@ -259,3 +266,13 @@ void OpieMail::slotMoveCopyMail()
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
270void 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
@@ -30,6 +30,7 @@ protected slots:
30 virtual void refreshMailView(QList<RecMail>*); 30 virtual void refreshMailView(QList<RecMail>*);
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
34private: 35private:
35 Settings *settings; 36 Settings *settings;