summaryrefslogtreecommitdiff
Side-by-side diff
Diffstat (more/less context) (show whitespace changes)
-rw-r--r--noncore/net/mail/editaccounts.cpp39
-rw-r--r--noncore/net/mail/editaccounts.h5
-rw-r--r--noncore/net/mail/libmailwrapper/nntpwrapper.cpp24
-rw-r--r--noncore/net/mail/libmailwrapper/nntpwrapper.h2
-rw-r--r--noncore/net/mail/nntpconfigui.ui38
5 files changed, 66 insertions, 42 deletions
diff --git a/noncore/net/mail/editaccounts.cpp b/noncore/net/mail/editaccounts.cpp
index edeb1de..2a1acc0 100644
--- a/noncore/net/mail/editaccounts.cpp
+++ b/noncore/net/mail/editaccounts.cpp
@@ -1,22 +1,26 @@
#include "defines.h"
#include "editaccounts.h"
/* OPIE */
#include <qpe/qpeapplication.h>
/* QT */
#include <qt.h>
+#include <libmailwrapper/nntpwrapper.h>
+
+#include <libetpan/nntpdriver.h>
+
AccountListItem::AccountListItem( QListView *parent, Account *a)
: QListViewItem( parent )
{
account = a;
setText( 0, account->getAccountName() );
setText( 1, account->getType() );
}
EditAccounts::EditAccounts( Settings *s, QWidget *parent, const char *name, bool modal, WFlags flags )
: EditAccountsUI( parent, name, modal, flags )
{
qDebug( "New Account Configuration Widget" );
@@ -479,54 +483,85 @@ void SMTPconfig::accept()
/**
* NNTPconfig
*/
NNTPconfig::NNTPconfig( NNTPaccount *account, QWidget *parent, const char *name, bool modal, WFlags flags )
: NNTPconfigUI( parent, name, modal, flags )
{
data = account;
connect( loginBox, SIGNAL( toggled(bool) ), userLine, SLOT( setEnabled(bool) ) );
connect( loginBox, SIGNAL( toggled(bool) ), passLine, SLOT( setEnabled(bool) ) );
-
+ connect( GetNGButton, SIGNAL( clicked() ), this, SLOT( slotGetNG() ) );
fillValues();
connect( sslBox, SIGNAL( toggled(bool) ), SLOT( slotSSL(bool) ) );
}
+void NNTPconfig::slotGetNG() {
+ save();
+ data->save();
+ NNTPwrapper* tmp = new NNTPwrapper( data );
+ clist* list = tmp->listAllNewsgroups();
+
+ clistcell *current;
+ newsnntp_group_description *group;
+
+ // FIXME - test if not empty
+ current = list->first;
+ for ( current=clist_begin(list);current!=NULL;current=clist_next(current) ) {
+ group = ( newsnntp_group_description* ) current->data;
+ qDebug( group->grp_name );
+
+ QCheckListItem *item;
+ item = new QCheckListItem( ListViewGroups, ( QString )group->grp_name, QCheckListItem::CheckBox );
+ }
+}
+
void NNTPconfig::slotSSL( bool enabled )
{
if ( enabled )
{
portLine->setText( NNTP_SSL_PORT );
}
else
{
portLine->setText( NNTP_PORT );
}
}
void NNTPconfig::fillValues()
{
accountLine->setText( data->getAccountName() );
serverLine->setText( data->getServer() );
portLine->setText( data->getPort() );
sslBox->setChecked( data->getSSL() );
loginBox->setChecked( data->getLogin() );
userLine->setText( data->getUser() );
passLine->setText( data->getPassword() );
}
-void NNTPconfig::accept()
+void NNTPconfig::save()
{
data->setAccountName( accountLine->text() );
data->setServer( serverLine->text() );
data->setPort( portLine->text() );
data->setSSL( sslBox->isChecked() );
data->setLogin( loginBox->isChecked() );
data->setUser( userLine->text() );
data->setPassword( passLine->text() );
+ QListViewItemIterator list_it( ListViewGroups );
+ for ( ; list_it.current(); ++list_it ) {
+ if ( list_it.current()->isSelected() ) {
+ qDebug( list_it.current()->text(0) );
+ }
+ }
+}
+
+void NNTPconfig::accept()
+{
+ save();
QDialog::accept();
}
diff --git a/noncore/net/mail/editaccounts.h b/noncore/net/mail/editaccounts.h
index d8e1219..438a984 100644
--- a/noncore/net/mail/editaccounts.h
+++ b/noncore/net/mail/editaccounts.h
@@ -1,24 +1,26 @@
#ifndef EDITACCOUNTS_H
#define EDITACCOUNTS_H
#include <qstring.h>
#include <qlistview.h>
#include "editaccountsui.h"
#include "selectmailtypeui.h"
#include "imapconfigui.h"
#include "pop3configui.h"
#include "smtpconfigui.h"
#include "nntpconfigui.h"
+
+#include <libetpan/clist.h>
#include <libmailwrapper/settings.h>
class AccountListItem : public QListViewItem
{
public:
AccountListItem( QListView *parent, Account *a);
Account *getAccount() { return account; }
private:
Account *account;
@@ -129,19 +131,22 @@ class NNTPconfig : public NNTPconfigUI
{
Q_OBJECT
public:
NNTPconfig( NNTPaccount *account, QWidget *parent = 0, const char *name = 0, bool modal = 0, WFlags flags = 0 );
public slots:
void fillValues();
protected slots:
void slotSSL( bool enabled );
void accept();
+ void slotGetNG();
private:
+ void save();
NNTPaccount *data;
+ clist* list;
};
#endif
diff --git a/noncore/net/mail/libmailwrapper/nntpwrapper.cpp b/noncore/net/mail/libmailwrapper/nntpwrapper.cpp
index 54e0ed4..2d6f9a3 100644
--- a/noncore/net/mail/libmailwrapper/nntpwrapper.cpp
+++ b/noncore/net/mail/libmailwrapper/nntpwrapper.cpp
@@ -1,23 +1,21 @@
#include "nntpwrapper.h"
#include "logindialog.h"
#include "mailtypes.h"
#include <qfile.h>
#include <stdlib.h>
#include <libetpan/libetpan.h>
-#include <libetpan/nntpdriver.h>
-
#define HARD_MSG_SIZE_LIMIT 5242880
NNTPwrapper::NNTPwrapper( NNTPaccount *a )
: Genericwrapper() {
account = a;
m_nntp = NULL;
msgTempName = a->getFileName()+"_msg_cache";
last_msg_id = 0;
}
@@ -183,52 +181,46 @@ void NNTPwrapper::login()
void NNTPwrapper::logout()
{
int err = NEWSNNTP_NO_ERROR;
if ( m_nntp == NULL )
return;
mailstorage_free(m_nntp);
m_nntp = 0;
}
QList<Folder>* NNTPwrapper::listFolders() {
-
-
-
QList<Folder> * folders = new QList<Folder>();
folders->setAutoDelete( false );
+
+// folders->append(inb);
+ return folders;
+}
+
+ clist * NNTPwrapper::listAllNewsgroups() {
+ login();
clist *result = 0;
clistcell *current;
newsnntp_group_description *list;
-
- login();
if ( m_nntp ) {
mailsession * session = m_nntp->sto_session;
newsnntp * news = ( ( nntp_session_state_data * )session->sess_data )->nntp_session;
int err = newsnntp_list_newsgroups(news, NULL, &result);
if ( err == NEWSNNTP_NO_ERROR ) {
- current = result->first;
- for ( current=clist_begin(result);current!=NULL;current=clist_next(current)) {
- list = ( newsnntp_group_description* ) current->data;
- qDebug( list->grp_name );
+ return result;
}
-// Folder*inb=new Folder("INBOX","/");
}
}
-// folders->append(inb);
- return folders;
-}
-
void NNTPwrapper::answeredMail(const RecMail&) {}
void NNTPwrapper::statusFolder(folderStat&target_stat,const QString&) {
login();
target_stat.message_count = 0;
target_stat.message_unseen = 0;
target_stat.message_recent = 0;
if (!m_nntp)
return;
int r = mailsession_status_folder(m_nntp->sto_session,0,&target_stat.message_count,
&target_stat.message_recent,&target_stat.message_unseen);
diff --git a/noncore/net/mail/libmailwrapper/nntpwrapper.h b/noncore/net/mail/libmailwrapper/nntpwrapper.h
index e47e68f..e4d4a37 100644
--- a/noncore/net/mail/libmailwrapper/nntpwrapper.h
+++ b/noncore/net/mail/libmailwrapper/nntpwrapper.h
@@ -16,25 +16,25 @@ class NNTPwrapper : public Genericwrapper
Q_OBJECT
public:
NNTPwrapper( NNTPaccount *a );
virtual ~NNTPwrapper();
/* mailbox will be ignored */
virtual void listMessages(const QString & mailbox, QList<RecMail> &target );
/* should only get the subscribed one */
virtual QList<Folder>* listFolders();
/* mailbox will be ignored */
virtual void statusFolder(folderStat&target_stat,const QString & mailbox="INBOX");
-
+ clist * listAllNewsgroups();
virtual void deleteMail(const RecMail&mail);
virtual void answeredMail(const RecMail&mail);
virtual int deleteAllMail(const Folder*);
virtual RecBody fetchBody( const RecMail &mail );
virtual encodedString* fetchRawBody(const RecMail&mail);
virtual void logout();
virtual const QString&getType()const;
virtual const QString&getName()const;
static void nntp_progress( size_t current, size_t maximum );
protected:
diff --git a/noncore/net/mail/nntpconfigui.ui b/noncore/net/mail/nntpconfigui.ui
index 7769804..25d564e 100644
--- a/noncore/net/mail/nntpconfigui.ui
+++ b/noncore/net/mail/nntpconfigui.ui
@@ -2,25 +2,25 @@
<class>NNTPconfigUI</class>
<widget>
<class>QDialog</class>
<property stdset="1">
<name>name</name>
<cstring>NNTPconfigUI</cstring>
</property>
<property stdset="1">
<name>geometry</name>
<rect>
<x>0</x>
<y>0</y>
- <width>413</width>
+ <width>409</width>
<height>520</height>
</rect>
</property>
<property stdset="1">
<name>caption</name>
<string>Configure NNTP</string>
</property>
<property>
<name>layoutMargin</name>
</property>
<property>
<name>layoutSpacing</name>
@@ -288,65 +288,57 @@
</attribute>
<vbox>
<property stdset="1">
<name>margin</name>
<number>3</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>
</vbox>
</widget>
</widget>
</vbox>
</widget>
-<customwidgets>
- <customwidget>
- <class>QListView</class>
- <header location="global">qlistview.h</header>
- <sizehint>
- <width>-1</width>
- <height>-1</height>
- </sizehint>
- <container>0</container>
- <sizepolicy>
- <hordata>5</hordata>
- <verdata>5</verdata>
- </sizepolicy>
- <pixmap>image0</pixmap>
- </customwidget>
-</customwidgets>
-<images>
- <image>
- <name>image0</name>
- <data format="XPM.GZ" length="646">789c6dd2c10ac2300c00d07bbf2234b7229d1ddec44f503c0ae2a154410f53d0ed20e2bf6bdb656dd6861dd23d9a66591b0587fd1654235ebded6f0edcd53e419d87ae7b1f4f9b8f906d0bfe012317426a70b07bdc2f3ec77f8ed6b89559061a0343d06a124cc105596482585094bc0ae599b04646c9018926491b2205e140c485cace25755c175d0a967b622ff900b8cc9c7d29af594ea722d589167f813aa852ba07d94b9dce296e883fe7bb163f23896753</data>
- </image>
-</images>
<tabstops>
<tabstop>accountLine</tabstop>
<tabstop>serverLine</tabstop>
<tabstop>portLine</tabstop>
<tabstop>sslBox</tabstop>
<tabstop>loginBox</tabstop>
<tabstop>userLine</tabstop>
<tabstop>passLine</tabstop>
</tabstops>
</UI>