summaryrefslogtreecommitdiffabout
path: root/kmicromail
authorzautrix <zautrix>2004-09-16 20:39:34 (UTC)
committer zautrix <zautrix>2004-09-16 20:39:34 (UTC)
commitb44edfb21be0eee91c4f47401e3fe6ff37e4c16c (patch) (unidiff)
treea17655e0e679f67498d9fee6f6a532e9c0f0e9e5 /kmicromail
parentb6bfa63deb15a2600d46a8c68c231f068da1444a (diff)
downloadkdepimpi-b44edfb21be0eee91c4f47401e3fe6ff37e4c16c.zip
kdepimpi-b44edfb21be0eee91c4f47401e3fe6ff37e4c16c.tar.gz
kdepimpi-b44edfb21be0eee91c4f47401e3fe6ff37e4c16c.tar.bz2
better newsgroup handling
Diffstat (limited to 'kmicromail') (more/less context) (ignore whitespace changes)
-rw-r--r--kmicromail/accountitem.cpp21
-rw-r--r--kmicromail/editaccounts.cpp70
-rw-r--r--kmicromail/editaccounts.h3
-rw-r--r--kmicromail/mainwindow.cpp7
-rw-r--r--kmicromail/mainwindow.h1
-rw-r--r--kmicromail/nntpconfigui.ui126
-rw-r--r--kmicromail/opiemail.cpp8
-rw-r--r--kmicromail/opiemail.h1
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
@@ -94,5 +94,5 @@ QPopupMenu * POP3viewItem::getContextMenu()
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 }
@@ -100,4 +100,4 @@ QPopupMenu * POP3viewItem::getContextMenu()
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 }
@@ -189,2 +189,3 @@ QPopupMenu * POP3folderItem::getContextMenu()
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);
@@ -219,2 +220,5 @@ void POP3folderItem::contextMenuSelected(int which)
219 break; 220 break;
221 case GET_NEW_MAILS: // daunlood
222 view->downloadMailsInbox(getFolder() ,pop3->getWrapper());
223 break;
220 default: 224 default:
@@ -515,2 +519,3 @@ QPopupMenu * IMAPviewItem::getContextMenu()
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);
@@ -521,3 +526,2 @@ QPopupMenu * IMAPviewItem::getContextMenu()
521 m->insertSeparator(); 526 m->insertSeparator();
522 m->insertItem(QObject::tr("Get new messages",contextName),GET_NEW_MAILS);
523 } 527 }
@@ -525,5 +529,4 @@ QPopupMenu * IMAPviewItem::getContextMenu()
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 }
@@ -671,2 +674,3 @@ QPopupMenu * IMAPfolderItem::getContextMenu()
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);
@@ -755,2 +759,9 @@ void IMAPfolderItem::contextMenuSelected(int id)
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:
diff --git a/kmicromail/editaccounts.cpp b/kmicromail/editaccounts.cpp
index d43d23b..733e38a 100644
--- a/kmicromail/editaccounts.cpp
+++ b/kmicromail/editaccounts.cpp
@@ -540,2 +540,4 @@ NNTPconfig::NNTPconfig( NNTPaccount *account, QWidget *parent, const char *name,
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();
@@ -545,2 +547,32 @@ NNTPconfig::NNTPconfig( NNTPaccount *account, QWidget *parent, const char *name,
545 547
548void 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}
560void 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}
546void NNTPconfig::slotGetNG() { 578void NNTPconfig::slotGetNG() {
@@ -548,4 +580,7 @@ void NNTPconfig::slotGetNG() {
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
@@ -553,9 +588,11 @@ void NNTPconfig::slotGetNG() {
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}
@@ -602,13 +639,16 @@ void NNTPconfig::save()
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}
diff --git a/kmicromail/editaccounts.h b/kmicromail/editaccounts.h
index a9eb19f..6cf842e 100644
--- a/kmicromail/editaccounts.h
+++ b/kmicromail/editaccounts.h
@@ -143,2 +143,4 @@ protected slots:
143 void slotGetNG(); 143 void slotGetNG();
144 void slotShowSub();
145 void slotShowFilter();
144 146
@@ -146,2 +148,3 @@ private:
146 QStringList subscribedGroups; 148 QStringList subscribedGroups;
149 QStringList allGroups;
147 void save(); 150 void save();
diff --git a/kmicromail/mainwindow.cpp b/kmicromail/mainwindow.cpp
index d130317..2a67e39 100644
--- a/kmicromail/mainwindow.cpp
+++ b/kmicromail/mainwindow.cpp
@@ -36,4 +36,9 @@ MainWindow::MainWindow( QWidget *parent, const char *name, WFlags flags )
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 );
diff --git a/kmicromail/mainwindow.h b/kmicromail/mainwindow.h
index ff0ff20..35b9c8c 100644
--- a/kmicromail/mainwindow.h
+++ b/kmicromail/mainwindow.h
@@ -44,2 +44,3 @@ protected slots:
44 virtual void slotGetMail() = 0; 44 virtual void slotGetMail() = 0;
45 virtual void slotGetAllMail() = 0;
45 virtual void slotDeleteMail(); 46 virtual void slotDeleteMail();
diff --git a/kmicromail/nntpconfigui.ui b/kmicromail/nntpconfigui.ui
index 25d564e..16ff6fc 100644
--- a/kmicromail/nntpconfigui.ui
+++ b/kmicromail/nntpconfigui.ui
@@ -13,4 +13,4 @@
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>
@@ -30,3 +30,3 @@
30 <name>margin</name> 30 <name>margin</name>
31 <number>3</number> 31 <number>2</number>
32 </property> 32 </property>
@@ -291,3 +291,3 @@
291 <name>margin</name> 291 <name>margin</name>
292 <number>3</number> 292 <number>2</number>
293 </property> 293 </property>
@@ -298,32 +298,98 @@
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>
diff --git a/kmicromail/opiemail.cpp b/kmicromail/opiemail.cpp
index 4e7c6be..7ccfb65 100644
--- a/kmicromail/opiemail.cpp
+++ b/kmicromail/opiemail.cpp
@@ -255,2 +255,10 @@ void OpieMail::displayMail()
255} 255}
256void OpieMail::slotGetAllMail()
257{
258 QListViewItem * item = folderView->firstChild();
259 while ( item ){
260 ((AccountViewItem *)item)->contextMenuSelected( 101 );
261 item = item->nextSibling ();
262 }
263}
256void OpieMail::slotGetMail() 264void OpieMail::slotGetMail()
diff --git a/kmicromail/opiemail.h b/kmicromail/opiemail.h
index 47264e4..9de95f8 100644
--- a/kmicromail/opiemail.h
+++ b/kmicromail/opiemail.h
@@ -34,2 +34,3 @@ protected slots:
34 virtual void slotGetMail(); 34 virtual void slotGetMail();
35 virtual void slotGetAllMail();
35 virtual void slotDeleteAllMail(); 36 virtual void slotDeleteAllMail();