• 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
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 
25 using namespace Akonadi;
26 using namespace MailTransport;
27 
28 class SentBehaviourAttribute::Private
29 {
30  public:
31  SentBehaviour mBehaviour;
32  Akonadi::Collection mMoveToCollection;
33 };
34 
35 SentBehaviourAttribute::SentBehaviourAttribute( SentBehaviour beh, Collection moveToCollection )
36  : d( new Private )
37 {
38  d->mBehaviour = beh;
39  d->mMoveToCollection = moveToCollection;
40 }
41 
42 SentBehaviourAttribute::~SentBehaviourAttribute()
43 {
44  delete d;
45 }
46 
47 SentBehaviourAttribute *SentBehaviourAttribute::clone() const
48 {
49  return new SentBehaviourAttribute( d->mBehaviour, d->mMoveToCollection );
50 }
51 
52 QByteArray SentBehaviourAttribute::type() const
53 {
54  static const QByteArray sType( "SentBehaviourAttribute" );
55  return sType;
56 }
57 
58 QByteArray 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 
70 void 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 
86 SentBehaviourAttribute::SentBehaviour SentBehaviourAttribute::sentBehaviour() const
87 {
88  return d->mBehaviour;
89 }
90 
91 void SentBehaviourAttribute::setSentBehaviour( SentBehaviour beh )
92 {
93  d->mBehaviour = beh;
94 }
95 
96 Collection SentBehaviourAttribute::moveToCollection() const
97 {
98  return d->mMoveToCollection;
99 }
100 
101 void SentBehaviourAttribute::setMoveToCollection( Collection moveToCollection )
102 {
103  d->mMoveToCollection = moveToCollection;
104 }
105 
MailTransport::SentBehaviourAttribute::SentBehaviour
SentBehaviour
What to do with the item in the outbox after it has been sent successfully.
Definition: sentbehaviourattribute.h:44
QByteArray
MailTransport::SentBehaviourAttribute
Attribute determining what will happen to a message after it is sent.
Definition: sentbehaviourattribute.h:38
MailTransport::SentBehaviourAttribute::MoveToDefaultSentCollection
Move the item to the default sent-mail collection.
Definition: sentbehaviourattribute.h:47
QByteArray::startsWith
bool startsWith(const QByteArray &ba) const
MailTransport::SentBehaviourAttribute::Delete
Delete the item from the outbox.
Definition: sentbehaviourattribute.h:45
QByteArray::number
QByteArray number(int n, int base)
MailTransport::SentBehaviourAttribute::sentBehaviour
SentBehaviour sentBehaviour() const
Returns the sent-behaviour of the message.
Definition: sentbehaviourattribute.cpp:86
MailTransport::SentBehaviourAttribute::MoveToCollection
Move the item to a custom collection.
Definition: sentbehaviourattribute.h:46
MailTransport::SentBehaviourAttribute::~SentBehaviourAttribute
virtual ~SentBehaviourAttribute()
Destroys the SentBehaviourAttribute.
Definition: sentbehaviourattribute.cpp:42
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
QByteArray::mid
QByteArray mid(int pos, int len) const
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
QByteArray::toLongLong
qlonglong toLongLong(bool *ok, int base) const
MailTransport::SentBehaviourAttribute::SentBehaviourAttribute
SentBehaviourAttribute(SentBehaviour beh=MoveToDefaultSentCollection, Akonadi::Collection moveToCollection=Akonadi::Collection(-1))
Creates a new SentBehaviourAttribute.
Definition: sentbehaviourattribute.cpp:35
MailTransport::SentBehaviourAttribute::setSentBehaviour
void setSentBehaviour(SentBehaviour beh)
Sets the sent-behaviour of the message.
Definition: sentbehaviourattribute.cpp:91
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