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

mailtransport

  • sources
  • kde-4.14
  • kdepimlibs
  • 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 
28 #include <akonadi/agentmanager.h>
29 #include <akonadi/collection.h>
30 #include <akonadi/kmime/specialmailcollections.h>
31 #include "transportattribute.h"
32 
33 using namespace Akonadi;
34 using namespace MailTransport;
35 
36 K_GLOBAL_STATIC( DispatcherInterfacePrivate, sInstance )
37 
38 void DispatcherInterfacePrivate::massModifyResult( KJob *job )
39 {
40  // Nothing to do here, really. If the job fails, the user can retry it.
41  if ( job->error() ) {
42  kDebug() << "failed" << job->errorString();
43  } else {
44  kDebug() << "succeeded.";
45  }
46 }
47 
48 DispatcherInterface::DispatcherInterface()
49 {
50 }
51 
52 AgentInstance DispatcherInterface::dispatcherInstance() const
53 {
54  AgentInstance a =
55  AgentManager::self()->instance( QLatin1String( "akonadi_maildispatcher_agent" ) );
56  if ( !a.isValid() ) {
57  kWarning() << "Could not get MDA instance.";
58  }
59  return a;
60 }
61 
62 void DispatcherInterface::dispatchManually()
63 {
64  Collection outbox =
65  SpecialMailCollections::self()->defaultCollection( SpecialMailCollections::Outbox );
66  if ( !outbox.isValid() ) {
67 // kError() << "Could not access Outbox.";
68  return;
69  }
70 
71  FilterActionJob *mjob = new FilterActionJob( outbox, new SendQueuedAction, sInstance );
72  QObject::connect( mjob, SIGNAL(result(KJob*)), sInstance, SLOT(massModifyResult(KJob*)) );
73 }
74 
75 void DispatcherInterface::retryDispatching()
76 {
77  Collection outbox =
78  SpecialMailCollections::self()->defaultCollection( SpecialMailCollections::Outbox );
79  if ( !outbox.isValid() ) {
80 // kError() << "Could not access Outbox.";
81  return;
82  }
83 
84  FilterActionJob *mjob = new FilterActionJob( outbox, new ClearErrorAction, sInstance );
85  QObject::connect( mjob, SIGNAL(result(KJob*)), sInstance, SLOT(massModifyResult(KJob*)) );
86 }
87 
88 void DispatcherInterface::dispatchManualTransport( int transportId )
89 {
90  Collection outbox =
91  SpecialMailCollections::self()->defaultCollection( SpecialMailCollections::Outbox );
92  if ( !outbox.isValid() ) {
93 // kError() << "Could not access Outbox.";
94  return;
95  }
96 
97  FilterActionJob *mjob =
98  new FilterActionJob( outbox, new DispatchManualTransportAction( transportId ), sInstance );
99  QObject::connect( mjob, SIGNAL(result(KJob*)), sInstance, SLOT(massModifyResult(KJob*)) );
100 }
101 
102 #include "moc_dispatcherinterface_p.cpp"
MailTransport::DispatchManualTransportAction
FilterAction that changes the transport for all messages and sets the "$QUEUED" 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 "$QUEUED" flag.
Definition: outboxactions_p.h:78
QLatin1String
QObject::connect
bool connect(const QObject *sender, const char *signal, const QObject *receiver, const char *method, Qt::ConnectionType type)
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-2020 The KDE developers.
Generated on Mon Jun 22 2020 13:37:48 by doxygen 1.8.7 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 API Reference

Skip menu "kdepimlibs 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

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