summaryrefslogtreecommitdiff
path: root/noncore
Unidiff
Diffstat (limited to 'noncore') (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
@@ -904,27 +904,27 @@ void MHfolderItem::initName()
904 int pos = bName.findRev("/"); 904 int pos = bName.findRev("/");
905 if (pos > 0) 905 if (pos > 0)
906 { 906 {
907 bName.replace(0,pos+1,""); 907 bName.replace(0,pos+1,"");
908 } 908 }
909 if (bName.lower() == "outgoing") 909 if (bName.lower() == "outgoing")
910 { 910 {
911 setPixmap( 0, PIXMAP_OUTBOXFOLDER ); 911 setPixmap( 0, PIXMAP_OUTBOXFOLDER );
912 } 912 }
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 );
922} 922}
923 923
924Folder*MHfolderItem::getFolder() 924Folder*MHfolderItem::getFolder()
925{ 925{
926 return folder; 926 return folder;
927} 927}
928 928
929void MHfolderItem::refresh(QList<RecMail>&target) 929void MHfolderItem::refresh(QList<RecMail>&target)
930{ 930{
@@ -1014,24 +1014,30 @@ void MHfolderItem::contextMenuSelected(int which)
1014 break; 1014 break;
1015 case 2: 1015 case 2:
1016 downloadMails(); 1016 downloadMails();
1017 break; 1017 break;
1018 case 3: 1018 case 3:
1019 createFolder(); 1019 createFolder();
1020 break; 1020 break;
1021 default: 1021 default:
1022 break; 1022 break;
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 */
1029 1035
1030const QString AccountViewItem::contextName="AccountViewItem"; 1036const QString AccountViewItem::contextName="AccountViewItem";
1031 1037
1032AccountViewItem::AccountViewItem( AccountView *parent ) 1038AccountViewItem::AccountViewItem( AccountView *parent )
1033 : QListViewItem( parent ) 1039 : QListViewItem( parent )
1034{ 1040{
1035 init(); 1041 init();
1036 m_Backlink = parent; 1042 m_Backlink = parent;
1037} 1043}
@@ -1118,12 +1124,17 @@ AccountViewItem*AccountViewItem::findSubItem(const QString&path,AccountViewItem*
1118 { 1124 {
1119 sitem = findSubItem(path,pitem); 1125 sitem = findSubItem(path,pitem);
1120 if (sitem) 1126 if (sitem)
1121 { 1127 {
1122 pitem = sitem; 1128 pitem = sitem;
1123 break; 1129 break;
1124 } 1130 }
1125 } 1131 }
1126 pitem=(AccountViewItem*)pitem->nextSibling(); 1132 pitem=(AccountViewItem*)pitem->nextSibling();
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
@@ -21,24 +21,25 @@ class AccountViewItem : public QListViewItem
21 21
22public: 22public:
23 AccountViewItem( AccountView *parent ); 23 AccountViewItem( AccountView *parent );
24 AccountViewItem( QListViewItem *parent); 24 AccountViewItem( QListViewItem *parent);
25 AccountViewItem( QListViewItem *parent , QListViewItem*after ); 25 AccountViewItem( QListViewItem *parent , QListViewItem*after );
26 virtual ~AccountViewItem(); 26 virtual ~AccountViewItem();
27 virtual void refresh(QList<RecMail>&)=0; 27 virtual void refresh(QList<RecMail>&)=0;
28 virtual RecBody fetchBody(const RecMail&)=0; 28 virtual RecBody fetchBody(const RecMail&)=0;
29 virtual QPopupMenu * getContextMenu(){return 0;}; 29 virtual QPopupMenu * getContextMenu(){return 0;};
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);
36 virtual void init(); 37 virtual void init();
37 virtual void removeChilds(); 38 virtual void removeChilds();
38 virtual void deleteAllMail(AbstractMail*wrapper,Folder*f); 39 virtual void deleteAllMail(AbstractMail*wrapper,Folder*f);
39 static const QString contextName; 40 static const QString contextName;
40 AccountView*m_Backlink; 41 AccountView*m_Backlink;
41 Folder *folder; 42 Folder *folder;
42}; 43};
43 44
44class POP3viewItem : public AccountViewItem 45class POP3viewItem : public AccountViewItem
@@ -184,22 +185,23 @@ protected:
184class MHfolderItem : public AccountViewItem 185class MHfolderItem : public AccountViewItem
185{ 186{
186 187
187public: 188public:
188 MHfolderItem( Folder *folder, MHviewItem *parent , QListViewItem*after ); 189 MHfolderItem( Folder *folder, MHviewItem *parent , QListViewItem*after );
189 MHfolderItem( Folder *folder, MHfolderItem *parent, QListViewItem*after, MHviewItem*master); 190 MHfolderItem( Folder *folder, MHfolderItem *parent, QListViewItem*after, MHviewItem*master);
190 virtual ~MHfolderItem(); 191 virtual ~MHfolderItem();
191 virtual void refresh(QList<RecMail>&); 192 virtual void refresh(QList<RecMail>&);
192 virtual RecBody fetchBody(const RecMail&); 193 virtual RecBody fetchBody(const RecMail&);
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();
199 virtual void createFolder(); 201 virtual void createFolder();
200 virtual void deleteFolder(); 202 virtual void deleteFolder();
201 void initName(); 203 void initName();
202 MHviewItem *mbox; 204 MHviewItem *mbox;
203}; 205};
204 206
205#endif 207#endif
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
@@ -159,12 +159,19 @@ void AccountView::downloadMails(Folder*fromFolder,AbstractMail*fromWrapper)
159 } 159 }
160 if (sels.newFolder() && !targetMail->createMbox(targetFolder)) 160 if (sels.newFolder() && !targetMail->createMbox(targetFolder))
161 { 161 {
162 QMessageBox::critical(0,tr("Error creating new Folder"), 162 QMessageBox::critical(0,tr("Error creating new Folder"),
163 tr("<center>Error while creating<br>new folder - breaking.</center>")); 163 tr("<center>Error while creating<br>new folder - breaking.</center>"));
164 return; 164 return;
165 } 165 }
166 qDebug("Targetfolder: %s",targetFolder.latin1()); 166 qDebug("Targetfolder: %s",targetFolder.latin1());
167 qDebug("Fromfolder: %s",fromFolder->getName().latin1()); 167 qDebug("Fromfolder: %s",fromFolder->getName().latin1());
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
@@ -14,24 +14,25 @@ class IMAPviewItem;
14class MHviewItem; 14class MHviewItem;
15 15
16class AccountView : public QListView 16class AccountView : public QListView
17{ 17{
18 Q_OBJECT 18 Q_OBJECT
19 19
20public: 20public:
21 AccountView( QWidget *parent = 0, const char *name = 0, WFlags flags = 0 ); 21 AccountView( QWidget *parent = 0, const char *name = 0, WFlags flags = 0 );
22 virtual ~AccountView(); 22 virtual ~AccountView();
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();
29 virtual void refresh(QListViewItem *item); 30 virtual void refresh(QListViewItem *item);
30 virtual void refreshCurrent(); 31 virtual void refreshCurrent();
31 virtual void slotHold(int, QListViewItem *,const QPoint&,int); 32 virtual void slotHold(int, QListViewItem *,const QPoint&,int);
32 virtual void slotContextMenu(int id); 33 virtual void slotContextMenu(int id);
33 void setupFolderselect(Selectstore*sels); 34 void setupFolderselect(Selectstore*sels);
34 35
35signals: 36signals:
36 void refreshMailview(QList<RecMail>*); 37 void refreshMailview(QList<RecMail>*);
37 38
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
@@ -1,23 +1,26 @@
1#include <qt.h> 1#include <qt.h>
2 2
3#include <opie2/ofiledialog.h> 3#include <opie2/ofiledialog.h>
4#include <qpe/resource.h> 4#include <qpe/resource.h>
5#include <qpe/config.h> 5#include <qpe/config.h>
6#include <qpe/global.h> 6#include <qpe/global.h>
7#include <qpe/contact.h> 7#include <qpe/contact.h>
8 8
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 )
15{ 18{
16 settings = s; 19 settings = s;
17 m_replyid = ""; 20 m_replyid = "";
18 21
19 QString vfilename = Global::applicationFileName("addressbook", 22 QString vfilename = Global::applicationFileName("addressbook",
20 "businesscard.vcf"); 23 "businesscard.vcf");
21 Contact c; 24 Contact c;
22 if (QFile::exists(vfilename)) { 25 if (QFile::exists(vfilename)) {
23 c = Contact::readVCard( vfilename )[0]; 26 c = Contact::readVCard( vfilename )[0];
@@ -115,25 +118,25 @@ void ComposeMail::pickAddressCC()
115} 118}
116 119
117void ComposeMail::pickAddressBCC() 120void ComposeMail::pickAddressBCC()
118{ 121{
119 pickAddress( bccLine ); 122 pickAddress( bccLine );
120} 123}
121 124
122void ComposeMail::pickAddressReply() 125void ComposeMail::pickAddressReply()
123{ 126{
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 );
131 ccLine->clear(); 134 ccLine->clear();
132 if ( smtp->getUseCC() ) { 135 if ( smtp->getUseCC() ) {
133 ccLine->setText( smtp->getCC() ); 136 ccLine->setText( smtp->getCC() );
134 } 137 }
135 bccLine->clear(); 138 bccLine->clear();
136 if ( smtp->getUseBCC() ) { 139 if ( smtp->getUseBCC() ) {
137 bccLine->setText( smtp->getBCC() ); 140 bccLine->setText( smtp->getBCC() );
138 } 141 }
139 replyLine->clear(); 142 replyLine->clear();
@@ -176,64 +179,123 @@ void ComposeMail::removeAttachment()
176} 179}
177 180
178void ComposeMail::accept() 181void ComposeMail::accept()
179{ 182{
180 if ( checkBoxLater->isChecked() ) { 183 if ( checkBoxLater->isChecked() ) {
181 qDebug( "Send later" ); 184 qDebug( "Send later" );
182 } 185 }
183 186
184#if 0 187#if 0
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() ) {
211 txt.append( "\n--\n" ); 215 txt.append( "\n--\n" );
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{
231 attachment = att; 293 attachment = att;
232 qDebug( att->getMimeType() ); 294 qDebug( att->getMimeType() );
233 setPixmap( 0, attachment->getDocLnk().pixmap().isNull() ? 295 setPixmap( 0, attachment->getDocLnk().pixmap().isNull() ?
234 Resource::loadPixmap( "UnknownDocument-14" ) : 296 Resource::loadPixmap( "UnknownDocument-14" ) :
235 attachment->getDocLnk().pixmap() ); 297 attachment->getDocLnk().pixmap() );
236 setText( 0, att->getName().isEmpty() ? att->getFileName() : att->getName() ); 298 setText( 0, att->getName().isEmpty() ? att->getFileName() : att->getName() );
237 setText( 1, QString::number( att->getSize() ) ); 299 setText( 1, QString::number( att->getSize() ) );
238} 300}
239 301
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
@@ -4,71 +4,76 @@
4#include <qlineedit.h> 4#include <qlineedit.h>
5#include <qlistview.h> 5#include <qlistview.h>
6 6
7#include "composemailui.h" 7#include "composemailui.h"
8#include "addresspickerui.h" 8#include "addresspickerui.h"
9#include <libmailwrapper/settings.h> 9#include <libmailwrapper/settings.h>
10#include <libmailwrapper/mailwrapper.h> 10#include <libmailwrapper/mailwrapper.h>
11 11
12 12
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();
38 42
39 void setTo( const QString & to ); 43 void setTo( const QString & to );
40 void setSubject( const QString & subject ); 44 void setSubject( const QString & subject );
41 void setInReplyTo( const QString & messageId ); 45 void setInReplyTo( const QString & messageId );
42 void setMessage( const QString & text ); 46 void setMessage( const QString & text );
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 );
50 void pickAddressTo(); 55 void pickAddressTo();
51 void pickAddressCC(); 56 void pickAddressCC();
52 void pickAddressBCC(); 57 void pickAddressBCC();
53 void pickAddressReply(); 58 void pickAddressReply();
54 void addAttachment(); 59 void addAttachment();
55 void removeAttachment(); 60 void removeAttachment();
56 61
57protected: 62protected:
58 Settings *settings; 63 Settings *settings;
59 QList<SMTPaccount> smtpAccounts; 64 QList<SMTPaccount> smtpAccounts;
60 QString m_replyid; 65 QString m_replyid;
61}; 66};
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
74#endif 79#endif
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
@@ -22,24 +22,42 @@ AbstractMail* AbstractMail::getWrapper(POP3account *a)
22} 22}
23 23
24AbstractMail* AbstractMail::getWrapper(NNTPaccount *a) 24AbstractMail* AbstractMail::getWrapper(NNTPaccount *a)
25{ 25{
26 return new NNTPwrapper(a); 26 return new NNTPwrapper(a);
27} 27}
28 28
29AbstractMail* AbstractMail::getWrapper(const QString&a,const QString&name) 29AbstractMail* AbstractMail::getWrapper(const QString&a,const QString&name)
30{ 30{
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");
37 char*result_text; 55 char*result_text;
38 size_t index = 0; 56 size_t index = 0;
39 /* reset for recursive use! */ 57 /* reset for recursive use! */
40 size_t target_length = 0; 58 size_t target_length = 0;
41 result_text = 0; 59 result_text = 0;
42 int mimetype = MAILMIME_MECHANISM_7BIT; 60 int mimetype = MAILMIME_MECHANISM_7BIT;
43 if (enc.lower()=="quoted-printable") { 61 if (enc.lower()=="quoted-printable") {
44 mimetype = MAILMIME_MECHANISM_QUOTED_PRINTABLE; 62 mimetype = MAILMIME_MECHANISM_QUOTED_PRINTABLE;
45 } else if (enc.lower()=="base64") { 63 } else if (enc.lower()=="base64") {
@@ -96,24 +114,29 @@ QString AbstractMail::gen_attachment_id()
96int AbstractMail::createMbox(const QString&,const Folder*,const QString& delemiter,bool) 114int AbstractMail::createMbox(const QString&,const Folder*,const QString& delemiter,bool)
97{ 115{
98 return 0; 116 return 0;
99} 117}
100 118
101QString AbstractMail::defaultLocalfolder() 119QString AbstractMail::defaultLocalfolder()
102{ 120{
103 QString f = getenv( "HOME" ); 121 QString f = getenv( "HOME" );
104 f += "/Applications/opiemail/localmail"; 122 f += "/Applications/opiemail/localmail";
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{
111} 134}
112 135
113void AbstractMail::mvcpAllMails(Folder*fromFolder,const QString&targetFolder,AbstractMail*targetWrapper,bool moveit) 136void AbstractMail::mvcpAllMails(Folder*fromFolder,const QString&targetFolder,AbstractMail*targetWrapper,bool moveit)
114{ 137{
115 QList<RecMail> t; 138 QList<RecMail> t;
116 listMessages(fromFolder->getName(),t); 139 listMessages(fromFolder->getName(),t);
117 encodedString*st = 0; 140 encodedString*st = 0;
118 while (t.count()>0) { 141 while (t.count()>0) {
119 RecMail*r = t.at(0); 142 RecMail*r = t.at(0);
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
@@ -31,38 +31,40 @@ public:
31 virtual encodedString* fetchRawBody(const RecMail&mail)=0; 31 virtual encodedString* fetchRawBody(const RecMail&mail)=0;
32 32
33 virtual void deleteMail(const RecMail&mail)=0; 33 virtual void deleteMail(const RecMail&mail)=0;
34 virtual void answeredMail(const RecMail&mail)=0; 34 virtual void answeredMail(const RecMail&mail)=0;
35 virtual int deleteAllMail(const Folder*)=0; 35 virtual int deleteAllMail(const Folder*)=0;
36 virtual void deleteMails(const QString & FolderName,QList<RecMail> &target); 36 virtual void deleteMails(const QString & FolderName,QList<RecMail> &target);
37 virtual int deleteMbox(const Folder*)=0; 37 virtual int deleteMbox(const Folder*)=0;
38 virtual void storeMessage(const char*msg,size_t length, const QString&folder)=0; 38 virtual void storeMessage(const char*msg,size_t length, const QString&folder)=0;
39 39
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
63protected: 65protected:
64 static encodedString*decode_String(const encodedString*text,const QString&enc); 66 static encodedString*decode_String(const encodedString*text,const QString&enc);
65 static QString convert_String(const char*text); 67 static QString convert_String(const char*text);
66 static QString gen_attachment_id(); 68 static QString gen_attachment_id();
67}; 69};
68#endif 70#endif
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
@@ -441,27 +441,35 @@ void Genericwrapper::parseList(QList<RecMail> &target,mailsession*session,const
441 if (single_fields.fld_cc) 441 if (single_fields.fld_cc)
442 mail->setCC( parseAddressList( single_fields.fld_cc->cc_addr_list ) ); 442 mail->setCC( parseAddressList( single_fields.fld_cc->cc_addr_list ) );
443 if (single_fields.fld_bcc) 443 if (single_fields.fld_bcc)
444 mail->setBcc( parseAddressList( single_fields.fld_bcc->bcc_addr_list ) ); 444 mail->setBcc( parseAddressList( single_fields.fld_bcc->bcc_addr_list ) );
445 if (single_fields.fld_orig_date) 445 if (single_fields.fld_orig_date)
446 mail->setDate( parseDateTime( single_fields.fld_orig_date->dt_date_time ) ); 446 mail->setDate( parseDateTime( single_fields.fld_orig_date->dt_date_time ) );
447 // crashes when accessing pop3 account? 447 // crashes when accessing pop3 account?
448 if (single_fields.fld_message_id->mid_value) { 448 if (single_fields.fld_message_id->mid_value) {
449 mail->setMsgid(QString(single_fields.fld_message_id->mid_value)); 449 mail->setMsgid(QString(single_fields.fld_message_id->mid_value));
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));
461 } 469 }
462 target.append(mail); 470 target.append(mail);
463 } 471 }
464 if (env_list) { 472 if (env_list) {
465 mailmessage_list_free(env_list); 473 mailmessage_list_free(env_list);
466 } 474 }
467} 475}
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
@@ -6,41 +6,43 @@ HEADERS = mailwrapper.h \
6 mailtypes.h \ 6 mailtypes.h \
7 pop3wrapper.h \ 7 pop3wrapper.h \
8 abstractmail.h \ 8 abstractmail.h \
9 smtpwrapper.h \ 9 smtpwrapper.h \
10 genericwrapper.h \ 10 genericwrapper.h \
11 mboxwrapper.h \ 11 mboxwrapper.h \
12 settings.h \ 12 settings.h \
13 logindialog.h \ 13 logindialog.h \
14 sendmailprogress.h \ 14 sendmailprogress.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 \
22 mailtypes.cpp \ 23 mailtypes.cpp \
23 pop3wrapper.cpp \ 24 pop3wrapper.cpp \
24 abstractmail.cpp \ 25 abstractmail.cpp \
25 smtpwrapper.cpp \ 26 smtpwrapper.cpp \
26 genericwrapper.cpp \ 27 genericwrapper.cpp \
27 mboxwrapper.cpp \ 28 mboxwrapper.cpp \
28 settings.cpp \ 29 settings.cpp \
29 logindialog.cpp \ 30 logindialog.cpp \
30 sendmailprogress.cpp \ 31 sendmailprogress.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
38 40
39 41
40INCLUDEPATH += $(OPIEDIR)/include 42INCLUDEPATH += $(OPIEDIR)/include
41 43
42CONFTEST = $$system( echo $CONFIG_TARGET_MACOSX ) 44CONFTEST = $$system( echo $CONFIG_TARGET_MACOSX )
43contains( CONFTEST, y ){ 45contains( CONFTEST, y ){
44 LIBS += -lqpe -letpan -lssl -lcrypto -liconv 46 LIBS += -lqpe -letpan -lssl -lcrypto -liconv
45}else{ 47}else{
46 LIBS += -lqpe -letpan -lssl -lcrypto 48 LIBS += -lqpe -letpan -lssl -lcrypto
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
@@ -27,24 +27,25 @@ void RecMail::copy_old(const RecMail&old)
27 mbox = old.mbox; 27 mbox = old.mbox;
28 msg_id = old.msg_id; 28 msg_id = old.msg_id;
29 msg_size = old.msg_size; 29 msg_size = old.msg_size;
30 msg_number = old.msg_number; 30 msg_number = old.msg_number;
31 from = old.from; 31 from = old.from;
32 msg_flags = old.msg_flags; 32 msg_flags = old.msg_flags;
33 to = old.to; 33 to = old.to;
34 cc = old.cc; 34 cc = old.cc;
35 bcc = old.bcc; 35 bcc = old.bcc;
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()
42{ 43{
43 to.clear(); 44 to.clear();
44 cc.clear(); 45 cc.clear();
45 bcc.clear(); 46 bcc.clear();
46 in_reply_to.clear(); 47 in_reply_to.clear();
47 references.clear(); 48 references.clear();
48 wrapper = 0; 49 wrapper = 0;
49} 50}
50 51
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,13 +1,14 @@
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
5MailListViewItem::MailListViewItem(QListView * parent, MailListViewItem * item ) 6MailListViewItem::MailListViewItem(QListView * parent, MailListViewItem * item )
6 :QListViewItem(parent,item),mail_data() 7 :QListViewItem(parent,item),mail_data()
7{ 8{
8} 9}
9 10
10void MailListViewItem::showEntry() 11void MailListViewItem::showEntry()
11{ 12{
12 if ( mail_data.getFlags().testBit( FLAG_ANSWERED ) == true) { 13 if ( mail_data.getFlags().testBit( FLAG_ANSWERED ) == true) {
13 setPixmap( 0, Resource::loadPixmap( "mail/kmmsgreplied") ); 14 setPixmap( 0, Resource::loadPixmap( "mail/kmmsgreplied") );
@@ -54,12 +55,18 @@ void MailListViewItem::showEntry()
54 setText(4,mail_data.getDate()); 55 setText(4,mail_data.getDate());
55} 56}
56 57
57void MailListViewItem::storeData(const RecMail&data) 58void MailListViewItem::storeData(const RecMail&data)
58{ 59{
59 mail_data = data; 60 mail_data = data;
60} 61}
61 62
62const RecMail& MailListViewItem::data()const 63const 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
@@ -1,21 +1,23 @@
1#ifndef __MAILLISTVIEWITEM_H 1#ifndef __MAILLISTVIEWITEM_H
2#define __MAILLISTVIEWITEM_H 2#define __MAILLISTVIEWITEM_H
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};
20 22
21#endif 23#endif
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
@@ -1,21 +1,21 @@
1#include "nntpgroupsdlg.h" 1#include "nntpgroupsdlg.h"
2#include "nntpgroups.h" 2#include "nntpgroups.h"
3 3
4#include <libmailwrapper/settings.h> 4#include <libmailwrapper/settings.h>
5 5
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;
13 QVBoxLayout*dlglayout = new QVBoxLayout(this); 13 QVBoxLayout*dlglayout = new QVBoxLayout(this);
14 dlglayout->setSpacing(2); 14 dlglayout->setSpacing(2);
15 dlglayout->setMargin(1); 15 dlglayout->setMargin(1);
16 groupsWidget = new NNTPGroups(account,this); 16 groupsWidget = new NNTPGroups(account,this);
17 dlglayout->addWidget(groupsWidget); 17 dlglayout->addWidget(groupsWidget);
18} 18}
19 19
20NNTPGroupsDlg::~NNTPGroupsDlg() 20NNTPGroupsDlg::~NNTPGroupsDlg()
21{ 21{
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
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");
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
202void OpieMail::slotShowFolders( bool show ) 205void 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
229void OpieMail::mailLeftClicked(int button, QListViewItem *item,const QPoint&,int ) 232void 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
237void OpieMail::slotMoveCopyMail() 244void 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
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
@@ -21,19 +21,20 @@ public slots:
21protected slots: 21protected slots:
22 virtual void slotSendQueued(); 22 virtual void slotSendQueued();
23 virtual void slotSearchMails(); 23 virtual void slotSearchMails();
24 virtual void slotEditSettings(); 24 virtual void slotEditSettings();
25 virtual void slotEditAccounts(); 25 virtual void slotEditAccounts();
26 virtual void displayMail(); 26 virtual void displayMail();
27 virtual void slotDeleteMail(); 27 virtual void slotDeleteMail();
28 virtual void mailHold(int, QListViewItem *,const QPoint&,int); 28 virtual void mailHold(int, QListViewItem *,const QPoint&,int);
29 virtual void slotShowFolders( bool show ); 29 virtual void slotShowFolders( bool show );
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;
36 37
37}; 38};
38 39
39#endif 40#endif