author | zautrix <zautrix> | 2004-10-31 12:28:03 (UTC) |
---|---|---|
committer | zautrix <zautrix> | 2004-10-31 12:28:03 (UTC) |
commit | bed831cc1a38d38a4c5b9329bf37b1c663142c23 (patch) (side-by-side diff) | |
tree | db12b81ea6cee0cac347c801798d759dfe24acfb /kmicromail | |
parent | 553bd9acf9879a77c5fa925155f73afbe8a9af41 (diff) | |
download | kdepimpi-bed831cc1a38d38a4c5b9329bf37b1c663142c23.zip kdepimpi-bed831cc1a38d38a4c5b9329bf37b1c663142c23.tar.gz kdepimpi-bed831cc1a38d38a4c5b9329bf37b1c663142c23.tar.bz2 |
ompi utf8 fixes
-rw-r--r-- | kmicromail/composemail.cpp | 52 | ||||
-rw-r--r-- | kmicromail/libmailwrapper/imapwrapper.cpp | 1 | ||||
-rw-r--r-- | kmicromail/libmailwrapper/settings.cpp | 1 | ||||
-rw-r--r-- | kmicromail/libmailwrapper/settings.h | 1 | ||||
-rw-r--r-- | kmicromail/mailistviewitem.cpp | 4 | ||||
-rw-r--r-- | kmicromail/mainwindow.cpp | 6 | ||||
-rw-r--r-- | kmicromail/opiemail.cpp | 46 | ||||
-rw-r--r-- | kmicromail/opiemail.h | 1 | ||||
-rw-r--r-- | kmicromail/qpe/global.cpp | 6 | ||||
-rw-r--r-- | kmicromail/qpe/qdialog.h | 4 | ||||
-rw-r--r-- | kmicromail/qpe/qdialog_hacked.cpp | 6 | ||||
-rw-r--r-- | kmicromail/viewmail.cpp | 35 |
12 files changed, 103 insertions, 60 deletions
diff --git a/kmicromail/composemail.cpp b/kmicromail/composemail.cpp index 5945b7f..2dcbc75 100644 --- a/kmicromail/composemail.cpp +++ b/kmicromail/composemail.cpp @@ -46,5 +46,5 @@ //using namespace Opie::Core; //using namespace Opie::Ui; -ComposeMail::ComposeMail( Settings *s, QWidget *parent, const char *name, bool modal ) +ComposeMail::ComposeMail( Settings *sett, QWidget *parent, const char *name, bool modal ) : ComposeMailUI( parent, name, modal ) { @@ -52,5 +52,5 @@ ComposeMail::ComposeMail( Settings *s, QWidget *parent, const char *name, bool m connect(ExternalAppHandler::instance(), SIGNAL(receivedNameEmailUidListEvent(const QString&, const QStringList&, const QStringList&, const QStringList&)), this, SLOT(insertAttendees(const QString&, const QStringList&, const QStringList&, const QStringList&))); - settings = s; + settings = sett; m_replyid = ""; if ( KOPrefs::instance()->mUseKapi) { @@ -166,11 +166,11 @@ void ComposeMail::saveAsDraft() Opie::Core::OSmartPointer<Mail> mail= new Mail(); - mail->setMail(fromBox->currentText()); - mail->setTo( toLine->text() ); - mail->setName(senderNameEdit->text()); - mail->setCC( ccLine->text() ); - mail->setBCC( bccLine->text() ); - mail->setReply( replyLine->text() ); - mail->setSubject( subjectLine->text() ); + mail->setMail(fromBox->currentText().utf8 ()); + mail->setTo( toLine->text().utf8 () ); + mail->setName(senderNameEdit->text().utf8 ()); + mail->setCC( ccLine->text().utf8 () ); + mail->setBCC( bccLine->text().utf8 () ); + mail->setReply( replyLine->text().utf8 () ); + mail->setSubject( subjectLine->text().utf8 () ); if (!m_replyid.isEmpty()) { QStringList ids; @@ -178,5 +178,5 @@ void ComposeMail::saveAsDraft() mail->setInreply(ids); } - QString txt = message->text(); + QString txt = message->text().utf8 (); if ( !sigMultiLine->text().isEmpty() ) { txt.append( "\n--\n" ); @@ -409,8 +409,8 @@ void ComposeMail::accept() SMTPaccount *smtp = smtpAccounts.at( smtpAccountBox->currentItem() ); - mail->setMail(fromBox->currentText()); + mail->setMail(fromBox->currentText().utf8 ()); if ( !toLine->text().isEmpty() ) { - mail->setTo( toLine->text() ); + mail->setTo( toLine->text().utf8 () ); } else { QMessageBox::warning(0,i18n("Sending mail"), @@ -419,18 +419,18 @@ void ComposeMail::accept() } - mail->setName(senderNameEdit->text()); - mail->setCC( ccLine->text() ); - mail->setBCC( bccLine->text() ); - mail->setReply( replyLine->text() ); - mail->setSubject( subjectLine->text() ); + mail->setName(senderNameEdit->text().utf8 ()); + mail->setCC( ccLine->text().utf8 () ); + mail->setBCC( bccLine->text().utf8 () ); + mail->setReply( replyLine->text().utf8 () ); + mail->setSubject( subjectLine->text().utf8 () ); if (!m_replyid.isEmpty()) { QStringList ids; - ids.append(m_replyid); + ids.append(m_replyid.utf8 ()); mail->setInreply(ids); } - QString txt = message->text(); + QString txt = message->text().utf8 (); if ( !sigMultiLine->text().isEmpty() ) { txt.append( "\n--\n" ); - txt.append( sigMultiLine->text() ); + txt.append( sigMultiLine->text().utf8 () ); } mail->setMessage( txt ); @@ -484,10 +484,10 @@ void ComposeMail::reEditMail(const RecMailP¤t) { RecMailP data = current; - message->setText(data->Wrapper()->fetchBody(current)->Bodytext()); - subjectLine->setText( data->getSubject()); - toLine->setText(data->To().join(",")); - ccLine->setText(data->CC().join(",")); - bccLine->setText(data->Bcc().join(",")); - replyLine->setText(data->Replyto()); + message->setText(QString::fromUtf8( data->Wrapper()->fetchBody(current)->Bodytext().latin1() )); + subjectLine->setText( QString::fromUtf8( data->getSubject().latin1() )); + toLine->setText(QString::fromUtf8( data->To().join(",").latin1() )); + ccLine->setText(QString::fromUtf8( data->CC().join(",").latin1() )); + bccLine->setText(QString::fromUtf8( data->Bcc().join(",").latin1() )); + replyLine->setText(QString::fromUtf8( data->Replyto().latin1() )); } diff --git a/kmicromail/libmailwrapper/imapwrapper.cpp b/kmicromail/libmailwrapper/imapwrapper.cpp index 110583f..ae667ec 100644 --- a/kmicromail/libmailwrapper/imapwrapper.cpp +++ b/kmicromail/libmailwrapper/imapwrapper.cpp @@ -752,4 +752,5 @@ void IMAPwrapper::traverseBody(const RecMailP&mail,mailimap_body*body,RecBodyP&t if (part1->bd_type==MAILIMAP_BODY_TYPE_1PART_TEXT && target_body->Bodytext().isNull() && countlist[0]==1) { QString body_text = fetchTextPart(mail,countlist,true,currentPart->Encoding()); + //qDebug("encoding %d text %s ",currentPart->Encoding().latin1(), body_text.latin1() ); target_body->setDescription(currentPart); target_body->setBodytext(body_text); diff --git a/kmicromail/libmailwrapper/settings.cpp b/kmicromail/libmailwrapper/settings.cpp index 40b5591..5d2c0ad 100644 --- a/kmicromail/libmailwrapper/settings.cpp +++ b/kmicromail/libmailwrapper/settings.cpp @@ -23,4 +23,5 @@ Settings::Settings() { updateAccounts(); + //qDebug("++++++++++++++++++new settings "); } diff --git a/kmicromail/libmailwrapper/settings.h b/kmicromail/libmailwrapper/settings.h index 79567ef..c996fe0 100644 --- a/kmicromail/libmailwrapper/settings.h +++ b/kmicromail/libmailwrapper/settings.h @@ -166,4 +166,5 @@ class Settings : public QObject public: Settings(); + //~Settings(){qDebug("-------------------settings "); }; QList<Account> getAccounts(); void addAccount(Account *account); diff --git a/kmicromail/mailistviewitem.cpp b/kmicromail/mailistviewitem.cpp index 484a635..5ef5b6a 100644 --- a/kmicromail/mailistviewitem.cpp +++ b/kmicromail/mailistviewitem.cpp @@ -56,6 +56,6 @@ void MailListViewItem::showEntry() mKeyMap.insert(3, "M" +fsort ); } - setText(1,mail_data->getSubject()); - setText(2,mail_data->getFrom()); + setText(1,QString::fromUtf8( mail_data->getSubject().latin1())); + setText(2,QString::fromUtf8( mail_data->getFrom().latin1())); #if 0 QString date = mail_data->getDate(); diff --git a/kmicromail/mainwindow.cpp b/kmicromail/mainwindow.cpp index 4115276..98eb9a5 100644 --- a/kmicromail/mainwindow.cpp +++ b/kmicromail/mainwindow.cpp @@ -12,4 +12,6 @@ #ifdef DESKTOP_VERSION #include <qapplication.h> +#include <qstatusbar.h> +extern QStatusBar* globalSstatusBarMainWindow; #else #include <qpe/qpeapplication.h> @@ -19,5 +21,4 @@ #include <KDGanttMinimizeSplitter.h> - #include <kabc/stdaddressbook.h> @@ -25,4 +26,7 @@ MainWindow::MainWindow( QWidget *parent, const char *name, WFlags flags ) : QMainWindow( parent, name ) //, flags ) { +#ifdef DESKTOP_VERSION + globalSstatusBarMainWindow = statusBar(); +#endif setCaption( i18n( "KOpieMail/Pi" ) ); setToolBarsMovable( false ); diff --git a/kmicromail/opiemail.cpp b/kmicromail/opiemail.cpp index ca3faaf..fe9df87 100644 --- a/kmicromail/opiemail.cpp +++ b/kmicromail/opiemail.cpp @@ -41,4 +41,5 @@ OpieMail::OpieMail( QWidget *parent, const char *name ) settings = new Settings(); + setIcon(SmallIcon( "kmicromail" ) ); folderView->populate( settings->getAccounts() ); @@ -241,5 +242,48 @@ void OpieMail::slotEditAccounts() folderView->populate( settings->getAccounts() ); } +void OpieMail::replyMail() +{ + + QListViewItem*item = mailView->currentItem(); + if (!item) return; + RecMailP mail = ((MailListViewItem*)item)->data(); + RecBodyP body = folderView->fetchBody(mail); + + QString rtext; + rtext += QString("* %1 wrote on %2:\n") // no i18n on purpose + .arg( QString::fromUtf8( mail->getFrom().latin1())) + .arg( QString::fromUtf8( mail->getDate().latin1() )); + + QString text = QString::fromUtf8( body->Bodytext().latin1() ); + QStringList lines = QStringList::split(QRegExp("\\n"), text); + QStringList::Iterator it; + for (it = lines.begin(); it != lines.end(); it++) + { + rtext += "> " + *it + "\n"; + } + rtext += "\n"; + QString prefix; + if ( mail->getSubject().find(QRegExp("^Re: .*$")) != -1) prefix = ""; + else prefix = "Re: "; // no i18n on purpose + + Settings *settings = new Settings(); + ComposeMail composer( settings ,this, 0, true); + if (mail->Replyto().isEmpty()) { + composer.setTo( QString::fromUtf8( mail->getFrom().latin1())); + } else { + composer.setTo( QString::fromUtf8(mail->Replyto().latin1())); + } + composer.setSubject( prefix + QString::fromUtf8( mail->getSubject().latin1() ) ); + composer.setMessage( rtext ); + composer.setInReplyTo( QString::fromUtf8(mail->Msgid().latin1())); + + if ( QDialog::Accepted == KApplication::execDialog( &composer ) ) + { + mail->Wrapper()->answeredMail(mail); + } + delete settings; + +} void OpieMail::displayMail() { @@ -341,4 +385,6 @@ void OpieMail::mailHold(int button, QListViewItem *item,const QPoint&,int ) m->insertItem(i18n("Edit this mail"),this,SLOT(reEditMail())); } + m->insertItem(i18n("Reply to this mail"),this,SLOT(replyMail())); + m->insertSeparator(); m->insertItem(i18n("Read this mail"),this,SLOT(displayMail())); m->insertItem(i18n("Move/Copy this mail"),this,SLOT(slotMoveCopyMail())); diff --git a/kmicromail/opiemail.h b/kmicromail/opiemail.h index 9de95f8..44ab1ec 100644 --- a/kmicromail/opiemail.h +++ b/kmicromail/opiemail.h @@ -31,4 +31,5 @@ protected slots: virtual void slotEditAccounts(); virtual void displayMail(); + virtual void replyMail(); virtual void slotDeleteMail(); virtual void slotGetMail(); diff --git a/kmicromail/qpe/global.cpp b/kmicromail/qpe/global.cpp index f4c6f60..8314f23 100644 --- a/kmicromail/qpe/global.cpp +++ b/kmicromail/qpe/global.cpp @@ -1,10 +1,12 @@ #include "global.h" - +#include <qstatusbar.h> +QStatusBar* globalSstatusBarMainWindow = 0; namespace Global{ void statusMessage(QString message) { - + if ( globalSstatusBarMainWindow ) + globalSstatusBarMainWindow->message( message,15000 ); qDebug("statusMessage %s ", message.latin1()); } diff --git a/kmicromail/qpe/qdialog.h b/kmicromail/qpe/qdialog.h index aafdf80..c63133d 100644 --- a/kmicromail/qpe/qdialog.h +++ b/kmicromail/qpe/qdialog.h @@ -24,8 +24,4 @@ class QDialog_hacked : public QDialog #else -#warning ****************************************** -#warning ****************************************** -#warning ****************************************** -#warning ****************************************** #warning "/usr/local/qt/include/qdialog.h" for KDialog #include "/usr/local/qt/include/qdialog.h" diff --git a/kmicromail/qpe/qdialog_hacked.cpp b/kmicromail/qpe/qdialog_hacked.cpp index 3669312..0a34cec 100644 --- a/kmicromail/qpe/qdialog_hacked.cpp +++ b/kmicromail/qpe/qdialog_hacked.cpp @@ -10,9 +10,5 @@ : QDialog( parent,name,modal, f) { - qDebug("******************** "); - qDebug("******************** "); - qDebug("******************** "); - qDebug("******************** "); - qDebug("New hacked QDialog for ompi "); + qDebug("New hacked QDialog for ompi desktop"); //QTimer::singleShot( 1, this,SLOT(addaddbuttons()) ); diff --git a/kmicromail/viewmail.cpp b/kmicromail/viewmail.cpp index f1e0225..2093678 100644 --- a/kmicromail/viewmail.cpp +++ b/kmicromail/viewmail.cpp @@ -99,5 +99,6 @@ void ViewMail::setBody(const RecBodyP&body ) m_body = body; - m_mail[2] = body->Bodytext(); + m_mail[2] = QString::fromUtf8( body->Bodytext().latin1() ); + // qDebug("********text %s ",m_mail[2].latin1() ); attachbutton->setEnabled(body->Parts().count()>0); attachments->setEnabled(body->Parts().count()>0); @@ -301,8 +302,8 @@ void ViewMail::setMail(const RecMailP&mail ) m_recMail = mail; - m_mail[0] = mail->getFrom(); - m_mail[1] = mail->getSubject(); - m_mail[3] = mail->getDate(); - m_mail[4] = mail->Msgid(); + m_mail[0] = QString::fromUtf8( mail->getFrom().latin1() ); + m_mail[1] = QString::fromUtf8( mail->getSubject().latin1() ); + m_mail[3] = QString::fromUtf8( mail->getDate().latin1() ); + m_mail[4] = QString::fromUtf8( mail->Msgid().latin1() ); m_mail2[0] = mail->To(); @@ -349,16 +350,9 @@ void ViewMail::setText() QString bccString; - 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 ) - { - ccString += (*it); - } - for ( QStringList::Iterator it = ( m_mail2[2] ).begin(); it != ( m_mail2[2] ).end(); ++it ) - { - bccString += (*it); - } + + toString = QString::fromUtf8(m_mail2[0].join(",").latin1()); + ccString = QString::fromUtf8(m_mail2[1].join(",").latin1()); + bccString = QString::fromUtf8(m_mail2[2].join(",").latin1()); + setCaption( i18n("E-Mail by %1").arg( m_mail[0] ) ); @@ -457,7 +451,7 @@ void ViewMail::slotReply() ComposeMail composer( settings ,this, 0, true); if (m_recMail->Replyto().isEmpty()) { - composer.setTo( m_recMail->getFrom()); + composer.setTo( QString::fromUtf8( m_recMail->getFrom().latin1())); } else { - composer.setTo( m_recMail->Replyto()); + composer.setTo( QString::fromUtf8( m_recMail->Replyto().latin1())); } composer.setSubject( prefix + m_mail[1] ); @@ -469,6 +463,7 @@ void ViewMail::slotReply() m_recMail->Wrapper()->answeredMail(m_recMail); } + delete settings; } - + void ViewMail::slotForward() { |