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

mailtransport

  • mailtransport
sentbehaviourattribute.cpp
1/*
2 Copyright 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 "sentbehaviourattribute.h"
21
22
23#include <KDebug>
24
25using namespace Akonadi;
26using namespace MailTransport;
27
28class SentBehaviourAttribute::Private
29{
30 public:
31 SentBehaviour mBehaviour;
32 Akonadi::Collection mMoveToCollection;
33};
34
35SentBehaviourAttribute::SentBehaviourAttribute( SentBehaviour beh, Collection moveToCollection )
36 : d( new Private )
37{
38 d->mBehaviour = beh;
39 d->mMoveToCollection = moveToCollection;
40}
41
42SentBehaviourAttribute::~SentBehaviourAttribute()
43{
44 delete d;
45}
46
47SentBehaviourAttribute *SentBehaviourAttribute::clone() const
48{
49 return new SentBehaviourAttribute( d->mBehaviour, d->mMoveToCollection );
50}
51
52QByteArray SentBehaviourAttribute::type() const
53{
54 static const QByteArray sType( "SentBehaviourAttribute" );
55 return sType;
56}
57
58QByteArray SentBehaviourAttribute::serialized() const
59{
60 switch ( d->mBehaviour ) {
61 case Delete: return "delete";
62 case MoveToCollection: return "moveTo" + QByteArray::number( d->mMoveToCollection.id() );
63 case MoveToDefaultSentCollection: return "moveToDefault";
64 }
65
66 Q_ASSERT( false );
67 return QByteArray();
68}
69
70void SentBehaviourAttribute::deserialize( const QByteArray &data )
71{
72 d->mMoveToCollection = Akonadi::Collection( -1 );
73 if ( data == "delete" ) {
74 d->mBehaviour = Delete;
75 } else if ( data == "moveToDefault" ) {
76 d->mBehaviour = MoveToDefaultSentCollection;
77 } else if ( data.startsWith( QByteArray( "moveTo" ) ) ) {
78 d->mBehaviour = MoveToCollection;
79 d->mMoveToCollection = Akonadi::Collection( data.mid( 6 ).toLongLong() );
80 // NOTE: 6 is the strlen of "moveTo".
81 } else {
82 Q_ASSERT( false );
83 }
84}
85
86SentBehaviourAttribute::SentBehaviour SentBehaviourAttribute::sentBehaviour() const
87{
88 return d->mBehaviour;
89}
90
91void SentBehaviourAttribute::setSentBehaviour( SentBehaviour beh )
92{
93 d->mBehaviour = beh;
94}
95
96Collection SentBehaviourAttribute::moveToCollection() const
97{
98 return d->mMoveToCollection;
99}
100
101void SentBehaviourAttribute::setMoveToCollection( Collection moveToCollection )
102{
103 d->mMoveToCollection = moveToCollection;
104}
105
MailTransport::SentBehaviourAttribute
Attribute determining what will happen to a message after it is sent.
Definition sentbehaviourattribute.h:39
MailTransport::SentBehaviourAttribute::SentBehaviourAttribute
SentBehaviourAttribute(SentBehaviour beh=MoveToDefaultSentCollection, Akonadi::Collection moveToCollection=Akonadi::Collection(-1))
Creates a new SentBehaviourAttribute.
Definition sentbehaviourattribute.cpp:35
MailTransport::SentBehaviourAttribute::SentBehaviour
SentBehaviour
What to do with the item in the outbox after it has been sent successfully.
Definition sentbehaviourattribute.h:44
MailTransport::SentBehaviourAttribute::MoveToDefaultSentCollection
@ MoveToDefaultSentCollection
Move the item to the default sent-mail collection.
Definition sentbehaviourattribute.h:47
MailTransport::SentBehaviourAttribute::Delete
@ Delete
Delete the item from the outbox.
Definition sentbehaviourattribute.h:45
MailTransport::SentBehaviourAttribute::MoveToCollection
@ MoveToCollection
Move the item to a custom collection.
Definition sentbehaviourattribute.h:46
MailTransport::SentBehaviourAttribute::setSentBehaviour
void setSentBehaviour(SentBehaviour beh)
Sets the sent-behaviour of the message.
Definition sentbehaviourattribute.cpp:91
MailTransport::SentBehaviourAttribute::setMoveToCollection
void setMoveToCollection(Akonadi::Collection moveToCollection)
Sets the collection to which the item should be moved after it is sent.
Definition sentbehaviourattribute.cpp:101
MailTransport::SentBehaviourAttribute::sentBehaviour
SentBehaviour sentBehaviour() const
Returns the sent-behaviour of the message.
Definition sentbehaviourattribute.cpp:86
MailTransport::SentBehaviourAttribute::~SentBehaviourAttribute
virtual ~SentBehaviourAttribute()
Destroys the SentBehaviourAttribute.
Definition sentbehaviourattribute.cpp:42
MailTransport::SentBehaviourAttribute::moveToCollection
Akonadi::Collection moveToCollection() const
Returns the collection to which the item should be moved after it is sent.
Definition sentbehaviourattribute.cpp:96
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