13 #include <kpimutils/kfileio.h>
21 #include "utils/stringutil.h"
22 #include "util/mailutil.h"
23 #include "mailcommon/pop3settings.h"
24 #include "mailcommon/folder/foldertreeview.h"
25 #include "mailcommon/filter/kmfilterdialog.h"
26 #include "mailcommon/mailcommonsettings_base.h"
27 #include "pimcommon/util/pimutil.h"
29 #include "pimcommon/storageservice/storageservicemanager.h"
30 #include "pimcommon/storageservice/storageservicejobconfig.h"
34 #include "kdepim-version.h"
37 #include <kpimidentities/identity.h>
38 #include <kpimidentities/identitymanager.h>
39 #include <mailtransport/transport.h>
40 #include <mailtransport/transportmanager.h>
41 #include <mailtransport/dispatcherinterface.h>
42 #include <akonadi/servermanager.h>
45 #include <kwindowsystem.h>
48 #include "job/jobscheduler.h"
50 #include "messagecore/settings/globalsettings.h"
51 #include "messagelist/core/settings.h"
52 #include "messagelist/messagelistutil.h"
53 #include "messageviewer/settings/globalsettings.h"
54 #include "messagecomposer/sender/akonadisender.h"
55 #include "settings/messagecomposersettings.h"
56 #include "messagecomposer/helper/messagehelper.h"
57 #include "messagecomposer/settings/messagecomposersettings.h"
58 #include "pimcommon/settings/pimcommonsettings.h"
59 #include "pimcommon/autocorrection/autocorrection.h"
61 #include "templateparser/templateparser.h"
62 #include "templateparser/globalsettings_base.h"
63 #include "templateparser/templatesutil.h"
65 #include "foldercollection.h"
69 #include <kmessagebox.h>
70 #include <knotification.h>
72 #include <kstandarddirs.h>
74 #include <kpassivepopup.h>
75 #include <kapplication.h>
76 #include <ksystemtrayicon.h>
77 #include <kconfiggroup.h>
79 #include <kio/jobuidelegate.h>
83 #include <kmime/kmime_message.h>
84 #include <kmime/kmime_util.h>
85 #include <Akonadi/Collection>
86 #include <Akonadi/CollectionFetchJob>
87 #include <Akonadi/ChangeRecorder>
88 #include <Akonadi/ItemFetchScope>
89 #include <Akonadi/AgentManager>
90 #include <Akonadi/ItemFetchJob>
91 #include <Akonadi/AttributeFactory>
92 #include <Akonadi/Session>
93 #include <Akonadi/EntityTreeModel>
94 #include <akonadi/entitymimetypefiltermodel.h>
95 #include <Akonadi/CollectionStatisticsJob>
100 #include <QtDBus/QtDBus>
102 #include <sys/types.h>
104 #include <sys/stat.h>
110 #include <kcmdlineargs.h>
111 #include <kstartupinfo.h>
112 #include <kmailadaptor.h>
113 #include "kmailinterface.h"
114 #include "foldercollectionmonitor.h"
115 #include "imapresourcesettings.h"
117 #include "mailcommon/kernel/mailkernel.h"
121 using namespace MailCommon;
134 mSystemNetworkStatus ( Solid::Networking::status() ),
138 if (!qgetenv(
"KDEPIM_BALOO_DEBUG").isEmpty()) {
141 Akonadi::AttributeFactory::registerAttribute<Akonadi::SearchDescriptionAttribute>();
144 kDebug() <<
"Starting up...";
147 the_firstInstance =
true;
151 mFilterEditDialog = 0;
160 mJobScheduler =
new JobScheduler(
this );
161 mXmlGuiInstance = KComponentData();
163 mAutoCorrection =
new PimCommon::AutoCorrection();
164 KMime::setFallbackCharEncoding( MessageCore::GlobalSettings::self()->fallbackCharacterEncoding() );
165 KMime::setUseOutlookAttachmentEncoding( MessageComposer::MessageComposerSettings::self()->outlookCompatibleAttachments() );
179 #if defined Q_WS_WIN || defined Q_WS_MACX
191 Akonadi::Session *session =
new Akonadi::Session(
"KMail Kernel ETM",
this );
193 mFolderCollectionMonitor =
new FolderCollectionMonitor( session,
this );
195 connect( mFolderCollectionMonitor->monitor(), SIGNAL(collectionRemoved(Akonadi::Collection)), SLOT(slotCollectionRemoved(Akonadi::Collection)));
198 mEntityTreeModel->setIncludeUnsubscribed(
false );
199 mEntityTreeModel->setItemPopulationStrategy( Akonadi::EntityTreeModel::LazyPopulation );
201 mCollectionModel =
new Akonadi::EntityMimeTypeFilterModel(
this );
202 mCollectionModel->setSourceModel( mEntityTreeModel );
203 mCollectionModel->addMimeTypeInclusionFilter( Akonadi::Collection::mimeType() );
204 mCollectionModel->setHeaderGroup( Akonadi::EntityTreeModel::CollectionTreeHeaders );
205 mCollectionModel->setDynamicSortFilter(
true );
206 mCollectionModel->setSortCaseSensitivity( Qt::CaseInsensitive );
212 connect( MailTransport::TransportManager::self(),
213 SIGNAL(transportRemoved(
int,
QString)),
214 SLOT(transportRemoved(
int,
QString)) );
215 connect( MailTransport::TransportManager::self(),
220 connect( Akonadi::AgentManager::self(), SIGNAL(instanceStatusChanged(Akonadi::AgentInstance)),
221 this, SLOT(instanceStatusChanged(Akonadi::AgentInstance)) );
223 connect( Akonadi::AgentManager::self(), SIGNAL(instanceError(Akonadi::AgentInstance,
QString)),
224 this, SLOT(slotInstanceError(Akonadi::AgentInstance,
QString)) );
226 connect( Akonadi::AgentManager::self(), SIGNAL(instanceWarning(Akonadi::AgentInstance,
QString)),
227 SLOT(slotInstanceWarning(Akonadi::AgentInstance,
QString)) );
229 connect( Akonadi::AgentManager::self(), SIGNAL(instanceRemoved(Akonadi::AgentInstance)),
230 this, SLOT(slotInstanceRemoved(Akonadi::AgentInstance)) );
232 connect ( Solid::Networking::notifier(), SIGNAL(statusChanged(Solid::Networking::Status)),
233 this, SLOT(slotSystemNetworkStatusChanged(Solid::Networking::Status)) );
240 CommonKernel->registerKernelIf(
this );
241 CommonKernel->registerSettingsIf(
this );
242 CommonKernel->registerFilterIf(
this );
244 mStorageManager =
new PimCommon::StorageServiceManager(
this);
246 PimCommon::StorageServiceJobConfig *configJob = PimCommon::StorageServiceJobConfig::self();
247 configJob->registerConfigIf(settingsJob);
260 delete mAutoCorrection;
267 return mFolderCollectionMonitor->monitor();
272 return mEntityTreeModel;
277 return mCollectionModel;
282 (void)
new KmailAdaptor(
this );
290 if ( url.protocol().isEmpty() ) {
292 return KUrl( newUrl );
301 QString to, cc, bcc, subj, body, inReplyTo, replyTo;
304 KUrl::List attachURLs;
307 bool viewOnly =
false;
308 bool calledWithSession =
false;
311 KCmdLineArgs *args = KCmdLineArgs::parsedArgs();
312 if (args->isSet(
"subject"))
314 subj = args->getOption(
"subject");
324 calledWithSession =
true;
330 if (args->isSet(
"cc"))
333 cc = args->getOption(
"cc");
336 if (args->isSet(
"bcc"))
339 bcc = args->getOption(
"bcc");
342 if (args->isSet(
"replyTo"))
345 replyTo = args->getOption(
"replyTo");
349 if (args->isSet(
"msg"))
352 const QString file = args->getOption(
"msg");
356 if (args->isSet(
"body"))
359 body = args->getOption(
"body");
362 const QStringList attachList = args->getOptionList(
"attach");
368 if ( !(*it).isEmpty() ) {
376 customHeaders = args->getOptionList(
"header");
378 if (args->isSet(
"composer"))
381 if (args->isSet(
"check"))
384 if ( args->isSet(
"view" ) ) {
387 args->getOption(
"view" );
388 messageFile = KUrl( filename );
389 if ( !messageFile.isValid() ) {
390 messageFile = KUrl();
391 messageFile.setPath( filename );
395 if ( !calledWithSession ) {
398 const int nbArgs = args->count();
399 for (
int i= 0; i < nbArgs; ++i)
401 if ( args->arg(i).startsWith(
QLatin1String(
"mailto:" ), Qt::CaseInsensitive ) ) {
422 if (url.isValid() && !url.protocol().isEmpty())
435 if ( !calledWithSession )
438 if ( !noArgsOpensReader && !mailto && !checkMail && !viewOnly )
444 action( mailto, checkMail, to, cc, bcc, subj, body, messageFile,
445 attachURLs, customHeaders, replyTo, inReplyTo );
459 const Akonadi::AgentInstance::List lst = MailCommon::Util::agentInstances();
460 foreach( Akonadi::AgentInstance type, lst ) {
461 const QString id = type.identifier();
463 if ( group.readEntry(
"IncludeInManualChecks",
true ) ) {
464 if ( !type.isOnline() )
465 type.setIsOnline(
true );
466 if ( mResourcesBeingChecked.
isEmpty() ) {
467 kDebug() <<
"Starting manual mail check";
471 if ( !mResourcesBeingChecked.
contains(
id ) ) {
472 mResourcesBeingChecked.
append(
id );
489 const Akonadi::AgentInstance::List lst = MailCommon::Util::agentInstances();
490 foreach (
const Akonadi::AgentInstance& type, lst )
494 accountLst<<type.identifier();
505 Akonadi::AgentInstance agent = Akonadi::AgentManager::self()->instance( account );
506 if ( agent.isValid() )
509 kDebug() <<
"- account with name '" << account <<
"' not found";
516 KMainWindow *ktmw = 0;
519 foreach ( KMainWindow *window, KMainWindow::memberList() )
521 if ( ::qobject_cast<KMMainWin *>( window ) )
531 activate = !onlyCheck;
544 #if defined Q_WS_X11 && ! defined K_WS_QTONLY
545 KStartupInfo::setNewStartupId( mWin, kapp->startupId() );
552 const QString &body,
bool hidden,
559 KMime::Message::Ptr msg(
new KMime::Message );
561 msg->contentType()->setCharset(
"utf-8");
563 msg->to()->fromUnicodeString( to,
"utf-8" );
566 msg->cc()->fromUnicodeString( cc,
"utf-8" );
569 msg->bcc()->fromUnicodeString( bcc,
"utf-8" );
572 msg->subject()->fromUnicodeString( subject,
"utf-8" );
574 KUrl messageUrl = KUrl( messageFile );
575 if ( !messageUrl.isEmpty() && messageUrl.isLocalFile() ) {
576 const QByteArray str = KPIMUtils::kFileToByteArray( messageUrl.toLocalFile(),
true, false );
582 TemplateParser::TemplateParser parser( msg, TemplateParser::TemplateParser::NewMessage );
584 parser.process( msg );
589 msg->setBody( body.
toUtf8() );
592 TemplateParser::TemplateParser parser( msg, TemplateParser::TemplateParser::NewMessage );
594 parser.process( msg );
598 KMime::Headers::InReplyTo *header =
new KMime::Headers::InReplyTo( msg.get(), inReplyTo,
"utf-8" );
599 msg->setHeader( header );
603 KMail::Composer * cWin = KMail::makeComposer( msg,
false,
false, context );
606 KUrl::List attachURLs = KUrl::List( attachmentPaths );
607 KUrl::List::ConstIterator endAttachment(attachURLs.constEnd());
608 for ( KUrl::List::ConstIterator it = attachURLs.constBegin() ; it != endAttachment; ++it ) {
609 if( KMimeType::findByUrl( *it )->name() ==
QLatin1String(
"inode/directory" ) ) {
610 if(KMessageBox::questionYesNo(0, i18n(
"Do you want to attach this folder \"%1\"?",(*it).prettyUrl()), i18n(
"Attach Folder")) == KMessageBox::No ) {
620 if (!customHeaders.
isEmpty()) {
624 if ( !(*it).isEmpty() ) {
635 if (!extraCustomHeaders.
isEmpty())
642 #if defined Q_WS_X11 && ! defined K_WS_QTONLY
643 KStartupInfo::setNewStartupId( cWin, kapp->startupId() );
651 const QString &body,
bool hidden,
658 const QString &attachParamValue,
661 unsigned int identity )
664 KMime::Message::Ptr msg(
new KMime::Message );
665 KMime::Content *msgPart = 0;
667 msg->contentType()->setCharset(
"utf-8" );
668 if ( !cc.
isEmpty() ) msg->cc()->fromUnicodeString( cc,
"utf-8" );
669 if ( !bcc.
isEmpty() ) msg->bcc()->fromUnicodeString( bcc,
"utf-8" );
670 if ( !subject.
isEmpty() ) msg->subject()->fromUnicodeString( subject,
"utf-8" );
671 if ( !to.
isEmpty() ) msg->to()->fromUnicodeString( to,
"utf-8" );
672 if ( identity > 0 ) {
673 KMime::Headers::Generic *h =
new KMime::Headers::Generic(
"X-KMail-Identity", msg.get(),
QByteArray::number( identity ) );
677 msg->setBody(body.
toUtf8());
680 TemplateParser::TemplateParser parser( msg, TemplateParser::TemplateParser::NewMessage );
682 parser.process( KMime::Message::Ptr() );
685 bool iCalAutoSend =
false;
686 bool noWordWrap =
false;
687 bool isICalInvitation =
false;
689 isICalInvitation = (attachName ==
QLatin1String(
"cal.ics")) &&
690 attachType ==
"text" &&
691 attachSubType ==
"calendar" &&
692 attachParamAttr ==
"method";
694 if ( isICalInvitation && bcc.
isEmpty() )
696 if ( isICalInvitation &&
697 MessageViewer::GlobalSettings::self()->legacyBodyInvites() ) {
699 msg->setBody( attachData );
701 msg->contentType()->from7BitString(
703 "charset=\"utf-8\"" ).
704 arg( attachParamValue ).toLatin1() );
710 msgPart =
new KMime::Content;
711 msgPart->contentTransferEncoding()->fromUnicodeString(
QLatin1String(attachCte),
"utf-8" );
712 msgPart->setBody( attachData );
713 msgPart->contentType()->setMimeType( attachType +
'/' + attachSubType );
714 msgPart->contentType()->setParameter(
QLatin1String(attachParamAttr), attachParamValue );
715 if( ! MessageViewer::GlobalSettings::self()->exchangeCompatibleInvitations() ) {
716 msgPart->contentDisposition()->fromUnicodeString(
QLatin1String(attachContDisp),
"utf-8" );
718 if( !attachCharset.
isEmpty() ) {
720 msgPart->contentType()->setCharset( attachCharset );
723 msgPart->contentType()->setName( attachName,
"utf-8" );
726 iCalAutoSend = MessageViewer::GlobalSettings::self()->automaticSending();
731 KMail::Composer * cWin = KMail::makeComposer( KMime::Message::Ptr(),
false,
false,context );
732 cWin->
setMessage( msg,
false,
false, !isICalInvitation );
734 && MessageViewer::GlobalSettings::self()->legacyBodyInvites() );
739 if ( isICalInvitation ) {
745 if ( !hidden && !iCalAutoSend ) {
749 #if defined Q_WS_X11 && ! defined K_WS_QTONLY
750 KStartupInfo::setNewStartupId( cWin, kapp->startupId() );
766 const QString &body,
bool hidden )
768 KMime::Message::Ptr msg(
new KMime::Message );
770 msg->contentType()->setCharset(
"utf-8");
771 if ( !cc.
isEmpty() ) msg->cc()->fromUnicodeString( cc,
"utf-8" );
772 if ( !bcc.
isEmpty() ) msg->bcc()->fromUnicodeString( bcc,
"utf-8" );
773 if ( !subject.
isEmpty() ) msg->subject()->fromUnicodeString( subject,
"utf-8" );
774 if ( !to.
isEmpty() ) msg->to()->fromUnicodeString( to,
"utf-8" );
776 msg->setBody( body.
toUtf8() );
778 TemplateParser::TemplateParser parser( msg, TemplateParser::TemplateParser::NewMessage );
780 parser.process( KMime::Message::Ptr() );
786 KMail::Composer * cWin = KMail::makeComposer( msg,
false,
false, context );
791 #if defined Q_WS_X11 && ! defined K_WS_QTONLY
792 KStartupInfo::setNewStartupId( cWin, kapp->startupId() );
812 KUrl attachURL( _attachURL );
813 KMime::Message::Ptr msg(
new KMime::Message );
819 folder = currentFolderCollection();
820 id = folder ? folder->identity() : 0;
823 msg->contentType()->setCharset(
"utf-8" );
825 if ( !cc.
isEmpty() ) msg->cc()->fromUnicodeString( cc,
"utf-8" );
826 if ( !bcc.
isEmpty() ) msg->bcc()->fromUnicodeString( bcc,
"utf-8" );
827 if ( !to.
isEmpty() ) msg->to()->fromUnicodeString( to,
"utf-8" );
830 TemplateParser::TemplateParser parser( msg, TemplateParser::TemplateParser::NewMessage );
832 Akonadi::Collection col = folder ? folder->collection() : Akonadi::Collection();
833 parser.process( msg, col );
839 if ( !attachURL.isEmpty() && attachURL.isValid() ) {
854 openCommand->
start();
867 kError() <<
"Communication problem with KMail. "
868 <<
"Error message was:" << err.
name() <<
": \"" << err.
message() <<
"\"";
878 foreach ( KMainWindow* window, KMainWindow::memberList() ) {
882 mainWidget = l.
first();
883 if ( window->isActiveWindow() )
888 Akonadi::ItemFetchJob *job =
new Akonadi::ItemFetchJob( Akonadi::Item(serialNumber ),
this );
889 job->fetchScope().fetchFullPayload();
891 if ( job->items().count() >= 1 ) {
893 win->
showMessage( MessageCore::GlobalSettings::self()->overrideCharacterEncoding(),
894 job->items().at( 0 ) );
905 mBackgroundTasksTimer->
stop();
906 mJobScheduler->pause();
911 mJobScheduler->resume();
912 mBackgroundTasksTimer->
start( 4 * 60 * 60 * 1000 );
922 GlobalSettings::setNetworkState( GlobalSettings::EnumNetworkState::Offline );
923 BroadcastStatus::instance()->setStatusMsg( i18n(
"KMail is set to be offline; all network jobs are suspended"));
924 emit
onlineStatusChanged( (GlobalSettings::EnumNetworkState::type)GlobalSettings::networkState() );
930 const Akonadi::AgentInstance::List lst = MailCommon::Util::agentInstances(
false);
931 foreach ( Akonadi::AgentInstance type, lst ) {
932 const QString identifier( type.identifier() );
933 if ( PimCommon::Util::isImapResource(identifier) ||
934 identifier.contains( POP3_RESOURCE_IDENTIFIER ) ||
935 identifier.contains(
QLatin1String(
"akonadi_maildispatcher_agent") ) ||
936 type.type().capabilities().contains(
QLatin1String(
"NeedsNetwork")) ) {
937 type.setIsOnline( goOnline );
940 if ( goOnline && MessageComposer::MessageComposerSettings::self()->sendImmediate() ) {
941 const qint64 nbMsgOutboxCollection = MailCommon::Util::updatedCollection( CommonKernel->outboxCollectionFolder() ).statistics().
count();
942 if(nbMsgOutboxCollection > 0) {
943 kmkernel->msgSender()->sendQueued();
953 if ( ( mSystemNetworkStatus == Solid::Networking::Connected ) ||
954 ( mSystemNetworkStatus == Solid::Networking::Unknown ) ) {
956 BroadcastStatus::instance()->setStatusMsg( i18n(
"KMail is set to be online; all network jobs resumed"));
959 BroadcastStatus::instance()->setStatusMsg( i18n (
"KMail is set to be online; all network jobs will resume when a network connection is detected" ) );
961 GlobalSettings::setNetworkState( GlobalSettings::EnumNetworkState::Online );
962 emit
onlineStatusChanged( (GlobalSettings::EnumNetworkState::type)GlobalSettings::networkState() );
971 Solid::Networking::Status networkStatus = Solid::Networking::status();
973 ( networkStatus == Solid::Networking::Unconnected ) ||
974 ( networkStatus == Solid::Networking::Disconnecting ) ||
975 ( networkStatus == Solid::Networking::Connecting ))
981 void KMKernel::verifyAccount()
985 const Akonadi::AgentInstance::List lst = MailCommon::Util::agentInstances();
986 foreach( Akonadi::AgentInstance type, lst ) {
987 KConfigGroup group(
KMKernel::config(), resourceGroupPattern.arg( type.identifier() ) );
988 if ( group.readEntry(
"CheckOnStartup",
false ) ) {
989 if ( !type.isOnline() )
990 type.setIsOnline(
true );
995 if ( group.readEntry(
"OfflineOnShutdown",
false ) ) {
996 if ( !type.isOnline() )
997 type.setIsOnline(
true );
1002 void KMKernel::slotCheckAccount(Akonadi::ServerManager::State state)
1004 if (state == Akonadi::ServerManager::Running) {
1005 disconnect(Akonadi::ServerManager::self(), SIGNAL(stateChanged(Akonadi::ServerManager::State)));
1015 if (Akonadi::ServerManager::state() != Akonadi::ServerManager::Running) {
1016 connect(Akonadi::ServerManager::self(), SIGNAL(stateChanged(Akonadi::ServerManager::State)),
1017 SLOT(slotCheckAccount(Akonadi::ServerManager::State)));
1034 i18n(
"KMail is currently in offline mode. "
1035 "How do you want to proceed?"),
1036 i18n(
"Online/Offline"),
1037 KGuiItem(i18n(
"Work Online")),
1038 KGuiItem(i18n(
"Work Offline")));
1041 if( rc == KMessageBox::No ) {
1053 void KMKernel::slotSystemNetworkStatusChanged( Solid::Networking::Status status )
1055 mSystemNetworkStatus = status;
1059 if ( status == Solid::Networking::Connected || status == Solid::Networking::Unknown) {
1060 BroadcastStatus::instance()->setStatusMsg( i18n(
1061 "Network connection detected, all network jobs resumed") );
1062 kmkernel->setAccountStatus(
true );
1065 BroadcastStatus::instance()->setStatusMsg( i18n(
1066 "No network connection detected, all network jobs are suspended"));
1067 kmkernel->setAccountStatus(
false );
1132 QDir dir( pathName );
1138 foreach(
const QFileInfo &file, autoSaveFiles ) {
1147 if( autoSaveFile.open( QIODevice::ReadOnly ) ) {
1148 const KMime::Message::Ptr autoSaveMessage(
new KMime::Message() );
1149 const QByteArray msgData = autoSaveFile.readAll();
1150 autoSaveMessage->setContent( msgData );
1151 autoSaveMessage->parse();
1155 autoSaveWin->
setMessage( autoSaveMessage,
false,
false,
false );
1157 autoSaveWin->show();
1158 autoSaveFile.close();
1160 KMessageBox::sorry( 0, i18n(
"Failed to open autosave file at %1.\nReason: %2" ,
1162 i18n(
"Opening Autosave File Failed" ) );
1168 void KMKernel::akonadiStateChanged( Akonadi::ServerManager::State state )
1170 kDebug() <<
"KMKernel has akonadi state changed to:" << int( state );
1172 if( state == Akonadi::ServerManager::Running ) {
1173 CommonKernel->initFolders();
1178 fprintf( stderr,
"*** KMail got signal %d (Exiting)\n", sigId );
1182 fprintf( stderr,
"*** Dead letters dumped.\n" );
1189 the_shuttingDown =
false;
1199 the_msgSender =
new MessageComposer::AkonadiSender;
1202 mBackgroundTasksTimer =
new QTimer(
this );
1205 #ifdef DEBUG_SCHEDULER // for debugging, see jobscheduler.h
1206 mBackgroundTasksTimer->
start( 10000 );
1208 mBackgroundTasksTimer->
start( 5 * 60000 );
1213 kDebug() <<
"KMail init with akonadi server state:" << int( Akonadi::ServerManager::state() );
1214 if( Akonadi::ServerManager::state() == Akonadi::ServerManager::Running ) {
1215 CommonKernel->initFolders();
1218 connect( Akonadi::ServerManager::self(), SIGNAL(stateChanged(Akonadi::ServerManager::State)),
this, SLOT(akonadiStateChanged(Akonadi::ServerManager::State)) );
1225 if (kapp->isSessionRestored()){
1227 while (KMMainWin::canBeRestored(n)){
1229 if (KMMainWin::classNameOfToplevel(n) ==
QLatin1String(
"KMMainWin"))
1242 foreach ( KMainWindow* window, KMainWindow::memberList() ) {
1243 if ( ::qobject_cast<KMMainWin *>(window) ||
1244 ::qobject_cast<KMail::SecondaryWindow *>(window) )
1247 window->setAttribute(Qt::WA_DeleteOnClose);
1249 windowsToDelete.
append( window );
1266 qDeleteAll( windowsToDelete );
1267 windowsToDelete.
clear();
1272 disconnect( Akonadi::AgentManager::self(), SIGNAL(instanceStatusChanged(Akonadi::AgentInstance)));
1273 disconnect( Akonadi::AgentManager::self(), SIGNAL(instanceError(Akonadi::AgentInstance,
QString)));
1274 disconnect( Akonadi::AgentManager::self(), SIGNAL(instanceWarning(Akonadi::AgentInstance,
QString)));
1275 disconnect( Akonadi::AgentManager::self(), SIGNAL(instanceRemoved(Akonadi::AgentInstance)));
1276 disconnect ( Solid::Networking::notifier(), SIGNAL(statusChanged(Solid::Networking::Status)));
1281 the_shuttingDown =
true;
1286 MailCommon::FolderCollection::clearCache();
1289 delete the_msgSender;
1291 delete the_undoStack;
1295 Akonadi::Collection trashCollection = CommonKernel->trashCollectionFolder();
1296 if ( trashCollection.isValid() ) {
1298 Akonadi::CollectionStatisticsJob *jobStatistics =
new Akonadi::CollectionStatisticsJob( trashCollection );
1299 if ( jobStatistics->exec() ) {
1300 if ( jobStatistics->statistics().count() > 0 ) {
1301 mFolderCollectionMonitor->expunge( trashCollection,
true );
1306 delete mConfigureDialog;
1307 mConfigureDialog = 0;
1312 if ( RecentAddresses::exists() )
1313 RecentAddresses::self( config.data() )->save( config.data() );
1322 foreach ( KMainWindow* window, KMainWindow::memberList() ) {
1323 if (
KMail::Composer * win = ::qobject_cast<KMail::Composer*>( window ) ) {
1324 win->autoSaveMessage(
true);
1326 while ( win->isComposing() ) {
1327 kWarning() <<
"Danger, using an event loop, this should no longer be happening!";
1328 qApp->processEvents();
1339 const KUrl &messageFile,
1340 const KUrl::List &attachURLs,
1347 messageFile.pathOrUrl(), attachURLs.toStringList(),
1348 customHeaders, replyTo, inReplyTo );
1366 PimCommon::PimCommonSettings::self()->writeConfig();
1367 MessageCore::GlobalSettings::self()->writeConfig();
1368 MessageViewer::GlobalSettings::self()->writeConfig();
1369 MessageComposer::MessageComposerSettings::self()->writeConfig();
1370 TemplateParser::GlobalSettings::self()->writeConfig();
1371 MessageList::Core::Settings::self()->writeConfig();
1372 MailCommon::MailCommonSettings::self()->writeConfig();
1393 if( !mConfigureDialog ) {
1395 mConfigureDialog->setObjectName(
QLatin1String(
"configure") );
1404 if( mConfigureDialog->isHidden() ) {
1405 mConfigureDialog->show();
1407 mConfigureDialog->raise();
1421 return KStandardDirs::locateLocal(
"data",
QLatin1String(
"kmail2/") );
1428 return (mSystemTray!=0);
1433 if ( mSystemTray && !the_shuttingDown ) {
1439 if ( !mIdentityManager ) {
1441 mIdentityManager =
new KPIMIdentities::IdentityManager(
false,
this,
"mIdentityManager" );
1443 return mIdentityManager;
1449 foreach ( KMainWindow* window, KMainWindow::memberList() )
1450 if ( ::qobject_cast<KMMainWin *>(window) )
1456 if ( !KMainWindow::memberList().isEmpty() ) {
1457 KMainWindow *kmWin = KMainWindow::memberList().first();
1483 KMail::checkConfigUpdates();
1484 MessageList::Core::Settings::self()->setSharedConfig(
mySelf->mConfig );
1485 MessageList::Core::Settings::self()->readConfig();
1486 TemplateParser::GlobalSettings::self()->setSharedConfig(
mySelf->mConfig );
1487 TemplateParser::GlobalSettings::self()->readConfig();
1488 MessageComposer::MessageComposerSettings::self()->setSharedConfig(
mySelf->mConfig );
1489 MessageComposer::MessageComposerSettings::self()->readConfig();
1490 MessageCore::GlobalSettings::self()->setSharedConfig(
mySelf->mConfig );
1491 MessageCore::GlobalSettings::self()->readConfig();
1492 MessageViewer::GlobalSettings::self()->setSharedConfig(
mySelf->mConfig );
1493 MessageViewer::GlobalSettings::self()->readConfig();
1494 MailCommon::MailCommonSettings::self()->setSharedConfig(
mySelf->mConfig );
1495 MailCommon::MailCommonSettings::self()->readConfig();
1496 PimCommon::PimCommonSettings::self()->setSharedConfig(
mySelf->mConfig );
1497 PimCommon::PimCommonSettings::self()->readConfig();
1515 Akonadi::Collection colFolder = CommonKernel->collectionFromId(
id );
1517 if( colFolder.isValid() )
1528 const Akonadi::Collection colFolder = CommonKernel->collectionFromId( folder.
toLongLong() );
1530 if( colFolder.isValid() ) {
1543 Q_FOREACH( wid, l ) {
1556 mFolderCollectionMonitor->expireAllFolders(
false ,
entityTreeModel() );
1559 #ifdef DEBUG_SCHEDULER // for debugging, see jobscheduler.h
1560 mBackgroundTasksTimer->
start( 60 * 1000 );
1562 mBackgroundTasksTimer->
start( 4 * 60 * 60 * 1000 );
1570 Akonadi::Collection::List collections;
1571 const int numberOfCollection( model->
rowCount( parent ) );
1572 for (
int i = 0; i < numberOfCollection; ++i ) {
1574 Akonadi::Collection collection =
1575 model->
data( child, Akonadi::EntityTreeModel::CollectionRole ).
value<Akonadi::Collection>();
1576 if ( collection.isValid() ) {
1577 collections << collection;
1591 mFolderCollectionMonitor->expireAllFolders(
true ,
entityTreeModel() );
1599 if ( !mSystemTray || GlobalSettings::closeDespiteSystemTray() )
1601 if ( mSystemTray->
mode() == GlobalSettings::EnumSystemTrayPolicy::ShowAlways ) {
1604 }
else if ( ( mSystemTray->
mode() == GlobalSettings::EnumSystemTrayPolicy::ShowOnUnread ) ) {
1606 mSystemTray->setStatus( KStatusNotifierItem::Active );
1627 return the_msgSender;
1630 void KMKernel::transportRemoved(
int id,
const QString & name)
1637 KPIMIdentities::IdentityManager::Iterator end = im->modifyEnd();
1638 for ( KPIMIdentities::IdentityManager::Iterator it = im->modifyBegin(); it != end; ++it ) {
1639 if ( name == (*it).transport() ) {
1640 (*it).setTransport(
QString() );
1641 changedIdents += (*it).identityName();
1647 if ( name == currentTransport )
1650 if ( !changedIdents.
isEmpty() ) {
1651 QString information = i18np(
"This identity has been changed to use the default transport:",
1652 "These %1 identities have been changed to use the default transport:",
1653 changedIdents.
count() );
1655 KMessageBox::informationList( 0, information, changedIdents );
1660 void KMKernel::transportRenamed(
int id,
const QString & oldName,
const QString & newName)
1666 KPIMIdentities::IdentityManager::Iterator end = im->modifyEnd();
1667 for ( KPIMIdentities::IdentityManager::Iterator it = im->modifyBegin(); it != end; ++it ) {
1668 if ( oldName == (*it).transport() ) {
1669 (*it).setTransport( newName );
1670 changedIdents << (*it).identityName();
1674 if ( !changedIdents.
isEmpty() ) {
1676 i18np(
"This identity has been changed to use the modified transport:",
1677 "These %1 identities have been changed to use the modified transport:",
1678 changedIdents.
count() );
1680 KMessageBox::informationList( 0, information, changedIdents );
1685 void KMKernel::itemDispatchStarted()
1689 MailTransport::DispatcherInterface().dispatcherInstance(),
1691 i18n(
"Sending messages" ),
1692 i18n(
"Initiating sending process..." ),
1696 void KMKernel::instanceStatusChanged(
const Akonadi::AgentInstance &instance )
1698 if (instance.identifier() ==
QLatin1String(
"akonadi_mailfilter_agent" ) ) {
1702 instance.identifier(), instance.name(), instance.statusMessage(),
1704 progress->
setProperty(
"AgentIdentifier", instance.identifier() );
1707 if ( MailCommon::Util::agentInstances(
true).contains( instance ) ) {
1708 if ( instance.status() == Akonadi::AgentInstance::Running ) {
1710 if ( mResourcesBeingChecked.
isEmpty() ) {
1711 kDebug() <<
"A Resource started to synchronize, starting a mail check.";
1715 const QString identifier(instance.identifier());
1716 if ( !mResourcesBeingChecked.
contains( identifier ) ) {
1717 mResourcesBeingChecked.
append( identifier );
1721 if(mResourceCryptoSettingCache.
contains(identifier)) {
1722 cryptoStatus = mResourceCryptoSettingCache.
value(identifier);
1724 if ( PimCommon::Util::isImapResource(identifier) ) {
1725 OrgKdeAkonadiImapSettingsInterface *iface = PimCommon::Util::createImapSettingsInterface( identifier );
1726 if ( iface->isValid() ) {
1727 const QString imapSafety = iface->safety();
1731 mResourceCryptoSettingCache.
insert(identifier,cryptoStatus);
1734 }
else if ( identifier.contains( POP3_RESOURCE_IDENTIFIER ) ) {
1735 OrgKdeAkonadiPOP3SettingsInterface *iface = MailCommon::Util::createPop3SettingsInterface( identifier );
1736 if ( iface->isValid() ) {
1737 if (( iface->useSSL() || iface->useTLS() ))
1739 mResourceCryptoSettingCache.
insert(identifier, cryptoStatus);
1749 instance.identifier(), instance.name(), instance.statusMessage(),
1750 true, cryptoStatus );
1751 progress->
setProperty(
"AgentIdentifier", instance.identifier() );
1752 }
else if ( instance.status() == Akonadi::AgentInstance::Broken ) {
1760 const QString summary = i18n(
"Resource %1 is broken.", instance.name() );
1762 KNotification::event(
QLatin1String(
"akonadi-resource-broken"),
1766 KNotification::CloseOnTimeout,
1769 KNotification::event(
QLatin1String(
"akonadi-resource-broken"),
1773 KNotification::CloseOnTimeout );
1781 const Akonadi::AgentInstance agent = Akonadi::AgentManager::self()->instance( identifier );
1782 if ( agent.isValid() ) {
1783 mResourcesBeingChecked.
removeAll( identifier );
1784 if ( mResourcesBeingChecked.
isEmpty() ) {
1785 kDebug() <<
"Last resource finished syncing, mail check done";
1799 const Akonadi::AgentInstance agentInstance = Akonadi::AgentManager::self()->instance( col.resource() );
1800 isOnline = agentInstance.isOnline();
1802 return PimCommon::Util::isImapResource(agentInstance.type().identifier());
1810 const Akonadi::AgentInstance::List lst = MailCommon::Util::agentInstances();
1811 foreach( Akonadi::AgentInstance type, lst ) {
1812 const QString identifier = type.identifier();
1816 if ( group.readEntry(
"OfflineOnShutdown", identifier.
startsWith(
QLatin1String(
"akonadi_pop3_resource")) ?
true : false ) )
1817 type.setIsOnline(
false );
1821 void KMKernel::slotCollectionRemoved(
const Akonadi::Collection &col)
1823 KConfigGroup group(
KMKernel::config(), MailCommon::FolderCollection::configGroupName( col ) );
1824 group.deleteGroup();
1827 TemplateParser::Util::deleteTemplate( colStr );
1828 MessageList::Util::deleteConfig( colStr );
1831 void KMKernel::slotDeleteIdentity( uint identity)
1833 TemplateParser::Util::deleteTemplate(
QString::fromLatin1(
"IDENTITY_%1" ).arg( identity ) );
1863 return GlobalSettingsBase::self()->customTemplates();
1868 if ( !mFilterEditDialog ) {
1869 mFilterEditDialog =
new MailCommon::KMFilterDialog(
getKMMainWidget()->actionCollections(), 0, createDummyFilter );
1870 mFilterEditDialog->setObjectName(
QLatin1String(
"filterdialog") );
1872 mFilterEditDialog->show();
1873 mFilterEditDialog->raise();
1874 mFilterEditDialog->activateWindow();
1879 mFilterEditDialog->createFilter( field, value );
1886 const Akonadi::AgentInstance::List lst = MailCommon::Util::agentInstances();
1887 foreach(
const Akonadi::AgentInstance& type, lst ) {
1888 if ( type.status() == Akonadi::AgentInstance::Broken )
1890 if ( PimCommon::Util::isImapResource(type.identifier()) ) {
1891 OrgKdeAkonadiImapSettingsInterface *iface = PimCommon::Util::createImapSettingsInterface( type.identifier() );
1892 if ( iface->isValid() ) {
1893 foreach(
const Akonadi::Collection& collection, collectionList ) {
1894 const Akonadi::Collection::Id collectionId = collection.id();
1895 if ( iface->trashCollection() == collectionId ) {
1897 iface->setTrashCollection( CommonKernel->trashCollectionFolder().id() );
1898 iface->writeConfig();
1905 else if ( type.identifier().contains( POP3_RESOURCE_IDENTIFIER ) ) {
1906 OrgKdeAkonadiPOP3SettingsInterface *iface = MailCommon::Util::createPop3SettingsInterface( type.identifier() );
1907 if ( iface->isValid() ) {
1908 foreach(
const Akonadi::Collection& collection, collectionList ) {
1909 const Akonadi::Collection::Id collectionId = collection.id();
1910 if ( iface->targetCollection() == collectionId ) {
1912 iface->setTargetCollection( CommonKernel->inboxCollectionFolder().id() );
1913 iface->writeConfig();
1931 void KMKernel::slotInstanceWarning(
const Akonadi::AgentInstance &instance ,
const QString &message)
1933 const QString summary = i18nc(
"<source>: <error message>",
"%1: %2", instance.name(), message );
1935 KNotification::event(
QLatin1String(
"akonadi-instance-warning"),
1939 KNotification::CloseOnTimeout,
1942 KNotification::event(
QLatin1String(
"akonadi-instance-warning"),
1946 KNotification::CloseOnTimeout );
1950 void KMKernel::slotInstanceError(
const Akonadi::AgentInstance &instance,
const QString &message)
1952 const QString summary = i18nc(
"<source>: <error message>",
"%1: %2", instance.name(), message );
1954 KNotification::event(
QLatin1String(
"akonadi-instance-error"),
1958 KNotification::CloseOnTimeout,
1961 KNotification::event(
QLatin1String(
"akonadi-instance-error"),
1965 KNotification::CloseOnTimeout );
1970 void KMKernel::slotInstanceRemoved(
const Akonadi::AgentInstance& instance)
1972 const QString identifier(instance.identifier());
1976 group.deleteGroup();
1979 if(mResourceCryptoSettingCache.
contains(identifier)) {
1980 mResourceCryptoSettingCache.
remove(identifier);
2001 void KMKernel::resourceGoOnLine()
2006 Akonadi::Collection collection = widget->
currentFolder()->collection();
2007 Akonadi::AgentInstance instance = Akonadi::AgentManager::self()->instance( collection.resource() );
2008 instance.setIsOnline(
true );
2017 case MessageViewer::Viewer::AllResources:
2020 case MessageViewer::Viewer::SelectedResource:
2028 return mAutoCorrection;
2039 kDebug() <<
"deleting systray";
2045 if ( mSystemTray ) {
2055 if (!collectionId.
isEmpty()) {
2056 const Akonadi::Collection::Id
id = collectionId.
toLongLong();
2066 void KMKernel::slotCollectionChanged(
const Akonadi::Collection &,
const QSet<QByteArray> &
set)
2068 if(set.
contains(
"newmailnotifierattribute")) {
2069 if ( mSystemTray ) {
2077 return mFolderArchiveManager;
2082 return mStorageManager;
void updatePreferredCharsets()
Re-read the preferred charsets from settings.
virtual void setFocusToSubject()=0
Sets the focus to the subject line edit.
Q_SCRIPTABLE QStringList accounts()
void createFilter(const QByteArray &field, const QString &value)
static bool s_askingToGoOnline
Q_SCRIPTABLE int viewMessage(const QString &messageFile)
static ProgressManager * instance()
virtual int rowCount(const QModelIndex &parent) const =0
Q_SCRIPTABLE void setSystrayIconNotificationsEnabled(bool enabled)
Enables/disables systray icon changing when mail arrives.
iterator insert(const Key &key, const T &value)
virtual void disableForgottenAttachmentsCheck()=0
virtual void addExtraCustomHeaders(const QMap< QByteArray, QString > &header)=0
virtual QModelIndex index(int row, int column, const QModelIndex &parent) const =0
void truncate(int position)
void showMessage(const QString &encoding, const Akonadi::Item &msg, const Akonadi::Collection &parentCollection=Akonadi::Collection())
take ownership of and show
Q_SCRIPTABLE bool showMail(qint64 serialNumber)
Q_SCRIPTABLE void stopNetworkJobs()
Stops all network related jobs and enter offline mode New network jobs cannot be started.
void slotShowConfigurationDialog()
static KUrl makeAbsoluteUrl(const QString &str)
virtual QByteArray name() const =0
virtual void setAutoSaveFileName(const QString &fileName)=0
QByteArray toLower() const
Q_SCRIPTABLE int openComposer(const QString &to, const QString &cc, const QString &bcc, const QString &subject, const QString &body, bool hidden, const QString &messageFile, const QStringList &attachmentPaths, const QStringList &customHeaders, const QString &replyTo=QString(), const QString &inReplyTo=QString())
Opens a composer window and prefills it with different message parts.
Central point of coordination in KMail.
Q_SCRIPTABLE void openReader()
bool isImapFolder(const Akonadi::Collection &, bool &isOnline) const
PimCommon::StorageServiceManager * storageServiceManager() const
Q_SCRIPTABLE QDBusObjectPath newMessage(const QString &to, const QString &cc, const QString &bcc, bool hidden, bool useFolderId, const QString &messageFile, const QString &attachURL)
Opens a composer window and prefills it with different message parts.
bool registerObject(const QString &path, QObject *object, QFlags< QDBusConnection::RegisterOption > options)
void updatedTemplates()
Custom templates have changed, so all windows using them need to regenerate their menus...
FolderArchiveManager * folderArchiveManager() const
virtual void disableWordWrap()=0
virtual void setMessage(const KMime::Message::Ptr &newMsg, bool lastSignState=false, bool lastEncryptState=false, bool mayAutoSign=true, bool allowDecryption=false, bool isModified=false)=0
Set the message the composer shall work with.
void action(bool mailto, bool check, const QString &to, const QString &cc, const QString &bcc, const QString &subj, const QString &body, const KUrl &messageFile, const KUrl::List &attach, const QStringList &customHeaders, const QString &replyTo, const QString &inReplyTo)
QDBusConnection sessionBus()
void setSystrayIconNotificationsEnabled(bool enable)
Use this method to disable any systray icon changing.
Akonadi::EntityMimeTypeFilterModel * collectionModel() const
Returns a model of all folders in KMail.
QSharedPointer< MailCommon::FolderCollection > currentFolder() const
Akonadi::ChangeRecorder * folderCollectionMonitor() const
const KComponentData & xmlGuiInstance()
bool disconnect(const QObject *sender, const char *signal, const QObject *receiver, const char *method)
void customTemplatesChanged()
static KMKernel * self()
normal control stuff
QDBusMessage call(const QString &method, const QVariant &arg1, const QVariant &arg2, const QVariant &arg3, const QVariant &arg4, const QVariant &arg5, const QVariant &arg6, const QVariant &arg7, const QVariant &arg8)
KSharedConfig::Ptr config()
MailCommon::FolderTreeView * folderTreeView() const
QList< T > findChildren(const QString &name) const
void selectCollectionFromId(const Akonadi::Collection::Id id)
void updatePaneTagComboBox()
virtual void addAttachment(const KUrl &url, const QString &comment)=0
QString number(int n, int base)
int count(const T &value) const
QString fromLocal8Bit(const char *str, int size)
void append(const T &value)
Q_SCRIPTABLE void resumeNetworkJobs()
Resumes all network related jobs and enter online mode New network jobs can be started.
QVariant property(const char *name) const
const QAbstractItemModel * treeviewModelSelection()
virtual void addAttach(KMime::Content *msgPart)=0
Add an attachment to the list.
Q_SCRIPTABLE void makeResourceOnline(MessageViewer::Viewer::ResourceOnlineMode mode)
QFileInfoList entryInfoList(QFlags< QDir::Filter > filters, QFlags< QDir::SortFlag > sort) const
void updatePaneTagComboBox()
bool cd(const QString &dirName)
QString absoluteFilePath() const
int removeAll(const T &value)
QByteArray number(int n, int base)
bool startsWith(const QString &s, Qt::CaseSensitivity cs) const
Q_SCRIPTABLE void checkAccount(const QString &account)
Checks the account with the specified name for new mail.
Q_SCRIPTABLE bool selectFolder(const QString &folder)
void checkMailOnStartup()
End of D-Bus callable stuff.
void recoverDeadLetters()
virtual QVariant data(const QModelIndex &index, int role) const =0
Q_SCRIPTABLE void updateConfig()
Q_SCRIPTABLE void checkMail()
Start of D-Bus callable stuff.
int remove(const Key &key)
virtual void setCurrentReplyTo(const QString &replyTo)=0
void slotRunBackgroundTasks()
static bool isOffline()
Checks if the current network state is online or offline.
void slotRequestConfigSync()
Call this slot instead of directly KConfig::sync() to minimize the overall config writes...
KMKernel(QObject *parent=0)
static const PtrList * mainWidgetList()
Returns a list of all KMMainWidgets.
const T value(const Key &key) const
void setAccountStatus(bool)
bool excludeImportantMailFromExpiry()
bool haveSystemTrayApplet() const
Returns true if we have a system tray applet.
bool hasUnreadMail() const
virtual void setSigningAndEncryptionDisabled(bool v)=0
Disabled signing and encryption completely for this composer window.
bool contains(const T &value) const
void slotSelectCollectionFolder(const Akonadi::Collection &col)
bool contains(const T &value) const
bool shuttingDown() const
void set(quint32, const QString &, const QString &, const QString &, const QString &, time_t)
static GlobalSettings * self()
static bool askToGoOnline()
A static helper function that asks the user if they want to go online.
QString mid(int position, int n) const
Q_SCRIPTABLE void showFolder(const QString &collectionId)
virtual QString dbusObjectPath() const =0
PimCommon::AutoCorrection * composerAutoCorrection()
void agentInstanceBroken(const Akonadi::AgentInstance &instance)
Akonadi::EntityTreeModel * entityTreeModel() const
Returns the main model, which contains all folders and the items of recently opened folders...
QTextCodec * codecForName(const QByteArray &name)
static CodecManager * self()
Returns the CodecManager instance.
static void kmCrashHandler(int sigId)
Q_SCRIPTABLE void resumeBackgroundJobs()
Resumes all background jobs and allows new jobs to be started.
Q_SCRIPTABLE void reloadFolderArchiveConfig()
QString left(int n) const
Q_SCRIPTABLE bool handleCommandLine(bool noArgsOpensReader)
QString fromLatin1(const char *str, int size)
void dumpDeadLetters()
Save contents of all open composer widnows to ~/dead.letter.
KPIMIdentities::IdentityManager * identityManager()
return the pointer to the identity manager
bool setProperty(const char *name, const QVariant &value)
iterator insert(const Key &key, const T &value)
bool contains(const Key &key) const
bool doSessionManagement()
void openFilterDialog(bool createDummyFilter=true)
void setShowUnreadCount(bool showUnreadCount)
static Akonadi::Collection::List collect_collections(const QAbstractItemModel *model, const QModelIndex &parent)
KMainWindow * mainWin()
returns a reference to the first Mainwin or a temporary Mainwin
void closeAllKMailWindows()
quint32 serialNumber() const
const_iterator constEnd() const
virtual void forceDisableHtml()=0
const_iterator constBegin() const
QDBusError lastError() const
MessageComposer::MessageSender * msgSender()
bool connect(const QString &service, const QString &path, const QString &interface, const QString &name, QObject *receiver, const char *slot)
bool connect(const QObject *sender, const char *signal, const QObject *receiver, const char *method, Qt::ConnectionType type)
virtual void setCollectionForNewMessage(const Akonadi::Collection &folder)=0
qreal closeToQuotaThreshold()
void checkFolderFromResources(const Akonadi::Collection::List &collectionList)
QString arg(qlonglong a, int fieldWidth, int base, const QChar &fillChar) const
void setLastSelectedFolder(const Akonadi::Collection::Id &col)
QStringList customTemplates()
void slotSyncConfig()
Sync the config immediatley.
qlonglong toLongLong(bool *ok, int base) const
bool allowToDebugBalooSupport() const
void expireAllFoldersNow()
Expire all folders, used for the gui action.
void onlineStatusChanged(GlobalSettings::EnumNetworkState::type)
Akonadi::Collection::Id lastSelectedFolder()
void slotInstanceRemoved(const Akonadi::AgentInstance &instance)
Akonadi::Collection::List allFolders() const
Returns a list of all currently loaded folders.
bool registerService(const QString &serviceName)
static QString localDataPath()
Returns the full path of the user's local data directory for KMail.
Q_SCRIPTABLE bool canQueryClose()
Q_SCRIPTABLE void pauseBackgroundJobs()
Pauses all background jobs and does not allow new background jobs to be started.
virtual void slotSendNow()=0
const T value(const Key &key) const
void setSingleShot(bool singleShot)
KMMainWidget * getKMMainWidget()
Get first mainwidget.
static ProgressItem * createProgressItem(unsigned int progressType, const QString &label)
QByteArray toUtf8() const