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

kmail

  • sources
  • kde-4.14
  • kdepim
  • kmail
  • folderarchive
folderarchiveaccountinfo.cpp
Go to the documentation of this file.
1 /*
2  Copyright (c) 2013-2015 Montel Laurent <montel@kde.org>
3 
4  This program is free software; you can redistribute it and/or modify it
5  under the terms of the GNU General Public License, version 2, as
6  published by the Free Software Foundation.
7 
8  This program is distributed in the hope that it will be useful, but
9  WITHOUT ANY WARRANTY; without even the implied warranty of
10  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
11  General Public License for more details.
12 
13  You should have received a copy of the GNU General Public License along
14  with this program; if not, write to the Free Software Foundation, Inc.,
15  51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
16 */
17 
18 #include "folderarchiveaccountinfo.h"
19 
20 #include <KConfigGroup>
21 
22 FolderArchiveAccountInfo::FolderArchiveAccountInfo()
23  : mArchiveTopLevelCollectionId(-1),
24  mArchiveType(UniqueFolder),
25  mEnabled(false),
26  mKeepExistingStructure(false)
27 {
28 }
29 
30 FolderArchiveAccountInfo::FolderArchiveAccountInfo(const KConfigGroup &config)
31  : mArchiveTopLevelCollectionId(-1),
32  mArchiveType(UniqueFolder),
33  mEnabled(false),
34  mKeepExistingStructure(false)
35 {
36  readConfig(config);
37 }
38 
39 FolderArchiveAccountInfo::~FolderArchiveAccountInfo()
40 {
41 }
42 
43 bool FolderArchiveAccountInfo::isValid() const
44 {
45  return (mArchiveTopLevelCollectionId > -1) && (!mInstanceName.isEmpty());
46 }
47 
48 void FolderArchiveAccountInfo::setFolderArchiveType(FolderArchiveAccountInfo::FolderArchiveType type)
49 {
50  mArchiveType = type;
51 }
52 
53 FolderArchiveAccountInfo::FolderArchiveType FolderArchiveAccountInfo::folderArchiveType() const
54 {
55  return mArchiveType;
56 }
57 
58 void FolderArchiveAccountInfo::setArchiveTopLevel(Akonadi::Collection::Id id)
59 {
60  mArchiveTopLevelCollectionId = id;
61 }
62 
63 Akonadi::Collection::Id FolderArchiveAccountInfo::archiveTopLevel() const
64 {
65  return mArchiveTopLevelCollectionId;
66 }
67 
68 QString FolderArchiveAccountInfo::instanceName() const
69 {
70  return mInstanceName;
71 }
72 
73 void FolderArchiveAccountInfo::setInstanceName(const QString &instance)
74 {
75  mInstanceName = instance;
76 }
77 
78 void FolderArchiveAccountInfo::setEnabled(bool enabled)
79 {
80  mEnabled = enabled;
81 }
82 
83 bool FolderArchiveAccountInfo::enabled() const
84 {
85  return mEnabled;
86 }
87 
88 void FolderArchiveAccountInfo::setKeepExistingStructure(bool b)
89 {
90  mKeepExistingStructure = b;
91 }
92 
93 bool FolderArchiveAccountInfo::keepExistingStructure() const
94 {
95  return mKeepExistingStructure;
96 }
97 
98 void FolderArchiveAccountInfo::readConfig(const KConfigGroup &config)
99 {
100  mInstanceName = config.readEntry(QLatin1String("instanceName"));
101  mArchiveTopLevelCollectionId = config.readEntry(QLatin1String("topLevelCollectionId"), -1);
102  mArchiveType = static_cast<FolderArchiveType>(config.readEntry("folderArchiveType", (int)UniqueFolder));
103  mEnabled = config.readEntry("enabled", false);
104  mKeepExistingStructure = config.readEntry("keepExistingStructure", false);
105 }
106 
107 void FolderArchiveAccountInfo::writeConfig(KConfigGroup &config )
108 {
109  config.writeEntry(QLatin1String("instanceName"), mInstanceName);
110  if (mArchiveTopLevelCollectionId>-1)
111  config.writeEntry(QLatin1String("topLevelCollectionId"), mArchiveTopLevelCollectionId);
112  else
113  config.deleteEntry(QLatin1String("topLevelCollectionId"));
114 
115  config.writeEntry(QLatin1String("folderArchiveType"), (int)mArchiveType);
116  config.writeEntry(QLatin1String("enabled"), mEnabled);
117  config.writeEntry("keepExistingStructure", mKeepExistingStructure);
118 }
119 
120 bool FolderArchiveAccountInfo::operator==( const FolderArchiveAccountInfo& other ) const
121 {
122  return (mInstanceName == other.instanceName())
123  && (mArchiveTopLevelCollectionId == other.archiveTopLevel())
124  && (mArchiveType == other.folderArchiveType())
125  && (mEnabled == other.enabled())
126  && (mKeepExistingStructure == other.keepExistingStructure());
127 }
FolderArchiveAccountInfo::folderArchiveType
FolderArchiveType folderArchiveType() const
Definition: folderarchiveaccountinfo.cpp:53
FolderArchiveAccountInfo::setEnabled
void setEnabled(bool enabled)
Definition: folderarchiveaccountinfo.cpp:78
FolderArchiveAccountInfo::setKeepExistingStructure
void setKeepExistingStructure(bool b)
Definition: folderarchiveaccountinfo.cpp:88
FolderArchiveAccountInfo::setInstanceName
void setInstanceName(const QString &instance)
Definition: folderarchiveaccountinfo.cpp:73
FolderArchiveAccountInfo::instanceName
QString instanceName() const
Definition: folderarchiveaccountinfo.cpp:68
FolderArchiveAccountInfo::readConfig
void readConfig(const KConfigGroup &config)
Definition: folderarchiveaccountinfo.cpp:98
folderarchiveaccountinfo.h
FolderArchiveAccountInfo::~FolderArchiveAccountInfo
~FolderArchiveAccountInfo()
Definition: folderarchiveaccountinfo.cpp:39
FolderArchiveAccountInfo::isValid
bool isValid() const
Definition: folderarchiveaccountinfo.cpp:43
FolderArchiveAccountInfo::setArchiveTopLevel
void setArchiveTopLevel(Akonadi::Collection::Id id)
Definition: folderarchiveaccountinfo.cpp:58
FolderArchiveAccountInfo::setFolderArchiveType
void setFolderArchiveType(FolderArchiveType type)
Definition: folderarchiveaccountinfo.cpp:48
QString::isEmpty
bool isEmpty() const
FolderArchiveAccountInfo::FolderArchiveAccountInfo
FolderArchiveAccountInfo()
Definition: folderarchiveaccountinfo.cpp:22
FolderArchiveAccountInfo::writeConfig
void writeConfig(KConfigGroup &config)
Definition: folderarchiveaccountinfo.cpp:107
QString
FolderArchiveAccountInfo::archiveTopLevel
Akonadi::Collection::Id archiveTopLevel() const
Definition: folderarchiveaccountinfo.cpp:63
FolderArchiveAccountInfo
Definition: folderarchiveaccountinfo.h:24
FolderArchiveAccountInfo::enabled
bool enabled() const
Definition: folderarchiveaccountinfo.cpp:83
QLatin1String
FolderArchiveAccountInfo::UniqueFolder
Definition: folderarchiveaccountinfo.h:32
FolderArchiveAccountInfo::keepExistingStructure
bool keepExistingStructure() const
Definition: folderarchiveaccountinfo.cpp:93
FolderArchiveAccountInfo::operator==
bool operator==(const FolderArchiveAccountInfo &other) const
Definition: folderarchiveaccountinfo.cpp:120
FolderArchiveAccountInfo::FolderArchiveType
FolderArchiveType
Definition: folderarchiveaccountinfo.h:31
This file is part of the KDE documentation.
Documentation copyright © 1996-2020 The KDE developers.
Generated on Mon Jun 22 2020 13:34:32 by doxygen 1.8.7 written by Dimitri van Heesch, © 1997-2006

KDE's Doxygen guidelines are available online.

kmail

Skip menu "kmail"
  • Main Page
  • Namespace List
  • Namespace Members
  • Alphabetical List
  • Class List
  • Class Hierarchy
  • Class Members
  • File List
  • File Members

kdepim API Reference

Skip menu "kdepim API Reference"
  • akonadi_next
  • akregator
  • blogilo
  • calendarsupport
  • console
  •   kabcclient
  •   konsolekalendar
  • kaddressbook
  • kalarm
  •   lib
  • kdgantt2
  • kjots
  • kleopatra
  • kmail
  • knode
  • knotes
  • kontact
  • korgac
  • korganizer
  • ktimetracker
  • libkdepim
  • libkleo
  • libkpgp
  • mailcommon
  • messagelist
  • messageviewer
  • pimprint

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