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 | |||
@@ -52,88 +52,93 @@ IMAPviewItem::~IMAPviewItem() | |||
52 | { | 52 | { |
53 | delete wrapper; | 53 | delete wrapper; |
54 | } | 54 | } |
55 | 55 | ||
56 | AbstractMail *IMAPviewItem::getWrapper() | 56 | AbstractMail *IMAPviewItem::getWrapper() |
57 | { | 57 | { |
58 | return wrapper; | 58 | return wrapper; |
59 | } | 59 | } |
60 | 60 | ||
61 | void IMAPviewItem::refresh(QList<RecMail>&) | 61 | void IMAPviewItem::refresh(QList<RecMail>&) |
62 | { | 62 | { |
63 | QList<Folder> *folders = wrapper->listFolders(); | 63 | QList<Folder> *folders = wrapper->listFolders(); |
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); |
128 | qDebug( "added IMAP " + imap->getAccountName() ); | 133 | qDebug( "added IMAP " + imap->getAccountName() ); |
129 | (void) new IMAPviewItem( imap, this ); | 134 | (void) new IMAPviewItem( imap, this ); |
130 | } else if ( it->getType().compare( "POP3" ) == 0 ) { | 135 | } else if ( it->getType().compare( "POP3" ) == 0 ) { |
131 | POP3account *pop3 = static_cast<POP3account *>(it); | 136 | POP3account *pop3 = static_cast<POP3account *>(it); |
132 | qDebug( "added POP3 " + pop3->getAccountName() ); | 137 | qDebug( "added POP3 " + pop3->getAccountName() ); |
133 | (void) new POP3viewItem( pop3, this ); | 138 | (void) new POP3viewItem( pop3, this ); |
134 | } | 139 | } |
135 | } | 140 | } |
136 | } | 141 | } |
137 | 142 | ||
138 | void AccountView::refresh(QListViewItem *item) { | 143 | void AccountView::refresh(QListViewItem *item) { |
139 | 144 | ||