summaryrefslogtreecommitdiff
authoralwin <alwin>2003-12-14 03:41:49 (UTC)
committer alwin <alwin>2003-12-14 03:41:49 (UTC)
commit84ac61a9b46d463c9e3112f55cc1e69957d1348a (patch) (unidiff)
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) (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
@@ -73,7 +73,11 @@ void IMAPviewItem::refresh(QList<RecMail>&)
73 QListViewItem*item = 0; 73 QListViewItem*item = 0;
74 for ( it = folders->first(); it; it = folders->next() ) { 74 for ( it = folders->first(); it; it = folders->next() ) {
75 item = new IMAPfolderItem( it, this , item ); 75 item = new IMAPfolderItem( it, this , item );
76 item->setSelectable(it->may_select());
76 } 77 }
78 // !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
79 folders->setAutoDelete(false);
80 delete folders;
77} 81}
78 82
79RecBody IMAPviewItem::fetchBody(const RecMail&) 83RecBody IMAPviewItem::fetchBody(const RecMail&)
@@ -97,6 +101,7 @@ IMAPfolderItem::IMAPfolderItem( Folder *folderInit, IMAPviewItem *parent , QList
97 101
98void IMAPfolderItem::refresh(QList<RecMail>&target) 102void IMAPfolderItem::refresh(QList<RecMail>&target)
99{ 103{
104 if (folder->may_select())
100 imap->getWrapper()->listMessages( folder->getName(),target ); 105 imap->getWrapper()->listMessages( folder->getName(),target );
101} 106}
102 107
@@ -112,7 +117,7 @@ RecBody IMAPfolderItem::fetchBody(const RecMail&aMail)
112AccountView::AccountView( QWidget *parent, const char *name, WFlags flags ) 117AccountView::AccountView( QWidget *parent, const char *name, WFlags flags )
113 : QListView( parent, name, flags ) 118 : QListView( parent, name, flags )
114{ 119{
115 connect( this, SIGNAL( clicked( QListViewItem * ) ), 120 connect( this, SIGNAL( selectionChanged( QListViewItem * ) ),
116 SLOT( refresh( QListViewItem * ) ) ); 121 SLOT( refresh( QListViewItem * ) ) );
117 setSorting(-1); 122 setSorting(-1);
118} 123}
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
@@ -149,7 +149,7 @@ QList<Folder>* IMAPwrapper::listFolders()
149 clistcell *current; 149 clistcell *current;
150 150
151 QList<Folder> * folders = new QList<Folder>(); 151 QList<Folder> * folders = new QList<Folder>();
152 folders->setAutoDelete( true ); 152 folders->setAutoDelete( false );
153 login(); 153 login();
154 if (!m_imap) { 154 if (!m_imap) {
155 return folders; 155 return folders;
@@ -188,19 +188,23 @@ QList<Folder>* IMAPwrapper::listFolders()
188 if (!path) path = ""; 188 if (!path) path = "";
189 result = clist_new(); 189 result = clist_new();
190 qDebug(path); 190 qDebug(path);
191 bool selectable = true;
192 mailimap_mbx_list_flags*bflags;
191 err = mailimap_list( m_imap, (char*)path, (char*)mask, &result ); 193 err = mailimap_list( m_imap, (char*)path, (char*)mask, &result );
192 if ( err == MAILIMAP_NO_ERROR ) { 194 if ( err == MAILIMAP_NO_ERROR ) {
193 current = result->first; 195 current = result->first;
194 for ( int i = result->count; i > 0; i-- ) { 196 for ( current=clist_begin(result);current!=NULL;current=clist_next(current)) {
195 list = (mailimap_mailbox_list *) current->data; 197 list = (mailimap_mailbox_list *) current->data;
196 // it is better use the deep copy mechanism of qt itself 198 // it is better use the deep copy mechanism of qt itself
197 // instead of using strdup! 199 // instead of using strdup!
198 temp = list->mb_name; 200 temp = list->mb_name;
199 current = current->next;
200 if (temp.lower()=="inbox") 201 if (temp.lower()=="inbox")
201 continue; 202 continue;
202 folders->append(new IMAPFolder(temp)); 203 if ( (bflags = list->mb_flag) ) {
203 204 selectable = !(bflags->mbf_type==MAILIMAP_MBX_LIST_FLAGS_SFLAG&&
205 bflags->mbf_sflag==MAILIMAP_MBX_LIST_SFLAG_NOSELECT);
206 }
207 folders->append(new IMAPFolder(temp,selectable));
204 } 208 }
205 } else { 209 } else {
206 qDebug("error fetching folders %s",m_imap->imap_response); 210 qDebug("error fetching folders %s",m_imap->imap_response);
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
@@ -149,7 +149,7 @@ QList<Folder>* IMAPwrapper::listFolders()
149 clistcell *current; 149 clistcell *current;
150 150
151 QList<Folder> * folders = new QList<Folder>(); 151 QList<Folder> * folders = new QList<Folder>();
152 folders->setAutoDelete( true ); 152 folders->setAutoDelete( false );
153 login(); 153 login();
154 if (!m_imap) { 154 if (!m_imap) {
155 return folders; 155 return folders;
@@ -188,19 +188,23 @@ QList<Folder>* IMAPwrapper::listFolders()
188 if (!path) path = ""; 188 if (!path) path = "";
189 result = clist_new(); 189 result = clist_new();
190 qDebug(path); 190 qDebug(path);
191 bool selectable = true;
192 mailimap_mbx_list_flags*bflags;
191 err = mailimap_list( m_imap, (char*)path, (char*)mask, &result ); 193 err = mailimap_list( m_imap, (char*)path, (char*)mask, &result );
192 if ( err == MAILIMAP_NO_ERROR ) { 194 if ( err == MAILIMAP_NO_ERROR ) {
193 current = result->first; 195 current = result->first;
194 for ( int i = result->count; i > 0; i-- ) { 196 for ( current=clist_begin(result);current!=NULL;current=clist_next(current)) {
195 list = (mailimap_mailbox_list *) current->data; 197 list = (mailimap_mailbox_list *) current->data;
196 // it is better use the deep copy mechanism of qt itself 198 // it is better use the deep copy mechanism of qt itself
197 // instead of using strdup! 199 // instead of using strdup!
198 temp = list->mb_name; 200 temp = list->mb_name;
199 current = current->next;
200 if (temp.lower()=="inbox") 201 if (temp.lower()=="inbox")
201 continue; 202 continue;
202 folders->append(new IMAPFolder(temp)); 203 if ( (bflags = list->mb_flag) ) {
203 204 selectable = !(bflags->mbf_type==MAILIMAP_MBX_LIST_FLAGS_SFLAG&&
205 bflags->mbf_sflag==MAILIMAP_MBX_LIST_SFLAG_NOSELECT);
206 }
207 folders->append(new IMAPFolder(temp,selectable));
204 } 208 }
205 } else { 209 } else {
206 qDebug("error fetching folders %s",m_imap->imap_response); 210 qDebug("error fetching folders %s",m_imap->imap_response);
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
@@ -273,7 +273,7 @@ void POP3wrapper::logout()
273QList<Folder>* POP3wrapper::listFolders() 273QList<Folder>* POP3wrapper::listFolders()
274{ 274{
275 QList<Folder> * folders = new QList<Folder>(); 275 QList<Folder> * folders = new QList<Folder>();
276 folders->setAutoDelete( true ); 276 folders->setAutoDelete( false );
277 Folder*inb=new Folder("INBOX"); 277 Folder*inb=new Folder("INBOX");
278 folders->append(inb); 278 folders->append(inb);
279 return folders; 279 return folders;
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
@@ -83,7 +83,7 @@ MainWindow::MainWindow( QWidget *parent, const char *name, WFlags flags )
83 83
84 folderView = new AccountView( view ); 84 folderView = new AccountView( view );
85 folderView->header()->hide(); 85 folderView->header()->hide();
86 folderView->setRootIsDecorated( false ); 86 folderView->setRootIsDecorated( true );
87 folderView->addColumn( tr( "Mailbox" ) ); 87 folderView->addColumn( tr( "Mailbox" ) );
88 //folderView->hide(); 88 //folderView->hide();
89 89
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
@@ -273,7 +273,7 @@ void POP3wrapper::logout()
273QList<Folder>* POP3wrapper::listFolders() 273QList<Folder>* POP3wrapper::listFolders()
274{ 274{
275 QList<Folder> * folders = new QList<Folder>(); 275 QList<Folder> * folders = new QList<Folder>();
276 folders->setAutoDelete( true ); 276 folders->setAutoDelete( false );
277 Folder*inb=new Folder("INBOX"); 277 Folder*inb=new Folder("INBOX");
278 folders->append(inb); 278 folders->append(inb);
279 return folders; 279 return folders;
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,5 +1,5 @@
1#include <qtextbrowser.h> 1#include <qtextbrowser.h>
2#include <qmessagebox.h>? 2#include <qmessagebox.h>
3#include <qtextstream.h> 3#include <qtextstream.h>
4#include <qaction.h> 4#include <qaction.h>
5#include <qpopupmenu.h> 5#include <qpopupmenu.h>