-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 @@ -21,8 +21,9 @@ public: virtual void listMessages(const QString & mailbox,QList<RecMail>&target )=0; virtual RecBody fetchBody(const RecMail&mail)=0; virtual QString fetchPart(const RecMail&mail,const RecPart&part)=0; virtual void deleteMail(const RecMail&mail)=0; + virtual void answeredMail(const RecMail&mail)=0; static AbstractMail* getWrapper(IMAPaccount *a); static AbstractMail* getWrapper(POP3account *a); }; 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 @@ -738,4 +738,34 @@ void IMAPwrapper::deleteMail(const RecMail&mail) qDebug("error deleting mail: %s",m_imap->imap_response); } qDebug("Delete successfull %s",m_imap->imap_response); } + +void IMAPwrapper::answeredMail(const RecMail&mail) +{ + mailimap_flag_list*flist; + mailimap_set *set; + mailimap_store_att_flags * store_flags; + int err; + login(); + if (!m_imap) { + return; + } + const char *mb = mail.getMbox().latin1(); + err = mailimap_select( m_imap, (char*)mb); + if ( err != MAILIMAP_NO_ERROR ) { + qDebug("error selecting mailbox for mark: %s",m_imap->imap_response); + return; + } + flist = mailimap_flag_list_new_empty(); + mailimap_flag_list_add(flist,mailimap_flag_new_answered()); + store_flags = mailimap_store_att_flags_new_set_flags(flist); + set = mailimap_set_new_single(mail.getNumber()); + err = mailimap_store(m_imap,set,store_flags); + mailimap_set_free( set ); + mailimap_store_att_flags_free(store_flags); + + if (err != MAILIMAP_NO_ERROR) { + qDebug("error marking mail: %s",m_imap->imap_response); + return; + } +} 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 @@ -24,8 +24,9 @@ public: virtual void listMessages(const QString & mailbox,QList<RecMail>&target ); virtual RecBody fetchBody(const RecMail&mail); virtual QString fetchPart(const RecMail&mail,const RecPart&part); virtual void deleteMail(const RecMail&mail); + virtual void answeredMail(const RecMail&mail); static void imap_progress( size_t current, size_t maximum ); protected: 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 @@ -21,8 +21,9 @@ public: virtual void listMessages(const QString & mailbox,QList<RecMail>&target )=0; virtual RecBody fetchBody(const RecMail&mail)=0; virtual QString fetchPart(const RecMail&mail,const RecPart&part)=0; virtual void deleteMail(const RecMail&mail)=0; + virtual void answeredMail(const RecMail&mail)=0; static AbstractMail* getWrapper(IMAPaccount *a); static AbstractMail* getWrapper(POP3account *a); }; 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 @@ -738,4 +738,34 @@ void IMAPwrapper::deleteMail(const RecMail&mail) qDebug("error deleting mail: %s",m_imap->imap_response); } qDebug("Delete successfull %s",m_imap->imap_response); } + +void IMAPwrapper::answeredMail(const RecMail&mail) +{ + mailimap_flag_list*flist; + mailimap_set *set; + mailimap_store_att_flags * store_flags; + int err; + login(); + if (!m_imap) { + return; + } + const char *mb = mail.getMbox().latin1(); + err = mailimap_select( m_imap, (char*)mb); + if ( err != MAILIMAP_NO_ERROR ) { + qDebug("error selecting mailbox for mark: %s",m_imap->imap_response); + return; + } + flist = mailimap_flag_list_new_empty(); + mailimap_flag_list_add(flist,mailimap_flag_new_answered()); + store_flags = mailimap_store_att_flags_new_set_flags(flist); + set = mailimap_set_new_single(mail.getNumber()); + err = mailimap_store(m_imap,set,store_flags); + mailimap_set_free( set ); + mailimap_store_att_flags_free(store_flags); + + if (err != MAILIMAP_NO_ERROR) { + qDebug("error marking mail: %s",m_imap->imap_response); + return; + } +} 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 @@ -24,8 +24,9 @@ public: virtual void listMessages(const QString & mailbox,QList<RecMail>&target ); virtual RecBody fetchBody(const RecMail&mail); virtual QString fetchPart(const RecMail&mail,const RecPart&part); virtual void deleteMail(const RecMail&mail); + virtual void answeredMail(const RecMail&mail); static void imap_progress( size_t current, size_t maximum ); protected: 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 @@ -286,4 +286,8 @@ QString POP3wrapper::fetchPart(const RecMail&,const RecPart&) void POP3wrapper::deleteMail(const RecMail&) { } + +void POP3wrapper::answeredMail(const RecMail&) +{ +} 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 @@ -19,8 +19,9 @@ public: virtual void listMessages(const QString & mailbox, QList<RecMail> &target ); virtual QList<Folder>* listFolders(); virtual QString fetchPart(const RecMail&mail,const RecPart&part); virtual void deleteMail(const RecMail&mail); + virtual void answeredMail(const RecMail&mail); RecBody fetchBody( const RecMail &mail ); static void pop3_progress( size_t current, size_t maximum ); 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 @@ -286,4 +286,8 @@ QString POP3wrapper::fetchPart(const RecMail&,const RecPart&) void POP3wrapper::deleteMail(const RecMail&) { } + +void POP3wrapper::answeredMail(const RecMail&) +{ +} 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 @@ -19,8 +19,9 @@ public: virtual void listMessages(const QString & mailbox, QList<RecMail> &target ); virtual QList<Folder>* listFolders(); virtual QString fetchPart(const RecMail&mail,const RecPart&part); virtual void deleteMail(const RecMail&mail); + virtual void answeredMail(const RecMail&mail); RecBody fetchBody( const RecMail &mail ); static void pop3_progress( size_t current, size_t maximum ); 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 @@ -258,9 +258,9 @@ void ViewMail::slotReply() } QString rtext; rtext += QString("* %1 wrote on %2:\n") // no i18n on purpose - .arg( m_mail[1] ) + .arg( m_mail[0] ) .arg( m_mail[3] ); QString text = m_mail[2]; QStringList lines = QStringList::split(QRegExp("\\n"), text); @@ -279,10 +279,11 @@ void ViewMail::slotReply() composer.setTo( m_mail[0] ); composer.setSubject( "Re: " + m_mail[1] ); composer.setMessage( rtext ); composer.showMaximized(); - composer.exec(); - + if ( QDialog::Accepted==composer.exec()) { + m_recMail.Wrapper()->answeredMail(m_recMail); + } } void ViewMail::slotForward() { @@ -313,9 +314,11 @@ void ViewMail::slotForward() ComposeMail composer( settings ,this, 0, true); composer.setSubject( "Fwd: " + m_mail[1] ); composer.setMessage( ftext ); composer.showMaximized(); - composer.exec(); + if ( QDialog::Accepted==composer.exec()) { + + } } void ViewMail::slotDeleteMail( ) { |