summaryrefslogtreecommitdiffabout
path: root/kmicromail
Side-by-side diff
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
@@ -42,19 +42,19 @@
#include <qlabel.h>
#include <qtabwidget.h>
#include <qlistview.h>
//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") );
config.setGroup( "General" );
QString whoami_uid = config.readEntry( "WhoAmI" );
@@ -162,25 +162,25 @@ void ComposeMail::fillSettings()
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() );
}
mail->setMessage( txt );
@@ -405,36 +405,36 @@ void ComposeMail::accept()
odebug << "Sending Mail with "
<< smtpAccounts.at( smtpAccountBox->currentItem() )->getAccountName() << oendl;
#endif
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();
while ( it != 0 ) {
mail->addAttachment( it->getAttachment() );
it = (AttachViewItem *) it->nextSibling();
@@ -480,18 +480,18 @@ 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 )
: QListViewItem( 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
@@ -748,12 +748,13 @@ void IMAPwrapper::traverseBody(const RecMailP&mail,mailimap_body*body,RecBodyP&t
currentPart->setIdentifier(id);
fillSinglePart(currentPart,part1);
/* important: Check for is NULL 'cause a body can be empty!
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) {
target_body->addPart(currentPart);
}
} else {
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
@@ -19,12 +19,13 @@
Settings::Settings()
: QObject()
{
updateAccounts();
+ //qDebug("++++++++++++++++++new settings ");
}
void Settings::checkDirectory()
{
return;
locateLocal("data", "kopiemail" );
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
@@ -162,12 +162,13 @@ private:
class Settings : public QObject
{
Q_OBJECT
public:
Settings();
+ //~Settings(){qDebug("-------------------settings "); };
QList<Account> getAccounts();
void addAccount(Account *account);
void delAccount(Account *account);
void saveAccounts();
void readAccounts();
static void checkDirectory();
diff --git a/kmicromail/mailistviewitem.cpp b/kmicromail/mailistviewitem.cpp
index 484a635..5ef5b6a 100644
--- a/kmicromail/mailistviewitem.cpp
+++ b/kmicromail/mailistviewitem.cpp
@@ -52,14 +52,14 @@ void MailListViewItem::showEntry()
mKeyMap.insert(3, "k" + fsort);
//setText(3, "kB" + fsort ); // test only
} else {
//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();
int kom = date.find( ",")+2;
if ( kom == 1 )
kom = 0;
diff --git a/kmicromail/mainwindow.cpp b/kmicromail/mainwindow.cpp
index 4115276..98eb9a5 100644
--- a/kmicromail/mainwindow.cpp
+++ b/kmicromail/mainwindow.cpp
@@ -8,25 +8,29 @@
//#include <kdialog.h>
#include <kiconloader.h>
#include <kapplication.h>
#ifdef DESKTOP_VERSION
#include <qapplication.h>
+#include <qstatusbar.h>
+extern QStatusBar* globalSstatusBarMainWindow;
#else
#include <qpe/qpeapplication.h>
#endif
#include "defines.h"
#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();
toolBar = new QToolBar( this );
menuBar = new QPEMenuBar( toolBar );
mailMenu = new QPopupMenu( menuBar );
diff --git a/kmicromail/opiemail.cpp b/kmicromail/opiemail.cpp
index ca3faaf..fe9df87 100644
--- a/kmicromail/opiemail.cpp
+++ b/kmicromail/opiemail.cpp
@@ -37,12 +37,13 @@
OpieMail::OpieMail( QWidget *parent, const char *name )
: MainWindow( parent, name) //, WStyle_ContextHelp )
{
settings = new Settings();
+ setIcon(SmallIcon( "kmicromail" ) );
folderView->populate( settings->getAccounts() );
}
OpieMail::~OpieMail()
{
@@ -237,13 +238,56 @@ void OpieMail::slotEditAccounts()
eaDialog.exec();
if ( settings ) delete settings;
settings = new Settings();
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();
if (!item) return;
RecMailP mail = ((MailListViewItem*)item)->data();
RecBodyP body = folderView->fetchBody(mail);
@@ -337,12 +381,14 @@ void OpieMail::mailHold(int button, QListViewItem *item,const QPoint&,int )
m->insertItem(i18n("Copy all selected postings"),this,SLOT(slotMoveCopyAllMail()));
m->insertItem(i18n("Clear selection"),this,SLOT(clearSelection()));
} else {
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()));
m->insertSeparator();
m->insertItem(i18n("Move/Copy all selected mail"),this,SLOT(slotMoveCopyAllMail()));
m->insertItem(i18n("Delete all selected mails"),this,SLOT(slotDeleteAllMail()));
diff --git a/kmicromail/opiemail.h b/kmicromail/opiemail.h
index 9de95f8..44ab1ec 100644
--- a/kmicromail/opiemail.h
+++ b/kmicromail/opiemail.h
@@ -27,12 +27,13 @@ public slots:
protected slots:
virtual void slotSendQueued();
virtual void slotSearchMails();
virtual void slotEditSettings();
virtual void slotEditAccounts();
virtual void displayMail();
+ virtual void replyMail();
virtual void slotDeleteMail();
virtual void slotGetMail();
virtual void slotGetAllMail();
virtual void slotDeleteAllMail();
virtual void mailHold(int, QListViewItem *,const QPoint&,int);
virtual void slotShowFolders( bool show );
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,12 +1,14 @@
#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
@@ -20,14 +20,10 @@ class QDialog_hacked : public QDialog
#define QDialog QDialog_hacked
#endif
#else
-#warning ******************************************
-#warning ******************************************
-#warning ******************************************
-#warning ******************************************
#warning "/usr/local/qt/include/qdialog.h" for KDialog
#include "/usr/local/qt/include/qdialog.h"
#endif
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
@@ -6,17 +6,13 @@
#ifdef QDialog
#undef QDialog
#endif
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 );
QHBox * hb = new QHBox ( this );
QPushButton *ok = new QPushButton( i18n("OK"), hb );
QPushButton *cancel = new QPushButton( i18n("Cancel"), hb );
diff --git a/kmicromail/viewmail.cpp b/kmicromail/viewmail.cpp
index f1e0225..2093678 100644
--- a/kmicromail/viewmail.cpp
+++ b/kmicromail/viewmail.cpp
@@ -95,13 +95,14 @@ AttachItem* ViewMail::lastChild(AttachItem*parent)
}
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)
{
return;
}
@@ -297,16 +298,16 @@ void ViewMail::slotItemClicked( QListViewItem * item , const QPoint & point, int
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();
m_mail2[2] = mail->Bcc();
setText();
@@ -345,24 +346,17 @@ void ViewMail::setText()
{
QString toString;
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] ) );
m_mailHtml = "<html><body>"
"<table width=\"100%\" border=\"0\"><tr bgcolor=\"#FFDD76\"><td>"
"<div align=left><b>" + deHtml( m_mail[1] ) + "</b></div>"
@@ -453,26 +447,27 @@ void ViewMail::slotReply()
if ( m_mail[1].find(QRegExp("^Re: .*$")) != -1) prefix = "";
else prefix = "Re: "; // no i18n on purpose
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 );
composer.setInReplyTo(m_recMail->Msgid());
if ( QDialog::Accepted == KApplication::execDialog( &composer ) )
{
m_recMail->Wrapper()->answeredMail(m_recMail);
}
+ delete settings;
}
-
+
void ViewMail::slotForward()
{
if (!m_gotBody)
{
QMessageBox::information(this, i18n("Error"), i18n("<p>The mail body is not yet downloaded, so you cannot forward yet."), i18n("Ok"));
return;