author | alwin <alwin> | 2004-10-28 02:12:12 (UTC) |
---|---|---|
committer | alwin <alwin> | 2004-10-28 02:12:12 (UTC) |
commit | 6205e982ec6d9ab1893919cd9c943c95b4baae33 (patch) (unidiff) | |
tree | 7f5eeab32ad333e441956ce3bccf313609a54b83 /noncore/net/mail | |
parent | beaee4a305e89b27f0482047daf06919fdd9d732 (diff) | |
download | opie-6205e982ec6d9ab1893919cd9c943c95b4baae33.zip opie-6205e982ec6d9ab1893919cd9c943c95b4baae33.tar.gz opie-6205e982ec6d9ab1893919cd9c943c95b4baae33.tar.bz2 |
fixed some problems when displaying mails
but it should reworked cause sometimes there are problems with html
mails.
-rw-r--r-- | noncore/net/mail/viewmail.cpp | 28 | ||||
-rw-r--r-- | noncore/net/mail/viewmail.h | 1 | ||||
-rw-r--r-- | noncore/net/mail/viewmailbase.cpp | 3 | ||||
-rw-r--r-- | noncore/net/mail/viewmailbase.h | 2 |
4 files changed, 16 insertions, 18 deletions
diff --git a/noncore/net/mail/viewmail.cpp b/noncore/net/mail/viewmail.cpp index d5f9b7f..d2f1584 100644 --- a/noncore/net/mail/viewmail.cpp +++ b/noncore/net/mail/viewmail.cpp | |||
@@ -19,8 +19,9 @@ | |||
19 | #include <qaction.h> | 19 | #include <qaction.h> |
20 | #include <qpopupmenu.h> | 20 | #include <qpopupmenu.h> |
21 | #include <qfile.h> | 21 | #include <qfile.h> |
22 | #include <qlayout.h> | 22 | #include <qlayout.h> |
23 | #include <qstylesheet.h> | ||
23 | 24 | ||
24 | using namespace Opie::Ui; | 25 | using namespace Opie::Ui; |
25 | using namespace Opie::Core; | 26 | using namespace Opie::Core; |
26 | 27 | ||
@@ -295,8 +296,9 @@ void ViewMail::setMail(const RecMailP&mail ) | |||
295 | m_mail2[0] = mail->To(); | 296 | m_mail2[0] = mail->To(); |
296 | m_mail2[1] = mail->CC(); | 297 | m_mail2[1] = mail->CC(); |
297 | m_mail2[2] = mail->Bcc(); | 298 | m_mail2[2] = mail->Bcc(); |
298 | 299 | ||
300 | setCaption(tr("E-Mail by %1").arg( m_mail[0] ) ); | ||
299 | setText(); | 301 | setText(); |
300 | } | 302 | } |
301 | 303 | ||
302 | 304 | ||
@@ -328,12 +330,12 @@ void ViewMail::readConfig() | |||
328 | } | 330 | } |
329 | 331 | ||
330 | void ViewMail::setText() | 332 | void ViewMail::setText() |
331 | { | 333 | { |
332 | |||
333 | QString toString; | 334 | QString toString; |
334 | QString ccString; | 335 | QString ccString; |
335 | QString bccString; | 336 | QString bccString; |
337 | QString mailHtml; | ||
336 | 338 | ||
337 | for ( QStringList::Iterator it = ( m_mail2[0] ).begin(); it != ( m_mail2[0] ).end(); ++it ) | 339 | for ( QStringList::Iterator it = ( m_mail2[0] ).begin(); it != ( m_mail2[0] ).end(); ++it ) |
338 | { | 340 | { |
339 | toString += (*it); | 341 | toString += (*it); |
@@ -345,28 +347,22 @@ void ViewMail::setText() | |||
345 | for ( QStringList::Iterator it = ( m_mail2[2] ).begin(); it != ( m_mail2[2] ).end(); ++it ) | 347 | for ( QStringList::Iterator it = ( m_mail2[2] ).begin(); it != ( m_mail2[2] ).end(); ++it ) |
346 | { | 348 | { |
347 | bccString += (*it); | 349 | bccString += (*it); |
348 | } | 350 | } |
349 | 351 | browser->setTextFormat(Qt::RichText); | |
350 | setCaption( caption().arg( m_mail[0] ) ); | 352 | mailHtml = "<html><body>" |
351 | |||
352 | m_mailHtml = "<html><body>" | ||
353 | "<table width=\"100%\" border=\"0\"><tr bgcolor=\"#FFDD76\"><td>" | 353 | "<table width=\"100%\" border=\"0\"><tr bgcolor=\"#FFDD76\"><td>" |
354 | "<div align=left><b>" + deHtml( m_mail[1] ) + "</b></div>" | 354 | "<div align=left><b>" + deHtml( m_mail[1] ) + "</b></div>" |
355 | "</td></tr><tr bgcolor=\"#EEEEE6\"><td>" | 355 | "</td></tr><tr bgcolor=\"#EEEEE6\"><td>" |
356 | "<b>" + tr( "From" ) + ": </b><font color=#6C86C0>" + deHtml( m_mail[0] ) + "</font><br>" | 356 | "<b>" + tr( "From" ) + ": </b><font color=#6C86C0>" + deHtml( m_mail[0] ) + "</font><br>" |
357 | "<b>" + tr( "To" ) + ": </b><font color=#6C86C0>" + deHtml( toString ) + "</font><br><b>" + | 357 | "<b>" + tr( "To" ) + ": </b><font color=#6C86C0>" + deHtml( toString ) + "</font><br><b>" + |
358 | tr( "Cc" ) + ": </b>" + deHtml( ccString ) + "<br>" | 358 | tr( "Cc" ) + ": </b>" + deHtml( ccString ) + "<br>" |
359 | "<b>" + tr( "Date" ) + ": </b> " + m_mail[3] + | 359 | "<b>" + tr( "Date" ) + ": </b> " + m_mail[3] + |
360 | "</td></tr></table><font face=fixed>"; | 360 | "</td></tr></table>"; |
361 | 361 | if ( !m_showHtml ) { | |
362 | if ( !m_showHtml ) | 362 | browser->setText( mailHtml+"<font face=fixed>" + QStyleSheet::convertFromPlainText(m_mail[2]) + "</font></body></html>" ); |
363 | { | 363 | } else { |
364 | browser->setText( QString( m_mailHtml) + deHtml( m_mail[2] ) + "</font></html>" ); | 364 | browser->setText(mailHtml+m_mail[2].simplifyWhiteSpace()+"</html>"); |
365 | } | ||
366 | else | ||
367 | { | ||
368 | browser->setText( QString( m_mailHtml) + m_mail[2] + "</font></html>" ); | ||
369 | } | 365 | } |
370 | // remove later in favor of a real handling | 366 | // remove later in favor of a real handling |
371 | m_gotBody = true; | 367 | m_gotBody = true; |
372 | } | 368 | } |
@@ -402,11 +398,11 @@ void ViewMail::exec() | |||
402 | } | 398 | } |
403 | 399 | ||
404 | } | 400 | } |
405 | 401 | ||
406 | QString ViewMail::deHtml(const QString &string) | 402 | QString ViewMail::deHtml(const QString &aString) |
407 | { | 403 | { |
408 | QString string_ = string; | 404 | QString string_ = aString; |
409 | string_.replace(QRegExp("&"), "&"); | 405 | string_.replace(QRegExp("&"), "&"); |
410 | string_.replace(QRegExp("<"), "<"); | 406 | string_.replace(QRegExp("<"), "<"); |
411 | string_.replace(QRegExp(">"), ">"); | 407 | string_.replace(QRegExp(">"), ">"); |
412 | string_.replace(QRegExp("\\n"), "<br>"); | 408 | string_.replace(QRegExp("\\n"), "<br>"); |
diff --git a/noncore/net/mail/viewmail.h b/noncore/net/mail/viewmail.h index 297836b..560453a 100644 --- a/noncore/net/mail/viewmail.h +++ b/noncore/net/mail/viewmail.h | |||
@@ -51,8 +51,9 @@ protected: | |||
51 | protected slots: | 51 | protected slots: |
52 | void slotReply(); | 52 | void slotReply(); |
53 | void slotForward(); | 53 | void slotForward(); |
54 | void setText(); | 54 | void setText(); |
55 | void setHeader(); | ||
55 | void slotItemClicked( QListViewItem * item , const QPoint & point, int c ); | 56 | void slotItemClicked( QListViewItem * item , const QPoint & point, int c ); |
56 | void slotDeleteMail( ); | 57 | void slotDeleteMail( ); |
57 | void slotShowHtml( bool ); | 58 | void slotShowHtml( bool ); |
58 | 59 | ||
diff --git a/noncore/net/mail/viewmailbase.cpp b/noncore/net/mail/viewmailbase.cpp index cbb98cc..49a0e6a 100644 --- a/noncore/net/mail/viewmailbase.cpp +++ b/noncore/net/mail/viewmailbase.cpp | |||
@@ -13,9 +13,9 @@ | |||
13 | 13 | ||
14 | ViewMailBase::ViewMailBase(QWidget *parent, const char *name, WFlags fl) | 14 | ViewMailBase::ViewMailBase(QWidget *parent, const char *name, WFlags fl) |
15 | : QMainWindow(parent, name, fl) | 15 | : QMainWindow(parent, name, fl) |
16 | { | 16 | { |
17 | setCaption(tr("E-Mail by %1")); | 17 | setCaption(tr("E-Mail view")); |
18 | setToolBarsMovable(false); | 18 | setToolBarsMovable(false); |
19 | 19 | ||
20 | toolbar = new QToolBar(this); | 20 | toolbar = new QToolBar(this); |
21 | menubar = new QMenuBar( toolbar ); | 21 | menubar = new QMenuBar( toolbar ); |
@@ -64,8 +64,9 @@ ViewMailBase::ViewMailBase(QWidget *parent, const char *name, WFlags fl) | |||
64 | attachments->addColumn(tr("Size"), 80); | 64 | attachments->addColumn(tr("Size"), 80); |
65 | attachments->setSorting(-1); | 65 | attachments->setSorting(-1); |
66 | attachments->hide(); | 66 | attachments->hide(); |
67 | 67 | ||
68 | //header = new QTextBrowser(view); | ||
68 | browser = new QTextBrowser(view); | 69 | browser = new QTextBrowser(view); |
69 | 70 | ||
70 | //openDiag = new OpenDiag(view); | 71 | //openDiag = new OpenDiag(view); |
71 | //openDiag->hide(); | 72 | //openDiag->hide(); |
diff --git a/noncore/net/mail/viewmailbase.h b/noncore/net/mail/viewmailbase.h index fdaad2a..583b1f6 100644 --- a/noncore/net/mail/viewmailbase.h +++ b/noncore/net/mail/viewmailbase.h | |||
@@ -21,9 +21,9 @@ public: | |||
21 | protected: | 21 | protected: |
22 | QAction *reply, *forward, *attachbutton, *deleteMail, *showHtml; | 22 | QAction *reply, *forward, *attachbutton, *deleteMail, *showHtml; |
23 | QListView *attachments; | 23 | QListView *attachments; |
24 | QToolBar *toolbar; | 24 | QToolBar *toolbar; |
25 | QTextBrowser *browser; | 25 | QTextBrowser *browser;//,*header; |
26 | OpenDiag *openDiag; | 26 | OpenDiag *openDiag; |
27 | QMenuBar *menubar; | 27 | QMenuBar *menubar; |
28 | QPopupMenu *mailmenu; | 28 | QPopupMenu *mailmenu; |
29 | 29 | ||