summaryrefslogtreecommitdiffabout
path: root/kmicromail/composemail.cpp
Side-by-side diff
Diffstat (limited to 'kmicromail/composemail.cpp') (more/less context) (show whitespace changes)
-rw-r--r--kmicromail/composemail.cpp24
1 files changed, 12 insertions, 12 deletions
diff --git a/kmicromail/composemail.cpp b/kmicromail/composemail.cpp
index ca4f247..c1b58a4 100644
--- a/kmicromail/composemail.cpp
+++ b/kmicromail/composemail.cpp
@@ -22,96 +22,96 @@
#include <qmessagebox.h>
#include <qpushbutton.h>
#include <qmultilineedit.h>
#include <qlabel.h>
#include <qtabwidget.h>
#include <qlistview.h>
#include <kabc/addresseedialog.h>
#include <kabc/stdaddressbook.h>
#include <kabc/addressee.h>
//using namespace Opie::Core;
//using namespace Opie::Ui;
ComposeMail::ComposeMail( Settings *s, QWidget *parent, const char *name, bool modal, WFlags flags )
: ComposeMailUI( parent, name, modal, flags )
{
settings = s;
m_replyid = "";
KABC::Addressee con = KABC::StdAddressBook::self()->whoAmI( );
QStringList mails = con.emails();
QString defmail = con.preferredEmail();
if ( mails.count() == 0)
- QMessageBox::information( parentWidget(), tr( "Hint" ),
- tr( "Please apply\n\"Set Who Am I\"\nin KA/Pi to get the from\nfield automatically filled out!" ),
+ QMessageBox::information( 0, tr( "Hint" ),
+ tr( "Please apply\n\"Set Who Am I\"\nin KA/Pi to get the from\nfield automatically filled out!\n" ),
tr( "Ok" ) );
if (defmail.length()!=0) {
fromBox->insertItem(defmail);
}
QStringList::ConstIterator sit = mails.begin();
for (;sit!=mails.end();++sit) {
if ( (*sit)==defmail)
continue;
fromBox->insertItem((*sit));
}
senderNameEdit->setText(con.formattedName());
Config cfg( "mail" );
cfg.setGroup( "Compose" );
checkBoxLater->setChecked( cfg.readBoolEntry( "sendLater", false ) );
attList->addColumn( tr( "Name" ) );
attList->addColumn( tr( "Size" ) );
QList<Account> accounts = settings->getAccounts();
Account *it;
for ( it = accounts.first(); it; it = accounts.next() ) {
if ( it->getType()==MAILLIB::A_SMTP ) {
SMTPaccount *smtp = static_cast<SMTPaccount *>(it);
smtpAccountBox->insertItem( smtp->getAccountName() );
smtpAccounts.append( smtp );
}
}
- if ( smtpAccounts.count() > 0 ) {
- fillValues( smtpAccountBox->currentItem() );
- } else {
- QMessageBox::information( parentWidget(), tr( "Problem" ),
- tr( "Please create an SMTP account first.\nThe SMTP is needed for sending mail." ),
- tr( "Ok" ) );
- return;
- }
connect( smtpAccountBox, SIGNAL( activated(int) ), SLOT( fillValues(int) ) );
connect( toButton, SIGNAL( clicked() ), SLOT( pickAddressTo() ) );
connect( ccButton, SIGNAL( clicked() ), SLOT( pickAddressCC() ) );
connect( bccButton, SIGNAL( clicked() ), SLOT( pickAddressBCC() ) );
connect( replyButton, SIGNAL( clicked() ), SLOT( pickAddressReply() ) );
connect( addButton, SIGNAL( clicked() ), SLOT( addAttachment() ) );
connect( deleteButton, SIGNAL( clicked() ), SLOT( removeAttachment() ) );
connect( SaveButton, SIGNAL( clicked() ), SLOT( saveAsDraft()) );
mMail = 0;
warnAttach = true;
+ if ( smtpAccounts.count() > 0 ) {
+ fillValues( smtpAccountBox->currentItem() );
+ } else {
+ QMessageBox::information( 0, tr( "Problem" ),
+ tr( "Please create an SMTP account first.\nThe SMTP is needed for sending mail.\n" ),
+ tr( "Ok" ) );
+ return;
+ }
}
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() );
if (!m_replyid.isEmpty()) {
QStringList ids;
ids.append(m_replyid);
mail->setInreply(ids);
}
QString txt = message->text();
if ( !sigMultiLine->text().isEmpty() ) {
txt.append( "\n--\n" );
txt.append( sigMultiLine->text() );
}
mail->setMessage( txt );
@@ -299,50 +299,50 @@ void ComposeMail::accept()
txt.append( sigMultiLine->text() );
}
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,tr("Stop editing message"),
- tr("Store message into drafts?"),
+ int yesno = QMessageBox::warning(0,tr("Store message?"),
+ tr("Store message into drafts?\n"),
tr("Yes"),
tr("No"));
//qDebug("button %d ", yesno);
if (yesno == 0) {
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(","));