-rw-r--r-- | kmicromail/viewmail.cpp | 47 |
1 files changed, 25 insertions, 22 deletions
diff --git a/kmicromail/viewmail.cpp b/kmicromail/viewmail.cpp index 685b4e4..c9dedb0 100644 --- a/kmicromail/viewmail.cpp +++ b/kmicromail/viewmail.cpp @@ -21,61 +21,64 @@ #include <qdialog.h> #include <qpe/qpeapplication.h> /* QT */ -#include <qtextbrowser.h> +#include <q3textbrowser.h> #include <qmessagebox.h> -#include <qtextstream.h> +#include <q3textstream.h> #include <qaction.h> -#include <qpopupmenu.h> +#include <q3popupmenu.h> #include <qfile.h> #include <qlayout.h> +//Added by qt3to4: +#include <Q3ValueList> +#include <Q3VBoxLayout> //using namespace Opie::Ui; //using namespace Opie::Core; -AttachItem::AttachItem(QListView * parent,QListViewItem *after, const QString&mime,const QString&desc,const QString&file, - const QString&fsize,int num,const QValueList<int>&path) - : QListViewItem(parent,after),_partNum(num) +AttachItem::AttachItem(Q3ListView * parent,Q3ListViewItem *after, const QString&mime,const QString&desc,const QString&file, + const QString&fsize,int num,const Q3ValueList<int>&path) + : Q3ListViewItem(parent,after),_partNum(num) { _path=path; setText(0, mime); setText(1, desc); setText(2, file); setText(3, fsize); } -AttachItem::AttachItem(QListViewItem * parent,QListViewItem *after, const QString&mime,const QString&desc,const QString&file, - const QString&fsize,int num,const QValueList<int>&path) - : QListViewItem(parent,after),_partNum(num) +AttachItem::AttachItem(Q3ListViewItem * parent,Q3ListViewItem *after, const QString&mime,const QString&desc,const QString&file, + const QString&fsize,int num,const Q3ValueList<int>&path) + : Q3ListViewItem(parent,after),_partNum(num) { _path=path; setText(0, mime); setText(1, desc); setText(2, file); setText(3, fsize); } -bool AttachItem::isParentof(const QValueList<int>&path) +bool AttachItem::isParentof(const Q3ValueList<int>&path) { /* if not set, then no parent */ if (path.count()==0||_path.count()==0) return false; /* the parent must have one digit less then a child */ if (path.count()!=_path.count()+1) return false; for (unsigned int i=0; i < _path.count();++i) { if (_path[i]!=path[i]) return false; } return true; } -AttachItem* ViewMail::searchParent(const QValueList<int>&path) +AttachItem* ViewMail::searchParent(const Q3ValueList<int>&path) { - QListViewItemIterator it( attachments ); + Q3ListViewItemIterator it( attachments ); for ( ; it.current(); ++it ) { AttachItem*ati = (AttachItem*)it.current(); if (ati->isParentof(path)) return ati; } return 0; @@ -151,13 +154,13 @@ void ViewMail::setBody(const RecBodyP&body ) so I use this construct that the stream will re-constructed in each loop. To let it work, the textstream is packed into a own area of code is it will be destructed after finishing its small job. */ QTextOStream o(&fsize); if (w>0) o.precision(2); else o.precision(0); - o.setf(QTextStream::fixed); + o.setf(Q3TextStream::fixed); o << s << " " << q << "Byte"; } curItem=new AttachItem(attachments,curItem,type,"Mailbody","",fsize,-1,body->Description()->Positionlist()); QString filename = ""; @@ -192,13 +195,13 @@ void ViewMail::setBody(const RecBodyP&body ) default: q=""; break; } QTextOStream o(&fsize); if (w>0) o.precision(2); else o.precision(0); - o.setf(QTextStream::fixed); + o.setf(Q3TextStream::fixed); o << s << " " << q << "Byte"; desc = body->Parts()[i]->Description(); parentItem = searchParent(body->Parts()[i]->Positionlist()); if (parentItem) { AttachItem*temp = lastChild(parentItem); @@ -236,23 +239,23 @@ void ViewMail::slotViewSource() void ViewMail::slotShowHtml( bool state ) { m_showHtml = state; setText(); } -void ViewMail::slotItemClicked( QListViewItem * item , const QPoint & point, int ) +void ViewMail::slotItemClicked( Q3ListViewItem * item , const QPoint & point, int ) { if (!item ) return; if ( ( ( AttachItem* )item )->Partnumber() == -1 ) { setText(); return; } - QPopupMenu *menu = new QPopupMenu(); + Q3PopupMenu *menu = new Q3PopupMenu(); int ret=0; if ( item->text( 0 ).left( 5 ) == "text/" || item->text(0)=="message/rfc822" ) { menu->insertItem( i18n( "Show Text" ), 1 ); } @@ -275,13 +278,13 @@ void ViewMail::slotItemClicked( QListViewItem * item , const QPoint & point, int if( !str.isEmpty() ) { encodedString*content = m_recMail->Wrapper()->fetchDecodedPart( m_recMail, m_body->Parts()[ ( ( AttachItem* )item )->Partnumber() ] ); if (content) { QFile output(str); - output.open(IO_WriteOnly); + output.open(QIODevice::WriteOnly); output.writeBlock(content->Content(),content->Length()); output.close(); delete content; } } } @@ -294,13 +297,13 @@ void ViewMail::slotItemClicked( QListViewItem * item , const QPoint & point, int #else QString tmpfile = "/tmp/opiemail-image"; #endif encodedString*content = m_recMail->Wrapper()->fetchDecodedPart( m_recMail, m_body->Parts()[ ( ( AttachItem* )item )->Partnumber() ] ); if (content) { QFile output(tmpfile); - output.open(IO_WriteOnly); + output.open(QIODevice::WriteOnly); output.writeBlock(content->Content(),content->Length()); output.close(); delete content; MailImageDlg iview(""); iview.setName(tmpfile); KApplication::execDialog(&iview); @@ -349,13 +352,13 @@ void ViewMail::slotNextMail() setCaption(i18n("Displaying next mail...please wait!")); qApp->processEvents(); emit showNextMail(this); nextMail->blockSignals( false ); } -ViewMail::ViewMail( QWidget *parent, const char *name, WFlags fl) +ViewMail::ViewMail( QWidget *parent, const char *name, Qt::WFlags fl) : ViewMailBase(parent, name, fl), _inLoop(false) { m_gotBody = false; deleted = false; sourceOn = false; readConfig(); @@ -366,13 +369,13 @@ ViewMail::ViewMail( QWidget *parent, const char *name, WFlags fl) connect( closeMail, SIGNAL( activated() ), SLOT( close() ) ); connect( nextMail, SIGNAL( activated() ), SLOT( slotNextMail() ) ); connect( viewSource, SIGNAL( activated() ), SLOT( slotViewSource() ) ); connect( downloadMail, SIGNAL( activated() ), SIGNAL( signalDownloadMail() ) ); attachments->setEnabled(m_gotBody); - connect( attachments, SIGNAL( clicked(QListViewItem*,const QPoint&, int) ), SLOT( slotItemClicked(QListViewItem*,const QPoint&, int) ) ); + connect( attachments, SIGNAL( clicked(Q3ListViewItem*,const QPoint&, int) ), SLOT( slotItemClicked(Q3ListViewItem*,const QPoint&, int) ) ); attachments->setSorting(-1); } void ViewMail::readConfig() { @@ -554,16 +557,16 @@ void ViewMail::slotDeleteMail( ) //m_recMail->Wrapper()->deleteMail( m_recMail ); //hide(); deleted = true; } } -MailImageDlg::MailImageDlg(const QString&fname,QWidget *parent, const char *name, bool modal, WFlags f) +MailImageDlg::MailImageDlg(const QString&fname,QWidget *parent, const char *name, bool modal, Qt::WFlags f) : QDialog(parent,name,modal) { - QVBoxLayout*dlglayout = new QVBoxLayout(this); + Q3VBoxLayout*dlglayout = new Q3VBoxLayout(this); dlglayout->setSpacing(2); dlglayout->setMargin(1); //m_imageview = new Opie::MM::OImageScrollView(this); //dlglayout->addWidget(m_imageview); } |