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.cpp6
1 files changed, 3 insertions, 3 deletions
diff --git a/noncore/unsupported/mailit/readmail.cpp b/noncore/unsupported/mailit/readmail.cpp
index 4954f34..2011ecf 100644
--- a/noncore/unsupported/mailit/readmail.cpp
+++ b/noncore/unsupported/mailit/readmail.cpp
@@ -11,117 +11,117 @@
11** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE 11** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE
12** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. 12** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
13** 13**
14** See http://www.trolltech.com/gpl/ for GPL licensing information. 14** See http://www.trolltech.com/gpl/ for GPL licensing information.
15** 15**
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 <qmime.h> 22#include <qmime.h>
23#include <qaction.h> 23#include <qaction.h>
24#include "resource.h" 24#include "resource.h"
25 25
26ReadMail::ReadMail( QWidget* parent, const char* name, WFlags fl ) 26ReadMail::ReadMail( QWidget* parent, const char* name, WFlags fl )
27 : QMainWindow(parent, name, fl) 27 : QMainWindow(parent, name, fl)
28{ 28{
29 plainTxt = FALSE; 29 plainTxt = FALSE;
30 30
31 init(); 31 init();
32 viewAtt = new ViewAtt(0, "View Attatchments"); 32 viewAtt = new ViewAtt(0, "View Attatchments");
33} 33}
34 34
35ReadMail::~ReadMail() 35ReadMail::~ReadMail()
36{ 36{
37 delete emailView->mimeSourceFactory(); 37 delete emailView->mimeSourceFactory();
38 delete viewAtt; 38 delete viewAtt;
39} 39}
40 40
41void ReadMail::init() 41void ReadMail::init()
42{ 42{
43 setToolBarsMovable(FALSE); 43 setToolBarsMovable(FALSE);
44 44
45 bar = new QToolBar(this); 45 bar = new QToolBar(this);
46 bar->setHorizontalStretchable( TRUE ); 46 bar->setHorizontalStretchable( TRUE );
47 47
48 menu = new QMenuBar( bar ); 48 menu = new QMenuBar( bar );
49 49
50 viewMenu = new QPopupMenu(menu); 50 viewMenu = new QPopupMenu(menu);
51 menu->insertItem( tr( "&View" ), viewMenu); 51 menu->insertItem( tr( "&View" ), viewMenu);
52 52
53 mailMenu = new QPopupMenu(menu); 53 mailMenu = new QPopupMenu(menu);
54 menu->insertItem( tr( "&Mail" ), mailMenu); 54 menu->insertItem( tr( "&Mail" ), mailMenu);
55 55
56 bar = new QToolBar(this); 56 bar = new QToolBar(this);
57 57
58 //reply dependant on viewing inbox 58 //reply dependant on viewing inbox
59 replyButton = new QAction( tr( "Reply" ), Resource::loadPixmap( "pass" ), 59 replyButton = new QAction( tr( "Reply" ), Resource::loadPixmap( "mailit/reply" ),
60 QString::null, 0, this, 0 ); 60 QString::null, 0, this, 0 );
61 connect(replyButton, SIGNAL(activated()), this, SLOT(reply()) ); 61 connect(replyButton, SIGNAL(activated()), this, SLOT(reply()) );
62 62
63 previousButton = new QAction( tr( "Previous" ), Resource::loadPixmap( "back" ), QString::null, 0, this, 0 ); 63 previousButton = new QAction( tr( "Previous" ), Resource::loadPixmap( "back" ), QString::null, 0, this, 0 );
64 connect( previousButton, SIGNAL( activated() ), this, SLOT( previous() ) ); 64 connect( previousButton, SIGNAL( activated() ), this, SLOT( previous() ) );
65 previousButton->addTo(bar); 65 previousButton->addTo(bar);
66 previousButton->addTo(viewMenu); 66 previousButton->addTo(viewMenu);
67 67
68 nextButton = new QAction( tr( "Next" ), Resource::loadPixmap( "forward" ), QString::null, 0, this, 0 ); 68 nextButton = new QAction( tr( "Next" ), Resource::loadPixmap( "forward" ), QString::null, 0, this, 0 );
69 connect( nextButton, SIGNAL( activated() ), this, SLOT( next() ) ); 69 connect( nextButton, SIGNAL( activated() ), this, SLOT( next() ) );
70 nextButton->addTo(bar); 70 nextButton->addTo(bar);
71 nextButton->addTo(viewMenu); 71 nextButton->addTo(viewMenu);
72 72
73 attatchmentsButton = new QAction( tr( "Attatchments" ), Resource::loadPixmap( "fileopen" ), QString::null, 0, this, 0 ); 73 attatchmentsButton = new QAction( tr( "Attatchments" ), Resource::loadPixmap( "mailit/attach" ), QString::null, 0, this, 0 );
74 connect( attatchmentsButton, SIGNAL( activated() ), this, 74 connect( attatchmentsButton, SIGNAL( activated() ), this,
75 SLOT( viewAttatchments() ) ); 75 SLOT( viewAttatchments() ) );
76 attatchmentsButton->addTo(bar); 76 attatchmentsButton->addTo(bar);
77 attatchmentsButton->addTo(viewMenu); 77 attatchmentsButton->addTo(viewMenu);
78 78
79 plainTextButton = new QAction( tr( "Text Format" ), Resource::loadPixmap( "new" ), QString::null, 0, this, 0, TRUE); 79 plainTextButton = new QAction( tr( "Text Format" ), Resource::loadPixmap( "DocsIcon" ), QString::null, 0, this, 0, TRUE);
80 connect( plainTextButton, SIGNAL( activated() ), this, SLOT( shiftText() ) ); 80 connect( plainTextButton, SIGNAL( activated() ), this, SLOT( shiftText() ) );
81 plainTextButton->addTo(bar); 81 plainTextButton->addTo(bar);
82 plainTextButton->addTo(viewMenu); 82 plainTextButton->addTo(viewMenu);
83 83
84 deleteButton = new QAction( tr( "Delete" ), Resource::loadPixmap( "trash" ), QString::null, 0, this, 0 ); 84 deleteButton = new QAction( tr( "Delete" ), Resource::loadPixmap( "trash" ), QString::null, 0, this, 0 );
85 connect( deleteButton, SIGNAL( activated() ), this, SLOT( deleteItem() ) ); 85 connect( deleteButton, SIGNAL( activated() ), this, SLOT( deleteItem() ) );
86 deleteButton->addTo(bar); 86 deleteButton->addTo(bar);
87 deleteButton->addTo(mailMenu); 87 deleteButton->addTo(mailMenu);
88 88
89 viewMenu->insertItem(Resource::loadPixmap("close"), "Close", this, SLOT(close())); 89 viewMenu->insertItem(Resource::loadPixmap("close"), "Close", this, SLOT(close()));
90 90
91 emailView = new QTextView( this, "emailView" ); 91 emailView = new QTextView( this, "emailView" );
92 setCentralWidget(emailView); 92 setCentralWidget(emailView);
93 93
94 mime = new QMimeSourceFactory(); 94 mime = new QMimeSourceFactory();
95 emailView->setMimeSourceFactory(mime); 95 emailView->setMimeSourceFactory(mime);
96} 96}
97 97
98void ReadMail::updateView() 98void ReadMail::updateView()
99{ 99{
100 Enclosure *ePtr; 100 Enclosure *ePtr;
101 QString mailStringSize; 101 QString mailStringSize;
102 QString text, temp; 102 QString text, temp;
103 103
104 mail->read = TRUE; //mark as read 104 mail->read = TRUE; //mark as read
105 inbox = mail->received; 105 inbox = mail->received;
106 106
107 replyButton->removeFrom(mailMenu); 107 replyButton->removeFrom(mailMenu);
108 replyButton->removeFrom(bar); 108 replyButton->removeFrom(bar);
109 109
110 if (inbox == TRUE) { 110 if (inbox == TRUE) {
111 replyButton->addTo(bar); 111 replyButton->addTo(bar);
112 replyButton->addTo(mailMenu); 112 replyButton->addTo(mailMenu);
113 113
114 if (!mail->downloaded) { 114 if (!mail->downloaded) {
115 //report currently viewed mail so that it will be 115 //report currently viewed mail so that it will be
116 //placed first in the queue of new mails to download 116 //placed first in the queue of new mails to download
117 emit viewingMail(mail); 117 emit viewingMail(mail);
118 118
119 double mailSize = (double) mail->size; 119 double mailSize = (double) mail->size;
120 if (mailSize < 1024) { 120 if (mailSize < 1024) {
121 mailStringSize.setNum(mailSize); 121 mailStringSize.setNum(mailSize);
122 mailStringSize += " Bytes"; 122 mailStringSize += " Bytes";
123 } else if (mailSize < 1024*1024) { 123 } else if (mailSize < 1024*1024) {
124 mailStringSize.setNum( (mailSize / 1024), 'g', 2 ); 124 mailStringSize.setNum( (mailSize / 1024), 'g', 2 );
125 mailStringSize += " Kb"; 125 mailStringSize += " Kb";
126 } else { 126 } else {
127 mailStringSize.setNum( (mailSize / (1024*1024)), 'g', 3); 127 mailStringSize.setNum( (mailSize / (1024*1024)), 'g', 3);