summaryrefslogtreecommitdiff
path: root/noncore/net/mailit/readmail.cpp
Side-by-side diff
Diffstat (limited to 'noncore/net/mailit/readmail.cpp') (more/less context) (ignore whitespace changes)
-rw-r--r--noncore/net/mailit/readmail.cpp64
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
@@ -10,71 +10,69 @@
**
** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE
** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
**
** See http://www.trolltech.com/gpl/ for GPL licensing information.
**
** Contact info@trolltech.com if any conditions of this licensing are
** not clear to you.
**
**********************************************************************/
#include "readmail.h"
#include <qimage.h>
+#include <qwhatsthis.h>
#include <qmime.h>
#include <qaction.h>
+#include <qpopupmenu.h>
#include <qpe/resource.h>
ReadMail::ReadMail( QWidget* parent, const char* name, WFlags fl )
: QMainWindow(parent, name, fl)
{
plainTxt = FALSE;
init();
viewAtt = new ViewAtt(0, "View Attatchments");
}
ReadMail::~ReadMail()
{
delete emailView->mimeSourceFactory();
delete viewAtt;
}
void ReadMail::init()
{
setToolBarsMovable(FALSE);
+ QPopupMenu* mailaction=new QPopupMenu(this);
+
bar = new QToolBar(this);
bar->setHorizontalStretchable( TRUE );
menu = new QMenuBar( bar );
viewMenu = new QPopupMenu(menu);
menu->insertItem( tr( "&View" ), viewMenu);
mailMenu = new QPopupMenu(menu);
menu->insertItem( tr( "&Mail" ), mailMenu);
bar = new QToolBar(this);
- //reply dependant on viewing inbox
- replyButton = new QAction( tr( "Reply" ), Resource::loadPixmap( "mailit/reply" ),
- QString::null, 0, this, 0 );
- connect(replyButton, SIGNAL(activated()), this, SLOT(reply()) );
- replyButton->setWhatsThis(tr("Click here to reply to the selected mail"));
-
- forwardButton = new QAction( tr( "Forward" ), Resource::loadPixmap( "mailit/forward" ),
- QString::null, 0, this, 0 );
- connect(forwardButton, SIGNAL(activated()), this, SLOT(forward()) );
- forwardButton->setWhatsThis(tr("Click here to forward the selected mail"));
+ downloadButton = new QAction( tr( "Download" ), Resource::loadPixmap( "mailit/download" ),QString::null, 0, this, 0 );
+ connect(downloadButton, SIGNAL(activated()), this, SLOT(download()) );
+ downloadButton->setWhatsThis(tr("Click here to download the selected mail"));
+
previousButton = new QAction( tr( "Previous" ), Resource::loadPixmap( "back" ), QString::null, 0, this, 0 );
connect( previousButton, SIGNAL( activated() ), this, SLOT( previous() ) );
previousButton->addTo(bar);
previousButton->addTo(viewMenu);
previousButton->setWhatsThis(tr("Read the previous mail in the list"));
nextButton = new QAction( tr( "Next" ), Resource::loadPixmap( "forward" ), QString::null, 0, this, 0 );
connect( nextButton, SIGNAL( activated() ), this, SLOT( next() ) );
nextButton->addTo(bar);
nextButton->addTo(viewMenu);
previousButton->setWhatsThis(tr("Read the next mail in the list"));
@@ -85,24 +83,41 @@ void ReadMail::init()
attachmentButton->addTo(viewMenu);
attachmentButton->setWhatsThis(tr("Click here to add attachments to your mail"));
plainTextButton = new QAction( tr( "Text Format" ), Resource::loadPixmap( "DocsIcon" ), QString::null, 0, this, 0, TRUE);
connect( plainTextButton, SIGNAL( activated() ), this, SLOT( shiftText() ) );
plainTextButton->addTo(bar);
plainTextButton->addTo(viewMenu);
plainTextButton->setWhatsThis(tr("The mail view has 2 modes:\n"
"<LI><B>RichText</B> shows the mail as HTML with reach features (no standard line breaks)</LI>"
"<LI><B>Plain</B> shows the mail as standard plain text</LI>"
"Click here to switch between those view modes" ));
+ //reply dependant on viewing inbox
+ replyButton = new QToolButton(Resource::loadPixmap("mailit/reply"),tr("reply"),tr("reply to mail"), this,SLOT(reply()),bar);
+ QWhatsThis::add(replyButton,tr("Click here to reply to the selected mail\nPress and hold for more options."));
+ replyButton->setPopup(mailaction);
+
+ replyAllButton = new QAction( tr( "Reply all" ), Resource::loadPixmap( "mailit/reply" ),QString::null, 0, this, 0 );
+ connect(replyAllButton, SIGNAL(activated()), this, SLOT(replyAll()));
+ replyAllButton->setWhatsThis(tr("Click here to reply to the selected mail to CC: addresses also"));
+ replyAllButton->addTo(mailaction);
+
+ forwardButton = new QAction( tr( "Forward" ), Resource::loadPixmap( "mailit/forward" ),
+ QString::null, 0, this, 0 );
+ connect(forwardButton, SIGNAL(activated()), this, SLOT(forward()));
+ forwardButton->setWhatsThis(tr("Click here to forward the selected mail"));
+ forwardButton->addTo(mailaction);
+
+
deleteButton = new QAction( tr( "Delete" ), Resource::loadPixmap( "trash" ), QString::null, 0, this, 0 );
connect( deleteButton, SIGNAL( activated() ), this, SLOT( deleteItem() ) );
deleteButton->addTo(bar);
deleteButton->addTo(mailMenu);
deleteButton->setWhatsThis(tr("Click here to remove the selected mail"));
viewMenu->insertItem(Resource::loadPixmap("close"), "Close", this, SLOT(close()));
emailView = new QTextView( this, "emailView" );
setCentralWidget(emailView);
@@ -110,37 +125,44 @@ void ReadMail::init()
emailView->setMimeSourceFactory(mime);
}
void ReadMail::updateView()
{
Enclosure *ePtr;
QString mailStringSize;
QString text, temp;
mail->read = TRUE; //mark as read
inbox = mail->received;
- replyButton->removeFrom(mailMenu);
- replyButton->removeFrom(bar);
+ replyButton->setEnabled(false);
+ /*replyButton->removeFrom(bar);
forwardButton->removeFrom(mailMenu);
- forwardButton->removeFrom(bar);
+ forwardButton->removeFrom(bar);*/
+ downloadButton->removeFrom(bar);
+
+ //downloadButton->setEnabled(!mail->downloaded);
+
if (inbox == TRUE) {
- replyButton->addTo(bar);
- replyButton->addTo(mailMenu);
+ replyButton->setEnabled(true);
+ /*replyButton->addTo(mailMenu);
forwardButton->addTo(bar);
- forwardButton->addTo(mailMenu);
+ forwardButton->addTo(mailMenu);*/
if (!mail->downloaded) {
+
+ downloadButton->addTo(bar);
+
//report currently viewed mail so that it will be
//placed first in the queue of new mails to download
emit viewingMail(mail);
double mailSize = (double) mail->size;
if (mailSize < 1024) {
mailStringSize.setNum(mailSize);
mailStringSize += " Bytes";
} else if (mailSize < 1024*1024) {
mailStringSize.setNum( (mailSize / 1024), 'g', 2 );
mailStringSize += " Kb";
} else {
@@ -348,20 +370,30 @@ void ReadMail::shiftText()
plainTxt = ! plainTxt;
updateView();
}
void ReadMail::viewAttachments()
{
viewAtt->update(mail, inbox);
viewAtt->showMaximized();
}
void ReadMail::reply()
{
+ emit replyRequested(*mail, (bool&)FALSE);
+}
+
+void ReadMail::replyAll()
+{
emit replyRequested(*mail, (bool&)TRUE);
}
void ReadMail::forward()
{
emit forwardRequested(*mail);
}
+void ReadMail::download()
+{
+ emit download(mail);
+}
+