summaryrefslogtreecommitdiffabout
path: root/kmicromail/opiemail.cpp
Side-by-side diff
Diffstat (limited to 'kmicromail/opiemail.cpp') (more/less context) (ignore whitespace changes)
-rw-r--r--kmicromail/opiemail.cpp8
1 files changed, 3 insertions, 5 deletions
diff --git a/kmicromail/opiemail.cpp b/kmicromail/opiemail.cpp
index 197f7ec..b701446 100644
--- a/kmicromail/opiemail.cpp
+++ b/kmicromail/opiemail.cpp
@@ -112,209 +112,207 @@ void OpieMail::message(const QCString &msg, const QByteArray &data)
//qDebug("END OpieMail::message ");
}
void OpieMail::slotExtAppHandler()
{
ExternalAppHandler::instance()->appMessage ( mPendingMessage, mPendingData );
}
void OpieMail::slotwriteMail2(const QString& namemail )
{
//qDebug("OpieMail::slotwriteMail2 ");
//qApp->processEvents();
ComposeMail compose( settings, this, 0, true );
if ( !namemail.isEmpty() ) {
QString to = namemail;
if ( namemail.find( " <") > 1 ) {
to = "\"" +to.replace( QRegExp( " <"), "\" <") ;
} else
if ( namemail.find( "<") > 1 ) {
to = "\"" +to.replace( QRegExp( "<"), "\" <") ;
}
int sub = to.find( ">:");
if ( sub > 0 ) {
compose.setTo( to.left(sub+1) );
compose.setSubject( to.mid(sub+2) );
} else
compose.setTo( to );
}
compose.slotAdjustColumns();
#ifndef DESKTOP_VERSION
compose.showMaximized();
#endif
mCurrentComposer = &compose;
compose.exec();
mCurrentComposer = 0;
folderView->refreshOutgoing();
raise();
//qDebug("retttich ");
}
void OpieMail::slotwriteMail(const QString&name,const QString&email)
{
// qDebug("OpieMail::slotwriteMail ");
ComposeMail compose( settings, this, 0, true );
if (!email.isEmpty())
{
if (!name.isEmpty())
{
compose.setTo("\"" + name + "\"" + " " + "<"+ email + ">");
}
else
{
compose.setTo(email);
}
}
compose.slotAdjustColumns();
#ifndef DESKTOP_VERSION
compose.showMaximized();
#endif
mCurrentComposer = &compose;
compose.exec();
mCurrentComposer = 0;
folderView->refreshOutgoing();
raise();
}
void OpieMail::slotComposeMail()
{
if ( mPendingEmail == QString::null && mPendingName == QString::null)
slotwriteMail2( QString () );
else {
if ( mPendingEmail == QString::null )
slotwriteMail2( mPendingName );
else
slotwriteMail( mPendingName, mPendingEmail );
}
//slotwriteMail(0l,0l);
}
void OpieMail::slotSendQueued()
{
SMTPaccount *smtp = 0;
QList<Account> list = settings->getAccounts();
QList<SMTPaccount> smtpList;
smtpList.setAutoDelete(false);
Account *it;
for ( it = list.first(); it; it = list.next() )
{
if ( it->getType() == MAILLIB::A_SMTP )
{
smtp = static_cast<SMTPaccount *>(it);
smtpList.append(smtp);
}
}
if (smtpList.count()==0)
{
- QMessageBox::information(0,i18n("Info"),i18n("Define a smtp account first!\n"));
+ QMessageBox::information(0,i18n("Info"),i18n("Define a smtp\n account first!\n"));
return;
}
- if ( QMessageBox::warning(this, i18n("Sending all mails"), i18n("Do you really want to send\nall queued mails?" ) , QMessageBox::Yes, QMessageBox::No ) == QMessageBox::No )
+ if ( QMessageBox::warning(this, i18n("Sending all mails"), i18n("Do you really want to\nsend all queued mails?" ) , QMessageBox::Yes, QMessageBox::No ) == QMessageBox::No )
return;
if (smtpList.count()==1)
{
smtp = smtpList.at(0);
}
else
{
smtp = 0;
selectsmtp selsmtp;
selsmtp.setSelectionlist(&smtpList);
-#ifndef DESKTOP_VERSION
- selsmtp.showMaximized();
-#endif
+ selsmtp.resize( selsmtp.sizeHint() );
if ( selsmtp.exec() == QDialog::Accepted )
{
smtp = selsmtp.selected_smtp();
}
}
if (smtp)
{
Global::statusMessage("Sending mails...!");
SMTPwrapper * wrap = new SMTPwrapper(smtp);
if ( wrap->flushOutbox() )
{
Global::statusMessage("Mails sent!");
}
delete wrap;
}
folderView->refreshOutgoing();
}
void OpieMail::slotSearchMails()
{
qDebug("OpieMail::slotSearchMails():not implemented ");
}
void OpieMail::slotEditSettings()
{
KOPrefsDialog settingsDialog( this, "koprefs", true );
#ifndef DESKTOP_VERSION
settingsDialog.showMaximized();
#endif
settingsDialog.exec();
slotSetCodec( KOPrefs::instance()->mCurrentCodec );
// KApplication::execDialog(settingsDialog);
}
void OpieMail::slotEditAccounts()
{
EditAccounts eaDialog( settings, this, 0, true );
eaDialog.slotAdjustColumns();
#ifndef DESKTOP_VERSION
eaDialog.showMaximized();
#endif
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( mail->getFrom())
.arg( mail->getDate());
QString text = body->Bodytext();
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( mail->getFrom());
} else {
composer.setTo( mail->Replyto());
}
composer.setSubject( prefix + mail->getSubject());
composer.setMessage( rtext );
composer.setInReplyTo( mail->Msgid());
composer.setCharset( body->getCharset() );
mCurrentComposer = &composer;
if ( QDialog::Accepted == KApplication::execDialog( &composer ) )
{
mail->Wrapper()->answeredMail(mail);
}
mCurrentComposer = 0;
folderView->refreshOutgoing();
delete settings;