• Skip to content
  • Skip to link menu
KDE API Reference
  • KDE API Reference
  • kdepim API Reference
  • KDE Home
  • Contact Us
 

knode

  • sources
  • kde-4.12
  • kdepim
  • knode
mailsendjob.cpp
Go to the documentation of this file.
1 /*
2  Copyright (c) 2005 by Volker Krause <vkrause@kde.org>
3 
4  This program is free software; you can redistribute it and/or modify
5  it under the terms of the GNU General Public License as published by
6  the Free Software Foundation; either version 2 of the License, or
7  (at your option) any later version.
8  You should have received a copy of the GNU General Public License
9  along with this program; if not, write to the Free Software Foundation,
10  Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, US
11 */
12 
13 #include "mailsendjob.h"
14 
15 #include "knarticle.h"
16 #include "knserverinfo.h"
17 
18 #include <mailtransport/transportmanager.h>
19 #include <mailtransport/transportjob.h>
20 
21 #include <kdebug.h>
22 #include <klocale.h>
23 #include <kio/job.h>
24 
25 using namespace MailTransport;
26 
27 KNode::MailSendJob::MailSendJob( KNJobConsumer * c, int transportId, KNJobItem::Ptr i ) :
28  KNJobData( KNJobData::JTmail, c, KNServerInfo::Ptr(), i ),
29  mTransportId( transportId )
30 {
31 }
32 
33 void KNode::MailSendJob::execute()
34 {
35  KNLocalArticle::Ptr art = boost::static_pointer_cast<KNLocalArticle>( data() );
36 
37  TransportJob* job = TransportManager::self()->createTransportJob( mTransportId );
38  if ( !job ) {
39  setError( KIO::ERR_INTERNAL, i18n("Could not create mail transport job.") );
40  emitFinished();
41  return;
42  }
43 
44  job->setData( art->encodedContent( true ) );
45  job->setSender( art->from()->addresses().first() );
46 
47  // FIXME
48  QStringList to;
49  foreach ( const QByteArray &b, art->to()->addresses() ) {
50  to << QString::fromLatin1( b );
51  }
52  job->setTo( to );
53 
54  connect( job, SIGNAL(result(KJob*)), SLOT(slotResult(KJob*)) );
55  setupKJob( job );
56  TransportManager::self()->schedule( job );
57 }
58 
59 void KNode::MailSendJob::slotResult( KJob * job )
60 {
61  if ( job->error() )
62  setError( job->error(), job->errorString() );
63  emitFinished();
64 }
65 
66 #include "mailsendjob.moc"
KNLocalArticle::Ptr
boost::shared_ptr< KNLocalArticle > Ptr
Shared pointer to a KNLocalArticle. To be used instead of raw KNLocalArticle*.
Definition: knarticle.h:214
KNJobData
Abstract base class for all KNode internal jobs.
Definition: knjobdata.h:101
KNLocalArticle
This class encapsulates an article, that is stored locally in an MBOX-file.
Definition: knarticle.h:210
to
QString to() const
KNode::MailSendJob::execute
virtual void execute()
Performs the actual operation of a job, needs to be reimplemented for every job.
Definition: mailsendjob.cpp:33
KNServerInfo
Represents an account on a news server.
Definition: knserverinfo.h:29
KNode::MailSendJob::MailSendJob
MailSendJob(KNJobConsumer *c, int transportId, KNJobItem::Ptr i)
Definition: mailsendjob.cpp:27
KNJobConsumer
Base class for classes that want to create and schedule jobs.
Definition: knjobdata.h:39
KNJobItem::Ptr
boost::shared_ptr< KNJobItem > Ptr
Shared pointer to a KNJobItem.
Definition: knjobdata.h:80
mailsendjob.h
knarticle.h
KJob
knserverinfo.h
This file is part of the KDE documentation.
Documentation copyright © 1996-2014 The KDE developers.
Generated on Tue Oct 14 2014 22:58:36 by doxygen 1.8.7 written by Dimitri van Heesch, © 1997-2006

KDE's Doxygen guidelines are available online.

knode

Skip menu "knode"
  • Main Page
  • Namespace List
  • Alphabetical List
  • Class List
  • Class Hierarchy
  • Class Members
  • File List
  • File Members
  • Related Pages

kdepim API Reference

Skip menu "kdepim API Reference"
  • akonadi_next
  • akregator
  • blogilo
  • calendarsupport
  • console
  •   kabcclient
  •   konsolekalendar
  • kaddressbook
  • kalarm
  •   lib
  • kdgantt2
  • kjots
  • kleopatra
  • kmail
  • knode
  • knotes
  • kontact
  • korgac
  • korganizer
  • ktimetracker
  • libkdepim
  • libkleo
  • libkpgp
  • mailcommon
  • messagelist
  • messageviewer

Search



Report problems with this website to our bug tracking system.
Contact the specific authors with questions and comments about the page contents.

KDE® and the K Desktop Environment® logo are registered trademarks of KDE e.V. | Legal