summaryrefslogtreecommitdiffabout
Side-by-side diff
Diffstat (more/less context) (show whitespace changes)
-rw-r--r--kmicromail/mailistviewitem.cpp5
-rw-r--r--kmicromail/opiemail.cpp2
-rw-r--r--kmicromail/viewmail.h4
-rw-r--r--kmicromail/viewmailbase.cpp6
4 files changed, 9 insertions, 8 deletions
diff --git a/kmicromail/mailistviewitem.cpp b/kmicromail/mailistviewitem.cpp
index 137c482..5119744 100644
--- a/kmicromail/mailistviewitem.cpp
+++ b/kmicromail/mailistviewitem.cpp
@@ -1,94 +1,97 @@
// CHANGED 2004-08-06 Lutz Rogowski
#include "mailistviewitem.h"
#include <libmailwrapper/abstractmail.h>
#include <qtextstream.h>
#include <kiconloader.h>
#include "koprefs.h"
//#include <qpe/resource.h>
MailListViewItem::MailListViewItem(QListView * parent, MailListViewItem * item )
:QListViewItem(parent,item),mail_data()
{
}
void MailListViewItem::showEntry()
{
if ( mail_data->getFlags().testBit( FLAG_ANSWERED ) == true) {
setPixmap( 0, SmallIcon ( "kmmsgreplied") );
+ mKeyMap.insert(0, "r" );
} else if ( mail_data->getFlags().testBit( FLAG_SEEN ) == true ) {
/* I think it looks nicer if there are not such a log of icons but only on mails
replied or new - Alwin*/
//setPixmap( 0,SmallIcon ("kmmsgunseen") );
+ mKeyMap.insert(0, "s" );
} else {
setPixmap( 0,SmallIcon ( "kmmsgnew") );
+ mKeyMap.insert(0, "u" );
}
QString fsize = mail_data->MsgsizeString();
// 1.23
// 11.23
// 111.23
// 999.23 maxlen
QString fsort;
switch(fsize.length() ) {
case 6:
fsort = "00" + fsize ;
break;
case 7:
fsort = "0" + fsize ;
break;
default:
fsort = fsize ;
break;
}
setText(3, fsize );
//qDebug("fsize *%s* ",fsize.latin1() );
//qDebug("fsort *%s* ",fsort.latin1() );
if ( fsize.right(2) == "kB" ) {
mKeyMap.insert(3, "k" + fsort);
} else {
mKeyMap.insert(3, "M" +fsort );
}
setText(1,mail_data->getSubject());
setText(2,mail_data->getFrom());
mKeyMap.insert(4,mail_data->getIsoDate());
setText(4,mail_data->getDate());
if ( KOPrefs::instance()->mShowToField )
setText(5,mail_data->To()[0]);
}
void MailListViewItem::storeData(const RecMailP&data)
{
mail_data = data;
}
void MailListViewItem::setSortKey(int column,const QString &key)
{
mKeyMap.insert(column,key);
}
QString MailListViewItem::key(int column, bool) const
{
// to make is fast, we use here special cases
- if ( column == 3 || column == 4 ) {
+ if ( column == 3 || column == 4 || column == 0) {
return *mKeyMap.find(column);
}
if ( column == 1 ) {
if ( text(1).left(4).lower() == "re: " )
return text(1).mid(4);
}
return text(column);
/*
QMap<int,QString>::ConstIterator it = mKeyMap.find(column);
if (it == mKeyMap.end()) return text(column);
else return *it;
*/
}
const RecMailP& MailListViewItem::data()const
{
return mail_data;
}
MAILLIB::ATYPE MailListViewItem::wrapperType()
{
if (!mail_data->Wrapper()) return MAILLIB::A_UNDEFINED;
return mail_data->Wrapper()->getType();
diff --git a/kmicromail/opiemail.cpp b/kmicromail/opiemail.cpp
index 760e3b0..68f0eb3 100644
--- a/kmicromail/opiemail.cpp
+++ b/kmicromail/opiemail.cpp
@@ -394,48 +394,50 @@ void OpieMail::displayMail()
QListViewItem*item = mailView->currentItem();
if (!item) return;
RecMailP mail = ((MailListViewItem*)item)->data();
RecBodyP body = folderView->fetchBody(mail);
ViewMail readMail( this,"", Qt::WType_Modal );
readMail.setBody( body );
readMail.setMail( mail );
#ifndef DESKTOP_VERSION
readMail.showMaximized();
#else
readMail.resize( 640, 480);
#endif
connect( &readMail,SIGNAL( showNextMail(ViewMail *) ), this, SLOT( displayNextMail(ViewMail *) ) );
connect( &readMail,SIGNAL( deleteAndDisplayNextMail(ViewMail *) ), this, SLOT(deleteAndDisplayNextMail(ViewMail *) ) );
connect( &readMail,SIGNAL( signalDownloadMail() ), this, SLOT( slotDownloadMail() ) );
readMail.exec();
if ( readMail.deleted )
{
folderView->refreshCurrent();
}
else
{
+ QListViewItem*item = mailView->currentItem();
+ if (item)
( (MailListViewItem*)item )->setPixmap( 0, QPixmap() );
}
}
void OpieMail::slotGetAllMail()
{
QListViewItem * item = folderView->firstChild();
while ( item ){
((AccountViewItem *)item)->contextMenuSelected( 101 );
item = item->nextSibling ();
}
}
void OpieMail::slotGetMail()
{
QListViewItem * item = folderView->currentItem();
if ( ! item ) return;
((AccountViewItem *)item)->contextMenuSelected( 101 );
}
void OpieMail::slotDeleteMail()
{
if (!mailView->currentItem()) return;
RecMailP mail = ((MailListViewItem*)mailView->currentItem() )->data();
if ( QMessageBox::warning(this, i18n("Delete Mail"), QString( i18n("<p>Do you really want to delete this mail? <br><br>" ) + mail->getFrom() + " - " + mail->getSubject() ) , QMessageBox::Yes, QMessageBox::No ) == QMessageBox::Yes )
{
mail->Wrapper()->deleteMail( mail );
diff --git a/kmicromail/viewmail.h b/kmicromail/viewmail.h
index 561989e..fc5edcf 100644
--- a/kmicromail/viewmail.h
+++ b/kmicromail/viewmail.h
@@ -1,79 +1,81 @@
#ifndef VIEWMAIL_H
#define VIEWMAIL_H
#include "viewmailbase.h"
#include <libmailwrapper/mailtypes.h>
#include <qdialog.h>
+#include <qapplication.h>
#include <qlistview.h>
#include <qmap.h>
+#include <klocale.h>
#include <qstringlist.h>
#include <qvaluelist.h>
//namespace Opie { namespace MM { class OImageScrollView; } }
class AttachItem : public QListViewItem
{
public:
AttachItem(QListView * parent,QListViewItem *after, const QString&mime,const QString&desc,const QString&file,
const QString&fsize,int num,const QValueList<int>&path);
AttachItem(QListViewItem * parent,QListViewItem *after, const QString&mime,const QString&desc,const QString&file,
const QString&fsize,int num,const QValueList<int>&path);
int Partnumber() { return _partNum; }
bool isParentof(const QValueList<int>&path);
private:
int _partNum;
/* needed for a better display of attachments */
QValueList<int> _path;
};
class ViewMail : public ViewMailBase
{
Q_OBJECT
public:
ViewMail( QWidget *parent = 0, const char *name = 0, WFlags fl = 0);
~ViewMail();
void hide();
void exec();
void setMail(const RecMailP&mail );
void setBody(const RecBodyP&body);
bool deleted;
signals:
void showNextMail(ViewMail*);
void deleteAndDisplayNextMail(ViewMail *);
void signalDownloadMail();
protected:
QString deHtml(const QString &string);
AttachItem* searchParent(const QValueList<int>&path);
AttachItem* lastChild(AttachItem*parent);
protected slots:
- void slotNextMail() { emit showNextMail(this); };
+ void slotNextMail() { setCaption(i18n("Displaying next mail...please wait!")); qApp->processEvents();emit showNextMail(this); };
void slotReply();
void slotForward();
void setText();
void slotItemClicked( QListViewItem * item , const QPoint & point, int c );
void slotDeleteMail( );
void slotShowHtml( bool );
void slotViewSource();
private:
void readConfig();
bool sourceOn;;
bool _inLoop;
QString m_mailHtml;
bool m_gotBody;
RecBodyP m_body;
RecMailP m_recMail;
bool m_showHtml;
// 0 from 1 subject 2 bodytext 3 date
QMap <int,QString> m_mail;
// 0 to 1 cc 2 bcc
QMap <int,QStringList> m_mail2;
};
diff --git a/kmicromail/viewmailbase.cpp b/kmicromail/viewmailbase.cpp
index 9365c23..3a41ba0 100644
--- a/kmicromail/viewmailbase.cpp
+++ b/kmicromail/viewmailbase.cpp
@@ -28,67 +28,61 @@ ViewMailBase::ViewMailBase(QWidget *parent, const char *name, WFlags fl)
toolbar->setHorizontalStretchable(true);
addToolBar(toolbar);
viewSource = new QAction(i18n("View Source"), 0, 0, this);
viewSource->addTo(mailmenu);
downloadMail= new QAction(i18n("Download Mail"),SmallIcon("add"), 0, 0, this);
downloadMail->addTo(toolbar);
downloadMail->addTo(mailmenu);
reply = new QAction(i18n("Reply"),SmallIcon("reply"), 0, 0, this);
reply->addTo(toolbar);
reply->addTo(mailmenu);
forward = new QAction(i18n("Forward"),SmallIcon("forward"), 0, 0, this);
forward->addTo(toolbar);
forward->addTo(mailmenu);
attachbutton = new QAction(i18n("Attachments"),SmallIcon("attach"), 0, 0, this, 0, true);
attachbutton->addTo(toolbar);
attachbutton->addTo(mailmenu);
connect(attachbutton, SIGNAL(toggled(bool)), SLOT(slotChangeAttachview(bool)));
-
showHtml = new QAction( i18n( "Show Html" ), SmallIcon( "html" ), 0, 0, this, 0, true );
showHtml->addTo( toolbar );
showHtml->addTo( mailmenu );
deleteMail = new QAction(i18n("Delete Mail"),SmallIcon("trash"), 0, 0, this);
deleteMail->addTo(toolbar);
deleteMail->addTo(mailmenu);
-
-
nextMail = new QAction(i18n("Show next mail"),SmallIcon("enter"), 0, 0, this);
QLabel *spacer = new QLabel(toolbar);
nextMail->addTo(toolbar);
nextMail->addTo(mailmenu);
-
-
-
closeMail = new QAction(i18n("Close"),SmallIcon("exit"), 0, 0, this);
//QLabel *spacer = new QLabel(toolbar);
spacer->setBackgroundMode(QWidget::PaletteButton);
toolbar->setStretchableWidget(spacer);
closeMail->addTo(toolbar);
closeMail->addTo(mailmenu);
QVBox *view = new QVBox(this);
setCentralWidget(view);
attachments = new QListView(view);
attachments->setMinimumHeight(90);
attachments->setMaximumHeight(90);
attachments->setAllColumnsShowFocus(true);
attachments->addColumn("Mime Type", 60);
attachments->addColumn(i18n("Description"), 100);
attachments->addColumn(i18n("Filename"), 80);
attachments->addColumn(i18n("Size"), 80);
attachments->setSorting(-1);
attachments->hide();
browser = new QTextBrowser(view);
// openDiag = new OpenDiag(view);
// openDiag->hide();