summaryrefslogtreecommitdiff
path: root/noncore/unsupported/mailit/readmail.cpp
Unidiff
Diffstat (limited to 'noncore/unsupported/mailit/readmail.cpp') (more/less context) (ignore whitespace changes)
-rw-r--r--noncore/unsupported/mailit/readmail.cpp64
1 files changed, 48 insertions, 16 deletions
diff --git a/noncore/unsupported/mailit/readmail.cpp b/noncore/unsupported/mailit/readmail.cpp
index 4eae7f6..1682675 100644
--- a/noncore/unsupported/mailit/readmail.cpp
+++ b/noncore/unsupported/mailit/readmail.cpp
@@ -16,14 +16,16 @@
16** Contact info@trolltech.com if any conditions of this licensing are 16** Contact info@trolltech.com if any conditions of this licensing are
17** not clear to you. 17** not clear to you.
18** 18**
19**********************************************************************/ 19**********************************************************************/
20#include "readmail.h" 20#include "readmail.h"
21#include <qimage.h> 21#include <qimage.h>
22#include <qwhatsthis.h>
22#include <qmime.h> 23#include <qmime.h>
23#include <qaction.h> 24#include <qaction.h>
25#include <qpopupmenu.h>
24#include <qpe/resource.h> 26#include <qpe/resource.h>
25 27
26ReadMail::ReadMail( QWidget* parent, const char* name, WFlags fl ) 28ReadMail::ReadMail( QWidget* parent, const char* name, WFlags fl )
27 : QMainWindow(parent, name, fl) 29 : QMainWindow(parent, name, fl)
28{ 30{
29 plainTxt = FALSE; 31 plainTxt = FALSE;
@@ -39,12 +41,14 @@ ReadMail::~ReadMail()
39} 41}
40 42
41void ReadMail::init() 43void ReadMail::init()
42{ 44{
43 setToolBarsMovable(FALSE); 45 setToolBarsMovable(FALSE);
44 46
47 QPopupMenu* mailaction=new QPopupMenu(this);
48
45 bar = new QToolBar(this); 49 bar = new QToolBar(this);
46 bar->setHorizontalStretchable( TRUE ); 50 bar->setHorizontalStretchable( TRUE );
47 51
48 menu = new QMenuBar( bar ); 52 menu = new QMenuBar( bar );
49 53
50 viewMenu = new QPopupMenu(menu); 54 viewMenu = new QPopupMenu(menu);
@@ -52,23 +56,17 @@ void ReadMail::init()
52 56
53 mailMenu = new QPopupMenu(menu); 57 mailMenu = new QPopupMenu(menu);
54 menu->insertItem( tr( "&Mail" ), mailMenu); 58 menu->insertItem( tr( "&Mail" ), mailMenu);
55 59
56 bar = new QToolBar(this); 60 bar = new QToolBar(this);
57 61
58 //reply dependant on viewing inbox 62 downloadButton = new QAction( tr( "Download" ), Resource::loadPixmap( "mailit/download" ),QString::null, 0, this, 0 );
59 replyButton = new QAction( tr( "Reply" ), Resource::loadPixmap( "mailit/reply" ), 63 connect(downloadButton, SIGNAL(activated()), this, SLOT(download()) );
60 QString::null, 0, this, 0 ); 64 downloadButton->setWhatsThis(tr("Click here to download the selected mail"));
61 connect(replyButton, SIGNAL(activated()), this, SLOT(reply()) );
62 replyButton->setWhatsThis(tr("Click here to reply to the selected mail"));
63
64 forwardButton = new QAction( tr( "Forward" ), Resource::loadPixmap( "mailit/forward" ),
65 QString::null, 0, this, 0 );
66 connect(forwardButton, SIGNAL(activated()), this, SLOT(forward()) );
67 forwardButton->setWhatsThis(tr("Click here to forward the selected mail"));
68 65
66
69 previousButton = new QAction( tr( "Previous" ), Resource::loadPixmap( "back" ), QString::null, 0, this, 0 ); 67 previousButton = new QAction( tr( "Previous" ), Resource::loadPixmap( "back" ), QString::null, 0, this, 0 );
70 connect( previousButton, SIGNAL( activated() ), this, SLOT( previous() ) ); 68 connect( previousButton, SIGNAL( activated() ), this, SLOT( previous() ) );
71 previousButton->addTo(bar); 69 previousButton->addTo(bar);
72 previousButton->addTo(viewMenu); 70 previousButton->addTo(viewMenu);
73 previousButton->setWhatsThis(tr("Read the previous mail in the list")); 71 previousButton->setWhatsThis(tr("Read the previous mail in the list"));
74 72
@@ -91,12 +89,29 @@ void ReadMail::init()
91 plainTextButton->addTo(viewMenu); 89 plainTextButton->addTo(viewMenu);
92 plainTextButton->setWhatsThis(tr("The mail view has 2 modes:\n" 90 plainTextButton->setWhatsThis(tr("The mail view has 2 modes:\n"
93 "<LI><B>RichText</B> shows the mail as HTML with reach features (no standard line breaks)</LI>" 91 "<LI><B>RichText</B> shows the mail as HTML with reach features (no standard line breaks)</LI>"
94 "<LI><B>Plain</B> shows the mail as standard plain text</LI>" 92 "<LI><B>Plain</B> shows the mail as standard plain text</LI>"
95 "Click here to switch between those view modes" )); 93 "Click here to switch between those view modes" ));
96 94
95 //reply dependant on viewing inbox
96 replyButton = new QToolButton(Resource::loadPixmap("mailit/reply"),tr("reply"),tr("reply to mail"), this,SLOT(reply()),bar);
97 QWhatsThis::add(replyButton,tr("Click here to reply to the selected mail\nPress and hold for more options."));
98 replyButton->setPopup(mailaction);
99
100 replyAllButton = new QAction( tr( "Reply all" ), Resource::loadPixmap( "mailit/reply" ),QString::null, 0, this, 0 );
101 connect(replyAllButton, SIGNAL(activated()), this, SLOT(replyAll()));
102 replyAllButton->setWhatsThis(tr("Click here to reply to the selected mail to CC: addresses also"));
103 replyAllButton->addTo(mailaction);
104
105 forwardButton = new QAction( tr( "Forward" ), Resource::loadPixmap( "mailit/forward" ),
106 QString::null, 0, this, 0 );
107 connect(forwardButton, SIGNAL(activated()), this, SLOT(forward()));
108 forwardButton->setWhatsThis(tr("Click here to forward the selected mail"));
109 forwardButton->addTo(mailaction);
110
111
97 deleteButton = new QAction( tr( "Delete" ), Resource::loadPixmap( "trash" ), QString::null, 0, this, 0 ); 112 deleteButton = new QAction( tr( "Delete" ), Resource::loadPixmap( "trash" ), QString::null, 0, this, 0 );
98 connect( deleteButton, SIGNAL( activated() ), this, SLOT( deleteItem() ) ); 113 connect( deleteButton, SIGNAL( activated() ), this, SLOT( deleteItem() ) );
99 deleteButton->addTo(bar); 114 deleteButton->addTo(bar);
100 deleteButton->addTo(mailMenu); 115 deleteButton->addTo(mailMenu);
101 deleteButton->setWhatsThis(tr("Click here to remove the selected mail")); 116 deleteButton->setWhatsThis(tr("Click here to remove the selected mail"));
102 117
@@ -116,25 +131,32 @@ void ReadMail::updateView()
116 QString mailStringSize; 131 QString mailStringSize;
117 QString text, temp; 132 QString text, temp;
118 133
119 mail->read = TRUE; //mark as read 134 mail->read = TRUE; //mark as read
120 inbox = mail->received; 135 inbox = mail->received;
121 136
122 replyButton->removeFrom(mailMenu); 137 replyButton->setEnabled(false);
123 replyButton->removeFrom(bar); 138 /*replyButton->removeFrom(bar);
124 forwardButton->removeFrom(mailMenu); 139 forwardButton->removeFrom(mailMenu);
125 forwardButton->removeFrom(bar); 140 forwardButton->removeFrom(bar);*/
141 downloadButton->removeFrom(bar);
142
143 //downloadButton->setEnabled(!mail->downloaded);
126 144
145
127 if (inbox == TRUE) { 146 if (inbox == TRUE) {
128 replyButton->addTo(bar); 147 replyButton->setEnabled(true);
129 replyButton->addTo(mailMenu); 148 /*replyButton->addTo(mailMenu);
130 forwardButton->addTo(bar); 149 forwardButton->addTo(bar);
131 forwardButton->addTo(mailMenu); 150 forwardButton->addTo(mailMenu);*/
132 151
133 152
134 if (!mail->downloaded) { 153 if (!mail->downloaded) {
154
155 downloadButton->addTo(bar);
156
135 //report currently viewed mail so that it will be 157 //report currently viewed mail so that it will be
136 //placed first in the queue of new mails to download 158 //placed first in the queue of new mails to download
137 emit viewingMail(mail); 159 emit viewingMail(mail);
138 160
139 double mailSize = (double) mail->size; 161 double mailSize = (double) mail->size;
140 if (mailSize < 1024) { 162 if (mailSize < 1024) {
@@ -354,14 +376,24 @@ void ReadMail::viewAttachments()
354 viewAtt->update(mail, inbox); 376 viewAtt->update(mail, inbox);
355 viewAtt->showMaximized(); 377 viewAtt->showMaximized();
356} 378}
357 379
358void ReadMail::reply() 380void ReadMail::reply()
359{ 381{
382 emit replyRequested(*mail, (bool&)FALSE);
383}
384
385void ReadMail::replyAll()
386{
360 emit replyRequested(*mail, (bool&)TRUE); 387 emit replyRequested(*mail, (bool&)TRUE);
361} 388}
362 389
363void ReadMail::forward() 390void ReadMail::forward()
364{ 391{
365 emit forwardRequested(*mail); 392 emit forwardRequested(*mail);
366} 393}
367 394
395void ReadMail::download()
396{
397 emit download(mail);
398}
399