summaryrefslogtreecommitdiff
path: root/noncore
authoralwin <alwin>2004-10-24 00:55:14 (UTC)
committer alwin <alwin>2004-10-24 00:55:14 (UTC)
commit9755bc969d17fc683791abc5c6fbd50fa3112486 (patch) (side-by-side diff)
tree0fdcf7b52b2f4627dd3efcd7330b116c4d9c4d98 /noncore
parent12eed25c7f18285f0e342d49fd3c41eb4b14e151 (diff)
downloadopie-9755bc969d17fc683791abc5c6fbd50fa3112486.zip
opie-9755bc969d17fc683791abc5c6fbd50fa3112486.tar.gz
opie-9755bc969d17fc683791abc5c6fbd50fa3112486.tar.bz2
new options for pop3 accounts
KATE eated a lot of last spaces in files some tryouts
Diffstat (limited to 'noncore') (more/less context) (ignore whitespace changes)
-rw-r--r--noncore/net/mail/accountview.cpp31
-rw-r--r--noncore/net/mail/editaccounts.cpp28
-rw-r--r--noncore/net/mail/libmailwrapper/genericwrapper.cpp13
-rw-r--r--noncore/net/mail/libmailwrapper/imapwrapper.cpp86
-rw-r--r--noncore/net/mail/libmailwrapper/mhwrapper.cpp60
-rw-r--r--noncore/net/mail/libmailwrapper/pop3wrapper.cpp21
-rw-r--r--noncore/net/mail/libmailwrapper/pop3wrapper.h2
-rw-r--r--noncore/net/mail/libmailwrapper/settings.cpp47
-rw-r--r--noncore/net/mail/libmailwrapper/settings.h7
-rw-r--r--noncore/net/mail/pop3configui.ui68
10 files changed, 238 insertions, 125 deletions
diff --git a/noncore/net/mail/accountview.cpp b/noncore/net/mail/accountview.cpp
index 662e555..0fe8475 100644
--- a/noncore/net/mail/accountview.cpp
+++ b/noncore/net/mail/accountview.cpp
@@ -54,53 +54,48 @@ void AccountView::slotHold(int button, QListViewItem * item,const QPoint&,int)
}
void AccountView::populate( QList<Account> list )
{
clear();
imapAccounts.clear();
mhAccounts.clear();
mhAccounts.append(new MHviewItem(AbstractMail::defaultLocalfolder(),this));
Account *it;
- for ( it = list.first(); it; it = list.next() )
- {
- if ( it->getType() == MAILLIB::A_IMAP )
- {
+ for ( it = list.first(); it; it = list.next() ) {
+ if ( it->getType() == MAILLIB::A_IMAP ) {
IMAPaccount *imap = static_cast<IMAPaccount *>(it);
- odebug << "added IMAP " + imap->getAccountName() << oendl;
+ odebug << "added IMAP " + imap->getAccountName() << oendl;
imapAccounts.append(new IMAPviewItem( imap, this ));
- }
- else if ( it->getType() == MAILLIB::A_POP3 )
- {
+ } else if ( it->getType() == MAILLIB::A_POP3 ) {
POP3account *pop3 = static_cast<POP3account *>(it);
- odebug << "added POP3 " + pop3->getAccountName() << oendl;
+ odebug << "added POP3 " + pop3->getAccountName() << oendl;
/* must not be hold 'cause it isn't required */
(void) new POP3viewItem( pop3, this );
- }
- else if ( it->getType() == MAILLIB::A_NNTP )
- {
+ } else if ( it->getType() == MAILLIB::A_NNTP ) {
NNTPaccount *nntp = static_cast<NNTPaccount *>(it);
- odebug << "added NNTP " + nntp->getAccountName() << oendl;
+ odebug << "added NNTP " + nntp->getAccountName() << oendl;
/* must not be hold 'cause it isn't required */
(void) new NNTPviewItem( nntp, this );
- }
- }
+ } else if ( it->getType() == MAILLIB::A_MH ) {
+ }
+ }
}
void AccountView::refresh(QListViewItem *item)
{
- odebug << "AccountView refresh..." << oendl;
+ odebug << "AccountView refresh..." << oendl;
if ( item )
{
m_currentItem = item;
QValueList<RecMailP> headerlist;
AccountViewItem *view = static_cast<AccountViewItem *>(item);
view->refresh(headerlist);
emit refreshMailview(headerlist);
}
}
void AccountView::refreshCurrent()
{
@@ -155,24 +150,24 @@ void AccountView::downloadMails(const FolderP&fromFolder,AbstractMail*fromWrappe
targetFolder = sels.currentFolder();
if ( (fromWrapper==targetMail && fromFolder->getName()==targetFolder) ||
targetFolder.isEmpty())
{
return;
}
if (sels.newFolder() && !targetMail->createMbox(targetFolder))
{
QMessageBox::critical(0,tr("Error creating new Folder"),
tr("<center>Error while creating<br>new folder - breaking.</center>"));
return;
}
- odebug << "Targetfolder: " << targetFolder.latin1() << "" << oendl;
- odebug << "Fromfolder: " << fromFolder->getName().latin1() << "" << oendl;
+ odebug << "Targetfolder: " << targetFolder.latin1() << "" << oendl;
+ odebug << "Fromfolder: " << fromFolder->getName().latin1() << "" << oendl;
fromWrapper->mvcpAllMails(fromFolder,targetFolder,targetMail,sels.moveMails());
refreshCurrent();
}
bool AccountView::currentisDraft()
{
AccountViewItem *view = static_cast<AccountViewItem *>(currentItem());
if (!view) return false;
return view->isDraftfolder();
}
diff --git a/noncore/net/mail/editaccounts.cpp b/noncore/net/mail/editaccounts.cpp
index b0ce57d..b7c137d 100644
--- a/noncore/net/mail/editaccounts.cpp
+++ b/noncore/net/mail/editaccounts.cpp
@@ -34,25 +34,25 @@ AccountListItem::AccountListItem( QListView *parent, Account *a)
ttext = "SMTP";
break;
default:
ttext = "UNKNOWN";
break;
}
setText( 1, ttext);
}
EditAccounts::EditAccounts( Settings *s, QWidget *parent, const char *name, bool modal, WFlags flags )
: EditAccountsUI( parent, name, modal, flags )
{
- odebug << "New Account Configuration Widget" << oendl;
+ odebug << "New Account Configuration Widget" << oendl;
settings = s;
mailList->addColumn( tr( "Account" ) );
mailList->addColumn( tr( "Type" ) );
newsList->addColumn( tr( "Account" ) );
connect( newMail, SIGNAL( clicked() ), SLOT( slotNewMail() ) );
connect( editMail, SIGNAL( clicked() ), SLOT( slotEditMail() ) );
connect( deleteMail, SIGNAL( clicked() ), SLOT( slotDeleteMail() ) );
connect( newNews, SIGNAL( clicked() ), SLOT( slotNewNews() ) );
connect( editNews, SIGNAL( clicked() ), SLOT( slotEditNews() ) );
@@ -74,88 +74,88 @@ void EditAccounts::slotFillLists()
{
(void) new AccountListItem( newsList, it );
}
else
{
(void) new AccountListItem( mailList, it );
}
}
}
void EditAccounts::slotNewMail()
{
- odebug << "New Mail Account" << oendl;
+ odebug << "New Mail Account" << oendl;
QString *selection = new QString();
SelectMailType selType( selection, this, 0, true );
selType.show();
if ( QDialog::Accepted == selType.exec() )
{
slotNewAccount( *selection );
}
}
void EditAccounts::slotNewAccount( const QString &type )
{
if ( type.compare( "IMAP" ) == 0 )
{
- odebug << "-> config IMAP" << oendl;
+ odebug << "-> config IMAP" << oendl;
IMAPaccount *account = new IMAPaccount();
IMAPconfig imap( account, this, 0, true );
if ( QDialog::Accepted == QPEApplication::execDialog( &imap ) )
{
settings->addAccount( account );
account->save();
slotFillLists();
}
else
{
account->remove();
}
}
else if ( type.compare( "POP3" ) == 0 )
{
- odebug << "-> config POP3" << oendl;
+ odebug << "-> config POP3" << oendl;
POP3account *account = new POP3account();
POP3config pop3( account, this, 0, true, WStyle_ContextHelp );
if ( QDialog::Accepted == QPEApplication::execDialog( &pop3 ) )
{
settings->addAccount( account );
account->save();
slotFillLists();
}
else
{
account->remove();
}
}
else if ( type.compare( "SMTP" ) == 0 )
{
- odebug << "-> config SMTP" << oendl;
+ odebug << "-> config SMTP" << oendl;
SMTPaccount *account = new SMTPaccount();
SMTPconfig smtp( account, this, 0, true, WStyle_ContextHelp );
if ( QDialog::Accepted == QPEApplication::execDialog( &smtp ) )
{
settings->addAccount( account );
account->save();
slotFillLists();
}
else
{
account->remove();
}
}
else if ( type.compare( "NNTP" ) == 0 )
{
- odebug << "-> config NNTP" << oendl;
+ odebug << "-> config NNTP" << oendl;
NNTPaccount *account = new NNTPaccount();
NNTPconfig nntp( account, this, 0, true, WStyle_ContextHelp );
if ( QDialog::Accepted == QPEApplication::execDialog( &nntp ) )
{
settings->addAccount( account );
account->save();
slotFillLists();
}
else
{
account->remove();
}
@@ -206,25 +206,25 @@ void EditAccounts::slotDeleteAccount( Account *account )
{
if ( QMessageBox::information( this, tr( "Question" ),
tr( "<p>Do you really want to delete the selected Account?</p>" ),
tr( "Yes" ), tr( "No" ) ) == 0 )
{
settings->delAccount( account );
slotFillLists();
}
}
void EditAccounts::slotEditMail()
{
- odebug << "Edit Mail Account" << oendl;
+ odebug << "Edit Mail Account" << oendl;
if ( !mailList->currentItem() )
{
QMessageBox::information( this, tr( "Error" ),
tr( "<p>Please select an account.</p>" ),
tr( "Ok" ) );
return;
}
Account *a = ((AccountListItem *) mailList->currentItem())->getAccount();
slotEditAccount( a );
}
@@ -235,46 +235,46 @@ void EditAccounts::slotDeleteMail()
QMessageBox::information( this, tr( "Error" ),
tr( "<p>Please select an account.</p>" ),
tr( "Ok" ) );
return;
}
Account *a = ((AccountListItem *) mailList->currentItem())->getAccount();
slotDeleteAccount( a );
}
void EditAccounts::slotNewNews()
{
- odebug << "New News Account" << oendl;
+ odebug << "New News Account" << oendl;
slotNewAccount( "NNTP" );
}
void EditAccounts::slotEditNews()
{
- odebug << "Edit News Account" << oendl;
+ odebug << "Edit News Account" << oendl;
if ( !newsList->currentItem() )
{
QMessageBox::information( this, tr( "Error" ),
tr( "<p>Please select an account.</p>" ),
tr( "Ok" ) );
return;
}
Account *a = ((AccountListItem *) newsList->currentItem())->getAccount();
slotEditAccount( a );
}
void EditAccounts::slotDeleteNews()
{
- odebug << "Delete News Account" << oendl;
+ odebug << "Delete News Account" << oendl;
if ( !newsList->currentItem() )
{
QMessageBox::information( this, tr( "Error" ),
tr( "<p>Please select an account.</p>" ),
tr( "Ok" ) );
return;
}
Account *a = ((AccountListItem *) newsList->currentItem())->getAccount();
slotDeleteAccount( a );
}
@@ -413,34 +413,38 @@ void POP3config::slotConnectionToggle( int index )
portLine->setText( POP3_PORT );
}
}
void POP3config::fillValues()
{
accountLine->setText( data->getAccountName() );
serverLine->setText( data->getServer() );
portLine->setText( data->getPort() );
ComboBox1->setCurrentItem( data->ConnectionType() );
userLine->setText( data->getUser() );
passLine->setText( data->getPassword() );
+ m_CheckSize->setChecked(data->getCheckMaxSize());
+ m_MailLimitBox->setValue(data->getMaxSize());
}
void POP3config::accept()
{
data->setAccountName( accountLine->text() );
data->setServer( serverLine->text() );
data->setPort( portLine->text() );
data->setConnectionType( ComboBox1->currentItem() );
data->setUser( userLine->text() );
data->setPassword( passLine->text() );
+ data->setMaxSize(m_MailLimitBox->value());
+ data->setCheckMaxSize(m_CheckSize->isChecked());
QDialog::accept();
}
/**
* SMTPconfig
*/
SMTPconfig::SMTPconfig( SMTPaccount *account, QWidget *parent, const char *name, bool modal, WFlags flags )
: SMTPconfigUI( parent, name, modal, flags )
{
data = account;
@@ -514,25 +518,25 @@ NNTPconfig::NNTPconfig( NNTPaccount *account, QWidget *parent, const char *name,
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 );
QStringList list = tmp->listAllNewsgroups();
-
+
ListViewGroups->clear();
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 );
}
}
}
void NNTPconfig::slotSSL( bool enabled )
@@ -572,25 +576,25 @@ void NNTPconfig::save()
data->setPort( portLine->text() );
data->setSSL( sslBox->isChecked() );
data->setLogin( loginBox->isChecked() );
data->setUser( userLine->text() );
data->setPassword( passLine->text() );
QListViewItemIterator list_it( ListViewGroups );
QStringList groupList;
for ( ; list_it.current(); ++list_it ) {
if ( ( (QCheckListItem*)list_it.current() )->isOn() ) {
- odebug << list_it.current()->text(0) << oendl;
+ odebug << list_it.current()->text(0) << oendl;
groupList.append( list_it.current()->text(0) );
}
}
data->setGroups( groupList );
}
void NNTPconfig::accept()
{
save();
QDialog::accept();
}
diff --git a/noncore/net/mail/libmailwrapper/genericwrapper.cpp b/noncore/net/mail/libmailwrapper/genericwrapper.cpp
index 1caa375..5ec9415 100644
--- a/noncore/net/mail/libmailwrapper/genericwrapper.cpp
+++ b/noncore/net/mail/libmailwrapper/genericwrapper.cpp
@@ -1,17 +1,19 @@
#include "genericwrapper.h"
#include <libetpan/libetpan.h>
#include "mailtypes.h"
#include <opie2/odebug.h>
+#include <qpe/timestring.h>
+#include <qdatetime.h>
using namespace Opie::Core;
Genericwrapper::Genericwrapper()
: AbstractMail()
{
bodyCache.clear();
m_storage = 0;
m_folder = 0;
}
Genericwrapper::~Genericwrapper()
{
@@ -234,30 +236,29 @@ RecBodyP Genericwrapper::parseMail( mailmessage * msg )
/* is bound to msg and will be freed there */
mailmime * mime=0;
RecBodyP body = new RecBody();
memset(&fields, 0, sizeof(struct mailmime_single_fields));
err = mailmessage_get_bodystructure(msg,&mime);
QValueList<int>recList;
traverseBody(body,msg,mime,recList);
return body;
}
QString Genericwrapper::parseDateTime( mailimf_date_time *date )
{
- char tmp[23];
-
- snprintf( tmp, 23, "%02i.%02i.%04i %02i:%02i:%02i %+05i",
- date->dt_day, date->dt_month, date->dt_year, date->dt_hour, date->dt_min, date->dt_sec, date->dt_zone );
-
- return QString( tmp );
+ QDateTime da(QDate(date->dt_year,date->dt_month,date->dt_day),QTime(date->dt_hour,date->dt_min,date->dt_sec));
+ QString timestring = TimeString::numberDateString(QDate(date->dt_year,date->dt_month,date->dt_day))+" ";
+ timestring+=TimeString::timeString(QTime(date->dt_hour,date->dt_min,date->dt_sec))+" ";
+ timestring.sprintf(timestring+" %+05i",date->dt_zone);
+ return timestring;
}
QString Genericwrapper::parseAddressList( mailimf_address_list *list )
{
QString result( "" );
bool first = true;
if (list == 0) return result;
for ( clistiter *current = clist_begin( list->ad_list ); current != NULL; current = current->next ) {
mailimf_address *addr = (mailimf_address *) current->data;
if ( !first ) {
diff --git a/noncore/net/mail/libmailwrapper/imapwrapper.cpp b/noncore/net/mail/libmailwrapper/imapwrapper.cpp
index 9b7c0e0..fe75a15 100644
--- a/noncore/net/mail/libmailwrapper/imapwrapper.cpp
+++ b/noncore/net/mail/libmailwrapper/imapwrapper.cpp
@@ -22,69 +22,69 @@ IMAPwrapper::~IMAPwrapper()
logout();
}
/* to avoid to often select statements in loops etc.
we trust that we are logged in and connection is established!*/
int IMAPwrapper::selectMbox(const QString&mbox)
{
if (mbox == m_Lastmbox) {
return MAILIMAP_NO_ERROR;
}
int err = mailimap_select( m_imap, (char*)mbox.latin1());
if ( err != MAILIMAP_NO_ERROR ) {
- odebug << "error selecting mailbox: " << m_imap->imap_response << "" << oendl;
+ odebug << "error selecting mailbox: " << m_imap->imap_response << "" << oendl;
m_Lastmbox = "";
return err;
}
m_Lastmbox = mbox;
return err;
}
void IMAPwrapper::imap_progress( size_t current, size_t maximum )
{
qApp->processEvents();
- odebug << "IMAP: " << current << " of " << maximum << "" << oendl;
+ odebug << "IMAP: " << current << " of " << maximum << "" << oendl;
}
bool IMAPwrapper::start_tls(bool force_tls)
{
int err;
bool try_tls;
mailimap_capability_data * cap_data = 0;
err = mailimap_capability(m_imap,&cap_data);
if (err != MAILIMAP_NO_ERROR) {
Global::statusMessage("error getting capabilities!");
- odebug << "error getting capabilities!" << oendl;
+ odebug << "error getting capabilities!" << oendl;
return false;
}
clistiter * cur;
for(cur = clist_begin(cap_data->cap_list) ; cur != NULL;cur = clist_next(cur)) {
struct mailimap_capability * cap;
cap = (struct mailimap_capability *)clist_content(cur);
if (cap->cap_type == MAILIMAP_CAPABILITY_NAME) {
if (strcasecmp(cap->cap_data.cap_name, "STARTTLS") == 0) {
try_tls = true;
break;
}
}
}
if (cap_data) {
mailimap_capability_data_free(cap_data);
}
if (try_tls) {
err = mailimap_starttls(m_imap);
if (err != MAILIMAP_NO_ERROR && force_tls) {
Global::statusMessage(tr("Server has no TLS support!"));
- odebug << "Server has no TLS support!" << oendl;
+ odebug << "Server has no TLS support!" << oendl;
try_tls = false;
} else {
mailstream_low * low;
mailstream_low * new_low;
low = mailstream_get_low(m_imap->imap_stream);
if (!low) {
try_tls = false;
} else {
int fd = mailstream_low_get_fd(low);
if (fd > -1 && (new_low = mailstream_low_ssl_open(fd))!=0) {
mailstream_low_free(low);
mailstream_set_low(m_imap->imap_stream, new_low);
@@ -117,48 +117,48 @@ void IMAPwrapper::login()
}
server = account->getServer().latin1();
port = account->getPort().toUInt();
if ( account->getUser().isEmpty() || account->getPassword().isEmpty() ) {
LoginDialog login( account->getUser(), account->getPassword(), NULL, 0, true );
login.show();
if ( QDialog::Accepted == login.exec() ) {
// ok
user = login.getUser().latin1();
pass = login.getPassword().latin1();
} else {
// cancel
- odebug << "IMAP: Login canceled" << oendl;
+ odebug << "IMAP: Login canceled" << oendl;
return;
}
} else {
user = account->getUser().latin1();
pass = account->getPassword().latin1();
}
m_imap = mailimap_new( 20, &imap_progress );
/* connect */
bool ssl = false;
bool try_tls = false;
bool force_tls = false;
if ( account->ConnectionType() == 2 ) {
ssl = true;
}
if (account->ConnectionType()==1) {
force_tls = true;
}
if ( ssl ) {
- odebug << "using ssl" << oendl;
+ odebug << "using ssl" << oendl;
err = mailimap_ssl_connect( m_imap, (char*)server, port );
} else {
err = mailimap_socket_connect( m_imap, (char*)server, port );
}
if ( err != MAILIMAP_NO_ERROR &&
err != MAILIMAP_NO_ERROR_AUTHENTICATED &&
err != MAILIMAP_NO_ERROR_NON_AUTHENTICATED ) {
QString failure = "";
if (err == MAILIMAP_ERROR_CONNECTION_REFUSED) {
failure="Connection refused";
} else {
@@ -168,25 +168,25 @@ void IMAPwrapper::login()
mailimap_free( m_imap );
m_imap = 0;
return;
}
if (!ssl) {
try_tls = start_tls(force_tls);
}
bool ok = true;
if (force_tls && !try_tls) {
Global::statusMessage(tr("Server has no TLS support!"));
- odebug << "Server has no TLS support!" << oendl;
+ odebug << "Server has no TLS support!" << oendl;
ok = false;
}
/* login */
if (ok) {
err = mailimap_login_simple( m_imap, (char*)user, (char*)pass );
if ( err != MAILIMAP_NO_ERROR ) {
Global::statusMessage(tr("error logging in imap server: %1").arg(m_imap->imap_response));
ok = false;
}
@@ -228,30 +228,34 @@ void IMAPwrapper::listMessages(const QString&mailbox,QValueList<Opie::Core::OSma
}
int last = m_imap->imap_selection_info->sel_exists;
if (last == 0) {
Global::statusMessage(tr("Mailbox has no mails"));
return;
} else {
}
/* the range has to start at 1!!! not with 0!!!! */
set = mailimap_set_new_interval( 1, last );
+
+
+ fetchType = mailimap_fetch_type_new_all();
+/*
fetchType = mailimap_fetch_type_new_fetch_att_list_empty();
mailimap_fetch_type_new_fetch_att_list_add(fetchType,mailimap_fetch_att_new_envelope());
mailimap_fetch_type_new_fetch_att_list_add(fetchType,mailimap_fetch_att_new_flags());
mailimap_fetch_type_new_fetch_att_list_add(fetchType,mailimap_fetch_att_new_internaldate());
mailimap_fetch_type_new_fetch_att_list_add(fetchType,mailimap_fetch_att_new_rfc822_size());
-
+*/
err = mailimap_fetch( m_imap, set, fetchType, &result );
mailimap_set_free( set );
mailimap_fetch_type_free( fetchType );
QString date,subject,from;
if ( err == MAILIMAP_NO_ERROR ) {
mailimap_msg_att * msg_att;
int i = 0;
for (current = clist_begin(result); current != 0; current=clist_next(current)) {
++i;
msg_att = (mailimap_msg_att*)current->data;
@@ -309,35 +313,35 @@ QValueList<Opie::Core::OSmartPointer<Folder> >* IMAPwrapper::listFolders()
if ( (bflags = list->mb_flag) ) {
selectable = !(bflags->mbf_type==MAILIMAP_MBX_LIST_FLAGS_SFLAG&&
bflags->mbf_sflag==MAILIMAP_MBX_LIST_SFLAG_NOSELECT);
for(cur_flag=clist_begin(bflags->mbf_oflags);cur_flag;cur_flag=clist_next(cur_flag)) {
if ( ((mailimap_mbx_list_oflag*)cur_flag->data)->of_type==MAILIMAP_MBX_LIST_OFLAG_NOINFERIORS) {
no_inferiors = true;
}
}
}
folders->append( new IMAPFolder(temp,del,selectable,no_inferiors,account->getPrefix()));
}
} else {
- odebug << "error fetching folders: " << m_imap->imap_response << "" << oendl;
+ odebug << "error fetching folders: " << m_imap->imap_response << "" << oendl;
}
mailimap_list_result_free( result );
/*
* second stage - get the other then inbox folders
*/
mask = "*" ;
path = account->getPrefix().latin1();
if (!path) path = "";
- odebug << path << oendl;
+ odebug << path << oendl;
err = mailimap_list( m_imap, (char*)path, (char*)mask, &result );
if ( err == MAILIMAP_NO_ERROR ) {
current = result->first;
for ( current=clist_begin(result);current!=NULL;current=clist_next(current)) {
no_inferiors = false;
list = (mailimap_mailbox_list *) current->data;
// it is better use the deep copy mechanism of qt itself
// instead of using strdup!
temp = list->mb_name;
if (temp.lower()=="inbox")
continue;
if (temp.lower()==account->getPrefix().lower())
@@ -346,48 +350,48 @@ QValueList<Opie::Core::OSmartPointer<Folder> >* IMAPwrapper::listFolders()
selectable = !(bflags->mbf_type==MAILIMAP_MBX_LIST_FLAGS_SFLAG&&
bflags->mbf_sflag==MAILIMAP_MBX_LIST_SFLAG_NOSELECT);
for(cur_flag=clist_begin(bflags->mbf_oflags);cur_flag;cur_flag=clist_next(cur_flag)) {
if ( ((mailimap_mbx_list_oflag*)cur_flag->data)->of_type==MAILIMAP_MBX_LIST_OFLAG_NOINFERIORS) {
no_inferiors = true;
}
}
}
del = list->mb_delimiter;
folders->append(new IMAPFolder(temp,del,selectable,no_inferiors,account->getPrefix()));
}
} else {
- odebug << "error fetching folders " << m_imap->imap_response << "" << oendl;
+ odebug << "error fetching folders " << m_imap->imap_response << "" << oendl;
}
if (result) mailimap_list_result_free( result );
return folders;
}
RecMail*IMAPwrapper::parse_list_result(mailimap_msg_att* m_att)
{
RecMail * m = 0;
mailimap_msg_att_item *item=0;
clistcell *current,*c,*cf;
mailimap_msg_att_dynamic*flist;
mailimap_flag_fetch*cflag;
int size;
QBitArray mFlags(7);
QStringList addresslist;
if (!m_att) {
return m;
}
+ size = 0;
m = new RecMail();
for (c = clist_begin(m_att->att_list); c!=NULL;c=clist_next(c) ) {
current = c;
- size = 0;
item = (mailimap_msg_att_item*)current->data;
if (item->att_type!=MAILIMAP_MSG_ATT_ITEM_STATIC) {
flist = (mailimap_msg_att_dynamic*)item->att_data.att_dyn;
if (!flist->att_list) {
continue;
}
cf = flist->att_list->first;
for (cf = clist_begin(flist->att_list); cf!=NULL; cf = clist_next(cf)) {
cflag = (mailimap_flag_fetch*)cf->data;
if (cflag->fl_type==MAILIMAP_FLAG_FETCH_OTHER && cflag->fl_flag!=0) {
switch (cflag->fl_flag->fl_type) {
case MAILIMAP_FLAG_ANSWERED: /* \Answered flag */
@@ -456,41 +460,47 @@ RecMail*IMAPwrapper::parse_list_result(mailimap_msg_att* m_att)
while (h.length()>0 && h[h.length()-1]=='>') {
h.remove(h.length()-1,1);
}
if (h.length()>0) {
m->setInreply(QStringList(h));
}
}
if (head->env_message_id) {
m->setMsgid(QString(head->env_message_id));
}
} else if (item->att_data.att_static->att_type==MAILIMAP_MSG_ATT_INTERNALDATE) {
#if 0
- mailimap_date_time*d = item->att_data.att_static->att_data.att_internal_date;
+ mailimap_date_time*date = item->att_data.att_static->att_data.att_internal_date;
+ if (date->dt_sec>60 || date->dt_sec<0) date->dt_sec=0;
+ //QDateTime da(QDate(d->dt_year,date->dt_month,date->dt_day),QTime(date->dt_hour,date->dt_min,date->dt_sec));
+ QString timestring = TimeString::numberDateString(QDate(date->dt_year,date->dt_month,date->dt_day))+" ";
+ timestring+=TimeString::timeString(QTime(date->dt_hour,date->dt_min,date->dt_sec))+" ";
+ timestring.sprintf(timestring+" %+05i",date->dt_zone);
+ m->setDate(timestring);
QDateTime da(QDate(d->dt_year,d->dt_month,d->dt_day),QTime(d->dt_hour,d->dt_min,d->dt_sec));
- odebug << "" << d->dt_year << " " << d->dt_month << " " << d->dt_day << " - " << d->dt_hour << " " << d->dt_min << " " << d->dt_sec << "" << oendl;
- odebug << da.toString() << oendl;
+ odebug << "" << d->dt_year << " " << d->dt_month << " " << d->dt_day << " - " << d->dt_hour << " " << d->dt_min << " " << d->dt_sec << "" << oendl;
+ odebug << da.toString() << oendl;
#endif
} else if (item->att_data.att_static->att_type==MAILIMAP_MSG_ATT_RFC822_SIZE) {
- size = item->att_data.att_static->att_data.att_rfc822_size;
+ //size = item->att_data.att_static->att_data.att_rfc822_size;
+ m->setMsgsize(item->att_data.att_static->att_data.att_rfc822_size);
}
}
/* msg is already deleted */
if (mFlags.testBit(FLAG_DELETED) && m) {
delete m;
m = 0;
}
if (m) {
m->setFlags(mFlags);
- m->setMsgsize(size);
}
return m;
}
RecBodyP IMAPwrapper::fetchBody(const RecMailP&mail)
{
RecBodyP body = new RecBody();
const char *mb;
int err = MAILIMAP_NO_ERROR;
clist *result = 0;
clistcell *current;
mailimap_fetch_att *fetchAtt = 0;
@@ -516,25 +526,25 @@ RecBodyP IMAPwrapper::fetchBody(const RecMailP&mail)
err = mailimap_fetch( m_imap, set, fetchType, &result );
mailimap_set_free( set );
mailimap_fetch_type_free( fetchType );
if (err == MAILIMAP_NO_ERROR && (current=clist_begin(result)) ) {
mailimap_msg_att * msg_att;
msg_att = (mailimap_msg_att*)current->data;
mailimap_msg_att_item*item = (mailimap_msg_att_item*)msg_att->att_list->first->data;
QValueList<int> path;
body_desc = item->att_data.att_static->att_data.att_body;
traverseBody(mail,body_desc,body,0,path);
} else {
- odebug << "error fetching body: " << m_imap->imap_response << "" << oendl;
+ odebug << "error fetching body: " << m_imap->imap_response << "" << oendl;
}
if (result) mailimap_fetch_list_free(result);
return body;
}
QStringList IMAPwrapper::address_list_to_stringlist(clist*list)
{
QStringList l;
QString from;
bool named_from;
clistcell *current = NULL;
mailimap_address * current_address=NULL;
@@ -628,25 +638,25 @@ encodedString*IMAPwrapper::fetchRawPart(const RecMailP&mail,const QValueList<int
for(cur = clist_begin(msg_att->att_list) ; cur != NULL ; cur = clist_next(cur)) {
msg_att_item = (mailimap_msg_att_item*)clist_content(cur);
if (msg_att_item->att_type == MAILIMAP_MSG_ATT_ITEM_STATIC) {
if (msg_att_item->att_data.att_static->att_type == MAILIMAP_MSG_ATT_BODY_SECTION) {
char*text = msg_att_item->att_data.att_static->att_data.att_body_section->sec_body_part;
/* detach - we take over the content */
msg_att_item->att_data.att_static->att_data.att_body_section->sec_body_part = 0L;
res->setContent(text,msg_att_item->att_data.att_static->att_data.att_body_section->sec_length);
}
}
}
} else {
- odebug << "error fetching text: " << m_imap->imap_response << "" << oendl;
+ odebug << "error fetching text: " << m_imap->imap_response << "" << oendl;
}
if (result) mailimap_fetch_list_free(result);
return res;
}
/* current_recursion is for recursive calls.
current_count means the position inside the internal loop! */
void IMAPwrapper::traverseBody(const RecMailP&mail,mailimap_body*body,RecBodyP&target_body,
int current_recursion,QValueList<int>recList,int current_count)
{
if (!body || current_recursion>=10) {
return;
@@ -655,25 +665,25 @@ void IMAPwrapper::traverseBody(const RecMailP&mail,mailimap_body*body,RecBodyP&t
case MAILIMAP_BODY_1PART:
{
QValueList<int>countlist = recList;
countlist.append(current_count);
RecPartP currentPart = new RecPart();
mailimap_body_type_1part*part1 = body->bd_data.bd_body_1part;
QString id("");
currentPart->setPositionlist(countlist);
for (unsigned int j = 0; j < countlist.count();++j) {
id+=(j>0?" ":"");
id+=QString("%1").arg(countlist[j]);
}
- odebug << "ID = " << id.latin1() << "" << oendl;
+ odebug << "ID = " << id.latin1() << "" << oendl;
currentPart->setIdentifier(id);
fillSinglePart(currentPart,part1);
/* important: Check for is NULL 'cause a body can be empty!
And we put it only into the mail if it is the FIRST part */
if (part1->bd_type==MAILIMAP_BODY_TYPE_1PART_TEXT && target_body->Bodytext().isNull() && countlist[0]==1) {
QString body_text = fetchTextPart(mail,countlist,true,currentPart->Encoding());
target_body->setDescription(currentPart);
target_body->setBodytext(body_text);
if (countlist.count()>1) {
target_body->addPart(currentPart);
}
} else {
@@ -696,25 +706,25 @@ void IMAPwrapper::traverseBody(const RecMailP&mail,mailimap_body*body,RecBodyP&t
if (current_body->bd_type==MAILIMAP_BODY_MPART) {
RecPartP targetPart = new RecPart();
targetPart->setType("multipart");
fillMultiPart(targetPart,mailDescription);
countlist.append(current_count);
targetPart->setPositionlist(countlist);
target_body->addPart(targetPart);
QString id("");
for (unsigned int j = 0; j < countlist.count();++j) {
id+=(j>0?" ":"");
id+=QString("%1").arg(countlist[j]);
}
- odebug << "ID(mpart) = " << id.latin1() << "" << oendl;
+ odebug << "ID(mpart) = " << id.latin1() << "" << oendl;
}
traverseBody(mail,current_body,target_body,current_recursion+1,countlist,ccount);
if (current_body->bd_type==MAILIMAP_BODY_MPART) {
countlist = recList;
}
++ccount;
}
}
break;
default:
break;
}
@@ -740,37 +750,37 @@ void IMAPwrapper::fillSinglePart(RecPartP&target_part,mailimap_body_type_1part*D
default:
break;
}
}
void IMAPwrapper::fillSingleTextPart(RecPartP&target_part,mailimap_body_type_text*which)
{
if (!which) {
return;
}
QString sub;
sub = which->bd_media_text;
- odebug << "Type= text/" << which->bd_media_text << "" << oendl;
+ odebug << "Type= text/" << which->bd_media_text << "" << oendl;
target_part->setSubtype(sub.lower());
target_part->setLines(which->bd_lines);
fillBodyFields(target_part,which->bd_fields);
}
void IMAPwrapper::fillSingleMsgPart(RecPartP&target_part,mailimap_body_type_msg*which)
{
if (!which) {
return;
}
target_part->setSubtype("rfc822");
- odebug << "Message part" << oendl;
+ odebug << "Message part" << oendl;
/* we set this type to text/plain */
target_part->setLines(which->bd_lines);
fillBodyFields(target_part,which->bd_fields);
}
void IMAPwrapper::fillMultiPart(RecPartP&target_part,mailimap_body_type_mpart*which)
{
if (!which) return;
QString sub = which->bd_media_subtype;
target_part->setSubtype(sub.lower());
if (which->bd_ext_mpart && which->bd_ext_mpart->bd_parameter && which->bd_ext_mpart->bd_parameter->pa_list) {
clistcell*cur = 0;
@@ -811,25 +821,25 @@ void IMAPwrapper::fillSingleBasicPart(RecPartP&target_part,mailimap_body_type_ba
if (which->bd_media_basic->med_basic_type) {
type = which->bd_media_basic->med_basic_type;
} else {
type = "";
}
break;
}
if (which->bd_media_basic->med_subtype) {
sub = which->bd_media_basic->med_subtype;
} else {
sub = "";
}
- odebug << "Type = " << type.latin1() << "/" << sub.latin1() << "" << oendl;
+ odebug << "Type = " << type.latin1() << "/" << sub.latin1() << "" << oendl;
target_part->setType(type.lower());
target_part->setSubtype(sub.lower());
fillBodyFields(target_part,which->bd_fields);
}
void IMAPwrapper::fillBodyFields(RecPartP&target_part,mailimap_body_fields*which)
{
if (!which) return;
if (which->bd_parameter && which->bd_parameter->pa_list && which->bd_parameter->pa_list->count>0) {
clistcell*cur;
mailimap_single_body_fld_param*param=0;
for (cur = clist_begin(which->bd_parameter->pa_list);cur!=NULL;cur=clist_next(cur)) {
@@ -887,34 +897,34 @@ void IMAPwrapper::deleteMail(const RecMailP&mail)
if ( err != MAILIMAP_NO_ERROR ) {
return;
}
flist = mailimap_flag_list_new_empty();
mailimap_flag_list_add(flist,mailimap_flag_new_deleted());
store_flags = mailimap_store_att_flags_new_set_flags(flist);
set = mailimap_set_new_single(mail->getNumber());
err = mailimap_store(m_imap,set,store_flags);
mailimap_set_free( set );
mailimap_store_att_flags_free(store_flags);
if (err != MAILIMAP_NO_ERROR) {
- odebug << "error deleting mail: " << m_imap->imap_response << "" << oendl;
+ odebug << "error deleting mail: " << m_imap->imap_response << "" << oendl;
return;
}
- odebug << "deleting mail: " << m_imap->imap_response << "" << oendl;
+ odebug << "deleting mail: " << m_imap->imap_response << "" << oendl;
/* should we realy do that at this moment? */
err = mailimap_expunge(m_imap);
if (err != MAILIMAP_NO_ERROR) {
- odebug << "error deleting mail: " << m_imap->imap_response << "" << oendl;
+ odebug << "error deleting mail: " << m_imap->imap_response << "" << oendl;
}
- odebug << "Delete successfull " << m_imap->imap_response << "" << oendl;
+ odebug << "Delete successfull " << m_imap->imap_response << "" << oendl;
}
void IMAPwrapper::answeredMail(const RecMailP&mail)
{
mailimap_flag_list*flist;
mailimap_set *set;
mailimap_store_att_flags * store_flags;
int err;
login();
if (!m_imap) {
return;
}
@@ -922,25 +932,25 @@ void IMAPwrapper::answeredMail(const RecMailP&mail)
if ( err != MAILIMAP_NO_ERROR ) {
return;
}
flist = mailimap_flag_list_new_empty();
mailimap_flag_list_add(flist,mailimap_flag_new_answered());
store_flags = mailimap_store_att_flags_new_add_flags(flist);
set = mailimap_set_new_single(mail->getNumber());
err = mailimap_store(m_imap,set,store_flags);
mailimap_set_free( set );
mailimap_store_att_flags_free(store_flags);
if (err != MAILIMAP_NO_ERROR) {
- odebug << "error marking mail: " << m_imap->imap_response << "" << oendl;
+ odebug << "error marking mail: " << m_imap->imap_response << "" << oendl;
return;
}
}
QString IMAPwrapper::fetchTextPart(const RecMailP&mail,const QValueList<int>&path,bool internal_call,const QString&enc)
{
QString body("");
encodedString*res = fetchRawPart(mail,path,internal_call);
encodedString*r = decode_String(res,enc);
delete res;
if (r) {
if (r->Length()>0) {
@@ -990,57 +1000,57 @@ int IMAPwrapper::deleteAllMail(const FolderP&folder)
}
flist = mailimap_flag_list_new_empty();
mailimap_flag_list_add(flist,mailimap_flag_new_deleted());
store_flags = mailimap_store_att_flags_new_set_flags(flist);
set = mailimap_set_new_interval( 1, last );
err = mailimap_store(m_imap,set,store_flags);
mailimap_set_free( set );
mailimap_store_att_flags_free(store_flags);
if (err != MAILIMAP_NO_ERROR) {
Global::statusMessage(tr("error deleting mail: %s").arg(m_imap->imap_response));
return 0;
}
- odebug << "deleting mail: " << m_imap->imap_response << "" << oendl;
+ odebug << "deleting mail: " << m_imap->imap_response << "" << oendl;
/* should we realy do that at this moment? */
err = mailimap_expunge(m_imap);
if (err != MAILIMAP_NO_ERROR) {
Global::statusMessage(tr("error deleting mail: %s").arg(m_imap->imap_response));
return 0;
}
- odebug << "Delete successfull " << m_imap->imap_response << "" << oendl;
+ odebug << "Delete successfull " << m_imap->imap_response << "" << oendl;
return 1;
}
int IMAPwrapper::createMbox(const QString&folder,const FolderP&parentfolder,const QString& delemiter,bool getsubfolder)
{
if (folder.length()==0) return 0;
login();
if (!m_imap) {return 0;}
QString pre = account->getPrefix();
if (delemiter.length()>0 && pre.findRev(delemiter)!=pre.length()-1) {
pre+=delemiter;
}
if (parentfolder) {
pre += parentfolder->getDisplayName()+delemiter;
}
pre+=folder;
if (getsubfolder) {
if (delemiter.length()>0) {
pre+=delemiter;
} else {
Global::statusMessage(tr("Cannot create folder %1 for holding subfolders").arg(pre));
return 0;
}
}
- odebug << "Creating " << pre.latin1() << "" << oendl;
+ odebug << "Creating " << pre.latin1() << "" << oendl;
int res = mailimap_create(m_imap,pre.latin1());
if (res != MAILIMAP_NO_ERROR) {
Global::statusMessage(tr("%1").arg(m_imap->imap_response));
return 0;
}
return 1;
}
int IMAPwrapper::deleteMbox(const FolderP&folder)
{
if (!folder) return 0;
login();
@@ -1081,108 +1091,108 @@ void IMAPwrapper::statusFolder(folderStat&target_stat,const QString & mailbox)
case MAILIMAP_STATUS_ATT_MESSAGES:
target_stat.message_count = status_info->st_value;
break;
case MAILIMAP_STATUS_ATT_RECENT:
target_stat.message_recent = status_info->st_value;
break;
case MAILIMAP_STATUS_ATT_UNSEEN:
target_stat.message_unseen = status_info->st_value;
break;
}
}
} else {
- odebug << "Error retrieving status" << oendl;
+ odebug << "Error retrieving status" << oendl;
}
if (status) mailimap_mailbox_data_status_free(status);
if (att_list) mailimap_status_att_list_free(att_list);
}
void IMAPwrapper::storeMessage(const char*msg,size_t length, const QString&folder)
{
login();
if (!m_imap) return;
if (!msg) return;
int r = mailimap_append(m_imap,(char*)folder.latin1(),0,0,msg,length);
if (r != MAILIMAP_NO_ERROR) {
Global::statusMessage("Error storing mail!");
}
}
MAILLIB::ATYPE IMAPwrapper::getType()const
{
return account->getType();
}
const QString&IMAPwrapper::getName()const
{
- odebug << "Get name: " << account->getAccountName().latin1() << "" << oendl;
+ odebug << "Get name: " << account->getAccountName().latin1() << "" << oendl;
return account->getAccountName();
}
encodedString* IMAPwrapper::fetchRawBody(const RecMailP&mail)
{
// dummy
QValueList<int> path;
return fetchRawPart(mail,path,false);
}
void IMAPwrapper::mvcpAllMails(const FolderP&fromFolder,
const QString&targetFolder,AbstractMail*targetWrapper,bool moveit)
{
if (targetWrapper != this) {
AbstractMail::mvcpAllMails(fromFolder,targetFolder,targetWrapper,moveit);
- odebug << "Using generic" << oendl;
+ odebug << "Using generic" << oendl;
return;
}
mailimap_set *set = 0;
login();
if (!m_imap) {
return;
}
int err = selectMbox(fromFolder->getName());
if ( err != MAILIMAP_NO_ERROR ) {
return;
}
int last = m_imap->imap_selection_info->sel_exists;
set = mailimap_set_new_interval( 1, last );
err = mailimap_copy(m_imap,set,targetFolder.latin1());
mailimap_set_free( set );
if ( err != MAILIMAP_NO_ERROR ) {
QString error_msg = tr("error copy mails: %1").arg(m_imap->imap_response);
Global::statusMessage(error_msg);
- odebug << error_msg << oendl;
+ odebug << error_msg << oendl;
return;
}
if (moveit) {
deleteAllMail(fromFolder);
}
}
void IMAPwrapper::mvcpMail(const RecMailP&mail,const QString&targetFolder,AbstractMail*targetWrapper,bool moveit)
{
if (targetWrapper != this) {
- odebug << "Using generic" << oendl;
+ odebug << "Using generic" << oendl;
AbstractMail::mvcpMail(mail,targetFolder,targetWrapper,moveit);
return;
}
mailimap_set *set = 0;
login();
if (!m_imap) {
return;
}
int err = selectMbox(mail->getMbox());
if ( err != MAILIMAP_NO_ERROR ) {
return;
}
set = mailimap_set_new_single(mail->getNumber());
err = mailimap_copy(m_imap,set,targetFolder.latin1());
mailimap_set_free( set );
if ( err != MAILIMAP_NO_ERROR ) {
QString error_msg = tr("error copy mail: %1").arg(m_imap->imap_response);
Global::statusMessage(error_msg);
- odebug << error_msg << oendl;
+ odebug << error_msg << oendl;
return;
}
if (moveit) {
deleteMail(mail);
}
}
diff --git a/noncore/net/mail/libmailwrapper/mhwrapper.cpp b/noncore/net/mail/libmailwrapper/mhwrapper.cpp
index 403afcf..765a21c 100644
--- a/noncore/net/mail/libmailwrapper/mhwrapper.cpp
+++ b/noncore/net/mail/libmailwrapper/mhwrapper.cpp
@@ -8,50 +8,50 @@
#include <qpe/global.h>
#include <opie2/oprocess.h>
#include <opie2/odebug.h>
using namespace Opie::Core;
MHwrapper::MHwrapper(const QString & mbox_dir,const QString&mbox_name)
: Genericwrapper(),MHPath(mbox_dir),MHName(mbox_name)
{
if (MHPath.length()>0) {
if (MHPath[MHPath.length()-1]=='/') {
MHPath=MHPath.left(MHPath.length()-1);
}
- odebug << MHPath << oendl;
+ odebug << MHPath << oendl;
QDir dir(MHPath);
if (!dir.exists()) {
dir.mkdir(MHPath);
}
init_storage();
}
}
void MHwrapper::init_storage()
{
int r;
QString pre = MHPath;
if (!m_storage) {
m_storage = mailstorage_new(NULL);
r = mh_mailstorage_init(m_storage,(char*)pre.latin1(),0,0,0);
if (r != MAIL_NO_ERROR) {
- odebug << "error initializing storage" << oendl;
+ odebug << "error initializing storage" << oendl;
mailstorage_free(m_storage);
m_storage = 0;
return;
}
}
r = mailstorage_connect(m_storage);
if (r!=MAIL_NO_ERROR) {
- odebug << "error connecting storage" << oendl;
+ odebug << "error connecting storage" << oendl;
mailstorage_free(m_storage);
m_storage = 0;
}
}
void MHwrapper::clean_storage()
{
if (m_storage) {
mailstorage_disconnect(m_storage);
mailstorage_free(m_storage);
m_storage = 0;
}
@@ -62,105 +62,105 @@ MHwrapper::~MHwrapper()
clean_storage();
}
void MHwrapper::listMessages(const QString & mailbox, QValueList<Opie::Core::OSmartPointer<RecMail> > &target )
{
init_storage();
if (!m_storage) {
return;
}
QString f = buildPath(mailbox);
int r = mailsession_select_folder(m_storage->sto_session,(char*)f.latin1());
if (r!=MAIL_NO_ERROR) {
- odebug << "listMessages: error selecting folder!" << oendl;
+ odebug << "listMessages: error selecting folder!" << oendl;
return;
}
parseList(target,m_storage->sto_session,f);
Global::statusMessage(tr("Mailbox has %1 mail(s)").arg(target.count()));
}
QValueList<Opie::Core::OSmartPointer<Folder> >* MHwrapper::listFolders()
{
QValueList<Opie::Core::OSmartPointer<Folder> >* folders = new QValueList<Opie::Core::OSmartPointer<Folder> >();
/* this is needed! */
if (m_storage) mailstorage_disconnect(m_storage);
init_storage();
if (!m_storage) {
return folders;
}
mail_list*flist = 0;
clistcell*current=0;
int r = mailsession_list_folders(m_storage->sto_session,NULL,&flist);
if (r != MAIL_NO_ERROR || !flist) {
- odebug << "error getting folder list" << oendl;
+ odebug << "error getting folder list" << oendl;
return folders;
}
for (current=clist_begin(flist->mb_list);current!=0;current=clist_next(current)) {
QString t = (char*)current->data;
t.replace(0,MHPath.length(),"");
folders->append(new MHFolder(t,MHPath));
}
mail_list_free(flist);
return folders;
}
void MHwrapper::deleteMail(const RecMailP&mail)
{
init_storage();
if (!m_storage) {
return;
}
int r = mailsession_select_folder(m_storage->sto_session,(char*)mail->getMbox().latin1());
if (r!=MAIL_NO_ERROR) {
- odebug << "error selecting folder!" << oendl;
+ odebug << "error selecting folder!" << oendl;
return;
}
r = mailsession_remove_message(m_storage->sto_session,mail->getNumber());
if (r != MAIL_NO_ERROR) {
- odebug << "error deleting mail" << oendl;
+ odebug << "error deleting mail" << oendl;
}
}
void MHwrapper::answeredMail(const RecMailP&)
{
}
RecBodyP MHwrapper::fetchBody( const RecMailP &mail )
{
RecBodyP body = new RecBody();
init_storage();
if (!m_storage) {
return body;
}
mailmessage * msg;
char*data=0;
/* mail should hold the complete path! */
int r = mailsession_select_folder(m_storage->sto_session,(char*)mail->getMbox().latin1());
if (r != MAIL_NO_ERROR) {
return body;
}
r = mailsession_get_message(m_storage->sto_session, mail->getNumber(), &msg);
if (r != MAIL_NO_ERROR) {
- odebug << "Error fetching mail " << mail->getNumber() << "" << oendl;
+ odebug << "Error fetching mail " << mail->getNumber() << "" << oendl;
return body;
}
body = parseMail(msg);
mailmessage_fetch_result_free(msg,data);
return body;
}
void MHwrapper::mbox_progress( size_t current, size_t maximum )
{
- odebug << "MH " << current << " von " << maximum << "" << oendl;
+ odebug << "MH " << current << " von " << maximum << "" << oendl;
}
QString MHwrapper::buildPath(const QString&p)
{
QString f="";
if (p.length()==0||p=="/")
return MHPath;
if (!p.startsWith(MHPath)) {
f+=MHPath;
}
if (!p.startsWith("/")) {
f+="/";
@@ -175,119 +175,119 @@ int MHwrapper::createMbox(const QString&folder,const FolderP&pfolder,const QStri
if (!m_storage) {
return 0;
}
QString f;
if (!pfolder) {
// toplevel folder
f = buildPath(folder);
} else {
f = pfolder->getName();
f+="/";
f+=folder;
}
- odebug << f << oendl;
+ odebug << f << oendl;
int r = mailsession_create_folder(m_storage->sto_session,(char*)f.latin1());
if (r != MAIL_NO_ERROR) {
- odebug << "error creating folder " << r << "" << oendl;
+ odebug << "error creating folder " << r << "" << oendl;
return 0;
}
- odebug << "Folder created" << oendl;
+ odebug << "Folder created" << oendl;
return 1;
}
void MHwrapper::storeMessage(const char*msg,size_t length, const QString&Folder)
{
init_storage();
if (!m_storage) {
return;
}
QString f = buildPath(Folder);
int r = mailsession_select_folder(m_storage->sto_session,(char*)f.latin1());
if (r!=MAIL_NO_ERROR) {
- odebug << "error selecting folder!" << oendl;
+ odebug << "error selecting folder!" << oendl;
return;
}
r = mailsession_append_message(m_storage->sto_session,(char*)msg,length);
if (r!=MAIL_NO_ERROR) {
- odebug << "error storing mail" << oendl;
+ odebug << "error storing mail" << oendl;
}
return;
}
encodedString* MHwrapper::fetchRawBody(const RecMailP&mail)
{
encodedString*result = 0;
init_storage();
if (!m_storage) {
return result;
}
mailmessage * msg = 0;
char*data=0;
size_t size;
int r = mailsession_select_folder(m_storage->sto_session,(char*)mail->getMbox().latin1());
if (r!=MAIL_NO_ERROR) {
- odebug << "error selecting folder!" << oendl;
+ odebug << "error selecting folder!" << oendl;
return result;
}
r = mailsession_get_message(m_storage->sto_session, mail->getNumber(), &msg);
if (r != MAIL_NO_ERROR) {
Global::statusMessage(tr("Error fetching mail %i").arg(mail->getNumber()));
return 0;
}
r = mailmessage_fetch(msg,&data,&size);
if (r != MAIL_NO_ERROR) {
Global::statusMessage(tr("Error fetching mail %i").arg(mail->getNumber()));
if (msg) mailmessage_free(msg);
return 0;
}
result = new encodedString(data,size);
if (msg) mailmessage_free(msg);
return result;
}
void MHwrapper::deleteMails(const QString & mailbox,const QValueList<RecMailP> &target)
{
QString f = buildPath(mailbox);
int r = mailsession_select_folder(m_storage->sto_session,(char*)f.latin1());
if (r!=MAIL_NO_ERROR) {
- odebug << "deleteMails: error selecting folder!" << oendl;
+ odebug << "deleteMails: error selecting folder!" << oendl;
return;
}
QValueList<RecMailP>::ConstIterator it;
for (it=target.begin(); it!=target.end();++it) {
r = mailsession_remove_message(m_storage->sto_session,(*it)->getNumber());
if (r != MAIL_NO_ERROR) {
- odebug << "error deleting mail" << oendl;
+ odebug << "error deleting mail" << oendl;
break;
}
}
}
int MHwrapper::deleteAllMail(const FolderP&tfolder)
{
init_storage();
if (!m_storage) {
return 0;
}
int res = 1;
if (!tfolder) return 0;
int r = mailsession_select_folder(m_storage->sto_session,(char*)tfolder->getName().latin1());
if (r!=MAIL_NO_ERROR) {
- odebug << "error selecting folder!" << oendl;
+ odebug << "error selecting folder!" << oendl;
return 0;
}
mailmessage_list*l=0;
r = mailsession_get_messages_list(m_storage->sto_session,&l);
if (r != MAIL_NO_ERROR) {
- odebug << "Error message list" << oendl;
+ odebug << "Error message list" << oendl;
res = 0;
}
unsigned j = 0;
for(unsigned int i = 0 ; l!= 0 && res==1 && i < carray_count(l->msg_tab) ; ++i) {
mailmessage * msg;
msg = (mailmessage*)carray_get(l->msg_tab, i);
j = msg->msg_index;
r = mailsession_remove_message(m_storage->sto_session,j);
if (r != MAIL_NO_ERROR) {
Global::statusMessage(tr("Error deleting mail %1").arg(i+1));
res = 0;
break;
@@ -300,46 +300,46 @@ int MHwrapper::deleteAllMail(const FolderP&tfolder)
int MHwrapper::deleteMbox(const FolderP&tfolder)
{
init_storage();
if (!m_storage) {
return 0;
}
if (!tfolder) return 0;
if (tfolder->getName()=="/" || tfolder->getName().isEmpty()) return 0;
int r = mailsession_delete_folder(m_storage->sto_session,(char*)tfolder->getName().latin1());
if (r != MAIL_NO_ERROR) {
- odebug << "error deleting mail box" << oendl;
+ odebug << "error deleting mail box" << oendl;
return 0;
}
QString cmd = "rm -rf "+tfolder->getName();
QStringList command;
command << "/bin/sh";
command << "-c";
command << cmd.latin1();
OProcess *process = new OProcess();
connect(process, SIGNAL(processExited(Opie::Core::OProcess*)),
this, SLOT( processEnded(Opie::Core::OProcess*)));
connect(process, SIGNAL( receivedStderr(Opie::Core::OProcess*,char*,int)),
this, SLOT( oprocessStderr(Opie::Core::OProcess*,char*,int)));
*process << command;
removeMboxfailed = false;
if(!process->start(OProcess::Block, OProcess::All) ) {
- odebug << "could not start process" << oendl;
+ odebug << "could not start process" << oendl;
return 0;
}
- odebug << "mail box deleted" << oendl;
+ odebug << "mail box deleted" << oendl;
return 1;
}
void MHwrapper::processEnded(OProcess *p)
{
if (p) delete p;
}
void MHwrapper::oprocessStderr(OProcess*, char *buffer, int )
{
QString lineStr = buffer;
QMessageBox::warning( 0, tr("Error"), lineStr ,tr("Ok") );
@@ -370,74 +370,74 @@ MAILLIB::ATYPE MHwrapper::getType()const
const QString&MHwrapper::getName()const
{
return MHName;
}
void MHwrapper::mvcpMail(const RecMailP&mail,const QString&targetFolder,AbstractMail*targetWrapper,bool moveit)
{
init_storage();
if (!m_storage) {
return;
}
if (targetWrapper != this) {
- odebug << "Using generic" << oendl;
+ odebug << "Using generic" << oendl;
Genericwrapper::mvcpMail(mail,targetFolder,targetWrapper,moveit);
return;
}
- odebug << "Using internal routines for move/copy" << oendl;
+ odebug << "Using internal routines for move/copy" << oendl;
QString tf = buildPath(targetFolder);
int r = mailsession_select_folder(m_storage->sto_session,(char*)mail->getMbox().latin1());
if (r != MAIL_NO_ERROR) {
- odebug << "Error selecting source mailbox" << oendl;
+ odebug << "Error selecting source mailbox" << oendl;
return;
}
if (moveit) {
r = mailsession_move_message(m_storage->sto_session,mail->getNumber(),(char*)tf.latin1());
} else {
r = mailsession_copy_message(m_storage->sto_session,mail->getNumber(),(char*)tf.latin1());
}
if (r != MAIL_NO_ERROR) {
- odebug << "Error copy/moving mail internal (" << r << ")" << oendl;
+ odebug << "Error copy/moving mail internal (" << r << ")" << oendl;
}
}
void MHwrapper::mvcpAllMails(const FolderP&fromFolder,
const QString&targetFolder,AbstractMail*targetWrapper,bool moveit)
{
init_storage();
if (!m_storage) {
return;
}
if (targetWrapper != this) {
- odebug << "Using generic" << oendl;
+ odebug << "Using generic" << oendl;
Genericwrapper::mvcpAllMails(fromFolder,targetFolder,targetWrapper,moveit);
return;
}
if (!fromFolder) return;
int r = mailsession_select_folder(m_storage->sto_session,(char*)fromFolder->getName().latin1());
if (r!=MAIL_NO_ERROR) {
- odebug << "error selecting source folder!" << oendl;
+ odebug << "error selecting source folder!" << oendl;
return;
}
QString tf = buildPath(targetFolder);
mailmessage_list*l=0;
r = mailsession_get_messages_list(m_storage->sto_session,&l);
if (r != MAIL_NO_ERROR) {
- odebug << "Error message list" << oendl;
+ odebug << "Error message list" << oendl;
}
unsigned j = 0;
for(unsigned int i = 0 ; l!= 0 && i < carray_count(l->msg_tab) ; ++i) {
mailmessage * msg;
msg = (mailmessage*)carray_get(l->msg_tab, i);
j = msg->msg_index;
if (moveit) {
r = mailsession_move_message(m_storage->sto_session,j,(char*)tf.latin1());
} else {
r = mailsession_copy_message(m_storage->sto_session,j,(char*)tf.latin1());
}
if (r != MAIL_NO_ERROR) {
- odebug << "Error copy/moving mail internal (" << r << ")" << oendl;
+ odebug << "Error copy/moving mail internal (" << r << ")" << oendl;
break;
}
}
if (l) mailmessage_list_free(l);
}
diff --git a/noncore/net/mail/libmailwrapper/pop3wrapper.cpp b/noncore/net/mail/libmailwrapper/pop3wrapper.cpp
index 3cfd1ee..2d66fc9 100644
--- a/noncore/net/mail/libmailwrapper/pop3wrapper.cpp
+++ b/noncore/net/mail/libmailwrapper/pop3wrapper.cpp
@@ -1,62 +1,69 @@
#include <stdlib.h>
#include "pop3wrapper.h"
#include "mailtypes.h"
#include "logindialog.h"
#include <libetpan/libetpan.h>
#include <opie2/odebug.h>
#include <qpe/global.h>
#include <qfile.h>
+#include <qmessagebox.h>
/* we don't fetch messages larger than 5 MB */
#define HARD_MSG_SIZE_LIMIT 5242880
using namespace Opie::Core;
POP3wrapper::POP3wrapper( POP3account *a )
: Genericwrapper() {
account = a;
m_pop3 = NULL;
msgTempName = a->getFileName()+"_msg_cache";
last_msg_id = 0;
+ m_maxsize = account->getMaxSize();
+ m_checksize = account->getCheckMaxSize();
}
POP3wrapper::~POP3wrapper() {
logout();
QFile msg_cache(msgTempName);
if (msg_cache.exists()) {
msg_cache.remove();
}
}
void POP3wrapper::pop3_progress( size_t current, size_t maximum ) {
- odebug << "POP3: " << current << " of " << maximum << "" << oendl;
+ odebug << "POP3: " << current << " of " << maximum << "" << oendl;
}
RecBodyP POP3wrapper::fetchBody( const RecMailP &mail ) {
int err = MAILPOP3_NO_ERROR;
char *message = 0;
size_t length = 0;
RecBodyP body = new RecBody();
login();
if ( !m_pop3 ) {
return body;
}
mailmessage * mailmsg;
- if (mail->Msgsize()>HARD_MSG_SIZE_LIMIT) {
- odebug << "Message to large: " << mail->Msgsize() << "" << oendl;
- return body;
+ if (mail->Msgsize()/1024>m_maxsize && m_checksize && mail->getNumber()!=last_msg_id) {
+ QString quest = QString(tr("Download mail?\nIt is %1 kByte but your limit is %2 kByte")).arg(mail->Msgsize()/1024).arg(m_maxsize);
+ int yesno = QMessageBox::warning(0,tr("Download message"),
+ quest,tr("Yes"),tr("No"),QString::null,0,1);
+ odebug << "Message to large: " << mail->Msgsize() << "" << oendl;
+ if (yesno==1)
+ return body;
}
QFile msg_cache(msgTempName);
cleanMimeCache();
if (mail->getNumber()!=last_msg_id) {
if (msg_cache.exists()) {
msg_cache.remove();
}
msg_cache.open(IO_ReadWrite|IO_Truncate);
last_msg_id = mail->getNumber();
@@ -122,25 +129,25 @@ void POP3wrapper::login()
server = account->getServer().latin1();
port = account->getPort().toUInt();
if ( account->getUser().isEmpty() || account->getPassword().isEmpty() ) {
LoginDialog login( account->getUser(), account->getPassword(), NULL, 0, true );
login.show();
if ( QDialog::Accepted == login.exec() ) {
// ok
user = login.getUser().latin1();
pass = login.getPassword().latin1();
} else {
// cancel
- odebug << "POP3: Login canceled" << oendl;
+ odebug << "POP3: Login canceled" << oendl;
return;
}
} else {
user = account->getUser().latin1();
pass = account->getPassword().latin1();
}
// bool ssl = account->getSSL();
m_pop3=mailstorage_new(NULL);
int conntypeset = account->ConnectionType();
@@ -154,25 +161,25 @@ void POP3wrapper::login()
} else if ( conntypeset == 0 ) {
conntype = CONNECTION_TYPE_TRY_STARTTLS;
}
//(ssl?CONNECTION_TYPE_TLS:CONNECTION_TYPE_PLAIN);
pop3_mailstorage_init(m_pop3,(char*)server, port, NULL, conntype, POP3_AUTH_TYPE_PLAIN,
(char*)user,(char*)pass,0,0,0);
err = mailstorage_connect(m_pop3);
if (err != MAIL_NO_ERROR) {
- odebug << QString( "FEHLERNUMMER %1" ).arg( err ) << oendl;
+ odebug << QString( "FEHLERNUMMER %1" ).arg( err ) << oendl;
Global::statusMessage(tr("Error initializing folder"));
mailstorage_free(m_pop3);
m_pop3 = 0;
} else {
mailsession * session = m_pop3->sto_session;
mailpop3 * mail = ( ( pop3_session_state_data * )session->sess_data )->pop3_session;
if (mail) {
mail->pop3_progr_fun = &pop3_progress;
}
}
}
@@ -228,25 +235,25 @@ int POP3wrapper::deleteAllMail(const FolderP&) {
}
void POP3wrapper::statusFolder(folderStat&target_stat,const QString&) {
login();
target_stat.message_count = 0;
target_stat.message_unseen = 0;
target_stat.message_recent = 0;
if (!m_pop3)
return;
int r = mailsession_status_folder(m_pop3->sto_session,0,&target_stat.message_count,
&target_stat.message_recent,&target_stat.message_unseen);
if (r != MAIL_NO_ERROR) {
- odebug << "error getting folter status." << oendl;
+ odebug << "error getting folter status." << oendl;
}
}
encodedString* POP3wrapper::fetchRawBody(const RecMailP&mail) {
char*target=0;
size_t length=0;
encodedString*res = 0;
mailmessage * mailmsg = 0;
int err = mailsession_get_message(m_pop3->sto_session, mail->getNumber(), &mailmsg);
err = mailmessage_fetch(mailmsg,&target,&length);
if (mailmsg)
mailmessage_free(mailmsg);
diff --git a/noncore/net/mail/libmailwrapper/pop3wrapper.h b/noncore/net/mail/libmailwrapper/pop3wrapper.h
index 5101fa5..8c36cf9 100644
--- a/noncore/net/mail/libmailwrapper/pop3wrapper.h
+++ b/noncore/net/mail/libmailwrapper/pop3wrapper.h
@@ -28,15 +28,17 @@ public:
virtual RecBodyP fetchBody( const RecMailP &mail );
virtual encodedString* fetchRawBody(const RecMailP&mail);
virtual void logout();
virtual MAILLIB::ATYPE getType()const;
virtual const QString&getName()const;
static void pop3_progress( size_t current, size_t maximum );
protected:
void login();
POP3account *account;
mailstorage*m_pop3;
+ int m_maxsize;
+ bool m_checksize;
};
#endif
diff --git a/noncore/net/mail/libmailwrapper/settings.cpp b/noncore/net/mail/libmailwrapper/settings.cpp
index 3c9b25c..09be91b 100644
--- a/noncore/net/mail/libmailwrapper/settings.cpp
+++ b/noncore/net/mail/libmailwrapper/settings.cpp
@@ -7,36 +7,35 @@
#include "settings.h"
//#include "defines.h"
#define IMAP_PORT "143"
#define IMAP_SSL_PORT "993"
#define SMTP_PORT "25"
#define SMTP_SSL_PORT "465"
#define POP3_PORT "110"
#define POP3_SSL_PORT "995"
#define NNTP_PORT "119"
#define NNTP_SSL_PORT "563"
-
Settings::Settings()
: QObject()
{
updateAccounts();
}
void Settings::checkDirectory()
{
if ( !QDir( (QString) getenv( "HOME" ) + "/Applications/opiemail/" ).exists() ) {
system( "mkdir -p $HOME/Applications/opiemail" );
- odebug << "$HOME/Applications/opiemail created" << oendl;
+ odebug << "$HOME/Applications/opiemail created" << oendl;
}
}
QList<Account> Settings::getAccounts()
{
return accounts;
}
void Settings::addAccount( Account *account )
{
accounts.append( account );
}
@@ -46,46 +45,46 @@ void Settings::delAccount( Account *account )
accounts.remove( account );
account->remove();
}
void Settings::updateAccounts()
{
accounts.clear();
QDir dir( (QString) getenv( "HOME" ) + "/Applications/opiemail" );
QStringList::Iterator it;
QStringList imap = dir.entryList( "imap-*" );
for ( it = imap.begin(); it != imap.end(); it++ ) {
- odebug << "Added IMAP account" << oendl;
+ odebug << "Added IMAP account" << oendl;
IMAPaccount *account = new IMAPaccount( (*it).replace(0, 5, "") );
accounts.append( account );
}
QStringList pop3 = dir.entryList( "pop3-*" );
for ( it = pop3.begin(); it != pop3.end(); it++ ) {
- odebug << "Added POP account" << oendl;
+ odebug << "Added POP account" << oendl;
POP3account *account = new POP3account( (*it).replace(0, 5, "") );
accounts.append( account );
}
QStringList smtp = dir.entryList( "smtp-*" );
for ( it = smtp.begin(); it != smtp.end(); it++ ) {
- odebug << "Added SMTP account" << oendl;
+ odebug << "Added SMTP account" << oendl;
SMTPaccount *account = new SMTPaccount( (*it).replace(0, 5, "") );
accounts.append( account );
}
QStringList nntp = dir.entryList( "nntp-*" );
for ( it = nntp.begin(); it != nntp.end(); it++ ) {
- odebug << "Added NNTP account" << oendl;
+ odebug << "Added NNTP account" << oendl;
NNTPaccount *account = new NNTPaccount( (*it).replace(0, 5, "") );
accounts.append( account );
}
readAccounts();
}
void Settings::saveAccounts()
{
checkDirectory();
Account *it;
@@ -171,25 +170,25 @@ void IMAPaccount::read()
user = conf->readEntry( "User","" );
if (user.isNull()) user = "";
password = conf->readEntryCrypt( "Password","" );
if (password.isNull()) password = "";
prefix = conf->readEntry("MailPrefix","");
if (prefix.isNull()) prefix = "";
offline = conf->readBoolEntry("Offline",false);
delete conf;
}
void IMAPaccount::save()
{
- odebug << "saving " + getFileName() << oendl;
+ odebug << "saving " + getFileName() << oendl;
Settings::checkDirectory();
Config *conf = new Config( getFileName(), Config::File );
conf->setGroup( "IMAP Account" );
conf->writeEntry( "Account", accountName );
conf->writeEntry( "Server", server );
conf->writeEntry( "Port", port );
conf->writeEntry( "SSL", ssl );
conf->writeEntry( "ConnectionType", connectionType );
conf->writeEntry( "User", user );
conf->writeEntryCrypt( "Password", password );
conf->writeEntry( "MailPrefix",prefix);
@@ -204,35 +203,39 @@ QString IMAPaccount::getFileName()
return (QString) getenv( "HOME" ) + "/Applications/opiemail/imap-" + file;
}
POP3account::POP3account()
: Account()
{
file = POP3account::getUniqueFileName();
accountName = "New POP3 Account";
ssl = false;
connectionType = 1;
type = MAILLIB::A_POP3;
port = POP3_PORT;
+ m_CheckSize = true;
+ m_MaxSize = 1024;
}
POP3account::POP3account( QString filename )
: Account()
{
file = filename;
accountName = "New POP3 Account";
ssl = false;
connectionType = 1;
type = MAILLIB::A_POP3;
port = POP3_PORT;
+ m_CheckSize = true;
+ m_MaxSize = 1024;
}
QString POP3account::getUniqueFileName()
{
int num = 0;
QString unique;
QDir dir( (QString) getenv( "HOME" ) + "/Applications/opiemail" );
QStringList imap = dir.entryList( "pop3-*" );
do {
unique.setNum( num++ );
@@ -244,52 +247,76 @@ QString POP3account::getUniqueFileName()
void POP3account::read()
{
Config *conf = new Config( getFileName(), Config::File );
conf->setGroup( "POP3 Account" );
accountName = conf->readEntry( "Account" );
server = conf->readEntry( "Server" );
port = conf->readEntry( "Port" );
ssl = conf->readBoolEntry( "SSL" );
connectionType = conf->readNumEntry( "ConnectionType" );
user = conf->readEntry( "User" );
password = conf->readEntryCrypt( "Password" );
offline = conf->readBoolEntry("Offline",false);
+ m_CheckSize = conf->readBoolEntry("Checkmaxsize",true);
+ m_MaxSize = conf->readNumEntry("Maxsize",1024);
delete conf;
}
void POP3account::save()
{
- odebug << "saving " + getFileName() << oendl;
+ odebug << "saving " + getFileName() << oendl;
Settings::checkDirectory();
Config *conf = new Config( getFileName(), Config::File );
conf->setGroup( "POP3 Account" );
conf->writeEntry( "Account", accountName );
conf->writeEntry( "Server", server );
conf->writeEntry( "Port", port );
conf->writeEntry( "SSL", ssl );
conf->writeEntry( "ConnectionType", connectionType );
conf->writeEntry( "User", user );
conf->writeEntryCrypt( "Password", password );
conf->writeEntry( "Offline",offline);
+ conf->writeEntry("Checkmaxsize",m_CheckSize);
+ conf->writeEntry("Maxsize",m_MaxSize);
conf->write();
delete conf;
}
QString POP3account::getFileName()
{
return (QString) getenv( "HOME" ) + "/Applications/opiemail/pop3-" + file;
}
+bool POP3account::getCheckMaxSize()const
+{
+ return m_CheckSize;
+}
+
+void POP3account::setCheckMaxSize(bool aValue)
+{
+ m_CheckSize = aValue;
+}
+
+int POP3account::getMaxSize()const
+{
+ return m_MaxSize;
+}
+
+void POP3account::setMaxSize(int aValue)
+{
+ m_MaxSize = aValue;
+}
+
SMTPaccount::SMTPaccount()
: Account()
{
file = SMTPaccount::getUniqueFileName();
accountName = "New SMTP Account";
ssl = false;
connectionType = 1;
login = false;
useCC = false;
useBCC = false;
useReply = false;
type = MAILLIB::A_SMTP;
@@ -331,25 +358,25 @@ void SMTPaccount::read()
server = conf->readEntry( "Server" );
port = conf->readEntry( "Port" );
ssl = conf->readBoolEntry( "SSL" );
connectionType = conf->readNumEntry( "ConnectionType" );
login = conf->readBoolEntry( "Login" );
user = conf->readEntry( "User" );
password = conf->readEntryCrypt( "Password" );
delete conf;
}
void SMTPaccount::save()
{
- odebug << "saving " + getFileName() << oendl;
+ odebug << "saving " + getFileName() << oendl;
Settings::checkDirectory();
Config *conf = new Config( getFileName(), Config::File );
conf->setGroup( "SMTP Account" );
conf->writeEntry( "Account", accountName );
conf->writeEntry( "Server", server );
conf->writeEntry( "Port", port );
conf->writeEntry( "SSL", ssl );
conf->writeEntry( "ConnectionType", connectionType );
conf->writeEntry( "Login", login );
conf->writeEntry( "User", user );
conf->writeEntryCrypt( "Password", password );
@@ -408,25 +435,25 @@ void NNTPaccount::read()
server = conf->readEntry( "Server" );
port = conf->readEntry( "Port" );
ssl = conf->readBoolEntry( "SSL" );
login = conf->readBoolEntry( "Login" );
user = conf->readEntry( "User" );
password = conf->readEntryCrypt( "Password" );
subscribedGroups = conf->readListEntry( "Subscribed", ',' );
delete conf;
}
void NNTPaccount::save()
{
- odebug << "saving " + getFileName() << oendl;
+ odebug << "saving " + getFileName() << oendl;
Settings::checkDirectory();
Config *conf = new Config( getFileName(), Config::File );
conf->setGroup( "NNTP Account" );
conf->writeEntry( "Account", accountName );
conf->writeEntry( "Server", server );
conf->writeEntry( "Port", port );
conf->writeEntry( "SSL", ssl );
conf->writeEntry( "Login", login );
conf->writeEntry( "User", user );
conf->writeEntryCrypt( "Password", password );
conf->writeEntry( "Subscribed" , subscribedGroups, ',' );
diff --git a/noncore/net/mail/libmailwrapper/settings.h b/noncore/net/mail/libmailwrapper/settings.h
index bf27b97..8683a05 100644
--- a/noncore/net/mail/libmailwrapper/settings.h
+++ b/noncore/net/mail/libmailwrapper/settings.h
@@ -80,28 +80,33 @@ private:
class POP3account : public Account
{
public:
POP3account();
POP3account( QString filename );
static QString getUniqueFileName();
virtual void read();
virtual void save();
virtual QString getFileName();
+ virtual bool getCheckMaxSize()const;
+ virtual void setCheckMaxSize(bool);
+ virtual int getMaxSize()const;
+ virtual void setMaxSize(int);
private:
QString file;
-
+ bool m_CheckSize;
+ int m_MaxSize;
};
class SMTPaccount : public Account
{
public:
SMTPaccount();
SMTPaccount( QString filename );
static QString getUniqueFileName();
virtual void read();
diff --git a/noncore/net/mail/pop3configui.ui b/noncore/net/mail/pop3configui.ui
index 1014ef4..e560661 100644
--- a/noncore/net/mail/pop3configui.ui
+++ b/noncore/net/mail/pop3configui.ui
@@ -2,46 +2,46 @@
<class>POP3configUI</class>
<widget>
<class>QDialog</class>
<property stdset="1">
<name>name</name>
<cstring>POP3configUI</cstring>
</property>
<property stdset="1">
<name>geometry</name>
<rect>
<x>0</x>
<y>0</y>
- <width>314</width>
+ <width>302</width>
<height>410</height>
</rect>
</property>
<property stdset="1">
<name>caption</name>
<string>Configure POP3</string>
</property>
<property>
<name>layoutMargin</name>
</property>
<property>
<name>layoutSpacing</name>
</property>
<vbox>
<property stdset="1">
<name>margin</name>
- <number>3</number>
+ <number>11</number>
</property>
<property stdset="1">
<name>spacing</name>
- <number>3</number>
+ <number>6</number>
</property>
<widget>
<class>QLayoutWidget</class>
<property stdset="1">
<name>name</name>
<cstring>Layout12</cstring>
</property>
<hbox>
<property stdset="1">
<name>margin</name>
<number>0</number>
</property>
@@ -310,24 +310,82 @@
<name>name</name>
<cstring>passLine</cstring>
</property>
<property stdset="1">
<name>echoMode</name>
<enum>Password</enum>
</property>
</widget>
</vbox>
</widget>
</hbox>
</widget>
+ <widget>
+ <class>QCheckBox</class>
+ <property stdset="1">
+ <name>name</name>
+ <cstring>m_CheckSize</cstring>
+ </property>
+ <property stdset="1">
+ <name>text</name>
+ <string>ask before downloading large mails</string>
+ </property>
+ </widget>
+ <widget>
+ <class>QLayoutWidget</class>
+ <property stdset="1">
+ <name>name</name>
+ <cstring>Layout9</cstring>
+ </property>
+ <grid>
+ <property stdset="1">
+ <name>margin</name>
+ <number>0</number>
+ </property>
+ <property stdset="1">
+ <name>spacing</name>
+ <number>6</number>
+ </property>
+ <widget row="0" column="0" >
+ <class>QLabel</class>
+ <property stdset="1">
+ <name>name</name>
+ <cstring>m_MailLimitLabel</cstring>
+ </property>
+ <property stdset="1">
+ <name>text</name>
+ <string>Large mail size (kb):</string>
+ </property>
+ </widget>
+ <widget row="0" column="1" >
+ <class>QSpinBox</class>
+ <property stdset="1">
+ <name>name</name>
+ <cstring>m_MailLimitBox</cstring>
+ </property>
+ <property stdset="1">
+ <name>suffix</name>
+ <string> kB</string>
+ </property>
+ <property stdset="1">
+ <name>maxValue</name>
+ <number>5120</number>
+ </property>
+ <property stdset="1">
+ <name>minValue</name>
+ <number>1</number>
+ </property>
+ </widget>
+ </grid>
+ </widget>
<spacer>
<property>
<name>name</name>
<cstring>spacer</cstring>
</property>
<property stdset="1">
<name>orientation</name>
<enum>Vertical</enum>
</property>
<property stdset="1">
<name>sizeType</name>
<enum>Expanding</enum>
@@ -337,16 +395,20 @@
<size>
<width>20</width>
<height>20</height>
</size>
</property>
</spacer>
</vbox>
</widget>
<tabstops>
<tabstop>accountLine</tabstop>
<tabstop>serverLine</tabstop>
<tabstop>portLine</tabstop>
+ <tabstop>ComboBox1</tabstop>
+ <tabstop>CommandEdit</tabstop>
<tabstop>userLine</tabstop>
<tabstop>passLine</tabstop>
+ <tabstop>m_CheckSize</tabstop>
+ <tabstop>m_MailLimitBox</tabstop>
</tabstops>
</UI>