summaryrefslogtreecommitdiff
authoralwin <alwin>2005-03-07 23:12:51 (UTC)
committer alwin <alwin>2005-03-07 23:12:51 (UTC)
commit2ba21de3fce9ca9fe9a70474a1927f0106d1d7ce (patch) (side-by-side diff)
treed0ff8c035e34a83fbc935c8f3f6ab926ed432559
parenta1fab1e1abd009a6a64c7ea3957bdb5587f4be81 (diff)
downloadopie-2ba21de3fce9ca9fe9a70474a1927f0106d1d7ce.zip
opie-2ba21de3fce9ca9fe9a70474a1927f0106d1d7ce.tar.gz
opie-2ba21de3fce9ca9fe9a70474a1927f0106d1d7ce.tar.bz2
beauty
hopefull some speedups obsolete stuff removed fixed a crasher
Diffstat (more/less context) (show 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
@@ -59,7 +59,6 @@ void AccountView::populate( QList<Account> list )
imapAccounts.clear();
mhAccounts.clear();
-
mhAccounts.append(new MHviewItem(AbstractMail::defaultLocalfolder(),this));
Account *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
@@ -11,7 +11,6 @@ HEADERS = defines.h \
opiemail.h \
mailistviewitem.h \
settingsdialog.h \
- statuswidget.h \
newmaildir.h \
selectstore.h \
selectsmtp.h \
@@ -30,7 +29,6 @@ SOURCES = main.cpp \
viewmailbase.cpp \
mailistviewitem.cpp \
settingsdialog.cpp \
- statuswidget.cpp \
newmaildir.cpp \
selectstore.cpp \
selectsmtp.cpp \
@@ -46,7 +44,6 @@ INTERFACES = editaccountsui.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
@@ -81,12 +81,9 @@ MainWindow::MainWindow( QWidget *parent, const char *name, WFlags flags )
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 );
@@ -106,9 +103,6 @@ MainWindow::MainWindow( QWidget *parent, const char *name, WFlags flags )
mailView->setShowSortIndicator(true);
mailView->setSorting(4,false);
- statusWidget = new StatusWidget( wrapperBox );
- statusWidget->hide();
-
layout->addWidget( mailView );
layout->setStretchFactor( folderView, 1 );
layout->setStretchFactor( mailView, 2 );
@@ -124,14 +118,18 @@ MainWindow::MainWindow( QWidget *parent, const char *name, WFlags flags )
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&) ) );
@@ -140,7 +138,7 @@ MainWindow::MainWindow( QWidget *parent, const char *name, WFlags flags )
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
@@ -9,7 +9,6 @@
#include <qmenubar.h>
#include "accountview.h"
-#include "statuswidget.h"
#include <libmailwrapper/mailtypes.h>
#include <opie2/osmartpointer.h>
@@ -45,7 +44,6 @@ protected slots:
protected:
QToolBar *toolBar;
- StatusWidget *statusWidget;
QMenuBar *menuBar;
QPopupMenu *mailMenu, *settingsMenu;
QAction *composeMail, *sendQueued, *showFolders, *searchMails, *deleteMails,
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
@@ -107,14 +107,7 @@ OpieMail::OpieMail( QWidget *parent, const char *name, WFlags )
{
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()
@@ -248,10 +241,11 @@ 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() );
}
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
@@ -196,7 +196,7 @@ 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 )
@@ -206,7 +206,7 @@ void ViewMail::slotItemClicked( QListViewItem * item , const QPoint & point, int
if ( ( ( AttachItem* )item )->Partnumber() == -1 )
{
- setText();
+ setMainText();
return;
}
QPopupMenu *menu = new QPopupMenu();
@@ -250,6 +250,15 @@ void ViewMail::slotItemClicked( QListViewItem * item , const QPoint & point, int
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()) {
@@ -276,18 +285,29 @@ void ViewMail::slotItemClicked( QListViewItem * item , const QPoint & point, int
} 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;
@@ -311,7 +331,7 @@ void ViewMail::setMail(const RecMailP&mail )
m_mail2[2] = mail->Bcc();
setCaption(tr("E-Mail by %1").arg( m_mail[0] ) );
- setText();
+ setMainText();
}
@@ -332,6 +352,8 @@ ViewMail::ViewMail( QWidget *parent, const char *name, WFlags fl)
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);
@@ -348,6 +370,7 @@ void ViewMail::slotImageInline(bool how)
m_lastdlg->reparent(0,QPoint(0,0),false);
delete m_lastdlg;
m_lastdlg = 0;
+ m_lastimagepart = -1;
}
}
@@ -361,7 +384,7 @@ void ViewMail::readConfig()
showHtml->setOn( m_showHtml );
}
-void ViewMail::setText()
+void ViewMail::setMainText()
{
QString toString;
QString ccString;
@@ -372,6 +395,8 @@ void ViewMail::setText()
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
@@ -55,7 +55,7 @@ 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 );
@@ -72,6 +72,8 @@ private:
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;