2
Copyright (c) 2012 Montel Laurent <montel@kde.org>
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.
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.
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
18
#include "backupmailkernel.h"
21
#include <kpimidentities/identitymanager.h>
22
#include <messagecomposer/akonadisender.h>
23
#include <mailcommon/foldercollectionmonitor.h>
24
#include <akonadi/session.h>
25
#include <akonadi/entitytreemodel.h>
26
#include <akonadi/entitymimetypefiltermodel.h>
27
#include <akonadi/changerecorder.h>
29
BackupMailKernel::BackupMailKernel( QObject *parent )
32
mMessageSender = new AkonadiSender( this );
33
mIdentityManager = new KPIMIdentities::IdentityManager( false, this );
34
mFolderCollectionMonitor = new MailCommon::FolderCollectionMonitor( this );
36
Akonadi::Session *session = new Akonadi::Session( "Backup Mail Kernel ETM", this );
37
folderCollectionMonitor()->setSession( session );
38
mEntityTreeModel = new Akonadi::EntityTreeModel( folderCollectionMonitor(), this );
39
mEntityTreeModel->setIncludeUnsubscribed( false );
40
mEntityTreeModel->setItemPopulationStrategy( Akonadi::EntityTreeModel::LazyPopulation );
42
mCollectionModel = new Akonadi::EntityMimeTypeFilterModel( this );
43
mCollectionModel->setSourceModel( mEntityTreeModel );
44
mCollectionModel->addMimeTypeInclusionFilter( Akonadi::Collection::mimeType() );
45
mCollectionModel->setHeaderGroup( Akonadi::EntityTreeModel::CollectionTreeHeaders );
46
mCollectionModel->setDynamicSortFilter( true );
47
mCollectionModel->setSortCaseSensitivity( Qt::CaseInsensitive );
50
KPIMIdentities::IdentityManager *BackupMailKernel::identityManager()
52
return mIdentityManager;
55
MessageSender *BackupMailKernel::msgSender()
57
return mMessageSender;
60
Akonadi::EntityMimeTypeFilterModel *BackupMailKernel::collectionModel() const
62
return mCollectionModel;
65
KSharedConfig::Ptr BackupMailKernel::config()
67
return KGlobal::config();
70
void BackupMailKernel::syncConfig()
75
MailCommon::JobScheduler* BackupMailKernel::jobScheduler() const
81
Akonadi::ChangeRecorder *BackupMailKernel::folderCollectionMonitor() const
83
return mFolderCollectionMonitor->monitor();
86
void BackupMailKernel::updateSystemTray()
91
bool BackupMailKernel::showPopupAfterDnD()
96
qreal BackupMailKernel::closeToQuotaThreshold()
101
QStringList BackupMailKernel::customTemplates()
104
return QStringList();
107
bool BackupMailKernel::excludeImportantMailFromExpiry()
113
Akonadi::Entity::Id BackupMailKernel::lastSelectedFolder()
116
return Akonadi::Entity::Id();
119
void BackupMailKernel::setLastSelectedFolder(const Akonadi::Entity::Id& col)