author | zautrix <zautrix> | 2004-09-16 20:39:34 (UTC) |
---|---|---|
committer | zautrix <zautrix> | 2004-09-16 20:39:34 (UTC) |
commit | b44edfb21be0eee91c4f47401e3fe6ff37e4c16c (patch) (unidiff) | |
tree | a17655e0e679f67498d9fee6f6a532e9c0f0e9e5 /kmicromail | |
parent | b6bfa63deb15a2600d46a8c68c231f068da1444a (diff) | |
download | kdepimpi-b44edfb21be0eee91c4f47401e3fe6ff37e4c16c.zip kdepimpi-b44edfb21be0eee91c4f47401e3fe6ff37e4c16c.tar.gz kdepimpi-b44edfb21be0eee91c4f47401e3fe6ff37e4c16c.tar.bz2 |
better newsgroup handling
-rw-r--r-- | kmicromail/accountitem.cpp | 21 | ||||
-rw-r--r-- | kmicromail/editaccounts.cpp | 70 | ||||
-rw-r--r-- | kmicromail/editaccounts.h | 3 | ||||
-rw-r--r-- | kmicromail/mainwindow.cpp | 7 | ||||
-rw-r--r-- | kmicromail/mainwindow.h | 1 | ||||
-rw-r--r-- | kmicromail/nntpconfigui.ui | 126 | ||||
-rw-r--r-- | kmicromail/opiemail.cpp | 8 | ||||
-rw-r--r-- | kmicromail/opiemail.h | 1 |
8 files changed, 186 insertions, 51 deletions
diff --git a/kmicromail/accountitem.cpp b/kmicromail/accountitem.cpp index 12d047a..7795055 100644 --- a/kmicromail/accountitem.cpp +++ b/kmicromail/accountitem.cpp | |||
@@ -31,253 +31,257 @@ POP3viewItem::POP3viewItem( POP3account *a, AccountView *parent ) | |||
31 | SETPIX(PIXMAP_POP3FOLDER); | 31 | SETPIX(PIXMAP_POP3FOLDER); |
32 | #if 0 | 32 | #if 0 |
33 | if (!account->getOffline()) | 33 | if (!account->getOffline()) |
34 | { | 34 | { |
35 | setPixmap( 0, ); | 35 | setPixmap( 0, ); |
36 | } | 36 | } |
37 | else | 37 | else |
38 | { | 38 | { |
39 | setPixmap( 0, PIXMAP_OFFLINE ); | 39 | setPixmap( 0, PIXMAP_OFFLINE ); |
40 | } | 40 | } |
41 | #endif | 41 | #endif |
42 | setText( 0, account->getAccountName() ); | 42 | setText( 0, account->getAccountName() ); |
43 | setOpen( true ); | 43 | setOpen( true ); |
44 | } | 44 | } |
45 | 45 | ||
46 | POP3viewItem::~POP3viewItem() | 46 | POP3viewItem::~POP3viewItem() |
47 | { | 47 | { |
48 | delete wrapper; | 48 | delete wrapper; |
49 | } | 49 | } |
50 | 50 | ||
51 | AbstractMail *POP3viewItem::getWrapper() | 51 | AbstractMail *POP3viewItem::getWrapper() |
52 | { | 52 | { |
53 | return wrapper; | 53 | return wrapper; |
54 | } | 54 | } |
55 | 55 | ||
56 | void POP3viewItem::refresh(QValueList<Opie::Core::OSmartPointer<RecMail> > & ) | 56 | void POP3viewItem::refresh(QValueList<Opie::Core::OSmartPointer<RecMail> > & ) |
57 | { | 57 | { |
58 | refresh(); | 58 | refresh(); |
59 | } | 59 | } |
60 | 60 | ||
61 | void POP3viewItem::refresh() | 61 | void POP3viewItem::refresh() |
62 | { | 62 | { |
63 | if (account->getOffline()) return; | 63 | if (account->getOffline()) return; |
64 | QValueList<FolderP> *folders = wrapper->listFolders(); | 64 | QValueList<FolderP> *folders = wrapper->listFolders(); |
65 | QListViewItem *child = firstChild(); | 65 | QListViewItem *child = firstChild(); |
66 | while ( child ) | 66 | while ( child ) |
67 | { | 67 | { |
68 | QListViewItem *tmp = child; | 68 | QListViewItem *tmp = child; |
69 | child = child->nextSibling(); | 69 | child = child->nextSibling(); |
70 | delete tmp; | 70 | delete tmp; |
71 | } | 71 | } |
72 | QValueList<FolderP>::ConstIterator it; | 72 | QValueList<FolderP>::ConstIterator it; |
73 | QListViewItem*item = 0; | 73 | QListViewItem*item = 0; |
74 | for ( it = folders->begin(); it!=folders->end(); ++it) | 74 | for ( it = folders->begin(); it!=folders->end(); ++it) |
75 | { | 75 | { |
76 | item = new POP3folderItem( (*it), this , item ); | 76 | item = new POP3folderItem( (*it), this , item ); |
77 | item->setSelectable( (*it)->may_select()); | 77 | item->setSelectable( (*it)->may_select()); |
78 | } | 78 | } |
79 | delete folders; | 79 | delete folders; |
80 | } | 80 | } |
81 | 81 | ||
82 | RECBODYP POP3viewItem::fetchBody( const RecMailP &mail ) | 82 | RECBODYP POP3viewItem::fetchBody( const RecMailP &mail ) |
83 | { | 83 | { |
84 | 84 | ||
85 | return wrapper->fetchBody( mail ); | 85 | return wrapper->fetchBody( mail ); |
86 | } | 86 | } |
87 | 87 | ||
88 | QPopupMenu * POP3viewItem::getContextMenu() | 88 | QPopupMenu * POP3viewItem::getContextMenu() |
89 | { | 89 | { |
90 | QPopupMenu *m = new QPopupMenu(0); | 90 | QPopupMenu *m = new QPopupMenu(0); |
91 | if (m) | 91 | if (m) |
92 | { | 92 | { |
93 | if (!account->getOffline()) | 93 | if (!account->getOffline()) |
94 | { | 94 | { |
95 | m->insertItem(QObject::tr("Get new messages",contextName),GET_NEW_MAILS); | ||
95 | m->insertItem(QObject::tr("Disconnect",contextName),0); | 96 | m->insertItem(QObject::tr("Disconnect",contextName),0); |
96 | m->insertItem(QObject::tr("Set offline",contextName),1); | 97 | m->insertItem(QObject::tr("Set offline",contextName),1); |
97 | m->insertItem(QObject::tr("Get new messages",contextName),GET_NEW_MAILS); | ||
98 | } | 98 | } |
99 | else | 99 | else |
100 | { | 100 | { |
101 | m->insertItem(QObject::tr("Set online",contextName),1); | ||
102 | m->insertItem(QObject::tr("Get new messages",contextName),GET_NEW_MAILS); | 101 | m->insertItem(QObject::tr("Get new messages",contextName),GET_NEW_MAILS); |
102 | m->insertItem(QObject::tr("Set online",contextName),1); | ||
103 | } | 103 | } |
104 | } | 104 | } |
105 | return m; | 105 | return m; |
106 | } | 106 | } |
107 | 107 | ||
108 | void POP3viewItem::disconnect() | 108 | void POP3viewItem::disconnect() |
109 | { | 109 | { |
110 | QListViewItem *child = firstChild(); | 110 | QListViewItem *child = firstChild(); |
111 | while ( child ) | 111 | while ( child ) |
112 | { | 112 | { |
113 | QListViewItem *tmp = child; | 113 | QListViewItem *tmp = child; |
114 | child = child->nextSibling(); | 114 | child = child->nextSibling(); |
115 | delete tmp; | 115 | delete tmp; |
116 | } | 116 | } |
117 | wrapper->logout(); | 117 | wrapper->logout(); |
118 | } | 118 | } |
119 | 119 | ||
120 | void POP3viewItem::setOnOffline() | 120 | void POP3viewItem::setOnOffline() |
121 | { | 121 | { |
122 | if (!account->getOffline()) | 122 | if (!account->getOffline()) |
123 | { | 123 | { |
124 | disconnect(); | 124 | disconnect(); |
125 | } | 125 | } |
126 | account->setOffline(!account->getOffline()); | 126 | account->setOffline(!account->getOffline()); |
127 | account->save(); | 127 | account->save(); |
128 | SETPIX(PIXMAP_POP3FOLDER); | 128 | SETPIX(PIXMAP_POP3FOLDER); |
129 | refresh(); | 129 | refresh(); |
130 | } | 130 | } |
131 | 131 | ||
132 | void POP3viewItem::contextMenuSelected(int which) | 132 | void POP3viewItem::contextMenuSelected(int which) |
133 | { | 133 | { |
134 | switch (which) | 134 | switch (which) |
135 | { | 135 | { |
136 | case 0: | 136 | case 0: |
137 | disconnect(); | 137 | disconnect(); |
138 | break; | 138 | break; |
139 | case 1: | 139 | case 1: |
140 | setOnOffline(); | 140 | setOnOffline(); |
141 | break; | 141 | break; |
142 | case GET_NEW_MAILS: // daunlood | 142 | case GET_NEW_MAILS: // daunlood |
143 | if (account->getOffline()) | 143 | if (account->getOffline()) |
144 | setOnOffline(); | 144 | setOnOffline(); |
145 | AccountView*bl = accountView(); | 145 | AccountView*bl = accountView(); |
146 | if (!bl) return; | 146 | if (!bl) return; |
147 | AccountViewItem* in = findSubItem( "inbox" , 0); | 147 | AccountViewItem* in = findSubItem( "inbox" , 0); |
148 | if ( ! in ) | 148 | if ( ! in ) |
149 | return; | 149 | return; |
150 | bl->downloadMailsInbox(in->getFolder() ,getWrapper()); | 150 | bl->downloadMailsInbox(in->getFolder() ,getWrapper()); |
151 | setOnOffline(); | 151 | setOnOffline(); |
152 | break; | 152 | break; |
153 | } | 153 | } |
154 | } | 154 | } |
155 | 155 | ||
156 | POP3folderItem::~POP3folderItem() | 156 | POP3folderItem::~POP3folderItem() |
157 | {} | 157 | {} |
158 | 158 | ||
159 | POP3folderItem::POP3folderItem( const FolderP&folderInit, POP3viewItem *parent , QListViewItem*after ) | 159 | POP3folderItem::POP3folderItem( const FolderP&folderInit, POP3viewItem *parent , QListViewItem*after ) |
160 | : AccountViewItem(folderInit,parent,after ) | 160 | : AccountViewItem(folderInit,parent,after ) |
161 | { | 161 | { |
162 | pop3 = parent; | 162 | pop3 = parent; |
163 | if (folder->getDisplayName().lower()!="inbox") | 163 | if (folder->getDisplayName().lower()!="inbox") |
164 | { | 164 | { |
165 | setPixmap( 0, PIXMAP_POP3FOLDER ); | 165 | setPixmap( 0, PIXMAP_POP3FOLDER ); |
166 | } | 166 | } |
167 | else | 167 | else |
168 | { | 168 | { |
169 | setPixmap( 0, PIXMAP_INBOXFOLDER); | 169 | setPixmap( 0, PIXMAP_INBOXFOLDER); |
170 | } | 170 | } |
171 | setText( 0, folder->getDisplayName() ); | 171 | setText( 0, folder->getDisplayName() ); |
172 | } | 172 | } |
173 | 173 | ||
174 | void POP3folderItem::refresh(QValueList<RecMailP>&target) | 174 | void POP3folderItem::refresh(QValueList<RecMailP>&target) |
175 | { | 175 | { |
176 | if (folder->may_select()) | 176 | if (folder->may_select()) |
177 | pop3->getWrapper()->listMessages( folder->getName(),target ); | 177 | pop3->getWrapper()->listMessages( folder->getName(),target ); |
178 | } | 178 | } |
179 | 179 | ||
180 | RECBODYP POP3folderItem::fetchBody(const RecMailP&aMail) | 180 | RECBODYP POP3folderItem::fetchBody(const RecMailP&aMail) |
181 | { | 181 | { |
182 | return pop3->getWrapper()->fetchBody(aMail); | 182 | return pop3->getWrapper()->fetchBody(aMail); |
183 | } | 183 | } |
184 | 184 | ||
185 | QPopupMenu * POP3folderItem::getContextMenu() | 185 | QPopupMenu * POP3folderItem::getContextMenu() |
186 | { | 186 | { |
187 | QPopupMenu *m = new QPopupMenu(0); | 187 | QPopupMenu *m = new QPopupMenu(0); |
188 | if (m) | 188 | if (m) |
189 | { | 189 | { |
190 | m->insertItem(QObject::tr("Get new messages",contextName),GET_NEW_MAILS); | ||
190 | m->insertItem(QObject::tr("Refresh header list",contextName),0); | 191 | m->insertItem(QObject::tr("Refresh header list",contextName),0); |
191 | m->insertItem(QObject::tr("Delete all mails",contextName),1); | 192 | m->insertItem(QObject::tr("Delete all mails",contextName),1); |
192 | m->insertItem(QObject::tr("Move/Copie all mails",contextName),2); | 193 | m->insertItem(QObject::tr("Move/Copie all mails",contextName),2); |
193 | } | 194 | } |
194 | return m; | 195 | return m; |
195 | } | 196 | } |
196 | 197 | ||
197 | void POP3folderItem::downloadMails() | 198 | void POP3folderItem::downloadMails() |
198 | { | 199 | { |
199 | AccountView*bl = pop3->accountView(); | 200 | AccountView*bl = pop3->accountView(); |
200 | if (!bl) return; | 201 | if (!bl) return; |
201 | bl->downloadMails(folder,pop3->getWrapper()); | 202 | bl->downloadMails(folder,pop3->getWrapper()); |
202 | } | 203 | } |
203 | 204 | ||
204 | void POP3folderItem::contextMenuSelected(int which) | 205 | void POP3folderItem::contextMenuSelected(int which) |
205 | { | 206 | { |
206 | AccountView * view = (AccountView*)listView(); | 207 | AccountView * view = (AccountView*)listView(); |
207 | switch (which) | 208 | switch (which) |
208 | { | 209 | { |
209 | case 0: | 210 | case 0: |
210 | /* must be 'cause pop3 lists are cached */ | 211 | /* must be 'cause pop3 lists are cached */ |
211 | pop3->getWrapper()->logout(); | 212 | pop3->getWrapper()->logout(); |
212 | view->refreshCurrent(); | 213 | view->refreshCurrent(); |
213 | break; | 214 | break; |
214 | case 1: | 215 | case 1: |
215 | deleteAllMail(pop3->getWrapper(),folder); | 216 | deleteAllMail(pop3->getWrapper(),folder); |
216 | break; | 217 | break; |
217 | case 2: | 218 | case 2: |
218 | downloadMails(); | 219 | downloadMails(); |
219 | break; | 220 | break; |
221 | case GET_NEW_MAILS: // daunlood | ||
222 | view->downloadMailsInbox(getFolder() ,pop3->getWrapper()); | ||
223 | break; | ||
220 | default: | 224 | default: |
221 | break; | 225 | break; |
222 | } | 226 | } |
223 | } | 227 | } |
224 | 228 | ||
225 | /** | 229 | /** |
226 | * NNTP Account stuff | 230 | * NNTP Account stuff |
227 | */ | 231 | */ |
228 | NNTPviewItem::NNTPviewItem( NNTPaccount *a, AccountView *parent ) | 232 | NNTPviewItem::NNTPviewItem( NNTPaccount *a, AccountView *parent ) |
229 | : AccountViewItem( parent ) | 233 | : AccountViewItem( parent ) |
230 | { | 234 | { |
231 | account = a; | 235 | account = a; |
232 | wrapper = AbstractMail::getWrapper( account ); | 236 | wrapper = AbstractMail::getWrapper( account ); |
233 | //FIXME | 237 | //FIXME |
234 | SETPIX(PIXMAP_POP3FOLDER); | 238 | SETPIX(PIXMAP_POP3FOLDER); |
235 | #if 0 | 239 | #if 0 |
236 | if (!account->getOffline()) | 240 | if (!account->getOffline()) |
237 | { | 241 | { |
238 | setPixmap( 0, ); | 242 | setPixmap( 0, ); |
239 | } | 243 | } |
240 | else | 244 | else |
241 | { | 245 | { |
242 | setPixmap( 0, PIXMAP_OFFLINE ); | 246 | setPixmap( 0, PIXMAP_OFFLINE ); |
243 | } | 247 | } |
244 | #endif | 248 | #endif |
245 | setText( 0, account->getAccountName() ); | 249 | setText( 0, account->getAccountName() ); |
246 | setOpen( true ); | 250 | setOpen( true ); |
247 | } | 251 | } |
248 | 252 | ||
249 | NNTPviewItem::~NNTPviewItem() | 253 | NNTPviewItem::~NNTPviewItem() |
250 | { | 254 | { |
251 | delete wrapper; | 255 | delete wrapper; |
252 | } | 256 | } |
253 | 257 | ||
254 | AbstractMail *NNTPviewItem::getWrapper() | 258 | AbstractMail *NNTPviewItem::getWrapper() |
255 | { | 259 | { |
256 | return wrapper; | 260 | return wrapper; |
257 | } | 261 | } |
258 | 262 | ||
259 | void NNTPviewItem::refresh( QValueList<RecMailP> & ) | 263 | void NNTPviewItem::refresh( QValueList<RecMailP> & ) |
260 | { | 264 | { |
261 | refresh(); | 265 | refresh(); |
262 | } | 266 | } |
263 | 267 | ||
264 | void NNTPviewItem::refresh() | 268 | void NNTPviewItem::refresh() |
265 | { | 269 | { |
266 | if (account->getOffline()) return; | 270 | if (account->getOffline()) return; |
267 | QValueList<FolderP> *folders = wrapper->listFolders(); | 271 | QValueList<FolderP> *folders = wrapper->listFolders(); |
268 | 272 | ||
269 | QListViewItem *child = firstChild(); | 273 | QListViewItem *child = firstChild(); |
270 | while ( child ) | 274 | while ( child ) |
271 | { | 275 | { |
272 | QListViewItem *tmp = child; | 276 | QListViewItem *tmp = child; |
273 | child = child->nextSibling(); | 277 | child = child->nextSibling(); |
274 | delete tmp; | 278 | delete tmp; |
275 | } | 279 | } |
276 | QValueList<FolderP>::ConstIterator it; | 280 | QValueList<FolderP>::ConstIterator it; |
277 | QListViewItem*item = 0; | 281 | QListViewItem*item = 0; |
278 | for ( it = folders->begin(); it!=folders->end(); ++it) | 282 | for ( it = folders->begin(); it!=folders->end(); ++it) |
279 | { | 283 | { |
280 | item = new NNTPfolderItem( (*it), this , item ); | 284 | item = new NNTPfolderItem( (*it), this , item ); |
281 | item->setSelectable( (*it)->may_select()); | 285 | item->setSelectable( (*it)->may_select()); |
282 | } | 286 | } |
283 | delete folders; | 287 | delete folders; |
@@ -452,141 +456,140 @@ void IMAPviewItem::refresh(QValueList<RecMailP>&) | |||
452 | } | 456 | } |
453 | 457 | ||
454 | const QStringList&IMAPviewItem::subFolders() | 458 | const QStringList&IMAPviewItem::subFolders() |
455 | { | 459 | { |
456 | return currentFolders; | 460 | return currentFolders; |
457 | } | 461 | } |
458 | 462 | ||
459 | void IMAPviewItem::refreshFolders(bool force) | 463 | void IMAPviewItem::refreshFolders(bool force) |
460 | { | 464 | { |
461 | if (childCount()>0 && force==false) return; | 465 | if (childCount()>0 && force==false) return; |
462 | if (account->getOffline()) return; | 466 | if (account->getOffline()) return; |
463 | 467 | ||
464 | removeChilds(); | 468 | removeChilds(); |
465 | currentFolders.clear(); | 469 | currentFolders.clear(); |
466 | QValueList<FolderP> * folders = wrapper->listFolders(); | 470 | QValueList<FolderP> * folders = wrapper->listFolders(); |
467 | 471 | ||
468 | QValueList<FolderP>::Iterator it; | 472 | QValueList<FolderP>::Iterator it; |
469 | QListViewItem*item = 0; | 473 | QListViewItem*item = 0; |
470 | QListViewItem*titem = 0; | 474 | QListViewItem*titem = 0; |
471 | QString fname,del,search; | 475 | QString fname,del,search; |
472 | int pos; | 476 | int pos; |
473 | 477 | ||
474 | for ( it = folders->begin(); it!=folders->end(); ++it) | 478 | for ( it = folders->begin(); it!=folders->end(); ++it) |
475 | { | 479 | { |
476 | if ((*it)->getDisplayName().lower()=="inbox") | 480 | if ((*it)->getDisplayName().lower()=="inbox") |
477 | { | 481 | { |
478 | item = new IMAPfolderItem( (*it), this , item ); | 482 | item = new IMAPfolderItem( (*it), this , item ); |
479 | folders->remove(it); | 483 | folders->remove(it); |
480 | break; | 484 | break; |
481 | } | 485 | } |
482 | } | 486 | } |
483 | for ( it = folders->begin(); it!=folders->end(); ++it) | 487 | for ( it = folders->begin(); it!=folders->end(); ++it) |
484 | { | 488 | { |
485 | fname = (*it)->getDisplayName(); | 489 | fname = (*it)->getDisplayName(); |
486 | currentFolders.append((*it)->getName()); | 490 | currentFolders.append((*it)->getName()); |
487 | pos = fname.findRev((*it)->Separator()); | 491 | pos = fname.findRev((*it)->Separator()); |
488 | if (pos != -1) | 492 | if (pos != -1) |
489 | { | 493 | { |
490 | fname = fname.left(pos); | 494 | fname = fname.left(pos); |
491 | } | 495 | } |
492 | IMAPfolderItem*pitem = (IMAPfolderItem*)findSubItem(fname); | 496 | IMAPfolderItem*pitem = (IMAPfolderItem*)findSubItem(fname); |
493 | if (pitem) | 497 | if (pitem) |
494 | { | 498 | { |
495 | titem = item; | 499 | titem = item; |
496 | item = new IMAPfolderItem( (*it),pitem,pitem->firstChild(),this); | 500 | item = new IMAPfolderItem( (*it),pitem,pitem->firstChild(),this); |
497 | /* setup the short name */ | 501 | /* setup the short name */ |
498 | item->setText(0,(*it)->getDisplayName().mid(pos+1)); | 502 | item->setText(0,(*it)->getDisplayName().mid(pos+1)); |
499 | item = titem; | 503 | item = titem; |
500 | } | 504 | } |
501 | else | 505 | else |
502 | { | 506 | { |
503 | item = new IMAPfolderItem( (*it), this , item ); | 507 | item = new IMAPfolderItem( (*it), this , item ); |
504 | } | 508 | } |
505 | } | 509 | } |
506 | delete folders; | 510 | delete folders; |
507 | } | 511 | } |
508 | 512 | ||
509 | QPopupMenu * IMAPviewItem::getContextMenu() | 513 | QPopupMenu * IMAPviewItem::getContextMenu() |
510 | { | 514 | { |
511 | QPopupMenu *m = new QPopupMenu(0); | 515 | QPopupMenu *m = new QPopupMenu(0); |
512 | if (m) | 516 | if (m) |
513 | { | 517 | { |
514 | if (!account->getOffline()) | 518 | if (!account->getOffline()) |
515 | { | 519 | { |
520 | m->insertItem(QObject::tr("Get new messages",contextName),GET_NEW_MAILS); | ||
516 | m->insertItem(QObject::tr("Refresh folder list",contextName),0); | 521 | m->insertItem(QObject::tr("Refresh folder list",contextName),0); |
517 | m->insertItem(QObject::tr("Create new folder",contextName),1); | 522 | m->insertItem(QObject::tr("Create new folder",contextName),1); |
518 | m->insertSeparator(); | 523 | m->insertSeparator(); |
519 | m->insertItem(QObject::tr("Disconnect",contextName),2); | 524 | m->insertItem(QObject::tr("Disconnect",contextName),2); |
520 | m->insertItem(QObject::tr("Set offline",contextName),3); | 525 | m->insertItem(QObject::tr("Set offline",contextName),3); |
521 | m->insertSeparator(); | 526 | m->insertSeparator(); |
522 | m->insertItem(QObject::tr("Get new messages",contextName),GET_NEW_MAILS); | ||
523 | } | 527 | } |
524 | else | 528 | else |
525 | { | 529 | { |
526 | m->insertItem(QObject::tr("Set online",contextName),3); | ||
527 | m->insertSeparator(); | ||
528 | m->insertItem(QObject::tr("Get new messages",contextName),GET_NEW_MAILS); | 530 | m->insertItem(QObject::tr("Get new messages",contextName),GET_NEW_MAILS); |
531 | m->insertItem(QObject::tr("Set online",contextName),3); | ||
529 | } | 532 | } |
530 | } | 533 | } |
531 | return m; | 534 | return m; |
532 | } | 535 | } |
533 | 536 | ||
534 | void IMAPviewItem::createNewFolder() | 537 | void IMAPviewItem::createNewFolder() |
535 | { | 538 | { |
536 | Newmdirdlg ndirdlg; | 539 | Newmdirdlg ndirdlg; |
537 | 540 | ||
538 | ndirdlg.showMaximized(); | 541 | ndirdlg.showMaximized(); |
539 | if ( ndirdlg.exec() ) | 542 | if ( ndirdlg.exec() ) |
540 | { | 543 | { |
541 | QString ndir = ndirdlg.Newdir(); | 544 | QString ndir = ndirdlg.Newdir(); |
542 | bool makesubs = ndirdlg.subpossible(); | 545 | bool makesubs = ndirdlg.subpossible(); |
543 | QString delemiter = "/"; | 546 | QString delemiter = "/"; |
544 | IMAPfolderItem*item = (IMAPfolderItem*)firstChild(); | 547 | IMAPfolderItem*item = (IMAPfolderItem*)firstChild(); |
545 | if (item) | 548 | if (item) |
546 | { | 549 | { |
547 | delemiter = item->Delemiter(); | 550 | delemiter = item->Delemiter(); |
548 | } | 551 | } |
549 | if (wrapper->createMbox(ndir,0,delemiter,makesubs)) | 552 | if (wrapper->createMbox(ndir,0,delemiter,makesubs)) |
550 | { | 553 | { |
551 | refreshFolders(true); | 554 | refreshFolders(true); |
552 | } | 555 | } |
553 | } | 556 | } |
554 | } | 557 | } |
555 | 558 | ||
556 | void IMAPviewItem::contextMenuSelected(int id) | 559 | void IMAPviewItem::contextMenuSelected(int id) |
557 | { | 560 | { |
558 | 561 | ||
559 | switch (id) | 562 | switch (id) |
560 | { | 563 | { |
561 | case 0: | 564 | case 0: |
562 | refreshFolders(true); | 565 | refreshFolders(true); |
563 | break; | 566 | break; |
564 | case 1: | 567 | case 1: |
565 | createNewFolder(); | 568 | createNewFolder(); |
566 | break; | 569 | break; |
567 | case 2: | 570 | case 2: |
568 | removeChilds(); | 571 | removeChilds(); |
569 | wrapper->logout(); | 572 | wrapper->logout(); |
570 | break; | 573 | break; |
571 | case 3: | 574 | case 3: |
572 | if (account->getOffline()==false) | 575 | if (account->getOffline()==false) |
573 | { | 576 | { |
574 | removeChilds(); | 577 | removeChilds(); |
575 | wrapper->logout(); | 578 | wrapper->logout(); |
576 | } | 579 | } |
577 | account->setOffline(!account->getOffline()); | 580 | account->setOffline(!account->getOffline()); |
578 | account->save(); | 581 | account->save(); |
579 | SETPIX(PIXMAP_IMAPFOLDER); | 582 | SETPIX(PIXMAP_IMAPFOLDER); |
580 | refreshFolders(false); | 583 | refreshFolders(false); |
581 | break; | 584 | break; |
582 | case GET_NEW_MAILS: // daunlood | 585 | case GET_NEW_MAILS: // daunlood |
583 | { | 586 | { |
584 | if (account->getOffline()) { | 587 | if (account->getOffline()) { |
585 | contextMenuSelected( 3 ); | 588 | contextMenuSelected( 3 ); |
586 | } | 589 | } |
587 | AccountView*bl = accountView(); | 590 | AccountView*bl = accountView(); |
588 | if (!bl) return; | 591 | if (!bl) return; |
589 | AccountViewItem* in = findSubItem( "inbox" , 0); | 592 | AccountViewItem* in = findSubItem( "inbox" , 0); |
590 | if ( ! in ) | 593 | if ( ! in ) |
591 | return; | 594 | return; |
592 | bl->downloadMailsInbox(in->getFolder(),getWrapper()); | 595 | bl->downloadMailsInbox(in->getFolder(),getWrapper()); |
@@ -608,212 +611,220 @@ bool IMAPviewItem::offline() | |||
608 | } | 611 | } |
609 | 612 | ||
610 | IMAPfolderItem::IMAPfolderItem( const FolderP& folderInit, IMAPviewItem *parent , QListViewItem*after ) | 613 | IMAPfolderItem::IMAPfolderItem( const FolderP& folderInit, IMAPviewItem *parent , QListViewItem*after ) |
611 | : AccountViewItem( folderInit, parent , after ) | 614 | : AccountViewItem( folderInit, parent , after ) |
612 | { | 615 | { |
613 | imap = parent; | 616 | imap = parent; |
614 | if (folder->getDisplayName().lower()!="inbox") | 617 | if (folder->getDisplayName().lower()!="inbox") |
615 | { | 618 | { |
616 | setPixmap( 0, PIXMAP_IMAPFOLDER ); | 619 | setPixmap( 0, PIXMAP_IMAPFOLDER ); |
617 | } | 620 | } |
618 | else | 621 | else |
619 | { | 622 | { |
620 | setPixmap( 0, PIXMAP_INBOXFOLDER); | 623 | setPixmap( 0, PIXMAP_INBOXFOLDER); |
621 | } | 624 | } |
622 | setText( 0, folder->getDisplayName() ); | 625 | setText( 0, folder->getDisplayName() ); |
623 | } | 626 | } |
624 | 627 | ||
625 | IMAPfolderItem::IMAPfolderItem(const FolderP &folderInit, IMAPfolderItem *parent , QListViewItem*after, IMAPviewItem *master ) | 628 | IMAPfolderItem::IMAPfolderItem(const FolderP &folderInit, IMAPfolderItem *parent , QListViewItem*after, IMAPviewItem *master ) |
626 | : AccountViewItem(folderInit, parent,after ) | 629 | : AccountViewItem(folderInit, parent,after ) |
627 | { | 630 | { |
628 | imap = master; | 631 | imap = master; |
629 | if (folder->getDisplayName().lower()!="inbox") | 632 | if (folder->getDisplayName().lower()!="inbox") |
630 | { | 633 | { |
631 | setPixmap( 0, PIXMAP_IMAPFOLDER ); | 634 | setPixmap( 0, PIXMAP_IMAPFOLDER ); |
632 | } | 635 | } |
633 | else | 636 | else |
634 | { | 637 | { |
635 | setPixmap( 0, PIXMAP_INBOXFOLDER); | 638 | setPixmap( 0, PIXMAP_INBOXFOLDER); |
636 | } | 639 | } |
637 | setText( 0, folder->getDisplayName() ); | 640 | setText( 0, folder->getDisplayName() ); |
638 | } | 641 | } |
639 | 642 | ||
640 | IMAPfolderItem::~IMAPfolderItem() | 643 | IMAPfolderItem::~IMAPfolderItem() |
641 | {} | 644 | {} |
642 | 645 | ||
643 | const QString& IMAPfolderItem::Delemiter()const | 646 | const QString& IMAPfolderItem::Delemiter()const |
644 | { | 647 | { |
645 | return folder->Separator(); | 648 | return folder->Separator(); |
646 | } | 649 | } |
647 | 650 | ||
648 | void IMAPfolderItem::refresh(QValueList<RecMailP>&target) | 651 | void IMAPfolderItem::refresh(QValueList<RecMailP>&target) |
649 | { | 652 | { |
650 | if (folder->may_select()) | 653 | if (folder->may_select()) |
651 | { | 654 | { |
652 | imap->getWrapper()->listMessages( folder->getName(),target ); | 655 | imap->getWrapper()->listMessages( folder->getName(),target ); |
653 | } | 656 | } |
654 | else | 657 | else |
655 | { | 658 | { |
656 | target.clear(); | 659 | target.clear(); |
657 | } | 660 | } |
658 | } | 661 | } |
659 | 662 | ||
660 | RECBODYP IMAPfolderItem::fetchBody(const RecMailP&aMail) | 663 | RECBODYP IMAPfolderItem::fetchBody(const RecMailP&aMail) |
661 | { | 664 | { |
662 | return imap->getWrapper()->fetchBody(aMail); | 665 | return imap->getWrapper()->fetchBody(aMail); |
663 | } | 666 | } |
664 | 667 | ||
665 | QPopupMenu * IMAPfolderItem::getContextMenu() | 668 | QPopupMenu * IMAPfolderItem::getContextMenu() |
666 | { | 669 | { |
667 | QPopupMenu *m = new QPopupMenu(0); | 670 | QPopupMenu *m = new QPopupMenu(0); |
668 | if (m) | 671 | if (m) |
669 | { | 672 | { |
670 | if (folder->may_select()) | 673 | if (folder->may_select()) |
671 | { | 674 | { |
675 | m->insertItem(QObject::tr("Get new messages",contextName),GET_NEW_MAILS); | ||
672 | m->insertItem(QObject::tr("Refresh header list",contextName),0); | 676 | m->insertItem(QObject::tr("Refresh header list",contextName),0); |
673 | m->insertItem(QObject::tr("Move/Copie all mails",contextName),4); | 677 | m->insertItem(QObject::tr("Move/Copie all mails",contextName),4); |
674 | m->insertItem(QObject::tr("Delete all mails",contextName),1); | 678 | m->insertItem(QObject::tr("Delete all mails",contextName),1); |
675 | } | 679 | } |
676 | if (folder->no_inferior()==false) | 680 | if (folder->no_inferior()==false) |
677 | { | 681 | { |
678 | m->insertItem(QObject::tr("Create new subfolder",contextName),2); | 682 | m->insertItem(QObject::tr("Create new subfolder",contextName),2); |
679 | } | 683 | } |
680 | if (folder->getDisplayName().lower()!="inbox") | 684 | if (folder->getDisplayName().lower()!="inbox") |
681 | { | 685 | { |
682 | m->insertItem(QObject::tr("Delete folder",contextName),3); | 686 | m->insertItem(QObject::tr("Delete folder",contextName),3); |
683 | } | 687 | } |
684 | } | 688 | } |
685 | return m; | 689 | return m; |
686 | } | 690 | } |
687 | 691 | ||
688 | void IMAPfolderItem::createNewFolder() | 692 | void IMAPfolderItem::createNewFolder() |
689 | { | 693 | { |
690 | Newmdirdlg ndirdlg; | 694 | Newmdirdlg ndirdlg; |
691 | ndirdlg.showMaximized(); | 695 | ndirdlg.showMaximized(); |
692 | if ( ndirdlg.exec() ) | 696 | if ( ndirdlg.exec() ) |
693 | { | 697 | { |
694 | QString ndir = ndirdlg.Newdir(); | 698 | QString ndir = ndirdlg.Newdir(); |
695 | bool makesubs = ndirdlg.subpossible(); | 699 | bool makesubs = ndirdlg.subpossible(); |
696 | QString delemiter = Delemiter(); | 700 | QString delemiter = Delemiter(); |
697 | if (imap->wrapper->createMbox(ndir,folder,delemiter,makesubs)) | 701 | if (imap->wrapper->createMbox(ndir,folder,delemiter,makesubs)) |
698 | { | 702 | { |
699 | imap->refreshFolders(true); | 703 | imap->refreshFolders(true); |
700 | } | 704 | } |
701 | } | 705 | } |
702 | } | 706 | } |
703 | 707 | ||
704 | void IMAPfolderItem::deleteFolder() | 708 | void IMAPfolderItem::deleteFolder() |
705 | { | 709 | { |
706 | int yesno = QMessageBox::warning(0,QObject::tr("Delete folder",contextName), | 710 | int yesno = QMessageBox::warning(0,QObject::tr("Delete folder",contextName), |
707 | QObject::tr("<center>Realy delete folder <br><b>%1</b><br>and all if it content?</center>",contextName).arg(folder->getDisplayName()), | 711 | QObject::tr("<center>Realy delete folder <br><b>%1</b><br>and all if it content?</center>",contextName).arg(folder->getDisplayName()), |
708 | QObject::tr("Yes",contextName), | 712 | QObject::tr("Yes",contextName), |
709 | QObject::tr("No",contextName),QString::null,1,1); | 713 | QObject::tr("No",contextName),QString::null,1,1); |
710 | 714 | ||
711 | if (yesno == 0) | 715 | if (yesno == 0) |
712 | { | 716 | { |
713 | if (imap->getWrapper()->deleteMbox(folder)) | 717 | if (imap->getWrapper()->deleteMbox(folder)) |
714 | { | 718 | { |
715 | QListView*v=listView(); | 719 | QListView*v=listView(); |
716 | IMAPviewItem * box = imap; | 720 | IMAPviewItem * box = imap; |
717 | /* be carefull - after that this object is destroyd so don't use | 721 | /* be carefull - after that this object is destroyd so don't use |
718 | * any member of it after that call!!*/ | 722 | * any member of it after that call!!*/ |
719 | imap->refreshFolders(true); | 723 | imap->refreshFolders(true); |
720 | if (v) | 724 | if (v) |
721 | { | 725 | { |
722 | v->setSelected(box,true); | 726 | v->setSelected(box,true); |
723 | } | 727 | } |
724 | } | 728 | } |
725 | } | 729 | } |
726 | } | 730 | } |
727 | 731 | ||
728 | void IMAPfolderItem::downloadMails() | 732 | void IMAPfolderItem::downloadMails() |
729 | { | 733 | { |
730 | AccountView*bl = imap->accountView(); | 734 | AccountView*bl = imap->accountView(); |
731 | if (!bl) return; | 735 | if (!bl) return; |
732 | bl->downloadMails(folder,imap->getWrapper()); | 736 | bl->downloadMails(folder,imap->getWrapper()); |
733 | } | 737 | } |
734 | 738 | ||
735 | void IMAPfolderItem::contextMenuSelected(int id) | 739 | void IMAPfolderItem::contextMenuSelected(int id) |
736 | { | 740 | { |
737 | 741 | ||
738 | AccountView * view = (AccountView*)listView(); | 742 | AccountView * view = (AccountView*)listView(); |
739 | switch(id) | 743 | switch(id) |
740 | { | 744 | { |
741 | case 0: | 745 | case 0: |
742 | view->refreshCurrent(); | 746 | view->refreshCurrent(); |
743 | break; | 747 | break; |
744 | case 1: | 748 | case 1: |
745 | deleteAllMail(imap->getWrapper(),folder); | 749 | deleteAllMail(imap->getWrapper(),folder); |
746 | break; | 750 | break; |
747 | case 2: | 751 | case 2: |
748 | createNewFolder(); | 752 | createNewFolder(); |
749 | break; | 753 | break; |
750 | case 3: | 754 | case 3: |
751 | deleteFolder(); | 755 | deleteFolder(); |
752 | break; | 756 | break; |
753 | case 4: | 757 | case 4: |
754 | downloadMails(); | 758 | downloadMails(); |
755 | break; | 759 | break; |
760 | case GET_NEW_MAILS: // daunlood | ||
761 | { | ||
762 | AccountView*bl = accountView(); | ||
763 | if (!bl) return; | ||
764 | bl->downloadMailsInbox(getFolder(),imap->getWrapper()); | ||
765 | } | ||
766 | break; | ||
756 | default: | 767 | default: |
757 | break; | 768 | break; |
758 | } | 769 | } |
759 | } | 770 | } |
760 | 771 | ||
761 | /** | 772 | /** |
762 | * MH Account stuff | 773 | * MH Account stuff |
763 | */ | 774 | */ |
764 | /* MH is a little bit different - the top folder can contains messages other than in IMAP and | 775 | /* MH is a little bit different - the top folder can contains messages other than in IMAP and |
765 | POP3 and MBOX */ | 776 | POP3 and MBOX */ |
766 | MHviewItem::MHviewItem( const QString&aPath, AccountView *parent ) | 777 | MHviewItem::MHviewItem( const QString&aPath, AccountView *parent ) |
767 | : AccountViewItem( parent ) | 778 | : AccountViewItem( parent ) |
768 | { | 779 | { |
769 | m_Path = aPath; | 780 | m_Path = aPath; |
770 | /* be carefull - the space within settext is wanted - thats why the string twice */ | 781 | /* be carefull - the space within settext is wanted - thats why the string twice */ |
771 | wrapper = AbstractMail::getWrapper( m_Path,"Local Folders"); | 782 | wrapper = AbstractMail::getWrapper( m_Path,"Local Folders"); |
772 | setPixmap( 0, PIXMAP_LOCALFOLDER ); | 783 | setPixmap( 0, PIXMAP_LOCALFOLDER ); |
773 | setText( 0, " Local Folders" ); | 784 | setText( 0, " Local Folders" ); |
774 | setOpen( true ); | 785 | setOpen( true ); |
775 | folder = 0; | 786 | folder = 0; |
776 | } | 787 | } |
777 | 788 | ||
778 | MHviewItem::~MHviewItem() | 789 | MHviewItem::~MHviewItem() |
779 | { | 790 | { |
780 | delete wrapper; | 791 | delete wrapper; |
781 | } | 792 | } |
782 | 793 | ||
783 | AbstractMail *MHviewItem::getWrapper() | 794 | AbstractMail *MHviewItem::getWrapper() |
784 | { | 795 | { |
785 | return wrapper; | 796 | return wrapper; |
786 | } | 797 | } |
787 | 798 | ||
788 | void MHviewItem::refresh( QValueList<RecMailP> & target) | 799 | void MHviewItem::refresh( QValueList<RecMailP> & target) |
789 | { | 800 | { |
790 | refresh(false); | 801 | refresh(false); |
791 | getWrapper()->listMessages( "",target ); | 802 | getWrapper()->listMessages( "",target ); |
792 | } | 803 | } |
793 | 804 | ||
794 | void MHviewItem::refresh(bool force) | 805 | void MHviewItem::refresh(bool force) |
795 | { | 806 | { |
796 | if (childCount()>0 && force==false) return; | 807 | if (childCount()>0 && force==false) return; |
797 | removeChilds(); | 808 | removeChilds(); |
798 | currentFolders.clear(); | 809 | currentFolders.clear(); |
799 | QValueList<FolderP> *folders = wrapper->listFolders(); | 810 | QValueList<FolderP> *folders = wrapper->listFolders(); |
800 | QValueList<FolderP>::ConstIterator it; | 811 | QValueList<FolderP>::ConstIterator it; |
801 | MHfolderItem*item = 0; | 812 | MHfolderItem*item = 0; |
802 | MHfolderItem*pmaster = 0; | 813 | MHfolderItem*pmaster = 0; |
803 | QString fname = ""; | 814 | QString fname = ""; |
804 | int pos; | 815 | int pos; |
805 | for ( it = folders->begin(); it!=folders->end(); ++it) | 816 | for ( it = folders->begin(); it!=folders->end(); ++it) |
806 | { | 817 | { |
807 | fname = (*it)->getDisplayName(); | 818 | fname = (*it)->getDisplayName(); |
808 | /* this folder itself */ | 819 | /* this folder itself */ |
809 | if (fname=="/") | 820 | if (fname=="/") |
810 | { | 821 | { |
811 | currentFolders.append(fname); | 822 | currentFolders.append(fname); |
812 | folder = (*it); | 823 | folder = (*it); |
813 | continue; | 824 | continue; |
814 | } | 825 | } |
815 | currentFolders.append(fname); | 826 | currentFolders.append(fname); |
816 | pos = fname.findRev("/"); | 827 | pos = fname.findRev("/"); |
817 | if (pos > 0) | 828 | if (pos > 0) |
818 | { | 829 | { |
819 | fname = fname.left(pos); | 830 | fname = fname.left(pos); |
diff --git a/kmicromail/editaccounts.cpp b/kmicromail/editaccounts.cpp index d43d23b..733e38a 100644 --- a/kmicromail/editaccounts.cpp +++ b/kmicromail/editaccounts.cpp | |||
@@ -477,145 +477,185 @@ SMTPconfig::SMTPconfig( SMTPaccount *account, QWidget *parent, const char *name, | |||
477 | 477 | ||
478 | connect( ComboBox1, SIGNAL( activated(int) ), SLOT( slotConnectionToggle(int) ) ); | 478 | connect( ComboBox1, SIGNAL( activated(int) ), SLOT( slotConnectionToggle(int) ) ); |
479 | ComboBox1->insertItem( "Only if available", 0 ); | 479 | ComboBox1->insertItem( "Only if available", 0 ); |
480 | ComboBox1->insertItem( "Always, Negotiated", 1 ); | 480 | ComboBox1->insertItem( "Always, Negotiated", 1 ); |
481 | ComboBox1->insertItem( "Connect on secure port", 2 ); | 481 | ComboBox1->insertItem( "Connect on secure port", 2 ); |
482 | ComboBox1->insertItem( "Run command instead", 3 ); | 482 | ComboBox1->insertItem( "Run command instead", 3 ); |
483 | CommandEdit->hide(); | 483 | CommandEdit->hide(); |
484 | ComboBox1->setCurrentItem( data->ConnectionType() ); | 484 | ComboBox1->setCurrentItem( data->ConnectionType() ); |
485 | } | 485 | } |
486 | 486 | ||
487 | void SMTPconfig::slotConnectionToggle( int index ) | 487 | void SMTPconfig::slotConnectionToggle( int index ) |
488 | { | 488 | { |
489 | // 2 is ssl connection | 489 | // 2 is ssl connection |
490 | if ( index == 2 ) | 490 | if ( index == 2 ) |
491 | { | 491 | { |
492 | portLine->setText( SMTP_SSL_PORT ); | 492 | portLine->setText( SMTP_SSL_PORT ); |
493 | } | 493 | } |
494 | else if ( index == 3 ) | 494 | else if ( index == 3 ) |
495 | { | 495 | { |
496 | portLine->setText( SMTP_PORT ); | 496 | portLine->setText( SMTP_PORT ); |
497 | CommandEdit->show(); | 497 | CommandEdit->show(); |
498 | } | 498 | } |
499 | else | 499 | else |
500 | { | 500 | { |
501 | portLine->setText( SMTP_PORT ); | 501 | portLine->setText( SMTP_PORT ); |
502 | } | 502 | } |
503 | } | 503 | } |
504 | 504 | ||
505 | void SMTPconfig::fillValues() | 505 | void SMTPconfig::fillValues() |
506 | { | 506 | { |
507 | accountLine->setText( data->getAccountName() ); | 507 | accountLine->setText( data->getAccountName() ); |
508 | serverLine->setText( data->getServer() ); | 508 | serverLine->setText( data->getServer() ); |
509 | portLine->setText( data->getPort() ); | 509 | portLine->setText( data->getPort() ); |
510 | ComboBox1->setCurrentItem( data->ConnectionType() ); | 510 | ComboBox1->setCurrentItem( data->ConnectionType() ); |
511 | loginBox->setChecked( data->getLogin() ); | 511 | loginBox->setChecked( data->getLogin() ); |
512 | userLine->setText( data->getUser() ); | 512 | userLine->setText( data->getUser() ); |
513 | passLine->setText( data->getPassword() ); | 513 | passLine->setText( data->getPassword() ); |
514 | } | 514 | } |
515 | 515 | ||
516 | void SMTPconfig::accept() | 516 | void SMTPconfig::accept() |
517 | { | 517 | { |
518 | data->setAccountName( accountLine->text() ); | 518 | data->setAccountName( accountLine->text() ); |
519 | data->setServer( serverLine->text() ); | 519 | data->setServer( serverLine->text() ); |
520 | data->setPort( portLine->text() ); | 520 | data->setPort( portLine->text() ); |
521 | data->setConnectionType( ComboBox1->currentItem() ); | 521 | data->setConnectionType( ComboBox1->currentItem() ); |
522 | data->setLogin( loginBox->isChecked() ); | 522 | data->setLogin( loginBox->isChecked() ); |
523 | data->setUser( userLine->text() ); | 523 | data->setUser( userLine->text() ); |
524 | data->setPassword( passLine->text() ); | 524 | data->setPassword( passLine->text() ); |
525 | 525 | ||
526 | QDialog::accept(); | 526 | QDialog::accept(); |
527 | } | 527 | } |
528 | 528 | ||
529 | /** | 529 | /** |
530 | * NNTPconfig | 530 | * NNTPconfig |
531 | */ | 531 | */ |
532 | 532 | ||
533 | NNTPconfig::NNTPconfig( NNTPaccount *account, QWidget *parent, const char *name, bool modal, WFlags flags ) | 533 | NNTPconfig::NNTPconfig( NNTPaccount *account, QWidget *parent, const char *name, bool modal, WFlags flags ) |
534 | : NNTPconfigUI( parent, name, modal, flags ) | 534 | : NNTPconfigUI( parent, name, modal, flags ) |
535 | { | 535 | { |
536 | data = account; | 536 | data = account; |
537 | 537 | ||
538 | connect( loginBox, SIGNAL( toggled(bool) ), userLine, SLOT( setEnabled(bool) ) ); | 538 | connect( loginBox, SIGNAL( toggled(bool) ), userLine, SLOT( setEnabled(bool) ) ); |
539 | connect( loginBox, SIGNAL( toggled(bool) ), passLine, SLOT( setEnabled(bool) ) ); | 539 | connect( loginBox, SIGNAL( toggled(bool) ), passLine, SLOT( setEnabled(bool) ) ); |
540 | connect( GetNGButton, SIGNAL( clicked() ), this, SLOT( slotGetNG() ) ); | 540 | connect( GetNGButton, SIGNAL( clicked() ), this, SLOT( slotGetNG() ) ); |
541 | connect( ShowSubcribed, SIGNAL( clicked() ), this, SLOT( slotShowSub() ) ); | ||
542 | connect( FilterButton, SIGNAL( clicked() ), this, SLOT( slotShowFilter() ) ); | ||
541 | fillValues(); | 543 | fillValues(); |
542 | 544 | ||
543 | connect( sslBox, SIGNAL( toggled(bool) ), SLOT( slotSSL(bool) ) ); | 545 | connect( sslBox, SIGNAL( toggled(bool) ), SLOT( slotSSL(bool) ) ); |
544 | } | 546 | } |
545 | 547 | ||
548 | void NNTPconfig::slotShowSub() | ||
549 | { | ||
550 | save(); | ||
551 | data->save(); | ||
552 | ListViewGroups->clear(); | ||
553 | for ( QStringList::Iterator it = subscribedGroups.begin(); it != subscribedGroups.end(); ++it ) { | ||
554 | QCheckListItem *item; | ||
555 | item = new QCheckListItem( ListViewGroups, (*it), QCheckListItem::CheckBox ); | ||
556 | item->setOn( true ); | ||
557 | } | ||
558 | topLevelWidget()->setCaption( tr("%1 groups subscribed").arg( subscribedGroups.count())); | ||
559 | } | ||
560 | void NNTPconfig::slotShowFilter() | ||
561 | { | ||
562 | save(); | ||
563 | data->save(); | ||
564 | ListViewGroups->clear(); | ||
565 | int count = 0; | ||
566 | for ( QStringList::Iterator it = allGroups.begin(); it != allGroups.end(); ++it ) { | ||
567 | QCheckListItem *item; | ||
568 | if ( GroupFilter->text().isEmpty() || (*it).find( GroupFilter->text() ) >= 0 ) { | ||
569 | item = new QCheckListItem( ListViewGroups, (*it), QCheckListItem::CheckBox ); | ||
570 | ++count; | ||
571 | if ( subscribedGroups.contains( (*it) ) >= 1 ) { | ||
572 | item->setOn( true ); | ||
573 | } | ||
574 | } | ||
575 | } | ||
576 | topLevelWidget()->setCaption( tr("Filter found %1 groups").arg( count)); | ||
577 | } | ||
546 | void NNTPconfig::slotGetNG() { | 578 | void NNTPconfig::slotGetNG() { |
547 | save(); | 579 | save(); |
548 | data->save(); | 580 | data->save(); |
581 | topLevelWidget()->setCaption( tr("Fetching group list...")); | ||
582 | qApp->processEvents(); | ||
549 | NNTPwrapper* tmp = new NNTPwrapper( data ); | 583 | NNTPwrapper* tmp = new NNTPwrapper( data ); |
550 | QStringList list = tmp->listAllNewsgroups(); | 584 | allGroups = tmp->listAllNewsgroups(); |
585 | topLevelWidget()->setCaption( tr("Downloaded %1 group names").arg( allGroups.count())); | ||
551 | 586 | ||
552 | ListViewGroups->clear(); | 587 | ListViewGroups->clear(); |
553 | 588 | ||
554 | for ( QStringList::Iterator it = list.begin(); it != list.end(); ++it ) { | 589 | for ( QStringList::Iterator it = allGroups.begin(); it != allGroups.end(); ++it ) { |
555 | QCheckListItem *item; | 590 | QCheckListItem *item; |
556 | item = new QCheckListItem( ListViewGroups, (*it), QCheckListItem::CheckBox ); | 591 | item = new QCheckListItem( ListViewGroups, (*it), QCheckListItem::CheckBox ); |
557 | if ( subscribedGroups.contains( (*it) ) >= 1 ) { | 592 | if ( subscribedGroups.contains( (*it) ) >= 1 ) { |
558 | item->setOn( true ); | 593 | item->setOn( true ); |
559 | } | 594 | |
595 | } | ||
560 | } | 596 | } |
597 | delete tmp; | ||
561 | } | 598 | } |
562 | 599 | ||
563 | void NNTPconfig::slotSSL( bool enabled ) | 600 | void NNTPconfig::slotSSL( bool enabled ) |
564 | { | 601 | { |
565 | if ( enabled ) | 602 | if ( enabled ) |
566 | { | 603 | { |
567 | portLine->setText( NNTP_SSL_PORT ); | 604 | portLine->setText( NNTP_SSL_PORT ); |
568 | } | 605 | } |
569 | else | 606 | else |
570 | { | 607 | { |
571 | portLine->setText( NNTP_PORT ); | 608 | portLine->setText( NNTP_PORT ); |
572 | } | 609 | } |
573 | } | 610 | } |
574 | 611 | ||
575 | void NNTPconfig::fillValues() | 612 | void NNTPconfig::fillValues() |
576 | { | 613 | { |
577 | accountLine->setText( data->getAccountName() ); | 614 | accountLine->setText( data->getAccountName() ); |
578 | serverLine->setText( data->getServer() ); | 615 | serverLine->setText( data->getServer() ); |
579 | portLine->setText( data->getPort() ); | 616 | portLine->setText( data->getPort() ); |
580 | sslBox->setChecked( data->getSSL() ); | 617 | sslBox->setChecked( data->getSSL() ); |
581 | loginBox->setChecked( data->getLogin() ); | 618 | loginBox->setChecked( data->getLogin() ); |
582 | userLine->setText( data->getUser() ); | 619 | userLine->setText( data->getUser() ); |
583 | passLine->setText( data->getPassword() ); | 620 | passLine->setText( data->getPassword() ); |
584 | subscribedGroups = data->getGroups(); | 621 | subscribedGroups = data->getGroups(); |
585 | /* don't forget that - you will overwrite values if user clicks cancel! */ | 622 | /* don't forget that - you will overwrite values if user clicks cancel! */ |
586 | for ( QStringList::Iterator it = subscribedGroups.begin(); it != subscribedGroups.end(); ++it ) { | 623 | for ( QStringList::Iterator it = subscribedGroups.begin(); it != subscribedGroups.end(); ++it ) { |
587 | QCheckListItem *item; | 624 | QCheckListItem *item; |
588 | item = new QCheckListItem( ListViewGroups, (*it), QCheckListItem::CheckBox ); | 625 | item = new QCheckListItem( ListViewGroups, (*it), QCheckListItem::CheckBox ); |
589 | item->setOn( true ); | 626 | item->setOn( true ); |
590 | } | 627 | } |
591 | } | 628 | } |
592 | 629 | ||
593 | void NNTPconfig::save() | 630 | void NNTPconfig::save() |
594 | { | 631 | { |
595 | data->setAccountName( accountLine->text() ); | 632 | data->setAccountName( accountLine->text() ); |
596 | data->setServer( serverLine->text() ); | 633 | data->setServer( serverLine->text() ); |
597 | data->setPort( portLine->text() ); | 634 | data->setPort( portLine->text() ); |
598 | data->setSSL( sslBox->isChecked() ); | 635 | data->setSSL( sslBox->isChecked() ); |
599 | data->setLogin( loginBox->isChecked() ); | 636 | data->setLogin( loginBox->isChecked() ); |
600 | data->setUser( userLine->text() ); | 637 | data->setUser( userLine->text() ); |
601 | data->setPassword( passLine->text() ); | 638 | data->setPassword( passLine->text() ); |
602 | 639 | ||
603 | QListViewItemIterator list_it( ListViewGroups ); | 640 | QListViewItemIterator list_it( ListViewGroups ); |
604 | 641 | ||
605 | QStringList groupList; | 642 | for ( ; list_it.current(); ++list_it ) { |
606 | for ( ; list_it.current(); ++list_it ) { | ||
607 | 643 | ||
608 | if ( ( (QCheckListItem*)list_it.current() )->isOn() ) { | 644 | if ( ( (QCheckListItem*)list_it.current() )->isOn() ) { |
609 | groupList.append( list_it.current()->text(0) ); | 645 | if ( subscribedGroups.contains( list_it.current()->text(0) ) < 1 ) |
610 | } | 646 | subscribedGroups.append( list_it.current()->text(0) ); |
647 | } else { | ||
648 | if ( subscribedGroups.contains( list_it.current()->text(0) ) >= 1 ) | ||
649 | subscribedGroups.remove( list_it.current()->text(0) ); | ||
650 | } | ||
611 | 651 | ||
612 | } | 652 | } |
613 | data->setGroups( groupList ); | 653 | data->setGroups( subscribedGroups ); |
614 | } | 654 | } |
615 | 655 | ||
616 | void NNTPconfig::accept() | 656 | void NNTPconfig::accept() |
617 | { | 657 | { |
618 | save(); | 658 | save(); |
619 | QDialog::accept(); | 659 | QDialog::accept(); |
620 | } | 660 | } |
621 | 661 | ||
diff --git a/kmicromail/editaccounts.h b/kmicromail/editaccounts.h index a9eb19f..6cf842e 100644 --- a/kmicromail/editaccounts.h +++ b/kmicromail/editaccounts.h | |||
@@ -80,74 +80,77 @@ public: | |||
80 | public slots: | 80 | public slots: |
81 | void fillValues(); | 81 | void fillValues(); |
82 | 82 | ||
83 | protected slots: | 83 | protected slots: |
84 | void slotConnectionToggle( int index ); | 84 | void slotConnectionToggle( int index ); |
85 | void accept(); | 85 | void accept(); |
86 | 86 | ||
87 | private: | 87 | private: |
88 | IMAPaccount *data; | 88 | IMAPaccount *data; |
89 | 89 | ||
90 | }; | 90 | }; |
91 | 91 | ||
92 | class POP3config : public POP3configUI | 92 | class POP3config : public POP3configUI |
93 | { | 93 | { |
94 | Q_OBJECT | 94 | Q_OBJECT |
95 | 95 | ||
96 | public: | 96 | public: |
97 | POP3config( POP3account *account, QWidget *parent = 0, const char *name = 0, bool modal = 0, WFlags flags = 0 ); | 97 | POP3config( POP3account *account, QWidget *parent = 0, const char *name = 0, bool modal = 0, WFlags flags = 0 ); |
98 | 98 | ||
99 | public slots: | 99 | public slots: |
100 | void fillValues(); | 100 | void fillValues(); |
101 | 101 | ||
102 | protected slots: | 102 | protected slots: |
103 | void slotConnectionToggle( int index ); | 103 | void slotConnectionToggle( int index ); |
104 | void accept(); | 104 | void accept(); |
105 | 105 | ||
106 | private: | 106 | private: |
107 | POP3account *data; | 107 | POP3account *data; |
108 | 108 | ||
109 | }; | 109 | }; |
110 | 110 | ||
111 | class SMTPconfig : public SMTPconfigUI | 111 | class SMTPconfig : public SMTPconfigUI |
112 | { | 112 | { |
113 | Q_OBJECT | 113 | Q_OBJECT |
114 | 114 | ||
115 | public: | 115 | public: |
116 | SMTPconfig( SMTPaccount *account, QWidget *parent = 0, const char *name = 0, bool modal = 0, WFlags flags = 0 ); | 116 | SMTPconfig( SMTPaccount *account, QWidget *parent = 0, const char *name = 0, bool modal = 0, WFlags flags = 0 ); |
117 | 117 | ||
118 | public slots: | 118 | public slots: |
119 | void fillValues(); | 119 | void fillValues(); |
120 | 120 | ||
121 | protected slots: | 121 | protected slots: |
122 | void slotConnectionToggle( int index ); | 122 | void slotConnectionToggle( int index ); |
123 | void accept(); | 123 | void accept(); |
124 | 124 | ||
125 | private: | 125 | private: |
126 | SMTPaccount *data; | 126 | SMTPaccount *data; |
127 | 127 | ||
128 | }; | 128 | }; |
129 | 129 | ||
130 | class NNTPconfig : public NNTPconfigUI | 130 | class NNTPconfig : public NNTPconfigUI |
131 | { | 131 | { |
132 | Q_OBJECT | 132 | Q_OBJECT |
133 | 133 | ||
134 | public: | 134 | public: |
135 | NNTPconfig( NNTPaccount *account, QWidget *parent = 0, const char *name = 0, bool modal = 0, WFlags flags = 0 ); | 135 | NNTPconfig( NNTPaccount *account, QWidget *parent = 0, const char *name = 0, bool modal = 0, WFlags flags = 0 ); |
136 | 136 | ||
137 | public slots: | 137 | public slots: |
138 | void fillValues(); | 138 | void fillValues(); |
139 | 139 | ||
140 | protected slots: | 140 | protected slots: |
141 | void slotSSL( bool enabled ); | 141 | void slotSSL( bool enabled ); |
142 | void accept(); | 142 | void accept(); |
143 | void slotGetNG(); | 143 | void slotGetNG(); |
144 | void slotShowSub(); | ||
145 | void slotShowFilter(); | ||
144 | 146 | ||
145 | private: | 147 | private: |
146 | QStringList subscribedGroups; | 148 | QStringList subscribedGroups; |
149 | QStringList allGroups; | ||
147 | void save(); | 150 | void save(); |
148 | NNTPaccount *data; | 151 | NNTPaccount *data; |
149 | clist* list; | 152 | clist* list; |
150 | 153 | ||
151 | }; | 154 | }; |
152 | 155 | ||
153 | #endif | 156 | #endif |
diff --git a/kmicromail/mainwindow.cpp b/kmicromail/mainwindow.cpp index d130317..2a67e39 100644 --- a/kmicromail/mainwindow.cpp +++ b/kmicromail/mainwindow.cpp | |||
@@ -1,102 +1,107 @@ | |||
1 | 1 | ||
2 | // CHANGED 2004-08-06 Lutz Rogowski | 2 | // CHANGED 2004-08-06 Lutz Rogowski |
3 | #include <qlabel.h> | 3 | #include <qlabel.h> |
4 | #include <qvbox.h> | 4 | #include <qvbox.h> |
5 | #include <qheader.h> | 5 | #include <qheader.h> |
6 | #include <qtimer.h> | 6 | #include <qtimer.h> |
7 | #include <qlayout.h> | 7 | #include <qlayout.h> |
8 | #include <kdialog.h> | 8 | #include <kdialog.h> |
9 | #include <kiconloader.h> | 9 | #include <kiconloader.h> |
10 | #include <kapplication.h> | 10 | #include <kapplication.h> |
11 | 11 | ||
12 | #ifndef DESKTOP_VERSION | 12 | #ifndef DESKTOP_VERSION |
13 | #include <qpe/qpeapplication.h> | 13 | #include <qpe/qpeapplication.h> |
14 | #endif | 14 | #endif |
15 | #include "defines.h" | 15 | #include "defines.h" |
16 | #include "mainwindow.h" | 16 | #include "mainwindow.h" |
17 | #include <KDGanttMinimizeSplitter.h> | 17 | #include <KDGanttMinimizeSplitter.h> |
18 | 18 | ||
19 | 19 | ||
20 | #include <kabc/stdaddressbook.h> | 20 | #include <kabc/stdaddressbook.h> |
21 | 21 | ||
22 | MainWindow::MainWindow( QWidget *parent, const char *name, WFlags flags ) | 22 | MainWindow::MainWindow( QWidget *parent, const char *name, WFlags flags ) |
23 | : QMainWindow( parent, name ) //, flags ) | 23 | : QMainWindow( parent, name ) //, flags ) |
24 | { | 24 | { |
25 | setCaption( tr( "KOpieMail/Pi" ) ); | 25 | setCaption( tr( "KOpieMail/Pi" ) ); |
26 | setToolBarsMovable( false ); | 26 | setToolBarsMovable( false ); |
27 | //KABC::StdAddressBook::self(); | 27 | //KABC::StdAddressBook::self(); |
28 | toolBar = new QToolBar( this ); | 28 | toolBar = new QToolBar( this ); |
29 | menuBar = new QPEMenuBar( toolBar ); | 29 | menuBar = new QPEMenuBar( toolBar ); |
30 | mailMenu = new QPopupMenu( menuBar ); | 30 | mailMenu = new QPopupMenu( menuBar ); |
31 | menuBar->insertItem( tr( "Mail" ), mailMenu ); | 31 | menuBar->insertItem( tr( "Mail" ), mailMenu ); |
32 | settingsMenu = new QPopupMenu( menuBar ); | 32 | settingsMenu = new QPopupMenu( menuBar ); |
33 | menuBar->insertItem( tr( "Settings" ), settingsMenu ); | 33 | menuBar->insertItem( tr( "Settings" ), settingsMenu ); |
34 | 34 | ||
35 | addToolBar( toolBar ); | 35 | addToolBar( toolBar ); |
36 | toolBar->setHorizontalStretchable( true ); | 36 | toolBar->setHorizontalStretchable( true ); |
37 | QAction* getMail = new QAction( tr( "Get all new mails" ), SmallIcon("add"), | ||
38 | 0, 0, this ); | ||
39 | connect(getMail, SIGNAL( activated() ), | ||
40 | SLOT( slotGetAllMail() ) ); | ||
41 | getMail->addTo( mailMenu ); | ||
37 | 42 | ||
38 | QAction* getMail = new QAction( tr( "Get new mail" ), SmallIcon("add"), | 43 | getMail = new QAction( tr( "Get new messages" ), SmallIcon("add"), |
39 | 0, 0, this ); | 44 | 0, 0, this ); |
40 | getMail->addTo( toolBar ); | 45 | getMail->addTo( toolBar ); |
41 | getMail->addTo( mailMenu ); | 46 | getMail->addTo( mailMenu ); |
42 | connect(getMail, SIGNAL( activated() ), | 47 | connect(getMail, SIGNAL( activated() ), |
43 | SLOT( slotGetMail() ) ); | 48 | SLOT( slotGetMail() ) ); |
44 | 49 | ||
45 | composeMail = new QAction( tr( "Compose new mail" ), SmallIcon("composemail"), | 50 | composeMail = new QAction( tr( "Compose new mail" ), SmallIcon("composemail"), |
46 | 0, 0, this ); | 51 | 0, 0, this ); |
47 | composeMail->addTo( toolBar ); | 52 | composeMail->addTo( toolBar ); |
48 | composeMail->addTo( mailMenu ); | 53 | composeMail->addTo( mailMenu ); |
49 | 54 | ||
50 | sendQueued = new QAction( tr( "Send queued mails" ), SmallIcon("sendqueued") , | 55 | sendQueued = new QAction( tr( "Send queued mails" ), SmallIcon("sendqueued") , |
51 | 0, 0, this ); | 56 | 0, 0, this ); |
52 | sendQueued->addTo( toolBar ); | 57 | sendQueued->addTo( toolBar ); |
53 | sendQueued->addTo( mailMenu ); | 58 | sendQueued->addTo( mailMenu ); |
54 | 59 | ||
55 | /* | 60 | /* |
56 | syncFolders = new QAction( tr( "Sync mailfolders" ), ICON_SYNC, | 61 | syncFolders = new QAction( tr( "Sync mailfolders" ), ICON_SYNC, |
57 | 0, 0, this ); | 62 | 0, 0, this ); |
58 | syncFolders->addTo( toolBar ); | 63 | syncFolders->addTo( toolBar ); |
59 | syncFolders->addTo( mailMenu ); | 64 | syncFolders->addTo( mailMenu ); |
60 | */ | 65 | */ |
61 | 66 | ||
62 | showFolders = new QAction( tr( "Show/Hide folders" ), SmallIcon("showfolders") , | 67 | showFolders = new QAction( tr( "Show/Hide folders" ), SmallIcon("showfolders") , |
63 | 0, 0, this, 0, true ); | 68 | 0, 0, this, 0, true ); |
64 | showFolders->addTo( toolBar ); | 69 | showFolders->addTo( toolBar ); |
65 | showFolders->addTo( mailMenu ); | 70 | showFolders->addTo( mailMenu ); |
66 | showFolders->setOn( true ); | 71 | showFolders->setOn( true ); |
67 | connect(showFolders, SIGNAL( toggled(bool) ), | 72 | connect(showFolders, SIGNAL( toggled(bool) ), |
68 | SLOT( slotShowFolders(bool) ) ); | 73 | SLOT( slotShowFolders(bool) ) ); |
69 | 74 | ||
70 | /* | 75 | /* |
71 | searchMails = new QAction( tr( "Search mails" ), SmallIcon("find") ), | 76 | searchMails = new QAction( tr( "Search mails" ), SmallIcon("find") ), |
72 | 0, 0, this ); | 77 | 0, 0, this ); |
73 | searchMails->addTo( toolBar ); | 78 | searchMails->addTo( toolBar ); |
74 | searchMails->addTo( mailMenu ); | 79 | searchMails->addTo( mailMenu ); |
75 | */ | 80 | */ |
76 | 81 | ||
77 | deleteMails = new QAction(tr("Delete Mail"), SmallIcon("trash"), 0, 0, this); | 82 | deleteMails = new QAction(tr("Delete Mail"), SmallIcon("trash"), 0, 0, this); |
78 | deleteMails->addTo( toolBar ); | 83 | deleteMails->addTo( toolBar ); |
79 | deleteMails->addTo( mailMenu ); | 84 | deleteMails->addTo( mailMenu ); |
80 | connect( deleteMails, SIGNAL( activated() ), | 85 | connect( deleteMails, SIGNAL( activated() ), |
81 | SLOT( slotDeleteMail() ) ); | 86 | SLOT( slotDeleteMail() ) ); |
82 | 87 | ||
83 | editSettings = new QAction( tr( "Edit settings" ), SmallIcon("SettingsIcon") , | 88 | editSettings = new QAction( tr( "Edit settings" ), SmallIcon("SettingsIcon") , |
84 | 0, 0, this ); | 89 | 0, 0, this ); |
85 | editSettings->addTo( settingsMenu ); | 90 | editSettings->addTo( settingsMenu ); |
86 | connect( editSettings, SIGNAL( activated() ), | 91 | connect( editSettings, SIGNAL( activated() ), |
87 | SLOT( slotEditSettings() ) ); | 92 | SLOT( slotEditSettings() ) ); |
88 | editAccounts = new QAction( tr( "Configure accounts" ), SmallIcon("editaccounts") , | 93 | editAccounts = new QAction( tr( "Configure accounts" ), SmallIcon("editaccounts") , |
89 | 0, 0, this ); | 94 | 0, 0, this ); |
90 | editAccounts->addTo( settingsMenu ); | 95 | editAccounts->addTo( settingsMenu ); |
91 | 96 | ||
92 | //setCentralWidget( view ); | 97 | //setCentralWidget( view ); |
93 | 98 | ||
94 | QVBox* wrapperBox = new QVBox( this ); | 99 | QVBox* wrapperBox = new QVBox( this ); |
95 | setCentralWidget( wrapperBox ); | 100 | setCentralWidget( wrapperBox ); |
96 | 101 | ||
97 | // QWidget *view = new QWidget( wrapperBox ); | 102 | // QWidget *view = new QWidget( wrapperBox ); |
98 | KDGanttMinimizeSplitter* split = new KDGanttMinimizeSplitter( Qt::Horizontal, wrapperBox); | 103 | KDGanttMinimizeSplitter* split = new KDGanttMinimizeSplitter( Qt::Horizontal, wrapperBox); |
99 | split->setMinimizeDirection( KDGanttMinimizeSplitter::Left); | 104 | split->setMinimizeDirection( KDGanttMinimizeSplitter::Left); |
100 | //layout = new QBoxLayout ( split, QBoxLayout::LeftToRight ); | 105 | //layout = new QBoxLayout ( split, QBoxLayout::LeftToRight ); |
101 | 106 | ||
102 | folderView = new AccountView( split ); | 107 | folderView = new AccountView( split ); |
diff --git a/kmicromail/mainwindow.h b/kmicromail/mainwindow.h index ff0ff20..35b9c8c 100644 --- a/kmicromail/mainwindow.h +++ b/kmicromail/mainwindow.h | |||
@@ -1,66 +1,67 @@ | |||
1 | 1 | ||
2 | // CHANGED 2004-08-06 Lutz Rogowski | 2 | // CHANGED 2004-08-06 Lutz Rogowski |
3 | #ifndef MAINWINDOW_H | 3 | #ifndef MAINWINDOW_H |
4 | #define MAINWINDOW_H | 4 | #define MAINWINDOW_H |
5 | 5 | ||
6 | #include <qmainwindow.h> | 6 | #include <qmainwindow.h> |
7 | #include <qlistview.h> | 7 | #include <qlistview.h> |
8 | #include <qaction.h> | 8 | #include <qaction.h> |
9 | 9 | ||
10 | #include <qtoolbar.h> | 10 | #include <qtoolbar.h> |
11 | #ifdef DESKTOP_VERSION | 11 | #ifdef DESKTOP_VERSION |
12 | #include <qmenubar.h> | 12 | #include <qmenubar.h> |
13 | #else | 13 | #else |
14 | #include <qpe/qpemenubar.h> | 14 | #include <qpe/qpemenubar.h> |
15 | #endif | 15 | #endif |
16 | 16 | ||
17 | #include "accountview.h" | 17 | #include "accountview.h" |
18 | #include "statuswidget.h" | 18 | #include "statuswidget.h" |
19 | 19 | ||
20 | #include <libmailwrapper/mailtypes.h> | 20 | #include <libmailwrapper/mailtypes.h> |
21 | #include <opie2/osmartpointer.h> | 21 | #include <opie2/osmartpointer.h> |
22 | 22 | ||
23 | class RecMail; | 23 | class RecMail; |
24 | 24 | ||
25 | class MainWindow : public QMainWindow | 25 | class MainWindow : public QMainWindow |
26 | { | 26 | { |
27 | Q_OBJECT | 27 | Q_OBJECT |
28 | 28 | ||
29 | public: | 29 | public: |
30 | MainWindow( QWidget *parent = 0, const char *name = 0, WFlags flags = 0 ); | 30 | MainWindow( QWidget *parent = 0, const char *name = 0, WFlags flags = 0 ); |
31 | virtual ~MainWindow(); | 31 | virtual ~MainWindow(); |
32 | 32 | ||
33 | public slots: | 33 | public slots: |
34 | virtual void slotAdjustColumns(); | 34 | virtual void slotAdjustColumns(); |
35 | virtual void appMessage(const QCString &msg, const QByteArray &data); | 35 | virtual void appMessage(const QCString &msg, const QByteArray &data); |
36 | virtual void slotComposeMail(); | 36 | virtual void slotComposeMail(); |
37 | 37 | ||
38 | protected slots: | 38 | protected slots: |
39 | virtual void slotSendQueued(); | 39 | virtual void slotSendQueued(); |
40 | virtual void slotEditAccounts(); | 40 | virtual void slotEditAccounts(); |
41 | virtual void slotShowFolders( bool show ); | 41 | virtual void slotShowFolders( bool show ); |
42 | virtual void refreshMailView(const QValueList<RecMailP>&); | 42 | virtual void refreshMailView(const QValueList<RecMailP>&); |
43 | virtual void displayMail(); | 43 | virtual void displayMail(); |
44 | virtual void slotGetMail() = 0; | 44 | virtual void slotGetMail() = 0; |
45 | virtual void slotGetAllMail() = 0; | ||
45 | virtual void slotDeleteMail(); | 46 | virtual void slotDeleteMail(); |
46 | virtual void mailHold(int, QListViewItem *,const QPoint&,int); | 47 | virtual void mailHold(int, QListViewItem *,const QPoint&,int); |
47 | virtual void slotAdjustLayout(); | 48 | virtual void slotAdjustLayout(); |
48 | virtual void slotEditSettings(); | 49 | virtual void slotEditSettings(); |
49 | virtual void mailLeftClicked( QListViewItem * ); | 50 | virtual void mailLeftClicked( QListViewItem * ); |
50 | void showLicence(); | 51 | void showLicence(); |
51 | void showAbout(); | 52 | void showAbout(); |
52 | void showEtpanLicence(); | 53 | void showEtpanLicence(); |
53 | 54 | ||
54 | protected: | 55 | protected: |
55 | QToolBar *toolBar; | 56 | QToolBar *toolBar; |
56 | StatusWidget *statusWidget; | 57 | StatusWidget *statusWidget; |
57 | QPEMenuBar *menuBar; | 58 | QPEMenuBar *menuBar; |
58 | QPopupMenu *mailMenu, *settingsMenu; | 59 | QPopupMenu *mailMenu, *settingsMenu; |
59 | QAction *composeMail, *sendQueued, *showFolders, *searchMails, *deleteMails, | 60 | QAction *composeMail, *sendQueued, *showFolders, *searchMails, *deleteMails, |
60 | *editSettings, *editAccounts, *syncFolders; | 61 | *editSettings, *editAccounts, *syncFolders; |
61 | AccountView *folderView; | 62 | AccountView *folderView; |
62 | QListView *mailView; | 63 | QListView *mailView; |
63 | //QBoxLayout *layout; | 64 | //QBoxLayout *layout; |
64 | }; | 65 | }; |
65 | 66 | ||
66 | #endif | 67 | #endif |
diff --git a/kmicromail/nntpconfigui.ui b/kmicromail/nntpconfigui.ui index 25d564e..16ff6fc 100644 --- a/kmicromail/nntpconfigui.ui +++ b/kmicromail/nntpconfigui.ui | |||
@@ -1,95 +1,95 @@ | |||
1 | <!DOCTYPE UI><UI> | 1 | <!DOCTYPE UI><UI> |
2 | <class>NNTPconfigUI</class> | 2 | <class>NNTPconfigUI</class> |
3 | <widget> | 3 | <widget> |
4 | <class>QDialog</class> | 4 | <class>QDialog</class> |
5 | <property stdset="1"> | 5 | <property stdset="1"> |
6 | <name>name</name> | 6 | <name>name</name> |
7 | <cstring>NNTPconfigUI</cstring> | 7 | <cstring>NNTPconfigUI</cstring> |
8 | </property> | 8 | </property> |
9 | <property stdset="1"> | 9 | <property stdset="1"> |
10 | <name>geometry</name> | 10 | <name>geometry</name> |
11 | <rect> | 11 | <rect> |
12 | <x>0</x> | 12 | <x>0</x> |
13 | <y>0</y> | 13 | <y>0</y> |
14 | <width>409</width> | 14 | <width>268</width> |
15 | <height>520</height> | 15 | <height>347</height> |
16 | </rect> | 16 | </rect> |
17 | </property> | 17 | </property> |
18 | <property stdset="1"> | 18 | <property stdset="1"> |
19 | <name>caption</name> | 19 | <name>caption</name> |
20 | <string>Configure NNTP</string> | 20 | <string>Configure NNTP</string> |
21 | </property> | 21 | </property> |
22 | <property> | 22 | <property> |
23 | <name>layoutMargin</name> | 23 | <name>layoutMargin</name> |
24 | </property> | 24 | </property> |
25 | <property> | 25 | <property> |
26 | <name>layoutSpacing</name> | 26 | <name>layoutSpacing</name> |
27 | </property> | 27 | </property> |
28 | <vbox> | 28 | <vbox> |
29 | <property stdset="1"> | 29 | <property stdset="1"> |
30 | <name>margin</name> | 30 | <name>margin</name> |
31 | <number>3</number> | 31 | <number>2</number> |
32 | </property> | 32 | </property> |
33 | <property stdset="1"> | 33 | <property stdset="1"> |
34 | <name>spacing</name> | 34 | <name>spacing</name> |
35 | <number>3</number> | 35 | <number>3</number> |
36 | </property> | 36 | </property> |
37 | <widget> | 37 | <widget> |
38 | <class>QTabWidget</class> | 38 | <class>QTabWidget</class> |
39 | <property stdset="1"> | 39 | <property stdset="1"> |
40 | <name>name</name> | 40 | <name>name</name> |
41 | <cstring>TabWidget2</cstring> | 41 | <cstring>TabWidget2</cstring> |
42 | </property> | 42 | </property> |
43 | <property> | 43 | <property> |
44 | <name>layoutMargin</name> | 44 | <name>layoutMargin</name> |
45 | </property> | 45 | </property> |
46 | <property> | 46 | <property> |
47 | <name>layoutSpacing</name> | 47 | <name>layoutSpacing</name> |
48 | </property> | 48 | </property> |
49 | <widget> | 49 | <widget> |
50 | <class>QWidget</class> | 50 | <class>QWidget</class> |
51 | <property stdset="1"> | 51 | <property stdset="1"> |
52 | <name>name</name> | 52 | <name>name</name> |
53 | <cstring>tab</cstring> | 53 | <cstring>tab</cstring> |
54 | </property> | 54 | </property> |
55 | <attribute> | 55 | <attribute> |
56 | <name>title</name> | 56 | <name>title</name> |
57 | <string>Account</string> | 57 | <string>Account</string> |
58 | </attribute> | 58 | </attribute> |
59 | <grid> | 59 | <grid> |
60 | <property stdset="1"> | 60 | <property stdset="1"> |
61 | <name>margin</name> | 61 | <name>margin</name> |
62 | <number>3</number> | 62 | <number>3</number> |
63 | </property> | 63 | </property> |
64 | <property stdset="1"> | 64 | <property stdset="1"> |
65 | <name>spacing</name> | 65 | <name>spacing</name> |
66 | <number>3</number> | 66 | <number>3</number> |
67 | </property> | 67 | </property> |
68 | <widget row="2" column="1" > | 68 | <widget row="2" column="1" > |
69 | <class>QLineEdit</class> | 69 | <class>QLineEdit</class> |
70 | <property stdset="1"> | 70 | <property stdset="1"> |
71 | <name>name</name> | 71 | <name>name</name> |
72 | <cstring>serverLine</cstring> | 72 | <cstring>serverLine</cstring> |
73 | </property> | 73 | </property> |
74 | </widget> | 74 | </widget> |
75 | <widget row="3" column="0" > | 75 | <widget row="3" column="0" > |
76 | <class>QLabel</class> | 76 | <class>QLabel</class> |
77 | <property stdset="1"> | 77 | <property stdset="1"> |
78 | <name>name</name> | 78 | <name>name</name> |
79 | <cstring>portLabel</cstring> | 79 | <cstring>portLabel</cstring> |
80 | </property> | 80 | </property> |
81 | <property stdset="1"> | 81 | <property stdset="1"> |
82 | <name>text</name> | 82 | <name>text</name> |
83 | <string>Port</string> | 83 | <string>Port</string> |
84 | </property> | 84 | </property> |
85 | </widget> | 85 | </widget> |
86 | <widget row="3" column="1" > | 86 | <widget row="3" column="1" > |
87 | <class>QLineEdit</class> | 87 | <class>QLineEdit</class> |
88 | <property stdset="1"> | 88 | <property stdset="1"> |
89 | <name>name</name> | 89 | <name>name</name> |
90 | <cstring>portLine</cstring> | 90 | <cstring>portLine</cstring> |
91 | </property> | 91 | </property> |
92 | </widget> | 92 | </widget> |
93 | <widget row="0" column="1" > | 93 | <widget row="0" column="1" > |
94 | <class>QLineEdit</class> | 94 | <class>QLineEdit</class> |
95 | <property stdset="1"> | 95 | <property stdset="1"> |
@@ -228,117 +228,183 @@ | |||
228 | <property stdset="1"> | 228 | <property stdset="1"> |
229 | <name>sizeType</name> | 229 | <name>sizeType</name> |
230 | <enum>Expanding</enum> | 230 | <enum>Expanding</enum> |
231 | </property> | 231 | </property> |
232 | <property> | 232 | <property> |
233 | <name>sizeHint</name> | 233 | <name>sizeHint</name> |
234 | <size> | 234 | <size> |
235 | <width>20</width> | 235 | <width>20</width> |
236 | <height>20</height> | 236 | <height>20</height> |
237 | </size> | 237 | </size> |
238 | </property> | 238 | </property> |
239 | </spacer> | 239 | </spacer> |
240 | <widget row="6" column="1" > | 240 | <widget row="6" column="1" > |
241 | <class>QCheckBox</class> | 241 | <class>QCheckBox</class> |
242 | <property stdset="1"> | 242 | <property stdset="1"> |
243 | <name>name</name> | 243 | <name>name</name> |
244 | <cstring>loginBox</cstring> | 244 | <cstring>loginBox</cstring> |
245 | </property> | 245 | </property> |
246 | <property stdset="1"> | 246 | <property stdset="1"> |
247 | <name>text</name> | 247 | <name>text</name> |
248 | <string>Use Login</string> | 248 | <string>Use Login</string> |
249 | </property> | 249 | </property> |
250 | </widget> | 250 | </widget> |
251 | <widget row="7" column="1" > | 251 | <widget row="7" column="1" > |
252 | <class>QLineEdit</class> | 252 | <class>QLineEdit</class> |
253 | <property stdset="1"> | 253 | <property stdset="1"> |
254 | <name>name</name> | 254 | <name>name</name> |
255 | <cstring>userLine</cstring> | 255 | <cstring>userLine</cstring> |
256 | </property> | 256 | </property> |
257 | <property stdset="1"> | 257 | <property stdset="1"> |
258 | <name>enabled</name> | 258 | <name>enabled</name> |
259 | <bool>false</bool> | 259 | <bool>false</bool> |
260 | </property> | 260 | </property> |
261 | </widget> | 261 | </widget> |
262 | <widget row="8" column="1" > | 262 | <widget row="8" column="1" > |
263 | <class>QLineEdit</class> | 263 | <class>QLineEdit</class> |
264 | <property stdset="1"> | 264 | <property stdset="1"> |
265 | <name>name</name> | 265 | <name>name</name> |
266 | <cstring>passLine</cstring> | 266 | <cstring>passLine</cstring> |
267 | </property> | 267 | </property> |
268 | <property stdset="1"> | 268 | <property stdset="1"> |
269 | <name>enabled</name> | 269 | <name>enabled</name> |
270 | <bool>false</bool> | 270 | <bool>false</bool> |
271 | </property> | 271 | </property> |
272 | <property stdset="1"> | 272 | <property stdset="1"> |
273 | <name>echoMode</name> | 273 | <name>echoMode</name> |
274 | <enum>Password</enum> | 274 | <enum>Password</enum> |
275 | </property> | 275 | </property> |
276 | </widget> | 276 | </widget> |
277 | </grid> | 277 | </grid> |
278 | </widget> | 278 | </widget> |
279 | <widget> | 279 | <widget> |
280 | <class>QWidget</class> | 280 | <class>QWidget</class> |
281 | <property stdset="1"> | 281 | <property stdset="1"> |
282 | <name>name</name> | 282 | <name>name</name> |
283 | <cstring>tab</cstring> | 283 | <cstring>tab</cstring> |
284 | </property> | 284 | </property> |
285 | <attribute> | 285 | <attribute> |
286 | <name>title</name> | 286 | <name>title</name> |
287 | <string>Groups</string> | 287 | <string>Groups</string> |
288 | </attribute> | 288 | </attribute> |
289 | <vbox> | 289 | <vbox> |
290 | <property stdset="1"> | 290 | <property stdset="1"> |
291 | <name>margin</name> | 291 | <name>margin</name> |
292 | <number>3</number> | 292 | <number>2</number> |
293 | </property> | 293 | </property> |
294 | <property stdset="1"> | 294 | <property stdset="1"> |
295 | <name>spacing</name> | 295 | <name>spacing</name> |
296 | <number>3</number> | 296 | <number>3</number> |
297 | </property> | 297 | </property> |
298 | <widget> | 298 | <widget> |
299 | <class>QListView</class> | 299 | <class>QLayoutWidget</class> |
300 | <column> | ||
301 | <property> | ||
302 | <name>text</name> | ||
303 | <string>Newsgroup</string> | ||
304 | </property> | ||
305 | <property> | ||
306 | <name>clickable</name> | ||
307 | <bool>true</bool> | ||
308 | </property> | ||
309 | <property> | ||
310 | <name>resizeable</name> | ||
311 | <bool>true</bool> | ||
312 | </property> | ||
313 | </column> | ||
314 | <property stdset="1"> | ||
315 | <name>name</name> | ||
316 | <cstring>ListViewGroups</cstring> | ||
317 | </property> | ||
318 | </widget> | ||
319 | <widget> | ||
320 | <class>QPushButton</class> | ||
321 | <property stdset="1"> | 300 | <property stdset="1"> |
322 | <name>name</name> | 301 | <name>name</name> |
323 | <cstring>GetNGButton</cstring> | 302 | <cstring>Layout10</cstring> |
324 | </property> | 303 | </property> |
325 | <property stdset="1"> | 304 | <property> |
326 | <name>text</name> | 305 | <name>layoutSpacing</name> |
327 | <string>Get newsgroup list from server</string> | ||
328 | </property> | 306 | </property> |
307 | <vbox> | ||
308 | <property stdset="1"> | ||
309 | <name>margin</name> | ||
310 | <number>0</number> | ||
311 | </property> | ||
312 | <property stdset="1"> | ||
313 | <name>spacing</name> | ||
314 | <number>3</number> | ||
315 | </property> | ||
316 | <widget> | ||
317 | <class>QListView</class> | ||
318 | <column> | ||
319 | <property> | ||
320 | <name>text</name> | ||
321 | <string>Newsgroup</string> | ||
322 | </property> | ||
323 | <property> | ||
324 | <name>clickable</name> | ||
325 | <bool>true</bool> | ||
326 | </property> | ||
327 | <property> | ||
328 | <name>resizeable</name> | ||
329 | <bool>true</bool> | ||
330 | </property> | ||
331 | </column> | ||
332 | <property stdset="1"> | ||
333 | <name>name</name> | ||
334 | <cstring>ListViewGroups</cstring> | ||
335 | </property> | ||
336 | </widget> | ||
337 | <widget> | ||
338 | <class>QPushButton</class> | ||
339 | <property stdset="1"> | ||
340 | <name>name</name> | ||
341 | <cstring>GetNGButton</cstring> | ||
342 | </property> | ||
343 | <property stdset="1"> | ||
344 | <name>text</name> | ||
345 | <string>Get newsgroup list from server</string> | ||
346 | </property> | ||
347 | </widget> | ||
348 | <widget> | ||
349 | <class>QLayoutWidget</class> | ||
350 | <property stdset="1"> | ||
351 | <name>name</name> | ||
352 | <cstring>Layout9</cstring> | ||
353 | </property> | ||
354 | <hbox> | ||
355 | <property stdset="1"> | ||
356 | <name>margin</name> | ||
357 | <number>0</number> | ||
358 | </property> | ||
359 | <property stdset="1"> | ||
360 | <name>spacing</name> | ||
361 | <number>6</number> | ||
362 | </property> | ||
363 | <widget> | ||
364 | <class>QPushButton</class> | ||
365 | <property stdset="1"> | ||
366 | <name>name</name> | ||
367 | <cstring>FilterButton</cstring> | ||
368 | </property> | ||
369 | <property stdset="1"> | ||
370 | <name>text</name> | ||
371 | <string>Filter:</string> | ||
372 | </property> | ||
373 | </widget> | ||
374 | <widget> | ||
375 | <class>QLineEdit</class> | ||
376 | <property stdset="1"> | ||
377 | <name>name</name> | ||
378 | <cstring>GroupFilter</cstring> | ||
379 | </property> | ||
380 | </widget> | ||
381 | <widget> | ||
382 | <class>QPushButton</class> | ||
383 | <property stdset="1"> | ||
384 | <name>name</name> | ||
385 | <cstring>ShowSubcribed</cstring> | ||
386 | </property> | ||
387 | <property stdset="1"> | ||
388 | <name>text</name> | ||
389 | <string>Show subscribed</string> | ||
390 | </property> | ||
391 | </widget> | ||
392 | </hbox> | ||
393 | </widget> | ||
394 | </vbox> | ||
329 | </widget> | 395 | </widget> |
330 | </vbox> | 396 | </vbox> |
331 | </widget> | 397 | </widget> |
332 | </widget> | 398 | </widget> |
333 | </vbox> | 399 | </vbox> |
334 | </widget> | 400 | </widget> |
335 | <tabstops> | 401 | <tabstops> |
336 | <tabstop>accountLine</tabstop> | 402 | <tabstop>accountLine</tabstop> |
337 | <tabstop>serverLine</tabstop> | 403 | <tabstop>serverLine</tabstop> |
338 | <tabstop>portLine</tabstop> | 404 | <tabstop>portLine</tabstop> |
339 | <tabstop>sslBox</tabstop> | 405 | <tabstop>sslBox</tabstop> |
340 | <tabstop>loginBox</tabstop> | 406 | <tabstop>loginBox</tabstop> |
341 | <tabstop>userLine</tabstop> | 407 | <tabstop>userLine</tabstop> |
342 | <tabstop>passLine</tabstop> | 408 | <tabstop>passLine</tabstop> |
343 | </tabstops> | 409 | </tabstops> |
344 | </UI> | 410 | </UI> |
diff --git a/kmicromail/opiemail.cpp b/kmicromail/opiemail.cpp index 4e7c6be..7ccfb65 100644 --- a/kmicromail/opiemail.cpp +++ b/kmicromail/opiemail.cpp | |||
@@ -192,128 +192,136 @@ void OpieMail::slotSendQueued() | |||
192 | smtp = selsmtp.selected_smtp(); | 192 | smtp = selsmtp.selected_smtp(); |
193 | } | 193 | } |
194 | } | 194 | } |
195 | if (smtp) | 195 | if (smtp) |
196 | { | 196 | { |
197 | SMTPwrapper * wrap = new SMTPwrapper(smtp); | 197 | SMTPwrapper * wrap = new SMTPwrapper(smtp); |
198 | if ( wrap->flushOutbox() ) | 198 | if ( wrap->flushOutbox() ) |
199 | { | 199 | { |
200 | QMessageBox::information(0,tr("Info"),tr("Mail queue flushed")); | 200 | QMessageBox::information(0,tr("Info"),tr("Mail queue flushed")); |
201 | } | 201 | } |
202 | delete wrap; | 202 | delete wrap; |
203 | } | 203 | } |
204 | } | 204 | } |
205 | 205 | ||
206 | void OpieMail::slotSearchMails() | 206 | void OpieMail::slotSearchMails() |
207 | { | 207 | { |
208 | qDebug("OpieMail::slotSearchMails():not implemented "); | 208 | qDebug("OpieMail::slotSearchMails():not implemented "); |
209 | } | 209 | } |
210 | 210 | ||
211 | void OpieMail::slotEditSettings() | 211 | void OpieMail::slotEditSettings() |
212 | { | 212 | { |
213 | #if 0 | 213 | #if 0 |
214 | SettingsDialog settingsDialog( this, 0, true, WStyle_ContextHelp ); | 214 | SettingsDialog settingsDialog( this, 0, true, WStyle_ContextHelp ); |
215 | settingsDialog.showMaximized(); | 215 | settingsDialog.showMaximized(); |
216 | settingsDialog.exec(); | 216 | settingsDialog.exec(); |
217 | #endif | 217 | #endif |
218 | KOPrefsDialog settingsDialog( this, "koprefs", true ); | 218 | KOPrefsDialog settingsDialog( this, "koprefs", true ); |
219 | settingsDialog.showMaximized(); | 219 | settingsDialog.showMaximized(); |
220 | settingsDialog.exec(); | 220 | settingsDialog.exec(); |
221 | } | 221 | } |
222 | 222 | ||
223 | void OpieMail::slotEditAccounts() | 223 | void OpieMail::slotEditAccounts() |
224 | { | 224 | { |
225 | EditAccounts eaDialog( settings, this, 0, true ); | 225 | EditAccounts eaDialog( settings, this, 0, true ); |
226 | eaDialog.slotAdjustColumns(); | 226 | eaDialog.slotAdjustColumns(); |
227 | eaDialog.showMaximized(); | 227 | eaDialog.showMaximized(); |
228 | eaDialog.exec(); | 228 | eaDialog.exec(); |
229 | if ( settings ) delete settings; | 229 | if ( settings ) delete settings; |
230 | settings = new Settings(); | 230 | settings = new Settings(); |
231 | 231 | ||
232 | folderView->populate( settings->getAccounts() ); | 232 | folderView->populate( settings->getAccounts() ); |
233 | } | 233 | } |
234 | 234 | ||
235 | void OpieMail::displayMail() | 235 | void OpieMail::displayMail() |
236 | { | 236 | { |
237 | QListViewItem*item = mailView->currentItem(); | 237 | QListViewItem*item = mailView->currentItem(); |
238 | if (!item) return; | 238 | if (!item) return; |
239 | RecMailP mail = ((MailListViewItem*)item)->data(); | 239 | RecMailP mail = ((MailListViewItem*)item)->data(); |
240 | RecBodyP body = folderView->fetchBody(mail); | 240 | RecBodyP body = folderView->fetchBody(mail); |
241 | ViewMail readMail( this,"", Qt::WType_Modal ); | 241 | ViewMail readMail( this,"", Qt::WType_Modal ); |
242 | readMail.setBody( body ); | 242 | readMail.setBody( body ); |
243 | readMail.setMail( mail ); | 243 | readMail.setMail( mail ); |
244 | readMail.showMaximized(); | 244 | readMail.showMaximized(); |
245 | readMail.exec(); | 245 | readMail.exec(); |
246 | 246 | ||
247 | if ( readMail.deleted ) | 247 | if ( readMail.deleted ) |
248 | { | 248 | { |
249 | folderView->refreshCurrent(); | 249 | folderView->refreshCurrent(); |
250 | } | 250 | } |
251 | else | 251 | else |
252 | { | 252 | { |
253 | ( (MailListViewItem*)item )->setPixmap( 0, QPixmap() ); | 253 | ( (MailListViewItem*)item )->setPixmap( 0, QPixmap() ); |
254 | } | 254 | } |
255 | } | 255 | } |
256 | void OpieMail::slotGetAllMail() | ||
257 | { | ||
258 | QListViewItem * item = folderView->firstChild(); | ||
259 | while ( item ){ | ||
260 | ((AccountViewItem *)item)->contextMenuSelected( 101 ); | ||
261 | item = item->nextSibling (); | ||
262 | } | ||
263 | } | ||
256 | void OpieMail::slotGetMail() | 264 | void OpieMail::slotGetMail() |
257 | { | 265 | { |
258 | QListViewItem * item = folderView->currentItem(); | 266 | QListViewItem * item = folderView->currentItem(); |
259 | if ( ! item ) return; | 267 | if ( ! item ) return; |
260 | while ( item->parent () ) | 268 | while ( item->parent () ) |
261 | item = item->parent (); | 269 | item = item->parent (); |
262 | ((AccountViewItem *)item)->contextMenuSelected( 101 ); | 270 | ((AccountViewItem *)item)->contextMenuSelected( 101 ); |
263 | } | 271 | } |
264 | void OpieMail::slotDeleteMail() | 272 | void OpieMail::slotDeleteMail() |
265 | { | 273 | { |
266 | if (!mailView->currentItem()) return; | 274 | if (!mailView->currentItem()) return; |
267 | RecMailP mail = ((MailListViewItem*)mailView->currentItem() )->data(); | 275 | RecMailP mail = ((MailListViewItem*)mailView->currentItem() )->data(); |
268 | 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 ) | 276 | 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 ) |
269 | { | 277 | { |
270 | mail->Wrapper()->deleteMail( mail ); | 278 | mail->Wrapper()->deleteMail( mail ); |
271 | folderView->refreshCurrent(); | 279 | folderView->refreshCurrent(); |
272 | } | 280 | } |
273 | } | 281 | } |
274 | void OpieMail::slotDeleteAllMail() | 282 | void OpieMail::slotDeleteAllMail() |
275 | { | 283 | { |
276 | 284 | ||
277 | QValueList<RecMailP> t; | 285 | QValueList<RecMailP> t; |
278 | if ( QMessageBox::warning(this, tr("Delete All Mails"), tr("Do you really want to delete\nall selected mails?" ) , QMessageBox::Yes, QMessageBox::No ) == QMessageBox::Yes ) | 286 | if ( QMessageBox::warning(this, tr("Delete All Mails"), tr("Do you really want to delete\nall selected mails?" ) , QMessageBox::Yes, QMessageBox::No ) == QMessageBox::Yes ) |
279 | { | 287 | { |
280 | MailListViewItem* item = (MailListViewItem*)mailView->firstChild (); | 288 | MailListViewItem* item = (MailListViewItem*)mailView->firstChild (); |
281 | while ( item ) { | 289 | while ( item ) { |
282 | if ( item->isSelected() ) { | 290 | if ( item->isSelected() ) { |
283 | t.append( item->data() ); | 291 | t.append( item->data() ); |
284 | } | 292 | } |
285 | item = (MailListViewItem*)item->nextSibling(); | 293 | item = (MailListViewItem*)item->nextSibling(); |
286 | } | 294 | } |
287 | } | 295 | } |
288 | else | 296 | else |
289 | return; | 297 | return; |
290 | if ( t.count() == 0 ) | 298 | if ( t.count() == 0 ) |
291 | return; | 299 | return; |
292 | RecMailP mail = t.first(); | 300 | RecMailP mail = t.first(); |
293 | mail->Wrapper()->deleteMailList(t); | 301 | mail->Wrapper()->deleteMailList(t); |
294 | folderView->refreshCurrent(); | 302 | folderView->refreshCurrent(); |
295 | 303 | ||
296 | 304 | ||
297 | } | 305 | } |
298 | void OpieMail::clearSelection() | 306 | void OpieMail::clearSelection() |
299 | { | 307 | { |
300 | mailView->clearSelection(); | 308 | mailView->clearSelection(); |
301 | 309 | ||
302 | } | 310 | } |
303 | 311 | ||
304 | void OpieMail::mailHold(int button, QListViewItem *item,const QPoint&,int ) | 312 | void OpieMail::mailHold(int button, QListViewItem *item,const QPoint&,int ) |
305 | { | 313 | { |
306 | if (!mailView->currentItem()) return; | 314 | if (!mailView->currentItem()) return; |
307 | MAILLIB::ATYPE mailtype = ((MailListViewItem*)mailView->currentItem() )->wrapperType(); | 315 | MAILLIB::ATYPE mailtype = ((MailListViewItem*)mailView->currentItem() )->wrapperType(); |
308 | /* just the RIGHT button - or hold on pda */ | 316 | /* just the RIGHT button - or hold on pda */ |
309 | if (button!=2) {return;} | 317 | if (button!=2) {return;} |
310 | if (!item) return; | 318 | if (!item) return; |
311 | QPopupMenu *m = new QPopupMenu(0); | 319 | QPopupMenu *m = new QPopupMenu(0); |
312 | if (m) | 320 | if (m) |
313 | { | 321 | { |
314 | if (mailtype==MAILLIB::A_NNTP) { | 322 | if (mailtype==MAILLIB::A_NNTP) { |
315 | m->insertItem(tr("Read this posting"),this,SLOT(displayMail())); | 323 | m->insertItem(tr("Read this posting"),this,SLOT(displayMail())); |
316 | // m->insertItem(tr("Copy this posting"),this,SLOT(slotMoveCopyMail())); | 324 | // m->insertItem(tr("Copy this posting"),this,SLOT(slotMoveCopyMail())); |
317 | } else { | 325 | } else { |
318 | if (folderView->currentisDraft()) { | 326 | if (folderView->currentisDraft()) { |
319 | m->insertItem(tr("Edit this mail"),this,SLOT(reEditMail())); | 327 | m->insertItem(tr("Edit this mail"),this,SLOT(reEditMail())); |
diff --git a/kmicromail/opiemail.h b/kmicromail/opiemail.h index 47264e4..9de95f8 100644 --- a/kmicromail/opiemail.h +++ b/kmicromail/opiemail.h | |||
@@ -1,54 +1,55 @@ | |||
1 | // CHANGED 2004-09-31 Lutz Rogowski | 1 | // CHANGED 2004-09-31 Lutz Rogowski |
2 | #ifndef OPIEMAIL_H | 2 | #ifndef OPIEMAIL_H |
3 | #define OPIEMAIL_H | 3 | #define OPIEMAIL_H |
4 | 4 | ||
5 | #include "mainwindow.h" | 5 | #include "mainwindow.h" |
6 | #include <libmailwrapper/settings.h> | 6 | #include <libmailwrapper/settings.h> |
7 | 7 | ||
8 | #include <opie2/osmartpointer.h> | 8 | #include <opie2/osmartpointer.h> |
9 | #include <libmailwrapper/mailtypes.h> | 9 | #include <libmailwrapper/mailtypes.h> |
10 | 10 | ||
11 | class OpieMail : public MainWindow | 11 | class OpieMail : public MainWindow |
12 | { | 12 | { |
13 | Q_OBJECT | 13 | Q_OBJECT |
14 | 14 | ||
15 | public: | 15 | public: |
16 | OpieMail( QWidget *parent = 0, const char *name = 0 ); | 16 | OpieMail( QWidget *parent = 0, const char *name = 0 ); |
17 | virtual ~OpieMail(); | 17 | virtual ~OpieMail(); |
18 | static QString appName() { return QString::fromLatin1("kopiemail"); } | 18 | static QString appName() { return QString::fromLatin1("kopiemail"); } |
19 | 19 | ||
20 | public slots: | 20 | public slots: |
21 | virtual void slotwriteMail(const QString&name,const QString&email); | 21 | virtual void slotwriteMail(const QString&name,const QString&email); |
22 | virtual void slotwriteMail2(const QString&nameemail); | 22 | virtual void slotwriteMail2(const QString&nameemail); |
23 | virtual void slotComposeMail(); | 23 | virtual void slotComposeMail(); |
24 | virtual void slotExtAppHandler(); | 24 | virtual void slotExtAppHandler(); |
25 | virtual void appMessage(const QCString &msg, const QByteArray &data); | 25 | virtual void appMessage(const QCString &msg, const QByteArray &data); |
26 | virtual void message(const QCString &msg, const QByteArray &data); | 26 | virtual void message(const QCString &msg, const QByteArray &data); |
27 | protected slots: | 27 | protected slots: |
28 | virtual void slotSendQueued(); | 28 | virtual void slotSendQueued(); |
29 | virtual void slotSearchMails(); | 29 | virtual void slotSearchMails(); |
30 | virtual void slotEditSettings(); | 30 | virtual void slotEditSettings(); |
31 | virtual void slotEditAccounts(); | 31 | virtual void slotEditAccounts(); |
32 | virtual void displayMail(); | 32 | virtual void displayMail(); |
33 | virtual void slotDeleteMail(); | 33 | virtual void slotDeleteMail(); |
34 | virtual void slotGetMail(); | 34 | virtual void slotGetMail(); |
35 | virtual void slotGetAllMail(); | ||
35 | virtual void slotDeleteAllMail(); | 36 | virtual void slotDeleteAllMail(); |
36 | virtual void mailHold(int, QListViewItem *,const QPoint&,int); | 37 | virtual void mailHold(int, QListViewItem *,const QPoint&,int); |
37 | virtual void slotShowFolders( bool show ); | 38 | virtual void slotShowFolders( bool show ); |
38 | virtual void refreshMailView(const QValueList<RecMailP>&); | 39 | virtual void refreshMailView(const QValueList<RecMailP>&); |
39 | virtual void mailLeftClicked( QListViewItem * ); | 40 | virtual void mailLeftClicked( QListViewItem * ); |
40 | virtual void slotMoveCopyMail(); | 41 | virtual void slotMoveCopyMail(); |
41 | virtual void slotMoveCopyAllMail(); | 42 | virtual void slotMoveCopyAllMail(); |
42 | virtual void reEditMail(); | 43 | virtual void reEditMail(); |
43 | void clearSelection(); | 44 | void clearSelection(); |
44 | 45 | ||
45 | private: | 46 | private: |
46 | QString mPendingEmail; | 47 | QString mPendingEmail; |
47 | QString mPendingName; | 48 | QString mPendingName; |
48 | QByteArray mPendingData; | 49 | QByteArray mPendingData; |
49 | QCString mPendingMessage; | 50 | QCString mPendingMessage; |
50 | Settings *settings; | 51 | Settings *settings; |
51 | 52 | ||
52 | }; | 53 | }; |
53 | 54 | ||
54 | #endif | 55 | #endif |