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) (side-by-side diff)
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()
{
+ m->insertItem(QObject::tr("Get new messages",contextName),GET_NEW_MAILS);
m->insertItem(QObject::tr("Disconnect",contextName),0);
m->insertItem(QObject::tr("Set offline",contextName),1);
- m->insertItem(QObject::tr("Get new messages",contextName),GET_NEW_MAILS);
}
@@ -100,4 +100,4 @@ QPopupMenu * POP3viewItem::getContextMenu()
{
- m->insertItem(QObject::tr("Set online",contextName),1);
m->insertItem(QObject::tr("Get new messages",contextName),GET_NEW_MAILS);
+ m->insertItem(QObject::tr("Set online",contextName),1);
}
@@ -189,2 +189,3 @@ QPopupMenu * POP3folderItem::getContextMenu()
{
+ m->insertItem(QObject::tr("Get new messages",contextName),GET_NEW_MAILS);
m->insertItem(QObject::tr("Refresh header list",contextName),0);
@@ -219,2 +220,5 @@ void POP3folderItem::contextMenuSelected(int which)
break;
+ case GET_NEW_MAILS: // daunlood
+ view->downloadMailsInbox(getFolder() ,pop3->getWrapper());
+ break;
default:
@@ -515,2 +519,3 @@ QPopupMenu * IMAPviewItem::getContextMenu()
{
+ m->insertItem(QObject::tr("Get new messages",contextName),GET_NEW_MAILS);
m->insertItem(QObject::tr("Refresh folder list",contextName),0);
@@ -521,3 +526,2 @@ QPopupMenu * IMAPviewItem::getContextMenu()
m->insertSeparator();
- m->insertItem(QObject::tr("Get new messages",contextName),GET_NEW_MAILS);
}
@@ -525,5 +529,4 @@ QPopupMenu * IMAPviewItem::getContextMenu()
{
- m->insertItem(QObject::tr("Set online",contextName),3);
- m->insertSeparator();
m->insertItem(QObject::tr("Get new messages",contextName),GET_NEW_MAILS);
+ m->insertItem(QObject::tr("Set online",contextName),3);
}
@@ -671,2 +674,3 @@ QPopupMenu * IMAPfolderItem::getContextMenu()
{
+ m->insertItem(QObject::tr("Get new messages",contextName),GET_NEW_MAILS);
m->insertItem(QObject::tr("Refresh header list",contextName),0);
@@ -755,2 +759,9 @@ void IMAPfolderItem::contextMenuSelected(int id)
break;
+ case GET_NEW_MAILS: // daunlood
+ {
+ AccountView*bl = accountView();
+ if (!bl) return;
+ bl->downloadMailsInbox(getFolder(),imap->getWrapper());
+ }
+ break;
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,
connect( GetNGButton, SIGNAL( clicked() ), this, SLOT( slotGetNG() ) );
+ connect( ShowSubcribed, SIGNAL( clicked() ), this, SLOT( slotShowSub() ) );
+ connect( FilterButton, SIGNAL( clicked() ), this, SLOT( slotShowFilter() ) );
fillValues();
@@ -545,2 +547,32 @@ NNTPconfig::NNTPconfig( NNTPaccount *account, QWidget *parent, const char *name,
+void NNTPconfig::slotShowSub()
+{
+ save();
+ data->save();
+ ListViewGroups->clear();
+ for ( QStringList::Iterator it = subscribedGroups.begin(); it != subscribedGroups.end(); ++it ) {
+ QCheckListItem *item;
+ item = new QCheckListItem( ListViewGroups, (*it), QCheckListItem::CheckBox );
+ item->setOn( true );
+ }
+ topLevelWidget()->setCaption( tr("%1 groups subscribed").arg( subscribedGroups.count()));
+}
+void NNTPconfig::slotShowFilter()
+{
+ save();
+ data->save();
+ ListViewGroups->clear();
+ int count = 0;
+ for ( QStringList::Iterator it = allGroups.begin(); it != allGroups.end(); ++it ) {
+ QCheckListItem *item;
+ if ( GroupFilter->text().isEmpty() || (*it).find( GroupFilter->text() ) >= 0 ) {
+ item = new QCheckListItem( ListViewGroups, (*it), QCheckListItem::CheckBox );
+ ++count;
+ if ( subscribedGroups.contains( (*it) ) >= 1 ) {
+ item->setOn( true );
+ }
+ }
+ }
+ topLevelWidget()->setCaption( tr("Filter found %1 groups").arg( count));
+}
void NNTPconfig::slotGetNG() {
@@ -548,4 +580,7 @@ void NNTPconfig::slotGetNG() {
data->save();
+ topLevelWidget()->setCaption( tr("Fetching group list..."));
+ qApp->processEvents();
NNTPwrapper* tmp = new NNTPwrapper( data );
- QStringList list = tmp->listAllNewsgroups();
+ allGroups = tmp->listAllNewsgroups();
+ topLevelWidget()->setCaption( tr("Downloaded %1 group names").arg( allGroups.count()));
@@ -553,9 +588,11 @@ void NNTPconfig::slotGetNG() {
- for ( QStringList::Iterator it = list.begin(); it != list.end(); ++it ) {
- QCheckListItem *item;
- item = new QCheckListItem( ListViewGroups, (*it), QCheckListItem::CheckBox );
- if ( subscribedGroups.contains( (*it) ) >= 1 ) {
- item->setOn( true );
- }
+ for ( QStringList::Iterator it = allGroups.begin(); it != allGroups.end(); ++it ) {
+ QCheckListItem *item;
+ item = new QCheckListItem( ListViewGroups, (*it), QCheckListItem::CheckBox );
+ if ( subscribedGroups.contains( (*it) ) >= 1 ) {
+ item->setOn( true );
+
+ }
}
+ delete tmp;
}
@@ -602,13 +639,16 @@ void NNTPconfig::save()
- QListViewItemIterator list_it( ListViewGroups );
+ QListViewItemIterator list_it( ListViewGroups );
- QStringList groupList;
- for ( ; list_it.current(); ++list_it ) {
+ for ( ; list_it.current(); ++list_it ) {
- if ( ( (QCheckListItem*)list_it.current() )->isOn() ) {
- groupList.append( list_it.current()->text(0) );
- }
+ if ( ( (QCheckListItem*)list_it.current() )->isOn() ) {
+ if ( subscribedGroups.contains( list_it.current()->text(0) ) < 1 )
+ subscribedGroups.append( list_it.current()->text(0) );
+ } else {
+ if ( subscribedGroups.contains( list_it.current()->text(0) ) >= 1 )
+ subscribedGroups.remove( list_it.current()->text(0) );
+ }
- }
- data->setGroups( groupList );
+ }
+ data->setGroups( subscribedGroups );
}
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:
void slotGetNG();
+ void slotShowSub();
+ void slotShowFilter();
@@ -146,2 +148,3 @@ private:
QStringList subscribedGroups;
+ QStringList allGroups;
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 )
toolBar->setHorizontalStretchable( true );
+ QAction* getMail = new QAction( tr( "Get all new mails" ), SmallIcon("add"),
+ 0, 0, this );
+ connect(getMail, SIGNAL( activated() ),
+ SLOT( slotGetAllMail() ) );
+ getMail->addTo( mailMenu );
- QAction* getMail = new QAction( tr( "Get new mail" ), SmallIcon("add"),
+ getMail = new QAction( tr( "Get new messages" ), SmallIcon("add"),
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:
virtual void slotGetMail() = 0;
+ virtual void slotGetAllMail() = 0;
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 @@
<y>0</y>
- <width>409</width>
- <height>520</height>
+ <width>268</width>
+ <height>347</height>
</rect>
@@ -30,3 +30,3 @@
<name>margin</name>
- <number>3</number>
+ <number>2</number>
</property>
@@ -291,3 +291,3 @@
<name>margin</name>
- <number>3</number>
+ <number>2</number>
</property>
@@ -298,32 +298,98 @@
<widget>
- <class>QListView</class>
- <column>
- <property>
- <name>text</name>
- <string>Newsgroup</string>
- </property>
- <property>
- <name>clickable</name>
- <bool>true</bool>
- </property>
- <property>
- <name>resizeable</name>
- <bool>true</bool>
- </property>
- </column>
- <property stdset="1">
- <name>name</name>
- <cstring>ListViewGroups</cstring>
- </property>
- </widget>
- <widget>
- <class>QPushButton</class>
+ <class>QLayoutWidget</class>
<property stdset="1">
<name>name</name>
- <cstring>GetNGButton</cstring>
+ <cstring>Layout10</cstring>
</property>
- <property stdset="1">
- <name>text</name>
- <string>Get newsgroup list from server</string>
+ <property>
+ <name>layoutSpacing</name>
</property>
+ <vbox>
+ <property stdset="1">
+ <name>margin</name>
+ <number>0</number>
+ </property>
+ <property stdset="1">
+ <name>spacing</name>
+ <number>3</number>
+ </property>
+ <widget>
+ <class>QListView</class>
+ <column>
+ <property>
+ <name>text</name>
+ <string>Newsgroup</string>
+ </property>
+ <property>
+ <name>clickable</name>
+ <bool>true</bool>
+ </property>
+ <property>
+ <name>resizeable</name>
+ <bool>true</bool>
+ </property>
+ </column>
+ <property stdset="1">
+ <name>name</name>
+ <cstring>ListViewGroups</cstring>
+ </property>
+ </widget>
+ <widget>
+ <class>QPushButton</class>
+ <property stdset="1">
+ <name>name</name>
+ <cstring>GetNGButton</cstring>
+ </property>
+ <property stdset="1">
+ <name>text</name>
+ <string>Get newsgroup list from server</string>
+ </property>
+ </widget>
+ <widget>
+ <class>QLayoutWidget</class>
+ <property stdset="1">
+ <name>name</name>
+ <cstring>Layout9</cstring>
+ </property>
+ <hbox>
+ <property stdset="1">
+ <name>margin</name>
+ <number>0</number>
+ </property>
+ <property stdset="1">
+ <name>spacing</name>
+ <number>6</number>
+ </property>
+ <widget>
+ <class>QPushButton</class>
+ <property stdset="1">
+ <name>name</name>
+ <cstring>FilterButton</cstring>
+ </property>
+ <property stdset="1">
+ <name>text</name>
+ <string>Filter:</string>
+ </property>
+ </widget>
+ <widget>
+ <class>QLineEdit</class>
+ <property stdset="1">
+ <name>name</name>
+ <cstring>GroupFilter</cstring>
+ </property>
+ </widget>
+ <widget>
+ <class>QPushButton</class>
+ <property stdset="1">
+ <name>name</name>
+ <cstring>ShowSubcribed</cstring>
+ </property>
+ <property stdset="1">
+ <name>text</name>
+ <string>Show subscribed</string>
+ </property>
+ </widget>
+ </hbox>
+ </widget>
+ </vbox>
</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()
}
+void OpieMail::slotGetAllMail()
+{
+ QListViewItem * item = folderView->firstChild();
+ while ( item ){
+ ((AccountViewItem *)item)->contextMenuSelected( 101 );
+ item = item->nextSibling ();
+ }
+}
void 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:
virtual void slotGetMail();
+ virtual void slotGetAllMail();
virtual void slotDeleteAllMail();