summaryrefslogtreecommitdiff
path: root/noncore/net/mailit
Unidiff
Diffstat (limited to 'noncore/net/mailit') (more/less context) (show whitespace changes)
-rw-r--r--noncore/net/mailit/config.in2
-rw-r--r--noncore/net/mailit/popclient.cpp3
-rw-r--r--noncore/net/mailit/resource.cpp136
-rw-r--r--noncore/net/mailit/resource.h80
-rw-r--r--noncore/net/mailit/smtpclient.cpp6
-rw-r--r--noncore/net/mailit/viewatt.cpp2
6 files changed, 7 insertions, 222 deletions
diff --git a/noncore/net/mailit/config.in b/noncore/net/mailit/config.in
index 142b840..2b56b5f 100644
--- a/noncore/net/mailit/config.in
+++ b/noncore/net/mailit/config.in
@@ -1,4 +1,4 @@
1 config MAILIT 1 config MAILIT
2 boolean "opie-mailit (a simple POP3 email client)" 2 boolean "mailit"
3 default "n" 3 default "n"
4 depends ( LIBQPE || LIBQPE-X11 ) 4 depends ( LIBQPE || LIBQPE-X11 )
diff --git a/noncore/net/mailit/popclient.cpp b/noncore/net/mailit/popclient.cpp
index 5da3bcb..1df6b2b 100644
--- a/noncore/net/mailit/popclient.cpp
+++ b/noncore/net/mailit/popclient.cpp
@@ -41,6 +41,7 @@ PopClient::PopClient()
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
@@ -191,7 +192,7 @@ void PopClient::incomingData()
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
diff --git a/noncore/net/mailit/resource.cpp b/noncore/net/mailit/resource.cpp
deleted file mode 100644
index dc19880..0000000
--- a/noncore/net/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/net/mailit/resource.h b/noncore/net/mailit/resource.h
deleted file mode 100644
index 982c58a..0000000
--- a/noncore/net/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/net/mailit/smtpclient.cpp b/noncore/net/mailit/smtpclient.cpp
index 5b5ef52..51ca50b 100644
--- a/noncore/net/mailit/smtpclient.cpp
+++ b/noncore/net/mailit/smtpclient.cpp
@@ -104,7 +104,7 @@ void SmtpClient::incomingData()
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;
@@ -115,7 +115,7 @@ void SmtpClient::incomingData()
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;
@@ -124,7 +124,7 @@ void SmtpClient::incomingData()
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;
diff --git a/noncore/net/mailit/viewatt.cpp b/noncore/net/mailit/viewatt.cpp
index 293e137..3515ba5 100644
--- a/noncore/net/mailit/viewatt.cpp
+++ b/noncore/net/mailit/viewatt.cpp
@@ -17,7 +17,7 @@
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>