summaryrefslogtreecommitdiffabout
path: root/kmicromail
authorzautrix <zautrix>2004-09-11 18:10:31 (UTC)
committer zautrix <zautrix>2004-09-11 18:10:31 (UTC)
commit53dda80aaab72d7efdbed8a206dc1fa64fed10ee (patch) (side-by-side diff)
tree23b5248145679628c0d346f7d42c53714634e1a3 /kmicromail
parent438403295657bdcab9ee9e526c6a08894e876f63 (diff)
downloadkdepimpi-53dda80aaab72d7efdbed8a206dc1fa64fed10ee.zip
kdepimpi-53dda80aaab72d7efdbed8a206dc1fa64fed10ee.tar.gz
kdepimpi-53dda80aaab72d7efdbed8a206dc1fa64fed10ee.tar.bz2
progress fixes
Diffstat (limited to 'kmicromail') (more/less context) (ignore whitespace changes)
-rw-r--r--kmicromail/imapconfigui.ui6
-rw-r--r--kmicromail/libmailwrapper/abstractmail.cpp13
-rw-r--r--kmicromail/libmailwrapper/imapwrapper.cpp5
-rw-r--r--kmicromail/libmailwrapper/pop3wrapper.cpp12
-rw-r--r--kmicromail/mainwindow.cpp3
-rw-r--r--kmicromail/pop3configui.ui6
6 files changed, 31 insertions, 14 deletions
diff --git a/kmicromail/imapconfigui.ui b/kmicromail/imapconfigui.ui
index 2e4c9ca..d24c9ea 100644
--- a/kmicromail/imapconfigui.ui
+++ b/kmicromail/imapconfigui.ui
@@ -1,111 +1,111 @@
<!DOCTYPE UI><UI>
<class>IMAPconfigUI</class>
<widget>
<class>QDialog</class>
<property stdset="1">
<name>name</name>
<cstring>IMAPconfigUI</cstring>
</property>
<property stdset="1">
<name>geometry</name>
<rect>
<x>0</x>
<y>0</y>
- <width>306</width>
- <height>396</height>
+ <width>269</width>
+ <height>388</height>
</rect>
</property>
<property stdset="1">
<name>caption</name>
<string>Configure IMAP</string>
</property>
<property>
<name>layoutMargin</name>
</property>
<property>
<name>layoutSpacing</name>
</property>
<vbox>
<property stdset="1">
<name>margin</name>
<number>3</number>
</property>
<property stdset="1">
<name>spacing</name>
<number>1</number>
</property>
<widget>
<class>QLayoutWidget</class>
<property stdset="1">
<name>name</name>
<cstring>Layout22</cstring>
</property>
<hbox>
<property stdset="1">
<name>margin</name>
<number>0</number>
</property>
<property stdset="1">
<name>spacing</name>
<number>6</number>
</property>
<widget>
<class>QLabel</class>
<property stdset="1">
<name>name</name>
<cstring>accountLabel</cstring>
</property>
<property stdset="1">
<name>text</name>
<string>Account</string>
</property>
</widget>
<widget>
<class>QLineEdit</class>
<property stdset="1">
<name>name</name>
<cstring>accountLine</cstring>
</property>
<property>
<name>toolTip</name>
<string>Name of the Account</string>
</property>
</widget>
</hbox>
</widget>
<widget>
<class>Line</class>
<property stdset="1">
<name>name</name>
<cstring>line1</cstring>
</property>
<property stdset="1">
<name>orientation</name>
<enum>Horizontal</enum>
</property>
</widget>
<widget>
<class>QLayoutWidget</class>
<property stdset="1">
<name>name</name>
<cstring>Layout23</cstring>
</property>
<hbox>
<property stdset="1">
<name>margin</name>
<number>0</number>
</property>
<property stdset="1">
<name>spacing</name>
<number>6</number>
</property>
<widget>
<class>QLabel</class>
<property stdset="1">
<name>name</name>
<cstring>serverLabel</cstring>
</property>
<property stdset="1">
<name>text</name>
<string>Server</string>
</property>
@@ -314,162 +314,162 @@
<class>QLayoutWidget</class>
<property stdset="1">
<name>name</name>
<cstring>Layout27</cstring>
</property>
<hbox>
<property stdset="1">
<name>margin</name>
<number>0</number>
</property>
<property stdset="1">
<name>spacing</name>
<number>6</number>
</property>
<widget>
<class>QLabel</class>
<property stdset="1">
<name>name</name>
<cstring>prefixLabel</cstring>
</property>
<property stdset="1">
<name>text</name>
<string>Prefix</string>
</property>
</widget>
<widget>
<class>QLineEdit</class>
<property stdset="1">
<name>name</name>
<cstring>prefixLine</cstring>
</property>
</widget>
</hbox>
</widget>
<widget>
<class>QLayoutWidget</class>
<property stdset="1">
<name>name</name>
<cstring>Layout11</cstring>
</property>
<hbox>
<property stdset="1">
<name>margin</name>
<number>0</number>
</property>
<property stdset="1">
<name>spacing</name>
<number>6</number>
</property>
<widget>
<class>QLabel</class>
<property stdset="1">
<name>name</name>
<cstring>TextLabel1_2</cstring>
</property>
<property stdset="1">
<name>text</name>
<string>Local storage folder:</string>
</property>
</widget>
<widget>
<class>QLineEdit</class>
<property stdset="1">
<name>name</name>
<cstring>localFolder</cstring>
</property>
<property stdset="1">
<name>text</name>
<string></string>
</property>
</widget>
</hbox>
</widget>
<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>
<property stdset="1">
<name>spacing</name>
<number>6</number>
</property>
<widget>
<class>QCheckBox</class>
<property stdset="1">
<name>name</name>
<cstring>CheckBoxDown</cstring>
</property>
<property stdset="1">
<name>text</name>
- <string>Download only messages smaller</string>
+ <string>Get only messages smaller</string>
</property>
</widget>
<widget>
<class>QSpinBox</class>
<property stdset="1">
<name>name</name>
<cstring>SpinBoxDown</cstring>
</property>
<property stdset="1">
<name>suffix</name>
<string>kB</string>
</property>
<property stdset="1">
<name>maxValue</name>
<number>99999</number>
</property>
<property stdset="1">
<name>minValue</name>
<number>1</number>
</property>
</widget>
</hbox>
</widget>
<widget>
<class>QCheckBox</class>
<property stdset="1">
<name>name</name>
<cstring>CheckBoxLeaveOn</cstring>
</property>
<property stdset="1">
<name>text</name>
<string>Leave Messages on Server</string>
</property>
</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>
</property>
<property>
<name>sizeHint</name>
<size>
<width>20</width>
<height>20</height>
</size>
</property>
</spacer>
</vbox>
</widget>
<tabstops>
<tabstop>accountLine</tabstop>
<tabstop>serverLine</tabstop>
<tabstop>portLine</tabstop>
<tabstop>userLine</tabstop>
<tabstop>passLine</tabstop>
</tabstops>
</UI>
diff --git a/kmicromail/libmailwrapper/abstractmail.cpp b/kmicromail/libmailwrapper/abstractmail.cpp
index 44878e0..8f67566 100644
--- a/kmicromail/libmailwrapper/abstractmail.cpp
+++ b/kmicromail/libmailwrapper/abstractmail.cpp
@@ -55,218 +55,223 @@ AbstractMail* AbstractMail::getWrapper(Account*a)
break;
default:
return 0;
}
}
encodedString* AbstractMail::decode_String(const encodedString*text,const QString&enc)
{
// odebug << "Decode string start" << oendl;
char*result_text;
size_t index = 0;
/* reset for recursive use! */
size_t target_length = 0;
result_text = 0;
int mimetype = MAILMIME_MECHANISM_7BIT;
if (enc.lower()=="quoted-printable") {
mimetype = MAILMIME_MECHANISM_QUOTED_PRINTABLE;
} else if (enc.lower()=="base64") {
mimetype = MAILMIME_MECHANISM_BASE64;
} else if (enc.lower()=="8bit") {
mimetype = MAILMIME_MECHANISM_8BIT;
} else if (enc.lower()=="binary") {
mimetype = MAILMIME_MECHANISM_BINARY;
}
int err = mailmime_part_parse(text->Content(),text->Length(),&index,mimetype,
&result_text,&target_length);
encodedString* result = new encodedString();
if (err == MAILIMF_NO_ERROR) {
result->setContent(result_text,target_length);
}
//odebug << "Decode string finished" << oendl;
return result;
}
QString AbstractMail::convert_String(const char*text)
{
//size_t index = 0;
char*res = 0;
int err = MAILIMF_NO_ERROR;
QString result(text);
/* due a bug in libetpan it isn't usable this moment */
/* int err = mailmime_encoded_phrase_parse("iso-8859-1",
text, strlen(text),&index, "iso-8859-1",&res);*/
//odebug << "Input: " << text << "" << oendl;
if (err == MAILIMF_NO_ERROR && res && strlen(res)) {
// result = QString(res);
// odebug << "Res: " << res << ", length: " << strlen(res) << "" << oendl;
}
if (res) free(res);
return result;
}
/* cp & paste from launcher */
QString AbstractMail::gen_attachment_id()
{
QFile file( "/proc/sys/kernel/random/uuid" );
if (!file.open(IO_ReadOnly ) )
return QString::null;
QTextStream stream(&file);
return "{" + stream.read().stripWhiteSpace() + "}";
}
int AbstractMail::createMbox(const QString&,const FolderP&,const QString& ,bool)
{
return 0;
}
QString AbstractMail::defaultLocalfolder()
{
// QString f = getenv( "HOME" );
QString f = locateLocal( "data", "kopiemail/localmail");
// f += "/Applications/opiemail/localmail";
return f;
}
QString AbstractMail::draftFolder()
{
return QString("Drafts");
}
/* temporary - will be removed when implemented in all classes */
void AbstractMail::deleteMails(const QString &,const QValueList<Opie::Core::OSmartPointer<RecMail> > &)
{
}
void AbstractMail::deleteMailList(const QValueList<RecMailP>&target)
{
//qDebug("AbstractMail::deleteMailList:: Please reimplement! ");
// this is currently re-implemented in pop3wrapper and imapwrapper
int iii = 0;
int count = target.count();
- QWidget wid;
+ QProgressBar wid ( count );
+ wid.setCaption( tr("Deleting ..."));
wid.show();
while (iii < count ) {
- Global::statusMessage(tr("Delete message %1 of %2").arg(iii).arg(count));
+ Global::statusMessage(tr("Delete message %1 of %2").arg(iii).arg(count));
+ wid.setProgress( iii );
wid.raise();
qApp->processEvents();
RecMailP mail = (*target.at( iii ));
deleteMail(mail);
++iii;
}
}
void AbstractMail::downloadNewMails(const FolderP&fromFolder, AbstractMail*targetMail )
{
//qDebug("AbstractMail::downloadNewMails %s ", fromFolder->getName().latin1());
// get local folder
Account * acc = getAccount();
if ( !acc ) return;
QString lfName = acc->getLocalFolder();
if ( lfName.isEmpty() )
lfName = acc->getAccountName();
// create local folder
if ( !targetMail->createMbox(lfName))
{
QMessageBox::critical(0,tr("Error creating new Folder"),
tr("Error while creating new folder\n%1\n\nCancelling action.").arg(lfName));
return;
}
QValueList<RecMailP> t;
listMessages(fromFolder->getName(),t,acc->getMaxMailSize() );
if ( t.count() == 0 ) {
Global::statusMessage(tr("There are no new messages"));
return;
}
QValueList<RecMailP> e;
targetMail->listMessages(lfName,e,acc->getMaxMailSize() );
//qDebug("target has mails %d ", e.count());
QValueList<RecMailP> n;
int iii = 0;
int count = t.count();
while (iii < count ) {
RecMailP r = (*t.at( iii ));
bool found = false;
int jjj = 0;
int countE = e.count();
while (jjj < countE ) {
RecMailP re = (*e.at( jjj ));
if ( re->isEqual(r) ) {
found = true;
break;
}
++jjj;
}
if ( !found ) {
n.append( r );
}
++iii;
}
if ( n.count() == 0 ) {
Global::statusMessage(tr("There are no new messages"));
return;
}
mvcpMailList( n,lfName,targetMail,!acc->getLeaveOnServer());
Global::statusMessage(tr("Downloaded %1 messages").arg(n.count()));
#if 0
QValueList<RecMailP> t;
listMessages(fromFolder->getName(),t, maxSizeInKb);
mvcpMailList( t,targetFolder,targetWrapper,moveit);
#endif
}
void AbstractMail::mvcpAllMails(const FolderP&fromFolder,
const QString&targetFolder,AbstractMail*targetWrapper,bool moveit, int maxSizeInKb)
{
QValueList<RecMailP> t;
listMessages(fromFolder->getName(),t, maxSizeInKb);
mvcpMailList( t,targetFolder,targetWrapper,moveit);
}
void AbstractMail::mvcpMailList(const QValueList<RecMailP>& t,
const QString&targetFolder,AbstractMail*targetWrapper,bool moveit)
{
encodedString*st = 0;
int iii = 0;
int count = t.count();
if ( count == 0 )
return;
// wel, processevents is qite strange, we need a widget for getting
- // Global::statusMessage(tr("Copy2 message %1").arg(iii)); displayed
- QWidget wid;
+ // Global::statusMessage(tr("Copy2 message %1").arg(iii)); displaye
+
+ QProgressBar wid ( count );
+ wid.setCaption( tr("Copying ..."));
wid.show();
while (iii < count ) {
Global::statusMessage(tr("Copy message %1 of %2").arg(iii).arg(count));
+ wid.setProgress( iii );
wid.raise();
qApp->processEvents();
RecMailP r = (*t.at( iii ));
st = fetchRawBody(r);
if (st) {
targetWrapper->storeMessage(st->Content(),st->Length(),targetFolder);
delete st;
}
++iii;
}
if (moveit) {
deleteMailList( t );
//deleteAllMail(fromFolder);
}
}
void AbstractMail::mvcpMail(const RecMailP&mail,const QString&targetFolder,AbstractMail*targetWrapper,bool moveit)
{
encodedString*st = 0;
st = fetchRawBody(mail);
if (st) {
targetWrapper->storeMessage(st->Content(),st->Length(),targetFolder);
delete st;
}
if (moveit) {
deleteMail(mail);
}
}
diff --git a/kmicromail/libmailwrapper/imapwrapper.cpp b/kmicromail/libmailwrapper/imapwrapper.cpp
index 91332c3..d79df4f 100644
--- a/kmicromail/libmailwrapper/imapwrapper.cpp
+++ b/kmicromail/libmailwrapper/imapwrapper.cpp
@@ -851,196 +851,199 @@ void IMAPwrapper::fillSingleBasicPart(RecPartP&target_part,mailimap_body_type_ba
type = "audio";
break;
case MAILIMAP_MEDIA_BASIC_IMAGE:
type = "image";
break;
case MAILIMAP_MEDIA_BASIC_MESSAGE:
type = "message";
break;
case MAILIMAP_MEDIA_BASIC_VIDEO:
type = "video";
break;
case MAILIMAP_MEDIA_BASIC_OTHER:
default:
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;
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)) {
param = (mailimap_single_body_fld_param*)cur->data;
if (param) {
target_part->addParameter(QString(param->pa_name).lower(),QString(param->pa_value));
}
}
}
mailimap_body_fld_enc*enc = which->bd_encoding;
QString encoding("");
switch (enc->enc_type) {
case MAILIMAP_BODY_FLD_ENC_7BIT:
encoding = "7bit";
break;
case MAILIMAP_BODY_FLD_ENC_8BIT:
encoding = "8bit";
break;
case MAILIMAP_BODY_FLD_ENC_BINARY:
encoding="binary";
break;
case MAILIMAP_BODY_FLD_ENC_BASE64:
encoding="base64";
break;
case MAILIMAP_BODY_FLD_ENC_QUOTED_PRINTABLE:
encoding="quoted-printable";
break;
case MAILIMAP_BODY_FLD_ENC_OTHER:
default:
if (enc->enc_value) {
char*t=enc->enc_value;
encoding=QString(enc->enc_value);
enc->enc_value=0L;
free(t);
}
}
if (which->bd_description) {
target_part->setDescription(QString(which->bd_description));
}
target_part->setEncoding(encoding);
target_part->setSize(which->bd_size);
}
void IMAPwrapper::deleteMailList(const QValueList<RecMailP>&target)
{
//#if 0
mailimap_flag_list*flist;
mailimap_set *set;
mailimap_store_att_flags * store_flags;
int err;
login();
//#endif
if (!m_imap) {
return;
}
int iii = 0;
int count = target.count();
// qDebug("imap remove count %d ", count);
mMax = count;
//progress( tr("Delete"));
- QWidget wid;
+
+ QProgressBar wid ( count );
+ wid.setCaption( tr("Deleting ..."));
wid.show();
while (iii < count ) {
Global::statusMessage(tr("Delete message %1 of %2").arg(iii).arg(count));
+ wid.setProgress( iii );
wid.raise();
qApp->processEvents();
RecMailP mail = (*target.at( iii ));
//#if 0
//qDebug("IMAP remove %d %d ", iii, mail->getNumber() );
err = selectMbox(mail->getMbox());
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;
return;
}
// 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 mails: %s").arg(m_imap->imap_response));
// }
//#endif
//deleteMail( mail);
++iii;
}
//qDebug("Deleting imap mails... ");
err = mailimap_expunge(m_imap);
if (err != MAILIMAP_NO_ERROR) {
Global::statusMessage(tr("Error deleting mails: %s").arg(m_imap->imap_response));
}
}
void IMAPwrapper::deleteMail(const RecMailP&mail)
{
mailimap_flag_list*flist;
mailimap_set *set;
mailimap_store_att_flags * store_flags;
int err;
login();
if (!m_imap) {
return;
}
err = selectMbox(mail->getMbox());
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;
return;
}
// 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));
}
//qDebug("IMAPwrapper::deleteMail 2");
}
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;
}
err = selectMbox(mail->getMbox());
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);
diff --git a/kmicromail/libmailwrapper/pop3wrapper.cpp b/kmicromail/libmailwrapper/pop3wrapper.cpp
index 1edec9e..9d52f52 100644
--- a/kmicromail/libmailwrapper/pop3wrapper.cpp
+++ b/kmicromail/libmailwrapper/pop3wrapper.cpp
@@ -107,188 +107,196 @@ void POP3wrapper::listMessages(const QString &, QValueList<Opie::Core::OSmartPoi
uint32_t res_messages,res_recent,res_unseen;
mailsession_status_folder(m_pop3->sto_session,"INBOX",&res_messages,&res_recent,&res_unseen);
parseList(target,m_pop3->sto_session,"INBOX", false, maxSizeInKb);
Global::statusMessage( tr("Mailbox contains %1 mail(s)").arg(res_messages));
}
void POP3wrapper::login()
{
if (account->getOffline())
return;
/* we'll hold the line */
if ( m_pop3 != NULL )
return;
QString server,user, pass;
uint16_t port;
int err = MAILPOP3_NO_ERROR;
server = account->getServer();
port = account->getPort().toUInt();
if ( account->getUser().isEmpty() || account->getPassword().isEmpty() ) {
qApp->processEvents();
LoginDialog login( account->getUser(), account->getPassword(), NULL, 0, true );
login.show();
if ( QDialog::Accepted == login.exec() ) {
// ok
user = login.getUser();
pass = login.getPassword();
} else {
// cancel
; // odebug << "POP3: Login canceled" << oendl;
return;
}
} else {
user = account->getUser();
pass = account->getPassword();
}
// bool ssl = account->getSSL();
m_pop3=mailstorage_new(NULL);
int conntypeset = account->ConnectionType();
int conntype = 0;
if ( conntypeset == 3 ) {
conntype = CONNECTION_TYPE_COMMAND;
} else if ( conntypeset == 2 ) {
conntype = CONNECTION_TYPE_TLS;
} else if ( conntypeset == 1 ) {
conntype = CONNECTION_TYPE_STARTTLS;
} else if ( conntypeset == 0 ) {
conntype = CONNECTION_TYPE_TRY_STARTTLS;
}
//(ssl?CONNECTION_TYPE_TLS:CONNECTION_TYPE_PLAIN);
pop3_mailstorage_init(m_pop3,(char*)server.latin1(), port, NULL, conntype, POP3_AUTH_TYPE_PLAIN,
(char*)user.latin1(),(char*)pass.latin1(),0,0,0);
err = mailstorage_connect(m_pop3);
if (err != MAIL_NO_ERROR) {
; // odebug << QString( "FEHLERNUMMER %1" ).arg( err ) << oendl;
Global::statusMessage(tr("Error %1 initializing folder").arg( err ));
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;
}
}
}
void POP3wrapper::logout()
{
if ( m_pop3 == NULL )
return;
mailstorage_free(m_pop3);
m_pop3 = 0;
}
QValueList<Opie::Core::OSmartPointer<Folder> >* POP3wrapper::listFolders() {
QValueList<Opie::Core::OSmartPointer<Folder> >* folders = new QValueList<FolderP>();
FolderP inb=new Folder("INBOX","/");
folders->append(inb);
return folders;
}
void POP3wrapper::deleteMailList(const QValueList<RecMailP>&target)
{
login();
if (!m_pop3)
return;
int iii = 0;
int count = target.count();
- QWidget wid;
+
+ QProgressBar wid ( count );
+ wid.setCaption( tr("Deleting ..."));
wid.show();
while (iii < count ) {
Global::statusMessage(tr("Delete message %1 of %2").arg(iii).arg(count));
+ wid.setProgress( iii );
wid.raise();
qApp->processEvents();
//qDebug("delete ");
RecMailP mail = (*target.at( iii ));
int err = mailsession_remove_message(m_pop3->sto_session,mail->getNumber());
if (err != MAIL_NO_ERROR) {
Global::statusMessage(tr("Error deleting mail"));
}
++iii;
}
}
void POP3wrapper::deleteMail(const RecMailP&mail) {
login();
if (!m_pop3)
return;
int err = mailsession_remove_message(m_pop3->sto_session,mail->getNumber());
if (err != MAIL_NO_ERROR) {
Global::statusMessage(tr("error deleting mail"));
}
}
void POP3wrapper::answeredMail(const RecMailP&) {}
int POP3wrapper::deleteAllMail(const FolderP&) {
login();
if (!m_pop3)
return 0;
int res = 1;
uint32_t result = 0;
int err = mailsession_messages_number(m_pop3->sto_session,NULL,&result);
if (err != MAIL_NO_ERROR) {
Global::statusMessage(tr("Error getting folder info"));
return 0;
}
- QWidget wid;
+
+
+
+ QProgressBar wid ( result );
+ wid.setCaption( tr("Deleting ..."));
wid.show();
for (unsigned int i = 0; i < result; ++i) {
Global::statusMessage(tr("Delete message %1 of %2").arg(i).arg(result));
+ wid.setProgress( i );
wid.raise();
qApp->processEvents();
err = mailsession_remove_message(m_pop3->sto_session,i+1);
if (err != MAIL_NO_ERROR) {
Global::statusMessage(tr("Error deleting mail %1").arg(i+1));
res=0;
}
break;
}
return res;
}
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;
}
}
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);
if (target) {
res = new encodedString(target,length);
}
return res;
}
MAILLIB::ATYPE POP3wrapper::getType()const {
return account->getType();
}
const QString&POP3wrapper::getName()const{
return account->getAccountName();
}
diff --git a/kmicromail/mainwindow.cpp b/kmicromail/mainwindow.cpp
index 5f777a3..d130317 100644
--- a/kmicromail/mainwindow.cpp
+++ b/kmicromail/mainwindow.cpp
@@ -63,193 +63,194 @@ MainWindow::MainWindow( QWidget *parent, const char *name, WFlags flags )
0, 0, this, 0, true );
showFolders->addTo( toolBar );
showFolders->addTo( mailMenu );
showFolders->setOn( true );
connect(showFolders, SIGNAL( toggled(bool) ),
SLOT( slotShowFolders(bool) ) );
/*
searchMails = new QAction( tr( "Search mails" ), SmallIcon("find") ),
0, 0, this );
searchMails->addTo( toolBar );
searchMails->addTo( mailMenu );
*/
deleteMails = new QAction(tr("Delete Mail"), SmallIcon("trash"), 0, 0, this);
deleteMails->addTo( toolBar );
deleteMails->addTo( mailMenu );
connect( deleteMails, SIGNAL( activated() ),
SLOT( slotDeleteMail() ) );
editSettings = new QAction( tr( "Edit settings" ), SmallIcon("SettingsIcon") ,
0, 0, this );
editSettings->addTo( settingsMenu );
connect( editSettings, SIGNAL( activated() ),
SLOT( slotEditSettings() ) );
editAccounts = new QAction( tr( "Configure accounts" ), SmallIcon("editaccounts") ,
0, 0, this );
editAccounts->addTo( settingsMenu );
//setCentralWidget( view );
QVBox* wrapperBox = new QVBox( this );
setCentralWidget( wrapperBox );
// QWidget *view = new QWidget( wrapperBox );
KDGanttMinimizeSplitter* split = new KDGanttMinimizeSplitter( Qt::Horizontal, wrapperBox);
split->setMinimizeDirection( KDGanttMinimizeSplitter::Left);
//layout = new QBoxLayout ( split, QBoxLayout::LeftToRight );
folderView = new AccountView( split );
folderView->header()->hide();
folderView->setRootIsDecorated( false );
folderView->addColumn( tr( "Mailbox" ) );
//layout->addWidget( folderView );
mailView = new QListView( split );
mailView->addColumn( tr( " " ) );
mailView->addColumn( tr( "Subject" ),QListView::Manual );
mailView->addColumn( tr( "Sender" ),QListView::Manual );
mailView->addColumn( tr( "Size" ),QListView::Manual);
mailView->addColumn( tr( "Date" ),QListView::Manual);
mailView->setAllColumnsShowFocus(true);
//mailView->setSorting(-1);
mailView->setRootIsDecorated( false );
statusWidget = new StatusWidget( wrapperBox );
statusWidget->hide();
//layout->addWidget( mailView );
//layout->setStretchFactor( folderView, 1 );
//layout->setStretchFactor( mailView, 2 );
slotAdjustLayout();
#ifndef DESKTOP_VERSION
QPEApplication::setStylusOperation( mailView->viewport(),QPEApplication::RightOnHold);
QPEApplication::setStylusOperation( folderView->viewport(),QPEApplication::RightOnHold);
#endif
connect( mailView, SIGNAL( doubleClicked (QListViewItem* )),this,
SLOT( mailLeftClicked(QListViewItem*) ) );
connect( mailView, SIGNAL( returnPressed (QListViewItem* )),this,
SLOT( mailLeftClicked(QListViewItem*) ) );
connect( mailView, SIGNAL( mouseButtonPressed(int,QListViewItem*,const QPoint&,int) ),this,
SLOT( mailHold(int,QListViewItem*,const QPoint&,int) ) );
connect(folderView, SIGNAL(refreshMailview(const QValueList<RecMailP>&)),
this,SLOT(refreshMailView(const QValueList<RecMailP>&)));
connect( composeMail, SIGNAL( activated() ), SLOT( slotComposeMail() ) );
connect( sendQueued, SIGNAL( activated() ), SLOT( slotSendQueued() ) );
// connect( searchMails, SIGNAL( activated() ), SLOT( slotSearchMails() ) );
connect( editAccounts, SIGNAL( activated() ), SLOT( slotEditAccounts() ) );
//mailView->setMultiSelection ( true );
mailView->setSelectionMode( QListView::Extended );
QValueList<int> list;
int fw = 100;
if ( QApplication::desktop()->width() > 320 )
fw = 50;
list.append( fw );
list.append( 100 );
split->setSizes( list );
QTimer::singleShot( 1000, this, SLOT( slotAdjustColumns() ) );
mailView->setShowSortIndicator ( true );
QLabel *spacer = new QLabel( toolBar );
spacer->setBackgroundMode( QWidget::PaletteButton );
toolBar->setStretchableWidget( spacer );
QAction* closeMail = new QAction(tr("Close"),SmallIcon("exit"), 0, 0, this);
connect( closeMail, SIGNAL( activated() ), SLOT( close() ) );
- closeMail->addTo(toolBar);
+ if ( QApplication::desktop()->width() > 320 )
+ closeMail->addTo(toolBar);
closeMail->addTo(mailMenu);
QPopupMenu* helpMenu = new QPopupMenu( menuBar );
menuBar->insertItem( tr( "Help" ), helpMenu );
QAction* li = new QAction(tr("About"), QPixmap(), 0, 0, this);
connect( li, SIGNAL( activated() ), SLOT( showAbout()) );
li->addTo(helpMenu);
li = new QAction(tr("Licence"),QPixmap(), 0, 0, this);
connect( li, SIGNAL( activated() ), SLOT( showLicence()) );
li->addTo(helpMenu);
li = new QAction(tr("LibEtPan Licence"), QPixmap(), 0, 0, this);
connect( li, SIGNAL( activated() ), SLOT( showEtpanLicence()) );
li->addTo(helpMenu);
}
MainWindow::~MainWindow()
{
}
void MainWindow::showLicence()
{
KApplication::showLicence();
}
void MainWindow::showAbout()
{
QString version;
#include <../version>
QString cap = "About KOpieMail/Pi";
QString text = i18n("KOpieMail/Platform-independent\n") +
"(OM/Pi) " + version + " - "
#ifdef DESKTOP_VERSION
"Desktop Edition\n"
#else
"PDA-Edition\nfor: Zaurus 5x00 / 7x0 / 8x0\n"
#endif
"www.pi-sync.net\n\n"
"Copyright (c) 2004 Lutz Rogowski <lutz@pi-sync.net>\n"
"KOpieMail/Pi is based on Opie Mail\n"
"Copyright (c) Rajko Albrecht and the Opie team\n"
"KOpieMail/Pi is licensed under the GPL\n"
"\n"
"KOpieMail/Pi uses LibEtPan - a mail stuff library\n"
"Copyright (C) 2001, 2002 - DINH Viet Hoa\n"
"libEtPan has its own licence - see LibEtPan licence\n";
KApplication::showText( cap, text );
}
void MainWindow::showEtpanLicence()
{
KApplication::showFile( "LibEtPan licence", "kdepim/kopiemail/COPYRIGHTlibetpan" );
}
void MainWindow::appMessage(const QCString &, const QByteArray &)
{
qDebug("appMessage implemented by subclass");
}
void MainWindow::slotAdjustLayout() {
/*
QWidget *d = QApplication::desktop();
if ( d->width() < d->height() ) {
layout->setDirection( QBoxLayout::TopToBottom );
} else {
layout->setDirection( QBoxLayout::LeftToRight );
}
*/
}
void MainWindow::slotAdjustColumns()
{
bool hidden = folderView->isHidden();
if ( hidden ) folderView->show();
folderView->setColumnWidth( 0, folderView->visibleWidth() );
if ( hidden ) folderView->hide();
mailView->setColumnWidth( 0, 10 );
mailView->setColumnWidth( 1, 100 );
mailView->setColumnWidth( 2, 100 );
mailView->setColumnWidth( 3, 50 );
mailView->setColumnWidth( 4, 120 );
}
void MainWindow::slotEditSettings()
{
}
void MainWindow::slotShowFolders( bool )
{
diff --git a/kmicromail/pop3configui.ui b/kmicromail/pop3configui.ui
index 6acd394..f1dda7a 100644
--- a/kmicromail/pop3configui.ui
+++ b/kmicromail/pop3configui.ui
@@ -1,111 +1,111 @@
<!DOCTYPE UI><UI>
<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>306</width>
- <height>371</height>
+ <width>269</width>
+ <height>358</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>
</property>
<property stdset="1">
<name>spacing</name>
<number>1</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>
<property stdset="1">
<name>spacing</name>
<number>6</number>
</property>
<widget>
<class>QLabel</class>
<property stdset="1">
<name>name</name>
<cstring>accountLabel</cstring>
</property>
<property stdset="1">
<name>text</name>
<string>Account</string>
</property>
</widget>
<widget>
<class>QLineEdit</class>
<property stdset="1">
<name>name</name>
<cstring>accountLine</cstring>
</property>
<property>
<name>toolTip</name>
<string>Name of the Account</string>
</property>
</widget>
</hbox>
</widget>
<widget>
<class>Line</class>
<property stdset="1">
<name>name</name>
<cstring>line1</cstring>
</property>
<property stdset="1">
<name>orientation</name>
<enum>Horizontal</enum>
</property>
</widget>
<widget>
<class>QLayoutWidget</class>
<property stdset="1">
<name>name</name>
<cstring>Layout11</cstring>
</property>
<hbox>
<property stdset="1">
<name>margin</name>
<number>0</number>
</property>
<property stdset="1">
<name>spacing</name>
<number>6</number>
</property>
<widget>
<class>QLayoutWidget</class>
<property stdset="1">
<name>name</name>
<cstring>Layout9</cstring>
</property>
<vbox>
<property stdset="1">
<name>margin</name>
<number>0</number>
@@ -288,162 +288,162 @@
<name>name</name>
<cstring>Layout5</cstring>
</property>
<vbox>
<property stdset="1">
<name>margin</name>
<number>0</number>
</property>
<property stdset="1">
<name>spacing</name>
<number>6</number>
</property>
<widget>
<class>QLineEdit</class>
<property stdset="1">
<name>name</name>
<cstring>userLine</cstring>
</property>
</widget>
<widget>
<class>QLineEdit</class>
<property stdset="1">
<name>name</name>
<cstring>passLine</cstring>
</property>
<property stdset="1">
<name>echoMode</name>
<enum>Password</enum>
</property>
</widget>
</vbox>
</widget>
</hbox>
</widget>
<widget>
<class>QLayoutWidget</class>
<property stdset="1">
<name>name</name>
<cstring>Layout9</cstring>
</property>
<hbox>
<property stdset="1">
<name>margin</name>
<number>0</number>
</property>
<property stdset="1">
<name>spacing</name>
<number>6</number>
</property>
<widget>
<class>QLabel</class>
<property stdset="1">
<name>name</name>
<cstring>TextLabel1_2</cstring>
</property>
<property stdset="1">
<name>text</name>
<string>Local storage folder:</string>
</property>
</widget>
<widget>
<class>QLineEdit</class>
<property stdset="1">
<name>name</name>
<cstring>localFolder</cstring>
</property>
<property stdset="1">
<name>text</name>
<string></string>
</property>
</widget>
</hbox>
</widget>
<widget>
<class>QLayoutWidget</class>
<property stdset="1">
<name>name</name>
<cstring>Layout10</cstring>
</property>
<hbox>
<property stdset="1">
<name>margin</name>
<number>0</number>
</property>
<property stdset="1">
<name>spacing</name>
<number>6</number>
</property>
<widget>
<class>QCheckBox</class>
<property stdset="1">
<name>name</name>
<cstring>CheckBoxDown</cstring>
</property>
<property stdset="1">
<name>text</name>
- <string>Download only messages smaller</string>
+ <string>Get only messages smaller</string>
</property>
</widget>
<widget>
<class>QSpinBox</class>
<property stdset="1">
<name>name</name>
<cstring>SpinBoxDown</cstring>
</property>
<property stdset="1">
<name>suffix</name>
<string>kB</string>
</property>
<property stdset="1">
<name>maxValue</name>
<number>99999</number>
</property>
<property stdset="1">
<name>minValue</name>
<number>1</number>
</property>
</widget>
</hbox>
</widget>
<widget>
<class>QCheckBox</class>
<property stdset="1">
<name>name</name>
<cstring>CheckBoxLeaveOn</cstring>
</property>
<property stdset="1">
<name>text</name>
<string>Leave Messages on Server</string>
</property>
</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>
</property>
<property>
<name>sizeHint</name>
<size>
<width>20</width>
<height>20</height>
</size>
</property>
</spacer>
</vbox>
</widget>
<tabstops>
<tabstop>accountLine</tabstop>
<tabstop>serverLine</tabstop>
<tabstop>portLine</tabstop>
<tabstop>userLine</tabstop>
<tabstop>passLine</tabstop>
</tabstops>
</UI>