-rw-r--r-- | noncore/net/mail/mail.pro | 12 | ||||
-rw-r--r-- | noncore/net/mail/mainwindow.cpp | 24 | ||||
-rw-r--r-- | noncore/net/mail/mainwindow.h | 3 | ||||
-rw-r--r-- | noncore/net/mail/opiemail.cpp | 2 | ||||
-rw-r--r-- | noncore/net/mail/viewmail.cpp | 91 | ||||
-rw-r--r-- | noncore/net/mail/viewmail.h | 5 | ||||
-rw-r--r-- | noncore/net/mail/viewmailbase.cpp | 5 | ||||
-rw-r--r-- | noncore/net/mail/viewmailbase.h | 3 |
8 files changed, 101 insertions, 44 deletions
diff --git a/noncore/net/mail/mail.pro b/noncore/net/mail/mail.pro index d058db7..49be889 100644 --- a/noncore/net/mail/mail.pro +++ b/noncore/net/mail/mail.pro @@ -14,9 +14,11 @@ HEADERS = defines.h \ imapwrapper.h \ mailtypes.h \ mailistviewitem.h \ pop3wrapper.h \ - abstractmail.h + abstractmail.h \ + settingsdialog.h \ + statuswidget.h SOURCES = main.cpp \ opiemail.cpp \ mainwindow.cpp \ @@ -31,9 +33,11 @@ SOURCES = main.cpp \ viewmailbase.cpp \ settings.cpp \ mailtypes.cpp \ pop3wrapper.cpp \ - abstractmail.cpp + abstractmail.cpp \ + settingsdialog.cpp \ + statuswidget.cpp INTERFACES = editaccountsui.ui \ selectmailtypeui.ui \ imapconfigui.ui \ @@ -41,9 +45,11 @@ INTERFACES = editaccountsui.ui \ nntpconfigui.ui \ smtpconfigui.ui \ addresspickerui.ui \ logindialogui.ui \ - composemailui.ui + composemailui.ui \ + settingsdialogui.ui \ + statuswidgetui.ui INCLUDEPATH += $(OPIEDIR)/include CONFTEST = $$system( echo $CONFIG_TARGET_MACOSX ) diff --git a/noncore/net/mail/mainwindow.cpp b/noncore/net/mail/mainwindow.cpp index 9a37510..d3b9c34 100644 --- a/noncore/net/mail/mainwindow.cpp +++ b/noncore/net/mail/mainwindow.cpp @@ -10,12 +10,14 @@ #include <qpe/resource.h> #include "defines.h" #include "mainwindow.h" +#include "settingsdialog.h" #include "viewmail.h" #include "mailtypes.h" #include "mailistviewitem.h" + MainWindow::MainWindow( QWidget *parent, const char *name, WFlags flags ) : QMainWindow( parent, name, flags ) { setCaption( tr( "Mail" ) ); @@ -44,12 +46,14 @@ MainWindow::MainWindow( QWidget *parent, const char *name, WFlags flags ) 0, 0, this ); sendQueued->addTo( toolBar ); sendQueued->addTo( mailMenu ); + /* syncFolders = new QAction( tr( "Sync mailfolders" ), ICON_SYNC, 0, 0, this ); syncFolders->addTo( toolBar ); syncFolders->addTo( mailMenu ); + */ showFolders = new QAction( tr( "Show/Hide folders" ), ICON_SHOWFOLDERS, 0, 0, this, 0, true ); showFolders->addTo( toolBar ); @@ -57,12 +61,14 @@ MainWindow::MainWindow( QWidget *parent, const char *name, WFlags flags ) showFolders->setOn( true ); connect(showFolders, SIGNAL( toggled( bool ) ), SLOT( slotShowFolders( bool ) ) ); - searchMails = new QAction( tr( "Search mails" ), ICON_SEARCHMAILS, + /* + searchMails = new QAction( tr( "Search mails" ), ICON_SEARCHMAILS, 0, 0, this ); searchMails->addTo( toolBar ); searchMails->addTo( mailMenu ); + */ deleteMails = new QAction(tr("Delete Mail"), QIconSet(Resource::loadPixmap("mail/delete")), 0, 0, this); deleteMails->addTo( toolBar ); deleteMails->addTo( mailMenu ); @@ -71,14 +77,16 @@ MainWindow::MainWindow( QWidget *parent, const char *name, WFlags flags ) editSettings = new QAction( tr( "Edit settings" ), ICON_EDITSETTINGS, 0, 0, this ); editSettings->addTo( settingsMenu ); + connect( editSettings, SIGNAL( activated() ), + SLOT( slotEditSettings() ) ); editAccounts = new QAction( tr( "Configure accounts" ), ICON_EDITACCOUNTS, 0, 0, this ); editAccounts->addTo( settingsMenu ); - QWidget *view = new QWidget( this ); + QWidget *view = new QWidget( this ); setCentralWidget( view ); layout = new QBoxLayout ( view, QBoxLayout::LeftToRight ); @@ -98,12 +106,16 @@ MainWindow::MainWindow( QWidget *parent, const char *name, WFlags flags ) mailView->addColumn( tr( "Date" )); mailView->setAllColumnsShowFocus(true); mailView->setSorting(-1); + statusWidget = new StatusWidget( view ); + layout->addWidget( mailView ); + layout->addWidget( statusWidget ); layout->setStretchFactor( folderView, 1 ); layout->setStretchFactor( mailView, 2 ); + slotAdjustLayout(); connect( mailView, SIGNAL( clicked( QListViewItem * ) ),this, SLOT( displayMail( QListViewItem * ) ) ); @@ -140,8 +152,14 @@ void MainWindow::slotAdjustColumns() mailView->setColumnWidth( 3, 50 ); mailView->setColumnWidth( 4, 50 ); } +void MainWindow::slotEditSettings() { + SettingsDialog settingsDialog( this, 0, true ); + settingsDialog.showMaximized(); + settingsDialog.exec(); +} + void MainWindow::slotShowFolders( bool show ) { qDebug( "Show Folders" ); if ( show && folderView->isHidden() ) { @@ -178,9 +196,9 @@ void MainWindow::displayMail(QListViewItem*item) if ( readMail.deleted ) { folderView->refreshCurrent(); } else { - ( (MailListViewItem*)item )->setPixmap( 0, Resource::loadPixmap( "mail/kmmsgunseen") ); + ( (MailListViewItem*)item )->setPixmap( 0, Resource::loadPixmap( "") ); } } void MainWindow::slotDeleteMail() diff --git a/noncore/net/mail/mainwindow.h b/noncore/net/mail/mainwindow.h index 21af190..4e4f4bb 100644 --- a/noncore/net/mail/mainwindow.h +++ b/noncore/net/mail/mainwindow.h @@ -8,8 +8,9 @@ #include <qtoolbar.h> #include <qmenubar.h> #include "accountview.h" +#include "statuswidget.h" class RecMail; class MainWindow : public QMainWindow @@ -27,11 +28,13 @@ protected slots: virtual void refreshMailView(QList<RecMail>*); virtual void displayMail(QListViewItem*); virtual void slotDeleteMail(); void slotAdjustLayout(); + void slotEditSettings(); protected: QToolBar *toolBar; + StatusWidget *statusWidget; QMenuBar *menuBar; QPopupMenu *mailMenu, *settingsMenu; QAction *composeMail, *sendQueued, *showFolders, *searchMails, *deleteMails, *editSettings, *editAccounts, *syncFolders; diff --git a/noncore/net/mail/opiemail.cpp b/noncore/net/mail/opiemail.cpp index 740e4cf..7ab4e0d 100644 --- a/noncore/net/mail/opiemail.cpp +++ b/noncore/net/mail/opiemail.cpp @@ -10,9 +10,9 @@ OpieMail::OpieMail( QWidget *parent, const char *name, WFlags flags ) folderView->populate( settings->getAccounts() ); connect( composeMail, SIGNAL( activated() ), SLOT( slotComposeMail() ) ); connect( sendQueued, SIGNAL( activated() ), SLOT( slotSendQueued() ) ); - connect( searchMails, SIGNAL( activated() ), SLOT( slotSearchMails() ) ); +// connect( searchMails, SIGNAL( activated() ), SLOT( slotSearchMails() ) ); connect( editSettings, SIGNAL( activated() ), SLOT( slotEditSettings() ) ); connect( editAccounts, SIGNAL( activated() ), SLOT( slotEditAccounts() ) ); } diff --git a/noncore/net/mail/viewmail.cpp b/noncore/net/mail/viewmail.cpp index d86454c..e11fe1f 100644 --- a/noncore/net/mail/viewmail.cpp +++ b/noncore/net/mail/viewmail.cpp @@ -5,8 +5,10 @@ #include <qpopupmenu.h> #include <qfile.h> #include <qapplication.h> +#include <qpe/config.h> + #include <opie/ofiledialog.h> #include "settings.h" #include "composemail.h" @@ -108,8 +110,14 @@ for (unsigned int i = 0; i < body.Parts().count();++i) { curItem=new AttachItem(attachments,curItem,type,desc,filename,fsize,i); } } + +void ViewMail::slotShowHtml( bool state ) { + m_showHtml = state; + setText(); +} + void ViewMail::slotItemClicked( QListViewItem * item , const QPoint & point, int ) { if (!item ) return; @@ -163,20 +171,20 @@ void ViewMail::slotItemClicked( QListViewItem * item , const QPoint & point, int void ViewMail::setMail( RecMail mail ) { -m_recMail = mail; + m_recMail = mail; -m_mail[0] = mail.getFrom(); -m_mail[1] = mail.getSubject(); -m_mail[3] = mail.getDate(); -m_mail[4] = mail.Msgid(); + m_mail[0] = mail.getFrom(); + m_mail[1] = mail.getSubject(); + m_mail[3] = mail.getDate(); + m_mail[4] = mail.Msgid(); -m_mail2[0] = mail.To(); -m_mail2[1] = mail.CC(); -m_mail2[2] = mail.Bcc(); + m_mail2[0] = mail.To(); + m_mail2[1] = mail.CC(); + m_mail2[2] = mail.Bcc(); -setText(); + setText(); } @@ -185,50 +193,63 @@ ViewMail::ViewMail( QWidget *parent, const char *name, WFlags fl) { m_gotBody = false; deleted = false; - connect(reply, SIGNAL(activated()), SLOT(slotReply())); - connect(forward, SIGNAL(activated()), SLOT(slotForward())); + 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 ) ) ); attachments->setEnabled(m_gotBody); connect( attachments, SIGNAL( clicked ( QListViewItem *, const QPoint & , int ) ), SLOT( slotItemClicked( QListViewItem *, const QPoint & , int ) ) ); + readConfig(); } +void ViewMail::readConfig() { + Config cfg( "mail" ); + cfg.setGroup( "Settings" ); + m_showHtml = cfg.readBoolEntry( "showHtml", false ); + showHtml->setOn( m_showHtml ); +} + void ViewMail::setText() { - QString toString; - QString ccString; - QString bccString; + QString toString; + QString ccString; + QString bccString; - for ( QStringList::Iterator it = ( m_mail2[0] ).begin(); it != ( m_mail2[0] ).end(); ++it ) { - toString += (*it); - } - for ( QStringList::Iterator it = ( m_mail2[1] ).begin(); it != ( m_mail2[1] ).end(); ++it ) { - ccString += (*it); - } - for ( QStringList::Iterator it = ( m_mail2[2] ).begin(); it != ( m_mail2[2] ).end(); ++it ) { - bccString += (*it); - } + for ( QStringList::Iterator it = ( m_mail2[0] ).begin(); it != ( m_mail2[0] ).end(); ++it ) { + toString += (*it); + } + for ( QStringList::Iterator it = ( m_mail2[1] ).begin(); it != ( m_mail2[1] ).end(); ++it ) { + ccString += (*it); + } + for ( QStringList::Iterator it = ( m_mail2[2] ).begin(); it != ( m_mail2[2] ).end(); ++it ) { + bccString += (*it); + } - setCaption( caption().arg( m_mail[0] ) ); + setCaption( caption().arg( m_mail[0] ) ); - m_mailHtml = "<html><body>" - "<table width=\"100%\" border=\"0\"><tr bgcolor=\"#FFDD76\"><td>" - "<div align=left><b>" + deHtml( m_mail[1] ) + "</b></div>" - "</td></tr><tr bgcolor=\"#EEEEE6\"><td>" - "<b>" + tr( "From" ) + ": </b><font color=#6C86C0>" + deHtml( m_mail[0] ) + "</font><br>" - "<b>" + tr( "To" ) + ": </b><font color=#6C86C0>" + deHtml( toString ) + "</font><br><b>" + - tr( "Cc" ) + ": </b>" + deHtml( ccString ) + "<br>" - "<b>" + tr( "Date" ) + ": </b> " + m_mail[3] + - "</td></tr></table><font face=fixed>"; + m_mailHtml = "<html><body>" + "<table width=\"100%\" border=\"0\"><tr bgcolor=\"#FFDD76\"><td>" + "<div align=left><b>" + deHtml( m_mail[1] ) + "</b></div>" + "</td></tr><tr bgcolor=\"#EEEEE6\"><td>" + "<b>" + tr( "From" ) + ": </b><font color=#6C86C0>" + deHtml( m_mail[0] ) + "</font><br>" + "<b>" + tr( "To" ) + ": </b><font color=#6C86C0>" + deHtml( toString ) + "</font><br><b>" + + tr( "Cc" ) + ": </b>" + deHtml( ccString ) + "<br>" + "<b>" + tr( "Date" ) + ": </b> " + m_mail[3] + + "</td></tr></table><font face=fixed>"; + if ( !m_showHtml ) { browser->setText( QString( m_mailHtml) + deHtml( m_mail[2] ) + "</font></html>" ); - // remove later in favor of a real handling - m_gotBody = true; + } else { + browser->setText( QString( m_mailHtml) + m_mail[2] + "</font></html>" ); + } + // remove later in favor of a real handling + m_gotBody = true; } ViewMail::~ViewMail() diff --git a/noncore/net/mail/viewmail.h b/noncore/net/mail/viewmail.h index dd7f854..bf7a4dd 100644 --- a/noncore/net/mail/viewmail.h +++ b/noncore/net/mail/viewmail.h @@ -41,16 +41,19 @@ protected slots: void slotForward(); void setText(); void slotItemClicked( QListViewItem * item , const QPoint & point, int c ); void slotDeleteMail( ); - + void slotShowHtml( bool ); private: + void readConfig(); + bool _inLoop; QString m_mailHtml; bool m_gotBody; RecBody m_body; RecMail m_recMail; + bool m_showHtml; // 0 from 1 subject 2 bodytext 3 date QMap <int,QString> m_mail; // 0 to 1 cc 2 bcc diff --git a/noncore/net/mail/viewmailbase.cpp b/noncore/net/mail/viewmailbase.cpp index 0c7f671..e69617d 100644 --- a/noncore/net/mail/viewmailbase.cpp +++ b/noncore/net/mail/viewmailbase.cpp @@ -42,8 +42,13 @@ ViewMailBase::ViewMailBase(QWidget *parent, const char *name, WFlags fl) attachbutton->addTo(toolbar); attachbutton->addTo(mailmenu); connect(attachbutton, SIGNAL(toggled(bool)), SLOT(slotChangeAttachview(bool))); + + showHtml = new QAction( tr( "Show Html" ), QIconSet( Resource::loadPixmap( "mail/attach" ) ), 0, 0, this, 0, true ); + showHtml->addTo( toolbar ); + showHtml->addTo( mailmenu ); + deleteMail = new QAction(tr("Delete Mail"), QIconSet(Resource::loadPixmap("mail/delete")), 0, 0, this); deleteMail->addTo(toolbar); deleteMail->addTo(mailmenu); diff --git a/noncore/net/mail/viewmailbase.h b/noncore/net/mail/viewmailbase.h index 898522e..6d2a5b2 100644 --- a/noncore/net/mail/viewmailbase.h +++ b/noncore/net/mail/viewmailbase.h @@ -18,9 +18,9 @@ class ViewMailBase : public QMainWindow public: ViewMailBase(QWidget *parent = 0, const char *name = 0, WFlags fl = 0); protected: - QAction *reply, *forward, *attachbutton, *deleteMail; + QAction *reply, *forward, *attachbutton, *deleteMail, *showHtml; QListView *attachments; QToolBar *toolbar; QTextBrowser *browser; OpenDiag *openDiag; @@ -29,8 +29,9 @@ protected: protected slots: void slotChangeAttachview(bool state); + }; #endif |