summaryrefslogtreecommitdiffabout
path: root/kmicromail/composemail.cpp
Side-by-side diff
Diffstat (limited to 'kmicromail/composemail.cpp') (more/less context) (ignore whitespace changes)
-rw-r--r--kmicromail/composemail.cpp52
1 files changed, 26 insertions, 26 deletions
diff --git a/kmicromail/composemail.cpp b/kmicromail/composemail.cpp
index 5945b7f..2dcbc75 100644
--- a/kmicromail/composemail.cpp
+++ b/kmicromail/composemail.cpp
@@ -24,55 +24,55 @@
#include <libmailwrapper/mailtypes.h>
/* OPIE */
//#include <opie2/ofiledialog.h>
//#include <opie2/odebug.h>
#include <kfiledialog.h>
//#include <qpe/resource.h>
#include <qpe/global.h>
//#include <qpe/contact.h>
#include <qcombobox.h>
#include <qcheckbox.h>
#include <qiconset.h>
#include <qtimer.h>
#include <qmessagebox.h>
#include <qpushbutton.h>
#include <qmultilineedit.h>
#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" );
if ( whoami_uid.isEmpty() ) {
QMessageBox::information( 0, i18n( "Hint" ),
i18n( "Please apply\n\"Set Who Am I\"\nin KA/Pi to get the from\nfield automatically filled out!\n" ),
i18n( "Ok" ) );
fillSettings();
} else
ExternalAppHandler::instance()->requestDetailsFromKAPI("", "sendbacklist", whoami_uid);
#ifdef DESKTOP_VERSION
KABC::Addressee con = KABC::StdAddressBook::self()->whoAmI( );
QStringList mails = con.emails();
QString defmail = con.preferredEmail();
if ( mails.count() == 0)
QMessageBox::information( 0, i18n( "Hint" ),
i18n( "Please apply\n\"Set Who Am I\"\nin KA/Pi to get the from\nfield automatically filled out!\n" ),
@@ -144,61 +144,61 @@ ComposeMail::ComposeMail( Settings *s, QWidget *parent, const char *name, bool m
}
connect( smtpAccountBox, SIGNAL( activated(int) ), SLOT( fillValues(int) ) );
}
void ComposeMail::fillSettings()
{
if ( QApplication::desktop()->width() < 320 )
fromBox->setMaximumWidth( 100 );
QStringList mailList = QStringList::split(";",KOPrefs::instance()->mEmail);
QStringList::ConstIterator sit = mailList.begin();
int pref = 0;
for (;sit!=mailList.end();++sit) {
fromBox->insertItem((*sit));
}
senderNameEdit->setText(KOPrefs::instance()->mName);
}
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 );
/* only use the default drafts folder name! */
Storemail wrapper(AbstractMail::draftFolder());
wrapper.storeMail(mail);
AttachViewItem *it = (AttachViewItem *) attList->firstChild();
/* attachments we will ignore! */
if ( it != 0 ) {
if ( warnAttach )
QMessageBox::warning(0,i18n("Store message"),
i18n("<center>Attachments will not be stored in \"Draft\" folder</center>"));
warnAttach = false;
}
setStatus( i18n("Mail saved as draft!") );
}
void ComposeMail::clearStatus()
{
topLevelWidget()->setCaption( i18n("Compose mail") );
}
@@ -387,72 +387,72 @@ void ComposeMail::accept()
{
if ( smtpAccountBox->count() == 0 ) {
reject();
return;
}
if (! checkBoxLater->isChecked() ) {
int yesno = QMessageBox::warning(0,i18n("Stop editing message"),
i18n("Send this message?"),
i18n("Yes"),
i18n("Cancel"));
if (yesno == 1) {
return;
}
}
#if 0
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();
}
SMTPwrapper wrapper( smtp );
if ( wrapper.sendMail( mail,checkBoxLater->isChecked() ) )
setStatus( tr ("Mail sent"));
else {
setStatus( tr ("Error: Something went wrong. Nothing sent"));
return;
}
QDialog::accept();
}
void ComposeMail::reject()
{
//qDebug("ComposeMail::reject() ");
int yesno = QMessageBox::warning(0,i18n("Store message?"),
@@ -462,42 +462,42 @@ void ComposeMail::reject()
//qDebug("button %d ", yesno);
if (yesno == 0) {
if ( toLine->text().isEmpty() ) {
QMessageBox::warning(0,i18n("Sending mail"),
i18n("No Receiver spezified" ) );
return;
}
saveAsDraft();
}
if (yesno == 2) {
qDebug("return ");
return;
}
QDialog::reject();
}
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;
if ( !attachment->getPixmap().isNull() )
setPixmap( 0,attachment->getPixmap() );
setText( 0, att->getName().isEmpty() ? att->getFileName() : att->getName() );
setText( 1, QString::number( att->getSize() ) );
}