summaryrefslogtreecommitdiff
Side-by-side diff
Diffstat (more/less context) (ignore whitespace changes)
-rw-r--r--noncore/net/mail/accountview.cpp1
-rw-r--r--noncore/net/mail/mail.pro3
-rw-r--r--noncore/net/mail/mainwindow.cpp16
-rw-r--r--noncore/net/mail/mainwindow.h2
-rw-r--r--noncore/net/mail/opiemail.cpp12
-rw-r--r--noncore/net/mail/statuswidget.cpp33
-rw-r--r--noncore/net/mail/statuswidget.h24
-rw-r--r--noncore/net/mail/statuswidgetui.ui71
-rw-r--r--noncore/net/mail/viewmail.cpp37
-rw-r--r--noncore/net/mail/viewmail.h4
10 files changed, 44 insertions, 159 deletions
diff --git a/noncore/net/mail/accountview.cpp b/noncore/net/mail/accountview.cpp
index 0fe8475..c747a8b 100644
--- a/noncore/net/mail/accountview.cpp
+++ b/noncore/net/mail/accountview.cpp
@@ -58,9 +58,8 @@ void AccountView::populate( QList<Account> list )
clear();
imapAccounts.clear();
mhAccounts.clear();
-
mhAccounts.append(new MHviewItem(AbstractMail::defaultLocalfolder(),this));
Account *it;
for ( it = list.first(); it; it = list.next() ) {
diff --git a/noncore/net/mail/mail.pro b/noncore/net/mail/mail.pro
index e394bbf..a1de8b5 100644
--- a/noncore/net/mail/mail.pro
+++ b/noncore/net/mail/mail.pro
@@ -10,9 +10,8 @@ HEADERS = defines.h \
viewmailbase.h \
opiemail.h \
mailistviewitem.h \
settingsdialog.h \
- statuswidget.h \
newmaildir.h \
selectstore.h \
selectsmtp.h \
nntpgroups.h \
@@ -29,9 +28,8 @@ SOURCES = main.cpp \
viewmail.cpp \
viewmailbase.cpp \
mailistviewitem.cpp \
settingsdialog.cpp \
- statuswidget.cpp \
newmaildir.cpp \
selectstore.cpp \
selectsmtp.cpp \
nntpgroups.cpp \
@@ -45,9 +43,8 @@ INTERFACES = editaccountsui.ui \
smtpconfigui.ui \
addresspickerui.ui \
composemailui.ui \
settingsdialogui.ui \
- statuswidgetui.ui \
newmaildirui.ui \
selectstoreui.ui \
nntpgroupsui.ui
diff --git a/noncore/net/mail/mainwindow.cpp b/noncore/net/mail/mainwindow.cpp
index 93d80d9..0a45445 100644
--- a/noncore/net/mail/mainwindow.cpp
+++ b/noncore/net/mail/mainwindow.cpp
@@ -80,14 +80,11 @@ MainWindow::MainWindow( QWidget *parent, const char *name, WFlags flags )
editAccounts = new QAction( tr( "Configure accounts" ), QIconSet( Resource::loadPixmap("mail/editaccounts") ) ,
0, 0, this );
editAccounts->addTo( settingsMenu );
- //setCentralWidget( view );
- QVBox* wrapperBox = new QVBox( this );
- setCentralWidget( wrapperBox );
-
- QWidget *view = new QWidget( wrapperBox );
+ QWidget *view = new QWidget( this );
+ setCentralWidget( view );
layout = new QBoxLayout ( view, QBoxLayout::LeftToRight );
folderView = new AccountView( view );
folderView->header()->hide();
@@ -105,11 +102,8 @@ MainWindow::MainWindow( QWidget *parent, const char *name, WFlags flags )
mailView->setAllColumnsShowFocus(true);
mailView->setShowSortIndicator(true);
mailView->setSorting(4,false);
- statusWidget = new StatusWidget( wrapperBox );
- statusWidget->hide();
-
layout->addWidget( mailView );
layout->setStretchFactor( folderView, 1 );
layout->setStretchFactor( mailView, 2 );
@@ -123,25 +117,29 @@ MainWindow::MainWindow( QWidget *parent, const char *name, WFlags flags )
connect( mailView, SIGNAL( mouseButtonClicked(int,QListViewItem*,const QPoint&,int) ),this,
SLOT( mailLeftClicked(int,QListViewItem*,const QPoint&,int) ) );
connect( mailView, SIGNAL( mouseButtonPressed(int,QListViewItem*,const QPoint&,int) ),this,
SLOT( mailHold(int,QListViewItem*,const QPoint&,int) ) );
+
connect(folderView, SIGNAL(refreshMailview(const QValueList<RecMailP>&)),
this,SLOT(refreshMailView(const QValueList<RecMailP>&)));
+
connect( composeMail, SIGNAL( activated() ), SLOT( slotComposeMail() ) );
connect( sendQueued, SIGNAL( activated() ), SLOT( slotSendQueued() ) );
+
// connect( searchMails, SIGNAL( activated() ), SLOT( slotSearchMails() ) );
connect( editAccounts, SIGNAL( activated() ), SLOT( slotEditAccounts() ) );
// Added by Stefan Eilers to allow starting by addressbook..
// copied from old mail2
+
#if !defined(QT_NO_COP)
connect( qApp, SIGNAL( appMessage(const QCString&,const QByteArray&) ),
this, SLOT( appMessage(const QCString&,const QByteArray&) ) );
m_sysChannel = new QCopChannel( "QPE/System", this );
connect( m_sysChannel, SIGNAL( received(const QCString&,const QByteArray&) ),
this, SLOT( systemMessage(const QCString&,const QByteArray&) ) );
#endif
- QTimer::singleShot( 1000, this, SLOT( slotAdjustColumns() ) );
+ QTimer::singleShot( 10, this, SLOT( slotAdjustColumns() ) );
}
MainWindow::~MainWindow()
{
diff --git a/noncore/net/mail/mainwindow.h b/noncore/net/mail/mainwindow.h
index 8cec888..ad71a54 100644
--- a/noncore/net/mail/mainwindow.h
+++ b/noncore/net/mail/mainwindow.h
@@ -8,9 +8,8 @@
#include <qtoolbar.h>
#include <qmenubar.h>
#include "accountview.h"
-#include "statuswidget.h"
#include <libmailwrapper/mailtypes.h>
#include <opie2/osmartpointer.h>
@@ -44,9 +43,8 @@ protected slots:
virtual void mailLeftClicked( int, QListViewItem *,const QPoint&,int );
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 2bbc8f1..9eba23e 100644
--- a/noncore/net/mail/opiemail.cpp
+++ b/noncore/net/mail/opiemail.cpp
@@ -106,16 +106,9 @@ OpieMail::OpieMail( QWidget *parent, const char *name, WFlags )
: MainWindow( parent, name, WStyle_ContextHelp )
{
setup_signalblocking();
settings = new Settings();
-
folderView->populate( settings->getAccounts() );
-#if 0
- tvaluelist s = ValueExplode("a=1&b=holladiewaldfee&c=3&d=&e=3450");
- for (int i = 0; i < s.count();++i) {
- odebug<<"Key: " << s[i].key << " Value: " << s[i].data << oendl;
- }
-#endif
}
OpieMail::~OpieMail()
{
@@ -247,12 +240,13 @@ void OpieMail::slotEditAccounts()
{
odebug << "Edit Accounts" << oendl;
EditAccounts eaDialog( settings, this, 0, true, WStyle_ContextHelp );
eaDialog.slotAdjustColumns();
- QPEApplication::execDialog( &eaDialog );
+ if (QPEApplication::execDialog( &eaDialog )==QDialog::Rejected);// return;
+
if ( settings ) delete settings;
settings = new Settings();
-
+ mailView->clear();
folderView->populate( settings->getAccounts() );
}
void OpieMail::displayMail()
diff --git a/noncore/net/mail/statuswidget.cpp b/noncore/net/mail/statuswidget.cpp
deleted file mode 100644
index 19cf635..0000000
--- a/noncore/net/mail/statuswidget.cpp
+++ b/dev/null
@@ -1,33 +0,0 @@
-#include <qtimer.h>
-#include <qprogressbar.h>
-#include <qlabel.h>
-
-#include "statuswidget.h"
-
-// the current problem I see is "locking": used exclusive by one sender
-
-
-StatusWidget::StatusWidget( QWidget* parent, const char* name,WFlags fl )
- : StatusWidgetUI( parent, name, fl ) {
-
- setMaximumHeight( 15 );
- // hide for now since nothing reports decent progress data yet.
- statusProgress->hide();
- }
-
-StatusWidget::~StatusWidget() {
-}
-
-void StatusWidget::setText( const QString& text ) {
- show();
- statusText->setText( text );
- QTimer::singleShot( 5000, this, SLOT( hide() ) );
-}
-
-void StatusWidget::setProgress( int progress ) {
- show();
- statusProgress->setProgress( progress );
- if ( progress == 100 ) {
- hide();
- }
-}
diff --git a/noncore/net/mail/statuswidget.h b/noncore/net/mail/statuswidget.h
deleted file mode 100644
index 73f0d75..0000000
--- a/noncore/net/mail/statuswidget.h
+++ b/dev/null
@@ -1,24 +0,0 @@
-#ifndef STATUS_WIDGET_H
-#define STATUS_WIDGET_H
-
-#include <qwidget.h>
-#include "statuswidgetui.h"
-
-class StatusWidget : public StatusWidgetUI {
-
-Q_OBJECT
-
-public:
- StatusWidget( QWidget* parent = 0, const char* name = 0,WFlags fl = 0 );
- ~StatusWidget();
-
-
-public slots:
-
- void setText( const QString& text );
- void setProgress( int progress );
-};
-
-
-#endif
-
diff --git a/noncore/net/mail/statuswidgetui.ui b/noncore/net/mail/statuswidgetui.ui
deleted file mode 100644
index ffe3528..0000000
--- a/noncore/net/mail/statuswidgetui.ui
+++ b/dev/null
@@ -1,71 +0,0 @@
-<!DOCTYPE UI><UI>
-<class>StatusWidgetUI</class>
-<widget>
- <class>QWidget</class>
- <property stdset="1">
- <name>name</name>
- <cstring>StatusWidgetUI</cstring>
- </property>
- <property stdset="1">
- <name>geometry</name>
- <rect>
- <x>0</x>
- <y>0</y>
- <width>596</width>
- <height>480</height>
- </rect>
- </property>
- <property stdset="1">
- <name>caption</name>
- <string>Form1</string>
- </property>
- <property>
- <name>layoutMargin</name>
- </property>
- <property>
- <name>layoutSpacing</name>
- </property>
- <hbox>
- <property stdset="1">
- <name>margin</name>
- <number>3</number>
- </property>
- <property stdset="1">
- <name>spacing</name>
- <number>3</number>
- </property>
- <widget>
- <class>QProgressBar</class>
- <property stdset="1">
- <name>name</name>
- <cstring>statusProgress</cstring>
- </property>
- <property stdset="1">
- <name>sizePolicy</name>
- <sizepolicy>
- <hsizetype>5</hsizetype>
- <vsizetype>0</vsizetype>
- </sizepolicy>
- </property>
- </widget>
- <widget>
- <class>QLabel</class>
- <property stdset="1">
- <name>name</name>
- <cstring>statusText</cstring>
- </property>
- <property stdset="1">
- <name>sizePolicy</name>
- <sizepolicy>
- <hsizetype>5</hsizetype>
- <vsizetype>1</vsizetype>
- </sizepolicy>
- </property>
- <property stdset="1">
- <name>text</name>
- <string>TextLabel1</string>
- </property>
- </widget>
- </hbox>
-</widget>
-</UI>
diff --git a/noncore/net/mail/viewmail.cpp b/noncore/net/mail/viewmail.cpp
index a64a168..5206220 100644
--- a/noncore/net/mail/viewmail.cpp
+++ b/noncore/net/mail/viewmail.cpp
@@ -195,9 +195,9 @@ void ViewMail::setBody(const RecBodyP&body )
void ViewMail::slotShowHtml( bool state )
{
m_showHtml = state;
- setText();
+ setMainText();
}
void ViewMail::slotItemClicked( QListViewItem * item , const QPoint & point, int )
{
@@ -205,9 +205,9 @@ void ViewMail::slotItemClicked( QListViewItem * item , const QPoint & point, int
return;
if ( ( ( AttachItem* )item )->Partnumber() == -1 )
{
- setText();
+ setMainText();
return;
}
QPopupMenu *menu = new QPopupMenu();
int ret=0;
@@ -249,8 +249,17 @@ void ViewMail::slotItemClicked( QListViewItem * item , const QPoint & point, int
break ;
case 2:
{
+ if (m_lastimagepart== (( AttachItem* )item )->Partnumber()) {
+ if (m_lastdlg) {
+ setUpdatesEnabled(false);
+ browser->hide();
+ m_lastdlg->show();
+ setUpdatesEnabled(true);
+ return;
+ }
+ }
QString tmpfile = QString("/tmp/opiemail-image-%1").arg(_icounter++);
encodedString*content = m_recMail->Wrapper()->fetchDecodedPart( m_recMail, m_body->Parts()[ ( ( AttachItem* )item )->Partnumber() ] );
if (content && content->Length()) {
QFile output(tmpfile);
@@ -275,20 +284,31 @@ void ViewMail::slotItemClicked( QListViewItem * item , const QPoint & point, int
output.remove();
} else {
QMessageBox::critical(this, tr("Reading attachment"), tr("Could not read content of attachment"));
}
+ m_lastimagepart=(( AttachItem* )item )->Partnumber();
}
break;
case 1:
if ( ( ( AttachItem* )item )->Partnumber() == -1 )
{
- setText();
+ setMainText();
}
else
{
if ( m_recMail->Wrapper() != 0l )
{ // make sure that there is a wrapper , even after delete or simular actions
- browser->setText( m_recMail->Wrapper()->fetchTextPart( m_recMail, m_body->Parts()[ ( ( AttachItem* )item )->Partnumber() ] ) );
+ if (m_lastdlg) {
+ m_lastdlg->hide();
+ browser->show();
+ }
+ if (m_lasttextpart == ( ( AttachItem* )item )->Partnumber() ) return;
+ m_lasttextpart = ( ( AttachItem* )item )->Partnumber();
+ QString s = m_recMail->Wrapper()->fetchTextPart( m_recMail, m_body->Parts()[ ( ( AttachItem* )item )->Partnumber() ] );;
+ if (item->text(0).right(4)!="html") {
+ s = QString("<html><body>\n<font face=fixed>%1</font></body></html>").arg(QStyleSheet::convertFromPlainText(s));
+ }
+ browser->setText(s);
}
}
break;
}
@@ -310,9 +330,9 @@ void ViewMail::setMail(const RecMailP&mail )
m_mail2[1] = mail->CC();
m_mail2[2] = mail->Bcc();
setCaption(tr("E-Mail by %1").arg( m_mail[0] ) );
- setText();
+ setMainText();
}
@@ -331,8 +351,10 @@ ViewMail::ViewMail( QWidget *parent, const char *name, WFlags fl)
attachments->setEnabled(m_gotBody);
connect( attachments, SIGNAL( clicked(QListViewItem*,const QPoint&, int) ), SLOT( slotItemClicked(QListViewItem*,const QPoint&, int) ) );
m_lastdlg = 0;
_icounter = 0;
+ m_lastimagepart = -1;
+ m_lasttextpart = -2;
readConfig();
attachments->setSorting(-1);
}
@@ -347,8 +369,9 @@ void ViewMail::slotImageInline(bool how)
m_lastdlg->hide();
m_lastdlg->reparent(0,QPoint(0,0),false);
delete m_lastdlg;
m_lastdlg = 0;
+ m_lastimagepart = -1;
}
}
void ViewMail::readConfig()
@@ -360,9 +383,9 @@ void ViewMail::readConfig()
showPicsInline->setOn(m_PicsInline);
showHtml->setOn( m_showHtml );
}
-void ViewMail::setText()
+void ViewMail::setMainText()
{
QString toString;
QString ccString;
QString bccString;
@@ -371,8 +394,10 @@ void ViewMail::setText()
if (m_lastdlg) {
m_lastdlg->hide();
}
browser->show();
+ if (m_lasttextpart == -1) return;
+ m_lasttextpart = -1;
for ( QStringList::Iterator it = ( m_mail2[0] ).begin(); it != ( m_mail2[0] ).end(); ++it )
{
toString += (*it);
}
diff --git a/noncore/net/mail/viewmail.h b/noncore/net/mail/viewmail.h
index f5033f0..18b1796 100644
--- a/noncore/net/mail/viewmail.h
+++ b/noncore/net/mail/viewmail.h
@@ -54,9 +54,9 @@ protected:
protected slots:
void slotReply();
void slotForward();
- void setText();
+ void setMainText();
void slotItemClicked( QListViewItem * item , const QPoint & point, int c );
void slotDeleteMail( );
void slotShowHtml( bool );
void slotImageInline(bool);
@@ -71,8 +71,10 @@ private:
RecMailP m_recMail;
bool m_showHtml:1;
bool m_PicsInline:1;
unsigned int _icounter;
+ int m_lastimagepart;
+ int m_lasttextpart;
// 0 from 1 subject 2 bodytext 3 date
QMap <int,QString> m_mail;
// 0 to 1 cc 2 bcc