summaryrefslogtreecommitdiff
authormickeyl <mickeyl>2005-07-03 21:03:44 (UTC)
committer mickeyl <mickeyl>2005-07-03 21:03:44 (UTC)
commit62842736cf871376f947f7b27ebc6f58fbc84fdc (patch) (unidiff)
treec37cb61624a0d6654eeeb218f93c5766bb9ff6f6
parentdf3947675e6e2fd46704810414005aa56aa391a1 (diff)
downloadopie-62842736cf871376f947f7b27ebc6f58fbc84fdc.zip
opie-62842736cf871376f947f7b27ebc6f58fbc84fdc.tar.gz
opie-62842736cf871376f947f7b27ebc6f58fbc84fdc.tar.bz2
Resource -> OResource
Dan, please check if I did everything correctly
Diffstat (more/less context) (ignore whitespace changes)
-rw-r--r--noncore/net/mail/accountitem.cpp6
-rw-r--r--noncore/net/mail/addresspicker.cpp6
-rw-r--r--noncore/net/mail/composemail.cpp9
-rw-r--r--noncore/net/mail/config.in6
-rw-r--r--noncore/net/mail/defines.h33
-rw-r--r--noncore/net/mail/mailistviewitem.cpp14
-rw-r--r--noncore/net/mail/mainwindow.cpp29
-rw-r--r--noncore/net/mail/opiemail.cpp7
-rw-r--r--noncore/net/mail/viewmailbase.cpp24
9 files changed, 71 insertions, 63 deletions
diff --git a/noncore/net/mail/accountitem.cpp b/noncore/net/mail/accountitem.cpp
index f7fdccd..f3f2182 100644
--- a/noncore/net/mail/accountitem.cpp
+++ b/noncore/net/mail/accountitem.cpp
@@ -1,1164 +1,1166 @@
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
11/* OPIE */ 12/* OPIE */
12#include <opie2/odebug.h> 13#include <opie2/odebug.h>
14#include <opie2/oresource.h>
13#include <qpe/qpeapplication.h> 15#include <qpe/qpeapplication.h>
16using namespace Opie::Core;
14 17
15/* QT */ 18/* QT */
16#include <qpopupmenu.h> 19#include <qpopupmenu.h>
17#include <qmessagebox.h> 20#include <qmessagebox.h>
18 21
19using namespace Opie::Core;
20#define SETPIX(x) if (!account->getOffline()) {setPixmap( 0,x);} else {setPixmap( 0, PIXMAP_OFFLINE );} 22#define SETPIX(x) if (!account->getOffline()) {setPixmap( 0,x);} else {setPixmap( 0, PIXMAP_OFFLINE );}
21/** 23/**
22 * POP3 Account stuff 24 * POP3 Account stuff
23 */ 25 */
24POP3viewItem::POP3viewItem( POP3account *a, AccountView *parent ) 26POP3viewItem::POP3viewItem( POP3account *a, AccountView *parent )
25 : AccountViewItem( parent ) 27 : AccountViewItem( parent )
26{ 28{
27 account = a; 29 account = a;
28 wrapper = AbstractMail::getWrapper( account ); 30 wrapper = AbstractMail::getWrapper( account );
29 SETPIX(PIXMAP_POP3FOLDER); 31 SETPIX(PIXMAP_POP3FOLDER);
30#if 0 32#if 0
31 if (!account->getOffline()) 33 if (!account->getOffline())
32 { 34 {
33 setPixmap( 0, ); 35 setPixmap( 0, );
34 } 36 }
35 else 37 else
36 { 38 {
37 setPixmap( 0, PIXMAP_OFFLINE ); 39 setPixmap( 0, PIXMAP_OFFLINE );
38 } 40 }
39#endif 41#endif
40 setText( 0, account->getAccountName() ); 42 setText( 0, account->getAccountName() );
41 setOpen( true ); 43 setOpen( true );
42} 44}
43 45
44POP3viewItem::~POP3viewItem() 46POP3viewItem::~POP3viewItem()
45{ 47{
46 delete wrapper; 48 delete wrapper;
47} 49}
48 50
49AbstractMail *POP3viewItem::getWrapper() 51AbstractMail *POP3viewItem::getWrapper()
50{ 52{
51 return wrapper; 53 return wrapper;
52} 54}
53 55
54void POP3viewItem::refresh(QValueList<Opie::Core::OSmartPointer<RecMail> > & ) 56void POP3viewItem::refresh(QValueList<Opie::Core::OSmartPointer<RecMail> > & )
55{ 57{
56 refresh(); 58 refresh();
57} 59}
58 60
59void POP3viewItem::refresh() 61void POP3viewItem::refresh()
60{ 62{
61 if (account->getOffline()) return; 63 if (account->getOffline()) return;
62 QValueList<FolderP> *folders = wrapper->listFolders(); 64 QValueList<FolderP> *folders = wrapper->listFolders();
63 QListViewItem *child = firstChild(); 65 QListViewItem *child = firstChild();
64 while ( child ) 66 while ( child )
65 { 67 {
66 QListViewItem *tmp = child; 68 QListViewItem *tmp = child;
67 child = child->nextSibling(); 69 child = child->nextSibling();
68 delete tmp; 70 delete tmp;
69 } 71 }
70 QValueList<FolderP>::ConstIterator it; 72 QValueList<FolderP>::ConstIterator it;
71 QListViewItem*item = 0; 73 QListViewItem*item = 0;
72 for ( it = folders->begin(); it!=folders->end(); ++it) 74 for ( it = folders->begin(); it!=folders->end(); ++it)
73 { 75 {
74 item = new POP3folderItem( (*it), this , item ); 76 item = new POP3folderItem( (*it), this , item );
75 item->setSelectable( (*it)->may_select()); 77 item->setSelectable( (*it)->may_select());
76 } 78 }
77 delete folders; 79 delete folders;
78} 80}
79 81
80RECBODYP POP3viewItem::fetchBody( const RecMailP &mail ) 82RECBODYP POP3viewItem::fetchBody( const RecMailP &mail )
81{ 83{
82 odebug << "POP3 fetchBody" << oendl; 84 odebug << "POP3 fetchBody" << oendl;
83 return wrapper->fetchBody( mail ); 85 return wrapper->fetchBody( mail );
84} 86}
85 87
86QMap<int,QString> POP3viewItem::serverMenu() 88QMap<int,QString> POP3viewItem::serverMenu()
87{ 89{
88 QMap<int,QString> _entries; 90 QMap<int,QString> _entries;
89 if (!account->getOffline()) { 91 if (!account->getOffline()) {
90 _entries[SERVER_MENU_DISCONNECT]=QObject::tr("Disconnect",contextName); 92 _entries[SERVER_MENU_DISCONNECT]=QObject::tr("Disconnect",contextName);
91 _entries[SERVER_MENU_OFFLINE]=QObject::tr("Set offline",contextName); 93 _entries[SERVER_MENU_OFFLINE]=QObject::tr("Set offline",contextName);
92 } else { 94 } else {
93 _entries[SERVER_MENU_OFFLINE]=QObject::tr("Set online",contextName); 95 _entries[SERVER_MENU_OFFLINE]=QObject::tr("Set online",contextName);
94 } 96 }
95 return _entries; 97 return _entries;
96} 98}
97 99
98void POP3viewItem::disconnect() 100void POP3viewItem::disconnect()
99{ 101{
100 QListViewItem *child = firstChild(); 102 QListViewItem *child = firstChild();
101 while ( child ) 103 while ( child )
102 { 104 {
103 QListViewItem *tmp = child; 105 QListViewItem *tmp = child;
104 child = child->nextSibling(); 106 child = child->nextSibling();
105 delete tmp; 107 delete tmp;
106 } 108 }
107 wrapper->logout(); 109 wrapper->logout();
108} 110}
109 111
110void POP3viewItem::setOnOffline() 112void POP3viewItem::setOnOffline()
111{ 113{
112 if (!account->getOffline()) 114 if (!account->getOffline())
113 { 115 {
114 disconnect(); 116 disconnect();
115 } 117 }
116 account->setOffline(!account->getOffline()); 118 account->setOffline(!account->getOffline());
117 account->save(); 119 account->save();
118 SETPIX(PIXMAP_POP3FOLDER); 120 SETPIX(PIXMAP_POP3FOLDER);
119 refresh(); 121 refresh();
120} 122}
121 123
122bool POP3viewItem::contextMenuSelected(int which) 124bool POP3viewItem::contextMenuSelected(int which)
123{ 125{
124 switch (which) 126 switch (which)
125 { 127 {
126 case SERVER_MENU_DISCONNECT: 128 case SERVER_MENU_DISCONNECT:
127 disconnect(); 129 disconnect();
128 break; 130 break;
129 case SERVER_MENU_OFFLINE: 131 case SERVER_MENU_OFFLINE:
130 setOnOffline(); 132 setOnOffline();
131 break; 133 break;
132 } 134 }
133 return false; 135 return false;
134} 136}
135 137
136POP3folderItem::~POP3folderItem() 138POP3folderItem::~POP3folderItem()
137{} 139{}
138 140
139POP3folderItem::POP3folderItem( const FolderP&folderInit, POP3viewItem *parent , QListViewItem*after ) 141POP3folderItem::POP3folderItem( const FolderP&folderInit, POP3viewItem *parent , QListViewItem*after )
140 : AccountViewItem(folderInit,parent,after ) 142 : AccountViewItem(folderInit,parent,after )
141{ 143{
142 pop3 = parent; 144 pop3 = parent;
143 if (folder->getDisplayName().lower()!="inbox") 145 if (folder->getDisplayName().lower()!="inbox")
144 { 146 {
145 setPixmap( 0, PIXMAP_POP3FOLDER ); 147 setPixmap( 0, PIXMAP_POP3FOLDER );
146 } 148 }
147 else 149 else
148 { 150 {
149 setPixmap( 0, PIXMAP_INBOXFOLDER); 151 setPixmap( 0, PIXMAP_INBOXFOLDER);
150 } 152 }
151 setText( 0, folder->getDisplayName() ); 153 setText( 0, folder->getDisplayName() );
152} 154}
153 155
154void POP3folderItem::refresh(QValueList<RecMailP>&target) 156void POP3folderItem::refresh(QValueList<RecMailP>&target)
155{ 157{
156 if (folder->may_select()) 158 if (folder->may_select())
157 pop3->getWrapper()->listMessages( folder->getName(),target ); 159 pop3->getWrapper()->listMessages( folder->getName(),target );
158} 160}
159 161
160RECBODYP POP3folderItem::fetchBody(const RecMailP&aMail) 162RECBODYP POP3folderItem::fetchBody(const RecMailP&aMail)
161{ 163{
162 return pop3->getWrapper()->fetchBody(aMail); 164 return pop3->getWrapper()->fetchBody(aMail);
163} 165}
164 166
165QMap<int,QString> POP3folderItem::folderMenu() 167QMap<int,QString> POP3folderItem::folderMenu()
166{ 168{
167 QMap<int,QString> _entries; 169 QMap<int,QString> _entries;
168 _entries[FOLDER_MENU_REFRESH_HEADER]=QObject::tr("Refresh header list",contextName); 170 _entries[FOLDER_MENU_REFRESH_HEADER]=QObject::tr("Refresh header list",contextName);
169 _entries[FOLDER_MENU_DELETE_ALL_MAILS]=QObject::tr("Delete all mails",contextName); 171 _entries[FOLDER_MENU_DELETE_ALL_MAILS]=QObject::tr("Delete all mails",contextName);
170 _entries[FOLDER_MENU_MOVE_MAILS]=QObject::tr("Move/Copie all mails",contextName); 172 _entries[FOLDER_MENU_MOVE_MAILS]=QObject::tr("Move/Copie all mails",contextName);
171 return _entries; 173 return _entries;
172} 174}
173 175
174void POP3folderItem::downloadMails() 176void POP3folderItem::downloadMails()
175{ 177{
176 AccountView*bl = pop3->accountView(); 178 AccountView*bl = pop3->accountView();
177 if (!bl) return; 179 if (!bl) return;
178 bl->downloadMails(folder,pop3->getWrapper()); 180 bl->downloadMails(folder,pop3->getWrapper());
179} 181}
180 182
181bool POP3folderItem::contextMenuSelected(int which) 183bool POP3folderItem::contextMenuSelected(int which)
182{ 184{
183 AccountView * view = (AccountView*)listView(); 185 AccountView * view = (AccountView*)listView();
184 switch (which) 186 switch (which)
185 { 187 {
186 case FOLDER_MENU_REFRESH_HEADER: 188 case FOLDER_MENU_REFRESH_HEADER:
187 /* must be 'cause pop3 lists are cached */ 189 /* must be 'cause pop3 lists are cached */
188 pop3->getWrapper()->logout(); 190 pop3->getWrapper()->logout();
189 view->refreshCurrent(); 191 view->refreshCurrent();
190 break; 192 break;
191 case FOLDER_MENU_DELETE_ALL_MAILS: 193 case FOLDER_MENU_DELETE_ALL_MAILS:
192 deleteAllMail(pop3->getWrapper(),folder); 194 deleteAllMail(pop3->getWrapper(),folder);
193 break; 195 break;
194 case FOLDER_MENU_MOVE_MAILS: 196 case FOLDER_MENU_MOVE_MAILS:
195 downloadMails(); 197 downloadMails();
196 break; 198 break;
197 default: 199 default:
198 break; 200 break;
199 } 201 }
200 return false; 202 return false;
201} 203}
202 204
203/** 205/**
204 * NNTP Account stuff 206 * NNTP Account stuff
205 */ 207 */
206NNTPviewItem::NNTPviewItem( NNTPaccount *a, AccountView *parent ) 208NNTPviewItem::NNTPviewItem( NNTPaccount *a, AccountView *parent )
207 : AccountViewItem( parent ) 209 : AccountViewItem( parent )
208{ 210{
209 account = a; 211 account = a;
210 wrapper = AbstractMail::getWrapper( account ); 212 wrapper = AbstractMail::getWrapper( account );
211 //FIXME 213 //FIXME
212 SETPIX(PIXMAP_POP3FOLDER); 214 SETPIX(PIXMAP_POP3FOLDER);
213#if 0 215#if 0
214 if (!account->getOffline()) 216 if (!account->getOffline())
215 { 217 {
216 setPixmap( 0, ); 218 setPixmap( 0, );
217 } 219 }
218 else 220 else
219 { 221 {
220 setPixmap( 0, PIXMAP_OFFLINE ); 222 setPixmap( 0, PIXMAP_OFFLINE );
221 } 223 }
222#endif 224#endif
223 setText( 0, account->getAccountName() ); 225 setText( 0, account->getAccountName() );
224 setOpen( true ); 226 setOpen( true );
225} 227}
226 228
227NNTPviewItem::~NNTPviewItem() 229NNTPviewItem::~NNTPviewItem()
228{ 230{
229 delete wrapper; 231 delete wrapper;
230} 232}
231 233
232AbstractMail *NNTPviewItem::getWrapper() 234AbstractMail *NNTPviewItem::getWrapper()
233{ 235{
234 return wrapper; 236 return wrapper;
235} 237}
236 238
237void NNTPviewItem::refresh( QValueList<RecMailP> & ) 239void NNTPviewItem::refresh( QValueList<RecMailP> & )
238{ 240{
239 refresh(); 241 refresh();
240} 242}
241 243
242void NNTPviewItem::refresh() 244void NNTPviewItem::refresh()
243{ 245{
244 if (account->getOffline()) return; 246 if (account->getOffline()) return;
245 QValueList<FolderP> *folders = wrapper->listFolders(); 247 QValueList<FolderP> *folders = wrapper->listFolders();
246 248
247 QListViewItem *child = firstChild(); 249 QListViewItem *child = firstChild();
248 while ( child ) 250 while ( child )
249 { 251 {
250 QListViewItem *tmp = child; 252 QListViewItem *tmp = child;
251 child = child->nextSibling(); 253 child = child->nextSibling();
252 delete tmp; 254 delete tmp;
253 } 255 }
254 QValueList<FolderP>::ConstIterator it; 256 QValueList<FolderP>::ConstIterator it;
255 QListViewItem*item = 0; 257 QListViewItem*item = 0;
256 for ( it = folders->begin(); it!=folders->end(); ++it) 258 for ( it = folders->begin(); it!=folders->end(); ++it)
257 { 259 {
258 item = new NNTPfolderItem( (*it), this , item ); 260 item = new NNTPfolderItem( (*it), this , item );
259 item->setSelectable( (*it)->may_select()); 261 item->setSelectable( (*it)->may_select());
260 } 262 }
261 delete folders; 263 delete folders;
262} 264}
263 265
264RECBODYP NNTPviewItem::fetchBody( const RecMailP &mail ) 266RECBODYP NNTPviewItem::fetchBody( const RecMailP &mail )
265{ 267{
266 odebug << "NNTP fetchBody" << oendl; 268 odebug << "NNTP fetchBody" << oendl;
267 return wrapper->fetchBody( mail ); 269 return wrapper->fetchBody( mail );
268} 270}
269 271
270QMap<int,QString> NNTPviewItem::serverMenu() 272QMap<int,QString> NNTPviewItem::serverMenu()
271{ 273{
272 QMap<int,QString> _entries; 274 QMap<int,QString> _entries;
273 if (!account->getOffline()) 275 if (!account->getOffline())
274 { 276 {
275 _entries[SERVER_MENU_DISCONNECT]=QObject::tr("Disconnect",contextName); 277 _entries[SERVER_MENU_DISCONNECT]=QObject::tr("Disconnect",contextName);
276 _entries[SERVER_MENU_OFFLINE]=QObject::tr("Set offline",contextName); 278 _entries[SERVER_MENU_OFFLINE]=QObject::tr("Set offline",contextName);
277 _entries[SERVER_MENU_SUBSCRIBE]=QObject::tr("(Un-)Subscribe groups",contextName); 279 _entries[SERVER_MENU_SUBSCRIBE]=QObject::tr("(Un-)Subscribe groups",contextName);
278 } else { 280 } else {
279 _entries[SERVER_MENU_OFFLINE]=QObject::tr("Set online",contextName); 281 _entries[SERVER_MENU_OFFLINE]=QObject::tr("Set online",contextName);
280 } 282 }
281 return _entries; 283 return _entries;
282} 284}
283 285
284void NNTPviewItem::subscribeGroups() 286void NNTPviewItem::subscribeGroups()
285{ 287{
286 NNTPGroupsDlg dlg(account); 288 NNTPGroupsDlg dlg(account);
287 if (QPEApplication::execDialog(&dlg)== QDialog::Accepted ){ 289 if (QPEApplication::execDialog(&dlg)== QDialog::Accepted ){
288 refresh(); 290 refresh();
289 } 291 }
290} 292}
291 293
292void NNTPviewItem::disconnect() 294void NNTPviewItem::disconnect()
293{ 295{
294 QListViewItem *child = firstChild(); 296 QListViewItem *child = firstChild();
295 while ( child ) 297 while ( child )
296 { 298 {
297 QListViewItem *tmp = child; 299 QListViewItem *tmp = child;
298 child = child->nextSibling(); 300 child = child->nextSibling();
299 delete tmp; 301 delete tmp;
300 } 302 }
301 wrapper->logout(); 303 wrapper->logout();
302} 304}
303 305
304void NNTPviewItem::setOnOffline() 306void NNTPviewItem::setOnOffline()
305{ 307{
306 if (!account->getOffline()) 308 if (!account->getOffline())
307 { 309 {
308 disconnect(); 310 disconnect();
309 } 311 }
310 account->setOffline(!account->getOffline()); 312 account->setOffline(!account->getOffline());
311 account->save(); 313 account->save();
312 //FIXME 314 //FIXME
313 SETPIX(PIXMAP_POP3FOLDER); 315 SETPIX(PIXMAP_POP3FOLDER);
314 refresh(); 316 refresh();
315} 317}
316 318
317bool NNTPviewItem::contextMenuSelected(int which) 319bool NNTPviewItem::contextMenuSelected(int which)
318{ 320{
319 switch (which) 321 switch (which)
320 { 322 {
321 case SERVER_MENU_DISCONNECT: 323 case SERVER_MENU_DISCONNECT:
322 disconnect(); 324 disconnect();
323 break; 325 break;
324 case SERVER_MENU_OFFLINE: 326 case SERVER_MENU_OFFLINE:
325 setOnOffline(); 327 setOnOffline();
326 break; 328 break;
327 case SERVER_MENU_SUBSCRIBE: 329 case SERVER_MENU_SUBSCRIBE:
328 subscribeGroups(); 330 subscribeGroups();
329 break; 331 break;
330 } 332 }
331 return false; 333 return false;
332} 334}
333 335
334NNTPfolderItem::~NNTPfolderItem() 336NNTPfolderItem::~NNTPfolderItem()
335{} 337{}
336 338
337NNTPfolderItem::NNTPfolderItem( const FolderP &folderInit, NNTPviewItem *parent , QListViewItem*after ) 339NNTPfolderItem::NNTPfolderItem( const FolderP &folderInit, NNTPviewItem *parent , QListViewItem*after )
338 : AccountViewItem( folderInit, parent,after ) 340 : AccountViewItem( folderInit, parent,after )
339{ 341{
340 nntp = parent; 342 nntp = parent;
341 if (folder->getDisplayName().lower()!="inbox") 343 if (folder->getDisplayName().lower()!="inbox")
342 { 344 {
343 setPixmap( 0, PIXMAP_POP3FOLDER ); 345 setPixmap( 0, PIXMAP_POP3FOLDER );
344 } 346 }
345 else 347 else
346 { 348 {
347 setPixmap( 0, PIXMAP_INBOXFOLDER); 349 setPixmap( 0, PIXMAP_INBOXFOLDER);
348 } 350 }
349 setText( 0, folder->getDisplayName() ); 351 setText( 0, folder->getDisplayName() );
350} 352}
351 353
352void NNTPfolderItem::refresh(QValueList<RecMailP>&target) 354void NNTPfolderItem::refresh(QValueList<RecMailP>&target)
353{ 355{
354 if (folder->may_select()) 356 if (folder->may_select())
355 nntp->getWrapper()->listMessages( folder->getName(),target ); 357 nntp->getWrapper()->listMessages( folder->getName(),target );
356} 358}
357 359
358RECBODYP NNTPfolderItem::fetchBody(const RecMailP&aMail) 360RECBODYP NNTPfolderItem::fetchBody(const RecMailP&aMail)
359{ 361{
360 return nntp->getWrapper()->fetchBody(aMail); 362 return nntp->getWrapper()->fetchBody(aMail);
361} 363}
362 364
363QMap<int,QString> NNTPfolderItem::folderMenu() 365QMap<int,QString> NNTPfolderItem::folderMenu()
364{ 366{
365 QMap<int,QString> _entries; 367 QMap<int,QString> _entries;
366 _entries[FOLDER_MENU_REFRESH_HEADER]=QObject::tr("Refresh header list",contextName); 368 _entries[FOLDER_MENU_REFRESH_HEADER]=QObject::tr("Refresh header list",contextName);
367 _entries[FOLDER_MENU_MOVE_MAILS]=QObject::tr("Copy all postings",contextName); 369 _entries[FOLDER_MENU_MOVE_MAILS]=QObject::tr("Copy all postings",contextName);
368 return _entries; 370 return _entries;
369} 371}
370 372
371void NNTPfolderItem::downloadMails() 373void NNTPfolderItem::downloadMails()
372{ 374{
373 AccountView*bl = nntp->accountView(); 375 AccountView*bl = nntp->accountView();
374 if (!bl) return; 376 if (!bl) return;
375 bl->downloadMails(folder,nntp->getWrapper()); 377 bl->downloadMails(folder,nntp->getWrapper());
376} 378}
377 379
378bool NNTPfolderItem::contextMenuSelected(int which) 380bool NNTPfolderItem::contextMenuSelected(int which)
379{ 381{
380 AccountView * view = (AccountView*)listView(); 382 AccountView * view = (AccountView*)listView();
381 switch (which) 383 switch (which)
382 { 384 {
383 case FOLDER_MENU_REFRESH_HEADER: 385 case FOLDER_MENU_REFRESH_HEADER:
384 /* must be 'cause nntp lists are cached */ 386 /* must be 'cause nntp lists are cached */
385 nntp->getWrapper()->logout(); 387 nntp->getWrapper()->logout();
386 view->refreshCurrent(); 388 view->refreshCurrent();
387 break; 389 break;
388 case FOLDER_MENU_MOVE_MAILS: 390 case FOLDER_MENU_MOVE_MAILS:
389 downloadMails(); 391 downloadMails();
390 break; 392 break;
391 default: 393 default:
392 break; 394 break;
393 } 395 }
394 return false; 396 return false;
395} 397}
396 398
397/** 399/**
398 * IMAP Account stuff 400 * IMAP Account stuff
399 */ 401 */
400IMAPviewItem::IMAPviewItem( IMAPaccount *a, AccountView *parent ) 402IMAPviewItem::IMAPviewItem( IMAPaccount *a, AccountView *parent )
401 : AccountViewItem( parent ) 403 : AccountViewItem( parent )
402{ 404{
403 account = a; 405 account = a;
404 wrapper = AbstractMail::getWrapper( account ); 406 wrapper = AbstractMail::getWrapper( account );
405 SETPIX(PIXMAP_IMAPFOLDER); 407 SETPIX(PIXMAP_IMAPFOLDER);
406 setText( 0, account->getAccountName() ); 408 setText( 0, account->getAccountName() );
407 setOpen( true ); 409 setOpen( true );
408} 410}
409 411
410IMAPviewItem::~IMAPviewItem() 412IMAPviewItem::~IMAPviewItem()
411{ 413{
412 delete wrapper; 414 delete wrapper;
413} 415}
414 416
415AbstractMail *IMAPviewItem::getWrapper() 417AbstractMail *IMAPviewItem::getWrapper()
416{ 418{
417 return wrapper; 419 return wrapper;
418} 420}
419 421
420void IMAPviewItem::refresh(QValueList<RecMailP>&) 422void IMAPviewItem::refresh(QValueList<RecMailP>&)
421{ 423{
422 refreshFolders(false); 424 refreshFolders(false);
423} 425}
424 426
425const QStringList&IMAPviewItem::subFolders() 427const QStringList&IMAPviewItem::subFolders()
426{ 428{
427 return currentFolders; 429 return currentFolders;
428} 430}
429 431
430void IMAPviewItem::refreshFolders(bool force) 432void IMAPviewItem::refreshFolders(bool force)
431{ 433{
432 if (childCount()>0 && force==false) return; 434 if (childCount()>0 && force==false) return;
433 if (account->getOffline()) return; 435 if (account->getOffline()) return;
434 436
435 removeChilds(); 437 removeChilds();
436 currentFolders.clear(); 438 currentFolders.clear();
437 QValueList<FolderP> * folders = wrapper->listFolders(); 439 QValueList<FolderP> * folders = wrapper->listFolders();
438 440
439 QValueList<FolderP>::Iterator it; 441 QValueList<FolderP>::Iterator it;
440 QListViewItem*item = 0; 442 QListViewItem*item = 0;
441 QListViewItem*titem = 0; 443 QListViewItem*titem = 0;
442 QString fname,del,search; 444 QString fname,del,search;
443 int pos; 445 int pos;
444 446
445 for ( it = folders->begin(); it!=folders->end(); ++it) 447 for ( it = folders->begin(); it!=folders->end(); ++it)
446 { 448 {
447 if ((*it)->getDisplayName().lower()=="inbox") 449 if ((*it)->getDisplayName().lower()=="inbox")
448 { 450 {
449 item = new IMAPfolderItem( (*it), this , item ); 451 item = new IMAPfolderItem( (*it), this , item );
450 folders->remove(it); 452 folders->remove(it);
451 odebug << "inbox found" << oendl; 453 odebug << "inbox found" << oendl;
452 break; 454 break;
453 } 455 }
454 } 456 }
455 for ( it = folders->begin(); it!=folders->end(); ++it) 457 for ( it = folders->begin(); it!=folders->end(); ++it)
456 { 458 {
457 fname = (*it)->getDisplayName(); 459 fname = (*it)->getDisplayName();
458 currentFolders.append((*it)->getName()); 460 currentFolders.append((*it)->getName());
459 pos = fname.findRev((*it)->Separator()); 461 pos = fname.findRev((*it)->Separator());
460 if (pos != -1) 462 if (pos != -1)
461 { 463 {
462 fname = fname.left(pos); 464 fname = fname.left(pos);
463 } 465 }
464 IMAPfolderItem*pitem = (IMAPfolderItem*)findSubItem(fname); 466 IMAPfolderItem*pitem = (IMAPfolderItem*)findSubItem(fname);
465 if (pitem) 467 if (pitem)
466 { 468 {
467 titem = item; 469 titem = item;
468 item = new IMAPfolderItem( (*it),pitem,pitem->firstChild(),this); 470 item = new IMAPfolderItem( (*it),pitem,pitem->firstChild(),this);
469 /* setup the short name */ 471 /* setup the short name */
470 item->setText(0,(*it)->getDisplayName().right((*it)->getDisplayName().length()-pos-1)); 472 item->setText(0,(*it)->getDisplayName().right((*it)->getDisplayName().length()-pos-1));
471 item = titem; 473 item = titem;
472 } 474 }
473 else 475 else
474 { 476 {
475 item = new IMAPfolderItem( (*it), this , item ); 477 item = new IMAPfolderItem( (*it), this , item );
476 } 478 }
477 } 479 }
478 delete folders; 480 delete folders;
479} 481}
480 482
481QMap<int,QString> IMAPviewItem::serverMenu() 483QMap<int,QString> IMAPviewItem::serverMenu()
482{ 484{
483 QMap<int,QString> e; 485 QMap<int,QString> e;
484 if (!account->getOffline()) { 486 if (!account->getOffline()) {
485 e[SERVER_MENU_DISCONNECT]=QObject::tr("Disconnect",contextName); 487 e[SERVER_MENU_DISCONNECT]=QObject::tr("Disconnect",contextName);
486 e[SERVER_MENU_OFFLINE]=QObject::tr("Set offline",contextName); 488 e[SERVER_MENU_OFFLINE]=QObject::tr("Set offline",contextName);
487 e[SERVER_MENU_REFRESH_FOLDER]=QObject::tr("Refresh folder list",contextName); 489 e[SERVER_MENU_REFRESH_FOLDER]=QObject::tr("Refresh folder list",contextName);
488 e[SERVER_MENU_CREATE_FOLDER]=QObject::tr("Create new folder",contextName); 490 e[SERVER_MENU_CREATE_FOLDER]=QObject::tr("Create new folder",contextName);
489 } else { 491 } else {
490 e[SERVER_MENU_OFFLINE]=QObject::tr("Set online",contextName); 492 e[SERVER_MENU_OFFLINE]=QObject::tr("Set online",contextName);
491 } 493 }
492 return e; 494 return e;
493} 495}
494 496
495void IMAPviewItem::createNewFolder() 497void IMAPviewItem::createNewFolder()
496{ 498{
497 Newmdirdlg ndirdlg; 499 Newmdirdlg ndirdlg;
498 if ( QPEApplication::execDialog( &ndirdlg )) 500 if ( QPEApplication::execDialog( &ndirdlg ))
499 { 501 {
500 QString ndir = ndirdlg.Newdir(); 502 QString ndir = ndirdlg.Newdir();
501 bool makesubs = ndirdlg.subpossible(); 503 bool makesubs = ndirdlg.subpossible();
502 QString delemiter = "/"; 504 QString delemiter = "/";
503 IMAPfolderItem*item = (IMAPfolderItem*)firstChild(); 505 IMAPfolderItem*item = (IMAPfolderItem*)firstChild();
504 if (item) 506 if (item)
505 { 507 {
506 delemiter = item->Delemiter(); 508 delemiter = item->Delemiter();
507 } 509 }
508 if (wrapper->createMbox(ndir,0,delemiter,makesubs)) 510 if (wrapper->createMbox(ndir,0,delemiter,makesubs))
509 { 511 {
510 refreshFolders(true); 512 refreshFolders(true);
511 } 513 }
512 } 514 }
513} 515}
514 516
515bool IMAPviewItem::contextMenuSelected(int id) 517bool IMAPviewItem::contextMenuSelected(int id)
516{ 518{
517 odebug << "Id selected: " << id << "" << oendl; 519 odebug << "Id selected: " << id << "" << oendl;
518 switch (id) 520 switch (id)
519 { 521 {
520 case SERVER_MENU_REFRESH_FOLDER: 522 case SERVER_MENU_REFRESH_FOLDER:
521 refreshFolders(true); 523 refreshFolders(true);
522 break; 524 break;
523 case SERVER_MENU_CREATE_FOLDER: 525 case SERVER_MENU_CREATE_FOLDER:
524 createNewFolder(); 526 createNewFolder();
525 break; 527 break;
526 case SERVER_MENU_DISCONNECT: 528 case SERVER_MENU_DISCONNECT:
527 removeChilds(); 529 removeChilds();
528 wrapper->logout(); 530 wrapper->logout();
529 break; 531 break;
530 case SERVER_MENU_OFFLINE: 532 case SERVER_MENU_OFFLINE:
531 if (account->getOffline()==false) 533 if (account->getOffline()==false)
532 { 534 {
533 removeChilds(); 535 removeChilds();
534 wrapper->logout(); 536 wrapper->logout();
535 } 537 }
536 account->setOffline(!account->getOffline()); 538 account->setOffline(!account->getOffline());
537 account->save(); 539 account->save();
538 SETPIX(PIXMAP_IMAPFOLDER); 540 SETPIX(PIXMAP_IMAPFOLDER);
539 refreshFolders(false); 541 refreshFolders(false);
540 break; 542 break;
541 default: 543 default:
542 break; 544 break;
543 } 545 }
544 return false; 546 return false;
545} 547}
546 548
547RECBODYP IMAPviewItem::fetchBody(const RecMailP&) 549RECBODYP IMAPviewItem::fetchBody(const RecMailP&)
548{ 550{
549 return new RecBody(); 551 return new RecBody();
550} 552}
551 553
552bool IMAPviewItem::offline() 554bool IMAPviewItem::offline()
553{ 555{
554 return account->getOffline(); 556 return account->getOffline();
555} 557}
556 558
557IMAPfolderItem::IMAPfolderItem( const FolderP& folderInit, IMAPviewItem *parent , QListViewItem*after ) 559IMAPfolderItem::IMAPfolderItem( const FolderP& folderInit, IMAPviewItem *parent , QListViewItem*after )
558 : AccountViewItem( folderInit, parent , after ) 560 : AccountViewItem( folderInit, parent , after )
559{ 561{
560 imap = parent; 562 imap = parent;
561 if (folder->getDisplayName().lower()!="inbox") 563 if (folder->getDisplayName().lower()!="inbox")
562 { 564 {
563 setPixmap( 0, PIXMAP_IMAPFOLDER ); 565 setPixmap( 0, PIXMAP_IMAPFOLDER );
564 } 566 }
565 else 567 else
566 { 568 {
567 setPixmap( 0, PIXMAP_INBOXFOLDER); 569 setPixmap( 0, PIXMAP_INBOXFOLDER);
568 } 570 }
569 setText( 0, folder->getDisplayName() ); 571 setText( 0, folder->getDisplayName() );
570} 572}
571 573
572IMAPfolderItem::IMAPfolderItem(const FolderP &folderInit, IMAPfolderItem *parent , QListViewItem*after, IMAPviewItem *master ) 574IMAPfolderItem::IMAPfolderItem(const FolderP &folderInit, IMAPfolderItem *parent , QListViewItem*after, IMAPviewItem *master )
573 : AccountViewItem(folderInit, parent,after ) 575 : AccountViewItem(folderInit, parent,after )
574{ 576{
575 imap = master; 577 imap = master;
576 if (folder->getDisplayName().lower()!="inbox") 578 if (folder->getDisplayName().lower()!="inbox")
577 { 579 {
578 setPixmap( 0, PIXMAP_IMAPFOLDER ); 580 setPixmap( 0, PIXMAP_IMAPFOLDER );
579 } 581 }
580 else 582 else
581 { 583 {
582 setPixmap( 0, PIXMAP_INBOXFOLDER); 584 setPixmap( 0, PIXMAP_INBOXFOLDER);
583 } 585 }
584 setText( 0, folder->getDisplayName() ); 586 setText( 0, folder->getDisplayName() );
585} 587}
586 588
587IMAPfolderItem::~IMAPfolderItem() 589IMAPfolderItem::~IMAPfolderItem()
588{} 590{}
589 591
590const QString& IMAPfolderItem::Delemiter()const 592const QString& IMAPfolderItem::Delemiter()const
591{ 593{
592 return folder->Separator(); 594 return folder->Separator();
593} 595}
594 596
595void IMAPfolderItem::refresh(QValueList<RecMailP>&target) 597void IMAPfolderItem::refresh(QValueList<RecMailP>&target)
596{ 598{
597 if (folder->may_select()) 599 if (folder->may_select())
598 { 600 {
599 imap->getWrapper()->listMessages( folder->getName(),target ); 601 imap->getWrapper()->listMessages( folder->getName(),target );
600 } 602 }
601 else 603 else
602 { 604 {
603 target.clear(); 605 target.clear();
604 } 606 }
605} 607}
606 608
607RECBODYP IMAPfolderItem::fetchBody(const RecMailP&aMail) 609RECBODYP IMAPfolderItem::fetchBody(const RecMailP&aMail)
608{ 610{
609 return imap->getWrapper()->fetchBody(aMail); 611 return imap->getWrapper()->fetchBody(aMail);
610} 612}
611 613
612QMap<int,QString> IMAPfolderItem::folderMenu() 614QMap<int,QString> IMAPfolderItem::folderMenu()
613{ 615{
614 QMap<int,QString> e; 616 QMap<int,QString> e;
615 if (folder->may_select()) { 617 if (folder->may_select()) {
616 e[FOLDER_MENU_REFRESH_HEADER]=QObject::tr("Refresh header list",contextName); 618 e[FOLDER_MENU_REFRESH_HEADER]=QObject::tr("Refresh header list",contextName);
617 e[FOLDER_MENU_MOVE_MAILS]=QObject::tr("Move/Copy all mails",contextName); 619 e[FOLDER_MENU_MOVE_MAILS]=QObject::tr("Move/Copy all mails",contextName);
618 e[FOLDER_MENU_DELETE_ALL_MAILS]=QObject::tr("Delete all mails",contextName); 620 e[FOLDER_MENU_DELETE_ALL_MAILS]=QObject::tr("Delete all mails",contextName);
619 } 621 }
620 if (folder->no_inferior()==false) { 622 if (folder->no_inferior()==false) {
621 e[FOLDER_MENU_NEW_SUBFOLDER]=QObject::tr("Create new subfolder",contextName); 623 e[FOLDER_MENU_NEW_SUBFOLDER]=QObject::tr("Create new subfolder",contextName);
622 } 624 }
623 if (folder->getDisplayName().lower()!="inbox") { 625 if (folder->getDisplayName().lower()!="inbox") {
624 e[FOLDER_MENU_DELETE_FOLDER]=QObject::tr("Delete folder",contextName); 626 e[FOLDER_MENU_DELETE_FOLDER]=QObject::tr("Delete folder",contextName);
625 } 627 }
626 return e; 628 return e;
627} 629}
628 630
629void IMAPfolderItem::createNewFolder() 631void IMAPfolderItem::createNewFolder()
630{ 632{
631 Newmdirdlg ndirdlg; 633 Newmdirdlg ndirdlg;
632 if ( QPEApplication::execDialog( &ndirdlg ) ) 634 if ( QPEApplication::execDialog( &ndirdlg ) )
633 { 635 {
634 QString ndir = ndirdlg.Newdir(); 636 QString ndir = ndirdlg.Newdir();
635 bool makesubs = ndirdlg.subpossible(); 637 bool makesubs = ndirdlg.subpossible();
636 QString delemiter = Delemiter(); 638 QString delemiter = Delemiter();
637 if (imap->wrapper->createMbox(ndir,folder,delemiter,makesubs)) 639 if (imap->wrapper->createMbox(ndir,folder,delemiter,makesubs))
638 { 640 {
639 imap->refreshFolders(true); 641 imap->refreshFolders(true);
640 } 642 }
641 } 643 }
642} 644}
643 645
644bool IMAPfolderItem::deleteFolder() 646bool IMAPfolderItem::deleteFolder()
645{ 647{
646 int yesno = QMessageBox::warning(0,QObject::tr("Delete folder",contextName), 648 int yesno = QMessageBox::warning(0,QObject::tr("Delete folder",contextName),
647 QObject::tr("<center>Realy delete folder <br><b>%1</b><br>and all if it content?</center>",contextName).arg(folder->getDisplayName()), 649 QObject::tr("<center>Realy delete folder <br><b>%1</b><br>and all if it content?</center>",contextName).arg(folder->getDisplayName()),
648 QObject::tr("Yes",contextName), 650 QObject::tr("Yes",contextName),
649 QObject::tr("No",contextName),QString::null,1,1); 651 QObject::tr("No",contextName),QString::null,1,1);
650 odebug << "Auswahl: " << yesno << "" << oendl; 652 odebug << "Auswahl: " << yesno << "" << oendl;
651 if (yesno == 0) 653 if (yesno == 0)
652 { 654 {
653 if (imap->getWrapper()->deleteMbox(folder)) 655 if (imap->getWrapper()->deleteMbox(folder))
654 { 656 {
655 QListView*v=listView(); 657 QListView*v=listView();
656 IMAPviewItem * box = imap; 658 IMAPviewItem * box = imap;
657 /* be carefull - after that this object is destroyd so don't use 659 /* be carefull - after that this object is destroyd so don't use
658 * any member of it after that call!!*/ 660 * any member of it after that call!!*/
659 imap->refreshFolders(true); 661 imap->refreshFolders(true);
660 if (v) 662 if (v)
661 { 663 {
662 v->setSelected(box,true); 664 v->setSelected(box,true);
663 } 665 }
664 return true; 666 return true;
665 } 667 }
666 } 668 }
667 return false; 669 return false;
668} 670}
669 671
670void IMAPfolderItem::downloadMails() 672void IMAPfolderItem::downloadMails()
671{ 673{
672 AccountView*bl = imap->accountView(); 674 AccountView*bl = imap->accountView();
673 if (!bl) return; 675 if (!bl) return;
674 bl->downloadMails(folder,imap->getWrapper()); 676 bl->downloadMails(folder,imap->getWrapper());
675} 677}
676 678
677bool IMAPfolderItem::contextMenuSelected(int id) 679bool IMAPfolderItem::contextMenuSelected(int id)
678{ 680{
679 odebug << "Selected id: " << id << "" << oendl; 681 odebug << "Selected id: " << id << "" << oendl;
680 AccountView * view = (AccountView*)listView(); 682 AccountView * view = (AccountView*)listView();
681 switch(id) 683 switch(id)
682 { 684 {
683 case FOLDER_MENU_REFRESH_HEADER: 685 case FOLDER_MENU_REFRESH_HEADER:
684 view->refreshCurrent(); 686 view->refreshCurrent();
685 break; 687 break;
686 case FOLDER_MENU_DELETE_ALL_MAILS: 688 case FOLDER_MENU_DELETE_ALL_MAILS:
687 deleteAllMail(imap->getWrapper(),folder); 689 deleteAllMail(imap->getWrapper(),folder);
688 break; 690 break;
689 case FOLDER_MENU_NEW_SUBFOLDER: 691 case FOLDER_MENU_NEW_SUBFOLDER:
690 if (folder->no_inferior()==false) { 692 if (folder->no_inferior()==false) {
691 createNewFolder(); 693 createNewFolder();
692 } 694 }
693 break; 695 break;
694 case FOLDER_MENU_DELETE_FOLDER: 696 case FOLDER_MENU_DELETE_FOLDER:
695 if (folder->getDisplayName().lower()!="inbox") { 697 if (folder->getDisplayName().lower()!="inbox") {
696 return deleteFolder(); 698 return deleteFolder();
697 } 699 }
698 break; 700 break;
699 case FOLDER_MENU_MOVE_MAILS: 701 case FOLDER_MENU_MOVE_MAILS:
700 downloadMails(); 702 downloadMails();
701 break; 703 break;
702 default: 704 default:
703 break; 705 break;
704 } 706 }
705 return false; 707 return false;
706} 708}
707 709
708/** 710/**
709 * MH Account stuff 711 * MH Account stuff
710 */ 712 */
711/* MH is a little bit different - the top folder can contains messages other than in IMAP and 713/* MH is a little bit different - the top folder can contains messages other than in IMAP and
712 POP3 and MBOX */ 714 POP3 and MBOX */
713MHviewItem::MHviewItem( const QString&aPath, AccountView *parent ) 715MHviewItem::MHviewItem( const QString&aPath, AccountView *parent )
714 : AccountViewItem( parent ) 716 : AccountViewItem( parent )
715{ 717{
716 m_Path = aPath; 718 m_Path = aPath;
717 /* be carefull - the space within settext is wanted - thats why the string twice */ 719 /* be carefull - the space within settext is wanted - thats why the string twice */
718 wrapper = AbstractMail::getWrapper( m_Path,"Local Folders"); 720 wrapper = AbstractMail::getWrapper( m_Path,"Local Folders");
719 setPixmap( 0, PIXMAP_LOCALFOLDER ); 721 setPixmap( 0, PIXMAP_LOCALFOLDER );
720 setText( 0, " Local Folders" ); 722 setText( 0, " Local Folders" );
721 setOpen( true ); 723 setOpen( true );
722 folder = 0; 724 folder = 0;
723} 725}
724 726
725MHviewItem::~MHviewItem() 727MHviewItem::~MHviewItem()
726{ 728{
727 delete wrapper; 729 delete wrapper;
728} 730}
729 731
730AbstractMail *MHviewItem::getWrapper() 732AbstractMail *MHviewItem::getWrapper()
731{ 733{
732 return wrapper; 734 return wrapper;
733} 735}
734 736
735void MHviewItem::refresh( QValueList<RecMailP> & target) 737void MHviewItem::refresh( QValueList<RecMailP> & target)
736{ 738{
737 refresh(false); 739 refresh(false);
738 getWrapper()->listMessages( "",target ); 740 getWrapper()->listMessages( "",target );
739} 741}
740 742
741void MHviewItem::refresh(bool force) 743void MHviewItem::refresh(bool force)
742{ 744{
743 if (childCount()>0 && force==false) return; 745 if (childCount()>0 && force==false) return;
744 odebug << "Refresh mh folders" << oendl; 746 odebug << "Refresh mh folders" << oendl;
745 removeChilds(); 747 removeChilds();
746 currentFolders.clear(); 748 currentFolders.clear();
747 QValueList<FolderP> *folders = wrapper->listFolders(); 749 QValueList<FolderP> *folders = wrapper->listFolders();
748 QValueList<FolderP>::ConstIterator it; 750 QValueList<FolderP>::ConstIterator it;
749 MHfolderItem*item = 0; 751 MHfolderItem*item = 0;
750 MHfolderItem*pmaster = 0; 752 MHfolderItem*pmaster = 0;
751 QString fname = ""; 753 QString fname = "";
752 int pos; 754 int pos;
753 for ( it = folders->begin(); it!=folders->end(); ++it) 755 for ( it = folders->begin(); it!=folders->end(); ++it)
754 { 756 {
755 fname = (*it)->getDisplayName(); 757 fname = (*it)->getDisplayName();
756 /* this folder itself */ 758 /* this folder itself */
757 if (fname=="/") 759 if (fname=="/")
758 { 760 {
759 currentFolders.append(fname); 761 currentFolders.append(fname);
760 folder = (*it); 762 folder = (*it);
761 continue; 763 continue;
762 } 764 }
763 currentFolders.append(fname); 765 currentFolders.append(fname);
764 pos = fname.findRev("/"); 766 pos = fname.findRev("/");
765 if (pos > 0) 767 if (pos > 0)
766 { 768 {
767 fname = fname.left(pos); 769 fname = fname.left(pos);
768 pmaster = (MHfolderItem*)findSubItem(fname); 770 pmaster = (MHfolderItem*)findSubItem(fname);
769 } 771 }
770 else 772 else
771 { 773 {
772 pmaster = 0; 774 pmaster = 0;
773 } 775 }
774 if (pmaster) 776 if (pmaster)
775 { 777 {
776 item = new MHfolderItem( (*it), pmaster, item, this ); 778 item = new MHfolderItem( (*it), pmaster, item, this );
777 } 779 }
778 else 780 else
779 { 781 {
780 item = new MHfolderItem( (*it), this , item ); 782 item = new MHfolderItem( (*it), this , item );
781 } 783 }
782 item->setSelectable((*it)->may_select()); 784 item->setSelectable((*it)->may_select());
783 } 785 }
784 delete folders; 786 delete folders;
785} 787}
786 788
787RECBODYP MHviewItem::fetchBody( const RecMailP &mail ) 789RECBODYP MHviewItem::fetchBody( const RecMailP &mail )
788{ 790{
789 odebug << "MH fetchBody" << oendl; 791 odebug << "MH fetchBody" << oendl;
790 return wrapper->fetchBody( mail ); 792 return wrapper->fetchBody( mail );
791} 793}
792 794
793QMap<int,QString> MHviewItem::serverMenu() 795QMap<int,QString> MHviewItem::serverMenu()
794{ 796{
795 QMap<int,QString> e; 797 QMap<int,QString> e;
796 e[SERVER_MENU_REFRESH_FOLDER]=QObject::tr("Refresh folder list",contextName); 798 e[SERVER_MENU_REFRESH_FOLDER]=QObject::tr("Refresh folder list",contextName);
797 return e; 799 return e;
798} 800}
799 801
800QMap<int,QString> MHviewItem::folderMenu() 802QMap<int,QString> MHviewItem::folderMenu()
801{ 803{
802 QMap<int,QString> e; 804 QMap<int,QString> e;
803 e[FOLDER_MENU_REFRESH_HEADER]=QObject::tr("Refresh header list",contextName); 805 e[FOLDER_MENU_REFRESH_HEADER]=QObject::tr("Refresh header list",contextName);
804 e[FOLDER_MENU_NEW_SUBFOLDER]=QObject::tr("Create new folder",contextName); 806 e[FOLDER_MENU_NEW_SUBFOLDER]=QObject::tr("Create new folder",contextName);
805 e[FOLDER_MENU_DELETE_ALL_MAILS]=QObject::tr("Delete all mails",contextName); 807 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); 808 e[FOLDER_MENU_MOVE_MAILS]=QObject::tr("Move/Copie all mails",contextName);
807 return e; 809 return e;
808} 810}
809 811
810void MHviewItem::createFolder() 812void MHviewItem::createFolder()
811{ 813{
812 Newmdirdlg ndirdlg(0,0,true); 814 Newmdirdlg ndirdlg(0,0,true);
813 if ( QPEApplication::execDialog( &ndirdlg ) ) 815 if ( QPEApplication::execDialog( &ndirdlg ) )
814 { 816 {
815 QString ndir = ndirdlg.Newdir(); 817 QString ndir = ndirdlg.Newdir();
816 if (wrapper->createMbox(ndir)) 818 if (wrapper->createMbox(ndir))
817 { 819 {
818 refresh(true); 820 refresh(true);
819 } 821 }
820 } 822 }
821} 823}
822 824
823void MHviewItem::downloadMails() 825void MHviewItem::downloadMails()
824{ 826{
825 AccountView*bl = accountView(); 827 AccountView*bl = accountView();
826 if (!bl) return; 828 if (!bl) return;
827 bl->downloadMails(folder,getWrapper()); 829 bl->downloadMails(folder,getWrapper());
828} 830}
829 831
830QStringList MHviewItem::subFolders() 832QStringList MHviewItem::subFolders()
831{ 833{
832 return currentFolders; 834 return currentFolders;
833} 835}
834 836
835bool MHviewItem::contextMenuSelected(int which) 837bool MHviewItem::contextMenuSelected(int which)
836{ 838{
837 AccountView*view = 0; 839 AccountView*view = 0;
838 840
839 switch (which) 841 switch (which)
840 { 842 {
841 case SERVER_MENU_REFRESH_FOLDER: 843 case SERVER_MENU_REFRESH_FOLDER:
842 refresh(true); 844 refresh(true);
843 break; 845 break;
844 case FOLDER_MENU_NEW_SUBFOLDER: 846 case FOLDER_MENU_NEW_SUBFOLDER:
845 createFolder(); 847 createFolder();
846 break; 848 break;
847 case FOLDER_MENU_DELETE_ALL_MAILS: 849 case FOLDER_MENU_DELETE_ALL_MAILS:
848 deleteAllMail(getWrapper(),folder); 850 deleteAllMail(getWrapper(),folder);
849 break; 851 break;
850 case FOLDER_MENU_MOVE_MAILS: 852 case FOLDER_MENU_MOVE_MAILS:
851 downloadMails(); 853 downloadMails();
852 break; 854 break;
853 case FOLDER_MENU_REFRESH_HEADER: 855 case FOLDER_MENU_REFRESH_HEADER:
854 view = (AccountView*)listView(); 856 view = (AccountView*)listView();
855 if (view) view->refreshCurrent(); 857 if (view) view->refreshCurrent();
856 break; 858 break;
857 default: 859 default:
858 break; 860 break;
859 } 861 }
860 return false; 862 return false;
861} 863}
862 864
863MHfolderItem::~MHfolderItem() 865MHfolderItem::~MHfolderItem()
864{} 866{}
865 867
866MHfolderItem::MHfolderItem( const FolderP &folderInit, MHviewItem *parent , QListViewItem*after ) 868MHfolderItem::MHfolderItem( const FolderP &folderInit, MHviewItem *parent , QListViewItem*after )
867 : AccountViewItem(folderInit, parent,after ) 869 : AccountViewItem(folderInit, parent,after )
868{ 870{
869 mbox = parent; 871 mbox = parent;
870 initName(); 872 initName();
871} 873}
872 874
873MHfolderItem::MHfolderItem(const FolderP& folderInit, MHfolderItem *parent, QListViewItem*after, MHviewItem*master) 875MHfolderItem::MHfolderItem(const FolderP& folderInit, MHfolderItem *parent, QListViewItem*after, MHviewItem*master)
874 : AccountViewItem(folderInit, parent,after ) 876 : AccountViewItem(folderInit, parent,after )
875{ 877{
876 folder = folderInit; 878 folder = folderInit;
877 mbox = master; 879 mbox = master;
878 initName(); 880 initName();
879} 881}
880 882
881void MHfolderItem::initName() 883void MHfolderItem::initName()
882{ 884{
883 QString bName = folder->getDisplayName(); 885 QString bName = folder->getDisplayName();
884 if (bName.startsWith("/")&&bName.length()>1) 886 if (bName.startsWith("/")&&bName.length()>1)
885 { 887 {
886 bName.replace(0,1,""); 888 bName.replace(0,1,"");
887 } 889 }
888 int pos = bName.findRev("/"); 890 int pos = bName.findRev("/");
889 if (pos > 0) 891 if (pos > 0)
890 { 892 {
891 bName.replace(0,pos+1,""); 893 bName.replace(0,pos+1,"");
892 } 894 }
893 if (bName.lower() == "outgoing") 895 if (bName.lower() == "outgoing")
894 { 896 {
895 setPixmap( 0, PIXMAP_OUTBOXFOLDER ); 897 setPixmap( 0, PIXMAP_OUTBOXFOLDER );
896 } 898 }
897 else if (bName.lower() == "inbox") 899 else if (bName.lower() == "inbox")
898 { 900 {
899 setPixmap( 0, PIXMAP_INBOXFOLDER); 901 setPixmap( 0, PIXMAP_INBOXFOLDER);
900 } else if (bName.lower() == "drafts") { 902 } else if (bName.lower() == "drafts") {
901 setPixmap(0, Resource::loadPixmap("edit")); 903 setPixmap(0, Opie::Core::OResource::loadPixmap("edit", Opie::Core::OResource::SmallIcon));
902 } else { 904 } else {
903 setPixmap( 0, PIXMAP_MBOXFOLDER ); 905 setPixmap( 0, PIXMAP_MBOXFOLDER );
904 } 906 }
905 setText( 0, bName ); 907 setText( 0, bName );
906} 908}
907 909
908const FolderP&MHfolderItem::getFolder()const 910const FolderP&MHfolderItem::getFolder()const
909{ 911{
910 return folder; 912 return folder;
911} 913}
912 914
913void MHfolderItem::refresh(QValueList<RecMailP>&target) 915void MHfolderItem::refresh(QValueList<RecMailP>&target)
914{ 916{
915 if (folder->may_select()) 917 if (folder->may_select())
916 mbox->getWrapper()->listMessages( folder->getName(),target ); 918 mbox->getWrapper()->listMessages( folder->getName(),target );
917} 919}
918 920
919RECBODYP MHfolderItem::fetchBody(const RecMailP&aMail) 921RECBODYP MHfolderItem::fetchBody(const RecMailP&aMail)
920{ 922{
921 return mbox->getWrapper()->fetchBody(aMail); 923 return mbox->getWrapper()->fetchBody(aMail);
922} 924}
923 925
924bool MHfolderItem::deleteFolder() 926bool MHfolderItem::deleteFolder()
925{ 927{
926 int yesno = QMessageBox::warning(0,QObject::tr("Delete folder",contextName), 928 int yesno = QMessageBox::warning(0,QObject::tr("Delete folder",contextName),
927 QObject::tr("<center>Realy delete folder <br><b>%1</b><br>and all if it content?</center>",contextName).arg(folder->getDisplayName()), 929 QObject::tr("<center>Realy delete folder <br><b>%1</b><br>and all if it content?</center>",contextName).arg(folder->getDisplayName()),
928 QObject::tr("Yes",contextName), 930 QObject::tr("Yes",contextName),
929 QObject::tr("No",contextName),QString::null,1,1); 931 QObject::tr("No",contextName),QString::null,1,1);
930 odebug << "Auswahl: " << yesno << "" << oendl; 932 odebug << "Auswahl: " << yesno << "" << oendl;
931 if (yesno == 0) 933 if (yesno == 0)
932 { 934 {
933 if (mbox->getWrapper()->deleteMbox(folder)) 935 if (mbox->getWrapper()->deleteMbox(folder))
934 { 936 {
935 QListView*v=listView(); 937 QListView*v=listView();
936 MHviewItem * box = mbox; 938 MHviewItem * box = mbox;
937 /* be carefull - after that this object is destroyd so don't use 939 /* be carefull - after that this object is destroyd so don't use
938 * any member of it after that call!!*/ 940 * any member of it after that call!!*/
939 mbox->refresh(true); 941 mbox->refresh(true);
940 if (v) 942 if (v)
941 { 943 {
942 v->setSelected(box,true); 944 v->setSelected(box,true);
943 } 945 }
944 return true; 946 return true;
945 } 947 }
946 } 948 }
947 return false; 949 return false;
948} 950}
949 951
950QMap<int,QString> MHfolderItem::folderMenu() 952QMap<int,QString> MHfolderItem::folderMenu()
951{ 953{
952 QMap<int,QString> e; 954 QMap<int,QString> e;
953 e[FOLDER_MENU_NEW_SUBFOLDER]=QObject::tr("Create new subfolder",contextName); 955 e[FOLDER_MENU_NEW_SUBFOLDER]=QObject::tr("Create new subfolder",contextName);
954 e[FOLDER_MENU_REFRESH_HEADER]=QObject::tr("Refresh header list",contextName); 956 e[FOLDER_MENU_REFRESH_HEADER]=QObject::tr("Refresh header list",contextName);
955 e[FOLDER_MENU_MOVE_MAILS]=QObject::tr("Move/Copie all mails",contextName); 957 e[FOLDER_MENU_MOVE_MAILS]=QObject::tr("Move/Copie all mails",contextName);
956 e[FOLDER_MENU_DELETE_ALL_MAILS]=QObject::tr("Delete all mails",contextName); 958 e[FOLDER_MENU_DELETE_ALL_MAILS]=QObject::tr("Delete all mails",contextName);
957 e[FOLDER_MENU_DELETE_FOLDER]=QObject::tr("Delete folder",contextName); 959 e[FOLDER_MENU_DELETE_FOLDER]=QObject::tr("Delete folder",contextName);
958 return e; 960 return e;
959} 961}
960 962
961void MHfolderItem::downloadMails() 963void MHfolderItem::downloadMails()
962{ 964{
963 AccountView*bl = mbox->accountView(); 965 AccountView*bl = mbox->accountView();
964 if (!bl) return; 966 if (!bl) return;
965 bl->downloadMails(folder,mbox->getWrapper()); 967 bl->downloadMails(folder,mbox->getWrapper());
966} 968}
967 969
968void MHfolderItem::createFolder() 970void MHfolderItem::createFolder()
969{ 971{
970 Newmdirdlg ndirdlg(0,0,true); 972 Newmdirdlg ndirdlg(0,0,true);
971 if ( QPEApplication::execDialog( &ndirdlg ) ) 973 if ( QPEApplication::execDialog( &ndirdlg ) )
972 { 974 {
973 QString ndir = ndirdlg.Newdir(); 975 QString ndir = ndirdlg.Newdir();
974 if (mbox->getWrapper()->createMbox(ndir,folder)) 976 if (mbox->getWrapper()->createMbox(ndir,folder))
975 { 977 {
976 QListView*v=listView(); 978 QListView*v=listView();
977 MHviewItem * box = mbox; 979 MHviewItem * box = mbox;
978 /* be carefull - after that this object is destroyd so don't use 980 /* be carefull - after that this object is destroyd so don't use
979 * any member of it after that call!!*/ 981 * any member of it after that call!!*/
980 mbox->refresh(true); 982 mbox->refresh(true);
981 if (v) 983 if (v)
982 { 984 {
983 v->setSelected(box,true); 985 v->setSelected(box,true);
984 } 986 }
985 } 987 }
986 } 988 }
987} 989}
988 990
989bool MHfolderItem::contextMenuSelected(int which) 991bool MHfolderItem::contextMenuSelected(int which)
990{ 992{
991 AccountView*view = 0; 993 AccountView*view = 0;
992 switch(which) 994 switch(which)
993 { 995 {
994 case FOLDER_MENU_DELETE_ALL_MAILS: 996 case FOLDER_MENU_DELETE_ALL_MAILS:
995 deleteAllMail(mbox->getWrapper(),folder); 997 deleteAllMail(mbox->getWrapper(),folder);
996 break; 998 break;
997 case FOLDER_MENU_DELETE_FOLDER: 999 case FOLDER_MENU_DELETE_FOLDER:
998 return deleteFolder(); 1000 return deleteFolder();
999 break; 1001 break;
1000 case FOLDER_MENU_MOVE_MAILS: 1002 case FOLDER_MENU_MOVE_MAILS:
1001 downloadMails(); 1003 downloadMails();
1002 break; 1004 break;
1003 case FOLDER_MENU_NEW_SUBFOLDER: 1005 case FOLDER_MENU_NEW_SUBFOLDER:
1004 createFolder(); 1006 createFolder();
1005 break; 1007 break;
1006 case FOLDER_MENU_REFRESH_HEADER: 1008 case FOLDER_MENU_REFRESH_HEADER:
1007 view = (AccountView*)listView(); 1009 view = (AccountView*)listView();
1008 if (view) view->refreshCurrent(); 1010 if (view) view->refreshCurrent();
1009 break; 1011 break;
1010 default: 1012 default:
1011 break; 1013 break;
1012 } 1014 }
1013 return false; 1015 return false;
1014} 1016}
1015 1017
1016bool MHfolderItem::isDraftfolder() 1018bool MHfolderItem::isDraftfolder()
1017{ 1019{
1018 if (folder && folder->getName()==AbstractMail::defaultLocalfolder()+"/"+AbstractMail::draftFolder()) return true; 1020 if (folder && folder->getName()==AbstractMail::defaultLocalfolder()+"/"+AbstractMail::draftFolder()) return true;
1019 return false; 1021 return false;
1020} 1022}
1021 1023
1022/** 1024/**
1023 * Generic stuff 1025 * Generic stuff
1024 */ 1026 */
1025 1027
1026const QString AccountViewItem::contextName="AccountViewItem"; 1028const QString AccountViewItem::contextName="AccountViewItem";
1027 1029
1028AccountViewItem::AccountViewItem( AccountView *parent ) 1030AccountViewItem::AccountViewItem( AccountView *parent )
1029 : QListViewItem( parent ) 1031 : QListViewItem( parent )
1030{ 1032{
1031 init(); 1033 init();
1032 m_Backlink = parent; 1034 m_Backlink = parent;
1033} 1035}
1034 1036
1035AccountViewItem::AccountViewItem( QListViewItem *parent) 1037AccountViewItem::AccountViewItem( QListViewItem *parent)
1036 : QListViewItem( parent),folder(0) 1038 : QListViewItem( parent),folder(0)
1037{ 1039{
1038 init(); 1040 init();
1039} 1041}
1040 1042
1041AccountViewItem::AccountViewItem( QListViewItem *parent , QListViewItem*after ) 1043AccountViewItem::AccountViewItem( QListViewItem *parent , QListViewItem*after )
1042 :QListViewItem( parent,after ),folder(0) 1044 :QListViewItem( parent,after ),folder(0)
1043{ 1045{
1044 init(); 1046 init();
1045} 1047}
1046 1048
1047AccountViewItem::AccountViewItem( const Opie::Core::OSmartPointer<Folder>&folderInit,QListViewItem *parent , QListViewItem*after ) 1049AccountViewItem::AccountViewItem( const Opie::Core::OSmartPointer<Folder>&folderInit,QListViewItem *parent , QListViewItem*after )
1048 :QListViewItem( parent,after ),folder(folderInit) 1050 :QListViewItem( parent,after ),folder(folderInit)
1049{ 1051{
1050 init(); 1052 init();
1051} 1053}
1052 1054
1053void AccountViewItem::init() 1055void AccountViewItem::init()
1054{ 1056{
1055 m_Backlink = 0; 1057 m_Backlink = 0;
1056} 1058}
1057 1059
1058AccountViewItem::~AccountViewItem() 1060AccountViewItem::~AccountViewItem()
1059{ 1061{
1060 folder = 0; 1062 folder = 0;
1061} 1063}
1062 1064
1063AccountView*AccountViewItem::accountView() 1065AccountView*AccountViewItem::accountView()
1064{ 1066{
1065 return m_Backlink; 1067 return m_Backlink;
1066} 1068}
1067 1069
1068void AccountViewItem::deleteAllMail(AbstractMail*wrapper,const FolderP&folder) 1070void AccountViewItem::deleteAllMail(AbstractMail*wrapper,const FolderP&folder)
1069{ 1071{
1070 if (!wrapper) return; 1072 if (!wrapper) return;
1071 QString fname=""; 1073 QString fname="";
1072 if (folder) fname = folder->getDisplayName(); 1074 if (folder) fname = folder->getDisplayName();
1073 int yesno = QMessageBox::warning(0,QObject::tr("Delete all mails",contextName), 1075 int yesno = QMessageBox::warning(0,QObject::tr("Delete all mails",contextName),
1074 QObject::tr("<center>Realy delete all mails in box <br>%1</center>",contextName). 1076 QObject::tr("<center>Realy delete all mails in box <br>%1</center>",contextName).
1075 arg(fname), 1077 arg(fname),
1076 QObject::tr("Yes",contextName), 1078 QObject::tr("Yes",contextName),
1077 QObject::tr("No",contextName),QString::null,1,1); 1079 QObject::tr("No",contextName),QString::null,1,1);
1078 odebug << "Auswahl: " << yesno << "" << oendl; 1080 odebug << "Auswahl: " << yesno << "" << oendl;
1079 if (yesno == 0) 1081 if (yesno == 0)
1080 { 1082 {
1081 if (wrapper->deleteAllMail(folder)) 1083 if (wrapper->deleteAllMail(folder))
1082 { 1084 {
1083 AccountView * view = (AccountView*)listView(); 1085 AccountView * view = (AccountView*)listView();
1084 if (view) view->refreshCurrent(); 1086 if (view) view->refreshCurrent();
1085 } 1087 }
1086 } 1088 }
1087} 1089}
1088 1090
1089void AccountViewItem::removeChilds() 1091void AccountViewItem::removeChilds()
1090{ 1092{
1091 QListViewItem *child = firstChild(); 1093 QListViewItem *child = firstChild();
1092 while ( child ) 1094 while ( child )
1093 { 1095 {
1094 QListViewItem *tmp = child; 1096 QListViewItem *tmp = child;
1095 child = child->nextSibling(); 1097 child = child->nextSibling();
1096 delete tmp; 1098 delete tmp;
1097 } 1099 }
1098} 1100}
1099 1101
1100bool AccountViewItem::matchName(const QString&name)const 1102bool AccountViewItem::matchName(const QString&name)const
1101{ 1103{
1102 if (!folder) return false; 1104 if (!folder) return false;
1103 return folder->getDisplayName()==name; 1105 return folder->getDisplayName()==name;
1104} 1106}
1105 1107
1106 1108
1107AccountViewItem*AccountViewItem::findSubItem(const QString&path,AccountViewItem*start) 1109AccountViewItem*AccountViewItem::findSubItem(const QString&path,AccountViewItem*start)
1108{ 1110{
1109 AccountViewItem*pitem,*sitem; 1111 AccountViewItem*pitem,*sitem;
1110 if (!start) pitem = (AccountViewItem*)firstChild(); 1112 if (!start) pitem = (AccountViewItem*)firstChild();
1111 else pitem = (AccountViewItem*)start->firstChild(); 1113 else pitem = (AccountViewItem*)start->firstChild();
1112 while (pitem) 1114 while (pitem)
1113 { 1115 {
1114 if (pitem->matchName(path)) 1116 if (pitem->matchName(path))
1115 { 1117 {
1116 break; 1118 break;
1117 } 1119 }
1118 if (pitem->childCount()>0) 1120 if (pitem->childCount()>0)
1119 { 1121 {
1120 sitem = findSubItem(path,pitem); 1122 sitem = findSubItem(path,pitem);
1121 if (sitem) 1123 if (sitem)
1122 { 1124 {
1123 pitem = sitem; 1125 pitem = sitem;
1124 break; 1126 break;
1125 } 1127 }
1126 } 1128 }
1127 pitem=(AccountViewItem*)pitem->nextSibling(); 1129 pitem=(AccountViewItem*)pitem->nextSibling();
1128 } 1130 }
1129 return pitem; 1131 return pitem;
1130} 1132}
1131 1133
1132bool AccountViewItem::isDraftfolder() 1134bool AccountViewItem::isDraftfolder()
1133{ 1135{
1134 return false; 1136 return false;
1135} 1137}
1136 1138
1137QMap<int,QString> AccountViewItem::serverMenu() 1139QMap<int,QString> AccountViewItem::serverMenu()
1138{ 1140{
1139 return QMap<int,QString>(); 1141 return QMap<int,QString>();
1140} 1142}
1141 1143
1142QMap<int,QString> AccountViewItem::folderMenu() 1144QMap<int,QString> AccountViewItem::folderMenu()
1143{ 1145{
1144 return QMap<int,QString>(); 1146 return QMap<int,QString>();
1145} 1147}
1146 1148
1147QPopupMenu * AccountViewItem::getContextMenu() 1149QPopupMenu * AccountViewItem::getContextMenu()
1148{ 1150{
1149 QPopupMenu *m = new QPopupMenu(0); 1151 QPopupMenu *m = new QPopupMenu(0);
1150 if (m) 1152 if (m)
1151 { 1153 {
1152 QMap<int,QString> entries; 1154 QMap<int,QString> entries;
1153 entries = folderMenu(); 1155 entries = folderMenu();
1154 QMap<int,QString>::Iterator it; 1156 QMap<int,QString>::Iterator it;
1155 for (it=entries.begin();it!=entries.end();++it) { 1157 for (it=entries.begin();it!=entries.end();++it) {
1156 m->insertItem(it.data(),it.key()); 1158 m->insertItem(it.data(),it.key());
1157 } 1159 }
1158 entries = serverMenu(); 1160 entries = serverMenu();
1159 for (it=entries.begin();it!=entries.end();++it) { 1161 for (it=entries.begin();it!=entries.end();++it) {
1160 m->insertItem(it.data(),it.key()); 1162 m->insertItem(it.data(),it.key());
1161 } 1163 }
1162 } 1164 }
1163 return m; 1165 return m;
1164} 1166}
diff --git a/noncore/net/mail/addresspicker.cpp b/noncore/net/mail/addresspicker.cpp
index 50c82e5..4e328d4 100644
--- a/noncore/net/mail/addresspicker.cpp
+++ b/noncore/net/mail/addresspicker.cpp
@@ -1,112 +1,112 @@
1 1
2#include "composemail.h" 2#include "composemail.h"
3 3
4/* OPIE */ 4/* OPIE */
5#include <opie2/ocontactaccess.h> 5#include <opie2/ocontactaccess.h>
6#include <opie2/opimcontact.h> 6#include <opie2/opimcontact.h>
7#include <qpe/resource.h> 7#include <opie2/oresource.h>
8#include <qpe/qpeapplication.h> 8#include <qpe/qpeapplication.h>
9 9
10/* QT */ 10/* QT */
11#include <qpushbutton.h> 11#include <qpushbutton.h>
12#include <qmessagebox.h> 12#include <qmessagebox.h>
13#include <qlistbox.h> 13#include <qlistbox.h>
14 14
15/* STD */ 15/* STD */
16#include <stdlib.h> 16#include <stdlib.h>
17 17
18AddressPicker::AddressPicker( QWidget *parent, const char *name, bool modal, WFlags flags ) 18AddressPicker::AddressPicker( QWidget *parent, const char *name, bool modal, WFlags flags )
19 : AddressPickerUI( parent, name, modal, flags ) 19 : AddressPickerUI( parent, name, modal, flags )
20{ 20{
21 okButton->setIconSet( Resource::loadPixmap( "enter" ) ); 21 okButton->setIconSet( Opie::Core::OResource::loadPixmap( "enter", Opie::Core::OResource::SmallIcon ) );
22 cancelButton->setIconSet( Resource::loadPixmap( "editdelete" ) ); 22 cancelButton->setIconSet( Opie::Core::OResource::loadPixmap( "editdelete", Opie::Core::OResource::SmallIcon ) );
23 23
24 connect(okButton, SIGNAL(clicked()), SLOT(accept())); 24 connect(okButton, SIGNAL(clicked()), SLOT(accept()));
25 connect(cancelButton, SIGNAL(clicked()), SLOT(close())); 25 connect(cancelButton, SIGNAL(clicked()), SLOT(close()));
26 Opie::OPimContactAccess::List::Iterator it; 26 Opie::OPimContactAccess::List::Iterator it;
27 27
28 QString lineEmail, lineName, contactLine; 28 QString lineEmail, lineName, contactLine;
29 /* what name has to set here???? */ 29 /* what name has to set here???? */
30 Opie::OPimContactAccess m_contactdb("opiemail"); 30 Opie::OPimContactAccess m_contactdb("opiemail");
31 31
32 QStringList mails; 32 QStringList mails;
33 QString pre,suf; 33 QString pre,suf;
34 Opie::OPimContactAccess::List m_list = m_contactdb.sorted( true, 0, 0, 0 ); 34 Opie::OPimContactAccess::List m_list = m_contactdb.sorted( true, 0, 0, 0 );
35 for ( it = m_list.begin(); it != m_list.end(); ++it ) 35 for ( it = m_list.begin(); it != m_list.end(); ++it )
36 { 36 {
37 if ((*it).defaultEmail().length()!=0) 37 if ((*it).defaultEmail().length()!=0)
38 { 38 {
39 mails = (*it).emailList(); 39 mails = (*it).emailList();
40 if ((*it).fileAs().length()>0) 40 if ((*it).fileAs().length()>0)
41 { 41 {
42 pre = "\""+(*it).firstName()+" "+(*it).lastName()+"\" <"; 42 pre = "\""+(*it).firstName()+" "+(*it).lastName()+"\" <";
43 suf = ">"; 43 suf = ">";
44 } 44 }
45 else 45 else
46 { 46 {
47 pre = ""; 47 pre = "";
48 suf = ""; 48 suf = "";
49 } 49 }
50 QStringList::ConstIterator sit = mails.begin(); 50 QStringList::ConstIterator sit = mails.begin();
51 for (;sit!=mails.end();++sit) 51 for (;sit!=mails.end();++sit)
52 { 52 {
53 contactLine=pre+(*sit)+suf; 53 contactLine=pre+(*sit)+suf;
54 addressList->insertItem(contactLine); 54 addressList->insertItem(contactLine);
55 } 55 }
56 } 56 }
57 } 57 }
58 if ( addressList->count() <= 0 ) 58 if ( addressList->count() <= 0 )
59 { 59 {
60#if 0 60#if 0
61 // makes this realy sense?? 61 // makes this realy sense??
62 addressList->insertItem( 62 addressList->insertItem(
63 tr( "There are no entries in the addressbook." ) ); 63 tr( "There are no entries in the addressbook." ) );
64#endif 64#endif
65 addressList->setEnabled( false ); 65 addressList->setEnabled( false );
66 okButton->setEnabled( false ); 66 okButton->setEnabled( false );
67 } 67 }
68 else 68 else
69 { 69 {
70 // addressList->sort(); 70 // addressList->sort();
71 } 71 }
72} 72}
73 73
74void AddressPicker::accept() 74void AddressPicker::accept()
75{ 75{
76 QListBoxItem *item = addressList->firstItem(); 76 QListBoxItem *item = addressList->firstItem();
77 QString names; 77 QString names;
78 78
79 while ( item ) 79 while ( item )
80 { 80 {
81 if ( item->selected() ) 81 if ( item->selected() )
82 names += item->text() + ", "; 82 names += item->text() + ", ";
83 item = item->next(); 83 item = item->next();
84 } 84 }
85 names.replace( names.length() - 2, 2, "" ); 85 names.replace( names.length() - 2, 2, "" );
86 86
87 if ( names.isEmpty() ) 87 if ( names.isEmpty() )
88 { 88 {
89 QMessageBox::information(this, tr("Error"), tr("<p>You have to select" 89 QMessageBox::information(this, tr("Error"), tr("<p>You have to select"
90 " at least one address entry.</p>"), tr("Ok")); 90 " at least one address entry.</p>"), tr("Ok"));
91 return; 91 return;
92 } 92 }
93 93
94 selectedNames = names; 94 selectedNames = names;
95 QDialog::accept(); 95 QDialog::accept();
96} 96}
97 97
98QString AddressPicker::getNames() 98QString AddressPicker::getNames()
99{ 99{
100 QString names = 0; 100 QString names = 0;
101 101
102 AddressPicker picker(0, 0, true); 102 AddressPicker picker(0, 0, true);
103 103
104 int ret = QPEApplication::execDialog( &picker ); 104 int ret = QPEApplication::execDialog( &picker );
105 if ( QDialog::Accepted == ret ) 105 if ( QDialog::Accepted == ret )
106 { 106 {
107 return picker.selectedNames; 107 return picker.selectedNames;
108 } 108 }
109 109
110 return 0; 110 return 0;
111} 111}
112 112
diff --git a/noncore/net/mail/composemail.cpp b/noncore/net/mail/composemail.cpp
index 154c1d5..9d04de3 100644
--- a/noncore/net/mail/composemail.cpp
+++ b/noncore/net/mail/composemail.cpp
@@ -1,307 +1,306 @@
1 1
2#include "composemail.h" 2#include "composemail.h"
3 3
4#include <libmailwrapper/smtpwrapper.h> 4#include <libmailwrapper/smtpwrapper.h>
5#include <libmailwrapper/storemail.h> 5#include <libmailwrapper/storemail.h>
6#include <libmailwrapper/abstractmail.h> 6#include <libmailwrapper/abstractmail.h>
7#include <libmailwrapper/mailtypes.h> 7#include <libmailwrapper/mailtypes.h>
8 8
9/* OPIE */ 9/* OPIE */
10#include <opie2/ofiledialog.h> 10#include <opie2/ofiledialog.h>
11#include <opie2/odebug.h> 11#include <opie2/odebug.h>
12#include <qpe/resource.h> 12#include <opie2/oresource.h>
13#include <qpe/config.h> 13#include <qpe/config.h>
14#include <qpe/global.h> 14#include <qpe/global.h>
15#include <qpe/contact.h> 15#include <qpe/contact.h>
16using namespace Opie::Core;
17using namespace Opie::Ui;
16 18
17/* QT */ 19/* QT */
18#include <qt.h> 20#include <qt.h>
19 21
20
21using namespace Opie::Core;
22using namespace Opie::Ui;
23ComposeMail::ComposeMail( Settings *s, QWidget *parent, const char *name, bool modal, WFlags flags ) 22ComposeMail::ComposeMail( Settings *s, QWidget *parent, const char *name, bool modal, WFlags flags )
24 : ComposeMailUI( parent, name, modal, flags ) 23 : ComposeMailUI( parent, name, modal, flags )
25{ 24{
26 settings = s; 25 settings = s;
27 m_replyid = ""; 26 m_replyid = "";
28 27
29 QString vfilename = Global::applicationFileName("addressbook", 28 QString vfilename = Global::applicationFileName("addressbook",
30 "businesscard.vcf"); 29 "businesscard.vcf");
31 Contact c; 30 Contact c;
32 if (QFile::exists(vfilename)) { 31 if (QFile::exists(vfilename)) {
33 c = Contact::readVCard( vfilename )[0]; 32 c = Contact::readVCard( vfilename )[0];
34 } 33 }
35 34
36 QStringList mails = c.emailList(); 35 QStringList mails = c.emailList();
37 QString defmail = c.defaultEmail(); 36 QString defmail = c.defaultEmail();
38 37
39 if (defmail.length()!=0) { 38 if (defmail.length()!=0) {
40 fromBox->insertItem(defmail); 39 fromBox->insertItem(defmail);
41 } 40 }
42 QStringList::ConstIterator sit = mails.begin(); 41 QStringList::ConstIterator sit = mails.begin();
43 for (;sit!=mails.end();++sit) { 42 for (;sit!=mails.end();++sit) {
44 if ( (*sit)==defmail) 43 if ( (*sit)==defmail)
45 continue; 44 continue;
46 fromBox->insertItem((*sit)); 45 fromBox->insertItem((*sit));
47 } 46 }
48 senderNameEdit->setText(c.firstName()+" "+c.lastName()); 47 senderNameEdit->setText(c.firstName()+" "+c.lastName());
49 Config cfg( "mail" ); 48 Config cfg( "mail" );
50 cfg.setGroup( "Compose" ); 49 cfg.setGroup( "Compose" );
51 checkBoxLater->setChecked( cfg.readBoolEntry( "sendLater", false ) ); 50 checkBoxLater->setChecked( cfg.readBoolEntry( "sendLater", false ) );
52 51
53 attList->addColumn( tr( "Name" ) ); 52 attList->addColumn( tr( "Name" ) );
54 attList->addColumn( tr( "Size" ) ); 53 attList->addColumn( tr( "Size" ) );
55 54
56 QList<Account> accounts = settings->getAccounts(); 55 QList<Account> accounts = settings->getAccounts();
57 56
58 Account *it; 57 Account *it;
59 for ( it = accounts.first(); it; it = accounts.next() ) { 58 for ( it = accounts.first(); it; it = accounts.next() ) {
60 if ( it->getType()==MAILLIB::A_SMTP ) { 59 if ( it->getType()==MAILLIB::A_SMTP ) {
61 SMTPaccount *smtp = static_cast<SMTPaccount *>(it); 60 SMTPaccount *smtp = static_cast<SMTPaccount *>(it);
62 smtpAccountBox->insertItem( smtp->getAccountName() ); 61 smtpAccountBox->insertItem( smtp->getAccountName() );
63 smtpAccounts.append( smtp ); 62 smtpAccounts.append( smtp );
64 } 63 }
65 } 64 }
66 65
67 if ( smtpAccounts.count() > 0 ) { 66 if ( smtpAccounts.count() > 0 ) {
68 fillValues( smtpAccountBox->currentItem() ); 67 fillValues( smtpAccountBox->currentItem() );
69 } else { 68 } else {
70 QMessageBox::information( this, tr( "Problem" ), 69 QMessageBox::information( this, tr( "Problem" ),
71 tr( "<p>Please create an SMTP account first.</p>" ), 70 tr( "<p>Please create an SMTP account first.</p>" ),
72 tr( "Ok" ) ); 71 tr( "Ok" ) );
73 return; 72 return;
74 } 73 }
75 74
76 connect( smtpAccountBox, SIGNAL( activated(int) ), SLOT( fillValues(int) ) ); 75 connect( smtpAccountBox, SIGNAL( activated(int) ), SLOT( fillValues(int) ) );
77 connect( toButton, SIGNAL( clicked() ), SLOT( pickAddressTo() ) ); 76 connect( toButton, SIGNAL( clicked() ), SLOT( pickAddressTo() ) );
78 connect( ccButton, SIGNAL( clicked() ), SLOT( pickAddressCC() ) ); 77 connect( ccButton, SIGNAL( clicked() ), SLOT( pickAddressCC() ) );
79 connect( bccButton, SIGNAL( clicked() ), SLOT( pickAddressBCC() ) ); 78 connect( bccButton, SIGNAL( clicked() ), SLOT( pickAddressBCC() ) );
80 connect( replyButton, SIGNAL( clicked() ), SLOT( pickAddressReply() ) ); 79 connect( replyButton, SIGNAL( clicked() ), SLOT( pickAddressReply() ) );
81 connect( addButton, SIGNAL( clicked() ), SLOT( addAttachment() ) ); 80 connect( addButton, SIGNAL( clicked() ), SLOT( addAttachment() ) );
82 connect( deleteButton, SIGNAL( clicked() ), SLOT( removeAttachment() ) ); 81 connect( deleteButton, SIGNAL( clicked() ), SLOT( removeAttachment() ) );
83} 82}
84 83
85void ComposeMail::pickAddress( QLineEdit *line ) 84void ComposeMail::pickAddress( QLineEdit *line )
86{ 85{
87 QString names = AddressPicker::getNames(); 86 QString names = AddressPicker::getNames();
88 if ( line->text().isEmpty() ) { 87 if ( line->text().isEmpty() ) {
89 line->setText( names ); 88 line->setText( names );
90 } else if ( !names.isEmpty() ) { 89 } else if ( !names.isEmpty() ) {
91 line->setText( line->text() + ", " + names ); 90 line->setText( line->text() + ", " + names );
92 } 91 }
93} 92}
94 93
95 94
96void ComposeMail::setTo( const QString & to ) 95void ComposeMail::setTo( const QString & to )
97{ 96{
98 toLine->setText( to ); 97 toLine->setText( to );
99} 98}
100 99
101void ComposeMail::setSubject( const QString & subject ) 100void ComposeMail::setSubject( const QString & subject )
102{ 101{
103 subjectLine->setText( subject ); 102 subjectLine->setText( subject );
104} 103}
105 104
106void ComposeMail::setInReplyTo( const QString & messageId ) 105void ComposeMail::setInReplyTo( const QString & messageId )
107{ 106{
108 m_replyid = messageId; 107 m_replyid = messageId;
109} 108}
110 109
111void ComposeMail::setMessage( const QString & text ) 110void ComposeMail::setMessage( const QString & text )
112{ 111{
113 message->setText( text ); 112 message->setText( text );
114} 113}
115 114
116 115
117void ComposeMail::pickAddressTo() 116void ComposeMail::pickAddressTo()
118{ 117{
119 pickAddress( toLine ); 118 pickAddress( toLine );
120} 119}
121 120
122void ComposeMail::pickAddressCC() 121void ComposeMail::pickAddressCC()
123{ 122{
124 pickAddress( ccLine ); 123 pickAddress( ccLine );
125} 124}
126 125
127void ComposeMail::pickAddressBCC() 126void ComposeMail::pickAddressBCC()
128{ 127{
129 pickAddress( bccLine ); 128 pickAddress( bccLine );
130} 129}
131 130
132void ComposeMail::pickAddressReply() 131void ComposeMail::pickAddressReply()
133{ 132{
134 pickAddress( replyLine ); 133 pickAddress( replyLine );
135} 134}
136 135
137void ComposeMail::fillValues( int ) 136void ComposeMail::fillValues( int )
138{ 137{
139#if 0 138#if 0
140 SMTPaccount *smtp = smtpAccounts.at( current ); 139 SMTPaccount *smtp = smtpAccounts.at( current );
141 ccLine->clear(); 140 ccLine->clear();
142 if ( smtp->getUseCC() ) { 141 if ( smtp->getUseCC() ) {
143 ccLine->setText( smtp->getCC() ); 142 ccLine->setText( smtp->getCC() );
144 } 143 }
145 bccLine->clear(); 144 bccLine->clear();
146 if ( smtp->getUseBCC() ) { 145 if ( smtp->getUseBCC() ) {
147 bccLine->setText( smtp->getBCC() ); 146 bccLine->setText( smtp->getBCC() );
148 } 147 }
149 replyLine->clear(); 148 replyLine->clear();
150 if ( smtp->getUseReply() ) { 149 if ( smtp->getUseReply() ) {
151 replyLine->setText( smtp->getReply() ); 150 replyLine->setText( smtp->getReply() );
152 } 151 }
153 sigMultiLine->setText( smtp->getSignature() ); 152 sigMultiLine->setText( smtp->getSignature() );
154#endif 153#endif
155} 154}
156 155
157void ComposeMail::slotAdjustColumns() 156void ComposeMail::slotAdjustColumns()
158{ 157{
159 int currPage = tabWidget->currentPageIndex(); 158 int currPage = tabWidget->currentPageIndex();
160 159
161 tabWidget->showPage( attachTab ); 160 tabWidget->showPage( attachTab );
162 attList->setColumnWidth( 0, attList->visibleWidth() - 80 ); 161 attList->setColumnWidth( 0, attList->visibleWidth() - 80 );
163 attList->setColumnWidth( 1, 80 ); 162 attList->setColumnWidth( 1, 80 );
164 163
165 tabWidget->setCurrentPage( currPage ); 164 tabWidget->setCurrentPage( currPage );
166} 165}
167 166
168void ComposeMail::addAttachment() 167void ComposeMail::addAttachment()
169{ 168{
170 DocLnk lnk = OFileDialog::getOpenFileName( 1, "/" ); 169 DocLnk lnk = OFileDialog::getOpenFileName( 1, "/" );
171 if ( !lnk.name().isEmpty() ) { 170 if ( !lnk.name().isEmpty() ) {
172 Attachment *att = new Attachment( lnk ); 171 Attachment *att = new Attachment( lnk );
173 (void) new AttachViewItem( attList, att ); 172 (void) new AttachViewItem( attList, att );
174 } 173 }
175} 174}
176 175
177void ComposeMail::removeAttachment() 176void ComposeMail::removeAttachment()
178{ 177{
179 if ( !attList->currentItem() ) { 178 if ( !attList->currentItem() ) {
180 QMessageBox::information( this, tr( "Error" ), 179 QMessageBox::information( this, tr( "Error" ),
181 tr( "<p>Please select a File.</p>" ), 180 tr( "<p>Please select a File.</p>" ),
182 tr( "Ok" ) ); 181 tr( "Ok" ) );
183 } else { 182 } else {
184 attList->takeItem( attList->currentItem() ); 183 attList->takeItem( attList->currentItem() );
185 } 184 }
186} 185}
187 186
188void ComposeMail::accept() 187void ComposeMail::accept()
189{ 188{
190 if ( checkBoxLater->isChecked() ) { 189 if ( checkBoxLater->isChecked() ) {
191 odebug << "Send later" << oendl; 190 odebug << "Send later" << oendl;
192 } 191 }
193 192
194#if 0 193#if 0
195 odebug << "Sending Mail with " 194 odebug << "Sending Mail with "
196 << smtpAccounts.at( smtpAccountBox->currentItem() )->getAccountName() << oendl; 195 << smtpAccounts.at( smtpAccountBox->currentItem() )->getAccountName() << oendl;
197#endif 196#endif
198 Opie::Core::OSmartPointer<Mail> mail=new Mail; 197 Opie::Core::OSmartPointer<Mail> mail=new Mail;
199 198
200 SMTPaccount *smtp = smtpAccounts.at( smtpAccountBox->currentItem() ); 199 SMTPaccount *smtp = smtpAccounts.at( smtpAccountBox->currentItem() );
201 mail->setMail(fromBox->currentText()); 200 mail->setMail(fromBox->currentText());
202 201
203 if ( !toLine->text().isEmpty() ) { 202 if ( !toLine->text().isEmpty() ) {
204 mail->setTo( toLine->text() ); 203 mail->setTo( toLine->text() );
205 } else { 204 } else {
206 QMessageBox::warning(0,tr("Sending mail"), 205 QMessageBox::warning(0,tr("Sending mail"),
207 tr("No Receiver specified" ) ); 206 tr("No Receiver specified" ) );
208 return; 207 return;
209 } 208 }
210 mail->setName(senderNameEdit->text()); 209 mail->setName(senderNameEdit->text());
211 mail->setCC( ccLine->text() ); 210 mail->setCC( ccLine->text() );
212 mail->setBCC( bccLine->text() ); 211 mail->setBCC( bccLine->text() );
213 mail->setReply( replyLine->text() ); 212 mail->setReply( replyLine->text() );
214 mail->setSubject( subjectLine->text() ); 213 mail->setSubject( subjectLine->text() );
215 if (!m_replyid.isEmpty()) { 214 if (!m_replyid.isEmpty()) {
216 QStringList ids; 215 QStringList ids;
217 ids.append(m_replyid); 216 ids.append(m_replyid);
218 mail->setInreply(ids); 217 mail->setInreply(ids);
219 } 218 }
220 QString txt = message->text(); 219 QString txt = message->text();
221 if ( !sigMultiLine->text().isEmpty() ) { 220 if ( !sigMultiLine->text().isEmpty() ) {
222 txt.append( "\n--\n" ); 221 txt.append( "\n--\n" );
223 txt.append( sigMultiLine->text() ); 222 txt.append( sigMultiLine->text() );
224 } 223 }
225 mail->setMessage( txt ); 224 mail->setMessage( txt );
226 AttachViewItem *it = (AttachViewItem *) attList->firstChild(); 225 AttachViewItem *it = (AttachViewItem *) attList->firstChild();
227 while ( it != NULL ) { 226 while ( it != NULL ) {
228 mail->addAttachment( it->getAttachment() ); 227 mail->addAttachment( it->getAttachment() );
229 it = (AttachViewItem *) it->nextSibling(); 228 it = (AttachViewItem *) it->nextSibling();
230 } 229 }
231 230
232 SMTPwrapper wrapper( smtp ); 231 SMTPwrapper wrapper( smtp );
233 wrapper.sendMail( mail,checkBoxLater->isChecked() ); 232 wrapper.sendMail( mail,checkBoxLater->isChecked() );
234 233
235 QDialog::accept(); 234 QDialog::accept();
236} 235}
237 236
238void ComposeMail::reject() 237void ComposeMail::reject()
239{ 238{
240 int yesno = QMessageBox::warning(0,tr("Store message"), 239 int yesno = QMessageBox::warning(0,tr("Store message"),
241 tr("Store message into drafts?"), 240 tr("Store message into drafts?"),
242 tr("Yes"), 241 tr("Yes"),
243 tr("No"),QString::null,0,1); 242 tr("No"),QString::null,0,1);
244 243
245 if (yesno == 0) { 244 if (yesno == 0) {
246 Opie::Core::OSmartPointer<Mail> mail=new Mail(); 245 Opie::Core::OSmartPointer<Mail> mail=new Mail();
247 mail->setMail(fromBox->currentText()); 246 mail->setMail(fromBox->currentText());
248 mail->setTo( toLine->text() ); 247 mail->setTo( toLine->text() );
249 mail->setName(senderNameEdit->text()); 248 mail->setName(senderNameEdit->text());
250 mail->setCC( ccLine->text() ); 249 mail->setCC( ccLine->text() );
251 mail->setBCC( bccLine->text() ); 250 mail->setBCC( bccLine->text() );
252 mail->setReply( replyLine->text() ); 251 mail->setReply( replyLine->text() );
253 mail->setSubject( subjectLine->text() ); 252 mail->setSubject( subjectLine->text() );
254 if (!m_replyid.isEmpty()) { 253 if (!m_replyid.isEmpty()) {
255 QStringList ids; 254 QStringList ids;
256 ids.append(m_replyid); 255 ids.append(m_replyid);
257 mail->setInreply(ids); 256 mail->setInreply(ids);
258 } 257 }
259 QString txt = message->text(); 258 QString txt = message->text();
260 if ( !sigMultiLine->text().isEmpty() ) { 259 if ( !sigMultiLine->text().isEmpty() ) {
261 txt.append( "\n--\n" ); 260 txt.append( "\n--\n" );
262 txt.append( sigMultiLine->text() ); 261 txt.append( sigMultiLine->text() );
263 } 262 }
264 odebug << txt << oendl; 263 odebug << txt << oendl;
265 mail->setMessage( txt ); 264 mail->setMessage( txt );
266 265
267 /* only use the default drafts folder name! */ 266 /* only use the default drafts folder name! */
268 Storemail wrapper(AbstractMail::draftFolder()); 267 Storemail wrapper(AbstractMail::draftFolder());
269 wrapper.storeMail(mail); 268 wrapper.storeMail(mail);
270 269
271 AttachViewItem *it = (AttachViewItem *) attList->firstChild(); 270 AttachViewItem *it = (AttachViewItem *) attList->firstChild();
272 /* attachments we will ignore! */ 271 /* attachments we will ignore! */
273 if ( it != NULL ) { 272 if ( it != NULL ) {
274 QMessageBox::warning(0,tr("Store message"), 273 QMessageBox::warning(0,tr("Store message"),
275 tr("<center>Attachments will not be stored in \"Draft\" folder</center>")); 274 tr("<center>Attachments will not be stored in \"Draft\" folder</center>"));
276 } 275 }
277 } 276 }
278 QDialog::reject(); 277 QDialog::reject();
279} 278}
280 279
281ComposeMail::~ComposeMail() 280ComposeMail::~ComposeMail()
282{ 281{
283} 282}
284 283
285void ComposeMail::reEditMail(const RecMailP&current) 284void ComposeMail::reEditMail(const RecMailP&current)
286{ 285{
287 RecMailP data = current; 286 RecMailP data = current;
288 message->setText(data->Wrapper()->fetchBody(current)->Bodytext()); 287 message->setText(data->Wrapper()->fetchBody(current)->Bodytext());
289 subjectLine->setText( data->getSubject()); 288 subjectLine->setText( data->getSubject());
290 toLine->setText(data->To().join(",")); 289 toLine->setText(data->To().join(","));
291 ccLine->setText(data->CC().join(",")); 290 ccLine->setText(data->CC().join(","));
292 bccLine->setText(data->Bcc().join(",")); 291 bccLine->setText(data->Bcc().join(","));
293 replyLine->setText(data->Replyto()); 292 replyLine->setText(data->Replyto());
294} 293}
295 294
296AttachViewItem::AttachViewItem( QListView *parent, Attachment *att ) 295AttachViewItem::AttachViewItem( QListView *parent, Attachment *att )
297 : QListViewItem( parent ) 296 : QListViewItem( parent )
298{ 297{
299 attachment = att; 298 attachment = att;
300 odebug << att->getMimeType() << oendl; 299 odebug << att->getMimeType() << oendl;
301 setPixmap( 0, attachment->getDocLnk().pixmap().isNull() ? 300 setPixmap( 0, attachment->getDocLnk().pixmap().isNull() ?
302 Resource::loadPixmap( "UnknownDocument-14" ) : 301 OResource::loadPixmap( "UnknownDocument", OResource::SmallIcon ) :
303 attachment->getDocLnk().pixmap() ); 302 attachment->getDocLnk().pixmap() );
304 setText( 0, att->getName().isEmpty() ? att->getFileName() : att->getName() ); 303 setText( 0, att->getName().isEmpty() ? att->getFileName() : att->getName() );
305 setText( 1, QString::number( att->getSize() ) ); 304 setText( 1, QString::number( att->getSize() ) );
306} 305}
307 306
diff --git a/noncore/net/mail/config.in b/noncore/net/mail/config.in
index f7fce91..b18feb7 100644
--- a/noncore/net/mail/config.in
+++ b/noncore/net/mail/config.in
@@ -1,10 +1,10 @@
1source noncore/net/mail/libmailwrapper/config.in 1source noncore/net/mail/libmailwrapper/config.in
2 2
3config MAIL3 3config MAIL3
4 boolean "opie-mail3 (a mail client)" 4 boolean "opie-mail3 (a mail client)"
5 default "y" 5 default "y"
6 depends ( LIBQPE || LIBQPE-X11 ) && LIBOPIE2CORE && LIBOPIE2PIM && LIBOPIE2MM && LIBMAILWRAPPER 6 depends ( LIBQPE || LIBQPE-X11 ) && LIBOPIE2CORE && LIBOPIE2UI && LIBOPIE2PIM && LIBOPIE2MM && LIBMAILWRAPPER
7 comment "opie-mail3 needs a libqpe, libopie2core, libopie2pim and the libmailwrapper" 7 comment "opie-mail3 needs a libqpe, libopie2core, libopie2ui, libopie2pim and the libmailwrapper"
8 depends ! ( ( LIBQPE || LIBQPE-X11 ) && LIBOPIE2CORE && LIBOPIE2PIM && LIBOPIE2MM && LIBMAILWRAPPER ) 8 depends ! ( ( LIBQPE || LIBQPE-X11 ) && LIBOPIE2CORE && LIBOPIE2UI && LIBOPIE2PIM && LIBOPIE2MM && LIBMAILWRAPPER )
9 9
10source noncore/net/mail/taskbarapplet/config.in 10source noncore/net/mail/taskbarapplet/config.in
diff --git a/noncore/net/mail/defines.h b/noncore/net/mail/defines.h
index 50d63dd..36ac5a1 100644
--- a/noncore/net/mail/defines.h
+++ b/noncore/net/mail/defines.h
@@ -1,72 +1,73 @@
1#ifndef DEFINE_CONSTANTS_H 1#ifndef DEFINE_CONSTANTS_H
2#define DEFINE_CONSTANTS_H 2#define DEFINE_CONSTANTS_H
3 3
4#include <qpe/resource.h> 4#include <opie2/oresource.h>
5using namespace Opie::Core;
5 6
6#define USER_AGENT "OpieMail v0.3" 7#define USER_AGENT "OpieMail v0.3"
7 8
8#define PIC_COMPOSEMAIL "mail/composemail" 9#define PIC_COMPOSEMAIL "mail/composemail"
9#define PIC_SENDQUEUED "mail/sendqueued" 10#define PIC_SENDQUEUED "mail/sendqueued"
10#define PIC_SHOWFOLDERS "mail/showfolders" 11#define PIC_SHOWFOLDERS "mail/showfolders"
11#define PIC_SYNC "mail/sync" 12#define PIC_SYNC "mail/sync"
12#define PIC_IMAPFOLDER "mail/imapfolder" 13#define PIC_IMAPFOLDER "mail/imapfolder"
13#define PIC_MBOXFOLDER "mail/mboxfolder" 14#define PIC_MBOXFOLDER "mail/mboxfolder"
14#define PIC_POP3FOLDER "mail/pop3folder" 15#define PIC_POP3FOLDER "mail/pop3folder"
15#define PIC_INBOXFOLDER "mail/inbox" 16#define PIC_INBOXFOLDER "mail/inbox"
16#define PIC_OUTBOXFOLDER "mail/outbox" 17#define PIC_OUTBOXFOLDER "mail/outbox"
17#define PIC_LOCALFOLDER "mail/localfolder" 18#define PIC_LOCALFOLDER "mail/localfolder"
18 19
19#define PIC_OFFLINE "mail/notconnected" 20#define PIC_OFFLINE "mail/notconnected"
20#define PIC_DOCUMENT "DocsIcon" 21#define PIC_DOCUMENT "DocsIcon"
21 22
22#define ICON_COMPOSEMAIL QIconSet( Resource::loadPixmap( PIC_COMPOSEMAIL ) ) 23#define ICON_COMPOSEMAIL QIconSet( OResource::loadPixmap( PIC_COMPOSEMAIL, OResource::SmallIcon ) )
23#define ICON_SENDQUEUED QIconSet( Resource::loadPixmap( PIC_SENDQUEUED ) ) 24#define ICON_SENDQUEUED QIconSet( OResource::loadPixmap( PIC_SENDQUEUED, OResource::SmallIcon ) )
24#define ICON_SHOWFOLDERS QIconSet( Resource::loadPixmap( PIC_SHOWFOLDERS ) ) 25#define ICON_SHOWFOLDERS QIconSet( OResource::loadPixmap( PIC_SHOWFOLDERS, OResource::SmallIcon ) )
25#define ICON_SEARCHMAILS QIconSet( Resource::loadPixmap( PIC_SEARCHMAILS ) ) 26#define ICON_SEARCHMAILS QIconSet( OResource::loadPixmap( PIC_SEARCHMAILS, OResource::SmallIcon ) )
26#define ICON_EDITSETTINGS QIconSet( Resource::loadPixmap( PIC_EDITSETTINGS ) ) 27#define ICON_EDITSETTINGS QIconSet( OResource::loadPixmap( PIC_EDITSETTINGS, OResource::SmallIcon ) )
27#define ICON_EDITACCOUNTS QIconSet( Resource::loadPixmap( PIC_EDITACCOUNTS ) ) 28#define ICON_EDITACCOUNTS QIconSet( OResource::loadPixmap( PIC_EDITACCOUNTS, OResource::SmallIcon ) )
28#define ICON_SYNC QIconSet( Resource::loadPixmap( PIC_SYNC ) ) 29#define ICON_SYNC QIconSet( OResource::loadPixmap( PIC_SYNC, OResource::SmallIcon ) )
29#define ICON_READMAIL QIconSet( Resource::loadPixmap( PIC_DOCUMENT)) 30#define ICON_READMAIL QIconSet( OResource::loadPixmap( PIC_DOCUMENT, OResource::SmallIcon) )
30 31
31#define PIXMAP_IMAPFOLDER QPixmap( Resource::loadPixmap( PIC_IMAPFOLDER ) ) 32#define PIXMAP_IMAPFOLDER QPixmap( OResource::loadPixmap( PIC_IMAPFOLDER, OResource::SmallIcon ) )
32#define PIXMAP_POP3FOLDER QPixmap( Resource::loadPixmap( PIC_POP3FOLDER ) ) 33#define PIXMAP_POP3FOLDER QPixmap( OResource::loadPixmap( PIC_POP3FOLDER, OResource::SmallIcon ) )
33#define PIXMAP_INBOXFOLDER QPixmap( Resource::loadPixmap( PIC_INBOXFOLDER) ) 34#define PIXMAP_INBOXFOLDER QPixmap( OResource::loadPixmap( PIC_INBOXFOLDER, OResource::SmallIcon ) )
34#define PIXMAP_MBOXFOLDER QPixmap( Resource::loadPixmap( PIC_MBOXFOLDER ) ) 35#define PIXMAP_MBOXFOLDER QPixmap( OResource::loadPixmap( PIC_MBOXFOLDER, OResource::SmallIcon ) )
35#define PIXMAP_OUTBOXFOLDER QPixmap( Resource::loadPixmap( PIC_OUTBOXFOLDER) ) 36#define PIXMAP_OUTBOXFOLDER QPixmap( OResource::loadPixmap( PIC_OUTBOXFOLDER, OResource::SmallIcon ) )
36#define PIXMAP_LOCALFOLDER QPixmap( Resource::loadPixmap( PIC_LOCALFOLDER) ) 37#define PIXMAP_LOCALFOLDER QPixmap( OResource::loadPixmap( PIC_LOCALFOLDER, OResource::SmallIcon ) )
37#define PIXMAP_OFFLINE QPixmap( Resource::loadPixmap( PIC_OFFLINE) ) 38#define PIXMAP_OFFLINE QPixmap( OResource::loadPixmap( PIC_OFFLINE, OResource::SmallIcon ) )
38 39
39#define IMAP_PORT "143" 40#define IMAP_PORT "143"
40#define IMAP_SSL_PORT "993" 41#define IMAP_SSL_PORT "993"
41#define SMTP_PORT "25" 42#define SMTP_PORT "25"
42#define SMTP_SSL_PORT "465" 43#define SMTP_SSL_PORT "465"
43#define POP3_PORT "110" 44#define POP3_PORT "110"
44#define POP3_SSL_PORT "995" 45#define POP3_SSL_PORT "995"
45#define NNTP_PORT "119" 46#define NNTP_PORT "119"
46#define NNTP_SSL_PORT "563" 47#define NNTP_SSL_PORT "563"
47 48
48/* used for decoding imapfoldername */ 49/* used for decoding imapfoldername */
49#define UNDEFINED 64 50#define UNDEFINED 64
50#define MAXLINE 76 51#define MAXLINE 76
51#define UTF16MASK 0x03FFUL 52#define UTF16MASK 0x03FFUL
52#define UTF16SHIFT 10 53#define UTF16SHIFT 10
53#define UTF16BASE 0x10000UL 54#define UTF16BASE 0x10000UL
54#define UTF16HIGHSTART 0xD800UL 55#define UTF16HIGHSTART 0xD800UL
55#define UTF16HIGHEND 0xDBFFUL 56#define UTF16HIGHEND 0xDBFFUL
56#define UTF16LOSTART 0xDC00UL 57#define UTF16LOSTART 0xDC00UL
57#define UTF16LOEND 0xDFFFUL 58#define UTF16LOEND 0xDFFFUL
58 59
59/* used for making menuids transparent */ 60/* used for making menuids transparent */
60#define FOLDER_MENU_REFRESH_HEADER 0 61#define FOLDER_MENU_REFRESH_HEADER 0
61#define FOLDER_MENU_DELETE_ALL_MAILS 1 62#define FOLDER_MENU_DELETE_ALL_MAILS 1
62#define FOLDER_MENU_NEW_SUBFOLDER 2 63#define FOLDER_MENU_NEW_SUBFOLDER 2
63#define FOLDER_MENU_DELETE_FOLDER 3 64#define FOLDER_MENU_DELETE_FOLDER 3
64#define FOLDER_MENU_MOVE_MAILS 4 65#define FOLDER_MENU_MOVE_MAILS 4
65 66
66#define SERVER_MENU_DISCONNECT 5 67#define SERVER_MENU_DISCONNECT 5
67#define SERVER_MENU_OFFLINE 6 68#define SERVER_MENU_OFFLINE 6
68#define SERVER_MENU_REFRESH_FOLDER 7 69#define SERVER_MENU_REFRESH_FOLDER 7
69#define SERVER_MENU_CREATE_FOLDER 8 70#define SERVER_MENU_CREATE_FOLDER 8
70#define SERVER_MENU_SUBSCRIBE 9 71#define SERVER_MENU_SUBSCRIBE 9
71 72
72#endif 73#endif
diff --git a/noncore/net/mail/mailistviewitem.cpp b/noncore/net/mail/mailistviewitem.cpp
index d3a0723..5254616 100644
--- a/noncore/net/mail/mailistviewitem.cpp
+++ b/noncore/net/mail/mailistviewitem.cpp
@@ -1,86 +1,90 @@
1#include "mailistviewitem.h" 1#include "mailistviewitem.h"
2#include <libmailwrapper/abstractmail.h> 2#include <libmailwrapper/abstractmail.h>
3#include <qtextstream.h> 3
4#include <qpe/resource.h> 4/* OPIE */
5#include <opie2/oresource.h>
5#include <qpe/timestring.h> 6#include <qpe/timestring.h>
6 7
8/* QT */
9#include <qtextstream.h>
10
7MailListViewItem::MailListViewItem(QListView * parent, MailListViewItem * item ) 11MailListViewItem::MailListViewItem(QListView * parent, MailListViewItem * item )
8 :QListViewItem(parent,item),mail_data() 12 :QListViewItem(parent,item),mail_data()
9{ 13{
10} 14}
11 15
12void MailListViewItem::showEntry() 16void MailListViewItem::showEntry()
13{ 17{
14 if ( mail_data->getFlags().testBit( FLAG_ANSWERED ) == true) { 18 if ( mail_data->getFlags().testBit( FLAG_ANSWERED ) == true) {
15 setPixmap( 0, Resource::loadPixmap( "mail/kmmsgreplied") ); 19 setPixmap( 0, Opie::Core::OResource::loadPixmap( "mail/kmmsgreplied", Opie::Core::OResource::SmallIcon ) );
16 } else if ( mail_data->getFlags().testBit( FLAG_SEEN ) == true ) { 20 } else if ( mail_data->getFlags().testBit( FLAG_SEEN ) == true ) {
17 /* I think it looks nicer if there are not such a lot of icons but only on mails 21 /* I think it looks nicer if there are not such a lot of icons but only on mails
18 replied or new - Alwin*/ 22 replied or new - Alwin*/
19 //setPixmap( 0, Resource::loadPixmap( "mail/kmmsgunseen") ); 23 //setPixmap( 0, Opie::Core::OResource::loadPixmap( "mail/kmmsgunseen", Opie::Core::OResource::SmallIcon ) );
20 } else { 24 } else {
21 setPixmap( 0, Resource::loadPixmap( "mail/kmmsgnew") ); 25 setPixmap( 0, Opie::Core::OResource::loadPixmap( "mail/kmmsgnew", Opie::Core::OResource::SmallIcon ) );
22 } 26 }
23 double s = mail_data->Msgsize(); 27 double s = mail_data->Msgsize();
24 int w; 28 int w;
25 w=0; 29 w=0;
26 30
27 while (s>1024) { 31 while (s>1024) {
28 s/=1024; 32 s/=1024;
29 ++w; 33 ++w;
30 if (w>=2) break; 34 if (w>=2) break;
31 } 35 }
32 36
33 QString q=""; 37 QString q="";
34 QString fsize=""; 38 QString fsize="";
35 switch(w) { 39 switch(w) {
36 case 1: 40 case 1:
37 q="k"; 41 q="k";
38 break; 42 break;
39 case 2: 43 case 2:
40 q="M"; 44 q="M";
41 break; 45 break;
42 default: 46 default:
43 break; 47 break;
44 } 48 }
45 49
46 { 50 {
47 QTextOStream o(&fsize); 51 QTextOStream o(&fsize);
48 if (w>0) o.precision(2); else o.precision(0); 52 if (w>0) o.precision(2); else o.precision(0);
49 o.setf(QTextStream::fixed); 53 o.setf(QTextStream::fixed);
50 o << s << " " << q << "Byte"; 54 o << s << " " << q << "Byte";
51 } 55 }
52 setText(1,mail_data->getSubject()); 56 setText(1,mail_data->getSubject());
53 setText(2,mail_data->getFrom()); 57 setText(2,mail_data->getFrom());
54 setText(3,fsize); 58 setText(3,fsize);
55 setText(4,mail_data->getStringDate()); 59 setText(4,mail_data->getStringDate());
56} 60}
57 61
58QString MailListViewItem::key(int col,bool) const 62QString MailListViewItem::key(int col,bool) const
59{ 63{
60 QString temp; 64 QString temp;
61 if (col == 4) { 65 if (col == 4) {
62 temp.sprintf( "%08d",QDateTime().secsTo(mail_data->getDate())); 66 temp.sprintf( "%08d",QDateTime().secsTo(mail_data->getDate()));
63 return temp; 67 return temp;
64 } 68 }
65 if (col == 3) { 69 if (col == 3) {
66 temp.sprintf( "%020d",mail_data->Msgsize()); 70 temp.sprintf( "%020d",mail_data->Msgsize());
67 return temp; 71 return temp;
68 } 72 }
69 return text(col); 73 return text(col);
70} 74}
71 75
72void MailListViewItem::storeData(const RecMailP&data) 76void MailListViewItem::storeData(const RecMailP&data)
73{ 77{
74 mail_data = data; 78 mail_data = data;
75} 79}
76 80
77const RecMailP& MailListViewItem::data()const 81const RecMailP& MailListViewItem::data()const
78{ 82{
79 return mail_data; 83 return mail_data;
80} 84}
81 85
82MAILLIB::ATYPE MailListViewItem::wrapperType() 86MAILLIB::ATYPE MailListViewItem::wrapperType()
83{ 87{
84 if (!mail_data->Wrapper()) return MAILLIB::A_UNDEFINED; 88 if (!mail_data->Wrapper()) return MAILLIB::A_UNDEFINED;
85 return mail_data->Wrapper()->getType(); 89 return mail_data->Wrapper()->getType();
86} 90}
diff --git a/noncore/net/mail/mainwindow.cpp b/noncore/net/mail/mainwindow.cpp
index b587424..bce4c0d 100644
--- a/noncore/net/mail/mainwindow.cpp
+++ b/noncore/net/mail/mainwindow.cpp
@@ -1,280 +1,281 @@
1#include <qlabel.h> 1#include "defines.h"
2#include <qvbox.h> 2#include "mainwindow.h"
3#include <qheader.h>
4#include <qtimer.h>
5#include <qlayout.h>
6 3
4/* OPIE */
7#include <opie2/odebug.h> 5#include <opie2/odebug.h>
6#include <opie2/oresource.h>
8#include <qpe/qpeapplication.h> 7#include <qpe/qpeapplication.h>
9#include <qpe/qcopenvelope_qws.h> 8#include <qpe/qcopenvelope_qws.h>
10
11#include "defines.h"
12#include "mainwindow.h"
13
14using namespace Opie::Core; 9using namespace Opie::Core;
15 10
11/* QT */
12#include <qlabel.h>
13#include <qvbox.h>
14#include <qheader.h>
15#include <qtimer.h>
16#include <qlayout.h>
17
16MainWindow::MainWindow( QWidget *parent, const char *name, WFlags flags ) 18MainWindow::MainWindow( QWidget *parent, const char *name, WFlags flags )
17 : QMainWindow( parent, name, flags ) 19 : QMainWindow( parent, name, flags )
18{ 20{
19
20 setCaption( tr( "Mail" ) ); 21 setCaption( tr( "Mail" ) );
21 setToolBarsMovable( false ); 22 setToolBarsMovable( false );
22 23
23 toolBar = new QToolBar( this ); 24 toolBar = new QToolBar( this );
24 menuBar = new QMenuBar( toolBar ); 25 menuBar = new QMenuBar( toolBar );
25 26
26 mailMenu = new QPopupMenu( menuBar ); 27 mailMenu = new QPopupMenu( menuBar );
27 menuBar->insertItem( tr( "Mail" ), mailMenu ); 28 menuBar->insertItem( tr( "Mail" ), mailMenu );
28 29
29 settingsMenu = new QPopupMenu( menuBar ); 30 settingsMenu = new QPopupMenu( menuBar );
30 menuBar->insertItem( tr( "Settings" ), settingsMenu ); 31 menuBar->insertItem( tr( "Settings" ), settingsMenu );
31 32
32 if (QApplication::desktop()->width()<330) { 33 if (QApplication::desktop()->width()<330) {
33 serverMenu = new QPopupMenu( mailMenu ); 34 serverMenu = new QPopupMenu( mailMenu );
34 folderMenu = new QPopupMenu( mailMenu ); 35 folderMenu = new QPopupMenu( mailMenu );
35 m_ServerMenuId = mailMenu->insertItem( tr( "Server" ), serverMenu ); 36 m_ServerMenuId = mailMenu->insertItem( tr( "Server" ), serverMenu );
36 m_FolderMenuId = mailMenu->insertItem( tr( "Folder" ), folderMenu ); 37 m_FolderMenuId = mailMenu->insertItem( tr( "Folder" ), folderMenu );
37 } else { 38 } else {
38 serverMenu = new QPopupMenu( menuBar ); 39 serverMenu = new QPopupMenu( menuBar );
39 folderMenu = new QPopupMenu( menuBar ); 40 folderMenu = new QPopupMenu( menuBar );
40 m_FolderMenuId = menuBar->insertItem( tr( "Folder" ), folderMenu ); 41 m_FolderMenuId = menuBar->insertItem( tr( "Folder" ), folderMenu );
41 m_ServerMenuId = menuBar->insertItem( tr( "Server" ), serverMenu ); 42 m_ServerMenuId = menuBar->insertItem( tr( "Server" ), serverMenu );
42 } 43 }
43 serverMenu->insertItem(tr("Disconnect"),SERVER_MENU_DISCONNECT); 44 serverMenu->insertItem(tr("Disconnect"),SERVER_MENU_DISCONNECT);
44 serverMenu->insertItem(tr("Set on/offline"),SERVER_MENU_OFFLINE); 45 serverMenu->insertItem(tr("Set on/offline"),SERVER_MENU_OFFLINE);
45 serverMenu->insertSeparator(); 46 serverMenu->insertSeparator();
46 serverMenu->insertItem(tr("Refresh folder list"),SERVER_MENU_REFRESH_FOLDER); 47 serverMenu->insertItem(tr("Refresh folder list"),SERVER_MENU_REFRESH_FOLDER);
47 serverMenu->insertItem(tr("Create new folder"),SERVER_MENU_CREATE_FOLDER); 48 serverMenu->insertItem(tr("Create new folder"),SERVER_MENU_CREATE_FOLDER);
48 serverMenu->insertSeparator(); 49 serverMenu->insertSeparator();
49 serverMenu->insertItem(tr("(Un-)Subscribe groups"),SERVER_MENU_SUBSCRIBE); 50 serverMenu->insertItem(tr("(Un-)Subscribe groups"),SERVER_MENU_SUBSCRIBE);
50 51
51 folderMenu->insertItem(tr("Refresh headerlist"),FOLDER_MENU_REFRESH_HEADER); 52 folderMenu->insertItem(tr("Refresh headerlist"),FOLDER_MENU_REFRESH_HEADER);
52 folderMenu->insertItem(tr("Delete all mails"),FOLDER_MENU_DELETE_ALL_MAILS); 53 folderMenu->insertItem(tr("Delete all mails"),FOLDER_MENU_DELETE_ALL_MAILS);
53 folderMenu->insertItem(tr("New subfolder"),FOLDER_MENU_NEW_SUBFOLDER); 54 folderMenu->insertItem(tr("New subfolder"),FOLDER_MENU_NEW_SUBFOLDER);
54 folderMenu->insertItem(tr("Delete folder"),FOLDER_MENU_DELETE_FOLDER); 55 folderMenu->insertItem(tr("Delete folder"),FOLDER_MENU_DELETE_FOLDER);
55 folderMenu->insertItem(tr("Move/Copie all mails"),FOLDER_MENU_MOVE_MAILS); 56 folderMenu->insertItem(tr("Move/Copie all mails"),FOLDER_MENU_MOVE_MAILS);
56 menuBar->setItemEnabled(m_ServerMenuId,false); 57 menuBar->setItemEnabled(m_ServerMenuId,false);
57 menuBar->setItemEnabled(m_FolderMenuId,false); 58 menuBar->setItemEnabled(m_FolderMenuId,false);
58 59
59 addToolBar( toolBar ); 60 addToolBar( toolBar );
60 toolBar->setHorizontalStretchable( true ); 61 toolBar->setHorizontalStretchable( true );
61 62
62 QLabel *spacer = new QLabel( toolBar ); 63 QLabel *spacer = new QLabel( toolBar );
63 spacer->setBackgroundMode( QWidget::PaletteButton ); 64 spacer->setBackgroundMode( QWidget::PaletteButton );
64 toolBar->setStretchableWidget( spacer ); 65 toolBar->setStretchableWidget( spacer );
65 66
66 readMail = new QAction(tr("Read current mail"),ICON_READMAIL,0,0,this); 67 readMail = new QAction(tr("Read current mail"),ICON_READMAIL,0,0,this);
67 readMail->addTo(toolBar); 68 readMail->addTo(toolBar);
68 readMail->addTo(mailMenu); 69 readMail->addTo(mailMenu);
69 connect(readMail,SIGNAL(activated()),this,SLOT(displayMail())); 70 connect(readMail,SIGNAL(activated()),this,SLOT(displayMail()));
70 71
71 composeMail = new QAction( tr( "Compose new mail" ), ICON_COMPOSEMAIL, 72 composeMail = new QAction( tr( "Compose new mail" ), ICON_COMPOSEMAIL,
72 0, 0, this ); 73 0, 0, this );
73 composeMail->addTo( toolBar ); 74 composeMail->addTo( toolBar );
74 composeMail->addTo( mailMenu ); 75 composeMail->addTo( mailMenu );
75 76
76 77
77 sendQueued = new QAction( tr( "Send queued mails" ), ICON_SENDQUEUED, 78 sendQueued = new QAction( tr( "Send queued mails" ), ICON_SENDQUEUED,
78 0, 0, this ); 79 0, 0, this );
79 sendQueued->addTo( toolBar ); 80 sendQueued->addTo( toolBar );
80 sendQueued->addTo( mailMenu ); 81 sendQueued->addTo( mailMenu );
81 82
82 /* 83 /*
83 syncFolders = new QAction( tr( "Sync mailfolders" ), ICON_SYNC, 84 syncFolders = new QAction( tr( "Sync mailfolders" ), ICON_SYNC,
84 0, 0, this ); 85 0, 0, this );
85 syncFolders->addTo( toolBar ); 86 syncFolders->addTo( toolBar );
86 syncFolders->addTo( mailMenu ); 87 syncFolders->addTo( mailMenu );
87 */ 88 */
88 89
89 showFolders = new QAction( tr( "Show/Hide folders" ), ICON_SHOWFOLDERS, 90 showFolders = new QAction( tr( "Show/Hide folders" ), ICON_SHOWFOLDERS,
90 0, 0, this, 0, true ); 91 0, 0, this, 0, true );
91 showFolders->addTo( toolBar ); 92 showFolders->addTo( toolBar );
92 showFolders->addTo( mailMenu ); 93 showFolders->addTo( mailMenu );
93 showFolders->setOn( true ); 94 showFolders->setOn( true );
94 connect(showFolders, SIGNAL( toggled(bool) ), 95 connect(showFolders, SIGNAL( toggled(bool) ),
95 SLOT( slotShowFolders(bool) ) ); 96 SLOT( slotShowFolders(bool) ) );
96 97
97 /* 98 /*
98 searchMails = new QAction( tr( "Search mails" ), QIconSet( Resource::loadPixmap("find") ), 99 searchMails = new QAction( tr( "Search mails" ), OResource::loadPixmap("find", OResource::SmallIcon ),
99 0, 0, this ); 100 0, 0, this );
100 searchMails->addTo( toolBar ); 101 searchMails->addTo( toolBar );
101 searchMails->addTo( mailMenu ); 102 searchMails->addTo( mailMenu );
102 */ 103 */
103 104
104 deleteMails = new QAction(tr("Delete Mail"), QIconSet( Resource::loadPixmap("trash")), 0, 0, this); 105 deleteMails = new QAction(tr("Delete Mail"), OResource::loadPixmap("trash", OResource::SmallIcon ), 0, 0, this);
105 deleteMails->addTo( toolBar ); 106 deleteMails->addTo( toolBar );
106 deleteMails->addTo( mailMenu ); 107 deleteMails->addTo( mailMenu );
107 connect( deleteMails, SIGNAL( activated() ), 108 connect( deleteMails, SIGNAL( activated() ),
108 SLOT( slotDeleteMail() ) ); 109 SLOT( slotDeleteMail() ) );
109 110
110 editSettings = new QAction( tr( "Edit settings" ), QIconSet( Resource::loadPixmap("SettingsIcon") ) , 111 editSettings = new QAction( tr( "Edit settings" ), OResource::loadPixmap("SettingsIcon", OResource::SmallIcon ) ,
111 0, 0, this ); 112 0, 0, this );
112 editSettings->addTo( settingsMenu ); 113 editSettings->addTo( settingsMenu );
113 connect( editSettings, SIGNAL( activated() ), 114 connect( editSettings, SIGNAL( activated() ),
114 SLOT( slotEditSettings() ) ); 115 SLOT( slotEditSettings() ) );
115 editAccounts = new QAction( tr( "Configure accounts" ), QIconSet( Resource::loadPixmap("mail/editaccounts") ) , 116 editAccounts = new QAction( tr( "Configure accounts" ), OResource::loadPixmap("mail/editaccounts", OResource::SmallIcon ) ,
116 0, 0, this ); 117 0, 0, this );
117 editAccounts->addTo( settingsMenu ); 118 editAccounts->addTo( settingsMenu );
118 119
119 120
120 QWidget *view = new QWidget( this ); 121 QWidget *view = new QWidget( this );
121 setCentralWidget( view ); 122 setCentralWidget( view );
122 layout = new QBoxLayout ( view, QBoxLayout::LeftToRight ); 123 layout = new QBoxLayout ( view, QBoxLayout::LeftToRight );
123 124
124 folderView = new AccountView( view ); 125 folderView = new AccountView( view );
125 folderView->header()->hide(); 126 folderView->header()->hide();
126 folderView->setRootIsDecorated( true ); 127 folderView->setRootIsDecorated( true );
127 folderView->addColumn( tr( "Mailbox" ) ); 128 folderView->addColumn( tr( "Mailbox" ) );
128 connect(folderView,SIGNAL(serverSelected(int)),this,SLOT(serverSelected(int))); 129 connect(folderView,SIGNAL(serverSelected(int)),this,SLOT(serverSelected(int)));
129 connect(serverMenu,SIGNAL(activated(int)),folderView,SLOT(slotContextMenu(int))); 130 connect(serverMenu,SIGNAL(activated(int)),folderView,SLOT(slotContextMenu(int)));
130 connect(folderMenu,SIGNAL(activated(int)),folderView,SLOT(slotContextMenu(int))); 131 connect(folderMenu,SIGNAL(activated(int)),folderView,SLOT(slotContextMenu(int)));
131 connect(this,SIGNAL(settingsChanged()),folderView,SLOT(readSettings())); 132 connect(this,SIGNAL(settingsChanged()),folderView,SLOT(readSettings()));
132 133
133 134
134 layout->addWidget( folderView ); 135 layout->addWidget( folderView );
135 136
136 mailView = new QListView( view ); 137 mailView = new QListView( view );
137 mailView->addColumn( "" ); 138 mailView->addColumn( "" );
138 mailView->addColumn( tr( "Subject" ),QListView::Manual ); 139 mailView->addColumn( tr( "Subject" ),QListView::Manual );
139 mailView->addColumn( tr( "Sender" ),QListView::Manual ); 140 mailView->addColumn( tr( "Sender" ),QListView::Manual );
140 mailView->addColumn( tr( "Size" ),QListView::Manual); 141 mailView->addColumn( tr( "Size" ),QListView::Manual);
141 mailView->addColumn( tr( "Date" )); 142 mailView->addColumn( tr( "Date" ));
142 mailView->setAllColumnsShowFocus(true); 143 mailView->setAllColumnsShowFocus(true);
143 mailView->setShowSortIndicator(true); 144 mailView->setShowSortIndicator(true);
144 mailView->setSorting(4,false); 145 mailView->setSorting(4,false);
145 146
146 layout->addWidget( mailView ); 147 layout->addWidget( mailView );
147 layout->setStretchFactor( folderView, 1 ); 148 layout->setStretchFactor( folderView, 1 );
148 layout->setStretchFactor( mailView, 2 ); 149 layout->setStretchFactor( mailView, 2 );
149 150
150 m_Rotate = (QApplication::desktop()->width() > QApplication::desktop()->height()?0:90); 151 m_Rotate = (QApplication::desktop()->width() > QApplication::desktop()->height()?0:90);
151 152
152 slotAdjustLayout(); 153 slotAdjustLayout();
153 154
154 QPEApplication::setStylusOperation( mailView->viewport(),QPEApplication::RightOnHold); 155 QPEApplication::setStylusOperation( mailView->viewport(),QPEApplication::RightOnHold);
155 QPEApplication::setStylusOperation( folderView->viewport(),QPEApplication::RightOnHold); 156 QPEApplication::setStylusOperation( folderView->viewport(),QPEApplication::RightOnHold);
156 157
157 connect( mailView, SIGNAL( mouseButtonClicked(int,QListViewItem*,const QPoint&,int) ),this, 158 connect( mailView, SIGNAL( mouseButtonClicked(int,QListViewItem*,const QPoint&,int) ),this,
158 SLOT( mailLeftClicked(int,QListViewItem*,const QPoint&,int) ) ); 159 SLOT( mailLeftClicked(int,QListViewItem*,const QPoint&,int) ) );
159 connect( mailView, SIGNAL( mouseButtonPressed(int,QListViewItem*,const QPoint&,int) ),this, 160 connect( mailView, SIGNAL( mouseButtonPressed(int,QListViewItem*,const QPoint&,int) ),this,
160 SLOT( mailHold(int,QListViewItem*,const QPoint&,int) ) ); 161 SLOT( mailHold(int,QListViewItem*,const QPoint&,int) ) );
161 162
162 connect(folderView, SIGNAL(refreshMailview(const QValueList<RecMailP>&)), 163 connect(folderView, SIGNAL(refreshMailview(const QValueList<RecMailP>&)),
163 this,SLOT(refreshMailView(const QValueList<RecMailP>&))); 164 this,SLOT(refreshMailView(const QValueList<RecMailP>&)));
164 165
165 connect( composeMail, SIGNAL( activated() ), SLOT( slotComposeMail() ) ); 166 connect( composeMail, SIGNAL( activated() ), SLOT( slotComposeMail() ) );
166 connect( sendQueued, SIGNAL( activated() ), SLOT( slotSendQueued() ) ); 167 connect( sendQueued, SIGNAL( activated() ), SLOT( slotSendQueued() ) );
167 168
168// connect( searchMails, SIGNAL( activated() ), SLOT( slotSearchMails() ) ); 169// connect( searchMails, SIGNAL( activated() ), SLOT( slotSearchMails() ) );
169 connect( editAccounts, SIGNAL( activated() ), SLOT( slotEditAccounts() ) ); 170 connect( editAccounts, SIGNAL( activated() ), SLOT( slotEditAccounts() ) );
170 // Added by Stefan Eilers to allow starting by addressbook.. 171 // Added by Stefan Eilers to allow starting by addressbook..
171 // copied from old mail2 172 // copied from old mail2
172 173
173#if !defined(QT_NO_COP) 174#if !defined(QT_NO_COP)
174 connect( qApp, SIGNAL( appMessage(const QCString&,const QByteArray&) ), 175 connect( qApp, SIGNAL( appMessage(const QCString&,const QByteArray&) ),
175 this, SLOT( appMessage(const QCString&,const QByteArray&) ) ); 176 this, SLOT( appMessage(const QCString&,const QByteArray&) ) );
176 m_sysChannel = new QCopChannel( "QPE/System", this ); 177 m_sysChannel = new QCopChannel( "QPE/System", this );
177 connect( m_sysChannel, SIGNAL( received(const QCString&,const QByteArray&) ), 178 connect( m_sysChannel, SIGNAL( received(const QCString&,const QByteArray&) ),
178 this, SLOT( systemMessage(const QCString&,const QByteArray&) ) ); 179 this, SLOT( systemMessage(const QCString&,const QByteArray&) ) );
179#endif 180#endif
180 181
181 QTimer::singleShot( 10, this, SLOT( slotAdjustColumns() ) ); 182 QTimer::singleShot( 10, this, SLOT( slotAdjustColumns() ) );
182} 183}
183 184
184MainWindow::~MainWindow() 185MainWindow::~MainWindow()
185{ 186{
186} 187}
187 188
188void MainWindow::serverSelected(int) 189void MainWindow::serverSelected(int)
189{ 190{
190 odebug << "slotShowFolders not reached" << oendl; 191 odebug << "slotShowFolders not reached" << oendl;
191} 192}
192 193
193void MainWindow::systemMessage( const QCString& msg, const QByteArray& data ) 194void MainWindow::systemMessage( const QCString& msg, const QByteArray& data )
194{ 195{
195 int _newrotation; 196 int _newrotation;
196 QDataStream stream( data, IO_ReadOnly ); 197 QDataStream stream( data, IO_ReadOnly );
197 if ( msg == "setCurrentRotation(int)" ) 198 if ( msg == "setCurrentRotation(int)" )
198 { 199 {
199 stream >> _newrotation; 200 stream >> _newrotation;
200 if (m_Rotate != _newrotation) { 201 if (m_Rotate != _newrotation) {
201 slotAdjustLayout(); 202 slotAdjustLayout();
202 m_Rotate = _newrotation; 203 m_Rotate = _newrotation;
203 } 204 }
204 } 205 }
205} 206}
206 207
207void MainWindow::appMessage(const QCString &, const QByteArray &) 208void MainWindow::appMessage(const QCString &, const QByteArray &)
208{ 209{
209 odebug << "appMessage not reached" << oendl; 210 odebug << "appMessage not reached" << oendl;
210} 211}
211 212
212void MainWindow::slotAdjustLayout() { 213void MainWindow::slotAdjustLayout() {
213 214
214 QWidget *d = QApplication::desktop(); 215 QWidget *d = QApplication::desktop();
215 if ( d->width() < d->height() ) { 216 if ( d->width() < d->height() ) {
216 layout->setDirection( QBoxLayout::TopToBottom ); 217 layout->setDirection( QBoxLayout::TopToBottom );
217 } else { 218 } else {
218 layout->setDirection( QBoxLayout::LeftToRight ); 219 layout->setDirection( QBoxLayout::LeftToRight );
219 } 220 }
220} 221}
221 222
222void MainWindow::slotAdjustColumns() 223void MainWindow::slotAdjustColumns()
223{ 224{
224 bool hidden = folderView->isHidden(); 225 bool hidden = folderView->isHidden();
225 if ( hidden ) folderView->show(); 226 if ( hidden ) folderView->show();
226 folderView->setColumnWidth( 0, folderView->visibleWidth() ); 227 folderView->setColumnWidth( 0, folderView->visibleWidth() );
227 if ( hidden ) folderView->hide(); 228 if ( hidden ) folderView->hide();
228 229
229 mailView->setColumnWidth( 0, 10 ); 230 mailView->setColumnWidth( 0, 10 );
230 mailView->setColumnWidth( 1, mailView->visibleWidth() - 130 ); 231 mailView->setColumnWidth( 1, mailView->visibleWidth() - 130 );
231 mailView->setColumnWidth( 2, 80 ); 232 mailView->setColumnWidth( 2, 80 );
232 mailView->setColumnWidth( 3, 50 ); 233 mailView->setColumnWidth( 3, 50 );
233 mailView->setColumnWidth( 4, 50 ); 234 mailView->setColumnWidth( 4, 50 );
234} 235}
235 236
236void MainWindow::slotEditSettings() 237void MainWindow::slotEditSettings()
237{ 238{
238} 239}
239 240
240void MainWindow::slotShowFolders( bool ) 241void MainWindow::slotShowFolders( bool )
241{ 242{
242 odebug << "slotShowFolders not reached" << oendl; 243 odebug << "slotShowFolders not reached" << oendl;
243} 244}
244 245
245void MainWindow::refreshMailView(const QValueList<RecMailP>&) 246void MainWindow::refreshMailView(const QValueList<RecMailP>&)
246{ 247{
247 odebug << "refreshMailView not reached" << oendl; 248 odebug << "refreshMailView not reached" << oendl;
248} 249}
249 250
250void MainWindow::mailLeftClicked(int, QListViewItem *,const QPoint&,int ) 251void MainWindow::mailLeftClicked(int, QListViewItem *,const QPoint&,int )
251{ 252{
252 odebug << "mailLeftClicked not reached" << oendl; 253 odebug << "mailLeftClicked not reached" << oendl;
253} 254}
254 255
255void MainWindow::displayMail() 256void MainWindow::displayMail()
256{ 257{
257 odebug << "displayMail not reached" << oendl; 258 odebug << "displayMail not reached" << oendl;
258} 259}
259 260
260void MainWindow::slotDeleteMail() 261void MainWindow::slotDeleteMail()
261{ 262{
262 odebug << "deleteMail not reached" << oendl; 263 odebug << "deleteMail not reached" << oendl;
263} 264}
264 265
265void MainWindow::mailHold(int, QListViewItem *,const QPoint&,int ) 266void MainWindow::mailHold(int, QListViewItem *,const QPoint&,int )
266{ 267{
267 odebug << "mailHold not reached" << oendl; 268 odebug << "mailHold not reached" << oendl;
268} 269}
269 270
270void MainWindow::slotSendQueued() 271void MainWindow::slotSendQueued()
271{ 272{
272} 273}
273 274
274void MainWindow::slotEditAccounts() 275void MainWindow::slotEditAccounts()
275{ 276{
276} 277}
277 278
278void MainWindow::slotComposeMail() 279void MainWindow::slotComposeMail()
279{ 280{
280} 281}
diff --git a/noncore/net/mail/opiemail.cpp b/noncore/net/mail/opiemail.cpp
index fb8877a..e07ed6f 100644
--- a/noncore/net/mail/opiemail.cpp
+++ b/noncore/net/mail/opiemail.cpp
@@ -1,440 +1,439 @@
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
14/* OPIE */ 15/* OPIE */
15#include <opie2/odebug.h> 16#include <opie2/odebug.h>
16#include <qpe/resource.h>
17#include <qpe/qpeapplication.h> 17#include <qpe/qpeapplication.h>
18#include <qpe/config.h> 18#include <qpe/config.h>
19using namespace Opie::Core;
19 20
20/* QT */ 21/* QT */
21#include <qmap.h> 22#include <qmap.h>
22#include <qvaluelist.h> 23#include <qvaluelist.h>
23 24
24/* UNIX */ 25/* UNIX */
25#include <signal.h> 26#include <signal.h>
26 27
27using namespace Opie::Core;
28
29typedef QMapNode<QString,QString> tkeyvalues; 28typedef QMapNode<QString,QString> tkeyvalues;
30typedef QValueList<tkeyvalues> tvaluelist; 29typedef QValueList<tkeyvalues> tvaluelist;
31 30
32class ValueExplode 31class ValueExplode
33{ 32{
34protected: 33protected:
35 //! what was parsed last 34 //! what was parsed last
36 tvaluelist m_LastParsed; 35 tvaluelist m_LastParsed;
37 //! the delemiter to use 36 //! the delemiter to use
38 QString mDelemiter; 37 QString mDelemiter;
39 //! the inner delemiter 38 //! the inner delemiter
40 QString m2Delemiter; 39 QString m2Delemiter;
41 //! the real split routine 40 //! the real split routine
42 void splitit(); 41 void splitit();
43 //! the content 42 //! the content
44 QString m_Command; 43 QString m_Command;
45 //! constructor 44 //! constructor
46 ValueExplode(){} 45 ValueExplode(){}
47public: 46public:
48 //! constructor 47 //! constructor
49 /*! 48 /*!
50 * \param aCommand the string to be splitted 49 * \param aCommand the string to be splitted
51 * \param aDelemiter which sign will be the delemiter character 50 * \param aDelemiter which sign will be the delemiter character
52 * \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
53 */ 52 */
54 ValueExplode(const QString&aCommand,const char aDelemiter = '&',const char a2Delemiter='='); 53 ValueExplode(const QString&aCommand,const char aDelemiter = '&',const char a2Delemiter='=');
55 //! destructor 54 //! destructor
56 virtual ~ValueExplode(); 55 virtual ~ValueExplode();
57 //! assigen operator 56 //! assigen operator
58 /*! 57 /*!
59 * \return a list of substrings 58 * \return a list of substrings
60 */ 59 */
61 operator const tvaluelist& (){return m_LastParsed;} 60 operator const tvaluelist& (){return m_LastParsed;}
62}; 61};
63 62
64ValueExplode::~ValueExplode() 63ValueExplode::~ValueExplode()
65{ 64{
66} 65}
67 66
68ValueExplode::ValueExplode(const QString&aCommand,const char aDelemiter,const char a2Delemiter) 67ValueExplode::ValueExplode(const QString&aCommand,const char aDelemiter,const char a2Delemiter)
69 :m_LastParsed(),m_Command(aCommand) 68 :m_LastParsed(),m_Command(aCommand)
70{ 69{
71 mDelemiter = aDelemiter; 70 mDelemiter = aDelemiter;
72 m2Delemiter = a2Delemiter; 71 m2Delemiter = a2Delemiter;
73 splitit(); 72 splitit();
74} 73}
75 74
76void ValueExplode::splitit() 75void ValueExplode::splitit()
77{ 76{
78 QString iLine; 77 QString iLine;
79 m_LastParsed.clear(); 78 m_LastParsed.clear();
80 if (mDelemiter.isEmpty()||m2Delemiter.isEmpty()) { 79 if (mDelemiter.isEmpty()||m2Delemiter.isEmpty()) {
81 m_LastParsed.append(tkeyvalues(m_Command,"")); 80 m_LastParsed.append(tkeyvalues(m_Command,""));
82 return; 81 return;
83 } 82 }
84 int pos,pos2; 83 int pos,pos2;
85 unsigned startpos = 0; 84 unsigned startpos = 0;
86 iLine = m_Command; 85 iLine = m_Command;
87 while ( (pos = iLine.find(mDelemiter,startpos))!=-1) { 86 while ( (pos = iLine.find(mDelemiter,startpos))!=-1) {
88 pos2 = iLine.find(m2Delemiter,startpos); 87 pos2 = iLine.find(m2Delemiter,startpos);
89 if (pos2==-1||pos2>pos) { 88 if (pos2==-1||pos2>pos) {
90 m_LastParsed.append(tkeyvalues(iLine.mid(startpos,pos-startpos),"")); 89 m_LastParsed.append(tkeyvalues(iLine.mid(startpos,pos-startpos),""));
91 } else { 90 } else {
92 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)));
93 } 92 }
94 startpos = pos+1; 93 startpos = pos+1;
95 } 94 }
96 if (startpos<iLine.length()) { 95 if (startpos<iLine.length()) {
97 pos2 = iLine.find(m2Delemiter,startpos); 96 pos2 = iLine.find(m2Delemiter,startpos);
98 if (pos2==-1) { 97 if (pos2==-1) {
99 m_LastParsed.append(tkeyvalues(iLine.mid(startpos),"")); 98 m_LastParsed.append(tkeyvalues(iLine.mid(startpos),""));
100 } else { 99 } else {
101 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)));
102 } 101 }
103 } 102 }
104} 103}
105 104
106OpieMail::OpieMail( QWidget *parent, const char *name, WFlags ) 105OpieMail::OpieMail( QWidget *parent, const char *name, WFlags )
107 : MainWindow( parent, name, WStyle_ContextHelp ) 106 : MainWindow( parent, name, WStyle_ContextHelp )
108{ 107{
109 setup_signalblocking(); 108 setup_signalblocking();
110 Config cfg("mail"); 109 Config cfg("mail");
111 cfg.setGroup( "Settings" ); 110 cfg.setGroup( "Settings" );
112 m_clickopens = cfg.readBoolEntry("clickOpensMail",true); 111 m_clickopens = cfg.readBoolEntry("clickOpensMail",true);
113 112
114 settings = new Settings(); 113 settings = new Settings();
115 folderView->populate( settings->getAccounts() ); 114 folderView->populate( settings->getAccounts() );
116 connect(folderView,SIGNAL(refreshMenues(int)),this,SLOT(refreshMenu(int))); 115 connect(folderView,SIGNAL(refreshMenues(int)),this,SLOT(refreshMenu(int)));
117} 116}
118 117
119OpieMail::~OpieMail() 118OpieMail::~OpieMail()
120{ 119{
121 if (settings) delete settings; 120 if (settings) delete settings;
122} 121}
123 122
124void OpieMail::setup_signalblocking() 123void OpieMail::setup_signalblocking()
125{ 124{
126 /* for networking we must block SIGPIPE and Co. */ 125 /* for networking we must block SIGPIPE and Co. */
127 struct sigaction blocking_action,temp_action; 126 struct sigaction blocking_action,temp_action;
128 blocking_action.sa_handler = SIG_IGN; 127 blocking_action.sa_handler = SIG_IGN;
129 sigemptyset(&(blocking_action.sa_mask)); 128 sigemptyset(&(blocking_action.sa_mask));
130 blocking_action.sa_flags = 0; 129 blocking_action.sa_flags = 0;
131 sigaction(SIGPIPE,&blocking_action,&temp_action); 130 sigaction(SIGPIPE,&blocking_action,&temp_action);
132} 131}
133 132
134void OpieMail::appMessage(const QCString &msg, const QByteArray &data) 133void OpieMail::appMessage(const QCString &msg, const QByteArray &data)
135{ 134{
136 // copied from old mail2 135 // copied from old mail2
137 if (msg == "writeMail(QString,QString)") 136 if (msg == "writeMail(QString,QString)")
138 { 137 {
139 QDataStream stream(data,IO_ReadOnly); 138 QDataStream stream(data,IO_ReadOnly);
140 QString name, email; 139 QString name, email;
141 stream >> name >> email; 140 stream >> name >> email;
142 // removing the whitespaces at beginning and end is needed! 141 // removing the whitespaces at beginning and end is needed!
143 slotwriteMail(name.stripWhiteSpace(),email.stripWhiteSpace()); 142 slotwriteMail(name.stripWhiteSpace(),email.stripWhiteSpace());
144 } 143 }
145 else if (msg == "newMail()") 144 else if (msg == "newMail()")
146 { 145 {
147 slotComposeMail(); 146 slotComposeMail();
148 } 147 }
149} 148}
150 149
151/** 150/**
152 * Konqueror calls us with the mailto:name@address 151 * Konqueror calls us with the mailto:name@address
153 */ 152 */
154void OpieMail::setDocument(const QString& mail) 153void OpieMail::setDocument(const QString& mail)
155{ 154{
156 /* 155 /*
157 * It looks like a mailto address, lets try it 156 * It looks like a mailto address, lets try it
158 */ 157 */
159 if( mail.startsWith(QString::fromLatin1("mailto:")) ) 158 if( mail.startsWith(QString::fromLatin1("mailto:")) )
160 slotwriteMail(QString::null, mail.mid(7)); 159 slotwriteMail(QString::null, mail.mid(7));
161} 160}
162 161
163void OpieMail::slotwriteMail(const QString&name,const QString&email) 162void OpieMail::slotwriteMail(const QString&name,const QString&email)
164{ 163{
165 ComposeMail compose( settings, this, 0, true , WStyle_ContextHelp ); 164 ComposeMail compose( settings, this, 0, true , WStyle_ContextHelp );
166 if (!email.isEmpty()) 165 if (!email.isEmpty())
167 { 166 {
168 if (!name.isEmpty()) 167 if (!name.isEmpty())
169 { 168 {
170 compose.setTo("\"" + name + "\"" + " " + "<"+ email + ">"); 169 compose.setTo("\"" + name + "\"" + " " + "<"+ email + ">");
171 } 170 }
172 else 171 else
173 { 172 {
174 compose.setTo(email); 173 compose.setTo(email);
175 } 174 }
176 } 175 }
177 compose.slotAdjustColumns(); 176 compose.slotAdjustColumns();
178 QPEApplication::execDialog( &compose ); 177 QPEApplication::execDialog( &compose );
179} 178}
180 179
181void OpieMail::slotComposeMail() 180void OpieMail::slotComposeMail()
182{ 181{
183 odebug << "Compose Mail" << oendl; 182 odebug << "Compose Mail" << oendl;
184 slotwriteMail(0l,0l); 183 slotwriteMail(0l,0l);
185} 184}
186 185
187void OpieMail::slotSendQueued() 186void OpieMail::slotSendQueued()
188{ 187{
189 odebug << "Send Queued" << oendl; 188 odebug << "Send Queued" << oendl;
190 SMTPaccount *smtp = 0; 189 SMTPaccount *smtp = 0;
191 190
192 QList<Account> list = settings->getAccounts(); 191 QList<Account> list = settings->getAccounts();
193 QList<SMTPaccount> smtpList; 192 QList<SMTPaccount> smtpList;
194 smtpList.setAutoDelete(false); 193 smtpList.setAutoDelete(false);
195 Account *it; 194 Account *it;
196 for ( it = list.first(); it; it = list.next() ) 195 for ( it = list.first(); it; it = list.next() )
197 { 196 {
198 if ( it->getType() == MAILLIB::A_SMTP ) 197 if ( it->getType() == MAILLIB::A_SMTP )
199 { 198 {
200 smtp = static_cast<SMTPaccount *>(it); 199 smtp = static_cast<SMTPaccount *>(it);
201 smtpList.append(smtp); 200 smtpList.append(smtp);
202 } 201 }
203 } 202 }
204 if (smtpList.count()==0) 203 if (smtpList.count()==0)
205 { 204 {
206 QMessageBox::information(0,tr("Info"),tr("Define a smtp account first")); 205 QMessageBox::information(0,tr("Info"),tr("Define a smtp account first"));
207 return; 206 return;
208 } 207 }
209 if (smtpList.count()==1) 208 if (smtpList.count()==1)
210 { 209 {
211 smtp = smtpList.at(0); 210 smtp = smtpList.at(0);
212 } 211 }
213 else 212 else
214 { 213 {
215 smtp = 0; 214 smtp = 0;
216 selectsmtp selsmtp; 215 selectsmtp selsmtp;
217 selsmtp.setSelectionlist(&smtpList); 216 selsmtp.setSelectionlist(&smtpList);
218 if ( QPEApplication::execDialog( &selsmtp ) == QDialog::Accepted ) 217 if ( QPEApplication::execDialog( &selsmtp ) == QDialog::Accepted )
219 { 218 {
220 smtp = selsmtp.selected_smtp(); 219 smtp = selsmtp.selected_smtp();
221 } 220 }
222 } 221 }
223 if (smtp) 222 if (smtp)
224 { 223 {
225 SMTPwrapper * wrap = new SMTPwrapper(smtp); 224 SMTPwrapper * wrap = new SMTPwrapper(smtp);
226 if ( wrap->flushOutbox() ) 225 if ( wrap->flushOutbox() )
227 { 226 {
228 QMessageBox::information(0,tr("Info"),tr("Mail queue flushed")); 227 QMessageBox::information(0,tr("Info"),tr("Mail queue flushed"));
229 } 228 }
230 delete wrap; 229 delete wrap;
231 } 230 }
232} 231}
233 232
234void OpieMail::slotSearchMails() 233void OpieMail::slotSearchMails()
235{ 234{
236 odebug << "Search Mails" << oendl; 235 odebug << "Search Mails" << oendl;
237} 236}
238 237
239void OpieMail::slotEditSettings() 238void OpieMail::slotEditSettings()
240{ 239{
241 SettingsDialog settingsDialog( this, 0, true, WStyle_ContextHelp ); 240 SettingsDialog settingsDialog( this, 0, true, WStyle_ContextHelp );
242 if (QPEApplication::execDialog( &settingsDialog )) { 241 if (QPEApplication::execDialog( &settingsDialog )) {
243 Config cfg("mail"); 242 Config cfg("mail");
244 cfg.setGroup( "Settings" ); 243 cfg.setGroup( "Settings" );
245 m_clickopens = cfg.readBoolEntry("clickOpensMail",true); 244 m_clickopens = cfg.readBoolEntry("clickOpensMail",true);
246 emit settingsChanged(); 245 emit settingsChanged();
247 } 246 }
248} 247}
249 248
250void OpieMail::slotEditAccounts() 249void OpieMail::slotEditAccounts()
251{ 250{
252 odebug << "Edit Accounts" << oendl; 251 odebug << "Edit Accounts" << oendl;
253 EditAccounts eaDialog( settings, this, 0, true, WStyle_ContextHelp ); 252 EditAccounts eaDialog( settings, this, 0, true, WStyle_ContextHelp );
254 eaDialog.slotAdjustColumns(); 253 eaDialog.slotAdjustColumns();
255 if (QPEApplication::execDialog( &eaDialog )==QDialog::Rejected);// return; 254 if (QPEApplication::execDialog( &eaDialog )==QDialog::Rejected);// return;
256 255
257 if ( settings ) delete settings; 256 if ( settings ) delete settings;
258 settings = new Settings(); 257 settings = new Settings();
259 mailView->clear(); 258 mailView->clear();
260 folderView->populate( settings->getAccounts() ); 259 folderView->populate( settings->getAccounts() );
261} 260}
262 261
263void OpieMail::displayMail() 262void OpieMail::displayMail()
264{ 263{
265 QListViewItem*item = mailView->currentItem(); 264 QListViewItem*item = mailView->currentItem();
266 if (!item) return; 265 if (!item) return;
267 RecMailP mail = ((MailListViewItem*)item)->data(); 266 RecMailP mail = ((MailListViewItem*)item)->data();
268 RecBodyP body = folderView->fetchBody(mail); 267 RecBodyP body = folderView->fetchBody(mail);
269 ViewMail readMail( this,"", Qt::WType_Modal | WStyle_ContextHelp ); 268 ViewMail readMail( this,"", Qt::WType_Modal | WStyle_ContextHelp );
270 readMail.setBody( body ); 269 readMail.setBody( body );
271 readMail.setMail( mail ); 270 readMail.setMail( mail );
272 readMail.showMaximized(); 271 readMail.showMaximized();
273 readMail.exec(); 272 readMail.exec();
274 273
275 if ( readMail.deleted ) 274 if ( readMail.deleted )
276 { 275 {
277 folderView->refreshCurrent(); 276 folderView->refreshCurrent();
278 } 277 }
279 else 278 else
280 { 279 {
281 ( (MailListViewItem*)item )->setPixmap( 0, Resource::loadPixmap( "" ) ); 280 ( (MailListViewItem*)item )->setPixmap( 0, QPixmap() );
282 } 281 }
283} 282}
284 283
285void OpieMail::slotDeleteMail() 284void OpieMail::slotDeleteMail()
286{ 285{
287 if (!mailView->currentItem()) return; 286 if (!mailView->currentItem()) return;
288 RecMailP mail = ((MailListViewItem*)mailView->currentItem() )->data(); 287 RecMailP mail = ((MailListViewItem*)mailView->currentItem() )->data();
289 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 ) 288 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 )
290 { 289 {
291 mail->Wrapper()->deleteMail( mail ); 290 mail->Wrapper()->deleteMail( mail );
292 folderView->refreshCurrent(); 291 folderView->refreshCurrent();
293 } 292 }
294} 293}
295 294
296void OpieMail::mailHold(int button, QListViewItem *item,const QPoint&,int ) 295void OpieMail::mailHold(int button, QListViewItem *item,const QPoint&,int )
297{ 296{
298 if (!mailView->currentItem()) return; 297 if (!mailView->currentItem()) return;
299 MAILLIB::ATYPE mailtype = ((MailListViewItem*)mailView->currentItem() )->wrapperType(); 298 MAILLIB::ATYPE mailtype = ((MailListViewItem*)mailView->currentItem() )->wrapperType();
300 /* just the RIGHT button - or hold on pda */ 299 /* just the RIGHT button - or hold on pda */
301 if (button!=2) {return;} 300 if (button!=2) {return;}
302 odebug << "Event right/hold" << oendl; 301 odebug << "Event right/hold" << oendl;
303 if (!item) return; 302 if (!item) return;
304 QPopupMenu *m = new QPopupMenu(0); 303 QPopupMenu *m = new QPopupMenu(0);
305 if (m) 304 if (m)
306 { 305 {
307 if (mailtype==MAILLIB::A_NNTP) { 306 if (mailtype==MAILLIB::A_NNTP) {
308 m->insertItem(tr("Read this posting"),this,SLOT(displayMail())); 307 m->insertItem(tr("Read this posting"),this,SLOT(displayMail()));
309// m->insertItem(tr("Copy this posting"),this,SLOT(slotMoveCopyMail())); 308// m->insertItem(tr("Copy this posting"),this,SLOT(slotMoveCopyMail()));
310 } else { 309 } else {
311 if (folderView->currentisDraft()) { 310 if (folderView->currentisDraft()) {
312 m->insertItem(tr("Edit this mail"),this,SLOT(reEditMail())); 311 m->insertItem(tr("Edit this mail"),this,SLOT(reEditMail()));
313 } 312 }
314 m->insertItem(tr("Read this mail"),this,SLOT(displayMail())); 313 m->insertItem(tr("Read this mail"),this,SLOT(displayMail()));
315 m->insertItem(tr("Delete this mail"),this,SLOT(slotDeleteMail())); 314 m->insertItem(tr("Delete this mail"),this,SLOT(slotDeleteMail()));
316 m->insertItem(tr("Copy/Move this mail"),this,SLOT(slotMoveCopyMail())); 315 m->insertItem(tr("Copy/Move this mail"),this,SLOT(slotMoveCopyMail()));
317 } 316 }
318 m->setFocus(); 317 m->setFocus();
319 m->exec( QPoint( QCursor::pos().x(), QCursor::pos().y()) ); 318 m->exec( QPoint( QCursor::pos().x(), QCursor::pos().y()) );
320 delete m; 319 delete m;
321 } 320 }
322} 321}
323 322
324void OpieMail::slotShowFolders( bool show ) 323void OpieMail::slotShowFolders( bool show )
325{ 324{
326 odebug << "Show Folders" << oendl; 325 odebug << "Show Folders" << oendl;
327 if ( show && folderView->isHidden() ) 326 if ( show && folderView->isHidden() )
328 { 327 {
329 odebug << "-> showing" << oendl; 328 odebug << "-> showing" << oendl;
330 folderView->show(); 329 folderView->show();
331 } 330 }
332 else if ( !show && !folderView->isHidden() ) 331 else if ( !show && !folderView->isHidden() )
333 { 332 {
334 odebug << "-> hiding" << oendl; 333 odebug << "-> hiding" << oendl;
335 folderView->hide(); 334 folderView->hide();
336 } 335 }
337} 336}
338 337
339void OpieMail::refreshMailView(const QValueList<RecMailP>&list) 338void OpieMail::refreshMailView(const QValueList<RecMailP>&list)
340{ 339{
341 MailListViewItem*item = 0; 340 MailListViewItem*item = 0;
342 mailView->clear(); 341 mailView->clear();
343 342
344 QValueList<RecMailP>::ConstIterator it; 343 QValueList<RecMailP>::ConstIterator it;
345 for (it = list.begin(); it != list.end();++it) 344 for (it = list.begin(); it != list.end();++it)
346 { 345 {
347 item = new MailListViewItem(mailView,item); 346 item = new MailListViewItem(mailView,item);
348 item->storeData((*it)); 347 item->storeData((*it));
349 item->showEntry(); 348 item->showEntry();
350 } 349 }
351} 350}
352 351
353void OpieMail::mailLeftClicked(int button, QListViewItem *item,const QPoint&,int ) 352void OpieMail::mailLeftClicked(int button, QListViewItem *item,const QPoint&,int )
354{ 353{
355 if (!m_clickopens) return; 354 if (!m_clickopens) return;
356 /* just LEFT button - or tap with stylus on pda */ 355 /* just LEFT button - or tap with stylus on pda */
357 if (button!=1) return; 356 if (button!=1) return;
358 if (!item) return; 357 if (!item) return;
359 if (folderView->currentisDraft()) { 358 if (folderView->currentisDraft()) {
360 reEditMail(); 359 reEditMail();
361 } else { 360 } else {
362 displayMail(); 361 displayMail();
363 } 362 }
364} 363}
365 364
366void OpieMail::slotMoveCopyMail() 365void OpieMail::slotMoveCopyMail()
367{ 366{
368 if (!mailView->currentItem()) return; 367 if (!mailView->currentItem()) return;
369 RecMailP mail = ((MailListViewItem*)mailView->currentItem() )->data(); 368 RecMailP mail = ((MailListViewItem*)mailView->currentItem() )->data();
370 AbstractMail*targetMail = 0; 369 AbstractMail*targetMail = 0;
371 QString targetFolder = ""; 370 QString targetFolder = "";
372 Selectstore sels; 371 Selectstore sels;
373 folderView->setupFolderselect(&sels); 372 folderView->setupFolderselect(&sels);
374 if (!sels.exec()) return; 373 if (!sels.exec()) return;
375 targetMail = sels.currentMail(); 374 targetMail = sels.currentMail();
376 targetFolder = sels.currentFolder(); 375 targetFolder = sels.currentFolder();
377 if ( (mail->Wrapper()==targetMail && mail->getMbox()==targetFolder) || 376 if ( (mail->Wrapper()==targetMail && mail->getMbox()==targetFolder) ||
378 targetFolder.isEmpty()) 377 targetFolder.isEmpty())
379 { 378 {
380 return; 379 return;
381 } 380 }
382 if (sels.newFolder() && !targetMail->createMbox(targetFolder)) 381 if (sels.newFolder() && !targetMail->createMbox(targetFolder))
383 { 382 {
384 QMessageBox::critical(0,tr("Error creating new Folder"), 383 QMessageBox::critical(0,tr("Error creating new Folder"),
385 tr("<center>Error while creating<br>new folder - breaking.</center>")); 384 tr("<center>Error while creating<br>new folder - breaking.</center>"));
386 return; 385 return;
387 } 386 }
388 mail->Wrapper()->mvcpMail(mail,targetFolder,targetMail,sels.moveMails()); 387 mail->Wrapper()->mvcpMail(mail,targetFolder,targetMail,sels.moveMails());
389 folderView->refreshCurrent(); 388 folderView->refreshCurrent();
390} 389}
391 390
392void OpieMail::reEditMail() 391void OpieMail::reEditMail()
393{ 392{
394 if (!mailView->currentItem()) return; 393 if (!mailView->currentItem()) return;
395 394
396 ComposeMail compose( settings, this, 0, true , WStyle_ContextHelp ); 395 ComposeMail compose( settings, this, 0, true , WStyle_ContextHelp );
397 compose.reEditMail(((MailListViewItem*)mailView->currentItem() )->data()); 396 compose.reEditMail(((MailListViewItem*)mailView->currentItem() )->data());
398 compose.slotAdjustColumns(); 397 compose.slotAdjustColumns();
399 QPEApplication::execDialog( &compose ); 398 QPEApplication::execDialog( &compose );
400} 399}
401 400
402void OpieMail::refreshMenu(int m_isFolder) 401void OpieMail::refreshMenu(int m_isFolder)
403{ 402{
404 if (QApplication::desktop()->width()<330) { 403 if (QApplication::desktop()->width()<330) {
405 mailMenu->setItemEnabled(m_ServerMenuId,m_isFolder&1); 404 mailMenu->setItemEnabled(m_ServerMenuId,m_isFolder&1);
406 mailMenu->setItemEnabled(m_FolderMenuId,m_isFolder&2); 405 mailMenu->setItemEnabled(m_FolderMenuId,m_isFolder&2);
407 } else { 406 } else {
408 menuBar->setItemEnabled(m_ServerMenuId,m_isFolder&1); 407 menuBar->setItemEnabled(m_ServerMenuId,m_isFolder&1);
409 menuBar->setItemEnabled(m_FolderMenuId,m_isFolder&2); 408 menuBar->setItemEnabled(m_FolderMenuId,m_isFolder&2);
410 } 409 }
411 410
412 QMap<int,QString>::ConstIterator it; 411 QMap<int,QString>::ConstIterator it;
413 QMap<int,QString> server_entries=folderView->currentServerMenu(); 412 QMap<int,QString> server_entries=folderView->currentServerMenu();
414 QMap<int,QString> folder_entries=folderView->currentFolderMenu(); 413 QMap<int,QString> folder_entries=folderView->currentFolderMenu();
415 414
416 int id; 415 int id;
417 unsigned int i; 416 unsigned int i;
418 for (i=0; i<folderMenu->count();++i) { 417 for (i=0; i<folderMenu->count();++i) {
419 id = folderMenu->idAt(i); 418 id = folderMenu->idAt(i);
420 folderMenu->setItemEnabled(id,false); 419 folderMenu->setItemEnabled(id,false);
421 } 420 }
422 for (it=folder_entries.begin();it!=folder_entries.end();++it) { 421 for (it=folder_entries.begin();it!=folder_entries.end();++it) {
423 folderMenu->changeItem(it.key(),it.data()); 422 folderMenu->changeItem(it.key(),it.data());
424 folderMenu->setItemEnabled(it.key(),true); 423 folderMenu->setItemEnabled(it.key(),true);
425 } 424 }
426 for (i=0; i<serverMenu->count();++i) { 425 for (i=0; i<serverMenu->count();++i) {
427 id = serverMenu->idAt(i); 426 id = serverMenu->idAt(i);
428 serverMenu->setItemEnabled(id,false); 427 serverMenu->setItemEnabled(id,false);
429 } 428 }
430 for (it=server_entries.begin();it!=server_entries.end();++it) { 429 for (it=server_entries.begin();it!=server_entries.end();++it) {
431 serverMenu->changeItem(it.key(),it.data()); 430 serverMenu->changeItem(it.key(),it.data());
432 serverMenu->setItemEnabled(it.key(),true); 431 serverMenu->setItemEnabled(it.key(),true);
433 } 432 }
434} 433}
435 434
436void OpieMail::serverSelected(int m_isFolder) 435void OpieMail::serverSelected(int m_isFolder)
437{ 436{
438 mailView->clear(); 437 mailView->clear();
439 refreshMenu(m_isFolder); 438 refreshMenu(m_isFolder);
440} 439}
diff --git a/noncore/net/mail/viewmailbase.cpp b/noncore/net/mail/viewmailbase.cpp
index 65ad0d6..9e17439 100644
--- a/noncore/net/mail/viewmailbase.cpp
+++ b/noncore/net/mail/viewmailbase.cpp
@@ -1,92 +1,94 @@
1#include "viewmailbase.h"
2
3/* OPIE */
4#include <opie2/oresource.h>
5using namespace Opie::Core;
6
7/* QT */
1#include <qtextbrowser.h> 8#include <qtextbrowser.h>
2#include <qlistview.h> 9#include <qlistview.h>
3#include <qaction.h> 10#include <qaction.h>
4#include <qlabel.h> 11#include <qlabel.h>
5#include <qvbox.h> 12#include <qvbox.h>
6
7#include <qtoolbar.h> 13#include <qtoolbar.h>
8#include <qlayout.h> 14#include <qlayout.h>
9#include <qmenubar.h> 15#include <qmenubar.h>
10#include <qpe/resource.h>
11
12#include "viewmailbase.h"
13//#include "opendiag.h"
14 16
15ViewMailBase::ViewMailBase(QWidget *parent, const char *name, WFlags fl) 17ViewMailBase::ViewMailBase(QWidget *parent, const char *name, WFlags fl)
16 : QMainWindow(parent, name, fl) 18 : QMainWindow(parent, name, fl)
17{ 19{
18 setCaption(tr("E-Mail view")); 20 setCaption(tr("E-Mail view"));
19 setToolBarsMovable(false); 21 setToolBarsMovable(false);
20 22
21 toolbar = new QToolBar(this); 23 toolbar = new QToolBar(this);
22 menubar = new QMenuBar( toolbar ); 24 menubar = new QMenuBar( toolbar );
23 mailmenu = new QPopupMenu( menubar ); 25 mailmenu = new QPopupMenu( menubar );
24 menubar->insertItem( tr( "Mail" ), mailmenu ); 26 menubar->insertItem( tr( "Mail" ), mailmenu );
25 toolbar->setHorizontalStretchable(true); 27 toolbar->setHorizontalStretchable(true);
26 addToolBar(toolbar); 28 addToolBar(toolbar);
27 QLabel *spacer = new QLabel(toolbar); 29 QLabel *spacer = new QLabel(toolbar);
28 spacer->setBackgroundMode(QWidget::PaletteButton); 30 spacer->setBackgroundMode(QWidget::PaletteButton);
29 toolbar->setStretchableWidget(spacer); 31 toolbar->setStretchableWidget(spacer);
30 32
31 reply = new QAction(tr("Reply"), QIconSet(Resource::loadPixmap("mail/reply")), 0, 0, this); 33 reply = new QAction(tr("Reply"), OResource::loadPixmap("mail/reply", OResource::SmallIcon), 0, 0, this);
32 reply->addTo(toolbar); 34 reply->addTo(toolbar);
33 reply->addTo(mailmenu); 35 reply->addTo(mailmenu);
34 36
35 forward = new QAction(tr("Forward"), QIconSet(Resource::loadPixmap("mail/forward")), 0, 0, this); 37 forward = new QAction(tr("Forward"), OResource::loadPixmap("mail/forward", OResource::SmallIcon), 0, 0, this);
36 forward->addTo(toolbar); 38 forward->addTo(toolbar);
37 forward->addTo(mailmenu); 39 forward->addTo(mailmenu);
38 40
39 attachbutton = new QAction(tr("Attachments"), QIconSet(Resource::loadPixmap("mail/attach")), 0, 0, this, 0, true); 41 attachbutton = new QAction(tr("Attachments"), OResource::loadPixmap("mail/attach", OResource::SmallIcon), 0, 0, this, 0, true);
40 attachbutton->addTo(toolbar); 42 attachbutton->addTo(toolbar);
41 attachbutton->addTo(mailmenu); 43 attachbutton->addTo(mailmenu);
42 connect(attachbutton, SIGNAL(toggled(bool)), SLOT(slotChangeAttachview(bool))); 44 connect(attachbutton, SIGNAL(toggled(bool)), SLOT(slotChangeAttachview(bool)));
43 45
44 46
45 showHtml = new QAction( tr( "Show Html" ), QIconSet( Resource::loadPixmap( "mail/html" ) ), 0, 0, this, 0, true ); 47 showHtml = new QAction( tr( "Show Html" ), OResource::loadPixmap( "mail/html", OResource::SmallIcon ), 0, 0, this, 0, true );
46 showHtml->addTo( toolbar ); 48 showHtml->addTo( toolbar );
47 showHtml->addTo( mailmenu ); 49 showHtml->addTo( mailmenu );
48 50
49 showPicsInline= new QAction(tr("Show image preview inline"), QIconSet(Resource::loadPixmap("pixmap")), 0, 0, this); 51 showPicsInline= new QAction(tr("Show image preview inline"), OResource::loadPixmap("pixmap", OResource::SmallIcon), 0, 0, this);
50 showPicsInline->setToggleAction(true); 52 showPicsInline->setToggleAction(true);
51 showPicsInline->addTo(toolbar); 53 showPicsInline->addTo(toolbar);
52 showPicsInline->addTo(mailmenu); 54 showPicsInline->addTo(mailmenu);
53 55
54 deleteMail = new QAction(tr("Delete Mail"), QIconSet(Resource::loadPixmap("trash")), 0, 0, this); 56 deleteMail = new QAction(tr("Delete Mail"), OResource::loadPixmap("trash", OResource::SmallIcon), 0, 0, this);
55 deleteMail->addTo(toolbar); 57 deleteMail->addTo(toolbar);
56 deleteMail->addTo(mailmenu); 58 deleteMail->addTo(mailmenu);
57 59
58 QVBox * view = new QVBox(this); 60 QVBox * view = new QVBox(this);
59 view->setSpacing(1); 61 view->setSpacing(1);
60 view->setMargin(0); 62 view->setMargin(0);
61 setCentralWidget(view); 63 setCentralWidget(view);
62 64
63 attachments = new QListView(view); 65 attachments = new QListView(view);
64 attachments->setMinimumHeight(90); 66 attachments->setMinimumHeight(90);
65 attachments->setMaximumHeight(90); 67 attachments->setMaximumHeight(90);
66 attachments->setAllColumnsShowFocus(true); 68 attachments->setAllColumnsShowFocus(true);
67 attachments->addColumn("Mime Type", 60); 69 attachments->addColumn("Mime Type", 60);
68 attachments->addColumn(tr("Description"), 100); 70 attachments->addColumn(tr("Description"), 100);
69 attachments->addColumn(tr("Filename"), 80); 71 attachments->addColumn(tr("Filename"), 80);
70 attachments->addColumn(tr("Size"), 80); 72 attachments->addColumn(tr("Size"), 80);
71 attachments->setSorting(-1); 73 attachments->setSorting(-1);
72 74
73 browser = new QTextBrowser(view); 75 browser = new QTextBrowser(view);
74 adjustSize(); 76 adjustSize();
75 attachments->hide(); 77 attachments->hide();
76} 78}
77 79
78void ViewMailBase::slotChangeAttachview(bool state) 80void ViewMailBase::slotChangeAttachview(bool state)
79{ 81{
80 if (state) attachments->show(); 82 if (state) attachments->show();
81 else attachments->hide(); 83 else attachments->hide();
82} 84}
83 85
84void ViewMailBase::keyPressEvent ( QKeyEvent * e ) 86void ViewMailBase::keyPressEvent ( QKeyEvent * e )
85{ 87{
86 if( e->key()==Qt::Key_Escape ) { 88 if( e->key()==Qt::Key_Escape ) {
87 close(); 89 close();
88 e->accept(); 90 e->accept();
89 return; 91 return;
90 } 92 }
91 QWidget::keyPressEvent(e); 93 QWidget::keyPressEvent(e);
92} 94}