summaryrefslogtreecommitdiff
Unidiff
Diffstat (more/less context) (ignore whitespace changes)
-rw-r--r--noncore/net/mail/mainwindow.cpp2
-rw-r--r--noncore/net/mail/viewmail.cpp4
-rw-r--r--noncore/net/mail/viewmail.h2
3 files changed, 4 insertions, 4 deletions
diff --git a/noncore/net/mail/mainwindow.cpp b/noncore/net/mail/mainwindow.cpp
index f19f93d..3edfff1 100644
--- a/noncore/net/mail/mainwindow.cpp
+++ b/noncore/net/mail/mainwindow.cpp
@@ -1,185 +1,185 @@
1#include <qlabel.h> 1#include <qlabel.h>
2#include <qvbox.h> 2#include <qvbox.h>
3#include <qheader.h> 3#include <qheader.h>
4#include <qtimer.h> 4#include <qtimer.h>
5#include <qlayout.h> 5#include <qlayout.h>
6 6
7#include <qpe/qpeapplication.h> 7#include <qpe/qpeapplication.h>
8 8
9#include "defines.h" 9#include "defines.h"
10#include "mainwindow.h" 10#include "mainwindow.h"
11#include "viewmail.h" 11#include "viewmail.h"
12#include "mailtypes.h" 12#include "mailtypes.h"
13#include "mailistviewitem.h" 13#include "mailistviewitem.h"
14 14
15MainWindow::MainWindow( QWidget *parent, const char *name, WFlags flags ) 15MainWindow::MainWindow( QWidget *parent, const char *name, WFlags flags )
16 : QMainWindow( parent, name, flags ) 16 : QMainWindow( parent, name, flags )
17{ 17{
18 setCaption( tr( "Opie-Mail" ) ); 18 setCaption( tr( "Opie-Mail" ) );
19 setToolBarsMovable( false ); 19 setToolBarsMovable( false );
20 20
21 toolBar = new QToolBar( this ); 21 toolBar = new QToolBar( this );
22 menuBar = new QMenuBar( toolBar ); 22 menuBar = new QMenuBar( toolBar );
23 mailMenu = new QPopupMenu( menuBar ); 23 mailMenu = new QPopupMenu( menuBar );
24 menuBar->insertItem( tr( "Mail" ), mailMenu ); 24 menuBar->insertItem( tr( "Mail" ), mailMenu );
25 settingsMenu = new QPopupMenu( menuBar ); 25 settingsMenu = new QPopupMenu( menuBar );
26 menuBar->insertItem( tr( "Settings" ), settingsMenu ); 26 menuBar->insertItem( tr( "Settings" ), settingsMenu );
27 27
28 addToolBar( toolBar ); 28 addToolBar( toolBar );
29 toolBar->setHorizontalStretchable( true ); 29 toolBar->setHorizontalStretchable( true );
30 30
31 QLabel *spacer = new QLabel( toolBar ); 31 QLabel *spacer = new QLabel( toolBar );
32 spacer->setBackgroundMode( QWidget::PaletteButton ); 32 spacer->setBackgroundMode( QWidget::PaletteButton );
33 toolBar->setStretchableWidget( spacer ); 33 toolBar->setStretchableWidget( spacer );
34 34
35 composeMail = new QAction( tr( "Compose new mail" ), ICON_COMPOSEMAIL, 35 composeMail = new QAction( tr( "Compose new mail" ), ICON_COMPOSEMAIL,
36 0, 0, this ); 36 0, 0, this );
37 composeMail->addTo( toolBar ); 37 composeMail->addTo( toolBar );
38 composeMail->addTo( mailMenu ); 38 composeMail->addTo( mailMenu );
39 39
40 sendQueued = new QAction( tr( "Send queued mails" ), ICON_SENDQUEUED, 40 sendQueued = new QAction( tr( "Send queued mails" ), ICON_SENDQUEUED,
41 0, 0, this ); 41 0, 0, this );
42 sendQueued->addTo( toolBar ); 42 sendQueued->addTo( toolBar );
43 sendQueued->addTo( mailMenu ); 43 sendQueued->addTo( mailMenu );
44 44
45 syncFolders = new QAction( tr( "Sync mailfolders" ), ICON_SYNC, 45 syncFolders = new QAction( tr( "Sync mailfolders" ), ICON_SYNC,
46 0, 0, this ); 46 0, 0, this );
47 syncFolders->addTo( toolBar ); 47 syncFolders->addTo( toolBar );
48 syncFolders->addTo( mailMenu ); 48 syncFolders->addTo( mailMenu );
49 49
50 showFolders = new QAction( tr( "Show/Hide folders" ), ICON_SHOWFOLDERS, 50 showFolders = new QAction( tr( "Show/Hide folders" ), ICON_SHOWFOLDERS,
51 0, 0, this, 0, true ); 51 0, 0, this, 0, true );
52 showFolders->addTo( toolBar ); 52 showFolders->addTo( toolBar );
53 showFolders->addTo( mailMenu ); 53 showFolders->addTo( mailMenu );
54 connect(showFolders, SIGNAL( toggled( bool ) ), 54 connect(showFolders, SIGNAL( toggled( bool ) ),
55 SLOT( slotShowFolders( bool ) ) ); 55 SLOT( slotShowFolders( bool ) ) );
56 56
57 searchMails = new QAction( tr( "Search mails" ), ICON_SEARCHMAILS, 57 searchMails = new QAction( tr( "Search mails" ), ICON_SEARCHMAILS,
58 0, 0, this ); 58 0, 0, this );
59 searchMails->addTo( toolBar ); 59 searchMails->addTo( toolBar );
60 searchMails->addTo( mailMenu ); 60 searchMails->addTo( mailMenu );
61 61
62 62
63 editSettings = new QAction( tr( "Edit settings" ), ICON_EDITSETTINGS, 63 editSettings = new QAction( tr( "Edit settings" ), ICON_EDITSETTINGS,
64 0, 0, this ); 64 0, 0, this );
65 editSettings->addTo( settingsMenu ); 65 editSettings->addTo( settingsMenu );
66 66
67 editAccounts = new QAction( tr( "Configure accounts" ), ICON_EDITACCOUNTS, 67 editAccounts = new QAction( tr( "Configure accounts" ), ICON_EDITACCOUNTS,
68 0, 0, this ); 68 0, 0, this );
69 editAccounts->addTo( settingsMenu ); 69 editAccounts->addTo( settingsMenu );
70 70
71 QWidget *view = new QWidget( this ); 71 QWidget *view = new QWidget( this );
72 setCentralWidget( view ); 72 setCentralWidget( view );
73 73
74 layout = new QBoxLayout ( view, QBoxLayout::LeftToRight ); 74 layout = new QBoxLayout ( view, QBoxLayout::LeftToRight );
75 75
76 folderView = new AccountView( view ); 76 folderView = new AccountView( view );
77 folderView->header()->hide(); 77 folderView->header()->hide();
78 folderView->addColumn( tr( "Mailbox" ) ); 78 folderView->addColumn( tr( "Mailbox" ) );
79 folderView->hide(); 79 folderView->hide();
80 80
81 layout->addWidget( folderView ); 81 layout->addWidget( folderView );
82 82
83 mailView = new QListView( view ); 83 mailView = new QListView( view );
84 mailView->addColumn( tr( "Subject" ),QListView::Manual ); 84 mailView->addColumn( tr( "Subject" ),QListView::Manual );
85 mailView->addColumn( tr( "Sender" ),QListView::Manual ); 85 mailView->addColumn( tr( "Sender" ),QListView::Manual );
86 mailView->addColumn( tr( "Date" )); 86 mailView->addColumn( tr( "Date" ));
87 mailView->setAllColumnsShowFocus(true); 87 mailView->setAllColumnsShowFocus(true);
88 mailView->setSorting(-1); 88 mailView->setSorting(-1);
89 89
90 layout->addWidget( mailView ); 90 layout->addWidget( mailView );
91 layout->setStretchFactor( folderView, 1 ); 91 layout->setStretchFactor( folderView, 1 );
92 layout->setStretchFactor( mailView, 2 ); 92 layout->setStretchFactor( mailView, 2 );
93 93
94 slotAdjustLayout(); 94 slotAdjustLayout();
95 95
96 connect( mailView, SIGNAL( clicked( QListViewItem * ) ),this, 96 connect( mailView, SIGNAL( clicked( QListViewItem * ) ),this,
97 SLOT( displayMail( QListViewItem * ) ) ); 97 SLOT( displayMail( QListViewItem * ) ) );
98 98
99 connect(folderView,SIGNAL(refreshMailview(QList<RecMail>*)),this,SLOT(refreshMailView(QList<RecMail>*))); 99 connect(folderView,SIGNAL(refreshMailview(QList<RecMail>*)),this,SLOT(refreshMailView(QList<RecMail>*)));
100 100
101 QTimer::singleShot( 1000, this, SLOT( slotAdjustColumns() ) ); 101 QTimer::singleShot( 1000, this, SLOT( slotAdjustColumns() ) );
102} 102}
103 103
104 104
105void MainWindow::slotAdjustLayout() { 105void MainWindow::slotAdjustLayout() {
106 106
107 QWidget *d = QApplication::desktop(); 107 QWidget *d = QApplication::desktop();
108 108
109 if ( d->width() < d->height() ) { 109 if ( d->width() < d->height() ) {
110 layout->setDirection( QBoxLayout::TopToBottom ); 110 layout->setDirection( QBoxLayout::TopToBottom );
111 } else { 111 } else {
112 layout->setDirection( QBoxLayout::LeftToRight ); 112 layout->setDirection( QBoxLayout::LeftToRight );
113 } 113 }
114 delete d; 114 delete d;
115} 115}
116 116
117void MainWindow::slotAdjustColumns() 117void MainWindow::slotAdjustColumns()
118{ 118{
119 bool hidden = folderView->isHidden(); 119 bool hidden = folderView->isHidden();
120 if ( hidden ) folderView->show(); 120 if ( hidden ) folderView->show();
121 folderView->setColumnWidth( 0, folderView->visibleWidth() ); 121 folderView->setColumnWidth( 0, folderView->visibleWidth() );
122 if ( hidden ) folderView->hide(); 122 if ( hidden ) folderView->hide();
123 123
124 mailView->setColumnWidth( 0, mailView->visibleWidth() - 130 ); 124 mailView->setColumnWidth( 0, mailView->visibleWidth() - 130 );
125 mailView->setColumnWidth( 1, 80 ); 125 mailView->setColumnWidth( 1, 80 );
126 mailView->setColumnWidth( 2, 50 ); 126 mailView->setColumnWidth( 2, 50 );
127} 127}
128 128
129void MainWindow::slotShowFolders( bool show ) 129void MainWindow::slotShowFolders( bool show )
130{ 130{
131 qDebug( "Show Folders" ); 131 qDebug( "Show Folders" );
132 if ( show && folderView->isHidden() ) { 132 if ( show && folderView->isHidden() ) {
133 qDebug( "-> showing" ); 133 qDebug( "-> showing" );
134 folderView->show(); 134 folderView->show();
135 } else if ( !show && !folderView->isHidden() ) { 135 } else if ( !show && !folderView->isHidden() ) {
136 qDebug( "-> hiding" ); 136 qDebug( "-> hiding" );
137 folderView->hide(); 137 folderView->hide();
138 } 138 }
139} 139}
140 140
141void MainWindow::refreshMailView(QList<RecMail>*list) 141void MainWindow::refreshMailView(QList<RecMail>*list)
142{ 142{
143 MailListViewItem*item = 0; 143 MailListViewItem*item = 0;
144 mailView->clear(); 144 mailView->clear();
145 for (unsigned int i = 0; i < list->count();++i) { 145 for (unsigned int i = 0; i < list->count();++i) {
146 item = new MailListViewItem(mailView,item); 146 item = new MailListViewItem(mailView,item);
147 item->storeData(*(list->at(i))); 147 item->storeData(*(list->at(i)));
148 item->showEntry(); 148 item->showEntry();
149 } 149 }
150} 150}
151void MainWindow::displayMail(QListViewItem*item) 151void MainWindow::displayMail(QListViewItem*item)
152{ 152{
153 if (!item) return; 153 if (!item) return;
154 qDebug("View mail"); 154 qDebug("View mail");
155 RecMail mail = ((MailListViewItem*)item)->data(); 155 RecMail mail = ((MailListViewItem*)item)->data();
156 RecBody body = folderView->fetchBody(mail); 156 RecBody body = folderView->fetchBody(mail);
157 157
158 ViewMail readMail( this ); 158 ViewMail readMail( this );
159 159
160 readMail.setMailInfo( mail.getFrom(), mail.To(), mail.getSubject(), mail.CC(), mail.Bcc(), mail.getDate(), body.Bodytext() ); 160 readMail.setMailInfo( mail.getFrom(), mail.To(), mail.getSubject(), mail.CC(), mail.Bcc(), mail.getDate(), body.Bodytext(), mail.Msgid() );
161 readMail.showMaximized(); 161 readMail.showMaximized();
162 readMail.exec(); 162 readMail.exec();
163} 163}
164 164
165MailListViewItem::MailListViewItem(QListView * parent, MailListViewItem * after ) 165MailListViewItem::MailListViewItem(QListView * parent, MailListViewItem * after )
166 :QListViewItem(parent,after),mail_data() 166 :QListViewItem(parent,after),mail_data()
167{ 167{
168} 168}
169 169
170void MailListViewItem::showEntry() 170void MailListViewItem::showEntry()
171{ 171{
172 setText(0,mail_data.getSubject()); 172 setText(0,mail_data.getSubject());
173 setText(1,mail_data.getFrom()); 173 setText(1,mail_data.getFrom());
174 setText(2,mail_data.getDate()); 174 setText(2,mail_data.getDate());
175} 175}
176 176
177void MailListViewItem::storeData(const RecMail&data) 177void MailListViewItem::storeData(const RecMail&data)
178{ 178{
179 mail_data = data; 179 mail_data = data;
180} 180}
181 181
182const RecMail& MailListViewItem::data()const 182const RecMail& MailListViewItem::data()const
183{ 183{
184 return mail_data; 184 return mail_data;
185} 185}
diff --git a/noncore/net/mail/viewmail.cpp b/noncore/net/mail/viewmail.cpp
index 8f9ea07..7969235 100644
--- a/noncore/net/mail/viewmail.cpp
+++ b/noncore/net/mail/viewmail.cpp
@@ -1,225 +1,225 @@
1#include <qtextbrowser.h> 1#include <qtextbrowser.h>
2#include <qmessagebox.h> 2#include <qmessagebox.h>
3#include <qaction.h> 3#include <qaction.h>
4#include <qapplication.h> 4#include <qapplication.h>
5 5
6#include "settings.h" 6#include "settings.h"
7#include "composemail.h" 7#include "composemail.h"
8#include "viewmail.h" 8#include "viewmail.h"
9 9
10AttachItem::AttachItem(QListView *parent, AttachItemStore &attachItemStore) 10AttachItem::AttachItem(QListView *parent, AttachItemStore &attachItemStore)
11 : QListViewItem(parent), _attachItemStore(attachItemStore) 11 : QListViewItem(parent), _attachItemStore(attachItemStore)
12{ 12{
13 setText(0, _attachItemStore.mimeType()); 13 setText(0, _attachItemStore.mimeType());
14 setText(1, _attachItemStore.fileName()); 14 setText(1, _attachItemStore.fileName());
15 setText(2, _attachItemStore.description()); 15 setText(2, _attachItemStore.description());
16} 16}
17 17
18AttachItem::AttachItem(QListViewItem *parent, AttachItemStore &attachItemStore) 18AttachItem::AttachItem(QListViewItem *parent, AttachItemStore &attachItemStore)
19 : QListViewItem(parent), _attachItemStore(attachItemStore) 19 : QListViewItem(parent), _attachItemStore(attachItemStore)
20{ 20{
21 setText(0, _attachItemStore.mimeType()); 21 setText(0, _attachItemStore.mimeType());
22 setText(1, _attachItemStore.fileName()); 22 setText(1, _attachItemStore.fileName());
23 setText(2, _attachItemStore.description()); 23 setText(2, _attachItemStore.description());
24} 24}
25 25
26void ViewMail::setMailInfo( const QString & from, const QStringList & to, const QString & subject, const QStringList & cc, const QStringList & bcc, const QString & date, const QString & bodytext ) { 26void ViewMail::setMailInfo( const QString & from, const QStringList & to, const QString & subject, const QStringList & cc, const QStringList & bcc, const QString & date, const QString & bodytext, const QString & messageID ) {
27 27
28m_mail[0] = from; 28m_mail[0] = from;
29m_mail2[0] = to; 29m_mail2[0] = to;
30m_mail[1] = subject; 30m_mail[1] = subject;
31m_mail2[1] = cc; 31m_mail2[1] = cc;
32m_mail2[2] = bcc; 32m_mail2[2] = bcc;
33m_mail[2] = bodytext; 33m_mail[2] = bodytext;
34m_mail[3] = date; 34m_mail[3] = date;
35m_mail[4] = messageID;
35 36
36setText(); 37setText();
37
38} 38}
39 39
40 40
41ViewMail::ViewMail( QWidget *parent, const char *name, WFlags fl) 41ViewMail::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
55void ViewMail::setText() 55void 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=#0000FF>%1</b></font></div>" 76 "<div align=center><b><font color=#0000FF>%1</b></font></div>"
77 "<b>From:</b><font color=#6C86C0> %2</font><br>" 77 "<b>From:</b><font color=#6C86C0> %2</font><br>"
78 "<b>To:</b><font color=#6C86C0> %3</font><br>" 78 "<b>To:</b><font color=#6C86C0> %3</font><br>"
79 "%4" 79 "%4"
80 "<b>Date:</b> %5<hr>" 80 "<b>Date:</b> %5<hr>"
81 "<font face=fixed>") 81 "<font face=fixed>")
82 .arg( deHtml( m_mail[1] ) ) 82 .arg( deHtml( m_mail[1] ) )
83 .arg( deHtml( m_mail[0] ) ) 83 .arg( deHtml( m_mail[0] ) )
84 .arg( deHtml( toString ) ) 84 .arg( deHtml( toString ) )
85 .arg( tr("<b>Cc:</b> %1<br>").arg( deHtml( ccString ) ) ) 85 .arg( tr("<b>Cc:</b> %1<br>").arg( deHtml( ccString ) ) )
86 .arg( m_mail[3] ); 86 .arg( m_mail[3] );
87 browser->setText( QString(_mailHtml) + deHtml( m_mail[2] ) + "</font>" ); 87 browser->setText( QString(_mailHtml) + deHtml( m_mail[2] ) + "</font>" );
88 // remove later in favor of a real handling 88 // remove later in favor of a real handling
89 _gotBody = true; 89 _gotBody = true;
90} 90}
91 91
92 92
93 93
94ViewMail::~ViewMail() 94ViewMail::~ViewMail()
95{ 95{
96 hide(); 96 hide();
97} 97}
98 98
99void ViewMail::hide() 99void ViewMail::hide()
100{ 100{
101 QWidget::hide(); 101 QWidget::hide();
102 102
103 if (_inLoop) { 103 if (_inLoop) {
104 _inLoop = false; 104 _inLoop = false;
105 qApp->exit_loop(); 105 qApp->exit_loop();
106 } 106 }
107} 107}
108 108
109void ViewMail::exec() 109void ViewMail::exec()
110{ 110{
111 show(); 111 show();
112 112
113 if (!_inLoop) { 113 if (!_inLoop) {
114 _inLoop = true; 114 _inLoop = true;
115 qApp->enter_loop(); 115 qApp->enter_loop();
116 } 116 }
117} 117}
118 118
119QString ViewMail::deHtml(const QString &string) 119QString ViewMail::deHtml(const QString &string)
120{ 120{
121 QString string_ = string; 121 QString string_ = string;
122 string_.replace(QRegExp("&"), "&amp;"); 122 string_.replace(QRegExp("&"), "&amp;");
123 string_.replace(QRegExp("<"), "&lt;"); 123 string_.replace(QRegExp("<"), "&lt;");
124 string_.replace(QRegExp(">"), "&gt;"); 124 string_.replace(QRegExp(">"), "&gt;");
125 string_.replace(QRegExp("\\n"), "<br>"); 125 string_.replace(QRegExp("\\n"), "<br>");
126 return string_; 126 return string_;
127} 127}
128 128
129void ViewMail::slotReply() 129void ViewMail::slotReply()
130{ 130{
131 if (!_gotBody) { 131 if (!_gotBody) {
132 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"));
133 return; 133 return;
134 } 134 }
135 135
136 QString rtext; 136 QString rtext;
137 rtext += QString("* %1 wrote on %2:\n") // no i18n on purpose 137 rtext += QString("* %1 wrote on %2:\n") // no i18n on purpose
138 .arg( m_mail[1] ) 138 .arg( m_mail[1] )
139 .arg( m_mail[3] ); 139 .arg( m_mail[3] );
140 140
141 QString text = m_mail[2]; 141 QString text = m_mail[2];
142 QStringList lines = QStringList::split(QRegExp("\\n"), text); 142 QStringList lines = QStringList::split(QRegExp("\\n"), text);
143 QStringList::Iterator it; 143 QStringList::Iterator it;
144 for (it = lines.begin(); it != lines.end(); it++) { 144 for (it = lines.begin(); it != lines.end(); it++) {
145 rtext += "> " + *it + "\n"; 145 rtext += "> " + *it + "\n";
146 } 146 }
147 rtext += "\n"; 147 rtext += "\n";
148 148
149 QString prefix; 149 QString prefix;
150 if ( m_mail[1].find(QRegExp("^Re: *$")) != -1) prefix = ""; 150 if ( m_mail[1].find(QRegExp("^Re: *$")) != -1) prefix = "";
151 else prefix = "Re: "; // no i18n on purpose 151 else prefix = "Re: "; // no i18n on purpose
152 152
153 Settings *settings = new Settings(); 153 Settings *settings = new Settings();
154 ComposeMail composer( settings ,this, 0, true); 154 ComposeMail composer( settings ,this, 0, true);
155 composer.setTo( m_mail[0] ); 155 composer.setTo( m_mail[0] );
156 composer.setSubject( "Re: " + m_mail[1] ); 156 composer.setSubject( "Re: " + m_mail[1] );
157 composer.setMessage( rtext ); 157 composer.setMessage( rtext );
158 composer.showMaximized(); 158 composer.showMaximized();
159 composer.exec(); 159 composer.exec();
160 160
161 qDebug ( rtext ); 161 qDebug ( rtext );
162} 162}
163 163
164void ViewMail::slotForward() 164void ViewMail::slotForward()
165{ 165{
166 if (!_gotBody) { 166 if (!_gotBody) {
167 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"));
168 return; 168 return;
169 } 169 }
170 170
171 QString ftext; 171 QString ftext;
172 ftext += QString("\n----- Forwarded message from %1 -----\n\n") 172 ftext += QString("\n----- Forwarded message from %1 -----\n\n")
173 .arg( m_mail[0] ); 173 .arg( m_mail[0] );
174 if (!m_mail[3].isNull()) 174 if (!m_mail[3].isNull())
175 ftext += QString("Date: %1\n") 175 ftext += QString("Date: %1\n")
176 .arg( m_mail[3] ); 176 .arg( m_mail[3] );
177 if (!m_mail[0].isNull()) 177 if (!m_mail[0].isNull())
178 ftext += QString("From: %1\n") 178 ftext += QString("From: %1\n")
179 .arg( m_mail[0] ); 179 .arg( m_mail[0] );
180 //if (!_mail.envelope().to().toString().isNull()) 180 //if (!_mail.envelope().to().toString().isNull())
181 //ftext += QString("To: %1\n") 181 //ftext += QString("To: %1\n")
182 // .arg(_mail.envelope().to().toString()); 182 // .arg(_mail.envelope().to().toString());
183 //if (!_mail.envelope().cc().toString().isNull()) 183 //if (!_mail.envelope().cc().toString().isNull())
184 //ftext += QString("Cc: %1\n") 184 //ftext += QString("Cc: %1\n")
185 // .arg(_mail.envelope().cc().toString()); 185 // .arg(_mail.envelope().cc().toString());
186 if (!m_mail[1].isNull()) 186 if (!m_mail[1].isNull())
187 ftext += QString("Subject: %1\n") 187 ftext += QString("Subject: %1\n")
188 .arg( m_mail[1] ); 188 .arg( m_mail[1] );
189 189
190 ftext += QString("\n%1\n") 190 ftext += QString("\n%1\n")
191 .arg( m_mail[2]); 191 .arg( m_mail[2]);
192 192
193 ftext += QString("----- End forwarded message -----\n"); 193 ftext += QString("----- End forwarded message -----\n");
194 194
195 qDebug( ftext ); 195 qDebug( ftext );
196 196
197 197
198 Settings *settings = new Settings(); 198 Settings *settings = new Settings();
199 ComposeMail composer( settings ,this, 0, true); 199 ComposeMail composer( settings ,this, 0, true);
200 composer.setSubject( "Fwd: " + m_mail[1] ); 200 composer.setSubject( "Fwd: " + m_mail[1] );
201 composer.setMessage( ftext ); 201 composer.setMessage( ftext );
202 composer.showMaximized(); 202 composer.showMaximized();
203 composer.exec(); 203 composer.exec();
204} 204}
205 205
206/* 206/*
207void ViewMail::slotIMAPUid(IMAPResponse &response) 207void ViewMail::slotIMAPUid(IMAPResponse &response)
208{ 208{
209 disconnect(_handler, SIGNAL(gotResponse(IMAPResponse &)), this, SLOT(slotIMAPUid(IMAPResponse &))); 209 disconnect(_handler, SIGNAL(gotResponse(IMAPResponse &)), this, SLOT(slotIMAPUid(IMAPResponse &)));
210 210
211 if (response.statusResponse().status() == IMAPResponseEnums::OK) { 211 if (response.statusResponse().status() == IMAPResponseEnums::OK) {
212 QValueList<IMAPResponseBodyPart> bodyParts; 212 QValueList<IMAPResponseBodyPart> bodyParts;
213 bodyParts.append(response.FETCH()[0].bodyPart(0)); 213 bodyParts.append(response.FETCH()[0].bodyPart(0));
214 _mail.setBodyParts(bodyParts); 214 _mail.setBodyParts(bodyParts);
215 215
216 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())));
217 217
218 // fillList(response.FETCH()[0].bodyStructure()); 218 // fillList(response.FETCH()[0].bodyStructure());
219 219
220 _gotBody = true; 220 _gotBody = true;
221 } else { 221 } else {
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")); 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"));
223 } 223 }
224} 224}
225*/ 225*/
diff --git a/noncore/net/mail/viewmail.h b/noncore/net/mail/viewmail.h
index 615939a..258c09b 100644
--- a/noncore/net/mail/viewmail.h
+++ b/noncore/net/mail/viewmail.h
@@ -1,85 +1,85 @@
1#ifndef VIEWMAIL_H 1#ifndef VIEWMAIL_H
2#define VIEWMAIL_H 2#define VIEWMAIL_H
3 3
4#include <qlistview.h> 4#include <qlistview.h>
5#include <qmap.h> 5#include <qmap.h>
6#include <qstringlist.h> 6#include <qstringlist.h>
7 7
8#include "viewmailbase.h" 8#include "viewmailbase.h"
9//#include "imapresponse.h" 9//#include "imapresponse.h"
10//#include "mailtable.h" 10//#include "mailtable.h"
11 11
12class AttachItemStore 12class AttachItemStore
13{ 13{
14public: 14public:
15 void setMimeType(QString mimeType) { _mimeType = mimeType; } 15 void setMimeType(QString mimeType) { _mimeType = mimeType; }
16 QString mimeType() { return _mimeType; } 16 QString mimeType() { return _mimeType; }
17 void setFileName(QString fileName) { _fileName = fileName; } 17 void setFileName(QString fileName) { _fileName = fileName; }
18 QString fileName() { return _fileName; } 18 QString fileName() { return _fileName; }
19 void setDescription(QString description) { _description = description; } 19 void setDescription(QString description) { _description = description; }
20 QString description() { return _description; } 20 QString description() { return _description; }
21 void setPartNum(QString partNum) { _partNum = partNum; } 21 void setPartNum(QString partNum) { _partNum = partNum; }
22 QString partNum() { return _partNum; } 22 QString partNum() { return _partNum; }
23 23
24private: 24private:
25 QString _mimeType, _fileName, _description, _partNum; 25 QString _mimeType, _fileName, _description, _partNum;
26 26
27}; 27};
28 28
29class AttachItem : public QListViewItem 29class AttachItem : public QListViewItem
30{ 30{
31public: 31public:
32 AttachItem(QListView *parent, AttachItemStore &attachment); 32 AttachItem(QListView *parent, AttachItemStore &attachment);
33 AttachItem(QListViewItem *parent, AttachItemStore &attachment); 33 AttachItem(QListViewItem *parent, AttachItemStore &attachment);
34 34
35 AttachItemStore attachItemStore() { return _attachItemStore; } 35 AttachItemStore attachItemStore() { return _attachItemStore; }
36 36
37private: 37private:
38 AttachItemStore _attachItemStore; 38 AttachItemStore _attachItemStore;
39 39
40}; 40};
41 41
42class ViewMail : public ViewMailBase 42class ViewMail : public ViewMailBase
43{ 43{
44 Q_OBJECT 44 Q_OBJECT
45 45
46public: 46public:
47 ViewMail( QWidget *parent = 0, const char *name = 0, WFlags fl = Qt::WType_Modal); 47 ViewMail( QWidget *parent = 0, const char *name = 0, WFlags fl = Qt::WType_Modal);
48 ~ViewMail(); 48 ~ViewMail();
49 49
50 void hide(); 50 void hide();
51 void exec(); 51 void exec();
52 static QString appName() { return QString::fromLatin1("mail"); } 52 static QString appName() { return QString::fromLatin1("mail"); }
53 void setMailInfo( const QString & from, const QStringList & to, const QString & subject, const QStringList & cc, const QStringList & bcc,const QString & date, const QString & bodytext ); 53 void setMailInfo( const QString & from, const QStringList & to, const QString & subject, const QStringList & cc, const QStringList & bcc,const QString & date, const QString & bodytext, const QString & messageID );
54 54
55protected: 55protected:
56 //void fillList(IMAPResponseBODYSTRUCTURE &structure); 56 //void fillList(IMAPResponseBODYSTRUCTURE &structure);
57 QString deHtml(const QString &string); 57 QString deHtml(const QString &string);
58 58
59protected slots: 59protected slots:
60 void slotReply(); 60 void slotReply();
61 void slotForward(); 61 void slotForward();
62 void setText(); 62 void setText();
63 63
64 //void slotIMAPUid(IMAPResponse &response); 64 //void slotIMAPUid(IMAPResponse &response);
65 65
66private: 66private:
67 bool _inLoop; 67 bool _inLoop;
68 //IMAPResponseFETCH _mail; 68 //IMAPResponseFETCH _mail;
69 //IMAPHandler *_handler; 69 //IMAPHandler *_handler;
70 QString _mailHtml; 70 QString _mailHtml;
71 bool _gotBody; 71 bool _gotBody;
72 72
73 // 0 from 73 // 0 from
74 // 1 subject 74 // 1 subject
75 // 2 bodytext 75 // 2 bodytext
76 // 3 date 76 // 3 date
77 QMap <int,QString> m_mail; 77 QMap <int,QString> m_mail;
78 // 0 to 78 // 0 to
79 // 1 cc 79 // 1 cc
80 // 2 bcc 80 // 2 bcc
81 QMap <int,QStringList> m_mail2; 81 QMap <int,QStringList> m_mail2;
82 82
83}; 83};
84 84
85#endif 85#endif