summaryrefslogtreecommitdiff
authoralwin <alwin>2003-12-14 03:41:49 (UTC)
committer alwin <alwin>2003-12-14 03:41:49 (UTC)
commit84ac61a9b46d463c9e3112f55cc1e69957d1348a (patch) (side-by-side diff)
treeaa2a03fc364b529a9863d44b9d51f030b22f4820
parent12ba6ab9606538628afc7f7015e115a0251d0389 (diff)
downloadopie-84ac61a9b46d463c9e3112f55cc1e69957d1348a.zip
opie-84ac61a9b46d463c9e3112f55cc1e69957d1348a.tar.gz
opie-84ac61a9b46d463c9e3112f55cc1e69957d1348a.tar.bz2
-memleak fixed
-check for non-selectable mailboxes -potential crasher fixed -selection handling better (app will not send a net-command on each mouse click)
Diffstat (more/less context) (ignore whitespace changes)
-rw-r--r--noncore/net/mail/accountview.cpp9
-rw-r--r--noncore/net/mail/imapwrapper.cpp14
-rw-r--r--noncore/net/mail/libmailwrapper/imapwrapper.cpp14
-rw-r--r--noncore/net/mail/libmailwrapper/pop3wrapper.cpp2
-rw-r--r--noncore/net/mail/mainwindow.cpp2
-rw-r--r--noncore/net/mail/pop3wrapper.cpp2
-rw-r--r--noncore/net/mail/viewmail.cpp2
7 files changed, 29 insertions, 16 deletions
diff --git a/noncore/net/mail/accountview.cpp b/noncore/net/mail/accountview.cpp
index 847b099..d725b87 100644
--- a/noncore/net/mail/accountview.cpp
+++ b/noncore/net/mail/accountview.cpp
@@ -28,136 +28,141 @@ void POP3viewItem::refresh( QList<RecMail> &target )
}
RecBody POP3viewItem::fetchBody( const RecMail &mail )
{
qDebug( "POP3 fetchBody" );
return wrapper->fetchBody( mail );
}
/**
* IMAP Account stuff
*/
IMAPviewItem::IMAPviewItem( IMAPaccount *a, QListView *parent )
: AccountViewItem( parent )
{
account = a;
wrapper = AbstractMail::getWrapper( account );
setPixmap( 0, PIXMAP_IMAPFOLDER );
setText( 0, account->getAccountName() );
setOpen( true );
}
IMAPviewItem::~IMAPviewItem()
{
delete wrapper;
}
AbstractMail *IMAPviewItem::getWrapper()
{
return wrapper;
}
void IMAPviewItem::refresh(QList<RecMail>&)
{
QList<Folder> *folders = wrapper->listFolders();
QListViewItem *child = firstChild();
while ( child ) {
QListViewItem *tmp = child;
child = child->nextSibling();
delete tmp;
}
Folder *it;
QListViewItem*item = 0;
for ( it = folders->first(); it; it = folders->next() ) {
item = new IMAPfolderItem( it, this , item );
+ item->setSelectable(it->may_select());
}
+ // !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
+ folders->setAutoDelete(false);
+ delete folders;
}
RecBody IMAPviewItem::fetchBody(const RecMail&)
{
return RecBody();
}
IMAPfolderItem::~IMAPfolderItem()
{
delete folder;
}
IMAPfolderItem::IMAPfolderItem( Folder *folderInit, IMAPviewItem *parent , QListViewItem*after )
: AccountViewItem( parent,after )
{
folder = folderInit;
imap = parent;
setPixmap( 0, PIXMAP_IMAPFOLDER );
setText( 0, folder->getDisplayName() );
}
void IMAPfolderItem::refresh(QList<RecMail>&target)
{
- imap->getWrapper()->listMessages( folder->getName(),target );
+ if (folder->may_select())
+ imap->getWrapper()->listMessages( folder->getName(),target );
}
RecBody IMAPfolderItem::fetchBody(const RecMail&aMail)
{
return imap->getWrapper()->fetchBody(aMail);
}
/**
* Generic stuff
*/
AccountView::AccountView( QWidget *parent, const char *name, WFlags flags )
: QListView( parent, name, flags )
{
- connect( this, SIGNAL( clicked( QListViewItem * ) ),
+ connect( this, SIGNAL( selectionChanged( QListViewItem * ) ),
SLOT( refresh( QListViewItem * ) ) );
setSorting(-1);
}
void AccountView::populate( QList<Account> list )
{
clear();
Account *it;
for ( it = list.first(); it; it = list.next() ) {
if ( it->getType().compare( "IMAP" ) == 0 ) {
IMAPaccount *imap = static_cast<IMAPaccount *>(it);
qDebug( "added IMAP " + imap->getAccountName() );
(void) new IMAPviewItem( imap, this );
} else if ( it->getType().compare( "POP3" ) == 0 ) {
POP3account *pop3 = static_cast<POP3account *>(it);
qDebug( "added POP3 " + pop3->getAccountName() );
(void) new POP3viewItem( pop3, this );
}
}
}
void AccountView::refresh(QListViewItem *item) {
qDebug("AccountView refresh...");
if ( item ) {
m_currentItem = item;
QList<RecMail> headerlist;
headerlist.setAutoDelete(true);
AccountViewItem *view = static_cast<AccountViewItem *>(item);
view->refresh(headerlist);
emit refreshMailview(&headerlist);
}
}
void AccountView::refreshCurrent()
{
if ( !m_currentItem ) return;
QList<RecMail> headerlist;
headerlist.setAutoDelete(true);
AccountViewItem *view = static_cast<AccountViewItem *>(m_currentItem);
view->refresh(headerlist);
emit refreshMailview(&headerlist);
}
void AccountView::refreshAll()
{
diff --git a/noncore/net/mail/imapwrapper.cpp b/noncore/net/mail/imapwrapper.cpp
index 9ee0dff..912a412 100644
--- a/noncore/net/mail/imapwrapper.cpp
+++ b/noncore/net/mail/imapwrapper.cpp
@@ -104,148 +104,152 @@ void IMAPwrapper::listMessages(const QString&mailbox,QList<RecMail> &target )
qDebug("mailbox has no mails");
return;
}
result = clist_new();
/* the range has to start at 1!!! not with 0!!!! */
set = mailimap_set_new_interval( 1, last );
fetchType = mailimap_fetch_type_new_fetch_att_list_empty();
mailimap_fetch_type_new_fetch_att_list_add(fetchType,mailimap_fetch_att_new_envelope());
mailimap_fetch_type_new_fetch_att_list_add(fetchType,mailimap_fetch_att_new_flags());
mailimap_fetch_type_new_fetch_att_list_add(fetchType,mailimap_fetch_att_new_internaldate());
mailimap_fetch_type_new_fetch_att_list_add(fetchType,mailimap_fetch_att_new_rfc822_size());
err = mailimap_fetch( m_imap, set, fetchType, &result );
mailimap_set_free( set );
mailimap_fetch_type_free( fetchType );
QString date,subject,from;
if ( err == MAILIMAP_NO_ERROR ) {
mailimap_msg_att * msg_att;
int i = 0;
for (current = clist_begin(result); current != 0; current=clist_next(current)) {
++i;
msg_att = (mailimap_msg_att*)current->data;
RecMail*m = parse_list_result(msg_att);
if (m) {
m->setNumber(i);
m->setMbox(mailbox);
m->setWrapper(this);
target.append(m);
}
}
} else {
qDebug("Error fetching headers: %s",m_imap->imap_response);
}
mailimap_fetch_list_free(result);
}
QList<Folder>* IMAPwrapper::listFolders()
{
const char *path, *mask;
int err = MAILIMAP_NO_ERROR;
clist *result;
clistcell *current;
QList<Folder> * folders = new QList<Folder>();
- folders->setAutoDelete( true );
+ folders->setAutoDelete( false );
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.
*/
QString temp;
mask = "INBOX" ;
result = clist_new();
mailimap_mailbox_list *list;
err = mailimap_list( m_imap, (char*)"", (char*)mask, &result );
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
// instead of using strdup!
temp = list->mb_name;
folders->append( new IMAPFolder(temp));
current = current->next;
}
} else {
qDebug("error fetching folders: %s",m_imap->imap_response);
}
mailimap_list_result_free( result );
/*
* second stage - get the other then inbox folders
*/
mask = "*" ;
path = account->getPrefix().latin1();
if (!path) path = "";
result = clist_new();
qDebug(path);
+ bool selectable = true;
+ mailimap_mbx_list_flags*bflags;
err = mailimap_list( m_imap, (char*)path, (char*)mask, &result );
if ( err == MAILIMAP_NO_ERROR ) {
current = result->first;
- for ( int i = result->count; i > 0; i-- ) {
+ for ( current=clist_begin(result);current!=NULL;current=clist_next(current)) {
list = (mailimap_mailbox_list *) current->data;
// it is better use the deep copy mechanism of qt itself
// instead of using strdup!
temp = list->mb_name;
- current = current->next;
if (temp.lower()=="inbox")
continue;
- folders->append(new IMAPFolder(temp));
-
+ if ( (bflags = list->mb_flag) ) {
+ selectable = !(bflags->mbf_type==MAILIMAP_MBX_LIST_FLAGS_SFLAG&&
+ bflags->mbf_sflag==MAILIMAP_MBX_LIST_SFLAG_NOSELECT);
+ }
+ folders->append(new IMAPFolder(temp,selectable));
}
} else {
qDebug("error fetching folders %s",m_imap->imap_response);
}
mailimap_list_result_free( result );
return folders;
}
RecMail*IMAPwrapper::parse_list_result(mailimap_msg_att* m_att)
{
RecMail * m = 0;
mailimap_msg_att_item *item=0;
clistcell *current,*c,*cf;
mailimap_msg_att_dynamic*flist;
mailimap_flag_fetch*cflag;
int size;
QBitArray mFlags(7);
QStringList addresslist;
if (!m_att) {
return m;
}
m = new RecMail();
for (c = clist_begin(m_att->att_list); c!=NULL;c=clist_next(c) ) {
current = c;
size = 0;
item = (mailimap_msg_att_item*)current->data;
if (item->att_type!=MAILIMAP_MSG_ATT_ITEM_STATIC) {
flist = (mailimap_msg_att_dynamic*)item->att_data.att_dyn;
if (!flist->att_list) {
continue;
}
cf = flist->att_list->first;
for (cf = clist_begin(flist->att_list); cf!=NULL; cf = clist_next(cf)) {
cflag = (mailimap_flag_fetch*)cf->data;
if (cflag->fl_type==MAILIMAP_FLAG_FETCH_OTHER && cflag->fl_flag!=0) {
switch (cflag->fl_flag->fl_type) {
case MAILIMAP_FLAG_ANSWERED: /* \Answered flag */
mFlags.setBit(FLAG_ANSWERED);
break;
case MAILIMAP_FLAG_FLAGGED: /* \Flagged flag */
mFlags.setBit(FLAG_FLAGGED);
break;
case MAILIMAP_FLAG_DELETED: /* \Deleted flag */
mFlags.setBit(FLAG_DELETED);
break;
case MAILIMAP_FLAG_SEEN: /* \Seen flag */
mFlags.setBit(FLAG_SEEN);
diff --git a/noncore/net/mail/libmailwrapper/imapwrapper.cpp b/noncore/net/mail/libmailwrapper/imapwrapper.cpp
index 9ee0dff..912a412 100644
--- a/noncore/net/mail/libmailwrapper/imapwrapper.cpp
+++ b/noncore/net/mail/libmailwrapper/imapwrapper.cpp
@@ -104,148 +104,152 @@ void IMAPwrapper::listMessages(const QString&mailbox,QList<RecMail> &target )
qDebug("mailbox has no mails");
return;
}
result = clist_new();
/* the range has to start at 1!!! not with 0!!!! */
set = mailimap_set_new_interval( 1, last );
fetchType = mailimap_fetch_type_new_fetch_att_list_empty();
mailimap_fetch_type_new_fetch_att_list_add(fetchType,mailimap_fetch_att_new_envelope());
mailimap_fetch_type_new_fetch_att_list_add(fetchType,mailimap_fetch_att_new_flags());
mailimap_fetch_type_new_fetch_att_list_add(fetchType,mailimap_fetch_att_new_internaldate());
mailimap_fetch_type_new_fetch_att_list_add(fetchType,mailimap_fetch_att_new_rfc822_size());
err = mailimap_fetch( m_imap, set, fetchType, &result );
mailimap_set_free( set );
mailimap_fetch_type_free( fetchType );
QString date,subject,from;
if ( err == MAILIMAP_NO_ERROR ) {
mailimap_msg_att * msg_att;
int i = 0;
for (current = clist_begin(result); current != 0; current=clist_next(current)) {
++i;
msg_att = (mailimap_msg_att*)current->data;
RecMail*m = parse_list_result(msg_att);
if (m) {
m->setNumber(i);
m->setMbox(mailbox);
m->setWrapper(this);
target.append(m);
}
}
} else {
qDebug("Error fetching headers: %s",m_imap->imap_response);
}
mailimap_fetch_list_free(result);
}
QList<Folder>* IMAPwrapper::listFolders()
{
const char *path, *mask;
int err = MAILIMAP_NO_ERROR;
clist *result;
clistcell *current;
QList<Folder> * folders = new QList<Folder>();
- folders->setAutoDelete( true );
+ folders->setAutoDelete( false );
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.
*/
QString temp;
mask = "INBOX" ;
result = clist_new();
mailimap_mailbox_list *list;
err = mailimap_list( m_imap, (char*)"", (char*)mask, &result );
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
// instead of using strdup!
temp = list->mb_name;
folders->append( new IMAPFolder(temp));
current = current->next;
}
} else {
qDebug("error fetching folders: %s",m_imap->imap_response);
}
mailimap_list_result_free( result );
/*
* second stage - get the other then inbox folders
*/
mask = "*" ;
path = account->getPrefix().latin1();
if (!path) path = "";
result = clist_new();
qDebug(path);
+ bool selectable = true;
+ mailimap_mbx_list_flags*bflags;
err = mailimap_list( m_imap, (char*)path, (char*)mask, &result );
if ( err == MAILIMAP_NO_ERROR ) {
current = result->first;
- for ( int i = result->count; i > 0; i-- ) {
+ for ( current=clist_begin(result);current!=NULL;current=clist_next(current)) {
list = (mailimap_mailbox_list *) current->data;
// it is better use the deep copy mechanism of qt itself
// instead of using strdup!
temp = list->mb_name;
- current = current->next;
if (temp.lower()=="inbox")
continue;
- folders->append(new IMAPFolder(temp));
-
+ if ( (bflags = list->mb_flag) ) {
+ selectable = !(bflags->mbf_type==MAILIMAP_MBX_LIST_FLAGS_SFLAG&&
+ bflags->mbf_sflag==MAILIMAP_MBX_LIST_SFLAG_NOSELECT);
+ }
+ folders->append(new IMAPFolder(temp,selectable));
}
} else {
qDebug("error fetching folders %s",m_imap->imap_response);
}
mailimap_list_result_free( result );
return folders;
}
RecMail*IMAPwrapper::parse_list_result(mailimap_msg_att* m_att)
{
RecMail * m = 0;
mailimap_msg_att_item *item=0;
clistcell *current,*c,*cf;
mailimap_msg_att_dynamic*flist;
mailimap_flag_fetch*cflag;
int size;
QBitArray mFlags(7);
QStringList addresslist;
if (!m_att) {
return m;
}
m = new RecMail();
for (c = clist_begin(m_att->att_list); c!=NULL;c=clist_next(c) ) {
current = c;
size = 0;
item = (mailimap_msg_att_item*)current->data;
if (item->att_type!=MAILIMAP_MSG_ATT_ITEM_STATIC) {
flist = (mailimap_msg_att_dynamic*)item->att_data.att_dyn;
if (!flist->att_list) {
continue;
}
cf = flist->att_list->first;
for (cf = clist_begin(flist->att_list); cf!=NULL; cf = clist_next(cf)) {
cflag = (mailimap_flag_fetch*)cf->data;
if (cflag->fl_type==MAILIMAP_FLAG_FETCH_OTHER && cflag->fl_flag!=0) {
switch (cflag->fl_flag->fl_type) {
case MAILIMAP_FLAG_ANSWERED: /* \Answered flag */
mFlags.setBit(FLAG_ANSWERED);
break;
case MAILIMAP_FLAG_FLAGGED: /* \Flagged flag */
mFlags.setBit(FLAG_FLAGGED);
break;
case MAILIMAP_FLAG_DELETED: /* \Deleted flag */
mFlags.setBit(FLAG_DELETED);
break;
case MAILIMAP_FLAG_SEEN: /* \Seen flag */
mFlags.setBit(FLAG_SEEN);
diff --git a/noncore/net/mail/libmailwrapper/pop3wrapper.cpp b/noncore/net/mail/libmailwrapper/pop3wrapper.cpp
index 62523bf..5065d29 100644
--- a/noncore/net/mail/libmailwrapper/pop3wrapper.cpp
+++ b/noncore/net/mail/libmailwrapper/pop3wrapper.cpp
@@ -228,62 +228,62 @@ void POP3wrapper::login()
server = account->getServer().latin1();
port = account->getPort().toUInt();
user = account->getUser().latin1();
pass = account->getPassword().latin1();
m_pop3 = mailpop3_new( 200, &pop3_progress );
// connect
if (account->getSSL()) {
err = mailpop3_ssl_connect( m_pop3, (char*)server, port );
} else {
err = mailpop3_socket_connect( m_pop3, (char*)server, port );
}
if ( err != MAILPOP3_NO_ERROR ) {
qDebug( "pop3: error connecting to %s\n reason: %s", server,
m_pop3->pop3_response );
mailpop3_free( m_pop3 );
m_pop3 = NULL;
return;
}
qDebug( "POP3: connected!" );
// login
// TODO: decide if apop or plain login should be used
err = mailpop3_login( m_pop3, (char *) user, (char *) pass );
if ( err != MAILPOP3_NO_ERROR ) {
qDebug( "pop3: error logging in: %s", m_pop3->pop3_response );
logout();
return;
}
qDebug( "POP3: logged in!" );
}
void POP3wrapper::logout()
{
int err = MAILPOP3_NO_ERROR;
if ( m_pop3 == NULL ) return;
err = mailpop3_quit( m_pop3 );
mailpop3_free( m_pop3 );
m_pop3 = NULL;
}
QList<Folder>* POP3wrapper::listFolders()
{
QList<Folder> * folders = new QList<Folder>();
- folders->setAutoDelete( true );
+ folders->setAutoDelete( false );
Folder*inb=new Folder("INBOX");
folders->append(inb);
return folders;
}
QString POP3wrapper::fetchPart(const RecMail&,const RecPart&)
{
return "";
}
void POP3wrapper::deleteMail(const RecMail&)
{
}
diff --git a/noncore/net/mail/mainwindow.cpp b/noncore/net/mail/mainwindow.cpp
index cab1a66..fae3e97 100644
--- a/noncore/net/mail/mainwindow.cpp
+++ b/noncore/net/mail/mainwindow.cpp
@@ -38,97 +38,97 @@ MainWindow::MainWindow( QWidget *parent, const char *name, WFlags flags )
0, 0, this );
composeMail->addTo( toolBar );
composeMail->addTo( mailMenu );
sendQueued = new QAction( tr( "Send queued mails" ), ICON_SENDQUEUED,
0, 0, this );
sendQueued->addTo( toolBar );
sendQueued->addTo( mailMenu );
syncFolders = new QAction( tr( "Sync mailfolders" ), ICON_SYNC,
0, 0, this );
syncFolders->addTo( toolBar );
syncFolders->addTo( mailMenu );
showFolders = new QAction( tr( "Show/Hide folders" ), ICON_SHOWFOLDERS,
0, 0, this, 0, true );
showFolders->addTo( toolBar );
showFolders->addTo( mailMenu );
showFolders->setOn( true );
connect(showFolders, SIGNAL( toggled( bool ) ),
SLOT( slotShowFolders( bool ) ) );
searchMails = new QAction( tr( "Search mails" ), ICON_SEARCHMAILS,
0, 0, this );
searchMails->addTo( toolBar );
searchMails->addTo( mailMenu );
deleteMails = new QAction(tr("Delete Mail"), QIconSet(Resource::loadPixmap("mail/delete")), 0, 0, this);
deleteMails->addTo( toolBar );
deleteMails->addTo( mailMenu );
connect( deleteMails, SIGNAL( activated() ),
SLOT( slotDeleteMail() ) );
editSettings = new QAction( tr( "Edit settings" ), ICON_EDITSETTINGS,
0, 0, this );
editSettings->addTo( settingsMenu );
editAccounts = new QAction( tr( "Configure accounts" ), ICON_EDITACCOUNTS,
0, 0, this );
editAccounts->addTo( settingsMenu );
QWidget *view = new QWidget( this );
setCentralWidget( view );
layout = new QBoxLayout ( view, QBoxLayout::LeftToRight );
folderView = new AccountView( view );
folderView->header()->hide();
- folderView->setRootIsDecorated( false );
+ folderView->setRootIsDecorated( true );
folderView->addColumn( tr( "Mailbox" ) );
//folderView->hide();
layout->addWidget( folderView );
mailView = new QListView( view );
mailView->addColumn( tr( "" ) );
mailView->addColumn( tr( "Subject" ),QListView::Manual );
mailView->addColumn( tr( "Sender" ),QListView::Manual );
mailView->addColumn( tr( "Date" ));
mailView->setAllColumnsShowFocus(true);
mailView->setSorting(-1);
layout->addWidget( mailView );
layout->setStretchFactor( folderView, 1 );
layout->setStretchFactor( mailView, 2 );
slotAdjustLayout();
connect( mailView, SIGNAL( clicked( QListViewItem * ) ),this,
SLOT( displayMail( QListViewItem * ) ) );
connect(folderView, SIGNAL(refreshMailview(QList<RecMail>*)),this,SLOT(refreshMailView(QList<RecMail>*)));
QTimer::singleShot( 1000, this, SLOT( slotAdjustColumns() ) );
}
void MainWindow::slotAdjustLayout() {
QWidget *d = QApplication::desktop();
if ( d->width() < d->height() ) {
layout->setDirection( QBoxLayout::TopToBottom );
} else {
layout->setDirection( QBoxLayout::LeftToRight );
}
delete d;
}
void MainWindow::slotAdjustColumns()
{
bool hidden = folderView->isHidden();
if ( hidden ) folderView->show();
folderView->setColumnWidth( 0, folderView->visibleWidth() );
if ( hidden ) folderView->hide();
diff --git a/noncore/net/mail/pop3wrapper.cpp b/noncore/net/mail/pop3wrapper.cpp
index 62523bf..5065d29 100644
--- a/noncore/net/mail/pop3wrapper.cpp
+++ b/noncore/net/mail/pop3wrapper.cpp
@@ -228,62 +228,62 @@ void POP3wrapper::login()
server = account->getServer().latin1();
port = account->getPort().toUInt();
user = account->getUser().latin1();
pass = account->getPassword().latin1();
m_pop3 = mailpop3_new( 200, &pop3_progress );
// connect
if (account->getSSL()) {
err = mailpop3_ssl_connect( m_pop3, (char*)server, port );
} else {
err = mailpop3_socket_connect( m_pop3, (char*)server, port );
}
if ( err != MAILPOP3_NO_ERROR ) {
qDebug( "pop3: error connecting to %s\n reason: %s", server,
m_pop3->pop3_response );
mailpop3_free( m_pop3 );
m_pop3 = NULL;
return;
}
qDebug( "POP3: connected!" );
// login
// TODO: decide if apop or plain login should be used
err = mailpop3_login( m_pop3, (char *) user, (char *) pass );
if ( err != MAILPOP3_NO_ERROR ) {
qDebug( "pop3: error logging in: %s", m_pop3->pop3_response );
logout();
return;
}
qDebug( "POP3: logged in!" );
}
void POP3wrapper::logout()
{
int err = MAILPOP3_NO_ERROR;
if ( m_pop3 == NULL ) return;
err = mailpop3_quit( m_pop3 );
mailpop3_free( m_pop3 );
m_pop3 = NULL;
}
QList<Folder>* POP3wrapper::listFolders()
{
QList<Folder> * folders = new QList<Folder>();
- folders->setAutoDelete( true );
+ folders->setAutoDelete( false );
Folder*inb=new Folder("INBOX");
folders->append(inb);
return folders;
}
QString POP3wrapper::fetchPart(const RecMail&,const RecPart&)
{
return "";
}
void POP3wrapper::deleteMail(const RecMail&)
{
}
diff --git a/noncore/net/mail/viewmail.cpp b/noncore/net/mail/viewmail.cpp
index 2415c82..e53f4a3 100644
--- a/noncore/net/mail/viewmail.cpp
+++ b/noncore/net/mail/viewmail.cpp
@@ -1,50 +1,50 @@
#include <qtextbrowser.h>
-#include <qmessagebox.h>?
+#include <qmessagebox.h>
#include <qtextstream.h>
#include <qaction.h>
#include <qpopupmenu.h>
#include <qapplication.h>
#include <opie/ofiledialog.h>
#include "settings.h"
#include "composemail.h"
#include "viewmail.h"
#include "abstractmail.h"
#include "accountview.h"
AttachItem::AttachItem(QListView * parent,QListViewItem *after, const QString&mime,const QString&file,const QString&desc,int num)
: QListViewItem(parent,after),_partNum(num)
{
setText(0, mime);
setText(1, file);
setText(2, desc);
}
void ViewMail::setBody( RecBody body ) {
m_body = body;
m_mail[2] = body.Bodytext();
attachbutton->setEnabled(body.Parts().count()>0);
attachments->setEnabled(body.Parts().count()>0);
if (body.Parts().count()==0) {
return;
}
AttachItem * curItem=0;
QString type=body.Description().Type()+"/"+body.Description().Subtype();
QString desc;
double s = body.Description().Size();
int w;
w=0;
while (s>1024) {
s/=1024;
++w;
if (w>=2) break;
}
QString q="";
switch(w) {
case 1:
q="k";
break;