author | alwin <alwin> | 2003-12-14 03:41:49 (UTC) |
---|---|---|
committer | alwin <alwin> | 2003-12-14 03:41:49 (UTC) |
commit | 84ac61a9b46d463c9e3112f55cc1e69957d1348a (patch) (unidiff) | |
tree | aa2a03fc364b529a9863d44b9d51f030b22f4820 /noncore/net/mail/accountview.cpp | |
parent | 12ba6ab9606538628afc7f7015e115a0251d0389 (diff) | |
download | opie-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 (limited to 'noncore/net/mail/accountview.cpp') (more/less context) (ignore whitespace changes)
-rw-r--r-- | noncore/net/mail/accountview.cpp | 9 |
1 files changed, 7 insertions, 2 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 | |||
@@ -64,64 +64,69 @@ void IMAPviewItem::refresh(QList<RecMail>&) | |||
64 | 64 | ||
65 | QListViewItem *child = firstChild(); | 65 | QListViewItem *child = firstChild(); |
66 | while ( child ) { | 66 | while ( child ) { |
67 | QListViewItem *tmp = child; | 67 | QListViewItem *tmp = child; |
68 | child = child->nextSibling(); | 68 | child = child->nextSibling(); |
69 | delete tmp; | 69 | delete tmp; |
70 | } | 70 | } |
71 | 71 | ||
72 | Folder *it; | 72 | Folder *it; |
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 | ||
79 | RecBody IMAPviewItem::fetchBody(const RecMail&) | 83 | RecBody IMAPviewItem::fetchBody(const RecMail&) |
80 | { | 84 | { |
81 | return RecBody(); | 85 | return RecBody(); |
82 | } | 86 | } |
83 | 87 | ||
84 | IMAPfolderItem::~IMAPfolderItem() | 88 | IMAPfolderItem::~IMAPfolderItem() |
85 | { | 89 | { |
86 | delete folder; | 90 | delete folder; |
87 | } | 91 | } |
88 | 92 | ||
89 | IMAPfolderItem::IMAPfolderItem( Folder *folderInit, IMAPviewItem *parent , QListViewItem*after ) | 93 | IMAPfolderItem::IMAPfolderItem( Folder *folderInit, IMAPviewItem *parent , QListViewItem*after ) |
90 | : AccountViewItem( parent,after ) | 94 | : AccountViewItem( parent,after ) |
91 | { | 95 | { |
92 | folder = folderInit; | 96 | folder = folderInit; |
93 | imap = parent; | 97 | imap = parent; |
94 | setPixmap( 0, PIXMAP_IMAPFOLDER ); | 98 | setPixmap( 0, PIXMAP_IMAPFOLDER ); |
95 | setText( 0, folder->getDisplayName() ); | 99 | setText( 0, folder->getDisplayName() ); |
96 | } | 100 | } |
97 | 101 | ||
98 | void IMAPfolderItem::refresh(QList<RecMail>&target) | 102 | void IMAPfolderItem::refresh(QList<RecMail>&target) |
99 | { | 103 | { |
100 | imap->getWrapper()->listMessages( folder->getName(),target ); | 104 | if (folder->may_select()) |
105 | imap->getWrapper()->listMessages( folder->getName(),target ); | ||
101 | } | 106 | } |
102 | 107 | ||
103 | RecBody IMAPfolderItem::fetchBody(const RecMail&aMail) | 108 | RecBody IMAPfolderItem::fetchBody(const RecMail&aMail) |
104 | { | 109 | { |
105 | return imap->getWrapper()->fetchBody(aMail); | 110 | return imap->getWrapper()->fetchBody(aMail); |
106 | } | 111 | } |
107 | 112 | ||
108 | /** | 113 | /** |
109 | * Generic stuff | 114 | * Generic stuff |
110 | */ | 115 | */ |
111 | 116 | ||
112 | AccountView::AccountView( QWidget *parent, const char *name, WFlags flags ) | 117 | AccountView::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 | } |
119 | 124 | ||
120 | void AccountView::populate( QList<Account> list ) | 125 | void AccountView::populate( QList<Account> list ) |
121 | { | 126 | { |
122 | clear(); | 127 | clear(); |
123 | 128 | ||
124 | Account *it; | 129 | Account *it; |
125 | for ( it = list.first(); it; it = list.next() ) { | 130 | for ( it = list.first(); it; it = list.next() ) { |
126 | if ( it->getType().compare( "IMAP" ) == 0 ) { | 131 | if ( it->getType().compare( "IMAP" ) == 0 ) { |
127 | IMAPaccount *imap = static_cast<IMAPaccount *>(it); | 132 | IMAPaccount *imap = static_cast<IMAPaccount *>(it); |