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
@@ -56,13 +56,12 @@ void AccountView::slotHold(int button, QListViewItem * item,const QPoint&,int)
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() ) {
if ( it->getType() == MAILLIB::A_IMAP ) {
IMAPaccount *imap = static_cast<IMAPaccount *>(it);
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
@@ -8,13 +8,12 @@ HEADERS = defines.h \
mainwindow.h \
viewmail.h \
viewmailbase.h \
opiemail.h \
mailistviewitem.h \
settingsdialog.h \
- statuswidget.h \
newmaildir.h \
selectstore.h \
selectsmtp.h \
nntpgroups.h \
nntpgroupsdlg.h
@@ -27,13 +26,12 @@ SOURCES = main.cpp \
addresspicker.cpp \
editaccounts.cpp \
viewmail.cpp \
viewmailbase.cpp \
mailistviewitem.cpp \
settingsdialog.cpp \
- statuswidget.cpp \
newmaildir.cpp \
selectstore.cpp \
selectsmtp.cpp \
nntpgroups.cpp \
nntpgroupsdlg.cpp
@@ -43,13 +41,12 @@ INTERFACES = editaccountsui.ui \
pop3configui.ui \
nntpconfigui.ui \
smtpconfigui.ui \
addresspickerui.ui \
composemailui.ui \
settingsdialogui.ui \
- statuswidgetui.ui \
newmaildirui.ui \
selectstoreui.ui \
nntpgroupsui.ui
INCLUDEPATH += $(OPIEDIR)/include /usr/local/include
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
@@ -78,18 +78,15 @@ MainWindow::MainWindow( QWidget *parent, const char *name, WFlags flags )
connect( editSettings, SIGNAL( activated() ),
SLOT( slotEditSettings() ) );
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();
folderView->setRootIsDecorated( true );
folderView->addColumn( tr( "Mailbox" ) );
@@ -103,15 +100,12 @@ MainWindow::MainWindow( QWidget *parent, const char *name, WFlags flags )
mailView->addColumn( tr( "Size" ),QListView::Manual);
mailView->addColumn( tr( "Date" ));
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 );
m_Rotate = (QApplication::desktop()->width() > QApplication::desktop()->height()?0:90);
@@ -121,29 +115,33 @@ MainWindow::MainWindow( QWidget *parent, const char *name, WFlags flags )
QPEApplication::setStylusOperation( folderView->viewport(),QPEApplication::RightOnHold);
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
@@ -6,13 +6,12 @@
#include <qaction.h>
#include <qtoolbar.h>
#include <qmenubar.h>
#include "accountview.h"
-#include "statuswidget.h"
#include <libmailwrapper/mailtypes.h>
#include <opie2/osmartpointer.h>
class RecMail;
class QCopChannel;
@@ -42,13 +41,12 @@ protected slots:
virtual void slotAdjustLayout();
virtual void slotEditSettings();
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;
AccountView *folderView;
QListView *mailView;
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
@@ -104,20 +104,13 @@ void ValueExplode::splitit()
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()
{
if (settings) delete settings;
}
@@ -245,16 +238,17 @@ void OpieMail::slotEditSettings()
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()
{
QListViewItem*item = mailView->currentItem();
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
@@ -193,23 +193,23 @@ 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 )
{
if (!item )
return;
if ( ( ( AttachItem* )item )->Partnumber() == -1 )
{
- setText();
+ setMainText();
return;
}
QPopupMenu *menu = new QPopupMenu();
int ret=0;
if ( item->text( 0 ).left( 5 ) == "text/" || item->text(0)=="message/rfc822" )
@@ -247,12 +247,21 @@ 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);
output.open(IO_WriteOnly);
output.writeBlock(content->Content(),content->Length());
@@ -273,24 +282,35 @@ void ViewMail::slotItemClicked( QListViewItem * item , const QPoint & point, int
m_lastdlg->show();
}
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;
}
delete menu;
}
@@ -308,13 +328,13 @@ void ViewMail::setMail(const RecMailP&mail )
m_mail2[0] = mail->To();
m_mail2[1] = mail->CC();
m_mail2[2] = mail->Bcc();
setCaption(tr("E-Mail by %1").arg( m_mail[0] ) );
- setText();
+ setMainText();
}
ViewMail::ViewMail( QWidget *parent, const char *name, WFlags fl)
: ViewMailBase(parent, name, fl), _inLoop(false)
@@ -329,12 +349,14 @@ ViewMail::ViewMail( QWidget *parent, const char *name, WFlags fl)
connect( showPicsInline, SIGNAL( toggled(bool) ), SLOT( slotImageInline(bool) ) );
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);
}
void ViewMail::slotImageInline(bool how)
@@ -345,12 +367,13 @@ void ViewMail::slotImageInline(bool how)
if (m_lastdlg&&!how) {
browser->show();
m_lastdlg->hide();
m_lastdlg->reparent(0,QPoint(0,0),false);
delete m_lastdlg;
m_lastdlg = 0;
+ m_lastimagepart = -1;
}
}
void ViewMail::readConfig()
{
Config cfg( "mail" );
@@ -358,23 +381,25 @@ void ViewMail::readConfig()
m_showHtml = cfg.readBoolEntry( "showHtml", false );
m_PicsInline = cfg.readBoolEntry( "showPicsInline", true );
showPicsInline->setOn(m_PicsInline);
showHtml->setOn( m_showHtml );
}
-void ViewMail::setText()
+void ViewMail::setMainText()
{
QString toString;
QString ccString;
QString bccString;
QString mailHtml;
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);
}
for ( QStringList::Iterator it = ( m_mail2[1] ).begin(); it != ( m_mail2[1] ).end(); ++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
@@ -52,13 +52,13 @@ protected:
Opie::MM::OImageScrollView*m_lastdlg;
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);
private:
@@ -69,12 +69,14 @@ private:
bool m_gotBody;
RecBodyP m_body;
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
QMap <int,QStringList> m_mail2;
};