author | harlekin <harlekin> | 2003-12-10 01:13:03 (UTC) |
---|---|---|
committer | harlekin <harlekin> | 2003-12-10 01:13:03 (UTC) |
commit | 9a7db10da12232625be270feae5df761cfe11afa (patch) (unidiff) | |
tree | 80de2161839bb27a75532e17bfc0844c5cabf1b9 | |
parent | 162c32b06ddfbf935ee7e43694ea1ee4df51a96c (diff) | |
download | opie-9a7db10da12232625be270feae5df761cfe11afa.zip opie-9a7db10da12232625be270feae5df761cfe11afa.tar.gz opie-9a7db10da12232625be270feae5df761cfe11afa.tar.bz2 |
reply and forward partly implemented but working
-rw-r--r-- | noncore/net/mail/composemail.cpp | 28 | ||||
-rw-r--r-- | noncore/net/mail/composemail.h | 4 | ||||
-rw-r--r-- | noncore/net/mail/opie-mail.control | 2 | ||||
-rw-r--r-- | noncore/net/mail/viewmail.cpp | 80 |
4 files changed, 68 insertions, 46 deletions
diff --git a/noncore/net/mail/composemail.cpp b/noncore/net/mail/composemail.cpp index 96787e4..cfccdbb 100644 --- a/noncore/net/mail/composemail.cpp +++ b/noncore/net/mail/composemail.cpp | |||
@@ -6,96 +6,124 @@ | |||
6 | #include "composemail.h" | 6 | #include "composemail.h" |
7 | 7 | ||
8 | ComposeMail::ComposeMail( Settings *s, QWidget *parent, const char *name, bool modal, WFlags flags ) | 8 | ComposeMail::ComposeMail( Settings *s, QWidget *parent, const char *name, bool modal, WFlags flags ) |
9 | : ComposeMailUI( parent, name, modal, flags ) | 9 | : ComposeMailUI( parent, name, modal, flags ) |
10 | { | 10 | { |
11 | settings = s; | 11 | settings = s; |
12 | 12 | ||
13 | attList->addColumn( tr( "Name" ) ); | 13 | attList->addColumn( tr( "Name" ) ); |
14 | attList->addColumn( tr( "Size" ) ); | 14 | attList->addColumn( tr( "Size" ) ); |
15 | 15 | ||
16 | QList<Account> accounts = settings->getAccounts(); | 16 | QList<Account> accounts = settings->getAccounts(); |
17 | Account *it; | 17 | Account *it; |
18 | for ( it = accounts.first(); it; it = accounts.next() ) { | 18 | for ( it = accounts.first(); it; it = accounts.next() ) { |
19 | if ( it->getType().compare( "SMTP" ) == 0 ) { | 19 | if ( it->getType().compare( "SMTP" ) == 0 ) { |
20 | SMTPaccount *smtp = static_cast<SMTPaccount *>(it); | 20 | SMTPaccount *smtp = static_cast<SMTPaccount *>(it); |
21 | fromBox->insertItem( smtp->getMail() ); | 21 | fromBox->insertItem( smtp->getMail() ); |
22 | smtpAccounts.append( smtp ); | 22 | smtpAccounts.append( smtp ); |
23 | } | 23 | } |
24 | } | 24 | } |
25 | 25 | ||
26 | if ( smtpAccounts.count() > 0 ) { | 26 | if ( smtpAccounts.count() > 0 ) { |
27 | fillValues( fromBox->currentItem() ); | 27 | fillValues( fromBox->currentItem() ); |
28 | } else { | 28 | } else { |
29 | QMessageBox::information( this, tr( "Problem" ), | 29 | QMessageBox::information( this, tr( "Problem" ), |
30 | tr( "<p>Please create an SMTP account first.</p>" ), | 30 | tr( "<p>Please create an SMTP account first.</p>" ), |
31 | tr( "Ok" ) ); | 31 | tr( "Ok" ) ); |
32 | } | 32 | } |
33 | 33 | ||
34 | connect( fromBox, SIGNAL( activated( int ) ), SLOT( fillValues( int ) ) ); | 34 | connect( fromBox, SIGNAL( activated( int ) ), SLOT( fillValues( int ) ) ); |
35 | connect( toButton, SIGNAL( clicked() ), SLOT( pickAddressTo() ) ); | 35 | connect( toButton, SIGNAL( clicked() ), SLOT( pickAddressTo() ) ); |
36 | connect( ccButton, SIGNAL( clicked() ), SLOT( pickAddressCC() ) ); | 36 | connect( ccButton, SIGNAL( clicked() ), SLOT( pickAddressCC() ) ); |
37 | connect( bccButton, SIGNAL( clicked() ), SLOT( pickAddressBCC() ) ); | 37 | connect( bccButton, SIGNAL( clicked() ), SLOT( pickAddressBCC() ) ); |
38 | connect( replyButton, SIGNAL( clicked() ), SLOT( pickAddressReply() ) ); | 38 | connect( replyButton, SIGNAL( clicked() ), SLOT( pickAddressReply() ) ); |
39 | connect( addButton, SIGNAL( clicked() ), SLOT( addAttachment() ) ); | 39 | connect( addButton, SIGNAL( clicked() ), SLOT( addAttachment() ) ); |
40 | connect( deleteButton, SIGNAL( clicked() ), SLOT( removeAttachment() ) ); | 40 | connect( deleteButton, SIGNAL( clicked() ), SLOT( removeAttachment() ) ); |
41 | } | 41 | } |
42 | 42 | ||
43 | void ComposeMail::pickAddress( QLineEdit *line ) | 43 | void ComposeMail::pickAddress( QLineEdit *line ) |
44 | { | 44 | { |
45 | QString names = AddressPicker::getNames(); | 45 | QString names = AddressPicker::getNames(); |
46 | if ( line->text().isEmpty() ) { | 46 | if ( line->text().isEmpty() ) { |
47 | line->setText( names ); | 47 | line->setText( names ); |
48 | } else if ( !names.isEmpty() ) { | 48 | } else if ( !names.isEmpty() ) { |
49 | line->setText( line->text() + ", " + names ); | 49 | line->setText( line->text() + ", " + names ); |
50 | } | 50 | } |
51 | } | 51 | } |
52 | 52 | ||
53 | 53 | ||
54 | void ComposeMail::setTo( const QString & to ) | ||
55 | { | ||
56 | /* QString toline; | ||
57 | QStringList toEntry = to; | ||
58 | for ( QStringList::Iterator it = toEntry.begin(); it != toEntry.end(); ++it ) { | ||
59 | toline += (*it); | ||
60 | } | ||
61 | toLine->setText( toline ); | ||
62 | */ | ||
63 | toLine->setText( to ); | ||
64 | } | ||
65 | |||
66 | void ComposeMail::setSubject( const QString & subject ) | ||
67 | { | ||
68 | subjectLine->setText( subject ); | ||
69 | } | ||
70 | |||
71 | void ComposeMail::setInReplyTo( const QString & messageId ) | ||
72 | { | ||
73 | |||
74 | } | ||
75 | |||
76 | void ComposeMail::setMessage( const QString & text ) | ||
77 | { | ||
78 | message->setText( text ); | ||
79 | } | ||
80 | |||
81 | |||
54 | void ComposeMail::pickAddressTo() | 82 | void ComposeMail::pickAddressTo() |
55 | { | 83 | { |
56 | pickAddress( toLine ); | 84 | pickAddress( toLine ); |
57 | } | 85 | } |
58 | 86 | ||
59 | void ComposeMail::pickAddressCC() | 87 | void ComposeMail::pickAddressCC() |
60 | { | 88 | { |
61 | pickAddress( ccLine ); | 89 | pickAddress( ccLine ); |
62 | } | 90 | } |
63 | 91 | ||
64 | void ComposeMail::pickAddressBCC() | 92 | void ComposeMail::pickAddressBCC() |
65 | { | 93 | { |
66 | pickAddress( bccLine ); | 94 | pickAddress( bccLine ); |
67 | } | 95 | } |
68 | 96 | ||
69 | void ComposeMail::pickAddressReply() | 97 | void ComposeMail::pickAddressReply() |
70 | { | 98 | { |
71 | pickAddress( replyLine ); | 99 | pickAddress( replyLine ); |
72 | } | 100 | } |
73 | 101 | ||
74 | void ComposeMail::fillValues( int current ) | 102 | void ComposeMail::fillValues( int current ) |
75 | { | 103 | { |
76 | SMTPaccount *smtp = smtpAccounts.at( current ); | 104 | SMTPaccount *smtp = smtpAccounts.at( current ); |
77 | 105 | ||
78 | ccLine->clear(); | 106 | ccLine->clear(); |
79 | if ( smtp->getUseCC() ) { | 107 | if ( smtp->getUseCC() ) { |
80 | ccLine->setText( smtp->getCC() ); | 108 | ccLine->setText( smtp->getCC() ); |
81 | } | 109 | } |
82 | bccLine->clear(); | 110 | bccLine->clear(); |
83 | if ( smtp->getUseBCC() ) { | 111 | if ( smtp->getUseBCC() ) { |
84 | bccLine->setText( smtp->getBCC() ); | 112 | bccLine->setText( smtp->getBCC() ); |
85 | } | 113 | } |
86 | replyLine->clear(); | 114 | replyLine->clear(); |
87 | if ( smtp->getUseReply() ) { | 115 | if ( smtp->getUseReply() ) { |
88 | replyLine->setText( smtp->getReply() ); | 116 | replyLine->setText( smtp->getReply() ); |
89 | } | 117 | } |
90 | 118 | ||
91 | sigMultiLine->setText( smtp->getSignature() ); | 119 | sigMultiLine->setText( smtp->getSignature() ); |
92 | } | 120 | } |
93 | 121 | ||
94 | void ComposeMail::slotAdjustColumns() | 122 | void ComposeMail::slotAdjustColumns() |
95 | { | 123 | { |
96 | int currPage = tabWidget->currentPageIndex(); | 124 | int currPage = tabWidget->currentPageIndex(); |
97 | 125 | ||
98 | tabWidget->showPage( attachTab ); | 126 | tabWidget->showPage( attachTab ); |
99 | attList->setColumnWidth( 0, attList->visibleWidth() - 80 ); | 127 | attList->setColumnWidth( 0, attList->visibleWidth() - 80 ); |
100 | attList->setColumnWidth( 1, 80 ); | 128 | attList->setColumnWidth( 1, 80 ); |
101 | 129 | ||
diff --git a/noncore/net/mail/composemail.h b/noncore/net/mail/composemail.h index 196a471..230e397 100644 --- a/noncore/net/mail/composemail.h +++ b/noncore/net/mail/composemail.h | |||
@@ -1,71 +1,75 @@ | |||
1 | #ifndef COMPOSEMAIL_H | 1 | #ifndef COMPOSEMAIL_H |
2 | #define COMPOSEMAIL_H | 2 | #define COMPOSEMAIL_H |
3 | 3 | ||
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 "settings.h" | 9 | #include "settings.h" |
10 | #include "mailwrapper.h" | 10 | #include "mailwrapper.h" |
11 | 11 | ||
12 | 12 | ||
13 | class AddressPicker : public AddressPickerUI | 13 | class AddressPicker : public AddressPickerUI |
14 | { | 14 | { |
15 | Q_OBJECT | 15 | Q_OBJECT |
16 | 16 | ||
17 | public: | 17 | public: |
18 | AddressPicker( QWidget *parent = 0, const char *name = 0, bool modal = false, WFlags flags = 0 ); | 18 | AddressPicker( QWidget *parent = 0, const char *name = 0, bool modal = false, WFlags flags = 0 ); |
19 | static QString getNames(); | 19 | static QString getNames(); |
20 | 20 | ||
21 | protected: | 21 | protected: |
22 | QString selectedNames; | 22 | QString selectedNames; |
23 | void accept(); | 23 | void accept(); |
24 | 24 | ||
25 | }; | 25 | }; |
26 | 26 | ||
27 | 27 | ||
28 | class ComposeMail : public ComposeMailUI | 28 | class ComposeMail : public ComposeMailUI |
29 | { | 29 | { |
30 | Q_OBJECT | 30 | Q_OBJECT |
31 | 31 | ||
32 | public: | 32 | public: |
33 | ComposeMail( Settings *s, QWidget *parent = 0, const char *name = 0, bool modal = false, WFlags flags = 0 ); | 33 | ComposeMail( Settings *s, QWidget *parent = 0, const char *name = 0, bool modal = false, WFlags flags = 0 ); |
34 | 34 | ||
35 | public slots: | 35 | public slots: |
36 | void slotAdjustColumns(); | 36 | void slotAdjustColumns(); |
37 | 37 | ||
38 | void setTo( const QString & to ); | ||
39 | void setSubject( const QString & subject ); | ||
40 | void setInReplyTo( const QString & messageId ); | ||
41 | void setMessage( const QString & text ); | ||
38 | 42 | ||
39 | protected slots: | 43 | protected slots: |
40 | void accept(); | 44 | void accept(); |
41 | 45 | ||
42 | private slots: | 46 | private slots: |
43 | void fillValues( int current ); | 47 | void fillValues( int current ); |
44 | void pickAddress( QLineEdit *line ); | 48 | void pickAddress( QLineEdit *line ); |
45 | void pickAddressTo(); | 49 | void pickAddressTo(); |
46 | void pickAddressCC(); | 50 | void pickAddressCC(); |
47 | void pickAddressBCC(); | 51 | void pickAddressBCC(); |
48 | void pickAddressReply(); | 52 | void pickAddressReply(); |
49 | void addAttachment(); | 53 | void addAttachment(); |
50 | void removeAttachment(); | 54 | void removeAttachment(); |
51 | 55 | ||
52 | 56 | ||
53 | 57 | ||
54 | private: | 58 | private: |
55 | Settings *settings; | 59 | Settings *settings; |
56 | QList<SMTPaccount> smtpAccounts; | 60 | QList<SMTPaccount> smtpAccounts; |
57 | 61 | ||
58 | }; | 62 | }; |
59 | 63 | ||
60 | class AttachViewItem : public QListViewItem | 64 | class AttachViewItem : public QListViewItem |
61 | { | 65 | { |
62 | public: | 66 | public: |
63 | AttachViewItem( QListView *parent, Attachment *att ); | 67 | AttachViewItem( QListView *parent, Attachment *att ); |
64 | Attachment *getAttachment() { return attachment; } | 68 | Attachment *getAttachment() { return attachment; } |
65 | 69 | ||
66 | private: | 70 | private: |
67 | Attachment *attachment; | 71 | Attachment *attachment; |
68 | 72 | ||
69 | }; | 73 | }; |
70 | 74 | ||
71 | #endif | 75 | #endif |
diff --git a/noncore/net/mail/opie-mail.control b/noncore/net/mail/opie-mail.control index afe0947..9dfe425 100644 --- a/noncore/net/mail/opie-mail.control +++ b/noncore/net/mail/opie-mail.control | |||
@@ -1,10 +1,10 @@ | |||
1 | Package: opie-mail | 1 | Package: opie-mail |
2 | Files: bin/opiemail apps/1Pim/opiemail.desktop pics/mail/*.png | 2 | Files: bin/opiemail apps/1Pim/mail.desktop pics/opiemail/*.png |
3 | Priority: optional | 3 | Priority: optional |
4 | Section: opie/applications | 4 | Section: opie/applications |
5 | Maintainer: Juergen Graf <jgf@handhelds.org> | 5 | Maintainer: Juergen Graf <jgf@handhelds.org> |
6 | Architecture: arm | 6 | Architecture: arm |
7 | Version: 0.0.1-$SUB_VERSION | 7 | Version: 0.0.1-$SUB_VERSION |
8 | Depends: task-opie-minimal, libopie1 | 8 | Depends: task-opie-minimal, libopie1 |
9 | Description: Opie's mail and news client (POP3, IMAP and NNTP) | 9 | Description: Opie's mail and news client (POP3, IMAP and NNTP) |
10 | License: LGPL | 10 | License: LGPL |
diff --git a/noncore/net/mail/viewmail.cpp b/noncore/net/mail/viewmail.cpp index ed3ece9..8f9ea07 100644 --- a/noncore/net/mail/viewmail.cpp +++ b/noncore/net/mail/viewmail.cpp | |||
@@ -28,208 +28,198 @@ void ViewMail::setMailInfo( const QString & from, const QStringList & to, const | |||
28 | m_mail[0] = from; | 28 | m_mail[0] = from; |
29 | m_mail2[0] = to; | 29 | m_mail2[0] = to; |
30 | m_mail[1] = subject; | 30 | m_mail[1] = subject; |
31 | m_mail2[1] = cc; | 31 | m_mail2[1] = cc; |
32 | m_mail2[2] = bcc; | 32 | m_mail2[2] = bcc; |
33 | m_mail[2] = bodytext; | 33 | m_mail[2] = bodytext; |
34 | m_mail[3] = date; | 34 | m_mail[3] = date; |
35 | 35 | ||
36 | setText(); | 36 | setText(); |
37 | 37 | ||
38 | } | 38 | } |
39 | 39 | ||
40 | 40 | ||
41 | ViewMail::ViewMail( QWidget *parent, const char *name, WFlags fl) | 41 | ViewMail::ViewMail( QWidget *parent, const char *name, WFlags fl) |
42 | : ViewMailBase(parent, name, fl), _inLoop(false) | 42 | : ViewMailBase(parent, name, fl), _inLoop(false) |
43 | { | 43 | { |
44 | _gotBody = false; | 44 | _gotBody = false; |
45 | 45 | ||
46 | connect(reply, SIGNAL(activated()), SLOT(slotReply())); | 46 | connect(reply, SIGNAL(activated()), SLOT(slotReply())); |
47 | connect(forward, SIGNAL(activated()), SLOT(slotForward())); | 47 | connect(forward, SIGNAL(activated()), SLOT(slotForward())); |
48 | 48 | ||
49 | attachments->setEnabled(_gotBody); | 49 | attachments->setEnabled(_gotBody); |
50 | 50 | ||
51 | //_handler->iUid("FETCH", QString("%1 (BODY[1])").arg(mail.uid())); | 51 | //_handler->iUid("FETCH", QString("%1 (BODY[1])").arg(mail.uid())); |
52 | //connect(_handler, SIGNAL(gotResponse(IMAPResponse &)), SLOT(slotIMAPUid(IMAPResponse &))); | 52 | //connect(_handler, SIGNAL(gotResponse(IMAPResponse &)), SLOT(slotIMAPUid(IMAPResponse &))); |
53 | } | 53 | } |
54 | 54 | ||
55 | void ViewMail::setText() | 55 | void ViewMail::setText() |
56 | { | 56 | { |
57 | 57 | ||
58 | QString toString; | 58 | QString toString; |
59 | QString ccString; | 59 | QString ccString; |
60 | QString bccString; | 60 | QString bccString; |
61 | 61 | ||
62 | for ( QStringList::Iterator it = ( m_mail2[0] ).begin(); it != ( m_mail2[0] ).end(); ++it ) { | 62 | for ( QStringList::Iterator it = ( m_mail2[0] ).begin(); it != ( m_mail2[0] ).end(); ++it ) { |
63 | toString += (*it); | 63 | toString += (*it); |
64 | } | 64 | } |
65 | for ( QStringList::Iterator it = ( m_mail2[1] ).begin(); it != ( m_mail2[1] ).end(); ++it ) { | 65 | for ( QStringList::Iterator it = ( m_mail2[1] ).begin(); it != ( m_mail2[1] ).end(); ++it ) { |
66 | ccString += (*it); | 66 | ccString += (*it); |
67 | } | 67 | } |
68 | for ( QStringList::Iterator it = ( m_mail2[2] ).begin(); it != ( m_mail2[2] ).end(); ++it ) { | 68 | for ( QStringList::Iterator it = ( m_mail2[2] ).begin(); it != ( m_mail2[2] ).end(); ++it ) { |
69 | bccString += (*it); | 69 | bccString += (*it); |
70 | } | 70 | } |
71 | 71 | ||
72 | setCaption( caption().arg( m_mail[0] ) ); | 72 | setCaption( caption().arg( m_mail[0] ) ); |
73 | 73 | ||
74 | _mailHtml = tr( | 74 | _mailHtml = tr( |
75 | "<html><body>" | 75 | "<html><body>" |
76 | "<div align=center><b><font color=#FF2222>%1</b></font></div>" | 76 | "<div align=center><b><font color=#0000FF>%1</b></font></div>" |
77 | "<b>From:</b> %2<br>" | 77 | "<b>From:</b><font color=#6C86C0> %2</font><br>" |
78 | "<b>To:</b> %3<br>" | 78 | "<b>To:</b><font color=#6C86C0> %3</font><br>" |
79 | "%4" | 79 | "%4" |
80 | "%5" | 80 | "<b>Date:</b> %5<hr>" |
81 | "<b>Date:</b> %6<hr>" | ||
82 | "<font face=fixed>") | 81 | "<font face=fixed>") |
83 | .arg( deHtml( m_mail[1] ) ) | 82 | .arg( deHtml( m_mail[1] ) ) |
84 | .arg( deHtml( m_mail[0] ) ) | 83 | .arg( deHtml( m_mail[0] ) ) |
85 | .arg( deHtml( toString ) ) | 84 | .arg( deHtml( toString ) ) |
86 | .arg( tr("<b>Cc:</b> %1<br>").arg( deHtml( ccString ) ) ) | 85 | .arg( tr("<b>Cc:</b> %1<br>").arg( deHtml( ccString ) ) ) |
87 | .arg( tr("<b>Bcc:</b> %1<br>").arg( deHtml( bccString ) ) ) | ||
88 | .arg( m_mail[3] ); | 86 | .arg( m_mail[3] ); |
89 | browser->setText( QString(_mailHtml) + deHtml( m_mail[2] ) + "</font>" ); | 87 | browser->setText( QString(_mailHtml) + deHtml( m_mail[2] ) + "</font>" ); |
90 | // remove later in favor of a real handling | 88 | // remove later in favor of a real handling |
91 | _gotBody = true; | 89 | _gotBody = true; |
92 | } | 90 | } |
93 | 91 | ||
94 | 92 | ||
95 | 93 | ||
96 | ViewMail::~ViewMail() | 94 | ViewMail::~ViewMail() |
97 | { | 95 | { |
98 | hide(); | 96 | hide(); |
99 | } | 97 | } |
100 | 98 | ||
101 | void ViewMail::hide() | 99 | void ViewMail::hide() |
102 | { | 100 | { |
103 | QWidget::hide(); | 101 | QWidget::hide(); |
104 | 102 | ||
105 | if (_inLoop) { | 103 | if (_inLoop) { |
106 | _inLoop = false; | 104 | _inLoop = false; |
107 | qApp->exit_loop(); | 105 | qApp->exit_loop(); |
108 | } | 106 | } |
109 | } | 107 | } |
110 | 108 | ||
111 | void ViewMail::exec() | 109 | void ViewMail::exec() |
112 | { | 110 | { |
113 | show(); | 111 | show(); |
114 | 112 | ||
115 | if (!_inLoop) { | 113 | if (!_inLoop) { |
116 | _inLoop = true; | 114 | _inLoop = true; |
117 | qApp->enter_loop(); | 115 | qApp->enter_loop(); |
118 | } | 116 | } |
119 | } | 117 | } |
120 | 118 | ||
121 | QString ViewMail::deHtml(const QString &string) | 119 | QString ViewMail::deHtml(const QString &string) |
122 | { | 120 | { |
123 | QString string_ = string; | 121 | QString string_ = string; |
124 | string_.replace(QRegExp("&"), "&"); | 122 | string_.replace(QRegExp("&"), "&"); |
125 | string_.replace(QRegExp("<"), "<"); | 123 | string_.replace(QRegExp("<"), "<"); |
126 | string_.replace(QRegExp(">"), ">"); | 124 | string_.replace(QRegExp(">"), ">"); |
127 | string_.replace(QRegExp("\\n"), "<br>"); | 125 | string_.replace(QRegExp("\\n"), "<br>"); |
128 | return string_; | 126 | return string_; |
129 | } | 127 | } |
130 | 128 | ||
131 | void ViewMail::slotReply() | 129 | void ViewMail::slotReply() |
132 | { | 130 | { |
133 | if (!_gotBody) { | 131 | if (!_gotBody) { |
134 | QMessageBox::information(this, tr("Error"), tr("<p>The mail body is not yet downloaded, so you cannot reply yet."), tr("Ok")); | 132 | QMessageBox::information(this, tr("Error"), tr("<p>The mail body is not yet downloaded, so you cannot reply yet."), tr("Ok")); |
135 | return; | 133 | return; |
136 | } | 134 | } |
137 | 135 | ||
138 | QString rtext; | 136 | QString rtext; |
139 | rtext += QString("* %1 wrote on %2:\n") // no i18n on purpose | 137 | rtext += QString("* %1 wrote on %2:\n") // no i18n on purpose |
140 | .arg( m_mail[1] ) | 138 | .arg( m_mail[1] ) |
141 | .arg( m_mail[3] ); | 139 | .arg( m_mail[3] ); |
142 | 140 | ||
143 | QString text = m_mail[2]; | 141 | QString text = m_mail[2]; |
144 | QStringList lines = QStringList::split(QRegExp("\\n"), text); | 142 | QStringList lines = QStringList::split(QRegExp("\\n"), text); |
145 | QStringList::Iterator it; | 143 | QStringList::Iterator it; |
146 | for (it = lines.begin(); it != lines.end(); it++) { | 144 | for (it = lines.begin(); it != lines.end(); it++) { |
147 | rtext += "> " + *it + "\n"; | 145 | rtext += "> " + *it + "\n"; |
148 | } | 146 | } |
149 | rtext += "\n"; | 147 | rtext += "\n"; |
150 | 148 | ||
151 | QString prefix; | 149 | QString prefix; |
152 | if ( m_mail[1].find(QRegExp("^Re: *$")) != -1) prefix = ""; | 150 | if ( m_mail[1].find(QRegExp("^Re: *$")) != -1) prefix = ""; |
153 | else prefix = "Re: "; // no i18n on purpose | 151 | else prefix = "Re: "; // no i18n on purpose |
154 | 152 | ||
155 | //SendMail sendMail; | 153 | Settings *settings = new Settings(); |
156 | //sendMail.setTo(_mail.envelope().from()[0].toString()); | 154 | ComposeMail composer( settings ,this, 0, true); |
157 | //sendMail.setSubject(prefix + _mail.envelope().subject()); | 155 | composer.setTo( m_mail[0] ); |
158 | //sendMail.setInReplyTo(_mail.envelope().messageId()); | 156 | composer.setSubject( "Re: " + m_mail[1] ); |
159 | //sendMail.setMessage(rtext); | 157 | composer.setMessage( rtext ); |
160 | |||
161 | |||
162 | /* ComposeMail composer(this, 0, true); | ||
163 | composer.setMessage( ); | ||
164 | composer.showMaximized(); | 158 | composer.showMaximized(); |
165 | composer.exec(); | 159 | composer.exec(); |
166 | */ | 160 | |
167 | qDebug ( rtext ); | 161 | qDebug ( rtext ); |
168 | } | 162 | } |
169 | 163 | ||
170 | void ViewMail::slotForward() | 164 | void ViewMail::slotForward() |
171 | { | 165 | { |
172 | if (!_gotBody) { | 166 | if (!_gotBody) { |
173 | QMessageBox::information(this, tr("Error"), tr("<p>The mail body is not yet downloaded, so you cannot forward yet."), tr("Ok")); | 167 | QMessageBox::information(this, tr("Error"), tr("<p>The mail body is not yet downloaded, so you cannot forward yet."), tr("Ok")); |
174 | return; | 168 | return; |
175 | } | 169 | } |
176 | 170 | ||
177 | QString ftext; | 171 | QString ftext; |
178 | /*ftext += QString("\n----- Forwarded message from %1 -----\n\n") | 172 | ftext += QString("\n----- Forwarded message from %1 -----\n\n") |
179 | .arg(_mail.envelope().from()[0].toString()); | 173 | .arg( m_mail[0] ); |
180 | if (!_mail.envelope().mailDate().isNull()) | 174 | if (!m_mail[3].isNull()) |
181 | ftext += QString("Date: %1\n") | 175 | ftext += QString("Date: %1\n") |
182 | .arg(_mail.envelope().mailDate()); | 176 | .arg( m_mail[3] ); |
183 | if (!_mail.envelope().from()[0].toString().isNull()) | 177 | if (!m_mail[0].isNull()) |
184 | ftext += QString("From: %1\n") | 178 | ftext += QString("From: %1\n") |
185 | .arg(_mail.envelope().from()[0].toString()); | 179 | .arg( m_mail[0] ); |
186 | if (!_mail.envelope().to().toString().isNull()) | 180 | //if (!_mail.envelope().to().toString().isNull()) |
187 | ftext += QString("To: %1\n") | 181 | //ftext += QString("To: %1\n") |
188 | .arg(_mail.envelope().to().toString()); | 182 | // .arg(_mail.envelope().to().toString()); |
189 | if (!_mail.envelope().cc().toString().isNull()) | 183 | //if (!_mail.envelope().cc().toString().isNull()) |
190 | ftext += QString("Cc: %1\n") | 184 | //ftext += QString("Cc: %1\n") |
191 | .arg(_mail.envelope().cc().toString()); | 185 | // .arg(_mail.envelope().cc().toString()); |
192 | if (!_mail.envelope().bcc().toString().isNull()) | 186 | if (!m_mail[1].isNull()) |
193 | ftext += QString("Bcc: %1\n") | 187 | ftext += QString("Subject: %1\n") |
194 | .arg(_mail.envelope().bcc().toString()); | 188 | .arg( m_mail[1] ); |
195 | if (!_mail.envelope().subject().isNull()) | ||
196 | ftext += QString("Subject: %1\n") | ||
197 | .arg(_mail.envelope().subject()); | ||
198 | 189 | ||
199 | ftext += QString("\n%1\n") | 190 | ftext += QString("\n%1\n") |
200 | .arg(_mail.bodyPart(1).data()); | 191 | .arg( m_mail[2]); |
201 | 192 | ||
202 | ftext += QString("----- End forwarded message -----\n"); | 193 | ftext += QString("----- End forwarded message -----\n"); |
203 | */ | ||
204 | /* | ||
205 | SendMail sendMail; | ||
206 | sendMail.setSubject("Fwd: " + _mail.envelope().subject()); | ||
207 | sendMail.setMessage(ftext); | ||
208 | 194 | ||
209 | Composer composer(this, 0, true); | 195 | qDebug( ftext ); |
210 | composer.setSendMail(sendMail); | 196 | |
197 | |||
198 | Settings *settings = new Settings(); | ||
199 | ComposeMail composer( settings ,this, 0, true); | ||
200 | composer.setSubject( "Fwd: " + m_mail[1] ); | ||
201 | composer.setMessage( ftext ); | ||
211 | composer.showMaximized(); | 202 | composer.showMaximized(); |
212 | composer.exec(); | 203 | composer.exec(); |
213 | */ | ||
214 | } | 204 | } |
215 | 205 | ||
216 | /* | 206 | /* |
217 | void ViewMail::slotIMAPUid(IMAPResponse &response) | 207 | void ViewMail::slotIMAPUid(IMAPResponse &response) |
218 | { | 208 | { |
219 | disconnect(_handler, SIGNAL(gotResponse(IMAPResponse &)), this, SLOT(slotIMAPUid(IMAPResponse &))); | 209 | disconnect(_handler, SIGNAL(gotResponse(IMAPResponse &)), this, SLOT(slotIMAPUid(IMAPResponse &))); |
220 | 210 | ||
221 | if (response.statusResponse().status() == IMAPResponseEnums::OK) { | 211 | if (response.statusResponse().status() == IMAPResponseEnums::OK) { |
222 | QValueList<IMAPResponseBodyPart> bodyParts; | 212 | QValueList<IMAPResponseBodyPart> bodyParts; |
223 | bodyParts.append(response.FETCH()[0].bodyPart(0)); | 213 | bodyParts.append(response.FETCH()[0].bodyPart(0)); |
224 | _mail.setBodyParts(bodyParts); | 214 | _mail.setBodyParts(bodyParts); |
225 | 215 | ||
226 | browser->setText(QString(_mailHtml).arg(deHtml(response.FETCH()[0].bodyPart(0).data()))); | 216 | browser->setText(QString(_mailHtml).arg(deHtml(response.FETCH()[0].bodyPart(0).data()))); |
227 | 217 | ||
228 | // fillList(response.FETCH()[0].bodyStructure()); | 218 | // fillList(response.FETCH()[0].bodyStructure()); |
229 | 219 | ||
230 | _gotBody = true; | 220 | _gotBody = true; |
231 | } else { | 221 | } else { |
232 | QMessageBox::warning(this, tr("Error"), tr("<p>I was unable to retrieve the mail from the server. You can try again later or give up.</p>"), tr("Ok")); | 222 | QMessageBox::warning(this, tr("Error"), tr("<p>I was unable to retrieve the mail from the server. You can try again later or give up.</p>"), tr("Ok")); |
233 | } | 223 | } |
234 | } | 224 | } |
235 | */ | 225 | */ |