Diffstat (limited to 'noncore/net/mail/composemail.cpp') (more/less context) (ignore whitespace changes)
-rw-r--r-- | noncore/net/mail/composemail.cpp | 26 |
1 files changed, 15 insertions, 11 deletions
diff --git a/noncore/net/mail/composemail.cpp b/noncore/net/mail/composemail.cpp index b15e692..449fdf1 100644 --- a/noncore/net/mail/composemail.cpp +++ b/noncore/net/mail/composemail.cpp | |||
@@ -1,27 +1,31 @@ | |||
1 | #include <qt.h> | ||
2 | 1 | ||
2 | #include "composemail.h" | ||
3 | |||
4 | #include <libmailwrapper/smtpwrapper.h> | ||
5 | #include <libmailwrapper/storemail.h> | ||
6 | #include <libmailwrapper/abstractmail.h> | ||
7 | #include <libmailwrapper/mailtypes.h> | ||
8 | |||
9 | /* OPIE */ | ||
3 | #include <opie2/ofiledialog.h> | 10 | #include <opie2/ofiledialog.h> |
4 | #include <opie2/odebug.h> | 11 | #include <opie2/odebug.h> |
5 | #include <qpe/resource.h> | 12 | #include <qpe/resource.h> |
6 | #include <qpe/config.h> | 13 | #include <qpe/config.h> |
7 | #include <qpe/global.h> | 14 | #include <qpe/global.h> |
8 | #include <qpe/contact.h> | 15 | #include <qpe/contact.h> |
9 | 16 | ||
10 | #include "composemail.h" | 17 | /* QT */ |
18 | #include <qt.h> | ||
11 | 19 | ||
12 | #include <libmailwrapper/smtpwrapper.h> | ||
13 | #include <libmailwrapper/storemail.h> | ||
14 | #include <libmailwrapper/abstractmail.h> | ||
15 | #include <libmailwrapper/mailtypes.h> | ||
16 | 20 | ||
17 | using namespace Opie::Core; | 21 | using namespace Opie::Core; |
18 | using namespace Opie::Ui; | 22 | using namespace Opie::Ui; |
19 | ComposeMail::ComposeMail( Settings *s, QWidget *parent, const char *name, bool modal, WFlags flags ) | 23 | ComposeMail::ComposeMail( Settings *s, QWidget *parent, const char *name, bool modal, WFlags flags ) |
20 | : ComposeMailUI( parent, name, modal, flags ) | 24 | : ComposeMailUI( parent, name, modal, flags ) |
21 | { | 25 | { |
22 | settings = s; | 26 | settings = s; |
23 | m_replyid = ""; | 27 | m_replyid = ""; |
24 | 28 | ||
25 | QString vfilename = Global::applicationFileName("addressbook", | 29 | QString vfilename = Global::applicationFileName("addressbook", |
26 | "businesscard.vcf"); | 30 | "businesscard.vcf"); |
27 | Contact c; | 31 | Contact c; |
@@ -175,30 +179,30 @@ void ComposeMail::removeAttachment() | |||
175 | if ( !attList->currentItem() ) { | 179 | if ( !attList->currentItem() ) { |
176 | QMessageBox::information( this, tr( "Error" ), | 180 | QMessageBox::information( this, tr( "Error" ), |
177 | tr( "<p>Please select a File.</p>" ), | 181 | tr( "<p>Please select a File.</p>" ), |
178 | tr( "Ok" ) ); | 182 | tr( "Ok" ) ); |
179 | } else { | 183 | } else { |
180 | attList->takeItem( attList->currentItem() ); | 184 | attList->takeItem( attList->currentItem() ); |
181 | } | 185 | } |
182 | } | 186 | } |
183 | 187 | ||
184 | void ComposeMail::accept() | 188 | void ComposeMail::accept() |
185 | { | 189 | { |
186 | if ( checkBoxLater->isChecked() ) { | 190 | if ( checkBoxLater->isChecked() ) { |
187 | odebug << "Send later" << oendl; | 191 | odebug << "Send later" << oendl; |
188 | } | 192 | } |
189 | 193 | ||
190 | #if 0 | 194 | #if 0 |
191 | qDebug( "Sending Mail with " + | 195 | odebug << "Sending Mail with " |
192 | smtpAccounts.at( smtpAccountBox->currentItem() )->getAccountName() ); | 196 | << smtpAccounts.at( smtpAccountBox->currentItem() )->getAccountName() << oendl; |
193 | #endif | 197 | #endif |
194 | Opie::Core::OSmartPointer<Mail> mail=new Mail; | 198 | Opie::Core::OSmartPointer<Mail> mail=new Mail; |
195 | 199 | ||
196 | SMTPaccount *smtp = smtpAccounts.at( smtpAccountBox->currentItem() ); | 200 | SMTPaccount *smtp = smtpAccounts.at( smtpAccountBox->currentItem() ); |
197 | mail->setMail(fromBox->currentText()); | 201 | mail->setMail(fromBox->currentText()); |
198 | 202 | ||
199 | if ( !toLine->text().isEmpty() ) { | 203 | if ( !toLine->text().isEmpty() ) { |
200 | mail->setTo( toLine->text() ); | 204 | mail->setTo( toLine->text() ); |
201 | } else { | 205 | } else { |
202 | QMessageBox::warning(0,tr("Sending mail"), | 206 | QMessageBox::warning(0,tr("Sending mail"), |
203 | tr("No Receiver spezified" ) ); | 207 | tr("No Receiver spezified" ) ); |
204 | return; | 208 | return; |
@@ -248,25 +252,25 @@ void ComposeMail::reject() | |||
248 | mail->setReply( replyLine->text() ); | 252 | mail->setReply( replyLine->text() ); |
249 | mail->setSubject( subjectLine->text() ); | 253 | mail->setSubject( subjectLine->text() ); |
250 | if (!m_replyid.isEmpty()) { | 254 | if (!m_replyid.isEmpty()) { |
251 | QStringList ids; | 255 | QStringList ids; |
252 | ids.append(m_replyid); | 256 | ids.append(m_replyid); |
253 | mail->setInreply(ids); | 257 | mail->setInreply(ids); |
254 | } | 258 | } |
255 | QString txt = message->text(); | 259 | QString txt = message->text(); |
256 | if ( !sigMultiLine->text().isEmpty() ) { | 260 | if ( !sigMultiLine->text().isEmpty() ) { |
257 | txt.append( "\n--\n" ); | 261 | txt.append( "\n--\n" ); |
258 | txt.append( sigMultiLine->text() ); | 262 | txt.append( sigMultiLine->text() ); |
259 | } | 263 | } |
260 | odebug << txt << oendl; | 264 | odebug << txt << oendl; |
261 | mail->setMessage( txt ); | 265 | mail->setMessage( txt ); |
262 | 266 | ||
263 | /* only use the default drafts folder name! */ | 267 | /* only use the default drafts folder name! */ |
264 | Storemail wrapper(AbstractMail::draftFolder()); | 268 | Storemail wrapper(AbstractMail::draftFolder()); |
265 | wrapper.storeMail(mail); | 269 | wrapper.storeMail(mail); |
266 | 270 | ||
267 | AttachViewItem *it = (AttachViewItem *) attList->firstChild(); | 271 | AttachViewItem *it = (AttachViewItem *) attList->firstChild(); |
268 | /* attachments we will ignore! */ | 272 | /* attachments we will ignore! */ |
269 | if ( it != NULL ) { | 273 | if ( it != NULL ) { |
270 | QMessageBox::warning(0,tr("Store message"), | 274 | QMessageBox::warning(0,tr("Store message"), |
271 | tr("<center>Attachments will not be stored in \"Draft\" folder</center>")); | 275 | tr("<center>Attachments will not be stored in \"Draft\" folder</center>")); |
272 | } | 276 | } |
@@ -284,20 +288,20 @@ void ComposeMail::reEditMail(const RecMailP¤t) | |||
284 | message->setText(data->Wrapper()->fetchBody(current)->Bodytext()); | 288 | message->setText(data->Wrapper()->fetchBody(current)->Bodytext()); |
285 | subjectLine->setText( data->getSubject()); | 289 | subjectLine->setText( data->getSubject()); |
286 | toLine->setText(data->To().join(",")); | 290 | toLine->setText(data->To().join(",")); |
287 | ccLine->setText(data->CC().join(",")); | 291 | ccLine->setText(data->CC().join(",")); |
288 | bccLine->setText(data->Bcc().join(",")); | 292 | bccLine->setText(data->Bcc().join(",")); |
289 | replyLine->setText(data->Replyto()); | 293 | replyLine->setText(data->Replyto()); |
290 | } | 294 | } |
291 | 295 | ||
292 | AttachViewItem::AttachViewItem( QListView *parent, Attachment *att ) | 296 | AttachViewItem::AttachViewItem( QListView *parent, Attachment *att ) |
293 | : QListViewItem( parent ) | 297 | : QListViewItem( parent ) |
294 | { | 298 | { |
295 | attachment = att; | 299 | attachment = att; |
296 | odebug << att->getMimeType() << oendl; | 300 | odebug << att->getMimeType() << oendl; |
297 | setPixmap( 0, attachment->getDocLnk().pixmap().isNull() ? | 301 | setPixmap( 0, attachment->getDocLnk().pixmap().isNull() ? |
298 | Resource::loadPixmap( "UnknownDocument-14" ) : | 302 | Resource::loadPixmap( "UnknownDocument-14" ) : |
299 | attachment->getDocLnk().pixmap() ); | 303 | attachment->getDocLnk().pixmap() ); |
300 | setText( 0, att->getName().isEmpty() ? att->getFileName() : att->getName() ); | 304 | setText( 0, att->getName().isEmpty() ? att->getFileName() : att->getName() ); |
301 | setText( 1, QString::number( att->getSize() ) ); | 305 | setText( 1, QString::number( att->getSize() ) ); |
302 | } | 306 | } |
303 | 307 | ||