Commit af2a236b authored by Laurent Montel's avatar Laurent Montel 😁
Browse files

Start to add class for archive mail agent

parent 5dff5e13
project(archivemailagent)
set(archivemailagent_SRCS
archivemailkernel.cpp
archivemailagent.cpp
)
#include_directories(${Boost_INCLUDE_DIR} ${CMAKE_SOURCE_DIR}/mailimporter )
......
/*
Copyright (c) 2012 Montel Laurent <montel@kde.org>
This program is free software; you can redistribute it and/or modify it
under the terms of the GNU General Public License, version 2, as
published by the Free Software Foundation.
This program is distributed in the hope that it will be useful, but
WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
General Public License for more details.
You should have received a copy of the GNU General Public License along
with this program; if not, write to the Free Software Foundation, Inc.,
51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
*/
#include "archivemailagent.h"
ArchiveMailAgent::ArchiveMailAgent( const QString &id )
: Akonadi::AgentBase( id )
{
}
ArchiveMailAgent::~ArchiveMailAgent()
{
}
AKONADI_AGENT_MAIN( ArchiveMailAgent )
/*
Copyright (c) 2012 Montel Laurent <montel@kde.org>
This program is free software; you can redistribute it and/or modify it
under the terms of the GNU General Public License, version 2, as
published by the Free Software Foundation.
This program is distributed in the hope that it will be useful, but
WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
General Public License for more details.
You should have received a copy of the GNU General Public License along
with this program; if not, write to the Free Software Foundation, Inc.,
51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
*/
#ifndef ARCHIVEMAILAGENT_H
#define ARCHIVEMAILAGENT_H
#include <akonadi/agentbase.h>
class ArchiveMailAgent : public Akonadi::AgentBase, public Akonadi::AgentBase::ObserverV2
{
Q_OBJECT
public:
explicit ArchiveMailAgent( const QString &id );
~ArchiveMailAgent();
};
#endif /* ARCHIVEMAILAGENT_H */
/*
Copyright (c) 2012 Montel Laurent <montel@kde.org>
This program is free software; you can redistribute it and/or modify it
under the terms of the GNU General Public License, version 2, as
published by the Free Software Foundation.
This program is distributed in the hope that it will be useful, but
WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
General Public License for more details.
You should have received a copy of the GNU General Public License along
with this program; if not, write to the Free Software Foundation, Inc.,
51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
*/
#include "archivemailkernel.h"
#include <KConfigGroup>
#include <kglobal.h>
#include <kpimidentities/identitymanager.h>
#include <mailcommon/foldercollectionmonitor.h>
#include <messagecomposer/akonadisender.h>
#include <akonadi/session.h>
#include <akonadi/entitytreemodel.h>
#include <akonadi/entitymimetypefiltermodel.h>
#include <akonadi/changerecorder.h>
ArchiveMailKernel::ArchiveMailKernel( QObject *parent )
: QObject( parent )
{
mIdentityManager = new KPIMIdentities::IdentityManager( false, this );
mFolderCollectionMonitor = new MailCommon::FolderCollectionMonitor( this );
Akonadi::Session *session = new Akonadi::Session( "Archive Mail Kernel ETM", this );
folderCollectionMonitor()->setSession( session );
mEntityTreeModel = new Akonadi::EntityTreeModel( folderCollectionMonitor(), this );
mEntityTreeModel->setIncludeUnsubscribed( false );
mEntityTreeModel->setItemPopulationStrategy( Akonadi::EntityTreeModel::LazyPopulation );
mCollectionModel = new Akonadi::EntityMimeTypeFilterModel( this );
mCollectionModel->setSourceModel( mEntityTreeModel );
mCollectionModel->addMimeTypeInclusionFilter( Akonadi::Collection::mimeType() );
mCollectionModel->setHeaderGroup( Akonadi::EntityTreeModel::CollectionTreeHeaders );
mCollectionModel->setDynamicSortFilter( true );
mCollectionModel->setSortCaseSensitivity( Qt::CaseInsensitive );
}
KPIMIdentities::IdentityManager *ArchiveMailKernel::identityManager()
{
return mIdentityManager;
}
MessageSender *ArchiveMailKernel::msgSender()
{
return 0;
}
Akonadi::EntityMimeTypeFilterModel *ArchiveMailKernel::collectionModel() const
{
return mCollectionModel;
}
KSharedConfig::Ptr ArchiveMailKernel::config()
{
return KGlobal::config();
}
void ArchiveMailKernel::syncConfig()
{
Q_ASSERT( false );
}
MailCommon::JobScheduler* ArchiveMailKernel::jobScheduler() const
{
Q_ASSERT( false );
return 0;
}
Akonadi::ChangeRecorder *ArchiveMailKernel::folderCollectionMonitor() const
{
return mFolderCollectionMonitor->monitor();
}
void ArchiveMailKernel::updateSystemTray()
{
Q_ASSERT( false );
}
bool ArchiveMailKernel::showPopupAfterDnD()
{
return false;
}
qreal ArchiveMailKernel::closeToQuotaThreshold()
{
return 80;
}
QStringList ArchiveMailKernel::customTemplates()
{
Q_ASSERT( false );
return QStringList();
}
bool ArchiveMailKernel::excludeImportantMailFromExpiry()
{
Q_ASSERT( false );
return true;
}
Akonadi::Entity::Id ArchiveMailKernel::lastSelectedFolder()
{
return Akonadi::Entity::Id();
}
void ArchiveMailKernel::setLastSelectedFolder(const Akonadi::Entity::Id& col)
{
}
/*
Copyright (c) 2012 Montel Laurent <montel@kde.org>
This program is free software; you can redistribute it and/or modify it
under the terms of the GNU General Public License, version 2, as
published by the Free Software Foundation.
This program is distributed in the hope that it will be useful, but
WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
General Public License for more details.
You should have received a copy of the GNU General Public License along
with this program; if not, write to the Free Software Foundation, Inc.,
51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
*/
#ifndef ARCHIVEMAILKERNEL_H
#define ARCHIVEMAILKERNEL_H
#include <mailcommon/mailinterfaces.h>
namespace Akonadi {
class EntityTreeModel;
class EntityMimeTypeFilterModel;
}
namespace MailCommon {
class FolderCollectionMonitor;
}
class ArchiveMailKernel : public QObject, public MailCommon::IKernel, public MailCommon::ISettings
{
public:
explicit ArchiveMailKernel( QObject *parent = 0 );
KPIMIdentities::IdentityManager *identityManager();
MessageSender *msgSender();
Akonadi::EntityMimeTypeFilterModel *collectionModel() const;
KSharedConfig::Ptr config();
void syncConfig();
MailCommon::JobScheduler* jobScheduler() const;
Akonadi::ChangeRecorder *folderCollectionMonitor() const;
void updateSystemTray();
qreal closeToQuotaThreshold();
bool excludeImportantMailFromExpiry();
QStringList customTemplates();
Akonadi::Entity::Id lastSelectedFolder();
void setLastSelectedFolder(const Akonadi::Entity::Id& col);
bool showPopupAfterDnD();
private:
KPIMIdentities::IdentityManager *mIdentityManager;
MailCommon::FolderCollectionMonitor *mFolderCollectionMonitor;
Akonadi::EntityTreeModel *mEntityTreeModel;
Akonadi::EntityMimeTypeFilterModel *mCollectionModel;
};
#endif
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment