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 "importwizardkernel.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 ImportWizardKernel::ImportWizardKernel( 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( "MailFilter 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
*ImportWizardKernel::identityManager()
52 return mIdentityManager
;
55 MessageSender
*ImportWizardKernel::msgSender()
57 return mMessageSender
;
60 Akonadi::EntityMimeTypeFilterModel
*ImportWizardKernel::collectionModel() const
62 return mCollectionModel
;
65 KSharedConfig::Ptr
ImportWizardKernel::config()
67 return KGlobal::config();
70 void ImportWizardKernel::syncConfig()
75 MailCommon::JobScheduler
* ImportWizardKernel::jobScheduler() const
81 Akonadi::ChangeRecorder
*ImportWizardKernel::folderCollectionMonitor() const
83 return mFolderCollectionMonitor
->monitor();
86 void ImportWizardKernel::updateSystemTray()
91 bool ImportWizardKernel::showPopupAfterDnD()
96 qreal
ImportWizardKernel::closeToQuotaThreshold()
101 QStringList
ImportWizardKernel::customTemplates()
104 return QStringList();
107 bool ImportWizardKernel::excludeImportantMailFromExpiry()
113 Akonadi::Entity::Id
ImportWizardKernel::lastSelectedFolder()
116 return Akonadi::Entity::Id();
119 void ImportWizardKernel::setLastSelectedFolder(const Akonadi::Entity::Id
& col
)