• Skip to content
  • Skip to link menu
  • KDE API Reference
  • kdepimlibs-4.14.10 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
28#include <akonadi/agentmanager.h>
29#include <akonadi/collection.h>
30#include <akonadi/kmime/specialmailcollections.h>
31#include "transportattribute.h"
32
33using namespace Akonadi;
34using namespace MailTransport;
35
36K_GLOBAL_STATIC( DispatcherInterfacePrivate, sInstance )
37
38void 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
48DispatcherInterface::DispatcherInterface()
49{
50}
51
52AgentInstance 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
62void 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
75void 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
88void 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"
Akonadi::FilterActionJob
Job to filter and apply an action on a set of items.
Definition filteractionjob_p.h:132
MailTransport::ClearErrorAction
FilterAction that finds all messages with an ErrorAttribute, removes the attribute,...
Definition outboxactions_p.h:79
MailTransport::DispatchManualTransportAction
FilterAction that changes the transport for all messages and sets the "$QUEUED" flag.
Definition outboxactions_p.h:114
MailTransport::DispatcherInterfacePrivate
Definition dispatcherinterface_p.h:32
MailTransport::DispatcherInterface::DispatcherInterface
DispatcherInterface()
Creates a new dispatcher interface.
Definition dispatcherinterface.cpp:48
MailTransport::DispatcherInterface::retryDispatching
void retryDispatching()
Looks for messages in the outbox with ErrorAttribute, and clears them and queues them again for sendi...
Definition dispatcherinterface.cpp:75
MailTransport::DispatcherInterface::dispatchManualTransport
void dispatchManualTransport(int transportId)
Looks for messages in the outbox with DispatchMode::Manual and changes the Transport for them to the ...
Definition dispatcherinterface.cpp:88
MailTransport::DispatcherInterface::dispatchManually
void dispatchManually()
Looks for messages in the outbox with DispatchMode::Manual and marks them DispatchMode::Automatic for...
Definition dispatcherinterface.cpp:62
MailTransport::DispatcherInterface::dispatcherInstance
Akonadi::AgentInstance dispatcherInstance() const
Returns the current instance of the mail dispatcher agent.
Definition dispatcherinterface.cpp:52
MailTransport::SendQueuedAction
FilterAction that finds all messages with a DispatchMode of Manual and assigns them a DispatchMode of...
Definition outboxactions_p.h:44
This file is part of the KDE documentation.
Documentation copyright © 1996-2024 The KDE developers.
Generated on Wed Jan 24 2024 00:00:00 by doxygen 1.10.0 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.14.10 API Reference

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