summaryrefslogtreecommitdiff
path: root/noncore
authoralwin <alwin>2005-03-07 23:12:51 (UTC)
committer alwin <alwin>2005-03-07 23:12:51 (UTC)
commit2ba21de3fce9ca9fe9a70474a1927f0106d1d7ce (patch) (unidiff)
treed0ff8c035e34a83fbc935c8f3f6ab926ed432559 /noncore
parenta1fab1e1abd009a6a64c7ea3957bdb5587f4be81 (diff)
downloadopie-2ba21de3fce9ca9fe9a70474a1927f0106d1d7ce.zip
opie-2ba21de3fce9ca9fe9a70474a1927f0106d1d7ce.tar.gz
opie-2ba21de3fce9ca9fe9a70474a1927f0106d1d7ce.tar.bz2
beauty
hopefull some speedups obsolete stuff removed fixed a crasher
Diffstat (limited to 'noncore') (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)
56void AccountView::populate( QList<Account> list ) 56void AccountView::populate( QList<Account> list )
57{ 57{
58 clear(); 58 clear();
59 59
60 imapAccounts.clear(); 60 imapAccounts.clear();
61 mhAccounts.clear(); 61 mhAccounts.clear();
62
63 mhAccounts.append(new MHviewItem(AbstractMail::defaultLocalfolder(),this)); 62 mhAccounts.append(new MHviewItem(AbstractMail::defaultLocalfolder(),this));
64 63
65 Account *it; 64 Account *it;
66 for ( it = list.first(); it; it = list.next() ) { 65 for ( it = list.first(); it; it = list.next() ) {
67 if ( it->getType() == MAILLIB::A_IMAP ) { 66 if ( it->getType() == MAILLIB::A_IMAP ) {
68 IMAPaccount *imap = static_cast<IMAPaccount *>(it); 67 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 \
8 mainwindow.h \ 8 mainwindow.h \
9 viewmail.h \ 9 viewmail.h \
10 viewmailbase.h \ 10 viewmailbase.h \
11 opiemail.h \ 11 opiemail.h \
12 mailistviewitem.h \ 12 mailistviewitem.h \
13 settingsdialog.h \ 13 settingsdialog.h \
14 statuswidget.h \
15 newmaildir.h \ 14 newmaildir.h \
16 selectstore.h \ 15 selectstore.h \
17 selectsmtp.h \ 16 selectsmtp.h \
18 nntpgroups.h \ 17 nntpgroups.h \
19 nntpgroupsdlg.h 18 nntpgroupsdlg.h
20 19
@@ -27,13 +26,12 @@ SOURCES = main.cpp \
27 addresspicker.cpp \ 26 addresspicker.cpp \
28 editaccounts.cpp \ 27 editaccounts.cpp \
29 viewmail.cpp \ 28 viewmail.cpp \
30 viewmailbase.cpp \ 29 viewmailbase.cpp \
31 mailistviewitem.cpp \ 30 mailistviewitem.cpp \
32 settingsdialog.cpp \ 31 settingsdialog.cpp \
33 statuswidget.cpp \
34 newmaildir.cpp \ 32 newmaildir.cpp \
35 selectstore.cpp \ 33 selectstore.cpp \
36 selectsmtp.cpp \ 34 selectsmtp.cpp \
37 nntpgroups.cpp \ 35 nntpgroups.cpp \
38 nntpgroupsdlg.cpp 36 nntpgroupsdlg.cpp
39 37
@@ -43,13 +41,12 @@ INTERFACES = editaccountsui.ui \
43 pop3configui.ui \ 41 pop3configui.ui \
44 nntpconfigui.ui \ 42 nntpconfigui.ui \
45 smtpconfigui.ui \ 43 smtpconfigui.ui \
46 addresspickerui.ui \ 44 addresspickerui.ui \
47 composemailui.ui \ 45 composemailui.ui \
48 settingsdialogui.ui \ 46 settingsdialogui.ui \
49 statuswidgetui.ui \
50 newmaildirui.ui \ 47 newmaildirui.ui \
51 selectstoreui.ui \ 48 selectstoreui.ui \
52 nntpgroupsui.ui 49 nntpgroupsui.ui
53 50
54 51
55INCLUDEPATH += $(OPIEDIR)/include /usr/local/include 52INCLUDEPATH += $(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 )
78 connect( editSettings, SIGNAL( activated() ), 78 connect( editSettings, SIGNAL( activated() ),
79 SLOT( slotEditSettings() ) ); 79 SLOT( slotEditSettings() ) );
80 editAccounts = new QAction( tr( "Configure accounts" ), QIconSet( Resource::loadPixmap("mail/editaccounts") ) , 80 editAccounts = new QAction( tr( "Configure accounts" ), QIconSet( Resource::loadPixmap("mail/editaccounts") ) ,
81 0, 0, this ); 81 0, 0, this );
82 editAccounts->addTo( settingsMenu ); 82 editAccounts->addTo( settingsMenu );
83 83
84 //setCentralWidget( view );
85 84
86 QVBox* wrapperBox = new QVBox( this ); 85 QWidget *view = new QWidget( this );
87 setCentralWidget( wrapperBox ); 86 setCentralWidget( view );
88
89 QWidget *view = new QWidget( wrapperBox );
90 layout = new QBoxLayout ( view, QBoxLayout::LeftToRight ); 87 layout = new QBoxLayout ( view, QBoxLayout::LeftToRight );
91 88
92 folderView = new AccountView( view ); 89 folderView = new AccountView( view );
93 folderView->header()->hide(); 90 folderView->header()->hide();
94 folderView->setRootIsDecorated( true ); 91 folderView->setRootIsDecorated( true );
95 folderView->addColumn( tr( "Mailbox" ) ); 92 folderView->addColumn( tr( "Mailbox" ) );
@@ -103,15 +100,12 @@ MainWindow::MainWindow( QWidget *parent, const char *name, WFlags flags )
103 mailView->addColumn( tr( "Size" ),QListView::Manual); 100 mailView->addColumn( tr( "Size" ),QListView::Manual);
104 mailView->addColumn( tr( "Date" )); 101 mailView->addColumn( tr( "Date" ));
105 mailView->setAllColumnsShowFocus(true); 102 mailView->setAllColumnsShowFocus(true);
106 mailView->setShowSortIndicator(true); 103 mailView->setShowSortIndicator(true);
107 mailView->setSorting(4,false); 104 mailView->setSorting(4,false);
108 105
109 statusWidget = new StatusWidget( wrapperBox );
110 statusWidget->hide();
111
112 layout->addWidget( mailView ); 106 layout->addWidget( mailView );
113 layout->setStretchFactor( folderView, 1 ); 107 layout->setStretchFactor( folderView, 1 );
114 layout->setStretchFactor( mailView, 2 ); 108 layout->setStretchFactor( mailView, 2 );
115 109
116 m_Rotate = (QApplication::desktop()->width() > QApplication::desktop()->height()?0:90); 110 m_Rotate = (QApplication::desktop()->width() > QApplication::desktop()->height()?0:90);
117 111
@@ -121,29 +115,33 @@ MainWindow::MainWindow( QWidget *parent, const char *name, WFlags flags )
121 QPEApplication::setStylusOperation( folderView->viewport(),QPEApplication::RightOnHold); 115 QPEApplication::setStylusOperation( folderView->viewport(),QPEApplication::RightOnHold);
122 116
123 connect( mailView, SIGNAL( mouseButtonClicked(int,QListViewItem*,const QPoint&,int) ),this, 117 connect( mailView, SIGNAL( mouseButtonClicked(int,QListViewItem*,const QPoint&,int) ),this,
124 SLOT( mailLeftClicked(int,QListViewItem*,const QPoint&,int) ) ); 118 SLOT( mailLeftClicked(int,QListViewItem*,const QPoint&,int) ) );
125 connect( mailView, SIGNAL( mouseButtonPressed(int,QListViewItem*,const QPoint&,int) ),this, 119 connect( mailView, SIGNAL( mouseButtonPressed(int,QListViewItem*,const QPoint&,int) ),this,
126 SLOT( mailHold(int,QListViewItem*,const QPoint&,int) ) ); 120 SLOT( mailHold(int,QListViewItem*,const QPoint&,int) ) );
121
127 connect(folderView, SIGNAL(refreshMailview(const QValueList<RecMailP>&)), 122 connect(folderView, SIGNAL(refreshMailview(const QValueList<RecMailP>&)),
128 this,SLOT(refreshMailView(const QValueList<RecMailP>&))); 123 this,SLOT(refreshMailView(const QValueList<RecMailP>&)));
124
129 connect( composeMail, SIGNAL( activated() ), SLOT( slotComposeMail() ) ); 125 connect( composeMail, SIGNAL( activated() ), SLOT( slotComposeMail() ) );
130 connect( sendQueued, SIGNAL( activated() ), SLOT( slotSendQueued() ) ); 126 connect( sendQueued, SIGNAL( activated() ), SLOT( slotSendQueued() ) );
127
131// connect( searchMails, SIGNAL( activated() ), SLOT( slotSearchMails() ) ); 128// connect( searchMails, SIGNAL( activated() ), SLOT( slotSearchMails() ) );
132 connect( editAccounts, SIGNAL( activated() ), SLOT( slotEditAccounts() ) ); 129 connect( editAccounts, SIGNAL( activated() ), SLOT( slotEditAccounts() ) );
133 // Added by Stefan Eilers to allow starting by addressbook.. 130 // Added by Stefan Eilers to allow starting by addressbook..
134 // copied from old mail2 131 // copied from old mail2
132
135#if !defined(QT_NO_COP) 133#if !defined(QT_NO_COP)
136 connect( qApp, SIGNAL( appMessage(const QCString&,const QByteArray&) ), 134 connect( qApp, SIGNAL( appMessage(const QCString&,const QByteArray&) ),
137 this, SLOT( appMessage(const QCString&,const QByteArray&) ) ); 135 this, SLOT( appMessage(const QCString&,const QByteArray&) ) );
138 m_sysChannel = new QCopChannel( "QPE/System", this ); 136 m_sysChannel = new QCopChannel( "QPE/System", this );
139 connect( m_sysChannel, SIGNAL( received(const QCString&,const QByteArray&) ), 137 connect( m_sysChannel, SIGNAL( received(const QCString&,const QByteArray&) ),
140 this, SLOT( systemMessage(const QCString&,const QByteArray&) ) ); 138 this, SLOT( systemMessage(const QCString&,const QByteArray&) ) );
141#endif 139#endif
142 140
143 QTimer::singleShot( 1000, this, SLOT( slotAdjustColumns() ) ); 141 QTimer::singleShot( 10, this, SLOT( slotAdjustColumns() ) );
144} 142}
145 143
146MainWindow::~MainWindow() 144MainWindow::~MainWindow()
147{ 145{
148} 146}
149 147
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 @@
6#include <qaction.h> 6#include <qaction.h>
7 7
8#include <qtoolbar.h> 8#include <qtoolbar.h>
9#include <qmenubar.h> 9#include <qmenubar.h>
10 10
11#include "accountview.h" 11#include "accountview.h"
12#include "statuswidget.h"
13 12
14#include <libmailwrapper/mailtypes.h> 13#include <libmailwrapper/mailtypes.h>
15#include <opie2/osmartpointer.h> 14#include <opie2/osmartpointer.h>
16 15
17class RecMail; 16class RecMail;
18class QCopChannel; 17class QCopChannel;
@@ -42,13 +41,12 @@ protected slots:
42 virtual void slotAdjustLayout(); 41 virtual void slotAdjustLayout();
43 virtual void slotEditSettings(); 42 virtual void slotEditSettings();
44 virtual void mailLeftClicked( int, QListViewItem *,const QPoint&,int ); 43 virtual void mailLeftClicked( int, QListViewItem *,const QPoint&,int );
45 44
46protected: 45protected:
47 QToolBar *toolBar; 46 QToolBar *toolBar;
48 StatusWidget *statusWidget;
49 QMenuBar *menuBar; 47 QMenuBar *menuBar;
50 QPopupMenu *mailMenu, *settingsMenu; 48 QPopupMenu *mailMenu, *settingsMenu;
51 QAction *composeMail, *sendQueued, *showFolders, *searchMails, *deleteMails, 49 QAction *composeMail, *sendQueued, *showFolders, *searchMails, *deleteMails,
52 *editSettings, *editAccounts, *syncFolders; 50 *editSettings, *editAccounts, *syncFolders;
53 AccountView *folderView; 51 AccountView *folderView;
54 QListView *mailView; 52 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()
104 104
105OpieMail::OpieMail( QWidget *parent, const char *name, WFlags ) 105OpieMail::OpieMail( QWidget *parent, const char *name, WFlags )
106 : MainWindow( parent, name, WStyle_ContextHelp ) 106 : MainWindow( parent, name, WStyle_ContextHelp )
107{ 107{
108 setup_signalblocking(); 108 setup_signalblocking();
109 settings = new Settings(); 109 settings = new Settings();
110
111 folderView->populate( settings->getAccounts() ); 110 folderView->populate( settings->getAccounts() );
112#if 0
113 tvaluelist s = ValueExplode("a=1&b=holladiewaldfee&c=3&d=&e=3450");
114 for (int i = 0; i < s.count();++i) {
115 odebug<<"Key: " << s[i].key << " Value: " << s[i].data << oendl;
116 }
117#endif
118} 111}
119 112
120OpieMail::~OpieMail() 113OpieMail::~OpieMail()
121{ 114{
122 if (settings) delete settings; 115 if (settings) delete settings;
123} 116}
@@ -245,16 +238,17 @@ void OpieMail::slotEditSettings()
245 238
246void OpieMail::slotEditAccounts() 239void OpieMail::slotEditAccounts()
247{ 240{
248 odebug << "Edit Accounts" << oendl; 241 odebug << "Edit Accounts" << oendl;
249 EditAccounts eaDialog( settings, this, 0, true, WStyle_ContextHelp ); 242 EditAccounts eaDialog( settings, this, 0, true, WStyle_ContextHelp );
250 eaDialog.slotAdjustColumns(); 243 eaDialog.slotAdjustColumns();
251 QPEApplication::execDialog( &eaDialog ); 244 if (QPEApplication::execDialog( &eaDialog )==QDialog::Rejected);// return;
245
252 if ( settings ) delete settings; 246 if ( settings ) delete settings;
253 settings = new Settings(); 247 settings = new Settings();
254 248 mailView->clear();
255 folderView->populate( settings->getAccounts() ); 249 folderView->populate( settings->getAccounts() );
256} 250}
257 251
258void OpieMail::displayMail() 252void OpieMail::displayMail()
259{ 253{
260 QListViewItem*item = mailView->currentItem(); 254 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 @@
1#include <qtimer.h>
2#include <qprogressbar.h>
3#include <qlabel.h>
4
5#include "statuswidget.h"
6
7// the current problem I see is "locking": used exclusive by one sender
8
9
10StatusWidget::StatusWidget( QWidget* parent, const char* name,WFlags fl )
11 : StatusWidgetUI( parent, name, fl ) {
12
13 setMaximumHeight( 15 );
14 // hide for now since nothing reports decent progress data yet.
15 statusProgress->hide();
16 }
17
18StatusWidget::~StatusWidget() {
19}
20
21void StatusWidget::setText( const QString& text ) {
22 show();
23 statusText->setText( text );
24 QTimer::singleShot( 5000, this, SLOT( hide() ) );
25}
26
27void StatusWidget::setProgress( int progress ) {
28 show();
29 statusProgress->setProgress( progress );
30 if ( progress == 100 ) {
31 hide();
32 }
33}
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 @@
1#ifndef STATUS_WIDGET_H
2#define STATUS_WIDGET_H
3
4#include <qwidget.h>
5#include "statuswidgetui.h"
6
7class StatusWidget : public StatusWidgetUI {
8
9Q_OBJECT
10
11public:
12 StatusWidget( QWidget* parent = 0, const char* name = 0,WFlags fl = 0 );
13 ~StatusWidget();
14
15
16public slots:
17
18 void setText( const QString& text );
19 void setProgress( int progress );
20};
21
22
23#endif
24
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 @@
1<!DOCTYPE UI><UI>
2<class>StatusWidgetUI</class>
3<widget>
4 <class>QWidget</class>
5 <property stdset="1">
6 <name>name</name>
7 <cstring>StatusWidgetUI</cstring>
8 </property>
9 <property stdset="1">
10 <name>geometry</name>
11 <rect>
12 <x>0</x>
13 <y>0</y>
14 <width>596</width>
15 <height>480</height>
16 </rect>
17 </property>
18 <property stdset="1">
19 <name>caption</name>
20 <string>Form1</string>
21 </property>
22 <property>
23 <name>layoutMargin</name>
24 </property>
25 <property>
26 <name>layoutSpacing</name>
27 </property>
28 <hbox>
29 <property stdset="1">
30 <name>margin</name>
31 <number>3</number>
32 </property>
33 <property stdset="1">
34 <name>spacing</name>
35 <number>3</number>
36 </property>
37 <widget>
38 <class>QProgressBar</class>
39 <property stdset="1">
40 <name>name</name>
41 <cstring>statusProgress</cstring>
42 </property>
43 <property stdset="1">
44 <name>sizePolicy</name>
45 <sizepolicy>
46 <hsizetype>5</hsizetype>
47 <vsizetype>0</vsizetype>
48 </sizepolicy>
49 </property>
50 </widget>
51 <widget>
52 <class>QLabel</class>
53 <property stdset="1">
54 <name>name</name>
55 <cstring>statusText</cstring>
56 </property>
57 <property stdset="1">
58 <name>sizePolicy</name>
59 <sizepolicy>
60 <hsizetype>5</hsizetype>
61 <vsizetype>1</vsizetype>
62 </sizepolicy>
63 </property>
64 <property stdset="1">
65 <name>text</name>
66 <string>TextLabel1</string>
67 </property>
68 </widget>
69 </hbox>
70</widget>
71</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 )
193} 193}
194 194
195 195
196void ViewMail::slotShowHtml( bool state ) 196void ViewMail::slotShowHtml( bool state )
197{ 197{
198 m_showHtml = state; 198 m_showHtml = state;
199 setText(); 199 setMainText();
200} 200}
201 201
202void ViewMail::slotItemClicked( QListViewItem * item , const QPoint & point, int ) 202void ViewMail::slotItemClicked( QListViewItem * item , const QPoint & point, int )
203{ 203{
204 if (!item ) 204 if (!item )
205 return; 205 return;
206 206
207 if ( ( ( AttachItem* )item )->Partnumber() == -1 ) 207 if ( ( ( AttachItem* )item )->Partnumber() == -1 )
208 { 208 {
209 setText(); 209 setMainText();
210 return; 210 return;
211 } 211 }
212 QPopupMenu *menu = new QPopupMenu(); 212 QPopupMenu *menu = new QPopupMenu();
213 int ret=0; 213 int ret=0;
214 214
215 if ( item->text( 0 ).left( 5 ) == "text/" || item->text(0)=="message/rfc822" ) 215 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
247 } 247 }
248 } 248 }
249 break ; 249 break ;
250 250
251 case 2: 251 case 2:
252 { 252 {
253 if (m_lastimagepart== (( AttachItem* )item )->Partnumber()) {
254 if (m_lastdlg) {
255 setUpdatesEnabled(false);
256 browser->hide();
257 m_lastdlg->show();
258 setUpdatesEnabled(true);
259 return;
260 }
261 }
253 QString tmpfile = QString("/tmp/opiemail-image-%1").arg(_icounter++); 262 QString tmpfile = QString("/tmp/opiemail-image-%1").arg(_icounter++);
254 encodedString*content = m_recMail->Wrapper()->fetchDecodedPart( m_recMail, m_body->Parts()[ ( ( AttachItem* )item )->Partnumber() ] ); 263 encodedString*content = m_recMail->Wrapper()->fetchDecodedPart( m_recMail, m_body->Parts()[ ( ( AttachItem* )item )->Partnumber() ] );
255 if (content && content->Length()) { 264 if (content && content->Length()) {
256 QFile output(tmpfile); 265 QFile output(tmpfile);
257 output.open(IO_WriteOnly); 266 output.open(IO_WriteOnly);
258 output.writeBlock(content->Content(),content->Length()); 267 output.writeBlock(content->Content(),content->Length());
@@ -273,24 +282,35 @@ void ViewMail::slotItemClicked( QListViewItem * item , const QPoint & point, int
273 m_lastdlg->show(); 282 m_lastdlg->show();
274 } 283 }
275 output.remove(); 284 output.remove();
276 } else { 285 } else {
277 QMessageBox::critical(this, tr("Reading attachment"), tr("Could not read content of attachment")); 286 QMessageBox::critical(this, tr("Reading attachment"), tr("Could not read content of attachment"));
278 } 287 }
288 m_lastimagepart=(( AttachItem* )item )->Partnumber();
279 } 289 }
280 break; 290 break;
281 case 1: 291 case 1:
282 if ( ( ( AttachItem* )item )->Partnumber() == -1 ) 292 if ( ( ( AttachItem* )item )->Partnumber() == -1 )
283 { 293 {
284 setText(); 294 setMainText();
285 } 295 }
286 else 296 else
287 { 297 {
288 if ( m_recMail->Wrapper() != 0l ) 298 if ( m_recMail->Wrapper() != 0l )
289 { // make sure that there is a wrapper , even after delete or simular actions 299 { // make sure that there is a wrapper , even after delete or simular actions
290 browser->setText( m_recMail->Wrapper()->fetchTextPart( m_recMail, m_body->Parts()[ ( ( AttachItem* )item )->Partnumber() ] ) ); 300 if (m_lastdlg) {
301 m_lastdlg->hide();
302 browser->show();
303 }
304 if (m_lasttextpart == ( ( AttachItem* )item )->Partnumber() ) return;
305 m_lasttextpart = ( ( AttachItem* )item )->Partnumber();
306 QString s = m_recMail->Wrapper()->fetchTextPart( m_recMail, m_body->Parts()[ ( ( AttachItem* )item )->Partnumber() ] );;
307 if (item->text(0).right(4)!="html") {
308 s = QString("<html><body>\n<font face=fixed>%1</font></body></html>").arg(QStyleSheet::convertFromPlainText(s));
309 }
310 browser->setText(s);
291 } 311 }
292 } 312 }
293 break; 313 break;
294 } 314 }
295 delete menu; 315 delete menu;
296} 316}
@@ -308,13 +328,13 @@ void ViewMail::setMail(const RecMailP&mail )
308 328
309 m_mail2[0] = mail->To(); 329 m_mail2[0] = mail->To();
310 m_mail2[1] = mail->CC(); 330 m_mail2[1] = mail->CC();
311 m_mail2[2] = mail->Bcc(); 331 m_mail2[2] = mail->Bcc();
312 332
313 setCaption(tr("E-Mail by %1").arg( m_mail[0] ) ); 333 setCaption(tr("E-Mail by %1").arg( m_mail[0] ) );
314 setText(); 334 setMainText();
315} 335}
316 336
317 337
318 338
319ViewMail::ViewMail( QWidget *parent, const char *name, WFlags fl) 339ViewMail::ViewMail( QWidget *parent, const char *name, WFlags fl)
320 : ViewMailBase(parent, name, fl), _inLoop(false) 340 : ViewMailBase(parent, name, fl), _inLoop(false)
@@ -329,12 +349,14 @@ ViewMail::ViewMail( QWidget *parent, const char *name, WFlags fl)
329 connect( showPicsInline, SIGNAL( toggled(bool) ), SLOT( slotImageInline(bool) ) ); 349 connect( showPicsInline, SIGNAL( toggled(bool) ), SLOT( slotImageInline(bool) ) );
330 350
331 attachments->setEnabled(m_gotBody); 351 attachments->setEnabled(m_gotBody);
332 connect( attachments, SIGNAL( clicked(QListViewItem*,const QPoint&, int) ), SLOT( slotItemClicked(QListViewItem*,const QPoint&, int) ) ); 352 connect( attachments, SIGNAL( clicked(QListViewItem*,const QPoint&, int) ), SLOT( slotItemClicked(QListViewItem*,const QPoint&, int) ) );
333 m_lastdlg = 0; 353 m_lastdlg = 0;
334 _icounter = 0; 354 _icounter = 0;
355 m_lastimagepart = -1;
356 m_lasttextpart = -2;
335 357
336 readConfig(); 358 readConfig();
337 attachments->setSorting(-1); 359 attachments->setSorting(-1);
338} 360}
339 361
340void ViewMail::slotImageInline(bool how) 362void ViewMail::slotImageInline(bool how)
@@ -345,12 +367,13 @@ void ViewMail::slotImageInline(bool how)
345 if (m_lastdlg&&!how) { 367 if (m_lastdlg&&!how) {
346 browser->show(); 368 browser->show();
347 m_lastdlg->hide(); 369 m_lastdlg->hide();
348 m_lastdlg->reparent(0,QPoint(0,0),false); 370 m_lastdlg->reparent(0,QPoint(0,0),false);
349 delete m_lastdlg; 371 delete m_lastdlg;
350 m_lastdlg = 0; 372 m_lastdlg = 0;
373 m_lastimagepart = -1;
351 } 374 }
352} 375}
353 376
354void ViewMail::readConfig() 377void ViewMail::readConfig()
355{ 378{
356 Config cfg( "mail" ); 379 Config cfg( "mail" );
@@ -358,23 +381,25 @@ void ViewMail::readConfig()
358 m_showHtml = cfg.readBoolEntry( "showHtml", false ); 381 m_showHtml = cfg.readBoolEntry( "showHtml", false );
359 m_PicsInline = cfg.readBoolEntry( "showPicsInline", true ); 382 m_PicsInline = cfg.readBoolEntry( "showPicsInline", true );
360 showPicsInline->setOn(m_PicsInline); 383 showPicsInline->setOn(m_PicsInline);
361 showHtml->setOn( m_showHtml ); 384 showHtml->setOn( m_showHtml );
362} 385}
363 386
364void ViewMail::setText() 387void ViewMail::setMainText()
365{ 388{
366 QString toString; 389 QString toString;
367 QString ccString; 390 QString ccString;
368 QString bccString; 391 QString bccString;
369 QString mailHtml; 392 QString mailHtml;
370 393
371 if (m_lastdlg) { 394 if (m_lastdlg) {
372 m_lastdlg->hide(); 395 m_lastdlg->hide();
373 } 396 }
374 browser->show(); 397 browser->show();
398 if (m_lasttextpart == -1) return;
399 m_lasttextpart = -1;
375 for ( QStringList::Iterator it = ( m_mail2[0] ).begin(); it != ( m_mail2[0] ).end(); ++it ) 400 for ( QStringList::Iterator it = ( m_mail2[0] ).begin(); it != ( m_mail2[0] ).end(); ++it )
376 { 401 {
377 toString += (*it); 402 toString += (*it);
378 } 403 }
379 for ( QStringList::Iterator it = ( m_mail2[1] ).begin(); it != ( m_mail2[1] ).end(); ++it ) 404 for ( QStringList::Iterator it = ( m_mail2[1] ).begin(); it != ( m_mail2[1] ).end(); ++it )
380 { 405 {
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:
52 52
53 Opie::MM::OImageScrollView*m_lastdlg; 53 Opie::MM::OImageScrollView*m_lastdlg;
54 54
55protected slots: 55protected slots:
56 void slotReply(); 56 void slotReply();
57 void slotForward(); 57 void slotForward();
58 void setText(); 58 void setMainText();
59 void slotItemClicked( QListViewItem * item , const QPoint & point, int c ); 59 void slotItemClicked( QListViewItem * item , const QPoint & point, int c );
60 void slotDeleteMail( ); 60 void slotDeleteMail( );
61 void slotShowHtml( bool ); 61 void slotShowHtml( bool );
62 void slotImageInline(bool); 62 void slotImageInline(bool);
63 63
64private: 64private:
@@ -69,12 +69,14 @@ private:
69 bool m_gotBody; 69 bool m_gotBody;
70 RecBodyP m_body; 70 RecBodyP m_body;
71 RecMailP m_recMail; 71 RecMailP m_recMail;
72 bool m_showHtml:1; 72 bool m_showHtml:1;
73 bool m_PicsInline:1; 73 bool m_PicsInline:1;
74 unsigned int _icounter; 74 unsigned int _icounter;
75 int m_lastimagepart;
76 int m_lasttextpart;
75 77
76 // 0 from 1 subject 2 bodytext 3 date 78 // 0 from 1 subject 2 bodytext 3 date
77 QMap <int,QString> m_mail; 79 QMap <int,QString> m_mail;
78 // 0 to 1 cc 2 bcc 80 // 0 to 1 cc 2 bcc
79 QMap <int,QStringList> m_mail2; 81 QMap <int,QStringList> m_mail2;
80}; 82};