2 Copyright (c) 2010 Klarälvdalens Datakonsult AB, a KDAB Group company, info@kdab.com
3 Copyright (c) 2010 Andras Mantia <andras@kdab.com>
5 This library is free software; you can redistribute it and/or
6 modify it under the terms of the GNU Lesser General Public
7 License as published by the Free Software Foundation; either
8 version 2.1 of the License, or (at your option) any later version.
10 This library is distributed in the hope that it will be useful,
11 but WITHOUT ANY WARRANTY; without even the implied warranty of
12 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
13 Lesser General Public License for more details.
15 You should have received a copy of the GNU Lesser General Public
16 License along with this library; if not, write to the Free Software
17 Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
21 #include "mobilekernel.h"
22 #include <mailcommon/filteraction.h>
23 #include <mailcommon/filtermanager.h>
24 #include <mailcommon/mailkernel.h>
25 #include <mailcommon/jobscheduler.h>
26 #include <kpimidentities/identitymanager.h>
27 #include <messagecomposer/akonadisender.h>
29 using namespace MailCommon
;
31 static MobileKernel
* mySelf
= 0;
33 MobileKernel::MobileKernel() : mMonitor( 0 ), mCollectionModel( 0 ), mMessageSender( 0 ), mConfig( 0 )
37 mJobScheduler
= new JobScheduler(0);
38 mIdentityManager
= new KPIMIdentities::IdentityManager( false, 0, "mIdentityManager" );
40 mMessageSender
= new AkonadiSender
;
41 CommonKernel
->registerKernelIf( this ); //register KernelIf early, it is used by the Filter classes
43 mFilterManager
= new FilterManager();
44 mFilterActionDict
= new FilterActionDict();
45 CommonKernel
->registerFilterIf( this );
47 //readConfig needs the registered FilterIf above
48 mFilterManager
->readConfig();
50 CommonKernel
->registerSettingsIf( this );
53 MobileKernel::~MobileKernel()
56 delete mIdentityManager
;
57 delete mMessageSender
;
60 MobileKernel
* MobileKernel::self()
63 mySelf
= new MobileKernel();
69 void MobileKernel::updateSystemTray()
71 //TODO: if it is needed at all
74 void MobileKernel::syncConfig()
79 KSharedConfig::Ptr
MobileKernel::config()
83 mConfig
= KSharedConfig::openConfig( "kmail-mobilerc" );
89 KPIMIdentities::IdentityManager
* MobileKernel::identityManager()
91 return mIdentityManager
;
94 MessageSender
* MobileKernel::msgSender()
96 return mMessageSender
;
100 void MobileKernel::setLastSelectedFolder(const Akonadi::Entity::Id
& col
)
105 Akonadi::Entity::Id
MobileKernel::lastSelectedFolder()
107 return -1; //this was the default on Kmail desktop
110 qreal
MobileKernel::closeToQuotaThreshold()
112 return 80; //this was the default on Kmail desktop
115 bool MobileKernel::excludeImportantMailFromExpiry()
117 return true;//this was the default on Kmail desktop
120 bool MobileKernel::showPopupAfterDnD()
125 QStringList
MobileKernel::customTemplates()
127 return QStringList(); //TODO: implement
130 FilterManager
* MobileKernel::filterManager() const
132 return mFilterManager
;
135 FilterActionDict
* MobileKernel::filterActionDict() const
137 return mFilterActionDict
;
140 void MobileKernel::openFilterDialog( bool createDummyFilter
)
142 //TODO: Implement filter dialog for mobile
143 Q_UNUSED( createDummyFilter
);
146 void MobileKernel::createFilter(const QByteArray
& field
, const QString
& value
)
148 //TODO: Implement for mobile (call the dialog with predefined values)