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"
47 #include "search/searchrule/searchrulestatus.h"
49 #include <ksieveui/debug/sievedebugdialog.h>
50 using KSieveUi::SieveDebugDialog;
64 #include "pimcommon/acl/collectionaclpage.h"
65 #include "mailcommon/collectionpage/collectiongeneralpage.h"
66 #include "mailcommon/collectionpage/collectionexpirypage.h"
67 #include "mailcommon/collectionpage/attributes/expirecollectionattribute.h"
68 #include "mailcommon/filter/filtermanager.h"
69 #include "mailcommon/filter/mailfilter.h"
70 #include "mailcommon/widgets/favoritecollectionwidget.h"
71 #include "mailcommon/folder/foldertreewidget.h"
72 #include "mailcommon/folder/foldertreeview.h"
73 #include "mailcommon/mailcommonsettings_base.h"
77 #include "kdepim-version.h"
79 #include "messageviewer/utils/autoqpointer.h"
80 #include "messageviewer/settings/globalsettings.h"
81 #include "messageviewer/viewer/viewer.h"
82 #include "messageviewer/viewer/attachmentstrategy.h"
83 #include "messageviewer/header/headerstrategy.h"
84 #include "messageviewer/header/headerstyle.h"
86 #include "messageviewer/utils/kcursorsaver.h"
89 #include "messagecomposer/sender/messagesender.h"
90 #include "messagecomposer/helper/messagehelper.h"
92 #include "templateparser/templateparser.h"
94 #include "messagecore/settings/globalsettings.h"
95 #include "messagecore/misc/mailinglist.h"
96 #include "messagecore/helpers/messagehelpers.h"
101 #include "ksieveui/vacation/vacationmanager.h"
109 #include <Akonadi/AgentManager>
110 #include <Akonadi/AttributeFactory>
111 #include <akonadi/itemfetchjob.h>
112 #include <akonadi/collectionfetchscope.h>
113 #include <akonadi/contact/contactsearchjob.h>
114 #include <akonadi/collectionpropertiesdialog.h>
115 #include <akonadi/entitydisplayattribute.h>
116 #include <akonadi/entitylistview.h>
117 #include <akonadi/etmviewstatesaver.h>
118 #include <akonadi/agentinstance.h>
119 #include <akonadi/agenttype.h>
120 #include <akonadi/changerecorder.h>
121 #include <akonadi/session.h>
122 #include <akonadi/entitytreemodel.h>
123 #include <akonadi/favoritecollectionsmodel.h>
124 #include <akonadi/itemfetchscope.h>
125 #include <akonadi/itemmodifyjob.h>
126 #include <akonadi/control.h>
127 #include <akonadi/collectiondialog.h>
128 #include <akonadi/collectionstatistics.h>
129 #include <Akonadi/EntityMimeTypeFilterModel>
130 #include <akonadi/kmime/messageflags.h>
131 #include <akonadi/kmime/removeduplicatesjob.h>
132 #include <akonadi/dbusconnectionpool.h>
133 #include <Akonadi/CachePolicy>
135 #include <kpimidentities/identity.h>
136 #include <kpimidentities/identitymanager.h>
137 #include <kpimutils/email.h>
138 #include <mailtransport/transportmanager.h>
139 #include <mailtransport/transport.h>
140 #include <kmime/kmime_mdn.h>
141 #include <kmime/kmime_header_parsing.h>
142 #include <kmime/kmime_message.h>
143 #include <ksieveui/managesievescriptsdialog.h>
144 #include <ksieveui/util/util.h>
147 #include <kaboutdata.h>
149 #include <kwindowsystem.h>
150 #include <kmessagebox.h>
151 #include <kactionmenu.h>
153 #include <kacceleratormanager.h>
155 #include <kglobalsettings.h>
156 #include <kstandardshortcut.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 <KRecentFilesAction>
177 #include <QByteArray>
178 #include <QHeaderView>
181 #include <QVBoxLayout>
184 #include <QDBusMessage>
185 #include <QDBusConnection>
186 #include <QTextDocument>
189 #include <akonadi/standardactionmanager.h>
195 using namespace KMime;
196 using namespace Akonadi;
197 using namespace MailCommon;
202 using KMime::Types::AddrSpecList;
203 using MessageViewer::AttachmentStrategy;
209 KActionCollection *actionCollection, KSharedConfig::Ptr config ) :
211 mMoveMsgToFolderAction(0),
212 mCollectionProperties( 0 ),
213 mFavoriteCollectionsView( 0 ),
217 mFolderViewSplitter( 0 ),
218 mArchiveFolderAction( 0 ),
219 mShowBusySplashTimer( 0 ),
222 mVacationIndicatorActive( false ),
223 mGoToFirstUnreadMessageInSelectedFolder( false ),
224 mDisplayMessageFormatMenu( 0 ),
225 mFolderDisplayFormatPreference(MessageViewer::Viewer::UseGlobalSetting),
226 mSearchMessages( 0 ),
228 mShowIntroductionAction( 0 )
232 mStartupDone =
false;
233 mWasEverShown =
false;
234 mReaderWindowActive =
true;
235 mReaderWindowBelow =
true;
236 mFolderHtmlLoadExtPreference =
false;
238 mActionCollection = actionCollection;
240 mTopLayout->setMargin( 0 );
242 mGUIClient = aGUIClient;
243 mFolderTreeWidget = 0;
244 mPreferHtmlLoadExtAction = 0;
245 Akonadi::Control::widgetNeedsAkonadi(
this );
247 mVacationManager =
new KSieveUi::VacationManager(
this);
249 mToolbarActionSeparator =
new QAction(
this );
250 mToolbarActionSeparator->setSeparator(
true );
252 theMainWidgetList->append(
this );
268 connect(
kmkernel, SIGNAL(startCheckMail()),
269 this, SLOT(slotStartCheckMail()) );
271 connect(
kmkernel, SIGNAL(endCheckMail()),
272 this, SLOT(slotEndCheckMail()) );
274 connect(
kmkernel, SIGNAL(configChanged()),
275 this, SLOT(slotConfigChanged()) );
277 connect(
kmkernel, SIGNAL(onlineStatusChanged(GlobalSettings::EnumNetworkState::type)),
278 this, SLOT(slotUpdateOnlineStatus(GlobalSettings::EnumNetworkState::type)) );
280 connect( mTagActionManager, SIGNAL(tagActionTriggered(Akonadi::Tag)),
281 this, SLOT(slotUpdateMessageTagList(Akonadi::Tag)) );
283 connect( mTagActionManager, SIGNAL(tagMoreActionClicked()),
284 this, SLOT(slotSelectMoreMessageTagList()) );
289 static bool pagesRegistered =
false;
291 if ( !pagesRegistered ) {
292 Akonadi::CollectionPropertiesDialog::registerPage(
new PimCommon::CollectionAclPageFactory );
293 Akonadi::CollectionPropertiesDialog::registerPage(
new MailCommon::CollectionGeneralPageFactory );
294 Akonadi::CollectionPropertiesDialog::registerPage(
new CollectionMaintenancePageFactory );
295 Akonadi::CollectionPropertiesDialog::registerPage(
new CollectionQuotaPageFactory );
296 Akonadi::CollectionPropertiesDialog::registerPage(
new CollectionTemplatesPageFactory );
297 Akonadi::CollectionPropertiesDialog::registerPage(
new MailCommon::CollectionExpiryPageFactory );
298 Akonadi::CollectionPropertiesDialog::registerPage(
new CollectionViewPageFactory );
299 Akonadi::CollectionPropertiesDialog::registerPage(
new CollectionMailingListPageFactory );
300 Akonadi::CollectionPropertiesDialog::registerPage(
new CollectionShortcutPageFactory );
302 pagesRegistered =
true;
306 KMainWindow *mainWin =
dynamic_cast<KMainWindow*
>(window());
307 KStatusBar *sb = mainWin ? mainWin->statusBar() : 0;
309 mVacationScriptIndicator->hide();
310 connect( mVacationScriptIndicator, SIGNAL(clicked(
QString)), SLOT(slotEditVacation(
QString)) );
311 if ( KSieveUi::Util::checkOutOfOfficeOnStartup() )
314 connect( mFolderTreeWidget->folderTreeView()->model(), SIGNAL(modelReset()),
315 this, SLOT(restoreCollectionFolderViewConfig()) );
316 restoreCollectionFolderViewConfig();
319 if (MailCommon::Util::foundMailer()) {
320 if (KMessageBox::questionYesNo(
this,i18n(
"Another mailer was found on system. Do you want to import data from it?")) == KMessageBox::Yes) {
323 KMessageBox::error(
this, i18n(
"Could not start the import wizard. "
324 "Please check your installation." ),
325 i18n(
"Unable to start import wizard" ) );
328 mLaunchExternalComponent->slotAccountWizard();
331 mLaunchExternalComponent->slotAccountWizard();
338 mCheckMailTimer.setInterval( 3 * 1000 );
339 mCheckMailTimer.setSingleShot(
true );
340 connect( &mCheckMailTimer, SIGNAL(timeout()), SLOT(slotUpdateActionsAfterMailChecking()) );
346 ETMViewStateSaver *saver =
new ETMViewStateSaver;
347 saver->setView( mFolderTreeWidget->folderTreeView() );
348 const KConfigGroup cfg(
KMKernel::self()->config(),
"CollectionFolderView" );
349 mFolderTreeWidget->restoreHeaderState( cfg.readEntry(
"HeaderState",
QByteArray() ) );
350 saver->restoreState( cfg );
353 Akonadi::Collection::Id
id = -1;
354 if (mCurrentFolder && mCurrentFolder->collection().isValid() ) {
355 id = mCurrentFolder->collection().id();
361 if ( startupFolder > 0 )
375 theMainWidgetList->removeAll(
this );
376 qDeleteAll( mFilterCommands );
392 mCurrentFolder.clear();
393 delete mMoveOrCopyToDialog;
394 delete mSelectFromAllFoldersDialog;
396 disconnect(
kmkernel->folderCollectionMonitor(), SIGNAL(itemAdded(Akonadi::Item,Akonadi::Collection)),
this, 0);
397 disconnect(
kmkernel->folderCollectionMonitor(), SIGNAL(itemRemoved(Akonadi::Item)),
this, 0);
398 disconnect(
kmkernel->folderCollectionMonitor(), SIGNAL(itemMoved(Akonadi::Item,Akonadi::Collection,Akonadi::Collection)),
this, 0);
399 disconnect(
kmkernel->folderCollectionMonitor(), SIGNAL(collectionChanged(Akonadi::Collection,
QSet<QByteArray>)),
this, 0);
400 disconnect(
kmkernel->folderCollectionMonitor(), SIGNAL(collectionStatisticsChanged(Akonadi::Collection::Id,Akonadi::CollectionStatistics)),
this, 0);
408 if ( mCheckMailTimer.isActive() )
409 mCheckMailTimer.stop();
414 if ( !mCheckMailTimer.isActive() )
415 mCheckMailTimer.start();
420 const bool sendOnAll =
422 const bool sendOnManual =
424 if ( !
kmkernel->isOffline() && ( sendOnAll || sendOnManual ) ) {
432 void KMMainWidget::slotCollectionFetched(
int collectionId )
437 if ( mCurrentFolder && collectionId == mCurrentFolder->collection().id() ) {
438 mCurrentFolder->setCollection( MailCommon::Util::updatedCollection( mCurrentFolder->collection() ) );
439 updateMessageActions();
443 if ( mCurrentFolder ) {
444 emit captionChangeRequest( MailCommon::Util::fullCollectionPath( mCurrentFolder->collection() ) );
448 void KMMainWidget::slotFolderChanged(
const Akonadi::Collection& collection )
450 folderSelected( collection );
451 if (collection.cachePolicy().syncOnDemand())
452 AgentManager::self()->synchronizeCollection( collection,
false );
453 mMsgActions->setCurrentMessage( Akonadi::Item() );
454 emit captionChangeRequest( MailCommon::Util::fullCollectionPath( collection ) );
461 if ( mGoToFirstUnreadMessageInSelectedFolder )
464 mPreSelectionMode = MessageList::Core::PreSelectFirstUnreadCentered;
469 case GlobalSettings::EnumActionEnterFolder::SelectFirstUnread:
470 mPreSelectionMode = MessageList::Core::PreSelectFirstUnreadCentered;
472 case GlobalSettings::EnumActionEnterFolder::SelectLastSelected:
473 mPreSelectionMode = MessageList::Core::PreSelectLastSelected;
475 case GlobalSettings::EnumActionEnterFolder::SelectNewest:
476 mPreSelectionMode = MessageList::Core::PreSelectNewestCentered;
478 case GlobalSettings::EnumActionEnterFolder::SelectOldest:
479 mPreSelectionMode = MessageList::Core::PreSelectOldestCentered;
482 mPreSelectionMode = MessageList::Core::PreSelectNone;
487 mGoToFirstUnreadMessageInSelectedFolder =
false;
489 MessageViewer::KCursorSaver busy( MessageViewer::KBusyPtr::busy() );
493 mMsgView->clear(
true);
494 const bool newFolder = mCurrentFolder && ( mCurrentFolder->collection() != col );
497 delete mShowBusySplashTimer;
498 mShowBusySplashTimer = 0;
505 mCurrentFolder = FolderCollection::forCollection( col );
510 mMsgView->setDisplayFormatMessageOverwrite(mFolderDisplayFormatPreference);
511 mMsgView->setHtmlLoadExtOverride(mFolderHtmlLoadExtPreference);
514 if ( !mCurrentFolder->isValid() && ( mMessagePane->count() < 2 ) )
517 updateMessageActions();
528 if ( mCurrentFolder && mCurrentFolder->collection().isValid() ) {
529 mMessagePane->setCurrentFolder( mCurrentFolder->collection(), false , mPreSelectionMode );
536 mMsgView->clear(
true );
537 mMsgView->displayAboutPage();
544 mLongFolderList =
GlobalSettings::self()->folderList() == GlobalSettings::EnumFolderList::longlist;
545 mReaderWindowActive =
GlobalSettings::self()->readerWindowMode() != GlobalSettings::EnumReaderWindowMode::hide;
546 mReaderWindowBelow =
GlobalSettings::self()->readerWindowMode() == GlobalSettings::EnumReaderWindowMode::below;
548 mHtmlGlobalSetting = MessageViewer::GlobalSettings::self()->htmlMail();
549 mHtmlLoadExtGlobalSetting = MessageViewer::GlobalSettings::self()->htmlLoadExternal();
551 mEnableFavoriteFolderView = ( MailCommon::MailCommonSettings::self()->favoriteCollectionViewMode() != MailCommon::MailCommonSettings::EnumFavoriteCollectionViewMode::HiddenMode );
554 updateHtmlMenuEntry();
556 mMsgView->setDisplayFormatMessageOverwrite(mFolderDisplayFormatPreference);
557 mMsgView->update(
true );
565 if ( !mCurrentFolder || !mCurrentFolder->isValid() )
568 KConfigGroup group( config, MailCommon::FolderCollection::configGroupName( mCurrentFolder->collection() ) );
569 if (group.hasKey(
"htmlMailOverride")) {
570 const bool useHtml = group.readEntry(
"htmlMailOverride",
false );
571 mFolderDisplayFormatPreference = useHtml ? MessageViewer::Viewer::Html : MessageViewer::Viewer::Text;
572 group.deleteEntry(
"htmlMailOverride");
575 mFolderDisplayFormatPreference =
static_cast<MessageViewer::Viewer::DisplayFormatMessage
>(group.readEntry(
"displayFormatOverride", static_cast<int>(MessageViewer::Viewer::UseGlobalSetting)));
577 mFolderHtmlLoadExtPreference =
578 group.readEntry(
"htmlLoadExternalOverride",
false );
585 if ( mCurrentFolder && mCurrentFolder->isValid() ) {
587 KConfigGroup group( config, MailCommon::FolderCollection::configGroupName( mCurrentFolder->collection() ) );
588 group.writeEntry(
"htmlLoadExternalOverride", mFolderHtmlLoadExtPreference );
589 if (mFolderDisplayFormatPreference == MessageViewer::Viewer::UseGlobalSetting)
590 group.deleteEntry(
"displayFormatOverride");
592 group.writeEntry(
"displayFormatOverride", static_cast<int>(mFolderDisplayFormatPreference) );
600 Q_ASSERT( !mSplitter1 );
601 Q_ASSERT( !mSplitter2 );
606 disconnect( mMsgView->copyAction(), SIGNAL(triggered(
bool)),
607 mMsgView, SLOT(slotCopySelectedText()) );
620 const bool opaqueResize = KGlobalSettings::opaqueResize();
621 const bool readerWindowAtSide = !mReaderWindowBelow && mReaderWindowActive;
622 const bool readerWindowBelow = mReaderWindowBelow && mReaderWindowActive;
625 mSplitter2 =
new QSplitter( mSplitter1 );
627 QWidget * folderTreeWidget = mSearchAndTree;
628 if ( mFavoriteCollectionsView ) {
629 mFolderViewSplitter =
new QSplitter( Qt::Vertical );
630 mFolderViewSplitter->setOpaqueResize( opaqueResize );
632 mFolderViewSplitter->addWidget( mFavoriteCollectionsView );
633 mFavoriteCollectionsView->setParent( mFolderViewSplitter );
634 mFolderViewSplitter->addWidget( mSearchAndTree );
635 folderTreeWidget = mFolderViewSplitter;
638 if ( mLongFolderList ) {
641 mSplitter1->setOrientation( Qt::Horizontal );
642 mSplitter1->addWidget( folderTreeWidget );
645 mSplitter1->addWidget( mSplitter2 );
648 if ( readerWindowAtSide ) {
649 mSplitter2->setOrientation( Qt::Horizontal );
651 mSplitter2->setOrientation( Qt::Vertical );
653 mSplitter2->addWidget( mMessagePane );
657 mSplitter2->addWidget( mMsgView );
661 if ( mReaderWindowBelow ) {
662 mSplitter1->setOrientation( Qt::Vertical );
663 mSplitter2->setOrientation( Qt::Horizontal );
665 mSplitter1->setOrientation( Qt::Horizontal );
666 mSplitter2->setOrientation( Qt::Vertical );
669 mSplitter1->addWidget( mSplitter2 );
672 mSplitter2->addWidget( folderTreeWidget );
674 mSplitter2->addWidget( mMessagePane );
678 mSplitter1->addWidget( mMsgView );
685 mSplitter1->setOpaqueResize( opaqueResize );
688 mSplitter2->setOpaqueResize( opaqueResize );
694 mSplitter1->setStretchFactor( 0, 0 );
695 mSplitter2->setStretchFactor( 0, 0 );
696 mSplitter1->setStretchFactor( 1, 1 );
697 mSplitter2->setStretchFactor( 1, 1 );
699 if ( mFavoriteCollectionsView ) {
700 mFolderViewSplitter->setStretchFactor( 0, 0 );
701 mFolderViewSplitter->setStretchFactor( 1, 1 );
707 if ( readerWindowAtSide && !mLongFolderList ) {
708 mSplitter1->setStretchFactor( 0, 1 );
709 mSplitter1->setStretchFactor( 1, 0 );
725 int ffvHeight = mFolderViewSplitter ? MailCommon::MailCommonSettings::self()->favoriteCollectionViewHeight() : 0;
728 if ( messageViewerHeight < 10 && readerWindowBelow ) {
730 messageViewerHeight = headerHeight;
733 if ( mLongFolderList ) {
734 if ( !readerWindowAtSide ) {
735 splitter1Sizes << folderViewWidth << headerWidth;
736 splitter2Sizes << headerHeight << messageViewerHeight;
738 splitter1Sizes << folderViewWidth << ( headerWidth + messageViewerWidth );
739 splitter2Sizes << headerWidth << messageViewerWidth;
742 if ( !readerWindowAtSide ) {
743 splitter1Sizes << headerHeight << messageViewerHeight;
744 splitter2Sizes << folderViewWidth << headerWidth;
746 splitter1Sizes << headerWidth << messageViewerWidth;
747 splitter2Sizes << ftHeight + ffvHeight << messageViewerHeight;
751 mSplitter1->setSizes( splitter1Sizes );
752 mSplitter2->setSizes( splitter2Sizes );
754 if ( mFolderViewSplitter ) {
756 splitterSizes << ffvHeight << ftHeight;
757 mFolderViewSplitter->setSizes( splitterSizes );
763 mTopLayout->addWidget( mSplitter1 );
769 mMessagePane->focusView();
774 mFolderTreeWidget->folderTreeView()->hideColumn( 1 );
775 mFolderTreeWidget->folderTreeView()->hideColumn( 3 );
776 mFolderTreeWidget->folderTreeView()->header()->resizeSection( 0, folderViewWidth * 0.8 );
781 connect( mMsgView->copyAction(), SIGNAL(triggered(
bool)),
782 mMsgView, SLOT(slotCopySelectedText()) );
786 void KMMainWidget::refreshFavoriteFoldersViewProperties()
788 if ( mFavoriteCollectionsView ) {
789 if ( MailCommon::MailCommonSettings::self()->favoriteCollectionViewMode() == MailCommon::MailCommonSettings::EnumFavoriteCollectionViewMode::IconMode )
790 mFavoriteCollectionsView->changeViewMode( QListView::IconMode );
791 else if ( MailCommon::MailCommonSettings::self()->favoriteCollectionViewMode() == MailCommon::MailCommonSettings::EnumFavoriteCollectionViewMode::ListMode )
792 mFavoriteCollectionsView->changeViewMode( QListView::ListMode );
795 mFavoriteCollectionsView->setDropActionMenuEnabled(
kmkernel->showPopupAfterDnD() );
796 mFavoriteCollectionsView->setWordWrap(
true );
797 mFavoriteCollectionsView->updateMode();
804 const bool oldLongFolderList = mLongFolderList;
805 const bool oldReaderWindowActive = mReaderWindowActive;
806 const bool oldReaderWindowBelow = mReaderWindowBelow;
807 const bool oldFavoriteFolderView = mEnableFavoriteFolderView;
808 const bool oldFolderQuickSearch = mEnableFolderQuickSearch;
811 bool layoutChanged = !mStartupDone;
817 layoutChanged = ( oldLongFolderList != mLongFolderList ) ||
818 ( oldReaderWindowActive != mReaderWindowActive ) ||
819 ( oldReaderWindowBelow != mReaderWindowBelow ) ||
820 ( oldFavoriteFolderView != mEnableFavoriteFolderView );
822 if ( layoutChanged ) {
825 restoreCollectionFolderViewConfig();
827 }
else if ( oldFolderQuickSearch != mEnableFolderQuickSearch ) {
828 if ( mEnableFolderQuickSearch )
829 mFolderTreeWidget->filterFolderLineEdit()->show();
831 mFolderTreeWidget->filterFolderLineEdit()->hide();
838 mMsgView->readConfig();
840 mMessagePane->reloadGlobalConfiguration();
841 mFolderTreeWidget->readConfig();
842 if ( mFavoriteCollectionsView ) {
843 mFavoriteCollectionsView->readConfig();
845 refreshFavoriteFoldersViewProperties();
857 if ( layoutChanged ) {
865 connect( Akonadi::AgentManager::self(), SIGNAL(instanceAdded(Akonadi::AgentInstance)),
866 this, SLOT(updateFileMenu()) );
867 connect( Akonadi::AgentManager::self(), SIGNAL(instanceRemoved(Akonadi::AgentInstance)),
868 this, SLOT(updateFileMenu()) );
878 if ( mWasEverShown ) {
882 int headersHeight = mMessagePane->height();
883 if ( headersHeight == 0 )
884 headersHeight = height() / 2;
888 if ( mFavoriteCollectionsView ) {
889 MailCommon::MailCommonSettings::self()->setFavoriteCollectionViewHeight( mFavoriteCollectionsView->height() );
891 if ( !mLongFolderList ) {
895 else if ( !mLongFolderList && mFolderTreeWidget )
899 if ( mFolderTreeWidget )
903 KConfigGroup group(config,
"CollectionFolderView");
905 ETMViewStateSaver saver;
906 saver.setView( mFolderTreeWidget->folderTreeView() );
907 saver.saveState( group );
909 group.writeEntry(
"HeaderState", mFolderTreeWidget->folderTreeView()->header()->saveState() );
911 group.deleteEntry(
"Selection" );
914 group.deleteEntry(
"Current" );
921 if ( !mReaderWindowBelow )
923 mMsgView->viewer()->writeConfig(force);
931 if ( mWasEverShown ) {
933 mMsgView->viewer()->writeConfig();
945 delete mAkonadiStandardActionManager;
946 mAkonadiStandardActionManager = 0;
950 mFolderViewSplitter = 0;
951 mFavoriteCollectionsView = 0;
966 FolderTreeWidget::TreeViewOptions opt = FolderTreeWidget::ShowUnreadCount;
967 opt |= FolderTreeWidget::UseLineEditForFiltering;
968 opt |= FolderTreeWidget::ShowCollectionStatisticAnimation;
969 opt |= FolderTreeWidget::DontKeyFilter;
970 mFolderTreeWidget =
new FolderTreeWidget(
this, mGUIClient, opt );
972 connect( mFolderTreeWidget->folderTreeView(), SIGNAL(currentChanged(Akonadi::Collection)),
this, SLOT(slotFolderChanged(Akonadi::Collection)) );
974 connect( mFolderTreeWidget->folderTreeView()->selectionModel(), SIGNAL(selectionChanged(
QItemSelection,
QItemSelection)),
this, SLOT(updateFolderMenu()) );
976 connect( mFolderTreeWidget->folderTreeView(), SIGNAL(prefereCreateNewTab(
bool)),
this, SLOT(slotCreateNewTab(
bool)) );
978 mFolderTreeWidget->setSelectionMode( QAbstractItemView::ExtendedSelection );
980 mFolderTreeWidget->folderTreeView()->selectionModel(),
982 connect(
KMKernel::self()->entityTreeModel(), SIGNAL(collectionFetched(
int)),
this, SLOT(slotCollectionFetched(
int)));
984 mMessagePane->setXmlGuiClient( mGUIClient );
985 connect( mMessagePane, SIGNAL(messageSelected(Akonadi::Item)),
986 this, SLOT(slotMessageSelected(Akonadi::Item)) );
987 connect( mMessagePane, SIGNAL(selectionChanged()),
988 SLOT(startUpdateMessageActionsTimer()) );
989 connect( mMessagePane, SIGNAL(currentTabChanged()),
this, SLOT(refreshMessageListSelection()) );
990 connect( mMessagePane, SIGNAL(messageActivated(Akonadi::Item)),
991 this, SLOT(slotMessageActivated(Akonadi::Item)) );
992 connect( mMessagePane, SIGNAL(messageStatusChangeRequest(Akonadi::Item,Akonadi::MessageStatus,Akonadi::MessageStatus)),
993 SLOT(slotMessageStatusChangeRequest(Akonadi::Item,Akonadi::MessageStatus,Akonadi::MessageStatus)) );
995 connect( mMessagePane, SIGNAL(statusMessage(
QString)),
996 BroadcastStatus::instance(), SLOT(setStatusMsg(
QString)) );
1002 if ( mReaderWindowActive ) {
1003 mMsgView =
new KMReaderWin(
this,
this, actionCollection(), 0 );
1004 if ( mMsgActions ) {
1005 mMsgActions->setMessageView( mMsgView );
1007 connect( mMsgView->viewer(), SIGNAL(replaceMsgByUnencryptedVersion()),
1008 this, SLOT(slotReplaceMsgByUnencryptedVersion()) );
1009 connect( mMsgView->viewer(), SIGNAL(popupMenu(Akonadi::Item,KUrl,KUrl,
QPoint)),
1010 this, SLOT(slotMessagePopup(Akonadi::Item,KUrl,KUrl,
QPoint)) );
1011 connect( mMsgView->viewer(), SIGNAL(moveMessageToTrash()),
1012 this, SLOT(slotMoveMessageToTrash()) );
1013 if (mShowIntroductionAction)
1014 mShowIntroductionAction->setEnabled(
true);
1017 if ( mMsgActions ) {
1018 mMsgActions->setMessageView( 0 );
1020 if (mShowIntroductionAction)
1021 mShowIntroductionAction->setEnabled(
false);
1029 mSearchAndTree =
new QWidget(
this );
1032 mSearchAndTree->setLayout( vboxlayout );
1034 vboxlayout->
addWidget( mFolderTreeWidget );
1037 mFolderTreeWidget->filterFolderLineEdit()->hide();
1042 mAkonadiStandardActionManager =
new Akonadi::StandardMailActionManager( mGUIClient->actionCollection(), this );
1043 connect( mAkonadiStandardActionManager, SIGNAL(actionStateUpdated()),
this, SLOT(slotAkonadiStandardActionUpdated()) );
1045 mAkonadiStandardActionManager->setCollectionSelectionModel( mFolderTreeWidget->folderTreeView()->selectionModel() );
1046 mAkonadiStandardActionManager->setItemSelectionModel( mMessagePane->currentItemSelectionModel() );
1048 if ( mEnableFavoriteFolderView ) {
1050 mFavoriteCollectionsView =
new FavoriteCollectionWidget( mGUIClient,
this );
1051 refreshFavoriteFoldersViewProperties();
1053 connect( mFavoriteCollectionsView, SIGNAL(currentChanged(Akonadi::Collection)),
this, SLOT(slotFolderChanged(Akonadi::Collection)) );
1055 mFavoritesModel =
new Akonadi::FavoriteCollectionsModel(
1056 mFolderTreeWidget->folderTreeView()->model(),
1059 mFavoriteCollectionsView->setModel( mFavoritesModel );
1061 mAkonadiStandardActionManager->setFavoriteCollectionsModel( mFavoritesModel );
1062 mAkonadiStandardActionManager->setFavoriteSelectionModel( mFavoriteCollectionsView->selectionModel() );
1068 standardActions << StandardActionManager::CreateCollection
1069 << StandardActionManager::CopyCollections
1070 << StandardActionManager::DeleteCollections
1071 << StandardActionManager::SynchronizeCollections
1072 << StandardActionManager::CollectionProperties
1073 << StandardActionManager::CopyItems
1074 << StandardActionManager::Paste
1075 << StandardActionManager::DeleteItems
1076 << StandardActionManager::ManageLocalSubscriptions
1077 << StandardActionManager::CopyCollectionToMenu
1078 << StandardActionManager::CopyItemToMenu
1079 << StandardActionManager::MoveItemToMenu
1080 << StandardActionManager::MoveCollectionToMenu
1081 << StandardActionManager::CutItems
1082 << StandardActionManager::CutCollections
1083 << StandardActionManager::CreateResource
1084 << StandardActionManager::DeleteResources
1085 << StandardActionManager::ResourceProperties
1086 << StandardActionManager::SynchronizeResources
1087 << StandardActionManager::ToggleWorkOffline
1088 << StandardActionManager::SynchronizeCollectionsRecursive;
1090 Q_FOREACH( StandardActionManager::Type standardAction, standardActions ) {
1091 mAkonadiStandardActionManager->createAction( standardAction );
1095 if (mEnableFavoriteFolderView) {
1097 favoriteActions << StandardActionManager::AddToFavoriteCollections
1098 << StandardActionManager::RemoveFromFavoriteCollections
1099 << StandardActionManager::RenameFavoriteCollection
1100 << StandardActionManager::SynchronizeFavoriteCollections;
1101 Q_FOREACH( StandardActionManager::Type favoriteAction, favoriteActions) {
1102 mAkonadiStandardActionManager->createAction( favoriteAction );
1107 mailActions << StandardMailActionManager::MarkAllMailAsRead
1108 << StandardMailActionManager::MoveToTrash
1109 << StandardMailActionManager::MoveAllToTrash
1110 << StandardMailActionManager::RemoveDuplicates
1111 << StandardMailActionManager::EmptyAllTrash
1112 << StandardMailActionManager::MarkMailAsRead
1113 << StandardMailActionManager::MarkMailAsUnread
1114 << StandardMailActionManager::MarkMailAsImportant
1115 << StandardMailActionManager::MarkMailAsActionItem;
1117 Q_FOREACH( StandardMailActionManager::Type mailAction, mailActions ) {
1118 mAkonadiStandardActionManager->createAction( mailAction );
1121 mAkonadiStandardActionManager->interceptAction( Akonadi::StandardActionManager::CollectionProperties );
1122 connect( mAkonadiStandardActionManager->action( Akonadi::StandardActionManager::CollectionProperties ), SIGNAL(triggered(
bool)), mManageShowCollectionProperties, SLOT(slotCollectionProperties()) );
1128 mAkonadiStandardActionManager->action( Akonadi::StandardMailActionManager::RemoveDuplicates )->setShortcut(
QKeySequence( Qt::CTRL + Qt::Key_Asterisk ) );
1129 mAkonadiStandardActionManager->interceptAction( Akonadi::StandardMailActionManager::RemoveDuplicates );
1130 connect( mAkonadiStandardActionManager->action( Akonadi::StandardMailActionManager::RemoveDuplicates ), SIGNAL(triggered(
bool)),
this, SLOT(slotRemoveDuplicates()) );
1133 mCollectionProperties = mAkonadiStandardActionManager->action( Akonadi::StandardActionManager::CollectionProperties );
1135 connect(
kmkernel->folderCollectionMonitor(), SIGNAL(collectionRemoved(Akonadi::Collection)),
1136 SLOT(slotCollectionRemoved(Akonadi::Collection)) );
1137 connect(
kmkernel->folderCollectionMonitor(), SIGNAL(itemAdded(Akonadi::Item,Akonadi::Collection)),
1138 SLOT(slotItemAdded(Akonadi::Item,Akonadi::Collection)) );
1139 connect(
kmkernel->folderCollectionMonitor(), SIGNAL(itemRemoved(Akonadi::Item)),
1140 SLOT(slotItemRemoved(Akonadi::Item)) );
1141 connect(
kmkernel->folderCollectionMonitor(), SIGNAL(itemMoved(Akonadi::Item,Akonadi::Collection,Akonadi::Collection)),
1142 SLOT(slotItemMoved(Akonadi::Item,Akonadi::Collection,Akonadi::Collection)) );
1145 connect(
kmkernel->folderCollectionMonitor(), SIGNAL(collectionStatisticsChanged(Akonadi::Collection::Id,Akonadi::CollectionStatistics)), SLOT(slotCollectionStatisticsChanged(Akonadi::Collection::Id,Akonadi::CollectionStatistics)) );
1149 void KMMainWidget::updateMoveAction(
const Akonadi::CollectionStatistics& statistic )
1151 const bool hasUnreadMails = (statistic.unreadCount() > 0);
1152 const bool hasMails = (statistic.count()>0);
1153 updateMoveAction(hasUnreadMails,hasMails);
1156 void KMMainWidget::updateMoveAction(
bool hasUnreadMails,
bool hasMails )
1158 const bool enable_goto_unread = hasUnreadMails
1159 || (
GlobalSettings::self()->loopOnGotoUnread() == GlobalSettings::EnumLoopOnGotoUnread::LoopInAllFolders)
1160 || (
GlobalSettings::self()->loopOnGotoUnread() == GlobalSettings::EnumLoopOnGotoUnread::LoopInAllMarkedFolders);
1161 actionCollection()->action(
QLatin1String(
"go_next_message") )->setEnabled( hasMails );
1162 actionCollection()->action(
QLatin1String(
"go_next_unread_message") )->setEnabled( enable_goto_unread );
1163 actionCollection()->action(
QLatin1String(
"go_prev_message") )->setEnabled( hasMails );
1164 actionCollection()->action(
QLatin1String(
"go_prev_unread_message") )->setEnabled( enable_goto_unread );
1165 if ( mAkonadiStandardActionManager && mAkonadiStandardActionManager->action( Akonadi::StandardMailActionManager::MarkAllMailAsRead ) ) {
1166 mAkonadiStandardActionManager->action( Akonadi::StandardMailActionManager::MarkAllMailAsRead )->setEnabled(hasUnreadMails);
1170 void KMMainWidget::updateAllToTrashAction(
int statistics)
1172 bool multiFolder =
false;
1173 if ( mFolderTreeWidget ) {
1174 multiFolder = mFolderTreeWidget->selectedCollections().count() > 1;
1176 if ( mAkonadiStandardActionManager->action( Akonadi::StandardMailActionManager::MoveAllToTrash ) ) {
1177 const bool folderWithContent = mCurrentFolder && !mCurrentFolder->isStructural();
1178 mAkonadiStandardActionManager->action( Akonadi::StandardMailActionManager::MoveAllToTrash )->setEnabled( folderWithContent
1179 && ( statistics > 0 )
1180 && mCurrentFolder->canDeleteMessages()
1187 if (
id == CommonKernel->outboxCollectionFolder().id() ) {
1188 const bool enableAction = (statistic.count() > 0);
1189 mSendQueued->setEnabled( enableAction );
1190 mSendActionMenu->setEnabled( enableAction );
1191 }
else if ( mCurrentFolder && (
id == mCurrentFolder->collection().id() ) ) {
1192 updateMoveAction( statistic );
1193 updateAllToTrashAction(statistic.count());
1194 mCurrentFolder->setCollection(MailCommon::Util::updatedCollection( mCurrentFolder->collection() ));
1200 mMessagePane->setPreferEmptyTab( preferNewTab );
1206 && ( collection == mCurrentFolder->collection() )
1207 && ( set.
contains(
"MESSAGEFOLDER" ) || set.
contains(
"expirationcollectionattribute" ) ) ) {
1208 if ( set.
contains(
"MESSAGEFOLDER" ) )
1209 mMessagePane->resetModelStorage();
1211 mCurrentFolder->setCollection( collection );
1214 const QModelIndex idx = Akonadi::EntityTreeModel::modelIndexForCollection(
KMKernel::self()->collectionModel(), collection );
1218 mMessagePane->updateTabIconText( collection, text,icon );
1227 if ( col.isValid() ) {
1228 if ( col == CommonKernel->outboxCollectionFolder() ) {
1229 startUpdateMessageActionsTimer();
1236 if ( item.isValid() && item.parentCollection().isValid() && ( item.parentCollection() == CommonKernel->outboxCollectionFolder() ) ) {
1237 startUpdateMessageActionsTimer();
1243 if ( item.isValid() && ( ( from.id() == CommonKernel->outboxCollectionFolder().id() )
1244 || to.id() == CommonKernel->outboxCollectionFolder().id() ) ) {
1245 startUpdateMessageActionsTimer();
1253 mMessagePane->focusQuickSearch(text);
1261 mSearchWin =
new SearchWindow(
this, mCurrentFolder ? mCurrentFolder->collection() : Akonadi::Collection());
1262 mSearchWin->setModal(
false );
1267 mSearchWin->
activateFolder(mCurrentFolder ? mCurrentFolder->collection() : Akonadi::Collection());
1271 KWindowSystem::activateWindow( mSearchWin->winId() );
1279 KToolInvocation::invokeHelp();
1286 FilterIf->openFilterDialog(
true );
1291 if ( !
kmkernel->askToGoOnline() ) {
1294 if (mManageSieveDialog)
1297 mManageSieveDialog =
new KSieveUi::ManageSieveScriptsDialog;
1298 mManageSieveDialog->show();
1317 KMime::Message::Ptr msg(
new KMime::Message() );
1319 bool forceCursorPosition =
false;
1320 if ( mCurrentFolder ) {
1321 MessageHelper::initHeader( msg,
KMKernel::self()->identityManager(), mCurrentFolder->identity() );
1329 TemplateParser::TemplateParser parser( msg, TemplateParser::TemplateParser::NewMessage );
1330 parser.setIdentityManager(
KMKernel::self()->identityManager() );
1331 parser.process( msg, mCurrentFolder->collection() );
1332 win = KMail::makeComposer( msg,
false,
false,
KMail::Composer::New, mCurrentFolder->identity() );
1334 forceCursorPosition = parser.cursorPositionWasSet();
1336 MessageHelper::initHeader( msg,
KMKernel::self()->identityManager() );
1337 TemplateParser::TemplateParser parser( msg, TemplateParser::TemplateParser::NewMessage );
1338 parser.setIdentityManager(
KMKernel::self()->identityManager() );
1339 parser.process( KMime::Message::Ptr(), Akonadi::Collection() );
1341 forceCursorPosition = parser.cursorPositionWasSet();
1343 if (forceCursorPosition) {
1354 if ( mCurrentFolder ) {
1355 const KPIMIdentities::Identity & ident =
1356 kmkernel->identityManager()->identityForUoidOrDefault( mCurrentFolder->identity() );
1357 mTemplateFolder = CommonKernel->collectionFromId( ident.templates().toLongLong() );
1360 if ( !mTemplateFolder.isValid() ) {
1361 mTemplateFolder = CommonKernel->templatesCollectionFolder();
1363 if ( !mTemplateFolder.isValid() )
1366 mTemplateMenu->menu()->clear();
1368 Akonadi::ItemFetchJob *job =
new Akonadi::ItemFetchJob( mTemplateFolder );
1369 job->fetchScope().setAncestorRetrieval( ItemFetchScope::Parent );
1370 job->fetchScope().fetchFullPayload();
1371 connect( job, SIGNAL(result(
KJob*)), SLOT(slotDelayedShowNewFromTemplate(
KJob*)) );
1376 Akonadi::ItemFetchJob *fetchJob = qobject_cast<Akonadi::ItemFetchJob*>( job );
1378 const Akonadi::Item::List items = fetchJob->items();
1379 const int numberOfItems = items.count();
1380 for (
int idx = 0; idx < numberOfItems; ++idx ) {
1381 KMime::Message::Ptr msg = MessageCore::Util::message( items.at( idx ) );
1383 QString subj = msg->subject()->asUnicodeString();
1385 subj = i18n(
"No Subject");
1390 templateAction->
setData( var );
1396 if ( mTemplateMenu->menu()->actions().isEmpty() ) {
1398 i18n(
"(no templates)" ) );
1408 if ( !mTemplateFolder.isValid() )
1410 const Akonadi::Item item = action->
data().
value<Akonadi::Item>();
1411 newFromTemplate( item );
1418 if ( !msg.isValid() )
1428 if ( mCurrentFolder && mCurrentFolder->isMailingListEnabled() ) {
1439 if ( !mCurrentFolder )
1441 bool mustDeleteExpirationAttribute =
false;
1442 MailCommon::ExpireCollectionAttribute *attr = MailCommon::Util::expirationCollectionAttribute( mCurrentFolder->collection(), mustDeleteExpirationAttribute );
1443 bool canBeExpired =
true;
1444 if ( !attr->isAutoExpire() ) {
1445 canBeExpired =
false;
1446 }
else if ( attr->unreadExpireUnits() == MailCommon::ExpireCollectionAttribute::ExpireNever &&
1447 attr->readExpireUnits() == MailCommon::ExpireCollectionAttribute::ExpireNever ) {
1448 canBeExpired =
false;
1451 if ( !canBeExpired ) {
1452 const QString message = i18n(
"This folder does not have any expiry options set" );
1453 KMessageBox::information(
this, message );
1454 if ( mustDeleteExpirationAttribute )
1460 const QString message = i18n(
"<qt>Are you sure you want to expire the folder <b>%1</b>?</qt>",
1462 if ( KMessageBox::warningContinueCancel(
this, message, i18n(
"Expire Folder" ),
1463 KGuiItem( i18n(
"&Expire" ) ) )
1464 != KMessageBox::Continue ) {
1465 if ( mustDeleteExpirationAttribute )
1471 MailCommon::Util::expireOldMessages( mCurrentFolder->collection(),
true );
1472 if ( mustDeleteExpirationAttribute )
1479 if (!mCurrentFolder)
return;
1480 const bool isTrash = CommonKernel->folderIsTrash( mCurrentFolder->collection() );
1483 const QString title = (isTrash) ? i18n(
"Empty Trash") : i18n(
"Move to Trash");
1485 i18n(
"Are you sure you want to empty the trash folder?") :
1486 i18n(
"<qt>Are you sure you want to move all messages from "
1487 "folder <b>%1</b> to the trash?</qt>",
Qt::escape( mCurrentFolder->name() ) );
1489 if (KMessageBox::warningContinueCancel(
this, text, title, KGuiItem( title,
QLatin1String(
"user-trash")))
1490 != KMessageBox::Continue)
return;
1492 #ifndef QT_NO_CURSOR
1493 MessageViewer::KCursorSaver busy( MessageViewer::KBusyPtr::busy() );
1499 slotDeleteMsg(
false );
1502 slotTrashSelectedMessages();
1505 mMsgView->clearCache();
1508 BroadcastStatus::instance()->setStatusMsg(i18n(
"Moved all messages to the trash"));
1510 updateMessageActions();
1514 mAkonadiStandardActionManager->action( Akonadi::StandardMailActionManager::MoveAllToTrash )->setEnabled(
false );
1520 if ( mCurrentFolder && mCurrentFolder->collection().isValid() ) {
1522 archiveDialog.
setFolder( mCurrentFolder->collection() );
1523 archiveDialog.exec();
1530 if ( !mCurrentFolder )
return;
1531 if ( !mCurrentFolder->collection().isValid() )
return;
1532 if ( mCurrentFolder->isSystemFolder() )
return;
1533 if ( mCurrentFolder->isReadOnly() )
return;
1536 connect(job, SIGNAL(clearCurrentFolder()),
this, SLOT(slotClearCurrentFolder()));
1544 mCurrentFolder.clear();
1551 const int ret = KMessageBox::warningContinueCancel(KMainWindow::memberList().first(),
1552 i18n(
"Are you sure you want to expire all old messages?"),
1553 i18n(
"Expire Old Messages?"), KGuiItem(i18n(
"Expire")));
1554 if (ret != KMessageBox::Continue) {
1566 if ( mHtmlLoadExtGlobalSetting == mFolderHtmlLoadExtPreference ) {
1567 int result = KMessageBox::warningContinueCancel(
this,
1569 i18n(
"Loading external references in html mail will make you more vulnerable to "
1570 "\"spam\" and may increase the likelihood that your system will be "
1571 "compromised by other present and anticipated security exploits." ),
1572 i18n(
"Security Warning" ),
1573 KGuiItem(i18n(
"Load External References" )),
1574 KStandardGuiItem::cancel(),
1576 if ( result == KMessageBox::Cancel ) {
1577 mPreferHtmlLoadExtAction->setChecked(
false );
1581 mFolderHtmlLoadExtPreference = !mFolderHtmlLoadExtPreference;
1584 mMsgView->setHtmlLoadExtOverride(mFolderHtmlLoadExtPreference);
1585 mMsgView->update(
true );
1592 if (!CommonKernel->folderIsDraftOrOutbox(mCurrentFolder->collection()))
1595 mMsgView->update(
true);
1602 if ( !mCurrentFolder ) {
1607 if ( selectedMessages.
isEmpty() )
1610 this, selectedMessages, mCurrentFolder->identity()
1620 if ( !mCurrentFolder ) {
1625 if ( selectedMessages.
isEmpty() )
1628 this, selectedMessages, mCurrentFolder->identity()
1638 newFromTemplate( mMessagePane->currentItem() );
1645 const Akonadi::Item msg = mMessagePane->currentItem();
1646 if ( !msg.isValid() )
1657 void KMMainWidget::moveMessageSelected( MessageList::Core::MessageItemSetReference ref,
const Akonadi::Collection &dest,
bool confirmOnDeletion )
1661 if ( !dest.isValid() && confirmOnDeletion )
1663 int ret = KMessageBox::warningContinueCancel(
1666 "<qt>Do you really want to delete the selected message?<br />"
1667 "Once deleted, it cannot be restored.</qt>",
1668 "<qt>Do you really want to delete the %1 selected messages?<br />"
1669 "Once deleted, they cannot be restored.</qt>",
1672 selectMsg.
count() > 1 ? i18n(
"Delete Messages" ) : i18n(
"Delete Message" ),
1673 KStandardGuiItem::del(),
1674 KStandardGuiItem::cancel(),
1677 if ( ret == KMessageBox::Cancel )
1679 mMessagePane->deletePersistentSet( ref );
1683 mMessagePane->markMessageItemsAsAboutToBeRemoved( ref,
true );
1692 if ( dest.isValid() )
1693 BroadcastStatus::instance()->setStatusMsg( i18n(
"Moving messages..." ) );
1695 BroadcastStatus::instance()->setStatusMsg( i18n(
"Deleting messages..." ) );
1698 void KMMainWidget::slotMoveMessagesCompleted(
KMMoveCommand *command )
1700 Q_ASSERT( command );
1701 mMessagePane->markMessageItemsAsAboutToBeRemoved( command->
refSet(), false );
1702 mMessagePane->deletePersistentSet( command->
refSet() );
1704 const bool moveWasReallyADelete = !command->
destFolder().isValid();
1708 if ( moveWasReallyADelete )
1709 BroadcastStatus::instance()->setStatusMsg( i18n(
"Messages deleted successfully." ) );
1711 BroadcastStatus::instance()->setStatusMsg( i18n(
"Messages moved successfully." ) );
1713 if ( moveWasReallyADelete )
1716 BroadcastStatus::instance()->setStatusMsg( i18n(
"Deleting messages failed." ) );
1718 BroadcastStatus::instance()->setStatusMsg( i18n(
"Deleting messages canceled." ) );
1721 BroadcastStatus::instance()->setStatusMsg( i18n(
"Moving messages failed." ) );
1723 BroadcastStatus::instance()->setStatusMsg( i18n(
"Moving messages canceled." ) );
1732 MessageList::Core::MessageItemSetReference ref = mMessagePane->selectionAsPersistentSet();
1734 moveMessageSelected( ref, Akonadi::Collection(), confirmDelete );
1740 MessageList::Core::MessageItemSetReference ref = mMessagePane->currentThreadAsPersistentSet();
1742 moveMessageSelected( ref, Akonadi::Collection(), confirmDelete );
1745 FolderSelectionDialog* KMMainWidget::moveOrCopyToDialog()
1747 if ( !mMoveOrCopyToDialog ) {
1748 FolderSelectionDialog::SelectionFolderOption options = FolderSelectionDialog::HideVirtualFolder;
1749 mMoveOrCopyToDialog =
new FolderSelectionDialog(
this, options );
1750 mMoveOrCopyToDialog->setModal(
true );
1752 return mMoveOrCopyToDialog;
1755 FolderSelectionDialog* KMMainWidget::selectFromAllFoldersDialog()
1757 if ( !mSelectFromAllFoldersDialog ) {
1758 FolderSelectionDialog::SelectionFolderOptions options = FolderSelectionDialog::None;
1759 options |= FolderSelectionDialog::NotAllowToCreateNewFolder;
1761 mSelectFromAllFoldersDialog =
new FolderSelectionDialog(
this, options );
1762 mSelectFromAllFoldersDialog->setModal(
true );
1764 return mSelectFromAllFoldersDialog;
1770 dialog->setCaption( i18n(
"Move Messages to Folder" ) );
1771 if ( dialog->exec() && dialog ) {
1772 const Akonadi::Collection dest = dialog->selectedCollection();
1773 if ( dest.isValid() ) {
1774 moveSelectedMessagesToFolder( dest );
1781 MessageList::Core::MessageItemSetReference ref = mMessagePane->selectionAsPersistentSet();
1784 moveMessageSelected( ref, dest,
false );
1789 void KMMainWidget::copyMessageSelected(
const QList<Akonadi::Item> &selectMsg,
const Akonadi::Collection &dest )
1797 this, SLOT(slotCopyMessagesCompleted(
KMCommand*))
1800 BroadcastStatus::instance()->setStatusMsg( i18n(
"Copying messages..." ) );
1804 void KMMainWidget::slotCopyMessagesCompleted(
KMCommand *command )
1806 Q_ASSERT( command );
1809 BroadcastStatus::instance()->setStatusMsg( i18n(
"Messages copied successfully." ) );
1812 BroadcastStatus::instance()->setStatusMsg( i18n(
"Copying messages failed." ) );
1814 BroadcastStatus::instance()->setStatusMsg( i18n(
"Copying messages canceled." ) );
1822 dialog->setCaption( i18n(
"Copy Messages to Folder" ) );
1824 if ( dialog->exec() && dialog ) {
1825 const Akonadi::Collection dest = dialog->selectedCollection();
1826 if ( dest.isValid() ) {
1827 copySelectedMessagesToFolder( dest );
1836 copyMessageSelected( lstMsg, dest );
1843 void KMMainWidget::trashMessageSelected( MessageList::Core::MessageItemSetReference ref )
1845 if ( !mCurrentFolder ) {
1850 mMessagePane->markMessageItemsAsAboutToBeRemoved( ref,
true );
1861 BroadcastStatus::instance()->setStatusMsg( i18n(
"Moving messages to trash..." ) );
1864 void KMMainWidget::slotTrashMessagesCompleted(
KMMoveCommand *command )
1866 Q_ASSERT( command );
1867 mMessagePane->markMessageItemsAsAboutToBeRemoved( command->
refSet(), false );
1868 mMessagePane->deletePersistentSet( command->
refSet() );
1871 BroadcastStatus::instance()->setStatusMsg( i18n(
"Messages moved to trash successfully." ) );
1874 BroadcastStatus::instance()->setStatusMsg( i18n(
"Moving messages to trash failed." ) );
1876 BroadcastStatus::instance()->setStatusMsg( i18n(
"Moving messages to trash canceled." ) );
1884 MessageList::Core::MessageItemSetReference ref = mMessagePane->selectionAsPersistentSet();
1886 trashMessageSelected( ref );
1892 MessageList::Core::MessageItemSetReference ref = mMessagePane->currentThreadAsPersistentSet();
1894 trashMessageSelected( ref );
1902 void KMMainWidget::toggleMessageSetTag(
const QList<Akonadi::Item> &select,
const Akonadi::Tag &tag )
1914 if ( selectedMessages.
isEmpty() )
1920 const Akonadi::Tag::List lst = dlg.selectedTag();
1931 if ( selectedMessages.
isEmpty() )
1933 toggleMessageSetTag( selectedMessages, tag );
1938 mAkonadiStandardActionManager->setItemSelectionModel( mMessagePane->currentItemSelectionModel() );
1939 slotMessageSelected(mMessagePane->currentItem());
1948 const Akonadi::MessageStatus &status,
1955 void KMMainWidget::setCurrentThreadStatus(
const Akonadi::MessageStatus &status,
bool toggle )
1960 setMessageSetStatus( select, status, toggle );
1965 setCurrentThreadStatus( MessageStatus::statusRead(),
true );
1970 setCurrentThreadStatus( MessageStatus::statusImportant(),
true );
1975 setCurrentThreadStatus( MessageStatus::statusRead(),
false );
1980 setCurrentThreadStatus( MessageStatus::statusToAct(),
true );
1985 setCurrentThreadStatus( MessageStatus::statusWatched(),
true );
1986 if ( mWatchThreadAction->isChecked() )
1987 mIgnoreThreadAction->setChecked(
false);
1992 setCurrentThreadStatus( MessageStatus::statusIgnored(),
true );
1993 if ( mIgnoreThreadAction->isChecked() )
1994 mWatchThreadAction->setChecked(
false);
2001 if ( selectedMessages.
isEmpty() )
2012 const Akonadi::Item msg = mMessagePane->currentItem();
2013 if ( !msg.isValid() )
2018 kDebug() <<
"Reply with template:" << tmpl;
2022 MessageComposer::ReplySmart,
2032 const Akonadi::Item msg = mMessagePane->currentItem();
2033 if ( !msg.isValid() )
2038 kDebug() <<
"Reply to All with template:" << tmpl;
2042 MessageComposer::ReplyAll,
2055 if ( !mCurrentFolder ) {
2060 if ( selectedMessages.
isEmpty() )
2063 kDebug() <<
"Forward with template:" << tmpl;
2065 this, selectedMessages, mCurrentFolder->identity(), tmpl
2072 void KMMainWidget::openFilterDialog(
const QByteArray &field,
const QString &value)
2074 FilterIf->openFilterDialog(
false );
2075 FilterIf->createFilter( field, value );
2081 const KMime::Message::Ptr msg = mMessagePane->currentMessage();
2085 openFilterDialog(
"Subject", msg->subject()->asUnicodeString());
2091 KMime::Message::Ptr msg = mMessagePane->currentMessage();
2095 AddrSpecList al = MessageHelper::extractAddrSpecs( msg,
"From" );
2097 openFilterDialog(
"From", msg->from()->asUnicodeString());
2099 openFilterDialog(
"From", al.front().asString());
2105 KMime::Message::Ptr msg = mMessagePane->currentMessage();
2108 openFilterDialog(
"To", msg->to()->asUnicodeString());
2115 updateMessageActions();
2124 dialog->setCaption( i18n(
"Jump to Folder") );
2125 if ( dialog->exec() && dialog ) {
2126 Akonadi::Collection collection = dialog->selectedCollection();
2127 if ( collection.isValid() ) {
2128 slotSelectCollectionFolder( collection );
2135 if ( mFolderTreeWidget ) {
2136 mFolderTreeWidget->selectCollectionFolder( col );
2137 slotFolderChanged( col );
2144 if ( selectedMessages.
isEmpty() )
2146 applyFilters( selectedMessages );
2151 if ( mCurrentFolder && mCurrentFolder->collection().isValid() ) {
2152 Akonadi::ItemFetchJob *job =
new Akonadi::ItemFetchJob( mCurrentFolder->collection(), this );
2153 connect( job, SIGNAL(result(
KJob*)),
this, SLOT(slotFetchItemsForFolderDone(
KJob*)) );
2157 void KMMainWidget::slotFetchItemsForFolderDone(
KJob*job)
2159 Akonadi::ItemFetchJob *fjob =
dynamic_cast<Akonadi::ItemFetchJob*
>( job );
2161 Akonadi::Item::List items = fjob->items();
2162 applyFilters( items );
2167 #ifndef QT_NO_CURSOR
2168 MessageViewer::KCursorSaver busy( MessageViewer::KBusyPtr::busy() );
2171 MailCommon::FilterManager::instance()->filter( selectedMessages );
2177 updateVacationScriptStatus(
false );
2181 mVacationManager->checkVacation();
2182 connect(mVacationManager, SIGNAL(updateVacationScriptStatus(
bool,
QString)), SLOT(updateVacationScriptStatus(
bool,
QString)) );
2183 connect(mVacationManager, SIGNAL(editVacation()), SLOT(slotEditVacation()) );
2188 if ( !
kmkernel->askToGoOnline() ) {
2192 mVacationManager->slotEditVacation(serverName);
2198 #if !defined(NDEBUG)
2199 if ( mSieveDebugDialog )
2202 mSieveDebugDialog =
new KSieveUi::SieveDebugDialog(
this );
2203 mSieveDebugDialog->exec();
2204 delete mSieveDebugDialog;
2212 mMsgActions->setupForwardActions();
2213 mMsgActions->setupForwardingActionsList( mGUIClient );
2220 if ( selectedMessages.
isEmpty() )
2223 saveCommand->
start();
2231 openCommand->
start();
2238 if ( selectedMessages.
isEmpty() )
2244 if ( mMsgView && selectedMessages.
size() == 1 &&
2245 mMsgView->message().hasPayload<KMime::Message::Ptr>() &&
2246 selectedMessages.
first().id() == mMsgView->message().id() ) {
2247 Akonadi::Item dummyItem;
2248 dummyItem.setPayload<KMime::Message::Ptr>( mMsgView->message().payload<KMime::Message::Ptr>() );
2254 saveCommand->
start();
2266 slotCheckVacation();
2272 if ( !mAkonadiStandardActionManager ) {
2275 KAction * action = mAkonadiStandardActionManager->action( Akonadi::StandardActionManager::ToggleWorkOffline );
2277 action->setText( i18n(
"Work Offline") );
2280 action->setText( i18n(
"Work Online") );
2290 kmkernel->msgSender()->sendQueued();
2299 kmkernel->msgSender()->sendQueued( transport->id() );
2307 if ( mReaderWindowActive ) {
2308 mMsgView->displayBusyPage();
2314 if ( !mReaderWindowActive )
return;
2316 mMsgView->displayOfflinePage();
2321 if ( !mReaderWindowActive )
return;
2323 mMsgView->displayResourceOfflinePage();
2331 Akonadi::Item oldMsg = mMessagePane->currentItem();
2332 if ( oldMsg.isValid() ) {
2334 kDebug() <<
"Old message found";
2335 if ( oldMsg->hasUnencryptedMsg() ) {
2336 kDebug() <<
"Extra unencrypted message found";
2337 KMime::Message* newMsg = oldMsg->unencryptedMsg();
2340 QString msgId( oldMsg->msgId() );
2341 QString prefix(
"DecryptedMsg.");
2342 int oldIdx = msgId.indexOf(prefix, 0, Qt::CaseInsensitive);
2343 if ( -1 == oldIdx ) {
2344 int leftAngle = msgId.lastIndexOf(
'<' );
2345 msgId = msgId.insert( (-1 == leftAngle) ? 0 : ++leftAngle, prefix );
2350 QCharRef c = msgId[ oldIdx+2 ];
2356 newMsg->setMsgId( msgId );
2357 mMsgView->setIdOfLastViewedMessage( msgId );
2360 kDebug() <<
"Adding unencrypted message to folder";
2361 mFolder->addMsg( newMsg );
2364 int newMsgIdx = mFolder->find( newMsg );
2365 Q_ASSERT( newMsgIdx != -1 );
2367 mFolder->unGetMsg( newMsgIdx );
2368 int idx = mFolder->find( oldMsg );
2369 Q_ASSERT( idx != -1 );
2374 mHeaders->setCurrentItemByIndex( newMsgIdx );
2378 kDebug() <<
"Deleting encrypted message";
2379 mFolder->take( idx );
2382 kDebug() <<
"Updating message actions";
2383 updateMessageActions();
2385 kDebug() <<
"Done.";
2387 kDebug() <<
"NO EXTRA UNENCRYPTED MESSAGE FOUND";
2389 kDebug() <<
"AKONADI PORT: Disabled code in " << Q_FUNC_INFO;
2392 kDebug() <<
"PANIC: NO OLD MESSAGE FOUND";
2397 mMessagePane->focusNextMessageItem(MessageList::Core::MessageTypeAny,
true,
false );
2402 mMessagePane->focusPreviousMessageItem( MessageList::Core::MessageTypeAny,
true,
false );
2407 mMessagePane->selectFirstMessageItem( MessageList::Core::MessageTypeAny,
true );
2412 mMessagePane->selectLastMessageItem( MessageList::Core::MessageTypeAny,
true );
2417 mMessagePane->selectFocusedMessageItem(
true );
2422 mMessagePane->selectNextMessageItem( MessageList::Core::MessageTypeAny,
2423 MessageList::Core::ClearExistingSelection,
2429 mMessagePane->selectNextMessageItem(
2430 MessageList::Core::MessageTypeAny,
2431 MessageList::Core::GrowOrShrinkExistingSelection,
2448 if ( !mMessagePane->selectNextMessageItem(
2449 MessageList::Core::MessageTypeUnreadOnly,
2450 MessageList::Core::ClearExistingSelection,
2458 GlobalSettings::EnumLoopOnGotoUnread::LoopInAllFolders ) ||
2460 GlobalSettings::EnumLoopOnGotoUnread::LoopInAllMarkedFolders ) )
2462 mGoToFirstUnreadMessageInSelectedFolder =
true;
2463 mFolderTreeWidget->folderTreeView()->selectNextUnreadFolder(
true );
2464 mGoToFirstUnreadMessageInSelectedFolder =
false;
2471 mMessagePane->selectPreviousMessageItem( MessageList::Core::MessageTypeAny,
2472 MessageList::Core::ClearExistingSelection,
2478 mMessagePane->selectPreviousMessageItem(
2479 MessageList::Core::MessageTypeAny,
2480 MessageList::Core::GrowOrShrinkExistingSelection,
2488 if ( !mMessagePane->selectPreviousMessageItem(
2489 MessageList::Core::MessageTypeUnreadOnly,
2490 MessageList::Core::ClearExistingSelection,
2492 GlobalSettings::self()->loopOnGotoUnread() == GlobalSettings::EnumLoopOnGotoUnread::LoopInCurrentFolder
2497 GlobalSettings::EnumLoopOnGotoUnread::LoopInAllFolders ) ||
2499 GlobalSettings::EnumLoopOnGotoUnread::LoopInAllMarkedFolders ) )
2501 mGoToFirstUnreadMessageInSelectedFolder =
true;
2502 mFolderTreeWidget->folderTreeView()->selectPrevUnreadFolder();
2503 mGoToFirstUnreadMessageInSelectedFolder =
false;
2510 if ( mMessagePane->currentItem().isValid() && !mMessagePane->searchEditHasFocus() )
2511 slotMessageActivated( mMessagePane->currentItem() );
2517 if ( !mCurrentFolder || !msg.isValid() )
2520 if ( CommonKernel->folderIsDraftOrOutbox( mCurrentFolder->collection() ) )
2522 mMsgActions->setCurrentMessage( msg );
2523 mMsgActions->editCurrentMessage();
2527 if ( CommonKernel->folderIsTemplates( mCurrentFolder->collection() ) ) {
2534 connect(cmd, SIGNAL(completed(
KMCommand*)),
2535 this, SLOT(slotItemsFetchedForActivation(
KMCommand*)));
2543 kDebug() <<
"Result:" << result;
2548 const Item msg = fetchCmd->
item();
2551 const bool useFixedFont = mMsgView ? mMsgView->isFixedFont() :
2552 MessageViewer::GlobalSettings::self()->useFixedFont();
2556 const Akonadi::Collection parentCollection = MailCommon::Util::parentCollectionFromItem(msg);
2557 win->
showMessage( overrideEncoding(), msg, parentCollection );
2563 if ( !item.isValid() )
2566 if ( clear.toQInt32() != Akonadi::MessageStatus().toQInt32() )
2572 if ( set.toQInt32() != Akonadi::MessageStatus().toQInt32() )
2582 mMessagePane->selectAll();
2583 updateMessageActions();
2588 updateMessageMenu();
2590 const QString email = KPIMUtils::firstEmailAddress( aUrl.path() ).toLower();
2592 Akonadi::ContactSearchJob *job =
new Akonadi::ContactSearchJob(
this );
2594 job->setQuery( Akonadi::ContactSearchJob::Email, email, Akonadi::ContactSearchJob::ExactMatch );
2596 job->setProperty(
"point", aPoint );
2597 job->setProperty(
"imageUrl", imageUrl );
2598 job->setProperty(
"url", aUrl );
2599 connect( job, SIGNAL(result(
KJob*)), SLOT(slotContactSearchJobForMessagePopupDone(
KJob*)) );
2601 showMessagePopup(msg, aUrl, imageUrl, aPoint,
false,
false);
2607 const Akonadi::ContactSearchJob *searchJob = qobject_cast<Akonadi::ContactSearchJob*>( job );
2608 const bool contactAlreadyExists = !searchJob->contacts().isEmpty();
2611 const bool uniqueContactFound = (listContact.
count() == 1);
2612 if (uniqueContactFound) {
2613 mMsgView->setContactItem(listContact.
first(), searchJob->contacts().at(0));
2615 mMsgView->clearContactItem();
2617 const Akonadi::Item msg = job->property(
"msg" ).value<Akonadi::Item>();
2618 const QPoint aPoint = job->property(
"point" ).toPoint();
2619 const KUrl imageUrl = job->property(
"imageUrl").value<KUrl>();
2620 const KUrl url = job->property(
"url" ).value<KUrl>();
2622 showMessagePopup(msg, url, imageUrl, aPoint, contactAlreadyExists, uniqueContactFound);
2625 void KMMainWidget::showMessagePopup(
const Akonadi::Item&msg ,
const KUrl&url,
const KUrl &imageUrl,
const QPoint& aPoint,
bool contactAlreadyExists,
bool uniqueContactFound)
2627 KMenu *menu =
new KMenu;
2629 bool urlMenuAdded =
false;
2631 if ( !url.isEmpty() ) {
2634 menu->addAction( mMsgView->mailToComposeAction() );
2635 menu->addAction( mMsgView->mailToReplyAction() );
2636 menu->addAction( mMsgView->mailToForwardAction() );
2638 menu->addSeparator();
2640 if ( contactAlreadyExists ) {
2641 if (uniqueContactFound) {
2642 menu->addAction( mMsgView->editContactAction() );
2644 menu->addAction( mMsgView->openAddrBookAction() );
2647 menu->addAction( mMsgView->addAddrBookAction() );
2648 menu->addAction( mMsgView->addToExistingContactAction() );
2650 menu->addSeparator();
2651 menu->addMenu(mMsgView->viewHtmlOption());
2652 menu->addSeparator();
2653 menu->addAction( mMsgView->copyURLAction() );
2654 urlMenuAdded =
true;
2655 }
else if ( url.protocol() !=
QLatin1String(
"attachment" ) ) {
2657 menu->addAction( mMsgView->urlOpenAction() );
2658 menu->addAction( mMsgView->addBookmarksAction() );
2659 menu->addAction( mMsgView->urlSaveAsAction() );
2660 menu->addAction( mMsgView->copyURLAction() );
2661 if (mMsgView->isAShortUrl(url)) {
2662 menu->addSeparator();
2663 menu->addAction( mMsgView->expandShortUrlAction() );
2665 if (!imageUrl.isEmpty()) {
2666 menu->addSeparator();
2667 menu->addAction( mMsgView->copyImageLocation());
2668 menu->addAction( mMsgView->downloadImageToDiskAction());
2669 menu->addAction( mMsgView->shareImage());
2670 if (mMsgView->adblockEnabled()) {
2671 menu->addSeparator();
2672 menu->addAction( mMsgView->blockImage());
2675 urlMenuAdded =
true;
2677 kDebug() <<
"URL is:" << url;
2679 const QString selectedText = mMsgView ? mMsgView->copyText() :
QString();
2680 if ( mMsgView && !selectedText.
isEmpty() ) {
2681 if ( urlMenuAdded ) {
2682 menu->addSeparator();
2684 menu->addAction( mMsgActions->replyMenu() );
2685 menu->addSeparator();
2687 menu->addAction( mMsgView->copyAction() );
2688 menu->addAction( mMsgView->selectAllAction() );
2689 menu->addSeparator();
2690 mMsgActions->addWebShortcutsMenu(menu,selectedText);
2691 menu->addSeparator();
2692 menu->addAction(mMsgView->translateAction());
2693 menu->addSeparator();
2694 menu->addAction( mMsgView->speakTextAction());
2695 }
else if ( !urlMenuAdded ) {
2697 if (!mMessagePane->currentMessage()) {
2702 Akonadi::Collection parentCol = msg.parentCollection();
2703 if ( parentCol.isValid() && CommonKernel->folderIsTemplates( parentCol) ) {
2704 menu->addAction( mUseAction );
2706 menu->addAction( mMsgActions->replyMenu() );
2707 menu->addAction( mMsgActions->forwardMenu() );
2709 if ( parentCol.isValid() && CommonKernel->folderIsSentMailFolder( parentCol ) ) {
2710 menu->addAction( sendAgainAction() );
2712 menu->addAction( editAction() );
2714 menu->addAction( mailingListActionMenu() );
2715 menu->addSeparator();
2717 menu->addAction( mCopyActionMenu );
2718 menu->addAction( mMoveActionMenu );
2720 menu->addSeparator();
2722 menu->addAction( mMsgActions->messageStatusMenu() );
2723 menu->addSeparator();
2725 if (!imageUrl.isEmpty()) {
2726 menu->addSeparator();
2727 menu->addAction( mMsgView->copyImageLocation());
2728 menu->addAction( mMsgView->downloadImageToDiskAction());
2729 menu->addAction( mMsgView->shareImage());
2730 menu->addSeparator();
2731 if (mMsgView->adblockEnabled()) {
2732 menu->addAction( mMsgView->blockImage() );
2733 menu->addSeparator();
2736 menu->addAction( mMsgView->viewSourceAction() );
2737 menu->addAction( mMsgView->toggleFixFontAction() );
2738 menu->addAction( mMsgView->toggleMimePartTreeAction() );
2740 menu->addSeparator();
2741 if (mMsgActions->printPreviewAction())
2742 menu->addAction( mMsgActions->printPreviewAction() );
2743 menu->addAction( mMsgActions->printAction() );
2744 menu->addAction( mSaveAsAction );
2745 menu->addAction( mSaveAttachmentsAction );
2746 menu->addSeparator();
2747 if ( parentCol.isValid() && CommonKernel->folderIsTrash(parentCol) ) {
2748 menu->addAction( mDeleteAction );
2750 menu->addAction( akonadiStandardAction( Akonadi::StandardMailActionManager::MoveToTrash ) );
2752 menu->addSeparator();
2753 menu->addAction( mMsgView->createTodoAction() );
2754 menu->addAction( mMsgView->createEventAction() );
2755 menu->addSeparator();
2757 menu->addAction( mMsgView->saveMessageDisplayFormatAction() );
2758 menu->addAction( mMsgView->resetMessageDisplayFormatAction() );
2759 menu->addSeparator();
2761 menu->addAction( mMsgActions->annotateAction() );
2762 if (mMsgView && mMsgView->adblockEnabled()) {
2763 menu->addSeparator();
2764 menu->addAction( mMsgView->openBlockableItems());
2766 menu->addSeparator();
2767 menu->addAction( mMsgActions->addFollowupReminderAction() );
2768 if (
kmkernel->allowToDebugBalooSupport()) {
2769 menu->addSeparator();
2770 menu->addAction( mMsgActions->debugBalooAction() );
2773 KAcceleratorManager::manage(menu);
2774 menu->exec( aPoint, 0 );
2782 mMsgActions->setMessageView( mMsgView );
2785 mSaveAsAction =
new KAction(KIcon(
QLatin1String(
"document-save")), i18n(
"Save &As..."),
this);
2786 actionCollection()->addAction(
QLatin1String(
"file_save_as"), mSaveAsAction );
2787 connect(mSaveAsAction, SIGNAL(triggered(
bool)), SLOT(slotSaveMsg()));
2788 mSaveAsAction->setShortcut(KStandardShortcut::save());
2790 mOpenAction = KStandardAction::open(
this, SLOT(slotOpenMsg()),
2791 actionCollection() );
2793 mOpenRecentAction = KStandardAction::openRecent(
this, SLOT(slotOpenRecentMsg(KUrl)),
2794 actionCollection() );
2795 KConfigGroup grp = mConfig->group(
QLatin1String(
"Recent Files"));
2796 mOpenRecentAction->loadEntries(grp);
2799 KAction *action =
new KAction(i18n(
"&Expire All Folders"),
this);
2800 actionCollection()->addAction(
QLatin1String(
"expire_all_folders"), action );
2801 connect(action, SIGNAL(triggered(
bool)), SLOT(slotExpireAll()));
2804 KAction *action =
new KAction(KIcon(
QLatin1String(
"mail-receive")), i18n(
"Check &Mail"),
this);
2805 actionCollection()->addAction(
QLatin1String(
"check_mail"), action );
2806 connect(action, SIGNAL(triggered(
bool)), SLOT(slotCheckMail()));
2811 actActionMenu->setIcon(KIcon(
QLatin1String(
"mail-receive")));
2812 actActionMenu->setText(i18n(
"Check Mail In"));
2813 actActionMenu->setIconText( i18n(
"Check Mail") );
2814 actActionMenu->setToolTip( i18n(
"Check Mail") );
2816 actionCollection()->addAction(
QLatin1String(
"check_mail_in"), actActionMenu );
2817 connect(actActionMenu, SIGNAL(triggered(
bool)),
this, SLOT(slotCheckMail()));
2819 mSendQueued =
new KAction(KIcon(
QLatin1String(
"mail-send")), i18n(
"&Send Queued Messages"),
this);
2820 actionCollection()->addAction(
QLatin1String(
"send_queued"), mSendQueued );
2821 connect(mSendQueued, SIGNAL(triggered(
bool)), SLOT(slotSendQueued()));
2824 KAction * action = mAkonadiStandardActionManager->action( Akonadi::StandardActionManager::ToggleWorkOffline );
2825 mAkonadiStandardActionManager->interceptAction( Akonadi::StandardActionManager::ToggleWorkOffline );
2826 action->setCheckable(
false);
2827 connect( action, SIGNAL(triggered(
bool)),
this, SLOT(slotOnlineStatus()) );
2828 action->setText( i18n(
"Online status (unknown)") );
2832 mSendActionMenu->setIcon(KIcon(
QLatin1String(
"mail-send-via")));
2833 mSendActionMenu->setText(i18n(
"Send Queued Messages Via"));
2834 actionCollection()->addAction(
QLatin1String(
"send_queued_via"), mSendActionMenu );
2836 connect(mSendActionMenu, SIGNAL(transportSelected(MailTransport::Transport*)), SLOT(slotSendQueuedVia(MailTransport::Transport*)));
2839 if (parent()->inherits(
"KMMainWin")) {
2840 KAction *action =
new KAction(KIcon(
QLatin1String(
"x-office-address-book")), i18n(
"&Address Book"),
this);
2841 actionCollection()->addAction(
QLatin1String(
"addressbook"), action );
2842 connect(action, SIGNAL(triggered(
bool)), mLaunchExternalComponent, SLOT(slotAddrBook()));
2843 if (KStandardDirs::findExe(
QLatin1String(
"kaddressbook")).isEmpty())
2844 action->setEnabled(
false);
2848 KAction *action =
new KAction(KIcon(
QLatin1String(
"pgp-keys")), i18n(
"Certificate Manager"),
this);
2849 actionCollection()->addAction(
QLatin1String(
"tools_start_certman"), action );
2850 connect(action, SIGNAL(triggered(
bool)), mLaunchExternalComponent, SLOT(slotStartCertManager()));
2852 if (KStandardDirs::findExe(
QLatin1String(
"kleopatra")).isEmpty())
2853 action->setEnabled(
false);
2856 KAction *action =
new KAction(KIcon(
QLatin1String(
"pgp-keys")), i18n(
"GnuPG Log Viewer"),
this);
2857 actionCollection()->addAction(
QLatin1String(
"tools_start_kwatchgnupg"), action );
2858 connect(action, SIGNAL(triggered(
bool)), mLaunchExternalComponent, SLOT(slotStartWatchGnuPG()));
2861 const bool usableKWatchGnupg =
false;
2864 bool usableKWatchGnupg = !KStandardDirs::findExe(
QLatin1String(
"kwatchgnupg")).isEmpty();
2866 action->setEnabled(usableKWatchGnupg);
2869 KAction *action =
new KAction(KIcon(
QLatin1String(
"document-import")), i18n(
"&Import Messages..."),
this);
2870 actionCollection()->addAction(
QLatin1String(
"import"), action );
2871 connect(action, SIGNAL(triggered(
bool)), mLaunchExternalComponent, SLOT(slotImport()));
2872 if (KStandardDirs::findExe(
QLatin1String(
"kmailcvt")).isEmpty()) action->setEnabled(
false);
2875 #if !defined(NDEBUG)
2877 KAction *action =
new KAction(i18n(
"&Debug Sieve..."),
this);
2878 actionCollection()->addAction(
QLatin1String(
"tools_debug_sieve"), action );
2879 connect(action, SIGNAL(triggered(
bool)), SLOT(slotDebugSieve()));
2884 KAction *action =
new KAction(i18n(
"Filter &Log Viewer..."),
this);
2885 actionCollection()->addAction(
QLatin1String(
"filter_log_viewer"), action );
2886 connect(action, SIGNAL(triggered(
bool)), mLaunchExternalComponent, SLOT(slotFilterLogViewer()));
2889 KAction *action =
new KAction(i18n(
"&Anti-Spam Wizard..."),
this);
2890 actionCollection()->addAction(
QLatin1String(
"antiSpamWizard"), action );
2891 connect(action, SIGNAL(triggered(
bool)), mLaunchExternalComponent, SLOT(slotAntiSpamWizard()));
2894 KAction *action =
new KAction(i18n(
"&Anti-Virus Wizard..."),
this);
2895 actionCollection()->addAction(
QLatin1String(
"antiVirusWizard"), action );
2896 connect(action, SIGNAL(triggered(
bool)), mLaunchExternalComponent, SLOT(slotAntiVirusWizard()));
2899 KAction *action =
new KAction( i18n(
"&Account Wizard..."),
this );
2900 actionCollection()->addAction(
QLatin1String(
"accountWizard"), action );
2901 connect( action, SIGNAL(triggered(
bool)), mLaunchExternalComponent, SLOT(slotAccountWizard()) );
2904 KAction *action =
new KAction( i18n(
"&Import Wizard..."),
this );
2905 actionCollection()->addAction(
QLatin1String(
"importWizard"), action );
2906 connect( action, SIGNAL(triggered(
bool)), mLaunchExternalComponent, SLOT(slotImportWizard()) );
2908 if ( KSieveUi::Util::allowOutOfOfficeSettings() )
2910 KAction *action =
new KAction( i18n(
"Edit \"Out of Office\" Replies..."),
this );
2911 actionCollection()->addAction(
QLatin1String(
"tools_edit_vacation"), action );
2912 connect( action, SIGNAL(triggered(
bool)), SLOT(slotEditVacation()) );
2916 KAction *action =
new KAction(i18n(
"&Configure Automatic Archiving..."),
this);
2917 actionCollection()->addAction(
QLatin1String(
"tools_automatic_archiving"), action );
2918 connect(action, SIGNAL(triggered(
bool)), mLaunchExternalComponent, SLOT(slotConfigureAutomaticArchiving()));
2922 KAction *action =
new KAction(i18n(
"Delayed Messages..."),
this);
2923 actionCollection()->addAction(
QLatin1String(
"message_delayed"), action );
2924 connect(action, SIGNAL(triggered(
bool)), mLaunchExternalComponent, SLOT(slotConfigureSendLater()));
2928 KAction *action =
new KAction(i18n(
"Followup Reminder Messages..."),
this);
2929 actionCollection()->addAction(
QLatin1String(
"followup_reminder_messages"), action );
2930 connect(action, SIGNAL(triggered(
bool)), mLaunchExternalComponent, SLOT(slotConfigureFollowupReminder()));
2935 KAction*
const standardDelAction = akonadiStandardAction( Akonadi::StandardActionManager::DeleteItems );
2944 mDeleteAction =
new KAction(KIcon(
QLatin1String(
"edit-delete")), i18nc(
"@action Hard delete, bypassing trash",
"&Delete"),
this);
2945 actionCollection()->addAction(
QLatin1String(
"delete"), mDeleteAction );
2946 connect(mDeleteAction, SIGNAL(triggered(
bool)), SLOT(slotDeleteMsg()));
2947 mDeleteAction->setShortcut(
QKeySequence(Qt::SHIFT+Qt::Key_Delete));
2949 mTrashThreadAction =
new KAction(i18n(
"M&ove Thread to Trash"),
this);
2950 actionCollection()->addAction(
QLatin1String(
"move_thread_to_trash"), mTrashThreadAction );
2951 mTrashThreadAction->setShortcut(
QKeySequence(Qt::CTRL+Qt::Key_Delete));
2952 mTrashThreadAction->setIcon(KIcon(
QLatin1String(
"user-trash")));
2953 mTrashThreadAction->setHelpText(i18n(
"Move thread to trashcan") );
2954 connect(mTrashThreadAction, SIGNAL(triggered(
bool)), SLOT(slotTrashThread()));
2956 mDeleteThreadAction =
new KAction(KIcon(
QLatin1String(
"edit-delete")), i18n(
"Delete T&hread"),
this);
2957 actionCollection()->addAction(
QLatin1String(
"delete_thread"), mDeleteThreadAction );
2958 connect(mDeleteThreadAction, SIGNAL(triggered(
bool)), SLOT(slotDeleteThread()));
2959 mDeleteThreadAction->setShortcut(
QKeySequence(Qt::CTRL+Qt::SHIFT+Qt::Key_Delete));
2961 mSearchMessages =
new KAction(KIcon(
QLatin1String(
"edit-find-mail")), i18n(
"&Find Messages..."),
this);
2962 actionCollection()->addAction(
QLatin1String(
"search_messages"), mSearchMessages );
2963 connect(mSearchMessages, SIGNAL(triggered(
bool)), SLOT(slotRequestFullSearchFromQuickSearch()));
2967 KAction *action =
new KAction(i18n(
"Select &All Messages"),
this);
2968 actionCollection()->addAction(
QLatin1String(
"mark_all_messages"), action );
2969 connect(action, SIGNAL(triggered(
bool)), SLOT(slotMarkAll()));
2970 action->setShortcut(
QKeySequence( Qt::CTRL + Qt::Key_A ) );
2975 mFolderMailingListPropertiesAction =
new KAction(i18n(
"&Mailing List Management..."),
this);
2976 actionCollection()->addAction(
QLatin1String(
"folder_mailinglist_properties"), mFolderMailingListPropertiesAction );
2977 connect(mFolderMailingListPropertiesAction, SIGNAL(triggered(
bool)), mManageShowCollectionProperties, SLOT(slotFolderMailingListProperties()));
2980 mShowFolderShortcutDialogAction =
new KAction(KIcon(
QLatin1String(
"configure-shortcuts")), i18n(
"&Assign Shortcut..."),
this);
2981 actionCollection()->addAction(
QLatin1String(
"folder_shortcut_command"), mShowFolderShortcutDialogAction );
2982 connect( mShowFolderShortcutDialogAction, SIGNAL(triggered(
bool)), mManageShowCollectionProperties,
2983 SLOT(slotShowFolderShortcutDialog()) );
2997 mExpireFolderAction =
new KAction(i18n(
"&Expiration Settings"),
this);
2998 actionCollection()->addAction(
QLatin1String(
"expire"), mExpireFolderAction );
2999 connect(mExpireFolderAction, SIGNAL(triggered(
bool)),
this, SLOT(slotExpireFolder()));
3002 mAkonadiStandardActionManager->interceptAction( Akonadi::StandardMailActionManager::MoveToTrash );
3003 connect( mAkonadiStandardActionManager->action( Akonadi::StandardMailActionManager::MoveToTrash ), SIGNAL(triggered(
bool)),
this, SLOT(slotTrashSelectedMessages()) );
3006 mAkonadiStandardActionManager->interceptAction( Akonadi::StandardMailActionManager::MoveAllToTrash );
3007 connect( mAkonadiStandardActionManager->action( Akonadi::StandardMailActionManager::MoveAllToTrash ), SIGNAL(triggered(
bool)),
this, SLOT(slotEmptyFolder()) );
3009 mAkonadiStandardActionManager->interceptAction( Akonadi::StandardActionManager::DeleteCollections );
3010 connect( mAkonadiStandardActionManager->action( Akonadi::StandardActionManager::DeleteCollections ), SIGNAL(triggered(
bool)),
this, SLOT(slotRemoveFolder()) );
3015 mArchiveFolderAction =
new KAction( i18n(
"&Archive Folder..." ),
this );
3016 actionCollection()->addAction(
QLatin1String(
"archive_folder"), mArchiveFolderAction );
3017 connect( mArchiveFolderAction, SIGNAL(triggered(
bool)), SLOT(slotArchiveFolder()) );
3020 connect(mDisplayMessageFormatMenu, SIGNAL(changeDisplayMessageFormat(MessageViewer::Viewer::DisplayFormatMessage)),
this, SLOT(slotChangeDisplayMessageFormat(MessageViewer::Viewer::DisplayFormatMessage)));
3021 actionCollection()->addAction(
QLatin1String(
"display_format_message"), mDisplayMessageFormatMenu );
3024 mPreferHtmlLoadExtAction =
new KToggleAction(i18n(
"Load E&xternal References"),
this);
3025 actionCollection()->addAction(
QLatin1String(
"prefer_html_external_refs"), mPreferHtmlLoadExtAction );
3026 connect(mPreferHtmlLoadExtAction, SIGNAL(triggered(
bool)), SLOT(slotOverrideHtmlLoadExt()));
3029 KAction *action = mAkonadiStandardActionManager->action( Akonadi::StandardActionManager::CopyCollections);
3030 action->setShortcut(
QKeySequence(Qt::SHIFT+Qt::CTRL+Qt::Key_C));
3033 KAction *action = mAkonadiStandardActionManager->action( Akonadi::StandardActionManager::Paste);
3034 action->setShortcut(
QKeySequence(Qt::SHIFT+Qt::CTRL+Qt::Key_V));
3037 KAction *action = mAkonadiStandardActionManager->action( Akonadi::StandardActionManager::CopyItems);
3038 action->setShortcut(
QKeySequence(Qt::ALT+Qt::CTRL+Qt::Key_C));
3041 KAction *action = mAkonadiStandardActionManager->action( Akonadi::StandardActionManager::CutItems );
3042 action->setShortcut(
QKeySequence(Qt::ALT+Qt::CTRL+Qt::Key_X));
3046 KAction *action = mAkonadiStandardActionManager->action( Akonadi::StandardActionManager::CopyItemToMenu );
3047 action->setText(i18n(
"Copy Message To...") );
3048 action = mAkonadiStandardActionManager->action( Akonadi::StandardActionManager::MoveItemToMenu );
3049 action->setText(i18n(
"Move Message To...") );
3054 KAction *action =
new KAction(KIcon(
QLatin1String(
"mail-message-new")), i18n(
"&New Message..."),
this);
3055 actionCollection()->addAction(
QLatin1String(
"new_message"), action );
3056 action->setIconText( i18nc(
"@action:intoolbar New Empty Message",
"New" ) );
3057 connect(action, SIGNAL(triggered(
bool)), SLOT(slotCompose()));
3059 if ( !
kmkernel->xmlGuiInstance().isValid() ) {
3060 action->setShortcut(KStandardShortcut::openNew());
3065 actionCollection() );
3066 mTemplateMenu->setDelayed(
true );
3067 actionCollection()->addAction(
QLatin1String(
"new_from_template"), mTemplateMenu );
3068 connect( mTemplateMenu->menu(), SIGNAL(aboutToShow()),
this,
3069 SLOT(slotShowNewFromTemplate()) );
3070 connect( mTemplateMenu->menu(), SIGNAL(triggered(
QAction*)),
this,
3071 SLOT(slotNewFromTemplate(
QAction*)) );
3073 mMessageNewList =
new KAction( KIcon(
QLatin1String(
"mail-message-new-list") ),
3074 i18n(
"New Message t&o Mailing-List..." ),
3076 actionCollection()->addAction(
QLatin1String(
"post_message"), mMessageNewList);
3077 connect( mMessageNewList, SIGNAL(triggered(
bool)),
3078 SLOT(slotPostToML()) );
3079 mMessageNewList->setShortcut(
QKeySequence( Qt::CTRL + Qt::SHIFT + Qt::Key_N ) );
3081 mSendAgainAction =
new KAction(i18n(
"Send A&gain..."),
this);
3082 actionCollection()->addAction(
QLatin1String(
"send_again"), mSendAgainAction );
3083 connect(mSendAgainAction, SIGNAL(triggered(
bool)), SLOT(slotResendMsg()));
3087 actionCollection()->addAction(
QLatin1String(
"create_filter"), mFilterMenu );
3088 connect( mFilterMenu, SIGNAL(triggered(
bool)),
this,
3089 SLOT(slotFilter()) );
3091 KAction *action =
new KAction(i18n(
"Filter on &Subject..."),
this);
3092 actionCollection()->addAction(
QLatin1String(
"subject_filter"), action );
3093 connect(action, SIGNAL(triggered(
bool)), SLOT(slotSubjectFilter()));
3094 mFilterMenu->addAction( action );
3098 KAction *action =
new KAction(i18n(
"Filter on &From..."),
this);
3099 actionCollection()->addAction(
QLatin1String(
"from_filter"), action );
3100 connect(action, SIGNAL(triggered(
bool)), SLOT(slotFromFilter()));
3101 mFilterMenu->addAction( action );
3104 KAction *action =
new KAction(i18n(
"Filter on &To..."),
this);
3105 actionCollection()->addAction(
QLatin1String(
"to_filter"), action );
3106 connect(action, SIGNAL(triggered(
bool)), SLOT(slotToFilter()));
3107 mFilterMenu->addAction( action );
3109 mFilterMenu->addAction( mMsgActions->listFilterAction() );
3111 mUseAction =
new KAction( KIcon(
QLatin1String(
"document-new")), i18n(
"New Message From &Template"),
this );
3112 actionCollection()->addAction(
QLatin1String(
"use_template"), mUseAction);
3113 connect(mUseAction, SIGNAL(triggered(
bool)), SLOT(slotUseTemplate()));
3114 mUseAction->setShortcut(
QKeySequence(Qt::SHIFT + Qt::Key_N));
3117 mThreadStatusMenu =
new KActionMenu(i18n(
"Mark &Thread"),
this);
3118 actionCollection()->addAction(
QLatin1String(
"thread_status"), mThreadStatusMenu );
3120 mMarkThreadAsReadAction =
new KAction(KIcon(
QLatin1String(
"mail-mark-read")), i18n(
"Mark Thread as &Read"),
this);
3121 actionCollection()->addAction(
QLatin1String(
"thread_read"), mMarkThreadAsReadAction );
3122 connect(mMarkThreadAsReadAction, SIGNAL(triggered(
bool)), SLOT(slotSetThreadStatusRead()));
3123 mMarkThreadAsReadAction->setHelpText(i18n(
"Mark all messages in the selected thread as read"));
3124 mThreadStatusMenu->addAction( mMarkThreadAsReadAction );
3126 mMarkThreadAsUnreadAction =
new KAction(KIcon(
QLatin1String(
"mail-mark-unread")), i18n(
"Mark Thread as &Unread"),
this);
3127 actionCollection()->addAction(
QLatin1String(
"thread_unread"), mMarkThreadAsUnreadAction );
3128 connect(mMarkThreadAsUnreadAction, SIGNAL(triggered(
bool)), SLOT(slotSetThreadStatusUnread()));
3129 mMarkThreadAsUnreadAction->setHelpText(i18n(
"Mark all messages in the selected thread as unread"));
3130 mThreadStatusMenu->addAction( mMarkThreadAsUnreadAction );
3132 mThreadStatusMenu->addSeparator();
3135 mToggleThreadImportantAction =
new KToggleAction(KIcon(
QLatin1String(
"mail-mark-important")), i18n(
"Mark Thread as &Important"),
this);
3136 actionCollection()->addAction(
QLatin1String(
"thread_flag"), mToggleThreadImportantAction );
3137 connect(mToggleThreadImportantAction, SIGNAL(triggered(
bool)), SLOT(slotSetThreadStatusImportant()));
3138 mToggleThreadImportantAction->setCheckedState( KGuiItem(i18n(
"Remove &Important Thread Mark")) );
3139 mThreadStatusMenu->addAction( mToggleThreadImportantAction );
3141 mToggleThreadToActAction =
new KToggleAction(KIcon(
QLatin1String(
"mail-mark-task")), i18n(
"Mark Thread as &Action Item"),
this);
3142 actionCollection()->addAction(
QLatin1String(
"thread_toact"), mToggleThreadToActAction );
3143 connect(mToggleThreadToActAction, SIGNAL(triggered(
bool)), SLOT(slotSetThreadStatusToAct()));
3144 mToggleThreadToActAction->setCheckedState( KGuiItem(i18n(
"Remove &Action Item Thread Mark")) );
3145 mThreadStatusMenu->addAction( mToggleThreadToActAction );
3148 mWatchThreadAction =
new KToggleAction(KIcon(
QLatin1String(
"mail-thread-watch")), i18n(
"&Watch Thread"),
this);
3149 actionCollection()->addAction(
QLatin1String(
"thread_watched"), mWatchThreadAction );
3150 connect(mWatchThreadAction, SIGNAL(triggered(
bool)), SLOT(slotSetThreadStatusWatched()));
3152 mIgnoreThreadAction =
new KToggleAction(KIcon(
QLatin1String(
"mail-thread-ignored")), i18n(
"&Ignore Thread"),
this);
3153 actionCollection()->addAction(
QLatin1String(
"thread_ignored"), mIgnoreThreadAction );
3154 connect(mIgnoreThreadAction, SIGNAL(triggered(
bool)), SLOT(slotSetThreadStatusIgnored()));
3156 mThreadStatusMenu->addSeparator();
3157 mThreadStatusMenu->addAction( mWatchThreadAction );
3158 mThreadStatusMenu->addAction( mIgnoreThreadAction );
3160 mSaveAttachmentsAction =
new KAction(KIcon(
QLatin1String(
"mail-attachment")), i18n(
"Save A&ttachments..."),
this);
3161 actionCollection()->addAction(
QLatin1String(
"file_save_attachments"), mSaveAttachmentsAction );
3162 connect(mSaveAttachmentsAction, SIGNAL(triggered(
bool)), SLOT(slotSaveAttachments()));
3164 mMoveActionMenu = mAkonadiStandardActionManager->action( Akonadi::StandardActionManager::MoveItemToMenu);
3166 mCopyActionMenu = mAkonadiStandardActionManager->action( Akonadi::StandardActionManager::CopyItemToMenu);
3168 mApplyAllFiltersAction =
3169 new KAction( KIcon(
QLatin1String(
"view-filter") ), i18n(
"Appl&y All Filters" ),
this );
3170 actionCollection()->addAction(
QLatin1String(
"apply_filters"), mApplyAllFiltersAction );
3171 connect( mApplyAllFiltersAction, SIGNAL(triggered(
bool)),
3172 SLOT(slotApplyFilters()) );
3173 mApplyAllFiltersAction->setShortcut(
QKeySequence( Qt::CTRL + Qt::Key_J ) );
3175 mApplyFilterActionsMenu =
new KActionMenu( i18n(
"A&pply Filter" ),
this );
3176 actionCollection()->addAction(
QLatin1String(
"apply_filter_actions"), mApplyFilterActionsMenu );
3179 KAction *action =
new KAction(i18nc(
"View->",
"&Expand Thread / Group"),
this);
3180 actionCollection()->addAction(
QLatin1String(
"expand_thread"), action );
3182 action->setHelpText(i18n(
"Expand the current thread or group"));
3183 connect(action, SIGNAL(triggered(
bool)), SLOT(slotExpandThread()));
3186 KAction *action =
new KAction(i18nc(
"View->",
"&Collapse Thread / Group"),
this);
3187 actionCollection()->addAction(
QLatin1String(
"collapse_thread"), action );
3189 action->setHelpText( i18n(
"Collapse the current thread or group"));
3190 connect(action, SIGNAL(triggered(
bool)), SLOT(slotCollapseThread()));
3193 KAction *action =
new KAction(i18nc(
"View->",
"Ex&pand All Threads"),
this);
3194 actionCollection()->addAction(
QLatin1String(
"expand_all_threads"), action );
3195 action->setShortcut(
QKeySequence(Qt::CTRL+Qt::Key_Period));
3196 action->setHelpText( i18n(
"Expand all threads in the current folder"));
3197 connect(action, SIGNAL(triggered(
bool)), SLOT(slotExpandAllThreads()));
3200 KAction *action =
new KAction(i18nc(
"View->",
"C&ollapse All Threads"),
this);
3201 actionCollection()->addAction(
QLatin1String(
"collapse_all_threads"), action );
3202 action->setShortcut(
QKeySequence(Qt::CTRL+Qt::Key_Comma));
3203 action->setHelpText( i18n(
"Collapse all threads in the current folder"));
3204 connect(action, SIGNAL(triggered(
bool)), SLOT(slotCollapseAllThreads()));
3208 KAction *dukeOfMonmoth =
new KAction(i18n(
"&Display Message"),
this);
3209 actionCollection()->addAction(
QLatin1String(
"display_message"), dukeOfMonmoth );
3210 connect(dukeOfMonmoth, SIGNAL(triggered(
bool)), SLOT(slotDisplayCurrentMessage()));
3211 KShortcut shortcut = KShortcut(
QKeySequence( Qt::Key_Enter ));
3212 shortcut.setAlternate(
QKeySequence( Qt::Key_Return ) );
3213 dukeOfMonmoth->setShortcuts( shortcut );
3217 KAction *action =
new KAction(i18n(
"&Next Message"),
this);
3218 actionCollection()->addAction(
QLatin1String(
"go_next_message"), action );
3219 action->setShortcuts(KShortcut(
QLatin1String(
"N; Right") ));
3220 action->setHelpText(i18n(
"Go to the next message"));
3221 connect(action, SIGNAL(triggered(
bool)), SLOT(slotSelectNextMessage()));
3224 KAction *action =
new KAction(i18n(
"Next &Unread Message"),
this);
3225 actionCollection()->addAction(
QLatin1String(
"go_next_unread_message"), action );
3232 action->setIconText( i18nc(
"@action:inmenu Goto next unread message",
"Next" ) );
3233 action->setHelpText(i18n(
"Go to the next unread message"));
3234 connect(action, SIGNAL(triggered(
bool)), SLOT(slotSelectNextUnreadMessage()));
3237 KAction *action =
new KAction(i18n(
"&Previous Message"),
this);
3238 actionCollection()->addAction(
QLatin1String(
"go_prev_message"), action );
3239 action->setHelpText(i18n(
"Go to the previous message"));
3240 action->setShortcuts(KShortcut(
QLatin1String(
"P; Left") ));
3241 connect(action, SIGNAL(triggered(
bool)), SLOT(slotSelectPreviousMessage()));
3244 KAction *action =
new KAction(i18n(
"Previous Unread &Message"),
this);
3245 actionCollection()->addAction(
QLatin1String(
"go_prev_unread_message"), action );
3252 action->setIconText( i18nc(
"@action:inmenu Goto previous unread message.",
"Previous" ) );
3253 action->setHelpText(i18n(
"Go to the previous unread message"));
3254 connect(action, SIGNAL(triggered(
bool)), SLOT(slotSelectPreviousUnreadMessage()));
3257 KAction *action =
new KAction(i18n(
"Next Unread &Folder"),
this);
3258 actionCollection()->addAction(
QLatin1String(
"go_next_unread_folder"), action );
3259 connect(action, SIGNAL(triggered(
bool)), SLOT(slotNextUnreadFolder()));
3260 action->setShortcut(
QKeySequence(Qt::ALT+Qt::Key_Plus));
3261 action->setHelpText(i18n(
"Go to the next folder with unread messages"));
3264 KAction *action =
new KAction(i18n(
"Previous Unread F&older"),
this);
3265 actionCollection()->addAction(
QLatin1String(
"go_prev_unread_folder"), action );
3266 action->setShortcut(
QKeySequence(Qt::ALT+Qt::Key_Minus));
3267 action->setHelpText(i18n(
"Go to the previous folder with unread messages"));
3268 connect(action, SIGNAL(triggered(
bool)), SLOT(slotPrevUnreadFolder()));
3271 KAction *action =
new KAction(i18nc(
"Go->",
"Next Unread &Text"),
this);
3272 actionCollection()->addAction(
QLatin1String(
"go_next_unread_text"), action );
3274 action->setHelpText(i18n(
"Go to the next unread text"));
3275 action->setWhatsThis( i18n(
"Scroll down current message. "
3276 "If at end of current message, "
3277 "go to next unread message."));
3278 connect(action, SIGNAL(triggered(
bool)), SLOT(slotReadOn()));
3283 KAction *action =
new KAction(i18n(
"Configure &Filters..."),
this);
3284 action->setMenuRole( QAction::NoRole );
3285 actionCollection()->addAction(
QLatin1String(
"filter"), action );
3286 connect(action, SIGNAL(triggered(
bool)), SLOT(slotFilter()));
3289 KAction *action =
new KAction(i18n(
"Manage &Sieve Scripts..."),
this);
3290 actionCollection()->addAction(
QLatin1String(
"sieveFilters"), action );
3291 connect(action, SIGNAL(triggered(
bool)), SLOT(slotManageSieveScripts()));
3294 mShowIntroductionAction =
new KAction(KIcon(
QLatin1String(
"kmail")), i18n(
"KMail &Introduction"),
this);
3295 actionCollection()->addAction(
QLatin1String(
"help_kmail_welcomepage"), mShowIntroductionAction );
3296 mShowIntroductionAction->setHelpText( i18n(
"Display KMail's Welcome Page") );
3297 connect(mShowIntroductionAction, SIGNAL(triggered(
bool)), SLOT(slotIntro()));
3298 mShowIntroductionAction->setEnabled(mMsgView != 0);
3305 KAction *action =
new KAction( KIcon(
QLatin1String(
"preferences-desktop-notification")),
3306 i18n(
"Configure &Notifications..."),
this );
3307 action->setMenuRole( QAction::NoRole );
3308 actionCollection()->addAction(
QLatin1String(
"kmail_configure_notifications"), action );
3309 connect(action, SIGNAL(triggered(
bool)), SLOT(slotEditNotifications()));
3313 KAction *action =
new KAction(KIcon(
QLatin1String(
"configure")), i18n(
"&Configure KMail..."),
this);
3314 action->setMenuRole( QAction::PreferencesRole );
3315 actionCollection()->addAction(
QLatin1String(
"kmail_configure_kmail"), action );
3316 connect(action, SIGNAL(triggered(
bool)),
kmkernel, SLOT(slotShowConfigurationDialog()));
3320 mExpireConfigAction =
new KAction( i18n(
"Expire..." ),
this );
3321 actionCollection()->addAction(
QLatin1String(
"expire_settings"),mExpireConfigAction );
3322 connect( mExpireConfigAction, SIGNAL(triggered(
bool)), mManageShowCollectionProperties, SLOT(slotShowExpiryProperties()) );
3326 KAction *action =
new KAction( KIcon(
QLatin1String(
"bookmark-new" )), i18n(
"Add Favorite Folder..." ),
this );
3327 actionCollection()->addAction(
QLatin1String(
"add_favorite_folder"), action );
3328 connect( action, SIGNAL(triggered(
bool)),
this, SLOT(slotAddFavoriteFolder()) );
3332 mServerSideSubscription =
new KAction( KIcon(
QLatin1String(
"folder-bookmarks") ), i18n(
"Serverside Subscription..." ),
this);
3333 actionCollection()->addAction(
QLatin1String(
"serverside_subscription"), mServerSideSubscription);
3334 connect( mServerSideSubscription, SIGNAL(triggered(
bool)),
this, SLOT(slotServerSideSubscription()) );
3339 mApplyFiltersOnFolder =
new KAction( KIcon(
QLatin1String(
"view-filter") ), i18n(
"Appl&y All Filters On Folder" ),
this );
3340 actionCollection()->addAction(
QLatin1String(
"apply_filters_on_folder"), mApplyFiltersOnFolder );
3341 connect( mApplyFiltersOnFolder, SIGNAL(triggered(
bool)),
3342 SLOT(slotApplyFiltersOnFolder()) );
3347 KAction *action =
new KAction(KIcon(
QLatin1String(
"kmail")), i18n(
"&Export KMail Data..."),
this);
3348 actionCollection()->addAction(
QLatin1String(
"kmail_export_data"), action );
3349 connect(action, SIGNAL(triggered(
bool)), mLaunchExternalComponent, SLOT(slotExportData()));
3353 KAction *action =
new KAction(KIcon(
QLatin1String(
"contact-new" ) ),i18n(
"New AddressBook Contact..."),
this);
3354 actionCollection()->addAction(
QLatin1String(
"kmail_new_addressbook_contact"), action );
3355 connect(action, SIGNAL(triggered(
bool)),
this, SLOT(slotCreateAddressBookContact()));
3360 actionCollection()->addAction(KStandardAction::Undo,
QLatin1String(
"kmail_undo"),
this, SLOT(slotUndo()));
3362 KStandardAction::tipOfDay( mLaunchExternalComponent, SLOT(slotShowTip()), actionCollection() );
3364 menutimer =
new QTimer(
this );
3366 menutimer->setSingleShot(
true );
3367 connect( menutimer, SIGNAL(timeout()), SLOT(updateMessageActionsDelayed()) );
3369 SIGNAL(undoStackChanged()),
this, SLOT(slotUpdateUndo()));
3371 updateMessageActions();
3378 KAction *action =
new KAction( i18n(
"Copy Message to Folder"),
this );
3379 actionCollection()->addAction(
QLatin1String(
"copy_message_to_folder"), action );
3380 connect( action, SIGNAL(triggered(
bool)),
3381 SLOT(slotCopySelectedMessagesToFolder()) );
3385 KAction *action =
new KAction( i18n(
"Jump to Folder..."),
this );
3386 actionCollection()->addAction(
QLatin1String(
"jump_to_folder"), action );
3387 connect( action, SIGNAL(triggered(
bool)),
3388 SLOT(slotJumpToFolder()) );
3392 KAction *action =
new KAction(i18n(
"Abort Current Operation"),
this);
3393 actionCollection()->addAction(
QLatin1String(
"cancel"), action );
3394 connect( action, SIGNAL(triggered(
bool)),
3395 ProgressManager::instance(), SLOT(slotAbortAll()) );
3399 KAction *action =
new KAction(i18n(
"Focus on Next Folder"),
this);
3400 actionCollection()->addAction(
QLatin1String(
"inc_current_folder"), action );
3401 connect( action, SIGNAL(triggered(
bool)),
3402 mFolderTreeWidget->folderTreeView(), SLOT(slotFocusNextFolder()) );
3403 action->setShortcut(
QKeySequence( Qt::CTRL+Qt::Key_Right ) );
3406 KAction *action =
new KAction(i18n(
"Focus on Previous Folder"),
this);
3407 actionCollection()->addAction(
QLatin1String(
"dec_current_folder"), action );
3408 connect( action, SIGNAL(triggered(
bool)),
3409 mFolderTreeWidget->folderTreeView(), SLOT(slotFocusPrevFolder()) );
3410 action->setShortcut(
QKeySequence( Qt::CTRL+Qt::Key_Left ) );
3413 KAction *action =
new KAction(i18n(
"Select Folder with Focus"),
this);
3414 actionCollection()->addAction(
QLatin1String(
"select_current_folder"), action );
3416 connect( action, SIGNAL(triggered(
bool)),
3417 mFolderTreeWidget->folderTreeView(), SLOT(slotSelectFocusFolder()) );
3418 action->setShortcut(
QKeySequence( Qt::CTRL+Qt::Key_Space ) );
3421 KAction *action =
new KAction(i18n(
"Focus on First Folder"),
this);
3422 actionCollection()->addAction(
QLatin1String(
"focus_first_folder"), action );
3423 connect( action, SIGNAL(triggered(
bool)),
3424 mFolderTreeWidget->folderTreeView(), SLOT(slotFocusFirstFolder()) );
3425 action->setShortcut(
QKeySequence( Qt::CTRL + Qt::Key_Home ) );
3428 KAction *action =
new KAction(i18n(
"Focus on Last Folder"),
this);
3429 actionCollection()->addAction(
QLatin1String(
"focus_last_folder"), action );
3430 connect( action, SIGNAL(triggered(
bool)),
3431 mFolderTreeWidget->folderTreeView(), SLOT(slotFocusLastFolder()) );
3432 action->setShortcut(
QKeySequence( Qt::CTRL + Qt::Key_End ) );
3435 KAction *action =
new KAction(i18n(
"Focus on Next Message"),
this);
3436 actionCollection()->addAction(
QLatin1String(
"inc_current_message"), action );
3437 connect( action, SIGNAL(triggered(
bool)),
3438 this, SLOT(slotFocusOnNextMessage()) );
3439 action->setShortcut(
QKeySequence( Qt::ALT+Qt::Key_Right ) );
3442 KAction *action =
new KAction(i18n(
"Focus on Previous Message"),
this);
3443 actionCollection()->addAction(
QLatin1String(
"dec_current_message"), action );
3444 connect( action, SIGNAL(triggered(
bool)),
3445 this, SLOT(slotFocusOnPrevMessage()) );
3446 action->setShortcut(
QKeySequence( Qt::ALT+Qt::Key_Left ) );
3449 KAction *action =
new KAction(i18n(
"Select First Message"),
this);
3450 actionCollection()->addAction(
QLatin1String(
"select_first_message"), action );
3451 connect ( action, SIGNAL(triggered(
bool)),
3452 this, SLOT(slotSelectFirstMessage()) );
3453 action->setShortcut(
QKeySequence( Qt::ALT + Qt::Key_Home ) );
3456 KAction *action =
new KAction(i18n(
"Select Last Message"),
this);
3457 actionCollection()->addAction(
QLatin1String(
"select_last_message"), action );
3458 connect ( action, SIGNAL(triggered(
bool)),
3459 this, SLOT(slotSelectLastMessage()) );
3460 action->setShortcut(
QKeySequence( Qt::ALT + Qt::Key_End ) );
3463 KAction *action =
new KAction(i18n(
"Select Message with Focus"),
this);
3464 actionCollection()->addAction(
QLatin1String(
"select_current_message"), action );
3465 connect( action, SIGNAL(triggered(
bool)),
3466 this, SLOT(slotSelectFocusedMessage()) );
3467 action->setShortcut(
QKeySequence( Qt::ALT+Qt::Key_Space ) );
3471 mQuickSearchAction =
new KAction( i18n(
"Set Focus to Quick Search"),
this );
3473 mQuickSearchAction->setShortcut(
QKeySequence( Qt::ALT + Qt::Key_Q ) );
3474 actionCollection()->addAction(
QLatin1String(
"focus_to_quickseach"), mQuickSearchAction );
3475 connect( mQuickSearchAction, SIGNAL(triggered(
bool)),
3476 SLOT(slotFocusQuickSearch()) );
3477 updateQuickSearchLineText();
3480 KAction *action =
new KAction( i18n(
"Extend Selection to Previous Message" ),
this );
3481 action->setShortcut(
QKeySequence( Qt::SHIFT + Qt::Key_Left ) );
3482 actionCollection()->addAction(
QLatin1String(
"previous_message"), action );
3483 connect( action, SIGNAL(triggered(
bool)),
3484 this, SLOT(slotExtendSelectionToPreviousMessage()) );
3487 KAction *action =
new KAction( i18n(
"Extend Selection to Next Message" ),
this );
3488 action->setShortcut(
QKeySequence( Qt::SHIFT + Qt::Key_Right ) );
3489 actionCollection()->addAction(
QLatin1String(
"next_message"), action );
3490 connect( action, SIGNAL(triggered(
bool)),
3491 this, SLOT(slotExtendSelectionToNextMessage()) );
3495 mMoveMsgToFolderAction =
new KAction( i18n(
"Move Message to Folder"),
this );
3496 mMoveMsgToFolderAction->setShortcut(
QKeySequence( Qt::Key_M ) );
3497 actionCollection()->addAction(
QLatin1String(
"move_message_to_folder"), mMoveMsgToFolderAction );
3498 connect( mMoveMsgToFolderAction, SIGNAL(triggered(
bool)),
3499 SLOT(slotMoveSelectedMessageToFolder()) );
3502 mArchiveAction =
new KAction( i18nc(
"@action",
"Archive"),
this);
3503 actionCollection()->addAction(
QLatin1String(
"archive_mails"), mArchiveAction );
3504 connect( mArchiveAction, SIGNAL(triggered(
bool)),
3505 SLOT(slotArchiveMails()) );
3512 if (!mFavoritesModel)
3515 dialog->setCaption( i18n(
"Add Favorite Folder") );
3516 if ( dialog->exec() && dialog ) {
3517 const Akonadi::Collection collection = dialog->selectedCollection();
3518 if ( collection.isValid() ) {
3519 mFavoritesModel->addCollection( collection );
3536 if ( !mMsgView->viewer()->atBottom() ) {
3537 mMsgView->viewer()->slotJumpDown();
3540 slotSelectNextUnreadMessage();
3545 if ( !mFolderTreeWidget )
3547 mGoToFirstUnreadMessageInSelectedFolder =
true;
3548 mFolderTreeWidget->folderTreeView()->selectNextUnreadFolder();
3549 mGoToFirstUnreadMessageInSelectedFolder =
false;
3554 if ( !mFolderTreeWidget )
3556 mGoToFirstUnreadMessageInSelectedFolder =
true;
3557 mFolderTreeWidget->folderTreeView()->selectPrevUnreadFolder();
3558 mGoToFirstUnreadMessageInSelectedFolder =
false;
3563 mMessagePane->setCurrentThreadExpanded(
true );
3568 mMessagePane->setCurrentThreadExpanded(
false );
3574 #ifndef QT_NO_CURSOR
3575 MessageViewer::KCursorSaver busy( MessageViewer::KBusyPtr::busy() );
3577 mMessagePane->setAllThreadsExpanded(
true );
3583 #ifndef QT_NO_CURSOR
3584 MessageViewer::KCursorSaver busy( MessageViewer::KBusyPtr::busy() );
3586 mMessagePane->setAllThreadsExpanded(
false );
3592 updateMessageActions();
3599 updateMessageActions(
true );
3602 menutimer->start( 500 );
3607 Akonadi::Item::List selectedItems;
3608 Akonadi::Item::List selectedVisibleItems;
3609 bool allSelectedBelongToSameThread =
false;
3610 if (mCurrentFolder && mCurrentFolder->isValid() &&
3611 mMessagePane->getSelectionStats( selectedItems, selectedVisibleItems, &allSelectedBelongToSameThread )
3614 mMsgActions->setCurrentMessage( mMessagePane->currentItem(), selectedVisibleItems );
3616 mMsgActions->setCurrentMessage( Akonadi::Item() );
3620 updateMessageActionsDelayed();
3628 Akonadi::Item::List selectedItems;
3629 Akonadi::Item::List selectedVisibleItems;
3630 bool allSelectedBelongToSameThread =
false;
3631 Akonadi::Item currentMessage;
3632 if (mCurrentFolder && mCurrentFolder->isValid() &&
3633 mMessagePane->getSelectionStats( selectedItems, selectedVisibleItems, &allSelectedBelongToSameThread )
3636 count = selectedItems.count();
3638 currentMessage = mMessagePane->currentItem();
3642 currentMessage = Akonadi::Item();
3645 mApplyFiltersOnFolder->setEnabled( mCurrentFolder && mCurrentFolder->isValid() );
3675 bool readOnly = mCurrentFolder && mCurrentFolder->isValid() && ( mCurrentFolder->rights() & Akonadi::Collection::ReadOnly );
3677 bool single_actions = count == 1;
3679 bool singleVisibleMessageSelected = selectedVisibleItems.count() == 1;
3681 bool mass_actions = count >= 1;
3683 bool thread_actions = mass_actions && allSelectedBelongToSameThread && mMessagePane->isThreaded();
3685 bool flags_available =
GlobalSettings::self()->allowLocalFlags() || !(mCurrentFolder && mCurrentFolder->isValid() ? readOnly :
true);
3687 mThreadStatusMenu->setEnabled( thread_actions );
3690 mWatchThreadAction->setEnabled( thread_actions && flags_available );
3691 mIgnoreThreadAction->setEnabled( thread_actions && flags_available );
3692 mMarkThreadAsReadAction->setEnabled( thread_actions );
3693 mMarkThreadAsUnreadAction->setEnabled( thread_actions );
3694 mToggleThreadToActAction->setEnabled( thread_actions && flags_available );
3695 mToggleThreadImportantAction->setEnabled( thread_actions && flags_available );
3696 bool canDeleteMessages = mCurrentFolder && mCurrentFolder->isValid() && ( mCurrentFolder->rights() & Akonadi::Collection::CanDeleteItem );
3698 mTrashThreadAction->setEnabled( thread_actions && canDeleteMessages );
3699 mDeleteThreadAction->setEnabled( thread_actions && canDeleteMessages );
3701 if ( currentMessage.isValid() )
3703 MessageStatus status;
3704 status.setStatusFromFlags( currentMessage.flags() );
3705 mTagActionManager->updateActionStates ( count, mMessagePane->currentItem() );
3708 mToggleThreadToActAction->setChecked( status.isToAct() );
3709 mToggleThreadImportantAction->setChecked( status.isImportant() );
3710 mWatchThreadAction->setChecked( status.isWatched() );
3711 mIgnoreThreadAction->setChecked( status.isIgnored() );
3715 mMoveActionMenu->setEnabled( mass_actions && canDeleteMessages );
3716 if (mMoveMsgToFolderAction)
3717 mMoveMsgToFolderAction->setEnabled( mass_actions && canDeleteMessages );
3720 mDeleteAction->setEnabled( mass_actions && canDeleteMessages );
3722 mExpireConfigAction->setEnabled( canDeleteMessages );
3725 mMsgView->findInMessageAction()->setEnabled( mass_actions && !CommonKernel->folderIsTemplates( mCurrentFolder->collection() ) );
3727 mMsgActions->forwardInlineAction()->setEnabled( mass_actions && !CommonKernel->folderIsTemplates( mCurrentFolder->collection() ) );
3728 mMsgActions->forwardAttachedAction()->setEnabled( mass_actions && !CommonKernel->folderIsTemplates( mCurrentFolder->collection() ) );
3729 mMsgActions->forwardMenu()->setEnabled( mass_actions && !CommonKernel->folderIsTemplates( mCurrentFolder->collection() ) );
3731 mMsgActions->editAction()->setEnabled( single_actions );
3732 mUseAction->setEnabled( single_actions && CommonKernel->folderIsTemplates( mCurrentFolder->collection() ) );
3733 filterMenu()->setEnabled( single_actions );
3734 mMsgActions->redirectAction()->setEnabled( mass_actions && !CommonKernel->folderIsTemplates( mCurrentFolder->collection() ) );
3736 if ( mMsgActions->customTemplatesMenu() )
3738 mMsgActions->customTemplatesMenu()->forwardActionMenu()->setEnabled( mass_actions );
3739 mMsgActions->customTemplatesMenu()->replyActionMenu()->setEnabled( single_actions );
3740 mMsgActions->customTemplatesMenu()->replyAllActionMenu()->setEnabled( single_actions );
3744 mMsgActions->printAction()->setEnabled( singleVisibleMessageSelected );
3746 KAction *printPreviewAction = mMsgActions->printPreviewAction();
3747 if (printPreviewAction)
3748 printPreviewAction->setEnabled( singleVisibleMessageSelected );
3752 mMsgView->viewSourceAction()->setEnabled( singleVisibleMessageSelected );
3754 MessageStatus status;
3755 status.setStatusFromFlags( currentMessage.flags() );
3758 bool statusSendAgain = single_actions && ( ( currentMessage.isValid() && status.isSent() ) || ( currentMessage.isValid() && CommonKernel->folderIsSentMailFolder( mCurrentFolder->collection() ) ) );
3759 if ( statusSendAgain ) {
3760 actionList << mSendAgainAction;
3761 }
else if ( single_actions ) {
3762 actionList << messageActions()->editAction();
3764 actionList << mSaveAttachmentsAction;
3766 actionList << mArchiveAction;
3767 mGUIClient->unplugActionList(
QLatin1String(
"messagelist_actionlist" ) );
3768 mGUIClient->plugActionList(
QLatin1String(
"messagelist_actionlist" ), actionList );
3769 mSendAgainAction->setEnabled( statusSendAgain );
3771 mSaveAsAction->setEnabled( mass_actions );
3773 if ((mCurrentFolder&& mCurrentFolder->isValid())) {
3774 updateMoveAction( mCurrentFolder->statistics() );
3777 updateMoveAction(
false,
false);
3780 const qint64 nbMsgOutboxCollection = MailCommon::Util::updatedCollection( CommonKernel->outboxCollectionFolder() ).statistics().count();
3782 mSendQueued->setEnabled( nbMsgOutboxCollection > 0 );
3783 mSendActionMenu->setEnabled( nbMsgOutboxCollection > 0 );
3785 const bool newPostToMailingList = mCurrentFolder && mCurrentFolder->isMailingListEnabled();
3786 mMessageNewList->setEnabled(newPostToMailingList);
3788 slotUpdateOnlineStatus( static_cast<GlobalSettingsBase::EnumNetworkState::type>(
GlobalSettings::self()->networkState() ) );
3793 foreach (
QAction *filterAction, mFilterMenuActions ) {
3797 mApplyAllFiltersAction->setEnabled( count);
3798 mApplyFilterActionsMenu->setEnabled( count );
3804 bool multiFolder =
false;
3805 if ( mFolderTreeWidget ) {
3806 multiFolder = mFolderTreeWidget->selectedCollections().count() > 1;
3808 if ( mCollectionProperties ) {
3809 if ( mCurrentFolder && mCurrentFolder->collection().isValid() ) {
3810 const Akonadi::AgentInstance instance =
3811 Akonadi::AgentManager::self()->instance( mCurrentFolder->collection().resource() );
3813 mCollectionProperties->setEnabled( !multiFolder &&
3814 !mCurrentFolder->isStructural() &&
3815 (instance.status()!=Akonadi::AgentInstance::Broken) );
3817 mCollectionProperties->setEnabled(
false);
3820 if ( mCollectionProperties->isEnabled() )
3821 collectionProperties << mCollectionProperties;
3822 mGUIClient->unplugActionList(
QLatin1String(
"akonadi_collection_collectionproperties_actionlist") );
3823 mGUIClient->plugActionList(
QLatin1String(
"akonadi_collection_collectionproperties_actionlist"), collectionProperties );
3827 const bool folderWithContent = mCurrentFolder && !mCurrentFolder->isStructural();
3829 if ( mAkonadiStandardActionManager->action( Akonadi::StandardActionManager::DeleteCollections ) ) {
3831 mAkonadiStandardActionManager->action( Akonadi::StandardActionManager::DeleteCollections )->setEnabled( mCurrentFolder
3833 && ( mCurrentFolder->collection().rights() & Collection::CanDeleteCollection )
3834 && !mCurrentFolder->isSystemFolder()
3835 && folderWithContent);
3838 if ( mAkonadiStandardActionManager->action( Akonadi::StandardMailActionManager::MoveAllToTrash ) ) {
3839 mAkonadiStandardActionManager->action( Akonadi::StandardMailActionManager::MoveAllToTrash )->setEnabled( folderWithContent
3840 && ( mCurrentFolder->count() > 0 )
3841 && mCurrentFolder->canDeleteMessages()
3843 mAkonadiStandardActionManager->action( Akonadi::StandardMailActionManager::MoveAllToTrash )->setText( (mCurrentFolder && CommonKernel->folderIsTrash(mCurrentFolder->collection())) ? i18n(
"E&mpty Trash") : i18n(
"&Move All Messages to Trash") );
3848 QAction *actionAddToFavoriteCollections = akonadiStandardAction( Akonadi::StandardActionManager::AddToFavoriteCollections );
3849 if ( actionAddToFavoriteCollections ) {
3850 if ( mEnableFavoriteFolderView && actionAddToFavoriteCollections->
isEnabled() )
3851 addToFavorite << actionAddToFavoriteCollections;
3852 mGUIClient->unplugActionList(
QLatin1String(
"akonadi_collection_add_to_favorites_actionlist") );
3853 mGUIClient->plugActionList(
QLatin1String(
"akonadi_collection_add_to_favorites_actionlist"), addToFavorite );
3857 QAction *actionSync = akonadiStandardAction( Akonadi::StandardActionManager::SynchronizeCollections );
3858 if ( actionSync && actionSync->
isEnabled() ) {
3859 syncActionList << actionSync;
3861 actionSync = akonadiStandardAction( Akonadi::StandardActionManager::SynchronizeCollectionsRecursive );
3862 if ( actionSync && actionSync->
isEnabled() ) {
3863 syncActionList << actionSync;
3865 mGUIClient->unplugActionList(
QLatin1String(
"akonadi_collection_sync_actionlist") );
3866 mGUIClient->plugActionList(
QLatin1String(
"akonadi_collection_sync_actionlist"), syncActionList );
3872 QAction *action = mAkonadiStandardActionManager->action( Akonadi::StandardActionManager::CreateCollection );
3874 actionList << action;
3877 action = mAkonadiStandardActionManager->action( Akonadi::StandardActionManager::MoveCollectionToMenu );
3879 actionList <<action;
3882 action = mAkonadiStandardActionManager->action( Akonadi::StandardActionManager::CopyCollectionToMenu);
3884 actionList <<action;
3886 mGUIClient->unplugActionList(
QLatin1String(
"akonadi_collection_move_copy_menu_actionlist") );
3887 mGUIClient->plugActionList(
QLatin1String(
"akonadi_collection_move_copy_menu_actionlist"), actionList );
3892 void KMMainWidget::updateHtmlMenuEntry()
3894 if (mDisplayMessageFormatMenu && mPreferHtmlLoadExtAction) {
3895 bool multiFolder =
false;
3896 if ( mFolderTreeWidget ) {
3897 multiFolder = mFolderTreeWidget->selectedCollections().count() > 1;
3900 const bool enabledAction = ( mFolderTreeWidget &&
3901 mFolderTreeWidget->folderTreeView()->currentFolder().isValid() &&
3904 mDisplayMessageFormatMenu->setEnabled(enabledAction);
3905 const bool isEnabled = ( mFolderTreeWidget &&
3906 mFolderTreeWidget->folderTreeView()->currentFolder().isValid() &&
3908 const bool useHtml = (mFolderDisplayFormatPreference == MessageViewer::Viewer::Html || (mHtmlGlobalSetting && mFolderDisplayFormatPreference == MessageViewer::Viewer::UseGlobalSetting));
3909 mPreferHtmlLoadExtAction->setEnabled( isEnabled && useHtml );
3911 mDisplayMessageFormatMenu->setDisplayMessageFormat(mFolderDisplayFormatPreference);
3913 mPreferHtmlLoadExtAction->setChecked( !multiFolder && ( mHtmlLoadExtGlobalSetting ? !mFolderHtmlLoadExtPreference : mFolderHtmlLoadExtPreference ) );
3920 if (!CommonKernel->outboxCollectionFolder().isValid()) {
3925 const bool folderWithContent = mCurrentFolder && !mCurrentFolder->isStructural();
3926 bool multiFolder =
false;
3927 if ( mFolderTreeWidget ) {
3928 multiFolder = mFolderTreeWidget->selectedCollections().count() > 1;
3930 mFolderMailingListPropertiesAction->setEnabled( folderWithContent &&
3932 !mCurrentFolder->isSystemFolder() );
3935 if ( mCurrentFolder && mCurrentFolder->collection().id() == CommonKernel->outboxCollectionFolder().id() && (mCurrentFolder->collection()).statistics().count() > 0) {
3936 kDebug() <<
"Enabling send queued";
3937 mSendQueued->setEnabled(
true);
3938 actionlist << mSendQueued;
3943 mGUIClient->unplugActionList(
QLatin1String(
"outbox_folder_actionlist" ) );
3944 mGUIClient->plugActionList(
QLatin1String(
"outbox_folder_actionlist" ), actionlist );
3947 const bool isASearchFolder = mCurrentFolder && mCurrentFolder->collection().resource() ==
QLatin1String(
"akonadi_search_resource" );
3948 if (isASearchFolder)
3949 mAkonadiStandardActionManager->action( Akonadi::StandardActionManager::DeleteCollections )->setText( i18n(
"&Delete Search") );
3951 mArchiveFolderAction->setEnabled( mCurrentFolder && !multiFolder && folderWithContent );
3953 bool isInTrashFolder = (mCurrentFolder && CommonKernel->folderIsTrash(mCurrentFolder->collection()));
3954 KAction *moveToTrash = akonadiStandardAction( Akonadi::StandardMailActionManager::MoveToTrash );
3955 moveToTrash->setText( isInTrashFolder ? i18nc(
"@action Hard delete, bypassing trash",
"&Delete"): i18n(
"&Move to Trash") );
3958 moveToTrash->setToolTip( isInTrashFolder ? i18nc(
"@action Hard delete, bypassing trash",
"&Delete"): i18n(
"&Move to Trash") );
3959 mTrashThreadAction->setText(isInTrashFolder ?i18n(
"Delete T&hread"): i18n(
"M&ove Thread to Trash"));
3962 mSearchMessages->setText( (mCurrentFolder && mCurrentFolder->collection().resource() ==
QLatin1String(
"akonadi_search_resource" )) ? i18n(
"Edit Search...") : i18n(
"&Find Messages...") );
3965 mExpireConfigAction->setEnabled( mCurrentFolder &&
3966 !mCurrentFolder->isStructural() &&
3968 mCurrentFolder->canDeleteMessages() &&
3969 folderWithContent &&
3970 !MailCommon::Util::isVirtualCollection( mCurrentFolder->collection() ) );
3972 updateHtmlMenuEntry();
3974 mShowFolderShortcutDialogAction->setEnabled( !multiFolder && folderWithContent );
3976 actionlist << akonadiStandardAction( Akonadi::StandardActionManager::ManageLocalSubscriptions );
3977 bool imapFolderIsOnline =
false;
3978 if (mCurrentFolder &&
kmkernel->isImapFolder( mCurrentFolder->collection(),imapFolderIsOnline )) {
3979 if (imapFolderIsOnline) {
3980 actionlist << mServerSideSubscription;
3984 mGUIClient->unplugActionList(
QLatin1String(
"collectionview_actionlist" ) );
3985 mGUIClient->plugActionList(
QLatin1String(
"collectionview_actionlist" ), actionlist );
3995 mMsgView->clear(
true );
3998 if ( mMessagePane && mLongFolderList )
3999 mMessagePane->hide();
4000 mMsgView->displayAboutPage();
4002 mCurrentFolder.clear();
4007 connect( MailCommon::FilterManager::instance(), SIGNAL(filtersChanged()),
4008 this, SLOT(initializeFilterActions()) );
4012 checkAkonadiServerManagerState();
4013 mFolderShortcutActionManager->createActions();
4014 mTagActionManager->createActions();
4015 messageActions()->setupForwardingActionsList( mGUIClient );
4026 void KMMainWidget::checkAkonadiServerManagerState()
4028 Akonadi::ServerManager::State state = Akonadi::ServerManager::self()->state();
4029 if (state == Akonadi::ServerManager::Running) {
4030 initializeFilterActions();
4032 connect( Akonadi::ServerManager::self(), SIGNAL(stateChanged(Akonadi::ServerManager::State)),
4033 SLOT(slotServerStateChanged(Akonadi::ServerManager::State)) );
4037 void KMMainWidget::slotServerStateChanged(Akonadi::ServerManager::State state)
4039 if (state == Akonadi::ServerManager::Running) {
4040 initializeFilterActions();
4041 disconnect( Akonadi::ServerManager::self(), SIGNAL(stateChanged(Akonadi::ServerManager::State)));
4052 if ( actionCollection()->action(
QLatin1String(
"kmail_undo") ) ) {
4059 act->
setText(i18n(
"&Undo: \"%1\"",
kmkernel->undoStack()->undoInfo()));
4067 if ( !mFilterTBarActions.isEmpty() )
4068 if ( mGUIClient->factory() )
4069 mGUIClient->unplugActionList(
QLatin1String(
"toolbar_filter_actions") );
4071 if ( !mFilterMenuActions.isEmpty() )
4072 if ( mGUIClient->factory() )
4073 mGUIClient->unplugActionList(
QLatin1String(
"menu_filter_actions") );
4075 foreach (
QAction *a, mFilterMenuActions )
4076 actionCollection()->removeAction( a );
4078 mApplyFilterActionsMenu->menu()->clear();
4079 mFilterTBarActions.clear();
4080 mFilterMenuActions.clear();
4082 qDeleteAll( mFilterCommands );
4083 mFilterCommands.clear();
4089 clearFilterActions();
4090 mApplyFilterActionsMenu->menu()->addAction( mApplyAllFiltersAction );
4091 bool addedSeparator =
false;
4093 foreach ( MailFilter *filter, MailCommon::FilterManager::instance()->filters() ) {
4094 if ( !filter->isEmpty() && filter->configureShortcut() && filter->isEnabled() ) {
4097 if ( action( normalizedName ) ) {
4101 mFilterCommands.append( filterCommand );
4102 QString displayText = i18n(
"Filter %1", filter->name() );
4103 QString icon = filter->icon();
4104 if ( icon.isEmpty() ) {
4107 KAction *filterAction =
new KAction( KIcon( icon ), displayText, actionCollection() );
4108 filterAction->setIconText( filter->toolbarName() );
4113 filterAction->setShortcutConfigurable(
false );
4114 actionCollection()->addAction( normalizedName,
4116 connect( filterAction, SIGNAL(triggered(
bool)),
4117 filterCommand, SLOT(start()) );
4118 filterAction->setShortcuts( filter->shortcut() );
4119 if ( !addedSeparator ) {
4121 mFilterMenuActions.append( a );
4122 addedSeparator =
true;
4125 mFilterMenuActions.append( filterAction );
4126 if ( filter->configureToolbar() ) {
4127 mFilterTBarActions.append( filterAction );
4131 if ( !mFilterMenuActions.isEmpty() && mGUIClient->factory() )
4132 mGUIClient->plugActionList(
QLatin1String(
"menu_filter_actions"), mFilterMenuActions );
4133 if ( !mFilterTBarActions.isEmpty() && mGUIClient->factory() ) {
4134 mFilterTBarActions.prepend( mToolbarActionSeparator );
4135 mGUIClient->plugActionList(
QLatin1String(
"toolbar_filter_actions"), mFilterTBarActions );
4139 updateMessageActions();
4145 const bool isEmpty = MailCommon::Util::agentInstances().isEmpty();
4146 actionCollection()->action(
QLatin1String(
"check_mail"))->setEnabled( !isEmpty );
4147 actionCollection()->action(
QLatin1String(
"check_mail_in"))->setEnabled( !isEmpty );
4154 if ( theMainWidgetList.isDestroyed() )
4158 return theMainWidgetList;
4163 return mCurrentFolder;
4167 QString KMMainWidget::overrideEncoding()
const
4170 return mMsgView->overrideEncoding();
4172 return MessageCore::GlobalSettings::self()->overrideCharacterEncoding();
4178 mWasEverShown =
true;
4181 void KMMainWidget::slotRequestFullSearchFromQuickSearch()
4185 if ( !slotSearch() )
4188 assert( mSearchWin );
4193 SearchPattern pattern;
4194 const QString searchString = mMessagePane->currentFilterSearchString();
4195 if ( !searchString.
isEmpty() ) {
4196 MessageList::Core::QuickSearchLine::SearchOptions options = mMessagePane->currentOptions();
4198 if (options & MessageList::Core::QuickSearchLine::SearchEveryWhere) {
4199 searchStringVal =
"<message>";
4200 }
else if (options & MessageList::Core::QuickSearchLine::SearchAgainstSubject) {
4201 searchStringVal =
"subject";
4202 }
else if (options & MessageList::Core::QuickSearchLine::SearchAgainstBody) {
4203 searchStringVal =
"<body>";
4204 }
else if (options & MessageList::Core::QuickSearchLine::SearchAgainstFrom) {
4205 searchStringVal =
"from";
4206 }
else if (options & MessageList::Core::QuickSearchLine::SearchAgainstBcc) {
4207 searchStringVal =
"bcc";
4208 }
else if (options & MessageList::Core::QuickSearchLine::SearchAgainstTo) {
4209 searchStringVal =
"to";
4211 searchStringVal =
"<message>";
4213 pattern.
append( SearchRule::createInstance( searchStringVal, SearchRule::FuncContains, searchString ) );
4215 Q_FOREACH(MessageStatus status, statusList) {
4216 if ( status.hasAttachment() ) {
4217 pattern.
append( SearchRule::createInstance( searchStringVal, SearchRule::FuncHasAttachment, searchString ) );
4218 status.setHasAttachment(
false );
4220 if ( !status.isOfUnknownStatus() ) {
4221 pattern.append( SearchRule::Ptr(
new SearchRuleStatus( status ) ) );
4225 if ( !pattern.isEmpty() )
4226 mSearchWin->addRulesToSearchPattern( pattern );
4231 mVacationScriptIndicator->setVacationScriptActive(active, serverName);
4232 mVacationIndicatorActive = mVacationScriptIndicator->hasVacationScriptActive();
4237 return mVacationScriptIndicator;
4242 updateVacationScriptStatus( mVacationIndicatorActive );
4247 return mTagActionManager;
4252 return mFolderShortcutActionManager;
4257 delete mShowBusySplashTimer;
4258 mShowBusySplashTimer = 0;
4262 if ( !item.isValid() ) {
4265 mShowBusySplashTimer =
new QTimer(
this );
4266 mShowBusySplashTimer->setSingleShot(
true );
4267 connect( mShowBusySplashTimer, SIGNAL(timeout()),
this, SLOT(slotShowBusySplash()) );
4270 Akonadi::ItemFetchJob *itemFetchJob = MessageViewer::Viewer::createFetchJob( item );
4271 if (mCurrentFolder) {
4272 const QString resource = mCurrentFolder->collection().resource();
4274 connect( itemFetchJob, SIGNAL(itemsReceived(Akonadi::Item::List)),
4275 SLOT(itemsReceived(Akonadi::Item::List)) );
4276 connect( itemFetchJob, SIGNAL(result(
KJob*)), SLOT(itemsFetchDone(
KJob*)) );
4282 void KMMainWidget::itemsReceived(
const Akonadi::Item::List &list )
4284 Q_ASSERT( list.size() == 1 );
4285 delete mShowBusySplashTimer;
4286 mShowBusySplashTimer = 0;
4291 Item item = list.first();
4293 if ( mMessagePane ) {
4294 mMessagePane->show();
4296 if ( mMessagePane->currentItem() != item ) {
4299 if ( MessageViewer::GlobalSettings::self()->delayedMarkAsRead() &&
4300 MessageViewer::GlobalSettings::self()->delayedMarkTime() == 0 ) {
4301 item.setFlag( Akonadi::MessageFlags::Seen );
4302 Akonadi::ItemModifyJob *modifyJob =
new Akonadi::ItemModifyJob( item,
this );
4303 modifyJob->disableRevisionCheck();
4304 modifyJob->setIgnorePayload(
true );
4310 mMsgView->setMessage( item );
4312 mMsgView->setDisplayFormatMessageOverwrite(mFolderDisplayFormatPreference);
4313 mMsgView->setHtmlLoadExtOverride(mFolderHtmlLoadExtPreference);
4314 mMsgView->setDecryptMessageOverwrite(
false );
4315 mMsgActions->setCurrentMessage( item );
4318 void KMMainWidget::itemsFetchDone(
KJob *job )
4320 delete mShowBusySplashTimer;
4321 mShowBusySplashTimer = 0;
4322 if ( job->error() ) {
4326 kDebug() << job->error() << job->errorString();
4328 const QString resource = job->property(
"_resource").toString();
4329 const Akonadi::AgentInstance agentInstance = Akonadi::AgentManager::self()->instance( resource );
4330 if ( !agentInstance.isOnline() ) {
4333 mMsgView->viewer()->enableMessageDisplay();
4334 mMsgView->clear(
true );
4336 mMessagePane->show();
4341 showResourceOfflinePage();
4344 BroadcastStatus::instance()->setStatusMsg( job->errorString() );
4351 return mAkonadiStandardActionManager->action( type );
4356 return mAkonadiStandardActionManager->action( type );
4365 void KMMainWidget::slotServerSideSubscription()
4367 if ( !mCurrentFolder )
4378 mMessagePane->saveCurrentSelection();
4385 mMessagePane->updateTagComboBox();
4398 openCommand->
start();
4403 mOpenRecentAction->addUrl(mUrl);
4404 KConfigGroup grp = mConfig->group(
QLatin1String(
"Recent Files"));
4405 mOpenRecentAction->saveEntries(grp);
4409 void KMMainWidget::slotMoveMessageToTrash()
4411 if (messageView() && messageView()->viewer()) {
4417 void KMMainWidget::slotArchiveMails()
4426 mMessagePane->setQuickSearchClickMessage(i18nc(
"Show shortcut for focus quick search. Don't change it",
"Search...<%1>",mQuickSearchAction->shortcut().toString()));
4429 void KMMainWidget::slotChangeDisplayMessageFormat(MessageViewer::Viewer::DisplayFormatMessage format)
4431 if (format == MessageViewer::Viewer::Html) {
4432 const int result = KMessageBox::warningContinueCancel(
this,
4434 i18n(
"Use of HTML in mail will make you more vulnerable to "
4435 "\"spam\" and may increase the likelihood that your system will be "
4436 "compromised by other present and anticipated security exploits." ),
4437 i18n(
"Security Warning" ),
4438 KGuiItem(i18n(
"Use HTML" )),
4439 KStandardGuiItem::cancel(),
4441 if ( result == KMessageBox::Cancel ) {
4442 mDisplayMessageFormatMenu->setDisplayMessageFormat(MessageViewer::Viewer::Text);
4446 mFolderDisplayFormatPreference = format;
4449 const bool useHtml = (mFolderDisplayFormatPreference == MessageViewer::Viewer::Html || (mHtmlGlobalSetting && mFolderDisplayFormatPreference == MessageViewer::Viewer::UseGlobalSetting));
4450 mPreferHtmlLoadExtAction->setEnabled( useHtml );
4453 mMsgView->setDisplayFormatMessageOverwrite(mFolderDisplayFormatPreference);
4454 mMsgView->update(
true );
4460 mMessagePane->populateStatusFilterCombo();
4463 void KMMainWidget::slotCollectionRemoved(
const Akonadi::Collection &col)
4465 if (mFavoritesModel)
4466 mFavoritesModel->removeCollection(col);
void readPreConfig()
Read configuration options before widgets are created.
void setText(const QString &text)
void slotUpdateUndo()
Update the undo action.
void slotCreateAddressBookContact()
void slotCollectionChanged(const Akonadi::Collection &, const QSet< QByteArray > &)
void slotSetThreadStatusUnread()
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 slotManageSieveScripts()
KAction * akonadiStandardAction(Akonadi::StandardActionManager::Type type)
void slotExpandAllThreads()
void slotItemsFetchedForActivation(KMCommand *command)
void slotSetThreadStatusWatched()
This class implements a "reader window", that is a window used for reading or viewing messages...
void slotDelayedShowNewFromTemplate(KJob *)
void slotReplaceMsgByUnencryptedVersion()
void slotSetThreadStatusImportant()
virtual QByteArray text(quint32 serialNumber) const =0
This command is used to set or toggle a tag for a list of messages.
bool startDetached(const QString &program, const QStringList &arguments, const QString &workingDirectory, qint64 *pid)
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 slotMessageSelected(const Akonadi::Item &)
Opens mail in the internal viewer.
FolderArchiveManager * folderArchiveManager() const
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
void slotClearCurrentFolder()
KSharedConfig::Ptr config()
Creates actions related to the existing Akonadi tags and plugs them into the GUI. ...
void slotExtendSelectionToPreviousMessage()
virtual void showEvent(QShowEvent *event)
void slotFocusOnPrevMessage()
void setArchiveItems(const QList< Akonadi::Item > &items, const QString &instanceName)
void slotEditVacation(const QString &serverName=QString())
Trigger the dialog for editing out-of-office scripts.
QWidget * vacationScriptIndicator() const
int count(const T &value) const
void slotUpdateOnlineStatus(GlobalSettings::EnumNetworkState::type)
void append(const T &value)
void startUpdateMessageActionsTimer()
Start a timer to update message actions.
void slotSendQueuedVia(MailTransport::Transport *transport)
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 setMainWidget(KMMainWidget *mainWidget)
void updateFolderMenu()
Update html and threaded messages preferences in Folder menu.
void restoreCollectionFolderViewConfig()
void slotCheckMailOnStartup()
void slotSelectNextMessage()
Message navigation.
void setCurrentFolder(const Akonadi::Collection ¤tFolder)
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 setObjectName(const QString &name)
void updatePaneTagComboBox()
void newFromTemplate(const Akonadi::Item &)
void setParentWidget(QWidget *parentWidget)
void slotPrevUnreadFolder()
void slotItemRemoved(const Akonadi::Item &)
void slotAddFavoriteFolder()
void slotSelectPreviousMessage()
void slotExtendSelectionToNextMessage()
void showResourceOfflinePage()
void setFolder(const Akonadi::Collection &defaultCollection)
void setMargin(int margin)
void slotMoveSelectedMessageToFolder()
This will ask for a destination folder and move the currently selected messages (in MessageListView) ...
void slotSaveAttachments()
QByteArray & append(char ch)
void setData(const QVariant &userData)
static const PtrList * mainWidgetList()
Returns a list of all KMMainWidgets.
void initializeFilterActions()
KMail::FolderShortcutActionManager * folderShortcutActionManager() const
void slotTrashSelectedMessages()
Implements the "move to trash" action.
void slotSelectFocusedMessage()
void slotForwardInlineMsg()
void setValue(const T &value)
QVariant fromValue(const T &value)
void slotSelectCollectionFolder(const Akonadi::Collection &col)
void setCurrentFolder(const QSharedPointer< MailCommon::FolderCollection > ¤tFolder)
bool contains(const T &value) const
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)
QString & replace(int position, int n, QChar after)
QList< KActionCollection * > actionCollections() const
Convenience function to get the action collection in a list.
bool resourceSupportArchiving(const QString &resource)
static GlobalSettings * self()
void slotForwardAttachedMsg()
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()
QVariant data(int role) const
void slotContactSearchJobForMessagePopupDone(KJob *job)
void slotUpdateActionsAfterMailChecking()
QString escape(const QString &plain)
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 updateVacationScriptStatus()
Akonadi::Item item() const
KMail::TagActionManager * tagActionManager() const
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.
QString fromLatin1(const char *str, int size)
void slotFocusOnNextMessage()
void slotSelectLastMessage()
void slotCollapseThread()
void addRecentFile(const KUrl &mUrl)
void slotApplyFiltersOnFolder()
void populateMessageListStatusFilterCombo()
void setUseFixedFont(bool useFixedFont)
void slotDisplayCurrentMessage()
etc.
bool connect(const QObject *sender, const char *signal, const QObject *receiver, const char *method, Qt::ConnectionType type)
virtual void setCollectionForNewMessage(const Akonadi::Collection &folder)=0
void slotEditNotifications()
Settings menu.
void writeFolderConfig()
Write configuration for current folder.
void slotSelectFirstMessage()
QString arg(qlonglong a, int fieldWidth, int base, const QChar &fillChar) const
void slotCustomForwardMsg(const QString &tmpl)
void slotUpdateMessageTagList(const Akonadi::Tag &tag)
Adds if not existing/removes if existing the tag identified by aLabel in all selected messages...
void slotOpenRecentMsg(const KUrl &url)
void updateQuickSearchLineText()
void slotCollectionStatisticsChanged(const Akonadi::Collection::Id, const Akonadi::CollectionStatistics &)
void activateFolder(const Akonadi::Collection &folder)
Changes the base folder for search operations to a different folder.
void slotNewFromTemplate(QAction *)
void updateMessageMenu()
Update message menu.
void slotSelectNextUnreadMessage()
void slotRemoveDuplicates()
void slotNextUnreadFolder()