summaryrefslogtreecommitdiff
path: root/noncore/unsupported/mailit
authorkergoth <kergoth>2003-08-09 17:00:23 (UTC)
committer kergoth <kergoth>2003-08-09 17:00:23 (UTC)
commitc33d5ec60361238e50a4a9d6e0eec03e396dce60 (patch) (unidiff)
tree31c0c85dc4262044db90c7918014bc45265ef420 /noncore/unsupported/mailit
parent78c296d534589835801fb6374ac9d43d44b2b1c9 (diff)
downloadopie-c33d5ec60361238e50a4a9d6e0eec03e396dce60.zip
opie-c33d5ec60361238e50a4a9d6e0eec03e396dce60.tar.gz
opie-c33d5ec60361238e50a4a9d6e0eec03e396dce60.tar.bz2
Merge from BRANCH_1_0
Diffstat (limited to 'noncore/unsupported/mailit') (more/less context) (ignore whitespace changes)
-rw-r--r--noncore/unsupported/mailit/config.in2
-rw-r--r--noncore/unsupported/mailit/popclient.cpp57
-rw-r--r--noncore/unsupported/mailit/resource.cpp136
-rw-r--r--noncore/unsupported/mailit/resource.h80
-rw-r--r--noncore/unsupported/mailit/smtpclient.cpp6
-rw-r--r--noncore/unsupported/mailit/viewatt.cpp24
6 files changed, 45 insertions, 260 deletions
diff --git a/noncore/unsupported/mailit/config.in b/noncore/unsupported/mailit/config.in
index 2b56b5f..142b840 100644
--- a/noncore/unsupported/mailit/config.in
+++ b/noncore/unsupported/mailit/config.in
@@ -1,4 +1,4 @@
1 config MAILIT 1 config MAILIT
2 boolean "mailit" 2 boolean "opie-mailit (a simple POP3 email client)"
3 default "n" 3 default "n"
4 depends ( LIBQPE || LIBQPE-X11 ) 4 depends ( LIBQPE || LIBQPE-X11 )
diff --git a/noncore/unsupported/mailit/popclient.cpp b/noncore/unsupported/mailit/popclient.cpp
index 5da3bcb..1df6b2b 100644
--- a/noncore/unsupported/mailit/popclient.cpp
+++ b/noncore/unsupported/mailit/popclient.cpp
@@ -26,24 +26,25 @@ extern "C" {
26} 26}
27 27
28#include <qcstring.h> 28#include <qcstring.h>
29 29
30PopClient::PopClient() 30PopClient::PopClient()
31{ 31{
32 32
33 socket = new QSocket(this, "popClient"); 33 socket = new QSocket(this, "popClient");
34 connect(socket, SIGNAL(error(int)), this, SLOT(errorHandling(int))); 34 connect(socket, SIGNAL(error(int)), this, SLOT(errorHandling(int)));
35 connect(socket, SIGNAL(connected()), this, SLOT(connectionEstablished())); 35 connect(socket, SIGNAL(connected()), this, SLOT(connectionEstablished()));
36 connect(socket, SIGNAL(readyRead()), this, SLOT(incomingData())); 36 connect(socket, SIGNAL(readyRead()), this, SLOT(incomingData()));
37 37
38 stream = new QTextStream(socket); 38 stream = new QTextStream(socket);
39 39
40 receiving = FALSE; 40 receiving = FALSE;
41 synchronize = FALSE; 41 synchronize = FALSE;
42 lastSync = 0; 42 lastSync = 0;
43 headerLimit = 0; 43 headerLimit = 0;
44 mailList = 0;
44 preview = FALSE; 45 preview = FALSE;
45} 46}
46 47
47PopClient::~PopClient() 48PopClient::~PopClient()
48{ 49{
49 delete socket; 50 delete socket;
@@ -53,27 +54,27 @@ PopClient::~PopClient()
53void PopClient::newConnection(const QString &target, int port) 54void PopClient::newConnection(const QString &target, int port)
54{ 55{
55 if (receiving) { 56 if (receiving) {
56 qWarning("socket in use, connection refused"); 57 qWarning("socket in use, connection refused");
57 return; 58 return;
58 } 59 }
59 60
60 status = Init; 61 status = Init;
61 62
62 socket->connectToHost(target, port); 63 socket->connectToHost(target, port);
63 receiving = TRUE; 64 receiving = TRUE;
64 //selected = FALSE; 65 //selected = FALSE;
65 66
66 emit updateStatus(tr("DNS lookup")); 67 emit updateStatus(tr("DNS lookup"));
67} 68}
68 69
69void PopClient::setAccount(const QString &popUser, const QString &popPasswd) 70void PopClient::setAccount(const QString &popUser, const QString &popPasswd)
70{ 71{
71 popUserName = popUser; 72 popUserName = popUser;
72 popPassword = popPasswd; 73 popPassword = popPasswd;
73} 74}
74 75
75void PopClient::setSynchronize(int lastCount) 76void PopClient::setSynchronize(int lastCount)
76{ 77{
77 synchronize = TRUE; 78 synchronize = TRUE;
78 lastSync = lastCount; 79 lastSync = lastCount;
79} 80}
@@ -120,86 +121,86 @@ void PopClient::incomingData()
120 int start, end; 121 int start, end;
121// char *md5Digest; 122// char *md5Digest;
122 char md5Digest[16]; 123 char md5Digest[16];
123// if ( !socket->canReadLine() ) 124// if ( !socket->canReadLine() )
124// return; 125// return;
125 126
126 127
127 response = socket->readLine(); 128 response = socket->readLine();
128 129
129 switch(status) { 130 switch(status) {
130 //logging in 131 //logging in
131 case Init: { 132 case Init: {
132#ifdef APOP_TEST 133#ifdef APOP_TEST
133 start = response.find('<',0); 134 start = response.find('<',0);
134 end = response.find('>', start); 135 end = response.find('>', start);
135 if( start >= 0 && end > start ) 136 if( start >= 0 && end > start )
136 { 137 {
137 timeStamp = response.mid( start , end - start + 1); 138 timeStamp = response.mid( start , end - start + 1);
138 md5Source = timeStamp + popPassword; 139 md5Source = timeStamp + popPassword;
139 140
140 md5_buffer( (char const *)md5Source, md5Source.length(),&md5Digest[0]); 141 md5_buffer( (char const *)md5Source, md5Source.length(),&md5Digest[0]);
141 142
142 for(int j =0;j < MD5_DIGEST_LENGTH ;j++) 143 for(int j =0;j < MD5_DIGEST_LENGTH ;j++)
143 { 144 {
144 printf("%x", md5Digest[j]); 145 printf("%x", md5Digest[j]);
145 } 146 }
146 printf("\n"); 147 printf("\n");
147// qDebug(md5Digest); 148// qDebug(md5Digest);
148 *stream << "APOP " << popUserName << " " << md5Digest << "\r\n"; 149 *stream << "APOP " << popUserName << " " << md5Digest << "\r\n";
149 // qDebug("%s", stream); 150 // qDebug("%s", stream);
150 status = Stat; 151 status = Stat;
151 } 152 }
152 else 153 else
153#endif 154#endif
154 { 155 {
155 timeStamp = ""; 156 timeStamp = "";
156 *stream << "USER " << popUserName << "\r\n"; 157 *stream << "USER " << popUserName << "\r\n";
157 status = Pass; 158 status = Pass;
158 } 159 }
159 160
160 break; 161 break;
161 } 162 }
162 163
163 case Pass: { 164 case Pass: {
164 *stream << "PASS " << popPassword << "\r\n"; 165 *stream << "PASS " << popPassword << "\r\n";
165 status = Stat; 166 status = Stat;
166 167
167 break; 168 break;
168 } 169 }
169 //ask for number of messages 170 //ask for number of messages
170 case Stat: { 171 case Stat: {
171 if (response[0] == '+') { 172 if (response[0] == '+') {
172 *stream << "STAT" << "\r\n"; 173 *stream << "STAT" << "\r\n";
173 status = Mcnt; 174 status = Mcnt;
174 } else errorHandlingWithMsg(ErrLoginFailed, response); 175 } else errorHandlingWithMsg(ErrLoginFailed, response);
175 break; 176 break;
176 } 177 }
177 //get count of messages, eg "+OK 4 900.." -> int 4 178 //get count of messages, eg "+OK 4 900.." -> int 4
178 case Mcnt: { 179 case Mcnt: {
179 if (response[0] == '+') { 180 if (response[0] == '+') {
180 temp = response.replace(0, 4, ""); 181 temp = response.replace(0, 4, "");
181 int x = temp.find(" ", 0); 182 int x = temp.find(" ", 0);
182 temp.truncate((uint) x); 183 temp.truncate((uint) x);
183 newMessages = temp.toInt(); 184 newMessages = temp.toInt();
184 messageCount = 1; 185 messageCount = 1;
185 status = List; 186 status = List;
186 187
187 if (synchronize) { 188 if (synchronize) {
188 //messages deleted from server, reload all 189 //messages deleted from server, reload all
189 if (newMessages < lastSync) 190 if (newMessages < lastSync)
190 lastSync = 0; 191 lastSync = 0;
191 messageCount = 1; 192 messageCount = 1;
192 } 193 }
193 194
194 if (selected) { 195 if (selected && mailList ) {
195 int *ptr = mailList->first(); 196 int *ptr = mailList->first();
196 if (ptr != 0) { 197 if (ptr != 0) {
197 newMessages++; //to ensure no early jumpout 198 newMessages++; //to ensure no early jumpout
198 messageCount = *ptr; 199 messageCount = *ptr;
199 } else newMessages = 0; 200 } else newMessages = 0;
200 } 201 }
201 202
202 } else errorHandlingWithMsg(ErrUnknownResponse, response); 203 } else errorHandlingWithMsg(ErrUnknownResponse, response);
203 } 204 }
204 //Read message number x, count upwards to messageCount 205 //Read message number x, count upwards to messageCount
205 case List: { 206 case List: {
@@ -221,43 +222,43 @@ void PopClient::incomingData()
221 } 222 }
222 break; 223 break;
223 } else { 224 } else {
224 emit updateStatus(tr("No new Messages")); 225 emit updateStatus(tr("No new Messages"));
225 status = Quit; 226 status = Quit;
226 } 227 }
227 } 228 }
228 //get size of message, eg "500 characters in message.." -> int 500 229 //get size of message, eg "500 characters in message.." -> int 500
229 case Size: { 230 case Size: {
230 if (status != Quit) { //because of idiotic switch 231 if (status != Quit) { //because of idiotic switch
231 if (response[0] == '+') { 232 if (response[0] == '+') {
232 temp = response.replace(0, 4, ""); 233 temp = response.replace(0, 4, "");
233 int x = temp.find(" ", 0); 234 int x = temp.find(" ", 0);
234 temp = temp.right(temp.length() - ((uint) x + 1) ); 235 temp = temp.right(temp.length() - ((uint) x + 1) );
235 mailSize = temp.toInt(); 236 mailSize = temp.toInt();
236 emit currentMailSize(mailSize); 237 emit currentMailSize(mailSize);
237 238
238 status = Retr; 239 status = Retr;
239 } else { 240 } else {
240 //qWarning(response); 241 //qWarning(response);
241 errorHandlingWithMsg(ErrUnknownResponse, response); 242 errorHandlingWithMsg(ErrUnknownResponse, response);
242 } 243 }
243 } 244 }
244 } 245 }
245 //Read message number x, count upwards to messageCount 246 //Read message number x, count upwards to messageCount
246 case Retr: { 247 case Retr: {
247 if (status != Quit) { 248 if (status != Quit) {
248 if ((selected)||(mailSize <= headerLimit)) 249 if ((selected)||(mailSize <= headerLimit))
249 { 250 {
250 *stream << "RETR " << messageCount << "\r\n"; 251 *stream << "RETR " << messageCount << "\r\n";
251 } else { //only header 252 } else { //only header
252 *stream << "TOP " << messageCount << " 0\r\n"; 253 *stream << "TOP " << messageCount << " 0\r\n";
253 } 254 }
254 messageCount++; 255 messageCount++;
255 status = Ignore; 256 status = Ignore;
256 break; 257 break;
257 } } 258 } }
258 case Ignore: { 259 case Ignore: {
259 if (status != Quit) { //because of idiotic switch 260 if (status != Quit) { //because of idiotic switch
260 if (response[0] == '+') { 261 if (response[0] == '+') {
261 message = ""; 262 message = "";
262 status = Read; 263 status = Read;
263 if (!socket->canReadLine()) //sync. problems 264 if (!socket->canReadLine()) //sync. problems
@@ -283,29 +284,29 @@ void PopClient::incomingData()
283 if ( (selected)||(mailSize <= headerLimit)) //mail size limit is not used if late download is active 284 if ( (selected)||(mailSize <= headerLimit)) //mail size limit is not used if late download is active
284 { 285 {
285 emit newMessage(message, messageCount-1, mailSize, TRUE); 286 emit newMessage(message, messageCount-1, mailSize, TRUE);
286 } else { //incomplete mail downloaded 287 } else { //incomplete mail downloaded
287 emit newMessage(message, messageCount-1, mailSize, FALSE); 288 emit newMessage(message, messageCount-1, mailSize, FALSE);
288 } 289 }
289 290
290 if ((messageCount > newMessages)||(selected)) //last message ? 291 if ((messageCount > newMessages)||(selected)) //last message ?
291 { 292 {
292 status = Quit; 293 status = Quit;
293 if (selected) { //grab next from queue 294 if (selected) { //grab next from queue
294 newMessages--; 295 newMessages--;
295 status = Quit; 296 status = Quit;
296 } 297 }
297 } 298 }
298 else 299 else
299 { 300 {
300 *stream << "LIST " << messageCount << "\r\n"; 301 *stream << "LIST " << messageCount << "\r\n";
301 status = Size; 302 status = Size;
302 temp2.setNum(newMessages - lastSync); 303 temp2.setNum(newMessages - lastSync);
303 temp.setNum(messageCount - lastSync); 304 temp.setNum(messageCount - lastSync);
304 emit updateStatus(tr("Retrieving ") + temp + "/" + temp2); 305 emit updateStatus(tr("Retrieving ") + temp + "/" + temp2);
305 306
306 break; 307 break;
307 } 308 }
308 } 309 }
309 } 310 }
310 if (status != Quit) 311 if (status != Quit)
311 break; 312 break;
@@ -317,13 +318,13 @@ void PopClient::incomingData()
317 if (newM > 0) { 318 if (newM > 0) {
318 temp.setNum(newM); 319 temp.setNum(newM);
319 emit updateStatus(temp + tr(" new messages")); 320 emit updateStatus(temp + tr(" new messages"));
320 } else { 321 } else {
321 emit updateStatus(tr("No new messages")); 322 emit updateStatus(tr("No new messages"));
322 } 323 }
323 324
324 socket->close(); 325 socket->close();
325 receiving = FALSE; 326 receiving = FALSE;
326 emit mailTransfered(newM); 327 emit mailTransfered(newM);
327 break; 328 break;
328 } 329 }
329 } 330 }
diff --git a/noncore/unsupported/mailit/resource.cpp b/noncore/unsupported/mailit/resource.cpp
deleted file mode 100644
index dc19880..0000000
--- a/noncore/unsupported/mailit/resource.cpp
+++ b/dev/null
@@ -1,136 +0,0 @@
1/**********************************************************************
2** Copyright (C) 2000 Trolltech AS. All rights reserved.
3**
4** This file is part of Qtopia Environment.
5**
6** This file may be distributed and/or modified under the terms of the
7** GNU General Public License version 2 as published by the Free Software
8** Foundation and appearing in the file LICENSE.GPL included in the
9** packaging of this file.
10**
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.
13**
14** See http://www.trolltech.com/gpl/ for GPL licensing information.
15**
16** Contact info@trolltech.com if any conditions of this licensing are
17** not clear to you.
18**
19**********************************************************************/
20
21#include "qpeapplication.h"
22#include "resource.h"
23#include <qdir.h>
24#include <qfile.h>
25#include <qregexp.h>
26#include <qpixmapcache.h>
27#include <qpainter.h>
28
29#include "inlinepics_p.h"
30
31/*!
32 \class Resource resource.h
33 \brief The Resource class provides access to named resources.
34
35 The resources may be provided from files or other sources.
36*/
37
38/*!
39 \fn Resource::Resource()
40 \internal
41*/
42
43/*!
44 Returns the QPixmap named \a pix. You should avoid including
45 any filename type extension (eg. .png, .xpm).
46*/
47QPixmap Resource::loadPixmap( const QString &pix )
48{
49 QPixmap pm;
50 QString key="QPE_"+pix;
51 if ( !QPixmapCache::find(key,pm) ) {
52 pm.convertFromImage(loadImage(pix));
53 QPixmapCache::insert(key,pm);
54 }
55 return pm;
56}
57
58/*!
59 Returns the QBitmap named \a pix. You should avoid including
60 any filename type extension (eg. .png, .xpm).
61*/
62QBitmap Resource::loadBitmap( const QString &pix )
63{
64 QBitmap bm;
65 bm = loadPixmap(pix);
66 return bm;
67}
68
69/*!
70 Returns the filename of a pixmap named \a pix. You should avoid including
71 any filename type extension (eg. .png, .xpm).
72
73 Normally you will use loadPixmap() rather than this function.
74*/
75QString Resource::findPixmap( const QString &pix )
76{
77 QString picsPath = QPEApplication::qpeDir() + "pics/";
78
79 if ( QFile( picsPath + pix + ".png").exists() )
80 return picsPath + pix + ".png";
81 else if ( QFile( picsPath + pix + ".xpm").exists() )
82 return picsPath + pix + ".xpm";
83 else if ( QFile( picsPath + pix ).exists() )
84 return picsPath + pix;
85
86 //qDebug("Cannot find pixmap: %s", pix.latin1());
87 return QString();
88}
89
90/*!
91 Returns a sound file for a sound named \a name.
92 You should avoid including any filename type extension (eg. .wav, .au, .mp3).
93*/
94QString Resource::findSound( const QString &name )
95{
96 QString picsPath = QPEApplication::qpeDir() + "sounds/";
97
98 QString result;
99 if ( QFile( (result = picsPath + name + ".wav") ).exists() )
100 return result;
101
102 return QString();
103}
104
105/*!
106 Returns a list of all sound names.
107*/
108QStringList Resource::allSounds()
109{
110 QDir resourcedir( QPEApplication::qpeDir() + "sounds/", "*.wav" );
111 QStringList entries = resourcedir.entryList();
112 QStringList result;
113 for (QStringList::Iterator i=entries.begin(); i != entries.end(); ++i)
114 result.append((*i).replace(QRegExp("\\.wav"),""));
115 return result;
116}
117
118/*!
119 Returns the QImage named \a name. You should avoid including
120 any filename type extension (eg. .png, .xpm).
121*/
122QImage Resource::loadImage( const QString &name)
123{
124 QImage img = qembed_findImage(name.latin1());
125 if ( img.isNull() )
126 return QImage(findPixmap(name));
127 return img;
128}
129
130/*!
131 \fn QIconSet Resource::loadIconSet( const QString &name )
132
133 Returns a QIconSet for the pixmap named \a name. A disabled icon is
134 generated that conforms to the Qtopia look & feel. You should avoid
135 including any filename type extension (eg. .png, .xpm).
136*/
diff --git a/noncore/unsupported/mailit/resource.h b/noncore/unsupported/mailit/resource.h
deleted file mode 100644
index 982c58a..0000000
--- a/noncore/unsupported/mailit/resource.h
+++ b/dev/null
@@ -1,80 +0,0 @@
1/**********************************************************************
2** Copyright (C) 2000 Trolltech AS. All rights reserved.
3**
4** This file is part of Qtopia Environment.
5**
6** This file may be distributed and/or modified under the terms of the
7** GNU General Public License version 2 as published by the Free Software
8** Foundation and appearing in the file LICENSE.GPL included in the
9** packaging of this file.
10**
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.
13**
14** See http://www.trolltech.com/gpl/ for GPL licensing information.
15**
16** Contact info@trolltech.com if any conditions of this licensing are
17** not clear to you.
18**
19**********************************************************************/
20#ifndef PIXMAPLOADER_H
21#define PIXMAPLOADER_H
22
23#include <qimage.h>
24#include <qbitmap.h>
25#include <qiconset.h>
26#include <qstringlist.h>
27
28class Resource
29{
30public:
31 Resource() {}
32
33 static QImage loadImage( const QString &name);
34
35 static QPixmap loadPixmap( const QString &name );
36 static QBitmap loadBitmap( const QString &name );
37 static QString findPixmap( const QString &name );
38
39 static QIconSet loadIconSet( const QString &name );
40
41 static QString findSound( const QString &name );
42 static QStringList allSounds();
43};
44
45// Inline for compatibility with SHARP ROMs
46inline QIconSet Resource::loadIconSet( const QString &pix )
47{
48 QImage img = loadImage( pix );
49 QPixmap pm;
50 pm.convertFromImage( img );
51 QIconSet is( pm );
52 QIconSet::Size size = pm.width() <= 22 ? QIconSet::Small : QIconSet::Large;
53
54 QPixmap dpm = loadPixmap( pix + "_disabled" );
55
56 #ifndef QT_NO_DEPTH_32// have alpha-blended pixmaps
57 if ( dpm.isNull() ) {
58 QImage dimg( img.width(), img.height(), 32 );
59 for ( int y = 0; y < img.height(); y++ ) {
60 for ( int x = 0; x < img.width(); x++ ) {
61 QRgb p = img.pixel( x, y );
62 uint a = (p & 0xff000000) / 3;
63 p = (p & 0x00ffffff) | (a & 0xff000000);
64 dimg.setPixel( x, y, p );
65 }
66 }
67
68 dimg.setAlphaBuffer( TRUE );
69 dpm.convertFromImage( dimg );
70 }
71#endif
72
73 if ( !dpm.isNull() )
74 is.setPixmap( dpm, size, QIconSet::Disabled );
75
76 return is;
77}
78
79
80#endif
diff --git a/noncore/unsupported/mailit/smtpclient.cpp b/noncore/unsupported/mailit/smtpclient.cpp
index 5b5ef52..51ca50b 100644
--- a/noncore/unsupported/mailit/smtpclient.cpp
+++ b/noncore/unsupported/mailit/smtpclient.cpp
@@ -101,33 +101,33 @@ void SmtpClient::incomingData()
101 } else errorHandlingWithMsg(ErrUnknownResponse,response); 101 } else errorHandlingWithMsg(ErrUnknownResponse,response);
102 break; 102 break;
103 } 103 }
104 case From: { 104 case From: {
105 if (response[0] == '2') { 105 if (response[0] == '2') {
106 qDebug(mailPtr->from); 106 qDebug(mailPtr->from);
107 *stream << "MAIL FROM: <" << mailPtr->from << ">\r\n"; 107 *stream << "MAIL FROM: " << mailPtr->from << "\r\n";
108 status = Recv; 108 status = Recv;
109 } else errorHandlingWithMsg(ErrUnknownResponse, response ); 109 } else errorHandlingWithMsg(ErrUnknownResponse, response );
110 break; 110 break;
111 } 111 }
112 case Recv: { 112 case Recv: {
113 if (response[0] == '2') { 113 if (response[0] == '2') {
114 it = mailPtr->to.begin(); 114 it = mailPtr->to.begin();
115 if (it == NULL) { 115 if (it == NULL) {
116 errorHandlingWithMsg(ErrUnknownResponse,response); 116 errorHandlingWithMsg(ErrUnknownResponse,response);
117 } 117 }
118 *stream << "RCPT TO: <" << *it << ">\r\n"; 118 *stream << "RCPT TO: " << *it << "\r\n";
119 status = MRcv; 119 status = MRcv;
120 } else errorHandlingWithMsg(ErrUnknownResponse,response); 120 } else errorHandlingWithMsg(ErrUnknownResponse,response);
121 break; 121 break;
122 } 122 }
123 case MRcv: { 123 case MRcv: {
124 if (response[0] == '2') { 124 if (response[0] == '2') {
125 it++; 125 it++;
126 if ( it != mailPtr->to.end() ) { 126 if ( it != mailPtr->to.end() ) {
127 *stream << "RCPT TO: <" << *it << ">\r\n"; 127 *stream << "RCPT TO: " << *it << "\r\n";
128 break; 128 break;
129 } else { 129 } else {
130 status = Data; 130 status = Data;
131 } 131 }
132 } else errorHandlingWithMsg(ErrUnknownResponse,response); 132 } else errorHandlingWithMsg(ErrUnknownResponse,response);
133 } 133 }
diff --git a/noncore/unsupported/mailit/viewatt.cpp b/noncore/unsupported/mailit/viewatt.cpp
index 293e137..3515ba5 100644
--- a/noncore/unsupported/mailit/viewatt.cpp
+++ b/noncore/unsupported/mailit/viewatt.cpp
@@ -14,13 +14,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 "resource.h" 20#include <qpe/resource.h>
21#include "viewatt.h" 21#include "viewatt.h"
22#include <qwhatsthis.h> 22#include <qwhatsthis.h>
23#include <qpe/applnk.h> 23#include <qpe/applnk.h>
24#include <qpe/mimetype.h> 24#include <qpe/mimetype.h>
25 25
26ViewAtt::ViewAtt(QWidget *parent, const char *name, WFlags f) 26ViewAtt::ViewAtt(QWidget *parent, const char *name, WFlags f)
@@ -30,49 +30,49 @@ ViewAtt::ViewAtt(QWidget *parent, const char *name, WFlags f)
30 30
31 setToolBarsMovable( FALSE ); 31 setToolBarsMovable( FALSE );
32 bar = new QToolBar(this); 32 bar = new QToolBar(this);
33 installButton = new QAction( tr( "Install" ), Resource::loadPixmap( "exec" ), QString::null, CTRL + Key_C, this, 0 ); 33 installButton = new QAction( tr( "Install" ), Resource::loadPixmap( "exec" ), QString::null, CTRL + Key_C, this, 0 );
34 connect(installButton, SIGNAL(activated()), this, SLOT(install()) ); 34 connect(installButton, SIGNAL(activated()), this, SLOT(install()) );
35 installButton->setWhatsThis(tr("Click here to install the attachment to your Documents")); 35 installButton->setWhatsThis(tr("Click here to install the attachment to your Documents"));
36 36
37 listView = new QListView(this, "AttView"); 37 listView = new QListView(this, "AttView");
38 listView->addColumn( tr("Attatchment") ); 38 listView->addColumn( tr("Attatchment") );
39 listView->addColumn( tr("Type") ); 39 listView->addColumn( tr("Type") );
40 listView->addColumn( tr("Installed") ); 40 listView->addColumn( tr("Installed") );
41 setCentralWidget(listView); 41 setCentralWidget(listView);
42 QWhatsThis::add(listView,QWidget::tr("This is an overview about all attachments in the mail")); 42 QWhatsThis::add(listView,QWidget::tr("This is an overview about all attachments in the mail"));
43} 43}
44 44
45void ViewAtt::update(Email *mailIn, bool inbox) 45void ViewAtt::update(Email *mailIn, bool inbox)
46{ 46{
47 QListViewItem *item; 47 QListViewItem *item;
48 Enclosure *ePtr; 48 Enclosure *ePtr;
49
50 49
51 50
51
52 listView->clear(); 52 listView->clear();
53 if (inbox) { 53 if (inbox) {
54 bar->clear(); 54 bar->clear();
55 installButton->addTo( bar ); 55 installButton->addTo( bar );
56 bar->show(); 56 bar->show();
57 } else { 57 } else {
58 bar->hide(); 58 bar->hide();
59 } 59 }
60 60
61 mail = mailIn; 61 mail = mailIn;
62 for ( ePtr=mail->files.first(); ePtr != 0; ePtr=mail->files.next() ) { 62 for ( ePtr=mail->files.first(); ePtr != 0; ePtr=mail->files.next() ) {
63 63
64 QString isInstalled = tr("No"); 64 QString isInstalled = tr("No");
65 if (ePtr->installed) 65 if (ePtr->installed)
66 isInstalled = tr("Yes"); 66 isInstalled = tr("Yes");
67 item = new QListViewItem(listView, ePtr->originalName, ePtr->contentType, isInstalled); 67 item = new QListViewItem(listView, ePtr->originalName, ePtr->contentType, isInstalled);
68 68
69 const QString& mtypeDef=(const QString&) ePtr->contentType+"/"+ePtr->contentAttribute; 69 const QString& mtypeDef=(const QString&) ePtr->contentType+"/"+ePtr->contentAttribute;
70 70
71 MimeType mt(mtypeDef); 71 MimeType mt(mtypeDef);
72 72
73 item->setPixmap(0, mt.pixmap()); 73 item->setPixmap(0, mt.pixmap());
74 74
75 /* 75 /*
76 if (ePtr->contentType == "TEXT") { 76 if (ePtr->contentType == "TEXT") {
77 actions = new QAction( tr("View"), Resource::loadPixmap("TextEditor"), QString::null, CTRL + Key_C, this, 0); 77 actions = new QAction( tr("View"), Resource::loadPixmap("TextEditor"), QString::null, CTRL + Key_C, this, 0);
78 actions->addTo(bar); 78 actions->addTo(bar);
@@ -93,27 +93,27 @@ void ViewAtt::update(Email *mailIn, bool inbox)
93void ViewAtt::install() 93void ViewAtt::install()
94{ 94{
95 Enclosure *ePtr, *selPtr; 95 Enclosure *ePtr, *selPtr;
96 QListViewItem *item; 96 QListViewItem *item;
97 QString filename; 97 QString filename;
98 DocLnk d; 98 DocLnk d;
99 99
100 item = listView->selectedItem(); 100 item = listView->selectedItem();
101 if (item != NULL) { 101 if (item != NULL) {
102 filename = item->text(0); 102 filename = item->text(0);
103 selPtr = NULL; 103 selPtr = NULL;
104 for ( ePtr=mail->files.first(); ePtr != 0; ePtr=mail->files.next() ) { 104 for ( ePtr=mail->files.first(); ePtr != 0; ePtr=mail->files.next() ) {
105 if (ePtr->originalName == filename) 105 if (ePtr->originalName == filename)
106 selPtr = ePtr; 106 selPtr = ePtr;
107 } 107 }
108 108
109 if (selPtr == NULL) { 109 if (selPtr == NULL) {
110 qWarning("Internal error, file is not installed to documents"); 110 qWarning("Internal error, file is not installed to documents");
111 return; 111 return;
112 } 112 }
113 113
114 d.setName(selPtr->originalName); 114 d.setName(selPtr->originalName);
115 d.setFile(selPtr->path + selPtr->name); 115 d.setFile(selPtr->path + selPtr->name);
116 d.setType(selPtr->contentType + "/" + selPtr->contentAttribute); 116 d.setType(selPtr->contentType + "/" + selPtr->contentAttribute);
117 d.writeLink(); 117 d.writeLink();
118 selPtr->installed = TRUE; 118 selPtr->installed = TRUE;
119 item->setText(2, tr("Yes")); 119 item->setText(2, tr("Yes"));