summaryrefslogtreecommitdiff
authorharlekin <harlekin>2003-12-20 00:05:37 (UTC)
committer harlekin <harlekin>2003-12-20 00:05:37 (UTC)
commitdc088ad432189b4883f7654ef6b2c1e2f69112cc (patch) (side-by-side diff)
tree090f6afd960e644d7da1fae3b8c8ffa97b669b59
parent00a0c8cf03fe746c1e3ba608bf298c8e66d065f9 (diff)
downloadopie-dc088ad432189b4883f7654ef6b2c1e2f69112cc.zip
opie-dc088ad432189b4883f7654ef6b2c1e2f69112cc.tar.gz
opie-dc088ad432189b4883f7654ef6b2c1e2f69112cc.tar.bz2
- beginning of a settings dialog
- button for switching between html and plain text view of the mail - hide some unused icons - completed alwins idea about status icons ( alwin you missed the one that sets the read icon .-) ) - beginning of a status widget -
Diffstat (more/less context) (ignore whitespace changes)
-rw-r--r--noncore/net/mail/mail.pro12
-rw-r--r--noncore/net/mail/mainwindow.cpp24
-rw-r--r--noncore/net/mail/mainwindow.h3
-rw-r--r--noncore/net/mail/opiemail.cpp2
-rw-r--r--noncore/net/mail/viewmail.cpp91
-rw-r--r--noncore/net/mail/viewmail.h5
-rw-r--r--noncore/net/mail/viewmailbase.cpp5
-rw-r--r--noncore/net/mail/viewmailbase.h3
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
@@ -16,5 +16,7 @@ HEADERS = defines.h \
mailistviewitem.h \
pop3wrapper.h \
- abstractmail.h
+ abstractmail.h \
+ settingsdialog.h \
+ statuswidget.h
SOURCES = main.cpp \
@@ -33,5 +35,7 @@ SOURCES = main.cpp \
mailtypes.cpp \
pop3wrapper.cpp \
- abstractmail.cpp
+ abstractmail.cpp \
+ settingsdialog.cpp \
+ statuswidget.cpp
INTERFACES = editaccountsui.ui \
@@ -43,5 +47,7 @@ INTERFACES = editaccountsui.ui \
addresspickerui.ui \
logindialogui.ui \
- composemailui.ui
+ composemailui.ui \
+ settingsdialogui.ui \
+ statuswidgetui.ui
INCLUDEPATH += $(OPIEDIR)/include
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
@@ -12,8 +12,10 @@
#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 )
@@ -46,8 +48,10 @@ MainWindow::MainWindow( QWidget *parent, const char *name, WFlags flags )
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,
@@ -59,8 +63,10 @@ MainWindow::MainWindow( QWidget *parent, const char *name, WFlags flags )
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);
@@ -73,4 +79,6 @@ MainWindow::MainWindow( QWidget *parent, const char *name, WFlags flags )
0, 0, this );
editSettings->addTo( settingsMenu );
+ connect( editSettings, SIGNAL( activated() ),
+ SLOT( slotEditSettings() ) );
editAccounts = new QAction( tr( "Configure accounts" ), ICON_EDITACCOUNTS,
@@ -78,5 +86,5 @@ MainWindow::MainWindow( QWidget *parent, const char *name, WFlags flags )
editAccounts->addTo( settingsMenu );
- QWidget *view = new QWidget( this );
+ QWidget *view = new QWidget( this );
setCentralWidget( view );
@@ -100,8 +108,12 @@ MainWindow::MainWindow( QWidget *parent, const char *name, WFlags flags )
mailView->setSorting(-1);
+ statusWidget = new StatusWidget( view );
+
layout->addWidget( mailView );
+ layout->addWidget( statusWidget );
layout->setStretchFactor( folderView, 1 );
layout->setStretchFactor( mailView, 2 );
+
slotAdjustLayout();
@@ -142,4 +154,10 @@ void MainWindow::slotAdjustColumns()
}
+void MainWindow::slotEditSettings() {
+ SettingsDialog settingsDialog( this, 0, true );
+ settingsDialog.showMaximized();
+ settingsDialog.exec();
+}
+
void MainWindow::slotShowFolders( bool show )
{
@@ -180,5 +198,5 @@ void MainWindow::displayMail(QListViewItem*item)
folderView->refreshCurrent();
} else {
- ( (MailListViewItem*)item )->setPixmap( 0, Resource::loadPixmap( "mail/kmmsgunseen") );
+ ( (MailListViewItem*)item )->setPixmap( 0, Resource::loadPixmap( "") );
}
}
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
@@ -10,4 +10,5 @@
#include "accountview.h"
+#include "statuswidget.h"
class RecMail;
@@ -29,7 +30,9 @@ protected slots:
virtual void slotDeleteMail();
void slotAdjustLayout();
+ void slotEditSettings();
protected:
QToolBar *toolBar;
+ StatusWidget *statusWidget;
QMenuBar *menuBar;
QPopupMenu *mailMenu, *settingsMenu;
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
@@ -12,5 +12,5 @@ OpieMail::OpieMail( QWidget *parent, const char *name, WFlags flags )
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
@@ -7,4 +7,6 @@
#include <qapplication.h>
+#include <qpe/config.h>
+
#include <opie/ofiledialog.h>
@@ -110,4 +112,10 @@ for (unsigned int i = 0; i < body.Parts().count();++i) {
}
+
+void ViewMail::slotShowHtml( bool state ) {
+ m_showHtml = state;
+ setText();
+}
+
void ViewMail::slotItemClicked( QListViewItem * item , const QPoint & point, int ) {
if (!item )
@@ -165,16 +173,16 @@ 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();
}
@@ -187,46 +195,59 @@ ViewMail::ViewMail( QWidget *parent, const char *name, WFlags fl)
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;
}
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
@@ -43,7 +43,9 @@ protected slots:
void slotItemClicked( QListViewItem * item , const QPoint & point, int c );
void slotDeleteMail( );
-
+ void slotShowHtml( bool );
private:
+ void readConfig();
+
bool _inLoop;
QString m_mailHtml;
@@ -51,4 +53,5 @@ private:
RecBody m_body;
RecMail m_recMail;
+ bool m_showHtml;
// 0 from 1 subject 2 bodytext 3 date
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
@@ -44,4 +44,9 @@ ViewMailBase::ViewMailBase(QWidget *parent, const char *name, WFlags fl)
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);
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
@@ -20,5 +20,5 @@ public:
protected:
- QAction *reply, *forward, *attachbutton, *deleteMail;
+ QAction *reply, *forward, *attachbutton, *deleteMail, *showHtml;
QListView *attachments;
QToolBar *toolbar;
@@ -31,4 +31,5 @@ protected slots:
void slotChangeAttachview(bool state);
+
};