author | alwin <alwin> | 2004-10-24 00:55:14 (UTC) |
---|---|---|
committer | alwin <alwin> | 2004-10-24 00:55:14 (UTC) |
commit | 9755bc969d17fc683791abc5c6fbd50fa3112486 (patch) (side-by-side diff) | |
tree | 0fdcf7b52b2f4627dd3efcd7330b116c4d9c4d98 | |
parent | 12eed25c7f18285f0e342d49fd3c41eb4b14e151 (diff) | |
download | opie-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
-rw-r--r-- | noncore/net/mail/accountview.cpp | 31 | ||||
-rw-r--r-- | noncore/net/mail/editaccounts.cpp | 28 | ||||
-rw-r--r-- | noncore/net/mail/libmailwrapper/genericwrapper.cpp | 13 | ||||
-rw-r--r-- | noncore/net/mail/libmailwrapper/imapwrapper.cpp | 86 | ||||
-rw-r--r-- | noncore/net/mail/libmailwrapper/mhwrapper.cpp | 60 | ||||
-rw-r--r-- | noncore/net/mail/libmailwrapper/pop3wrapper.cpp | 21 | ||||
-rw-r--r-- | noncore/net/mail/libmailwrapper/pop3wrapper.h | 2 | ||||
-rw-r--r-- | noncore/net/mail/libmailwrapper/settings.cpp | 47 | ||||
-rw-r--r-- | noncore/net/mail/libmailwrapper/settings.h | 7 | ||||
-rw-r--r-- | noncore/net/mail/pop3configui.ui | 68 |
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 @@ -65,25 +65,20 @@ void AccountView::populate( QList<Account> list ) 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 ) { + } + } } @@ -93,3 +88,3 @@ void AccountView::refresh(QListViewItem *item) - odebug << "AccountView refresh..." << oendl; + odebug << "AccountView refresh..." << oendl; if ( item ) @@ -166,4 +161,4 @@ void AccountView::downloadMails(const FolderP&fromFolder,AbstractMail*fromWrappe } - 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()); 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 @@ -45,3 +45,3 @@ EditAccounts::EditAccounts( Settings *s, QWidget *parent, const char *name, bool { - odebug << "New Account Configuration Widget" << oendl; + odebug << "New Account Configuration Widget" << oendl; settings = s; @@ -85,3 +85,3 @@ void EditAccounts::slotNewMail() { - odebug << "New Mail Account" << oendl; + odebug << "New Mail Account" << oendl; QString *selection = new QString(); @@ -99,3 +99,3 @@ void EditAccounts::slotNewAccount( const QString &type ) { - odebug << "-> config IMAP" << oendl; + odebug << "-> config IMAP" << oendl; IMAPaccount *account = new IMAPaccount(); @@ -115,3 +115,3 @@ void EditAccounts::slotNewAccount( const QString &type ) { - odebug << "-> config POP3" << oendl; + odebug << "-> config POP3" << oendl; POP3account *account = new POP3account(); @@ -131,3 +131,3 @@ void EditAccounts::slotNewAccount( const QString &type ) { - odebug << "-> config SMTP" << oendl; + odebug << "-> config SMTP" << oendl; SMTPaccount *account = new SMTPaccount(); @@ -148,3 +148,3 @@ void EditAccounts::slotNewAccount( const QString &type ) { - odebug << "-> config NNTP" << oendl; + odebug << "-> config NNTP" << oendl; NNTPaccount *account = new NNTPaccount(); @@ -217,3 +217,3 @@ void EditAccounts::slotEditMail() { - odebug << "Edit Mail Account" << oendl; + odebug << "Edit Mail Account" << oendl; if ( !mailList->currentItem() ) @@ -246,3 +246,3 @@ void EditAccounts::slotNewNews() { - odebug << "New News Account" << oendl; + odebug << "New News Account" << oendl; slotNewAccount( "NNTP" ); @@ -252,3 +252,3 @@ void EditAccounts::slotEditNews() { - odebug << "Edit News Account" << oendl; + odebug << "Edit News Account" << oendl; if ( !newsList->currentItem() ) @@ -267,3 +267,3 @@ void EditAccounts::slotDeleteNews() { - odebug << "Delete News Account" << oendl; + odebug << "Delete News Account" << oendl; if ( !newsList->currentItem() ) @@ -424,2 +424,4 @@ void POP3config::fillValues() passLine->setText( data->getPassword() ); + m_CheckSize->setChecked(data->getCheckMaxSize()); + m_MailLimitBox->setValue(data->getMaxSize()); } @@ -434,2 +436,4 @@ void POP3config::accept() data->setPassword( passLine->text() ); + data->setMaxSize(m_MailLimitBox->value()); + data->setCheckMaxSize(m_CheckSize->isChecked()); @@ -525,3 +529,3 @@ void NNTPconfig::slotGetNG() { QStringList list = tmp->listAllNewsgroups(); - + ListViewGroups->clear(); @@ -583,3 +587,3 @@ void NNTPconfig::save() 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) ); 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 @@ -5,2 +5,4 @@ #include <opie2/odebug.h> +#include <qpe/timestring.h> +#include <qdatetime.h> @@ -245,8 +247,7 @@ 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; } 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 @@ -33,3 +33,3 @@ int IMAPwrapper::selectMbox(const QString&mbox) 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 = ""; @@ -44,3 +44,3 @@ void IMAPwrapper::imap_progress( size_t current, size_t maximum ) qApp->processEvents(); - odebug << "IMAP: " << current << " of " << maximum << "" << oendl; + odebug << "IMAP: " << current << " of " << maximum << "" << oendl; } @@ -56,3 +56,3 @@ bool IMAPwrapper::start_tls(bool force_tls) Global::statusMessage("error getting capabilities!"); - odebug << "error getting capabilities!" << oendl; + odebug << "error getting capabilities!" << oendl; return false; @@ -77,3 +77,3 @@ bool IMAPwrapper::start_tls(bool 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; @@ -128,3 +128,3 @@ void IMAPwrapper::login() // cancel - odebug << "IMAP: Login canceled" << oendl; + odebug << "IMAP: Login canceled" << oendl; return; @@ -151,3 +151,3 @@ void IMAPwrapper::login() if ( ssl ) { - odebug << "using ssl" << oendl; + odebug << "using ssl" << oendl; err = mailimap_ssl_connect( m_imap, (char*)server, port ); @@ -179,3 +179,3 @@ void IMAPwrapper::login() Global::statusMessage(tr("Server has no TLS support!")); - odebug << "Server has no TLS support!" << oendl; + odebug << "Server has no TLS support!" << oendl; ok = false; @@ -239,2 +239,6 @@ void IMAPwrapper::listMessages(const QString&mailbox,QValueList<Opie::Core::OSma set = mailimap_set_new_interval( 1, last ); + + + fetchType = mailimap_fetch_type_new_all(); +/* fetchType = mailimap_fetch_type_new_fetch_att_list_empty(); @@ -244,3 +248,3 @@ void IMAPwrapper::listMessages(const QString&mailbox,QValueList<Opie::Core::OSma mailimap_fetch_type_new_fetch_att_list_add(fetchType,mailimap_fetch_att_new_rfc822_size()); - +*/ err = mailimap_fetch( m_imap, set, fetchType, &result ); @@ -320,3 +324,3 @@ QValueList<Opie::Core::OSmartPointer<Folder> >* IMAPwrapper::listFolders() } else { - odebug << "error fetching folders: " << m_imap->imap_response << "" << oendl; + odebug << "error fetching folders: " << m_imap->imap_response << "" << oendl; } @@ -330,3 +334,3 @@ QValueList<Opie::Core::OSmartPointer<Folder> >* IMAPwrapper::listFolders() if (!path) path = ""; - odebug << path << oendl; + odebug << path << oendl; err = mailimap_list( m_imap, (char*)path, (char*)mask, &result ); @@ -357,3 +361,3 @@ QValueList<Opie::Core::OSmartPointer<Folder> >* IMAPwrapper::listFolders() } else { - odebug << "error fetching folders " << m_imap->imap_response << "" << oendl; + odebug << "error fetching folders " << m_imap->imap_response << "" << oendl; } @@ -377,2 +381,3 @@ RecMail*IMAPwrapper::parse_list_result(mailimap_msg_att* m_att) } + size = 0; m = new RecMail(); @@ -380,3 +385,2 @@ RecMail*IMAPwrapper::parse_list_result(mailimap_msg_att* m_att) current = c; - size = 0; item = (mailimap_msg_att_item*)current->data; @@ -467,9 +471,16 @@ RecMail*IMAPwrapper::parse_list_result(mailimap_msg_att* m_att) #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); } @@ -483,3 +494,2 @@ RecMail*IMAPwrapper::parse_list_result(mailimap_msg_att* m_att) m->setFlags(mFlags); - m->setMsgsize(size); } @@ -527,3 +537,3 @@ RecBodyP IMAPwrapper::fetchBody(const RecMailP&mail) } else { - odebug << "error fetching body: " << m_imap->imap_response << "" << oendl; + odebug << "error fetching body: " << m_imap->imap_response << "" << oendl; } @@ -639,3 +649,3 @@ encodedString*IMAPwrapper::fetchRawPart(const RecMailP&mail,const QValueList<int } else { - odebug << "error fetching text: " << m_imap->imap_response << "" << oendl; + odebug << "error fetching text: " << m_imap->imap_response << "" << oendl; } @@ -666,3 +676,3 @@ void IMAPwrapper::traverseBody(const RecMailP&mail,mailimap_body*body,RecBodyP&t } - odebug << "ID = " << id.latin1() << "" << oendl; + odebug << "ID = " << id.latin1() << "" << oendl; currentPart->setIdentifier(id); @@ -707,3 +717,3 @@ void IMAPwrapper::traverseBody(const RecMailP&mail,mailimap_body*body,RecBodyP&t } - odebug << "ID(mpart) = " << id.latin1() << "" << oendl; + odebug << "ID(mpart) = " << id.latin1() << "" << oendl; } @@ -751,3 +761,3 @@ void IMAPwrapper::fillSingleTextPart(RecPartP&target_part,mailimap_body_type_tex 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()); @@ -763,3 +773,3 @@ void IMAPwrapper::fillSingleMsgPart(RecPartP&target_part,mailimap_body_type_msg* target_part->setSubtype("rfc822"); - odebug << "Message part" << oendl; + odebug << "Message part" << oendl; /* we set this type to text/plain */ @@ -822,3 +832,3 @@ void IMAPwrapper::fillSingleBasicPart(RecPartP&target_part,mailimap_body_type_ba } - odebug << "Type = " << type.latin1() << "/" << sub.latin1() << "" << oendl; + odebug << "Type = " << type.latin1() << "/" << sub.latin1() << "" << oendl; target_part->setType(type.lower()); @@ -898,6 +908,6 @@ void IMAPwrapper::deleteMail(const RecMailP&mail) 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? */ @@ -905,5 +915,5 @@ void IMAPwrapper::deleteMail(const RecMailP&mail) 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; } @@ -933,3 +943,3 @@ void IMAPwrapper::answeredMail(const RecMailP&mail) if (err != MAILIMAP_NO_ERROR) { - odebug << "error marking mail: " << m_imap->imap_response << "" << oendl; + odebug << "error marking mail: " << m_imap->imap_response << "" << oendl; return; @@ -1001,3 +1011,3 @@ int IMAPwrapper::deleteAllMail(const FolderP&folder) } - odebug << "deleting mail: " << m_imap->imap_response << "" << oendl; + odebug << "deleting mail: " << m_imap->imap_response << "" << oendl; /* should we realy do that at this moment? */ @@ -1008,3 +1018,3 @@ int IMAPwrapper::deleteAllMail(const FolderP&folder) } - odebug << "Delete successfull " << m_imap->imap_response << "" << oendl; + odebug << "Delete successfull " << m_imap->imap_response << "" << oendl; return 1; @@ -1033,3 +1043,3 @@ int IMAPwrapper::createMbox(const QString&folder,const FolderP&parentfolder,cons } - odebug << "Creating " << pre.latin1() << "" << oendl; + odebug << "Creating " << pre.latin1() << "" << oendl; int res = mailimap_create(m_imap,pre.latin1()); @@ -1092,3 +1102,3 @@ void IMAPwrapper::statusFolder(folderStat&target_stat,const QString & mailbox) } else { - odebug << "Error retrieving status" << oendl; + odebug << "Error retrieving status" << oendl; } @@ -1116,3 +1126,3 @@ const QString&IMAPwrapper::getName()const { - odebug << "Get name: " << account->getAccountName().latin1() << "" << oendl; + odebug << "Get name: " << account->getAccountName().latin1() << "" << oendl; return account->getAccountName(); @@ -1132,3 +1142,3 @@ void IMAPwrapper::mvcpAllMails(const FolderP&fromFolder, AbstractMail::mvcpAllMails(fromFolder,targetFolder,targetWrapper,moveit); - odebug << "Using generic" << oendl; + odebug << "Using generic" << oendl; return; @@ -1151,3 +1161,3 @@ void IMAPwrapper::mvcpAllMails(const FolderP&fromFolder, Global::statusMessage(error_msg); - odebug << error_msg << oendl; + odebug << error_msg << oendl; return; @@ -1162,3 +1172,3 @@ void IMAPwrapper::mvcpMail(const RecMailP&mail,const QString&targetFolder,Abstra if (targetWrapper != this) { - odebug << "Using generic" << oendl; + odebug << "Using generic" << oendl; AbstractMail::mvcpMail(mail,targetFolder,targetWrapper,moveit); @@ -1181,3 +1191,3 @@ void IMAPwrapper::mvcpMail(const RecMailP&mail,const QString&targetFolder,Abstra Global::statusMessage(error_msg); - odebug << error_msg << oendl; + odebug << error_msg << oendl; return; 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 @@ -19,3 +19,3 @@ MHwrapper::MHwrapper(const QString & mbox_dir,const QString&mbox_name) } - odebug << MHPath << oendl; + odebug << MHPath << oendl; QDir dir(MHPath); @@ -36,3 +36,3 @@ void MHwrapper::init_storage() if (r != MAIL_NO_ERROR) { - odebug << "error initializing storage" << oendl; + odebug << "error initializing storage" << oendl; mailstorage_free(m_storage); @@ -44,3 +44,3 @@ void MHwrapper::init_storage() if (r!=MAIL_NO_ERROR) { - odebug << "error connecting storage" << oendl; + odebug << "error connecting storage" << oendl; mailstorage_free(m_storage); @@ -73,3 +73,3 @@ void MHwrapper::listMessages(const QString & mailbox, QValueList<Opie::Core::OSm if (r!=MAIL_NO_ERROR) { - odebug << "listMessages: error selecting folder!" << oendl; + odebug << "listMessages: error selecting folder!" << oendl; return; @@ -93,3 +93,3 @@ QValueList<Opie::Core::OSmartPointer<Folder> >* MHwrapper::listFolders() if (r != MAIL_NO_ERROR || !flist) { - odebug << "error getting folder list" << oendl; + odebug << "error getting folder list" << oendl; return folders; @@ -113,3 +113,3 @@ void MHwrapper::deleteMail(const RecMailP&mail) if (r!=MAIL_NO_ERROR) { - odebug << "error selecting folder!" << oendl; + odebug << "error selecting folder!" << oendl; return; @@ -118,3 +118,3 @@ void MHwrapper::deleteMail(const RecMailP&mail) if (r != MAIL_NO_ERROR) { - odebug << "error deleting mail" << oendl; + odebug << "error deleting mail" << oendl; } @@ -143,3 +143,3 @@ RecBodyP MHwrapper::fetchBody( const RecMailP &mail ) if (r != MAIL_NO_ERROR) { - odebug << "Error fetching mail " << mail->getNumber() << "" << oendl; + odebug << "Error fetching mail " << mail->getNumber() << "" << oendl; return body; @@ -153,3 +153,3 @@ void MHwrapper::mbox_progress( size_t current, size_t maximum ) { - odebug << "MH " << current << " von " << maximum << "" << oendl; + odebug << "MH " << current << " von " << maximum << "" << oendl; } @@ -186,9 +186,9 @@ int MHwrapper::createMbox(const QString&folder,const FolderP&pfolder,const QStri } - 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; @@ -205,3 +205,3 @@ void MHwrapper::storeMessage(const char*msg,size_t length, const QString&Folder) if (r!=MAIL_NO_ERROR) { - odebug << "error selecting folder!" << oendl; + odebug << "error selecting folder!" << oendl; return; @@ -210,3 +210,3 @@ void MHwrapper::storeMessage(const char*msg,size_t length, const QString&Folder) if (r!=MAIL_NO_ERROR) { - odebug << "error storing mail" << oendl; + odebug << "error storing mail" << oendl; } @@ -227,3 +227,3 @@ encodedString* MHwrapper::fetchRawBody(const RecMailP&mail) if (r!=MAIL_NO_ERROR) { - odebug << "error selecting folder!" << oendl; + odebug << "error selecting folder!" << oendl; return result; @@ -251,3 +251,3 @@ void MHwrapper::deleteMails(const QString & mailbox,const QValueList<RecMailP> & if (r!=MAIL_NO_ERROR) { - odebug << "deleteMails: error selecting folder!" << oendl; + odebug << "deleteMails: error selecting folder!" << oendl; return; @@ -258,3 +258,3 @@ void MHwrapper::deleteMails(const QString & mailbox,const QValueList<RecMailP> & if (r != MAIL_NO_ERROR) { - odebug << "error deleting mail" << oendl; + odebug << "error deleting mail" << oendl; break; @@ -274,3 +274,3 @@ int MHwrapper::deleteAllMail(const FolderP&tfolder) if (r!=MAIL_NO_ERROR) { - odebug << "error selecting folder!" << oendl; + odebug << "error selecting folder!" << oendl; return 0; @@ -280,3 +280,3 @@ int MHwrapper::deleteAllMail(const FolderP&tfolder) if (r != MAIL_NO_ERROR) { - odebug << "Error message list" << oendl; + odebug << "Error message list" << oendl; res = 0; @@ -311,3 +311,3 @@ int MHwrapper::deleteMbox(const FolderP&tfolder) if (r != MAIL_NO_ERROR) { - odebug << "error deleting mail box" << oendl; + odebug << "error deleting mail box" << oendl; return 0; @@ -329,6 +329,6 @@ int MHwrapper::deleteMbox(const FolderP&tfolder) 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; @@ -381,3 +381,3 @@ void MHwrapper::mvcpMail(const RecMailP&mail,const QString&targetFolder,Abstract if (targetWrapper != this) { - odebug << "Using generic" << oendl; + odebug << "Using generic" << oendl; Genericwrapper::mvcpMail(mail,targetFolder,targetWrapper,moveit); @@ -385,3 +385,3 @@ void MHwrapper::mvcpMail(const RecMailP&mail,const QString&targetFolder,Abstract } - odebug << "Using internal routines for move/copy" << oendl; + odebug << "Using internal routines for move/copy" << oendl; QString tf = buildPath(targetFolder); @@ -389,3 +389,3 @@ void MHwrapper::mvcpMail(const RecMailP&mail,const QString&targetFolder,Abstract if (r != MAIL_NO_ERROR) { - odebug << "Error selecting source mailbox" << oendl; + odebug << "Error selecting source mailbox" << oendl; return; @@ -398,3 +398,3 @@ void MHwrapper::mvcpMail(const RecMailP&mail,const QString&targetFolder,Abstract if (r != MAIL_NO_ERROR) { - odebug << "Error copy/moving mail internal (" << r << ")" << oendl; + odebug << "Error copy/moving mail internal (" << r << ")" << oendl; } @@ -410,3 +410,3 @@ void MHwrapper::mvcpAllMails(const FolderP&fromFolder, if (targetWrapper != this) { - odebug << "Using generic" << oendl; + odebug << "Using generic" << oendl; Genericwrapper::mvcpAllMails(fromFolder,targetFolder,targetWrapper,moveit); @@ -417,3 +417,3 @@ void MHwrapper::mvcpAllMails(const FolderP&fromFolder, if (r!=MAIL_NO_ERROR) { - odebug << "error selecting source folder!" << oendl; + odebug << "error selecting source folder!" << oendl; return; @@ -424,3 +424,3 @@ void MHwrapper::mvcpAllMails(const FolderP&fromFolder, if (r != MAIL_NO_ERROR) { - odebug << "Error message list" << oendl; + odebug << "Error message list" << oendl; } @@ -437,3 +437,3 @@ void MHwrapper::mvcpAllMails(const FolderP&fromFolder, if (r != MAIL_NO_ERROR) { - odebug << "Error copy/moving mail internal (" << r << ")" << oendl; + odebug << "Error copy/moving mail internal (" << r << ")" << oendl; break; 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 @@ -9,2 +9,3 @@ #include <qfile.h> +#include <qmessagebox.h> @@ -20,2 +21,4 @@ POP3wrapper::POP3wrapper( POP3account *a ) last_msg_id = 0; + m_maxsize = account->getMaxSize(); + m_checksize = account->getCheckMaxSize(); } @@ -31,3 +34,3 @@ POP3wrapper::~POP3wrapper() { void POP3wrapper::pop3_progress( size_t current, size_t maximum ) { - odebug << "POP3: " << current << " of " << maximum << "" << oendl; + odebug << "POP3: " << current << " of " << maximum << "" << oendl; } @@ -47,5 +50,9 @@ RecBodyP POP3wrapper::fetchBody( const RecMailP &mail ) { 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; } @@ -133,3 +140,3 @@ void POP3wrapper::login() // cancel - odebug << "POP3: Login canceled" << oendl; + odebug << "POP3: Login canceled" << oendl; return; @@ -165,3 +172,3 @@ void POP3wrapper::login() 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")); @@ -239,3 +246,3 @@ void POP3wrapper::statusFolder(folderStat&target_stat,const QString&) { if (r != MAIL_NO_ERROR) { - odebug << "error getting folter status." << oendl; + odebug << "error getting folter status." << oendl; } 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 @@ -39,2 +39,4 @@ protected: mailstorage*m_pop3; + int m_maxsize; + bool m_checksize; }; 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 @@ -18,3 +18,2 @@ - Settings::Settings() @@ -29,3 +28,3 @@ void Settings::checkDirectory() system( "mkdir -p $HOME/Applications/opiemail" ); - odebug << "$HOME/Applications/opiemail created" << oendl; + odebug << "$HOME/Applications/opiemail created" << oendl; } @@ -57,3 +56,3 @@ void Settings::updateAccounts() 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, "") ); @@ -64,3 +63,3 @@ void Settings::updateAccounts() 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, "") ); @@ -71,3 +70,3 @@ void Settings::updateAccounts() 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, "") ); @@ -78,3 +77,3 @@ void Settings::updateAccounts() 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, "") ); @@ -182,3 +181,3 @@ void IMAPaccount::save() { - odebug << "saving " + getFileName() << oendl; + odebug << "saving " + getFileName() << oendl; Settings::checkDirectory(); @@ -215,2 +214,4 @@ POP3account::POP3account() port = POP3_PORT; + m_CheckSize = true; + m_MaxSize = 1024; } @@ -226,2 +227,4 @@ POP3account::POP3account( QString filename ) port = POP3_PORT; + m_CheckSize = true; + m_MaxSize = 1024; } @@ -255,2 +258,4 @@ void POP3account::read() offline = conf->readBoolEntry("Offline",false); + m_CheckSize = conf->readBoolEntry("Checkmaxsize",true); + m_MaxSize = conf->readNumEntry("Maxsize",1024); delete conf; @@ -260,3 +265,3 @@ void POP3account::save() { - odebug << "saving " + getFileName() << oendl; + odebug << "saving " + getFileName() << oendl; Settings::checkDirectory(); @@ -273,2 +278,4 @@ void POP3account::save() conf->writeEntry( "Offline",offline); + conf->writeEntry("Checkmaxsize",m_CheckSize); + conf->writeEntry("Maxsize",m_MaxSize); conf->write(); @@ -283,2 +290,22 @@ QString POP3account::getFileName() +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() @@ -342,3 +369,3 @@ void SMTPaccount::save() { - odebug << "saving " + getFileName() << oendl; + odebug << "saving " + getFileName() << oendl; Settings::checkDirectory(); @@ -419,3 +446,3 @@ void NNTPaccount::save() { - odebug << "saving " + getFileName() << oendl; + odebug << "saving " + getFileName() << oendl; Settings::checkDirectory(); 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 @@ -91,2 +91,6 @@ public: virtual QString getFileName(); + virtual bool getCheckMaxSize()const; + virtual void setCheckMaxSize(bool); + virtual int getMaxSize()const; + virtual void setMaxSize(int); @@ -94,3 +98,4 @@ private: QString file; - + bool m_CheckSize; + int m_MaxSize; }; 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 @@ -13,3 +13,3 @@ <y>0</y> - <width>314</width> + <width>302</width> <height>410</height> @@ -30,3 +30,3 @@ <name>margin</name> - <number>3</number> + <number>11</number> </property> @@ -34,3 +34,3 @@ <name>spacing</name> - <number>3</number> + <number>6</number> </property> @@ -321,2 +321,60 @@ </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> @@ -348,4 +406,8 @@ <tabstop>portLine</tabstop> + <tabstop>ComboBox1</tabstop> + <tabstop>CommandEdit</tabstop> <tabstop>userLine</tabstop> <tabstop>passLine</tabstop> + <tabstop>m_CheckSize</tabstop> + <tabstop>m_MailLimitBox</tabstop> </tabstops> |