From 696a2dcfcb65fbb24b709bbae0a18a7854e2d72c Mon Sep 17 00:00:00 2001 From: alwin Date: Sun, 28 Dec 2003 17:32:43 +0000 Subject: reduced to the max... - from address isn't setup any longer within the smtp account (it makes realy no sense, a smtp account describes the connection to a smtp server, not the identity of the sender) - from address is taken from the personal info of the addressbook (thats why this info exists). Of course the user can change it when sending an email. - user can select a from with a selection of the mails given in their personal infos. - in addresspicker: use " " instead of "Filename" - settings ui: switched of the part within the smtp accounts describing the identitiy of user ToDo: a dialog setting up a default signature --- (limited to 'noncore/net/mail/composemail.cpp') diff --git a/noncore/net/mail/composemail.cpp b/noncore/net/mail/composemail.cpp index 73d1a43..13c7900 100644 --- a/noncore/net/mail/composemail.cpp +++ b/noncore/net/mail/composemail.cpp @@ -3,6 +3,8 @@ #include #include #include +#include +#include #include "composemail.h" #include "smtpwrapper.h" @@ -12,6 +14,26 @@ ComposeMail::ComposeMail( Settings *s, QWidget *parent, const char *name, bool m { settings = s; + QString vfilename = Global::applicationFileName("addressbook", + "businesscard.vcf"); + Contact c; + if (QFile::exists(vfilename)) { + c = Contact::readVCard( vfilename )[0]; + } + + QStringList mails = c.emailList(); + QString defmail = c.defaultEmail(); + + 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(c.firstName()+" "+c.lastName()); Config cfg( "mail" ); cfg.setGroup( "Compose" ); checkBoxLater->setChecked( cfg.readBoolEntry( "sendLater", false ) ); @@ -20,17 +42,18 @@ ComposeMail::ComposeMail( Settings *s, QWidget *parent, const char *name, bool m attList->addColumn( tr( "Size" ) ); QList accounts = settings->getAccounts(); + Account *it; for ( it = accounts.first(); it; it = accounts.next() ) { if ( it->getType().compare( "SMTP" ) == 0 ) { SMTPaccount *smtp = static_cast(it); - fromBox->insertItem( smtp->getMail() ); + smtpAccountBox->insertItem( smtp->getAccountName() ); smtpAccounts.append( smtp ); } } if ( smtpAccounts.count() > 0 ) { - fillValues( fromBox->currentItem() ); + fillValues( smtpAccountBox->currentItem() ); } else { QMessageBox::information( this, tr( "Problem" ), tr( "

Please create an SMTP account first.

" ), @@ -38,7 +61,7 @@ ComposeMail::ComposeMail( Settings *s, QWidget *parent, const char *name, bool m return; } - connect( fromBox, SIGNAL( activated( int ) ), SLOT( fillValues( int ) ) ); + 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() ) ); @@ -108,8 +131,8 @@ void ComposeMail::pickAddressReply() void ComposeMail::fillValues( int current ) { +#if 0 SMTPaccount *smtp = smtpAccounts.at( current ); - ccLine->clear(); if ( smtp->getUseCC() ) { ccLine->setText( smtp->getCC() ); @@ -122,8 +145,8 @@ void ComposeMail::fillValues( int current ) if ( smtp->getUseReply() ) { replyLine->setText( smtp->getReply() ); } - sigMultiLine->setText( smtp->getSignature() ); +#endif } void ComposeMail::slotAdjustColumns() @@ -163,14 +186,14 @@ void ComposeMail::accept() qDebug( "Send later" ); } - +#if 0 qDebug( "Sending Mail with " + - smtpAccounts.at( fromBox->currentItem() )->getAccountName() ); + smtpAccounts.at( smtpAccountBox->currentItem() )->getAccountName() ); +#endif Mail *mail = new Mail(); - SMTPaccount *smtp = smtpAccounts.at( fromBox->currentItem() ); - mail->setMail( smtp->getMail() ); - mail->setName( smtp->getName() ); + SMTPaccount *smtp = smtpAccounts.at( smtpAccountBox->currentItem() ); + mail->setMail(fromBox->currentText()); if ( !toLine->text().isEmpty() ) { mail->setTo( toLine->text() ); @@ -178,7 +201,7 @@ void ComposeMail::accept() qDebug( "No Reciever spezified -> returning" ); return; } - + mail->setName(senderNameEdit->text()); mail->setCC( ccLine->text() ); mail->setBCC( bccLine->text() ); mail->setReply( replyLine->text() ); @@ -188,6 +211,7 @@ void ComposeMail::accept() txt.append( "\n--\n" ); txt.append( sigMultiLine->text() ); } + qDebug(txt); mail->setMessage( txt ); AttachViewItem *it = (AttachViewItem *) attList->firstChild(); while ( it != NULL ) { @@ -196,8 +220,8 @@ void ComposeMail::accept() } SMTPwrapper wrapper( settings ); - wrapper.sendMail( *mail,checkBoxLater->isChecked() ); - + wrapper.sendMail( *mail,smtp,checkBoxLater->isChecked() ); + QDialog::accept(); } -- cgit v0.9.0.2