summaryrefslogtreecommitdiff
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
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 (more/less context) (show whitespace changes)
-rw-r--r--noncore/net/mail/accountview.cpp15
-rw-r--r--noncore/net/mail/editaccounts.cpp4
-rw-r--r--noncore/net/mail/libmailwrapper/genericwrapper.cpp13
-rw-r--r--noncore/net/mail/libmailwrapper/imapwrapper.cpp20
-rw-r--r--noncore/net/mail/libmailwrapper/mhwrapper.cpp0
-rw-r--r--noncore/net/mail/libmailwrapper/pop3wrapper.cpp9
-rw-r--r--noncore/net/mail/libmailwrapper/pop3wrapper.h2
-rw-r--r--noncore/net/mail/libmailwrapper/settings.cpp29
-rw-r--r--noncore/net/mail/libmailwrapper/settings.h7
-rw-r--r--noncore/net/mail/pop3configui.ui68
10 files changed, 140 insertions, 27 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,6 +65,4 @@ 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);
@@ -72,5 +70,3 @@ void AccountView::populate( QList<Account> list )
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);
@@ -79,5 +75,3 @@ void AccountView::populate( QList<Account> list )
(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);
@@ -86,2 +80,3 @@ void AccountView::populate( QList<Account> list )
(void) new NNTPviewItem( nntp, this );
+ } else if ( it->getType() == MAILLIB::A_MH ) {
}
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
@@ -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());
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
@@ -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 );
@@ -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,3 +471,9 @@ 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));
@@ -473,3 +483,4 @@ RecMail*IMAPwrapper::parse_list_result(mailimap_msg_att* m_att)
} 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);
}
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
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();
}
@@ -47,4 +50,8 @@ RecBodyP POP3wrapper::fetchBody( const RecMailP &mail ) {
mailmessage * mailmsg;
- if (mail->Msgsize()>HARD_MSG_SIZE_LIMIT) {
+ 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;
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()
@@ -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;
@@ -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()
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>