• Skip to content
  • Skip to link menu
  • KDE API Reference
  • kdepimlibs-4.11.3 API Reference
  • KDE Home
  • Contact Us
 

mailtransport

  • mailtransport
dispatcherinterface.cpp
1 /*
2  Copyright (c) 2009 Constantin Berzan <exit3219@gmail.com>
3 
4  This library is free software; you can redistribute it and/or modify it
5  under the terms of the GNU Library General Public License as published by
6  the Free Software Foundation; either version 2 of the License, or (at your
7  option) any later version.
8 
9  This library is distributed in the hope that it will be useful, but WITHOUT
10  ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
11  FITNESS FOR A PARTICULAR PURPOSE. See the GNU Library General Public
12  License for more details.
13 
14  You should have received a copy of the GNU Library General Public License
15  along with this library; see the file COPYING.LIB. If not, write to the
16  Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
17  02110-1301, USA.
18 */
19 
20 #include "dispatcherinterface.h"
21 #include "dispatcherinterface_p.h"
22 
23 #include "outboxactions_p.h"
24 
25 #include <KDebug>
26 #include <KGlobal>
27 #include <KLocalizedString>
28 
29 #include <akonadi/agentmanager.h>
30 #include <akonadi/collection.h>
31 #include <akonadi/kmime/specialmailcollections.h>
32 #include "transportattribute.h"
33 
34 using namespace Akonadi;
35 using namespace MailTransport;
36 
37 K_GLOBAL_STATIC( DispatcherInterfacePrivate, sInstance )
38 
39 void DispatcherInterfacePrivate::massModifyResult( KJob *job )
40 {
41  // Nothing to do here, really. If the job fails, the user can retry it.
42  if ( job->error() ) {
43  kDebug() << "failed" << job->errorString();
44  } else {
45  kDebug() << "succeeded.";
46  }
47 }
48 
49 DispatcherInterface::DispatcherInterface()
50 {
51 }
52 
53 AgentInstance DispatcherInterface::dispatcherInstance() const
54 {
55  AgentInstance a =
56  AgentManager::self()->instance( QLatin1String( "akonadi_maildispatcher_agent" ) );
57  if ( !a.isValid() ) {
58  kWarning() << "Could not get MDA instance.";
59  }
60  return a;
61 }
62 
63 void DispatcherInterface::dispatchManually()
64 {
65  Collection outbox =
66  SpecialMailCollections::self()->defaultCollection( SpecialMailCollections::Outbox );
67  if ( !outbox.isValid() ) {
68 // kError() << "Could not access Outbox.";
69  return;
70  }
71 
72  FilterActionJob *mjob = new FilterActionJob( outbox, new SendQueuedAction, sInstance );
73  QObject::connect( mjob, SIGNAL(result(KJob*)), sInstance, SLOT(massModifyResult(KJob*)) );
74 }
75 
76 void DispatcherInterface::retryDispatching()
77 {
78  Collection outbox =
79  SpecialMailCollections::self()->defaultCollection( SpecialMailCollections::Outbox );
80  if ( !outbox.isValid() ) {
81 // kError() << "Could not access Outbox.";
82  return;
83  }
84 
85  FilterActionJob *mjob = new FilterActionJob( outbox, new ClearErrorAction, sInstance );
86  QObject::connect( mjob, SIGNAL(result(KJob*)), sInstance, SLOT(massModifyResult(KJob*)) );
87 }
88 
89 void DispatcherInterface::dispatchManualTransport( int transportId )
90 {
91  Collection outbox =
92  SpecialMailCollections::self()->defaultCollection( SpecialMailCollections::Outbox );
93  if ( !outbox.isValid() ) {
94 // kError() << "Could not access Outbox.";
95  return;
96  }
97 
98  FilterActionJob *mjob =
99  new FilterActionJob( outbox, new DispatchManualTransportAction( transportId ), sInstance );
100  QObject::connect( mjob, SIGNAL(result(KJob*)), sInstance, SLOT(massModifyResult(KJob*)) );
101 }
102 
103 #include "moc_dispatcherinterface_p.cpp"
MailTransport::DispatchManualTransportAction
FilterAction that changes the transport for all messages and sets the &quot;$QUEUED&quot; flag.
Definition: outboxactions_p.h:113
Akonadi::FilterActionJob
Job to filter and apply an action on a set of items.
Definition: filteractionjob_p.h:131
MailTransport::DispatcherInterfacePrivate
Definition: dispatcherinterface_p.h:31
MailTransport::ClearErrorAction
FilterAction that finds all messages with an ErrorAttribute, removes the attribute, and sets the &quot;$QUEUED&quot; flag.
Definition: outboxactions_p.h:78
MailTransport::SendQueuedAction
FilterAction that finds all messages with a DispatchMode of Manual and assigns them a DispatchMode of...
Definition: outboxactions_p.h:43
This file is part of the KDE documentation.
Documentation copyright © 1996-2013 The KDE developers.
Generated on Tue Nov 26 2013 09:03:01 by doxygen 1.8.5 written by Dimitri van Heesch, © 1997-2006

KDE's Doxygen guidelines are available online.

mailtransport

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

kdepimlibs-4.11.3 API Reference

Skip menu "kdepimlibs-4.11.3 API Reference"
  • akonadi
  •   contact
  •   kmime
  •   socialutils
  • kabc
  • kalarmcal
  • kblog
  • kcal
  • kcalcore
  • kcalutils
  • kholidays
  • kimap
  • kioslave
  •   imap4
  •   mbox
  •   nntp
  • kldap
  • kmbox
  • kmime
  • kontactinterface
  • kpimidentities
  • kpimtextedit
  • kpimutils
  • kresources
  • ktnef
  • kxmlrpcclient
  • mailtransport
  • microblog
  • qgpgme
  • syndication
  •   atom
  •   rdf
  •   rss2
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