summaryrefslogtreecommitdiff
authorharlekin <harlekin>2003-12-09 01:05:53 (UTC)
committer harlekin <harlekin>2003-12-09 01:05:53 (UTC)
commit6142ad15ac50090b95bb5d80116c1750ffc515de (patch) (unidiff)
tree177b72b44446824d6faa13e140ab95a25c931b81
parente372949ac776a7d986cac91b2ff1a5022040d43b (diff)
downloadopie-6142ad15ac50090b95bb5d80116c1750ffc515de.zip
opie-6142ad15ac50090b95bb5d80116c1750ffc515de.tar.gz
opie-6142ad15ac50090b95bb5d80116c1750ffc515de.tar.bz2
beginning of a view mail part
Diffstat (more/less context) (ignore whitespace changes)
-rw-r--r--noncore/net/mail/mail.pro4
-rw-r--r--noncore/net/mail/mainwindow.cpp8
-rw-r--r--noncore/net/mail/viewmail.cpp216
-rw-r--r--noncore/net/mail/viewmail.h75
-rw-r--r--noncore/net/mail/viewmailbase.cpp75
-rw-r--r--noncore/net/mail/viewmailbase.h36
6 files changed, 413 insertions, 1 deletions
diff --git a/noncore/net/mail/mail.pro b/noncore/net/mail/mail.pro
index 2142cdc..3ae1ddc 100644
--- a/noncore/net/mail/mail.pro
+++ b/noncore/net/mail/mail.pro
@@ -1,40 +1,44 @@
1 CONFIG += qt warn_on debug quick-app 1 CONFIG += qt warn_on debug quick-app
2 2
3 HEADERS = defines.h \ 3 HEADERS = defines.h \
4 logindialog.h \ 4 logindialog.h \
5 settings.h \ 5 settings.h \
6 editaccounts.h \ 6 editaccounts.h \
7 mailwrapper.h \ 7 mailwrapper.h \
8 composemail.h \ 8 composemail.h \
9 accountview.h \ 9 accountview.h \
10 mainwindow.h \ 10 mainwindow.h \
11 viewmail.h \
12 viewmailbase.h \
11 opiemail.h \ 13 opiemail.h \
12 imapwrapper.h 14 imapwrapper.h
13 15
14 SOURCES = main.cpp \ 16 SOURCES = main.cpp \
15 opiemail.cpp \ 17 opiemail.cpp \
16 mainwindow.cpp \ 18 mainwindow.cpp \
17 accountview.cpp \ 19 accountview.cpp \
18 composemail.cpp \ 20 composemail.cpp \
19 mailwrapper.cpp \ 21 mailwrapper.cpp \
20 imapwrapper.cpp \ 22 imapwrapper.cpp \
21 addresspicker.cpp \ 23 addresspicker.cpp \
22 editaccounts.cpp \ 24 editaccounts.cpp \
23 logindialog.cpp \ 25 logindialog.cpp \
26 viewmail.cpp \
27 viewmailbase.cpp \
24 settings.cpp 28 settings.cpp
25 29
26 INTERFACES = editaccountsui.ui \ 30 INTERFACES = editaccountsui.ui \
27 selectmailtypeui.ui \ 31 selectmailtypeui.ui \
28 imapconfigui.ui \ 32 imapconfigui.ui \
29 pop3configui.ui \ 33 pop3configui.ui \
30 nntpconfigui.ui \ 34 nntpconfigui.ui \
31 smtpconfigui.ui \ 35 smtpconfigui.ui \
32 addresspickerui.ui \ 36 addresspickerui.ui \
33 logindialogui.ui \ 37 logindialogui.ui \
34 composemailui.ui 38 composemailui.ui
35 39
36INCLUDEPATH += $(OPIEDIR)/include 40INCLUDEPATH += $(OPIEDIR)/include
37 LIBS += -lqpe -lopie -letpan -lssl -lcrypto -ldb 41 LIBS += -lqpe -lopie -letpan -lssl -lcrypto -ldb
38TARGET = opiemail 42TARGET = opiemail
39 43
40include ( $(OPIEDIR)/include.pro ) 44include ( $(OPIEDIR)/include.pro )
diff --git a/noncore/net/mail/mainwindow.cpp b/noncore/net/mail/mainwindow.cpp
index 6f054cc..6e8f4d3 100644
--- a/noncore/net/mail/mainwindow.cpp
+++ b/noncore/net/mail/mainwindow.cpp
@@ -1,72 +1,73 @@
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 5
6 6
7#include "defines.h" 7#include "defines.h"
8#include "mainwindow.h" 8#include "mainwindow.h"
9#include "viewmail.h"
9 10
10MainWindow::MainWindow( QWidget *parent, const char *name, WFlags flags ) 11MainWindow::MainWindow( QWidget *parent, const char *name, WFlags flags )
11 : QMainWindow( parent, name, flags ) 12 : QMainWindow( parent, name, flags )
12{ 13{
13 setCaption( tr( "Opie-Mail" ) ); 14 setCaption( tr( "Opie-Mail" ) );
14 setToolBarsMovable( false ); 15 setToolBarsMovable( false );
15 16
16 toolBar = new QToolBar( this ); 17 toolBar = new QToolBar( this );
17 menuBar = new QMenuBar( toolBar ); 18 menuBar = new QMenuBar( toolBar );
18 mailMenu = new QPopupMenu( menuBar ); 19 mailMenu = new QPopupMenu( menuBar );
19 menuBar->insertItem( tr( "Mail" ), mailMenu ); 20 menuBar->insertItem( tr( "Mail" ), mailMenu );
20 settingsMenu = new QPopupMenu( menuBar ); 21 settingsMenu = new QPopupMenu( menuBar );
21 menuBar->insertItem( tr( "Settings" ), settingsMenu ); 22 menuBar->insertItem( tr( "Settings" ), settingsMenu );
22 23
23 addToolBar( toolBar ); 24 addToolBar( toolBar );
24 toolBar->setHorizontalStretchable( true ); 25 toolBar->setHorizontalStretchable( true );
25 26
26 QLabel *spacer = new QLabel( toolBar ); 27 QLabel *spacer = new QLabel( toolBar );
27 spacer->setBackgroundMode( QWidget::PaletteButton ); 28 spacer->setBackgroundMode( QWidget::PaletteButton );
28 toolBar->setStretchableWidget( spacer ); 29 toolBar->setStretchableWidget( spacer );
29 30
30 composeMail = new QAction( tr( "Compose new mail" ), ICON_COMPOSEMAIL, 31 composeMail = new QAction( tr( "Compose new mail" ), ICON_COMPOSEMAIL,
31 0, 0, this ); 32 0, 0, this );
32 composeMail->addTo( toolBar ); 33 composeMail->addTo( toolBar );
33 composeMail->addTo( mailMenu ); 34 composeMail->addTo( mailMenu );
34 35
35 sendQueued = new QAction( tr( "Send queued mails" ), ICON_SENDQUEUED, 36 sendQueued = new QAction( tr( "Send queued mails" ), ICON_SENDQUEUED,
36 0, 0, this ); 37 0, 0, this );
37 sendQueued->addTo( toolBar ); 38 sendQueued->addTo( toolBar );
38 sendQueued->addTo( mailMenu ); 39 sendQueued->addTo( mailMenu );
39 40
40 syncFolders = new QAction( tr( "Sync mailfolders" ), ICON_SYNC, 41 syncFolders = new QAction( tr( "Sync mailfolders" ), ICON_SYNC,
41 0, 0, this ); 42 0, 0, this );
42 syncFolders->addTo( toolBar ); 43 syncFolders->addTo( toolBar );
43 syncFolders->addTo( mailMenu ); 44 syncFolders->addTo( mailMenu );
44 45
45 showFolders = new QAction( tr( "Show/Hide folders" ), ICON_SHOWFOLDERS, 46 showFolders = new QAction( tr( "Show/Hide folders" ), ICON_SHOWFOLDERS,
46 0, 0, this, 0, true ); 47 0, 0, this, 0, true );
47 showFolders->addTo( toolBar ); 48 showFolders->addTo( toolBar );
48 showFolders->addTo( mailMenu ); 49 showFolders->addTo( mailMenu );
49 connect(showFolders, SIGNAL( toggled( bool ) ), 50 connect(showFolders, SIGNAL( toggled( bool ) ),
50 SLOT( slotShowFolders( bool ) ) ); 51 SLOT( slotShowFolders( bool ) ) );
51 52
52 searchMails = new QAction( tr( "Search mails" ), ICON_SEARCHMAILS, 53 searchMails = new QAction( tr( "Search mails" ), ICON_SEARCHMAILS,
53 0, 0, this ); 54 0, 0, this );
54 searchMails->addTo( toolBar ); 55 searchMails->addTo( toolBar );
55 searchMails->addTo( mailMenu ); 56 searchMails->addTo( mailMenu );
56 57
57 58
58 editSettings = new QAction( tr( "Edit settings" ), ICON_EDITSETTINGS, 59 editSettings = new QAction( tr( "Edit settings" ), ICON_EDITSETTINGS,
59 0, 0, this ); 60 0, 0, this );
60 editSettings->addTo( settingsMenu ); 61 editSettings->addTo( settingsMenu );
61 62
62 editAccounts = new QAction( tr( "Configure accounts" ), ICON_EDITACCOUNTS, 63 editAccounts = new QAction( tr( "Configure accounts" ), ICON_EDITACCOUNTS,
63 0, 0, this ); 64 0, 0, this );
64 editAccounts->addTo( settingsMenu ); 65 editAccounts->addTo( settingsMenu );
65 66
66 QVBox *view = new QVBox( this ); 67 QVBox *view = new QVBox( this );
67 setCentralWidget( view ); 68 setCentralWidget( view );
68 69
69 folderView = new AccountView( view ); 70 folderView = new AccountView( view );
70 folderView->header()->hide(); 71 folderView->header()->hide();
71 folderView->setMinimumHeight( 90 ); 72 folderView->setMinimumHeight( 90 );
72 folderView->setMaximumHeight( 90 ); 73 folderView->setMaximumHeight( 90 );
@@ -77,73 +78,78 @@ MainWindow::MainWindow( QWidget *parent, const char *name, WFlags flags )
77 mailView->setMinimumHeight( 50 ); 78 mailView->setMinimumHeight( 50 );
78 mailView->addColumn( tr( "Subject" ),QListView::Manual ); 79 mailView->addColumn( tr( "Subject" ),QListView::Manual );
79 mailView->addColumn( tr( "Sender" ),QListView::Manual ); 80 mailView->addColumn( tr( "Sender" ),QListView::Manual );
80 mailView->addColumn( tr( "Date" )); 81 mailView->addColumn( tr( "Date" ));
81 mailView->setAllColumnsShowFocus(true); 82 mailView->setAllColumnsShowFocus(true);
82 mailView->setSorting(-1); 83 mailView->setSorting(-1);
83 connect( mailView, SIGNAL( clicked( QListViewItem * ) ),this, 84 connect( mailView, SIGNAL( clicked( QListViewItem * ) ),this,
84 SLOT( displayMail( QListViewItem * ) ) ); 85 SLOT( displayMail( QListViewItem * ) ) );
85 86
86 connect(folderView,SIGNAL(refreshMailview(Maillist*)),this,SLOT(refreshMailView(Maillist*))); 87 connect(folderView,SIGNAL(refreshMailview(Maillist*)),this,SLOT(refreshMailView(Maillist*)));
87 88
88 QTimer::singleShot( 1000, this, SLOT( slotAdjustColumns() ) ); 89 QTimer::singleShot( 1000, this, SLOT( slotAdjustColumns() ) );
89} 90}
90 91
91void MainWindow::slotAdjustColumns() 92void MainWindow::slotAdjustColumns()
92{ 93{
93 bool hidden = folderView->isHidden(); 94 bool hidden = folderView->isHidden();
94 if ( hidden ) folderView->show(); 95 if ( hidden ) folderView->show();
95 folderView->setColumnWidth( 0, folderView->visibleWidth() ); 96 folderView->setColumnWidth( 0, folderView->visibleWidth() );
96 if ( hidden ) folderView->hide(); 97 if ( hidden ) folderView->hide();
97 98
98 mailView->setColumnWidth( 0, mailView->visibleWidth() - 130 ); 99 mailView->setColumnWidth( 0, mailView->visibleWidth() - 130 );
99 mailView->setColumnWidth( 1, 80 ); 100 mailView->setColumnWidth( 1, 80 );
100 mailView->setColumnWidth( 2, 50 ); 101 mailView->setColumnWidth( 2, 50 );
101} 102}
102 103
103void MainWindow::slotShowFolders( bool show ) 104void MainWindow::slotShowFolders( bool show )
104{ 105{
105 qDebug( "Show Folders" ); 106 qDebug( "Show Folders" );
106 if ( show && folderView->isHidden() ) { 107 if ( show && folderView->isHidden() ) {
107 qDebug( "-> showing" ); 108 qDebug( "-> showing" );
108 folderView->show(); 109 folderView->show();
109 } else if ( !show && !folderView->isHidden() ) { 110 } else if ( !show && !folderView->isHidden() ) {
110 qDebug( "-> hiding" ); 111 qDebug( "-> hiding" );
111 folderView->hide(); 112 folderView->hide();
112 } 113 }
113} 114}
114 115
115void MainWindow::refreshMailView(Maillist*list) 116void MainWindow::refreshMailView(Maillist*list)
116{ 117{
117 MailListViewItem*item = 0; 118 MailListViewItem*item = 0;
118 mailView->clear(); 119 mailView->clear();
119#if 0 120#if 0
120 QFont f = mailView->getFont(); 121 QFont f = mailView->getFont();
121 QFont bf = f; 122 QFont bf = f;
122#endif 123#endif
123 for (unsigned int i = 0; i < list->count();++i) { 124 for (unsigned int i = 0; i < list->count();++i) {
124 item = new MailListViewItem(mailView,item); 125 item = new MailListViewItem(mailView,item);
125 item->storeData(*(list->at(i))); 126 item->storeData(*(list->at(i)));
126 item->showEntry(); 127 item->showEntry();
127#if 0 128#if 0
128 if (!list->at(i)->getFlags().testBit(FLAG_SEEN)) { 129 if (!list->at(i)->getFlags().testBit(FLAG_SEEN)) {
129 item->setFont(bf); 130 item->setFont(bf);
130 } 131 }
131#endif 132#endif
132 } 133 }
133} 134}
134void MainWindow::displayMail(QListViewItem*item) 135void MainWindow::displayMail(QListViewItem*item)
135{ 136{
136 if (!item) return; 137 if (!item) return;
137 qDebug("View mail"); 138 qDebug("View mail");
138 RecMail mail = ((MailListViewItem*)item)->data(); 139 RecMail mail = ((MailListViewItem*)item)->data();
139 QString body = folderView->fetchBody(mail); 140 QString body = folderView->fetchBody(mail);
140 141
141 qDebug(body); 142 ViewMail readMail( this );
143 readMail.setMailInfo( mail.getFrom(), "", mail.getSubject(), "", "", body );
144 readMail.showMaximized();
145 readMail.exec();
146
147 qDebug(body );
142} 148}
143 149
144void MailListViewItem::showEntry() 150void MailListViewItem::showEntry()
145{ 151{
146 setText(0,mail_data.getSubject()); 152 setText(0,mail_data.getSubject());
147 setText(1,mail_data.getFrom()); 153 setText(1,mail_data.getFrom());
148 setText(2,mail_data.getDate()); 154 setText(2,mail_data.getDate());
149} 155}
diff --git a/noncore/net/mail/viewmail.cpp b/noncore/net/mail/viewmail.cpp
new file mode 100644
index 0000000..b648b34
--- a/dev/null
+++ b/noncore/net/mail/viewmail.cpp
@@ -0,0 +1,216 @@
1#include <qtextbrowser.h>
2#include <qmessagebox.h>
3#include <qaction.h>
4#include <qapplication.h>
5
6//#include "mailfactory.h"
7//#include "composer.h"
8#include "viewmail.h"
9
10AttachItem::AttachItem(QListView *parent, AttachItemStore &attachItemStore)
11 : QListViewItem(parent), _attachItemStore(attachItemStore)
12{
13 setText(0, _attachItemStore.mimeType());
14 setText(1, _attachItemStore.fileName());
15 setText(2, _attachItemStore.description());
16}
17
18AttachItem::AttachItem(QListViewItem *parent, AttachItemStore &attachItemStore)
19 : QListViewItem(parent), _attachItemStore(attachItemStore)
20{
21 setText(0, _attachItemStore.mimeType());
22 setText(1, _attachItemStore.fileName());
23 setText(2, _attachItemStore.description());
24}
25
26void ViewMail::setMailInfo( const QString & from, const QString & to, const QString & subject, const QString & cc, const QString & bcc, const QString & bodytext ) {
27
28m_mail[0] = from;
29m_mail[1] = to;
30m_mail[2] = subject;
31m_mail[3] = cc;
32m_mail[4] = bcc;
33m_mail[5] = bodytext;
34
35setText();
36
37}
38
39
40ViewMail::ViewMail( QWidget *parent, const char *name, WFlags fl)
41 : ViewMailBase(parent, name, fl), _inLoop(false)
42{
43 _gotBody = false;
44
45 connect(reply, SIGNAL(activated()), SLOT(slotReply()));
46 connect(forward, SIGNAL(activated()), SLOT(slotForward()));
47
48 attachments->setEnabled(_gotBody);
49
50 //_handler->iUid("FETCH", QString("%1 (BODY[1])").arg(mail.uid()));
51 //connect(_handler, SIGNAL(gotResponse(IMAPResponse &)), SLOT(slotIMAPUid(IMAPResponse &)));
52}
53
54void ViewMail::setText()
55{
56
57 setCaption( caption().arg( m_mail[0] ) );
58
59 _mailHtml = tr(
60 "<html><body>"
61 "<div align=center><b>%1</b></div>"
62 "<b>From:</b> %2<br>"
63 "<b>To:</b> %3<br>"
64 "%4"
65 "%5"
66 "<b>Date:</b> %6<hr>"
67 "<font face=fixed>%7</font>")
68 .arg( deHtml( m_mail[2] ) )
69 .arg( deHtml( m_mail[0] ) )
70 .arg( deHtml( m_mail[1] ) )
71 .arg( tr("<b>Cc:</b> %1<br>").arg( deHtml( m_mail[3] ) ) )
72 .arg( tr("<b>Bcc:</b> %1<br>").arg( deHtml( m_mail[4] ) ) )
73 .arg( tr("(no date)" ) )
74 .arg("%1");
75 browser->setText( QString(_mailHtml) + deHtml( m_mail[5] ) );
76}
77
78
79
80ViewMail::~ViewMail()
81{
82 hide();
83}
84
85void ViewMail::hide()
86{
87 QWidget::hide();
88
89 if (_inLoop) {
90 _inLoop = false;
91 qApp->exit_loop();
92 }
93}
94
95void ViewMail::exec()
96{
97 show();
98
99 if (!_inLoop) {
100 _inLoop = true;
101 qApp->enter_loop();
102 }
103}
104
105QString ViewMail::deHtml(const QString &string)
106{
107 QString string_ = string;
108 string_.replace(QRegExp("&"), "&amp;");
109 string_.replace(QRegExp("<"), "&lt;");
110 string_.replace(QRegExp(">"), "&gt;");
111 string_.replace(QRegExp("\\n"), "<br>");
112 return string_;
113}
114
115void ViewMail::slotReply()
116{
117 if (!_gotBody) {
118 QMessageBox::information(this, tr("Error"), tr("<p>The mail body is not yet downloaded, so you cannot reply yet."), tr("Ok"));
119 return;
120 }
121
122 QString rtext;
123 // rtext += QString("* %1 wrote on %2:\n") // no i18n on purpose
124 // .arg(_mail.envelope().from()[0].toString())
125 // .arg(_mail.envelope().mailDate());
126
127 //QString text = _mail.bodyPart(1).data();
128 //QStringList lines = QStringList::split(QRegExp("\\n"), text);
129 QStringList::Iterator it;
130 //for (it = lines.begin(); it != lines.end(); it++) {
131 // rtext += "> " + *it + "\n";
132 //}
133 rtext += "\n";
134
135 QString prefix;
136 //if (_mail.envelope().subject().find(QRegExp("^Re: *$")) != -1) prefix = "";
137 // else prefix = "Re: "; // no i18n on purpose
138
139 //SendMail sendMail;
140 //sendMail.setTo(_mail.envelope().from()[0].toString());
141 //sendMail.setSubject(prefix + _mail.envelope().subject());
142 //sendMail.setInReplyTo(_mail.envelope().messageId());
143 //sendMail.setMessage(rtext);
144
145 //Composer composer(this, 0, true);
146 //composer.setSendMail(sendMail);
147 //composer.showMaximized();
148 //composer.exec();
149}
150
151void ViewMail::slotForward()
152{
153 if (!_gotBody) {
154 QMessageBox::information(this, tr("Error"), tr("<p>The mail body is not yet downloaded, so you cannot forward yet."), tr("Ok"));
155 return;
156 }
157
158 QString ftext;
159 /*ftext += QString("\n----- Forwarded message from %1 -----\n\n")
160 .arg(_mail.envelope().from()[0].toString());
161 if (!_mail.envelope().mailDate().isNull())
162 ftext += QString("Date: %1\n")
163 .arg(_mail.envelope().mailDate());
164 if (!_mail.envelope().from()[0].toString().isNull())
165 ftext += QString("From: %1\n")
166 .arg(_mail.envelope().from()[0].toString());
167 if (!_mail.envelope().to().toString().isNull())
168 ftext += QString("To: %1\n")
169 .arg(_mail.envelope().to().toString());
170 if (!_mail.envelope().cc().toString().isNull())
171 ftext += QString("Cc: %1\n")
172 .arg(_mail.envelope().cc().toString());
173 if (!_mail.envelope().bcc().toString().isNull())
174 ftext += QString("Bcc: %1\n")
175 .arg(_mail.envelope().bcc().toString());
176 if (!_mail.envelope().subject().isNull())
177 ftext += QString("Subject: %1\n")
178 .arg(_mail.envelope().subject());
179
180 ftext += QString("\n%1\n")
181 .arg(_mail.bodyPart(1).data());
182
183 ftext += QString("----- End forwarded message -----\n");
184*/
185/*
186 SendMail sendMail;
187 sendMail.setSubject("Fwd: " + _mail.envelope().subject());
188 sendMail.setMessage(ftext);
189
190 Composer composer(this, 0, true);
191 composer.setSendMail(sendMail);
192 composer.showMaximized();
193 composer.exec();
194*/
195}
196
197/*
198void ViewMail::slotIMAPUid(IMAPResponse &response)
199{
200 disconnect(_handler, SIGNAL(gotResponse(IMAPResponse &)), this, SLOT(slotIMAPUid(IMAPResponse &)));
201
202 if (response.statusResponse().status() == IMAPResponseEnums::OK) {
203 QValueList<IMAPResponseBodyPart> bodyParts;
204 bodyParts.append(response.FETCH()[0].bodyPart(0));
205 _mail.setBodyParts(bodyParts);
206
207 browser->setText(QString(_mailHtml).arg(deHtml(response.FETCH()[0].bodyPart(0).data())));
208
209 // fillList(response.FETCH()[0].bodyStructure());
210
211 _gotBody = true;
212 } else {
213 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"));
214 }
215}
216*/
diff --git a/noncore/net/mail/viewmail.h b/noncore/net/mail/viewmail.h
new file mode 100644
index 0000000..9d3c6e4
--- a/dev/null
+++ b/noncore/net/mail/viewmail.h
@@ -0,0 +1,75 @@
1#ifndef VIEWMAIL_H
2#define VIEWMAIL_H
3
4#include <qlistview.h>
5#include <qmap.h>
6
7#include "viewmailbase.h"
8//#include "imapresponse.h"
9//#include "mailtable.h"
10
11class AttachItemStore
12{
13public:
14 void setMimeType(QString mimeType) { _mimeType = mimeType; }
15 QString mimeType() { return _mimeType; }
16 void setFileName(QString fileName) { _fileName = fileName; }
17 QString fileName() { return _fileName; }
18 void setDescription(QString description) { _description = description; }
19 QString description() { return _description; }
20 void setPartNum(QString partNum) { _partNum = partNum; }
21 QString partNum() { return _partNum; }
22
23private:
24 QString _mimeType, _fileName, _description, _partNum;
25
26};
27
28class AttachItem : public QListViewItem
29{
30public:
31 AttachItem(QListView *parent, AttachItemStore &attachment);
32 AttachItem(QListViewItem *parent, AttachItemStore &attachment);
33
34 AttachItemStore attachItemStore() { return _attachItemStore; }
35
36private:
37 AttachItemStore _attachItemStore;
38
39};
40
41class ViewMail : public ViewMailBase
42{
43 Q_OBJECT
44
45public:
46 ViewMail( QWidget *parent = 0, const char *name = 0, WFlags fl = Qt::WType_Modal);
47 ~ViewMail();
48
49 void hide();
50 void exec();
51 static QString appName() { return QString::fromLatin1("mail"); }
52 void setMailInfo( const QString & from, const QString & to, const QString & subject, const QString & cc, const QString & bcc, const QString & bodytext );
53
54protected:
55 //void fillList(IMAPResponseBODYSTRUCTURE &structure);
56 QString deHtml(const QString &string);
57
58protected slots:
59 void slotReply();
60 void slotForward();
61 void setText();
62
63 //void slotIMAPUid(IMAPResponse &response);
64
65private:
66 bool _inLoop;
67 //IMAPResponseFETCH _mail;
68 //IMAPHandler *_handler;
69 QString _mailHtml;
70 bool _gotBody;
71 QMap <int,QString> m_mail;
72
73};
74
75#endif
diff --git a/noncore/net/mail/viewmailbase.cpp b/noncore/net/mail/viewmailbase.cpp
new file mode 100644
index 0000000..197a665
--- a/dev/null
+++ b/noncore/net/mail/viewmailbase.cpp
@@ -0,0 +1,75 @@
1#include <qtextbrowser.h>
2#include <qlistview.h>
3#include <qaction.h>
4#include <qlabel.h>
5#include <qvbox.h>
6#include <qpopupmenu.h>
7
8#include <qpe/qpetoolbar.h>
9#include <qmenubar.h>
10#include <qpe/resource.h>
11
12#include "viewmailbase.h"
13//#include "opendiag.h"
14
15ViewMailBase::ViewMailBase(QWidget *parent, const char *name, WFlags fl)
16 : QMainWindow(parent, name, fl)
17{
18 setCaption(tr("E-Mail by %1"));
19 setToolBarsMovable(false);
20
21 toolbar = new QToolBar(this);
22 menubar = new QMenuBar( toolbar );
23 mailmenu = new QPopupMenu( menubar );
24 menubar->insertItem( tr( "Mail" ), mailmenu );
25
26 toolbar->setHorizontalStretchable(true);
27 addToolBar(toolbar);
28
29 QLabel *spacer = new QLabel(toolbar);
30 spacer->setBackgroundMode(QWidget::PaletteButton);
31 toolbar->setStretchableWidget(spacer);
32
33 reply = new QAction(tr("Reply"), QIconSet(Resource::loadPixmap("mail/reply")), 0, 0, this);
34 reply->addTo(toolbar);
35 reply->addTo(mailmenu);
36
37 forward = new QAction(tr("Forward"), QIconSet(Resource::loadPixmap("mail/forward")), 0, 0, this);
38 forward->addTo(toolbar);
39 forward->addTo(mailmenu);
40
41 attachbutton = new QAction(tr("Attachments"), QIconSet(Resource::loadPixmap("mail/attach")), 0, 0, this, 0, true);
42 attachbutton->addTo(toolbar);
43 attachbutton->addTo(mailmenu);
44 connect(attachbutton, SIGNAL(toggled(bool)), SLOT(slotChangeAttachview(bool)));
45
46 deleteMail = new QAction(tr("Delete Mail"), QIconSet(Resource::loadPixmap("mail/delete")), 0, 0, this);
47 deleteMail->addTo(toolbar);
48 deleteMail->addTo(mailmenu);
49
50 QVBox *view = new QVBox(this);
51 setCentralWidget(view);
52
53 attachments = new QListView(view);
54 attachments->setMinimumHeight(90);
55 attachments->setMaximumHeight(90);
56 attachments->setAllColumnsShowFocus(true);
57 attachments->addColumn("Mime Type", 100);
58 attachments->addColumn("Filename", 100);
59 attachments->addColumn("Description", 100);
60 attachments->hide();
61
62 browser = new QTextBrowser(view);
63
64 //openDiag = new OpenDiag(view);
65 //openDiag->hide();
66
67}
68
69void ViewMailBase::slotChangeAttachview(bool state)
70{
71 if (state) attachments->show();
72 else attachments->hide();
73}
74
75
diff --git a/noncore/net/mail/viewmailbase.h b/noncore/net/mail/viewmailbase.h
new file mode 100644
index 0000000..898522e
--- a/dev/null
+++ b/noncore/net/mail/viewmailbase.h
@@ -0,0 +1,36 @@
1#ifndef VIEWMAILBASE_H
2#define VIEWMAILBASE_H
3
4#include <qmainwindow.h>
5
6class QAction;
7class OpenDiag;
8class QListView;
9class QToolBar;
10class QTextBrowser;
11class QMenuBar;
12class QPopupMenu;
13
14class ViewMailBase : public QMainWindow
15{
16 Q_OBJECT
17
18public:
19 ViewMailBase(QWidget *parent = 0, const char *name = 0, WFlags fl = 0);
20
21protected:
22 QAction *reply, *forward, *attachbutton, *deleteMail;
23 QListView *attachments;
24 QToolBar *toolbar;
25 QTextBrowser *browser;
26 OpenDiag *openDiag;
27 QMenuBar *menubar;
28 QPopupMenu *mailmenu;
29
30protected slots:
31 void slotChangeAttachview(bool state);
32
33};
34
35#endif
36