summaryrefslogtreecommitdiffabout
path: root/kmicromail/libmailwrapper
Side-by-side diff
Diffstat (limited to 'kmicromail/libmailwrapper') (more/less context) (ignore whitespace changes)
-rw-r--r--kmicromail/libmailwrapper/abstractmail.cpp30
-rw-r--r--kmicromail/libmailwrapper/abstractmail.h12
-rw-r--r--kmicromail/libmailwrapper/generatemail.cpp6
-rw-r--r--kmicromail/libmailwrapper/genericwrapper.cpp14
-rw-r--r--kmicromail/libmailwrapper/genericwrapper.h6
-rw-r--r--kmicromail/libmailwrapper/imapwrapper.cpp28
-rw-r--r--kmicromail/libmailwrapper/imapwrapper.h14
-rw-r--r--kmicromail/libmailwrapper/libmailwrapper.pro8
-rw-r--r--kmicromail/libmailwrapper/logindialog.cpp2
-rw-r--r--kmicromail/libmailwrapper/logindialog.h2
-rw-r--r--kmicromail/libmailwrapper/mailtypes.cpp10
-rw-r--r--kmicromail/libmailwrapper/mailtypes.h14
-rw-r--r--kmicromail/libmailwrapper/mailwrapper.cpp14
-rw-r--r--kmicromail/libmailwrapper/mailwrapper.h6
-rw-r--r--kmicromail/libmailwrapper/mboxwrapper.cpp14
-rw-r--r--kmicromail/libmailwrapper/mboxwrapper.h10
-rw-r--r--kmicromail/libmailwrapper/mhwrapper.cpp12
-rw-r--r--kmicromail/libmailwrapper/mhwrapper.h8
-rw-r--r--kmicromail/libmailwrapper/nntpwrapper.cpp12
-rw-r--r--kmicromail/libmailwrapper/nntpwrapper.h6
-rw-r--r--kmicromail/libmailwrapper/pop3wrapper.cpp20
-rw-r--r--kmicromail/libmailwrapper/pop3wrapper.h8
-rw-r--r--kmicromail/libmailwrapper/sendmailprogress.cpp2
-rw-r--r--kmicromail/libmailwrapper/settings.cpp10
-rw-r--r--kmicromail/libmailwrapper/smtpwrapper.cpp6
25 files changed, 159 insertions, 115 deletions
diff --git a/kmicromail/libmailwrapper/abstractmail.cpp b/kmicromail/libmailwrapper/abstractmail.cpp
index 870985e..746d2ae 100644
--- a/kmicromail/libmailwrapper/abstractmail.cpp
+++ b/kmicromail/libmailwrapper/abstractmail.cpp
@@ -1,41 +1,43 @@
// CHANGED 2004-09-31 Lutz Rogowski
#include "abstractmail.h"
#include "imapwrapper.h"
#include "pop3wrapper.h"
#include "nntpwrapper.h"
#include "mhwrapper.h"
#include "mailtypes.h"
#include <qpe/global.h>
-#include <qprogressbar.h>
+#include <q3progressbar.h>
#include <qapplication.h>
#include <qmessagebox.h>
+//Added by qt3to4:
+#include <Q3ValueList>
#include <klocale.h>
#include <kdecore/kstandarddirs.h>
#include <qfile.h>
-#include <qtextstream.h>
+#include <q3textstream.h>
#include <stdlib.h>
#include <libetpan/mailmime_content.h>
#include <libetpan/mailmime.h>
using namespace Opie::Core;
AbstractMail* AbstractMail::getWrapper(IMAPaccount *a)
{
return new IMAPwrapper(a);
}
AbstractMail* AbstractMail::getWrapper(POP3account *a)
{
return new POP3wrapper(a);
}
AbstractMail* AbstractMail::getWrapper(NNTPaccount *a)
{
return new NNTPwrapper(a);
}
AbstractMail* AbstractMail::getWrapper(const QString&a,const QString&name)
{
return new MHwrapper(a,name);
}
@@ -90,184 +92,184 @@ encodedString* AbstractMail::decode_String(const encodedString*text,const QStrin
QString AbstractMail::convert_String(const char*text)
{
size_t index = 0;
char*res = 0;
int err = MAILIMF_NO_ERROR;
QString result(text);
//qDebug("convert_String %s ", text);
//err = mailmime_encoded_phrase_parse("iso-8859-1",
// text, strlen(text),&index, "iso-8859-1",&res);
err = mailmime_encoded_phrase_parse("iso-8859-1",
text, strlen(text),&index, "utf-8",&res);
if (err == MAILIMF_NO_ERROR && res && strlen(res)) {
result = QString::fromUtf8(res);
}
//qDebug("convert_String:%s ",result.latin1() );
if (res) free(res);
return result;
}
/* cp & paste from launcher */
QString AbstractMail::gen_attachment_id()
{
QFile file( "/proc/sys/kernel/random/uuid" );
- if (!file.open(IO_ReadOnly ) )
+ if (!file.open(QIODevice::ReadOnly ) )
return QString::null;
- QTextStream stream(&file);
+ Q3TextStream stream(&file);
return "{" + stream.read().stripWhiteSpace() + "}";
}
int AbstractMail::createMbox(const QString&,const FolderP&,const QString& ,bool)
{
return 0;
}
QString AbstractMail::defaultLocalfolder()
{
// QString f = getenv( "HOME" );
QString f = locateLocal( "data", "kopiemail/localmail");
// f += "/Applications/opiemail/localmail";
return f;
}
QString AbstractMail::draftFolder()
{
return QString("Drafts");
}
/* temporary - will be removed when implemented in all classes */
-void AbstractMail::deleteMails(const QString &,const QValueList<Opie::Core::OSmartPointer<RecMail> > &)
+void AbstractMail::deleteMails(const QString &,const Q3ValueList<Opie::Core::OSmartPointer<RecMail> > &)
{
}
-void AbstractMail::deleteMailList(const QValueList<RecMailP>&target)
+void AbstractMail::deleteMailList(const Q3ValueList<RecMailP>&target)
{
//qDebug("AbstractMail::deleteMailList:: Please reimplement! ");
// this is currently re-implemented in pop3wrapper and imapwrapper
int iii = 0;
int count = target.count();
- QProgressBar wid ( count );
+ Q3ProgressBar wid ( count );
wid.setCaption( i18n("Deleting ..."));
wid.show();
while (iii < count ) {
Global::statusMessage(i18n("Delete message %1 of %2").arg(iii).arg(count));
wid.setProgress( iii );
wid.raise();
qApp->processEvents();
RecMailP mail = (*target.at( iii ));
deleteMail(mail);
++iii;
}
}
void AbstractMail::downloadNewMails(const FolderP&fromFolder, AbstractMail*targetMail )
{
//qDebug("AbstractMail::downloadNewMails %s ", fromFolder->getName().latin1());
// get local folder
Account * acc = getAccount();
if ( !acc ) return;
QString lfName = acc->getLocalFolder();
if ( lfName.isEmpty() )
lfName = acc->getAccountName();
// create local folder
if ( !targetMail->createMbox(lfName))
{
QMessageBox::critical(0,i18n("Error creating new Folder"),
i18n("Error while creating new folder\n%1\n\nCancelling action.").arg(lfName));
return;
}
- QValueList<RecMailP> t;
+ Q3ValueList<RecMailP> t;
listMessages(fromFolder->getName(),t,acc->getMaxMailSize() );
if ( t.count() == 0 ) {
qDebug("There are no new messages %s", fromFolder->getName().latin1());
Global::statusMessage(i18n("There are no new messages"));
return;
}
Global::statusMessage(i18n("%1 :Downloading mails..."). arg(acc->getAccountName()));
qDebug(i18n("%1 :Downloading mails..."). arg(acc->getAccountName()));
qApp->processEvents();
- QValueList<RecMailP> e;
+ Q3ValueList<RecMailP> e;
targetMail->listMessages(lfName,e,acc->getMaxMailSize() );
//qDebug("target has mails %d ", e.count());
- QValueList<RecMailP> n;
+ Q3ValueList<RecMailP> n;
int iii = 0;
int count = t.count();
while (iii < count ) {
RecMailP r = (*t.at( iii ));
bool found = false;
int jjj = 0;
int countE = e.count();
while (jjj < countE ) {
RecMailP re = (*e.at( jjj ));
if ( re->isEqual(r) ) {
found = true;
break;
}
++jjj;
}
if ( !found ) {
//qDebug("AAAdate *%s* ", r->isodate.latin1() );
n.append( r );
}
++iii;
}
qDebug("Downloaded %d messages ",n.count() );
if ( n.count() == 0 ) {
Global::statusMessage(i18n("There are no new messages"));
return;
}
mvcpMailList( n,lfName,targetMail,!acc->getLeaveOnServer());
Global::statusMessage(i18n("Downloaded %1 messages").arg(n.count()));
#if 0
- QValueList<RecMailP> t;
+ Q3ValueList<RecMailP> t;
listMessages(fromFolder->getName(),t, maxSizeInKb);
mvcpMailList( t,targetFolder,targetWrapper,moveit);
#endif
}
void AbstractMail::mvcpAllMails(const FolderP&fromFolder,
const QString&targetFolder,AbstractMail*targetWrapper,bool moveit, int maxSizeInKb)
{
- QValueList<RecMailP> t;
+ Q3ValueList<RecMailP> t;
listMessages(fromFolder->getName(),t, maxSizeInKb);
mvcpMailList( t,targetFolder,targetWrapper,moveit);
}
-void AbstractMail::mvcpMailList(const QValueList<RecMailP>& t,
+void AbstractMail::mvcpMailList(const Q3ValueList<RecMailP>& t,
const QString&targetFolder,AbstractMail*targetWrapper,bool moveit)
{
encodedString*st = 0;
int iii = 0;
int count = t.count();
if ( count == 0 )
return;
// wel, processevents is qite strange, we need a widget for getting
// Global::statusMessage(i18n("Copy2 message %1").arg(iii)); displaye
- QProgressBar wid ( count );
+ Q3ProgressBar wid ( count );
wid.setCaption( i18n("Copying..."));
wid.show();
while (iii < count ) {
Global::statusMessage(i18n("Copy message %1 of %2").arg(iii).arg(count));
wid.setProgress( iii );
wid.raise();
qApp->processEvents();
RecMailP r = (*t.at( iii ));
st = fetchRawBody(r);
if (st) {
targetWrapper->storeMessage(st->Content(),st->Length(),targetFolder);
delete st;
}
++iii;
}
if (moveit) {
deleteMailList( t );
//deleteAllMail(fromFolder);
}
}
void AbstractMail::mvcpMail(const RecMailP&mail,const QString&targetFolder,AbstractMail*targetWrapper,bool moveit)
{
encodedString*st = 0;
diff --git a/kmicromail/libmailwrapper/abstractmail.h b/kmicromail/libmailwrapper/abstractmail.h
index 2069ca1..f606b1f 100644
--- a/kmicromail/libmailwrapper/abstractmail.h
+++ b/kmicromail/libmailwrapper/abstractmail.h
@@ -1,71 +1,73 @@
// CHANGED 2004-09-31 Lutz Rogowski
#ifndef __abstract_mail_
#define __abstract_mail_
#include "maildefines.h"
#include "settings.h"
#include <qobject.h>
+//Added by qt3to4:
+#include <Q3ValueList>
#include <opie2/osmartpointer.h>
#include "mailtypes.h"
#include "mailwrapper.h"
class IMAPwrapper;
class POP3wrapper;
class Folder;
class encodedString;
struct folderStat;
class AbstractMail:public QObject
{
Q_OBJECT
public:
AbstractMail(){};
virtual ~AbstractMail(){}
- virtual QValueList<Opie::Core::OSmartPointer<Folder> >* listFolders()=0;
- virtual void listMessages(const QString & mailbox,QValueList<RecMailP>&target, int sizeInKb = 0 )=0;
+ virtual Q3ValueList<Opie::Core::OSmartPointer<Folder> >* listFolders()=0;
+ virtual void listMessages(const QString & mailbox,Q3ValueList<RecMailP>&target, int sizeInKb = 0 )=0;
virtual void statusFolder(folderStat&target_stat,const QString & mailbox="INBOX")=0;
virtual RecBodyP fetchBody(const RecMailP&mail)=0;
virtual QString fetchTextPart(const RecMailP&mail,const RecPartP&part)=0;
virtual encodedString* fetchDecodedPart(const RecMailP&mail,const RecPartP&part)=0;
virtual encodedString* fetchRawPart(const RecMailP&mail,const RecPartP&part)=0;
virtual encodedString* fetchRawBody(const RecMailP&mail)=0;
virtual void deleteMail(const RecMailP&mail)=0;
- virtual void deleteMailList(const QValueList<RecMailP>&target);
+ virtual void deleteMailList(const Q3ValueList<RecMailP>&target);
virtual void answeredMail(const RecMailP&mail)=0;
virtual int deleteAllMail(const Opie::Core::OSmartPointer<Folder>&)=0;
- virtual void deleteMails(const QString & FolderName,const QValueList<Opie::Core::OSmartPointer<RecMail> >&target);
+ virtual void deleteMails(const QString & FolderName,const Q3ValueList<Opie::Core::OSmartPointer<RecMail> >&target);
virtual int deleteMbox(const Opie::Core::OSmartPointer<Folder>&)=0;
virtual void storeMessage(const char*msg,size_t length, const QString&folder)=0;
void downloadNewMails(const FolderP&fromFolder,AbstractMail*targetWrapper );
virtual void mvcpAllMails(const Opie::Core::OSmartPointer<Folder>&fromFolder,
const QString&targetFolder,AbstractMail*targetWrapper,bool moveit, int sizeInKb = 0);
- virtual void mvcpMailList(const QValueList<RecMailP>& t,
+ virtual void mvcpMailList(const Q3ValueList<RecMailP>& t,
const QString&targetFolder,AbstractMail*targetWrapper,bool moveit);
virtual void mvcpMail(const RecMailP&mail,const QString&targetFolder,AbstractMail*targetWrapper,bool moveit);
virtual void cleanMimeCache(){};
/* mail box methods */
/* parameter is the box to create.
* if the implementing subclass has prefixes,
* them has to be appended automatic.
*/
virtual int createMbox(const QString&,const Opie::Core::OSmartPointer<Folder>&parentfolder=0,
const QString& delemiter="/",bool getsubfolder=false);
virtual void logout()=0;
virtual Account* getAccount() = 0;
static AbstractMail* getWrapper(IMAPaccount *a);
static AbstractMail* getWrapper(POP3account *a);
static AbstractMail* getWrapper(NNTPaccount *a);
/* mbox only! */
static AbstractMail* getWrapper(const QString&a,const QString&name="Local Folders");
static AbstractMail* getWrapper(Account*a);
static QString defaultLocalfolder();
static QString draftFolder();
diff --git a/kmicromail/libmailwrapper/generatemail.cpp b/kmicromail/libmailwrapper/generatemail.cpp
index 2d213fe..ddad21b 100644
--- a/kmicromail/libmailwrapper/generatemail.cpp
+++ b/kmicromail/libmailwrapper/generatemail.cpp
@@ -1,33 +1,35 @@
#include "generatemail.h"
#include "mailwrapper.h"
#include <libetpan/libetpan.h>
//#include <qt.h>
#include <stdlib.h>
#include <qfileinfo.h>
+//Added by qt3to4:
+#include <Q3CString>
using namespace Opie::Core;
const char* Generatemail::USER_AGENT="KOpieMail 33 1/3";
Generatemail::Generatemail()
{
mCharset = "iso-8859-1";
}
Generatemail::~Generatemail()
{
}
void Generatemail::addRcpts( clist *list, mailimf_address_list *addr_list ) {
clistiter *it, *it2;
for ( it = clist_begin( addr_list->ad_list ); it; it = it->next ) {
mailimf_address *addr;
addr = (mailimf_address *) it->data;
if ( addr->ad_type == MAILIMF_ADDRESS_MAILBOX ) {
esmtp_address_list_add( list, addr->ad_data.ad_mailbox->mb_addr_spec, 0, NULL );
} else if ( addr->ad_type == MAILIMF_ADDRESS_GROUP ) {
clist *l = addr->ad_data.ad_group->grp_mb_list->mb_list;
@@ -207,73 +209,73 @@ void Generatemail::addFileParts( mailmime *message,const QList<Attachment>&files
const Attachment *it;
unsigned int count = files.count();
for ( unsigned int i = 0; i < count; ++i ) {
mailmime *filePart;
int err;
it = ((QList<Attachment>)files).at(i);
filePart = buildFilePart( it->getFileName(), it->getMimeType(),"" );
if ( filePart == NULL ) {
continue;
}
err = mailmime_smart_add_part( message, filePart );
if ( err != MAILIMF_NO_ERROR ) {
mailmime_free( filePart );
}
}
}
mailmime *Generatemail::buildTxtPart(const QString&str ) {
mailmime *txtPart;
mailmime_fields *fields;
mailmime_content *content;
mailmime_parameter *param;
int err;
- QCString __str;
+ Q3CString __str;
//qDebug(" Generatemail::buildTxtPart %s", str.latin1());
param = mailmime_parameter_new( strdup( "charset" ),
strdup( mCharset.latin1() ) );
if ( param == NULL )
goto err_free;
content = mailmime_content_new_with_str( "text/plain" );
if ( content == NULL )
goto err_free_param;
err = clist_append( content->ct_parameters, param );
if ( err != MAILIMF_NO_ERROR )
goto err_free_content;
fields = mailmime_fields_new_encoding(MAILMIME_MECHANISM_8BIT);
if ( fields == NULL )
goto err_free_content;
txtPart = mailmime_new_empty( content, fields );
if ( txtPart == NULL )
goto err_free_fields;
{
//__str = str.utf8();
- __str = QCString (str.latin1());
+ __str = Q3CString (str.latin1());
err = mailmime_set_body_text( txtPart, strdup(__str.data()), __str.length() );
}
if ( err != MAILIMF_NO_ERROR )
goto err_free_txtPart;
return txtPart; // Success :)
err_free_txtPart:
mailmime_free( txtPart );
err_free_fields:
mailmime_fields_free( fields );
err_free_content:
mailmime_content_free( content );
err_free_param:
mailmime_parameter_free( param );
err_free:
;
return NULL; // Error :(
}
mailimf_mailbox *Generatemail::newMailbox(const QString&name, const QString&mail ) {
return mailimf_mailbox_new( strdup( name.latin1() ),
strdup( mail.latin1() ) );
diff --git a/kmicromail/libmailwrapper/genericwrapper.cpp b/kmicromail/libmailwrapper/genericwrapper.cpp
index 0b6adf7..633ab42 100644
--- a/kmicromail/libmailwrapper/genericwrapper.cpp
+++ b/kmicromail/libmailwrapper/genericwrapper.cpp
@@ -1,32 +1,34 @@
// CHANGED 2004-09-31 Lutz Rogowski
#include "genericwrapper.h"
#include <libetpan/libetpan.h>
#include "mailtypes.h"
#include <kconfig.h>
#include <kglobal.h>
#include <kstandarddirs.h>
+//Added by qt3to4:
+#include <Q3ValueList>
using namespace Opie::Core;
Genericwrapper::Genericwrapper()
: AbstractMail()
{
bodyCache.clear();
m_storage = 0;
m_folder = 0;
}
Genericwrapper::~Genericwrapper()
{
if (m_folder) {
mailfolder_free(m_folder);
}
if (m_storage) {
mailstorage_free(m_storage);
}
cleanMimeCache();
}
const QDateTime Genericwrapper::parseDateTime( mailimf_date_time *date )
{
@@ -161,67 +163,67 @@ QString Genericwrapper::getencoding(mailmime_mechanism*aEnc)
enc = "7bit";
break;
case MAILMIME_MECHANISM_8BIT:
enc = "8bit";
break;
case MAILMIME_MECHANISM_BINARY:
enc = "binary";
break;
case MAILMIME_MECHANISM_QUOTED_PRINTABLE:
enc = "quoted-printable";
break;
case MAILMIME_MECHANISM_BASE64:
enc = "base64";
break;
case MAILMIME_MECHANISM_TOKEN:
default:
if (aEnc->enc_token) {
enc = QString(aEnc->enc_token);
}
break;
}
return enc;
}
-void Genericwrapper::traverseBody(RecBodyP&target,mailmessage*message,mailmime*mime,QValueList<int>recList,unsigned int current_rec,int current_count)
+void Genericwrapper::traverseBody(RecBodyP&target,mailmessage*message,mailmime*mime,Q3ValueList<int>recList,unsigned int current_rec,int current_count)
{
if (current_rec >= 10) {
; // odebug << "too deep recursion!" << oendl;
}
if (!message || !mime) {
return;
}
int r;
char*data = 0;
size_t len;
clistiter * cur = 0;
QString b;
RecPartP part = new RecPart();
switch (mime->mm_type) {
case MAILMIME_SINGLE:
{
- QValueList<int>countlist = recList;
+ Q3ValueList<int>countlist = recList;
countlist.append(current_count);
r = mailmessage_fetch_section(message,mime,&data,&len);
part->setSize(len);
part->setPositionlist(countlist);
b = gen_attachment_id();
part->setIdentifier(b);
fillSingleBody(part,message,mime);
if (part->Type()=="text" && target->Bodytext().isNull()) {
encodedString*rs = new encodedString();
rs->setContent(data,len);
encodedString*res = decode_String(rs,part->Encoding());
if (countlist.count()>2) {
bodyCache[b]=rs;
target->addPart(part);
} else {
delete rs;
}
b = QString(res->Content());
delete res;
size_t index = 0;
char*resu = 0;
int err = MAILIMF_NO_ERROR;
QString charset = part->searchParamter( "charset");
qDebug("CHARSET %s ",charset.latin1() );
@@ -229,101 +231,101 @@ void Genericwrapper::traverseBody(RecBodyP&target,mailmessage*message,mailmime*m
if (false ) {
//if ( !charset.isEmpty() ) {
target->setCharset( charset );
err = mailmime_encoded_phrase_parse(charset.latin1(),
b.latin1(), b.length(),&index, "utf-8",&resu);
if (err == MAILIMF_NO_ERROR && resu && strlen(resu)) {
//qDebug("res %d %s ", index, resu);
b = QString::fromUtf8(resu);
}
if (resu) free(resu);
}
#endif
target->setBodytext(b);
target->setDescription(part);
} else {
bodyCache[b]=new encodedString(data,len);
target->addPart(part);
}
}
break;
case MAILMIME_MULTIPLE:
{
unsigned int ccount = 1;
mailmime*cbody=0;
- QValueList<int>countlist = recList;
+ Q3ValueList<int>countlist = recList;
for (cur = clist_begin(mime->mm_data.mm_multipart.mm_mp_list) ; cur != NULL ; cur = clist_next(cur)) {
cbody = (mailmime*)clist_content(cur);
if (cbody->mm_type==MAILMIME_MULTIPLE) {
RecPartP targetPart = new RecPart();
targetPart->setType("multipart");
countlist.append(current_count);
targetPart->setPositionlist(countlist);
target->addPart(targetPart);
}
traverseBody(target,message, cbody,countlist,current_rec+1,ccount);
if (cbody->mm_type==MAILMIME_MULTIPLE) {
countlist = recList;
}
++ccount;
}
}
break;
case MAILMIME_MESSAGE:
{
- QValueList<int>countlist = recList;
+ Q3ValueList<int>countlist = recList;
countlist.append(current_count);
/* the own header is always at recursion 0 - we don't need that */
if (current_rec > 0) {
part->setPositionlist(countlist);
r = mailmessage_fetch_section(message,mime,&data,&len);
part->setSize(len);
part->setPositionlist(countlist);
b = gen_attachment_id();
part->setIdentifier(b);
part->setType("message");
part->setSubtype("rfc822");
bodyCache[b]=new encodedString(data,len);
target->addPart(part);
}
if (mime->mm_data.mm_message.mm_msg_mime != NULL) {
traverseBody(target,message,mime->mm_data.mm_message.mm_msg_mime,countlist,current_rec+1);
}
}
break;
}
}
RecBodyP Genericwrapper::parseMail( mailmessage * msg )
{
int err = MAILIMF_NO_ERROR;
//mailmime_single_fields fields;
/* is bound to msg and will be freed there */
mailmime * mime=0;
RecBodyP body = new RecBody();
//memset(&fields, 0, sizeof(struct mailmime_single_fields));
err = mailmessage_get_bodystructure(msg,&mime);
- QValueList<int>recList;
+ Q3ValueList<int>recList;
traverseBody(body,msg,mime,recList);
return body;
}
QString Genericwrapper::parseAddressList( mailimf_address_list *list )
{
QString result( "" );
bool first = true;
if (list == 0) return result;
for ( clistiter *current = clist_begin( list->ad_list ); current != NULL; current = current->next ) {
mailimf_address *addr = (mailimf_address *) current->data;
if ( !first ) {
result.append( "," );
} else {
first = false;
}
switch ( addr->ad_type ) {
case MAILIMF_ADDRESS_MAILBOX:
result.append( parseMailbox( addr->ad_data.ad_mailbox ) );
break;
@@ -426,49 +428,49 @@ void Genericwrapper::cleanMimeCache()
bodyCache.clear();
; // odebug << "Genericwrapper: cache cleaned" << oendl;
}
QStringList Genericwrapper::parseInreplies(mailimf_in_reply_to * in_replies)
{
QStringList res;
if (!in_replies || !in_replies->mid_list) return res;
clistiter * current = 0;
for ( current = clist_begin( in_replies->mid_list ); current != NULL; current = current->next ) {
QString h((char*)current->data);
while (h.length()>0 && h[0]=='<') {
h.remove(0,1);
}
while (h.length()>0 && h[h.length()-1]=='>') {
h.remove(h.length()-1,1);
}
if (h.length()>0) {
res.append(h);
}
}
return res;
}
-void Genericwrapper::parseList(QValueList<Opie::Core::OSmartPointer<RecMail> > &target,mailsession*session,const QString&mailbox,bool mbox_as_to, int maxSizeInKb)
+void Genericwrapper::parseList(Q3ValueList<Opie::Core::OSmartPointer<RecMail> > &target,mailsession*session,const QString&mailbox,bool mbox_as_to, int maxSizeInKb)
{
int r;
mailmessage_list * env_list = 0;
r = mailsession_get_messages_list(session,&env_list);
if (r != MAIL_NO_ERROR) {
; // odebug << "Error message list" << oendl;
return;
}
r = mailsession_get_envelopes_list(session, env_list);
if (r != MAIL_NO_ERROR) {
; // odebug << "Error filling message list" << oendl;
if (env_list) {
mailmessage_list_free(env_list);
}
return;
}
mailimf_references * refs = 0;
mailimf_in_reply_to * in_replies = 0;
uint32_t i = 0;
for(; i < carray_count(env_list->msg_tab) ; ++i) {
mailmessage * msg;
QBitArray mFlags(7);
msg = (mailmessage*)carray_get(env_list->msg_tab, i);
if (msg->msg_fields == NULL) {
diff --git a/kmicromail/libmailwrapper/genericwrapper.h b/kmicromail/libmailwrapper/genericwrapper.h
index c35a6da..a50161d 100644
--- a/kmicromail/libmailwrapper/genericwrapper.h
+++ b/kmicromail/libmailwrapper/genericwrapper.h
@@ -1,68 +1,70 @@
// CHANGED 2004-09-31 Lutz Rogowski
#ifndef __GENERIC_WRAPPER_H
#define __GENERIC_WRAPPER_H
#include "abstractmail.h"
#include <qmap.h>
#include <qstring.h>
+//Added by qt3to4:
+#include <Q3ValueList>
#include <libetpan/clist.h>
class RecMail;
class RecBody;
class encodedString;
struct mailpop3;
struct mailmessage;
struct mailmime;
struct mailmime_mechanism;
struct mailimf_mailbox_list;
struct mailimf_mailbox;
struct mailimf_date_time;
struct mailimf_group;
struct mailimf_address_list;
struct mailsession;
struct mailstorage;
struct mailfolder;
struct mailimf_in_reply_to;
/* this class hold just the funs shared between
* mbox and pop3 (later mh, too) mail access.
* it is not desigend to make a instance of it!
*/
class Genericwrapper : public AbstractMail
{
Q_OBJECT
public:
Genericwrapper();
virtual ~Genericwrapper();
virtual encodedString* fetchDecodedPart(const RecMailP&mail,const RecPartP&part);
virtual encodedString* fetchRawPart(const RecMailP&mail,const RecPartP&part);
virtual QString fetchTextPart(const RecMailP&mail,const RecPartP&part);
virtual void cleanMimeCache();
virtual int deleteMbox(const Opie::Core::OSmartPointer<Folder>&){return 1;}
virtual void logout(){};
virtual void storeMessage(const char*msg,size_t length, const QString&folder){};
static const QDateTime parseDateTime( mailimf_date_time *date );
protected:
RecBodyP parseMail( mailmessage * msg );
QString parseMailboxList( mailimf_mailbox_list *list );
QString parseMailbox( mailimf_mailbox *box );
QString parseGroup( mailimf_group *group );
QString parseAddressList( mailimf_address_list *list );
- void traverseBody(RecBodyP&target,mailmessage*message,mailmime*mime,QValueList<int>recList,unsigned int current_rek=0,int current_count=1);
+ void traverseBody(RecBodyP&target,mailmessage*message,mailmime*mime,Q3ValueList<int>recList,unsigned int current_rek=0,int current_count=1);
static void fillSingleBody(RecPartP&target,mailmessage*message,mailmime*mime);
static void fillParameters(RecPartP&target,clist*parameters);
static QString getencoding(mailmime_mechanism*aEnc);
- virtual void parseList(QValueList<Opie::Core::OSmartPointer<RecMail> > &target,mailsession*session,const QString&mailbox,bool mbox_as_to=false, int maxSizeInKb = 0);
+ virtual void parseList(Q3ValueList<Opie::Core::OSmartPointer<RecMail> > &target,mailsession*session,const QString&mailbox,bool mbox_as_to=false, int maxSizeInKb = 0);
QStringList parseInreplies(mailimf_in_reply_to * in_replies);
QString msgTempName;
unsigned int last_msg_id;
QMap<QString,encodedString*> bodyCache;
mailstorage * m_storage;
mailfolder*m_folder;
};
#endif
diff --git a/kmicromail/libmailwrapper/imapwrapper.cpp b/kmicromail/libmailwrapper/imapwrapper.cpp
index 4f0c849..f73f4cc 100644
--- a/kmicromail/libmailwrapper/imapwrapper.cpp
+++ b/kmicromail/libmailwrapper/imapwrapper.cpp
@@ -1,33 +1,35 @@
// CHANGED 2004-09-31 Lutz Rogowski
#include <stdlib.h>
#include <libetpan/libetpan.h>
#include <qpe/global.h>
#include <qapplication.h>
+//Added by qt3to4:
+#include <Q3ValueList>
#include "imapwrapper.h"
#include "mailtypes.h"
#include "logindialog.h"
-#include <qprogressbar.h>
+#include <q3progressbar.h>
#include "genericwrapper.h"
#include <kglobal.h>
using namespace Opie::Core;
int IMAPwrapper::mMax = 0;
int IMAPwrapper::mCurrent = 0;
IMAPwrapper::IMAPwrapper( IMAPaccount *a )
: AbstractMail()
{
account = a;
m_imap = 0;
m_Lastmbox = "";
mCurrent = 0;
mMax = 0;
}
IMAPwrapper::~IMAPwrapper()
{
logout();
}
/* to avoid to often select statements in loops etc.
we trust that we are logged in and connection is established!*/
@@ -218,49 +220,49 @@ void IMAPwrapper::login(bool tryTLS) // = true)
return;
}
Global::statusMessage(i18n("error logging in imap server: %1").arg(m_imap->imap_response));
ok = false;
}
}
if (!ok) {
err = mailimap_close( m_imap );
mailimap_free( m_imap );
m_imap = 0;
}
}
void IMAPwrapper::logout()
{
int err = MAILIMAP_NO_ERROR;
if (!m_imap) return;
err = mailimap_logout( m_imap );
err = mailimap_close( m_imap );
mailimap_free( m_imap );
m_imap = 0;
m_Lastmbox = "";
}
-void IMAPwrapper::listMessages(const QString&mailbox,QValueList<Opie::Core::OSmartPointer<RecMail> > &target , int maxSizeInKb)
+void IMAPwrapper::listMessages(const QString&mailbox,Q3ValueList<Opie::Core::OSmartPointer<RecMail> > &target , int maxSizeInKb)
{
int tryAgain = 1;
while ( tryAgain >= 0 ) {
int err = MAILIMAP_NO_ERROR;
clist *result = 0;
clistcell *current;
mailimap_fetch_type *fetchType = 0;
mailimap_set *set = 0;
login();
if (!m_imap) {
return;
}
/* select mailbox READONLY for operations */
err = selectMbox(mailbox);
if ( err != MAILIMAP_NO_ERROR ) {
return;
}
int last = m_imap->imap_selection_info->sel_exists;
if (last == 0) {
Global::statusMessage(i18n("Mailbox has no mails"));
@@ -299,58 +301,58 @@ void IMAPwrapper::listMessages(const QString&mailbox,QValueList<Opie::Core::OSma
RecMail*m = parse_list_result(msg_att);
if (m) {
if ( maxSizeInKb == 0 || m->Msgsize()<=(unsigned int ) maxSizeInKb*1024 ) {
m->setNumber(i);
m->setMbox(mailbox);
m->setWrapper(this);
target.append(m);
}
}
}
Global::statusMessage(i18n("Mailbox has %1 mails").arg(target.count()));
} else {
--tryAgain;
--tryAgain;//disabled tryagain by adding this line
if ( tryAgain < 0 )
Global::statusMessage(i18n("Error fetching headers: %1").arg(m_imap->imap_response));
else
qDebug("try again... ");
}
if (result) mailimap_fetch_list_free(result);
}
}
-QValueList<Opie::Core::OSmartPointer<Folder> >* IMAPwrapper::listFolders()
+Q3ValueList<Opie::Core::OSmartPointer<Folder> >* IMAPwrapper::listFolders()
{
const char *path, *mask;
int err = MAILIMAP_NO_ERROR;
clist *result = 0;
clistcell *current = 0;
clistcell*cur_flag = 0;
mailimap_mbx_list_flags*bflags = 0;
- QValueList<FolderP>* folders = new QValueList<FolderP>();
+ Q3ValueList<FolderP>* folders = new Q3ValueList<FolderP>();
login();
if (!m_imap) {
return folders;
}
/*
* First we have to check for INBOX 'cause it sometimes it's not inside the path.
* We must not forget to filter them out in next loop!
* it seems like ugly code. and yes - it is ugly code. but the best way.
*/
Global::statusMessage(i18n("Fetching folder list"));
qApp->processEvents();
QString temp;
mask = "INBOX" ;
mailimap_mailbox_list *list;
err = mailimap_list( m_imap, (char*)"", (char*)mask, &result );
QString del;
bool selectable = true;
bool no_inferiors = false;
if ( err == MAILIMAP_NO_ERROR ) {
current = result->first;
for ( int i = result->count; i > 0; i-- ) {
list = (mailimap_mailbox_list *) current->data;
// it is better use the deep copy mechanism of qt itself
@@ -592,49 +594,49 @@ RecBodyP IMAPwrapper::fetchBody(const RecMailP&mail)
mb = mail->getMbox().latin1();
login();
if (!m_imap) {
return body;
}
err = selectMbox(mail->getMbox());
if ( err != MAILIMAP_NO_ERROR ) {
return body;
}
/* the range has to start at 1!!! not with 0!!!! */
set = mailimap_set_new_interval( mail->getNumber(),mail->getNumber() );
fetchAtt = mailimap_fetch_att_new_bodystructure();
fetchType = mailimap_fetch_type_new_fetch_att(fetchAtt);
err = mailimap_fetch( m_imap, set, fetchType, &result );
mailimap_set_free( set );
mailimap_fetch_type_free( fetchType );
if (err == MAILIMAP_NO_ERROR && (current=clist_begin(result)) ) {
mailimap_msg_att * msg_att;
msg_att = (mailimap_msg_att*)current->data;
mailimap_msg_att_item*item = (mailimap_msg_att_item*)msg_att->att_list->first->data;
- QValueList<int> path;
+ Q3ValueList<int> path;
body_desc = item->att_data.att_static->att_data.att_body;
traverseBody(mail,body_desc,body,0,path);
} else {
qDebug("error fetching body %d (%d): %s", err, MAILIMAP_NO_ERROR, m_imap->imap_response );
}
if (result) mailimap_fetch_list_free(result);
return body;
}
QStringList IMAPwrapper::address_list_to_stringlist(clist*list)
{
QStringList l;
QString from;
bool named_from;
clistcell *current = NULL;
mailimap_address * current_address=NULL;
if (!list) {
return l;
}
unsigned int count = 0;
for (current=clist_begin(list);current!= NULL;current=clist_next(current)) {
from = "";
named_from = false;
current_address=(mailimap_address*)current->data;
@@ -643,49 +645,49 @@ QStringList IMAPwrapper::address_list_to_stringlist(clist*list)
from+=" ";
named_from = true;
}
if (named_from && (current_address->ad_mailbox_name || current_address->ad_host_name)) {
from+="<";
}
if (current_address->ad_mailbox_name) {
from+=QString(current_address->ad_mailbox_name);
from+="@";
}
if (current_address->ad_host_name) {
from+=QString(current_address->ad_host_name);
}
if (named_from && (current_address->ad_mailbox_name || current_address->ad_host_name)) {
from+=">";
}
l.append(QString(from));
if (++count > 99) {
break;
}
}
return l;
}
-encodedString*IMAPwrapper::fetchRawPart(const RecMailP&mail,const QValueList<int>&path,bool internal_call)
+encodedString*IMAPwrapper::fetchRawPart(const RecMailP&mail,const Q3ValueList<int>&path,bool internal_call)
{
encodedString*res=new encodedString;
int err;
mailimap_fetch_type *fetchType;
mailimap_set *set;
clistcell*current,*cur;
mailimap_section_part * section_part = 0;
mailimap_section_spec * section_spec = 0;
mailimap_section * section = 0;
mailimap_fetch_att * fetch_att = 0;
login();
if (!m_imap) {
return res;
}
if (!internal_call) {
err = selectMbox(mail->getMbox());
if ( err != MAILIMAP_NO_ERROR ) {
return res;
}
}
set = mailimap_set_new_single(mail->getNumber());
clist*id_list = 0;
@@ -717,57 +719,57 @@ encodedString*IMAPwrapper::fetchRawPart(const RecMailP&mail,const QValueList<int
mailimap_msg_att * msg_att;
msg_att = (mailimap_msg_att*)current->data;
mailimap_msg_att_item*msg_att_item;
for(cur = clist_begin(msg_att->att_list) ; cur != NULL ; cur = clist_next(cur)) {
msg_att_item = (mailimap_msg_att_item*)clist_content(cur);
if (msg_att_item->att_type == MAILIMAP_MSG_ATT_ITEM_STATIC) {
if (msg_att_item->att_data.att_static->att_type == MAILIMAP_MSG_ATT_BODY_SECTION) {
char*text = msg_att_item->att_data.att_static->att_data.att_body_section->sec_body_part;
/* detach - we take over the content */
msg_att_item->att_data.att_static->att_data.att_body_section->sec_body_part = 0L;
res->setContent(text,msg_att_item->att_data.att_static->att_data.att_body_section->sec_length);
}
}
}
} else {
;//odebug << "error fetching text: " << m_imap->imap_response << "" << oendl;
}
if (result) mailimap_fetch_list_free(result);
return res;
}
/* current_recursion is for recursive calls.
current_count means the position inside the internal loop! */
void IMAPwrapper::traverseBody(const RecMailP&mail,mailimap_body*body,RecBodyP&target_body,
- int current_recursion,QValueList<int>recList,int current_count)
+ int current_recursion,Q3ValueList<int>recList,int current_count)
{
if (!body || current_recursion>=10) {
return;
}
switch (body->bd_type) {
case MAILIMAP_BODY_1PART:
{
- QValueList<int>countlist = recList;
+ Q3ValueList<int>countlist = recList;
countlist.append(current_count);
RecPartP currentPart = new RecPart();
mailimap_body_type_1part*part1 = body->bd_data.bd_body_1part;
QString id("");
currentPart->setPositionlist(countlist);
for (unsigned int j = 0; j < countlist.count();++j) {
id+=(j>0?" ":"");
id+=QString("%1").arg(countlist[j]);
}
//odebug << "ID = " << id.latin1() << "" << oendl;
currentPart->setIdentifier(id);
fillSinglePart(currentPart,part1);
/* important: Check for is NULL 'cause a body can be empty!
And we put it only into the mail if it is the FIRST part */
if (part1->bd_type==MAILIMAP_BODY_TYPE_1PART_TEXT && target_body->Bodytext().isNull() && countlist[0]==1) {
QString body_text = fetchTextPart(mail,countlist,true,currentPart->Encoding());
size_t index = 0;
char*res = 0;
int err = MAILIMF_NO_ERROR;
QString charset = currentPart->searchParamter( "charset");
qDebug("CHARSET %s ",charset.latin1() );
if ( false ) {
@@ -778,49 +780,49 @@ void IMAPwrapper::traverseBody(const RecMailP&mail,mailimap_body*body,RecBodyP&t
err = mailmime_encoded_phrase_parse(charset.latin1(),
body_text.latin1(), body_text.length(),&index, "utf-8",&res);
if (err == MAILIMF_NO_ERROR && res && strlen(res)) {
//qDebug("res %d %s ", index, res);
body_text = QString::fromUtf8(res);
}
if (res) free(res);
}
//qDebug("encoding %d text %s ",currentPart->Encoding().latin1(), body_text.latin1() );
target_body->setDescription(currentPart);
target_body->setBodytext(body_text);
if (countlist.count()>1) {
target_body->addPart(currentPart);
}
} else {
target_body->addPart(currentPart);
}
if (part1->bd_type==MAILIMAP_BODY_TYPE_1PART_MSG) {
traverseBody(mail,part1->bd_data.bd_type_msg->bd_body,target_body,current_recursion+1,countlist);
}
}
break;
case MAILIMAP_BODY_MPART:
{
- QValueList<int>countlist = recList;
+ Q3ValueList<int>countlist = recList;
clistcell*current=0;
mailimap_body*current_body=0;
unsigned int ccount = 1;
mailimap_body_type_mpart*mailDescription = body->bd_data.bd_body_mpart;
for (current=clist_begin(mailDescription->bd_list);current!=0;current=clist_next(current)) {
current_body = (mailimap_body*)current->data;
if (current_body->bd_type==MAILIMAP_BODY_MPART) {
RecPartP targetPart = new RecPart();
targetPart->setType("multipart");
fillMultiPart(targetPart,mailDescription);
countlist.append(current_count);
targetPart->setPositionlist(countlist);
target_body->addPart(targetPart);
QString id("");
for (unsigned int j = 0; j < countlist.count();++j) {
id+=(j>0?" ":"");
id+=QString("%1").arg(countlist[j]);
}
// odebug << "ID(mpart) = " << id.latin1() << "" << oendl;
}
traverseBody(mail,current_body,target_body,current_recursion+1,countlist,ccount);
if (current_body->bd_type==MAILIMAP_BODY_MPART) {
countlist = recList;
}
@@ -964,69 +966,69 @@ void IMAPwrapper::fillBodyFields(RecPartP&target_part,mailimap_body_fields*which
case MAILIMAP_BODY_FLD_ENC_BINARY:
encoding="binary";
break;
case MAILIMAP_BODY_FLD_ENC_BASE64:
encoding="base64";
break;
case MAILIMAP_BODY_FLD_ENC_QUOTED_PRINTABLE:
encoding="quoted-printable";
break;
case MAILIMAP_BODY_FLD_ENC_OTHER:
default:
if (enc->enc_value) {
char*t=enc->enc_value;
encoding=QString(enc->enc_value);
enc->enc_value=0L;
free(t);
}
}
if (which->bd_description) {
target_part->setDescription(QString(which->bd_description));
}
target_part->setEncoding(encoding);
target_part->setSize(which->bd_size);
}
-void IMAPwrapper::deleteMailList(const QValueList<RecMailP>&target)
+void IMAPwrapper::deleteMailList(const Q3ValueList<RecMailP>&target)
{
//#if 0
mailimap_flag_list*flist;
mailimap_set *set;
mailimap_store_att_flags * store_flags;
int err;
login();
//#endif
if (!m_imap) {
return;
}
int iii = 0;
int count = target.count();
// qDebug("imap remove count %d ", count);
mMax = count;
progress( i18n("Delete"));
- QProgressBar wid ( count );
+ Q3ProgressBar wid ( count );
wid.setCaption( i18n("Deleting ..."));
wid.show();
while (iii < count ) {
Global::statusMessage(i18n("Delete message %1 of %2").arg(iii).arg(count));
wid.setProgress( iii );
wid.raise();
qApp->processEvents();
RecMailP mail = (*target.at( iii ));
//#if 0
//qDebug("IMAP remove %d %d ", iii, mail->getNumber() );
err = selectMbox(mail->getMbox());
if ( err != MAILIMAP_NO_ERROR ) {
return;
}
flist = mailimap_flag_list_new_empty();
mailimap_flag_list_add(flist,mailimap_flag_new_deleted());
store_flags = mailimap_store_att_flags_new_set_flags(flist);
set = mailimap_set_new_single(mail->getNumber());
err = mailimap_store(m_imap,set,store_flags);
mailimap_set_free( set );
mailimap_store_att_flags_free(store_flags);
if (err != MAILIMAP_NO_ERROR) {
// odebug << "error deleting mail: " << m_imap->imap_response << "" << oendl;
@@ -1093,49 +1095,49 @@ void IMAPwrapper::answeredMail(const RecMailP&mail)
mailimap_store_att_flags * store_flags;
int err;
login();
if (!m_imap) {
return;
}
err = selectMbox(mail->getMbox());
if ( err != MAILIMAP_NO_ERROR ) {
return;
}
flist = mailimap_flag_list_new_empty();
mailimap_flag_list_add(flist,mailimap_flag_new_answered());
store_flags = mailimap_store_att_flags_new_add_flags(flist);
set = mailimap_set_new_single(mail->getNumber());
err = mailimap_store(m_imap,set,store_flags);
mailimap_set_free( set );
mailimap_store_att_flags_free(store_flags);
if (err != MAILIMAP_NO_ERROR) {
// odebug << "error marking mail: " << m_imap->imap_response << "" << oendl;
return;
}
}
-QString IMAPwrapper::fetchTextPart(const RecMailP&mail,const QValueList<int>&path,bool internal_call,const QString&enc)
+QString IMAPwrapper::fetchTextPart(const RecMailP&mail,const Q3ValueList<int>&path,bool internal_call,const QString&enc)
{
QString body("");
encodedString*res = fetchRawPart(mail,path,internal_call);
encodedString*r = decode_String(res,enc);
delete res;
if (r) {
if (r->Length()>0) {
body = r->Content();
}
delete r;
}
return body;
}
QString IMAPwrapper::fetchTextPart(const RecMailP&mail,const RecPartP&part)
{
return fetchTextPart(mail,part->Positionlist(),false,part->Encoding());
}
encodedString* IMAPwrapper::fetchDecodedPart(const RecMailP&mail,const RecPartP&part)
{
encodedString*res = fetchRawPart(mail,part->Positionlist(),false);
encodedString*r = decode_String(res,part->Encoding());
delete res;
@@ -1278,49 +1280,49 @@ void IMAPwrapper::storeMessage(const char*msg,size_t length, const QString&folde
{
login();
if (!m_imap) return;
if (!msg) return;
int r = mailimap_append(m_imap,(char*)folder.latin1(),0,0,msg,length);
if (r != MAILIMAP_NO_ERROR) {
Global::statusMessage("Error storing mail!");
}
}
MAILLIB::ATYPE IMAPwrapper::getType()const
{
return account->getType();
}
const QString&IMAPwrapper::getName()const
{
// odebug << "Get name: " << account->getAccountName().latin1() << "" << oendl;
return account->getAccountName();
}
encodedString* IMAPwrapper::fetchRawBody(const RecMailP&mail)
{
// dummy
- QValueList<int> path;
+ Q3ValueList<int> path;
return fetchRawPart(mail,path,false);
}
void IMAPwrapper::mvcpAllMails(const FolderP&fromFolder,
const QString&targetFolder,AbstractMail*targetWrapper,bool moveit, int maxSizeInKb)
{
if (targetWrapper != this || maxSizeInKb > 0 ) {
mMax = 0;
progress( i18n("Copy"));
AbstractMail::mvcpAllMails(fromFolder,targetFolder,targetWrapper,moveit, maxSizeInKb);
//qDebug("IMAPwrapper::mvcpAllMails::Using generic");
// odebug << "Using generic" << oendl;
return;
}
mailimap_set *set = 0;
login();
if (!m_imap) {
return;
}
int err = selectMbox(fromFolder->getName());
if ( err != MAILIMAP_NO_ERROR ) {
return;
}
Global::statusMessage( i18n("Copying mails on server...") );
diff --git a/kmicromail/libmailwrapper/imapwrapper.h b/kmicromail/libmailwrapper/imapwrapper.h
index 31c60a8..d3d3ecd 100644
--- a/kmicromail/libmailwrapper/imapwrapper.h
+++ b/kmicromail/libmailwrapper/imapwrapper.h
@@ -1,85 +1,87 @@
// CHANGED 2004-09-31 Lutz Rogowski
#ifndef __IMAPWRAPPER
#define __IMAPWRAPPER
#include <qlist.h>
+//Added by qt3to4:
+#include <Q3ValueList>
#include "mailwrapper.h"
#include "abstractmail.h"
#include <libetpan/clist.h>
struct mailimap;
struct mailimap_body;
struct mailimap_body_type_1part;
struct mailimap_body_type_text;
struct mailimap_body_type_basic;
struct mailimap_body_type_msg;
struct mailimap_body_type_mpart;
struct mailimap_body_fields;
struct mailimap_msg_att;
class encodedString;
class IMAPwrapper : public AbstractMail
{
Q_OBJECT
public:
IMAPwrapper( IMAPaccount *a );
virtual ~IMAPwrapper();
- virtual QValueList<Opie::Core::OSmartPointer<Folder> >* listFolders();
- virtual void listMessages(const QString & mailbox,QValueList<Opie::Core::OSmartPointer<RecMail> >&target , int sizeInKb = 0);
+ virtual Q3ValueList<Opie::Core::OSmartPointer<Folder> >* listFolders();
+ virtual void listMessages(const QString & mailbox,Q3ValueList<Opie::Core::OSmartPointer<RecMail> >&target , int sizeInKb = 0);
virtual void statusFolder(folderStat&target_stat,const QString & mailbox="INBOX");
virtual void deleteMail(const RecMailP&mail);
- void deleteMailList(const QValueList<RecMailP>&target);
+ void deleteMailList(const Q3ValueList<RecMailP>&target);
virtual void answeredMail(const RecMailP&mail);
virtual int deleteAllMail(const Opie::Core::OSmartPointer<Folder>&folder);
virtual void storeMessage(const char*msg,size_t length, const QString&folder);
virtual void mvcpAllMails(const Opie::Core::OSmartPointer<Folder>&fromFolder,
const QString&targetFolder,AbstractMail*targetWrapper,bool moveit,int sizeInKb = 0);
virtual void mvcpMail(const RecMailP&mail,const QString&targetFolder,AbstractMail*targetWrapper,bool moveit);
virtual RecBodyP fetchBody(const RecMailP&mail);
virtual QString fetchTextPart(const RecMailP&mail,const RecPartP&part);
virtual encodedString* fetchDecodedPart(const RecMailP&mail,const RecPartP&part);
virtual encodedString* fetchRawPart(const RecMailP&mail,const RecPartP&part);
virtual encodedString* fetchRawBody(const RecMailP&mail);
virtual int createMbox(const QString&,const Opie::Core::OSmartPointer<Folder>&parentfolder=0,
const QString& delemiter="/",bool getsubfolder=false);
virtual int deleteMbox(const Opie::Core::OSmartPointer<Folder>&folder);
static void imap_progress( size_t current, size_t maximum );
virtual void logout();
virtual MAILLIB::ATYPE getType()const;
virtual const QString&getName()const;
virtual Account* getAccount() { return account; };
protected:
RecMail*parse_list_result(mailimap_msg_att*);
void login(bool tryTLS = true);
bool start_tls(bool force=true);
- virtual QString fetchTextPart(const RecMailP&mail,const QValueList<int>&path,bool internal_call=false,const QString&enc="");
- virtual encodedString*fetchRawPart(const RecMailP&mail,const QValueList<int>&path,bool internal_call);
+ virtual QString fetchTextPart(const RecMailP&mail,const Q3ValueList<int>&path,bool internal_call=false,const QString&enc="");
+ virtual encodedString*fetchRawPart(const RecMailP&mail,const Q3ValueList<int>&path,bool internal_call);
int selectMbox(const QString&mbox);
void fillSinglePart(RecPartP&target_part,mailimap_body_type_1part*Description);
void fillSingleTextPart(RecPartP&target_part,mailimap_body_type_text*which);
void fillSingleBasicPart(RecPartP&target_part,mailimap_body_type_basic*which);
void fillSingleMsgPart(RecPartP&target_part,mailimap_body_type_msg*which);
void fillMultiPart(RecPartP&target_part,mailimap_body_type_mpart*which);
- void traverseBody(const RecMailP&mail,mailimap_body*body,RecBodyP&target_body,int current_recursion,QValueList<int>recList,int current_count=1);
+ void traverseBody(const RecMailP&mail,mailimap_body*body,RecBodyP&target_body,int current_recursion,Q3ValueList<int>recList,int current_count=1);
/* just helpers */
static void fillBodyFields(RecPartP&target_part,mailimap_body_fields*which);
static QStringList address_list_to_stringlist(clist*list);
static void progress(QString mess = QString::null);
static int mCurrent;
static int mMax;
IMAPaccount *account;
mailimap *m_imap;
QString m_Lastmbox;
};
#endif
diff --git a/kmicromail/libmailwrapper/libmailwrapper.pro b/kmicromail/libmailwrapper/libmailwrapper.pro
index 646630b..6b595ab 100644
--- a/kmicromail/libmailwrapper/libmailwrapper.pro
+++ b/kmicromail/libmailwrapper/libmailwrapper.pro
@@ -17,49 +17,55 @@ HEADERS = mailwrapper.h \
nntpwrapper.h \
generatemail.h \
storemail.h \
../qpe/global.h
SOURCES = imapwrapper.cpp \
mailwrapper.cpp \
mailtypes.cpp \
pop3wrapper.cpp \
abstractmail.cpp \
smtpwrapper.cpp \
genericwrapper.cpp \
mboxwrapper.cpp \
settings.cpp \
logindialog.cpp \
sendmailprogress.cpp \
statusmail.cpp \
mhwrapper.cpp \
nntpwrapper.cpp \
generatemail.cpp \
storemail.cpp \
../qpe/qdialog_hacked.cpp \
../qpe/global.cpp
-INTERFACES = logindialogui.ui \
+#The following line was changed from INTERFACES to FORMS3 by qt3to4
+FORMS3 = logindialogui.ui \
sendmailprogressui.ui
INCLUDEPATH += ../qpe .. ../../microkde ../../microkde/kdecore ../../libetpan/include
LIBS += -lssl -lcrypto
#-lqpe -letpan
DESTDIR = ../../bin
TARGET = micromailwrapper
DEFINES += DESKTOP_VERSION
unix : {
OBJECTS_DIR = obj/unix
MOC_DIR = moc/unix
}
win32: {
DEFINES += _WIN32_
LIBS += mfc71u.lib
QMAKE_LINK += /NODEFAULTLIB:LIBC
#QMAKE_LINK += /NODEFAULTLIB:MSVCRT
#QMAKE_LINK += /NODEFAULTLIB:uafxcw.lib
OBJECTS_DIR = obj/win
MOC_DIR = moc/win
}
+#The following line was inserted by qt3to4
+QT += xml qt3support
+#The following line was inserted by qt3to4
+CONFIG += uic3
+
diff --git a/kmicromail/libmailwrapper/logindialog.cpp b/kmicromail/libmailwrapper/logindialog.cpp
index 31b75d0..d1f4b5d 100644
--- a/kmicromail/libmailwrapper/logindialog.cpp
+++ b/kmicromail/libmailwrapper/logindialog.cpp
@@ -1,33 +1,33 @@
#include <qlineedit.h>
#include "logindialog.h"
//using namespace Opie::Core;
-LoginDialog::LoginDialog(const QString&user,const QString&pass, QWidget *parent, const char *name, bool modal, WFlags flags )
+LoginDialog::LoginDialog(const QString&user,const QString&pass, QWidget *parent, const char *name, bool modal, Qt::WFlags flags )
: LoginDialogUI( parent, name, modal, flags )
{
userLine->setText( (user.isEmpty()?QString(""):user) );
passLine->setText( (pass.isEmpty()?QString(""):pass) );
_user = user;
_pass = pass;
if ( user.isEmpty() ) {
userLine->setFocus();
} else {
passLine->setFocus();
}
}
void LoginDialog::accept()
{
//_user.replace( 0, _user.length(), userLine->text() );
//_pass.replace( 0, _pass.length(), passLine->text() );
_user = userLine->text();
_pass = passLine->text();
//odebug << "User im accept: |" << _user.latin1() << "|" << oendl;
QDialog::accept();
}
diff --git a/kmicromail/libmailwrapper/logindialog.h b/kmicromail/libmailwrapper/logindialog.h
index f406f2c..a18daa5 100644
--- a/kmicromail/libmailwrapper/logindialog.h
+++ b/kmicromail/libmailwrapper/logindialog.h
@@ -1,23 +1,23 @@
#ifndef LOGINDIALOG_H
#define LOGINDIALOG_H
#include "logindialogui.h"
class LoginDialog : public LoginDialogUI
{
Q_OBJECT
public:
- LoginDialog(const QString&user,const QString&pass, QWidget *parent = 0, const char *name = 0, bool modal = false, WFlags flags = 0 );
+ LoginDialog(const QString&user,const QString&pass, QWidget *parent = 0, const char *name = 0, bool modal = false, Qt::WFlags flags = 0 );
QString getUser() { return _user; }
QString getPassword() { return _pass; }
protected slots:
void accept();
private:
QString _user, _pass;
};
#endif
diff --git a/kmicromail/libmailwrapper/mailtypes.cpp b/kmicromail/libmailwrapper/mailtypes.cpp
index 70a0ab5..84ccf9f 100644
--- a/kmicromail/libmailwrapper/mailtypes.cpp
+++ b/kmicromail/libmailwrapper/mailtypes.cpp
@@ -1,29 +1,31 @@
#include "mailtypes.h"
//#include <opie2/odebug.h>
#include <stdlib.h>
+//Added by qt3to4:
+#include <Q3ValueList>
using namespace Opie::Core;
RecMail::RecMail()
:Opie::Core::ORefCount(),subject(""),date(""),from(""),mbox(""),msg_id(""),msg_number(0),msg_size(0),msg_flags(7)
{
init();
}
RecMail::RecMail(const RecMail&old)
:Opie::Core::ORefCount(),subject(""),date(""),from(""),mbox(""),msg_id(""),msg_number(0),msg_flags(7)
{
init();
copy_old(old);
// odebug << "Copy constructor RecMail" << oendl;
}
RecMail::~RecMail()
{
wrapper = 0;
}
static bool stringCompareRec( const QString& s1, const QString& s2 )
{
if ( s1.isEmpty() && s2.isEmpty() )
return true;
@@ -262,95 +264,95 @@ void RecPart::setParameters(const part_plist_t&list)
{
m_Parameters = list;
}
const part_plist_t& RecPart::Parameters()const
{
return m_Parameters;
}
void RecPart::addParameter(const QString&key,const QString&value)
{
m_Parameters[key]=value;
}
const QString RecPart::searchParamter(const QString&key)const
{
QString value("");
part_plist_t::ConstIterator it = m_Parameters.find(key);
if (it != m_Parameters.end()) {
value = it.data();
}
return value;
}
-void RecPart::setPositionlist(const QValueList<int>&poslist)
+void RecPart::setPositionlist(const Q3ValueList<int>&poslist)
{
m_poslist = poslist;
}
-const QValueList<int>& RecPart::Positionlist()const
+const Q3ValueList<int>& RecPart::Positionlist()const
{
return m_poslist;
}
RecBody::RecBody()
: Opie::Core::ORefCount(),m_BodyText(),m_description(new RecPart())
{
m_PartsList.clear();
}
RecBody::RecBody(const RecBody&old)
:Opie::Core::ORefCount(),m_BodyText(),m_PartsList(),m_description(new RecPart())
{
m_BodyText = old.m_BodyText;
m_PartsList = old.m_PartsList;
m_description = old.m_description;
mCharset = old.mCharset;
// odebug << "Recbody copy constructor" << oendl;
}
RecBody::~RecBody()
{
}
void RecBody::setBodytext(const QString&bodyText)
{
m_BodyText = bodyText;
}
const QString& RecBody::Bodytext()const
{
return m_BodyText;
}
-void RecBody::setParts(const QValueList<RecPartP>&parts)
+void RecBody::setParts(const Q3ValueList<RecPartP>&parts)
{
m_PartsList.clear();
m_PartsList = parts;
}
-const QValueList<RecPartP>& RecBody::Parts()const
+const Q3ValueList<RecPartP>& RecBody::Parts()const
{
return m_PartsList;
}
void RecBody::addPart(const RecPartP& part)
{
m_PartsList.append(part);
}
void RecBody::setDescription(const RecPartP&des)
{
m_description = des;
}
const RecPartP& RecBody::Description()const
{
return m_description;
}
void RecBody::setCharset(const QString& str)
{
mCharset = str;
}
diff --git a/kmicromail/libmailwrapper/mailtypes.h b/kmicromail/libmailwrapper/mailtypes.h
index 97f10d7..ac7f8da 100644
--- a/kmicromail/libmailwrapper/mailtypes.h
+++ b/kmicromail/libmailwrapper/mailtypes.h
@@ -1,41 +1,41 @@
#ifndef __MAIL_TYPES_H
#define __MAIL_TYPES_H
#define FLAG_ANSWERED 0
#define FLAG_FLAGGED 1
#define FLAG_DELETED 2
#define FLAG_SEEN 3
#define FLAG_DRAFT 4
#define FLAG_RECENT 5
#include <opie2/osmartpointer.h>
#include <qbitarray.h>
#include <qstring.h>
#include <qstringlist.h>
#include <qmap.h>
-#include <qvaluelist.h>
+#include <q3valuelist.h>
class AbstractMail;
/* a class to describe mails in a mailbox */
/* Attention!
From programmers point of view it would make sense to
store the mail body into this class, too.
But: not from the point of view of the device.
Mailbodies can be real large. So we request them when
needed from the mail-wrapper class direct from the server itself
(imap) or from a file-based cache (pop3?)
So there is no interface "const QString&body()" but you should
make a request to the mailwrapper with this class as parameter to
get the body. Same words for the attachments.
*/
class RecMail:public Opie::Core::ORefCount
{
public:
RecMail();
RecMail(const RecMail&old);
virtual ~RecMail();
bool isEqual( RecMail* r1 );
const unsigned int getNumber()const{return msg_number;}
void setNumber(unsigned int number){msg_number=number;}
@@ -88,103 +88,103 @@ public:
AbstractMail* Wrapper();
// public for debugging
QString subject,date,isodate,from,mbox,msg_id,replyto;
protected:
//QString subject,date,isodate,from,mbox,msg_id,replyto;
unsigned int msg_number,msg_size;
QBitArray msg_flags;
QStringList to,cc,bcc,in_reply_to,references;
AbstractMail*wrapper;
void init();
void copy_old(const RecMail&old);
};
typedef Opie::Core::OSmartPointer<RecMail> RecMailP;
typedef QMap<QString,QString> part_plist_t;
class RecPart:public Opie::Core::ORefCount
{
protected:
QString m_type,m_subtype,m_identifier,m_encoding,m_description;
unsigned int m_lines,m_size;
part_plist_t m_Parameters;
/* describes the position in the mail */
- QValueList<int> m_poslist;
+ Q3ValueList<int> m_poslist;
public:
RecPart();
RecPart(const RecPart&);
virtual ~RecPart();
const QString&Type()const;
void setType(const QString&type);
const QString&Subtype()const;
void setSubtype(const QString&subtype);
const QString&Identifier()const;
void setIdentifier(const QString&identifier);
const QString&Encoding()const;
void setEncoding(const QString&encoding);
const QString&Description()const;
void setDescription(const QString&desc);
void setLines(unsigned int lines);
const unsigned int Lines()const;
void setSize(unsigned int size);
const unsigned int Size()const;
void setParameters(const part_plist_t&list);
const part_plist_t&Parameters()const;
void addParameter(const QString&key,const QString&value);
const QString searchParamter(const QString&key)const;
- void setPositionlist(const QValueList<int>&poslist);
- const QValueList<int>& Positionlist()const;
+ void setPositionlist(const Q3ValueList<int>&poslist);
+ const Q3ValueList<int>& Positionlist()const;
};
typedef Opie::Core::OSmartPointer<RecPart> RecPartP;
class RecBody:public Opie::Core::ORefCount
{
protected:
QString m_BodyText;
QString mCharset;
- QValueList<RecPartP> m_PartsList;
+ Q3ValueList<RecPartP> m_PartsList;
RecPartP m_description;
public:
RecBody();
RecBody(const RecBody&old);
virtual ~RecBody();
void setBodytext(const QString&);
const QString& Bodytext()const;
void setCharset(const QString&);
QString getCharset()const;
void setDescription(const RecPartP&des);
const RecPartP& Description()const;
- void setParts(const QValueList<RecPartP>&parts);
- const QValueList<RecPartP>& Parts()const;
+ void setParts(const Q3ValueList<RecPartP>&parts);
+ const Q3ValueList<RecPartP>& Parts()const;
void addPart(const RecPartP&part);
};
typedef Opie::Core::OSmartPointer<RecBody> RecBodyP;
class encodedString
{
public:
encodedString();
/*
creates an new content string.
it makes a deep copy of it!
*/
encodedString(const char*nContent,unsigned int length);
/*
Take over the nContent. Means: it will just copy the pointer, not the content.
so make sure: No one else frees the string, the string has allocated with
malloc for compatibility with c-based libs
*/
encodedString(char*nContent,unsigned int nSize);
/* copy construkor - makes ALWAYS a deep copy!!!! */
encodedString(const encodedString&old);
/* assign operator - makes ALWAYS a deep copy!!!! */
encodedString& operator=(const encodedString&old);
diff --git a/kmicromail/libmailwrapper/mailwrapper.cpp b/kmicromail/libmailwrapper/mailwrapper.cpp
index 2ee1ab3..9c299e8 100644
--- a/kmicromail/libmailwrapper/mailwrapper.cpp
+++ b/kmicromail/libmailwrapper/mailwrapper.cpp
@@ -1,31 +1,33 @@
#include <stdlib.h>
#include <sys/stat.h>
#include <sys/types.h>
#include <unistd.h>
#include <fcntl.h>
#include <string.h>
#include <qdir.h>
+//Added by qt3to4:
+#include <Q3CString>
#include "mailwrapper.h"
//#include "logindialog.h"
//#include "defines.h"
#define UNDEFINED 64
#define MAXLINE 76
#define UTF16MASK 0x03FFUL
#define UTF16SHIFT 10
#define UTF16BASE 0x10000UL
#define UTF16HIGHSTART 0xD800UL
#define UTF16HIGHEND 0xDBFFUL
#define UTF16LOSTART 0xDC00UL
#define UTF16LOEND 0xDFFFUL
using namespace Opie::Core;
Attachment::Attachment( QString lnk )
{
doc = lnk;
size = QFileInfo( doc ).size();
mPix = SmallIcon( "files" );
}
@@ -60,117 +62,117 @@ IMAPFolder::IMAPFolder(const QString&t_name,const QString&sep, bool select,bool
if (prefix.length()>0) {
if (nameDisplay.startsWith(prefix) && nameDisplay.length()>prefix.length()) {
nameDisplay=nameDisplay.right(nameDisplay.length()-prefix.length());
}
}
}
IMAPFolder::~IMAPFolder()
{
}
static unsigned char base64chars[] =
"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+,";
/**
* Decodes base64 encoded parts of the imapfolder name
* Code taken from kde cvs: kdebase/kioslave/imap4/rfcdecoder.cc
*/
QString IMAPFolder::decodeFolderName( const QString &name )
{
unsigned char c, i, bitcount;
unsigned long ucs4, utf16, bitbuf;
unsigned char base64[256], utf8[6];
unsigned long srcPtr = 0;
- QCString dst = "";
- QCString src = name.ascii();
+ Q3CString dst = "";
+ Q3CString src = name.ascii();
/* initialize modified base64 decoding table */
memset(base64, UNDEFINED, sizeof(base64));
for (i = 0; i < sizeof(base64chars); ++i) {
base64[(int)base64chars[i]] = i;
}
/* loop until end of string */
while (srcPtr < src.length ()) {
- c = src[srcPtr++];
+ c = src.at(srcPtr++);
/* deal with literal characters and &- */
- if (c != '&' || src[srcPtr] == '-') {
+ if (c != '&' || src.at(srcPtr) == '-') {
/* encode literally */
dst += c;
/* skip over the '-' if this is an &- sequence */
if (c == '&')
srcPtr++;
} else {
/* convert modified UTF-7 -> UTF-16 -> UCS-4 -> UTF-8 -> HEX */
bitbuf = 0;
bitcount = 0;
ucs4 = 0;
- while ((c = base64[(unsigned char) src[srcPtr]]) != UNDEFINED) {
+ while ((c = base64[(unsigned char) src.at(srcPtr)]) != UNDEFINED) {
++srcPtr;
bitbuf = (bitbuf << 6) | c;
bitcount += 6;
/* enough bits for a UTF-16 character? */
if (bitcount >= 16) {
bitcount -= 16;
utf16 = (bitcount ? bitbuf >> bitcount : bitbuf) & 0xffff;
/* convert UTF16 to UCS4 */
if (utf16 >= UTF16HIGHSTART && utf16 <= UTF16HIGHEND) {
ucs4 = (utf16 - UTF16HIGHSTART) << UTF16SHIFT;
continue;
} else if (utf16 >= UTF16LOSTART && utf16 <= UTF16LOEND) {
ucs4 += utf16 - UTF16LOSTART + UTF16BASE;
} else {
ucs4 = utf16;
}
/* convert UTF-16 range of UCS4 to UTF-8 */
if (ucs4 <= 0x7fUL) {
utf8[0] = ucs4;
i = 1;
} else if (ucs4 <= 0x7ffUL) {
utf8[0] = 0xc0 | (ucs4 >> 6);
utf8[1] = 0x80 | (ucs4 & 0x3f);
i = 2;
} else if (ucs4 <= 0xffffUL) {
utf8[0] = 0xe0 | (ucs4 >> 12);
utf8[1] = 0x80 | ((ucs4 >> 6) & 0x3f);
utf8[2] = 0x80 | (ucs4 & 0x3f);
i = 3;
} else {
utf8[0] = 0xf0 | (ucs4 >> 18);
utf8[1] = 0x80 | ((ucs4 >> 12) & 0x3f);
utf8[2] = 0x80 | ((ucs4 >> 6) & 0x3f);
utf8[3] = 0x80 | (ucs4 & 0x3f);
i = 4;
}
/* copy it */
for (c = 0; c < i; ++c) {
dst += utf8[c];
}
}
}
/* skip over trailing '-' in modified UTF-7 encoding */
- if (src[srcPtr] == '-')
+ if (src.at(srcPtr) == '-')
++srcPtr;
}
}
return QString::fromUtf8( dst.data() );
}
Mail::Mail()
:Opie::Core::ORefCount(),name(""), mail(""), to(""), cc(""), bcc(""), reply(""), subject(""), message("")
{
}
MHFolder::MHFolder(const QString&disp_name,const QString&mbox)
: Folder( disp_name,"/" )
{
separator = "/";
name = mbox;
if (!disp_name.startsWith("/") && disp_name.length()>0)
name+="/";
name+=disp_name;
if (disp_name.length()==0) {
nameDisplay = separator;
}
prefix = mbox;
diff --git a/kmicromail/libmailwrapper/mailwrapper.h b/kmicromail/libmailwrapper/mailwrapper.h
index 3e8b51f..bebabf4 100644
--- a/kmicromail/libmailwrapper/mailwrapper.h
+++ b/kmicromail/libmailwrapper/mailwrapper.h
@@ -1,32 +1,34 @@
#ifndef MAILWRAPPER_H
#define MAILWRAPPER_H
//#include <qpe/applnk.h>
#include <qbitarray.h>
#include <qdatetime.h>
#include <qfileinfo.h>
+//Added by qt3to4:
+#include <QPixmap>
#include <kiconloader.h>
#include "settings.h"
#include <opie2/osmartpointer.h>
/*
class Attachment
{
public:
Attachment( DocLnk lnk );
virtual ~Attachment(){}
const QString getFileName()const{ return doc.file(); }
const QString getName()const{ return doc.name(); }
const QString getMimeType()const{ return doc.type(); }
const QPixmap getPixmap()const{ return doc.pixmap(); }
const int getSize()const { return size; }
DocLnk getDocLnk() { return doc; }
protected:
DocLnk doc;
int size;
};
*/
@@ -40,74 +42,74 @@ public:
const QString getName()const{ return QFileInfo( doc ).baseName (); }
const QString getMimeType()const{ return QFileInfo( doc ).extension(false); }
const QPixmap getPixmap()const{ return mPix; }
const int getSize()const { return size; }
QString getDocLnk() { return doc; }
protected:
QPixmap mPix;
QString doc;
int size;
};
class Mail:public Opie::Core::ORefCount
{
public:
Mail();
/* Possible that this destructor must not be declared virtual
* 'cause it seems that it will never have some child classes.
* in this case this object will not get a virtual table -> memory and
* speed will be a little bit better?
*/
virtual ~Mail(){}
void addAttachment( Attachment *att ) { attList.append( att ); }
- const QList<Attachment>& getAttachments()const { return attList; }
+ const QList<Attachment*>& getAttachments()const { return attList; }
void removeAttachment( Attachment *att ) { attList.remove( att ); }
const QString&getName()const { return name; }
void setName( QString s ) { name = s; }
const QString&getMail()const{ return mail; }
void setMail( const QString&s ) { mail = s; }
const QString&getTo()const{ return to; }
void setTo( const QString&s ) { to = s; }
const QString&getCC()const{ return cc; }
void setCC( const QString&s ) { cc = s; }
const QString&getBCC()const { return bcc; }
void setBCC( const QString&s ) { bcc = s; }
const QString&getMessage()const { return message; }
void setMessage( const QString&s ) { message = s; }
const QString&getSubject()const { return subject; }
void setSubject( const QString&s ) { subject = s; }
const QString&getReply()const{ return reply; }
void setReply( const QString&a ) { reply = a; }
void setInreply(const QStringList&list){m_in_reply_to = list;}
const QStringList&Inreply()const{return m_in_reply_to;}
void setCharset( const QString&a ) { charset= a; }
const QString& getCharset() const { return charset; }
private:
- QList<Attachment> attList;
+ QList<Attachment*> attList;
QString name, mail, to, cc, bcc, reply, subject, message, charset;
QStringList m_in_reply_to;
};
class Folder:public Opie::Core::ORefCount
{
public:
Folder( const QString&init_name,const QString&sep );
virtual ~Folder();
const QString&getDisplayName()const { return nameDisplay; }
const QString&getName()const { return name; }
const QString&getPrefix()const{return prefix; }
virtual bool may_select()const{return true;}
virtual bool no_inferior()const{return true;}
const QString&Separator()const;
protected:
QString nameDisplay, name, separator,prefix;
};
typedef Opie::Core::OSmartPointer<Folder> FolderP;
class MHFolder : public Folder
{
diff --git a/kmicromail/libmailwrapper/mboxwrapper.cpp b/kmicromail/libmailwrapper/mboxwrapper.cpp
index 87f8c8a..888cae2 100644
--- a/kmicromail/libmailwrapper/mboxwrapper.cpp
+++ b/kmicromail/libmailwrapper/mboxwrapper.cpp
@@ -1,77 +1,79 @@
#include "mboxwrapper.h"
#include "mailtypes.h"
#include "mailwrapper.h"
#include <libetpan/libetpan.h>
#include <qdir.h>
+//Added by qt3to4:
+#include <Q3ValueList>
#include <stdlib.h>
#include <klocale.h>
#include <qpe/global.h>
using namespace Opie::Core;
MBOXwrapper::MBOXwrapper(const QString & mbox_dir,const QString&mbox_name)
: Genericwrapper(),MBOXPath(mbox_dir),MBOXName(mbox_name)
{
QDir dir(MBOXPath);
if (!dir.exists()) {
dir.mkdir(MBOXPath);
}
}
MBOXwrapper::~MBOXwrapper()
{
}
-void MBOXwrapper::listMessages(const QString & mailbox, QValueList<RecMailP> &target )
+void MBOXwrapper::listMessages(const QString & mailbox, Q3ValueList<RecMailP> &target )
{
mailstorage*storage = mailstorage_new(NULL);
QString p = MBOXPath+"/";
p+=mailbox;
int r = mbox_mailstorage_init(storage,(char*)p.latin1(),0,0,0);
mailfolder*folder;
folder = mailfolder_new( storage,(char*)p.latin1(),NULL);
r = mailfolder_connect(folder);
if (r != MAIL_NO_ERROR) {
//odebug << "Error initializing mbox" << oendl;
mailfolder_free(folder);
mailstorage_free(storage);
return;
}
parseList(target,folder->fld_session,mailbox);
mailfolder_disconnect(folder);
mailfolder_free(folder);
mailstorage_free(storage);
Global::statusMessage(i18n("Mailbox has %1 mail(s)").arg(target.count()));
}
-QValueList<Opie::Core::OSmartPointer<Folder> >* MBOXwrapper::listFolders()
+Q3ValueList<Opie::Core::OSmartPointer<Folder> >* MBOXwrapper::listFolders()
{
- QValueList<Opie::Core::OSmartPointer<Folder> >* folders = new QValueList<Opie::Core::OSmartPointer<Folder> >();
+ Q3ValueList<Opie::Core::OSmartPointer<Folder> >* folders = new Q3ValueList<Opie::Core::OSmartPointer<Folder> >();
QDir dir(MBOXPath);
if (!dir.exists()) return folders;
dir.setFilter(QDir::Files|QDir::Writable|QDir::Readable);
QStringList entries = dir.entryList();
QStringList::ConstIterator it = entries.begin();
for (;it!=entries.end();++it) {
FolderP inb=new Folder(*it,"/");
folders->append(inb);
}
return folders;
}
void MBOXwrapper::deleteMail(const RecMailP & mail)
{
mailstorage*storage = mailstorage_new(NULL);
QString p = MBOXPath+"/";
p+=mail->getMbox();
int r = mbox_mailstorage_init(storage,(char*)p.latin1(),0,0,0);
mailfolder*folder;
folder = mailfolder_new( storage,(char*)p.latin1(),NULL);
r = mailfolder_connect(folder);
if (r != MAIL_NO_ERROR) {
; // << "Error initializing mbox" << oendl;
mailfolder_free(folder);
@@ -196,67 +198,67 @@ encodedString* MBOXwrapper::fetchRawBody(const RecMailP&mail)
}
r = mailsession_get_message(folder->fld_session, mail->getNumber(), &msg);
if (r != MAIL_NO_ERROR) {
Global::statusMessage(i18n("Error fetching mail %i").arg(mail->getNumber()));
mailfolder_free(folder);
mailstorage_free(storage);
return 0;
}
r = mailmessage_fetch(msg,&data,&size);
if (r != MAIL_NO_ERROR) {
Global::statusMessage(i18n("Error fetching mail %i").arg(mail->getNumber()));
mailfolder_free(folder);
mailstorage_free(storage);
mailmessage_free(msg);
return 0;
}
encodedString*result = new encodedString(data,size);
mailfolder_free(folder);
mailstorage_free(storage);
mailmessage_free(msg);
return result;
}
-void MBOXwrapper::deleteMails(const QString & mailbox,const QValueList<RecMailP> &target)
+void MBOXwrapper::deleteMails(const QString & mailbox,const Q3ValueList<RecMailP> &target)
{
QString p = MBOXPath+"/";
p+=mailbox;
mailmbox_folder*f = 0;
int r = mailmbox_init(p.latin1(),0,1,0,&f);
if (r != MAIL_NO_ERROR) {
; // << "Error init folder" << oendl;
return;
}
deleteMails(f,target);
mailmbox_done(f);
}
-void MBOXwrapper::deleteMails(mailmbox_folder*f,const QValueList<RecMailP> &target)
+void MBOXwrapper::deleteMails(mailmbox_folder*f,const Q3ValueList<RecMailP> &target)
{
if (!f) return;
int r;
- QValueList<RecMailP>::ConstIterator it;
+ Q3ValueList<RecMailP>::ConstIterator it;
for (it=target.begin(); it != target.end();++it) {
r = mailmbox_delete_msg(f,(*it)->getNumber());
if (r!=MAILMBOX_NO_ERROR) {
; // << "error delete mail" << oendl;
}
}
r = mailmbox_expunge(f);
if (r != MAILMBOX_NO_ERROR) {
; // << "error expunge mailbox" << oendl;
}
}
int MBOXwrapper::deleteAllMail(const FolderP&tfolder)
{
if (!tfolder) return 0;
QString p = MBOXPath+"/"+tfolder->getDisplayName();
int res = 1;
mailfolder*folder = 0;
mailmessage_list*l=0;
mailstorage*storage = mailstorage_new(NULL);
int r = mbox_mailstorage_init(storage,(char*)p.latin1(),0,0,0);
if (r != MAIL_NO_ERROR) {
Global::statusMessage(i18n("Error initializing mbox"));
diff --git a/kmicromail/libmailwrapper/mboxwrapper.h b/kmicromail/libmailwrapper/mboxwrapper.h
index d03940f..e658a71 100644
--- a/kmicromail/libmailwrapper/mboxwrapper.h
+++ b/kmicromail/libmailwrapper/mboxwrapper.h
@@ -1,47 +1,49 @@
#ifndef __MBOX_WRAPPER_H
#define __MBOX_WRAPPER_H
#include "genericwrapper.h"
#include <qstring.h>
+//Added by qt3to4:
+#include <Q3ValueList>
class encodedString;
struct mailmbox_folder;
class MBOXwrapper : public Genericwrapper
{
Q_OBJECT
public:
MBOXwrapper(const QString & dir,const QString&name);
virtual ~MBOXwrapper();
- virtual void listMessages(const QString & mailbox, QValueList<RecMailP>&target );
- virtual QValueList<Opie::Core::OSmartPointer<Folder> >* listFolders();
+ virtual void listMessages(const QString & mailbox, Q3ValueList<RecMailP>&target );
+ virtual Q3ValueList<Opie::Core::OSmartPointer<Folder> >* listFolders();
virtual void statusFolder(folderStat&target_stat,const QString & mailbox="INBOX");
virtual void deleteMail(const RecMailP&mail);
virtual void answeredMail(const RecMailP&mail);
virtual int createMbox(const QString&folder,const Opie::Core::OSmartPointer<Folder>&f=0,
const QString&d="",bool s=false);
virtual int deleteMbox(const Opie::Core::OSmartPointer<Folder>&);
virtual void storeMessage(const char*msg,size_t length, const QString&folder);
virtual RecBodyP fetchBody( const RecMailP &mail );
static void mbox_progress( size_t current, size_t maximum );
virtual encodedString* fetchRawBody(const RecMailP&mail);
- virtual void deleteMails(const QString & FolderName,const QValueList<RecMailP> &target);
+ virtual void deleteMails(const QString & FolderName,const Q3ValueList<RecMailP> &target);
virtual int deleteAllMail(const Opie::Core::OSmartPointer<Folder>&);
virtual MAILLIB::ATYPE getType()const;
virtual const QString&getName()const;
virtual Account* getAccount() { return 0; };
protected:
- static void deleteMails(mailmbox_folder*f,const QValueList<RecMailP> &target);
+ static void deleteMails(mailmbox_folder*f,const Q3ValueList<RecMailP> &target);
QString MBOXPath;
QString MBOXName;
};
#endif
diff --git a/kmicromail/libmailwrapper/mhwrapper.cpp b/kmicromail/libmailwrapper/mhwrapper.cpp
index 787e85d..4cd7a94 100644
--- a/kmicromail/libmailwrapper/mhwrapper.cpp
+++ b/kmicromail/libmailwrapper/mhwrapper.cpp
@@ -1,31 +1,33 @@
// CHANGED 2004-09-31 Lutz Rogowski
#include "mhwrapper.h"
#include "mailtypes.h"
#include "mailwrapper.h"
#include <libetpan/libetpan.h>
#include <qdir.h>
#include <qmessagebox.h>
+//Added by qt3to4:
+#include <Q3ValueList>
#include <stdlib.h>
#include <qpe/global.h>
#include <klocale.h>
#include <kglobal.h>
//#include <opie2/odebug.h>
using namespace Opie::Core;
MHwrapper::MHwrapper(const QString & mbox_dir,const QString&mbox_name)
: Genericwrapper(),MHPath(mbox_dir),MHName(mbox_name)
{
if (MHPath.length()>0) {
if (MHPath[MHPath.length()-1]=='/') {
MHPath=MHPath.left(MHPath.length()-1);
}
//odebug << MHPath << oendl;
QDir dir(MHPath);
if (!dir.exists()) {
dir.mkdir(MHPath);
}
init_storage();
}
}
void MHwrapper::init_storage()
@@ -43,67 +45,67 @@ void MHwrapper::init_storage()
}
}
r = mailstorage_connect(m_storage);
if (r!=MAIL_NO_ERROR) {
qDebug("error connecting storage ");
mailstorage_free(m_storage);
m_storage = 0;
}
}
void MHwrapper::clean_storage()
{
if (m_storage) {
mailstorage_disconnect(m_storage);
mailstorage_free(m_storage);
m_storage = 0;
}
}
MHwrapper::~MHwrapper()
{
clean_storage();
}
-void MHwrapper::listMessages(const QString & mailbox, QValueList<Opie::Core::OSmartPointer<RecMail> > &target, int maxSizeInKb )
+void MHwrapper::listMessages(const QString & mailbox, Q3ValueList<Opie::Core::OSmartPointer<RecMail> > &target, int maxSizeInKb )
{
init_storage();
if (!m_storage) {
return;
}
QString f = buildPath(mailbox);
int r = mailsession_select_folder(m_storage->sto_session,(char*)f.latin1());
if (r!=MAIL_NO_ERROR) {
qDebug("listMessages: error selecting folder! ");
return;
}
parseList(target,m_storage->sto_session,f, false, maxSizeInKb );
Global::statusMessage(i18n("Mailbox has %1 mail(s)").arg(target.count()));
}
-QValueList<Opie::Core::OSmartPointer<Folder> >* MHwrapper::listFolders()
+Q3ValueList<Opie::Core::OSmartPointer<Folder> >* MHwrapper::listFolders()
{
- QValueList<Opie::Core::OSmartPointer<Folder> >* folders = new QValueList<Opie::Core::OSmartPointer<Folder> >();
+ Q3ValueList<Opie::Core::OSmartPointer<Folder> >* folders = new Q3ValueList<Opie::Core::OSmartPointer<Folder> >();
/* this is needed! */
if (m_storage) mailstorage_disconnect(m_storage);
init_storage();
if (!m_storage) {
return folders;
}
mail_list*flist = 0;
clistcell*current=0;
int r = mailsession_list_folders(m_storage->sto_session,NULL,&flist);
if (r != MAIL_NO_ERROR || !flist) {
qDebug("error getting folder list ");
return folders;
}
for (current=clist_begin(flist->mb_list);current!=0;current=clist_next(current)) {
QString t = (char*)current->data;
t.replace(0,MHPath.length(),"");
folders->append(new MHFolder(t,MHPath));
}
mail_list_free(flist);
return folders;
}
void MHwrapper::deleteMail(const RecMailP&mail)
{
@@ -234,57 +236,57 @@ encodedString* MHwrapper::fetchRawBody(const RecMailP&mail)
mailmessage * msg = 0;
char*data=0;
size_t size;
int r = mailsession_select_folder(m_storage->sto_session,(char*)mail->getMbox().latin1());
if (r!=MAIL_NO_ERROR) {
qDebug("error selecting folder! ");
return result;
}
r = mailsession_get_message(m_storage->sto_session, mail->getNumber(), &msg);
if (r != MAIL_NO_ERROR) {
Global::statusMessage(i18n("Error fetching mail %i").arg(mail->getNumber()));
return 0;
}
r = mailmessage_fetch(msg,&data,&size);
if (r != MAIL_NO_ERROR) {
Global::statusMessage(i18n("Error fetching mail %i").arg(mail->getNumber()));
if (msg) mailmessage_free(msg);
return 0;
}
result = new encodedString(data,size);
if (msg) mailmessage_free(msg);
return result;
}
-void MHwrapper::deleteMails(const QString & mailbox,const QValueList<RecMailP> &target)
+void MHwrapper::deleteMails(const QString & mailbox,const Q3ValueList<RecMailP> &target)
{
QString f = buildPath(mailbox);
int r = mailsession_select_folder(m_storage->sto_session,(char*)f.latin1());
if (r!=MAIL_NO_ERROR) {
qDebug("deleteMails: error selecting folder! ");
return;
}
- QValueList<RecMailP>::ConstIterator it;
+ Q3ValueList<RecMailP>::ConstIterator it;
for (it=target.begin(); it!=target.end();++it) {
r = mailsession_remove_message(m_storage->sto_session,(*it)->getNumber());
if (r != MAIL_NO_ERROR) {
qDebug("error deleting mail ");
break;
}
}
}
int MHwrapper::deleteAllMail(const FolderP&tfolder)
{
init_storage();
if (!m_storage) {
return 0;
}
int res = 1;
if (!tfolder) return 0;
int r = mailsession_select_folder(m_storage->sto_session,(char*)tfolder->getName().latin1());
if (r!=MAIL_NO_ERROR) {
qDebug("error selecting folder! ");
return 0;
}
mailmessage_list*l=0;
r = mailsession_get_messages_list(m_storage->sto_session,&l);
diff --git a/kmicromail/libmailwrapper/mhwrapper.h b/kmicromail/libmailwrapper/mhwrapper.h
index 36a443a..6151ff1 100644
--- a/kmicromail/libmailwrapper/mhwrapper.h
+++ b/kmicromail/libmailwrapper/mhwrapper.h
@@ -1,59 +1,61 @@
// CHANGED 2004-09-31 Lutz Rogowski
#ifndef __MH_WRAPPER_H
#define __MH_WRAPPER_H
#include "maildefines.h"
#include "genericwrapper.h"
#include <qstring.h>
+//Added by qt3to4:
+#include <Q3ValueList>
class encodedString;
struct mailmbox_folder;
class MHwrapper : public Genericwrapper
{
Q_OBJECT
public:
MHwrapper(const QString & dir,const QString&name);
virtual ~MHwrapper();
- virtual void listMessages(const QString & mailbox, QValueList<Opie::Core::OSmartPointer<RecMail> > &target, int maxSizeInKb = 0 );
- virtual QValueList<Opie::Core::OSmartPointer<Folder> >* listFolders();
+ virtual void listMessages(const QString & mailbox, Q3ValueList<Opie::Core::OSmartPointer<RecMail> > &target, int maxSizeInKb = 0 );
+ virtual Q3ValueList<Opie::Core::OSmartPointer<Folder> >* listFolders();
virtual void statusFolder(folderStat&target_stat,const QString & mailbox="INBOX");
virtual void deleteMail(const RecMailP&mail);
virtual void answeredMail(const RecMailP&mail);
virtual void mvcpMail(const RecMailP&mail,const QString&targetFolder,AbstractMail*targetWrapper,bool moveit);
virtual void mvcpAllMails(const Opie::Core::OSmartPointer<Folder>&fromFolder,
const QString&targetFolder,AbstractMail*targetWrapper,bool moveit);
virtual int createMbox(const QString&folder,const Opie::Core::OSmartPointer<Folder>&f=0,
const QString&d="",bool s=false);
virtual int deleteMbox(const Opie::Core::OSmartPointer<Folder>&);
virtual void storeMessage(const char*msg,size_t length, const QString&folder);
virtual RecBodyP fetchBody( const RecMailP &mail );
static void mbox_progress( size_t current, size_t maximum );
virtual encodedString* fetchRawBody(const RecMailP&mail);
- virtual void deleteMails(const QString & FolderName,const QValueList<Opie::Core::OSmartPointer<RecMail> > &target);
+ virtual void deleteMails(const QString & FolderName,const Q3ValueList<Opie::Core::OSmartPointer<RecMail> > &target);
virtual int deleteAllMail(const Opie::Core::OSmartPointer<Folder>&);
virtual MAILLIB::ATYPE getType()const;
virtual const QString&getName()const;
virtual Account* getAccount() { return 0; };
public slots:
protected:
QString buildPath(const QString&p);
QString MHPath;
QString MHName;
void init_storage();
void clean_storage();
bool rmDir(QString folderabspath);
bool removeMboxfailed;
};
#endif
diff --git a/kmicromail/libmailwrapper/nntpwrapper.cpp b/kmicromail/libmailwrapper/nntpwrapper.cpp
index 93cd2b5..b328ecd 100644
--- a/kmicromail/libmailwrapper/nntpwrapper.cpp
+++ b/kmicromail/libmailwrapper/nntpwrapper.cpp
@@ -1,30 +1,32 @@
// CHANGED 2004-09-31 Lutz Rogowski
#include "nntpwrapper.h"
#include "logindialog.h"
#include "mailtypes.h"
#include <qfile.h>
+//Added by qt3to4:
+#include <Q3ValueList>
#include <stdlib.h>
#include <libetpan/libetpan.h>
#define HARD_MSG_SIZE_LIMIT 5242880
using namespace Opie::Core;
NNTPwrapper::NNTPwrapper( NNTPaccount *a )
: Genericwrapper() {
account = a;
m_nntp = NULL;
msgTempName = a->getFileName()+"_msg_cache";
last_msg_id = 0;
}
NNTPwrapper::~NNTPwrapper() {
logout();
QFile msg_cache(msgTempName);
if (msg_cache.exists()) {
msg_cache.remove();
}
@@ -39,88 +41,88 @@ RecBodyP NNTPwrapper::fetchBody( const RecMailP &mail ) {
int err = NEWSNNTP_NO_ERROR;
char *message = 0;
size_t length = 0;
RecBodyP body = new RecBody();
login();
if ( !m_nntp ) {
return body;
}
mailmessage * mailmsg;
if (mail->Msgsize()>HARD_MSG_SIZE_LIMIT) {
; // << "Message to large: " << mail->Msgsize() << "" << oendl;
return body;
}
QFile msg_cache(msgTempName);
cleanMimeCache();
if (mail->getNumber()!=last_msg_id) {
if (msg_cache.exists()) {
msg_cache.remove();
}
- msg_cache.open(IO_ReadWrite|IO_Truncate);
+ msg_cache.open(QIODevice::ReadWrite|QIODevice::Truncate);
last_msg_id = mail->getNumber();
err = mailsession_get_message(m_nntp->sto_session, mail->getNumber(), &mailmsg);
err = mailmessage_fetch(mailmsg,&message,&length);
msg_cache.writeBlock(message,length);
} else {
QString msg="";
- msg_cache.open(IO_ReadOnly);
+ msg_cache.open(QIODevice::ReadOnly);
message = new char[4096];
memset(message,0,4096);
while (msg_cache.readBlock(message,4095)>0) {
msg+=message;
memset(message,0,4096);
}
delete message;
message = (char*)malloc(msg.length()+1*sizeof(char));
memset(message,0,msg.length()+1);
memcpy(message,msg.latin1(),msg.length());
/* transform to libetpan stuff */
mailmsg = mailmessage_new();
mailmessage_init(mailmsg, NULL, data_message_driver, 0, strlen(message));
generic_message_t * msg_data;
msg_data = (generic_message_t *)mailmsg->msg_data;
msg_data->msg_fetched = 1;
msg_data->msg_message = message;
msg_data->msg_length = strlen(message);
}
body = parseMail(mailmsg);
/* clean up */
if (mailmsg)
mailmessage_free(mailmsg);
if (message)
free(message);
return body;
}
-void NNTPwrapper::listMessages(const QString & which, QValueList<Opie::Core::OSmartPointer<RecMail> > &target, int maxSizeInKb)
+void NNTPwrapper::listMessages(const QString & which, Q3ValueList<Opie::Core::OSmartPointer<RecMail> > &target, int maxSizeInKb)
{
login();
if (!m_nntp)
return;
uint32_t res_messages,res_recent,res_unseen;
mailsession_status_folder(m_nntp->sto_session,(char*)which.latin1(),&res_messages,&res_recent,&res_unseen);
parseList(target,m_nntp->sto_session,which,true, maxSizeInKb);
}
void NNTPwrapper::login()
{
if (account->getOffline())
return;
/* we'll hold the line */
if ( m_nntp != NULL )
return;
QString server;
QString User,Pass;
uint16_t port;
int err = NEWSNNTP_NO_ERROR;
server = account->getServer();
port = account->getPort().toUInt();
@@ -165,51 +167,51 @@ void NNTPwrapper::login()
if (err != NEWSNNTP_NO_ERROR) {
; // << QString( "FEHLERNUMMER %1" ).arg( err ) << oendl;
// Global::statusMessage(tr("Error initializing folder"));
mailstorage_free(m_nntp);
m_nntp = 0;
} else {
mailsession * session = m_nntp->sto_session;
newsnntp * news = ( ( nntp_session_state_data * )session->sess_data )->nntp_session;
news->nntp_progr_fun = &nntp_progress;
}
}
void NNTPwrapper::logout()
{
int err = NEWSNNTP_NO_ERROR;
if ( m_nntp == NULL )
return;
mailstorage_free(m_nntp);
m_nntp = 0;
}
-QValueList<Opie::Core::OSmartPointer<Folder> >* NNTPwrapper::listFolders() {
+Q3ValueList<Opie::Core::OSmartPointer<Folder> >* NNTPwrapper::listFolders() {
- QValueList<Opie::Core::OSmartPointer<Folder> >* folders = new QValueList<Opie::Core::OSmartPointer<Folder> >();
+ Q3ValueList<Opie::Core::OSmartPointer<Folder> >* folders = new Q3ValueList<Opie::Core::OSmartPointer<Folder> >();
QStringList groups;
if (account) {
groups = account->getGroups();
}
for ( QStringList::Iterator it = groups.begin(); it != groups.end(); ++it ) {
folders->append(new Folder((*it),"."));
}
return folders;
}
/* we made this method in raw nntp access of etpan and not via generic interface
* 'cause in that case there will be doubled copy operations. eg. the etpan would
* copy that stuff into its own structures and we must copy it into useable c++
* structures for our frontend. this would not make sense, so it is better to reimplement
* the stuff from generic interface of etpan but copy it direct to qt classes.
*/
QStringList NNTPwrapper::listAllNewsgroups(const QString&mask) {
login();
QStringList res;
clist *result = 0;
clistcell *current = 0;
newsnntp_group_description *group;
if ( m_nntp ) {
diff --git a/kmicromail/libmailwrapper/nntpwrapper.h b/kmicromail/libmailwrapper/nntpwrapper.h
index 8c54f12..7c8e671 100644
--- a/kmicromail/libmailwrapper/nntpwrapper.h
+++ b/kmicromail/libmailwrapper/nntpwrapper.h
@@ -1,50 +1,52 @@
// CHANGED 2004-09-31 Lutz Rogowski
#ifndef __NNTPWRAPPER
#define __NNTPWRAPPER
#include "mailwrapper.h"
#include "genericwrapper.h"
#include <qstring.h>
+//Added by qt3to4:
+#include <Q3ValueList>
#include <libetpan/clist.h>
class encodedString;
struct mailstorage;
struct mailfolder;
class NNTPwrapper : public Genericwrapper
{
Q_OBJECT
public:
NNTPwrapper( NNTPaccount *a );
virtual ~NNTPwrapper();
/* mailbox will be ignored */
- virtual void listMessages(const QString & mailbox, QValueList<Opie::Core::OSmartPointer<RecMail> > &target, int maxSizeInKb = 0 );
+ virtual void listMessages(const QString & mailbox, Q3ValueList<Opie::Core::OSmartPointer<RecMail> > &target, int maxSizeInKb = 0 );
/* should only get the subscribed one */
- virtual QValueList<Opie::Core::OSmartPointer<Folder> >* listFolders();
+ virtual Q3ValueList<Opie::Core::OSmartPointer<Folder> >* listFolders();
/* mailbox will be ignored */
virtual void statusFolder(folderStat&target_stat,const QString & mailbox="INBOX");
QStringList listAllNewsgroups(const QString&mask = QString::null);
virtual void deleteMail(const RecMailP&mail);
virtual void answeredMail(const RecMailP&mail);
virtual int deleteAllMail(const Opie::Core::OSmartPointer<Folder>&);
virtual RecBodyP fetchBody( const RecMailP &mail );
virtual encodedString* fetchRawBody(const RecMailP&mail);
virtual void logout();
virtual MAILLIB::ATYPE getType()const;
virtual const QString&getName()const;
static void nntp_progress( size_t current, size_t maximum );
virtual Account* getAccount() { return account; };
protected:
void login();
NNTPaccount *account;
mailstorage* m_nntp;
};
#endif
diff --git a/kmicromail/libmailwrapper/pop3wrapper.cpp b/kmicromail/libmailwrapper/pop3wrapper.cpp
index 2888f7c..ebeed71 100644
--- a/kmicromail/libmailwrapper/pop3wrapper.cpp
+++ b/kmicromail/libmailwrapper/pop3wrapper.cpp
@@ -1,37 +1,39 @@
// CHANGED 2004-09-31 Lutz Rogowski
#include <stdlib.h>
#include "pop3wrapper.h"
#include "mailtypes.h"
#include "logindialog.h"
#include <libetpan/libetpan.h>
#include <klocale.h>
#include <qpe/global.h>
#include <qfile.h>
-#include <qprogressbar.h>
+#include <q3progressbar.h>
#include <qapplication.h>
+//Added by qt3to4:
+#include <Q3ValueList>
/* we don't fetch messages larger than 5 MB */
#define HARD_MSG_SIZE_LIMIT 5242880
using namespace Opie::Core;
POP3wrapper::POP3wrapper( POP3account *a )
: Genericwrapper() {
account = a;
m_pop3 = NULL;
msgTempName = a->getFileName()+"_msg_cache";
last_msg_id = 0;
}
POP3wrapper::~POP3wrapper() {
logout();
QFile msg_cache(msgTempName);
if (msg_cache.exists()) {
msg_cache.remove();
}
}
void POP3wrapper::pop3_progress( size_t current, size_t maximum ) {
; // odebug << "POP3: " << current << " of " << maximum << "" << oendl;
}
@@ -41,87 +43,87 @@ RecBodyP POP3wrapper::fetchBody( const RecMailP &mail ) {
char *message = 0;
size_t length = 0;
RecBodyP body = new RecBody();
login();
if ( !m_pop3 ) {
return body;
}
mailmessage * mailmsg;
if (mail->Msgsize()>HARD_MSG_SIZE_LIMIT) {
; // odebug << "Message to large: " << mail->Msgsize() << "" << oendl;
return body;
}
QFile msg_cache(msgTempName);
cleanMimeCache();
if (mail->getNumber()!=last_msg_id) {
if (msg_cache.exists()) {
msg_cache.remove();
}
- msg_cache.open(IO_ReadWrite|IO_Truncate);
+ msg_cache.open(QIODevice::ReadWrite|QIODevice::Truncate);
last_msg_id = mail->getNumber();
err = mailsession_get_message(m_pop3->sto_session, mail->getNumber(), &mailmsg);
err = mailmessage_fetch(mailmsg,&message,&length);
msg_cache.writeBlock(message,length);
} else {
QString msg="";
- msg_cache.open(IO_ReadOnly);
+ msg_cache.open(QIODevice::ReadOnly);
message = new char[4096];
memset(message,0,4096);
while (msg_cache.readBlock(message,4095)>0) {
msg+=message;
memset(message,0,4096);
}
delete message;
message = (char*)malloc(msg.length()+1*sizeof(char));
memset(message,0,msg.length()+1);
memcpy(message,msg.latin1(),msg.length());
/* transform to libetpan stuff */
mailmsg = mailmessage_new();
mailmessage_init(mailmsg, NULL, data_message_driver, 0, strlen(message));
generic_message_t * msg_data;
msg_data = (generic_message_t *)mailmsg->msg_data;
msg_data->msg_fetched = 1;
msg_data->msg_message = message;
msg_data->msg_length = strlen(message);
}
body = parseMail(mailmsg);
/* clean up */
if (mailmsg)
mailmessage_free(mailmsg);
if (message)
free(message);
return body;
}
-void POP3wrapper::listMessages(const QString &, QValueList<Opie::Core::OSmartPointer<RecMail> > &target, int maxSizeInKb )
+void POP3wrapper::listMessages(const QString &, Q3ValueList<Opie::Core::OSmartPointer<RecMail> > &target, int maxSizeInKb )
{
login();
if (!m_pop3)
return;
uint32_t res_messages,res_recent,res_unseen;
mailsession_status_folder(m_pop3->sto_session,"INBOX",&res_messages,&res_recent,&res_unseen);
parseList(target,m_pop3->sto_session,"INBOX", false, maxSizeInKb);
Global::statusMessage( i18n("Mailbox contains %1 mail(s)").arg(res_messages));
}
void POP3wrapper::login()
{
if (account->getOffline())
return;
/* we'll hold the line */
if ( m_pop3 != NULL )
return;
QString server,user, pass;
uint16_t port;
int err = MAILPOP3_NO_ERROR;
server = account->getServer();
port = account->getPort().toUInt();
@@ -166,108 +168,108 @@ void POP3wrapper::login()
err = mailstorage_connect(m_pop3);
if (err != MAIL_NO_ERROR) {
; // odebug << QString( "FEHLERNUMMER %1" ).arg( err ) << oendl;
Global::statusMessage(i18n("Error %1 initializing folder").arg( err ));
mailstorage_free(m_pop3);
m_pop3 = 0;
} else {
mailsession * session = m_pop3->sto_session;
mailpop3 * mail = ( ( pop3_session_state_data * )session->sess_data )->pop3_session;
if (mail) {
mail->pop3_progr_fun = &pop3_progress;
}
}
}
void POP3wrapper::logout()
{
if ( m_pop3 == NULL )
return;
mailstorage_free(m_pop3);
m_pop3 = 0;
}
-QValueList<Opie::Core::OSmartPointer<Folder> >* POP3wrapper::listFolders() {
- QValueList<Opie::Core::OSmartPointer<Folder> >* folders = new QValueList<FolderP>();
+Q3ValueList<Opie::Core::OSmartPointer<Folder> >* POP3wrapper::listFolders() {
+ Q3ValueList<Opie::Core::OSmartPointer<Folder> >* folders = new Q3ValueList<FolderP>();
FolderP inb=new Folder("INBOX","/");
folders->append(inb);
return folders;
}
-void POP3wrapper::deleteMailList(const QValueList<RecMailP>&target)
+void POP3wrapper::deleteMailList(const Q3ValueList<RecMailP>&target)
{
login();
if (!m_pop3)
return;
int iii = 0;
int count = target.count();
- QProgressBar wid ( count );
+ Q3ProgressBar wid ( count );
wid.setCaption( i18n("Deleting ..."));
wid.show();
while (iii < count ) {
Global::statusMessage(i18n("Delete message %1 of %2").arg(iii).arg(count));
wid.setProgress( iii );
wid.raise();
qApp->processEvents();
//qDebug("delete ");
RecMailP mail = (*target.at( iii ));
int err = mailsession_remove_message(m_pop3->sto_session,mail->getNumber());
if (err != MAIL_NO_ERROR) {
Global::statusMessage(i18n("Error deleting mail"));
}
++iii;
}
}
void POP3wrapper::deleteMail(const RecMailP&mail) {
login();
if (!m_pop3)
return;
int err = mailsession_remove_message(m_pop3->sto_session,mail->getNumber());
if (err != MAIL_NO_ERROR) {
Global::statusMessage(i18n("error deleting mail"));
}
}
void POP3wrapper::answeredMail(const RecMailP&) {}
int POP3wrapper::deleteAllMail(const FolderP&) {
login();
if (!m_pop3)
return 0;
int res = 1;
uint32_t result = 0;
int err = mailsession_messages_number(m_pop3->sto_session,NULL,&result);
if (err != MAIL_NO_ERROR) {
Global::statusMessage(i18n("Error getting folder info"));
return 0;
}
- QProgressBar wid ( result );
+ Q3ProgressBar wid ( result );
wid.setCaption( i18n("Deleting ..."));
wid.show();
for (unsigned int i = 0; i < result; ++i) {
Global::statusMessage(i18n("Delete message %1 of %2").arg(i).arg(result));
wid.setProgress( i );
wid.raise();
qApp->processEvents();
err = mailsession_remove_message(m_pop3->sto_session,i+1);
if (err != MAIL_NO_ERROR) {
Global::statusMessage(i18n("Error deleting mail %1").arg(i+1));
res=0;
}
break;
}
return res;
}
void POP3wrapper::statusFolder(folderStat&target_stat,const QString&) {
login();
target_stat.message_count = 0;
target_stat.message_unseen = 0;
target_stat.message_recent = 0;
if (!m_pop3)
diff --git a/kmicromail/libmailwrapper/pop3wrapper.h b/kmicromail/libmailwrapper/pop3wrapper.h
index ebc2fc7..a077877 100644
--- a/kmicromail/libmailwrapper/pop3wrapper.h
+++ b/kmicromail/libmailwrapper/pop3wrapper.h
@@ -1,44 +1,46 @@
// CHANGED 2004-09-31 Lutz Rogowski
#ifndef __POP3WRAPPER
#define __POP3WRAPPER
#include "mailwrapper.h"
#include "genericwrapper.h"
#include <qstring.h>
+//Added by qt3to4:
+#include <Q3ValueList>
class encodedString;
struct mailstorage;
struct mailfolder;
class POP3wrapper : public Genericwrapper
{
Q_OBJECT
public:
POP3wrapper( POP3account *a );
virtual ~POP3wrapper();
/* mailbox will be ignored */
- virtual void listMessages(const QString & mailbox, QValueList<Opie::Core::OSmartPointer<RecMail> > &target, int maxSizeInKb = 0 );
- virtual QValueList<Opie::Core::OSmartPointer<Folder> >* listFolders();
+ virtual void listMessages(const QString & mailbox, Q3ValueList<Opie::Core::OSmartPointer<RecMail> > &target, int maxSizeInKb = 0 );
+ virtual Q3ValueList<Opie::Core::OSmartPointer<Folder> >* listFolders();
/* mailbox will be ignored */
virtual void statusFolder(folderStat&target_stat,const QString & mailbox="INBOX");
virtual void deleteMail(const RecMailP&mail);
- virtual void deleteMailList(const QValueList<RecMailP>&target);
+ virtual void deleteMailList(const Q3ValueList<RecMailP>&target);
virtual void answeredMail(const RecMailP&mail);
virtual int deleteAllMail(const Opie::Core::OSmartPointer<Folder>&);
virtual RecBodyP fetchBody( const RecMailP &mail );
virtual encodedString* fetchRawBody(const RecMailP&mail);
virtual void logout();
virtual MAILLIB::ATYPE getType()const;
virtual const QString&getName()const;
static void pop3_progress( size_t current, size_t maximum );
virtual Account* getAccount() { return account; };
protected:
void login();
POP3account *account;
mailstorage*m_pop3;
};
#endif
diff --git a/kmicromail/libmailwrapper/sendmailprogress.cpp b/kmicromail/libmailwrapper/sendmailprogress.cpp
index 20dfe9b..6cd6409 100644
--- a/kmicromail/libmailwrapper/sendmailprogress.cpp
+++ b/kmicromail/libmailwrapper/sendmailprogress.cpp
@@ -1,26 +1,26 @@
#include "sendmailprogress.h"
-#include <qprogressbar.h>
+#include <q3progressbar.h>
#include <qlabel.h>
#include <klocale.h>
progressMailSend::progressMailSend(QWidget*parent, const char * name)
:progressMailSendUI(parent,name,true),m_current_mail(0),m_current_single(0),m_max_mail(0),m_max_single(0)
{
}
progressMailSend::~progressMailSend()
{
}
void progressMailSend::setMaxMails(unsigned int aMaxMails)
{
m_max_mail = aMaxMails;
allMailProgressBar->setTotalSteps(aMaxMails);
setMails();
}
void progressMailSend::setCurrentMails(unsigned int aCurrent)
{
m_current_mail = aCurrent;
allMailProgressBar->setProgress(aCurrent);
setMails();
diff --git a/kmicromail/libmailwrapper/settings.cpp b/kmicromail/libmailwrapper/settings.cpp
index 9436d43..fc01528 100644
--- a/kmicromail/libmailwrapper/settings.cpp
+++ b/kmicromail/libmailwrapper/settings.cpp
@@ -1,29 +1,29 @@
#include <stdlib.h>
#include <qdir.h>
#include <qtextcodec.h>
-#include <qtextstream.h>
+#include <q3textstream.h>
#include <qfile.h>
//#include <opie2/odebug.h>
#include <kconfig.h>
#include <kstandarddirs.h>
#include "settings.h"
//#include "defines.h"
#define IMAP_PORT "143"
#define IMAP_SSL_PORT "993"
#define SMTP_PORT "25"
#define SMTP_SSL_PORT "465"
#define POP3_PORT "110"
#define POP3_SSL_PORT "995"
#define NNTP_PORT "119"
#define NNTP_SSL_PORT "563"
Settings::Settings()
: QObject()
{
accounts.setAutoDelete( true ); ;
updateAccounts();
@@ -355,76 +355,76 @@ SMTPaccount::SMTPaccount()
useReply = false;
type = MAILLIB::A_SMTP;
port = SMTP_PORT;
}
SMTPaccount::SMTPaccount( QString filename )
: Account()
{
file = filename;
accountName = "New SMTP Account";
ssl = false;
connectionType = 1;
login = false;
type = MAILLIB::A_SMTP;
port = SMTP_PORT;
}
QString SMTPaccount::getSignature()
{
QFileInfo fi ( signature );
if ( ! fi.exists() )
return QString();
QFile file( signature );
- if (!file.open( IO_ReadOnly ) ) {
+ if (!file.open( QIODevice::ReadOnly ) ) {
return QString();
}
- QTextStream ts( &file );
+ Q3TextStream ts( &file );
ts.setCodec( QTextCodec::codecForName("utf8") );
QString text = ts.read();
file.close();
return text;
}
void SMTPaccount::setSignature( QString b )
{
QFileInfo fi ( signature );
if ( ! fi.exists() ) {
QString filedir( locateLocal("data", "kopiemail" ) );
signature = filedir+ "/" + getAccountName() +".sig";
qDebug("new sig %s ", signature.latin1());
save();
}
QFile fileIn( signature );
- if (!fileIn.open( IO_WriteOnly ) ) {
+ if (!fileIn.open( QIODevice::WriteOnly ) ) {
qDebug("OM: Cannot write signature file %s ", signature.latin1() );
return ;
}
- QTextStream tsIn( &fileIn );
+ Q3TextStream tsIn( &fileIn );
tsIn.setCodec( QTextCodec::codecForName("utf8") );
tsIn << b ;
fileIn.close();
}
QString SMTPaccount::getUniqueFileName()
{
int num = 0;
QString unique;
QDir dir( locateLocal("data", "kopiemail" ) );
QStringList imap = dir.entryList( "smtp-*" );
do {
unique.setNum( num++ );
} while ( imap.contains( "smtp-" + unique ) > 0 );
return unique;
}
void SMTPaccount::read()
{
KConfig *conf = new KConfig( getFileName() );
conf->setGroup( "SMTP Account" );
accountName = conf->readEntry( "Account" );
diff --git a/kmicromail/libmailwrapper/smtpwrapper.cpp b/kmicromail/libmailwrapper/smtpwrapper.cpp
index 7c813cc..2df55ff 100644
--- a/kmicromail/libmailwrapper/smtpwrapper.cpp
+++ b/kmicromail/libmailwrapper/smtpwrapper.cpp
@@ -1,35 +1,37 @@
#include "smtpwrapper.h"
#include "mailwrapper.h"
#include "abstractmail.h"
#include "logindialog.h"
#include "mailtypes.h"
#include "sendmailprogress.h"
//#include <opie2/odebug.h>
//#include <qt.h>
#include <qapplication.h>
#include <qmessagebox.h>
+//Added by qt3to4:
+#include <Q3ValueList>
#include <stdlib.h>
#ifndef DESKTOP_VERSION
//#include <qpe/config.h>
#include <qpe/qcopenvelope_qws.h>
#endif
#include <libetpan/libetpan.h>
#include <klocale.h>
#include <kglobal.h>
#include <kconfig.h>
using namespace Opie::Core;
progressMailSend*SMTPwrapper::sendProgress = 0;
SMTPwrapper::SMTPwrapper(SMTPaccount * aSmtp )
: Generatemail()
{
m_SmtpAccount = aSmtp;
KConfig cfg( locateLocal("config", "kopiemailrc" ) );
cfg.setGroup( "Status" );
m_queuedMail = cfg.readNumEntry( "outgoing", 0 );
emit queuedMails( m_queuedMail );
connect( this, SIGNAL( queuedMails(int) ), this, SLOT( emitQCop(int) ) );
m_smtp = 0;
@@ -413,50 +415,50 @@ int SMTPwrapper::sendQueuedMail(AbstractMail*wrap,const RecMailP&which) {
if (rcpts) {
smtp_address_list_free( rcpts );
}
return res;
}
/* this is a special fun */
bool SMTPwrapper::flushOutbox() {
bool returnValue = true;
; // odebug << "Sending the queue" << oendl;
if (!m_SmtpAccount) {
; // odebug << "No smtp account given" << oendl;
return false;
}
bool reset_user_value = false;
QString localfolders = AbstractMail::defaultLocalfolder();
AbstractMail*wrap = AbstractMail::getWrapper(localfolders);
if (!wrap) {
; // odebug << "memory error" << oendl;
return false;
}
QString oldPw, oldUser;
- QValueList<RecMailP> mailsToSend;
- QValueList<RecMailP> mailsToRemove;
+ Q3ValueList<RecMailP> mailsToSend;
+ Q3ValueList<RecMailP> mailsToRemove;
QString mbox("Outgoing");
wrap->listMessages(mbox,mailsToSend);
if (mailsToSend.count()==0) {
delete wrap;
; // odebug << "No mails to send" << oendl;
return false;
}
oldPw = m_SmtpAccount->getPassword();
oldUser = m_SmtpAccount->getUser();
if (m_SmtpAccount->getLogin() && (m_SmtpAccount->getUser().isEmpty() || m_SmtpAccount->getPassword().isEmpty()) ) {
// get'em
QString user,pass;
LoginDialog login( m_SmtpAccount->getUser(), m_SmtpAccount->getPassword(), NULL, 0, true );
login.show();
if ( QDialog::Accepted == login.exec() ) {
// ok
user = login.getUser().latin1();
pass = login.getPassword().latin1();
reset_user_value = true;
m_SmtpAccount->setUser(user);
m_SmtpAccount->setPassword(pass);
} else {
return true;