Diffstat (limited to 'noncore/net/mailit/readmail.cpp') (more/less context) (ignore whitespace changes)
-rw-r--r-- | noncore/net/mailit/readmail.cpp | 64 |
1 files changed, 48 insertions, 16 deletions
diff --git a/noncore/net/mailit/readmail.cpp b/noncore/net/mailit/readmail.cpp index 4eae7f6..1682675 100644 --- a/noncore/net/mailit/readmail.cpp +++ b/noncore/net/mailit/readmail.cpp | |||
@@ -18,10 +18,12 @@ | |||
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 | ||
26 | ReadMail::ReadMail( QWidget* parent, const char* name, WFlags fl ) | 28 | ReadMail::ReadMail( QWidget* parent, const char* name, WFlags fl ) |
27 | : QMainWindow(parent, name, fl) | 29 | : QMainWindow(parent, name, fl) |
@@ -41,8 +43,10 @@ ReadMail::~ReadMail() | |||
41 | void ReadMail::init() | 43 | void 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 ); |
@@ -54,19 +58,13 @@ void ReadMail::init() | |||
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); |
@@ -93,8 +91,25 @@ void ReadMail::init() | |||
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); |
@@ -118,21 +133,28 @@ void ReadMail::updateView() | |||
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 | ||
@@ -356,12 +378,22 @@ void ReadMail::viewAttachments() | |||
356 | } | 378 | } |
357 | 379 | ||
358 | void ReadMail::reply() | 380 | void ReadMail::reply() |
359 | { | 381 | { |
382 | emit replyRequested(*mail, (bool&)FALSE); | ||
383 | } | ||
384 | |||
385 | void ReadMail::replyAll() | ||
386 | { | ||
360 | emit replyRequested(*mail, (bool&)TRUE); | 387 | emit replyRequested(*mail, (bool&)TRUE); |
361 | } | 388 | } |
362 | 389 | ||
363 | void ReadMail::forward() | 390 | void ReadMail::forward() |
364 | { | 391 | { |
365 | emit forwardRequested(*mail); | 392 | emit forwardRequested(*mail); |
366 | } | 393 | } |
367 | 394 | ||
395 | void ReadMail::download() | ||
396 | { | ||
397 | emit download(mail); | ||
398 | } | ||
399 | |||