summaryrefslogtreecommitdiffabout
Side-by-side diff
Diffstat (more/less context) (ignore whitespace changes)
-rw-r--r--kmicromail/accountitem.cpp7
-rw-r--r--kmicromail/libmailwrapper/abstractmail.cpp1
-rw-r--r--kmicromail/libmailwrapper/genericwrapper.cpp35
-rw-r--r--kmicromail/libmailwrapper/genericwrapper.h2
-rw-r--r--kmicromail/libmailwrapper/imapwrapper.cpp17
-rw-r--r--kmicromail/libmailwrapper/mailtypes.cpp20
-rw-r--r--kmicromail/libmailwrapper/mailtypes.h4
-rw-r--r--kmicromail/opiemail.cpp5
8 files changed, 63 insertions, 28 deletions
diff --git a/kmicromail/accountitem.cpp b/kmicromail/accountitem.cpp
index 7795055..49d86fc 100644
--- a/kmicromail/accountitem.cpp
+++ b/kmicromail/accountitem.cpp
@@ -293,25 +293,25 @@ RECBODYP NNTPviewItem::fetchBody( const RecMailP &mail )
return wrapper->fetchBody( mail );
}
QPopupMenu * NNTPviewItem::getContextMenu()
{
QPopupMenu *m = new QPopupMenu(0);
if (m)
{
if (!account->getOffline())
{
m->insertItem(QObject::tr("Disconnect",contextName),0);
m->insertItem(QObject::tr("Set offline",contextName),1);
- m->insertItem(QObject::tr("(Un-)Subscribe groups",contextName),2);
+ //m->insertItem(QObject::tr("(Un-)Subscribe groups",contextName),2);
}
else
{
m->insertItem(QObject::tr("Set online",contextName),1);
}
}
return m;
}
void NNTPviewItem::subscribeGroups()
{
NNTPGroupsDlg dlg(account);
@@ -750,27 +750,26 @@ void IMAPfolderItem::contextMenuSelected(int id)
break;
case 2:
createNewFolder();
break;
case 3:
deleteFolder();
break;
case 4:
downloadMails();
break;
case GET_NEW_MAILS: // daunlood
{
- AccountView*bl = accountView();
- if (!bl) return;
- bl->downloadMailsInbox(getFolder(),imap->getWrapper());
+ if (!view) return;
+ view->downloadMailsInbox(getFolder(),imap->getWrapper());
}
break;
default:
break;
}
}
/**
* MH Account stuff
*/
/* MH is a little bit different - the top folder can contains messages other than in IMAP and
POP3 and MBOX */
diff --git a/kmicromail/libmailwrapper/abstractmail.cpp b/kmicromail/libmailwrapper/abstractmail.cpp
index 8f67566..88545f8 100644
--- a/kmicromail/libmailwrapper/abstractmail.cpp
+++ b/kmicromail/libmailwrapper/abstractmail.cpp
@@ -195,24 +195,25 @@ void AbstractMail::downloadNewMails(const FolderP&fromFolder, AbstractMail*targe
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 ) {
+ //qDebug("AAAdate *%s* ", r->isodate.latin1() );
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
diff --git a/kmicromail/libmailwrapper/genericwrapper.cpp b/kmicromail/libmailwrapper/genericwrapper.cpp
index c3a1627..d99c6a3 100644
--- a/kmicromail/libmailwrapper/genericwrapper.cpp
+++ b/kmicromail/libmailwrapper/genericwrapper.cpp
@@ -18,77 +18,85 @@ Genericwrapper::Genericwrapper()
}
Genericwrapper::~Genericwrapper()
{
if (m_folder) {
mailfolder_free(m_folder);
}
if (m_storage) {
mailstorage_free(m_storage);
}
cleanMimeCache();
}
-QString Genericwrapper::parseDateTime( mailimf_date_time *date )
+const QDateTime Genericwrapper::parseDateTime( mailimf_date_time *date )
{
static bool init = false ;
if ( ! init ) {
KConfig kon ( locateLocal( "config", "korganizerrc" ) );
kon.setGroup("Locale");
KGlobal::locale()->setIntDateFormat( (KLocale::IntDateFormat)kon.readNumEntry( "PreferredDate",0) );
QString dummy = kon.readEntry( "UserDateFormatShort","%aK %d.%m.%y" );// kon.readEntry( "");
KGlobal::locale()->setHore24Format( !kon.readBoolEntry( "PreferredTime",0 ) );
KGlobal::locale()->setDateFormatShort(dummy.replace( QRegExp("K"), QString(",") ));
dummy = kon.readEntry( "UserDateFormatLong","%A %d %b %y" );
KGlobal::locale()->setDateFormat(dummy.replace( QRegExp("K"), QString(",") ));
kon.setGroup("Time & Date");
KGlobal::locale()->setDaylightSaving( kon.readBoolEntry( "UseDaylightsaving", true ),
kon.readNumEntry( "DaylightsavingStart", 90),
kon.readNumEntry( "DaylightsavingEnd",304) );
KGlobal::locale()->setTimezone( kon.readEntry( "TimeZoneName" ," 00:00 Europe/London(UTC)") );
init = true;
}
QDate da (date->dt_year,date->dt_month, date->dt_day );
QTime ti ( date->dt_hour, date->dt_min, date->dt_sec );
QDateTime dt ( da ,ti );
+ int addsec = -date->dt_zone*36;
+ //qDebug("adsec1 %d ",addsec );
+ dt = dt.addSecs( addsec );
int off = KGlobal::locale()->localTimeOffset( dt );
- //dt = dt.addSecs( off*60 );
+ //qDebug("adsec2 %d ",off*60 );
+
+ dt = dt.addSecs( off*60 );
+ return dt;
+#if 0
QString ret;
- if ( da == QDate::currentDate () )
- ret = KGlobal::locale()->formatTime( ti,true);
+ if ( dt.date() == QDate::currentDate () )
+ ret = KGlobal::locale()->formatTime( dt.time(),true);
else {
ret = KGlobal::locale()->formatDateTime( dt,true,true);
}
+#endif
#if 0
if ( off < 0 )
ret += " -";
else
ret += " +";
ret += QString::number( off / 60 );
ret += "h";
#endif
#if 0
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 );
snprintf( tmp, 23, "%04i-%02i-%02i %02i:%02i:%02i %+05i",
date->dt_year,date->dt_month, date->dt_day, date->dt_hour, date->dt_min, date->dt_sec, date->dt_zone );
return QString( tmp );
#endif
- return ret;
+ //return ret;
}
void Genericwrapper::fillSingleBody(RecPartP&target,mailmessage*,mailmime*mime)
{
if (!mime) {
return;
}
mailmime_field*field = 0;
mailmime_single_fields fields;
memset(&fields, 0, sizeof(struct mailmime_single_fields));
if (mime->mm_mime_fields != NULL) {
mailmime_single_fields_init(&fields, mime->mm_mime_fields,
@@ -486,29 +494,36 @@ void Genericwrapper::parseList(QValueList<Opie::Core::OSmartPointer<RecMail> > &
mail->setFrom(parseMailboxList(single_fields.fld_from->frm_mb_list));
if (!mbox_as_to) {
if (single_fields.fld_to)
mail->setTo( parseAddressList( single_fields.fld_to->to_addr_list ) );
} else {
mail->setTo(mailbox);
}
if (single_fields.fld_cc)
mail->setCC( parseAddressList( single_fields.fld_cc->cc_addr_list ) );
if (single_fields.fld_bcc)
mail->setBcc( parseAddressList( single_fields.fld_bcc->bcc_addr_list ) );
if (single_fields.fld_orig_date) {
- mail->setDate( parseDateTime( single_fields.fld_orig_date->dt_date_time ) );
- char tmp[23];
- struct mailimf_date_time* date = single_fields.fld_orig_date->dt_date_time;
- snprintf( tmp, 23, "%04i-%02i-%02i %02i:%02i:%02i %05i",
- date->dt_year,date->dt_month, date->dt_day, date->dt_hour, date->dt_min, date->dt_sec, date->dt_zone );
+ QDateTime dt = Genericwrapper::parseDateTime( single_fields.fld_orig_date->dt_date_time );
+ QString ret;
+ if ( dt.date() == QDate::currentDate () )
+ ret = KGlobal::locale()->formatTime( dt.time(),true);
+ else {
+ ret = KGlobal::locale()->formatDateTime( dt,true,true);
+ }
+ mail->setDate( ret );
+ char tmp[20];
+ snprintf( tmp, 20, "%04i-%02i-%02i %02i:%02i:%02i",
+ dt.date().year(),dt.date().month(), dt.date().day(), dt.time().hour(), dt.time().minute(), dt.time().second() );
+ //qDebug(" iso %s ", tmp);
mail->setIsoDate( QString( tmp ) );
}
// crashes when accessing pop3 account?
if (single_fields.fld_message_id) {
mail->setMsgid(QString(single_fields.fld_message_id->mid_value));
; // odebug << "Msgid == " << mail->Msgid().latin1() << "" << oendl;
}
if (single_fields.fld_reply_to) {
QStringList t = parseAddressList(single_fields.fld_reply_to->rt_addr_list);
if (t.count()>0) {
mail->setReplyto(t[0]);
}
diff --git a/kmicromail/libmailwrapper/genericwrapper.h b/kmicromail/libmailwrapper/genericwrapper.h
index 244212f..c35a6da 100644
--- a/kmicromail/libmailwrapper/genericwrapper.h
+++ b/kmicromail/libmailwrapper/genericwrapper.h
@@ -33,25 +33,25 @@ class Genericwrapper : public AbstractMail
Q_OBJECT
public:
Genericwrapper();
virtual ~Genericwrapper();
virtual encodedString* fetchDecodedPart(const RecMailP&mail,const RecPartP&part);
virtual encodedString* fetchRawPart(const RecMailP&mail,const RecPartP&part);
virtual QString fetchTextPart(const RecMailP&mail,const RecPartP&part);
virtual void cleanMimeCache();
virtual int deleteMbox(const Opie::Core::OSmartPointer<Folder>&){return 1;}
virtual void logout(){};
virtual void storeMessage(const char*msg,size_t length, const QString&folder){};
- static QString parseDateTime( mailimf_date_time *date );
+ static const QDateTime parseDateTime( mailimf_date_time *date );
protected:
RecBodyP parseMail( mailmessage * msg );
QString parseMailboxList( mailimf_mailbox_list *list );
QString parseMailbox( mailimf_mailbox *box );
QString parseGroup( mailimf_group *group );
QString parseAddressList( mailimf_address_list *list );
void traverseBody(RecBodyP&target,mailmessage*message,mailmime*mime,QValueList<int>recList,unsigned int current_rek=0,int current_count=1);
static void fillSingleBody(RecPartP&target,mailmessage*message,mailmime*mime);
static void fillParameters(RecPartP&target,clist*parameters);
static QString getencoding(mailmime_mechanism*aEnc);
diff --git a/kmicromail/libmailwrapper/imapwrapper.cpp b/kmicromail/libmailwrapper/imapwrapper.cpp
index d79df4f..b0dd1b8 100644
--- a/kmicromail/libmailwrapper/imapwrapper.cpp
+++ b/kmicromail/libmailwrapper/imapwrapper.cpp
@@ -1,22 +1,23 @@
// CHANGED 2004-09-31 Lutz Rogowski
#include <stdlib.h>
#include <libetpan/libetpan.h>
#include <qpe/global.h>
#include <qapplication.h>
#include "imapwrapper.h"
#include "mailtypes.h"
#include "logindialog.h"
#include <qprogressbar.h>
#include "genericwrapper.h"
+#include <kglobal.h>
using namespace Opie::Core;
int IMAPwrapper::mMax = 0;
int IMAPwrapper::mCurrent = 0;
IMAPwrapper::IMAPwrapper( IMAPaccount *a )
: AbstractMail()
{
account = a;
m_imap = 0;
m_Lastmbox = "";
mCurrent = 0;
@@ -456,28 +457,36 @@ RecMail*IMAPwrapper::parse_list_result(mailimap_msg_att* m_att)
if (item->att_data.att_static->att_type==MAILIMAP_MSG_ATT_ENVELOPE) {
mailimap_envelope * head = item->att_data.att_static->att_data.att_env;
if ( head == NULL )
continue;
if ( head->env_date != NULL ) {
m->setDate(head->env_date);
struct mailimf_date_time result;
struct mailimf_date_time* date = &result;
struct mailimf_date_time **re = &date;
size_t length = m->getDate().length();
size_t index = 0;
if ( mailimf_date_time_parse(head->env_date, length,&index, re ) == MAILIMF_NO_ERROR ) {
- m->setDate( Genericwrapper::parseDateTime( date ) );
- char tmp[23];
- snprintf( tmp, 23, "%04i-%02i-%02i %02i:%02i:%02i %05i",
- date->dt_year,date->dt_month, date->dt_day, date->dt_hour, date->dt_min, date->dt_sec, date->dt_zone );
+ QDateTime dt = Genericwrapper::parseDateTime( date );
+ QString ret;
+ if ( dt.date() == QDate::currentDate () )
+ ret = KGlobal::locale()->formatTime( dt.time(),true);
+ else {
+ ret = KGlobal::locale()->formatDateTime( dt,true,true);
+ }
+ m->setDate( ret );
+ char tmp[20];
+ snprintf( tmp, 20, "%04i-%02i-%02i %02i:%02i:%02i",
+ dt.date().year(),dt.date().month(), dt.date().day(), dt.time().hour(), dt.time().minute(), dt.time().second() );
+ //qDebug("%d iso %s %s ", date->dt_zone, tmp, head->env_date);
m->setIsoDate( QString( tmp ) );
} else {
m->setIsoDate(head->env_date);
}
}
if ( head->env_subject != NULL )
m->setSubject(convert_String((const char*)head->env_subject));
//m->setSubject(head->env_subject);
if (head->env_from!=NULL) {
addresslist = address_list_to_stringlist(head->env_from->frm_list);
if (addresslist.count()) {
m->setFrom(addresslist.first());
diff --git a/kmicromail/libmailwrapper/mailtypes.cpp b/kmicromail/libmailwrapper/mailtypes.cpp
index 1a4ffd1..af3b9d0 100644
--- a/kmicromail/libmailwrapper/mailtypes.cpp
+++ b/kmicromail/libmailwrapper/mailtypes.cpp
@@ -24,34 +24,40 @@ RecMail::~RecMail()
wrapper = 0;
}
static bool stringCompareRec( const QString& s1, const QString& s2 )
{
if ( s1.isEmpty() && s2.isEmpty() )
return true;
return s1 == s2;
}
bool RecMail::isEqual( RecMail* r1 )
{
if ( !stringCompareRec( isodate, r1->isodate ) ) {
- // qDebug("date *%s* *%s* ", isodate.latin1(), r1->isodate.latin1());
+ //qDebug("date *%s* *%s* ", isodate.latin1(), r1->isodate.latin1());
return false;
- }
- if ( !stringCompareRec( from, r1->from ) ) {
- //qDebug("from *%s* *%s* ", from.latin1(), r1->from.latin1());
+ }
+ if ( !stringCompareRec( subject.left(40), r1->subject.left(40) ) ) {
+ //qDebug("sub *%s* *%s*", subject.latin1(), r1->subject.latin1());
return false;
}
- if ( !stringCompareRec( subject, r1->subject ) ) {
- //qDebug("sub ");
- return false;
+
+ //qDebug("date *%s* *%s* ", isodate.latin1(), r1->isodate.latin1());
+ if ( !stringCompareRec( from.left(40), r1->from.left(40)) ) {
+ if ( r1->from.find ( from ) < 0 ) {
+ if ( !stringCompareRec( from.simplifyWhiteSpace ().left(40), r1->from.simplifyWhiteSpace ().left(40)) ) {
+ //qDebug("from *%s* *%s* ", from.left(40).latin1(), r1->from.left(20).latin1());
+ return false;
+ }
+ }
}
return true;
}
void RecMail::copy_old(const RecMail&old)
{
subject = old.subject;
date = old.date;
mbox = old.mbox;
msg_id = old.msg_id;
msg_size = old.msg_size;
msg_number = old.msg_number;
diff --git a/kmicromail/libmailwrapper/mailtypes.h b/kmicromail/libmailwrapper/mailtypes.h
index 020278d..c1c1a74 100644
--- a/kmicromail/libmailwrapper/mailtypes.h
+++ b/kmicromail/libmailwrapper/mailtypes.h
@@ -64,27 +64,29 @@ public:
void setBcc(const QStringList&list);
const QStringList&Bcc()const;
void setInreply(const QStringList&list);
const QStringList&Inreply()const;
void setReferences(const QStringList&list);
const QStringList&References()const;
const QBitArray&getFlags()const{return msg_flags;}
void setFlags(const QBitArray&flags){msg_flags = flags;}
void setWrapper(AbstractMail*wrapper);
AbstractMail* Wrapper();
+ // public for debugging
+ QString subject,date,isodate,from,mbox,msg_id,replyto;
protected:
- QString subject,date,isodate,from,mbox,msg_id,replyto;
+ //QString subject,date,isodate,from,mbox,msg_id,replyto;
unsigned int msg_number,msg_size;
QBitArray msg_flags;
QStringList to,cc,bcc,in_reply_to,references;
AbstractMail*wrapper;
void init();
void copy_old(const RecMail&old);
};
typedef Opie::Core::OSmartPointer<RecMail> RecMailP;
typedef QMap<QString,QString> part_plist_t;
class RecPart:public Opie::Core::ORefCount
diff --git a/kmicromail/opiemail.cpp b/kmicromail/opiemail.cpp
index 7ccfb65..3cbac8e 100644
--- a/kmicromail/opiemail.cpp
+++ b/kmicromail/opiemail.cpp
@@ -312,25 +312,28 @@ void OpieMail::clearSelection()
void OpieMail::mailHold(int button, QListViewItem *item,const QPoint&,int )
{
if (!mailView->currentItem()) return;
MAILLIB::ATYPE mailtype = ((MailListViewItem*)mailView->currentItem() )->wrapperType();
/* just the RIGHT button - or hold on pda */
if (button!=2) {return;}
if (!item) return;
QPopupMenu *m = new QPopupMenu(0);
if (m)
{
if (mailtype==MAILLIB::A_NNTP) {
m->insertItem(tr("Read this posting"),this,SLOT(displayMail()));
-// m->insertItem(tr("Copy this posting"),this,SLOT(slotMoveCopyMail()));
+ m->insertItem(tr("Copy this posting"),this,SLOT(slotMoveCopyMail()));
+ m->insertSeparator();
+ m->insertItem(tr("Copy all selected postings"),this,SLOT(slotMoveCopyAllMail()));
+ m->insertItem(tr("Clear selection"),this,SLOT(clearSelection()));
} else {
if (folderView->currentisDraft()) {
m->insertItem(tr("Edit this mail"),this,SLOT(reEditMail()));
}
m->insertItem(tr("Read this mail"),this,SLOT(displayMail()));
m->insertItem(tr("Move/Copy this mail"),this,SLOT(slotMoveCopyMail()));
m->insertItem(tr("Delete this mail"),this,SLOT(slotDeleteMail()));
m->insertSeparator();
m->insertItem(tr("Move/Copy all selected mail"),this,SLOT(slotMoveCopyAllMail()));
m->insertItem(tr("Delete all selected mails"),this,SLOT(slotDeleteAllMail()));
m->insertItem(tr("Clear selection"),this,SLOT(clearSelection()));
}