summaryrefslogtreecommitdiff
authoralwin <alwin>2004-03-06 12:36:55 (UTC)
committer alwin <alwin>2004-03-06 12:36:55 (UTC)
commita66fd5afde517e9a61e74fc17df617297f134c96 (patch) (unidiff)
tree7bb9819c087516f6b0f3399bdec6d5ce225201e5
parent5b49d47174925c1e2415641b77269b753688f5f1 (diff)
downloadopie-a66fd5afde517e9a61e74fc17df617297f134c96.zip
opie-a66fd5afde517e9a61e74fc17df617297f134c96.tar.gz
opie-a66fd5afde517e9a61e74fc17df617297f134c96.tar.bz2
standalone dlg for (un-)subscribing newsgroups.
May be integrated into the standard nntp-settings-dialog, too.
Diffstat (more/less context) (ignore whitespace changes)
-rw-r--r--noncore/net/mail/.cvsignore3
-rw-r--r--noncore/net/mail/accountitem.cpp15
-rw-r--r--noncore/net/mail/accountitem.h1
-rw-r--r--noncore/net/mail/mail.pro11
-rw-r--r--noncore/net/mail/nntpgroups.cpp57
-rw-r--r--noncore/net/mail/nntpgroups.h33
-rw-r--r--noncore/net/mail/nntpgroupsdlg.cpp29
-rw-r--r--noncore/net/mail/nntpgroupsdlg.h24
-rw-r--r--noncore/net/mail/nntpgroupsui.ui88
9 files changed, 256 insertions, 5 deletions
diff --git a/noncore/net/mail/.cvsignore b/noncore/net/mail/.cvsignore
index 4957719..3819f80 100644
--- a/noncore/net/mail/.cvsignore
+++ b/noncore/net/mail/.cvsignore
@@ -1,31 +1,32 @@
1.moc 1.moc
2Makefile 2Makefile
3addresspickerui.cpp 3addresspickerui.cpp
4addresspickerui.h 4addresspickerui.h
5composemailui.cpp 5composemailui.cpp
6composemailui.h 6composemailui.h
7editaccountsui.cpp 7editaccountsui.cpp
8editaccountsui.h 8editaccountsui.h
9imapconfigui.cpp 9imapconfigui.cpp
10imapconfigui.h 10imapconfigui.h
11logindialogui.cpp 11logindialogui.cpp
12logindialogui.h 12logindialogui.h
13nntpconfigui.cpp 13nntpconfigui.cpp
14nntpconfigui.h 14nntpconfigui.h
15pop3configui.cpp 15pop3configui.cpp
16pop3configui.h 16pop3configui.h
17selectmailtypeui.cpp 17selectmailtypeui.cpp
18selectmailtypeui.h 18selectmailtypeui.h
19smtpconfigui.cpp 19smtpconfigui.cpp
20smtpconfigui.h 20smtpconfigui.h
21settingsdialogui.cpp 21settingsdialogui.cpp
22settingsdialogui.h 22settingsdialogui.h
23statuswidgetui.cpp 23statuswidgetui.cpp
24statuswidgetui.h 24statuswidgetui.h
25newmaildirui.cpp 25newmaildirui.cpp
26newmaildirui.h 26newmaildirui.h
27sendmailprogressui.cpp 27sendmailprogressui.cpp
28sendmailprogressui.h 28sendmailprogressui.h
29selectstoreui.cpp 29selectstoreui.cpp
30selectstoreui.h 30selectstoreui.h
31 31nntpgroupsui.cpp
32nntpgroupsui.h
diff --git a/noncore/net/mail/accountitem.cpp b/noncore/net/mail/accountitem.cpp
index e925d8d..0d636a4 100644
--- a/noncore/net/mail/accountitem.cpp
+++ b/noncore/net/mail/accountitem.cpp
@@ -1,52 +1,53 @@
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 "defines.h" 6#include "defines.h"
6 7
7/* OPIE */ 8/* OPIE */
8#include <libmailwrapper/mailtypes.h> 9#include <libmailwrapper/mailtypes.h>
9#include <libmailwrapper/abstractmail.h> 10#include <libmailwrapper/abstractmail.h>
10#include <libmailwrapper/mailwrapper.h> 11#include <libmailwrapper/mailwrapper.h>
11#include <qpe/qpeapplication.h> 12#include <qpe/qpeapplication.h>
12 13
13/* QT */ 14/* QT */
14#include <qpopupmenu.h> 15#include <qpopupmenu.h>
15#include <qmessagebox.h> 16#include <qmessagebox.h>
16 17
17#define SETPIX(x) if (!account->getOffline()) {setPixmap( 0,x);} else {setPixmap( 0, PIXMAP_OFFLINE );} 18#define SETPIX(x) if (!account->getOffline()) {setPixmap( 0,x);} else {setPixmap( 0, PIXMAP_OFFLINE );}
18/** 19/**
19 * POP3 Account stuff 20 * POP3 Account stuff
20 */ 21 */
21POP3viewItem::POP3viewItem( POP3account *a, AccountView *parent ) 22POP3viewItem::POP3viewItem( POP3account *a, AccountView *parent )
22 : AccountViewItem( parent ) 23 : AccountViewItem( parent )
23{ 24{
24 account = a; 25 account = a;
25 wrapper = AbstractMail::getWrapper( account ); 26 wrapper = AbstractMail::getWrapper( account );
26 SETPIX(PIXMAP_POP3FOLDER); 27 SETPIX(PIXMAP_POP3FOLDER);
27#if 0 28#if 0
28 if (!account->getOffline()) 29 if (!account->getOffline())
29 { 30 {
30 setPixmap( 0, ); 31 setPixmap( 0, );
31 } 32 }
32 else 33 else
33 { 34 {
34 setPixmap( 0, PIXMAP_OFFLINE ); 35 setPixmap( 0, PIXMAP_OFFLINE );
35 } 36 }
36#endif 37#endif
37 setText( 0, account->getAccountName() ); 38 setText( 0, account->getAccountName() );
38 setOpen( true ); 39 setOpen( true );
39} 40}
40 41
41POP3viewItem::~POP3viewItem() 42POP3viewItem::~POP3viewItem()
42{ 43{
43 delete wrapper; 44 delete wrapper;
44} 45}
45 46
46AbstractMail *POP3viewItem::getWrapper() 47AbstractMail *POP3viewItem::getWrapper()
47{ 48{
48 return wrapper; 49 return wrapper;
49} 50}
50 51
51void POP3viewItem::refresh( QList<RecMail> & ) 52void POP3viewItem::refresh( QList<RecMail> & )
52{ 53{
@@ -239,180 +240,192 @@ NNTPviewItem::~NNTPviewItem()
239AbstractMail *NNTPviewItem::getWrapper() 240AbstractMail *NNTPviewItem::getWrapper()
240{ 241{
241 return wrapper; 242 return wrapper;
242} 243}
243 244
244void NNTPviewItem::refresh( QList<RecMail> & ) 245void NNTPviewItem::refresh( QList<RecMail> & )
245{ 246{
246 refresh(); 247 refresh();
247} 248}
248 249
249void NNTPviewItem::refresh() 250void NNTPviewItem::refresh()
250{ 251{
251 if (account->getOffline()) return; 252 if (account->getOffline()) return;
252 QList<Folder> *folders = wrapper->listFolders(); 253 QList<Folder> *folders = wrapper->listFolders();
253 QListViewItem *child = firstChild(); 254 QListViewItem *child = firstChild();
254 while ( child ) 255 while ( child )
255 { 256 {
256 QListViewItem *tmp = child; 257 QListViewItem *tmp = child;
257 child = child->nextSibling(); 258 child = child->nextSibling();
258 delete tmp; 259 delete tmp;
259 } 260 }
260 Folder *it; 261 Folder *it;
261 QListViewItem*item = 0; 262 QListViewItem*item = 0;
262 for ( it = folders->first(); it; it = folders->next() ) 263 for ( it = folders->first(); it; it = folders->next() )
263 { 264 {
264 item = new NNTPfolderItem( it, this , item ); 265 item = new NNTPfolderItem( it, this , item );
265 item->setSelectable(it->may_select()); 266 item->setSelectable(it->may_select());
266 } 267 }
267 // !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! 268 // !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
268 folders->setAutoDelete(false); 269 folders->setAutoDelete(false);
269 delete folders; 270 delete folders;
270} 271}
271 272
272RecBody NNTPviewItem::fetchBody( const RecMail &mail ) 273RecBody NNTPviewItem::fetchBody( const RecMail &mail )
273{ 274{
274 qDebug( "NNTP fetchBody" ); 275 qDebug( "NNTP fetchBody" );
275 return wrapper->fetchBody( mail ); 276 return wrapper->fetchBody( mail );
276} 277}
277 278
278QPopupMenu * NNTPviewItem::getContextMenu() 279QPopupMenu * NNTPviewItem::getContextMenu()
279{ 280{
280 QPopupMenu *m = new QPopupMenu(0); 281 QPopupMenu *m = new QPopupMenu(0);
281 if (m) 282 if (m)
282 { 283 {
283 if (!account->getOffline()) 284 if (!account->getOffline())
284 { 285 {
285 m->insertItem(QObject::tr("Disconnect",contextName),0); 286 m->insertItem(QObject::tr("Disconnect",contextName),0);
286 m->insertItem(QObject::tr("Set offline",contextName),1); 287 m->insertItem(QObject::tr("Set offline",contextName),1);
288 m->insertItem(QObject::tr("(Un-)Subscribe groups",contextName),2);
287 } 289 }
288 else 290 else
289 { 291 {
290 m->insertItem(QObject::tr("Set online",contextName),1); 292 m->insertItem(QObject::tr("Set online",contextName),1);
291 } 293 }
292 } 294 }
293 return m; 295 return m;
294} 296}
295 297
298void NNTPviewItem::subscribeGroups()
299{
300 NNTPGroupsDlg dlg(account);
301 if (QPEApplication::execDialog(&dlg)== QDialog::Accepted ){
302 refresh();
303 }
304}
305
296void NNTPviewItem::disconnect() 306void NNTPviewItem::disconnect()
297{ 307{
298 QListViewItem *child = firstChild(); 308 QListViewItem *child = firstChild();
299 while ( child ) 309 while ( child )
300 { 310 {
301 QListViewItem *tmp = child; 311 QListViewItem *tmp = child;
302 child = child->nextSibling(); 312 child = child->nextSibling();
303 delete tmp; 313 delete tmp;
304 } 314 }
305 wrapper->logout(); 315 wrapper->logout();
306} 316}
307 317
308void NNTPviewItem::setOnOffline() 318void NNTPviewItem::setOnOffline()
309{ 319{
310 if (!account->getOffline()) 320 if (!account->getOffline())
311 { 321 {
312 disconnect(); 322 disconnect();
313 } 323 }
314 account->setOffline(!account->getOffline()); 324 account->setOffline(!account->getOffline());
315 account->save(); 325 account->save();
316 //FIXME 326 //FIXME
317 SETPIX(PIXMAP_POP3FOLDER); 327 SETPIX(PIXMAP_POP3FOLDER);
318 refresh(); 328 refresh();
319} 329}
320 330
321void NNTPviewItem::contextMenuSelected(int which) 331void NNTPviewItem::contextMenuSelected(int which)
322{ 332{
323 switch (which) 333 switch (which)
324 { 334 {
325 case 0: 335 case 0:
326 disconnect(); 336 disconnect();
327 break; 337 break;
328 case 1: 338 case 1:
329 setOnOffline(); 339 setOnOffline();
330 break; 340 break;
341 case 2:
342 subscribeGroups();
343 break;
331 } 344 }
332} 345}
333 346
334NNTPfolderItem::~NNTPfolderItem() 347NNTPfolderItem::~NNTPfolderItem()
335{} 348{}
336 349
337NNTPfolderItem::NNTPfolderItem( Folder *folderInit, NNTPviewItem *parent , QListViewItem*after ) 350NNTPfolderItem::NNTPfolderItem( Folder *folderInit, NNTPviewItem *parent , QListViewItem*after )
338 : AccountViewItem( parent,after ) 351 : AccountViewItem( parent,after )
339{ 352{
340 folder = folderInit; 353 folder = folderInit;
341 nntp = parent; 354 nntp = parent;
342 if (folder->getDisplayName().lower()!="inbox") 355 if (folder->getDisplayName().lower()!="inbox")
343 { 356 {
344 setPixmap( 0, PIXMAP_POP3FOLDER ); 357 setPixmap( 0, PIXMAP_POP3FOLDER );
345 } 358 }
346 else 359 else
347 { 360 {
348 setPixmap( 0, PIXMAP_INBOXFOLDER); 361 setPixmap( 0, PIXMAP_INBOXFOLDER);
349 } 362 }
350 setText( 0, folder->getDisplayName() ); 363 setText( 0, folder->getDisplayName() );
351} 364}
352 365
353void NNTPfolderItem::refresh(QList<RecMail>&target) 366void NNTPfolderItem::refresh(QList<RecMail>&target)
354{ 367{
355 if (folder->may_select()) 368 if (folder->may_select())
356 nntp->getWrapper()->listMessages( folder->getName(),target ); 369 nntp->getWrapper()->listMessages( folder->getName(),target );
357} 370}
358 371
359RecBody NNTPfolderItem::fetchBody(const RecMail&aMail) 372RecBody NNTPfolderItem::fetchBody(const RecMail&aMail)
360{ 373{
361 return nntp->getWrapper()->fetchBody(aMail); 374 return nntp->getWrapper()->fetchBody(aMail);
362} 375}
363 376
364QPopupMenu * NNTPfolderItem::getContextMenu() 377QPopupMenu * NNTPfolderItem::getContextMenu()
365{ 378{
366 QPopupMenu *m = new QPopupMenu(0); 379 QPopupMenu *m = new QPopupMenu(0);
367 if (m) 380 if (m)
368 { 381 {
369 m->insertItem(QObject::tr("Refresh header list",contextName),0); 382 m->insertItem(QObject::tr("Refresh header list",contextName),0);
370 m->insertItem(QObject::tr("Move/Copie all mails",contextName),1); 383 m->insertItem(QObject::tr("Copy all postings",contextName),1);
371 } 384 }
372 return m; 385 return m;
373} 386}
374 387
375void NNTPfolderItem::downloadMails() 388void NNTPfolderItem::downloadMails()
376{ 389{
377 AccountView*bl = nntp->accountView(); 390 AccountView*bl = nntp->accountView();
378 if (!bl) return; 391 if (!bl) return;
379 bl->downloadMails(folder,nntp->getWrapper()); 392 bl->downloadMails(folder,nntp->getWrapper());
380} 393}
381 394
382void NNTPfolderItem::contextMenuSelected(int which) 395void NNTPfolderItem::contextMenuSelected(int which)
383{ 396{
384 AccountView * view = (AccountView*)listView(); 397 AccountView * view = (AccountView*)listView();
385 switch (which) 398 switch (which)
386 { 399 {
387 case 0: 400 case 0:
388 /* must be 'cause pop3 lists are cached */ 401 /* must be 'cause pop3 lists are cached */
389 nntp->getWrapper()->logout(); 402 nntp->getWrapper()->logout();
390 view->refreshCurrent(); 403 view->refreshCurrent();
391 break; 404 break;
392 case 1: 405 case 1:
393 downloadMails(); 406 downloadMails();
394 break; 407 break;
395 default: 408 default:
396 break; 409 break;
397 } 410 }
398} 411}
399 412
400/** 413/**
401 * IMAP Account stuff 414 * IMAP Account stuff
402 */ 415 */
403IMAPviewItem::IMAPviewItem( IMAPaccount *a, AccountView *parent ) 416IMAPviewItem::IMAPviewItem( IMAPaccount *a, AccountView *parent )
404 : AccountViewItem( parent ) 417 : AccountViewItem( parent )
405{ 418{
406 account = a; 419 account = a;
407 wrapper = AbstractMail::getWrapper( account ); 420 wrapper = AbstractMail::getWrapper( account );
408 SETPIX(PIXMAP_IMAPFOLDER); 421 SETPIX(PIXMAP_IMAPFOLDER);
409 setText( 0, account->getAccountName() ); 422 setText( 0, account->getAccountName() );
410 setOpen( true ); 423 setOpen( true );
411} 424}
412 425
413IMAPviewItem::~IMAPviewItem() 426IMAPviewItem::~IMAPviewItem()
414{ 427{
415 delete wrapper; 428 delete wrapper;
416} 429}
417 430
418AbstractMail *IMAPviewItem::getWrapper() 431AbstractMail *IMAPviewItem::getWrapper()
diff --git a/noncore/net/mail/accountitem.h b/noncore/net/mail/accountitem.h
index a138c9b..f3c0f5d 100644
--- a/noncore/net/mail/accountitem.h
+++ b/noncore/net/mail/accountitem.h
@@ -51,96 +51,97 @@ public:
51 virtual RecBody fetchBody( const RecMail &mail ); 51 virtual RecBody fetchBody( const RecMail &mail );
52 AbstractMail *getWrapper(); 52 AbstractMail *getWrapper();
53 virtual QPopupMenu * getContextMenu(); 53 virtual QPopupMenu * getContextMenu();
54 virtual void contextMenuSelected(int); 54 virtual void contextMenuSelected(int);
55 55
56protected: 56protected:
57 POP3account *account; 57 POP3account *account;
58 virtual void refresh(); 58 virtual void refresh();
59 AbstractMail *wrapper; 59 AbstractMail *wrapper;
60 void disconnect(); 60 void disconnect();
61 void setOnOffline(); 61 void setOnOffline();
62}; 62};
63 63
64class POP3folderItem : public AccountViewItem 64class POP3folderItem : public AccountViewItem
65{ 65{
66 66
67public: 67public:
68 POP3folderItem( Folder *folder, POP3viewItem *parent , QListViewItem*after ); 68 POP3folderItem( Folder *folder, POP3viewItem *parent , QListViewItem*after );
69 virtual ~POP3folderItem(); 69 virtual ~POP3folderItem();
70 virtual void refresh(QList<RecMail>&); 70 virtual void refresh(QList<RecMail>&);
71 virtual RecBody fetchBody(const RecMail&); 71 virtual RecBody fetchBody(const RecMail&);
72 virtual QPopupMenu * getContextMenu(); 72 virtual QPopupMenu * getContextMenu();
73 virtual void contextMenuSelected(int); 73 virtual void contextMenuSelected(int);
74 74
75protected: 75protected:
76 void downloadMails(); 76 void downloadMails();
77 POP3viewItem *pop3; 77 POP3viewItem *pop3;
78}; 78};
79 79
80 80
81class NNTPviewItem : public AccountViewItem 81class NNTPviewItem : public AccountViewItem
82{ 82{
83 83
84public: 84public:
85 NNTPviewItem( NNTPaccount *a, AccountView *parent ); 85 NNTPviewItem( NNTPaccount *a, AccountView *parent );
86 virtual ~NNTPviewItem(); 86 virtual ~NNTPviewItem();
87 virtual void refresh( QList<RecMail> &target ); 87 virtual void refresh( QList<RecMail> &target );
88 virtual RecBody fetchBody( const RecMail &mail ); 88 virtual RecBody fetchBody( const RecMail &mail );
89 AbstractMail *getWrapper(); 89 AbstractMail *getWrapper();
90 virtual QPopupMenu * getContextMenu(); 90 virtual QPopupMenu * getContextMenu();
91 virtual void contextMenuSelected(int); 91 virtual void contextMenuSelected(int);
92 92
93protected: 93protected:
94 NNTPaccount *account; 94 NNTPaccount *account;
95 virtual void refresh(); 95 virtual void refresh();
96 AbstractMail *wrapper; 96 AbstractMail *wrapper;
97 void disconnect(); 97 void disconnect();
98 void setOnOffline(); 98 void setOnOffline();
99 void subscribeGroups();
99}; 100};
100 101
101class NNTPfolderItem : public AccountViewItem 102class NNTPfolderItem : public AccountViewItem
102{ 103{
103 104
104public: 105public:
105 NNTPfolderItem( Folder *folder, NNTPviewItem *parent , QListViewItem*after ); 106 NNTPfolderItem( Folder *folder, NNTPviewItem *parent , QListViewItem*after );
106 virtual ~NNTPfolderItem(); 107 virtual ~NNTPfolderItem();
107 virtual void refresh(QList<RecMail>&); 108 virtual void refresh(QList<RecMail>&);
108 virtual RecBody fetchBody(const RecMail&); 109 virtual RecBody fetchBody(const RecMail&);
109 virtual QPopupMenu * getContextMenu(); 110 virtual QPopupMenu * getContextMenu();
110 virtual void contextMenuSelected(int); 111 virtual void contextMenuSelected(int);
111 112
112protected: 113protected:
113 void downloadMails(); 114 void downloadMails();
114 NNTPviewItem *nntp; 115 NNTPviewItem *nntp;
115}; 116};
116 117
117 118
118 119
119class IMAPviewItem : public AccountViewItem 120class IMAPviewItem : public AccountViewItem
120{ 121{
121 friend class IMAPfolderItem; 122 friend class IMAPfolderItem;
122public: 123public:
123 IMAPviewItem( IMAPaccount *a, AccountView *parent ); 124 IMAPviewItem( IMAPaccount *a, AccountView *parent );
124 virtual ~IMAPviewItem(); 125 virtual ~IMAPviewItem();
125 virtual void refresh(QList<RecMail>&); 126 virtual void refresh(QList<RecMail>&);
126 virtual RecBody fetchBody(const RecMail&); 127 virtual RecBody fetchBody(const RecMail&);
127 AbstractMail *getWrapper(); 128 AbstractMail *getWrapper();
128 virtual QPopupMenu * getContextMenu(); 129 virtual QPopupMenu * getContextMenu();
129 virtual void contextMenuSelected(int); 130 virtual void contextMenuSelected(int);
130 const QStringList&subFolders(); 131 const QStringList&subFolders();
131 virtual void refreshFolders(bool force=false); 132 virtual void refreshFolders(bool force=false);
132 bool offline(); 133 bool offline();
133 134
134protected: 135protected:
135 virtual void createNewFolder(); 136 virtual void createNewFolder();
136 IMAPaccount *account; 137 IMAPaccount *account;
137 AbstractMail *wrapper; 138 AbstractMail *wrapper;
138 QStringList currentFolders; 139 QStringList currentFolders;
139}; 140};
140 141
141class IMAPfolderItem : public AccountViewItem 142class IMAPfolderItem : public AccountViewItem
142{ 143{
143 144
144public: 145public:
145 IMAPfolderItem( Folder *folder, IMAPviewItem *parent , QListViewItem*after ); 146 IMAPfolderItem( Folder *folder, IMAPviewItem *parent , QListViewItem*after );
146 IMAPfolderItem( Folder *folder, IMAPfolderItem *parent , QListViewItem*after, IMAPviewItem *master ); 147 IMAPfolderItem( Folder *folder, IMAPfolderItem *parent , QListViewItem*after, IMAPviewItem *master );
diff --git a/noncore/net/mail/mail.pro b/noncore/net/mail/mail.pro
index 7e0de2b..005a839 100644
--- a/noncore/net/mail/mail.pro
+++ b/noncore/net/mail/mail.pro
@@ -1,61 +1,66 @@
1CONFIG += qt warn_on debug quick-app 1CONFIG += qt warn_on debug quick-app
2 2
3HEADERS = defines.h \ 3HEADERS = defines.h \
4 editaccounts.h \ 4 editaccounts.h \
5 composemail.h \ 5 composemail.h \
6 accountview.h \ 6 accountview.h \
7 accountitem.h \ 7 accountitem.h \
8 mainwindow.h \ 8 mainwindow.h \
9 viewmail.h \ 9 viewmail.h \
10 viewmailbase.h \ 10 viewmailbase.h \
11 opiemail.h \ 11 opiemail.h \
12 mailistviewitem.h \ 12 mailistviewitem.h \
13 settingsdialog.h \ 13 settingsdialog.h \
14 statuswidget.h \ 14 statuswidget.h \
15 newmaildir.h \ 15 newmaildir.h \
16 selectstore.h \ 16 selectstore.h \
17 selectsmtp.h 17 selectsmtp.h \
18 nntpgroups.h \
19 nntpgroupsdlg.h
18 20
19SOURCES = main.cpp \ 21SOURCES = main.cpp \
20 opiemail.cpp \ 22 opiemail.cpp \
21 mainwindow.cpp \ 23 mainwindow.cpp \
22 accountview.cpp \ 24 accountview.cpp \
23 accountitem.cpp \ 25 accountitem.cpp \
24 composemail.cpp \ 26 composemail.cpp \
25 addresspicker.cpp \ 27 addresspicker.cpp \
26 editaccounts.cpp \ 28 editaccounts.cpp \
27 viewmail.cpp \ 29 viewmail.cpp \
28 viewmailbase.cpp \ 30 viewmailbase.cpp \
29 mailistviewitem.cpp \ 31 mailistviewitem.cpp \
30 settingsdialog.cpp \ 32 settingsdialog.cpp \
31 statuswidget.cpp \ 33 statuswidget.cpp \
32 newmaildir.cpp \ 34 newmaildir.cpp \
33 selectstore.cpp \ 35 selectstore.cpp \
34 selectsmtp.cpp 36 selectsmtp.cpp \
37 nntpgroups.cpp \
38 nntpgroupsdlg.cpp
35 39
36INTERFACES = editaccountsui.ui \ 40INTERFACES = editaccountsui.ui \
37 selectmailtypeui.ui \ 41 selectmailtypeui.ui \
38 imapconfigui.ui \ 42 imapconfigui.ui \
39 pop3configui.ui \ 43 pop3configui.ui \
40 nntpconfigui.ui \ 44 nntpconfigui.ui \
41 smtpconfigui.ui \ 45 smtpconfigui.ui \
42 addresspickerui.ui \ 46 addresspickerui.ui \
43 composemailui.ui \ 47 composemailui.ui \
44 settingsdialogui.ui \ 48 settingsdialogui.ui \
45 statuswidgetui.ui \ 49 statuswidgetui.ui \
46 newmaildirui.ui \ 50 newmaildirui.ui \
47 selectstoreui.ui 51 selectstoreui.ui \
52 nntpgroupsui.ui
48 53
49 54
50INCLUDEPATH += $(OPIEDIR)/include 55INCLUDEPATH += $(OPIEDIR)/include
51 56
52CONFTEST = $$system( echo $CONFIG_TARGET_MACOSX ) 57CONFTEST = $$system( echo $CONFIG_TARGET_MACOSX )
53contains( CONFTEST, y ){ 58contains( CONFTEST, y ){
54 LIBS += -lqpe -lopieui2 -lopiecore2 -lopiepim2 -lopiedb2 -lmailwrapper -liconv 59 LIBS += -lqpe -lopieui2 -lopiecore2 -lopiepim2 -lopiedb2 -lmailwrapper -liconv
55}else{ 60}else{
56 LIBS += -lqpe -lopieui2 -lopiecore2 -lopiepim2 -lopiedb2 -lmailwrapper 61 LIBS += -lqpe -lopieui2 -lopiecore2 -lopiepim2 -lopiedb2 -lmailwrapper
57} 62}
58 63
59TARGET = opiemail 64TARGET = opiemail
60 65
61include ( $(OPIEDIR)/include.pro ) 66include ( $(OPIEDIR)/include.pro )
diff --git a/noncore/net/mail/nntpgroups.cpp b/noncore/net/mail/nntpgroups.cpp
new file mode 100644
index 0000000..97b1985
--- a/dev/null
+++ b/noncore/net/mail/nntpgroups.cpp
@@ -0,0 +1,57 @@
1#include "nntpgroups.h"
2
3#include <libmailwrapper/settings.h>
4
5#include <qlistview.h>
6
7NNTPGroups::NNTPGroups(NNTPaccount *account, QWidget* parent, const char* name, WFlags fl)
8 : NNTPGroupsUI(parent,name,fl),subscribedGroups()
9{
10 m_Account = account;
11 fillGroups();
12}
13
14NNTPGroups::~NNTPGroups()
15{
16
17}
18
19void NNTPGroups::slotGetNG()
20{
21 if (!m_Account) return;
22 GroupListView->clear();
23 NNTPwrapper tmp( m_Account );
24 QStringList list = tmp.listAllNewsgroups();
25 for ( QStringList::Iterator it = list.begin(); it != list.end(); ++it ) {
26 QCheckListItem *item;
27 item = new QCheckListItem( GroupListView, (*it), QCheckListItem::CheckBox );
28 if ( subscribedGroups.contains( (*it) ) >= 1 ) {
29 item->setOn( true );
30 }
31 }
32}
33
34void NNTPGroups::fillGroups()
35{
36 if (!m_Account) return;
37 subscribedGroups = m_Account->getGroups();
38 for ( QStringList::Iterator it = subscribedGroups.begin(); it != subscribedGroups.end(); ++it ) {
39 QCheckListItem *item;
40 item = new QCheckListItem( GroupListView, (*it), QCheckListItem::CheckBox );
41 item->setOn( true );
42 }
43}
44
45void NNTPGroups::storeValues()
46{
47 if (!m_Account) return;
48 QListViewItemIterator list_it( GroupListView );
49 subscribedGroups.clear();
50 for ( ; list_it.current(); ++list_it ) {
51 if ( ( (QCheckListItem*)list_it.current() )->isOn() ) {
52 qDebug(list_it.current()->text(0) );
53 subscribedGroups.append( list_it.current()->text(0) );
54 }
55 }
56 m_Account->setGroups( subscribedGroups );
57}
diff --git a/noncore/net/mail/nntpgroups.h b/noncore/net/mail/nntpgroups.h
new file mode 100644
index 0000000..8cc2e8b
--- a/dev/null
+++ b/noncore/net/mail/nntpgroups.h
@@ -0,0 +1,33 @@
1#ifndef __NNTPGROUPS_WINDOW__
2#define __NNTPGROUPS_WINDOW__
3
4#include "nntpgroupsui.h"
5
6#include <libmailwrapper/nntpwrapper.h>
7
8class NNTPaccount;
9class QStringList;
10
11class NNTPGroups:public NNTPGroupsUI
12{
13 Q_OBJECT
14public:
15 NNTPGroups(NNTPaccount *account, QWidget* parent = 0, const char* name = 0, WFlags fl = 0);
16 virtual ~NNTPGroups();
17 /* must be called from external.
18 * it will store the new subscription list into the account
19 * but don't save them, this must be done by the calling class.
20 */
21 void storeValues();
22
23protected slots:
24 virtual void slotGetNG();
25
26protected:
27 virtual void fillGroups();
28
29 NNTPaccount*m_Account;
30 QStringList subscribedGroups;
31};
32
33#endif
diff --git a/noncore/net/mail/nntpgroupsdlg.cpp b/noncore/net/mail/nntpgroupsdlg.cpp
new file mode 100644
index 0000000..752ce3c
--- a/dev/null
+++ b/noncore/net/mail/nntpgroupsdlg.cpp
@@ -0,0 +1,29 @@
1#include "nntpgroupsdlg.h"
2#include "nntpgroups.h"
3
4#include <libmailwrapper/settings.h>
5
6#include <qlayout.h>
7
8NNTPGroupsDlg::NNTPGroupsDlg(NNTPaccount *account,QWidget * parent, const char * name)
9 : QDialog(parent,name,true)
10{
11 setCaption(tr("Subscribed newsgroups"));
12 m_Account = account;
13 QVBoxLayout*dlglayout = new QVBoxLayout(this);
14 dlglayout->setSpacing(2);
15 dlglayout->setMargin(1);
16 groupsWidget = new NNTPGroups(account,this);
17 dlglayout->addWidget(groupsWidget);
18}
19
20NNTPGroupsDlg::~NNTPGroupsDlg()
21{
22}
23
24void NNTPGroupsDlg::accept()
25{
26 groupsWidget->storeValues();
27 m_Account->save();
28 QDialog::accept();
29}
diff --git a/noncore/net/mail/nntpgroupsdlg.h b/noncore/net/mail/nntpgroupsdlg.h
new file mode 100644
index 0000000..a21bac7
--- a/dev/null
+++ b/noncore/net/mail/nntpgroupsdlg.h
@@ -0,0 +1,24 @@
1#ifndef __NNTP_GROUP_DLG_H
2#define __NNTP_GROUP_DLG_H
3
4#include <qdialog.h>
5
6class NNTPGroups;
7class NNTPaccount;
8
9class NNTPGroupsDlg : public QDialog
10{
11 Q_OBJECT
12public:
13 NNTPGroupsDlg(NNTPaccount *account,QWidget * parent=0, const char * name=0);
14 virtual ~NNTPGroupsDlg();
15
16protected:
17 NNTPGroups*groupsWidget;
18 NNTPaccount*m_Account;
19
20protected slots:
21 virtual void accept ();
22};
23
24#endif
diff --git a/noncore/net/mail/nntpgroupsui.ui b/noncore/net/mail/nntpgroupsui.ui
new file mode 100644
index 0000000..93f487b
--- a/dev/null
+++ b/noncore/net/mail/nntpgroupsui.ui
@@ -0,0 +1,88 @@
1<!DOCTYPE UI><UI>
2<class>NNTPGroupsUI</class>
3<widget>
4 <class>QWidget</class>
5 <property stdset="1">
6 <name>name</name>
7 <cstring>NNTPGroupsUI</cstring>
8 </property>
9 <property stdset="1">
10 <name>geometry</name>
11 <rect>
12 <x>0</x>
13 <y>0</y>
14 <width>356</width>
15 <height>406</height>
16 </rect>
17 </property>
18 <property stdset="1">
19 <name>caption</name>
20 <string>newsgroupslist</string>
21 </property>
22 <property>
23 <name>layoutMargin</name>
24 </property>
25 <property>
26 <name>layoutSpacing</name>
27 </property>
28 <vbox>
29 <property stdset="1">
30 <name>margin</name>
31 <number>2</number>
32 </property>
33 <property stdset="1">
34 <name>spacing</name>
35 <number>2</number>
36 </property>
37 <widget>
38 <class>QListView</class>
39 <column>
40 <property>
41 <name>text</name>
42 <string>Newsgroups</string>
43 </property>
44 <property>
45 <name>clickable</name>
46 <bool>true</bool>
47 </property>
48 <property>
49 <name>resizeable</name>
50 <bool>true</bool>
51 </property>
52 </column>
53 <property stdset="1">
54 <name>name</name>
55 <cstring>GroupListView</cstring>
56 </property>
57 <property>
58 <name>whatsThis</name>
59 <string>List of groups from the server. On start, only subscribed groups are listed.</string>
60 </property>
61 </widget>
62 <widget>
63 <class>QPushButton</class>
64 <property stdset="1">
65 <name>name</name>
66 <cstring>GetNGButton</cstring>
67 </property>
68 <property stdset="1">
69 <name>text</name>
70 <string>Get newsgroup list from server</string>
71 </property>
72 <property>
73 <name>whatsThis</name>
74 <string>Retrieve the list of groups from server</string>
75 </property>
76 </widget>
77 </vbox>
78</widget>
79<connections>
80 <connection>
81 <sender>GetNGButton</sender>
82 <signal>clicked()</signal>
83 <receiver>NNTPGroupsUI</receiver>
84 <slot>slotGetNG()</slot>
85 </connection>
86 <slot access="protected">slotGetNG()</slot>
87</connections>
88</UI>