summaryrefslogtreecommitdiff
path: root/noncore/net/mail/composemail.cpp
Unidiff
Diffstat (limited to 'noncore/net/mail/composemail.cpp') (more/less context) (show whitespace changes)
-rw-r--r--noncore/net/mail/composemail.cpp11
1 files changed, 11 insertions, 0 deletions
diff --git a/noncore/net/mail/composemail.cpp b/noncore/net/mail/composemail.cpp
index 048fa85..f680f5c 100644
--- a/noncore/net/mail/composemail.cpp
+++ b/noncore/net/mail/composemail.cpp
@@ -1,44 +1,50 @@
1#include <qt.h> 1#include <qt.h>
2 2
3#include <opie/ofiledialog.h> 3#include <opie/ofiledialog.h>
4#include <qpe/resource.h> 4#include <qpe/resource.h>
5#include <qpe/config.h>
5 6
6#include "composemail.h" 7#include "composemail.h"
7#include "smtpwrapper.h" 8#include "smtpwrapper.h"
8 9
9ComposeMail::ComposeMail( Settings *s, QWidget *parent, const char *name, bool modal, WFlags flags ) 10ComposeMail::ComposeMail( Settings *s, QWidget *parent, const char *name, bool modal, WFlags flags )
10 : ComposeMailUI( parent, name, modal, flags ) 11 : ComposeMailUI( parent, name, modal, flags )
11{ 12{
12 settings = s; 13 settings = s;
13 14
15 Config cfg( "mail" );
16 cfg.setGroup( "Compose" );
17 checkBoxLater->setChecked( cfg.readBoolEntry( "sendLater", false ) );
18
14 attList->addColumn( tr( "Name" ) ); 19 attList->addColumn( tr( "Name" ) );
15 attList->addColumn( tr( "Size" ) ); 20 attList->addColumn( tr( "Size" ) );
16 21
17 QList<Account> accounts = settings->getAccounts(); 22 QList<Account> accounts = settings->getAccounts();
18 Account *it; 23 Account *it;
19 for ( it = accounts.first(); it; it = accounts.next() ) { 24 for ( it = accounts.first(); it; it = accounts.next() ) {
20 if ( it->getType().compare( "SMTP" ) == 0 ) { 25 if ( it->getType().compare( "SMTP" ) == 0 ) {
21 SMTPaccount *smtp = static_cast<SMTPaccount *>(it); 26 SMTPaccount *smtp = static_cast<SMTPaccount *>(it);
22 fromBox->insertItem( smtp->getMail() ); 27 fromBox->insertItem( smtp->getMail() );
23 smtpAccounts.append( smtp ); 28 smtpAccounts.append( smtp );
24 } 29 }
25 } 30 }
26 31
27 if ( smtpAccounts.count() > 0 ) { 32 if ( smtpAccounts.count() > 0 ) {
28 fillValues( fromBox->currentItem() ); 33 fillValues( fromBox->currentItem() );
29 } else { 34 } else {
30 QMessageBox::information( this, tr( "Problem" ), 35 QMessageBox::information( this, tr( "Problem" ),
31 tr( "<p>Please create an SMTP account first.</p>" ), 36 tr( "<p>Please create an SMTP account first.</p>" ),
32 tr( "Ok" ) ); 37 tr( "Ok" ) );
38 return;
33 } 39 }
34 40
35 connect( fromBox, SIGNAL( activated( int ) ), SLOT( fillValues( int ) ) ); 41 connect( fromBox, SIGNAL( activated( int ) ), SLOT( fillValues( int ) ) );
36 connect( toButton, SIGNAL( clicked() ), SLOT( pickAddressTo() ) ); 42 connect( toButton, SIGNAL( clicked() ), SLOT( pickAddressTo() ) );
37 connect( ccButton, SIGNAL( clicked() ), SLOT( pickAddressCC() ) ); 43 connect( ccButton, SIGNAL( clicked() ), SLOT( pickAddressCC() ) );
38 connect( bccButton, SIGNAL( clicked() ), SLOT( pickAddressBCC() ) ); 44 connect( bccButton, SIGNAL( clicked() ), SLOT( pickAddressBCC() ) );
39 connect( replyButton, SIGNAL( clicked() ), SLOT( pickAddressReply() ) ); 45 connect( replyButton, SIGNAL( clicked() ), SLOT( pickAddressReply() ) );
40 connect( addButton, SIGNAL( clicked() ), SLOT( addAttachment() ) ); 46 connect( addButton, SIGNAL( clicked() ), SLOT( addAttachment() ) );
41 connect( deleteButton, SIGNAL( clicked() ), SLOT( removeAttachment() ) ); 47 connect( deleteButton, SIGNAL( clicked() ), SLOT( removeAttachment() ) );
42} 48}
43 49
44void ComposeMail::pickAddress( QLineEdit *line ) 50void ComposeMail::pickAddress( QLineEdit *line )
@@ -144,24 +150,29 @@ void ComposeMail::removeAttachment()
144{ 150{
145 if ( !attList->currentItem() ) { 151 if ( !attList->currentItem() ) {
146 QMessageBox::information( this, tr( "Error" ), 152 QMessageBox::information( this, tr( "Error" ),
147 tr( "<p>Please select a File.</p>" ), 153 tr( "<p>Please select a File.</p>" ),
148 tr( "Ok" ) ); 154 tr( "Ok" ) );
149 } else { 155 } else {
150 attList->takeItem( attList->currentItem() ); 156 attList->takeItem( attList->currentItem() );
151 } 157 }
152} 158}
153 159
154void ComposeMail::accept() 160void ComposeMail::accept()
155{ 161{
162 if ( checkBoxLater->isChecked() ) {
163 qDebug( "Send later" );
164 }
165
166
156 qDebug( "Sending Mail with " + 167 qDebug( "Sending Mail with " +
157 smtpAccounts.at( fromBox->currentItem() )->getAccountName() ); 168 smtpAccounts.at( fromBox->currentItem() )->getAccountName() );
158 Mail *mail = new Mail(); 169 Mail *mail = new Mail();
159 SMTPaccount *smtp = smtpAccounts.at( fromBox->currentItem() ); 170 SMTPaccount *smtp = smtpAccounts.at( fromBox->currentItem() );
160 mail->setMail( smtp->getMail() ); 171 mail->setMail( smtp->getMail() );
161 mail->setName( smtp->getName() ); 172 mail->setName( smtp->getName() );
162 173
163 if ( !toLine->text().isEmpty() ) { 174 if ( !toLine->text().isEmpty() ) {
164 mail->setTo( toLine->text() ); 175 mail->setTo( toLine->text() );
165 } else { 176 } else {
166 qDebug( "No Reciever spezified -> returning" ); 177 qDebug( "No Reciever spezified -> returning" );
167 return; 178 return;