-rw-r--r-- | noncore/net/mail/abstractmail.h | 1 | ||||
-rw-r--r-- | noncore/net/mail/imapwrapper.cpp | 30 | ||||
-rw-r--r-- | noncore/net/mail/imapwrapper.h | 1 | ||||
-rw-r--r-- | noncore/net/mail/libmailwrapper/abstractmail.h | 1 | ||||
-rw-r--r-- | noncore/net/mail/libmailwrapper/imapwrapper.cpp | 30 | ||||
-rw-r--r-- | noncore/net/mail/libmailwrapper/imapwrapper.h | 1 | ||||
-rw-r--r-- | noncore/net/mail/libmailwrapper/pop3wrapper.cpp | 4 | ||||
-rw-r--r-- | noncore/net/mail/libmailwrapper/pop3wrapper.h | 1 | ||||
-rw-r--r-- | noncore/net/mail/pop3wrapper.cpp | 4 | ||||
-rw-r--r-- | noncore/net/mail/pop3wrapper.h | 1 | ||||
-rw-r--r-- | noncore/net/mail/viewmail.cpp | 11 |
11 files changed, 81 insertions, 4 deletions
diff --git a/noncore/net/mail/abstractmail.h b/noncore/net/mail/abstractmail.h index 0a1719d..62e0715 100644 --- a/noncore/net/mail/abstractmail.h +++ b/noncore/net/mail/abstractmail.h | |||
@@ -19,12 +19,13 @@ public: | |||
19 | virtual ~AbstractMail(){} | 19 | virtual ~AbstractMail(){} |
20 | virtual QList<Folder>* listFolders()=0; | 20 | virtual QList<Folder>* listFolders()=0; |
21 | virtual void listMessages(const QString & mailbox,QList<RecMail>&target )=0; | 21 | virtual void listMessages(const QString & mailbox,QList<RecMail>&target )=0; |
22 | virtual RecBody fetchBody(const RecMail&mail)=0; | 22 | virtual RecBody fetchBody(const RecMail&mail)=0; |
23 | virtual QString fetchPart(const RecMail&mail,const RecPart&part)=0; | 23 | virtual QString fetchPart(const RecMail&mail,const RecPart&part)=0; |
24 | virtual void deleteMail(const RecMail&mail)=0; | 24 | virtual void deleteMail(const RecMail&mail)=0; |
25 | virtual void answeredMail(const RecMail&mail)=0; | ||
25 | 26 | ||
26 | static AbstractMail* getWrapper(IMAPaccount *a); | 27 | static AbstractMail* getWrapper(IMAPaccount *a); |
27 | static AbstractMail* getWrapper(POP3account *a); | 28 | static AbstractMail* getWrapper(POP3account *a); |
28 | }; | 29 | }; |
29 | 30 | ||
30 | #endif | 31 | #endif |
diff --git a/noncore/net/mail/imapwrapper.cpp b/noncore/net/mail/imapwrapper.cpp index 912a412..b253b49 100644 --- a/noncore/net/mail/imapwrapper.cpp +++ b/noncore/net/mail/imapwrapper.cpp | |||
@@ -736,6 +736,36 @@ void IMAPwrapper::deleteMail(const RecMail&mail) | |||
736 | err = mailimap_expunge(m_imap); | 736 | err = mailimap_expunge(m_imap); |
737 | if (err != MAILIMAP_NO_ERROR) { | 737 | if (err != MAILIMAP_NO_ERROR) { |
738 | qDebug("error deleting mail: %s",m_imap->imap_response); | 738 | qDebug("error deleting mail: %s",m_imap->imap_response); |
739 | } | 739 | } |
740 | qDebug("Delete successfull %s",m_imap->imap_response); | 740 | qDebug("Delete successfull %s",m_imap->imap_response); |
741 | } | 741 | } |
742 | |||
743 | void IMAPwrapper::answeredMail(const RecMail&mail) | ||
744 | { | ||
745 | mailimap_flag_list*flist; | ||
746 | mailimap_set *set; | ||
747 | mailimap_store_att_flags * store_flags; | ||
748 | int err; | ||
749 | login(); | ||
750 | if (!m_imap) { | ||
751 | return; | ||
752 | } | ||
753 | const char *mb = mail.getMbox().latin1(); | ||
754 | err = mailimap_select( m_imap, (char*)mb); | ||
755 | if ( err != MAILIMAP_NO_ERROR ) { | ||
756 | qDebug("error selecting mailbox for mark: %s",m_imap->imap_response); | ||
757 | return; | ||
758 | } | ||
759 | flist = mailimap_flag_list_new_empty(); | ||
760 | mailimap_flag_list_add(flist,mailimap_flag_new_answered()); | ||
761 | store_flags = mailimap_store_att_flags_new_set_flags(flist); | ||
762 | set = mailimap_set_new_single(mail.getNumber()); | ||
763 | err = mailimap_store(m_imap,set,store_flags); | ||
764 | mailimap_set_free( set ); | ||
765 | mailimap_store_att_flags_free(store_flags); | ||
766 | |||
767 | if (err != MAILIMAP_NO_ERROR) { | ||
768 | qDebug("error marking mail: %s",m_imap->imap_response); | ||
769 | return; | ||
770 | } | ||
771 | } | ||
diff --git a/noncore/net/mail/imapwrapper.h b/noncore/net/mail/imapwrapper.h index 4f4d575..700d512 100644 --- a/noncore/net/mail/imapwrapper.h +++ b/noncore/net/mail/imapwrapper.h | |||
@@ -22,12 +22,13 @@ public: | |||
22 | virtual ~IMAPwrapper(); | 22 | virtual ~IMAPwrapper(); |
23 | virtual QList<Folder>* listFolders(); | 23 | virtual QList<Folder>* listFolders(); |
24 | virtual void listMessages(const QString & mailbox,QList<RecMail>&target ); | 24 | virtual void listMessages(const QString & mailbox,QList<RecMail>&target ); |
25 | virtual RecBody fetchBody(const RecMail&mail); | 25 | virtual RecBody fetchBody(const RecMail&mail); |
26 | virtual QString fetchPart(const RecMail&mail,const RecPart&part); | 26 | virtual QString fetchPart(const RecMail&mail,const RecPart&part); |
27 | virtual void deleteMail(const RecMail&mail); | 27 | virtual void deleteMail(const RecMail&mail); |
28 | virtual void answeredMail(const RecMail&mail); | ||
28 | 29 | ||
29 | static void imap_progress( size_t current, size_t maximum ); | 30 | static void imap_progress( size_t current, size_t maximum ); |
30 | 31 | ||
31 | protected: | 32 | protected: |
32 | RecMail*parse_list_result(mailimap_msg_att*); | 33 | RecMail*parse_list_result(mailimap_msg_att*); |
33 | void login(); | 34 | void login(); |
diff --git a/noncore/net/mail/libmailwrapper/abstractmail.h b/noncore/net/mail/libmailwrapper/abstractmail.h index 0a1719d..62e0715 100644 --- a/noncore/net/mail/libmailwrapper/abstractmail.h +++ b/noncore/net/mail/libmailwrapper/abstractmail.h | |||
@@ -19,12 +19,13 @@ public: | |||
19 | virtual ~AbstractMail(){} | 19 | virtual ~AbstractMail(){} |
20 | virtual QList<Folder>* listFolders()=0; | 20 | virtual QList<Folder>* listFolders()=0; |
21 | virtual void listMessages(const QString & mailbox,QList<RecMail>&target )=0; | 21 | virtual void listMessages(const QString & mailbox,QList<RecMail>&target )=0; |
22 | virtual RecBody fetchBody(const RecMail&mail)=0; | 22 | virtual RecBody fetchBody(const RecMail&mail)=0; |
23 | virtual QString fetchPart(const RecMail&mail,const RecPart&part)=0; | 23 | virtual QString fetchPart(const RecMail&mail,const RecPart&part)=0; |
24 | virtual void deleteMail(const RecMail&mail)=0; | 24 | virtual void deleteMail(const RecMail&mail)=0; |
25 | virtual void answeredMail(const RecMail&mail)=0; | ||
25 | 26 | ||
26 | static AbstractMail* getWrapper(IMAPaccount *a); | 27 | static AbstractMail* getWrapper(IMAPaccount *a); |
27 | static AbstractMail* getWrapper(POP3account *a); | 28 | static AbstractMail* getWrapper(POP3account *a); |
28 | }; | 29 | }; |
29 | 30 | ||
30 | #endif | 31 | #endif |
diff --git a/noncore/net/mail/libmailwrapper/imapwrapper.cpp b/noncore/net/mail/libmailwrapper/imapwrapper.cpp index 912a412..b253b49 100644 --- a/noncore/net/mail/libmailwrapper/imapwrapper.cpp +++ b/noncore/net/mail/libmailwrapper/imapwrapper.cpp | |||
@@ -736,6 +736,36 @@ void IMAPwrapper::deleteMail(const RecMail&mail) | |||
736 | err = mailimap_expunge(m_imap); | 736 | err = mailimap_expunge(m_imap); |
737 | if (err != MAILIMAP_NO_ERROR) { | 737 | if (err != MAILIMAP_NO_ERROR) { |
738 | qDebug("error deleting mail: %s",m_imap->imap_response); | 738 | qDebug("error deleting mail: %s",m_imap->imap_response); |
739 | } | 739 | } |
740 | qDebug("Delete successfull %s",m_imap->imap_response); | 740 | qDebug("Delete successfull %s",m_imap->imap_response); |
741 | } | 741 | } |
742 | |||
743 | void IMAPwrapper::answeredMail(const RecMail&mail) | ||
744 | { | ||
745 | mailimap_flag_list*flist; | ||
746 | mailimap_set *set; | ||
747 | mailimap_store_att_flags * store_flags; | ||
748 | int err; | ||
749 | login(); | ||
750 | if (!m_imap) { | ||
751 | return; | ||
752 | } | ||
753 | const char *mb = mail.getMbox().latin1(); | ||
754 | err = mailimap_select( m_imap, (char*)mb); | ||
755 | if ( err != MAILIMAP_NO_ERROR ) { | ||
756 | qDebug("error selecting mailbox for mark: %s",m_imap->imap_response); | ||
757 | return; | ||
758 | } | ||
759 | flist = mailimap_flag_list_new_empty(); | ||
760 | mailimap_flag_list_add(flist,mailimap_flag_new_answered()); | ||
761 | store_flags = mailimap_store_att_flags_new_set_flags(flist); | ||
762 | set = mailimap_set_new_single(mail.getNumber()); | ||
763 | err = mailimap_store(m_imap,set,store_flags); | ||
764 | mailimap_set_free( set ); | ||
765 | mailimap_store_att_flags_free(store_flags); | ||
766 | |||
767 | if (err != MAILIMAP_NO_ERROR) { | ||
768 | qDebug("error marking mail: %s",m_imap->imap_response); | ||
769 | return; | ||
770 | } | ||
771 | } | ||
diff --git a/noncore/net/mail/libmailwrapper/imapwrapper.h b/noncore/net/mail/libmailwrapper/imapwrapper.h index 4f4d575..700d512 100644 --- a/noncore/net/mail/libmailwrapper/imapwrapper.h +++ b/noncore/net/mail/libmailwrapper/imapwrapper.h | |||
@@ -22,12 +22,13 @@ public: | |||
22 | virtual ~IMAPwrapper(); | 22 | virtual ~IMAPwrapper(); |
23 | virtual QList<Folder>* listFolders(); | 23 | virtual QList<Folder>* listFolders(); |
24 | virtual void listMessages(const QString & mailbox,QList<RecMail>&target ); | 24 | virtual void listMessages(const QString & mailbox,QList<RecMail>&target ); |
25 | virtual RecBody fetchBody(const RecMail&mail); | 25 | virtual RecBody fetchBody(const RecMail&mail); |
26 | virtual QString fetchPart(const RecMail&mail,const RecPart&part); | 26 | virtual QString fetchPart(const RecMail&mail,const RecPart&part); |
27 | virtual void deleteMail(const RecMail&mail); | 27 | virtual void deleteMail(const RecMail&mail); |
28 | virtual void answeredMail(const RecMail&mail); | ||
28 | 29 | ||
29 | static void imap_progress( size_t current, size_t maximum ); | 30 | static void imap_progress( size_t current, size_t maximum ); |
30 | 31 | ||
31 | protected: | 32 | protected: |
32 | RecMail*parse_list_result(mailimap_msg_att*); | 33 | RecMail*parse_list_result(mailimap_msg_att*); |
33 | void login(); | 34 | void login(); |
diff --git a/noncore/net/mail/libmailwrapper/pop3wrapper.cpp b/noncore/net/mail/libmailwrapper/pop3wrapper.cpp index 5065d29..46c854b 100644 --- a/noncore/net/mail/libmailwrapper/pop3wrapper.cpp +++ b/noncore/net/mail/libmailwrapper/pop3wrapper.cpp | |||
@@ -284,6 +284,10 @@ QString POP3wrapper::fetchPart(const RecMail&,const RecPart&) | |||
284 | return ""; | 284 | return ""; |
285 | } | 285 | } |
286 | 286 | ||
287 | void POP3wrapper::deleteMail(const RecMail&) | 287 | void POP3wrapper::deleteMail(const RecMail&) |
288 | { | 288 | { |
289 | } | 289 | } |
290 | |||
291 | void POP3wrapper::answeredMail(const RecMail&) | ||
292 | { | ||
293 | } | ||
diff --git a/noncore/net/mail/libmailwrapper/pop3wrapper.h b/noncore/net/mail/libmailwrapper/pop3wrapper.h index ef972c8..6ff8d62 100644 --- a/noncore/net/mail/libmailwrapper/pop3wrapper.h +++ b/noncore/net/mail/libmailwrapper/pop3wrapper.h | |||
@@ -17,12 +17,13 @@ public: | |||
17 | virtual ~POP3wrapper(); | 17 | virtual ~POP3wrapper(); |
18 | /* mailbox will be ignored */ | 18 | /* mailbox will be ignored */ |
19 | virtual void listMessages(const QString & mailbox, QList<RecMail> &target ); | 19 | virtual void listMessages(const QString & mailbox, QList<RecMail> &target ); |
20 | virtual QList<Folder>* listFolders(); | 20 | virtual QList<Folder>* listFolders(); |
21 | virtual QString fetchPart(const RecMail&mail,const RecPart&part); | 21 | virtual QString fetchPart(const RecMail&mail,const RecPart&part); |
22 | virtual void deleteMail(const RecMail&mail); | 22 | virtual void deleteMail(const RecMail&mail); |
23 | virtual void answeredMail(const RecMail&mail); | ||
23 | 24 | ||
24 | RecBody fetchBody( const RecMail &mail ); | 25 | RecBody fetchBody( const RecMail &mail ); |
25 | static void pop3_progress( size_t current, size_t maximum ); | 26 | static void pop3_progress( size_t current, size_t maximum ); |
26 | 27 | ||
27 | protected: | 28 | protected: |
28 | void login(); | 29 | void login(); |
diff --git a/noncore/net/mail/pop3wrapper.cpp b/noncore/net/mail/pop3wrapper.cpp index 5065d29..46c854b 100644 --- a/noncore/net/mail/pop3wrapper.cpp +++ b/noncore/net/mail/pop3wrapper.cpp | |||
@@ -284,6 +284,10 @@ QString POP3wrapper::fetchPart(const RecMail&,const RecPart&) | |||
284 | return ""; | 284 | return ""; |
285 | } | 285 | } |
286 | 286 | ||
287 | void POP3wrapper::deleteMail(const RecMail&) | 287 | void POP3wrapper::deleteMail(const RecMail&) |
288 | { | 288 | { |
289 | } | 289 | } |
290 | |||
291 | void POP3wrapper::answeredMail(const RecMail&) | ||
292 | { | ||
293 | } | ||
diff --git a/noncore/net/mail/pop3wrapper.h b/noncore/net/mail/pop3wrapper.h index ef972c8..6ff8d62 100644 --- a/noncore/net/mail/pop3wrapper.h +++ b/noncore/net/mail/pop3wrapper.h | |||
@@ -17,12 +17,13 @@ public: | |||
17 | virtual ~POP3wrapper(); | 17 | virtual ~POP3wrapper(); |
18 | /* mailbox will be ignored */ | 18 | /* mailbox will be ignored */ |
19 | virtual void listMessages(const QString & mailbox, QList<RecMail> &target ); | 19 | virtual void listMessages(const QString & mailbox, QList<RecMail> &target ); |
20 | virtual QList<Folder>* listFolders(); | 20 | virtual QList<Folder>* listFolders(); |
21 | virtual QString fetchPart(const RecMail&mail,const RecPart&part); | 21 | virtual QString fetchPart(const RecMail&mail,const RecPart&part); |
22 | virtual void deleteMail(const RecMail&mail); | 22 | virtual void deleteMail(const RecMail&mail); |
23 | virtual void answeredMail(const RecMail&mail); | ||
23 | 24 | ||
24 | RecBody fetchBody( const RecMail &mail ); | 25 | RecBody fetchBody( const RecMail &mail ); |
25 | static void pop3_progress( size_t current, size_t maximum ); | 26 | static void pop3_progress( size_t current, size_t maximum ); |
26 | 27 | ||
27 | protected: | 28 | protected: |
28 | void login(); | 29 | void login(); |
diff --git a/noncore/net/mail/viewmail.cpp b/noncore/net/mail/viewmail.cpp index e53f4a3..68d3c51 100644 --- a/noncore/net/mail/viewmail.cpp +++ b/noncore/net/mail/viewmail.cpp | |||
@@ -256,13 +256,13 @@ void ViewMail::slotReply() | |||
256 | QMessageBox::information(this, tr("Error"), tr("<p>The mail body is not yet downloaded, so you cannot reply yet."), tr("Ok")); | 256 | QMessageBox::information(this, tr("Error"), tr("<p>The mail body is not yet downloaded, so you cannot reply yet."), tr("Ok")); |
257 | return; | 257 | return; |
258 | } | 258 | } |
259 | 259 | ||
260 | QString rtext; | 260 | QString rtext; |
261 | rtext += QString("* %1 wrote on %2:\n") // no i18n on purpose | 261 | rtext += QString("* %1 wrote on %2:\n") // no i18n on purpose |
262 | .arg( m_mail[1] ) | 262 | .arg( m_mail[0] ) |
263 | .arg( m_mail[3] ); | 263 | .arg( m_mail[3] ); |
264 | 264 | ||
265 | QString text = m_mail[2]; | 265 | QString text = m_mail[2]; |
266 | QStringList lines = QStringList::split(QRegExp("\\n"), text); | 266 | QStringList lines = QStringList::split(QRegExp("\\n"), text); |
267 | QStringList::Iterator it; | 267 | QStringList::Iterator it; |
268 | for (it = lines.begin(); it != lines.end(); it++) { | 268 | for (it = lines.begin(); it != lines.end(); it++) { |
@@ -277,14 +277,15 @@ void ViewMail::slotReply() | |||
277 | Settings *settings = new Settings(); | 277 | Settings *settings = new Settings(); |
278 | ComposeMail composer( settings ,this, 0, true); | 278 | ComposeMail composer( settings ,this, 0, true); |
279 | composer.setTo( m_mail[0] ); | 279 | composer.setTo( m_mail[0] ); |
280 | composer.setSubject( "Re: " + m_mail[1] ); | 280 | composer.setSubject( "Re: " + m_mail[1] ); |
281 | composer.setMessage( rtext ); | 281 | composer.setMessage( rtext ); |
282 | composer.showMaximized(); | 282 | composer.showMaximized(); |
283 | composer.exec(); | 283 | if ( QDialog::Accepted==composer.exec()) { |
284 | 284 | m_recMail.Wrapper()->answeredMail(m_recMail); | |
285 | } | ||
285 | } | 286 | } |
286 | 287 | ||
287 | void ViewMail::slotForward() | 288 | void ViewMail::slotForward() |
288 | { | 289 | { |
289 | if (!m_gotBody) { | 290 | if (!m_gotBody) { |
290 | QMessageBox::information(this, tr("Error"), tr("<p>The mail body is not yet downloaded, so you cannot forward yet."), tr("Ok")); | 291 | QMessageBox::information(this, tr("Error"), tr("<p>The mail body is not yet downloaded, so you cannot forward yet."), tr("Ok")); |
@@ -311,13 +312,15 @@ void ViewMail::slotForward() | |||
311 | 312 | ||
312 | Settings *settings = new Settings(); | 313 | Settings *settings = new Settings(); |
313 | ComposeMail composer( settings ,this, 0, true); | 314 | ComposeMail composer( settings ,this, 0, true); |
314 | composer.setSubject( "Fwd: " + m_mail[1] ); | 315 | composer.setSubject( "Fwd: " + m_mail[1] ); |
315 | composer.setMessage( ftext ); | 316 | composer.setMessage( ftext ); |
316 | composer.showMaximized(); | 317 | composer.showMaximized(); |
317 | composer.exec(); | 318 | if ( QDialog::Accepted==composer.exec()) { |
319 | |||
320 | } | ||
318 | } | 321 | } |
319 | 322 | ||
320 | void ViewMail::slotDeleteMail( ) | 323 | void ViewMail::slotDeleteMail( ) |
321 | { | 324 | { |
322 | if ( QMessageBox::warning(this, tr("Delete Mail"), QString( tr("<p>Do you really want to delete this mail? <br><br>" ) + m_mail[0] + " - " + m_mail[1] ) , QMessageBox::Yes, QMessageBox::No ) == QMessageBox::Yes ) { | 325 | if ( QMessageBox::warning(this, tr("Delete Mail"), QString( tr("<p>Do you really want to delete this mail? <br><br>" ) + m_mail[0] + " - " + m_mail[1] ) , QMessageBox::Yes, QMessageBox::No ) == QMessageBox::Yes ) { |
323 | m_recMail.Wrapper()->deleteMail( m_recMail ); | 326 | m_recMail.Wrapper()->deleteMail( m_recMail ); |