author | alwin <alwin> | 2003-12-28 17:32:43 (UTC) |
---|---|---|
committer | alwin <alwin> | 2003-12-28 17:32:43 (UTC) |
commit | 696a2dcfcb65fbb24b709bbae0a18a7854e2d72c (patch) (side-by-side diff) | |
tree | e813c9508881796cf999e9c25c05e4482c6fd9e8 | |
parent | b900cad9c050c2d5963228a2191e13053457ef1d (diff) | |
download | opie-696a2dcfcb65fbb24b709bbae0a18a7854e2d72c.zip opie-696a2dcfcb65fbb24b709bbae0a18a7854e2d72c.tar.gz opie-696a2dcfcb65fbb24b709bbae0a18a7854e2d72c.tar.bz2 |
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 "<Firstname> <Lastname>" 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
-rw-r--r-- | noncore/net/mail/addresspicker.cpp | 2 | ||||
-rw-r--r-- | noncore/net/mail/composemail.cpp | 50 | ||||
-rw-r--r-- | noncore/net/mail/composemailui.ui | 268 | ||||
-rw-r--r-- | noncore/net/mail/editaccounts.cpp | 23 | ||||
-rw-r--r-- | noncore/net/mail/libmailwrapper/settings.cpp | 25 | ||||
-rw-r--r-- | noncore/net/mail/libmailwrapper/settings.h | 20 | ||||
-rw-r--r-- | noncore/net/mail/libmailwrapper/smtpwrapper.cpp | 54 | ||||
-rw-r--r-- | noncore/net/mail/libmailwrapper/smtpwrapper.h | 3 | ||||
-rw-r--r-- | noncore/net/mail/settings.cpp | 25 | ||||
-rw-r--r-- | noncore/net/mail/settings.h | 20 | ||||
-rw-r--r-- | noncore/net/mail/smtpconfigui.ui | 637 | ||||
-rw-r--r-- | noncore/net/mail/smtpwrapper.cpp | 54 | ||||
-rw-r--r-- | noncore/net/mail/smtpwrapper.h | 3 |
13 files changed, 482 insertions, 702 deletions
diff --git a/noncore/net/mail/addresspicker.cpp b/noncore/net/mail/addresspicker.cpp index 581de62..7857870 100644 --- a/noncore/net/mail/addresspicker.cpp +++ b/noncore/net/mail/addresspicker.cpp @@ -34,5 +34,5 @@ AddressPicker::AddressPicker( QWidget *parent, const char *name, bool modal, WFl mails = (*it).emailList(); if ((*it).fileAs().length()>0) { - pre = "\""+(*it).fileAs()+"\" <"; + pre = "\""+(*it).firstName()+" "+(*it).lastName()+"\" <"; suf = ">"; } else { 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 @@ -4,4 +4,6 @@ #include <qpe/resource.h> #include <qpe/config.h> +#include <qpe/global.h> +#include <qpe/contact.h> #include "composemail.h" @@ -13,4 +15,24 @@ 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" ); @@ -21,9 +43,10 @@ ComposeMail::ComposeMail( Settings *s, QWidget *parent, const char *name, bool m QList<Account> accounts = settings->getAccounts(); + Account *it; for ( it = accounts.first(); it; it = accounts.next() ) { if ( it->getType().compare( "SMTP" ) == 0 ) { SMTPaccount *smtp = static_cast<SMTPaccount *>(it); - fromBox->insertItem( smtp->getMail() ); + smtpAccountBox->insertItem( smtp->getAccountName() ); smtpAccounts.append( smtp ); } @@ -31,5 +54,5 @@ ComposeMail::ComposeMail( Settings *s, QWidget *parent, const char *name, bool m if ( smtpAccounts.count() > 0 ) { - fillValues( fromBox->currentItem() ); + fillValues( smtpAccountBox->currentItem() ); } else { QMessageBox::information( this, tr( "Problem" ), @@ -39,5 +62,5 @@ ComposeMail::ComposeMail( Settings *s, QWidget *parent, const char *name, bool m } - 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() ) ); @@ -109,6 +132,6 @@ void ComposeMail::pickAddressReply() void ComposeMail::fillValues( int current ) { +#if 0 SMTPaccount *smtp = smtpAccounts.at( current ); - ccLine->clear(); if ( smtp->getUseCC() ) { @@ -123,6 +146,6 @@ void ComposeMail::fillValues( int current ) replyLine->setText( smtp->getReply() ); } - sigMultiLine->setText( smtp->getSignature() ); +#endif } @@ -164,12 +187,12 @@ void ComposeMail::accept() } - +#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() ) { @@ -179,5 +202,5 @@ void ComposeMail::accept() return; } - + mail->setName(senderNameEdit->text()); mail->setCC( ccLine->text() ); mail->setBCC( bccLine->text() ); @@ -189,4 +212,5 @@ void ComposeMail::accept() txt.append( sigMultiLine->text() ); } + qDebug(txt); mail->setMessage( txt ); AttachViewItem *it = (AttachViewItem *) attList->firstChild(); @@ -197,6 +221,6 @@ void ComposeMail::accept() SMTPwrapper wrapper( settings ); - wrapper.sendMail( *mail,checkBoxLater->isChecked() ); - + wrapper.sendMail( *mail,smtp,checkBoxLater->isChecked() ); + QDialog::accept(); } diff --git a/noncore/net/mail/composemailui.ui b/noncore/net/mail/composemailui.ui index 4d225e4..aebdf67 100644 --- a/noncore/net/mail/composemailui.ui +++ b/noncore/net/mail/composemailui.ui @@ -12,5 +12,5 @@ <x>0</x> <y>0</y> - <width>260</width> + <width>252</width> <height>360</height> </rect> @@ -29,20 +29,65 @@ <property stdset="1"> <name>margin</name> - <number>3</number> + <number>1</number> </property> <property stdset="1"> <name>spacing</name> - <number>3</number> + <number>1</number> </property> <widget> - <class>QCheckBox</class> + <class>QLayoutWidget</class> <property stdset="1"> <name>name</name> - <cstring>checkBoxLater</cstring> + <cstring>Layout4</cstring> </property> - <property stdset="1"> - <name>text</name> - <string>send later</string> + <property> + <name>layoutSpacing</name> </property> + <grid> + <property stdset="1"> + <name>margin</name> + <number>0</number> + </property> + <property stdset="1"> + <name>spacing</name> + <number>3</number> + </property> + <widget row="0" column="0" > + <class>QCheckBox</class> + <property stdset="1"> + <name>name</name> + <cstring>checkBoxLater</cstring> + </property> + <property stdset="1"> + <name>text</name> + <string>send later</string> + </property> + </widget> + <widget row="0" column="1" > + <class>QLabel</class> + <property stdset="1"> + <name>name</name> + <cstring>accountLabel</cstring> + </property> + <property stdset="1"> + <name>text</name> + <string>use:</string> + </property> + </widget> + <widget row="0" column="2" > + <class>QComboBox</class> + <property stdset="1"> + <name>name</name> + <cstring>smtpAccountBox</cstring> + </property> + <property stdset="1"> + <name>sizePolicy</name> + <sizepolicy> + <hsizetype>3</hsizetype> + <vsizetype>0</vsizetype> + </sizepolicy> + </property> + </widget> + </grid> </widget> <widget> @@ -68,21 +113,165 @@ <string>Mail</string> </attribute> - <grid> + <vbox> <property stdset="1"> <name>margin</name> - <number>-1</number> + <number>1</number> </property> <property stdset="1"> <name>spacing</name> - <number>-1</number> + <number>1</number> </property> - <widget row="2" column="1" > - <class>QLineEdit</class> + <widget> + <class>QLayoutWidget</class> <property stdset="1"> <name>name</name> - <cstring>subjectLine</cstring> + <cstring>Layout10</cstring> </property> + <property> + <name>layoutSpacing</name> + </property> + <grid> + <property stdset="1"> + <name>margin</name> + <number>0</number> + </property> + <property stdset="1"> + <name>spacing</name> + <number>1</number> + </property> + <widget row="0" column="1" > + <class>QLayoutWidget</class> + <property stdset="1"> + <name>name</name> + <cstring>Layout9</cstring> + </property> + <property> + <name>layoutSpacing</name> + </property> + <grid> + <property stdset="1"> + <name>margin</name> + <number>0</number> + </property> + <property stdset="1"> + <name>spacing</name> + <number>3</number> + </property> + <widget row="0" column="1" > + <class>QComboBox</class> + <property stdset="1"> + <name>name</name> + <cstring>fromBox</cstring> + </property> + <property stdset="1"> + <name>sizePolicy</name> + <sizepolicy> + <hsizetype>3</hsizetype> + <vsizetype>0</vsizetype> + </sizepolicy> + </property> + <property stdset="1"> + <name>editable</name> + <bool>true</bool> + </property> + <property stdset="1"> + <name>duplicatesEnabled</name> + <bool>false</bool> + </property> + </widget> + <widget row="0" column="0" > + <class>QLineEdit</class> + <property stdset="1"> + <name>name</name> + <cstring>senderNameEdit</cstring> + </property> + <property stdset="1"> + <name>sizePolicy</name> + <sizepolicy> + <hsizetype>0</hsizetype> + <vsizetype>0</vsizetype> + </sizepolicy> + </property> + <property stdset="1"> + <name>minimumSize</name> + <size> + <width>70</width> + <height>0</height> + </size> + </property> + <property stdset="1"> + <name>maximumSize</name> + <size> + <width>70</width> + <height>32767</height> + </size> + </property> + </widget> + </grid> + </widget> + <widget row="2" column="1" > + <class>QLineEdit</class> + <property stdset="1"> + <name>name</name> + <cstring>subjectLine</cstring> + </property> + <property stdset="1"> + <name>sizePolicy</name> + <sizepolicy> + <hsizetype>3</hsizetype> + <vsizetype>0</vsizetype> + </sizepolicy> + </property> + </widget> + <widget row="1" column="1" > + <class>QLineEdit</class> + <property stdset="1"> + <name>name</name> + <cstring>toLine</cstring> + </property> + <property stdset="1"> + <name>sizePolicy</name> + <sizepolicy> + <hsizetype>3</hsizetype> + <vsizetype>0</vsizetype> + </sizepolicy> + </property> + </widget> + <widget row="2" column="0" > + <class>QLabel</class> + <property stdset="1"> + <name>name</name> + <cstring>subjectLabel</cstring> + </property> + <property stdset="1"> + <name>text</name> + <string>Subject</string> + </property> + </widget> + <widget row="0" column="0" > + <class>QLabel</class> + <property stdset="1"> + <name>name</name> + <cstring>fromLabel</cstring> + </property> + <property stdset="1"> + <name>text</name> + <string>From</string> + </property> + </widget> + <widget row="1" column="0" > + <class>QPushButton</class> + <property stdset="1"> + <name>name</name> + <cstring>toButton</cstring> + </property> + <property stdset="1"> + <name>text</name> + <string>To</string> + </property> + </widget> + </grid> </widget> - <widget row="3" column="0" rowspan="1" colspan="2" > + <widget> <class>QMultiLineEdit</class> <property stdset="1"> @@ -91,52 +280,5 @@ </property> </widget> - <widget row="2" column="0" > - <class>QLabel</class> - <property stdset="1"> - <name>name</name> - <cstring>subjectLabel</cstring> - </property> - <property stdset="1"> - <name>text</name> - <string>Subject</string> - </property> - </widget> - <widget row="0" column="0" > - <class>QLabel</class> - <property stdset="1"> - <name>name</name> - <cstring>fromLabel</cstring> - </property> - <property stdset="1"> - <name>text</name> - <string>From</string> - </property> - </widget> - <widget row="1" column="1" > - <class>QLineEdit</class> - <property stdset="1"> - <name>name</name> - <cstring>toLine</cstring> - </property> - </widget> - <widget row="0" column="1" > - <class>QComboBox</class> - <property stdset="1"> - <name>name</name> - <cstring>fromBox</cstring> - </property> - </widget> - <widget row="1" column="0" > - <class>QPushButton</class> - <property stdset="1"> - <name>name</name> - <cstring>toButton</cstring> - </property> - <property stdset="1"> - <name>text</name> - <string>To</string> - </property> - </widget> - </grid> + </vbox> </widget> <widget> diff --git a/noncore/net/mail/editaccounts.cpp b/noncore/net/mail/editaccounts.cpp index 1246037..de36e0d 100644 --- a/noncore/net/mail/editaccounts.cpp +++ b/noncore/net/mail/editaccounts.cpp @@ -356,7 +356,4 @@ SMTPconfig::SMTPconfig( SMTPaccount *account, QWidget *parent, const char *name, data = account; - connect( ccBox, SIGNAL( toggled( bool ) ), ccLine, SLOT( setEnabled( bool ) ) ); - connect( bccBox, SIGNAL( toggled( bool ) ), bccLine, SLOT( setEnabled( bool ) ) ); - connect( replyBox, SIGNAL( toggled( bool ) ), replyLine, SLOT( setEnabled( bool ) ) ); connect( loginBox, SIGNAL( toggled( bool ) ), userLine, SLOT( setEnabled( bool ) ) ); connect( loginBox, SIGNAL( toggled( bool ) ), passLine, SLOT( setEnabled( bool ) ) ); @@ -385,14 +382,4 @@ void SMTPconfig::fillValues() userLine->setText( data->getUser() ); passLine->setText( data->getPassword() ); - nameLine->setText( data->getName() ); - mailLine->setText( data->getMail() ); - orgLine->setText( data->getOrg() ); - ccBox->setChecked( data->getUseCC() ); - ccLine->setText( data->getCC() ); - bccBox->setChecked( data->getUseBCC() ); - bccLine->setText( data->getBCC() ); - replyBox->setChecked( data->getUseReply() ); - replyLine->setText( data->getReply() ); - sigMultiLine->setText( data->getSignature() ); } @@ -406,14 +393,4 @@ void SMTPconfig::accept() data->setUser( userLine->text() ); data->setPassword( passLine->text() ); - data->setName( nameLine->text() ); - data->setMail( mailLine->text() ); - data->setOrg( orgLine->text() ); - data->setCC( ccLine->text() ); - data->setUseCC( ccBox->isChecked() ); - data->setBCC( bccLine->text() ); - data->setUseBCC( bccBox->isChecked() ); - data->setReply( replyLine->text() ); - data->setUseReply( replyBox->isChecked() ); - data->setSignature( sigMultiLine->text() ); QDialog::accept(); diff --git a/noncore/net/mail/libmailwrapper/settings.cpp b/noncore/net/mail/libmailwrapper/settings.cpp index b580954..17aa1b0 100644 --- a/noncore/net/mail/libmailwrapper/settings.cpp +++ b/noncore/net/mail/libmailwrapper/settings.cpp @@ -274,7 +274,4 @@ SMTPaccount::SMTPaccount( QString filename ) ssl = false; login = false; - useCC = false; - useBCC = false; - useReply = false; type = "SMTP"; port = SMTP_PORT; @@ -307,15 +304,4 @@ void SMTPaccount::read() user = conf->readEntry( "User" ); password = conf->readEntryCrypt( "Password" ); - useCC = conf->readBoolEntry( "useCC" ); - useBCC = conf->readBoolEntry( "useBCC" ); - useReply = conf->readBoolEntry( "useReply" ); - name = conf->readEntry( "Name" ); - mail = conf->readEntry( "Mail" ); - org = conf->readEntry( "Org" ); - cc = conf->readEntry( "CC" ); - bcc = conf->readEntry( "BCC" ); - reply = conf->readEntry( "Reply" ); - signature = conf->readEntry( "Signature" ); - signature = signature.replace( QRegExp( "<br>" ), "\n" ); } @@ -334,15 +320,4 @@ void SMTPaccount::save() conf->writeEntry( "User", user ); conf->writeEntryCrypt( "Password", password ); - conf->writeEntry( "useCC", useCC ); - conf->writeEntry( "useBCC", useBCC ); - conf->writeEntry( "useReply", useReply ); - conf->writeEntry( "Name", name ); - conf->writeEntry( "Mail", mail ); - conf->writeEntry( "Org", org ); - conf->writeEntry( "CC", cc ); - conf->writeEntry( "BCC", bcc ); - conf->writeEntry( "Reply", reply ); - conf->writeEntry( "Signature", - signature.replace( QRegExp( "\\n" ), "<br>" ) ); conf->write(); } diff --git a/noncore/net/mail/libmailwrapper/settings.h b/noncore/net/mail/libmailwrapper/settings.h index 22184a5..caa5dfc 100644 --- a/noncore/net/mail/libmailwrapper/settings.h +++ b/noncore/net/mail/libmailwrapper/settings.h @@ -94,24 +94,4 @@ public: virtual QString getFileName(); - void setName( QString str ) { name = str; } - QString getName() { return name; } - void setMail( QString str ) { mail = str; } - QString getMail() { return mail; } - void setOrg( QString str ) { org = str; } - QString getOrg() { return org; } - void setUseCC( bool b ) { useCC = b; } - bool getUseCC() { return useCC; } - void setCC( QString str ) { cc = str; } - QString getCC() { return cc; } - void setUseBCC( bool b ) { useBCC = b; } - bool getUseBCC() { return useBCC; } - void setBCC( QString str ) { bcc = str; } - QString getBCC() { return bcc; } - void setUseReply( bool b ) { useReply = b; } - bool getUseReply() { return useReply; } - void setReply( QString str ) { reply = str; } - QString getReply() { return reply; } - void setSignature( QString str ) { signature = str; } - QString getSignature() { return signature; } void setLogin( bool b ) { login = b; } bool getLogin() { return login; } diff --git a/noncore/net/mail/libmailwrapper/smtpwrapper.cpp b/noncore/net/mail/libmailwrapper/smtpwrapper.cpp index 521cd0a..30c0707 100644 --- a/noncore/net/mail/libmailwrapper/smtpwrapper.cpp +++ b/noncore/net/mail/libmailwrapper/smtpwrapper.cpp @@ -129,7 +129,7 @@ mailimf_fields *SMTPwrapper::createImfFields(const Mail&mail ) mailimf_fields *fields; mailimf_field *xmailer; - mailimf_mailbox *sender, *fromBox; - mailimf_mailbox_list *from; - mailimf_address_list *to, *cc, *bcc, *reply; + mailimf_mailbox *sender=0,*fromBox=0; + mailimf_mailbox_list *from=0; + mailimf_address_list *to=0, *cc=0, *bcc=0, *reply=0; char *subject = strdup( mail.getSubject().latin1() ); int err; @@ -168,20 +168,20 @@ mailimf_fields *SMTPwrapper::createImfFields(const Mail&mail ) err_free_xmailer: - mailimf_field_free( xmailer ); + if (xmailer) mailimf_field_free( xmailer ); err_free_fields: - mailimf_fields_free( fields ); + if (fields) mailimf_fields_free( fields ); err_free_reply: - mailimf_address_list_free( reply ); - mailimf_address_list_free( bcc ); - mailimf_address_list_free( cc ); - mailimf_address_list_free( to ); + if (reply) mailimf_address_list_free( reply ); + if (bcc) mailimf_address_list_free( bcc ); + if (cc) mailimf_address_list_free( cc ); + if (to) mailimf_address_list_free( to ); err_free_from: - mailimf_mailbox_list_free( from ); + if (from) mailimf_mailbox_list_free( from ); err_free_fromBox: mailimf_mailbox_free( fromBox ); err_free_sender: - mailimf_mailbox_free( sender ); + if (sender) mailimf_mailbox_free( sender ); err_free: - free( subject ); + if (subject) free( subject ); qDebug( "createImfFields - error" ); @@ -207,5 +207,5 @@ mailmime *SMTPwrapper::buildTxtPart(const QString&str ) if ( err != MAILIMF_NO_ERROR ) goto err_free_content; - fields = mailmime_fields_new_encoding(MAILMIME_MECHANISM_QUOTED_PRINTABLE); + fields = mailmime_fields_new_encoding(MAILMIME_MECHANISM_8BIT); if ( fields == NULL ) goto err_free_content; @@ -463,24 +463,4 @@ char *SMTPwrapper::getFrom( mailmime *mail ) } -SMTPaccount *SMTPwrapper::getAccount(const QString&name ) -{ - SMTPaccount *smtp; - - QList<Account> list = settings->getAccounts(); - Account *it; - for ( it = list.first(); it; it = list.next() ) { - if ( it->getType().compare( "SMTP" ) == 0 ) { - smtp = static_cast<SMTPaccount *>(it); - if ( smtp->getName()== name ) { - qDebug( "SMTPaccount found for" ); - qDebug( name ); - return smtp; - } - } - } - - return NULL; -} - void SMTPwrapper::progress( size_t current, size_t maximum ) { @@ -614,10 +594,14 @@ free_mem: } -void SMTPwrapper::sendMail(const Mail&mail,bool later ) +void SMTPwrapper::sendMail(const Mail&mail,SMTPaccount*aSmtp,bool later ) { mailmime * mimeMail; - SMTPaccount *smtp = getAccount(mail.getName()); + SMTPaccount *smtp = aSmtp; + if (!later && !smtp) { + qDebug("Didn't get any send method - giving up"); + return; + } mimeMail = createMimeMail(mail ); if ( mimeMail == NULL ) { diff --git a/noncore/net/mail/libmailwrapper/smtpwrapper.h b/noncore/net/mail/libmailwrapper/smtpwrapper.h index f734fa4..0535983 100644 --- a/noncore/net/mail/libmailwrapper/smtpwrapper.h +++ b/noncore/net/mail/libmailwrapper/smtpwrapper.h @@ -28,5 +28,5 @@ public: SMTPwrapper( Settings *s ); virtual ~SMTPwrapper(){} - void sendMail(const Mail& mail,bool later=false ); + void sendMail(const Mail& mail,SMTPaccount*smtp,bool later=false ); bool flushOutbox(SMTPaccount*smtp); @@ -43,5 +43,4 @@ protected: void smtpSend( mailmime *mail,bool later, SMTPaccount *smtp ); clist *createRcptList( mailimf_fields *fields ); - SMTPaccount *getAccount(const QString&from ); static void storeMail(char*mail, size_t length, const QString&box); diff --git a/noncore/net/mail/settings.cpp b/noncore/net/mail/settings.cpp index b580954..17aa1b0 100644 --- a/noncore/net/mail/settings.cpp +++ b/noncore/net/mail/settings.cpp @@ -274,7 +274,4 @@ SMTPaccount::SMTPaccount( QString filename ) ssl = false; login = false; - useCC = false; - useBCC = false; - useReply = false; type = "SMTP"; port = SMTP_PORT; @@ -307,15 +304,4 @@ void SMTPaccount::read() user = conf->readEntry( "User" ); password = conf->readEntryCrypt( "Password" ); - useCC = conf->readBoolEntry( "useCC" ); - useBCC = conf->readBoolEntry( "useBCC" ); - useReply = conf->readBoolEntry( "useReply" ); - name = conf->readEntry( "Name" ); - mail = conf->readEntry( "Mail" ); - org = conf->readEntry( "Org" ); - cc = conf->readEntry( "CC" ); - bcc = conf->readEntry( "BCC" ); - reply = conf->readEntry( "Reply" ); - signature = conf->readEntry( "Signature" ); - signature = signature.replace( QRegExp( "<br>" ), "\n" ); } @@ -334,15 +320,4 @@ void SMTPaccount::save() conf->writeEntry( "User", user ); conf->writeEntryCrypt( "Password", password ); - conf->writeEntry( "useCC", useCC ); - conf->writeEntry( "useBCC", useBCC ); - conf->writeEntry( "useReply", useReply ); - conf->writeEntry( "Name", name ); - conf->writeEntry( "Mail", mail ); - conf->writeEntry( "Org", org ); - conf->writeEntry( "CC", cc ); - conf->writeEntry( "BCC", bcc ); - conf->writeEntry( "Reply", reply ); - conf->writeEntry( "Signature", - signature.replace( QRegExp( "\\n" ), "<br>" ) ); conf->write(); } diff --git a/noncore/net/mail/settings.h b/noncore/net/mail/settings.h index 22184a5..caa5dfc 100644 --- a/noncore/net/mail/settings.h +++ b/noncore/net/mail/settings.h @@ -94,24 +94,4 @@ public: virtual QString getFileName(); - void setName( QString str ) { name = str; } - QString getName() { return name; } - void setMail( QString str ) { mail = str; } - QString getMail() { return mail; } - void setOrg( QString str ) { org = str; } - QString getOrg() { return org; } - void setUseCC( bool b ) { useCC = b; } - bool getUseCC() { return useCC; } - void setCC( QString str ) { cc = str; } - QString getCC() { return cc; } - void setUseBCC( bool b ) { useBCC = b; } - bool getUseBCC() { return useBCC; } - void setBCC( QString str ) { bcc = str; } - QString getBCC() { return bcc; } - void setUseReply( bool b ) { useReply = b; } - bool getUseReply() { return useReply; } - void setReply( QString str ) { reply = str; } - QString getReply() { return reply; } - void setSignature( QString str ) { signature = str; } - QString getSignature() { return signature; } void setLogin( bool b ) { login = b; } bool getLogin() { return login; } diff --git a/noncore/net/mail/smtpconfigui.ui b/noncore/net/mail/smtpconfigui.ui index 2cae8d6..f5ce8cb 100644 --- a/noncore/net/mail/smtpconfigui.ui +++ b/noncore/net/mail/smtpconfigui.ui @@ -12,6 +12,6 @@ <x>0</x> <y>0</y> - <width>253</width> - <height>342</height> + <width>241</width> + <height>321</height> </rect> </property> @@ -29,451 +29,223 @@ <property stdset="1"> <name>margin</name> - <number>0</number> + <number>2</number> </property> <property stdset="1"> <name>spacing</name> - <number>0</number> + <number>2</number> </property> <widget> - <class>QTabWidget</class> + <class>QLayoutWidget</class> <property stdset="1"> <name>name</name> - <cstring>smtpTab</cstring> - </property> - <property stdset="1"> - <name>caption</name> - <string></string> - </property> - <property> - <name>layoutMargin</name> + <cstring>Layout4</cstring> </property> <property> <name>layoutSpacing</name> </property> - <widget> - <class>QWidget</class> + <grid> <property stdset="1"> - <name>name</name> - <cstring>serverTab</cstring> + <name>margin</name> + <number>0</number> </property> - <attribute> - <name>title</name> - <string>Server</string> - </attribute> - <grid> + <property stdset="1"> + <name>spacing</name> + <number>2</number> + </property> + <widget row="0" column="0" rowspan="1" colspan="2" > + <class>QLabel</class> <property stdset="1"> - <name>margin</name> - <number>4</number> + <name>name</name> + <cstring>accountLabel</cstring> </property> <property stdset="1"> - <name>spacing</name> - <number>3</number> + <name>text</name> + <string>Account</string> + </property> + </widget> + <widget row="8" column="2" > + <class>QLineEdit</class> + <property stdset="1"> + <name>name</name> + <cstring>passLine</cstring> + </property> + <property stdset="1"> + <name>enabled</name> + <bool>false</bool> + </property> + <property stdset="1"> + <name>echoMode</name> + <enum>Password</enum> + </property> + </widget> + <widget row="4" column="0" rowspan="1" colspan="3" > + <class>QCheckBox</class> + <property stdset="1"> + <name>name</name> + <cstring>sslBox</cstring> + </property> + <property stdset="1"> + <name>text</name> + <string>Use SSL</string> + </property> + </widget> + <widget row="6" column="0" rowspan="1" colspan="3" > + <class>QCheckBox</class> + <property stdset="1"> + <name>name</name> + <cstring>loginBox</cstring> + </property> + <property stdset="1"> + <name>text</name> + <string>Use Login</string> + </property> + </widget> + <widget row="0" column="2" > + <class>QLineEdit</class> + <property stdset="1"> + <name>name</name> + <cstring>accountLine</cstring> + </property> + <property> + <name>toolTip</name> + <string>Name of the Account</string> + </property> + </widget> + <widget row="2" column="1" rowspan="1" colspan="2" > + <class>QLineEdit</class> + <property stdset="1"> + <name>name</name> + <cstring>serverLine</cstring> + </property> + <property> + <name>toolTip</name> + <string>Name of the SMTP Server</string> + </property> + </widget> + <widget row="7" column="2" > + <class>QLineEdit</class> + <property stdset="1"> + <name>name</name> + <cstring>userLine</cstring> + </property> + <property stdset="1"> + <name>enabled</name> + <bool>false</bool> + </property> + </widget> + <widget row="8" column="0" rowspan="1" colspan="2" > + <class>QLabel</class> + <property stdset="1"> + <name>name</name> + <cstring>passLabel</cstring> </property> - <widget row="3" column="0" > - <class>QLabel</class> - <property stdset="1"> - <name>name</name> - <cstring>portLabel</cstring> - </property> - <property stdset="1"> - <name>text</name> - <string>Port</string> - </property> - </widget> - <widget row="2" column="1" rowspan="1" colspan="2" > - <class>QLineEdit</class> - <property stdset="1"> - <name>name</name> - <cstring>serverLine</cstring> - </property> - <property> - <name>toolTip</name> - <string>Name of the SMTP Server</string> - </property> - </widget> - <widget row="2" column="0" > - <class>QLabel</class> - <property stdset="1"> - <name>name</name> - <cstring>serverLabel</cstring> - </property> - <property stdset="1"> - <name>text</name> - <string>Server</string> - </property> - </widget> - <widget row="3" column="1" rowspan="1" colspan="2" > - <class>QLineEdit</class> - <property stdset="1"> - <name>name</name> - <cstring>portLine</cstring> - </property> - <property> - <name>toolTip</name> - <string>Port of the SMTP Server</string> - </property> - </widget> - <widget row="0" column="0" > - <class>QLabel</class> - <property stdset="1"> - <name>name</name> - <cstring>accountLabel</cstring> - </property> - <property stdset="1"> - <name>text</name> - <string>Account</string> - </property> - </widget> - <widget row="0" column="1" rowspan="1" colspan="2" > - <class>QLineEdit</class> - <property stdset="1"> - <name>name</name> - <cstring>accountLine</cstring> - </property> - <property> - <name>toolTip</name> - <string>Name of the Account</string> - </property> - </widget> - <widget row="1" column="0" rowspan="1" colspan="3" > - <class>Line</class> - <property stdset="1"> - <name>name</name> - <cstring>line1</cstring> - </property> - <property stdset="1"> - <name>orientation</name> - <enum>Horizontal</enum> - </property> - </widget> - <widget row="4" column="1" > - <class>QCheckBox</class> - <property stdset="1"> - <name>name</name> - <cstring>sslBox</cstring> - </property> - <property stdset="1"> - <name>text</name> - <string>Use SSL</string> - </property> - </widget> - <widget row="5" column="0" rowspan="1" colspan="3" > - <class>Line</class> - <property stdset="1"> - <name>name</name> - <cstring>line2</cstring> - </property> - <property stdset="1"> - <name>orientation</name> - <enum>Horizontal</enum> - </property> - </widget> - <widget row="8" column="1" rowspan="1" colspan="2" > - <class>QLineEdit</class> - <property stdset="1"> - <name>name</name> - <cstring>passLine</cstring> - </property> - <property stdset="1"> - <name>enabled</name> - <bool>false</bool> - </property> - <property stdset="1"> - <name>echoMode</name> - <enum>Password</enum> - </property> - </widget> - <widget row="6" column="1" rowspan="1" colspan="2" > - <class>QCheckBox</class> - <property stdset="1"> - <name>name</name> - <cstring>loginBox</cstring> - </property> - <property stdset="1"> - <name>text</name> - <string>Use Login</string> - </property> - </widget> - <widget row="8" column="0" > - <class>QLabel</class> - <property stdset="1"> - <name>name</name> - <cstring>passLabel</cstring> - </property> - <property stdset="1"> - <name>text</name> - <string>Password</string> - </property> - </widget> - <widget row="7" column="0" > - <class>QLabel</class> - <property stdset="1"> - <name>name</name> - <cstring>userLabel</cstring> - </property> - <property stdset="1"> - <name>text</name> - <string>User</string> - </property> - </widget> - <widget row="7" column="1" rowspan="1" colspan="2" > - <class>QLineEdit</class> - <property stdset="1"> - <name>name</name> - <cstring>userLine</cstring> - </property> - <property stdset="1"> - <name>enabled</name> - <bool>false</bool> - </property> - </widget> - <spacer row="9" column="2" > - <property> - <name>name</name> - <cstring>spacer</cstring> - </property> - <property stdset="1"> - <name>orientation</name> - <enum>Vertical</enum> - </property> - <property stdset="1"> - <name>sizeType</name> - <enum>Expanding</enum> - </property> - <property> - <name>sizeHint</name> - <size> - <width>20</width> - <height>20</height> - </size> - </property> - </spacer> - </grid> - </widget> - <widget> - <class>QWidget</class> - <property stdset="1"> - <name>name</name> - <cstring>identityTab</cstring> - </property> - <attribute> - <name>title</name> - <string>Identity</string> - </attribute> - <grid> <property stdset="1"> - <name>margin</name> - <number>4</number> + <name>text</name> + <string>Password</string> </property> + </widget> + <widget row="3" column="0" > + <class>QLabel</class> <property stdset="1"> - <name>spacing</name> - <number>3</number> + <name>name</name> + <cstring>portLabel</cstring> </property> - <widget row="9" column="0" rowspan="1" colspan="4" > - <class>QMultiLineEdit</class> - <property stdset="1"> - <name>name</name> - <cstring>sigMultiLine</cstring> - </property> - </widget> - <spacer row="10" column="3" > - <property> - <name>name</name> - <cstring>Spacer3</cstring> - </property> - <property stdset="1"> - <name>orientation</name> - <enum>Vertical</enum> - </property> - <property stdset="1"> - <name>sizeType</name> - <enum>Expanding</enum> - </property> - <property> - <name>sizeHint</name> - <size> - <width>20</width> - <height>20</height> - </size> - </property> - <property> - <name>toolTip</name> - <string>Name of the Account</string> - </property> - </spacer> - <widget row="8" column="0" rowspan="1" colspan="3" > - <class>QLabel</class> - <property stdset="1"> - <name>name</name> - <cstring>sigLabel</cstring> - </property> - <property stdset="1"> - <name>text</name> - <string>Signature</string> - </property> - </widget> - <widget row="6" column="2" rowspan="1" colspan="2" > - <class>QLineEdit</class> - <property stdset="1"> - <name>name</name> - <cstring>replyLine</cstring> - </property> - <property stdset="1"> - <name>enabled</name> - <bool>false</bool> - </property> - </widget> - <widget row="5" column="2" rowspan="1" colspan="2" > - <class>QLineEdit</class> - <property stdset="1"> - <name>name</name> - <cstring>bccLine</cstring> - </property> - <property stdset="1"> - <name>enabled</name> - <bool>false</bool> - </property> - </widget> - <widget row="4" column="2" rowspan="1" colspan="2" > - <class>QLineEdit</class> - <property stdset="1"> - <name>name</name> - <cstring>ccLine</cstring> - </property> - <property stdset="1"> - <name>enabled</name> - <bool>false</bool> - </property> - </widget> - <widget row="5" column="0" rowspan="1" colspan="2" > - <class>QCheckBox</class> - <property stdset="1"> - <name>name</name> - <cstring>bccBox</cstring> - </property> - <property stdset="1"> - <name>text</name> - <string>BCC</string> - </property> - </widget> - <widget row="6" column="0" rowspan="1" colspan="2" > - <class>QCheckBox</class> - <property stdset="1"> - <name>name</name> - <cstring>replyBox</cstring> - </property> - <property stdset="1"> - <name>text</name> - <string>Reply-To</string> - </property> - </widget> - <widget row="4" column="0" rowspan="1" colspan="2" > - <class>QCheckBox</class> - <property stdset="1"> - <name>name</name> - <cstring>ccBox</cstring> - </property> - <property stdset="1"> - <name>text</name> - <string>CC</string> - </property> - </widget> - <widget row="1" column="0" > - <class>QLabel</class> - <property stdset="1"> - <name>name</name> - <cstring>mailLabel</cstring> - </property> - <property stdset="1"> - <name>text</name> - <string>E-Mail</string> - </property> - </widget> - <widget row="0" column="1" rowspan="1" colspan="3" > - <class>QLineEdit</class> - <property stdset="1"> - <name>name</name> - <cstring>nameLine</cstring> - </property> - <property> - <name>toolTip</name> - <string>Your Full Name</string> - </property> - </widget> - <widget row="0" column="0" > - <class>QLabel</class> - <property stdset="1"> - <name>name</name> - <cstring>nameLabel</cstring> - </property> - <property stdset="1"> - <name>text</name> - <string>Name</string> - </property> - </widget> - <widget row="2" column="0" > - <class>QLabel</class> - <property stdset="1"> - <name>name</name> - <cstring>orgLabel</cstring> - </property> - <property stdset="1"> - <name>text</name> - <string>Org.</string> - </property> - <property> - <name>layoutMargin</name> - </property> - <property> - <name>layoutSpacing</name> - </property> - </widget> - <widget row="2" column="1" rowspan="1" colspan="3" > - <class>QLineEdit</class> - <property stdset="1"> - <name>name</name> - <cstring>orgLine</cstring> - </property> - <property> - <name>toolTip</name> - <string>Your Organisation</string> - </property> - </widget> - <widget row="1" column="1" rowspan="1" colspan="3" > - <class>QLineEdit</class> - <property stdset="1"> - <name>name</name> - <cstring>mailLine</cstring> - </property> - <property> - <name>toolTip</name> - <string>Your E-Mail Adress</string> - </property> - </widget> - <widget row="3" column="0" rowspan="1" colspan="4" > - <class>Line</class> - <property stdset="1"> - <name>name</name> - <cstring>line3</cstring> - </property> - <property stdset="1"> - <name>orientation</name> - <enum>Horizontal</enum> - </property> - </widget> - <widget row="7" column="0" rowspan="1" colspan="4" > - <class>Line</class> - <property stdset="1"> - <name>name</name> - <cstring>line4</cstring> - </property> - <property stdset="1"> - <name>orientation</name> - <enum>Horizontal</enum> - </property> - </widget> - </grid> - </widget> + <property stdset="1"> + <name>text</name> + <string>Port</string> + </property> + </widget> + <widget row="2" column="0" > + <class>QLabel</class> + <property stdset="1"> + <name>name</name> + <cstring>serverLabel</cstring> + </property> + <property stdset="1"> + <name>text</name> + <string>Server</string> + </property> + </widget> + <widget row="3" column="1" rowspan="1" colspan="2" > + <class>QLineEdit</class> + <property stdset="1"> + <name>name</name> + <cstring>portLine</cstring> + </property> + <property> + <name>toolTip</name> + <string>Port of the SMTP Server</string> + </property> + </widget> + <widget row="1" column="0" rowspan="1" colspan="3" > + <class>Line</class> + <property stdset="1"> + <name>name</name> + <cstring>line1</cstring> + </property> + <property stdset="1"> + <name>sizePolicy</name> + <sizepolicy> + <hsizetype>3</hsizetype> + <vsizetype>0</vsizetype> + </sizepolicy> + </property> + <property stdset="1"> + <name>orientation</name> + <enum>Horizontal</enum> + </property> + </widget> + <widget row="7" column="0" rowspan="1" colspan="2" > + <class>QLabel</class> + <property stdset="1"> + <name>name</name> + <cstring>userLabel</cstring> + </property> + <property stdset="1"> + <name>text</name> + <string>User</string> + </property> + </widget> + <widget row="5" column="0" rowspan="1" colspan="3" > + <class>Line</class> + <property stdset="1"> + <name>name</name> + <cstring>line2</cstring> + </property> + <property stdset="1"> + <name>sizePolicy</name> + <sizepolicy> + <hsizetype>3</hsizetype> + <vsizetype>0</vsizetype> + </sizepolicy> + </property> + <property stdset="1"> + <name>orientation</name> + <enum>Horizontal</enum> + </property> + </widget> + </grid> </widget> + <spacer> + <property> + <name>name</name> + <cstring>spacer</cstring> + </property> + <property stdset="1"> + <name>orientation</name> + <enum>Vertical</enum> + </property> + <property stdset="1"> + <name>sizeType</name> + <enum>Expanding</enum> + </property> + <property> + <name>sizeHint</name> + <size> + <width>20</width> + <height>20</height> + </size> + </property> + </spacer> </vbox> </widget> @@ -486,15 +258,4 @@ <tabstop>userLine</tabstop> <tabstop>passLine</tabstop> - <tabstop>smtpTab</tabstop> - <tabstop>nameLine</tabstop> - <tabstop>mailLine</tabstop> - <tabstop>orgLine</tabstop> - <tabstop>ccBox</tabstop> - <tabstop>ccLine</tabstop> - <tabstop>bccBox</tabstop> - <tabstop>bccLine</tabstop> - <tabstop>replyBox</tabstop> - <tabstop>replyLine</tabstop> - <tabstop>sigMultiLine</tabstop> </tabstops> </UI> diff --git a/noncore/net/mail/smtpwrapper.cpp b/noncore/net/mail/smtpwrapper.cpp index 521cd0a..30c0707 100644 --- a/noncore/net/mail/smtpwrapper.cpp +++ b/noncore/net/mail/smtpwrapper.cpp @@ -129,7 +129,7 @@ mailimf_fields *SMTPwrapper::createImfFields(const Mail&mail ) mailimf_fields *fields; mailimf_field *xmailer; - mailimf_mailbox *sender, *fromBox; - mailimf_mailbox_list *from; - mailimf_address_list *to, *cc, *bcc, *reply; + mailimf_mailbox *sender=0,*fromBox=0; + mailimf_mailbox_list *from=0; + mailimf_address_list *to=0, *cc=0, *bcc=0, *reply=0; char *subject = strdup( mail.getSubject().latin1() ); int err; @@ -168,20 +168,20 @@ mailimf_fields *SMTPwrapper::createImfFields(const Mail&mail ) err_free_xmailer: - mailimf_field_free( xmailer ); + if (xmailer) mailimf_field_free( xmailer ); err_free_fields: - mailimf_fields_free( fields ); + if (fields) mailimf_fields_free( fields ); err_free_reply: - mailimf_address_list_free( reply ); - mailimf_address_list_free( bcc ); - mailimf_address_list_free( cc ); - mailimf_address_list_free( to ); + if (reply) mailimf_address_list_free( reply ); + if (bcc) mailimf_address_list_free( bcc ); + if (cc) mailimf_address_list_free( cc ); + if (to) mailimf_address_list_free( to ); err_free_from: - mailimf_mailbox_list_free( from ); + if (from) mailimf_mailbox_list_free( from ); err_free_fromBox: mailimf_mailbox_free( fromBox ); err_free_sender: - mailimf_mailbox_free( sender ); + if (sender) mailimf_mailbox_free( sender ); err_free: - free( subject ); + if (subject) free( subject ); qDebug( "createImfFields - error" ); @@ -207,5 +207,5 @@ mailmime *SMTPwrapper::buildTxtPart(const QString&str ) if ( err != MAILIMF_NO_ERROR ) goto err_free_content; - fields = mailmime_fields_new_encoding(MAILMIME_MECHANISM_QUOTED_PRINTABLE); + fields = mailmime_fields_new_encoding(MAILMIME_MECHANISM_8BIT); if ( fields == NULL ) goto err_free_content; @@ -463,24 +463,4 @@ char *SMTPwrapper::getFrom( mailmime *mail ) } -SMTPaccount *SMTPwrapper::getAccount(const QString&name ) -{ - SMTPaccount *smtp; - - QList<Account> list = settings->getAccounts(); - Account *it; - for ( it = list.first(); it; it = list.next() ) { - if ( it->getType().compare( "SMTP" ) == 0 ) { - smtp = static_cast<SMTPaccount *>(it); - if ( smtp->getName()== name ) { - qDebug( "SMTPaccount found for" ); - qDebug( name ); - return smtp; - } - } - } - - return NULL; -} - void SMTPwrapper::progress( size_t current, size_t maximum ) { @@ -614,10 +594,14 @@ free_mem: } -void SMTPwrapper::sendMail(const Mail&mail,bool later ) +void SMTPwrapper::sendMail(const Mail&mail,SMTPaccount*aSmtp,bool later ) { mailmime * mimeMail; - SMTPaccount *smtp = getAccount(mail.getName()); + SMTPaccount *smtp = aSmtp; + if (!later && !smtp) { + qDebug("Didn't get any send method - giving up"); + return; + } mimeMail = createMimeMail(mail ); if ( mimeMail == NULL ) { diff --git a/noncore/net/mail/smtpwrapper.h b/noncore/net/mail/smtpwrapper.h index f734fa4..0535983 100644 --- a/noncore/net/mail/smtpwrapper.h +++ b/noncore/net/mail/smtpwrapper.h @@ -28,5 +28,5 @@ public: SMTPwrapper( Settings *s ); virtual ~SMTPwrapper(){} - void sendMail(const Mail& mail,bool later=false ); + void sendMail(const Mail& mail,SMTPaccount*smtp,bool later=false ); bool flushOutbox(SMTPaccount*smtp); @@ -43,5 +43,4 @@ protected: void smtpSend( mailmime *mail,bool later, SMTPaccount *smtp ); clist *createRcptList( mailimf_fields *fields ); - SMTPaccount *getAccount(const QString&from ); static void storeMail(char*mail, size_t length, const QString&box); |