-rw-r--r-- | noncore/net/mailit/config.in | 2 | ||||
-rw-r--r-- | noncore/net/mailit/popclient.cpp | 57 | ||||
-rw-r--r-- | noncore/net/mailit/resource.cpp | 136 | ||||
-rw-r--r-- | noncore/net/mailit/resource.h | 80 | ||||
-rw-r--r-- | noncore/net/mailit/smtpclient.cpp | 6 | ||||
-rw-r--r-- | noncore/net/mailit/viewatt.cpp | 24 |
6 files changed, 45 insertions, 260 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,3 +1,3 @@ config MAILIT - boolean "opie-mailit (a simple POP3 email client)" + boolean "mailit" default "n" 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 @@ -31,3 +31,3 @@ PopClient::PopClient() { - + socket = new QSocket(this, "popClient"); @@ -36,5 +36,5 @@ PopClient::PopClient() connect(socket, SIGNAL(readyRead()), this, SLOT(incomingData())); - + stream = new QTextStream(socket); - + receiving = FALSE; @@ -43,2 +43,3 @@ PopClient::PopClient() headerLimit = 0; + mailList = 0; preview = FALSE; @@ -58,5 +59,5 @@ void PopClient::newConnection(const QString &target, int port) } - + status = Init; - + socket->connectToHost(target, port); @@ -64,3 +65,3 @@ void PopClient::newConnection(const QString &target, int port) //selected = FALSE; - + emit updateStatus(tr("DNS lookup")); @@ -72,3 +73,3 @@ void PopClient::setAccount(const QString &popUser, const QString &popPasswd) popPassword = popPasswd; -} +} @@ -125,5 +126,5 @@ void PopClient::incomingData() - + response = socket->readLine(); - + switch(status) { @@ -138,3 +139,3 @@ void PopClient::incomingData() md5Source = timeStamp + popPassword; - + md5_buffer( (char const *)md5Source, md5Source.length(),&md5Digest[0]); @@ -145,3 +146,3 @@ void PopClient::incomingData() } - printf("\n"); + printf("\n"); // qDebug(md5Digest); @@ -158,6 +159,6 @@ void PopClient::incomingData() } - + break; } - + case Pass: { @@ -165,3 +166,3 @@ void PopClient::incomingData() status = Stat; - + break; @@ -172,3 +173,3 @@ void PopClient::incomingData() *stream << "STAT" << "\r\n"; - status = Mcnt; + status = Mcnt; } else errorHandlingWithMsg(ErrLoginFailed, response); @@ -185,3 +186,3 @@ void PopClient::incomingData() status = List; - + if (synchronize) { @@ -192,4 +193,4 @@ void PopClient::incomingData() } - - if (selected) { + + if (selected && mailList ) { int *ptr = mailList->first(); @@ -198,3 +199,3 @@ void PopClient::incomingData() messageCount = *ptr; - } else newMessages = 0; + } else newMessages = 0; } @@ -226,3 +227,3 @@ void PopClient::incomingData() } - } + } //get size of message, eg "500 characters in message.." -> int 500 @@ -236,3 +237,3 @@ void PopClient::incomingData() emit currentMailSize(mailSize); - + status = Retr; @@ -243,3 +244,3 @@ void PopClient::incomingData() } - } + } //Read message number x, count upwards to messageCount @@ -247,3 +248,3 @@ void PopClient::incomingData() if (status != Quit) { - if ((selected)||(mailSize <= headerLimit)) + if ((selected)||(mailSize <= headerLimit)) { @@ -256,3 +257,3 @@ void PopClient::incomingData() break; - } } + } } case Ignore: { @@ -288,3 +289,3 @@ void PopClient::incomingData() } - + if ((messageCount > newMessages)||(selected)) //last message ? @@ -297,3 +298,3 @@ void PopClient::incomingData() } - else + else { @@ -304,3 +305,3 @@ void PopClient::incomingData() emit updateStatus(tr("Retrieving ") + temp + "/" + temp2); - + break; @@ -322,3 +323,3 @@ void PopClient::incomingData() } - + socket->close(); 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 @@ -/********************************************************************** -** Copyright (C) 2000 Trolltech AS. All rights reserved. -** -** This file is part of Qtopia Environment. -** -** This file may be distributed and/or modified under the terms of the -** GNU General Public License version 2 as published by the Free Software -** Foundation and appearing in the file LICENSE.GPL included in the -** packaging of this file. -** -** 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 "qpeapplication.h" -#include "resource.h" -#include <qdir.h> -#include <qfile.h> -#include <qregexp.h> -#include <qpixmapcache.h> -#include <qpainter.h> - -#include "inlinepics_p.h" - -/*! - \class Resource resource.h - \brief The Resource class provides access to named resources. - - The resources may be provided from files or other sources. -*/ - -/*! - \fn Resource::Resource() - \internal -*/ - -/*! - Returns the QPixmap named \a pix. You should avoid including - any filename type extension (eg. .png, .xpm). -*/ -QPixmap Resource::loadPixmap( const QString &pix ) -{ - QPixmap pm; - QString key="QPE_"+pix; - if ( !QPixmapCache::find(key,pm) ) { - pm.convertFromImage(loadImage(pix)); - QPixmapCache::insert(key,pm); - } - return pm; -} - -/*! - Returns the QBitmap named \a pix. You should avoid including - any filename type extension (eg. .png, .xpm). -*/ -QBitmap Resource::loadBitmap( const QString &pix ) -{ - QBitmap bm; - bm = loadPixmap(pix); - return bm; -} - -/*! - Returns the filename of a pixmap named \a pix. You should avoid including - any filename type extension (eg. .png, .xpm). - - Normally you will use loadPixmap() rather than this function. -*/ -QString Resource::findPixmap( const QString &pix ) -{ - QString picsPath = QPEApplication::qpeDir() + "pics/"; - - if ( QFile( picsPath + pix + ".png").exists() ) - return picsPath + pix + ".png"; - else if ( QFile( picsPath + pix + ".xpm").exists() ) - return picsPath + pix + ".xpm"; - else if ( QFile( picsPath + pix ).exists() ) - return picsPath + pix; - - //qDebug("Cannot find pixmap: %s", pix.latin1()); - return QString(); -} - -/*! - Returns a sound file for a sound named \a name. - You should avoid including any filename type extension (eg. .wav, .au, .mp3). -*/ -QString Resource::findSound( const QString &name ) -{ - QString picsPath = QPEApplication::qpeDir() + "sounds/"; - - QString result; - if ( QFile( (result = picsPath + name + ".wav") ).exists() ) - return result; - - return QString(); -} - -/*! - Returns a list of all sound names. -*/ -QStringList Resource::allSounds() -{ - QDir resourcedir( QPEApplication::qpeDir() + "sounds/", "*.wav" ); - QStringList entries = resourcedir.entryList(); - QStringList result; - for (QStringList::Iterator i=entries.begin(); i != entries.end(); ++i) - result.append((*i).replace(QRegExp("\\.wav"),"")); - return result; -} - -/*! - Returns the QImage named \a name. You should avoid including - any filename type extension (eg. .png, .xpm). -*/ -QImage Resource::loadImage( const QString &name) -{ - QImage img = qembed_findImage(name.latin1()); - if ( img.isNull() ) - return QImage(findPixmap(name)); - return img; -} - -/*! - \fn QIconSet Resource::loadIconSet( const QString &name ) - - Returns a QIconSet for the pixmap named \a name. A disabled icon is - generated that conforms to the Qtopia look & feel. You should avoid - including any filename type extension (eg. .png, .xpm). -*/ 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 @@ -/********************************************************************** -** Copyright (C) 2000 Trolltech AS. All rights reserved. -** -** This file is part of Qtopia Environment. -** -** This file may be distributed and/or modified under the terms of the -** GNU General Public License version 2 as published by the Free Software -** Foundation and appearing in the file LICENSE.GPL included in the -** packaging of this file. -** -** 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. -** -**********************************************************************/ -#ifndef PIXMAPLOADER_H -#define PIXMAPLOADER_H - -#include <qimage.h> -#include <qbitmap.h> -#include <qiconset.h> -#include <qstringlist.h> - -class Resource -{ -public: - Resource() {} - - static QImage loadImage( const QString &name); - - static QPixmap loadPixmap( const QString &name ); - static QBitmap loadBitmap( const QString &name ); - static QString findPixmap( const QString &name ); - - static QIconSet loadIconSet( const QString &name ); - - static QString findSound( const QString &name ); - static QStringList allSounds(); -}; - -// Inline for compatibility with SHARP ROMs -inline QIconSet Resource::loadIconSet( const QString &pix ) -{ - QImage img = loadImage( pix ); - QPixmap pm; - pm.convertFromImage( img ); - QIconSet is( pm ); - QIconSet::Size size = pm.width() <= 22 ? QIconSet::Small : QIconSet::Large; - - QPixmap dpm = loadPixmap( pix + "_disabled" ); - -#ifndef QT_NO_DEPTH_32 // have alpha-blended pixmaps - if ( dpm.isNull() ) { - QImage dimg( img.width(), img.height(), 32 ); - for ( int y = 0; y < img.height(); y++ ) { - for ( int x = 0; x < img.width(); x++ ) { - QRgb p = img.pixel( x, y ); - uint a = (p & 0xff000000) / 3; - p = (p & 0x00ffffff) | (a & 0xff000000); - dimg.setPixel( x, y, p ); - } - } - - dimg.setAlphaBuffer( TRUE ); - dpm.convertFromImage( dimg ); - } -#endif - - if ( !dpm.isNull() ) - is.setPixmap( dpm, size, QIconSet::Disabled ); - - return is; -} - - -#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 @@ -106,3 +106,3 @@ void SmtpClient::incomingData() qDebug(mailPtr->from); - *stream << "MAIL FROM: <" << mailPtr->from << ">\r\n"; + *stream << "MAIL FROM: " << mailPtr->from << "\r\n"; status = Recv; @@ -117,3 +117,3 @@ void SmtpClient::incomingData() } - *stream << "RCPT TO: <" << *it << ">\r\n"; + *stream << "RCPT TO: " << *it << "\r\n"; status = MRcv; @@ -126,3 +126,3 @@ void SmtpClient::incomingData() if ( it != mailPtr->to.end() ) { - *stream << "RCPT TO: <" << *it << ">\r\n"; + *stream << "RCPT TO: " << *it << "\r\n"; break; 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 @@ -19,3 +19,3 @@ **********************************************************************/ -#include "resource.h" +#include <qpe/resource.h> #include "viewatt.h" @@ -35,3 +35,3 @@ ViewAtt::ViewAtt(QWidget *parent, const char *name, WFlags f) installButton->setWhatsThis(tr("Click here to install the attachment to your Documents")); - + listView = new QListView(this, "AttView"); @@ -48,5 +48,5 @@ void ViewAtt::update(Email *mailIn, bool inbox) Enclosure *ePtr; - - + + listView->clear(); @@ -59,6 +59,6 @@ void ViewAtt::update(Email *mailIn, bool inbox) } - + mail = mailIn; for ( ePtr=mail->files.first(); ePtr != 0; ePtr=mail->files.next() ) { - + QString isInstalled = tr("No"); @@ -67,7 +67,7 @@ void ViewAtt::update(Email *mailIn, bool inbox) item = new QListViewItem(listView, ePtr->originalName, ePtr->contentType, isInstalled); - + const QString& mtypeDef=(const QString&) ePtr->contentType+"/"+ePtr->contentAttribute; - + MimeType mt(mtypeDef); - + item->setPixmap(0, mt.pixmap()); @@ -98,3 +98,3 @@ void ViewAtt::install() DocLnk d; - + item = listView->selectedItem(); @@ -107,3 +107,3 @@ void ViewAtt::install() } - + if (selPtr == NULL) { @@ -112,3 +112,3 @@ void ViewAtt::install() } - + d.setName(selPtr->originalName); |