-rw-r--r-- | noncore/net/mail/accountitem.cpp | 240 | ||||
-rw-r--r-- | noncore/net/mail/accountitem.h | 50 | ||||
-rw-r--r-- | noncore/net/mail/accountview.cpp | 29 | ||||
-rw-r--r-- | noncore/net/mail/accountview.h | 8 | ||||
-rw-r--r-- | noncore/net/mail/mainwindow.cpp | 23 | ||||
-rw-r--r-- | noncore/net/mail/mainwindow.h | 12 | ||||
-rw-r--r-- | noncore/net/mail/opiemail.cpp | 41 | ||||
-rw-r--r-- | noncore/net/mail/opiemail.h | 8 |
8 files changed, 249 insertions, 162 deletions
diff --git a/noncore/net/mail/accountitem.cpp b/noncore/net/mail/accountitem.cpp index 10db2c6..f7fdccd 100644 --- a/noncore/net/mail/accountitem.cpp +++ b/noncore/net/mail/accountitem.cpp | |||
@@ -1,1152 +1,1164 @@ | |||
1 | 1 | ||
2 | #include "accountitem.h" | 2 | #include "accountitem.h" |
3 | #include "accountview.h" | 3 | #include "accountview.h" |
4 | #include "newmaildir.h" | 4 | #include "newmaildir.h" |
5 | #include "nntpgroupsdlg.h" | 5 | #include "nntpgroupsdlg.h" |
6 | #include "defines.h" | 6 | #include "defines.h" |
7 | 7 | ||
8 | #include <libmailwrapper/mailtypes.h> | 8 | #include <libmailwrapper/mailtypes.h> |
9 | #include <libmailwrapper/abstractmail.h> | 9 | #include <libmailwrapper/abstractmail.h> |
10 | #include <libmailwrapper/mailwrapper.h> | 10 | #include <libmailwrapper/mailwrapper.h> |
11 | /* OPIE */ | 11 | /* OPIE */ |
12 | #include <opie2/odebug.h> | 12 | #include <opie2/odebug.h> |
13 | #include <qpe/qpeapplication.h> | 13 | #include <qpe/qpeapplication.h> |
14 | 14 | ||
15 | /* QT */ | 15 | /* QT */ |
16 | #include <qpopupmenu.h> | 16 | #include <qpopupmenu.h> |
17 | #include <qmessagebox.h> | 17 | #include <qmessagebox.h> |
18 | 18 | ||
19 | using namespace Opie::Core; | 19 | using namespace Opie::Core; |
20 | #define SETPIX(x) if (!account->getOffline()) {setPixmap( 0,x);} else {setPixmap( 0, PIXMAP_OFFLINE );} | 20 | #define SETPIX(x) if (!account->getOffline()) {setPixmap( 0,x);} else {setPixmap( 0, PIXMAP_OFFLINE );} |
21 | /** | 21 | /** |
22 | * POP3 Account stuff | 22 | * POP3 Account stuff |
23 | */ | 23 | */ |
24 | POP3viewItem::POP3viewItem( POP3account *a, AccountView *parent ) | 24 | POP3viewItem::POP3viewItem( POP3account *a, AccountView *parent ) |
25 | : AccountViewItem( parent ) | 25 | : AccountViewItem( parent ) |
26 | { | 26 | { |
27 | account = a; | 27 | account = a; |
28 | wrapper = AbstractMail::getWrapper( account ); | 28 | wrapper = AbstractMail::getWrapper( account ); |
29 | SETPIX(PIXMAP_POP3FOLDER); | 29 | SETPIX(PIXMAP_POP3FOLDER); |
30 | #if 0 | 30 | #if 0 |
31 | if (!account->getOffline()) | 31 | if (!account->getOffline()) |
32 | { | 32 | { |
33 | setPixmap( 0, ); | 33 | setPixmap( 0, ); |
34 | } | 34 | } |
35 | else | 35 | else |
36 | { | 36 | { |
37 | setPixmap( 0, PIXMAP_OFFLINE ); | 37 | setPixmap( 0, PIXMAP_OFFLINE ); |
38 | } | 38 | } |
39 | #endif | 39 | #endif |
40 | setText( 0, account->getAccountName() ); | 40 | setText( 0, account->getAccountName() ); |
41 | setOpen( true ); | 41 | setOpen( true ); |
42 | } | 42 | } |
43 | 43 | ||
44 | POP3viewItem::~POP3viewItem() | 44 | POP3viewItem::~POP3viewItem() |
45 | { | 45 | { |
46 | delete wrapper; | 46 | delete wrapper; |
47 | } | 47 | } |
48 | 48 | ||
49 | AbstractMail *POP3viewItem::getWrapper() | 49 | AbstractMail *POP3viewItem::getWrapper() |
50 | { | 50 | { |
51 | return wrapper; | 51 | return wrapper; |
52 | } | 52 | } |
53 | 53 | ||
54 | void POP3viewItem::refresh(QValueList<Opie::Core::OSmartPointer<RecMail> > & ) | 54 | void POP3viewItem::refresh(QValueList<Opie::Core::OSmartPointer<RecMail> > & ) |
55 | { | 55 | { |
56 | refresh(); | 56 | refresh(); |
57 | } | 57 | } |
58 | 58 | ||
59 | void POP3viewItem::refresh() | 59 | void POP3viewItem::refresh() |
60 | { | 60 | { |
61 | if (account->getOffline()) return; | 61 | if (account->getOffline()) return; |
62 | QValueList<FolderP> *folders = wrapper->listFolders(); | 62 | QValueList<FolderP> *folders = wrapper->listFolders(); |
63 | QListViewItem *child = firstChild(); | 63 | QListViewItem *child = firstChild(); |
64 | while ( child ) | 64 | while ( child ) |
65 | { | 65 | { |
66 | QListViewItem *tmp = child; | 66 | QListViewItem *tmp = child; |
67 | child = child->nextSibling(); | 67 | child = child->nextSibling(); |
68 | delete tmp; | 68 | delete tmp; |
69 | } | 69 | } |
70 | QValueList<FolderP>::ConstIterator it; | 70 | QValueList<FolderP>::ConstIterator it; |
71 | QListViewItem*item = 0; | 71 | QListViewItem*item = 0; |
72 | for ( it = folders->begin(); it!=folders->end(); ++it) | 72 | for ( it = folders->begin(); it!=folders->end(); ++it) |
73 | { | 73 | { |
74 | item = new POP3folderItem( (*it), this , item ); | 74 | item = new POP3folderItem( (*it), this , item ); |
75 | item->setSelectable( (*it)->may_select()); | 75 | item->setSelectable( (*it)->may_select()); |
76 | } | 76 | } |
77 | delete folders; | 77 | delete folders; |
78 | } | 78 | } |
79 | 79 | ||
80 | RECBODYP POP3viewItem::fetchBody( const RecMailP &mail ) | 80 | RECBODYP POP3viewItem::fetchBody( const RecMailP &mail ) |
81 | { | 81 | { |
82 | odebug << "POP3 fetchBody" << oendl; | 82 | odebug << "POP3 fetchBody" << oendl; |
83 | return wrapper->fetchBody( mail ); | 83 | return wrapper->fetchBody( mail ); |
84 | } | 84 | } |
85 | 85 | ||
86 | QPopupMenu * POP3viewItem::getContextMenu() | 86 | QMap<int,QString> POP3viewItem::serverMenu() |
87 | { | 87 | { |
88 | QPopupMenu *m = new QPopupMenu(0); | 88 | QMap<int,QString> _entries; |
89 | if (m) | 89 | if (!account->getOffline()) { |
90 | { | 90 | _entries[SERVER_MENU_DISCONNECT]=QObject::tr("Disconnect",contextName); |
91 | if (!account->getOffline()) | 91 | _entries[SERVER_MENU_OFFLINE]=QObject::tr("Set offline",contextName); |
92 | { | 92 | } else { |
93 | m->insertItem(QObject::tr("Disconnect",contextName),SERVER_MENU_DISCONNECT); | 93 | _entries[SERVER_MENU_OFFLINE]=QObject::tr("Set online",contextName); |
94 | m->insertItem(QObject::tr("Set offline",contextName),SERVER_MENU_OFFLINE); | ||
95 | } | ||
96 | else | ||
97 | { | ||
98 | m->insertItem(QObject::tr("Set online",contextName),SERVER_MENU_OFFLINE); | ||
99 | } | ||
100 | } | 94 | } |
101 | return m; | 95 | return _entries; |
102 | } | 96 | } |
103 | 97 | ||
104 | void POP3viewItem::disconnect() | 98 | void POP3viewItem::disconnect() |
105 | { | 99 | { |
106 | QListViewItem *child = firstChild(); | 100 | QListViewItem *child = firstChild(); |
107 | while ( child ) | 101 | while ( child ) |
108 | { | 102 | { |
109 | QListViewItem *tmp = child; | 103 | QListViewItem *tmp = child; |
110 | child = child->nextSibling(); | 104 | child = child->nextSibling(); |
111 | delete tmp; | 105 | delete tmp; |
112 | } | 106 | } |
113 | wrapper->logout(); | 107 | wrapper->logout(); |
114 | } | 108 | } |
115 | 109 | ||
116 | void POP3viewItem::setOnOffline() | 110 | void POP3viewItem::setOnOffline() |
117 | { | 111 | { |
118 | if (!account->getOffline()) | 112 | if (!account->getOffline()) |
119 | { | 113 | { |
120 | disconnect(); | 114 | disconnect(); |
121 | } | 115 | } |
122 | account->setOffline(!account->getOffline()); | 116 | account->setOffline(!account->getOffline()); |
123 | account->save(); | 117 | account->save(); |
124 | SETPIX(PIXMAP_POP3FOLDER); | 118 | SETPIX(PIXMAP_POP3FOLDER); |
125 | refresh(); | 119 | refresh(); |
126 | } | 120 | } |
127 | 121 | ||
128 | void POP3viewItem::contextMenuSelected(int which) | 122 | bool POP3viewItem::contextMenuSelected(int which) |
129 | { | 123 | { |
130 | switch (which) | 124 | switch (which) |
131 | { | 125 | { |
132 | case SERVER_MENU_DISCONNECT: | 126 | case SERVER_MENU_DISCONNECT: |
133 | disconnect(); | 127 | disconnect(); |
134 | break; | 128 | break; |
135 | case SERVER_MENU_OFFLINE: | 129 | case SERVER_MENU_OFFLINE: |
136 | setOnOffline(); | 130 | setOnOffline(); |
137 | break; | 131 | break; |
138 | } | 132 | } |
133 | return false; | ||
139 | } | 134 | } |
140 | 135 | ||
141 | POP3folderItem::~POP3folderItem() | 136 | POP3folderItem::~POP3folderItem() |
142 | {} | 137 | {} |
143 | 138 | ||
144 | POP3folderItem::POP3folderItem( const FolderP&folderInit, POP3viewItem *parent , QListViewItem*after ) | 139 | POP3folderItem::POP3folderItem( const FolderP&folderInit, POP3viewItem *parent , QListViewItem*after ) |
145 | : AccountViewItem(folderInit,parent,after ) | 140 | : AccountViewItem(folderInit,parent,after ) |
146 | { | 141 | { |
147 | pop3 = parent; | 142 | pop3 = parent; |
148 | if (folder->getDisplayName().lower()!="inbox") | 143 | if (folder->getDisplayName().lower()!="inbox") |
149 | { | 144 | { |
150 | setPixmap( 0, PIXMAP_POP3FOLDER ); | 145 | setPixmap( 0, PIXMAP_POP3FOLDER ); |
151 | } | 146 | } |
152 | else | 147 | else |
153 | { | 148 | { |
154 | setPixmap( 0, PIXMAP_INBOXFOLDER); | 149 | setPixmap( 0, PIXMAP_INBOXFOLDER); |
155 | } | 150 | } |
156 | setText( 0, folder->getDisplayName() ); | 151 | setText( 0, folder->getDisplayName() ); |
157 | } | 152 | } |
158 | 153 | ||
159 | void POP3folderItem::refresh(QValueList<RecMailP>&target) | 154 | void POP3folderItem::refresh(QValueList<RecMailP>&target) |
160 | { | 155 | { |
161 | if (folder->may_select()) | 156 | if (folder->may_select()) |
162 | pop3->getWrapper()->listMessages( folder->getName(),target ); | 157 | pop3->getWrapper()->listMessages( folder->getName(),target ); |
163 | } | 158 | } |
164 | 159 | ||
165 | RECBODYP POP3folderItem::fetchBody(const RecMailP&aMail) | 160 | RECBODYP POP3folderItem::fetchBody(const RecMailP&aMail) |
166 | { | 161 | { |
167 | return pop3->getWrapper()->fetchBody(aMail); | 162 | return pop3->getWrapper()->fetchBody(aMail); |
168 | } | 163 | } |
169 | 164 | ||
170 | QPopupMenu * POP3folderItem::getContextMenu() | 165 | QMap<int,QString> POP3folderItem::folderMenu() |
171 | { | 166 | { |
172 | QPopupMenu *m = new QPopupMenu(0); | 167 | QMap<int,QString> _entries; |
173 | if (m) | 168 | _entries[FOLDER_MENU_REFRESH_HEADER]=QObject::tr("Refresh header list",contextName); |
174 | { | 169 | _entries[FOLDER_MENU_DELETE_ALL_MAILS]=QObject::tr("Delete all mails",contextName); |
175 | m->insertItem(QObject::tr("Refresh header list",contextName),FOLDER_MENU_REFRESH_HEADER); | 170 | _entries[FOLDER_MENU_MOVE_MAILS]=QObject::tr("Move/Copie all mails",contextName); |
176 | m->insertItem(QObject::tr("Delete all mails",contextName),FOLDER_MENU_DELETE_ALL_MAILS); | 171 | return _entries; |
177 | m->insertItem(QObject::tr("Move/Copie all mails",contextName),FOLDER_MENU_MOVE_MAILS); | ||
178 | } | ||
179 | return m; | ||
180 | } | 172 | } |
181 | 173 | ||
182 | void POP3folderItem::downloadMails() | 174 | void POP3folderItem::downloadMails() |
183 | { | 175 | { |
184 | AccountView*bl = pop3->accountView(); | 176 | AccountView*bl = pop3->accountView(); |
185 | if (!bl) return; | 177 | if (!bl) return; |
186 | bl->downloadMails(folder,pop3->getWrapper()); | 178 | bl->downloadMails(folder,pop3->getWrapper()); |
187 | } | 179 | } |
188 | 180 | ||
189 | void POP3folderItem::contextMenuSelected(int which) | 181 | bool POP3folderItem::contextMenuSelected(int which) |
190 | { | 182 | { |
191 | AccountView * view = (AccountView*)listView(); | 183 | AccountView * view = (AccountView*)listView(); |
192 | switch (which) | 184 | switch (which) |
193 | { | 185 | { |
194 | case FOLDER_MENU_REFRESH_HEADER: | 186 | case FOLDER_MENU_REFRESH_HEADER: |
195 | /* must be 'cause pop3 lists are cached */ | 187 | /* must be 'cause pop3 lists are cached */ |
196 | pop3->getWrapper()->logout(); | 188 | pop3->getWrapper()->logout(); |
197 | view->refreshCurrent(); | 189 | view->refreshCurrent(); |
198 | break; | 190 | break; |
199 | case FOLDER_MENU_DELETE_ALL_MAILS: | 191 | case FOLDER_MENU_DELETE_ALL_MAILS: |
200 | deleteAllMail(pop3->getWrapper(),folder); | 192 | deleteAllMail(pop3->getWrapper(),folder); |
201 | break; | 193 | break; |
202 | case FOLDER_MENU_MOVE_MAILS: | 194 | case FOLDER_MENU_MOVE_MAILS: |
203 | downloadMails(); | 195 | downloadMails(); |
204 | break; | 196 | break; |
205 | default: | 197 | default: |
206 | break; | 198 | break; |
207 | } | 199 | } |
200 | return false; | ||
208 | } | 201 | } |
209 | 202 | ||
210 | /** | 203 | /** |
211 | * NNTP Account stuff | 204 | * NNTP Account stuff |
212 | */ | 205 | */ |
213 | NNTPviewItem::NNTPviewItem( NNTPaccount *a, AccountView *parent ) | 206 | NNTPviewItem::NNTPviewItem( NNTPaccount *a, AccountView *parent ) |
214 | : AccountViewItem( parent ) | 207 | : AccountViewItem( parent ) |
215 | { | 208 | { |
216 | account = a; | 209 | account = a; |
217 | wrapper = AbstractMail::getWrapper( account ); | 210 | wrapper = AbstractMail::getWrapper( account ); |
218 | //FIXME | 211 | //FIXME |
219 | SETPIX(PIXMAP_POP3FOLDER); | 212 | SETPIX(PIXMAP_POP3FOLDER); |
220 | #if 0 | 213 | #if 0 |
221 | if (!account->getOffline()) | 214 | if (!account->getOffline()) |
222 | { | 215 | { |
223 | setPixmap( 0, ); | 216 | setPixmap( 0, ); |
224 | } | 217 | } |
225 | else | 218 | else |
226 | { | 219 | { |
227 | setPixmap( 0, PIXMAP_OFFLINE ); | 220 | setPixmap( 0, PIXMAP_OFFLINE ); |
228 | } | 221 | } |
229 | #endif | 222 | #endif |
230 | setText( 0, account->getAccountName() ); | 223 | setText( 0, account->getAccountName() ); |
231 | setOpen( true ); | 224 | setOpen( true ); |
232 | } | 225 | } |
233 | 226 | ||
234 | NNTPviewItem::~NNTPviewItem() | 227 | NNTPviewItem::~NNTPviewItem() |
235 | { | 228 | { |
236 | delete wrapper; | 229 | delete wrapper; |
237 | } | 230 | } |
238 | 231 | ||
239 | AbstractMail *NNTPviewItem::getWrapper() | 232 | AbstractMail *NNTPviewItem::getWrapper() |
240 | { | 233 | { |
241 | return wrapper; | 234 | return wrapper; |
242 | } | 235 | } |
243 | 236 | ||
244 | void NNTPviewItem::refresh( QValueList<RecMailP> & ) | 237 | void NNTPviewItem::refresh( QValueList<RecMailP> & ) |
245 | { | 238 | { |
246 | refresh(); | 239 | refresh(); |
247 | } | 240 | } |
248 | 241 | ||
249 | void NNTPviewItem::refresh() | 242 | void NNTPviewItem::refresh() |
250 | { | 243 | { |
251 | if (account->getOffline()) return; | 244 | if (account->getOffline()) return; |
252 | QValueList<FolderP> *folders = wrapper->listFolders(); | 245 | QValueList<FolderP> *folders = wrapper->listFolders(); |
253 | 246 | ||
254 | QListViewItem *child = firstChild(); | 247 | QListViewItem *child = firstChild(); |
255 | while ( child ) | 248 | while ( child ) |
256 | { | 249 | { |
257 | QListViewItem *tmp = child; | 250 | QListViewItem *tmp = child; |
258 | child = child->nextSibling(); | 251 | child = child->nextSibling(); |
259 | delete tmp; | 252 | delete tmp; |
260 | } | 253 | } |
261 | QValueList<FolderP>::ConstIterator it; | 254 | QValueList<FolderP>::ConstIterator it; |
262 | QListViewItem*item = 0; | 255 | QListViewItem*item = 0; |
263 | for ( it = folders->begin(); it!=folders->end(); ++it) | 256 | for ( it = folders->begin(); it!=folders->end(); ++it) |
264 | { | 257 | { |
265 | item = new NNTPfolderItem( (*it), this , item ); | 258 | item = new NNTPfolderItem( (*it), this , item ); |
266 | item->setSelectable( (*it)->may_select()); | 259 | item->setSelectable( (*it)->may_select()); |
267 | } | 260 | } |
268 | delete folders; | 261 | delete folders; |
269 | } | 262 | } |
270 | 263 | ||
271 | RECBODYP NNTPviewItem::fetchBody( const RecMailP &mail ) | 264 | RECBODYP NNTPviewItem::fetchBody( const RecMailP &mail ) |
272 | { | 265 | { |
273 | odebug << "NNTP fetchBody" << oendl; | 266 | odebug << "NNTP fetchBody" << oendl; |
274 | return wrapper->fetchBody( mail ); | 267 | return wrapper->fetchBody( mail ); |
275 | } | 268 | } |
276 | 269 | ||
277 | QPopupMenu * NNTPviewItem::getContextMenu() | 270 | QMap<int,QString> NNTPviewItem::serverMenu() |
278 | { | 271 | { |
279 | QPopupMenu *m = new QPopupMenu(0); | 272 | QMap<int,QString> _entries; |
280 | if (m) | 273 | if (!account->getOffline()) |
281 | { | 274 | { |
282 | if (!account->getOffline()) | 275 | _entries[SERVER_MENU_DISCONNECT]=QObject::tr("Disconnect",contextName); |
283 | { | 276 | _entries[SERVER_MENU_OFFLINE]=QObject::tr("Set offline",contextName); |
284 | m->insertItem(QObject::tr("Disconnect",contextName),SERVER_MENU_DISCONNECT); | 277 | _entries[SERVER_MENU_SUBSCRIBE]=QObject::tr("(Un-)Subscribe groups",contextName); |
285 | m->insertItem(QObject::tr("Set offline",contextName),SERVER_MENU_OFFLINE); | 278 | } else { |
286 | m->insertItem(QObject::tr("(Un-)Subscribe groups",contextName),SERVER_MENU_SUBSCRIBE); | 279 | _entries[SERVER_MENU_OFFLINE]=QObject::tr("Set online",contextName); |
287 | } | ||
288 | else | ||
289 | { | ||
290 | m->insertItem(QObject::tr("Set online",contextName),SERVER_MENU_OFFLINE); | ||
291 | } | ||
292 | } | 280 | } |
293 | return m; | 281 | return _entries; |
294 | } | 282 | } |
295 | 283 | ||
296 | void NNTPviewItem::subscribeGroups() | 284 | void NNTPviewItem::subscribeGroups() |
297 | { | 285 | { |
298 | NNTPGroupsDlg dlg(account); | 286 | NNTPGroupsDlg dlg(account); |
299 | if (QPEApplication::execDialog(&dlg)== QDialog::Accepted ){ | 287 | if (QPEApplication::execDialog(&dlg)== QDialog::Accepted ){ |
300 | refresh(); | 288 | refresh(); |
301 | } | 289 | } |
302 | } | 290 | } |
303 | 291 | ||
304 | void NNTPviewItem::disconnect() | 292 | void NNTPviewItem::disconnect() |
305 | { | 293 | { |
306 | QListViewItem *child = firstChild(); | 294 | QListViewItem *child = firstChild(); |
307 | while ( child ) | 295 | while ( child ) |
308 | { | 296 | { |
309 | QListViewItem *tmp = child; | 297 | QListViewItem *tmp = child; |
310 | child = child->nextSibling(); | 298 | child = child->nextSibling(); |
311 | delete tmp; | 299 | delete tmp; |
312 | } | 300 | } |
313 | wrapper->logout(); | 301 | wrapper->logout(); |
314 | } | 302 | } |
315 | 303 | ||
316 | void NNTPviewItem::setOnOffline() | 304 | void NNTPviewItem::setOnOffline() |
317 | { | 305 | { |
318 | if (!account->getOffline()) | 306 | if (!account->getOffline()) |
319 | { | 307 | { |
320 | disconnect(); | 308 | disconnect(); |
321 | } | 309 | } |
322 | account->setOffline(!account->getOffline()); | 310 | account->setOffline(!account->getOffline()); |
323 | account->save(); | 311 | account->save(); |
324 | //FIXME | 312 | //FIXME |
325 | SETPIX(PIXMAP_POP3FOLDER); | 313 | SETPIX(PIXMAP_POP3FOLDER); |
326 | refresh(); | 314 | refresh(); |
327 | } | 315 | } |
328 | 316 | ||
329 | void NNTPviewItem::contextMenuSelected(int which) | 317 | bool NNTPviewItem::contextMenuSelected(int which) |
330 | { | 318 | { |
331 | switch (which) | 319 | switch (which) |
332 | { | 320 | { |
333 | case SERVER_MENU_DISCONNECT: | 321 | case SERVER_MENU_DISCONNECT: |
334 | disconnect(); | 322 | disconnect(); |
335 | break; | 323 | break; |
336 | case SERVER_MENU_OFFLINE: | 324 | case SERVER_MENU_OFFLINE: |
337 | setOnOffline(); | 325 | setOnOffline(); |
338 | break; | 326 | break; |
339 | case SERVER_MENU_SUBSCRIBE: | 327 | case SERVER_MENU_SUBSCRIBE: |
340 | subscribeGroups(); | 328 | subscribeGroups(); |
341 | break; | 329 | break; |
342 | } | 330 | } |
331 | return false; | ||
343 | } | 332 | } |
344 | 333 | ||
345 | NNTPfolderItem::~NNTPfolderItem() | 334 | NNTPfolderItem::~NNTPfolderItem() |
346 | {} | 335 | {} |
347 | 336 | ||
348 | NNTPfolderItem::NNTPfolderItem( const FolderP &folderInit, NNTPviewItem *parent , QListViewItem*after ) | 337 | NNTPfolderItem::NNTPfolderItem( const FolderP &folderInit, NNTPviewItem *parent , QListViewItem*after ) |
349 | : AccountViewItem( folderInit, parent,after ) | 338 | : AccountViewItem( folderInit, parent,after ) |
350 | { | 339 | { |
351 | nntp = parent; | 340 | nntp = parent; |
352 | if (folder->getDisplayName().lower()!="inbox") | 341 | if (folder->getDisplayName().lower()!="inbox") |
353 | { | 342 | { |
354 | setPixmap( 0, PIXMAP_POP3FOLDER ); | 343 | setPixmap( 0, PIXMAP_POP3FOLDER ); |
355 | } | 344 | } |
356 | else | 345 | else |
357 | { | 346 | { |
358 | setPixmap( 0, PIXMAP_INBOXFOLDER); | 347 | setPixmap( 0, PIXMAP_INBOXFOLDER); |
359 | } | 348 | } |
360 | setText( 0, folder->getDisplayName() ); | 349 | setText( 0, folder->getDisplayName() ); |
361 | } | 350 | } |
362 | 351 | ||
363 | void NNTPfolderItem::refresh(QValueList<RecMailP>&target) | 352 | void NNTPfolderItem::refresh(QValueList<RecMailP>&target) |
364 | { | 353 | { |
365 | if (folder->may_select()) | 354 | if (folder->may_select()) |
366 | nntp->getWrapper()->listMessages( folder->getName(),target ); | 355 | nntp->getWrapper()->listMessages( folder->getName(),target ); |
367 | } | 356 | } |
368 | 357 | ||
369 | RECBODYP NNTPfolderItem::fetchBody(const RecMailP&aMail) | 358 | RECBODYP NNTPfolderItem::fetchBody(const RecMailP&aMail) |
370 | { | 359 | { |
371 | return nntp->getWrapper()->fetchBody(aMail); | 360 | return nntp->getWrapper()->fetchBody(aMail); |
372 | } | 361 | } |
373 | 362 | ||
374 | QPopupMenu * NNTPfolderItem::getContextMenu() | 363 | QMap<int,QString> NNTPfolderItem::folderMenu() |
375 | { | 364 | { |
376 | QPopupMenu *m = new QPopupMenu(0); | 365 | QMap<int,QString> _entries; |
377 | if (m) | 366 | _entries[FOLDER_MENU_REFRESH_HEADER]=QObject::tr("Refresh header list",contextName); |
378 | { | 367 | _entries[FOLDER_MENU_MOVE_MAILS]=QObject::tr("Copy all postings",contextName); |
379 | m->insertItem(QObject::tr("Refresh header list",contextName),FOLDER_MENU_REFRESH_HEADER); | 368 | return _entries; |
380 | m->insertItem(QObject::tr("Copy all postings",contextName),FOLDER_MENU_MOVE_MAILS); | ||
381 | } | ||
382 | return m; | ||
383 | } | 369 | } |
384 | 370 | ||
385 | void NNTPfolderItem::downloadMails() | 371 | void NNTPfolderItem::downloadMails() |
386 | { | 372 | { |
387 | AccountView*bl = nntp->accountView(); | 373 | AccountView*bl = nntp->accountView(); |
388 | if (!bl) return; | 374 | if (!bl) return; |
389 | bl->downloadMails(folder,nntp->getWrapper()); | 375 | bl->downloadMails(folder,nntp->getWrapper()); |
390 | } | 376 | } |
391 | 377 | ||
392 | void NNTPfolderItem::contextMenuSelected(int which) | 378 | bool NNTPfolderItem::contextMenuSelected(int which) |
393 | { | 379 | { |
394 | AccountView * view = (AccountView*)listView(); | 380 | AccountView * view = (AccountView*)listView(); |
395 | switch (which) | 381 | switch (which) |
396 | { | 382 | { |
397 | case FOLDER_MENU_REFRESH_HEADER: | 383 | case FOLDER_MENU_REFRESH_HEADER: |
398 | /* must be 'cause nntp lists are cached */ | 384 | /* must be 'cause nntp lists are cached */ |
399 | nntp->getWrapper()->logout(); | 385 | nntp->getWrapper()->logout(); |
400 | view->refreshCurrent(); | 386 | view->refreshCurrent(); |
401 | break; | 387 | break; |
402 | case FOLDER_MENU_MOVE_MAILS: | 388 | case FOLDER_MENU_MOVE_MAILS: |
403 | downloadMails(); | 389 | downloadMails(); |
404 | break; | 390 | break; |
405 | default: | 391 | default: |
406 | break; | 392 | break; |
407 | } | 393 | } |
394 | return false; | ||
408 | } | 395 | } |
409 | 396 | ||
410 | /** | 397 | /** |
411 | * IMAP Account stuff | 398 | * IMAP Account stuff |
412 | */ | 399 | */ |
413 | IMAPviewItem::IMAPviewItem( IMAPaccount *a, AccountView *parent ) | 400 | IMAPviewItem::IMAPviewItem( IMAPaccount *a, AccountView *parent ) |
414 | : AccountViewItem( parent ) | 401 | : AccountViewItem( parent ) |
415 | { | 402 | { |
416 | account = a; | 403 | account = a; |
417 | wrapper = AbstractMail::getWrapper( account ); | 404 | wrapper = AbstractMail::getWrapper( account ); |
418 | SETPIX(PIXMAP_IMAPFOLDER); | 405 | SETPIX(PIXMAP_IMAPFOLDER); |
419 | setText( 0, account->getAccountName() ); | 406 | setText( 0, account->getAccountName() ); |
420 | setOpen( true ); | 407 | setOpen( true ); |
421 | } | 408 | } |
422 | 409 | ||
423 | IMAPviewItem::~IMAPviewItem() | 410 | IMAPviewItem::~IMAPviewItem() |
424 | { | 411 | { |
425 | delete wrapper; | 412 | delete wrapper; |
426 | } | 413 | } |
427 | 414 | ||
428 | AbstractMail *IMAPviewItem::getWrapper() | 415 | AbstractMail *IMAPviewItem::getWrapper() |
429 | { | 416 | { |
430 | return wrapper; | 417 | return wrapper; |
431 | } | 418 | } |
432 | 419 | ||
433 | void IMAPviewItem::refresh(QValueList<RecMailP>&) | 420 | void IMAPviewItem::refresh(QValueList<RecMailP>&) |
434 | { | 421 | { |
435 | refreshFolders(false); | 422 | refreshFolders(false); |
436 | } | 423 | } |
437 | 424 | ||
438 | const QStringList&IMAPviewItem::subFolders() | 425 | const QStringList&IMAPviewItem::subFolders() |
439 | { | 426 | { |
440 | return currentFolders; | 427 | return currentFolders; |
441 | } | 428 | } |
442 | 429 | ||
443 | void IMAPviewItem::refreshFolders(bool force) | 430 | void IMAPviewItem::refreshFolders(bool force) |
444 | { | 431 | { |
445 | if (childCount()>0 && force==false) return; | 432 | if (childCount()>0 && force==false) return; |
446 | if (account->getOffline()) return; | 433 | if (account->getOffline()) return; |
447 | 434 | ||
448 | removeChilds(); | 435 | removeChilds(); |
449 | currentFolders.clear(); | 436 | currentFolders.clear(); |
450 | QValueList<FolderP> * folders = wrapper->listFolders(); | 437 | QValueList<FolderP> * folders = wrapper->listFolders(); |
451 | 438 | ||
452 | QValueList<FolderP>::Iterator it; | 439 | QValueList<FolderP>::Iterator it; |
453 | QListViewItem*item = 0; | 440 | QListViewItem*item = 0; |
454 | QListViewItem*titem = 0; | 441 | QListViewItem*titem = 0; |
455 | QString fname,del,search; | 442 | QString fname,del,search; |
456 | int pos; | 443 | int pos; |
457 | 444 | ||
458 | for ( it = folders->begin(); it!=folders->end(); ++it) | 445 | for ( it = folders->begin(); it!=folders->end(); ++it) |
459 | { | 446 | { |
460 | if ((*it)->getDisplayName().lower()=="inbox") | 447 | if ((*it)->getDisplayName().lower()=="inbox") |
461 | { | 448 | { |
462 | item = new IMAPfolderItem( (*it), this , item ); | 449 | item = new IMAPfolderItem( (*it), this , item ); |
463 | folders->remove(it); | 450 | folders->remove(it); |
464 | odebug << "inbox found" << oendl; | 451 | odebug << "inbox found" << oendl; |
465 | break; | 452 | break; |
466 | } | 453 | } |
467 | } | 454 | } |
468 | for ( it = folders->begin(); it!=folders->end(); ++it) | 455 | for ( it = folders->begin(); it!=folders->end(); ++it) |
469 | { | 456 | { |
470 | fname = (*it)->getDisplayName(); | 457 | fname = (*it)->getDisplayName(); |
471 | currentFolders.append((*it)->getName()); | 458 | currentFolders.append((*it)->getName()); |
472 | pos = fname.findRev((*it)->Separator()); | 459 | pos = fname.findRev((*it)->Separator()); |
473 | if (pos != -1) | 460 | if (pos != -1) |
474 | { | 461 | { |
475 | fname = fname.left(pos); | 462 | fname = fname.left(pos); |
476 | } | 463 | } |
477 | IMAPfolderItem*pitem = (IMAPfolderItem*)findSubItem(fname); | 464 | IMAPfolderItem*pitem = (IMAPfolderItem*)findSubItem(fname); |
478 | if (pitem) | 465 | if (pitem) |
479 | { | 466 | { |
480 | titem = item; | 467 | titem = item; |
481 | item = new IMAPfolderItem( (*it),pitem,pitem->firstChild(),this); | 468 | item = new IMAPfolderItem( (*it),pitem,pitem->firstChild(),this); |
482 | /* setup the short name */ | 469 | /* setup the short name */ |
483 | item->setText(0,(*it)->getDisplayName().right((*it)->getDisplayName().length()-pos-1)); | 470 | item->setText(0,(*it)->getDisplayName().right((*it)->getDisplayName().length()-pos-1)); |
484 | item = titem; | 471 | item = titem; |
485 | } | 472 | } |
486 | else | 473 | else |
487 | { | 474 | { |
488 | item = new IMAPfolderItem( (*it), this , item ); | 475 | item = new IMAPfolderItem( (*it), this , item ); |
489 | } | 476 | } |
490 | } | 477 | } |
491 | delete folders; | 478 | delete folders; |
492 | } | 479 | } |
493 | 480 | ||
494 | QPopupMenu * IMAPviewItem::getContextMenu() | 481 | QMap<int,QString> IMAPviewItem::serverMenu() |
495 | { | 482 | { |
496 | QPopupMenu *m = new QPopupMenu(0); | 483 | QMap<int,QString> e; |
497 | if (m) | 484 | if (!account->getOffline()) { |
498 | { | 485 | e[SERVER_MENU_DISCONNECT]=QObject::tr("Disconnect",contextName); |
499 | if (!account->getOffline()) | 486 | e[SERVER_MENU_OFFLINE]=QObject::tr("Set offline",contextName); |
500 | { | 487 | e[SERVER_MENU_REFRESH_FOLDER]=QObject::tr("Refresh folder list",contextName); |
501 | m->insertItem(QObject::tr("Disconnect",contextName),SERVER_MENU_DISCONNECT); | 488 | e[SERVER_MENU_CREATE_FOLDER]=QObject::tr("Create new folder",contextName); |
502 | m->insertItem(QObject::tr("Set offline",contextName),SERVER_MENU_OFFLINE); | 489 | } else { |
503 | m->insertSeparator(); | 490 | e[SERVER_MENU_OFFLINE]=QObject::tr("Set online",contextName); |
504 | m->insertItem(QObject::tr("Refresh folder list",contextName),SERVER_MENU_REFRESH_FOLDER); | ||
505 | m->insertItem(QObject::tr("Create new folder",contextName),SERVER_MENU_CREATE_FOLDER); | ||
506 | } | ||
507 | else | ||
508 | { | ||
509 | m->insertItem(QObject::tr("Set online",contextName),SERVER_MENU_OFFLINE); | ||
510 | } | ||
511 | } | 491 | } |
512 | return m; | 492 | return e; |
513 | } | 493 | } |
514 | 494 | ||
515 | void IMAPviewItem::createNewFolder() | 495 | void IMAPviewItem::createNewFolder() |
516 | { | 496 | { |
517 | Newmdirdlg ndirdlg; | 497 | Newmdirdlg ndirdlg; |
518 | if ( QPEApplication::execDialog( &ndirdlg )) | 498 | if ( QPEApplication::execDialog( &ndirdlg )) |
519 | { | 499 | { |
520 | QString ndir = ndirdlg.Newdir(); | 500 | QString ndir = ndirdlg.Newdir(); |
521 | bool makesubs = ndirdlg.subpossible(); | 501 | bool makesubs = ndirdlg.subpossible(); |
522 | QString delemiter = "/"; | 502 | QString delemiter = "/"; |
523 | IMAPfolderItem*item = (IMAPfolderItem*)firstChild(); | 503 | IMAPfolderItem*item = (IMAPfolderItem*)firstChild(); |
524 | if (item) | 504 | if (item) |
525 | { | 505 | { |
526 | delemiter = item->Delemiter(); | 506 | delemiter = item->Delemiter(); |
527 | } | 507 | } |
528 | if (wrapper->createMbox(ndir,0,delemiter,makesubs)) | 508 | if (wrapper->createMbox(ndir,0,delemiter,makesubs)) |
529 | { | 509 | { |
530 | refreshFolders(true); | 510 | refreshFolders(true); |
531 | } | 511 | } |
532 | } | 512 | } |
533 | } | 513 | } |
534 | 514 | ||
535 | void IMAPviewItem::contextMenuSelected(int id) | 515 | bool IMAPviewItem::contextMenuSelected(int id) |
536 | { | 516 | { |
537 | odebug << "Id selected: " << id << "" << oendl; | 517 | odebug << "Id selected: " << id << "" << oendl; |
538 | switch (id) | 518 | switch (id) |
539 | { | 519 | { |
540 | case SERVER_MENU_REFRESH_FOLDER: | 520 | case SERVER_MENU_REFRESH_FOLDER: |
541 | refreshFolders(true); | 521 | refreshFolders(true); |
542 | break; | 522 | break; |
543 | case SERVER_MENU_CREATE_FOLDER: | 523 | case SERVER_MENU_CREATE_FOLDER: |
544 | createNewFolder(); | 524 | createNewFolder(); |
545 | break; | 525 | break; |
546 | case SERVER_MENU_DISCONNECT: | 526 | case SERVER_MENU_DISCONNECT: |
547 | removeChilds(); | 527 | removeChilds(); |
548 | wrapper->logout(); | 528 | wrapper->logout(); |
549 | break; | 529 | break; |
550 | case SERVER_MENU_OFFLINE: | 530 | case SERVER_MENU_OFFLINE: |
551 | if (account->getOffline()==false) | 531 | if (account->getOffline()==false) |
552 | { | 532 | { |
553 | removeChilds(); | 533 | removeChilds(); |
554 | wrapper->logout(); | 534 | wrapper->logout(); |
555 | } | 535 | } |
556 | account->setOffline(!account->getOffline()); | 536 | account->setOffline(!account->getOffline()); |
557 | account->save(); | 537 | account->save(); |
558 | SETPIX(PIXMAP_IMAPFOLDER); | 538 | SETPIX(PIXMAP_IMAPFOLDER); |
559 | refreshFolders(false); | 539 | refreshFolders(false); |
560 | break; | 540 | break; |
561 | default: | 541 | default: |
562 | break; | 542 | break; |
563 | } | 543 | } |
544 | return false; | ||
564 | } | 545 | } |
565 | 546 | ||
566 | RECBODYP IMAPviewItem::fetchBody(const RecMailP&) | 547 | RECBODYP IMAPviewItem::fetchBody(const RecMailP&) |
567 | { | 548 | { |
568 | return new RecBody(); | 549 | return new RecBody(); |
569 | } | 550 | } |
570 | 551 | ||
571 | bool IMAPviewItem::offline() | 552 | bool IMAPviewItem::offline() |
572 | { | 553 | { |
573 | return account->getOffline(); | 554 | return account->getOffline(); |
574 | } | 555 | } |
575 | 556 | ||
576 | IMAPfolderItem::IMAPfolderItem( const FolderP& folderInit, IMAPviewItem *parent , QListViewItem*after ) | 557 | IMAPfolderItem::IMAPfolderItem( const FolderP& folderInit, IMAPviewItem *parent , QListViewItem*after ) |
577 | : AccountViewItem( folderInit, parent , after ) | 558 | : AccountViewItem( folderInit, parent , after ) |
578 | { | 559 | { |
579 | imap = parent; | 560 | imap = parent; |
580 | if (folder->getDisplayName().lower()!="inbox") | 561 | if (folder->getDisplayName().lower()!="inbox") |
581 | { | 562 | { |
582 | setPixmap( 0, PIXMAP_IMAPFOLDER ); | 563 | setPixmap( 0, PIXMAP_IMAPFOLDER ); |
583 | } | 564 | } |
584 | else | 565 | else |
585 | { | 566 | { |
586 | setPixmap( 0, PIXMAP_INBOXFOLDER); | 567 | setPixmap( 0, PIXMAP_INBOXFOLDER); |
587 | } | 568 | } |
588 | setText( 0, folder->getDisplayName() ); | 569 | setText( 0, folder->getDisplayName() ); |
589 | } | 570 | } |
590 | 571 | ||
591 | IMAPfolderItem::IMAPfolderItem(const FolderP &folderInit, IMAPfolderItem *parent , QListViewItem*after, IMAPviewItem *master ) | 572 | IMAPfolderItem::IMAPfolderItem(const FolderP &folderInit, IMAPfolderItem *parent , QListViewItem*after, IMAPviewItem *master ) |
592 | : AccountViewItem(folderInit, parent,after ) | 573 | : AccountViewItem(folderInit, parent,after ) |
593 | { | 574 | { |
594 | imap = master; | 575 | imap = master; |
595 | if (folder->getDisplayName().lower()!="inbox") | 576 | if (folder->getDisplayName().lower()!="inbox") |
596 | { | 577 | { |
597 | setPixmap( 0, PIXMAP_IMAPFOLDER ); | 578 | setPixmap( 0, PIXMAP_IMAPFOLDER ); |
598 | } | 579 | } |
599 | else | 580 | else |
600 | { | 581 | { |
601 | setPixmap( 0, PIXMAP_INBOXFOLDER); | 582 | setPixmap( 0, PIXMAP_INBOXFOLDER); |
602 | } | 583 | } |
603 | setText( 0, folder->getDisplayName() ); | 584 | setText( 0, folder->getDisplayName() ); |
604 | } | 585 | } |
605 | 586 | ||
606 | IMAPfolderItem::~IMAPfolderItem() | 587 | IMAPfolderItem::~IMAPfolderItem() |
607 | {} | 588 | {} |
608 | 589 | ||
609 | const QString& IMAPfolderItem::Delemiter()const | 590 | const QString& IMAPfolderItem::Delemiter()const |
610 | { | 591 | { |
611 | return folder->Separator(); | 592 | return folder->Separator(); |
612 | } | 593 | } |
613 | 594 | ||
614 | void IMAPfolderItem::refresh(QValueList<RecMailP>&target) | 595 | void IMAPfolderItem::refresh(QValueList<RecMailP>&target) |
615 | { | 596 | { |
616 | if (folder->may_select()) | 597 | if (folder->may_select()) |
617 | { | 598 | { |
618 | imap->getWrapper()->listMessages( folder->getName(),target ); | 599 | imap->getWrapper()->listMessages( folder->getName(),target ); |
619 | } | 600 | } |
620 | else | 601 | else |
621 | { | 602 | { |
622 | target.clear(); | 603 | target.clear(); |
623 | } | 604 | } |
624 | } | 605 | } |
625 | 606 | ||
626 | RECBODYP IMAPfolderItem::fetchBody(const RecMailP&aMail) | 607 | RECBODYP IMAPfolderItem::fetchBody(const RecMailP&aMail) |
627 | { | 608 | { |
628 | return imap->getWrapper()->fetchBody(aMail); | 609 | return imap->getWrapper()->fetchBody(aMail); |
629 | } | 610 | } |
630 | 611 | ||
631 | QPopupMenu * IMAPfolderItem::getContextMenu() | 612 | QMap<int,QString> IMAPfolderItem::folderMenu() |
632 | { | 613 | { |
633 | QPopupMenu *m = new QPopupMenu(0); | 614 | QMap<int,QString> e; |
634 | if (m) | 615 | if (folder->may_select()) { |
635 | { | 616 | e[FOLDER_MENU_REFRESH_HEADER]=QObject::tr("Refresh header list",contextName); |
636 | if (folder->may_select()) | 617 | e[FOLDER_MENU_MOVE_MAILS]=QObject::tr("Move/Copy all mails",contextName); |
637 | { | 618 | e[FOLDER_MENU_DELETE_ALL_MAILS]=QObject::tr("Delete all mails",contextName); |
638 | m->insertItem(QObject::tr("Refresh header list",contextName),FOLDER_MENU_REFRESH_HEADER); | ||
639 | m->insertItem(QObject::tr("Move/Copy all mails",contextName),FOLDER_MENU_MOVE_MAILS); | ||
640 | m->insertItem(QObject::tr("Delete all mails",contextName),FOLDER_MENU_DELETE_ALL_MAILS); | ||
641 | } | ||
642 | if (folder->no_inferior()==false) | ||
643 | { | ||
644 | m->insertItem(QObject::tr("Create new subfolder",contextName),FOLDER_MENU_NEW_SUBFOLDER); | ||
645 | } | ||
646 | if (folder->getDisplayName().lower()!="inbox") | ||
647 | { | ||
648 | m->insertItem(QObject::tr("Delete folder",contextName),FOLDER_MENU_DELETE_FOLDER); | ||
649 | } | ||
650 | } | 619 | } |
651 | return m; | 620 | if (folder->no_inferior()==false) { |
621 | e[FOLDER_MENU_NEW_SUBFOLDER]=QObject::tr("Create new subfolder",contextName); | ||
622 | } | ||
623 | if (folder->getDisplayName().lower()!="inbox") { | ||
624 | e[FOLDER_MENU_DELETE_FOLDER]=QObject::tr("Delete folder",contextName); | ||
625 | } | ||
626 | return e; | ||
652 | } | 627 | } |
653 | 628 | ||
654 | void IMAPfolderItem::createNewFolder() | 629 | void IMAPfolderItem::createNewFolder() |
655 | { | 630 | { |
656 | Newmdirdlg ndirdlg; | 631 | Newmdirdlg ndirdlg; |
657 | if ( QPEApplication::execDialog( &ndirdlg ) ) | 632 | if ( QPEApplication::execDialog( &ndirdlg ) ) |
658 | { | 633 | { |
659 | QString ndir = ndirdlg.Newdir(); | 634 | QString ndir = ndirdlg.Newdir(); |
660 | bool makesubs = ndirdlg.subpossible(); | 635 | bool makesubs = ndirdlg.subpossible(); |
661 | QString delemiter = Delemiter(); | 636 | QString delemiter = Delemiter(); |
662 | if (imap->wrapper->createMbox(ndir,folder,delemiter,makesubs)) | 637 | if (imap->wrapper->createMbox(ndir,folder,delemiter,makesubs)) |
663 | { | 638 | { |
664 | imap->refreshFolders(true); | 639 | imap->refreshFolders(true); |
665 | } | 640 | } |
666 | } | 641 | } |
667 | } | 642 | } |
668 | 643 | ||
669 | void IMAPfolderItem::deleteFolder() | 644 | bool IMAPfolderItem::deleteFolder() |
670 | { | 645 | { |
671 | int yesno = QMessageBox::warning(0,QObject::tr("Delete folder",contextName), | 646 | int yesno = QMessageBox::warning(0,QObject::tr("Delete folder",contextName), |
672 | QObject::tr("<center>Realy delete folder <br><b>%1</b><br>and all if it content?</center>",contextName).arg(folder->getDisplayName()), | 647 | QObject::tr("<center>Realy delete folder <br><b>%1</b><br>and all if it content?</center>",contextName).arg(folder->getDisplayName()), |
673 | QObject::tr("Yes",contextName), | 648 | QObject::tr("Yes",contextName), |
674 | QObject::tr("No",contextName),QString::null,1,1); | 649 | QObject::tr("No",contextName),QString::null,1,1); |
675 | odebug << "Auswahl: " << yesno << "" << oendl; | 650 | odebug << "Auswahl: " << yesno << "" << oendl; |
676 | if (yesno == 0) | 651 | if (yesno == 0) |
677 | { | 652 | { |
678 | if (imap->getWrapper()->deleteMbox(folder)) | 653 | if (imap->getWrapper()->deleteMbox(folder)) |
679 | { | 654 | { |
680 | QListView*v=listView(); | 655 | QListView*v=listView(); |
681 | IMAPviewItem * box = imap; | 656 | IMAPviewItem * box = imap; |
682 | /* be carefull - after that this object is destroyd so don't use | 657 | /* be carefull - after that this object is destroyd so don't use |
683 | * any member of it after that call!!*/ | 658 | * any member of it after that call!!*/ |
684 | imap->refreshFolders(true); | 659 | imap->refreshFolders(true); |
685 | if (v) | 660 | if (v) |
686 | { | 661 | { |
687 | v->setSelected(box,true); | 662 | v->setSelected(box,true); |
688 | } | 663 | } |
664 | return true; | ||
689 | } | 665 | } |
690 | } | 666 | } |
667 | return false; | ||
691 | } | 668 | } |
692 | 669 | ||
693 | void IMAPfolderItem::downloadMails() | 670 | void IMAPfolderItem::downloadMails() |
694 | { | 671 | { |
695 | AccountView*bl = imap->accountView(); | 672 | AccountView*bl = imap->accountView(); |
696 | if (!bl) return; | 673 | if (!bl) return; |
697 | bl->downloadMails(folder,imap->getWrapper()); | 674 | bl->downloadMails(folder,imap->getWrapper()); |
698 | } | 675 | } |
699 | 676 | ||
700 | void IMAPfolderItem::contextMenuSelected(int id) | 677 | bool IMAPfolderItem::contextMenuSelected(int id) |
701 | { | 678 | { |
702 | odebug << "Selected id: " << id << "" << oendl; | 679 | odebug << "Selected id: " << id << "" << oendl; |
703 | AccountView * view = (AccountView*)listView(); | 680 | AccountView * view = (AccountView*)listView(); |
704 | switch(id) | 681 | switch(id) |
705 | { | 682 | { |
706 | case FOLDER_MENU_REFRESH_HEADER: | 683 | case FOLDER_MENU_REFRESH_HEADER: |
707 | view->refreshCurrent(); | 684 | view->refreshCurrent(); |
708 | break; | 685 | break; |
709 | case FOLDER_MENU_DELETE_ALL_MAILS: | 686 | case FOLDER_MENU_DELETE_ALL_MAILS: |
710 | deleteAllMail(imap->getWrapper(),folder); | 687 | deleteAllMail(imap->getWrapper(),folder); |
711 | break; | 688 | break; |
712 | case FOLDER_MENU_NEW_SUBFOLDER: | 689 | case FOLDER_MENU_NEW_SUBFOLDER: |
713 | if (folder->no_inferior()==false) { | 690 | if (folder->no_inferior()==false) { |
714 | createNewFolder(); | 691 | createNewFolder(); |
715 | } | 692 | } |
716 | break; | 693 | break; |
717 | case FOLDER_MENU_DELETE_FOLDER: | 694 | case FOLDER_MENU_DELETE_FOLDER: |
718 | if (folder->getDisplayName().lower()!="inbox") { | 695 | if (folder->getDisplayName().lower()!="inbox") { |
719 | deleteFolder(); | 696 | return deleteFolder(); |
720 | } | 697 | } |
721 | break; | 698 | break; |
722 | case FOLDER_MENU_MOVE_MAILS: | 699 | case FOLDER_MENU_MOVE_MAILS: |
723 | downloadMails(); | 700 | downloadMails(); |
724 | break; | 701 | break; |
725 | default: | 702 | default: |
726 | break; | 703 | break; |
727 | } | 704 | } |
705 | return false; | ||
728 | } | 706 | } |
729 | 707 | ||
730 | /** | 708 | /** |
731 | * MH Account stuff | 709 | * MH Account stuff |
732 | */ | 710 | */ |
733 | /* MH is a little bit different - the top folder can contains messages other than in IMAP and | 711 | /* MH is a little bit different - the top folder can contains messages other than in IMAP and |
734 | POP3 and MBOX */ | 712 | POP3 and MBOX */ |
735 | MHviewItem::MHviewItem( const QString&aPath, AccountView *parent ) | 713 | MHviewItem::MHviewItem( const QString&aPath, AccountView *parent ) |
736 | : AccountViewItem( parent ) | 714 | : AccountViewItem( parent ) |
737 | { | 715 | { |
738 | m_Path = aPath; | 716 | m_Path = aPath; |
739 | /* be carefull - the space within settext is wanted - thats why the string twice */ | 717 | /* be carefull - the space within settext is wanted - thats why the string twice */ |
740 | wrapper = AbstractMail::getWrapper( m_Path,"Local Folders"); | 718 | wrapper = AbstractMail::getWrapper( m_Path,"Local Folders"); |
741 | setPixmap( 0, PIXMAP_LOCALFOLDER ); | 719 | setPixmap( 0, PIXMAP_LOCALFOLDER ); |
742 | setText( 0, " Local Folders" ); | 720 | setText( 0, " Local Folders" ); |
743 | setOpen( true ); | 721 | setOpen( true ); |
744 | folder = 0; | 722 | folder = 0; |
745 | } | 723 | } |
746 | 724 | ||
747 | MHviewItem::~MHviewItem() | 725 | MHviewItem::~MHviewItem() |
748 | { | 726 | { |
749 | delete wrapper; | 727 | delete wrapper; |
750 | } | 728 | } |
751 | 729 | ||
752 | AbstractMail *MHviewItem::getWrapper() | 730 | AbstractMail *MHviewItem::getWrapper() |
753 | { | 731 | { |
754 | return wrapper; | 732 | return wrapper; |
755 | } | 733 | } |
756 | 734 | ||
757 | void MHviewItem::refresh( QValueList<RecMailP> & target) | 735 | void MHviewItem::refresh( QValueList<RecMailP> & target) |
758 | { | 736 | { |
759 | refresh(false); | 737 | refresh(false); |
760 | getWrapper()->listMessages( "",target ); | 738 | getWrapper()->listMessages( "",target ); |
761 | } | 739 | } |
762 | 740 | ||
763 | void MHviewItem::refresh(bool force) | 741 | void MHviewItem::refresh(bool force) |
764 | { | 742 | { |
765 | if (childCount()>0 && force==false) return; | 743 | if (childCount()>0 && force==false) return; |
766 | odebug << "Refresh mh folders" << oendl; | 744 | odebug << "Refresh mh folders" << oendl; |
767 | removeChilds(); | 745 | removeChilds(); |
768 | currentFolders.clear(); | 746 | currentFolders.clear(); |
769 | QValueList<FolderP> *folders = wrapper->listFolders(); | 747 | QValueList<FolderP> *folders = wrapper->listFolders(); |
770 | QValueList<FolderP>::ConstIterator it; | 748 | QValueList<FolderP>::ConstIterator it; |
771 | MHfolderItem*item = 0; | 749 | MHfolderItem*item = 0; |
772 | MHfolderItem*pmaster = 0; | 750 | MHfolderItem*pmaster = 0; |
773 | QString fname = ""; | 751 | QString fname = ""; |
774 | int pos; | 752 | int pos; |
775 | for ( it = folders->begin(); it!=folders->end(); ++it) | 753 | for ( it = folders->begin(); it!=folders->end(); ++it) |
776 | { | 754 | { |
777 | fname = (*it)->getDisplayName(); | 755 | fname = (*it)->getDisplayName(); |
778 | /* this folder itself */ | 756 | /* this folder itself */ |
779 | if (fname=="/") | 757 | if (fname=="/") |
780 | { | 758 | { |
781 | currentFolders.append(fname); | 759 | currentFolders.append(fname); |
782 | folder = (*it); | 760 | folder = (*it); |
783 | continue; | 761 | continue; |
784 | } | 762 | } |
785 | currentFolders.append(fname); | 763 | currentFolders.append(fname); |
786 | pos = fname.findRev("/"); | 764 | pos = fname.findRev("/"); |
787 | if (pos > 0) | 765 | if (pos > 0) |
788 | { | 766 | { |
789 | fname = fname.left(pos); | 767 | fname = fname.left(pos); |
790 | pmaster = (MHfolderItem*)findSubItem(fname); | 768 | pmaster = (MHfolderItem*)findSubItem(fname); |
791 | } | 769 | } |
792 | else | 770 | else |
793 | { | 771 | { |
794 | pmaster = 0; | 772 | pmaster = 0; |
795 | } | 773 | } |
796 | if (pmaster) | 774 | if (pmaster) |
797 | { | 775 | { |
798 | item = new MHfolderItem( (*it), pmaster, item, this ); | 776 | item = new MHfolderItem( (*it), pmaster, item, this ); |
799 | } | 777 | } |
800 | else | 778 | else |
801 | { | 779 | { |
802 | item = new MHfolderItem( (*it), this , item ); | 780 | item = new MHfolderItem( (*it), this , item ); |
803 | } | 781 | } |
804 | item->setSelectable((*it)->may_select()); | 782 | item->setSelectable((*it)->may_select()); |
805 | } | 783 | } |
806 | delete folders; | 784 | delete folders; |
807 | } | 785 | } |
808 | 786 | ||
809 | RECBODYP MHviewItem::fetchBody( const RecMailP &mail ) | 787 | RECBODYP MHviewItem::fetchBody( const RecMailP &mail ) |
810 | { | 788 | { |
811 | odebug << "MH fetchBody" << oendl; | 789 | odebug << "MH fetchBody" << oendl; |
812 | return wrapper->fetchBody( mail ); | 790 | return wrapper->fetchBody( mail ); |
813 | } | 791 | } |
814 | 792 | ||
815 | QPopupMenu * MHviewItem::getContextMenu() | 793 | QMap<int,QString> MHviewItem::serverMenu() |
816 | { | 794 | { |
817 | QPopupMenu *m = new QPopupMenu(0); | 795 | QMap<int,QString> e; |
818 | if (m) | 796 | e[SERVER_MENU_REFRESH_FOLDER]=QObject::tr("Refresh folder list",contextName); |
819 | { | 797 | return e; |
820 | m->insertItem(QObject::tr("Refresh folder list",contextName),SERVER_MENU_REFRESH_FOLDER); | 798 | } |
821 | m->insertItem(QObject::tr("Create new folder",contextName),FOLDER_MENU_NEW_SUBFOLDER); | 799 | |
822 | m->insertItem(QObject::tr("Delete all mails",contextName),FOLDER_MENU_DELETE_ALL_MAILS); | 800 | QMap<int,QString> MHviewItem::folderMenu() |
823 | m->insertItem(QObject::tr("Move/Copie all mails",contextName),FOLDER_MENU_MOVE_MAILS); | 801 | { |
824 | } | 802 | QMap<int,QString> e; |
825 | return m; | 803 | e[FOLDER_MENU_REFRESH_HEADER]=QObject::tr("Refresh header list",contextName); |
804 | e[FOLDER_MENU_NEW_SUBFOLDER]=QObject::tr("Create new folder",contextName); | ||
805 | e[FOLDER_MENU_DELETE_ALL_MAILS]=QObject::tr("Delete all mails",contextName); | ||
806 | e[FOLDER_MENU_MOVE_MAILS]=QObject::tr("Move/Copie all mails",contextName); | ||
807 | return e; | ||
826 | } | 808 | } |
827 | 809 | ||
828 | void MHviewItem::createFolder() | 810 | void MHviewItem::createFolder() |
829 | { | 811 | { |
830 | Newmdirdlg ndirdlg(0,0,true); | 812 | Newmdirdlg ndirdlg(0,0,true); |
831 | if ( QPEApplication::execDialog( &ndirdlg ) ) | 813 | if ( QPEApplication::execDialog( &ndirdlg ) ) |
832 | { | 814 | { |
833 | QString ndir = ndirdlg.Newdir(); | 815 | QString ndir = ndirdlg.Newdir(); |
834 | if (wrapper->createMbox(ndir)) | 816 | if (wrapper->createMbox(ndir)) |
835 | { | 817 | { |
836 | refresh(true); | 818 | refresh(true); |
837 | } | 819 | } |
838 | } | 820 | } |
839 | } | 821 | } |
840 | 822 | ||
841 | void MHviewItem::downloadMails() | 823 | void MHviewItem::downloadMails() |
842 | { | 824 | { |
843 | AccountView*bl = accountView(); | 825 | AccountView*bl = accountView(); |
844 | if (!bl) return; | 826 | if (!bl) return; |
845 | bl->downloadMails(folder,getWrapper()); | 827 | bl->downloadMails(folder,getWrapper()); |
846 | } | 828 | } |
847 | 829 | ||
848 | QStringList MHviewItem::subFolders() | 830 | QStringList MHviewItem::subFolders() |
849 | { | 831 | { |
850 | return currentFolders; | 832 | return currentFolders; |
851 | } | 833 | } |
852 | 834 | ||
853 | void MHviewItem::contextMenuSelected(int which) | 835 | bool MHviewItem::contextMenuSelected(int which) |
854 | { | 836 | { |
855 | AccountView*view = 0; | 837 | AccountView*view = 0; |
856 | 838 | ||
857 | switch (which) | 839 | switch (which) |
858 | { | 840 | { |
859 | case SERVER_MENU_REFRESH_FOLDER: | 841 | case SERVER_MENU_REFRESH_FOLDER: |
860 | refresh(true); | 842 | refresh(true); |
861 | break; | 843 | break; |
862 | case FOLDER_MENU_NEW_SUBFOLDER: | 844 | case FOLDER_MENU_NEW_SUBFOLDER: |
863 | createFolder(); | 845 | createFolder(); |
864 | break; | 846 | break; |
865 | case FOLDER_MENU_DELETE_ALL_MAILS: | 847 | case FOLDER_MENU_DELETE_ALL_MAILS: |
866 | deleteAllMail(getWrapper(),folder); | 848 | deleteAllMail(getWrapper(),folder); |
867 | break; | 849 | break; |
868 | case FOLDER_MENU_MOVE_MAILS: | 850 | case FOLDER_MENU_MOVE_MAILS: |
869 | downloadMails(); | 851 | downloadMails(); |
870 | break; | 852 | break; |
871 | case FOLDER_MENU_REFRESH_HEADER: | 853 | case FOLDER_MENU_REFRESH_HEADER: |
872 | view = (AccountView*)listView(); | 854 | view = (AccountView*)listView(); |
873 | if (view) view->refreshCurrent(); | 855 | if (view) view->refreshCurrent(); |
874 | break; | 856 | break; |
875 | default: | 857 | default: |
876 | break; | 858 | break; |
877 | } | 859 | } |
860 | return false; | ||
878 | } | 861 | } |
879 | 862 | ||
880 | MHfolderItem::~MHfolderItem() | 863 | MHfolderItem::~MHfolderItem() |
881 | {} | 864 | {} |
882 | 865 | ||
883 | MHfolderItem::MHfolderItem( const FolderP &folderInit, MHviewItem *parent , QListViewItem*after ) | 866 | MHfolderItem::MHfolderItem( const FolderP &folderInit, MHviewItem *parent , QListViewItem*after ) |
884 | : AccountViewItem(folderInit, parent,after ) | 867 | : AccountViewItem(folderInit, parent,after ) |
885 | { | 868 | { |
886 | mbox = parent; | 869 | mbox = parent; |
887 | initName(); | 870 | initName(); |
888 | } | 871 | } |
889 | 872 | ||
890 | MHfolderItem::MHfolderItem(const FolderP& folderInit, MHfolderItem *parent, QListViewItem*after, MHviewItem*master) | 873 | MHfolderItem::MHfolderItem(const FolderP& folderInit, MHfolderItem *parent, QListViewItem*after, MHviewItem*master) |
891 | : AccountViewItem(folderInit, parent,after ) | 874 | : AccountViewItem(folderInit, parent,after ) |
892 | { | 875 | { |
893 | folder = folderInit; | 876 | folder = folderInit; |
894 | mbox = master; | 877 | mbox = master; |
895 | initName(); | 878 | initName(); |
896 | } | 879 | } |
897 | 880 | ||
898 | void MHfolderItem::initName() | 881 | void MHfolderItem::initName() |
899 | { | 882 | { |
900 | QString bName = folder->getDisplayName(); | 883 | QString bName = folder->getDisplayName(); |
901 | if (bName.startsWith("/")&&bName.length()>1) | 884 | if (bName.startsWith("/")&&bName.length()>1) |
902 | { | 885 | { |
903 | bName.replace(0,1,""); | 886 | bName.replace(0,1,""); |
904 | } | 887 | } |
905 | int pos = bName.findRev("/"); | 888 | int pos = bName.findRev("/"); |
906 | if (pos > 0) | 889 | if (pos > 0) |
907 | { | 890 | { |
908 | bName.replace(0,pos+1,""); | 891 | bName.replace(0,pos+1,""); |
909 | } | 892 | } |
910 | if (bName.lower() == "outgoing") | 893 | if (bName.lower() == "outgoing") |
911 | { | 894 | { |
912 | setPixmap( 0, PIXMAP_OUTBOXFOLDER ); | 895 | setPixmap( 0, PIXMAP_OUTBOXFOLDER ); |
913 | } | 896 | } |
914 | else if (bName.lower() == "inbox") | 897 | else if (bName.lower() == "inbox") |
915 | { | 898 | { |
916 | setPixmap( 0, PIXMAP_INBOXFOLDER); | 899 | setPixmap( 0, PIXMAP_INBOXFOLDER); |
917 | } else if (bName.lower() == "drafts") { | 900 | } else if (bName.lower() == "drafts") { |
918 | setPixmap(0, Resource::loadPixmap("edit")); | 901 | setPixmap(0, Resource::loadPixmap("edit")); |
919 | } else { | 902 | } else { |
920 | setPixmap( 0, PIXMAP_MBOXFOLDER ); | 903 | setPixmap( 0, PIXMAP_MBOXFOLDER ); |
921 | } | 904 | } |
922 | setText( 0, bName ); | 905 | setText( 0, bName ); |
923 | } | 906 | } |
924 | 907 | ||
925 | const FolderP&MHfolderItem::getFolder()const | 908 | const FolderP&MHfolderItem::getFolder()const |
926 | { | 909 | { |
927 | return folder; | 910 | return folder; |
928 | } | 911 | } |
929 | 912 | ||
930 | void MHfolderItem::refresh(QValueList<RecMailP>&target) | 913 | void MHfolderItem::refresh(QValueList<RecMailP>&target) |
931 | { | 914 | { |
932 | if (folder->may_select()) | 915 | if (folder->may_select()) |
933 | mbox->getWrapper()->listMessages( folder->getName(),target ); | 916 | mbox->getWrapper()->listMessages( folder->getName(),target ); |
934 | } | 917 | } |
935 | 918 | ||
936 | RECBODYP MHfolderItem::fetchBody(const RecMailP&aMail) | 919 | RECBODYP MHfolderItem::fetchBody(const RecMailP&aMail) |
937 | { | 920 | { |
938 | return mbox->getWrapper()->fetchBody(aMail); | 921 | return mbox->getWrapper()->fetchBody(aMail); |
939 | } | 922 | } |
940 | 923 | ||
941 | void MHfolderItem::deleteFolder() | 924 | bool MHfolderItem::deleteFolder() |
942 | { | 925 | { |
943 | int yesno = QMessageBox::warning(0,QObject::tr("Delete folder",contextName), | 926 | int yesno = QMessageBox::warning(0,QObject::tr("Delete folder",contextName), |
944 | QObject::tr("<center>Realy delete folder <br><b>%1</b><br>and all if it content?</center>",contextName).arg(folder->getDisplayName()), | 927 | QObject::tr("<center>Realy delete folder <br><b>%1</b><br>and all if it content?</center>",contextName).arg(folder->getDisplayName()), |
945 | QObject::tr("Yes",contextName), | 928 | QObject::tr("Yes",contextName), |
946 | QObject::tr("No",contextName),QString::null,1,1); | 929 | QObject::tr("No",contextName),QString::null,1,1); |
947 | odebug << "Auswahl: " << yesno << "" << oendl; | 930 | odebug << "Auswahl: " << yesno << "" << oendl; |
948 | if (yesno == 0) | 931 | if (yesno == 0) |
949 | { | 932 | { |
950 | if (mbox->getWrapper()->deleteMbox(folder)) | 933 | if (mbox->getWrapper()->deleteMbox(folder)) |
951 | { | 934 | { |
952 | QListView*v=listView(); | 935 | QListView*v=listView(); |
953 | MHviewItem * box = mbox; | 936 | MHviewItem * box = mbox; |
954 | /* be carefull - after that this object is destroyd so don't use | 937 | /* be carefull - after that this object is destroyd so don't use |
955 | * any member of it after that call!!*/ | 938 | * any member of it after that call!!*/ |
956 | mbox->refresh(true); | 939 | mbox->refresh(true); |
957 | if (v) | 940 | if (v) |
958 | { | 941 | { |
959 | v->setSelected(box,true); | 942 | v->setSelected(box,true); |
960 | } | 943 | } |
944 | return true; | ||
961 | } | 945 | } |
962 | } | 946 | } |
947 | return false; | ||
963 | } | 948 | } |
964 | 949 | ||
965 | QPopupMenu * MHfolderItem::getContextMenu() | 950 | QMap<int,QString> MHfolderItem::folderMenu() |
966 | { | 951 | { |
967 | QPopupMenu *m = new QPopupMenu(0); | 952 | QMap<int,QString> e; |
968 | if (m) | 953 | e[FOLDER_MENU_NEW_SUBFOLDER]=QObject::tr("Create new subfolder",contextName); |
969 | { | 954 | e[FOLDER_MENU_REFRESH_HEADER]=QObject::tr("Refresh header list",contextName); |
970 | m->insertItem(QObject::tr("Create new subfolder",contextName),FOLDER_MENU_NEW_SUBFOLDER); | 955 | e[FOLDER_MENU_MOVE_MAILS]=QObject::tr("Move/Copie all mails",contextName); |
971 | m->insertItem(QObject::tr("Refresh header list",contextName),FOLDER_MENU_REFRESH_HEADER); | 956 | e[FOLDER_MENU_DELETE_ALL_MAILS]=QObject::tr("Delete all mails",contextName); |
972 | m->insertItem(QObject::tr("Move/Copie all mails",contextName),FOLDER_MENU_MOVE_MAILS); | 957 | e[FOLDER_MENU_DELETE_FOLDER]=QObject::tr("Delete folder",contextName); |
973 | m->insertItem(QObject::tr("Delete all mails",contextName),FOLDER_MENU_DELETE_ALL_MAILS); | 958 | return e; |
974 | m->insertItem(QObject::tr("Delete folder",contextName),FOLDER_MENU_DELETE_FOLDER); | ||
975 | } | ||
976 | return m; | ||
977 | } | 959 | } |
978 | 960 | ||
979 | void MHfolderItem::downloadMails() | 961 | void MHfolderItem::downloadMails() |
980 | { | 962 | { |
981 | AccountView*bl = mbox->accountView(); | 963 | AccountView*bl = mbox->accountView(); |
982 | if (!bl) return; | 964 | if (!bl) return; |
983 | bl->downloadMails(folder,mbox->getWrapper()); | 965 | bl->downloadMails(folder,mbox->getWrapper()); |
984 | } | 966 | } |
985 | 967 | ||
986 | void MHfolderItem::createFolder() | 968 | void MHfolderItem::createFolder() |
987 | { | 969 | { |
988 | Newmdirdlg ndirdlg(0,0,true); | 970 | Newmdirdlg ndirdlg(0,0,true); |
989 | if ( QPEApplication::execDialog( &ndirdlg ) ) | 971 | if ( QPEApplication::execDialog( &ndirdlg ) ) |
990 | { | 972 | { |
991 | QString ndir = ndirdlg.Newdir(); | 973 | QString ndir = ndirdlg.Newdir(); |
992 | if (mbox->getWrapper()->createMbox(ndir,folder)) | 974 | if (mbox->getWrapper()->createMbox(ndir,folder)) |
993 | { | 975 | { |
994 | QListView*v=listView(); | 976 | QListView*v=listView(); |
995 | MHviewItem * box = mbox; | 977 | MHviewItem * box = mbox; |
996 | /* be carefull - after that this object is destroyd so don't use | 978 | /* be carefull - after that this object is destroyd so don't use |
997 | * any member of it after that call!!*/ | 979 | * any member of it after that call!!*/ |
998 | mbox->refresh(true); | 980 | mbox->refresh(true); |
999 | if (v) | 981 | if (v) |
1000 | { | 982 | { |
1001 | v->setSelected(box,true); | 983 | v->setSelected(box,true); |
1002 | } | 984 | } |
1003 | } | 985 | } |
1004 | } | 986 | } |
1005 | } | 987 | } |
1006 | 988 | ||
1007 | void MHfolderItem::contextMenuSelected(int which) | 989 | bool MHfolderItem::contextMenuSelected(int which) |
1008 | { | 990 | { |
1009 | AccountView*view = 0; | 991 | AccountView*view = 0; |
1010 | switch(which) | 992 | switch(which) |
1011 | { | 993 | { |
1012 | case FOLDER_MENU_DELETE_ALL_MAILS: | 994 | case FOLDER_MENU_DELETE_ALL_MAILS: |
1013 | deleteAllMail(mbox->getWrapper(),folder); | 995 | deleteAllMail(mbox->getWrapper(),folder); |
1014 | break; | 996 | break; |
1015 | case FOLDER_MENU_DELETE_FOLDER: | 997 | case FOLDER_MENU_DELETE_FOLDER: |
1016 | deleteFolder(); | 998 | return deleteFolder(); |
1017 | break; | 999 | break; |
1018 | case FOLDER_MENU_MOVE_MAILS: | 1000 | case FOLDER_MENU_MOVE_MAILS: |
1019 | downloadMails(); | 1001 | downloadMails(); |
1020 | break; | 1002 | break; |
1021 | case FOLDER_MENU_NEW_SUBFOLDER: | 1003 | case FOLDER_MENU_NEW_SUBFOLDER: |
1022 | createFolder(); | 1004 | createFolder(); |
1023 | break; | 1005 | break; |
1024 | case FOLDER_MENU_REFRESH_HEADER: | 1006 | case FOLDER_MENU_REFRESH_HEADER: |
1025 | view = (AccountView*)listView(); | 1007 | view = (AccountView*)listView(); |
1026 | if (view) view->refreshCurrent(); | 1008 | if (view) view->refreshCurrent(); |
1027 | break; | 1009 | break; |
1028 | default: | 1010 | default: |
1029 | break; | 1011 | break; |
1030 | } | 1012 | } |
1013 | return false; | ||
1031 | } | 1014 | } |
1032 | 1015 | ||
1033 | bool MHfolderItem::isDraftfolder() | 1016 | bool MHfolderItem::isDraftfolder() |
1034 | { | 1017 | { |
1035 | if (folder && folder->getName()==AbstractMail::defaultLocalfolder()+"/"+AbstractMail::draftFolder()) return true; | 1018 | if (folder && folder->getName()==AbstractMail::defaultLocalfolder()+"/"+AbstractMail::draftFolder()) return true; |
1036 | return false; | 1019 | return false; |
1037 | } | 1020 | } |
1038 | 1021 | ||
1039 | /** | 1022 | /** |
1040 | * Generic stuff | 1023 | * Generic stuff |
1041 | */ | 1024 | */ |
1042 | 1025 | ||
1043 | const QString AccountViewItem::contextName="AccountViewItem"; | 1026 | const QString AccountViewItem::contextName="AccountViewItem"; |
1044 | 1027 | ||
1045 | AccountViewItem::AccountViewItem( AccountView *parent ) | 1028 | AccountViewItem::AccountViewItem( AccountView *parent ) |
1046 | : QListViewItem( parent ) | 1029 | : QListViewItem( parent ) |
1047 | { | 1030 | { |
1048 | init(); | 1031 | init(); |
1049 | m_Backlink = parent; | 1032 | m_Backlink = parent; |
1050 | } | 1033 | } |
1051 | 1034 | ||
1052 | AccountViewItem::AccountViewItem( QListViewItem *parent) | 1035 | AccountViewItem::AccountViewItem( QListViewItem *parent) |
1053 | : QListViewItem( parent),folder(0) | 1036 | : QListViewItem( parent),folder(0) |
1054 | { | 1037 | { |
1055 | init(); | 1038 | init(); |
1056 | } | 1039 | } |
1057 | 1040 | ||
1058 | AccountViewItem::AccountViewItem( QListViewItem *parent , QListViewItem*after ) | 1041 | AccountViewItem::AccountViewItem( QListViewItem *parent , QListViewItem*after ) |
1059 | :QListViewItem( parent,after ),folder(0) | 1042 | :QListViewItem( parent,after ),folder(0) |
1060 | { | 1043 | { |
1061 | init(); | 1044 | init(); |
1062 | } | 1045 | } |
1063 | 1046 | ||
1064 | AccountViewItem::AccountViewItem( const Opie::Core::OSmartPointer<Folder>&folderInit,QListViewItem *parent , QListViewItem*after ) | 1047 | AccountViewItem::AccountViewItem( const Opie::Core::OSmartPointer<Folder>&folderInit,QListViewItem *parent , QListViewItem*after ) |
1065 | :QListViewItem( parent,after ),folder(folderInit) | 1048 | :QListViewItem( parent,after ),folder(folderInit) |
1066 | { | 1049 | { |
1067 | init(); | 1050 | init(); |
1068 | } | 1051 | } |
1069 | 1052 | ||
1070 | void AccountViewItem::init() | 1053 | void AccountViewItem::init() |
1071 | { | 1054 | { |
1072 | m_Backlink = 0; | 1055 | m_Backlink = 0; |
1073 | } | 1056 | } |
1074 | 1057 | ||
1075 | AccountViewItem::~AccountViewItem() | 1058 | AccountViewItem::~AccountViewItem() |
1076 | { | 1059 | { |
1077 | folder = 0; | 1060 | folder = 0; |
1078 | } | 1061 | } |
1079 | 1062 | ||
1080 | AccountView*AccountViewItem::accountView() | 1063 | AccountView*AccountViewItem::accountView() |
1081 | { | 1064 | { |
1082 | return m_Backlink; | 1065 | return m_Backlink; |
1083 | } | 1066 | } |
1084 | 1067 | ||
1085 | void AccountViewItem::deleteAllMail(AbstractMail*wrapper,const FolderP&folder) | 1068 | void AccountViewItem::deleteAllMail(AbstractMail*wrapper,const FolderP&folder) |
1086 | { | 1069 | { |
1087 | if (!wrapper) return; | 1070 | if (!wrapper) return; |
1088 | QString fname=""; | 1071 | QString fname=""; |
1089 | if (folder) fname = folder->getDisplayName(); | 1072 | if (folder) fname = folder->getDisplayName(); |
1090 | int yesno = QMessageBox::warning(0,QObject::tr("Delete all mails",contextName), | 1073 | int yesno = QMessageBox::warning(0,QObject::tr("Delete all mails",contextName), |
1091 | QObject::tr("<center>Realy delete all mails in box <br>%1</center>",contextName). | 1074 | QObject::tr("<center>Realy delete all mails in box <br>%1</center>",contextName). |
1092 | arg(fname), | 1075 | arg(fname), |
1093 | QObject::tr("Yes",contextName), | 1076 | QObject::tr("Yes",contextName), |
1094 | QObject::tr("No",contextName),QString::null,1,1); | 1077 | QObject::tr("No",contextName),QString::null,1,1); |
1095 | odebug << "Auswahl: " << yesno << "" << oendl; | 1078 | odebug << "Auswahl: " << yesno << "" << oendl; |
1096 | if (yesno == 0) | 1079 | if (yesno == 0) |
1097 | { | 1080 | { |
1098 | if (wrapper->deleteAllMail(folder)) | 1081 | if (wrapper->deleteAllMail(folder)) |
1099 | { | 1082 | { |
1100 | AccountView * view = (AccountView*)listView(); | 1083 | AccountView * view = (AccountView*)listView(); |
1101 | if (view) view->refreshCurrent(); | 1084 | if (view) view->refreshCurrent(); |
1102 | } | 1085 | } |
1103 | } | 1086 | } |
1104 | } | 1087 | } |
1105 | 1088 | ||
1106 | void AccountViewItem::removeChilds() | 1089 | void AccountViewItem::removeChilds() |
1107 | { | 1090 | { |
1108 | QListViewItem *child = firstChild(); | 1091 | QListViewItem *child = firstChild(); |
1109 | while ( child ) | 1092 | while ( child ) |
1110 | { | 1093 | { |
1111 | QListViewItem *tmp = child; | 1094 | QListViewItem *tmp = child; |
1112 | child = child->nextSibling(); | 1095 | child = child->nextSibling(); |
1113 | delete tmp; | 1096 | delete tmp; |
1114 | } | 1097 | } |
1115 | } | 1098 | } |
1116 | 1099 | ||
1117 | bool AccountViewItem::matchName(const QString&name)const | 1100 | bool AccountViewItem::matchName(const QString&name)const |
1118 | { | 1101 | { |
1119 | if (!folder) return false; | 1102 | if (!folder) return false; |
1120 | return folder->getDisplayName()==name; | 1103 | return folder->getDisplayName()==name; |
1121 | } | 1104 | } |
1122 | 1105 | ||
1123 | 1106 | ||
1124 | AccountViewItem*AccountViewItem::findSubItem(const QString&path,AccountViewItem*start) | 1107 | AccountViewItem*AccountViewItem::findSubItem(const QString&path,AccountViewItem*start) |
1125 | { | 1108 | { |
1126 | AccountViewItem*pitem,*sitem; | 1109 | AccountViewItem*pitem,*sitem; |
1127 | if (!start) pitem = (AccountViewItem*)firstChild(); | 1110 | if (!start) pitem = (AccountViewItem*)firstChild(); |
1128 | else pitem = (AccountViewItem*)start->firstChild(); | 1111 | else pitem = (AccountViewItem*)start->firstChild(); |
1129 | while (pitem) | 1112 | while (pitem) |
1130 | { | 1113 | { |
1131 | if (pitem->matchName(path)) | 1114 | if (pitem->matchName(path)) |
1132 | { | 1115 | { |
1133 | break; | 1116 | break; |
1134 | } | 1117 | } |
1135 | if (pitem->childCount()>0) | 1118 | if (pitem->childCount()>0) |
1136 | { | 1119 | { |
1137 | sitem = findSubItem(path,pitem); | 1120 | sitem = findSubItem(path,pitem); |
1138 | if (sitem) | 1121 | if (sitem) |
1139 | { | 1122 | { |
1140 | pitem = sitem; | 1123 | pitem = sitem; |
1141 | break; | 1124 | break; |
1142 | } | 1125 | } |
1143 | } | 1126 | } |
1144 | pitem=(AccountViewItem*)pitem->nextSibling(); | 1127 | pitem=(AccountViewItem*)pitem->nextSibling(); |
1145 | } | 1128 | } |
1146 | return pitem; | 1129 | return pitem; |
1147 | } | 1130 | } |
1148 | 1131 | ||
1149 | bool AccountViewItem::isDraftfolder() | 1132 | bool AccountViewItem::isDraftfolder() |
1150 | { | 1133 | { |
1151 | return false; | 1134 | return false; |
1152 | } | 1135 | } |
1136 | |||
1137 | QMap<int,QString> AccountViewItem::serverMenu() | ||
1138 | { | ||
1139 | return QMap<int,QString>(); | ||
1140 | } | ||
1141 | |||
1142 | QMap<int,QString> AccountViewItem::folderMenu() | ||
1143 | { | ||
1144 | return QMap<int,QString>(); | ||
1145 | } | ||
1146 | |||
1147 | QPopupMenu * AccountViewItem::getContextMenu() | ||
1148 | { | ||
1149 | QPopupMenu *m = new QPopupMenu(0); | ||
1150 | if (m) | ||
1151 | { | ||
1152 | QMap<int,QString> entries; | ||
1153 | entries = folderMenu(); | ||
1154 | QMap<int,QString>::Iterator it; | ||
1155 | for (it=entries.begin();it!=entries.end();++it) { | ||
1156 | m->insertItem(it.data(),it.key()); | ||
1157 | } | ||
1158 | entries = serverMenu(); | ||
1159 | for (it=entries.begin();it!=entries.end();++it) { | ||
1160 | m->insertItem(it.data(),it.key()); | ||
1161 | } | ||
1162 | } | ||
1163 | return m; | ||
1164 | } | ||
diff --git a/noncore/net/mail/accountitem.h b/noncore/net/mail/accountitem.h index b2c50a1..6518899 100644 --- a/noncore/net/mail/accountitem.h +++ b/noncore/net/mail/accountitem.h | |||
@@ -1,225 +1,229 @@ | |||
1 | #ifndef __ACCOUNT_ITEM | 1 | #ifndef __ACCOUNT_ITEM |
2 | #define __ACCOUNT_ITEM | 2 | #define __ACCOUNT_ITEM |
3 | 3 | ||
4 | #include <opie2/osmartpointer.h> | ||
5 | |||
4 | #include <qlistview.h> | 6 | #include <qlistview.h> |
5 | #include <qlist.h> | 7 | #include <qlist.h> |
6 | #include <opie2/osmartpointer.h> | 8 | #include <qmap.h> |
7 | 9 | ||
8 | class POP3wrapper; | 10 | class POP3wrapper; |
9 | class RecMail; | 11 | class RecMail; |
10 | class RecBody; | 12 | class RecBody; |
11 | class QPopupMenu; | 13 | class QPopupMenu; |
12 | class Selectstore; | 14 | class Selectstore; |
13 | class AccountView; | 15 | class AccountView; |
14 | class POP3account; | 16 | class POP3account; |
15 | class NNTPaccount; | 17 | class NNTPaccount; |
16 | class IMAPaccount; | 18 | class IMAPaccount; |
17 | class AbstractMail; | 19 | class AbstractMail; |
18 | class Folder; | 20 | class Folder; |
19 | 21 | ||
20 | #define RECBODYP Opie::Core::OSmartPointer<RecBody> | 22 | #define RECBODYP Opie::Core::OSmartPointer<RecBody> |
21 | 23 | ||
22 | class AccountViewItem : public QListViewItem | 24 | class AccountViewItem : public QListViewItem |
23 | { | 25 | { |
24 | 26 | ||
25 | public: | 27 | public: |
26 | AccountViewItem( AccountView *parent ); | 28 | AccountViewItem( AccountView *parent ); |
27 | AccountViewItem( QListViewItem *parent); | 29 | AccountViewItem( QListViewItem *parent); |
28 | AccountViewItem( QListViewItem *parent , QListViewItem*after ); | 30 | AccountViewItem( QListViewItem *parent , QListViewItem*after ); |
29 | AccountViewItem( const Opie::Core::OSmartPointer<Folder>&folderInit,QListViewItem *parent , QListViewItem*after ); | 31 | AccountViewItem( const Opie::Core::OSmartPointer<Folder>&folderInit,QListViewItem *parent , QListViewItem*after ); |
30 | 32 | ||
31 | virtual ~AccountViewItem(); | 33 | virtual ~AccountViewItem(); |
32 | virtual void refresh(QValueList<Opie::Core::OSmartPointer<RecMail> >&)=0; | 34 | virtual void refresh(QValueList<Opie::Core::OSmartPointer<RecMail> >&)=0; |
33 | virtual RECBODYP fetchBody(const Opie::Core::OSmartPointer<RecMail>&)=0; | 35 | virtual RECBODYP fetchBody(const Opie::Core::OSmartPointer<RecMail>&)=0; |
34 | virtual QPopupMenu * getContextMenu(){return 0;}; | 36 | virtual QPopupMenu * getContextMenu(); |
35 | virtual void contextMenuSelected(int){} | 37 | virtual bool contextMenuSelected(int){return false;} |
36 | virtual AccountView*accountView(); | 38 | virtual AccountView*accountView(); |
37 | virtual bool matchName(const QString&name)const; | 39 | virtual bool matchName(const QString&name)const; |
38 | virtual bool isDraftfolder(); | 40 | virtual bool isDraftfolder(); |
39 | /* 1 - server | 41 | /* 1 - server |
40 | * 2 - folder | 42 | * 2 - folder |
41 | * 3 - beides | 43 | * 3 - both |
42 | */ | 44 | */ |
43 | virtual int isServer()const=0; | 45 | virtual int isServer()const=0; |
46 | virtual QMap<int,QString> serverMenu(); | ||
47 | virtual QMap<int,QString> folderMenu(); | ||
44 | 48 | ||
45 | protected: | 49 | protected: |
46 | AccountViewItem*findSubItem(const QString&path,AccountViewItem*start=0); | 50 | AccountViewItem*findSubItem(const QString&path,AccountViewItem*start=0); |
47 | virtual void init(); | 51 | virtual void init(); |
48 | virtual void removeChilds(); | 52 | virtual void removeChilds(); |
49 | virtual void deleteAllMail(AbstractMail*wrapper,const Opie::Core::OSmartPointer<Folder>&f); | 53 | virtual void deleteAllMail(AbstractMail*wrapper,const Opie::Core::OSmartPointer<Folder>&f); |
50 | static const QString contextName; | 54 | static const QString contextName; |
51 | AccountView*m_Backlink; | 55 | AccountView*m_Backlink; |
52 | Opie::Core::OSmartPointer<Folder> folder; | 56 | Opie::Core::OSmartPointer<Folder> folder; |
53 | }; | 57 | }; |
54 | 58 | ||
55 | class POP3viewItem : public AccountViewItem | 59 | class POP3viewItem : public AccountViewItem |
56 | { | 60 | { |
57 | 61 | ||
58 | public: | 62 | public: |
59 | POP3viewItem( POP3account *a, AccountView *parent ); | 63 | POP3viewItem( POP3account *a, AccountView *parent ); |
60 | virtual ~POP3viewItem(); | 64 | virtual ~POP3viewItem(); |
61 | virtual void refresh(QValueList<Opie::Core::OSmartPointer<RecMail> >&target ); | 65 | virtual void refresh(QValueList<Opie::Core::OSmartPointer<RecMail> >&target ); |
62 | virtual RECBODYP fetchBody( const Opie::Core::OSmartPointer<RecMail> &mail ); | 66 | virtual RECBODYP fetchBody( const Opie::Core::OSmartPointer<RecMail> &mail ); |
63 | AbstractMail *getWrapper(); | 67 | AbstractMail *getWrapper(); |
64 | virtual QPopupMenu * getContextMenu(); | 68 | virtual bool contextMenuSelected(int); |
65 | virtual void contextMenuSelected(int); | ||
66 | virtual int isServer()const{return 1;} | 69 | virtual int isServer()const{return 1;} |
70 | virtual QMap<int,QString> serverMenu(); | ||
67 | 71 | ||
68 | protected: | 72 | protected: |
69 | POP3account *account; | 73 | POP3account *account; |
70 | virtual void refresh(); | 74 | virtual void refresh(); |
71 | AbstractMail *wrapper; | 75 | AbstractMail *wrapper; |
72 | void disconnect(); | 76 | void disconnect(); |
73 | void setOnOffline(); | 77 | void setOnOffline(); |
74 | }; | 78 | }; |
75 | 79 | ||
76 | class POP3folderItem : public AccountViewItem | 80 | class POP3folderItem : public AccountViewItem |
77 | { | 81 | { |
78 | 82 | ||
79 | public: | 83 | public: |
80 | POP3folderItem( const Opie::Core::OSmartPointer<Folder>&folder, POP3viewItem *parent , QListViewItem*after ); | 84 | POP3folderItem( const Opie::Core::OSmartPointer<Folder>&folder, POP3viewItem *parent , QListViewItem*after ); |
81 | virtual ~POP3folderItem(); | 85 | virtual ~POP3folderItem(); |
82 | virtual void refresh(QValueList<Opie::Core::OSmartPointer<RecMail> >&); | 86 | virtual void refresh(QValueList<Opie::Core::OSmartPointer<RecMail> >&); |
83 | virtual RECBODYP fetchBody(const Opie::Core::OSmartPointer<RecMail>&); | 87 | virtual RECBODYP fetchBody(const Opie::Core::OSmartPointer<RecMail>&); |
84 | virtual QPopupMenu * getContextMenu(); | 88 | virtual bool contextMenuSelected(int); |
85 | virtual void contextMenuSelected(int); | ||
86 | virtual int isServer()const{return 2;} | 89 | virtual int isServer()const{return 2;} |
90 | virtual QMap<int,QString> folderMenu(); | ||
87 | 91 | ||
88 | protected: | 92 | protected: |
89 | void downloadMails(); | 93 | void downloadMails(); |
90 | POP3viewItem *pop3; | 94 | POP3viewItem *pop3; |
91 | }; | 95 | }; |
92 | 96 | ||
93 | 97 | ||
94 | class NNTPviewItem : public AccountViewItem | 98 | class NNTPviewItem : public AccountViewItem |
95 | { | 99 | { |
96 | 100 | ||
97 | public: | 101 | public: |
98 | NNTPviewItem( NNTPaccount *a, AccountView *parent ); | 102 | NNTPviewItem( NNTPaccount *a, AccountView *parent ); |
99 | virtual ~NNTPviewItem(); | 103 | virtual ~NNTPviewItem(); |
100 | virtual void refresh(QValueList<Opie::Core::OSmartPointer<RecMail> >&target ); | 104 | virtual void refresh(QValueList<Opie::Core::OSmartPointer<RecMail> >&target ); |
101 | virtual RECBODYP fetchBody( const Opie::Core::OSmartPointer<RecMail> &mail ); | 105 | virtual RECBODYP fetchBody( const Opie::Core::OSmartPointer<RecMail> &mail ); |
102 | AbstractMail *getWrapper(); | 106 | AbstractMail *getWrapper(); |
103 | virtual QPopupMenu * getContextMenu(); | 107 | virtual bool contextMenuSelected(int); |
104 | virtual void contextMenuSelected(int); | ||
105 | virtual int isServer()const{return 1;} | 108 | virtual int isServer()const{return 1;} |
109 | virtual QMap<int,QString> serverMenu(); | ||
106 | 110 | ||
107 | protected: | 111 | protected: |
108 | NNTPaccount *account; | 112 | NNTPaccount *account; |
109 | virtual void refresh(); | 113 | virtual void refresh(); |
110 | AbstractMail *wrapper; | 114 | AbstractMail *wrapper; |
111 | void disconnect(); | 115 | void disconnect(); |
112 | void setOnOffline(); | 116 | void setOnOffline(); |
113 | void subscribeGroups(); | 117 | void subscribeGroups(); |
114 | }; | 118 | }; |
115 | 119 | ||
116 | class NNTPfolderItem : public AccountViewItem | 120 | class NNTPfolderItem : public AccountViewItem |
117 | { | 121 | { |
118 | 122 | ||
119 | public: | 123 | public: |
120 | NNTPfolderItem(const Opie::Core::OSmartPointer<Folder>&folder, NNTPviewItem *parent , QListViewItem*after ); | 124 | NNTPfolderItem(const Opie::Core::OSmartPointer<Folder>&folder, NNTPviewItem *parent , QListViewItem*after ); |
121 | virtual ~NNTPfolderItem(); | 125 | virtual ~NNTPfolderItem(); |
122 | virtual void refresh(QValueList<Opie::Core::OSmartPointer<RecMail> >&); | 126 | virtual void refresh(QValueList<Opie::Core::OSmartPointer<RecMail> >&); |
123 | virtual RECBODYP fetchBody(const Opie::Core::OSmartPointer<RecMail>&); | 127 | virtual RECBODYP fetchBody(const Opie::Core::OSmartPointer<RecMail>&); |
124 | virtual QPopupMenu * getContextMenu(); | 128 | virtual bool contextMenuSelected(int); |
125 | virtual void contextMenuSelected(int); | ||
126 | virtual int isServer()const{return 2;} | 129 | virtual int isServer()const{return 2;} |
127 | 130 | virtual QMap<int,QString> folderMenu(); | |
128 | protected: | 131 | protected: |
129 | void downloadMails(); | 132 | void downloadMails(); |
130 | NNTPviewItem *nntp; | 133 | NNTPviewItem *nntp; |
131 | }; | 134 | }; |
132 | 135 | ||
133 | 136 | ||
134 | 137 | ||
135 | class IMAPviewItem : public AccountViewItem | 138 | class IMAPviewItem : public AccountViewItem |
136 | { | 139 | { |
137 | friend class IMAPfolderItem; | 140 | friend class IMAPfolderItem; |
138 | public: | 141 | public: |
139 | IMAPviewItem( IMAPaccount *a, AccountView *parent ); | 142 | IMAPviewItem( IMAPaccount *a, AccountView *parent ); |
140 | virtual ~IMAPviewItem(); | 143 | virtual ~IMAPviewItem(); |
141 | virtual void refresh(QValueList<Opie::Core::OSmartPointer<RecMail> >&); | 144 | virtual void refresh(QValueList<Opie::Core::OSmartPointer<RecMail> >&); |
142 | virtual RECBODYP fetchBody(const Opie::Core::OSmartPointer<RecMail>&); | 145 | virtual RECBODYP fetchBody(const Opie::Core::OSmartPointer<RecMail>&); |
143 | AbstractMail *getWrapper(); | 146 | AbstractMail *getWrapper(); |
144 | virtual QPopupMenu * getContextMenu(); | 147 | virtual bool contextMenuSelected(int); |
145 | virtual void contextMenuSelected(int); | ||
146 | const QStringList&subFolders(); | 148 | const QStringList&subFolders(); |
147 | virtual void refreshFolders(bool force=false); | 149 | virtual void refreshFolders(bool force=false); |
148 | virtual int isServer()const{return 1;} | 150 | virtual int isServer()const{return 1;} |
149 | bool offline(); | 151 | bool offline(); |
152 | virtual QMap<int,QString> serverMenu(); | ||
150 | 153 | ||
151 | protected: | 154 | protected: |
152 | virtual void createNewFolder(); | 155 | virtual void createNewFolder(); |
153 | IMAPaccount *account; | 156 | IMAPaccount *account; |
154 | AbstractMail *wrapper; | 157 | AbstractMail *wrapper; |
155 | QStringList currentFolders; | 158 | QStringList currentFolders; |
156 | }; | 159 | }; |
157 | 160 | ||
158 | class IMAPfolderItem : public AccountViewItem | 161 | class IMAPfolderItem : public AccountViewItem |
159 | { | 162 | { |
160 | 163 | ||
161 | public: | 164 | public: |
162 | IMAPfolderItem( const Opie::Core::OSmartPointer<Folder>&folder, IMAPviewItem *parent , QListViewItem*after ); | 165 | IMAPfolderItem( const Opie::Core::OSmartPointer<Folder>&folder, IMAPviewItem *parent , QListViewItem*after ); |
163 | IMAPfolderItem( const Opie::Core::OSmartPointer<Folder>&folder, IMAPfolderItem *parent , QListViewItem*after, IMAPviewItem *master ); | 166 | IMAPfolderItem( const Opie::Core::OSmartPointer<Folder>&folder, IMAPfolderItem *parent , QListViewItem*after, IMAPviewItem *master ); |
164 | virtual ~IMAPfolderItem(); | 167 | virtual ~IMAPfolderItem(); |
165 | virtual void refresh(QValueList<Opie::Core::OSmartPointer<RecMail> >&); | 168 | virtual void refresh(QValueList<Opie::Core::OSmartPointer<RecMail> >&); |
166 | virtual RECBODYP fetchBody(const Opie::Core::OSmartPointer<RecMail>&); | 169 | virtual RECBODYP fetchBody(const Opie::Core::OSmartPointer<RecMail>&); |
167 | virtual QPopupMenu * getContextMenu(); | 170 | virtual bool contextMenuSelected(int); |
168 | virtual void contextMenuSelected(int); | ||
169 | virtual const QString& Delemiter()const; | 171 | virtual const QString& Delemiter()const; |
170 | virtual int isServer()const{return 2;} | 172 | virtual int isServer()const{return 2;} |
173 | virtual QMap<int,QString> folderMenu(); | ||
171 | protected: | 174 | protected: |
172 | virtual void createNewFolder(); | 175 | virtual void createNewFolder(); |
173 | virtual void deleteFolder(); | 176 | virtual bool deleteFolder(); |
174 | virtual void downloadMails(); | 177 | virtual void downloadMails(); |
175 | IMAPviewItem *imap; | 178 | IMAPviewItem *imap; |
176 | }; | 179 | }; |
177 | 180 | ||
178 | class MHviewItem : public AccountViewItem | 181 | class MHviewItem : public AccountViewItem |
179 | { | 182 | { |
180 | friend class MHfolderItem; | 183 | friend class MHfolderItem; |
181 | 184 | ||
182 | public: | 185 | public: |
183 | MHviewItem( const QString&aMboxPath, AccountView *parent ); | 186 | MHviewItem( const QString&aMboxPath, AccountView *parent ); |
184 | virtual ~MHviewItem(); | 187 | virtual ~MHviewItem(); |
185 | virtual void refresh(QValueList<Opie::Core::OSmartPointer<RecMail> >&target ); | 188 | virtual void refresh(QValueList<Opie::Core::OSmartPointer<RecMail> >&target ); |
186 | virtual RECBODYP fetchBody( const Opie::Core::OSmartPointer<RecMail> &mail ); | 189 | virtual RECBODYP fetchBody( const Opie::Core::OSmartPointer<RecMail> &mail ); |
187 | AbstractMail *getWrapper(); | 190 | AbstractMail *getWrapper(); |
188 | virtual QPopupMenu * getContextMenu(); | 191 | virtual bool contextMenuSelected(int); |
189 | virtual void contextMenuSelected(int); | ||
190 | QStringList subFolders(); | 192 | QStringList subFolders(); |
191 | virtual void refresh(bool force=false); | 193 | virtual void refresh(bool force=false); |
192 | virtual int isServer()const{return 3;} | 194 | virtual int isServer()const{return 3;} |
195 | virtual QMap<int,QString> serverMenu(); | ||
196 | virtual QMap<int,QString> folderMenu(); | ||
193 | 197 | ||
194 | protected: | 198 | protected: |
195 | void downloadMails(); | 199 | void downloadMails(); |
196 | virtual void createFolder(); | 200 | virtual void createFolder(); |
197 | QString m_Path; | 201 | QString m_Path; |
198 | AbstractMail *wrapper; | 202 | AbstractMail *wrapper; |
199 | QStringList currentFolders; | 203 | QStringList currentFolders; |
200 | }; | 204 | }; |
201 | 205 | ||
202 | class MHfolderItem : public AccountViewItem | 206 | class MHfolderItem : public AccountViewItem |
203 | { | 207 | { |
204 | 208 | ||
205 | public: | 209 | public: |
206 | MHfolderItem( const Opie::Core::OSmartPointer<Folder>&folder, MHviewItem *parent , QListViewItem*after ); | 210 | MHfolderItem( const Opie::Core::OSmartPointer<Folder>&folder, MHviewItem *parent , QListViewItem*after ); |
207 | MHfolderItem( const Opie::Core::OSmartPointer<Folder>&folder, MHfolderItem *parent, QListViewItem*after, MHviewItem*master); | 211 | MHfolderItem( const Opie::Core::OSmartPointer<Folder>&folder, MHfolderItem *parent, QListViewItem*after, MHviewItem*master); |
208 | virtual ~MHfolderItem(); | 212 | virtual ~MHfolderItem(); |
209 | virtual void refresh(QValueList<Opie::Core::OSmartPointer<RecMail> >&); | 213 | virtual void refresh(QValueList<Opie::Core::OSmartPointer<RecMail> >&); |
210 | virtual RECBODYP fetchBody(const Opie::Core::OSmartPointer<RecMail>&); | 214 | virtual RECBODYP fetchBody(const Opie::Core::OSmartPointer<RecMail>&); |
211 | virtual QPopupMenu * getContextMenu(); | 215 | virtual bool contextMenuSelected(int); |
212 | virtual void contextMenuSelected(int); | ||
213 | virtual const Opie::Core::OSmartPointer<Folder>&getFolder()const; | 216 | virtual const Opie::Core::OSmartPointer<Folder>&getFolder()const; |
214 | virtual bool isDraftfolder(); | 217 | virtual bool isDraftfolder(); |
215 | virtual int isServer()const{return 2;} | 218 | virtual int isServer()const{return 2;} |
219 | virtual QMap<int,QString> folderMenu(); | ||
216 | 220 | ||
217 | protected: | 221 | protected: |
218 | void downloadMails(); | 222 | void downloadMails(); |
219 | virtual void createFolder(); | 223 | virtual void createFolder(); |
220 | virtual void deleteFolder(); | 224 | virtual bool deleteFolder(); |
221 | void initName(); | 225 | void initName(); |
222 | MHviewItem *mbox; | 226 | MHviewItem *mbox; |
223 | }; | 227 | }; |
224 | 228 | ||
225 | #endif | 229 | #endif |
diff --git a/noncore/net/mail/accountview.cpp b/noncore/net/mail/accountview.cpp index faa42c3..1183704 100644 --- a/noncore/net/mail/accountview.cpp +++ b/noncore/net/mail/accountview.cpp | |||
@@ -1,213 +1,232 @@ | |||
1 | 1 | ||
2 | #include "accountview.h" | 2 | #include "accountview.h" |
3 | #include "accountitem.h" | 3 | #include "accountitem.h" |
4 | #include "selectstore.h" | 4 | #include "selectstore.h" |
5 | 5 | ||
6 | #include <libmailwrapper/settings.h> | 6 | #include <libmailwrapper/settings.h> |
7 | #include <libmailwrapper/mailwrapper.h> | 7 | #include <libmailwrapper/mailwrapper.h> |
8 | #include <libmailwrapper/mailtypes.h> | 8 | #include <libmailwrapper/mailtypes.h> |
9 | #include <libmailwrapper/abstractmail.h> | 9 | #include <libmailwrapper/abstractmail.h> |
10 | 10 | ||
11 | /* OPIE */ | 11 | /* OPIE */ |
12 | #include <opie2/odebug.h> | 12 | #include <opie2/odebug.h> |
13 | #include <qpe/qpeapplication.h> | 13 | #include <qpe/qpeapplication.h> |
14 | 14 | ||
15 | /* QT */ | 15 | /* QT */ |
16 | #include <qmessagebox.h> | 16 | #include <qmessagebox.h> |
17 | #include <qpopupmenu.h> | 17 | #include <qpopupmenu.h> |
18 | 18 | ||
19 | using namespace Opie::Core; | 19 | using namespace Opie::Core; |
20 | AccountView::AccountView( QWidget *parent, const char *name, WFlags flags ) | 20 | AccountView::AccountView( QWidget *parent, const char *name, WFlags flags ) |
21 | : QListView( parent, name, flags ) | 21 | : QListView( parent, name, flags ) |
22 | { | 22 | { |
23 | setSorting(0); | 23 | setSorting(0); |
24 | setSelectionMode(Single); | 24 | setSelectionMode(Single); |
25 | m_rightPressed = false; | 25 | m_rightPressed = false; |
26 | 26 | ||
27 | connect( this, SIGNAL( selectionChanged(QListViewItem*) ), | 27 | connect( this, SIGNAL( selectionChanged(QListViewItem*) ), |
28 | SLOT( slotSelectionChanged(QListViewItem*) ) ); | 28 | SLOT( slotSelectionChanged(QListViewItem*) ) ); |
29 | connect( this, SIGNAL( mouseButtonPressed(int,QListViewItem*,const QPoint&,int) ),this, | 29 | connect( this, SIGNAL( mouseButtonPressed(int,QListViewItem*,const QPoint&,int) ),this, |
30 | SLOT( slotMouseButton(int,QListViewItem*,const QPoint&,int) ) ); | 30 | SLOT( slotMouseButton(int,QListViewItem*,const QPoint&,int) ) ); |
31 | connect( this, SIGNAL(clicked(QListViewItem*) ),this, | 31 | connect( this, SIGNAL(clicked(QListViewItem*) ),this, |
32 | SLOT( slotMouseClicked(QListViewItem*) ) ); | 32 | SLOT( slotMouseClicked(QListViewItem*) ) ); |
33 | m_currentItem = 0; | 33 | m_currentItem = 0; |
34 | } | 34 | } |
35 | 35 | ||
36 | AccountView::~AccountView() | 36 | AccountView::~AccountView() |
37 | { | 37 | { |
38 | imapAccounts.clear(); | 38 | imapAccounts.clear(); |
39 | mhAccounts.clear(); | 39 | mhAccounts.clear(); |
40 | } | 40 | } |
41 | 41 | ||
42 | void AccountView::slotSelectionChanged(QListViewItem*item) | 42 | void AccountView::slotSelectionChanged(QListViewItem*item) |
43 | { | 43 | { |
44 | odebug << "AccountView: Selection changed" << oendl; | ||
45 | if (!item) { | 44 | if (!item) { |
46 | emit serverSelected(0); | 45 | emit serverSelected(0); |
47 | return; | 46 | return; |
48 | } | 47 | } |
49 | AccountViewItem *view = static_cast<AccountViewItem *>(item); | 48 | AccountViewItem *view = static_cast<AccountViewItem *>(item); |
50 | |||
51 | emit serverSelected(view->isServer()); | 49 | emit serverSelected(view->isServer()); |
52 | } | 50 | } |
53 | 51 | ||
52 | QMap<int,QString> AccountView::currentServerMenu()const | ||
53 | { | ||
54 | QMap<int,QString> smap; | ||
55 | AccountViewItem *view = static_cast<AccountViewItem *>(currentItem()); | ||
56 | if (!view)return smap; | ||
57 | smap = view->serverMenu(); | ||
58 | return smap; | ||
59 | } | ||
60 | |||
61 | QMap<int,QString> AccountView::currentFolderMenu()const | ||
62 | { | ||
63 | QMap<int,QString> fmap; | ||
64 | AccountViewItem *view = static_cast<AccountViewItem *>(currentItem()); | ||
65 | if (!view)return fmap; | ||
66 | fmap = view->folderMenu(); | ||
67 | return fmap; | ||
68 | } | ||
69 | |||
54 | void AccountView::slotContextMenu(int id) | 70 | void AccountView::slotContextMenu(int id) |
55 | { | 71 | { |
56 | AccountViewItem *view = static_cast<AccountViewItem *>(currentItem()); | 72 | AccountViewItem *view = static_cast<AccountViewItem *>(currentItem()); |
57 | if (!view) return; | 73 | if (!view) return; |
58 | view->contextMenuSelected(id); | 74 | bool del = view->contextMenuSelected(id); |
75 | if (!del && view->isServer()!=2) { | ||
76 | emit refreshMenues(view->isServer()); | ||
77 | } | ||
59 | } | 78 | } |
60 | 79 | ||
61 | void AccountView::slotRightButton(int button, QListViewItem * item,const QPoint&,int) | 80 | void AccountView::slotRightButton(int, QListViewItem * item,const QPoint&,int) |
62 | { | 81 | { |
63 | m_rightPressed = true; | 82 | m_rightPressed = true; |
64 | if (!item) return; | 83 | if (!item) return; |
65 | AccountViewItem *view = static_cast<AccountViewItem *>(item); | 84 | AccountViewItem *view = static_cast<AccountViewItem *>(item); |
66 | QPopupMenu*m = view->getContextMenu(); | 85 | QPopupMenu*m = view->getContextMenu(); |
67 | if (!m) return; | 86 | if (!m) return; |
68 | connect(m,SIGNAL(activated(int)),this,SLOT(slotContextMenu(int))); | 87 | connect(m,SIGNAL(activated(int)),this,SLOT(slotContextMenu(int))); |
69 | m->setFocus(); | 88 | m->setFocus(); |
70 | m->exec( QPoint( QCursor::pos().x(), QCursor::pos().y()) ); | 89 | m->exec( QPoint( QCursor::pos().x(), QCursor::pos().y()) ); |
71 | delete m; | 90 | delete m; |
72 | } | 91 | } |
73 | 92 | ||
74 | void AccountView::slotLeftButton(int button, QListViewItem * item,const QPoint&,int) | 93 | void AccountView::slotLeftButton(int, QListViewItem *,const QPoint&,int) |
75 | { | 94 | { |
76 | m_rightPressed = false; | 95 | m_rightPressed = false; |
77 | } | 96 | } |
78 | 97 | ||
79 | void AccountView::slotMouseClicked(QListViewItem*item) | 98 | void AccountView::slotMouseClicked(QListViewItem*item) |
80 | { | 99 | { |
81 | if (m_rightPressed) return; | 100 | if (m_rightPressed) return; |
82 | if (!item || m_currentItem == item) return; | 101 | if (!item || m_currentItem == item) return; |
83 | /* ### ToDo check settings if on single tab it should open */ | 102 | /* ### ToDo check settings if on single tab it should open */ |
84 | m_currentItem = item; | 103 | m_currentItem = item; |
85 | refresh(m_currentItem); | 104 | refresh(m_currentItem); |
86 | } | 105 | } |
87 | 106 | ||
88 | void AccountView::slotMouseButton(int button, QListViewItem * item,const QPoint&pos,int column) | 107 | void AccountView::slotMouseButton(int button, QListViewItem * item,const QPoint&pos,int column) |
89 | { | 108 | { |
90 | if (button==1) { | 109 | if (button==1) { |
91 | slotLeftButton(button,item,pos,column); | 110 | slotLeftButton(button,item,pos,column); |
92 | } else if (button==2) { | 111 | } else if (button==2) { |
93 | slotRightButton(button,item,pos,column); | 112 | slotRightButton(button,item,pos,column); |
94 | } | 113 | } |
95 | } | 114 | } |
96 | 115 | ||
97 | void AccountView::populate( QList<Account> list ) | 116 | void AccountView::populate( QList<Account> list ) |
98 | { | 117 | { |
99 | clear(); | 118 | clear(); |
100 | 119 | ||
101 | imapAccounts.clear(); | 120 | imapAccounts.clear(); |
102 | mhAccounts.clear(); | 121 | mhAccounts.clear(); |
103 | mhAccounts.append(new MHviewItem(AbstractMail::defaultLocalfolder(),this)); | 122 | mhAccounts.append(new MHviewItem(AbstractMail::defaultLocalfolder(),this)); |
104 | 123 | ||
105 | Account *it; | 124 | Account *it; |
106 | for ( it = list.first(); it; it = list.next() ) { | 125 | for ( it = list.first(); it; it = list.next() ) { |
107 | if ( it->getType() == MAILLIB::A_IMAP ) { | 126 | if ( it->getType() == MAILLIB::A_IMAP ) { |
108 | IMAPaccount *imap = static_cast<IMAPaccount *>(it); | 127 | IMAPaccount *imap = static_cast<IMAPaccount *>(it); |
109 | odebug << "added IMAP " + imap->getAccountName() << oendl; | 128 | odebug << "added IMAP " + imap->getAccountName() << oendl; |
110 | imapAccounts.append(new IMAPviewItem( imap, this )); | 129 | imapAccounts.append(new IMAPviewItem( imap, this )); |
111 | } else if ( it->getType() == MAILLIB::A_POP3 ) { | 130 | } else if ( it->getType() == MAILLIB::A_POP3 ) { |
112 | POP3account *pop3 = static_cast<POP3account *>(it); | 131 | POP3account *pop3 = static_cast<POP3account *>(it); |
113 | odebug << "added POP3 " + pop3->getAccountName() << oendl; | 132 | odebug << "added POP3 " + pop3->getAccountName() << oendl; |
114 | /* must not be hold 'cause it isn't required */ | 133 | /* must not be hold 'cause it isn't required */ |
115 | (void) new POP3viewItem( pop3, this ); | 134 | (void) new POP3viewItem( pop3, this ); |
116 | } else if ( it->getType() == MAILLIB::A_NNTP ) { | 135 | } else if ( it->getType() == MAILLIB::A_NNTP ) { |
117 | NNTPaccount *nntp = static_cast<NNTPaccount *>(it); | 136 | NNTPaccount *nntp = static_cast<NNTPaccount *>(it); |
118 | odebug << "added NNTP " + nntp->getAccountName() << oendl; | 137 | odebug << "added NNTP " + nntp->getAccountName() << oendl; |
119 | /* must not be hold 'cause it isn't required */ | 138 | /* must not be hold 'cause it isn't required */ |
120 | (void) new NNTPviewItem( nntp, this ); | 139 | (void) new NNTPviewItem( nntp, this ); |
121 | } else if ( it->getType() == MAILLIB::A_MH ) { | 140 | } else if ( it->getType() == MAILLIB::A_MH ) { |
122 | } | 141 | } |
123 | } | 142 | } |
124 | } | 143 | } |
125 | 144 | ||
126 | void AccountView::refresh(QListViewItem *item) | 145 | void AccountView::refresh(QListViewItem *item) |
127 | { | 146 | { |
128 | 147 | ||
129 | odebug << "AccountView refresh..." << oendl; | 148 | odebug << "AccountView refresh..." << oendl; |
130 | if ( item ) | 149 | if ( item ) |
131 | { | 150 | { |
132 | m_currentItem = item; | 151 | m_currentItem = item; |
133 | QValueList<RecMailP> headerlist; | 152 | QValueList<RecMailP> headerlist; |
134 | AccountViewItem *view = static_cast<AccountViewItem *>(item); | 153 | AccountViewItem *view = static_cast<AccountViewItem *>(item); |
135 | view->refresh(headerlist); | 154 | view->refresh(headerlist); |
136 | emit refreshMailview(headerlist); | 155 | emit refreshMailview(headerlist); |
137 | } | 156 | } |
138 | } | 157 | } |
139 | 158 | ||
140 | void AccountView::refreshCurrent() | 159 | void AccountView::refreshCurrent() |
141 | { | 160 | { |
142 | m_currentItem = currentItem(); | 161 | m_currentItem = currentItem(); |
143 | if ( !m_currentItem ) return; | 162 | if ( !m_currentItem ) return; |
144 | QValueList<RecMailP> headerlist; | 163 | QValueList<RecMailP> headerlist; |
145 | AccountViewItem *view = static_cast<AccountViewItem *>(m_currentItem); | 164 | AccountViewItem *view = static_cast<AccountViewItem *>(m_currentItem); |
146 | view->refresh(headerlist); | 165 | view->refresh(headerlist); |
147 | emit refreshMailview(headerlist); | 166 | emit refreshMailview(headerlist); |
148 | } | 167 | } |
149 | 168 | ||
150 | void AccountView::refreshAll() | 169 | void AccountView::refreshAll() |
151 | { | 170 | { |
152 | } | 171 | } |
153 | 172 | ||
154 | RecBodyP AccountView::fetchBody(const RecMailP&aMail) | 173 | RecBodyP AccountView::fetchBody(const RecMailP&aMail) |
155 | { | 174 | { |
156 | QListViewItem*item = selectedItem (); | 175 | QListViewItem*item = selectedItem (); |
157 | if (!item) return new RecBody(); | 176 | if (!item) return new RecBody(); |
158 | AccountViewItem *view = static_cast<AccountViewItem *>(item); | 177 | AccountViewItem *view = static_cast<AccountViewItem *>(item); |
159 | return view->fetchBody(aMail); | 178 | return view->fetchBody(aMail); |
160 | } | 179 | } |
161 | 180 | ||
162 | void AccountView::setupFolderselect(Selectstore*sels) | 181 | void AccountView::setupFolderselect(Selectstore*sels) |
163 | { | 182 | { |
164 | QPEApplication::showDialog( sels ); | 183 | QPEApplication::showDialog( sels ); |
165 | QStringList sFolders; | 184 | QStringList sFolders; |
166 | unsigned int i = 0; | 185 | unsigned int i = 0; |
167 | for (i=0; i < mhAccounts.count();++i) | 186 | for (i=0; i < mhAccounts.count();++i) |
168 | { | 187 | { |
169 | mhAccounts[i]->refresh(false); | 188 | mhAccounts[i]->refresh(false); |
170 | sFolders = mhAccounts[i]->subFolders(); | 189 | sFolders = mhAccounts[i]->subFolders(); |
171 | sels->addAccounts(mhAccounts[i]->getWrapper(),sFolders); | 190 | sels->addAccounts(mhAccounts[i]->getWrapper(),sFolders); |
172 | } | 191 | } |
173 | for (i=0; i < imapAccounts.count();++i) | 192 | for (i=0; i < imapAccounts.count();++i) |
174 | { | 193 | { |
175 | if (imapAccounts[i]->offline()) | 194 | if (imapAccounts[i]->offline()) |
176 | continue; | 195 | continue; |
177 | imapAccounts[i]->refreshFolders(false); | 196 | imapAccounts[i]->refreshFolders(false); |
178 | sels->addAccounts(imapAccounts[i]->getWrapper(),imapAccounts[i]->subFolders()); | 197 | sels->addAccounts(imapAccounts[i]->getWrapper(),imapAccounts[i]->subFolders()); |
179 | } | 198 | } |
180 | } | 199 | } |
181 | 200 | ||
182 | void AccountView::downloadMails(const FolderP&fromFolder,AbstractMail*fromWrapper) | 201 | void AccountView::downloadMails(const FolderP&fromFolder,AbstractMail*fromWrapper) |
183 | { | 202 | { |
184 | AbstractMail*targetMail = 0; | 203 | AbstractMail*targetMail = 0; |
185 | QString targetFolder = ""; | 204 | QString targetFolder = ""; |
186 | Selectstore sels; | 205 | Selectstore sels; |
187 | setupFolderselect(&sels); | 206 | setupFolderselect(&sels); |
188 | if (!sels.exec()) return; | 207 | if (!sels.exec()) return; |
189 | targetMail = sels.currentMail(); | 208 | targetMail = sels.currentMail(); |
190 | targetFolder = sels.currentFolder(); | 209 | targetFolder = sels.currentFolder(); |
191 | if ( (fromWrapper==targetMail && fromFolder->getName()==targetFolder) || | 210 | if ( (fromWrapper==targetMail && fromFolder->getName()==targetFolder) || |
192 | targetFolder.isEmpty()) | 211 | targetFolder.isEmpty()) |
193 | { | 212 | { |
194 | return; | 213 | return; |
195 | } | 214 | } |
196 | if (sels.newFolder() && !targetMail->createMbox(targetFolder)) | 215 | if (sels.newFolder() && !targetMail->createMbox(targetFolder)) |
197 | { | 216 | { |
198 | QMessageBox::critical(0,tr("Error creating new Folder"), | 217 | QMessageBox::critical(0,tr("Error creating new Folder"), |
199 | tr("<center>Error while creating<br>new folder - breaking.</center>")); | 218 | tr("<center>Error while creating<br>new folder - breaking.</center>")); |
200 | return; | 219 | return; |
201 | } | 220 | } |
202 | odebug << "Targetfolder: " << targetFolder.latin1() << "" << oendl; | 221 | odebug << "Targetfolder: " << targetFolder.latin1() << "" << oendl; |
203 | odebug << "Fromfolder: " << fromFolder->getName().latin1() << "" << oendl; | 222 | odebug << "Fromfolder: " << fromFolder->getName().latin1() << "" << oendl; |
204 | fromWrapper->mvcpAllMails(fromFolder,targetFolder,targetMail,sels.moveMails()); | 223 | fromWrapper->mvcpAllMails(fromFolder,targetFolder,targetMail,sels.moveMails()); |
205 | refreshCurrent(); | 224 | refreshCurrent(); |
206 | } | 225 | } |
207 | 226 | ||
208 | bool AccountView::currentisDraft() | 227 | bool AccountView::currentisDraft() |
209 | { | 228 | { |
210 | AccountViewItem *view = static_cast<AccountViewItem *>(currentItem()); | 229 | AccountViewItem *view = static_cast<AccountViewItem *>(currentItem()); |
211 | if (!view) return false; | 230 | if (!view) return false; |
212 | return view->isDraftfolder(); | 231 | return view->isDraftfolder(); |
213 | } | 232 | } |
diff --git a/noncore/net/mail/accountview.h b/noncore/net/mail/accountview.h index ae24dce..5c4b559 100644 --- a/noncore/net/mail/accountview.h +++ b/noncore/net/mail/accountview.h | |||
@@ -1,54 +1,58 @@ | |||
1 | #ifndef ACCOUNTVIEW_H | 1 | #ifndef ACCOUNTVIEW_H |
2 | #define ACCOUNTVIEW_H | 2 | #define ACCOUNTVIEW_H |
3 | 3 | ||
4 | #include <libmailwrapper/mailtypes.h> | ||
5 | #include <opie2/osmartpointer.h> | ||
4 | #include <qlistview.h> | 6 | #include <qlistview.h> |
5 | #include <qlist.h> | 7 | #include <qlist.h> |
6 | #include <opie2/osmartpointer.h> | 8 | #include <qmap.h> |
7 | #include <libmailwrapper/mailtypes.h> | ||
8 | 9 | ||
9 | class Selectstore; | 10 | class Selectstore; |
10 | class Folder; | 11 | class Folder; |
11 | class AbstractMail; | 12 | class AbstractMail; |
12 | class Account; | 13 | class Account; |
13 | class IMAPviewItem; | 14 | class IMAPviewItem; |
14 | class MHviewItem; | 15 | class MHviewItem; |
15 | 16 | ||
16 | class AccountView : public QListView | 17 | class AccountView : public QListView |
17 | { | 18 | { |
18 | Q_OBJECT | 19 | Q_OBJECT |
19 | 20 | ||
20 | public: | 21 | public: |
21 | AccountView( QWidget *parent = 0, const char *name = 0, WFlags flags = 0 ); | 22 | AccountView( QWidget *parent = 0, const char *name = 0, WFlags flags = 0 ); |
22 | virtual ~AccountView(); | 23 | virtual ~AccountView(); |
23 | virtual void populate( QList<Account> list ); | 24 | virtual void populate( QList<Account> list ); |
24 | virtual RecBodyP fetchBody(const Opie::Core::OSmartPointer<RecMail>&aMail); | 25 | virtual RecBodyP fetchBody(const Opie::Core::OSmartPointer<RecMail>&aMail); |
25 | virtual void downloadMails(const Opie::Core::OSmartPointer<Folder>&fromFolder,AbstractMail*fromWrapper); | 26 | virtual void downloadMails(const Opie::Core::OSmartPointer<Folder>&fromFolder,AbstractMail*fromWrapper); |
26 | virtual bool currentisDraft(); | 27 | virtual bool currentisDraft(); |
28 | QMap<int,QString> currentServerMenu()const; | ||
29 | QMap<int,QString> currentFolderMenu()const; | ||
27 | 30 | ||
28 | public slots: | 31 | public slots: |
29 | virtual void refreshAll(); | 32 | virtual void refreshAll(); |
30 | virtual void refresh(QListViewItem *item); | 33 | virtual void refresh(QListViewItem *item); |
31 | virtual void refreshCurrent(); | 34 | virtual void refreshCurrent(); |
32 | virtual void slotContextMenu(int id); | 35 | virtual void slotContextMenu(int id); |
33 | 36 | ||
34 | void setupFolderselect(Selectstore*sels); | 37 | void setupFolderselect(Selectstore*sels); |
35 | 38 | ||
36 | signals: | 39 | signals: |
37 | void refreshMailview(const QValueList<RecMailP>& ); | 40 | void refreshMailview(const QValueList<RecMailP>& ); |
38 | void serverSelected(int); | 41 | void serverSelected(int); |
42 | void refreshMenues(int); | ||
39 | 43 | ||
40 | protected: | 44 | protected: |
41 | QListViewItem* m_currentItem; | 45 | QListViewItem* m_currentItem; |
42 | QValueList<IMAPviewItem*> imapAccounts; | 46 | QValueList<IMAPviewItem*> imapAccounts; |
43 | QValueList<MHviewItem*> mhAccounts; | 47 | QValueList<MHviewItem*> mhAccounts; |
44 | bool m_rightPressed:1; | 48 | bool m_rightPressed:1; |
45 | 49 | ||
46 | protected slots: | 50 | protected slots: |
47 | virtual void slotRightButton(int, QListViewItem *,const QPoint&,int); | 51 | virtual void slotRightButton(int, QListViewItem *,const QPoint&,int); |
48 | virtual void slotLeftButton(int, QListViewItem *,const QPoint&,int); | 52 | virtual void slotLeftButton(int, QListViewItem *,const QPoint&,int); |
49 | virtual void slotMouseButton(int, QListViewItem *,const QPoint&,int); | 53 | virtual void slotMouseButton(int, QListViewItem *,const QPoint&,int); |
50 | virtual void slotMouseClicked(QListViewItem*); | 54 | virtual void slotMouseClicked(QListViewItem*); |
51 | virtual void slotSelectionChanged(QListViewItem*); | 55 | virtual void slotSelectionChanged(QListViewItem*); |
52 | }; | 56 | }; |
53 | 57 | ||
54 | #endif | 58 | #endif |
diff --git a/noncore/net/mail/mainwindow.cpp b/noncore/net/mail/mainwindow.cpp index 81c8fee..3689352 100644 --- a/noncore/net/mail/mainwindow.cpp +++ b/noncore/net/mail/mainwindow.cpp | |||
@@ -1,270 +1,273 @@ | |||
1 | #include <qlabel.h> | 1 | #include <qlabel.h> |
2 | #include <qvbox.h> | 2 | #include <qvbox.h> |
3 | #include <qheader.h> | 3 | #include <qheader.h> |
4 | #include <qtimer.h> | 4 | #include <qtimer.h> |
5 | #include <qlayout.h> | 5 | #include <qlayout.h> |
6 | 6 | ||
7 | #include <opie2/odebug.h> | 7 | #include <opie2/odebug.h> |
8 | #include <qpe/qpeapplication.h> | 8 | #include <qpe/qpeapplication.h> |
9 | #include <qpe/qcopenvelope_qws.h> | 9 | #include <qpe/qcopenvelope_qws.h> |
10 | 10 | ||
11 | #include "defines.h" | 11 | #include "defines.h" |
12 | #include "mainwindow.h" | 12 | #include "mainwindow.h" |
13 | 13 | ||
14 | using namespace Opie::Core; | 14 | using namespace Opie::Core; |
15 | 15 | ||
16 | MainWindow::MainWindow( QWidget *parent, const char *name, WFlags flags ) | 16 | MainWindow::MainWindow( QWidget *parent, const char *name, WFlags flags ) |
17 | : QMainWindow( parent, name, flags ) | 17 | : QMainWindow( parent, name, flags ) |
18 | { | 18 | { |
19 | 19 | ||
20 | setCaption( tr( "Mail" ) ); | 20 | setCaption( tr( "Mail" ) ); |
21 | setToolBarsMovable( false ); | 21 | setToolBarsMovable( false ); |
22 | 22 | ||
23 | toolBar = new QToolBar( this ); | 23 | toolBar = new QToolBar( this ); |
24 | |||
25 | menuBar = new QMenuBar( toolBar ); | 24 | menuBar = new QMenuBar( toolBar ); |
26 | 25 | ||
27 | mailMenu = new QPopupMenu( menuBar ); | 26 | mailMenu = new QPopupMenu( menuBar ); |
28 | menuBar->insertItem( tr( "Mail" ), mailMenu ); | 27 | menuBar->insertItem( tr( "Mail" ), mailMenu ); |
29 | 28 | ||
30 | settingsMenu = new QPopupMenu( menuBar ); | 29 | settingsMenu = new QPopupMenu( menuBar ); |
31 | menuBar->insertItem( tr( "Settings" ), settingsMenu ); | 30 | menuBar->insertItem( tr( "Settings" ), settingsMenu ); |
32 | 31 | ||
33 | serverMenu = new QPopupMenu( menuBar ); | 32 | if (QApplication::desktop()->width()<330) { |
34 | m_ServerMenuId = menuBar->insertItem( tr( "Server" ), serverMenu ); | 33 | serverMenu = new QPopupMenu( mailMenu ); |
34 | folderMenu = new QPopupMenu( mailMenu ); | ||
35 | m_ServerMenuId = mailMenu->insertItem( tr( "Server" ), serverMenu ); | ||
36 | m_FolderMenuId = mailMenu->insertItem( tr( "Folder" ), folderMenu ); | ||
37 | } else { | ||
38 | serverMenu = new QPopupMenu( menuBar ); | ||
39 | folderMenu = new QPopupMenu( menuBar ); | ||
40 | m_FolderMenuId = menuBar->insertItem( tr( "Folder" ), folderMenu ); | ||
41 | m_ServerMenuId = menuBar->insertItem( tr( "Server" ), serverMenu ); | ||
42 | } | ||
35 | serverMenu->insertItem(tr("Disconnect"),SERVER_MENU_DISCONNECT); | 43 | serverMenu->insertItem(tr("Disconnect"),SERVER_MENU_DISCONNECT); |
36 | serverMenu->insertItem(tr("Set on/offline"),SERVER_MENU_OFFLINE); | 44 | serverMenu->insertItem(tr("Set on/offline"),SERVER_MENU_OFFLINE); |
37 | serverMenu->insertSeparator(); | 45 | serverMenu->insertSeparator(); |
38 | serverMenu->insertItem(tr("Refresh folder list"),SERVER_MENU_REFRESH_FOLDER); | 46 | serverMenu->insertItem(tr("Refresh folder list"),SERVER_MENU_REFRESH_FOLDER); |
39 | serverMenu->insertItem(tr("Create new folder"),SERVER_MENU_CREATE_FOLDER); | 47 | serverMenu->insertItem(tr("Create new folder"),SERVER_MENU_CREATE_FOLDER); |
40 | serverMenu->insertSeparator(); | 48 | serverMenu->insertSeparator(); |
41 | serverMenu->insertItem(tr("(Un-)Subscribe groups"),SERVER_MENU_SUBSCRIBE); | 49 | serverMenu->insertItem(tr("(Un-)Subscribe groups"),SERVER_MENU_SUBSCRIBE); |
42 | 50 | ||
43 | folderMenu = new QPopupMenu( menuBar ); | ||
44 | m_FolderMenuId = menuBar->insertItem( tr( "Folder" ), folderMenu ); | ||
45 | folderMenu->insertItem(tr("Refresh headerlist"),FOLDER_MENU_REFRESH_HEADER); | 51 | folderMenu->insertItem(tr("Refresh headerlist"),FOLDER_MENU_REFRESH_HEADER); |
46 | folderMenu->insertItem(tr("Delete all mails"),FOLDER_MENU_DELETE_ALL_MAILS); | 52 | folderMenu->insertItem(tr("Delete all mails"),FOLDER_MENU_DELETE_ALL_MAILS); |
47 | folderMenu->insertItem(tr("New subfolder"),FOLDER_MENU_NEW_SUBFOLDER); | 53 | folderMenu->insertItem(tr("New subfolder"),FOLDER_MENU_NEW_SUBFOLDER); |
48 | folderMenu->insertItem(tr("Delete folder"),FOLDER_MENU_DELETE_FOLDER); | 54 | folderMenu->insertItem(tr("Delete folder"),FOLDER_MENU_DELETE_FOLDER); |
49 | folderMenu->insertItem(tr("Move/Copie all mails"),FOLDER_MENU_MOVE_MAILS); | 55 | folderMenu->insertItem(tr("Move/Copie all mails"),FOLDER_MENU_MOVE_MAILS); |
50 | |||
51 | menuBar->setItemEnabled(m_ServerMenuId,false); | 56 | menuBar->setItemEnabled(m_ServerMenuId,false); |
52 | menuBar->setItemEnabled(m_FolderMenuId,false); | 57 | menuBar->setItemEnabled(m_FolderMenuId,false); |
53 | 58 | ||
54 | addToolBar( toolBar ); | 59 | addToolBar( toolBar ); |
55 | toolBar->setHorizontalStretchable( true ); | 60 | toolBar->setHorizontalStretchable( true ); |
56 | 61 | ||
57 | QLabel *spacer = new QLabel( toolBar ); | 62 | QLabel *spacer = new QLabel( toolBar ); |
58 | spacer->setBackgroundMode( QWidget::PaletteButton ); | 63 | spacer->setBackgroundMode( QWidget::PaletteButton ); |
59 | toolBar->setStretchableWidget( spacer ); | 64 | toolBar->setStretchableWidget( spacer ); |
60 | 65 | ||
61 | composeMail = new QAction( tr( "Compose new mail" ), ICON_COMPOSEMAIL, | 66 | composeMail = new QAction( tr( "Compose new mail" ), ICON_COMPOSEMAIL, |
62 | 0, 0, this ); | 67 | 0, 0, this ); |
63 | composeMail->addTo( toolBar ); | 68 | composeMail->addTo( toolBar ); |
64 | composeMail->addTo( mailMenu ); | 69 | composeMail->addTo( mailMenu ); |
65 | 70 | ||
66 | sendQueued = new QAction( tr( "Send queued mails" ), ICON_SENDQUEUED, | 71 | sendQueued = new QAction( tr( "Send queued mails" ), ICON_SENDQUEUED, |
67 | 0, 0, this ); | 72 | 0, 0, this ); |
68 | sendQueued->addTo( toolBar ); | 73 | sendQueued->addTo( toolBar ); |
69 | sendQueued->addTo( mailMenu ); | 74 | sendQueued->addTo( mailMenu ); |
70 | 75 | ||
71 | /* | 76 | /* |
72 | syncFolders = new QAction( tr( "Sync mailfolders" ), ICON_SYNC, | 77 | syncFolders = new QAction( tr( "Sync mailfolders" ), ICON_SYNC, |
73 | 0, 0, this ); | 78 | 0, 0, this ); |
74 | syncFolders->addTo( toolBar ); | 79 | syncFolders->addTo( toolBar ); |
75 | syncFolders->addTo( mailMenu ); | 80 | syncFolders->addTo( mailMenu ); |
76 | */ | 81 | */ |
77 | 82 | ||
78 | showFolders = new QAction( tr( "Show/Hide folders" ), ICON_SHOWFOLDERS, | 83 | showFolders = new QAction( tr( "Show/Hide folders" ), ICON_SHOWFOLDERS, |
79 | 0, 0, this, 0, true ); | 84 | 0, 0, this, 0, true ); |
80 | showFolders->addTo( toolBar ); | 85 | showFolders->addTo( toolBar ); |
81 | showFolders->addTo( mailMenu ); | 86 | showFolders->addTo( mailMenu ); |
82 | showFolders->setOn( true ); | 87 | showFolders->setOn( true ); |
83 | connect(showFolders, SIGNAL( toggled(bool) ), | 88 | connect(showFolders, SIGNAL( toggled(bool) ), |
84 | SLOT( slotShowFolders(bool) ) ); | 89 | SLOT( slotShowFolders(bool) ) ); |
85 | 90 | ||
86 | /* | 91 | /* |
87 | searchMails = new QAction( tr( "Search mails" ), QIconSet( Resource::loadPixmap("find") ), | 92 | searchMails = new QAction( tr( "Search mails" ), QIconSet( Resource::loadPixmap("find") ), |
88 | 0, 0, this ); | 93 | 0, 0, this ); |
89 | searchMails->addTo( toolBar ); | 94 | searchMails->addTo( toolBar ); |
90 | searchMails->addTo( mailMenu ); | 95 | searchMails->addTo( mailMenu ); |
91 | */ | 96 | */ |
92 | 97 | ||
93 | deleteMails = new QAction(tr("Delete Mail"), QIconSet( Resource::loadPixmap("trash")), 0, 0, this); | 98 | deleteMails = new QAction(tr("Delete Mail"), QIconSet( Resource::loadPixmap("trash")), 0, 0, this); |
94 | deleteMails->addTo( toolBar ); | 99 | deleteMails->addTo( toolBar ); |
95 | deleteMails->addTo( mailMenu ); | 100 | deleteMails->addTo( mailMenu ); |
96 | connect( deleteMails, SIGNAL( activated() ), | 101 | connect( deleteMails, SIGNAL( activated() ), |
97 | SLOT( slotDeleteMail() ) ); | 102 | SLOT( slotDeleteMail() ) ); |
98 | 103 | ||
99 | editSettings = new QAction( tr( "Edit settings" ), QIconSet( Resource::loadPixmap("SettingsIcon") ) , | 104 | editSettings = new QAction( tr( "Edit settings" ), QIconSet( Resource::loadPixmap("SettingsIcon") ) , |
100 | 0, 0, this ); | 105 | 0, 0, this ); |
101 | editSettings->addTo( settingsMenu ); | 106 | editSettings->addTo( settingsMenu ); |
102 | connect( editSettings, SIGNAL( activated() ), | 107 | connect( editSettings, SIGNAL( activated() ), |
103 | SLOT( slotEditSettings() ) ); | 108 | SLOT( slotEditSettings() ) ); |
104 | editAccounts = new QAction( tr( "Configure accounts" ), QIconSet( Resource::loadPixmap("mail/editaccounts") ) , | 109 | editAccounts = new QAction( tr( "Configure accounts" ), QIconSet( Resource::loadPixmap("mail/editaccounts") ) , |
105 | 0, 0, this ); | 110 | 0, 0, this ); |
106 | editAccounts->addTo( settingsMenu ); | 111 | editAccounts->addTo( settingsMenu ); |
107 | 112 | ||
108 | 113 | ||
109 | QWidget *view = new QWidget( this ); | 114 | QWidget *view = new QWidget( this ); |
110 | setCentralWidget( view ); | 115 | setCentralWidget( view ); |
111 | layout = new QBoxLayout ( view, QBoxLayout::LeftToRight ); | 116 | layout = new QBoxLayout ( view, QBoxLayout::LeftToRight ); |
112 | 117 | ||
113 | folderView = new AccountView( view ); | 118 | folderView = new AccountView( view ); |
114 | folderView->header()->hide(); | 119 | folderView->header()->hide(); |
115 | folderView->setRootIsDecorated( true ); | 120 | folderView->setRootIsDecorated( true ); |
116 | folderView->addColumn( tr( "Mailbox" ) ); | 121 | folderView->addColumn( tr( "Mailbox" ) ); |
117 | connect(folderView,SIGNAL(serverSelected(int)),this,SLOT(serverSelected(int))); | 122 | connect(folderView,SIGNAL(serverSelected(int)),this,SLOT(serverSelected(int))); |
118 | connect(serverMenu,SIGNAL(activated(int)),folderView,SLOT(slotContextMenu(int))); | 123 | connect(serverMenu,SIGNAL(activated(int)),folderView,SLOT(slotContextMenu(int))); |
119 | connect(folderMenu,SIGNAL(activated(int)),folderView,SLOT(slotContextMenu(int))); | 124 | connect(folderMenu,SIGNAL(activated(int)),folderView,SLOT(slotContextMenu(int))); |
120 | 125 | ||
121 | 126 | ||
122 | layout->addWidget( folderView ); | 127 | layout->addWidget( folderView ); |
123 | 128 | ||
124 | mailView = new QListView( view ); | 129 | mailView = new QListView( view ); |
125 | mailView->addColumn( "" ); | 130 | mailView->addColumn( "" ); |
126 | mailView->addColumn( tr( "Subject" ),QListView::Manual ); | 131 | mailView->addColumn( tr( "Subject" ),QListView::Manual ); |
127 | mailView->addColumn( tr( "Sender" ),QListView::Manual ); | 132 | mailView->addColumn( tr( "Sender" ),QListView::Manual ); |
128 | mailView->addColumn( tr( "Size" ),QListView::Manual); | 133 | mailView->addColumn( tr( "Size" ),QListView::Manual); |
129 | mailView->addColumn( tr( "Date" )); | 134 | mailView->addColumn( tr( "Date" )); |
130 | mailView->setAllColumnsShowFocus(true); | 135 | mailView->setAllColumnsShowFocus(true); |
131 | mailView->setShowSortIndicator(true); | 136 | mailView->setShowSortIndicator(true); |
132 | mailView->setSorting(4,false); | 137 | mailView->setSorting(4,false); |
133 | 138 | ||
134 | layout->addWidget( mailView ); | 139 | layout->addWidget( mailView ); |
135 | layout->setStretchFactor( folderView, 1 ); | 140 | layout->setStretchFactor( folderView, 1 ); |
136 | layout->setStretchFactor( mailView, 2 ); | 141 | layout->setStretchFactor( mailView, 2 ); |
137 | 142 | ||
138 | m_Rotate = (QApplication::desktop()->width() > QApplication::desktop()->height()?0:90); | 143 | m_Rotate = (QApplication::desktop()->width() > QApplication::desktop()->height()?0:90); |
139 | 144 | ||
140 | slotAdjustLayout(); | 145 | slotAdjustLayout(); |
141 | 146 | ||
142 | QPEApplication::setStylusOperation( mailView->viewport(),QPEApplication::RightOnHold); | 147 | QPEApplication::setStylusOperation( mailView->viewport(),QPEApplication::RightOnHold); |
143 | QPEApplication::setStylusOperation( folderView->viewport(),QPEApplication::RightOnHold); | 148 | QPEApplication::setStylusOperation( folderView->viewport(),QPEApplication::RightOnHold); |
144 | 149 | ||
145 | connect( mailView, SIGNAL( mouseButtonClicked(int,QListViewItem*,const QPoint&,int) ),this, | 150 | connect( mailView, SIGNAL( mouseButtonClicked(int,QListViewItem*,const QPoint&,int) ),this, |
146 | SLOT( mailLeftClicked(int,QListViewItem*,const QPoint&,int) ) ); | 151 | SLOT( mailLeftClicked(int,QListViewItem*,const QPoint&,int) ) ); |
147 | connect( mailView, SIGNAL( mouseButtonPressed(int,QListViewItem*,const QPoint&,int) ),this, | 152 | connect( mailView, SIGNAL( mouseButtonPressed(int,QListViewItem*,const QPoint&,int) ),this, |
148 | SLOT( mailHold(int,QListViewItem*,const QPoint&,int) ) ); | 153 | SLOT( mailHold(int,QListViewItem*,const QPoint&,int) ) ); |
149 | 154 | ||
150 | connect(folderView, SIGNAL(refreshMailview(const QValueList<RecMailP>&)), | 155 | connect(folderView, SIGNAL(refreshMailview(const QValueList<RecMailP>&)), |
151 | this,SLOT(refreshMailView(const QValueList<RecMailP>&))); | 156 | this,SLOT(refreshMailView(const QValueList<RecMailP>&))); |
152 | 157 | ||
153 | connect( composeMail, SIGNAL( activated() ), SLOT( slotComposeMail() ) ); | 158 | connect( composeMail, SIGNAL( activated() ), SLOT( slotComposeMail() ) ); |
154 | connect( sendQueued, SIGNAL( activated() ), SLOT( slotSendQueued() ) ); | 159 | connect( sendQueued, SIGNAL( activated() ), SLOT( slotSendQueued() ) ); |
155 | 160 | ||
156 | // connect( searchMails, SIGNAL( activated() ), SLOT( slotSearchMails() ) ); | 161 | // connect( searchMails, SIGNAL( activated() ), SLOT( slotSearchMails() ) ); |
157 | connect( editAccounts, SIGNAL( activated() ), SLOT( slotEditAccounts() ) ); | 162 | connect( editAccounts, SIGNAL( activated() ), SLOT( slotEditAccounts() ) ); |
158 | // Added by Stefan Eilers to allow starting by addressbook.. | 163 | // Added by Stefan Eilers to allow starting by addressbook.. |
159 | // copied from old mail2 | 164 | // copied from old mail2 |
160 | 165 | ||
161 | #if !defined(QT_NO_COP) | 166 | #if !defined(QT_NO_COP) |
162 | connect( qApp, SIGNAL( appMessage(const QCString&,const QByteArray&) ), | 167 | connect( qApp, SIGNAL( appMessage(const QCString&,const QByteArray&) ), |
163 | this, SLOT( appMessage(const QCString&,const QByteArray&) ) ); | 168 | this, SLOT( appMessage(const QCString&,const QByteArray&) ) ); |
164 | m_sysChannel = new QCopChannel( "QPE/System", this ); | 169 | m_sysChannel = new QCopChannel( "QPE/System", this ); |
165 | connect( m_sysChannel, SIGNAL( received(const QCString&,const QByteArray&) ), | 170 | connect( m_sysChannel, SIGNAL( received(const QCString&,const QByteArray&) ), |
166 | this, SLOT( systemMessage(const QCString&,const QByteArray&) ) ); | 171 | this, SLOT( systemMessage(const QCString&,const QByteArray&) ) ); |
167 | #endif | 172 | #endif |
168 | 173 | ||
169 | QTimer::singleShot( 10, this, SLOT( slotAdjustColumns() ) ); | 174 | QTimer::singleShot( 10, this, SLOT( slotAdjustColumns() ) ); |
170 | } | 175 | } |
171 | 176 | ||
172 | MainWindow::~MainWindow() | 177 | MainWindow::~MainWindow() |
173 | { | 178 | { |
174 | } | 179 | } |
175 | 180 | ||
176 | void MainWindow::serverSelected(int m_isFolder) | 181 | void MainWindow::serverSelected(int) |
177 | { | 182 | { |
178 | mailView->clear(); | 183 | odebug << "slotShowFolders not reached" << oendl; |
179 | menuBar->setItemEnabled(m_ServerMenuId,m_isFolder&1); | ||
180 | menuBar->setItemEnabled(m_FolderMenuId,m_isFolder&2); | ||
181 | } | 184 | } |
182 | 185 | ||
183 | void MainWindow::systemMessage( const QCString& msg, const QByteArray& data ) | 186 | void MainWindow::systemMessage( const QCString& msg, const QByteArray& data ) |
184 | { | 187 | { |
185 | int _newrotation; | 188 | int _newrotation; |
186 | QDataStream stream( data, IO_ReadOnly ); | 189 | QDataStream stream( data, IO_ReadOnly ); |
187 | if ( msg == "setCurrentRotation(int)" ) | 190 | if ( msg == "setCurrentRotation(int)" ) |
188 | { | 191 | { |
189 | stream >> _newrotation; | 192 | stream >> _newrotation; |
190 | if (m_Rotate != _newrotation) { | 193 | if (m_Rotate != _newrotation) { |
191 | slotAdjustLayout(); | 194 | slotAdjustLayout(); |
192 | m_Rotate = _newrotation; | 195 | m_Rotate = _newrotation; |
193 | } | 196 | } |
194 | } | 197 | } |
195 | } | 198 | } |
196 | 199 | ||
197 | void MainWindow::appMessage(const QCString &, const QByteArray &) | 200 | void MainWindow::appMessage(const QCString &, const QByteArray &) |
198 | { | 201 | { |
199 | odebug << "appMessage not reached" << oendl; | 202 | odebug << "appMessage not reached" << oendl; |
200 | } | 203 | } |
201 | 204 | ||
202 | void MainWindow::slotAdjustLayout() { | 205 | void MainWindow::slotAdjustLayout() { |
203 | 206 | ||
204 | QWidget *d = QApplication::desktop(); | 207 | QWidget *d = QApplication::desktop(); |
205 | if ( d->width() < d->height() ) { | 208 | if ( d->width() < d->height() ) { |
206 | layout->setDirection( QBoxLayout::TopToBottom ); | 209 | layout->setDirection( QBoxLayout::TopToBottom ); |
207 | } else { | 210 | } else { |
208 | layout->setDirection( QBoxLayout::LeftToRight ); | 211 | layout->setDirection( QBoxLayout::LeftToRight ); |
209 | } | 212 | } |
210 | } | 213 | } |
211 | 214 | ||
212 | void MainWindow::slotAdjustColumns() | 215 | void MainWindow::slotAdjustColumns() |
213 | { | 216 | { |
214 | bool hidden = folderView->isHidden(); | 217 | bool hidden = folderView->isHidden(); |
215 | if ( hidden ) folderView->show(); | 218 | if ( hidden ) folderView->show(); |
216 | folderView->setColumnWidth( 0, folderView->visibleWidth() ); | 219 | folderView->setColumnWidth( 0, folderView->visibleWidth() ); |
217 | if ( hidden ) folderView->hide(); | 220 | if ( hidden ) folderView->hide(); |
218 | 221 | ||
219 | mailView->setColumnWidth( 0, 10 ); | 222 | mailView->setColumnWidth( 0, 10 ); |
220 | mailView->setColumnWidth( 1, mailView->visibleWidth() - 130 ); | 223 | mailView->setColumnWidth( 1, mailView->visibleWidth() - 130 ); |
221 | mailView->setColumnWidth( 2, 80 ); | 224 | mailView->setColumnWidth( 2, 80 ); |
222 | mailView->setColumnWidth( 3, 50 ); | 225 | mailView->setColumnWidth( 3, 50 ); |
223 | mailView->setColumnWidth( 4, 50 ); | 226 | mailView->setColumnWidth( 4, 50 ); |
224 | } | 227 | } |
225 | 228 | ||
226 | void MainWindow::slotEditSettings() | 229 | void MainWindow::slotEditSettings() |
227 | { | 230 | { |
228 | } | 231 | } |
229 | 232 | ||
230 | void MainWindow::slotShowFolders( bool ) | 233 | void MainWindow::slotShowFolders( bool ) |
231 | { | 234 | { |
232 | odebug << "slotShowFolders not reached" << oendl; | 235 | odebug << "slotShowFolders not reached" << oendl; |
233 | } | 236 | } |
234 | 237 | ||
235 | void MainWindow::refreshMailView(const QValueList<RecMailP>&) | 238 | void MainWindow::refreshMailView(const QValueList<RecMailP>&) |
236 | { | 239 | { |
237 | odebug << "refreshMailView not reached" << oendl; | 240 | odebug << "refreshMailView not reached" << oendl; |
238 | } | 241 | } |
239 | 242 | ||
240 | void MainWindow::mailLeftClicked(int, QListViewItem *,const QPoint&,int ) | 243 | void MainWindow::mailLeftClicked(int, QListViewItem *,const QPoint&,int ) |
241 | { | 244 | { |
242 | odebug << "mailLeftClicked not reached" << oendl; | 245 | odebug << "mailLeftClicked not reached" << oendl; |
243 | } | 246 | } |
244 | 247 | ||
245 | void MainWindow::displayMail() | 248 | void MainWindow::displayMail() |
246 | { | 249 | { |
247 | odebug << "displayMail not reached" << oendl; | 250 | odebug << "displayMail not reached" << oendl; |
248 | } | 251 | } |
249 | 252 | ||
250 | void MainWindow::slotDeleteMail() | 253 | void MainWindow::slotDeleteMail() |
251 | { | 254 | { |
252 | odebug << "deleteMail not reached" << oendl; | 255 | odebug << "deleteMail not reached" << oendl; |
253 | } | 256 | } |
254 | 257 | ||
255 | void MainWindow::mailHold(int, QListViewItem *,const QPoint&,int ) | 258 | void MainWindow::mailHold(int, QListViewItem *,const QPoint&,int ) |
256 | { | 259 | { |
257 | odebug << "mailHold not reached" << oendl; | 260 | odebug << "mailHold not reached" << oendl; |
258 | } | 261 | } |
259 | 262 | ||
260 | void MainWindow::slotSendQueued() | 263 | void MainWindow::slotSendQueued() |
261 | { | 264 | { |
262 | } | 265 | } |
263 | 266 | ||
264 | void MainWindow::slotEditAccounts() | 267 | void MainWindow::slotEditAccounts() |
265 | { | 268 | { |
266 | } | 269 | } |
267 | 270 | ||
268 | void MainWindow::slotComposeMail() | 271 | void MainWindow::slotComposeMail() |
269 | { | 272 | { |
270 | } | 273 | } |
diff --git a/noncore/net/mail/mainwindow.h b/noncore/net/mail/mainwindow.h index 409f160..b781d62 100644 --- a/noncore/net/mail/mainwindow.h +++ b/noncore/net/mail/mainwindow.h | |||
@@ -1,61 +1,61 @@ | |||
1 | #ifndef MAINWINDOW_H | 1 | #ifndef MAINWINDOW_H |
2 | #define MAINWINDOW_H | 2 | #define MAINWINDOW_H |
3 | 3 | ||
4 | #include "accountview.h" | ||
5 | #include <libmailwrapper/mailtypes.h> | ||
6 | |||
7 | #include <opie2/osmartpointer.h> | ||
8 | |||
4 | #include <qmainwindow.h> | 9 | #include <qmainwindow.h> |
5 | #include <qlistview.h> | 10 | #include <qlistview.h> |
6 | #include <qaction.h> | 11 | #include <qaction.h> |
7 | |||
8 | #include <qtoolbar.h> | 12 | #include <qtoolbar.h> |
9 | #include <qmenubar.h> | 13 | #include <qmenubar.h> |
10 | 14 | #include <qmap.h> | |
11 | #include "accountview.h" | ||
12 | |||
13 | #include <libmailwrapper/mailtypes.h> | ||
14 | #include <opie2/osmartpointer.h> | ||
15 | 15 | ||
16 | class RecMail; | 16 | class RecMail; |
17 | class QCopChannel; | 17 | class QCopChannel; |
18 | 18 | ||
19 | class MainWindow : public QMainWindow | 19 | class MainWindow : public QMainWindow |
20 | { | 20 | { |
21 | Q_OBJECT | 21 | Q_OBJECT |
22 | 22 | ||
23 | public: | 23 | public: |
24 | MainWindow( QWidget *parent = 0, const char *name = 0, WFlags flags = 0 ); | 24 | MainWindow( QWidget *parent = 0, const char *name = 0, WFlags flags = 0 ); |
25 | virtual ~MainWindow(); | 25 | virtual ~MainWindow(); |
26 | 26 | ||
27 | public slots: | 27 | public slots: |
28 | virtual void slotAdjustColumns(); | 28 | virtual void slotAdjustColumns(); |
29 | virtual void appMessage(const QCString &msg, const QByteArray &data); | 29 | virtual void appMessage(const QCString &msg, const QByteArray &data); |
30 | virtual void slotComposeMail(); | 30 | virtual void slotComposeMail(); |
31 | virtual void systemMessage( const QCString&, const QByteArray& ); | 31 | virtual void systemMessage( const QCString&, const QByteArray& ); |
32 | 32 | ||
33 | protected slots: | 33 | protected slots: |
34 | virtual void slotSendQueued(); | 34 | virtual void slotSendQueued(); |
35 | virtual void slotEditAccounts(); | 35 | virtual void slotEditAccounts(); |
36 | virtual void slotShowFolders( bool show ); | 36 | virtual void slotShowFolders( bool show ); |
37 | virtual void refreshMailView(const QValueList<RecMailP>&); | 37 | virtual void refreshMailView(const QValueList<RecMailP>&); |
38 | virtual void displayMail(); | 38 | virtual void displayMail(); |
39 | virtual void slotDeleteMail(); | 39 | virtual void slotDeleteMail(); |
40 | virtual void mailHold(int, QListViewItem *,const QPoint&,int); | 40 | virtual void mailHold(int, QListViewItem *,const QPoint&,int); |
41 | virtual void slotAdjustLayout(); | 41 | virtual void slotAdjustLayout(); |
42 | virtual void slotEditSettings(); | 42 | virtual void slotEditSettings(); |
43 | virtual void mailLeftClicked( int, QListViewItem *,const QPoint&,int ); | 43 | virtual void mailLeftClicked( int, QListViewItem *,const QPoint&,int ); |
44 | virtual void serverSelected(int); | 44 | virtual void serverSelected(int); |
45 | 45 | ||
46 | protected: | 46 | protected: |
47 | QToolBar *toolBar; | 47 | QToolBar *toolBar; |
48 | QMenuBar *menuBar; | 48 | QMenuBar *menuBar; |
49 | QPopupMenu *mailMenu, *settingsMenu,*serverMenu,*folderMenu; | 49 | QPopupMenu *mailMenu, *settingsMenu,*serverMenu,*folderMenu; |
50 | 50 | ||
51 | QAction *composeMail, *sendQueued, *showFolders, *searchMails, *deleteMails, | 51 | QAction *composeMail, *sendQueued, *showFolders, *searchMails, *deleteMails, |
52 | *editSettings, *editAccounts, *syncFolders; | 52 | *editSettings, *editAccounts, *syncFolders; |
53 | AccountView *folderView; | 53 | AccountView *folderView; |
54 | QListView *mailView; | 54 | QListView *mailView; |
55 | QBoxLayout *layout; | 55 | QBoxLayout *layout; |
56 | int m_Rotate; | 56 | int m_Rotate; |
57 | QCopChannel* m_sysChannel; | 57 | QCopChannel* m_sysChannel; |
58 | int m_ServerMenuId,m_FolderMenuId; | 58 | int m_ServerMenuId,m_FolderMenuId; |
59 | }; | 59 | }; |
60 | 60 | ||
61 | #endif | 61 | #endif |
diff --git a/noncore/net/mail/opiemail.cpp b/noncore/net/mail/opiemail.cpp index 7c6d314..1bc81e4 100644 --- a/noncore/net/mail/opiemail.cpp +++ b/noncore/net/mail/opiemail.cpp | |||
@@ -1,388 +1,429 @@ | |||
1 | 1 | ||
2 | #include "settingsdialog.h" | 2 | #include "settingsdialog.h" |
3 | #include "opiemail.h" | 3 | #include "opiemail.h" |
4 | #include "editaccounts.h" | 4 | #include "editaccounts.h" |
5 | #include "composemail.h" | 5 | #include "composemail.h" |
6 | #include "mailistviewitem.h" | 6 | #include "mailistviewitem.h" |
7 | #include "viewmail.h" | 7 | #include "viewmail.h" |
8 | #include "selectstore.h" | 8 | #include "selectstore.h" |
9 | #include "selectsmtp.h" | 9 | #include "selectsmtp.h" |
10 | 10 | ||
11 | #include <libmailwrapper/smtpwrapper.h> | 11 | #include <libmailwrapper/smtpwrapper.h> |
12 | #include <libmailwrapper/mailtypes.h> | 12 | #include <libmailwrapper/mailtypes.h> |
13 | #include <libmailwrapper/abstractmail.h> | 13 | #include <libmailwrapper/abstractmail.h> |
14 | /* OPIE */ | 14 | /* OPIE */ |
15 | #include <opie2/odebug.h> | 15 | #include <opie2/odebug.h> |
16 | #include <qpe/resource.h> | 16 | #include <qpe/resource.h> |
17 | #include <qpe/qpeapplication.h> | 17 | #include <qpe/qpeapplication.h> |
18 | 18 | ||
19 | /* QT */ | 19 | /* QT */ |
20 | #include <qmap.h> | 20 | #include <qmap.h> |
21 | #include <qvaluelist.h> | 21 | #include <qvaluelist.h> |
22 | 22 | ||
23 | /* UNIX */ | 23 | /* UNIX */ |
24 | #include <signal.h> | 24 | #include <signal.h> |
25 | 25 | ||
26 | using namespace Opie::Core; | 26 | using namespace Opie::Core; |
27 | 27 | ||
28 | typedef QMapNode<QString,QString> tkeyvalues; | 28 | typedef QMapNode<QString,QString> tkeyvalues; |
29 | typedef QValueList<tkeyvalues> tvaluelist; | 29 | typedef QValueList<tkeyvalues> tvaluelist; |
30 | 30 | ||
31 | class ValueExplode | 31 | class ValueExplode |
32 | { | 32 | { |
33 | protected: | 33 | protected: |
34 | //! what was parsed last | 34 | //! what was parsed last |
35 | tvaluelist m_LastParsed; | 35 | tvaluelist m_LastParsed; |
36 | //! the delemiter to use | 36 | //! the delemiter to use |
37 | QString mDelemiter; | 37 | QString mDelemiter; |
38 | //! the inner delemiter | 38 | //! the inner delemiter |
39 | QString m2Delemiter; | 39 | QString m2Delemiter; |
40 | //! the real split routine | 40 | //! the real split routine |
41 | void splitit(); | 41 | void splitit(); |
42 | //! the content | 42 | //! the content |
43 | QString m_Command; | 43 | QString m_Command; |
44 | //! constructor | 44 | //! constructor |
45 | ValueExplode(){} | 45 | ValueExplode(){} |
46 | public: | 46 | public: |
47 | //! constructor | 47 | //! constructor |
48 | /*! | 48 | /*! |
49 | * \param aCommand the string to be splitted | 49 | * \param aCommand the string to be splitted |
50 | * \param aDelemiter which sign will be the delemiter character | 50 | * \param aDelemiter which sign will be the delemiter character |
51 | * \param a2Delemiter which sign will delemiter the key-value-pairs between other delemiters | 51 | * \param a2Delemiter which sign will delemiter the key-value-pairs between other delemiters |
52 | */ | 52 | */ |
53 | ValueExplode(const QString&aCommand,const char aDelemiter = '&',const char a2Delemiter='='); | 53 | ValueExplode(const QString&aCommand,const char aDelemiter = '&',const char a2Delemiter='='); |
54 | //! destructor | 54 | //! destructor |
55 | virtual ~ValueExplode(); | 55 | virtual ~ValueExplode(); |
56 | //! assigen operator | 56 | //! assigen operator |
57 | /*! | 57 | /*! |
58 | * \return a list of substrings | 58 | * \return a list of substrings |
59 | */ | 59 | */ |
60 | operator const tvaluelist& (){return m_LastParsed;} | 60 | operator const tvaluelist& (){return m_LastParsed;} |
61 | }; | 61 | }; |
62 | 62 | ||
63 | ValueExplode::~ValueExplode() | 63 | ValueExplode::~ValueExplode() |
64 | { | 64 | { |
65 | } | 65 | } |
66 | 66 | ||
67 | ValueExplode::ValueExplode(const QString&aCommand,const char aDelemiter,const char a2Delemiter) | 67 | ValueExplode::ValueExplode(const QString&aCommand,const char aDelemiter,const char a2Delemiter) |
68 | :m_LastParsed(),m_Command(aCommand) | 68 | :m_LastParsed(),m_Command(aCommand) |
69 | { | 69 | { |
70 | mDelemiter = aDelemiter; | 70 | mDelemiter = aDelemiter; |
71 | m2Delemiter = a2Delemiter; | 71 | m2Delemiter = a2Delemiter; |
72 | splitit(); | 72 | splitit(); |
73 | } | 73 | } |
74 | 74 | ||
75 | void ValueExplode::splitit() | 75 | void ValueExplode::splitit() |
76 | { | 76 | { |
77 | QString iLine; | 77 | QString iLine; |
78 | m_LastParsed.clear(); | 78 | m_LastParsed.clear(); |
79 | if (mDelemiter.isEmpty()||m2Delemiter.isEmpty()) { | 79 | if (mDelemiter.isEmpty()||m2Delemiter.isEmpty()) { |
80 | m_LastParsed.append(tkeyvalues(m_Command,"")); | 80 | m_LastParsed.append(tkeyvalues(m_Command,"")); |
81 | return; | 81 | return; |
82 | } | 82 | } |
83 | int pos,pos2; | 83 | int pos,pos2; |
84 | unsigned startpos = 0; | 84 | unsigned startpos = 0; |
85 | iLine = m_Command; | 85 | iLine = m_Command; |
86 | while ( (pos = iLine.find(mDelemiter,startpos))!=-1) { | 86 | while ( (pos = iLine.find(mDelemiter,startpos))!=-1) { |
87 | pos2 = iLine.find(m2Delemiter,startpos); | 87 | pos2 = iLine.find(m2Delemiter,startpos); |
88 | if (pos2==-1||pos2>pos) { | 88 | if (pos2==-1||pos2>pos) { |
89 | m_LastParsed.append(tkeyvalues(iLine.mid(startpos,pos-startpos),"")); | 89 | m_LastParsed.append(tkeyvalues(iLine.mid(startpos,pos-startpos),"")); |
90 | } else { | 90 | } else { |
91 | m_LastParsed.append(tkeyvalues(iLine.mid(startpos,pos2-startpos),iLine.mid(pos2+1,pos-pos2-1))); | 91 | m_LastParsed.append(tkeyvalues(iLine.mid(startpos,pos2-startpos),iLine.mid(pos2+1,pos-pos2-1))); |
92 | } | 92 | } |
93 | startpos = pos+1; | 93 | startpos = pos+1; |
94 | } | 94 | } |
95 | if (startpos<iLine.length()) { | 95 | if (startpos<iLine.length()) { |
96 | pos2 = iLine.find(m2Delemiter,startpos); | 96 | pos2 = iLine.find(m2Delemiter,startpos); |
97 | if (pos2==-1) { | 97 | if (pos2==-1) { |
98 | m_LastParsed.append(tkeyvalues(iLine.mid(startpos),"")); | 98 | m_LastParsed.append(tkeyvalues(iLine.mid(startpos),"")); |
99 | } else { | 99 | } else { |
100 | m_LastParsed.append(tkeyvalues(iLine.mid(startpos,pos2-startpos),iLine.mid(pos2+1))); | 100 | m_LastParsed.append(tkeyvalues(iLine.mid(startpos,pos2-startpos),iLine.mid(pos2+1))); |
101 | } | 101 | } |
102 | } | 102 | } |
103 | } | 103 | } |
104 | 104 | ||
105 | OpieMail::OpieMail( QWidget *parent, const char *name, WFlags ) | 105 | OpieMail::OpieMail( QWidget *parent, const char *name, WFlags ) |
106 | : MainWindow( parent, name, WStyle_ContextHelp ) | 106 | : MainWindow( parent, name, WStyle_ContextHelp ) |
107 | { | 107 | { |
108 | setup_signalblocking(); | 108 | setup_signalblocking(); |
109 | settings = new Settings(); | 109 | settings = new Settings(); |
110 | folderView->populate( settings->getAccounts() ); | 110 | folderView->populate( settings->getAccounts() ); |
111 | connect(folderView,SIGNAL(refreshMenues(int)),this,SLOT(refreshMenu(int))); | ||
111 | } | 112 | } |
112 | 113 | ||
113 | OpieMail::~OpieMail() | 114 | OpieMail::~OpieMail() |
114 | { | 115 | { |
115 | if (settings) delete settings; | 116 | if (settings) delete settings; |
116 | } | 117 | } |
117 | 118 | ||
118 | void OpieMail::setup_signalblocking() | 119 | void OpieMail::setup_signalblocking() |
119 | { | 120 | { |
120 | /* for networking we must block SIGPIPE and Co. */ | 121 | /* for networking we must block SIGPIPE and Co. */ |
121 | struct sigaction blocking_action,temp_action; | 122 | struct sigaction blocking_action,temp_action; |
122 | blocking_action.sa_handler = SIG_IGN; | 123 | blocking_action.sa_handler = SIG_IGN; |
123 | sigemptyset(&(blocking_action.sa_mask)); | 124 | sigemptyset(&(blocking_action.sa_mask)); |
124 | blocking_action.sa_flags = 0; | 125 | blocking_action.sa_flags = 0; |
125 | sigaction(SIGPIPE,&blocking_action,&temp_action); | 126 | sigaction(SIGPIPE,&blocking_action,&temp_action); |
126 | } | 127 | } |
127 | 128 | ||
128 | void OpieMail::appMessage(const QCString &msg, const QByteArray &data) | 129 | void OpieMail::appMessage(const QCString &msg, const QByteArray &data) |
129 | { | 130 | { |
130 | // copied from old mail2 | 131 | // copied from old mail2 |
131 | if (msg == "writeMail(QString,QString)") | 132 | if (msg == "writeMail(QString,QString)") |
132 | { | 133 | { |
133 | QDataStream stream(data,IO_ReadOnly); | 134 | QDataStream stream(data,IO_ReadOnly); |
134 | QString name, email; | 135 | QString name, email; |
135 | stream >> name >> email; | 136 | stream >> name >> email; |
136 | // removing the whitespaces at beginning and end is needed! | 137 | // removing the whitespaces at beginning and end is needed! |
137 | slotwriteMail(name.stripWhiteSpace(),email.stripWhiteSpace()); | 138 | slotwriteMail(name.stripWhiteSpace(),email.stripWhiteSpace()); |
138 | } | 139 | } |
139 | else if (msg == "newMail()") | 140 | else if (msg == "newMail()") |
140 | { | 141 | { |
141 | slotComposeMail(); | 142 | slotComposeMail(); |
142 | } | 143 | } |
143 | } | 144 | } |
144 | 145 | ||
145 | /** | 146 | /** |
146 | * Konqueror calls us with the mailto:name@address | 147 | * Konqueror calls us with the mailto:name@address |
147 | */ | 148 | */ |
148 | void OpieMail::setDocument(const QString& mail) | 149 | void OpieMail::setDocument(const QString& mail) |
149 | { | 150 | { |
150 | /* | 151 | /* |
151 | * It looks like a mailto address, lets try it | 152 | * It looks like a mailto address, lets try it |
152 | */ | 153 | */ |
153 | if( mail.startsWith(QString::fromLatin1("mailto:")) ) | 154 | if( mail.startsWith(QString::fromLatin1("mailto:")) ) |
154 | slotwriteMail(QString::null, mail.mid(7)); | 155 | slotwriteMail(QString::null, mail.mid(7)); |
155 | } | 156 | } |
156 | 157 | ||
157 | void OpieMail::slotwriteMail(const QString&name,const QString&email) | 158 | void OpieMail::slotwriteMail(const QString&name,const QString&email) |
158 | { | 159 | { |
159 | ComposeMail compose( settings, this, 0, true , WStyle_ContextHelp ); | 160 | ComposeMail compose( settings, this, 0, true , WStyle_ContextHelp ); |
160 | if (!email.isEmpty()) | 161 | if (!email.isEmpty()) |
161 | { | 162 | { |
162 | if (!name.isEmpty()) | 163 | if (!name.isEmpty()) |
163 | { | 164 | { |
164 | compose.setTo("\"" + name + "\"" + " " + "<"+ email + ">"); | 165 | compose.setTo("\"" + name + "\"" + " " + "<"+ email + ">"); |
165 | } | 166 | } |
166 | else | 167 | else |
167 | { | 168 | { |
168 | compose.setTo(email); | 169 | compose.setTo(email); |
169 | } | 170 | } |
170 | } | 171 | } |
171 | compose.slotAdjustColumns(); | 172 | compose.slotAdjustColumns(); |
172 | QPEApplication::execDialog( &compose ); | 173 | QPEApplication::execDialog( &compose ); |
173 | } | 174 | } |
174 | 175 | ||
175 | void OpieMail::slotComposeMail() | 176 | void OpieMail::slotComposeMail() |
176 | { | 177 | { |
177 | odebug << "Compose Mail" << oendl; | 178 | odebug << "Compose Mail" << oendl; |
178 | slotwriteMail(0l,0l); | 179 | slotwriteMail(0l,0l); |
179 | } | 180 | } |
180 | 181 | ||
181 | void OpieMail::slotSendQueued() | 182 | void OpieMail::slotSendQueued() |
182 | { | 183 | { |
183 | odebug << "Send Queued" << oendl; | 184 | odebug << "Send Queued" << oendl; |
184 | SMTPaccount *smtp = 0; | 185 | SMTPaccount *smtp = 0; |
185 | 186 | ||
186 | QList<Account> list = settings->getAccounts(); | 187 | QList<Account> list = settings->getAccounts(); |
187 | QList<SMTPaccount> smtpList; | 188 | QList<SMTPaccount> smtpList; |
188 | smtpList.setAutoDelete(false); | 189 | smtpList.setAutoDelete(false); |
189 | Account *it; | 190 | Account *it; |
190 | for ( it = list.first(); it; it = list.next() ) | 191 | for ( it = list.first(); it; it = list.next() ) |
191 | { | 192 | { |
192 | if ( it->getType() == MAILLIB::A_SMTP ) | 193 | if ( it->getType() == MAILLIB::A_SMTP ) |
193 | { | 194 | { |
194 | smtp = static_cast<SMTPaccount *>(it); | 195 | smtp = static_cast<SMTPaccount *>(it); |
195 | smtpList.append(smtp); | 196 | smtpList.append(smtp); |
196 | } | 197 | } |
197 | } | 198 | } |
198 | if (smtpList.count()==0) | 199 | if (smtpList.count()==0) |
199 | { | 200 | { |
200 | QMessageBox::information(0,tr("Info"),tr("Define a smtp account first")); | 201 | QMessageBox::information(0,tr("Info"),tr("Define a smtp account first")); |
201 | return; | 202 | return; |
202 | } | 203 | } |
203 | if (smtpList.count()==1) | 204 | if (smtpList.count()==1) |
204 | { | 205 | { |
205 | smtp = smtpList.at(0); | 206 | smtp = smtpList.at(0); |
206 | } | 207 | } |
207 | else | 208 | else |
208 | { | 209 | { |
209 | smtp = 0; | 210 | smtp = 0; |
210 | selectsmtp selsmtp; | 211 | selectsmtp selsmtp; |
211 | selsmtp.setSelectionlist(&smtpList); | 212 | selsmtp.setSelectionlist(&smtpList); |
212 | if ( QPEApplication::execDialog( &selsmtp ) == QDialog::Accepted ) | 213 | if ( QPEApplication::execDialog( &selsmtp ) == QDialog::Accepted ) |
213 | { | 214 | { |
214 | smtp = selsmtp.selected_smtp(); | 215 | smtp = selsmtp.selected_smtp(); |
215 | } | 216 | } |
216 | } | 217 | } |
217 | if (smtp) | 218 | if (smtp) |
218 | { | 219 | { |
219 | SMTPwrapper * wrap = new SMTPwrapper(smtp); | 220 | SMTPwrapper * wrap = new SMTPwrapper(smtp); |
220 | if ( wrap->flushOutbox() ) | 221 | if ( wrap->flushOutbox() ) |
221 | { | 222 | { |
222 | QMessageBox::information(0,tr("Info"),tr("Mail queue flushed")); | 223 | QMessageBox::information(0,tr("Info"),tr("Mail queue flushed")); |
223 | } | 224 | } |
224 | delete wrap; | 225 | delete wrap; |
225 | } | 226 | } |
226 | } | 227 | } |
227 | 228 | ||
228 | void OpieMail::slotSearchMails() | 229 | void OpieMail::slotSearchMails() |
229 | { | 230 | { |
230 | odebug << "Search Mails" << oendl; | 231 | odebug << "Search Mails" << oendl; |
231 | } | 232 | } |
232 | 233 | ||
233 | void OpieMail::slotEditSettings() | 234 | void OpieMail::slotEditSettings() |
234 | { | 235 | { |
235 | SettingsDialog settingsDialog( this, 0, true, WStyle_ContextHelp ); | 236 | SettingsDialog settingsDialog( this, 0, true, WStyle_ContextHelp ); |
236 | QPEApplication::execDialog( &settingsDialog ); | 237 | QPEApplication::execDialog( &settingsDialog ); |
237 | } | 238 | } |
238 | 239 | ||
239 | void OpieMail::slotEditAccounts() | 240 | void OpieMail::slotEditAccounts() |
240 | { | 241 | { |
241 | odebug << "Edit Accounts" << oendl; | 242 | odebug << "Edit Accounts" << oendl; |
242 | EditAccounts eaDialog( settings, this, 0, true, WStyle_ContextHelp ); | 243 | EditAccounts eaDialog( settings, this, 0, true, WStyle_ContextHelp ); |
243 | eaDialog.slotAdjustColumns(); | 244 | eaDialog.slotAdjustColumns(); |
244 | if (QPEApplication::execDialog( &eaDialog )==QDialog::Rejected);// return; | 245 | if (QPEApplication::execDialog( &eaDialog )==QDialog::Rejected);// return; |
245 | 246 | ||
246 | if ( settings ) delete settings; | 247 | if ( settings ) delete settings; |
247 | settings = new Settings(); | 248 | settings = new Settings(); |
248 | mailView->clear(); | 249 | mailView->clear(); |
249 | folderView->populate( settings->getAccounts() ); | 250 | folderView->populate( settings->getAccounts() ); |
250 | } | 251 | } |
251 | 252 | ||
252 | void OpieMail::displayMail() | 253 | void OpieMail::displayMail() |
253 | { | 254 | { |
254 | QListViewItem*item = mailView->currentItem(); | 255 | QListViewItem*item = mailView->currentItem(); |
255 | if (!item) return; | 256 | if (!item) return; |
256 | RecMailP mail = ((MailListViewItem*)item)->data(); | 257 | RecMailP mail = ((MailListViewItem*)item)->data(); |
257 | RecBodyP body = folderView->fetchBody(mail); | 258 | RecBodyP body = folderView->fetchBody(mail); |
258 | ViewMail readMail( this,"", Qt::WType_Modal | WStyle_ContextHelp ); | 259 | ViewMail readMail( this,"", Qt::WType_Modal | WStyle_ContextHelp ); |
259 | readMail.setBody( body ); | 260 | readMail.setBody( body ); |
260 | readMail.setMail( mail ); | 261 | readMail.setMail( mail ); |
261 | readMail.showMaximized(); | 262 | readMail.showMaximized(); |
262 | readMail.exec(); | 263 | readMail.exec(); |
263 | 264 | ||
264 | if ( readMail.deleted ) | 265 | if ( readMail.deleted ) |
265 | { | 266 | { |
266 | folderView->refreshCurrent(); | 267 | folderView->refreshCurrent(); |
267 | } | 268 | } |
268 | else | 269 | else |
269 | { | 270 | { |
270 | ( (MailListViewItem*)item )->setPixmap( 0, Resource::loadPixmap( "" ) ); | 271 | ( (MailListViewItem*)item )->setPixmap( 0, Resource::loadPixmap( "" ) ); |
271 | } | 272 | } |
272 | } | 273 | } |
273 | 274 | ||
274 | void OpieMail::slotDeleteMail() | 275 | void OpieMail::slotDeleteMail() |
275 | { | 276 | { |
276 | if (!mailView->currentItem()) return; | 277 | if (!mailView->currentItem()) return; |
277 | RecMailP mail = ((MailListViewItem*)mailView->currentItem() )->data(); | 278 | RecMailP mail = ((MailListViewItem*)mailView->currentItem() )->data(); |
278 | if ( QMessageBox::warning(this, tr("Delete Mail"), QString( tr("<p>Do you really want to delete this mail? <br><br>" ) + mail->getFrom() + " - " + mail->getSubject() ) , QMessageBox::Yes, QMessageBox::No ) == QMessageBox::Yes ) | 279 | if ( QMessageBox::warning(this, tr("Delete Mail"), QString( tr("<p>Do you really want to delete this mail? <br><br>" ) + mail->getFrom() + " - " + mail->getSubject() ) , QMessageBox::Yes, QMessageBox::No ) == QMessageBox::Yes ) |
279 | { | 280 | { |
280 | mail->Wrapper()->deleteMail( mail ); | 281 | mail->Wrapper()->deleteMail( mail ); |
281 | folderView->refreshCurrent(); | 282 | folderView->refreshCurrent(); |
282 | } | 283 | } |
283 | } | 284 | } |
284 | 285 | ||
285 | void OpieMail::mailHold(int button, QListViewItem *item,const QPoint&,int ) | 286 | void OpieMail::mailHold(int button, QListViewItem *item,const QPoint&,int ) |
286 | { | 287 | { |
287 | if (!mailView->currentItem()) return; | 288 | if (!mailView->currentItem()) return; |
288 | MAILLIB::ATYPE mailtype = ((MailListViewItem*)mailView->currentItem() )->wrapperType(); | 289 | MAILLIB::ATYPE mailtype = ((MailListViewItem*)mailView->currentItem() )->wrapperType(); |
289 | /* just the RIGHT button - or hold on pda */ | 290 | /* just the RIGHT button - or hold on pda */ |
290 | if (button!=2) {return;} | 291 | if (button!=2) {return;} |
291 | odebug << "Event right/hold" << oendl; | 292 | odebug << "Event right/hold" << oendl; |
292 | if (!item) return; | 293 | if (!item) return; |
293 | QPopupMenu *m = new QPopupMenu(0); | 294 | QPopupMenu *m = new QPopupMenu(0); |
294 | if (m) | 295 | if (m) |
295 | { | 296 | { |
296 | if (mailtype==MAILLIB::A_NNTP) { | 297 | if (mailtype==MAILLIB::A_NNTP) { |
297 | m->insertItem(tr("Read this posting"),this,SLOT(displayMail())); | 298 | m->insertItem(tr("Read this posting"),this,SLOT(displayMail())); |
298 | // m->insertItem(tr("Copy this posting"),this,SLOT(slotMoveCopyMail())); | 299 | // m->insertItem(tr("Copy this posting"),this,SLOT(slotMoveCopyMail())); |
299 | } else { | 300 | } else { |
300 | if (folderView->currentisDraft()) { | 301 | if (folderView->currentisDraft()) { |
301 | m->insertItem(tr("Edit this mail"),this,SLOT(reEditMail())); | 302 | m->insertItem(tr("Edit this mail"),this,SLOT(reEditMail())); |
302 | } | 303 | } |
303 | m->insertItem(tr("Read this mail"),this,SLOT(displayMail())); | 304 | m->insertItem(tr("Read this mail"),this,SLOT(displayMail())); |
304 | m->insertItem(tr("Delete this mail"),this,SLOT(slotDeleteMail())); | 305 | m->insertItem(tr("Delete this mail"),this,SLOT(slotDeleteMail())); |
305 | m->insertItem(tr("Copy/Move this mail"),this,SLOT(slotMoveCopyMail())); | 306 | m->insertItem(tr("Copy/Move this mail"),this,SLOT(slotMoveCopyMail())); |
306 | } | 307 | } |
307 | m->setFocus(); | 308 | m->setFocus(); |
308 | m->exec( QPoint( QCursor::pos().x(), QCursor::pos().y()) ); | 309 | m->exec( QPoint( QCursor::pos().x(), QCursor::pos().y()) ); |
309 | delete m; | 310 | delete m; |
310 | } | 311 | } |
311 | } | 312 | } |
312 | 313 | ||
313 | void OpieMail::slotShowFolders( bool show ) | 314 | void OpieMail::slotShowFolders( bool show ) |
314 | { | 315 | { |
315 | odebug << "Show Folders" << oendl; | 316 | odebug << "Show Folders" << oendl; |
316 | if ( show && folderView->isHidden() ) | 317 | if ( show && folderView->isHidden() ) |
317 | { | 318 | { |
318 | odebug << "-> showing" << oendl; | 319 | odebug << "-> showing" << oendl; |
319 | folderView->show(); | 320 | folderView->show(); |
320 | } | 321 | } |
321 | else if ( !show && !folderView->isHidden() ) | 322 | else if ( !show && !folderView->isHidden() ) |
322 | { | 323 | { |
323 | odebug << "-> hiding" << oendl; | 324 | odebug << "-> hiding" << oendl; |
324 | folderView->hide(); | 325 | folderView->hide(); |
325 | } | 326 | } |
326 | } | 327 | } |
327 | 328 | ||
328 | void OpieMail::refreshMailView(const QValueList<RecMailP>&list) | 329 | void OpieMail::refreshMailView(const QValueList<RecMailP>&list) |
329 | { | 330 | { |
330 | MailListViewItem*item = 0; | 331 | MailListViewItem*item = 0; |
331 | mailView->clear(); | 332 | mailView->clear(); |
332 | 333 | ||
333 | QValueList<RecMailP>::ConstIterator it; | 334 | QValueList<RecMailP>::ConstIterator it; |
334 | for (it = list.begin(); it != list.end();++it) | 335 | for (it = list.begin(); it != list.end();++it) |
335 | { | 336 | { |
336 | item = new MailListViewItem(mailView,item); | 337 | item = new MailListViewItem(mailView,item); |
337 | item->storeData((*it)); | 338 | item->storeData((*it)); |
338 | item->showEntry(); | 339 | item->showEntry(); |
339 | } | 340 | } |
340 | } | 341 | } |
341 | 342 | ||
342 | void OpieMail::mailLeftClicked(int button, QListViewItem *item,const QPoint&,int ) | 343 | void OpieMail::mailLeftClicked(int button, QListViewItem *item,const QPoint&,int ) |
343 | { | 344 | { |
344 | /* just LEFT button - or tap with stylus on pda */ | 345 | /* just LEFT button - or tap with stylus on pda */ |
345 | if (button!=1) return; | 346 | if (button!=1) return; |
346 | if (!item) return; | 347 | if (!item) return; |
347 | if (folderView->currentisDraft()) { | 348 | if (folderView->currentisDraft()) { |
348 | reEditMail(); | 349 | reEditMail(); |
349 | } else { | 350 | } else { |
350 | displayMail(); | 351 | displayMail(); |
351 | } | 352 | } |
352 | } | 353 | } |
353 | 354 | ||
354 | void OpieMail::slotMoveCopyMail() | 355 | void OpieMail::slotMoveCopyMail() |
355 | { | 356 | { |
356 | if (!mailView->currentItem()) return; | 357 | if (!mailView->currentItem()) return; |
357 | RecMailP mail = ((MailListViewItem*)mailView->currentItem() )->data(); | 358 | RecMailP mail = ((MailListViewItem*)mailView->currentItem() )->data(); |
358 | AbstractMail*targetMail = 0; | 359 | AbstractMail*targetMail = 0; |
359 | QString targetFolder = ""; | 360 | QString targetFolder = ""; |
360 | Selectstore sels; | 361 | Selectstore sels; |
361 | folderView->setupFolderselect(&sels); | 362 | folderView->setupFolderselect(&sels); |
362 | if (!sels.exec()) return; | 363 | if (!sels.exec()) return; |
363 | targetMail = sels.currentMail(); | 364 | targetMail = sels.currentMail(); |
364 | targetFolder = sels.currentFolder(); | 365 | targetFolder = sels.currentFolder(); |
365 | if ( (mail->Wrapper()==targetMail && mail->getMbox()==targetFolder) || | 366 | if ( (mail->Wrapper()==targetMail && mail->getMbox()==targetFolder) || |
366 | targetFolder.isEmpty()) | 367 | targetFolder.isEmpty()) |
367 | { | 368 | { |
368 | return; | 369 | return; |
369 | } | 370 | } |
370 | if (sels.newFolder() && !targetMail->createMbox(targetFolder)) | 371 | if (sels.newFolder() && !targetMail->createMbox(targetFolder)) |
371 | { | 372 | { |
372 | QMessageBox::critical(0,tr("Error creating new Folder"), | 373 | QMessageBox::critical(0,tr("Error creating new Folder"), |
373 | tr("<center>Error while creating<br>new folder - breaking.</center>")); | 374 | tr("<center>Error while creating<br>new folder - breaking.</center>")); |
374 | return; | 375 | return; |
375 | } | 376 | } |
376 | mail->Wrapper()->mvcpMail(mail,targetFolder,targetMail,sels.moveMails()); | 377 | mail->Wrapper()->mvcpMail(mail,targetFolder,targetMail,sels.moveMails()); |
377 | folderView->refreshCurrent(); | 378 | folderView->refreshCurrent(); |
378 | } | 379 | } |
379 | 380 | ||
380 | void OpieMail::reEditMail() | 381 | void OpieMail::reEditMail() |
381 | { | 382 | { |
382 | if (!mailView->currentItem()) return; | 383 | if (!mailView->currentItem()) return; |
383 | 384 | ||
384 | ComposeMail compose( settings, this, 0, true , WStyle_ContextHelp ); | 385 | ComposeMail compose( settings, this, 0, true , WStyle_ContextHelp ); |
385 | compose.reEditMail(((MailListViewItem*)mailView->currentItem() )->data()); | 386 | compose.reEditMail(((MailListViewItem*)mailView->currentItem() )->data()); |
386 | compose.slotAdjustColumns(); | 387 | compose.slotAdjustColumns(); |
387 | QPEApplication::execDialog( &compose ); | 388 | QPEApplication::execDialog( &compose ); |
388 | } | 389 | } |
390 | |||
391 | void OpieMail::refreshMenu(int m_isFolder) | ||
392 | { | ||
393 | if (QApplication::desktop()->width()<330) { | ||
394 | mailMenu->setItemEnabled(m_ServerMenuId,m_isFolder&1); | ||
395 | mailMenu->setItemEnabled(m_FolderMenuId,m_isFolder&2); | ||
396 | } else { | ||
397 | menuBar->setItemEnabled(m_ServerMenuId,m_isFolder&1); | ||
398 | menuBar->setItemEnabled(m_FolderMenuId,m_isFolder&2); | ||
399 | } | ||
400 | |||
401 | QMap<int,QString>::ConstIterator it; | ||
402 | QMap<int,QString> server_entries=folderView->currentServerMenu(); | ||
403 | QMap<int,QString> folder_entries=folderView->currentFolderMenu(); | ||
404 | |||
405 | int id; | ||
406 | unsigned int i; | ||
407 | for (i=0; i<folderMenu->count();++i) { | ||
408 | id = folderMenu->idAt(i); | ||
409 | folderMenu->setItemEnabled(id,false); | ||
410 | } | ||
411 | for (it=folder_entries.begin();it!=folder_entries.end();++it) { | ||
412 | folderMenu->changeItem(it.key(),it.data()); | ||
413 | folderMenu->setItemEnabled(it.key(),true); | ||
414 | } | ||
415 | for (i=0; i<serverMenu->count();++i) { | ||
416 | id = serverMenu->idAt(i); | ||
417 | serverMenu->setItemEnabled(id,false); | ||
418 | } | ||
419 | for (it=server_entries.begin();it!=server_entries.end();++it) { | ||
420 | serverMenu->changeItem(it.key(),it.data()); | ||
421 | serverMenu->setItemEnabled(it.key(),true); | ||
422 | } | ||
423 | } | ||
424 | |||
425 | void OpieMail::serverSelected(int m_isFolder) | ||
426 | { | ||
427 | mailView->clear(); | ||
428 | refreshMenu(m_isFolder); | ||
429 | } | ||
diff --git a/noncore/net/mail/opiemail.h b/noncore/net/mail/opiemail.h index c9d758d..75a0b2d 100644 --- a/noncore/net/mail/opiemail.h +++ b/noncore/net/mail/opiemail.h | |||
@@ -1,47 +1,51 @@ | |||
1 | #ifndef OPIEMAIL_H | 1 | #ifndef OPIEMAIL_H |
2 | #define OPIEMAIL_H | 2 | #define OPIEMAIL_H |
3 | 3 | ||
4 | #include "mainwindow.h" | 4 | #include "mainwindow.h" |
5 | #include <libmailwrapper/settings.h> | 5 | #include <libmailwrapper/settings.h> |
6 | #include <libmailwrapper/mailtypes.h> | ||
6 | 7 | ||
7 | #include <opie2/osmartpointer.h> | 8 | #include <opie2/osmartpointer.h> |
8 | #include <libmailwrapper/mailtypes.h> | 9 | |
10 | #include <qmap.h> | ||
9 | 11 | ||
10 | class OpieMail : public MainWindow | 12 | class OpieMail : public MainWindow |
11 | { | 13 | { |
12 | Q_OBJECT | 14 | Q_OBJECT |
13 | 15 | ||
14 | public: | 16 | public: |
15 | OpieMail( QWidget *parent = 0, const char *name = 0, WFlags flags = 0 ); | 17 | OpieMail( QWidget *parent = 0, const char *name = 0, WFlags flags = 0 ); |
16 | virtual ~OpieMail(); | 18 | virtual ~OpieMail(); |
17 | static QString appName() { return QString::fromLatin1("opiemail"); } | 19 | static QString appName() { return QString::fromLatin1("opiemail"); } |
18 | 20 | ||
19 | public slots: | 21 | public slots: |
20 | virtual void slotwriteMail(const QString&name,const QString&email); | 22 | virtual void slotwriteMail(const QString&name,const QString&email); |
21 | virtual void slotComposeMail(); | 23 | virtual void slotComposeMail(); |
22 | virtual void appMessage(const QCString &msg, const QByteArray &data); | 24 | virtual void appMessage(const QCString &msg, const QByteArray &data); |
23 | void setDocument(const QString&); | 25 | void setDocument(const QString&); |
24 | 26 | ||
25 | protected slots: | 27 | protected slots: |
26 | virtual void slotSendQueued(); | 28 | virtual void slotSendQueued(); |
27 | virtual void slotSearchMails(); | 29 | virtual void slotSearchMails(); |
28 | virtual void slotEditSettings(); | 30 | virtual void slotEditSettings(); |
29 | virtual void slotEditAccounts(); | 31 | virtual void slotEditAccounts(); |
30 | virtual void displayMail(); | 32 | virtual void displayMail(); |
31 | virtual void slotDeleteMail(); | 33 | virtual void slotDeleteMail(); |
32 | virtual void mailHold(int, QListViewItem *,const QPoint&,int); | 34 | virtual void mailHold(int, QListViewItem *,const QPoint&,int); |
33 | virtual void slotShowFolders( bool show ); | 35 | virtual void slotShowFolders( bool show ); |
34 | virtual void refreshMailView(const QValueList<RecMailP>&); | 36 | virtual void refreshMailView(const QValueList<RecMailP>&); |
35 | virtual void mailLeftClicked( int, QListViewItem *,const QPoint&,int ); | 37 | virtual void mailLeftClicked( int, QListViewItem *,const QPoint&,int ); |
36 | virtual void slotMoveCopyMail(); | 38 | virtual void slotMoveCopyMail(); |
37 | virtual void reEditMail(); | 39 | virtual void reEditMail(); |
40 | virtual void serverSelected(int); | ||
41 | virtual void refreshMenu(int); | ||
38 | 42 | ||
39 | protected: | 43 | protected: |
40 | void setup_signalblocking(); | 44 | void setup_signalblocking(); |
41 | 45 | ||
42 | private: | 46 | private: |
43 | Settings *settings; | 47 | Settings *settings; |
44 | 48 | ||
45 | }; | 49 | }; |
46 | 50 | ||
47 | #endif | 51 | #endif |