summaryrefslogtreecommitdiffabout
path: root/kmicromail
authorzautrix <zautrix>2004-10-31 12:28:03 (UTC)
committer zautrix <zautrix>2004-10-31 12:28:03 (UTC)
commitbed831cc1a38d38a4c5b9329bf37b1c663142c23 (patch) (side-by-side diff)
treedb12b81ea6cee0cac347c801798d759dfe24acfb /kmicromail
parent553bd9acf9879a77c5fa925155f73afbe8a9af41 (diff)
downloadkdepimpi-bed831cc1a38d38a4c5b9329bf37b1c663142c23.zip
kdepimpi-bed831cc1a38d38a4c5b9329bf37b1c663142c23.tar.gz
kdepimpi-bed831cc1a38d38a4c5b9329bf37b1c663142c23.tar.bz2
ompi utf8 fixes
Diffstat (limited to 'kmicromail') (more/less context) (ignore whitespace changes)
-rw-r--r--kmicromail/composemail.cpp52
-rw-r--r--kmicromail/libmailwrapper/imapwrapper.cpp1
-rw-r--r--kmicromail/libmailwrapper/settings.cpp1
-rw-r--r--kmicromail/libmailwrapper/settings.h1
-rw-r--r--kmicromail/mailistviewitem.cpp4
-rw-r--r--kmicromail/mainwindow.cpp6
-rw-r--r--kmicromail/opiemail.cpp46
-rw-r--r--kmicromail/opiemail.h1
-rw-r--r--kmicromail/qpe/global.cpp6
-rw-r--r--kmicromail/qpe/qdialog.h4
-rw-r--r--kmicromail/qpe/qdialog_hacked.cpp6
-rw-r--r--kmicromail/viewmail.cpp35
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
@@ -45,13 +45,13 @@
//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 )
{
mPickLineEdit = 0;
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) {
KConfig config( locateLocal("config", "kabcrc") );
@@ -165,19 +165,19 @@ 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;
ids.append(m_replyid);
mail->setInreply(ids);
}
- QString txt = message->text();
+ QString txt = message->text().utf8 ();
if ( !sigMultiLine->text().isEmpty() ) {
txt.append( "\n--\n" );
txt.append( sigMultiLine->text() );
@@ -408,30 +408,30 @@ void ComposeMail::accept()
Opie::Core::OSmartPointer<Mail> mail=new Mail;
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"),
i18n("No Receiver spezified" ) );
return;
}
- 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 );
AttachViewItem *it = (AttachViewItem *) attList->firstChild();
@@ -483,12 +483,12 @@ ComposeMail::~ComposeMail()
void ComposeMail::reEditMail(const RecMailP&current)
{
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() ));
}
AttachViewItem::AttachViewItem( QListView *parent, Attachment *att )
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
@@ -751,6 +751,7 @@ void IMAPwrapper::traverseBody(const RecMailP&mail,mailimap_body*body,RecBodyP&t
And we put it only into the mail if it is the FIRST part */
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);
if (countlist.count()>1) {
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
@@ -22,6 +22,7 @@ Settings::Settings()
: QObject()
{
updateAccounts();
+ //qDebug("++++++++++++++++++new settings ");
}
void Settings::checkDirectory()
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
@@ -165,6 +165,7 @@ class Settings : public QObject
public:
Settings();
+ //~Settings(){qDebug("-------------------settings "); };
QList<Account> getAccounts();
void addAccount(Account *account);
void delAccount(Account *account);
diff --git a/kmicromail/mailistviewitem.cpp b/kmicromail/mailistviewitem.cpp
index 484a635..5ef5b6a 100644
--- a/kmicromail/mailistviewitem.cpp
+++ b/kmicromail/mailistviewitem.cpp
@@ -55,8 +55,8 @@ void MailListViewItem::showEntry()
//setText(3, fsize + "MB");
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
@@ -11,6 +11,8 @@
#ifdef DESKTOP_VERSION
#include <qapplication.h>
+#include <qstatusbar.h>
+extern QStatusBar* globalSstatusBarMainWindow;
#else
#include <qpe/qpeapplication.h>
#endif
@@ -18,12 +20,14 @@
#include "mainwindow.h"
#include <KDGanttMinimizeSplitter.h>
-
#include <kabc/stdaddressbook.h>
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 );
//KABC::StdAddressBook::self();
diff --git a/kmicromail/opiemail.cpp b/kmicromail/opiemail.cpp
index ca3faaf..fe9df87 100644
--- a/kmicromail/opiemail.cpp
+++ b/kmicromail/opiemail.cpp
@@ -40,6 +40,7 @@ OpieMail::OpieMail( QWidget *parent, const char *name )
{
settings = new Settings();
+ setIcon(SmallIcon( "kmicromail" ) );
folderView->populate( settings->getAccounts() );
}
@@ -240,7 +241,50 @@ 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()
{
QListViewItem*item = mailView->currentItem();
@@ -340,6 +384,8 @@ void OpieMail::mailHold(int button, QListViewItem *item,const QPoint&,int )
if (folderView->currentisDraft()) {
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()));
m->insertItem(i18n("Delete this mail"),this,SLOT(slotDeleteMail()));
diff --git a/kmicromail/opiemail.h b/kmicromail/opiemail.h
index 9de95f8..44ab1ec 100644
--- a/kmicromail/opiemail.h
+++ b/kmicromail/opiemail.h
@@ -30,6 +30,7 @@ protected slots:
virtual void slotEditSettings();
virtual void slotEditAccounts();
virtual void displayMail();
+ virtual void replyMail();
virtual void slotDeleteMail();
virtual void slotGetMail();
virtual void slotGetAllMail();
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,11 +1,13 @@
#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
@@ -23,10 +23,6 @@ class QDialog_hacked : public QDialog
#endif
#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
@@ -9,11 +9,7 @@
QDialog_hacked::QDialog_hacked ( QWidget * parent, const char * name, bool modal, WFlags f )
: 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()) );
setOrientation ( Vertical );
diff --git a/kmicromail/viewmail.cpp b/kmicromail/viewmail.cpp
index f1e0225..2093678 100644
--- a/kmicromail/viewmail.cpp
+++ b/kmicromail/viewmail.cpp
@@ -98,7 +98,8 @@ 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);
if (body->Parts().count()==0)
@@ -300,10 +301,10 @@ 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();
m_mail2[1] = mail->CC();
@@ -348,18 +349,11 @@ void ViewMail::setText()
QString ccString;
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] ) );
@@ -456,9 +450,9 @@ void ViewMail::slotReply()
Settings *settings = new Settings();
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] );
composer.setMessage( rtext );
@@ -468,8 +462,9 @@ void ViewMail::slotReply()
{
m_recMail->Wrapper()->answeredMail(m_recMail);
}
+ delete settings;
}
-
+
void ViewMail::slotForward()
{
if (!m_gotBody)