32 #include "customtemplatesmenu.h"
33 #include "folderselectiondialog.h"
34 #include "foldertreewidget.h"
36 #include "util/mailutil.h"
37 #include "kernel/mailkernel.h"
40 #include "foldertreeview.h"
45 #include <ksieveui/debug/sievedebugdialog.h>
46 using KSieveUi::SieveDebugDialog;
56 #include "archivemailagentinterface.h"
58 #include "sendlateragentinterface.h"
59 #include "folderarchiveagentinterface.h"
60 #include "agents/folderarchiveagent/folderarchiveutil.h"
62 #include "pimcommon/acl/collectionaclpage.h"
63 #include "mailcommon/collectionpage/collectiongeneralpage.h"
64 #include "mailcommon/collectionpage/collectionexpirypage.h"
65 #include "mailcommon/collectionpage/expirecollectionattribute.h"
66 #include "mailcommon/filter/filtermanager.h"
67 #include "mailcommon/filter/mailfilter.h"
68 #include "mailcommon/widgets/favoritecollectionwidget.h"
69 #include "mailcommon/mailcommonsettings_base.h"
72 #include "kdepim-version.h"
74 #include "messageviewer/utils/autoqpointer.h"
75 #include "messageviewer/settings/globalsettings.h"
76 #include "messageviewer/viewer/viewer.h"
77 #include "messageviewer/viewer/attachmentstrategy.h"
78 #include "messageviewer/header/headerstrategy.h"
79 #include "messageviewer/header/headerstyle.h"
81 #include "messageviewer/utils/kcursorsaver.h"
84 #include "messagecomposer/sender/messagesender.h"
85 #include "messagecomposer/helper/messagehelper.h"
87 #include "templateparser/templateparser.h"
89 #include "messagecore/settings/globalsettings.h"
90 #include "messagecore/misc/mailinglist.h"
91 #include "messagecore/helpers/messagehelpers.h"
103 #include <Akonadi/AgentManager>
104 #include <Akonadi/AttributeFactory>
105 #include <akonadi/itemfetchjob.h>
106 #include <akonadi/collectionattributessynchronizationjob.h>
107 #include <akonadi/collectionfetchjob.h>
108 #include <akonadi/collectionfetchscope.h>
109 #include <akonadi/contact/contactsearchjob.h>
110 #include <akonadi/collectionpropertiesdialog.h>
111 #include <akonadi/entitydisplayattribute.h>
112 #include <akonadi/entitylistview.h>
113 #include <akonadi/etmviewstatesaver.h>
114 #include <akonadi/agentinstance.h>
115 #include <akonadi/agenttype.h>
116 #include <akonadi/changerecorder.h>
117 #include <akonadi/session.h>
118 #include <akonadi/entitytreemodel.h>
119 #include <akonadi/favoritecollectionsmodel.h>
120 #include <akonadi/itemfetchscope.h>
121 #include <akonadi/itemmodifyjob.h>
122 #include <akonadi/control.h>
123 #include <akonadi/collectiondialog.h>
124 #include <akonadi/collectionstatistics.h>
125 #include <akonadi/collectionstatisticsdelegate.h>
126 #include <Akonadi/EntityMimeTypeFilterModel>
127 #include <akonadi/kmime/messageflags.h>
128 #include <akonadi/kmime/removeduplicatesjob.h>
129 #include <akonadi/collectiondeletejob.h>
130 #include <akonadi/dbusconnectionpool.h>
131 #include <Akonadi/CachePolicy>
133 #include <kpimidentities/identity.h>
134 #include <kpimidentities/identitymanager.h>
135 #include <kpimutils/email.h>
136 #include <mailtransport/transportmanager.h>
137 #include <mailtransport/transport.h>
138 #include <kmime/kmime_mdn.h>
139 #include <kmime/kmime_header_parsing.h>
140 #include <kmime/kmime_message.h>
141 #include <ksieveui/managesievescriptsdialog.h>
142 #include <ksieveui/util/util.h>
145 #include <kaboutdata.h>
147 #include <kwindowsystem.h>
149 #include <kmessagebox.h>
150 #include <kactionmenu.h>
152 #include <kacceleratormanager.h>
154 #include <kglobalsettings.h>
155 #include <kstandardshortcut.h>
156 #include <kshortcutsdialog.h>
157 #include <kcharsets.h>
159 #include <kfiledialog.h>
161 #include <kstandarddirs.h>
162 #include <kstandardaction.h>
163 #include <ktoggleaction.h>
164 #include <knotification.h>
165 #include <knotifyconfigwidget.h>
166 #include <kstringhandler.h>
167 #include <kconfiggroup.h>
168 #include <ktoolinvocation.h>
169 #include <kxmlguifactory.h>
170 #include <kxmlguiclient.h>
171 #include <kstatusbar.h>
173 #include <ktreewidgetsearchline.h>
174 #include <Solid/Networking>
175 #include <nepomuk2/resourcemanager.h>
176 #include <KRecentFilesAction>
179 #include <QByteArray>
180 #include <QHeaderView>
184 #include <QVBoxLayout>
187 #include <QDBusMessage>
188 #include <QDBusConnection>
189 #include <QTextDocument>
191 #include <QtDBus/QDBusInterface>
192 #include <QtDBus/QDBusReply>
193 #include <QDBusPendingCallWatcher>
198 #include <akonadi/standardactionmanager.h>
200 #include "kmmainwidget.moc"
202 using namespace KMime;
203 using namespace Akonadi;
204 using namespace MailCommon;
209 using KMime::Types::AddrSpecList;
210 using MessageViewer::AttachmentStrategy;
213 Q_DECLARE_METATYPE(Akonadi::Job*)
214 Q_DECLARE_METATYPE(QPointer<KPIM::ProgressItem>)
215 K_GLOBAL_STATIC(
KMMainWidget::PtrList, theMainWidgetList )
219 KActionCollection *actionCollection, KSharedConfig::Ptr config ) :
221 mMoveMsgToFolderAction(0),
222 mCollectionProperties( 0 ),
223 mFavoriteCollectionsView( 0 ),
227 mFolderViewSplitter( 0 ),
228 mArchiveFolderAction( 0 ),
229 mShowBusySplashTimer( 0 ),
232 mVacationIndicatorActive( false ),
233 mGoToFirstUnreadMessageInSelectedFolder( false )
236 mStartupDone =
false;
237 mWasEverShown =
false;
238 mReaderWindowActive =
true;
239 mReaderWindowBelow =
true;
240 mFolderHtmlPref =
false;
241 mFolderHtmlLoadExtPref =
false;
243 mActionCollection = actionCollection;
244 mTopLayout =
new QVBoxLayout(
this );
245 mTopLayout->setMargin( 0 );
247 mGUIClient = aGUIClient;
248 mFolderTreeWidget = 0;
249 mPreferHtmlAction = 0;
250 mPreferHtmlLoadExtAction = 0;
251 Akonadi::Control::widgetNeedsAkonadi(
this );
258 mToolbarActionSeparator =
new QAction(
this );
259 mToolbarActionSeparator->setSeparator(
true );
261 theMainWidgetList->append(
this );
275 QTimer::singleShot( 0,
this, SLOT(slotShowStartupFolder()));
277 connect(
kmkernel, SIGNAL(startCheckMail()),
278 this, SLOT(slotStartCheckMail()) );
280 connect(
kmkernel, SIGNAL(endCheckMail()),
281 this, SLOT(slotEndCheckMail()) );
283 connect(
kmkernel, SIGNAL(configChanged()),
284 this, SLOT(slotConfigChanged()) );
286 connect(
kmkernel, SIGNAL(onlineStatusChanged(GlobalSettings::EnumNetworkState::type)),
287 this, SLOT(slotUpdateOnlineStatus(GlobalSettings::EnumNetworkState::type)) );
289 connect( mTagActionManager, SIGNAL(tagActionTriggered(QString)),
290 this, SLOT(slotUpdateMessageTagList(QString)) );
292 connect( mTagActionManager, SIGNAL(tagMoreActionClicked()),
293 this, SLOT(slotSelectMoreMessageTagList()) );
298 static bool pagesRegistered =
false;
300 if ( !pagesRegistered ) {
301 Akonadi::CollectionPropertiesDialog::registerPage(
new PimCommon::CollectionAclPageFactory );
302 Akonadi::CollectionPropertiesDialog::registerPage(
new MailCommon::CollectionGeneralPageFactory );
303 Akonadi::CollectionPropertiesDialog::registerPage(
new CollectionMaintenancePageFactory );
304 Akonadi::CollectionPropertiesDialog::registerPage(
new CollectionQuotaPageFactory );
305 Akonadi::CollectionPropertiesDialog::registerPage(
new CollectionTemplatesPageFactory );
306 Akonadi::CollectionPropertiesDialog::registerPage(
new MailCommon::CollectionExpiryPageFactory );
307 Akonadi::CollectionPropertiesDialog::registerPage(
new CollectionViewPageFactory );
308 Akonadi::CollectionPropertiesDialog::registerPage(
new CollectionMailingListPageFactory );
309 Akonadi::CollectionPropertiesDialog::registerPage(
new CollectionShortcutPageFactory );
311 pagesRegistered =
true;
315 KMainWindow *mainWin =
dynamic_cast<KMainWindow*
>(window());
316 KStatusBar *sb = mainWin ? mainWin->statusBar() : 0;
318 mVacationScriptIndicator->hide();
319 connect( mVacationScriptIndicator, SIGNAL(clicked()), SLOT(slotEditVacation()) );
320 if ( KSieveUi::Util::checkOutOfOfficeOnStartup() )
321 QTimer::singleShot( 0,
this, SLOT(slotCheckVacation()) );
323 restoreCollectionFolderViewConfig();
326 if (MailCommon::Util::foundMailer()) {
327 if (KMessageBox::questionYesNo(
this,i18n(
"Another mailer was found on system. Do you want to import data from it?")) == KMessageBox::Yes) {
328 const QString path = KStandardDirs::findExe( QLatin1String(
"importwizard" ) );
329 if ( !QProcess::startDetached( path ) ) {
330 KMessageBox::error(
this, i18n(
"Could not start the import wizard. "
331 "Please check your installation." ),
332 i18n(
"Unable to start import wizard" ) );
345 mCheckMailTimer.setInterval( 3 * 1000 );
346 mCheckMailTimer.setSingleShot(
true );
347 connect( &mCheckMailTimer, SIGNAL(timeout()), SLOT(slotUpdateActionsAfterMailChecking()) );
353 ETMViewStateSaver *saver =
new ETMViewStateSaver;
354 saver->setView( mFolderTreeWidget->folderTreeView() );
355 const KConfigGroup cfg(
KMKernel::self()->config(),
"CollectionFolderView" );
356 mFolderTreeWidget->restoreHeaderState( cfg.readEntry(
"HeaderState", QByteArray() ) );
357 saver->restoreState( cfg );
363 if ( startupFolder > 0 )
364 saver->restoreCurrentItem( QString::fromLatin1(
"c%1").arg(startupFolder) );
367 saver->restoreCurrentItem( QString::fromLatin1(
"c%1").arg(
id) );
377 theMainWidgetList->removeAll(
this );
378 qDeleteAll( mFilterCommands );
394 mCurrentFolder.clear();
395 delete mMoveOrCopyToDialog;
396 delete mSelectFromAllFoldersDialog;
398 disconnect(
kmkernel->folderCollectionMonitor(), SIGNAL(itemAdded(Akonadi::Item,Akonadi::Collection)),
this, 0);
399 disconnect(
kmkernel->folderCollectionMonitor(), SIGNAL(itemRemoved(Akonadi::Item)),
this, 0);
400 disconnect(
kmkernel->folderCollectionMonitor(), SIGNAL(itemMoved(Akonadi::Item,Akonadi::Collection,Akonadi::Collection)),
this, 0);
401 disconnect(
kmkernel->folderCollectionMonitor(), SIGNAL(collectionChanged(Akonadi::Collection,QSet<QByteArray>)),
this, 0);
402 disconnect(
kmkernel->folderCollectionMonitor(), SIGNAL(collectionStatisticsChanged(Akonadi::Collection::Id,Akonadi::CollectionStatistics)),
this, 0);
410 if ( mCheckMailTimer.isActive() )
411 mCheckMailTimer.stop();
416 if ( !mCheckMailTimer.isActive() )
417 mCheckMailTimer.start();
422 const bool sendOnAll =
424 const bool sendOnManual =
426 if ( !
kmkernel->isOffline() && ( sendOnAll || (sendOnManual ) ) ) {
434 void KMMainWidget::slotCollectionFetched(
int collectionId )
439 if ( mCurrentFolder && collectionId == mCurrentFolder->collection().id() ) {
440 mCurrentFolder->setCollection( MailCommon::Util::updatedCollection( mCurrentFolder->collection() ) );
441 updateMessageActions();
445 if ( mCurrentFolder ) {
446 emit captionChangeRequest( MailCommon::Util::fullCollectionPath( mCurrentFolder->collection() ) );
450 void KMMainWidget::slotFolderChanged(
const Akonadi::Collection& collection )
452 folderSelected( collection );
453 if (collection.cachePolicy().syncOnDemand())
454 AgentManager::self()->synchronizeCollection( collection,
false );
455 mMsgActions->setCurrentMessage( Akonadi::Item() );
456 emit captionChangeRequest( MailCommon::Util::fullCollectionPath( collection ) );
463 if ( mGoToFirstUnreadMessageInSelectedFolder )
466 mPreSelectionMode = MessageList::Core::PreSelectFirstUnreadCentered;
471 case GlobalSettings::EnumActionEnterFolder::SelectFirstUnread:
472 mPreSelectionMode = MessageList::Core::PreSelectFirstUnreadCentered;
474 case GlobalSettings::EnumActionEnterFolder::SelectLastSelected:
475 mPreSelectionMode = MessageList::Core::PreSelectLastSelected;
477 case GlobalSettings::EnumActionEnterFolder::SelectNewest:
478 mPreSelectionMode = MessageList::Core::PreSelectNewestCentered;
480 case GlobalSettings::EnumActionEnterFolder::SelectOldest:
481 mPreSelectionMode = MessageList::Core::PreSelectOldestCentered;
484 mPreSelectionMode = MessageList::Core::PreSelectNone;
489 mGoToFirstUnreadMessageInSelectedFolder =
false;
491 MessageViewer::KCursorSaver busy( MessageViewer::KBusyPtr::busy() );
495 mMsgView->clear(
true);
496 const bool newFolder = mCurrentFolder && ( mCurrentFolder->collection() != col );
499 delete mShowBusySplashTimer;
500 mShowBusySplashTimer = 0;
507 mCurrentFolder = FolderCollection::forCollection( col );
512 mMsgView->setHtmlOverride(mFolderHtmlPref);
513 mMsgView->setHtmlLoadExtOverride(mFolderHtmlLoadExtPref);
516 if ( !mCurrentFolder->isValid() && ( mMessagePane->count() < 2 ) )
519 updateMessageActions();
525 QTimer::singleShot( 0,
this, SLOT(slotShowSelectedFolderInPane()) );
530 if ( mCurrentFolder && mCurrentFolder->collection().isValid() ) {
531 mMessagePane->setCurrentFolder( mCurrentFolder->collection(), false , mPreSelectionMode );
538 mMsgView->clear(
true );
539 mMsgView->displayAboutPage();
546 mLongFolderList =
GlobalSettings::self()->folderList() == GlobalSettings::EnumFolderList::longlist;
547 mReaderWindowActive =
GlobalSettings::self()->readerWindowMode() != GlobalSettings::EnumReaderWindowMode::hide;
548 mReaderWindowBelow =
GlobalSettings::self()->readerWindowMode() == GlobalSettings::EnumReaderWindowMode::below;
550 mHtmlPref = MessageViewer::GlobalSettings::self()->htmlMail();
551 mHtmlLoadExtPref = MessageViewer::GlobalSettings::self()->htmlLoadExternal();
552 mEnableFavoriteFolderView = ( MailCommon::MailCommonSettings::self()->favoriteCollectionViewMode() != MailCommon::MailCommonSettings::EnumFavoriteCollectionViewMode::HiddenMode );
554 updateHtmlMenuEntry();
561 if ( !mCurrentFolder || !mCurrentFolder->isValid() )
565 KConfigGroup group( config, MailCommon::FolderCollection::configGroupName( mCurrentFolder->collection() ) );
567 group.readEntry(
"htmlMailOverride",
false );
568 mFolderHtmlLoadExtPref =
569 group.readEntry(
"htmlLoadExternalOverride",
false );
576 if ( mCurrentFolder && mCurrentFolder->isValid() ) {
578 KConfigGroup group( config, MailCommon::FolderCollection::configGroupName( mCurrentFolder->collection() ) );
579 group.writeEntry(
"htmlMailOverride", mFolderHtmlPref );
580 group.writeEntry(
"htmlLoadExternalOverride", mFolderHtmlLoadExtPref );
588 assert( !mSplitter1 );
589 assert( !mSplitter2 );
594 disconnect( mMsgView->copyAction(), SIGNAL(triggered(
bool)),
595 mMsgView, SLOT(slotCopySelectedText()) );
608 const bool opaqueResize = KGlobalSettings::opaqueResize();
609 const bool readerWindowAtSide = !mReaderWindowBelow && mReaderWindowActive;
610 const bool readerWindowBelow = mReaderWindowBelow && mReaderWindowActive;
612 mSplitter1 =
new QSplitter(
this );
613 mSplitter2 =
new QSplitter( mSplitter1 );
615 QWidget * folderTreeWidget = mSearchAndTree;
616 if ( mFavoriteCollectionsView ) {
617 mFolderViewSplitter =
new QSplitter( Qt::Vertical );
618 mFolderViewSplitter->setOpaqueResize( opaqueResize );
620 mFolderViewSplitter->addWidget( mFavoriteCollectionsView );
621 mFavoriteCollectionsView->setParent( mFolderViewSplitter );
622 mFolderViewSplitter->addWidget( mSearchAndTree );
623 folderTreeWidget = mFolderViewSplitter;
626 if ( mLongFolderList ) {
629 mSplitter1->setOrientation( Qt::Horizontal );
630 mSplitter1->addWidget( folderTreeWidget );
633 mSplitter1->addWidget( mSplitter2 );
636 if ( readerWindowAtSide ) {
637 mSplitter2->setOrientation( Qt::Horizontal );
639 mSplitter2->setOrientation( Qt::Vertical );
641 mSplitter2->addWidget( mMessagePane );
645 mSplitter2->addWidget( mMsgView );
649 if ( mReaderWindowBelow ) {
650 mSplitter1->setOrientation( Qt::Vertical );
651 mSplitter2->setOrientation( Qt::Horizontal );
653 mSplitter1->setOrientation( Qt::Horizontal );
654 mSplitter2->setOrientation( Qt::Vertical );
657 mSplitter1->addWidget( mSplitter2 );
660 mSplitter2->addWidget( folderTreeWidget );
662 mSplitter2->addWidget( mMessagePane );
666 mSplitter1->addWidget( mMsgView );
672 mSplitter1->setObjectName( QLatin1String(
"splitter1") );
673 mSplitter1->setOpaqueResize( opaqueResize );
675 mSplitter2->setObjectName( QLatin1String(
"splitter2") );
676 mSplitter2->setOpaqueResize( opaqueResize );
682 mSplitter1->setStretchFactor( 0, 0 );
683 mSplitter2->setStretchFactor( 0, 0 );
684 mSplitter1->setStretchFactor( 1, 1 );
685 mSplitter2->setStretchFactor( 1, 1 );
687 if ( mFavoriteCollectionsView ) {
688 mFolderViewSplitter->setStretchFactor( 0, 0 );
689 mFolderViewSplitter->setStretchFactor( 1, 1 );
695 if ( readerWindowAtSide && !mLongFolderList ) {
696 mSplitter1->setStretchFactor( 0, 1 );
697 mSplitter1->setStretchFactor( 1, 0 );
713 int ffvHeight = mFolderViewSplitter ? MailCommon::MailCommonSettings::self()->favoriteCollectionViewHeight() : 0;
716 if ( messageViewerHeight < 10 && readerWindowBelow ) {
718 messageViewerHeight = headerHeight;
721 if ( mLongFolderList ) {
722 if ( !readerWindowAtSide ) {
723 splitter1Sizes << folderViewWidth << headerWidth;
724 splitter2Sizes << headerHeight << messageViewerHeight;
726 splitter1Sizes << folderViewWidth << ( headerWidth + messageViewerWidth );
727 splitter2Sizes << headerWidth << messageViewerWidth;
730 if ( !readerWindowAtSide ) {
731 splitter1Sizes << headerHeight << messageViewerHeight;
732 splitter2Sizes << folderViewWidth << headerWidth;
734 splitter1Sizes << headerWidth << messageViewerWidth;
735 splitter2Sizes << ftHeight + ffvHeight << messageViewerHeight;
739 mSplitter1->setSizes( splitter1Sizes );
740 mSplitter2->setSizes( splitter2Sizes );
742 if ( mFolderViewSplitter ) {
744 splitterSizes << ffvHeight << ftHeight;
745 mFolderViewSplitter->setSizes( splitterSizes );
751 mTopLayout->addWidget( mSplitter1 );
757 mMessagePane->focusView();
762 mFolderTreeWidget->folderTreeView()->hideColumn( 1 );
763 mFolderTreeWidget->folderTreeView()->hideColumn( 3 );
764 mFolderTreeWidget->folderTreeView()->header()->resizeSection( 0, folderViewWidth * 0.8 );
769 connect( mMsgView->copyAction(), SIGNAL(triggered(
bool)),
770 mMsgView, SLOT(slotCopySelectedText()) );
774 void KMMainWidget::refreshFavoriteFoldersViewProperties()
776 if ( mFavoriteCollectionsView ) {
777 if ( MailCommon::MailCommonSettings::self()->favoriteCollectionViewMode() == MailCommon::MailCommonSettings::EnumFavoriteCollectionViewMode::IconMode )
778 mFavoriteCollectionsView->setViewMode( QListView::IconMode );
779 else if ( MailCommon::MailCommonSettings::self()->favoriteCollectionViewMode() == MailCommon::MailCommonSettings::EnumFavoriteCollectionViewMode::ListMode )
780 mFavoriteCollectionsView->setViewMode( QListView::ListMode );
783 mFavoriteCollectionsView->setDropActionMenuEnabled(
kmkernel->showPopupAfterDnD() );
784 mFavoriteCollectionsView->setWordWrap(
true );
785 mFavoriteCollectionsView->updateMode();
792 const bool oldLongFolderList = mLongFolderList;
793 const bool oldReaderWindowActive = mReaderWindowActive;
794 const bool oldReaderWindowBelow = mReaderWindowBelow;
795 const bool oldFavoriteFolderView = mEnableFavoriteFolderView;
796 const bool oldFolderQuickSearch = mEnableFolderQuickSearch;
799 bool layoutChanged = !mStartupDone;
805 layoutChanged = ( oldLongFolderList != mLongFolderList ) ||
806 ( oldReaderWindowActive != mReaderWindowActive ) ||
807 ( oldReaderWindowBelow != mReaderWindowBelow ) ||
808 ( oldFavoriteFolderView != mEnableFavoriteFolderView );
810 if ( layoutChanged ) {
813 Akonadi::Collection::Id
id = -1;
814 if (mCurrentFolder && mCurrentFolder->collection().isValid() ) {
815 id = mCurrentFolder->collection().id();
817 restoreCollectionFolderViewConfig(
id);
819 }
else if ( oldFolderQuickSearch != mEnableFolderQuickSearch ) {
820 if ( mEnableFolderQuickSearch )
821 mFolderTreeWidget->filterFolderLineEdit()->show();
823 mFolderTreeWidget->filterFolderLineEdit()->hide();
830 mMsgView->readConfig();
832 mMessagePane->reloadGlobalConfiguration();
833 mFolderTreeWidget->readConfig();
834 if ( mFavoriteCollectionsView ) {
835 mFavoriteCollectionsView->readConfig();
837 refreshFavoriteFoldersViewProperties();
845 QTimer::singleShot( 0,
this, SLOT(slotCheckMailOnStartup()) );
849 if ( layoutChanged ) {
857 connect( Akonadi::AgentManager::self(), SIGNAL(instanceAdded(Akonadi::AgentInstance)),
858 this, SLOT(updateFileMenu()) );
859 connect( Akonadi::AgentManager::self(), SIGNAL(instanceRemoved(Akonadi::AgentInstance)),
860 this, SLOT(updateFileMenu()) );
870 if ( mWasEverShown ) {
874 int headersHeight = mMessagePane->height();
875 if ( headersHeight == 0 )
876 headersHeight = height() / 2;
880 if ( mFavoriteCollectionsView ) {
881 MailCommon::MailCommonSettings::self()->setFavoriteCollectionViewHeight( mFavoriteCollectionsView->height() );
883 if ( !mLongFolderList ) {
887 else if ( !mLongFolderList && mFolderTreeWidget )
891 if ( mFolderTreeWidget )
895 KConfigGroup group(config,
"CollectionFolderView");
897 ETMViewStateSaver saver;
898 saver.setView( mFolderTreeWidget->folderTreeView() );
899 saver.saveState( group );
901 group.writeEntry(
"HeaderState", mFolderTreeWidget->folderTreeView()->header()->saveState() );
903 group.deleteEntry(
"Selection" );
906 group.deleteEntry(
"Current" );
913 if ( !mReaderWindowBelow )
915 mMsgView->viewer()->writeConfig(force);
923 if ( mWasEverShown ) {
925 mMsgView->viewer()->writeConfig();
937 delete mAkonadiStandardActionManager;
938 mAkonadiStandardActionManager = 0;
942 mFolderViewSplitter = 0;
943 mFavoriteCollectionsView = 0;
958 FolderTreeWidget::TreeViewOptions opt = FolderTreeWidget::ShowUnreadCount;
959 opt |= FolderTreeWidget::UseLineEditForFiltering;
960 opt |= FolderTreeWidget::ShowCollectionStatisticAnimation;
961 opt |= FolderTreeWidget::DontKeyFilter;
962 mFolderTreeWidget =
new FolderTreeWidget(
this, mGUIClient, opt );
964 connect( mFolderTreeWidget->folderTreeView(), SIGNAL(currentChanged(Akonadi::Collection)),
this, SLOT(slotFolderChanged(Akonadi::Collection)) );
966 connect( mFolderTreeWidget->folderTreeView()->selectionModel(), SIGNAL(selectionChanged(QItemSelection,QItemSelection)),
this, SLOT(updateFolderMenu()) );
968 connect( mFolderTreeWidget->folderTreeView(), SIGNAL(prefereCreateNewTab(
bool)),
this, SLOT(slotCreateNewTab(
bool)) );
970 mFolderTreeWidget->setSelectionMode( QAbstractItemView::ExtendedSelection );
972 mFolderTreeWidget->folderTreeView()->selectionModel(),
974 connect(
KMKernel::self()->entityTreeModel(), SIGNAL(collectionFetched(
int)),
this, SLOT(slotCollectionFetched(
int)));
976 mMessagePane->setXmlGuiClient( mGUIClient );
977 connect( mMessagePane, SIGNAL(messageSelected(Akonadi::Item)),
978 this, SLOT(slotMessageSelected(Akonadi::Item)) );
979 connect( mMessagePane, SIGNAL(fullSearchRequest()),
this,SLOT(slotRequestFullSearchFromQuickSearch()) );
980 connect( mMessagePane, SIGNAL(selectionChanged()),
981 SLOT(startUpdateMessageActionsTimer()) );
982 connect( mMessagePane, SIGNAL(currentTabChanged()),
this, SLOT(refreshMessageListSelection()) );
983 connect( mMessagePane, SIGNAL(messageActivated(Akonadi::Item)),
984 this, SLOT(slotMessageActivated(Akonadi::Item)) );
985 connect( mMessagePane, SIGNAL(messageStatusChangeRequest(Akonadi::Item,Akonadi::MessageStatus,Akonadi::MessageStatus)),
986 SLOT(slotMessageStatusChangeRequest(Akonadi::Item,Akonadi::MessageStatus,Akonadi::MessageStatus)) );
988 connect( mMessagePane, SIGNAL(statusMessage(QString)),
989 BroadcastStatus::instance(), SLOT(setStatusMsg(QString)) );
995 if ( mReaderWindowActive ) {
996 mMsgView =
new KMReaderWin(
this,
this, actionCollection(), 0 );
998 mMsgActions->setMessageView( mMsgView );
1000 connect( mMsgView->viewer(), SIGNAL(replaceMsgByUnencryptedVersion()),
1001 this, SLOT(slotReplaceMsgByUnencryptedVersion()) );
1002 connect( mMsgView->viewer(), SIGNAL(popupMenu(Akonadi::Item,KUrl,KUrl,QPoint)),
1003 this, SLOT(slotMessagePopup(Akonadi::Item,KUrl,KUrl,QPoint)) );
1004 connect( mMsgView->viewer(), SIGNAL(moveMessageToTrash()),
1005 this, SLOT(slotMoveMessageToTrash()) );
1008 if ( mMsgActions ) {
1009 mMsgActions->setMessageView( 0 );
1018 mSearchAndTree =
new QWidget(
this );
1019 QVBoxLayout *vboxlayout =
new QVBoxLayout;
1020 vboxlayout->setMargin(0);
1021 mSearchAndTree->setLayout( vboxlayout );
1023 vboxlayout->addWidget( mFolderTreeWidget );
1026 mFolderTreeWidget->filterFolderLineEdit()->hide();
1031 mAkonadiStandardActionManager =
new Akonadi::StandardMailActionManager( mGUIClient->actionCollection(), this );
1032 connect( mAkonadiStandardActionManager, SIGNAL(actionStateUpdated()),
this, SLOT(slotAkonadiStandardActionUpdated()) );
1034 mAkonadiStandardActionManager->setCollectionSelectionModel( mFolderTreeWidget->folderTreeView()->selectionModel() );
1035 mAkonadiStandardActionManager->setItemSelectionModel( mMessagePane->currentItemSelectionModel() );
1037 if ( mEnableFavoriteFolderView ) {
1039 mFavoriteCollectionsView =
new FavoriteCollectionWidget( mGUIClient,
this );
1040 refreshFavoriteFoldersViewProperties();
1042 connect( mFavoriteCollectionsView, SIGNAL(currentChanged(Akonadi::Collection)),
this, SLOT(slotFolderChanged(Akonadi::Collection)) );
1044 mFavoritesModel =
new Akonadi::FavoriteCollectionsModel(
1045 mFolderTreeWidget->folderTreeView()->model(),
1048 mFavoriteCollectionsView->setModel( mFavoritesModel );
1050 Akonadi::CollectionStatisticsDelegate *delegate =
new Akonadi::CollectionStatisticsDelegate( mFavoriteCollectionsView );
1051 delegate->setProgressAnimationEnabled(
true );
1052 mFavoriteCollectionsView->setItemDelegate(delegate);
1053 delegate->setUnreadCountShown(
true );
1055 mAkonadiStandardActionManager->setFavoriteCollectionsModel( mFavoritesModel );
1056 mAkonadiStandardActionManager->setFavoriteSelectionModel( mFavoriteCollectionsView->selectionModel() );
1062 standardActions << StandardActionManager::CreateCollection
1063 << StandardActionManager::CopyCollections
1064 << StandardActionManager::DeleteCollections
1065 << StandardActionManager::SynchronizeCollections
1066 << StandardActionManager::CollectionProperties
1067 << StandardActionManager::CopyItems
1068 << StandardActionManager::Paste
1069 << StandardActionManager::DeleteItems
1070 << StandardActionManager::ManageLocalSubscriptions
1071 << StandardActionManager::CopyCollectionToMenu
1072 << StandardActionManager::CopyItemToMenu
1073 << StandardActionManager::MoveItemToMenu
1074 << StandardActionManager::MoveCollectionToMenu
1075 << StandardActionManager::CutItems
1076 << StandardActionManager::CutCollections
1077 << StandardActionManager::CreateResource
1078 << StandardActionManager::DeleteResources
1079 << StandardActionManager::ResourceProperties
1080 << StandardActionManager::SynchronizeResources
1081 << StandardActionManager::ToggleWorkOffline
1082 << StandardActionManager::SynchronizeCollectionsRecursive;
1084 Q_FOREACH( StandardActionManager::Type standardAction, standardActions ) {
1085 mAkonadiStandardActionManager->createAction( standardAction );
1089 if (mEnableFavoriteFolderView) {
1091 favoriteActions << StandardActionManager::AddToFavoriteCollections
1092 << StandardActionManager::RemoveFromFavoriteCollections
1093 << StandardActionManager::RenameFavoriteCollection
1094 << StandardActionManager::SynchronizeFavoriteCollections;
1095 Q_FOREACH( StandardActionManager::Type favoriteAction, favoriteActions) {
1096 mAkonadiStandardActionManager->createAction( favoriteAction );
1101 mailActions << StandardMailActionManager::MarkAllMailAsRead
1102 << StandardMailActionManager::MoveToTrash
1103 << StandardMailActionManager::MoveAllToTrash
1104 << StandardMailActionManager::RemoveDuplicates
1105 << StandardMailActionManager::EmptyAllTrash
1106 << StandardMailActionManager::MarkMailAsRead
1107 << StandardMailActionManager::MarkMailAsUnread
1108 << StandardMailActionManager::MarkMailAsImportant
1109 << StandardMailActionManager::MarkMailAsActionItem;
1111 Q_FOREACH( StandardMailActionManager::Type mailAction, mailActions ) {
1112 mAkonadiStandardActionManager->createAction( mailAction );
1115 mAkonadiStandardActionManager->interceptAction( Akonadi::StandardActionManager::CollectionProperties );
1116 connect( mAkonadiStandardActionManager->action( Akonadi::StandardActionManager::CollectionProperties ), SIGNAL(triggered(
bool)),
this, SLOT(slotCollectionProperties()) );
1122 mAkonadiStandardActionManager->action( Akonadi::StandardMailActionManager::RemoveDuplicates )->setShortcut( QKeySequence( Qt::CTRL + Qt::Key_Asterisk ) );
1123 mAkonadiStandardActionManager->interceptAction( Akonadi::StandardMailActionManager::RemoveDuplicates );
1124 connect( mAkonadiStandardActionManager->action( Akonadi::StandardMailActionManager::RemoveDuplicates ), SIGNAL(triggered(
bool)),
this, SLOT(slotRemoveDuplicates()) );
1127 mCollectionProperties = mAkonadiStandardActionManager->action( Akonadi::StandardActionManager::CollectionProperties );
1129 connect(
kmkernel->folderCollectionMonitor(), SIGNAL(itemAdded(Akonadi::Item,Akonadi::Collection)),
1130 SLOT(slotItemAdded(Akonadi::Item,Akonadi::Collection)) );
1131 connect(
kmkernel->folderCollectionMonitor(), SIGNAL(itemRemoved(Akonadi::Item)),
1132 SLOT(slotItemRemoved(Akonadi::Item)) );
1133 connect(
kmkernel->folderCollectionMonitor(), SIGNAL(itemMoved(Akonadi::Item,Akonadi::Collection,Akonadi::Collection)),
1134 SLOT(slotItemMoved(Akonadi::Item,Akonadi::Collection,Akonadi::Collection)) );
1135 connect(
kmkernel->folderCollectionMonitor(), SIGNAL(collectionChanged(Akonadi::Collection,QSet<QByteArray>)), SLOT(slotCollectionChanged(Akonadi::Collection,QSet<QByteArray>)) );
1137 connect(
kmkernel->folderCollectionMonitor(), SIGNAL(collectionStatisticsChanged(Akonadi::Collection::Id,Akonadi::CollectionStatistics)), SLOT(slotCollectionStatisticsChanged(Akonadi::Collection::Id,Akonadi::CollectionStatistics)) );
1141 void KMMainWidget::updateMoveAction(
const Akonadi::CollectionStatistics& statistic )
1143 const bool hasUnreadMails = (statistic.unreadCount() > 0);
1144 const bool hasMails = (statistic.count()>0);
1145 updateMoveAction(hasUnreadMails,hasMails);
1148 void KMMainWidget::updateMoveAction(
bool hasUnreadMails,
bool hasMails )
1150 const bool enable_goto_unread = hasUnreadMails
1151 || (
GlobalSettings::self()->loopOnGotoUnread() == GlobalSettings::EnumLoopOnGotoUnread::LoopInAllFolders)
1152 || (
GlobalSettings::self()->loopOnGotoUnread() == GlobalSettings::EnumLoopOnGotoUnread::LoopInAllMarkedFolders);
1153 actionCollection()->action( QLatin1String(
"go_next_message") )->setEnabled( hasMails );
1154 actionCollection()->action( QLatin1String(
"go_next_unread_message") )->setEnabled( enable_goto_unread );
1155 actionCollection()->action( QLatin1String(
"go_prev_message") )->setEnabled( hasMails );
1156 actionCollection()->action( QLatin1String(
"go_prev_unread_message") )->setEnabled( enable_goto_unread );
1157 if ( mAkonadiStandardActionManager->action( Akonadi::StandardMailActionManager::MarkAllMailAsRead ) ) {
1158 mAkonadiStandardActionManager->action( Akonadi::StandardMailActionManager::MarkAllMailAsRead )->setEnabled(hasUnreadMails);
1162 void KMMainWidget::updateAllToTrashAction(
int statistics)
1164 bool multiFolder =
false;
1165 if ( mFolderTreeWidget ) {
1166 multiFolder = mFolderTreeWidget->selectedCollections().count() > 1;
1168 if ( mAkonadiStandardActionManager->action( Akonadi::StandardMailActionManager::MoveAllToTrash ) ) {
1169 const bool folderWithContent = mCurrentFolder && !mCurrentFolder->isStructural();
1170 mAkonadiStandardActionManager->action( Akonadi::StandardMailActionManager::MoveAllToTrash )->setEnabled( folderWithContent
1171 && ( statistics > 0 )
1172 && mCurrentFolder->canDeleteMessages()
1179 if (
id == CommonKernel->outboxCollectionFolder().id() ) {
1180 const qint64 nbMsgOutboxCollection = statistic.count();
1181 mSendQueued->setEnabled( nbMsgOutboxCollection > 0 );
1182 mSendActionMenu->setEnabled( nbMsgOutboxCollection > 0 );
1183 }
else if ( mCurrentFolder && (
id == mCurrentFolder->collection().id() ) ) {
1184 updateMoveAction( statistic );
1185 updateAllToTrashAction(statistic.count());
1186 mCurrentFolder->setCollection(MailCommon::Util::updatedCollection( mCurrentFolder->collection() ));
1192 mMessagePane->setPreferEmptyTab( preferNewTab );
1198 && ( collection == mCurrentFolder->collection() )
1199 && ( set.contains(
"MESSAGEFOLDER" ) || set.contains(
"expirationcollectionattribute" ) ) ) {
1200 if ( set.contains(
"MESSAGEFOLDER" ) )
1201 mMessagePane->resetModelStorage();
1203 mCurrentFolder->setCollection( collection );
1205 }
else if ( set.contains(
"ENTITYDISPLAY" ) || set.contains(
"NAME" ) ) {
1207 QIcon icon = KIcon( QLatin1String(
"folder" ) );
1210 const QModelIndex idx = Akonadi::EntityTreeModel::modelIndexForCollection(
KMKernel::self()->collectionModel(), collection );
1211 if ( idx.isValid() ) {
1212 text = idx.data().toString();
1213 icon = idx.data( Qt::DecorationRole ).value<QIcon>();
1214 mMessagePane->updateTabIconText( collection, text,icon );
1223 if ( col.isValid() ) {
1224 if ( col == CommonKernel->outboxCollectionFolder() ) {
1225 startUpdateMessageActionsTimer();
1232 if ( item.isValid() && item.parentCollection().isValid() && ( item.parentCollection() == CommonKernel->outboxCollectionFolder() ) ) {
1233 startUpdateMessageActionsTimer();
1239 if ( item.isValid() && ( ( from.id() == CommonKernel->outboxCollectionFolder().id() )
1240 || to.id() == CommonKernel->outboxCollectionFolder().id() ) ) {
1241 startUpdateMessageActionsTimer();
1248 mMessagePane->focusQuickSearch();
1255 if ( !Nepomuk2::ResourceManager::instance()->initialized() ) {
1256 KMessageBox::information(
this, i18n(
"The Nepomuk semantic search service is not available. Searching is not possible without it. "
1257 "You can enable it in \"System Settings\"." ), i18n(
"Search Not Available" ) );
1262 KConfig config( QLatin1String(
"akonadi_nepomuk_feederrc") );
1263 KConfigGroup cfgGroup( &config,
"akonadi_nepomuk_email_feeder" );
1264 if ( !cfgGroup.readEntry(
"Enabled",
true ) ) {
1265 KMessageBox::information(
this, i18n(
"You have disabled full text indexing of emails. Searching is not possible without that. "
1266 "You can enable it in \"System Settings\". Note that searching will only be possible after "
1267 "your emails have been fully indexed, which can take some time." ) );
1275 mSearchWin =
new SearchWindow(
this, mCurrentFolder ? mCurrentFolder->collection() : Akonadi::Collection());
1276 mSearchWin->setModal(
false );
1277 mSearchWin->setObjectName( QLatin1String(
"Search") );
1281 mSearchWin->
activateFolder(mCurrentFolder ? mCurrentFolder->collection() : Akonadi::Collection());
1285 KWindowSystem::activateWindow( mSearchWin->winId() );
1293 KToolInvocation::invokeHelp();
1300 FilterIf->openFilterDialog(
true );
1305 if ( !
kmkernel->askToGoOnline() ) {
1308 if (mManageSieveDialog)
1311 mManageSieveDialog =
new KSieveUi::ManageSieveScriptsDialog(
this );
1312 mManageSieveDialog->show();
1319 KRun::runCommand(QLatin1String(
"kaddressbook"), window());
1326 KRun::runCommand(QLatin1String(
"kmailcvt"), window());
1348 Akonadi::AgentInstance agent = Akonadi::AgentManager::self()->instance( item->data().toString() );
1349 if ( agent.isValid() ) {
1350 if ( !agent.isOnline() ) {
1351 agent.setIsOnline(
true );
1353 agent.synchronize();
1355 kDebug() <<
"account with identifier" << item->data().toString() <<
"not found";
1363 KMime::Message::Ptr msg(
new KMime::Message() );
1365 bool forceCursorPosition =
false;
1366 if ( mCurrentFolder ) {
1367 MessageHelper::initHeader( msg,
KMKernel::self()->identityManager(), mCurrentFolder->identity() );
1375 TemplateParser::TemplateParser parser( msg, TemplateParser::TemplateParser::NewMessage );
1376 parser.setIdentityManager(
KMKernel::self()->identityManager() );
1377 parser.process( msg, mCurrentFolder->collection() );
1378 win = KMail::makeComposer( msg,
false,
false,
KMail::Composer::New, mCurrentFolder->identity() );
1380 forceCursorPosition = parser.cursorPositionWasSet();
1382 MessageHelper::initHeader( msg,
KMKernel::self()->identityManager() );
1383 TemplateParser::TemplateParser parser( msg, TemplateParser::TemplateParser::NewMessage );
1384 parser.setIdentityManager(
KMKernel::self()->identityManager() );
1385 parser.process( KMime::Message::Ptr(), Akonadi::Collection() );
1387 forceCursorPosition = parser.cursorPositionWasSet();
1389 if (forceCursorPosition) {
1400 if ( mCurrentFolder )
1402 const KPIMIdentities::Identity & ident =
1403 kmkernel->identityManager()->identityForUoidOrDefault( mCurrentFolder->identity() );
1404 mTemplateFolder = CommonKernel->collectionFromId( ident.templates().toLongLong() );
1407 if ( !mTemplateFolder.isValid() ) {
1408 mTemplateFolder = CommonKernel->templatesCollectionFolder();
1410 if ( !mTemplateFolder.isValid() )
1413 mTemplateMenu->menu()->clear();
1415 Akonadi::ItemFetchJob *job =
new Akonadi::ItemFetchJob( mTemplateFolder );
1416 job->fetchScope().setAncestorRetrieval( ItemFetchScope::Parent );
1417 job->fetchScope().fetchFullPayload();
1418 connect( job, SIGNAL(result(
KJob*)), SLOT(slotDelayedShowNewFromTemplate(
KJob*)) );
1423 Akonadi::ItemFetchJob *fetchJob = qobject_cast<Akonadi::ItemFetchJob*>( job );
1425 const Akonadi::Item::List items = fetchJob->items();
1426 const int numberOfItems = items.count();
1427 for (
int idx = 0; idx < numberOfItems; ++idx ) {
1428 KMime::Message::Ptr msg = MessageCore::Util::message( items.at( idx ) );
1430 QString subj = msg->subject()->asUnicodeString();
1431 if ( subj.isEmpty() )
1432 subj = i18n(
"No Subject");
1434 QAction *templateAction = mTemplateMenu->menu()->addAction(KStringHandler::rsqueeze( subj.replace( QLatin1Char(
'&'), QLatin1String(
"&&") ) ) );
1436 var.setValue( items.at( idx ) );
1437 templateAction->setData( var );
1443 if ( mTemplateMenu->menu()->actions().isEmpty() ) {
1444 QAction *noAction = mTemplateMenu->menu()->addAction(
1445 i18n(
"(no templates)" ) );
1446 noAction->setEnabled(
false );
1455 if ( !mTemplateFolder.isValid() )
1457 const Akonadi::Item item = action->data().value<Akonadi::Item>();
1458 newFromTemplate( item );
1465 if ( !msg.isValid() )
1475 if ( mCurrentFolder && mCurrentFolder->isMailingListEnabled() ) {
1486 showCollectionProperties( QLatin1String(
"KMail::CollectionMailingListPage" ) );
1492 showCollectionProperties( QLatin1String(
"KMail::CollectionShortcutPage" ) );
1498 if ( !mCurrentFolder )
1500 bool mustDeleteExpirationAttribute =
false;
1501 MailCommon::ExpireCollectionAttribute *attr = MailCommon::ExpireCollectionAttribute::expirationCollectionAttribute( mCurrentFolder->collection(), mustDeleteExpirationAttribute );
1503 bool canBeExpired =
true;
1504 if ( !attr->isAutoExpire() ) {
1505 canBeExpired =
false;
1506 }
else if ( attr->unreadExpireUnits() == MailCommon::ExpireCollectionAttribute::ExpireNever &&
1507 attr->readExpireUnits() == MailCommon::ExpireCollectionAttribute::ExpireNever ) {
1508 canBeExpired =
false;
1511 if ( !canBeExpired ) {
1512 const QString message = i18n(
"This folder does not have any expiry options set" );
1513 KMessageBox::information(
this, message );
1514 if ( mustDeleteExpirationAttribute )
1520 const QString message = i18n(
"<qt>Are you sure you want to expire the folder <b>%1</b>?</qt>",
1521 Qt::escape( mCurrentFolder->name() ) );
1522 if ( KMessageBox::warningContinueCancel(
this, message, i18n(
"Expire Folder" ),
1523 KGuiItem( i18n(
"&Expire" ) ) )
1524 != KMessageBox::Continue ) {
1525 if ( mustDeleteExpirationAttribute )
1531 MailCommon::Util::expireOldMessages( mCurrentFolder->collection(),
true );
1532 if ( mustDeleteExpirationAttribute )
1539 if (!mCurrentFolder)
return;
1540 const bool isTrash = CommonKernel->folderIsTrash( mCurrentFolder->collection() );
1543 const QString title = (isTrash) ? i18n(
"Empty Trash") : i18n(
"Move to Trash");
1544 const QString
text = (isTrash) ?
1545 i18n(
"Are you sure you want to empty the trash folder?") :
1546 i18n(
"<qt>Are you sure you want to move all messages from "
1547 "folder <b>%1</b> to the trash?</qt>", Qt::escape( mCurrentFolder->name() ) );
1549 if (KMessageBox::warningContinueCancel(
this, text, title, KGuiItem( title, QLatin1String(
"user-trash")))
1550 != KMessageBox::Continue)
return;
1552 #ifndef QT_NO_CURSOR
1553 MessageViewer::KCursorSaver busy( MessageViewer::KBusyPtr::busy() );
1559 slotDeleteMsg(
false );
1562 slotTrashSelectedMessages();
1565 mMsgView->clearCache();
1568 BroadcastStatus::instance()->setStatusMsg(i18n(
"Moved all messages to the trash"));
1570 updateMessageActions();
1574 mAkonadiStandardActionManager->action( Akonadi::StandardMailActionManager::MoveAllToTrash )->setEnabled(
false );
1580 if ( mCurrentFolder && mCurrentFolder->collection().isValid() ) {
1582 archiveDialog.
setFolder( mCurrentFolder->collection() );
1583 archiveDialog.exec();
1590 if ( !mCurrentFolder )
return;
1591 if ( !mCurrentFolder->collection().isValid() )
return;
1592 if ( mCurrentFolder->isSystemFolder() )
return;
1593 if ( mCurrentFolder->isReadOnly() )
return;
1595 Akonadi::CollectionFetchJob *job =
new Akonadi::CollectionFetchJob( mCurrentFolder->collection(), CollectionFetchJob::FirstLevel, this );
1596 job->fetchScope().setContentMimeTypes( QStringList() << KMime::Message::mimeType() );
1597 job->setProperty(
"collectionId", mCurrentFolder->collection().id() );
1598 connect( job, SIGNAL(result(
KJob*)), SLOT(slotDelayedRemoveFolder(
KJob*)) );
1603 const Akonadi::CollectionFetchJob *fetchJob = qobject_cast<Akonadi::CollectionFetchJob*>( job );
1604 Akonadi::Collection::List listOfCollection = fetchJob->collections();
1605 const bool hasNotSubDirectory = listOfCollection.isEmpty();
1607 const Akonadi::Collection::Id
id = fetchJob->property(
"collectionId" ).toLongLong();
1608 Akonadi::Collection col = MailCommon::Util::updatedCollection(CommonKernel->collectionFromId(
id ));
1612 QString buttonLabel;
1613 if ( col.resource() == QLatin1String(
"akonadi_search_resource" ) ) {
1614 title = i18n(
"Delete Search");
1615 str = i18n(
"<qt>Are you sure you want to delete the search <b>%1</b>?<br />"
1616 "Any messages it shows will still be available in their original folder.</qt>",
1617 Qt::escape( col.name() ) );
1618 buttonLabel = i18nc(
"@action:button Delete search",
"&Delete");
1620 title = i18n(
"Delete Folder");
1623 if ( col.statistics().count() == 0 ) {
1624 if ( hasNotSubDirectory ) {
1625 str = i18n(
"<qt>Are you sure you want to delete the empty folder "
1627 Qt::escape( col.name() ) );
1629 str = i18n(
"<qt>Are you sure you want to delete the empty folder "
1630 "<resource>%1</resource> and all its subfolders? Those subfolders might "
1631 "not be empty and their contents will be discarded as well. "
1632 "<p><b>Beware</b> that discarded messages are not saved "
1633 "into your Trash folder and are permanently deleted.</p></qt>",
1634 Qt::escape( col.name() ) );
1637 if ( hasNotSubDirectory ) {
1638 str = i18n(
"<qt>Are you sure you want to delete the folder "
1639 "<resource>%1</resource>, discarding its contents? "
1640 "<p><b>Beware</b> that discarded messages are not saved "
1641 "into your Trash folder and are permanently deleted.</p></qt>",
1642 Qt::escape( col.name() ) );
1644 str = i18n(
"<qt>Are you sure you want to delete the folder <resource>%1</resource> "
1645 "and all its subfolders, discarding their contents? "
1646 "<p><b>Beware</b> that discarded messages are not saved "
1647 "into your Trash folder and are permanently deleted.</p></qt>",
1648 Qt::escape( col.name() ) );
1651 buttonLabel = i18nc(
"@action:button Delete folder",
"&Delete");
1654 if ( KMessageBox::warningContinueCancel(
this, str, title,
1655 KGuiItem( buttonLabel, QLatin1String(
"edit-delete" )),
1656 KStandardGuiItem::cancel(), QString(),
1657 KMessageBox::Notify | KMessageBox::Dangerous )
1658 == KMessageBox::Continue )
1660 kmkernel->checkFolderFromResources( listOfCollection<<col );
1662 if (col.id() == mCurrentFolder->collection().id())
1663 mCurrentFolder.clear();
1665 Akonadi::CollectionDeleteJob *job =
new Akonadi::CollectionDeleteJob( col );
1666 connect( job, SIGNAL(result(
KJob*)),
this, SLOT(slotDeletionCollectionResult(
KJob*)) );
1670 void KMMainWidget::slotDeletionCollectionResult(
KJob* job)
1673 if (Util::showJobErrorMessage( job )) {
1683 const int ret = KMessageBox::warningContinueCancel(KMainWindow::memberList().first(),
1684 i18n(
"Are you sure you want to expire all old messages?"),
1685 i18n(
"Expire Old Messages?"), KGuiItem(i18n(
"Expire")));
1686 if (ret != KMessageBox::Continue) {
1698 if ( mHtmlPref == mFolderHtmlPref ) {
1699 int result = KMessageBox::warningContinueCancel(
this,
1701 i18n(
"Use of HTML in mail will make you more vulnerable to "
1702 "\"spam\" and may increase the likelihood that your system will be "
1703 "compromised by other present and anticipated security exploits." ),
1704 i18n(
"Security Warning" ),
1705 KGuiItem(i18n(
"Use HTML" )),
1706 KStandardGuiItem::cancel(),
1707 QLatin1String(
"OverrideHtmlWarning"), 0);
1708 if ( result == KMessageBox::Cancel ) {
1709 mPreferHtmlAction->setChecked(
false );
1713 mFolderHtmlPref = !mFolderHtmlPref;
1716 mPreferHtmlLoadExtAction->setEnabled( mCurrentFolder && (mHtmlPref ? !mFolderHtmlPref : mFolderHtmlPref) ?
true :
false );
1719 mMsgView->setHtmlOverride(mFolderHtmlPref);
1720 mMsgView->update(
true );
1727 if ( mHtmlLoadExtPref == mFolderHtmlLoadExtPref ) {
1728 int result = KMessageBox::warningContinueCancel(
this,
1730 i18n(
"Loading external references in html mail will make you more vulnerable to "
1731 "\"spam\" and may increase the likelihood that your system will be "
1732 "compromised by other present and anticipated security exploits." ),
1733 i18n(
"Security Warning" ),
1734 KGuiItem(i18n(
"Load External References" )),
1735 KStandardGuiItem::cancel(),
1736 QLatin1String(
"OverrideHtmlLoadExtWarning"), 0);
1737 if ( result == KMessageBox::Cancel ) {
1738 mPreferHtmlLoadExtAction->setChecked(
false );
1742 mFolderHtmlLoadExtPref = !mFolderHtmlLoadExtPref;
1745 mMsgView->setHtmlLoadExtOverride(mFolderHtmlLoadExtPref);
1746 mMsgView->update(
true );
1753 if (!CommonKernel->folderIsDraftOrOutbox(mCurrentFolder->collection()))
1756 mMsgView->update(
true);
1763 if ( !mCurrentFolder ) {
1768 if ( selectedMessages.isEmpty() )
1771 this, selectedMessages, mCurrentFolder->identity()
1781 if ( !mCurrentFolder ) {
1786 if ( selectedMessages.isEmpty() )
1789 this, selectedMessages, mCurrentFolder->identity()
1799 newFromTemplate( mMessagePane->currentItem() );
1806 const Akonadi::Item msg = mMessagePane->currentItem();
1807 if ( !msg.isValid() )
1818 void KMMainWidget::moveMessageSelected( MessageList::Core::MessageItemSetReference ref,
const Akonadi::Collection &dest,
bool confirmOnDeletion )
1822 if ( !dest.isValid() && confirmOnDeletion )
1824 int ret = KMessageBox::warningContinueCancel(
1827 "<qt>Do you really want to delete the selected message?<br />"
1828 "Once deleted, it cannot be restored.</qt>",
1829 "<qt>Do you really want to delete the %1 selected messages?<br />"
1830 "Once deleted, they cannot be restored.</qt>",
1833 selectMsg.count() > 1 ? i18n(
"Delete Messages" ) : i18n(
"Delete Message" ),
1834 KStandardGuiItem::del(),
1835 KStandardGuiItem::cancel(),
1836 QLatin1String(
"NoConfirmDelete")
1838 if ( ret == KMessageBox::Cancel )
1840 mMessagePane->deletePersistentSet( ref );
1844 mMessagePane->markMessageItemsAsAboutToBeRemoved( ref,
true );
1853 if ( dest.isValid() )
1854 BroadcastStatus::instance()->setStatusMsg( i18n(
"Moving messages..." ) );
1856 BroadcastStatus::instance()->setStatusMsg( i18n(
"Deleting messages..." ) );
1859 void KMMainWidget::slotMoveMessagesCompleted(
KMMoveCommand *command )
1861 Q_ASSERT( command );
1862 mMessagePane->markMessageItemsAsAboutToBeRemoved( command->
refSet(), false );
1863 mMessagePane->deletePersistentSet( command->
refSet() );
1865 const bool moveWasReallyADelete = !command->
destFolder().isValid();
1869 if ( moveWasReallyADelete )
1870 BroadcastStatus::instance()->setStatusMsg( i18n(
"Messages deleted successfully." ) );
1872 BroadcastStatus::instance()->setStatusMsg( i18n(
"Messages moved successfully." ) );
1874 if ( moveWasReallyADelete )
1877 BroadcastStatus::instance()->setStatusMsg( i18n(
"Deleting messages failed." ) );
1879 BroadcastStatus::instance()->setStatusMsg( i18n(
"Deleting messages canceled." ) );
1882 BroadcastStatus::instance()->setStatusMsg( i18n(
"Moving messages failed." ) );
1884 BroadcastStatus::instance()->setStatusMsg( i18n(
"Moving messages canceled." ) );
1893 MessageList::Core::MessageItemSetReference ref = mMessagePane->selectionAsPersistentSet();
1895 moveMessageSelected( ref, Akonadi::Collection(), confirmDelete );
1901 MessageList::Core::MessageItemSetReference ref = mMessagePane->currentThreadAsPersistentSet();
1903 moveMessageSelected( ref, Akonadi::Collection(), confirmDelete );
1906 FolderSelectionDialog* KMMainWidget::moveOrCopyToDialog()
1908 if ( !mMoveOrCopyToDialog ) {
1909 FolderSelectionDialog::SelectionFolderOption options = FolderSelectionDialog::HideVirtualFolder;
1910 mMoveOrCopyToDialog =
new FolderSelectionDialog(
this, options );
1911 mMoveOrCopyToDialog->setModal(
true );
1913 return mMoveOrCopyToDialog;
1916 FolderSelectionDialog* KMMainWidget::selectFromAllFoldersDialog()
1918 if ( !mSelectFromAllFoldersDialog ) {
1919 FolderSelectionDialog::SelectionFolderOptions options = FolderSelectionDialog::None;
1920 options |= FolderSelectionDialog::NotAllowToCreateNewFolder;
1922 mSelectFromAllFoldersDialog =
new FolderSelectionDialog(
this, options );
1923 mSelectFromAllFoldersDialog->setModal(
true );
1925 return mSelectFromAllFoldersDialog;
1930 QPointer<MailCommon::FolderSelectionDialog> dialog( moveOrCopyToDialog() );
1931 dialog->setCaption( i18n(
"Move Messages to Folder" ) );
1932 if ( dialog->exec() && dialog ) {
1933 const Akonadi::Collection dest = dialog->selectedCollection();
1934 if ( dest.isValid() ) {
1935 moveSelectedMessagesToFolder( dest );
1942 MessageList::Core::MessageItemSetReference ref = mMessagePane->selectionAsPersistentSet();
1945 moveMessageSelected( ref, dest,
false );
1950 void KMMainWidget::copyMessageSelected(
const QList<Akonadi::Item> &selectMsg,
const Akonadi::Collection &dest )
1952 if ( selectMsg.isEmpty() )
1958 this, SLOT(slotCopyMessagesCompleted(
KMCommand*))
1961 BroadcastStatus::instance()->setStatusMsg( i18n(
"Copying messages..." ) );
1965 void KMMainWidget::slotCopyMessagesCompleted(
KMCommand *command )
1967 Q_ASSERT( command );
1970 BroadcastStatus::instance()->setStatusMsg( i18n(
"Messages copied successfully." ) );
1973 BroadcastStatus::instance()->setStatusMsg( i18n(
"Copying messages failed." ) );
1975 BroadcastStatus::instance()->setStatusMsg( i18n(
"Copying messages canceled." ) );
1982 QPointer<MailCommon::FolderSelectionDialog> dialog( moveOrCopyToDialog() );
1983 dialog->setCaption( i18n(
"Copy Messages to Folder" ) );
1985 if ( dialog->exec() && dialog ) {
1986 const Akonadi::Collection dest = dialog->selectedCollection();
1987 if ( dest.isValid() ) {
1988 copySelectedMessagesToFolder( dest );
1996 if ( !lstMsg.isEmpty() ) {
1997 copyMessageSelected( lstMsg, dest );
2004 void KMMainWidget::trashMessageSelected( MessageList::Core::MessageItemSetReference ref )
2006 if ( !mCurrentFolder ) {
2011 mMessagePane->markMessageItemsAsAboutToBeRemoved( ref,
true );
2022 BroadcastStatus::instance()->setStatusMsg( i18n(
"Moving messages to trash..." ) );
2025 void KMMainWidget::slotTrashMessagesCompleted(
KMMoveCommand *command )
2027 Q_ASSERT( command );
2028 mMessagePane->markMessageItemsAsAboutToBeRemoved( command->
refSet(), false );
2029 mMessagePane->deletePersistentSet( command->
refSet() );
2032 BroadcastStatus::instance()->setStatusMsg( i18n(
"Messages moved to trash successfully." ) );
2035 BroadcastStatus::instance()->setStatusMsg( i18n(
"Moving messages to trash failed." ) );
2037 BroadcastStatus::instance()->setStatusMsg( i18n(
"Moving messages to trash canceled." ) );
2045 MessageList::Core::MessageItemSetReference ref = mMessagePane->selectionAsPersistentSet();
2047 trashMessageSelected( ref );
2053 MessageList::Core::MessageItemSetReference ref = mMessagePane->currentThreadAsPersistentSet();
2055 trashMessageSelected( ref );
2063 void KMMainWidget::toggleMessageSetTag(
const QList<Akonadi::Item> &select,
const QString &taglabel )
2065 if ( select.isEmpty() )
2075 if ( selectedMessages.isEmpty() )
2078 TagSelectDialog dlg(
this, selectedMessages.count(), selectedMessages.first() );
2092 if ( selectedMessages.isEmpty() )
2094 toggleMessageSetTag( selectedMessages, taglabel );
2099 mAkonadiStandardActionManager->setItemSelectionModel( mMessagePane->currentItemSelectionModel() );
2100 slotMessageSelected(mMessagePane->currentItem());
2109 const Akonadi::MessageStatus &status,
2116 void KMMainWidget::setCurrentThreadStatus(
const Akonadi::MessageStatus &status,
bool toggle )
2119 if ( select.isEmpty() )
2121 setMessageSetStatus( select, status, toggle );
2126 setCurrentThreadStatus( MessageStatus::statusRead(),
true );
2131 setCurrentThreadStatus( MessageStatus::statusImportant(),
true );
2136 setCurrentThreadStatus( MessageStatus::statusRead(),
false );
2141 setCurrentThreadStatus( MessageStatus::statusToAct(),
true );
2146 setCurrentThreadStatus( MessageStatus::statusWatched(),
true );
2147 if ( mWatchThreadAction->isChecked() )
2148 mIgnoreThreadAction->setChecked(
false);
2153 setCurrentThreadStatus( MessageStatus::statusIgnored(),
true );
2154 if ( mIgnoreThreadAction->isChecked() )
2155 mWatchThreadAction->setChecked(
false);
2162 if ( selectedMessages.isEmpty() )
2173 const Akonadi::Item msg = mMessagePane->currentItem();
2174 if ( !msg.isValid() )
2177 const QString
text = mMsgView ? mMsgView->copyText() : QString();
2179 kDebug() <<
"Reply with template:" << tmpl;
2183 MessageComposer::ReplySmart,
2193 const Akonadi::Item msg = mMessagePane->currentItem();
2194 if ( !msg.isValid() )
2197 const QString
text = mMsgView? mMsgView->copyText() : QString();
2199 kDebug() <<
"Reply to All with template:" << tmpl;
2203 MessageComposer::ReplyAll,
2216 if ( !mCurrentFolder ) {
2221 if ( selectedMessages.isEmpty() )
2224 kDebug() <<
"Forward with template:" << tmpl;
2226 this, selectedMessages, mCurrentFolder->identity(), tmpl
2233 void KMMainWidget::openFilterDialog(
const QByteArray &field,
const QString &value)
2235 FilterIf->openFilterDialog(
false );
2236 FilterIf->createFilter( field, value );
2242 const KMime::Message::Ptr msg = mMessagePane->currentMessage();
2246 openFilterDialog(
"Subject", msg->subject()->asUnicodeString());
2252 KMime::Message::Ptr msg = mMessagePane->currentMessage();
2256 AddrSpecList al = MessageHelper::extractAddrSpecs( msg,
"From" );
2258 openFilterDialog(
"From", msg->from()->asUnicodeString());
2260 openFilterDialog(
"From", al.front().asString());
2266 KMime::Message::Ptr msg = mMessagePane->currentMessage();
2269 openFilterDialog(
"To", msg->to()->asUnicodeString());
2276 updateMessageActions();
2284 QPointer<MailCommon::FolderSelectionDialog> dialog( selectFromAllFoldersDialog() );
2285 dialog->setCaption( i18n(
"Jump to Folder") );
2286 if ( dialog->exec() && dialog ) {
2287 Akonadi::Collection collection = dialog->selectedCollection();
2288 if ( collection.isValid() ) {
2289 slotSelectCollectionFolder( collection );
2296 if ( mFolderTreeWidget ) {
2297 mFolderTreeWidget->selectCollectionFolder( col );
2298 slotFolderChanged( col );
2305 if ( selectedMessages.isEmpty() )
2307 applyFilters( selectedMessages );
2312 if ( mCurrentFolder && mCurrentFolder->collection().isValid() ) {
2313 Akonadi::ItemFetchJob *job =
new Akonadi::ItemFetchJob( mCurrentFolder->collection(), this );
2314 connect( job, SIGNAL(result(
KJob*)),
this, SLOT(slotFetchItemsForFolderDone(
KJob*)) );
2318 void KMMainWidget::slotFetchItemsForFolderDone(
KJob*job)
2320 Akonadi::ItemFetchJob *fjob =
dynamic_cast<Akonadi::ItemFetchJob*
>( job );
2322 Akonadi::Item::List items = fjob->items();
2323 applyFilters( items );
2328 #ifndef QT_NO_CURSOR
2329 MessageViewer::KCursorSaver busy( MessageViewer::KBusyPtr::busy() );
2332 MailCommon::FilterManager::instance()->filter( selectedMessages );
2338 updateVacationScriptStatus(
false );
2342 mVacationManager->checkVacation();
2343 connect(mVacationManager, SIGNAL(updateVacationScriptStatus(
bool,QString)), SLOT(updateVacationScriptStatus(
bool,QString)) );
2344 connect(mVacationManager, SIGNAL(editVacation()), SLOT(slotEditVacation()) );
2349 if ( !
kmkernel->askToGoOnline() ) {
2353 mVacationManager->slotEditVacation();
2359 #if !defined(NDEBUG)
2360 if ( mSieveDebugDialog )
2363 mSieveDebugDialog =
new KSieveUi::SieveDebugDialog(
this );
2364 mSieveDebugDialog->exec();
2365 delete mSieveDebugDialog;
2372 if ( !QProcess::startDetached(QLatin1String(
"kleopatra") ) )
2373 KMessageBox::error(
this, i18n(
"Could not start certificate manager; "
2374 "please check your installation." ),
2375 i18n(
"KMail Error" ) );
2377 kDebug() <<
"\nslotStartCertManager(): certificate manager started.";
2383 if ( !QProcess::startDetached(QLatin1String(
"kwatchgnupg")) )
2384 KMessageBox::error(
this, i18n(
"Could not start GnuPG LogViewer (kwatchgnupg); "
2385 "please check your installation." ),
2386 i18n(
"KMail Error" ) );
2393 mMsgActions->setupForwardActions();
2394 mMsgActions->setupForwardingActionsList( mGUIClient );
2401 if ( selectedMessages.isEmpty() )
2404 saveCommand->
start();
2412 openCommand->
start();
2419 if ( selectedMessages.isEmpty() )
2426 if ( mMsgView && selectedMessages.size() == 1 &&
2427 mMsgView->message().hasPayload<KMime::Message::Ptr>() &&
2428 selectedMessages.first().id() == mMsgView->message().id() ) {
2429 Akonadi::Item dummyItem;
2430 dummyItem.setPayload<KMime::Message::Ptr>( mMsgView->message().payload<KMime::Message::Ptr>() );
2436 saveCommand->
start();
2448 slotCheckVacation();
2454 if ( !mAkonadiStandardActionManager ) {
2457 KAction * action = mAkonadiStandardActionManager->action( Akonadi::StandardActionManager::ToggleWorkOffline );
2459 action->setText( i18n(
"Work Offline") );
2460 action->setIcon( KIcon(QLatin1String(
"user-offline")) );
2462 action->setText( i18n(
"Work Online") );
2463 action->setIcon( KIcon(QLatin1String(
"user-online")) );
2472 kmkernel->msgSender()->sendQueued();
2479 const QStringList availTransports = MailTransport::TransportManager::self()->transportNames();
2480 if ( !availTransports.isEmpty() && availTransports.contains( item->text() ) ) {
2482 kmkernel->msgSender()->sendQueued( item->text() );
2490 if ( mReaderWindowActive ) {
2491 mMsgView->displayBusyPage();
2497 if ( !mReaderWindowActive )
return;
2499 mMsgView->displayOfflinePage();
2504 if ( !mReaderWindowActive )
return;
2506 mMsgView->displayResourceOfflinePage();
2514 Akonadi::Item oldMsg = mMessagePane->currentItem();
2515 if ( oldMsg.isValid() ) {
2517 kDebug() <<
"Old message found";
2518 if ( oldMsg->hasUnencryptedMsg() ) {
2519 kDebug() <<
"Extra unencrypted message found";
2520 KMime::Message* newMsg = oldMsg->unencryptedMsg();
2523 QString msgId( oldMsg->msgId() );
2524 QString prefix(
"DecryptedMsg.");
2525 int oldIdx = msgId.indexOf(prefix, 0, Qt::CaseInsensitive);
2526 if ( -1 == oldIdx ) {
2527 int leftAngle = msgId.lastIndexOf(
'<' );
2528 msgId = msgId.insert( (-1 == leftAngle) ? 0 : ++leftAngle, prefix );
2533 QCharRef c = msgId[ oldIdx+2 ];
2539 newMsg->setMsgId( msgId );
2540 mMsgView->setIdOfLastViewedMessage( msgId );
2543 kDebug() <<
"Adding unencrypted message to folder";
2544 mFolder->addMsg( newMsg );
2547 int newMsgIdx = mFolder->find( newMsg );
2548 Q_ASSERT( newMsgIdx != -1 );
2550 mFolder->unGetMsg( newMsgIdx );
2551 int idx = mFolder->find( oldMsg );
2552 Q_ASSERT( idx != -1 );
2557 mHeaders->setCurrentItemByIndex( newMsgIdx );
2561 kDebug() <<
"Deleting encrypted message";
2562 mFolder->take( idx );
2565 kDebug() <<
"Updating message actions";
2566 updateMessageActions();
2568 kDebug() <<
"Done.";
2570 kDebug() <<
"NO EXTRA UNENCRYPTED MESSAGE FOUND";
2572 kDebug() <<
"AKONADI PORT: Disabled code in " << Q_FUNC_INFO;
2575 kDebug() <<
"PANIC: NO OLD MESSAGE FOUND";
2580 mMessagePane->focusNextMessageItem(MessageList::Core::MessageTypeAny,
true,
false );
2585 mMessagePane->focusPreviousMessageItem( MessageList::Core::MessageTypeAny,
true,
false );
2590 mMessagePane->selectFirstMessageItem( MessageList::Core::MessageTypeAny,
true );
2595 mMessagePane->selectLastMessageItem( MessageList::Core::MessageTypeAny,
true );
2600 mMessagePane->selectFocusedMessageItem(
true );
2605 mMessagePane->selectNextMessageItem( MessageList::Core::MessageTypeAny,
2606 MessageList::Core::ClearExistingSelection,
2612 mMessagePane->selectNextMessageItem(
2613 MessageList::Core::MessageTypeAny,
2614 MessageList::Core::GrowOrShrinkExistingSelection,
2631 if ( !mMessagePane->selectNextMessageItem(
2632 MessageList::Core::MessageTypeUnreadOnly,
2633 MessageList::Core::ClearExistingSelection,
2641 GlobalSettings::EnumLoopOnGotoUnread::LoopInAllFolders ) ||
2643 GlobalSettings::EnumLoopOnGotoUnread::LoopInAllMarkedFolders ) )
2645 mGoToFirstUnreadMessageInSelectedFolder =
true;
2646 mFolderTreeWidget->folderTreeView()->selectNextUnreadFolder(
true );
2647 mGoToFirstUnreadMessageInSelectedFolder =
false;
2654 mMessagePane->selectPreviousMessageItem( MessageList::Core::MessageTypeAny,
2655 MessageList::Core::ClearExistingSelection,
2661 mMessagePane->selectPreviousMessageItem(
2662 MessageList::Core::MessageTypeAny,
2663 MessageList::Core::GrowOrShrinkExistingSelection,
2671 if ( !mMessagePane->selectPreviousMessageItem(
2672 MessageList::Core::MessageTypeUnreadOnly,
2673 MessageList::Core::ClearExistingSelection,
2675 GlobalSettings::self()->loopOnGotoUnread() == GlobalSettings::EnumLoopOnGotoUnread::LoopInCurrentFolder
2680 GlobalSettings::EnumLoopOnGotoUnread::LoopInAllFolders ) ||
2682 GlobalSettings::EnumLoopOnGotoUnread::LoopInAllMarkedFolders ) )
2684 mGoToFirstUnreadMessageInSelectedFolder =
true;
2685 mFolderTreeWidget->folderTreeView()->selectPrevUnreadFolder();
2686 mGoToFirstUnreadMessageInSelectedFolder =
false;
2693 if ( mMessagePane->currentItem().isValid() && !mMessagePane->searchEditHasFocus() )
2694 slotMessageActivated( mMessagePane->currentItem() );
2700 if ( !mCurrentFolder || !msg.isValid() )
2703 if ( CommonKernel->folderIsDraftOrOutbox( mCurrentFolder->collection() ) )
2705 mMsgActions->setCurrentMessage( msg );
2706 mMsgActions->editCurrentMessage();
2710 if ( CommonKernel->folderIsTemplates( mCurrentFolder->collection() ) ) {
2716 ItemFetchJob *itemFetchJob = MessageViewer::Viewer::createFetchJob( msg );
2717 connect( itemFetchJob, SIGNAL(itemsReceived(Akonadi::Item::List)),
2718 SLOT(slotItemsFetchedForActivation(Akonadi::Item::List)) );
2719 connect( itemFetchJob, SIGNAL(result(
KJob*)),
2720 SLOT(itemsFetchForActivationDone(
KJob*)) );
2725 Q_ASSERT( list.size() == 1 );
2727 const Item msg = list.first();
2730 const bool useFixedFont = mMsgView ? mMsgView->isFixedFont() :
2731 MessageViewer::GlobalSettings::self()->useFixedFont();
2735 const Akonadi::Collection parentCollection = MailCommon::Util::parentCollectionFromItem(msg);
2736 win->
showMessage( overrideEncoding(), msg, parentCollection );
2740 void KMMainWidget::itemsFetchForActivationDone(
KJob * job )
2742 if ( job->error() ) {
2743 kDebug() << job->error() << job->errorString();
2744 BroadcastStatus::instance()->setStatusMsg( job->errorString() );
2750 if ( !item.isValid() )
2753 if ( clear.toQInt32() != Akonadi::MessageStatus().toQInt32() )
2759 if ( set.toQInt32() != Akonadi::MessageStatus().toQInt32() )
2769 mMessagePane->selectAll();
2770 updateMessageActions();
2775 updateMessageMenu();
2777 const QString
email = KPIMUtils::firstEmailAddress( aUrl.path() ).toLower();
2778 if ( aUrl.protocol() == QLatin1String(
"mailto") && !email.isEmpty()) {
2779 Akonadi::ContactSearchJob *job =
new Akonadi::ContactSearchJob(
this );
2781 job->setQuery( Akonadi::ContactSearchJob::Email, email, Akonadi::ContactSearchJob::ExactMatch );
2782 job->setProperty(
"msg", QVariant::fromValue( msg ) );
2783 job->setProperty(
"point", aPoint );
2784 job->setProperty(
"imageUrl", imageUrl );
2785 job->setProperty(
"url", aUrl );
2786 connect( job, SIGNAL(result(
KJob*)), SLOT(slotContactSearchJobForMessagePopupDone(
KJob*)) );
2788 showMessagePopup(msg, aUrl, imageUrl, aPoint,
false,
false);
2794 const Akonadi::ContactSearchJob *searchJob = qobject_cast<Akonadi::ContactSearchJob*>( job );
2795 const bool contactAlreadyExists = !searchJob->contacts().isEmpty();
2798 const bool uniqueContactFound = (listContact.count() == 1);
2799 if (uniqueContactFound) {
2800 mMsgView->setContactItem(listContact.first(), searchJob->contacts().at(0));
2802 mMsgView->clearContactItem();
2804 const Akonadi::Item msg = job->property(
"msg" ).value<Akonadi::Item>();
2805 const QPoint aPoint = job->property(
"point" ).toPoint();
2806 const KUrl imageUrl = job->property(
"imageUrl").value<KUrl>();
2807 const KUrl url = job->property(
"url" ).value<KUrl>();
2809 showMessagePopup(msg, url, imageUrl, aPoint, contactAlreadyExists, uniqueContactFound);
2812 void KMMainWidget::showMessagePopup(
const Akonadi::Item&msg ,
const KUrl&url,
const KUrl &imageUrl,
const QPoint& aPoint,
bool contactAlreadyExists,
bool uniqueContactFound)
2814 KMenu *menu =
new KMenu;
2816 bool urlMenuAdded =
false;
2818 if ( !url.isEmpty() ) {
2819 if ( url.protocol() == QLatin1String(
"mailto" ) ) {
2821 menu->addAction( mMsgView->mailToComposeAction() );
2822 menu->addAction( mMsgView->mailToReplyAction() );
2823 menu->addAction( mMsgView->mailToForwardAction() );
2825 menu->addSeparator();
2827 if ( contactAlreadyExists ) {
2828 if (uniqueContactFound) {
2829 menu->addAction( mMsgView->editContactAction() );
2831 menu->addAction( mMsgView->openAddrBookAction() );
2834 menu->addAction( mMsgView->addAddrBookAction() );
2836 menu->addSeparator();
2837 menu->addMenu(mMsgView->viewHtmlOption());
2838 menu->addSeparator();
2839 menu->addAction( mMsgView->copyURLAction() );
2840 urlMenuAdded =
true;
2841 }
else if ( url.protocol() != QLatin1String(
"attachment" ) ) {
2843 menu->addAction( mMsgView->urlOpenAction() );
2844 menu->addAction( mMsgView->addBookmarksAction() );
2845 menu->addAction( mMsgView->urlSaveAsAction() );
2846 menu->addAction( mMsgView->copyURLAction() );
2847 if (mMsgView->isAShortUrl(url)) {
2848 menu->addSeparator();
2849 menu->addAction( mMsgView->expandShortUrlAction() );
2851 if (!imageUrl.isEmpty()) {
2852 menu->addSeparator();
2853 menu->addAction( mMsgView->copyImageLocation());
2854 menu->addAction( mMsgView->downloadImageToDiskAction());
2855 menu->addAction( mMsgView->shareImage());
2856 if (mMsgView->adblockEnabled()) {
2857 menu->addSeparator();
2858 menu->addAction( mMsgView->blockImage());
2861 urlMenuAdded =
true;
2863 kDebug() <<
"URL is:" << url;
2865 const QString selectedText = mMsgView ? mMsgView->copyText() : QString();
2866 if ( mMsgView && !selectedText.isEmpty() ) {
2867 if ( urlMenuAdded ) {
2868 menu->addSeparator();
2870 menu->addAction( mMsgActions->replyMenu() );
2871 menu->addSeparator();
2873 menu->addAction( mMsgView->copyAction() );
2874 menu->addAction( mMsgView->selectAllAction() );
2875 menu->addSeparator();
2876 mMsgActions->addWebShortcutsMenu(menu,selectedText);
2877 menu->addSeparator();
2878 menu->addAction(mMsgView->translateAction());
2879 menu->addSeparator();
2880 menu->addAction( mMsgView->speakTextAction());
2881 }
else if ( !urlMenuAdded ) {
2883 if (!mMessagePane->currentMessage()) {
2888 Akonadi::Collection parentCol = msg.parentCollection();
2889 if ( parentCol.isValid() && CommonKernel->folderIsTemplates( parentCol) ) {
2890 menu->addAction( mUseAction );
2892 menu->addAction( mMsgActions->replyMenu() );
2893 menu->addAction( mMsgActions->forwardMenu() );
2895 if ( parentCol.isValid() && CommonKernel->folderIsSentMailFolder( parentCol ) ) {
2896 menu->addAction( sendAgainAction() );
2898 menu->addAction( editAction() );
2900 menu->addAction( mailingListActionMenu() );
2901 menu->addSeparator();
2903 menu->addAction( mCopyActionMenu );
2904 menu->addAction( mMoveActionMenu );
2906 menu->addSeparator();
2908 menu->addAction( mMsgActions->messageStatusMenu() );
2909 menu->addSeparator();
2911 if (!imageUrl.isEmpty()) {
2912 menu->addSeparator();
2913 menu->addAction( mMsgView->copyImageLocation());
2914 menu->addAction( mMsgView->downloadImageToDiskAction());
2915 menu->addAction( mMsgView->shareImage());
2916 menu->addSeparator();
2917 if (mMsgView->adblockEnabled()) {
2918 menu->addAction( mMsgView->blockImage() );
2919 menu->addSeparator();
2922 menu->addAction( mMsgView->viewSourceAction() );
2923 menu->addAction( mMsgView->toggleFixFontAction() );
2924 menu->addAction( mMsgView->toggleMimePartTreeAction() );
2926 menu->addSeparator();
2927 menu->addAction( mMsgActions->printPreviewAction() );
2928 menu->addAction( mMsgActions->printAction() );
2929 menu->addAction( mSaveAsAction );
2930 menu->addAction( mSaveAttachmentsAction );
2931 menu->addSeparator();
2932 if ( parentCol.isValid() && CommonKernel->folderIsTrash(parentCol) ) {
2933 menu->addAction( mDeleteAction );
2935 menu->addAction( akonadiStandardAction( Akonadi::StandardMailActionManager::MoveToTrash ) );
2937 menu->addSeparator();
2938 menu->addAction( mMsgActions->createTodoAction() );
2939 menu->addSeparator();
2941 menu->addAction( mMsgView->saveMessageDisplayFormatAction() );
2942 menu->addAction( mMsgView->resetMessageDisplayFormatAction() );
2943 menu->addSeparator();
2945 menu->addAction( mMsgActions->annotateAction() );
2946 if (mMsgView && mMsgView->adblockEnabled()) {
2947 menu->addSeparator();
2948 menu->addAction( mMsgView->openBlockableItems());
2951 KAcceleratorManager::manage(menu);
2952 menu->exec( aPoint, 0 );
2959 const Akonadi::AgentInstance::List lst = MailCommon::Util::agentInstances();
2960 foreach (
const Akonadi::AgentInstance& type, lst )
2964 QAction* action = mActMenu->addAction( QString( type.name() ).replace(QLatin1Char(
'&'), QLatin1String(
"&&")) );
2965 action->setData( type.identifier() );
2974 QStringList availTransports = MailTransport::TransportManager::self()->transportNames();
2975 QStringList::Iterator it;
2976 QStringList::Iterator end( availTransports.end() );
2978 for (it = availTransports.begin(); it != end ; ++it)
2979 mSendMenu->addAction((*it).replace(QLatin1Char(
'&'), QLatin1String(
"&&")));
2987 mMsgActions->setMessageView( mMsgView );
2990 mSaveAsAction =
new KAction(KIcon(QLatin1String(
"document-save")), i18n(
"Save &As..."),
this);
2991 actionCollection()->addAction(QLatin1String(
"file_save_as"), mSaveAsAction );
2992 connect(mSaveAsAction, SIGNAL(triggered(
bool)), SLOT(slotSaveMsg()));
2993 mSaveAsAction->setShortcut(KStandardShortcut::save());
2995 mOpenAction = KStandardAction::open(
this, SLOT(slotOpenMsg()),
2996 actionCollection() );
2998 mOpenRecentAction = KStandardAction::openRecent(
this, SLOT(slotOpenRecentMsg(KUrl)),
2999 actionCollection() );
3000 KConfigGroup grp = mConfig->group(QLatin1String(
"Recent Files"));
3001 mOpenRecentAction->loadEntries(grp);
3004 KAction *action =
new KAction(i18n(
"&Expire All Folders"),
this);
3005 actionCollection()->addAction(QLatin1String(
"expire_all_folders"), action );
3006 connect(action, SIGNAL(triggered(
bool)), SLOT(slotExpireAll()));
3009 KAction *action =
new KAction(KIcon(QLatin1String(
"mail-receive")), i18n(
"Check &Mail"),
this);
3010 actionCollection()->addAction(QLatin1String(
"check_mail"), action );
3011 connect(action, SIGNAL(triggered(
bool)), SLOT(slotCheckMail()));
3012 action->setShortcut(QKeySequence(Qt::CTRL+Qt::Key_L));
3015 KActionMenu *actActionMenu =
new KActionMenu(KIcon(QLatin1String(
"mail-receive")), i18n(
"Check Mail In"),
this);
3016 actActionMenu->setIconText( i18n(
"Check Mail") );
3017 actActionMenu->setToolTip( i18n(
"Check Mail") );
3018 actionCollection()->addAction(QLatin1String(
"check_mail_in"), actActionMenu );
3019 actActionMenu->setDelayed(
true);
3020 connect(actActionMenu, SIGNAL(triggered(
bool)),
this, SLOT(slotCheckMail()));
3021 mActMenu = actActionMenu->menu();
3022 connect(mActMenu, SIGNAL(triggered(QAction*)),
3023 SLOT(slotCheckOneAccount(QAction*)));
3024 connect(mActMenu, SIGNAL(aboutToShow()), SLOT(getAccountMenu()));
3026 mSendQueued =
new KAction(KIcon(QLatin1String(
"mail-send")), i18n(
"&Send Queued Messages"),
this);
3027 actionCollection()->addAction(QLatin1String(
"send_queued"), mSendQueued );
3028 connect(mSendQueued, SIGNAL(triggered(
bool)), SLOT(slotSendQueued()));
3031 KAction * action = mAkonadiStandardActionManager->action( Akonadi::StandardActionManager::ToggleWorkOffline );
3032 mAkonadiStandardActionManager->interceptAction( Akonadi::StandardActionManager::ToggleWorkOffline );
3033 action->setCheckable(
false);
3034 connect( action, SIGNAL(triggered(
bool)),
this, SLOT(slotOnlineStatus()) );
3035 action->setText( i18n(
"Online status (unknown)") );
3038 mSendActionMenu =
new KActionMenu(KIcon(QLatin1String(
"mail-send-via")), i18n(
"Send Queued Messages Via"),
this);
3039 actionCollection()->addAction(QLatin1String(
"send_queued_via"), mSendActionMenu );
3040 mSendActionMenu->setDelayed(
true);
3042 mSendMenu = mSendActionMenu->menu();
3043 connect(mSendMenu,SIGNAL(triggered(QAction*)), SLOT(slotSendQueuedVia(QAction*)));
3044 connect(mSendMenu,SIGNAL(aboutToShow()),SLOT(getTransportMenu()));
3047 if (parent()->inherits(
"KMMainWin")) {
3048 KAction *action =
new KAction(KIcon(QLatin1String(
"x-office-address-book")), i18n(
"&Address Book"),
this);
3049 actionCollection()->addAction(QLatin1String(
"addressbook"), action );
3050 connect(action, SIGNAL(triggered(
bool)), SLOT(slotAddrBook()));
3051 if (KStandardDirs::findExe(QLatin1String(
"kaddressbook")).isEmpty())
3052 action->setEnabled(
false);
3056 KAction *action =
new KAction(KIcon(QLatin1String(
"pgp-keys")), i18n(
"Certificate Manager"),
this);
3057 actionCollection()->addAction(QLatin1String(
"tools_start_certman"), action );
3058 connect(action, SIGNAL(triggered(
bool)), SLOT(slotStartCertManager()));
3060 if (KStandardDirs::findExe(QLatin1String(
"kleopatra")).isEmpty())
3061 action->setEnabled(
false);
3064 KAction *action =
new KAction(KIcon(QLatin1String(
"pgp-keys")), i18n(
"GnuPG Log Viewer"),
this);
3065 actionCollection()->addAction(QLatin1String(
"tools_start_kwatchgnupg"), action );
3066 connect(action, SIGNAL(triggered(
bool)), SLOT(slotStartWatchGnuPG()));
3069 const bool usableKWatchGnupg =
false;
3072 bool usableKWatchGnupg = !KStandardDirs::findExe(QLatin1String(
"kwatchgnupg")).isEmpty();
3074 action->setEnabled(usableKWatchGnupg);
3077 KAction *action =
new KAction(KIcon(QLatin1String(
"document-import")), i18n(
"&Import Messages..."),
this);
3078 actionCollection()->addAction(QLatin1String(
"import"), action );
3079 connect(action, SIGNAL(triggered(
bool)), SLOT(slotImport()));
3080 if (KStandardDirs::findExe(QLatin1String(
"kmailcvt")).isEmpty()) action->setEnabled(
false);
3083 #if !defined(NDEBUG)
3085 KAction *action =
new KAction(i18n(
"&Debug Sieve..."),
this);
3086 actionCollection()->addAction(QLatin1String(
"tools_debug_sieve"), action );
3087 connect(action, SIGNAL(triggered(
bool)), SLOT(slotDebugSieve()));
3092 KAction *action =
new KAction(i18n(
"Filter &Log Viewer..."),
this);
3093 actionCollection()->addAction(QLatin1String(
"filter_log_viewer"), action );
3094 connect(action, SIGNAL(triggered(
bool)), SLOT(slotFilterLogViewer()));
3097 KAction *action =
new KAction(i18n(
"&Anti-Spam Wizard..."),
this);
3098 actionCollection()->addAction(QLatin1String(
"antiSpamWizard"), action );
3099 connect(action, SIGNAL(triggered(
bool)), SLOT(slotAntiSpamWizard()));
3102 KAction *action =
new KAction(i18n(
"&Anti-Virus Wizard..."),
this);
3103 actionCollection()->addAction(QLatin1String(
"antiVirusWizard"), action );
3104 connect(action, SIGNAL(triggered(
bool)), SLOT(slotAntiVirusWizard()));
3107 KAction *action =
new KAction( i18n(
"&Account Wizard..."),
this );
3108 actionCollection()->addAction( QLatin1String(
"accountWizard"), action );
3109 connect( action, SIGNAL(triggered(
bool)), SLOT(slotAccountWizard()) );
3112 KAction *action =
new KAction( i18n(
"&Import Wizard..."),
this );
3113 actionCollection()->addAction( QLatin1String(
"importWizard"), action );
3114 connect( action, SIGNAL(triggered(
bool)), SLOT(slotImportWizard()) );
3116 if ( KSieveUi::Util::allowOutOfOfficeSettings() )
3118 KAction *action =
new KAction( i18n(
"Edit \"Out of Office\" Replies..."),
this );
3119 actionCollection()->addAction( QLatin1String(
"tools_edit_vacation"), action );
3120 connect( action, SIGNAL(triggered(
bool)), SLOT(slotEditVacation()) );
3124 KAction *action =
new KAction(i18n(
"&Configure Automatic Archiving..."),
this);
3125 actionCollection()->addAction(QLatin1String(
"tools_automatic_archiving"), action );
3126 connect(action, SIGNAL(triggered(
bool)), SLOT(slotConfigureAutomaticArchiving()));
3130 KAction *action =
new KAction(i18n(
"Configure Send Later Agent..."),
this);
3131 actionCollection()->addAction(QLatin1String(
"tools_configure_sendlater"), action );
3132 connect(action, SIGNAL(triggered(
bool)), SLOT(slotConfigureSendLater()));
3136 KAction *action =
new KAction(i18n(
"&Configure Folder Archive Agent..."),
this);
3137 actionCollection()->addAction(QLatin1String(
"tools_configure_folderarchiving"), action );
3138 connect(action, SIGNAL(triggered(
bool)), SLOT(slotConfigureFolderArchiving()));
3143 KAction*
const standardDelAction = akonadiStandardAction( Akonadi::StandardActionManager::DeleteItems );
3144 standardDelAction->setShortcut( QKeySequence() );
3152 mDeleteAction =
new KAction(KIcon(QLatin1String(
"edit-delete")), i18nc(
"@action Hard delete, bypassing trash",
"&Delete"),
this);
3153 actionCollection()->addAction(QLatin1String(
"delete"), mDeleteAction );
3154 connect(mDeleteAction, SIGNAL(triggered(
bool)), SLOT(slotDeleteMsg()));
3155 mDeleteAction->setShortcut(QKeySequence(Qt::SHIFT+Qt::Key_Delete));
3157 mTrashThreadAction =
new KAction(i18n(
"M&ove Thread to Trash"),
this);
3158 actionCollection()->addAction(QLatin1String(
"move_thread_to_trash"), mTrashThreadAction );
3159 mTrashThreadAction->setShortcut(QKeySequence(Qt::CTRL+Qt::Key_Delete));
3160 mTrashThreadAction->setIcon(KIcon(QLatin1String(
"user-trash")));
3161 mTrashThreadAction->setHelpText(i18n(
"Move thread to trashcan") );
3162 connect(mTrashThreadAction, SIGNAL(triggered(
bool)), SLOT(slotTrashThread()));
3164 mDeleteThreadAction =
new KAction(KIcon(QLatin1String(
"edit-delete")), i18n(
"Delete T&hread"),
this);
3165 actionCollection()->addAction(QLatin1String(
"delete_thread"), mDeleteThreadAction );
3166 connect(mDeleteThreadAction, SIGNAL(triggered(
bool)), SLOT(slotDeleteThread()));
3167 mDeleteThreadAction->setShortcut(QKeySequence(Qt::CTRL+Qt::SHIFT+Qt::Key_Delete));
3170 KAction *action =
new KAction(KIcon(QLatin1String(
"edit-find-mail")), i18n(
"&Find Messages..."),
this);
3171 actionCollection()->addAction(QLatin1String(
"search_messages"), action );
3172 connect(action, SIGNAL(triggered(
bool)), SLOT(slotRequestFullSearchFromQuickSearch()));
3173 action->setShortcut(QKeySequence(Qt::Key_S));
3176 KAction *action =
new KAction(i18n(
"Select &All Messages"),
this);
3177 actionCollection()->addAction(QLatin1String(
"mark_all_messages"), action );
3178 connect(action, SIGNAL(triggered(
bool)), SLOT(slotMarkAll()));
3179 action->setShortcut( QKeySequence( Qt::CTRL + Qt::Key_A ) );
3184 mFolderMailingListPropertiesAction =
new KAction(i18n(
"&Mailing List Management..."),
this);
3185 actionCollection()->addAction(QLatin1String(
"folder_mailinglist_properties"), mFolderMailingListPropertiesAction );
3186 connect(mFolderMailingListPropertiesAction, SIGNAL(triggered(
bool)), SLOT(slotFolderMailingListProperties()));
3189 mShowFolderShortcutDialogAction =
new KAction(KIcon(QLatin1String(
"configure-shortcuts")), i18n(
"&Assign Shortcut..."),
this);
3190 actionCollection()->addAction(QLatin1String(
"folder_shortcut_command"), mShowFolderShortcutDialogAction );
3191 connect( mShowFolderShortcutDialogAction, SIGNAL(triggered(
bool)),
3192 SLOT(slotShowFolderShortcutDialog()) );
3206 mExpireFolderAction =
new KAction(i18n(
"&Expiration Settings"),
this);
3207 actionCollection()->addAction(QLatin1String(
"expire"), mExpireFolderAction );
3208 connect(mExpireFolderAction, SIGNAL(triggered(
bool)), SLOT(slotExpireFolder()));
3211 mAkonadiStandardActionManager->interceptAction( Akonadi::StandardMailActionManager::MoveToTrash );
3212 connect( mAkonadiStandardActionManager->action( Akonadi::StandardMailActionManager::MoveToTrash ), SIGNAL(triggered(
bool)),
this, SLOT(slotTrashSelectedMessages()) );
3215 mAkonadiStandardActionManager->interceptAction( Akonadi::StandardMailActionManager::MoveAllToTrash );
3216 connect( mAkonadiStandardActionManager->action( Akonadi::StandardMailActionManager::MoveAllToTrash ), SIGNAL(triggered(
bool)),
this, SLOT(slotEmptyFolder()) );
3218 mAkonadiStandardActionManager->interceptAction( Akonadi::StandardActionManager::DeleteCollections );
3219 connect( mAkonadiStandardActionManager->action( Akonadi::StandardActionManager::DeleteCollections ), SIGNAL(triggered(
bool)),
this, SLOT(slotRemoveFolder()) );
3224 mArchiveFolderAction =
new KAction( i18n(
"&Archive Folder..." ),
this );
3225 actionCollection()->addAction( QLatin1String(
"archive_folder"), mArchiveFolderAction );
3226 connect( mArchiveFolderAction, SIGNAL(triggered(
bool)), SLOT(slotArchiveFolder()) );
3228 mPreferHtmlAction =
new KToggleAction(i18n(
"Prefer &HTML to Plain Text"),
this);
3229 actionCollection()->addAction(QLatin1String(
"prefer_html"), mPreferHtmlAction );
3230 connect(mPreferHtmlAction, SIGNAL(triggered(
bool)), SLOT(slotOverrideHtml()));
3232 mPreferHtmlLoadExtAction =
new KToggleAction(i18n(
"Load E&xternal References"),
this);
3233 actionCollection()->addAction(QLatin1String(
"prefer_html_external_refs"), mPreferHtmlLoadExtAction );
3234 connect(mPreferHtmlLoadExtAction, SIGNAL(triggered(
bool)), SLOT(slotOverrideHtmlLoadExt()));
3237 KAction *action = mAkonadiStandardActionManager->action( Akonadi::StandardActionManager::CopyCollections);
3238 action->setShortcut(QKeySequence(Qt::SHIFT+Qt::CTRL+Qt::Key_C));
3241 KAction *action = mAkonadiStandardActionManager->action( Akonadi::StandardActionManager::Paste);
3242 action->setShortcut(QKeySequence(Qt::SHIFT+Qt::CTRL+Qt::Key_V));
3245 KAction *action = mAkonadiStandardActionManager->action( Akonadi::StandardActionManager::CopyItems);
3246 action->setShortcut(QKeySequence(Qt::ALT+Qt::CTRL+Qt::Key_C));
3249 KAction *action = mAkonadiStandardActionManager->action( Akonadi::StandardActionManager::CutItems );
3250 action->setShortcut(QKeySequence(Qt::ALT+Qt::CTRL+Qt::Key_X));
3254 KAction *action = mAkonadiStandardActionManager->action( Akonadi::StandardActionManager::CopyItemToMenu );
3255 action->setText(i18n(
"Copy Message To...") );
3256 action = mAkonadiStandardActionManager->action( Akonadi::StandardActionManager::MoveItemToMenu );
3257 action->setText(i18n(
"Move Message To...") );
3262 KAction *action =
new KAction(KIcon(QLatin1String(
"mail-message-new")), i18n(
"&New Message..."),
this);
3263 actionCollection()->addAction(QLatin1String(
"new_message"), action );
3264 action->setIconText( i18nc(
"@action:intoolbar New Empty Message",
"New" ) );
3265 connect(action, SIGNAL(triggered(
bool)), SLOT(slotCompose()));
3267 if ( !
kmkernel->xmlGuiInstance().isValid() ) {
3268 action->setShortcut(KStandardShortcut::openNew());
3272 mTemplateMenu =
new KActionMenu( KIcon( QLatin1String(
"document-new") ), i18n(
"Message From &Template"),
3273 actionCollection() );
3274 mTemplateMenu->setDelayed(
true );
3275 actionCollection()->addAction(QLatin1String(
"new_from_template"), mTemplateMenu );
3276 connect( mTemplateMenu->menu(), SIGNAL(aboutToShow()),
this,
3277 SLOT(slotShowNewFromTemplate()) );
3278 connect( mTemplateMenu->menu(), SIGNAL(triggered(QAction*)),
this,
3279 SLOT(slotNewFromTemplate(QAction*)) );
3281 mMessageNewList =
new KAction( KIcon( QLatin1String(
"mail-message-new-list") ),
3282 i18n(
"New Message t&o Mailing-List..." ),
3284 actionCollection()->addAction(QLatin1String(
"post_message"), mMessageNewList);
3285 connect( mMessageNewList, SIGNAL(triggered(
bool)),
3286 SLOT(slotPostToML()) );
3287 mMessageNewList->setShortcut( QKeySequence( Qt::CTRL + Qt::SHIFT + Qt::Key_N ) );
3289 mSendAgainAction =
new KAction(i18n(
"Send A&gain..."),
this);
3290 actionCollection()->addAction(QLatin1String(
"send_again"), mSendAgainAction );
3291 connect(mSendAgainAction, SIGNAL(triggered(
bool)), SLOT(slotResendMsg()));
3294 mFilterMenu =
new KActionMenu(KIcon(QLatin1String(
"view-filter")), i18n(
"&Create Filter"),
this);
3295 actionCollection()->addAction(QLatin1String(
"create_filter"), mFilterMenu );
3296 connect( mFilterMenu, SIGNAL(triggered(
bool)),
this,
3297 SLOT(slotFilter()) );
3299 KAction *action =
new KAction(i18n(
"Filter on &Subject..."),
this);
3300 actionCollection()->addAction(QLatin1String(
"subject_filter"), action );
3301 connect(action, SIGNAL(triggered(
bool)), SLOT(slotSubjectFilter()));
3302 mFilterMenu->addAction( action );
3306 KAction *action =
new KAction(i18n(
"Filter on &From..."),
this);
3307 actionCollection()->addAction(QLatin1String(
"from_filter"), action );
3308 connect(action, SIGNAL(triggered(
bool)), SLOT(slotFromFilter()));
3309 mFilterMenu->addAction( action );
3312 KAction *action =
new KAction(i18n(
"Filter on &To..."),
this);
3313 actionCollection()->addAction(QLatin1String(
"to_filter"), action );
3314 connect(action, SIGNAL(triggered(
bool)), SLOT(slotToFilter()));
3315 mFilterMenu->addAction( action );
3317 mFilterMenu->addAction( mMsgActions->listFilterAction() );
3319 mUseAction =
new KAction( KIcon(QLatin1String(
"document-new")), i18n(
"New Message From &Template"),
this );
3320 actionCollection()->addAction(QLatin1String(
"use_template"), mUseAction);
3321 connect(mUseAction, SIGNAL(triggered(
bool)), SLOT(slotUseTemplate()));
3322 mUseAction->setShortcut(QKeySequence(Qt::SHIFT + Qt::Key_N));
3325 mThreadStatusMenu =
new KActionMenu(i18n(
"Mark &Thread"),
this);
3326 actionCollection()->addAction(QLatin1String(
"thread_status"), mThreadStatusMenu );
3328 mMarkThreadAsReadAction =
new KAction(KIcon(QLatin1String(
"mail-mark-read")), i18n(
"Mark Thread as &Read"),
this);
3329 actionCollection()->addAction(QLatin1String(
"thread_read"), mMarkThreadAsReadAction );
3330 connect(mMarkThreadAsReadAction, SIGNAL(triggered(
bool)), SLOT(slotSetThreadStatusRead()));
3331 mMarkThreadAsReadAction->setHelpText(i18n(
"Mark all messages in the selected thread as read"));
3332 mThreadStatusMenu->addAction( mMarkThreadAsReadAction );
3334 mMarkThreadAsUnreadAction =
new KAction(KIcon(QLatin1String(
"mail-mark-unread")), i18n(
"Mark Thread as &Unread"),
this);
3335 actionCollection()->addAction(QLatin1String(
"thread_unread"), mMarkThreadAsUnreadAction );
3336 connect(mMarkThreadAsUnreadAction, SIGNAL(triggered(
bool)), SLOT(slotSetThreadStatusUnread()));
3337 mMarkThreadAsUnreadAction->setHelpText(i18n(
"Mark all messages in the selected thread as unread"));
3338 mThreadStatusMenu->addAction( mMarkThreadAsUnreadAction );
3340 mThreadStatusMenu->addSeparator();
3343 mToggleThreadImportantAction =
new KToggleAction(KIcon(QLatin1String(
"mail-mark-important")), i18n(
"Mark Thread as &Important"),
this);
3344 actionCollection()->addAction(QLatin1String(
"thread_flag"), mToggleThreadImportantAction );
3345 connect(mToggleThreadImportantAction, SIGNAL(triggered(
bool)), SLOT(slotSetThreadStatusImportant()));
3346 mToggleThreadImportantAction->setCheckedState( KGuiItem(i18n(
"Remove &Important Thread Mark")) );
3347 mThreadStatusMenu->addAction( mToggleThreadImportantAction );
3349 mToggleThreadToActAction =
new KToggleAction(KIcon(QLatin1String(
"mail-mark-task")), i18n(
"Mark Thread as &Action Item"),
this);
3350 actionCollection()->addAction(QLatin1String(
"thread_toact"), mToggleThreadToActAction );
3351 connect(mToggleThreadToActAction, SIGNAL(triggered(
bool)), SLOT(slotSetThreadStatusToAct()));
3352 mToggleThreadToActAction->setCheckedState( KGuiItem(i18n(
"Remove &Action Item Thread Mark")) );
3353 mThreadStatusMenu->addAction( mToggleThreadToActAction );
3356 mWatchThreadAction =
new KToggleAction(KIcon(QLatin1String(
"mail-thread-watch")), i18n(
"&Watch Thread"),
this);
3357 actionCollection()->addAction(QLatin1String(
"thread_watched"), mWatchThreadAction );
3358 connect(mWatchThreadAction, SIGNAL(triggered(
bool)), SLOT(slotSetThreadStatusWatched()));
3360 mIgnoreThreadAction =
new KToggleAction(KIcon(QLatin1String(
"mail-thread-ignored")), i18n(
"&Ignore Thread"),
this);
3361 actionCollection()->addAction(QLatin1String(
"thread_ignored"), mIgnoreThreadAction );
3362 connect(mIgnoreThreadAction, SIGNAL(triggered(
bool)), SLOT(slotSetThreadStatusIgnored()));
3364 mThreadStatusMenu->addSeparator();
3365 mThreadStatusMenu->addAction( mWatchThreadAction );
3366 mThreadStatusMenu->addAction( mIgnoreThreadAction );
3368 mSaveAttachmentsAction =
new KAction(KIcon(QLatin1String(
"mail-attachment")), i18n(
"Save A&ttachments..."),
this);
3369 actionCollection()->addAction(QLatin1String(
"file_save_attachments"), mSaveAttachmentsAction );
3370 connect(mSaveAttachmentsAction, SIGNAL(triggered(
bool)), SLOT(slotSaveAttachments()));
3372 mMoveActionMenu = mAkonadiStandardActionManager->action( Akonadi::StandardActionManager::MoveItemToMenu);
3374 mCopyActionMenu = mAkonadiStandardActionManager->action( Akonadi::StandardActionManager::CopyItemToMenu);
3376 mApplyAllFiltersAction =
3377 new KAction( KIcon( QLatin1String(
"view-filter") ), i18n(
"Appl&y All Filters" ),
this );
3378 actionCollection()->addAction( QLatin1String(
"apply_filters"), mApplyAllFiltersAction );
3379 connect( mApplyAllFiltersAction, SIGNAL(triggered(
bool)),
3380 SLOT(slotApplyFilters()) );
3381 mApplyAllFiltersAction->setShortcut( QKeySequence( Qt::CTRL + Qt::Key_J ) );
3383 mApplyFilterActionsMenu =
new KActionMenu( i18n(
"A&pply Filter" ),
this );
3384 actionCollection()->addAction( QLatin1String(
"apply_filter_actions"), mApplyFilterActionsMenu );
3387 KAction *action =
new KAction(i18nc(
"View->",
"&Expand Thread / Group"),
this);
3388 actionCollection()->addAction(QLatin1String(
"expand_thread"), action );
3389 action->setShortcut(QKeySequence(Qt::Key_Period));
3390 action->setHelpText(i18n(
"Expand the current thread or group"));
3391 connect(action, SIGNAL(triggered(
bool)), SLOT(slotExpandThread()));
3394 KAction *action =
new KAction(i18nc(
"View->",
"&Collapse Thread / Group"),
this);
3395 actionCollection()->addAction(QLatin1String(
"collapse_thread"), action );
3396 action->setShortcut(QKeySequence(Qt::Key_Comma));
3397 action->setHelpText( i18n(
"Collapse the current thread or group"));
3398 connect(action, SIGNAL(triggered(
bool)), SLOT(slotCollapseThread()));
3401 KAction *action =
new KAction(i18nc(
"View->",
"Ex&pand All Threads"),
this);
3402 actionCollection()->addAction(QLatin1String(
"expand_all_threads"), action );
3403 action->setShortcut(QKeySequence(Qt::CTRL+Qt::Key_Period));
3404 action->setHelpText( i18n(
"Expand all threads in the current folder"));
3405 connect(action, SIGNAL(triggered(
bool)), SLOT(slotExpandAllThreads()));
3408 KAction *action =
new KAction(i18nc(
"View->",
"C&ollapse All Threads"),
this);
3409 actionCollection()->addAction(QLatin1String(
"collapse_all_threads"), action );
3410 action->setShortcut(QKeySequence(Qt::CTRL+Qt::Key_Comma));
3411 action->setHelpText( i18n(
"Collapse all threads in the current folder"));
3412 connect(action, SIGNAL(triggered(
bool)), SLOT(slotCollapseAllThreads()));
3416 KAction *dukeOfMonmoth =
new KAction(i18n(
"&Display Message"),
this);
3417 actionCollection()->addAction(QLatin1String(
"display_message"), dukeOfMonmoth );
3418 connect(dukeOfMonmoth, SIGNAL(triggered(
bool)), SLOT(slotDisplayCurrentMessage()));
3419 KShortcut shortcut = KShortcut(QKeySequence( Qt::Key_Enter ));
3420 shortcut.setAlternate( QKeySequence( Qt::Key_Return ) );
3421 dukeOfMonmoth->setShortcuts( shortcut );
3425 KAction *action =
new KAction(i18n(
"&Next Message"),
this);
3426 actionCollection()->addAction(QLatin1String(
"go_next_message"), action );
3427 action->setShortcuts(KShortcut( QLatin1String(
"N; Right") ));
3428 action->setHelpText(i18n(
"Go to the next message"));
3429 connect(action, SIGNAL(triggered(
bool)), SLOT(slotSelectNextMessage()));
3432 KAction *action =
new KAction(i18n(
"Next &Unread Message"),
this);
3433 actionCollection()->addAction(QLatin1String(
"go_next_unread_message"), action );
3434 action->setShortcut(QKeySequence(Qt::Key_Plus));
3435 if ( QApplication::isRightToLeft() ) {
3436 action->setIcon( KIcon( QLatin1String(
"go-previous") ) );
3438 action->setIcon( KIcon( QLatin1String(
"go-next") ) );
3440 action->setIconText( i18nc(
"@action:inmenu Goto next unread message",
"Next" ) );
3441 action->setHelpText(i18n(
"Go to the next unread message"));
3442 connect(action, SIGNAL(triggered(
bool)), SLOT(slotSelectNextUnreadMessage()));
3445 KAction *action =
new KAction(i18n(
"&Previous Message"),
this);
3446 actionCollection()->addAction(QLatin1String(
"go_prev_message"), action );
3447 action->setHelpText(i18n(
"Go to the previous message"));
3448 action->setShortcuts(KShortcut( QLatin1String(
"P; Left") ));
3449 connect(action, SIGNAL(triggered(
bool)), SLOT(slotSelectPreviousMessage()));
3452 KAction *action =
new KAction(i18n(
"Previous Unread &Message"),
this);
3453 actionCollection()->addAction(QLatin1String(
"go_prev_unread_message"), action );
3454 action->setShortcut(QKeySequence(Qt::Key_Minus));
3455 if ( QApplication::isRightToLeft() ) {
3456 action->setIcon( KIcon( QLatin1String(
"go-next") ) );
3458 action->setIcon( KIcon( QLatin1String(
"go-previous") ) );
3460 action->setIconText( i18nc(
"@action:inmenu Goto previous unread message.",
"Previous" ) );
3461 action->setHelpText(i18n(
"Go to the previous unread message"));
3462 connect(action, SIGNAL(triggered(
bool)), SLOT(slotSelectPreviousUnreadMessage()));
3465 KAction *action =
new KAction(i18n(
"Next Unread &Folder"),
this);
3466 actionCollection()->addAction(QLatin1String(
"go_next_unread_folder"), action );
3467 connect(action, SIGNAL(triggered(
bool)), SLOT(slotNextUnreadFolder()));
3468 action->setShortcut(QKeySequence(Qt::ALT+Qt::Key_Plus));
3469 action->setHelpText(i18n(
"Go to the next folder with unread messages"));
3472 KAction *action =
new KAction(i18n(
"Previous Unread F&older"),
this);
3473 actionCollection()->addAction(QLatin1String(
"go_prev_unread_folder"), action );
3474 action->setShortcut(QKeySequence(Qt::ALT+Qt::Key_Minus));
3475 action->setHelpText(i18n(
"Go to the previous folder with unread messages"));
3476 connect(action, SIGNAL(triggered(
bool)), SLOT(slotPrevUnreadFolder()));
3479 KAction *action =
new KAction(i18nc(
"Go->",
"Next Unread &Text"),
this);
3480 actionCollection()->addAction(QLatin1String(
"go_next_unread_text"), action );
3481 action->setShortcut(QKeySequence(Qt::Key_Space));
3482 action->setHelpText(i18n(
"Go to the next unread text"));
3483 action->setWhatsThis( i18n(
"Scroll down current message. "
3484 "If at end of current message, "
3485 "go to next unread message."));
3486 connect(action, SIGNAL(triggered(
bool)), SLOT(slotReadOn()));
3491 KAction *action =
new KAction(i18n(
"Configure &Filters..."),
this);
3492 action->setMenuRole( QAction::NoRole );
3493 actionCollection()->addAction(QLatin1String(
"filter"), action );
3494 connect(action, SIGNAL(triggered(
bool)), SLOT(slotFilter()));
3497 KAction *action =
new KAction(i18n(
"Manage &Sieve Scripts..."),
this);
3498 actionCollection()->addAction(QLatin1String(
"sieveFilters"), action );
3499 connect(action, SIGNAL(triggered(
bool)), SLOT(slotManageSieveScripts()));
3502 KAction *action =
new KAction(KIcon(QLatin1String(
"kmail")), i18n(
"KMail &Introduction"),
this);
3503 actionCollection()->addAction(QLatin1String(
"help_kmail_welcomepage"), action );
3504 action->setHelpText( i18n(
"Display KMail's Welcome Page") );
3505 connect(action, SIGNAL(triggered(
bool)), SLOT(slotIntro()));
3512 KAction *action =
new KAction( KIcon(QLatin1String(
"preferences-desktop-notification")),
3513 i18n(
"Configure &Notifications..."),
this );
3514 action->setMenuRole( QAction::NoRole );
3515 actionCollection()->addAction( QLatin1String(
"kmail_configure_notifications"), action );
3516 connect(action, SIGNAL(triggered(
bool)), SLOT(slotEditNotifications()));
3520 KAction *action =
new KAction(KIcon(QLatin1String(
"configure")), i18n(
"&Configure KMail..."),
this);
3521 actionCollection()->addAction(QLatin1String(
"kmail_configure_kmail"), action );
3522 connect(action, SIGNAL(triggered(
bool)),
kmkernel, SLOT(slotShowConfigurationDialog()));
3526 mExpireConfigAction =
new KAction( i18n(
"Expire..." ),
this );
3527 actionCollection()->addAction( QLatin1String(
"expire_settings"),mExpireConfigAction );
3528 connect( mExpireConfigAction, SIGNAL(triggered(
bool)),
this, SLOT(slotShowExpiryProperties()) );
3532 KAction *action =
new KAction( KIcon( QLatin1String(
"bookmark-new" )), i18n(
"Add Favorite Folder..." ),
this );
3533 actionCollection()->addAction( QLatin1String(
"add_favorite_folder"), action );
3534 connect( action, SIGNAL(triggered(
bool)),
this, SLOT(slotAddFavoriteFolder()) );
3538 mServerSideSubscription =
new KAction( KIcon( QLatin1String(
"folder-bookmarks") ), i18n(
"Serverside Subscription..." ),
this);
3539 actionCollection()->addAction( QLatin1String(
"serverside_subscription"), mServerSideSubscription);
3540 connect( mServerSideSubscription, SIGNAL(triggered(
bool)),
this, SLOT(slotServerSideSubscription()) );
3545 mApplyFiltersOnFolder =
new KAction( KIcon( QLatin1String(
"view-filter") ), i18n(
"Appl&y All Filters On Folder" ),
this );
3546 actionCollection()->addAction( QLatin1String(
"apply_filters_on_folder"), mApplyFiltersOnFolder );
3547 connect( mApplyFiltersOnFolder, SIGNAL(triggered(
bool)),
3548 SLOT(slotApplyFiltersOnFolder()) );
3553 KAction *action =
new KAction(KIcon(QLatin1String(
"kmail")), i18n(
"&Export KMail Data..."),
this);
3554 actionCollection()->addAction(QLatin1String(
"kmail_export_data"), action );
3555 connect(action, SIGNAL(triggered(
bool)),
this, SLOT(slotExportData()));
3559 KAction *action =
new KAction(KIcon( QLatin1String(
"contact-new" ) ),i18n(
"New AddressBook Contact..."),
this);
3560 actionCollection()->addAction(QLatin1String(
"kmail_new_addressbook_contact"), action );
3561 connect(action, SIGNAL(triggered(
bool)),
this, SLOT(slotCreateAddressBookContact()));
3566 actionCollection()->addAction(KStandardAction::Undo, QLatin1String(
"kmail_undo"),
this, SLOT(slotUndo()));
3568 KStandardAction::tipOfDay(
this, SLOT(slotShowTip()), actionCollection() );
3570 menutimer =
new QTimer(
this );
3571 menutimer->setObjectName( QLatin1String(
"menutimer") );
3572 menutimer->setSingleShot(
true );
3573 connect( menutimer, SIGNAL(timeout()), SLOT(updateMessageActionsDelayed()) );
3575 SIGNAL(undoStackChanged()),
this, SLOT(slotUpdateUndo()));
3577 updateMessageActions();
3584 KAction *action =
new KAction( i18n(
"Copy Message to Folder"),
this );
3585 actionCollection()->addAction(QLatin1String(
"copy_message_to_folder"), action );
3586 connect( action, SIGNAL(triggered(
bool)),
3587 SLOT(slotCopySelectedMessagesToFolder()) );
3588 action->setShortcut( QKeySequence( Qt::Key_C ) );
3591 KAction *action =
new KAction( i18n(
"Jump to Folder..."),
this );
3592 actionCollection()->addAction( QLatin1String(
"jump_to_folder"), action );
3593 connect( action, SIGNAL(triggered(
bool)),
3594 SLOT(slotJumpToFolder()) );
3595 action->setShortcut( QKeySequence( Qt::Key_J ) );
3598 KAction *action =
new KAction(i18n(
"Abort Current Operation"),
this);
3599 actionCollection()->addAction(QLatin1String(
"cancel"), action );
3600 connect( action, SIGNAL(triggered(
bool)),
3601 ProgressManager::instance(), SLOT(slotAbortAll()) );
3602 action->setShortcut( QKeySequence( Qt::Key_Escape ) );
3605 KAction *action =
new KAction(i18n(
"Focus on Next Folder"),
this);
3606 actionCollection()->addAction(QLatin1String(
"inc_current_folder"), action );
3607 connect( action, SIGNAL(triggered(
bool)),
3608 mFolderTreeWidget->folderTreeView(), SLOT(slotFocusNextFolder()) );
3609 action->setShortcut( QKeySequence( Qt::CTRL+Qt::Key_Right ) );
3612 KAction *action =
new KAction(i18n(
"Focus on Previous Folder"),
this);
3613 actionCollection()->addAction(QLatin1String(
"dec_current_folder"), action );
3614 connect( action, SIGNAL(triggered(
bool)),
3615 mFolderTreeWidget->folderTreeView(), SLOT(slotFocusPrevFolder()) );
3616 action->setShortcut( QKeySequence( Qt::CTRL+Qt::Key_Left ) );
3619 KAction *action =
new KAction(i18n(
"Select Folder with Focus"),
this);
3620 actionCollection()->addAction(QLatin1String(
"select_current_folder"), action );
3622 connect( action, SIGNAL(triggered(
bool)),
3623 mFolderTreeWidget->folderTreeView(), SLOT(slotSelectFocusFolder()) );
3624 action->setShortcut( QKeySequence( Qt::CTRL+Qt::Key_Space ) );
3627 KAction *action =
new KAction(i18n(
"Focus on First Folder"),
this);
3628 actionCollection()->addAction(QLatin1String(
"focus_first_folder"), action );
3629 connect( action, SIGNAL(triggered(
bool)),
3630 mFolderTreeWidget->folderTreeView(), SLOT(slotFocusFirstFolder()) );
3631 action->setShortcut( QKeySequence( Qt::CTRL + Qt::Key_Home ) );
3634 KAction *action =
new KAction(i18n(
"Focus on Last Folder"),
this);
3635 actionCollection()->addAction(QLatin1String(
"focus_last_folder"), action );
3636 connect( action, SIGNAL(triggered(
bool)),
3637 mFolderTreeWidget->folderTreeView(), SLOT(slotFocusLastFolder()) );
3638 action->setShortcut( QKeySequence( Qt::CTRL + Qt::Key_End ) );
3641 KAction *action =
new KAction(i18n(
"Focus on Next Message"),
this);
3642 actionCollection()->addAction(QLatin1String(
"inc_current_message"), action );
3643 connect( action, SIGNAL(triggered(
bool)),
3644 this, SLOT(slotFocusOnNextMessage()) );
3645 action->setShortcut( QKeySequence( Qt::ALT+Qt::Key_Right ) );
3648 KAction *action =
new KAction(i18n(
"Focus on Previous Message"),
this);
3649 actionCollection()->addAction(QLatin1String(
"dec_current_message"), action );
3650 connect( action, SIGNAL(triggered(
bool)),
3651 this, SLOT(slotFocusOnPrevMessage()) );
3652 action->setShortcut( QKeySequence( Qt::ALT+Qt::Key_Left ) );
3655 KAction *action =
new KAction(i18n(
"Select First Message"),
this);
3656 actionCollection()->addAction(QLatin1String(
"select_first_message"), action );
3657 connect ( action, SIGNAL(triggered(
bool)),
3658 this, SLOT(slotSelectFirstMessage()) );
3659 action->setShortcut( QKeySequence( Qt::ALT + Qt::Key_Home ) );
3662 KAction *action =
new KAction(i18n(
"Select Last Message"),
this);
3663 actionCollection()->addAction(QLatin1String(
"select_last_message"), action );
3664 connect ( action, SIGNAL(triggered(
bool)),
3665 this, SLOT(slotSelectLastMessage()) );
3666 action->setShortcut( QKeySequence( Qt::ALT + Qt::Key_End ) );
3669 KAction *action =
new KAction(i18n(
"Select Message with Focus"),
this);
3670 actionCollection()->addAction( QLatin1String(
"select_current_message"), action );
3671 connect( action, SIGNAL(triggered(
bool)),
3672 this, SLOT(slotSelectFocusedMessage()) );
3673 action->setShortcut( QKeySequence( Qt::ALT+Qt::Key_Space ) );
3677 KAction *action =
new KAction( i18n(
"Set Focus to Quick Search"),
this );
3678 action->setShortcut( QKeySequence( Qt::ALT + Qt::Key_Q ) );
3679 actionCollection()->addAction( QLatin1String(
"focus_to_quickseach"), action );
3680 connect( action, SIGNAL(triggered(
bool)),
3681 SLOT(slotFocusQuickSearch()) );
3684 KAction *action =
new KAction( i18n(
"Extend Selection to Previous Message" ),
this );
3685 action->setShortcut( QKeySequence( Qt::SHIFT + Qt::Key_Left ) );
3686 actionCollection()->addAction( QLatin1String(
"previous_message"), action );
3687 connect( action, SIGNAL(triggered(
bool)),
3688 this, SLOT(slotExtendSelectionToPreviousMessage()) );
3691 KAction *action =
new KAction( i18n(
"Extend Selection to Next Message" ),
this );
3692 action->setShortcut( QKeySequence( Qt::SHIFT + Qt::Key_Right ) );
3693 actionCollection()->addAction( QLatin1String(
"next_message"), action );
3694 connect( action, SIGNAL(triggered(
bool)),
3695 this, SLOT(slotExtendSelectionToNextMessage()) );
3699 mMoveMsgToFolderAction =
new KAction( i18n(
"Move Message to Folder"),
this );
3700 mMoveMsgToFolderAction->setShortcut( QKeySequence( Qt::Key_M ) );
3701 actionCollection()->addAction( QLatin1String(
"move_message_to_folder"), mMoveMsgToFolderAction );
3702 connect( mMoveMsgToFolderAction, SIGNAL(triggered(
bool)),
3703 SLOT(slotMoveSelectedMessageToFolder()) );
3706 mArchiveAction =
new KAction( i18n(
"Archive"),
this);
3707 actionCollection()->addAction( QLatin1String(
"archive_mails"), mArchiveAction );
3708 connect( mArchiveAction, SIGNAL(triggered(
bool)),
3709 SLOT(slotArchiveMails()) );
3716 if (!mFavoritesModel)
3718 QPointer<MailCommon::FolderSelectionDialog> dialog( selectFromAllFoldersDialog() );
3719 dialog->setCaption( i18n(
"Add Favorite Folder") );
3720 if ( dialog->exec() && dialog ) {
3721 const Akonadi::Collection collection = dialog->selectedCollection();
3722 if ( collection.isValid() ) {
3723 mFavoritesModel->addCollection( collection );
3737 showCollectionProperties( QLatin1String(
"MailCommon::CollectionExpiryPage" ) );
3745 if ( !mMsgView->viewer()->atBottom() ) {
3746 mMsgView->viewer()->slotJumpDown();
3749 slotSelectNextUnreadMessage();
3754 if ( !mFolderTreeWidget )
3756 mGoToFirstUnreadMessageInSelectedFolder =
true;
3757 mFolderTreeWidget->folderTreeView()->selectNextUnreadFolder();
3758 mGoToFirstUnreadMessageInSelectedFolder =
false;
3763 if ( !mFolderTreeWidget )
3765 mGoToFirstUnreadMessageInSelectedFolder =
true;
3766 mFolderTreeWidget->folderTreeView()->selectPrevUnreadFolder();
3767 mGoToFirstUnreadMessageInSelectedFolder =
false;
3772 mMessagePane->setCurrentThreadExpanded(
true );
3777 mMessagePane->setCurrentThreadExpanded(
false );
3783 #ifndef QT_NO_CURSOR
3784 MessageViewer::KCursorSaver busy( MessageViewer::KBusyPtr::busy() );
3786 mMessagePane->setAllThreadsExpanded(
true );
3792 #ifndef QT_NO_CURSOR
3793 MessageViewer::KCursorSaver busy( MessageViewer::KBusyPtr::busy() );
3795 mMessagePane->setAllThreadsExpanded(
false );
3801 updateMessageActions();
3808 updateMessageActions(
true );
3811 menutimer->start( 500 );
3816 Akonadi::Item::List selectedItems;
3817 Akonadi::Item::List selectedVisibleItems;
3818 bool allSelectedBelongToSameThread =
false;
3819 if (mCurrentFolder && mCurrentFolder->isValid() &&
3820 mMessagePane->getSelectionStats( selectedItems, selectedVisibleItems, &allSelectedBelongToSameThread )
3823 mMsgActions->setCurrentMessage( mMessagePane->currentItem(), selectedVisibleItems );
3825 mMsgActions->setCurrentMessage( Akonadi::Item() );
3829 updateMessageActionsDelayed();
3837 Akonadi::Item::List selectedItems;
3838 Akonadi::Item::List selectedVisibleItems;
3839 bool allSelectedBelongToSameThread =
false;
3840 Akonadi::Item currentMessage;
3841 if (mCurrentFolder && mCurrentFolder->isValid() &&
3842 mMessagePane->getSelectionStats( selectedItems, selectedVisibleItems, &allSelectedBelongToSameThread )
3845 count = selectedItems.count();
3847 currentMessage = mMessagePane->currentItem();
3851 currentMessage = Akonadi::Item();
3854 mApplyFiltersOnFolder->setEnabled( mCurrentFolder && mCurrentFolder->isValid() );
3884 bool readOnly = mCurrentFolder && mCurrentFolder->isValid() && ( mCurrentFolder->rights() & Akonadi::Collection::ReadOnly );
3886 bool single_actions = count == 1;
3888 bool singleVisibleMessageSelected = selectedVisibleItems.count() == 1;
3890 bool mass_actions = count >= 1;
3892 bool thread_actions = mass_actions && allSelectedBelongToSameThread && mMessagePane->isThreaded();
3894 bool flags_available =
GlobalSettings::self()->allowLocalFlags() || !(mCurrentFolder && mCurrentFolder->isValid() ? readOnly :
true);
3896 mThreadStatusMenu->setEnabled( thread_actions );
3899 mWatchThreadAction->setEnabled( thread_actions && flags_available );
3900 mIgnoreThreadAction->setEnabled( thread_actions && flags_available );
3901 mMarkThreadAsReadAction->setEnabled( thread_actions );
3902 mMarkThreadAsUnreadAction->setEnabled( thread_actions );
3903 mToggleThreadToActAction->setEnabled( thread_actions && flags_available );
3904 mToggleThreadImportantAction->setEnabled( thread_actions && flags_available );
3905 bool canDeleteMessages = mCurrentFolder && mCurrentFolder->isValid() && ( mCurrentFolder->rights() & Akonadi::Collection::CanDeleteItem );
3907 mTrashThreadAction->setEnabled( thread_actions && canDeleteMessages );
3908 mDeleteThreadAction->setEnabled( thread_actions && canDeleteMessages );
3910 if ( currentMessage.isValid() )
3912 MessageStatus status;
3913 status.setStatusFromFlags( currentMessage.flags() );
3914 mTagActionManager->updateActionStates ( count, mMessagePane->currentItem() );
3917 mToggleThreadToActAction->setChecked( status.isToAct() );
3918 mToggleThreadImportantAction->setChecked( status.isImportant() );
3919 mWatchThreadAction->setChecked( status.isWatched() );
3920 mIgnoreThreadAction->setChecked( status.isIgnored() );
3924 mMoveActionMenu->setEnabled( mass_actions && canDeleteMessages );
3925 if (mMoveMsgToFolderAction)
3926 mMoveMsgToFolderAction->setEnabled( mass_actions && canDeleteMessages );
3929 mDeleteAction->setEnabled( mass_actions && canDeleteMessages );
3931 mExpireConfigAction->setEnabled( canDeleteMessages );
3934 mMsgView->findInMessageAction()->setEnabled( mass_actions && !CommonKernel->folderIsTemplates( mCurrentFolder->collection() ) );
3936 mMsgActions->forwardInlineAction()->setEnabled( mass_actions && !CommonKernel->folderIsTemplates( mCurrentFolder->collection() ) );
3937 mMsgActions->forwardAttachedAction()->setEnabled( mass_actions && !CommonKernel->folderIsTemplates( mCurrentFolder->collection() ) );
3938 mMsgActions->forwardMenu()->setEnabled( mass_actions && !CommonKernel->folderIsTemplates( mCurrentFolder->collection() ) );
3940 mMsgActions->editAction()->setEnabled( single_actions );
3941 mUseAction->setEnabled( single_actions && CommonKernel->folderIsTemplates( mCurrentFolder->collection() ) );
3942 filterMenu()->setEnabled( single_actions );
3943 mMsgActions->redirectAction()->setEnabled( mass_actions && !CommonKernel->folderIsTemplates( mCurrentFolder->collection() ) );
3945 if ( mMsgActions->customTemplatesMenu() )
3947 mMsgActions->customTemplatesMenu()->forwardActionMenu()->setEnabled( mass_actions );
3948 mMsgActions->customTemplatesMenu()->replyActionMenu()->setEnabled( single_actions );
3949 mMsgActions->customTemplatesMenu()->replyAllActionMenu()->setEnabled( single_actions );
3953 mMsgActions->printAction()->setEnabled( singleVisibleMessageSelected );
3955 KAction *printPreviewAction = mMsgActions->printPreviewAction();
3956 if (printPreviewAction)
3957 printPreviewAction->setEnabled( singleVisibleMessageSelected );
3961 mMsgView->viewSourceAction()->setEnabled( singleVisibleMessageSelected );
3963 MessageStatus status;
3964 status.setStatusFromFlags( currentMessage.flags() );
3967 bool statusSendAgain = single_actions && ( ( currentMessage.isValid() && status.isSent() ) || ( currentMessage.isValid() && CommonKernel->folderIsSentMailFolder( mCurrentFolder->collection() ) ) );
3968 if ( statusSendAgain ) {
3969 actionList << mSendAgainAction;
3970 }
else if ( single_actions ) {
3971 actionList << messageActions()->editAction();
3973 actionList << mSaveAttachmentsAction;
3974 if (FolderArchive::FolderArchiveUtil::folderArchiveAgentEnabled() && mCurrentFolder && FolderArchive::FolderArchiveUtil::resourceSupportArchiving(mCurrentFolder->collection().resource()))
3975 actionList << mArchiveAction;
3976 mGUIClient->unplugActionList( QLatin1String(
"messagelist_actionlist" ) );
3977 mGUIClient->plugActionList( QLatin1String(
"messagelist_actionlist" ), actionList );
3978 mSendAgainAction->setEnabled( statusSendAgain );
3980 mSaveAsAction->setEnabled( mass_actions );
3982 if ((mCurrentFolder&& mCurrentFolder->isValid())) {
3983 updateMoveAction( mCurrentFolder->statistics() );
3986 updateMoveAction(
false,
false);
3989 const qint64 nbMsgOutboxCollection = MailCommon::Util::updatedCollection( CommonKernel->outboxCollectionFolder() ).statistics().count();
3991 mSendQueued->setEnabled( nbMsgOutboxCollection > 0 );
3992 mSendActionMenu->setEnabled( nbMsgOutboxCollection > 0 );
3994 const bool newPostToMailingList = mCurrentFolder && mCurrentFolder->isMailingListEnabled();
3995 mMessageNewList->setEnabled(newPostToMailingList);
3997 slotUpdateOnlineStatus( static_cast<GlobalSettingsBase::EnumNetworkState::type>(
GlobalSettings::self()->networkState() ) );
3998 if (action( QLatin1String(
"kmail_undo") ))
3999 action( QLatin1String(
"kmail_undo") )->setEnabled(
kmkernel->undoStack()->size() > 0 );
4002 foreach ( QAction *filterAction, mFilterMenuActions ) {
4003 filterAction->setEnabled( count > 0 );
4006 mApplyAllFiltersAction->setEnabled( count);
4007 mApplyFilterActionsMenu->setEnabled( count );
4013 bool multiFolder =
false;
4014 if ( mFolderTreeWidget ) {
4015 multiFolder = mFolderTreeWidget->selectedCollections().count() > 1;
4017 if ( mCollectionProperties ) {
4018 if ( mCurrentFolder && mCurrentFolder->collection().isValid() ) {
4019 const Akonadi::AgentInstance instance =
4020 Akonadi::AgentManager::self()->instance( mCurrentFolder->collection().resource() );
4022 mCollectionProperties->setEnabled( !multiFolder &&
4023 !mCurrentFolder->isStructural() &&
4024 (instance.status()!=Akonadi::AgentInstance::Broken) );
4026 mCollectionProperties->setEnabled(
false);
4029 if ( mCollectionProperties->isEnabled() )
4030 collectionProperties << mCollectionProperties;
4031 mGUIClient->unplugActionList( QLatin1String(
"akonadi_collection_collectionproperties_actionlist") );
4032 mGUIClient->plugActionList( QLatin1String(
"akonadi_collection_collectionproperties_actionlist"), collectionProperties );
4036 const bool folderWithContent = mCurrentFolder && !mCurrentFolder->isStructural();
4038 if ( mAkonadiStandardActionManager->action( Akonadi::StandardActionManager::DeleteCollections ) ) {
4040 mAkonadiStandardActionManager->action( Akonadi::StandardActionManager::DeleteCollections )->setEnabled( mCurrentFolder
4042 && ( mCurrentFolder->collection().rights() & Collection::CanDeleteCollection )
4043 && !mCurrentFolder->isSystemFolder()
4044 && folderWithContent
4045 && mCurrentFolder->collection().resource() != QLatin1String(
"akonadi_nepomuktag_resource") );
4048 if ( mAkonadiStandardActionManager->action( Akonadi::StandardMailActionManager::MoveAllToTrash ) ) {
4049 mAkonadiStandardActionManager->action( Akonadi::StandardMailActionManager::MoveAllToTrash )->setEnabled( folderWithContent
4050 && ( mCurrentFolder->count() > 0 )
4051 && mCurrentFolder->canDeleteMessages()
4053 mAkonadiStandardActionManager->action( Akonadi::StandardMailActionManager::MoveAllToTrash )->setText( (mCurrentFolder && CommonKernel->folderIsTrash(mCurrentFolder->collection())) ? i18n(
"E&mpty Trash") : i18n(
"&Move All Messages to Trash") );
4058 QAction *actionAddToFavoriteCollections = akonadiStandardAction( Akonadi::StandardActionManager::AddToFavoriteCollections );
4059 if ( actionAddToFavoriteCollections ) {
4060 if ( mEnableFavoriteFolderView && actionAddToFavoriteCollections->isEnabled() )
4061 addToFavorite << actionAddToFavoriteCollections;
4062 mGUIClient->unplugActionList( QLatin1String(
"akonadi_collection_add_to_favorites_actionlist") );
4063 mGUIClient->plugActionList( QLatin1String(
"akonadi_collection_add_to_favorites_actionlist"), addToFavorite );
4067 QAction *actionSync = akonadiStandardAction( Akonadi::StandardActionManager::SynchronizeCollections );
4068 if ( actionSync && actionSync->isEnabled() ) {
4069 syncActionList << actionSync;
4071 actionSync = akonadiStandardAction( Akonadi::StandardActionManager::SynchronizeCollectionsRecursive );
4072 if ( actionSync && actionSync->isEnabled() ) {
4073 syncActionList << actionSync;
4075 mGUIClient->unplugActionList( QLatin1String(
"akonadi_collection_sync_actionlist") );
4076 mGUIClient->plugActionList( QLatin1String(
"akonadi_collection_sync_actionlist"), syncActionList );
4082 QAction *action = mAkonadiStandardActionManager->action( Akonadi::StandardActionManager::CreateCollection );
4083 if ( action && action->isEnabled() ) {
4084 actionList << action;
4087 action = mAkonadiStandardActionManager->action( Akonadi::StandardActionManager::MoveCollectionToMenu );
4088 if ( action && action->isEnabled() ) {
4089 actionList <<action;
4092 action = mAkonadiStandardActionManager->action( Akonadi::StandardActionManager::CopyCollectionToMenu);
4093 if ( action && action->isEnabled() ) {
4094 actionList <<action;
4096 mGUIClient->unplugActionList( QLatin1String(
"akonadi_collection_move_copy_menu_actionlist") );
4097 mGUIClient->plugActionList( QLatin1String(
"akonadi_collection_move_copy_menu_actionlist"), actionList );
4102 void KMMainWidget::updateHtmlMenuEntry()
4104 if (mPreferHtmlAction && mPreferHtmlLoadExtAction) {
4105 bool multiFolder =
false;
4106 if ( mFolderTreeWidget ) {
4107 multiFolder = mFolderTreeWidget->selectedCollections().count() > 1;
4110 mPreferHtmlAction->setEnabled( mFolderTreeWidget &&
4111 mFolderTreeWidget->folderTreeView()->currentFolder().isValid() &&
4113 mPreferHtmlLoadExtAction->setEnabled( mFolderTreeWidget &&
4114 mFolderTreeWidget->folderTreeView()->currentFolder().isValid() &&
4116 (mHtmlPref ? !mFolderHtmlPref : mFolderHtmlPref) ?
true :
false );
4117 mPreferHtmlAction->setChecked( !multiFolder && ( mHtmlPref ? !mFolderHtmlPref : mFolderHtmlPref ) );
4118 mPreferHtmlLoadExtAction->setChecked( !multiFolder && ( mHtmlLoadExtPref ? !mFolderHtmlLoadExtPref : mFolderHtmlLoadExtPref ) );
4125 if (!CommonKernel->outboxCollectionFolder().isValid()) {
4126 QTimer::singleShot(1000,
this,SLOT(updateFolderMenu()));
4130 const bool folderWithContent = mCurrentFolder && !mCurrentFolder->isStructural();
4131 bool multiFolder =
false;
4132 if ( mFolderTreeWidget ) {
4133 multiFolder = mFolderTreeWidget->selectedCollections().count() > 1;
4135 mFolderMailingListPropertiesAction->setEnabled( folderWithContent &&
4137 !mCurrentFolder->isSystemFolder() );
4140 if ( mCurrentFolder && mCurrentFolder->collection().id() == CommonKernel->outboxCollectionFolder().id() && (mCurrentFolder->collection()).statistics().count() > 0) {
4141 kDebug() <<
"Enabling send queued";
4142 mSendQueued->setEnabled(
true);
4143 actionlist << mSendQueued;
4148 mGUIClient->unplugActionList( QLatin1String(
"outbox_folder_actionlist" ) );
4149 mGUIClient->plugActionList( QLatin1String(
"outbox_folder_actionlist" ), actionlist );
4152 const bool isASearchFolder = mCurrentFolder && mCurrentFolder->collection().resource() == QLatin1String(
"akonadi_search_resource" );
4153 if (isASearchFolder)
4154 mAkonadiStandardActionManager->action( Akonadi::StandardActionManager::DeleteCollections )->setText( i18n(
"&Delete Search") );
4156 mArchiveFolderAction->setEnabled( mCurrentFolder && !multiFolder && folderWithContent );
4158 bool isInTrashFolder = (mCurrentFolder && CommonKernel->folderIsTrash(mCurrentFolder->collection()));
4159 akonadiStandardAction( Akonadi::StandardMailActionManager::MoveToTrash )->setText( isInTrashFolder ? i18nc(
"@action Hard delete, bypassing trash",
"&Delete"): i18n(
"&Move to Trash") );
4161 mTrashThreadAction->setText(isInTrashFolder ?i18n(
"Delete T&hread"): i18n(
"M&ove Thread to Trash"));
4165 mExpireConfigAction->setEnabled( mCurrentFolder &&
4166 !mCurrentFolder->isStructural() &&
4168 mCurrentFolder->canDeleteMessages() &&
4169 folderWithContent &&
4170 !MailCommon::Util::isVirtualCollection( mCurrentFolder->collection() ) );
4172 updateHtmlMenuEntry();
4174 mShowFolderShortcutDialogAction->setEnabled( !multiFolder && folderWithContent );
4176 actionlist << akonadiStandardAction( Akonadi::StandardActionManager::ManageLocalSubscriptions );
4177 bool imapFolderIsOnline =
false;
4178 if (mCurrentFolder &&
kmkernel->isImapFolder( mCurrentFolder->collection(),imapFolderIsOnline )) {
4179 if (imapFolderIsOnline) {
4180 actionlist << mServerSideSubscription;
4184 mGUIClient->unplugActionList( QLatin1String(
"collectionview_actionlist" ) );
4185 mGUIClient->plugActionList( QLatin1String(
"collectionview_actionlist" ), actionlist );
4195 mMsgView->clear(
true );
4198 if ( mMessagePane && mLongFolderList )
4199 mMessagePane->hide();
4200 mMsgView->displayAboutPage();
4202 mCurrentFolder.clear();
4207 connect( MailCommon::FilterManager::instance(), SIGNAL(filtersChanged()),
4208 this, SLOT(initializeFilterActions()) );
4212 checkAkonadiServerManagerState();
4213 mFolderShortcutActionManager->createActions();
4214 mTagActionManager->createActions();
4215 messageActions()->setupForwardingActionsList( mGUIClient );
4226 void KMMainWidget::checkAkonadiServerManagerState()
4228 Akonadi::ServerManager::State state = Akonadi::ServerManager::self()->state();
4229 if (state == Akonadi::ServerManager::Running) {
4230 initializeFilterActions();
4232 connect( Akonadi::ServerManager::self(), SIGNAL(stateChanged(Akonadi::ServerManager::State)),
4233 SLOT(slotServerStateChanged(Akonadi::ServerManager::State)) );
4237 void KMMainWidget::slotServerStateChanged(Akonadi::ServerManager::State state)
4239 if (state == Akonadi::ServerManager::Running) {
4240 initializeFilterActions();
4241 disconnect( Akonadi::ServerManager::self(), SIGNAL(stateChanged(Akonadi::ServerManager::State)));
4248 KTipDialog::showTip(
this, QString(),
true );
4258 if ( actionCollection()->action( QLatin1String(
"kmail_undo") ) ) {
4259 actionCollection()->action( QLatin1String(
"kmail_undo") )->setEnabled(
kmkernel->undoStack()->size()>0 );
4266 if ( !mFilterTBarActions.isEmpty() )
4267 if ( mGUIClient->factory() )
4268 mGUIClient->unplugActionList( QLatin1String(
"toolbar_filter_actions") );
4270 if ( !mFilterMenuActions.isEmpty() )
4271 if ( mGUIClient->factory() )
4272 mGUIClient->unplugActionList( QLatin1String(
"menu_filter_actions") );
4274 foreach ( QAction *a, mFilterMenuActions )
4275 actionCollection()->removeAction( a );
4277 mApplyFilterActionsMenu->menu()->clear();
4278 mFilterTBarActions.clear();
4279 mFilterMenuActions.clear();
4281 qDeleteAll( mFilterCommands );
4282 mFilterCommands.clear();
4288 clearFilterActions();
4289 mApplyFilterActionsMenu->menu()->addAction( mApplyAllFiltersAction );
4290 bool addedSeparator =
false;
4292 foreach ( MailFilter *filter, MailCommon::FilterManager::instance()->filters() ) {
4293 if ( !filter->isEmpty() && filter->configureShortcut() && filter->isEnabled() ) {
4294 QString filterName = QString::fromLatin1(
"Filter %1").arg( filter->name() );
4295 QString normalizedName = filterName.replace(QLatin1Char(
' '), QLatin1Char(
'_'));
4296 if ( action( normalizedName ) ) {
4300 mFilterCommands.append( filterCommand );
4301 QString displayText = i18n(
"Filter %1", filter->name() );
4302 QString icon = filter->icon();
4303 if ( icon.isEmpty() ) {
4304 icon = QLatin1String(
"system-run");
4306 KAction *filterAction =
new KAction( KIcon( icon ), displayText, actionCollection() );
4307 filterAction->setIconText( filter->toolbarName() );
4312 filterAction->setShortcutConfigurable(
false );
4313 actionCollection()->addAction( normalizedName,
4315 connect( filterAction, SIGNAL(triggered(
bool)),
4316 filterCommand, SLOT(start()) );
4317 filterAction->setShortcuts( filter->shortcut() );
4318 if ( !addedSeparator ) {
4319 QAction *a = mApplyFilterActionsMenu->menu()->addSeparator();
4320 mFilterMenuActions.append( a );
4321 addedSeparator =
true;
4323 mApplyFilterActionsMenu->menu()->addAction( filterAction );
4324 mFilterMenuActions.append( filterAction );
4325 if ( filter->configureToolbar() ) {
4326 mFilterTBarActions.append( filterAction );
4330 if ( !mFilterMenuActions.isEmpty() && mGUIClient->factory() )
4331 mGUIClient->plugActionList( QLatin1String(
"menu_filter_actions"), mFilterMenuActions );
4332 if ( !mFilterTBarActions.isEmpty() && mGUIClient->factory() ) {
4333 mFilterTBarActions.prepend( mToolbarActionSeparator );
4334 mGUIClient->plugActionList( QLatin1String(
"toolbar_filter_actions"), mFilterTBarActions );
4338 updateMessageActions();
4362 const QString path = KStandardDirs::findExe( QLatin1String(
"importwizard" ) );
4363 if ( !QProcess::startDetached( path ) )
4364 KMessageBox::error(
this, i18n(
"Could not start the import wizard. "
4365 "Please check your installation." ),
4366 i18n(
"Unable to start import wizard" ) );
4372 MailCommon::FilterManager::instance()->showFilterLogDialog( (qlonglong)winId() );
4378 const bool isEmpty = MailCommon::Util::agentInstances().isEmpty();
4379 actionCollection()->action(QLatin1String(
"check_mail"))->setEnabled( !isEmpty );
4380 actionCollection()->action(QLatin1String(
"check_mail_in"))->setEnabled( !isEmpty );
4387 if ( theMainWidgetList.isDestroyed() )
4391 return theMainWidgetList;
4396 return mCurrentFolder;
4400 QString KMMainWidget::overrideEncoding()
const
4403 return mMsgView->overrideEncoding();
4405 return MessageCore::GlobalSettings::self()->overrideCharacterEncoding();
4410 QWidget::showEvent( event );
4411 mWasEverShown =
true;
4414 void KMMainWidget::slotRequestFullSearchFromQuickSearch()
4418 if ( !slotSearch() )
4421 assert( mSearchWin );
4426 SearchPattern pattern;
4427 const QString searchString = mMessagePane->currentFilterSearchString();
4428 if ( !searchString.isEmpty() )
4429 pattern.append( SearchRule::createInstance(
"<message>", SearchRule::FuncContains, searchString ) );
4430 MessageStatus status = mMessagePane->currentFilterStatus();
4431 if ( status.hasAttachment() ) {
4432 pattern.append( SearchRule::createInstance(
"<message>", SearchRule::FuncHasAttachment ) );
4433 status.setHasAttachment(
false );
4436 if ( !status.isOfUnknownStatus() ) {
4437 pattern.append( SearchRule::Ptr(
new SearchRuleStatus( status ) ) );
4440 if ( !pattern.isEmpty() )
4441 mSearchWin->addRulesToSearchPattern( pattern );
4446 mVacationIndicatorActive = active;
4448 mVacationScriptIndicator->setText( i18n(
"Out of office reply active on server \"%1\"", serverName) );
4449 mVacationScriptIndicator->setBackgroundColor( Qt::yellow );
4450 mVacationScriptIndicator->setCursor( QCursor( Qt::PointingHandCursor ) );
4451 mVacationScriptIndicator->show();
4453 mVacationScriptIndicator->hide();
4459 return mVacationScriptIndicator;
4464 delete mShowBusySplashTimer;
4465 mShowBusySplashTimer = 0;
4469 if ( !item.isValid() ) {
4472 mShowBusySplashTimer =
new QTimer(
this );
4473 mShowBusySplashTimer->setSingleShot(
true );
4474 connect( mShowBusySplashTimer, SIGNAL(timeout()),
this, SLOT(slotShowBusySplash()) );
4477 Akonadi::ItemFetchJob *itemFetchJob = MessageViewer::Viewer::createFetchJob( item );
4478 const QString resource = mCurrentFolder->collection().resource();
4479 itemFetchJob->setProperty(
"_resource", QVariant::fromValue(resource) );
4480 connect( itemFetchJob, SIGNAL(itemsReceived(Akonadi::Item::List)),
4481 SLOT(itemsReceived(Akonadi::Item::List)) );
4482 connect( itemFetchJob, SIGNAL(result(
KJob*)), SLOT(itemsFetchDone(
KJob*)) );
4487 void KMMainWidget::itemsReceived(
const Akonadi::Item::List &list )
4489 Q_ASSERT( list.size() == 1 );
4490 delete mShowBusySplashTimer;
4491 mShowBusySplashTimer = 0;
4496 Item item = list.first();
4498 if ( mMessagePane ) {
4499 mMessagePane->show();
4501 if ( mMessagePane->currentItem() != item ) {
4504 if ( MessageViewer::GlobalSettings::self()->delayedMarkAsRead() &&
4505 MessageViewer::GlobalSettings::self()->delayedMarkTime() == 0 ) {
4506 item.setFlag( Akonadi::MessageFlags::Seen );
4507 Akonadi::ItemModifyJob *modifyJob =
new Akonadi::ItemModifyJob( item,
this );
4508 modifyJob->disableRevisionCheck();
4509 modifyJob->setIgnorePayload(
true );
4515 mMsgView->setMessage( item );
4517 mMsgView->setHtmlOverride(mFolderHtmlPref);
4518 mMsgView->setHtmlLoadExtOverride(mFolderHtmlLoadExtPref);
4519 mMsgView->setDecryptMessageOverwrite(
false );
4520 mMsgActions->setCurrentMessage( item );
4523 void KMMainWidget::itemsFetchDone(
KJob *job )
4525 delete mShowBusySplashTimer;
4526 mShowBusySplashTimer = 0;
4527 if ( job->error() ) {
4531 kDebug() << job->error() << job->errorString();
4533 const QString resource = job->property(
"_resource").toString();
4534 const Akonadi::AgentInstance agentInstance = Akonadi::AgentManager::self()->instance( resource );
4535 if ( !agentInstance.isOnline() ) {
4538 mMsgView->viewer()->enableMessageDisplay();
4539 mMsgView->clear(
true );
4541 mMessagePane->show();
4546 showResourceOfflinePage();
4549 BroadcastStatus::instance()->setStatusMsg( job->errorString() );
4556 return mAkonadiStandardActionManager->action( type );
4561 return mAkonadiStandardActionManager->action( type );
4566 showCollectionProperties( QString() );
4569 void KMMainWidget::showCollectionProperties(
const QString &pageToShow )
4571 if ( !mCurrentFolder )
4574 if ( Solid::Networking::status() == Solid::Networking::Unconnected ) {
4575 KMessageBox::information(
4577 i18n(
"Network is unconnected. Folder information cannot be updated." ) );
4578 showCollectionPropertiesContinued( pageToShow, QPointer<KPIM::ProgressItem>() );
4580 const Akonadi::AgentInstance agentInstance = Akonadi::AgentManager::self()->instance( mCurrentFolder->collection().resource() );
4581 bool isOnline = agentInstance.isOnline();
4583 showCollectionPropertiesContinued( pageToShow, QPointer<KPIM::ProgressItem>() );
4586 progressItem->setUsesBusyIndicator(
true );
4588 Akonadi::CollectionAttributesSynchronizationJob *sync
4589 =
new Akonadi::CollectionAttributesSynchronizationJob( mCurrentFolder->collection() );
4590 sync->setProperty(
"collectionId", mCurrentFolder->collection().id() );
4591 sync->setProperty(
"pageToShow", pageToShow );
4592 sync->setProperty(
"progressItem", QVariant::fromValue( progressItem ) );
4593 connect( sync, SIGNAL(result(
KJob*)),
4594 this, SLOT(slotCollectionPropertiesContinued(
KJob*)) );
4596 sync, SLOT(kill()) );
4604 void KMMainWidget::slotCollectionPropertiesContinued(
KJob* job )
4607 QPointer<KPIM::ProgressItem> progressItem;
4610 Akonadi::CollectionAttributesSynchronizationJob *sync
4611 =
dynamic_cast<Akonadi::CollectionAttributesSynchronizationJob *
>( job );
4613 if ( sync->property(
"collectionId" ) != mCurrentFolder->collection().id() )
4615 pageToShow = sync->property(
"pageToShow" ).toString();
4616 progressItem = sync->property(
"progressItem" ).value< QPointer<KPIM::ProgressItem> >();
4617 if ( progressItem ) {
4619 sync, SLOT(kill()) );
4626 showCollectionPropertiesContinued( pageToShow, progressItem );
4629 void KMMainWidget::showCollectionPropertiesContinued(
const QString &pageToShow, QPointer<KPIM::ProgressItem> progressItem )
4631 if ( !progressItem ) {
4633 progressItem->setUsesBusyIndicator(
true );
4638 Akonadi::CollectionFetchJob *fetch =
new Akonadi::CollectionFetchJob( mCurrentFolder->collection(),
4639 Akonadi::CollectionFetchJob::Base );
4640 connect( progressItem, SIGNAL(progressItemCanceled(
KPIM::ProgressItem*)), fetch, SLOT(kill()) );
4641 fetch->fetchScope().setIncludeStatistics(
true );
4642 fetch->setProperty(
"pageToShow", pageToShow );
4643 fetch->setProperty(
"progressItem", QVariant::fromValue( progressItem ) );
4644 connect( fetch, SIGNAL(result(
KJob*)),
4645 this, SLOT(slotCollectionPropertiesFinished(
KJob*)) );
4647 fetch, SLOT(kill()) );
4650 void KMMainWidget::slotCollectionPropertiesFinished(
KJob *job )
4655 QPointer<KPIM::ProgressItem> progressItem = job->property(
"progressItem" ).value< QPointer<KPIM::ProgressItem> >();
4657 if ( !progressItem ) {
4661 progressItem->setComplete();
4662 progressItem->setStatus( i18n(
"Done" ) );
4664 Akonadi::CollectionFetchJob *fetch =
dynamic_cast<Akonadi::CollectionFetchJob *
>( job );
4666 if ( fetch->collections().isEmpty() )
4668 kWarning() <<
"no collection";
4672 const Akonadi::Collection collection = fetch->collections().first();
4674 const QStringList pages = QStringList() << QLatin1String(
"MailCommon::CollectionGeneralPage" )
4675 << QLatin1String(
"KMail::CollectionViewPage" )
4676 << QLatin1String(
"Akonadi::CachePolicyPage" )
4677 << QLatin1String(
"KMail::CollectionTemplatesPage" )
4678 << QLatin1String(
"MailCommon::CollectionExpiryPage" )
4679 << QLatin1String(
"PimCommon::CollectionAclPage" )
4680 << QLatin1String(
"KMail::CollectionMailingListPage" )
4681 << QLatin1String(
"KMail::CollectionQuotaPage" )
4682 << QLatin1String(
"KMail::CollectionShortcutPage" )
4683 << QLatin1String(
"KMail::CollectionMaintenancePage" );
4685 Akonadi::CollectionPropertiesDialog *dlg =
new Akonadi::CollectionPropertiesDialog( collection, pages,
this );
4686 dlg->setCaption( i18nc(
"@title:window",
"Properties of Folder %1", collection.name() ) );
4689 const QString pageToShow = fetch->property(
"pageToShow" ).toString();
4690 if ( !pageToShow.isEmpty() ) {
4691 dlg->setCurrentPage( pageToShow );
4701 QItemSelectionModel *selectionModel = mFolderTreeWidget->folderTreeView()->selectionModel();
4702 QModelIndexList indexes = selectionModel->selectedIndexes();
4703 Akonadi::Collection::List collections;
4705 Q_FOREACH (
const QModelIndex &index, indexes) {
4706 Akonadi::Collection collection = index.data(Akonadi::EntityTreeModel::CollectionRole).value<Akonadi::Collection>();
4707 if ( collection.isValid() ) {
4708 collections << collection;
4712 Akonadi::RemoveDuplicatesJob *job =
new RemoveDuplicatesJob( collections,
this );
4713 job->setProperty(
"ProgressItem", QVariant::fromValue ( item ) );
4714 item->setProperty(
"RemoveDuplicatesJob", QVariant::fromValue( qobject_cast<Akonadi::Job*>( job ) ) );
4715 connect( job, SIGNAL(finished(
KJob*)),
this, SLOT(slotRemoveDuplicatesDone(
KJob*)) );
4716 connect( job, SIGNAL(description(
KJob*,QString,QPair<QString,QString>,QPair<QString,QString>)),
this, SLOT(slotRemoveDuplicatesUpdate(
KJob*,QString)) );
4722 if ( job->error() && job->error() != KJob::KilledJobError ) {
4723 KMessageBox::error(
this, job->errorText(), i18n(
"Error while removing duplicates" ) );
4736 Akonadi::Job *job = item->property(
"RemoveDuplicatesJob" ).value<Akonadi::Job*>();
4738 job->kill( KJob::Quietly );
4754 void KMMainWidget::slotServerSideSubscription()
4756 if ( !mCurrentFolder )
4758 bool isImapOnline =
false;
4759 if (
kmkernel->isImapFolder( mCurrentFolder->collection(), isImapOnline ) ) {
4760 QDBusInterface iface(
4761 QLatin1String(
"org.freedesktop.Akonadi.Resource.")+mCurrentFolder->collection().resource(),
4762 QLatin1String(
"/" ), QLatin1String(
"org.kde.Akonadi.Imap.Resource" ),
4763 DBusConnectionPool::threadConnection(), this );
4764 if ( !iface.isValid() ) {
4765 kDebug()<<
"Cannot create imap dbus interface";
4768 QDBusPendingCall call = iface.asyncCall( QLatin1String(
"configureSubscription" ), (qlonglong)winId() );
4769 QDBusPendingCallWatcher *watcher =
new QDBusPendingCallWatcher(call,
this);
4770 connect(watcher, SIGNAL(finished(QDBusPendingCallWatcher*)),
this, SLOT(slotConfigureSubscriptionFinished(QDBusPendingCallWatcher*)));
4774 void KMMainWidget::slotConfigureSubscriptionFinished(QDBusPendingCallWatcher* watcher)
4776 QDBusPendingReply<int> reply = *watcher;
4777 if ( !reply.isValid() ) {
4781 KMessageBox::error(
this,i18n(
"IMAP server not configured yet. Please configure the server in the IMAP account before setting up server-side subscription."));
4782 }
else if (reply == -1) {
4783 KMessageBox::error(
this,i18n(
"Log in failed, please configure the IMAP account before setting up server-side subscription."));
4785 watcher->deleteLater();
4791 mMessagePane->saveCurrentSelection();
4797 OrgFreedesktopAkonadiArchiveMailAgentInterface archiveMailInterface(QLatin1String(
"org.freedesktop.Akonadi.ArchiveMailAgent"), QLatin1String(
"/ArchiveMailAgent"),QDBusConnection::sessionBus(),
this);
4798 if (archiveMailInterface.isValid()) {
4799 archiveMailInterface.showConfigureDialog( (qlonglong)winId() );
4801 KMessageBox::error(
this,i18n(
"Archive Mail Agent was not registered."));
4807 OrgFreedesktopAkonadiSendLaterAgentInterface sendLaterInterface(QLatin1String(
"org.freedesktop.Akonadi.SendLaterAgent"), QLatin1String(
"/SendLaterAgent"),QDBusConnection::sessionBus(),
this);
4808 if (sendLaterInterface.isValid()) {
4809 sendLaterInterface.showConfigureDialog( (qlonglong)winId() );
4811 KMessageBox::error(
this,i18n(
"Send Later Agent was not registered."));
4817 OrgFreedesktopAkonadiFolderArchiveAgentInterface folderArchiveInterface(QLatin1String(
"org.freedesktop.Akonadi.FolderArchiveAgent"), QLatin1String(
"/FolderArchiveAgent"),QDBusConnection::sessionBus(),
this);
4818 if (folderArchiveInterface.isValid()) {
4819 folderArchiveInterface.showConfigureDialog( (qlonglong)winId() );
4821 KMessageBox::error(
this,i18n(
"Archive Folder Agent was not registered."));
4828 mMessagePane->updateTagComboBox();
4835 const QString path = KStandardDirs::findExe( QLatin1String(
"pimsettingexporter" ) );
4836 if ( !QProcess::startDetached( path ) )
4837 KMessageBox::error(
this, i18n(
"Could not start \"PIM Setting Exporter\" program. "
4838 "Please check your installation." ),
4839 i18n(
"Unable to start \"PIM Setting Exporter\" program" ) );
4851 openCommand->
start();
4856 mOpenRecentAction->addUrl(mUrl);
4857 KConfigGroup grp = mConfig->group(QLatin1String(
"Recent Files"));
4858 mOpenRecentAction->saveEntries(grp);
4862 void KMMainWidget::slotMoveMessageToTrash()
4864 if (messageView() && messageView()->viewer()) {
4870 void KMMainWidget::slotArchiveMails()
4872 OrgFreedesktopAkonadiFolderArchiveAgentInterface folderArchiveInterface(QLatin1String(
"org.freedesktop.Akonadi.FolderArchiveAgent"), QLatin1String(
"/FolderArchiveAgent"),QDBusConnection::sessionBus(),
this);
4873 if (folderArchiveInterface.isValid()) {
4875 if (mCurrentFolder) {
4876 folderArchiveInterface.archiveItems(selectedMessages, mCurrentFolder->collection().resource());
4879 KMessageBox::error(
this,i18n(
"Archive Folder Agent was not registered."));
void readPreConfig()
Read configuration options before widgets are created.
void slotUpdateUndo()
Update the undo action.
void slotSendQueuedVia(QAction *item)
void slotCreateAddressBookContact()
static ProgressManager * instance()
void slotCollectionChanged(const Akonadi::Collection &, const QSet< QByteArray > &)
void slotConfigureAutomaticArchiving()
QLabel * vacationScriptIndicator() const
void slotSetThreadStatusUnread()
void slotDelayedRemoveFolder(KJob *)
static ProgressItem * createProgressItem(const QString &label)
void showMessage(const QString &encoding, const Akonadi::Item &msg, const Akonadi::Collection &parentCollection=Akonadi::Collection())
take ownership of and show
void slotItemAdded(const Akonadi::Item &, const Akonadi::Collection &col)
bool mailingListPost(const QSharedPointer< MailCommon::FolderCollection > &fd)
void slotRemoveDuplicatesCanceled(KPIM::ProgressItem *)
void slotConfigureSendLater()
void slotFilterLogViewer()
void slotManageSieveScripts()
KAction * akonadiStandardAction(Akonadi::StandardActionManager::Type type)
void slotExpandAllThreads()
void slotSetThreadStatusWatched()
This class implements a "reader window", that is a window used for reading or viewing messages...
void slotFolderMailingListProperties()
void slotDelayedShowNewFromTemplate(KJob *)
void slotReplaceMsgByUnencryptedVersion()
void slotSetThreadStatusImportant()
virtual QByteArray text(quint32 serialNumber) const =0
void slotCheckOneAccount(QAction *)
This command is used to set or toggle a tag for a list of messages.
void launchAccountWizard(QWidget *)
Manages common actions that can be performed on one or more messages.
void slotMessagePopup(const Akonadi::Item &, const KUrl &, const KUrl &imageUrl, const QPoint &)
void slotUpdateMessageTagList(const QString &aLabel)
Adds if not existing/removes if existing the tag identified by aLabel in all selected messages...
void slotMessageSelected(const Akonadi::Item &)
Opens mail in the internal viewer.
void slotOverrideHtmlLoadExt()
void slotSetThreadStatusToAct()
void slotFocusQuickSearch()
void slotMessageActivated(const Akonadi::Item &)
Open a separate viewer window containing the specified message.
void slotCustomReplyAllToMsg(const QString &tmpl)
void refreshMessageListSelection()
void copySelectedMessagesToFolder(const Akonadi::Collection &dest)
QSharedPointer< MailCommon::FolderCollection > currentFolder() const
void slotShowStartupFolder()
void slotSelectMoreMessageTagList()
void slotShowNewFromTemplate()
void slotDeleteThread(bool confirmDelete=true)
static KMKernel * self()
normal control stuff
Result result() const
Returns the result of the command.
Akonadi::Collection destFolder() const
KSharedConfig::Ptr config()
Creates actions related to the existing Nepomuk tags and plugs them into the GUI. ...
void slotExtendSelectionToPreviousMessage()
void slotAntiSpamWizard()
virtual void showEvent(QShowEvent *event)
void slotFocusOnPrevMessage()
void slotUpdateOnlineStatus(GlobalSettings::EnumNetworkState::type)
Slightly extended QLabel for embedding into the status bar, providing mouse click signals and support...
void startUpdateMessageActionsTimer()
Start a timer to update message actions.
void slotMessageStatusChangeRequest(const Akonadi::Item &, const Akonadi::MessageStatus &, const Akonadi::MessageStatus &)
void readConfig()
Read configuration options after widgets are created.
void slotStartCheckMail()
Small helper structure which encapsulates the KMMessage created when creating a reply, and.
void slotShowSelectedFolderInPane()
void updateFolderMenu()
Update html and threaded messages preferences in Folder menu.
void slotCheckMailOnStartup()
void slotSelectNextMessage()
Message navigation.
void slotSelectPreviousUnreadMessage()
void slotAkonadiStandardActionUpdated()
void moveSelectedMessagesToFolder(const Akonadi::Collection &dest)
MessageList::Core::MessageItemSetReference refSet() const
void slotDeleteMsg(bool confirmDelete=true)
void slotShowBusySplash()
Show a splash screen for the longer-lasting operation.
void slotItemMoved(const Akonadi::Item &item, const Akonadi::Collection &from, const Akonadi::Collection &to)
void slotCreateNewTab(bool)
void slotItemsFetchedForActivation(const Akonadi::Item::List &list)
void updatePaneTagComboBox()
void slotStartCertManager()
void slotCollectionProperties()
void newFromTemplate(const Akonadi::Item &)
void slotPrevUnreadFolder()
void slotItemRemoved(const Akonadi::Item &)
void slotAddFavoriteFolder()
void slotSelectPreviousMessage()
void slotExtendSelectionToNextMessage()
void showResourceOfflinePage()
void setFolder(const Akonadi::Collection &defaultCollection)
void slotMoveSelectedMessageToFolder()
This will ask for a destination folder and move the currently selected messages (in MessageListView) ...
void slotRemoveDuplicatesDone(KJob *)
void slotSaveAttachments()
static const PtrList * mainWidgetList()
Returns a list of all KMMainWidgets.
void initializeFilterActions()
void slotConfigureFolderArchiving()
void slotTrashSelectedMessages()
Implements the "move to trash" action.
void slotSelectFocusedMessage()
void slotForwardInlineMsg()
void slotSelectCollectionFolder(const Akonadi::Collection &col)
void readFolderConfig()
Read configuration for current folder.
static QString newFeaturesMD5()
Returns the MD5 hash for the list of new features.
void writeConfig(bool force=true)
Write configuration options.
void set(quint32, const QString &, const QString &, const QString &, const QString &, time_t)
void setUsesBusyIndicator(bool useBusyIndicator)
QList< KActionCollection * > actionCollections() const
Convenience function to get the action collection in a list.
static GlobalSettings * self()
void slotForwardAttachedMsg()
void slotShowFolderShortcutDialog()
void showOfflinePage()
Show a message screen explaining that we are currently offline, when an online folder is selected...
void slotSetThreadStatusIgnored()
void updateMessageActions(bool fast=false)
Update message actions.
void slotCollapseAllThreads()
void slotAntiVirusWizard()
void slotShowTip()
Show tip-of-the-day, forced.
void slotContactSearchJobForMessagePopupDone(KJob *job)
void slotUpdateActionsAfterMailChecking()
void slotShowExpiryProperties()
void slotCopySelectedMessagesToFolder()
This will ask for a destination folder and copy the currently selected messages (in MessageListView) ...
void folderSelected(const Akonadi::Collection &col)
Select the given folder If the folder is 0 the intro is shown.
void slotMessageQueuedOrDrafted()
void clearFilterActions()
Clear and create actions for marked filters.
void restoreCollectionFolderViewConfig(Akonadi::Collection::Id id=-1)
void updateVacationScriptStatus()
void slotSetThreadStatusRead()
void updateMessageActionsDelayed()
virtual void setFocusToEditor()=0
Sets the focus to the edit-widget and the cursor below the "On ... you wrote" line when hasMessage is...
void slotCustomReplyToMsg(const QString &tmpl)
Slot to reply to a message.
void slotFocusOnNextMessage()
void slotSelectLastMessage()
void slotCollapseThread()
void addRecentFile(const KUrl &mUrl)
void slotApplyFiltersOnFolder()
void setUseFixedFont(bool useFixedFont)
void slotRemoveDuplicatesUpdate(KJob *, const QString &)
void slotDisplayCurrentMessage()
etc.
virtual void setCollectionForNewMessage(const Akonadi::Collection &folder)=0
void slotEditNotifications()
Settings menu.
void writeFolderConfig()
Write configuration for current folder.
void slotSelectFirstMessage()
void slotCustomForwardMsg(const QString &tmpl)
void slotOpenRecentMsg(const KUrl &url)
void slotCollectionStatisticsChanged(const Akonadi::Collection::Id, const Akonadi::CollectionStatistics &)
void slotStartWatchGnuPG()
void activateFolder(const Akonadi::Collection &folder)
Changes the base folder for search operations to a different folder.
void slotEditVacation()
Trigger the dialog for editing out-of-office scripts.
void slotNewFromTemplate(QAction *)
void updateMessageMenu()
Update message menu.
void slotSelectNextUnreadMessage()
void setStatus(const QString &v)
void slotRemoveDuplicates()
void slotNextUnreadFolder()