summaryrefslogtreecommitdiff
path: root/noncore/net/mail/composemail.cpp
authorharlekin <harlekin>2004-01-04 02:46:56 (UTC)
committer harlekin <harlekin>2004-01-04 02:46:56 (UTC)
commitcda867a4d179eb3320c5a043cb9116014fa736b8 (patch) (unidiff)
tree1dafac9c041634e19fab18759f181c41500346a5 /noncore/net/mail/composemail.cpp
parent7bfc0889cf761e20402f775a46c8b8508c48ed8f (diff)
downloadopie-cda867a4d179eb3320c5a043cb9116014fa736b8.zip
opie-cda867a4d179eb3320c5a043cb9116014fa736b8.tar.gz
opie-cda867a4d179eb3320c5a043cb9116014fa736b8.tar.bz2
adapted includes to the new lib
Diffstat (limited to 'noncore/net/mail/composemail.cpp') (more/less context) (ignore whitespace changes)
-rw-r--r--noncore/net/mail/composemail.cpp11
1 files changed, 6 insertions, 5 deletions
diff --git a/noncore/net/mail/composemail.cpp b/noncore/net/mail/composemail.cpp
index 13c7900..5e823e8 100644
--- a/noncore/net/mail/composemail.cpp
+++ b/noncore/net/mail/composemail.cpp
@@ -1,57 +1,58 @@
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#include <qpe/config.h>
6#include <qpe/global.h> 6#include <qpe/global.h>
7#include <qpe/contact.h> 7#include <qpe/contact.h>
8 8
9#include "composemail.h" 9#include "composemail.h"
10#include "smtpwrapper.h" 10
11#include <libmailwrapper/smtpwrapper.h>
11 12
12ComposeMail::ComposeMail( Settings *s, QWidget *parent, const char *name, bool modal, WFlags flags ) 13ComposeMail::ComposeMail( Settings *s, QWidget *parent, const char *name, bool modal, WFlags flags )
13 : ComposeMailUI( parent, name, modal, flags ) 14 : ComposeMailUI( parent, name, modal, flags )
14{ 15{
15 settings = s; 16 settings = s;
16 17
17 QString vfilename = Global::applicationFileName("addressbook", 18 QString vfilename = Global::applicationFileName("addressbook",
18 "businesscard.vcf"); 19 "businesscard.vcf");
19 Contact c; 20 Contact c;
20 if (QFile::exists(vfilename)) { 21 if (QFile::exists(vfilename)) {
21 c = Contact::readVCard( vfilename )[0]; 22 c = Contact::readVCard( vfilename )[0];
22 } 23 }
23 24
24 QStringList mails = c.emailList(); 25 QStringList mails = c.emailList();
25 QString defmail = c.defaultEmail(); 26 QString defmail = c.defaultEmail();
26 27
27 if (defmail.length()!=0) { 28 if (defmail.length()!=0) {
28 fromBox->insertItem(defmail); 29 fromBox->insertItem(defmail);
29 } 30 }
30 QStringList::ConstIterator sit = mails.begin(); 31 QStringList::ConstIterator sit = mails.begin();
31 for (;sit!=mails.end();++sit) { 32 for (;sit!=mails.end();++sit) {
32 if ( (*sit)==defmail) 33 if ( (*sit)==defmail)
33 continue; 34 continue;
34 fromBox->insertItem((*sit)); 35 fromBox->insertItem((*sit));
35 } 36 }
36 senderNameEdit->setText(c.firstName()+" "+c.lastName()); 37 senderNameEdit->setText(c.firstName()+" "+c.lastName());
37 Config cfg( "mail" ); 38 Config cfg( "mail" );
38 cfg.setGroup( "Compose" ); 39 cfg.setGroup( "Compose" );
39 checkBoxLater->setChecked( cfg.readBoolEntry( "sendLater", false ) ); 40 checkBoxLater->setChecked( cfg.readBoolEntry( "sendLater", false ) );
40 41
41 attList->addColumn( tr( "Name" ) ); 42 attList->addColumn( tr( "Name" ) );
42 attList->addColumn( tr( "Size" ) ); 43 attList->addColumn( tr( "Size" ) );
43 44
44 QList<Account> accounts = settings->getAccounts(); 45 QList<Account> accounts = settings->getAccounts();
45 46
46 Account *it; 47 Account *it;
47 for ( it = accounts.first(); it; it = accounts.next() ) { 48 for ( it = accounts.first(); it; it = accounts.next() ) {
48 if ( it->getType().compare( "SMTP" ) == 0 ) { 49 if ( it->getType().compare( "SMTP" ) == 0 ) {
49 SMTPaccount *smtp = static_cast<SMTPaccount *>(it); 50 SMTPaccount *smtp = static_cast<SMTPaccount *>(it);
50 smtpAccountBox->insertItem( smtp->getAccountName() ); 51 smtpAccountBox->insertItem( smtp->getAccountName() );
51 smtpAccounts.append( smtp ); 52 smtpAccounts.append( smtp );
52 } 53 }
53 } 54 }
54 55
55 if ( smtpAccounts.count() > 0 ) { 56 if ( smtpAccounts.count() > 0 ) {
56 fillValues( smtpAccountBox->currentItem() ); 57 fillValues( smtpAccountBox->currentItem() );
57 } else { 58 } else {
@@ -182,25 +183,25 @@ void ComposeMail::removeAttachment()
182 183
183void ComposeMail::accept() 184void ComposeMail::accept()
184{ 185{
185 if ( checkBoxLater->isChecked() ) { 186 if ( checkBoxLater->isChecked() ) {
186 qDebug( "Send later" ); 187 qDebug( "Send later" );
187 } 188 }
188 189
189#if 0 190#if 0
190 qDebug( "Sending Mail with " + 191 qDebug( "Sending Mail with " +
191 smtpAccounts.at( smtpAccountBox->currentItem() )->getAccountName() ); 192 smtpAccounts.at( smtpAccountBox->currentItem() )->getAccountName() );
192#endif 193#endif
193 Mail *mail = new Mail(); 194 Mail *mail = new Mail();
194 195
195 SMTPaccount *smtp = smtpAccounts.at( smtpAccountBox->currentItem() ); 196 SMTPaccount *smtp = smtpAccounts.at( smtpAccountBox->currentItem() );
196 mail->setMail(fromBox->currentText()); 197 mail->setMail(fromBox->currentText());
197 198
198 if ( !toLine->text().isEmpty() ) { 199 if ( !toLine->text().isEmpty() ) {
199 mail->setTo( toLine->text() ); 200 mail->setTo( toLine->text() );
200 } else { 201 } else {
201 qDebug( "No Reciever spezified -> returning" ); 202 qDebug( "No Reciever spezified -> returning" );
202 return; 203 return;
203 } 204 }
204 mail->setName(senderNameEdit->text()); 205 mail->setName(senderNameEdit->text());
205 mail->setCC( ccLine->text() ); 206 mail->setCC( ccLine->text() );
206 mail->setBCC( bccLine->text() ); 207 mail->setBCC( bccLine->text() );
@@ -212,25 +213,25 @@ void ComposeMail::accept()
212 txt.append( sigMultiLine->text() ); 213 txt.append( sigMultiLine->text() );
213 } 214 }
214 qDebug(txt); 215 qDebug(txt);
215 mail->setMessage( txt ); 216 mail->setMessage( txt );
216 AttachViewItem *it = (AttachViewItem *) attList->firstChild(); 217 AttachViewItem *it = (AttachViewItem *) attList->firstChild();
217 while ( it != NULL ) { 218 while ( it != NULL ) {
218 mail->addAttachment( it->getAttachment() ); 219 mail->addAttachment( it->getAttachment() );
219 it = (AttachViewItem *) it->nextSibling(); 220 it = (AttachViewItem *) it->nextSibling();
220 } 221 }
221 222
222 SMTPwrapper wrapper( settings ); 223 SMTPwrapper wrapper( settings );
223 wrapper.sendMail( *mail,smtp,checkBoxLater->isChecked() ); 224 wrapper.sendMail( *mail,smtp,checkBoxLater->isChecked() );
224 225
225 QDialog::accept(); 226 QDialog::accept();
226} 227}
227 228
228AttachViewItem::AttachViewItem( QListView *parent, Attachment *att ) 229AttachViewItem::AttachViewItem( QListView *parent, Attachment *att )
229 : QListViewItem( parent ) 230 : QListViewItem( parent )
230{ 231{
231 attachment = att; 232 attachment = att;
232 qDebug( att->getMimeType() ); 233 qDebug( att->getMimeType() );
233 setPixmap( 0, attachment->getDocLnk().pixmap().isNull() ? 234 setPixmap( 0, attachment->getDocLnk().pixmap().isNull() ?
234 Resource::loadPixmap( "UnknownDocument-14" ) : 235 Resource::loadPixmap( "UnknownDocument-14" ) :
235 attachment->getDocLnk().pixmap() ); 236 attachment->getDocLnk().pixmap() );
236 setText( 0, att->getName().isEmpty() ? att->getFileName() : att->getName() ); 237 setText( 0, att->getName().isEmpty() ? att->getFileName() : att->getName() );