-rw-r--r-- | kmicromail/koprefs.cpp | 1 | ||||
-rw-r--r-- | kmicromail/koprefs.h | 2 | ||||
-rw-r--r-- | kmicromail/koprefsdialog.cpp | 3 | ||||
-rw-r--r-- | kmicromail/mailistviewitem.cpp | 49 | ||||
-rw-r--r-- | kmicromail/mainwindow.cpp | 4 | ||||
-rw-r--r-- | kmicromail/opiemail.cpp | 17 | ||||
-rw-r--r-- | kmicromail/opiemail.h | 3 | ||||
-rw-r--r-- | kmicromail/viewmail.cpp | 25 | ||||
-rw-r--r-- | kmicromail/viewmail.h | 4 | ||||
-rw-r--r-- | kmicromail/viewmailbase.cpp | 8 | ||||
-rw-r--r-- | kmicromail/viewmailbase.h | 2 |
11 files changed, 66 insertions, 52 deletions
diff --git a/kmicromail/koprefs.cpp b/kmicromail/koprefs.cpp index 342bbf3..2bae5f6 100644 --- a/kmicromail/koprefs.cpp +++ b/kmicromail/koprefs.cpp @@ -57,16 +57,17 @@ KOPrefs::KOPrefs() : mReadFont = QFont("helvetica",12); KPrefs::setCurrentGroup("General"); addItemString("SendCodec",&mSendCodec,i18n ("userdefined") ); addItemString("SenderName",&mName,i18n ("Please set at") ); addItemString("SenderEmail",&mEmail,i18n ("Settings@General TAB") ); addItemBool("ViewMailAsHtml",&mViewAsHtml,false); addItemBool("SendMailLater",&mSendLater,true); + addItemBool("ShowToField",&mShowToField,false); addItemBool("UseKapi",&mUseKapi,false); addItemInt("CurrentCodec",&mCurrentCodec,0); KPrefs::setCurrentGroup("Fonts"); addItemFont("Application Font",&mAppFont); addItemFont("Compose Font",&mComposeFont); addItemFont("Read Font",&mReadFont); fillMailDefaults(); diff --git a/kmicromail/koprefs.h b/kmicromail/koprefs.h index 91f3fa3..f2c4fbb 100644 --- a/kmicromail/koprefs.h +++ b/kmicromail/koprefs.h @@ -67,14 +67,14 @@ class KOPrefs : public KPimPrefs QFont mAppFont; QFont mComposeFont; QFont mReadFont; QString mName; QString mSendCodec; QString mEmail; QString mCurrentCodeName; int mCurrentCodec; - bool mSendLater, mViewAsHtml, mUseKapi, isDirty; + bool mSendLater, mViewAsHtml, mUseKapi, isDirty, mShowToField; private: }; #endif diff --git a/kmicromail/koprefsdialog.cpp b/kmicromail/koprefsdialog.cpp index 13d6681..5c8a5a9 100644 --- a/kmicromail/koprefsdialog.cpp +++ b/kmicromail/koprefsdialog.cpp @@ -142,16 +142,19 @@ void KOPrefsDialog::setupMailTab() KPrefsDialogWidBool* ttt = addWidBool(i18n("View mail as html"), &(KOPrefs::instance()->mViewAsHtml),topFrame); topLayout->addMultiCellWidget(ttt->checkBox(),0,0,0,1); ttt = addWidBool(i18n("Send mails later"), &(KOPrefs::instance()->mSendLater),topFrame); topLayout->addMultiCellWidget(ttt->checkBox(),1,1,0,1); + ttt = addWidBool(i18n("Show \"To\" field in list view"), + &(KOPrefs::instance()->mShowToField),topFrame); + topLayout->addMultiCellWidget(ttt->checkBox(),2,2,0,1); /* mCodecEdit = new QLineEdit(topFrame); topLayout->addMultiCellWidget( new QLabel(mCodecEdit, i18n("User defined codec for new mails:"), topFrame),2,2,0,1); topLayout->addMultiCellWidget(mCodecEdit,3,3,0,1); topLayout->addMultiCellWidget( new QLabel(0, i18n("Example: iso-8859-15"), topFrame),4,4,0,1); */ } void KOPrefsDialog::setupFontsTab() diff --git a/kmicromail/mailistviewitem.cpp b/kmicromail/mailistviewitem.cpp index 484a635..ffb835c 100644 --- a/kmicromail/mailistviewitem.cpp +++ b/kmicromail/mailistviewitem.cpp @@ -1,13 +1,14 @@ // 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() @@ -52,64 +53,20 @@ void MailListViewItem::showEntry() mKeyMap.insert(3, "k" + fsort); //setText(3, "kB" + fsort ); // test only } else { //setText(3, fsize + "MB"); mKeyMap.insert(3, "M" +fsort ); } setText(1,mail_data->getSubject()); setText(2,mail_data->getFrom()); -#if 0 - QString date = mail_data->getDate(); - - int kom = date.find( ",")+2; - if ( kom == 1 ) - kom = 0; - if ( date.mid(kom,1) == " ") - ++kom; - if ( date.mid(kom+1,1) == " " ) - date = "0" + date.mid( kom ); - else if ( kom ) - date = date.mid( kom ); - if ( kom || date.mid(2,1 ) == " ") { - QString mon = date.mid(3,3); - QString so = 00; - if ( mon == "Jan" ) - so = "01"; - else if ( mon == "Feb" ) - so = "02"; - else if ( mon == "Mar" ) - so = "03"; - else if ( mon == "Apr" ) - so = "04"; - else if ( mon == "May" ) - so = "05"; - else if ( mon == "Jun" ) - so = "06"; - else if ( mon == "Jul" ) - so = "07"; - else if ( mon == "Aug" ) - so = "08"; - else if ( mon == "Sep" ) - so = "09"; - else if ( mon == "Oct" ) - so = "10"; - else if ( mon == "Nov" ) - so = "11"; - else if ( mon == "Dec" ) - so = "12"; - date = date.mid(7,4)+so+date.left(2)+date.mid(12,14); - } - //qDebug("insert Date %s ", date.latin1()); - // if ( date.left(1) != "1" || date.left(1) != "2" ) - // date = date.mid(5); - mKeyMap.insert(4,date); -#endif 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) { diff --git a/kmicromail/mainwindow.cpp b/kmicromail/mainwindow.cpp index 1dc374b..875ab77 100644 --- a/kmicromail/mainwindow.cpp +++ b/kmicromail/mainwindow.cpp @@ -128,16 +128,18 @@ MainWindow::MainWindow( QWidget *parent, const char *name, WFlags flags ) //layout->addWidget( folderView ); mailView = new QListView( split ); mailView->addColumn( i18n( " " ) ); mailView->addColumn( i18n( "Subject" ),QListView::Manual ); mailView->addColumn( i18n( "Sender" ),QListView::Manual ); mailView->addColumn( i18n( "Size" ),QListView::Manual); mailView->addColumn( i18n( "Date" ),QListView::Manual); + if ( KOPrefs::instance()->mShowToField ) + mailView->addColumn( i18n( "To" ),QListView::Manual); mailView->setAllColumnsShowFocus(true); //mailView->setSorting(-1); mailView->setRootIsDecorated( false ); statusWidget = new StatusWidget( wrapperBox ); statusWidget->hide(); //layout->addWidget( mailView ); //layout->setStretchFactor( folderView, 1 ); @@ -298,16 +300,18 @@ void MainWindow::slotAdjustColumns() 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 ); + if ( KOPrefs::instance()->mShowToField ) + mailView->setColumnWidth( 5, 100 ); } void MainWindow::slotEditSettings() { } void MainWindow::slotShowFolders( bool ) { diff --git a/kmicromail/opiemail.cpp b/kmicromail/opiemail.cpp index 915b3e8..6e54bf4 100644 --- a/kmicromail/opiemail.cpp +++ b/kmicromail/opiemail.cpp @@ -1,11 +1,15 @@ // CHANGED 2004-09-31 Lutz Rogowski // CHANGED 2004-08-06 Lutz Rogowski + +#define protected public +#include <qwidget.h> +#undef protected #include "koprefsdialog.h" #include <kapplication.h> #include <libkdepim/externalapphandler.h> #include <libkdepim/kpimglobalprefs.h> #ifdef MINIKDE_KDIALOG_H #undef MINIKDE_KDIALOG_H #endif #include "settingsdialog.h" @@ -17,16 +21,17 @@ #include "selectstore.h" #include "selectsmtp.h" #include "accountitem.h" #include "klocale.h" #include <qmessagebox.h> #include <qtimer.h> #include <qcursor.h> +#include <qtextbrowser.h> #include <qregexp.h> #include <qpe/global.h> #ifdef DESKTOP_VERSION #include <qapplication.h> #else #include <qpe/qpeapplication.h> #endif @@ -36,25 +41,27 @@ #include "koprefs.h" //using namespace Opie::Core; OpieMail::OpieMail( QWidget *parent, const char *name ) : MainWindow( parent, name) //, WStyle_ContextHelp ) { settings = new Settings(); - + tb = 0; setIcon(SmallIcon( "kmicromail" ) ); folderView->populate( settings->getAccounts() ); } OpieMail::~OpieMail() { if (settings) delete settings; + if ( tb ) + delete tb; } void OpieMail::appMessage(const QCString &msg, const QByteArray &data) { } #include <stdlib.h> void OpieMail::message(const QCString &msg, const QByteArray &data) @@ -298,16 +305,23 @@ void OpieMail::replyMail() } delete settings; } void OpieMail::closeViewMail(ViewMail * vm) { vm->hide(); } + +void OpieMail::slotDownloadMail( ) +{ + qDebug("slotDownloadMail( ) "); +} + + void OpieMail::deleteAndDisplayNextMail(ViewMail * vm) { QListViewItem*item = mailView->currentItem(); if (!item ) { closeViewMail(vm); return; } RecMailP mail = ((MailListViewItem*)item)->data(); @@ -350,16 +364,17 @@ void OpieMail::displayMail() 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 diff --git a/kmicromail/opiemail.h b/kmicromail/opiemail.h index a81a34c..b8a527f 100644 --- a/kmicromail/opiemail.h +++ b/kmicromail/opiemail.h @@ -41,20 +41,21 @@ protected slots: virtual void mailHold(int, QListViewItem *,const QPoint&,int); virtual void slotShowFolders( bool show ); virtual void refreshMailView(const QValueList<RecMailP>&); virtual void mailLeftClicked( QListViewItem * ); virtual void slotMoveCopyMail(); virtual void slotMoveCopyAllMail(); virtual void reEditMail(); void clearSelection(); - + void slotDownloadMail(); private: void closeViewMail(ViewMail * vm); QString mPendingEmail; QString mPendingName; QByteArray mPendingData; QCString mPendingMessage; Settings *settings; + QTextBrowser * tb; }; #endif diff --git a/kmicromail/viewmail.cpp b/kmicromail/viewmail.cpp index 6d88cad..767a369 100644 --- a/kmicromail/viewmail.cpp +++ b/kmicromail/viewmail.cpp @@ -198,16 +198,34 @@ void ViewMail::setBody(const RecBodyP&body ) else { curItem=new AttachItem(attachments,curItem,type,desc,filename,fsize,i,body->Parts()[i]->Positionlist()); } } } +void ViewMail::slotViewSource() +{ + + if ( !sourceOn ) { + sourceOn = true; + viewSource->setText(i18n("View Body Text")); + encodedString*st = 0; + st = m_recMail->Wrapper()->fetchRawBody(m_recMail); + if ( st ) { + QString source = QString::fromUtf8( st->Content(), st->Length()); + browser->setText( source ); + delete st; + } + } else + setText(); + + +} void ViewMail::slotShowHtml( bool state ) { m_showHtml = state; setText(); } void ViewMail::slotItemClicked( QListViewItem * item , const QPoint & point, int ) { @@ -315,23 +333,25 @@ void ViewMail::setMail(const RecMailP&mail ) ViewMail::ViewMail( QWidget *parent, const char *name, WFlags fl) : ViewMailBase(parent, name, fl), _inLoop(false) { m_gotBody = false; deleted = false; - + sourceOn = false; connect( reply, SIGNAL(activated()), SLOT(slotReply())); connect( forward, SIGNAL(activated()), SLOT(slotForward())); connect( deleteMail, SIGNAL( activated() ), SLOT( slotDeleteMail() ) ); connect( showHtml, SIGNAL( toggled(bool) ), SLOT( slotShowHtml(bool) ) ); connect( closeMail, SIGNAL( activated() ), SLOT( close() ) ); connect( nextMail, SIGNAL( activated() ), SLOT( slotNextMail() ) ); + connect( viewSource, SIGNAL( activated() ), SLOT( slotViewSource() ) ); + connect( downloadMail, SIGNAL( activated() ), SIGNAL( signalDownloadMail() ) ); attachments->setEnabled(m_gotBody); connect( attachments, SIGNAL( clicked(QListViewItem*,const QPoint&, int) ), SLOT( slotItemClicked(QListViewItem*,const QPoint&, int) ) ); readConfig(); attachments->setSorting(-1); } @@ -341,16 +361,18 @@ void ViewMail::readConfig() setFont ( KOPrefs::instance()->mReadFont ); m_showHtml = KOPrefs::instance()->mViewAsHtml; showHtml->setOn( m_showHtml ); } void ViewMail::setText() { + viewSource->setText(i18n("View Source")); + sourceOn = false; QString toString; QString ccString; QString bccString; toString = m_mail2[0].join(","); ccString = m_mail2[1].join(","); bccString = m_mail2[2].join(","); @@ -527,8 +549,9 @@ MailImageDlg::~MailImageDlg() { } void MailImageDlg::setName(const QString&fname) { qDebug("viewmail.cpp: MailImageDlg::setName Pending"); // m_imageview->setImage(fname); } + diff --git a/kmicromail/viewmail.h b/kmicromail/viewmail.h index d85b8b2..561989e 100644 --- a/kmicromail/viewmail.h +++ b/kmicromail/viewmail.h @@ -40,33 +40,35 @@ public: 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 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 diff --git a/kmicromail/viewmailbase.cpp b/kmicromail/viewmailbase.cpp index d21696a..9365c23 100644 --- a/kmicromail/viewmailbase.cpp +++ b/kmicromail/viewmailbase.cpp @@ -23,16 +23,24 @@ ViewMailBase::ViewMailBase(QWidget *parent, const char *name, WFlags fl) toolbar = new QToolBar(this); menubar = new QMenuBar( toolbar ); mailmenu = new QPopupMenu( menubar ); menubar->insertItem( i18n( "Mail" ), mailmenu ); 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); diff --git a/kmicromail/viewmailbase.h b/kmicromail/viewmailbase.h index c97e9e3..7ad1eec 100644 --- a/kmicromail/viewmailbase.h +++ b/kmicromail/viewmailbase.h @@ -15,17 +15,17 @@ class QPopupMenu; class ViewMailBase : public QMainWindow { Q_OBJECT public: ViewMailBase(QWidget *parent = 0, const char *name = 0, WFlags fl = 0); protected: - QAction *reply, *forward, *attachbutton, *deleteMail, *showHtml, *closeMail, *nextMail; + QAction *reply, *forward, *attachbutton, *deleteMail, *showHtml, *closeMail, *nextMail, *downloadMail, *viewSource; QListView *attachments; QToolBar *toolbar; QTextBrowser *browser; OpenDiag *openDiag; QMenuBar *menubar; QPopupMenu *mailmenu; protected slots: |