summaryrefslogtreecommitdiff
Side-by-side diff
Diffstat (more/less context) (show whitespace changes)
-rw-r--r--noncore/net/mail/accountview.cpp7
-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, 28 insertions, 15 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
@@ -70,13 +70,17 @@ void IMAPviewItem::refresh(QList<RecMail>&)
}
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();
}
@@ -94,12 +98,13 @@ IMAPfolderItem::IMAPfolderItem( Folder *folderInit, IMAPviewItem *parent , QList
setPixmap( 0, PIXMAP_IMAPFOLDER );
setText( 0, folder->getDisplayName() );
}
void IMAPfolderItem::refresh(QList<RecMail>&target)
{
+ if (folder->may_select())
imap->getWrapper()->listMessages( folder->getName(),target );
}
RecBody IMAPfolderItem::fetchBody(const RecMail&aMail)
{
return imap->getWrapper()->fetchBody(aMail);
@@ -109,13 +114,13 @@ RecBody IMAPfolderItem::fetchBody(const RecMail&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 )
{
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
@@ -146,13 +146,13 @@ 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;
}
/*
@@ -185,25 +185,29 @@ QList<Folder>* IMAPwrapper::listFolders()
*/
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;
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
@@ -146,13 +146,13 @@ 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;
}
/*
@@ -185,25 +185,29 @@ QList<Folder>* IMAPwrapper::listFolders()
*/
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;
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
@@ -270,13 +270,13 @@ void POP3wrapper::logout()
}
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&)
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
@@ -80,13 +80,13 @@ MainWindow::MainWindow( QWidget *parent, const char *name, WFlags flags )
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 );
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
@@ -270,13 +270,13 @@ void POP3wrapper::logout()
}
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&)
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,8 +1,8 @@
#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>