19#include <tqpopupmenu.h>
21#include <tqsignalmapper.h>
22#include <tqvaluevector.h>
23#include <tqstylesheet.h>
26#include <tdemessagebox.h>
27#include <tdepopupmenu.h>
28#include <tdeaccelmanager.h>
29#include <tdeglobalsettings.h>
30#include <tdestdaccel.h>
31#include <kkeydialog.h>
33#include <knotifyclient.h>
35#include <tdeapplication.h>
36#include <tdefiledialog.h>
38#include <knotifydialog.h>
39#include <tdestandarddirs.h>
40#include <dcopclient.h>
43#include <kstringhandler.h>
45#include "globalsettings.h"
46#include "kcursorsaver.h"
47#include "broadcaststatus.h"
48using KPIM::BroadcastStatus;
49#include "kmfoldermgr.h"
50#include "kmfolderdia.h"
51#include "accountmanager.h"
54#include "kmfoldertree.h"
55#include "kmreadermainwin.h"
56#include "kmfoldercachedimap.h"
57#include "kmfolderimap.h"
58#include "kmacctcachedimap.h"
60#include "kmfolderseldlg.h"
61#include "kmfiltermgr.h"
62#include "messagesender.h"
63#include "kmaddrbook.h"
65#include "searchwindow.h"
67#include "kmacctfolder.h"
69#include "kmcommands.h"
71#include "kmsystemtray.h"
72#include "imapaccountbase.h"
73#include "transportmanager.h"
74using KMail::ImapAccountBase;
77#include "favoritefolderview.h"
78#include "subscriptiondialog.h"
79using KMail::SubscriptionDialog;
80#include "localsubscriptiondialog.h"
81using KMail::LocalSubscriptionDialog;
82#include "attachmentstrategy.h"
83using KMail::AttachmentStrategy;
84#include "headerstrategy.h"
85using KMail::HeaderStrategy;
86#include "headerstyle.h"
89using KMail::FolderJob;
90#include "mailinglist-magic.h"
91#include "antispamwizard.h"
93#include "filterlogdlg.h"
95#include <headerlistquicksearch.h>
96#include "tdelistviewindexedsearchline.h"
97using KMail::HeaderListQuickSearch;
99#include "mailinglistpropertiesdialog.h"
100#include "templateparser.h"
101#include "archivefolderdialog.h"
102#include "folderutil.h"
103#include "csshelper.h"
106 #include "sievedebugdialog.h"
110#include <libkpimidentities/identity.h>
111#include <libkpimidentities/identitymanager.h>
114#include <kstatusbar.h>
115#include <kstaticdeleter.h>
116#include <tdeaction.h>
118#include <kmime_mdn.h>
119#include <kmime_header_parsing.h>
120using namespace KMime;
121using KMime::Types::AddrSpecList;
123#include "progressmanager.h"
124using KPIM::ProgressManager;
126#include "managesievescriptsdialog.h"
128#include "customtemplates.h"
129#include "customtemplates_kfg.h"
131#include "kmmainwidget.moc"
133TQValueList<KMMainWidget*>* KMMainWidget::s_mainWidgetList =
nullptr;
134static KStaticDeleter<TQValueList<KMMainWidget*> > mwlsd;
137KMMainWidget::KMMainWidget(TQWidget *parent,
const char *name,
138 KXMLGUIClient *aGUIClient,
139 TDEActionCollection *actionCollection, TDEConfig* config ) :
140 TQWidget(parent, name),
141 mFavoritesCheckMailAction( nullptr ),
142 mFavoriteFolderView( nullptr ),
143 mFolderView( nullptr ),
144 mFolderViewParent( nullptr ),
145 mFolderViewSplitter( nullptr ),
146 mQuickSearchLine( nullptr ),
147 mArchiveFolderAction( nullptr ),
148 mShowBusySplashTimer( nullptr ),
149 mShowingOfflineScreen( false ),
150 mMsgActions( nullptr ),
151 mVacationIndicatorActive( false )
154 mStartupDone =
false;
155 mSearchWin =
nullptr;
158 mTemplateFolder =
nullptr;
159 mFolderThreadPref =
false;
160 mFolderThreadSubjPref =
true;
161 mReaderWindowActive =
true;
162 mReaderWindowBelow =
true;
163 mFolderHtmlPref =
false;
164 mFolderHtmlLoadExtPref =
false;
165 mSystemTray =
nullptr;
167 mActionCollection = actionCollection;
168 mTopLayout =
new TQVBoxLayout(
this);
169 mFilterMenuActions.setAutoDelete(
true);
170 mFilterTBarActions.setAutoDelete(
false);
171 mFilterCommands.setAutoDelete(
true);
172 mFolderShortcutCommands.setAutoDelete(
true);
175 mGUIClient = aGUIClient;
177 mCustomReplyActionMenu =
nullptr;
178 mCustomReplyAllActionMenu =
nullptr;
179 mCustomForwardActionMenu =
nullptr;
180 mCustomReplyMapper =
nullptr;
181 mCustomReplyAllMapper =
nullptr;
182 mCustomForwardMapper =
nullptr;
186 mToolbarActionSeparator =
new TDEActionSeparator( actionCollection );
188 if( !s_mainWidgetList )
189 mwlsd.setObject( s_mainWidgetList,
new TQValueList<KMMainWidget*>() );
190 s_mainWidgetList->append(
this );
192 mPanner1Sep << 1 << 1;
193 mPanner2Sep << 1 << 1;
195 setMinimumSize(400, 300);
206 TQTimer::singleShot( 0,
this, TQ_SLOT( slotShowStartupFolder() ));
208 connect( kmkernel->acctMgr(), TQ_SIGNAL( checkedMail(
bool,
bool,
const TQMap<TQString, int> & ) ),
209 this, TQ_SLOT( slotMailChecked(
bool,
bool,
const TQMap<TQString, int> & ) ) );
211 connect( kmkernel->acctMgr(), TQ_SIGNAL( accountAdded( KMAccount* ) ),
212 this, TQ_SLOT( initializeIMAPActions() ) );
213 connect( kmkernel->acctMgr(), TQ_SIGNAL( accountRemoved( KMAccount* ) ),
214 this, TQ_SLOT( initializeIMAPActions() ) );
216 connect(kmkernel, TQ_SIGNAL( configChanged() ),
217 this, TQ_SLOT( slotConfigChanged() ));
220 connect(mFolderTree, TQ_SIGNAL(currentChanged(TQListViewItem*)),
221 this, TQ_SLOT(slotChangeCaption(TQListViewItem*)));
222 connect(mFolderTree, TQ_SIGNAL(selectionChanged()),
223 TQ_SLOT(updateFolderMenu()) );
224 connect( mFolderTree, TQ_SIGNAL(syncStateChanged()),
225 TQ_SLOT(updateFolderMenu()) );
227 connect(kmkernel->folderMgr(), TQ_SIGNAL(folderRemoved(
KMFolder*)),
228 this, TQ_SLOT(slotFolderRemoved(
KMFolder*)));
230 connect(kmkernel->imapFolderMgr(), TQ_SIGNAL(folderRemoved(
KMFolder*)),
231 this, TQ_SLOT(slotFolderRemoved(
KMFolder*)));
233 connect(kmkernel->dimapFolderMgr(), TQ_SIGNAL(folderRemoved(
KMFolder*)),
234 this, TQ_SLOT(slotFolderRemoved(
KMFolder*)));
236 connect(kmkernel->searchFolderMgr(), TQ_SIGNAL(folderRemoved(
KMFolder*)),
237 this, TQ_SLOT(slotFolderRemoved(
KMFolder*)));
239 connect( kmkernel, TQ_SIGNAL( onlineStatusChanged( GlobalSettings::EnumNetworkState::type ) ),
240 this, TQ_SLOT( slotUpdateOnlineStatus( GlobalSettings::EnumNetworkState::type ) ) );
248 TDEMainWindow *mainWin =
dynamic_cast<TDEMainWindow*
>(topLevelWidget());
249 KStatusBar *sb = mainWin ? mainWin->statusBar() :
nullptr;
250 mVacationScriptIndicator =
new KStatusBarLabel( TQString(), 0, sb );
251 mVacationScriptIndicator->hide();
252 connect( mVacationScriptIndicator, TQ_SIGNAL(itemReleased(
int)), TQ_SLOT(slotEditVacation()) );
253 if ( GlobalSettings::checkOutOfOfficeOnStartup() )
254 TQTimer::singleShot( 0,
this, TQ_SLOT(slotCheckVacation()) );
261KMMainWidget::~KMMainWidget()
263 s_mainWidgetList->remove(
this );
270void KMMainWidget::destruct()
287void KMMainWidget::readPreConfig(
void)
289 const TDEConfigGroup geometry( KMKernel::config(),
"Geometry" );
290 const TDEConfigGroup reader( KMKernel::config(),
"Reader" );
292 mLongFolderList = geometry.readEntry(
"FolderList",
"long" ) !=
"short";
293 mReaderWindowActive = geometry.readEntry(
"readerWindowMode",
"below" ) !=
"hide";
294 mReaderWindowBelow = geometry.readEntry(
"readerWindowMode",
"below" ) ==
"below";
295 mThreadPref = geometry.readBoolEntry(
"nestedMessages",
false );
297 mHtmlPref = reader.readBoolEntry(
"htmlMail",
false );
298 mHtmlLoadExtPref = reader.readBoolEntry(
"htmlLoadExternal",
false );
299 mEnableFavoriteFolderView = GlobalSettings::self()->enableFavoriteFolderView();
304void KMMainWidget::readFolderConfig(
void)
309 TDEConfig *config = KMKernel::config();
310 TDEConfigGroupSaver saver(config,
"Folder-" + mFolder->idString());
311 mFolderThreadPref = config->readBoolEntry(
"threadMessagesOverride",
false );
312 mFolderThreadSubjPref = config->readBoolEntry(
"threadMessagesBySubject",
true );
313 mFolderHtmlPref = config->readBoolEntry(
"htmlMailOverride",
false );
314 mFolderHtmlLoadExtPref = config->readBoolEntry(
"htmlLoadExternalOverride",
false );
319void KMMainWidget::writeFolderConfig(
void)
324 TDEConfig *config = KMKernel::config();
325 TDEConfigGroupSaver saver(config,
"Folder-" + mFolder->idString());
326 config->writeEntry(
"threadMessagesOverride", mFolderThreadPref );
327 config->writeEntry(
"threadMessagesBySubject", mFolderThreadSubjPref );
328 config->writeEntry(
"htmlMailOverride", mFolderHtmlPref );
329 config->writeEntry(
"htmlLoadExternalOverride", mFolderHtmlLoadExtPref );
334void KMMainWidget::readConfig(
void)
336 TDEConfig *config = KMKernel::config();
338 bool oldLongFolderList = mLongFolderList;
339 bool oldReaderWindowActive = mReaderWindowActive;
340 bool oldReaderWindowBelow = mReaderWindowBelow;
341 bool oldFavoriteFolderView = mEnableFavoriteFolderView;
351 mHeaders->refreshNestedState();
353 bool layoutChanged = ( oldLongFolderList != mLongFolderList )
354 || ( oldReaderWindowActive != mReaderWindowActive )
355 || ( oldReaderWindowBelow != mReaderWindowBelow )
356 || ( oldFavoriteFolderView != mEnableFavoriteFolderView );
359 if( layoutChanged ) {
369 TDEConfigGroupSaver saver(config,
"Geometry");
371 TQSize defaultSize(750,560);
372 siz = config->readSizeEntry(
"MainWin", &defaultSize);
376 static const int folderpanewidth = 250;
378 const int folderW = config->readNumEntry(
"FolderPaneWidth", folderpanewidth );
379 const int headerW = config->readNumEntry(
"HeaderPaneWidth", width()-folderpanewidth );
380 const int headerH = config->readNumEntry(
"HeaderPaneHeight", 180 );
381 const int readerH = config->readNumEntry(
"ReaderPaneHeight", 280 );
385 TQValueList<int> & widths = mLongFolderList ? mPanner1Sep : mPanner2Sep ;
386 TQValueList<int> & heights = mLongFolderList ? mPanner2Sep : mPanner1Sep ;
388 widths << folderW << headerW;
389 heights << headerH << readerH;
391 bool layoutChanged = ( oldLongFolderList != mLongFolderList )
392 || ( oldReaderWindowActive != mReaderWindowActive )
393 || ( oldReaderWindowBelow != mReaderWindowBelow );
395 if (!mStartupDone || layoutChanged )
402 const int unreadColumn = config->readNumEntry(
"UnreadColumn", 1);
403 const int totalColumn = config->readNumEntry(
"TotalColumn", 2);
404 const int sizeColumn = config->readNumEntry(
"SizeColumn", 3);
410 if (unreadColumn == 1)
411 mFolderTree->addUnreadColumn( i18n(
"Unread"), 70 );
412 else if (totalColumn == 1)
413 mFolderTree->addTotalColumn( i18n(
"Total"), 70 );
414 else if (sizeColumn == 1)
415 mFolderTree->addSizeColumn( i18n(
"Size"), 70 );
417 if (unreadColumn == 2)
418 mFolderTree->addUnreadColumn( i18n(
"Unread"), 70 );
419 else if (totalColumn == 2)
420 mFolderTree->addTotalColumn( i18n(
"Total"), 70 );
421 else if (sizeColumn == 2)
422 mFolderTree->addSizeColumn( i18n(
"Size"), 70 );
424 if (unreadColumn == 3)
425 mFolderTree->addUnreadColumn( i18n(
"Unread"), 70 );
426 else if (totalColumn == 3)
427 mFolderTree->addTotalColumn( i18n(
"Total"), 70 );
428 else if (sizeColumn == 3)
429 mFolderTree->addSizeColumn( i18n(
"Size"), 70 );
431 mUnreadColumnToggle->setChecked( mFolderTree->isUnreadActive() );
432 mUnreadTextToggle->setChecked( !mFolderTree->isUnreadActive() );
433 mTotalColumnToggle->setChecked( mFolderTree->isTotalActive() );
434 mSizeColumnToggle->setChecked( mFolderTree->isSizeActive() );
436 mFolderTree->updatePopup();
441 mMsgView->readConfig();
443 mHeaders->readConfig();
444 mHeaders->restoreColumnLayout( KMKernel::config(),
"Header-Geometry" );
446 if ( mFolderViewSplitter && !GlobalSettings::self()->folderViewSplitterPosition().isEmpty() ) {
447 mFolderViewSplitter->setSizes( GlobalSettings::self()->folderViewSplitterPosition() );
449 TQValueList<int> defaults;
450 defaults << (int)(height() * 0.2) << (
int)(height() * 0.8);
451 mFolderViewSplitter->setSizes( defaults );
454 mFolderTree->readConfig();
455 if ( mFavoriteFolderView )
456 mFavoriteFolderView->readConfig();
457 mFavoritesCheckMailAction->setEnabled( GlobalSettings::self()->enableFavoriteFolderView() );
460 TDEConfigGroupSaver saver(config,
"General");
461 mBeepOnNew = config->readBoolEntry(
"beep-on-mail",
false);
462 mConfirmEmpty = config->readBoolEntry(
"confirm-before-empty",
true);
464 mStartupFolder = config->readEntry(
"startupFolder", kmkernel->inboxFolder()->idString());
468 bool check = config->readBoolEntry(
"checkmail-startup",
false);
471 TQTimer::singleShot( 0,
this, TQ_SLOT( slotCheckMail() ) );
476 mFolderTree->reload();
484 bool layoutChanged = ( oldLongFolderList != mLongFolderList )
485 || ( oldReaderWindowActive != mReaderWindowActive )
486 || ( oldReaderWindowBelow != mReaderWindowBelow )
487 || ( oldFavoriteFolderView != mEnableFavoriteFolderView );
488 if ( layoutChanged ) {
492 mFolderTree->showFolder( mFolder );
495 mHeaders->setFolder(mFolder);
497 int aIdx = mHeaders->currentItemIndex();
499 mMsgView->setMsg( mFolder->getMsg(aIdx),
true );
501 mMsgView->clear(
true );
503 updateMessageActions();
514void KMMainWidget::writeConfig(
void)
517 TDEConfig *config = KMKernel::config();
518 TDEConfigGroup geometry( config,
"Geometry" );
521 mMsgView->writeConfig();
523 if ( mFolderViewSplitter )
524 GlobalSettings::setFolderViewSplitterPosition( mFolderViewSplitter->sizes() );
525 mFolderTree->writeConfig();
526 if ( mFavoriteFolderView )
527 mFavoriteFolderView->writeConfig();
529 geometry.writeEntry(
"MainWin", this->geometry().size() );
531 const TQValueList<int> widths = ( mLongFolderList ? mPanner1 : mPanner2 )->sizes();
532 const TQValueList<int> heights = ( mLongFolderList ? mPanner2 : mPanner1 )->sizes();
534 geometry.writeEntry(
"FolderPaneWidth", widths[0] );
535 geometry.writeEntry(
"HeaderPaneWidth", widths[1] );
538 if ( mSearchAndHeaders && mSearchAndHeaders->isShown() ) {
539 geometry.writeEntry(
"HeaderPaneHeight", heights[0] );
540 geometry.writeEntry(
"ReaderPaneHeight", heights[1] );
544 geometry.writeEntry(
"UnreadColumn", mFolderTree->unreadIndex() );
545 geometry.writeEntry(
"TotalColumn", mFolderTree->totalIndex() );
546 geometry.writeEntry(
"SizeColumn", mFolderTree->sizeIndex() );
551void KMMainWidget::createWidgets(
void)
554 TQWidget *headerParent =
nullptr,
555 *mimeParent =
nullptr, *messageParent =
nullptr;
557 const bool opaqueResize = TDEGlobalSettings::opaqueResize();
558 if ( mLongFolderList ) {
561 mPanner1 =
new TQSplitter( TQt::Horizontal,
this,
"panner 1" );
562 mPanner1->setOpaqueResize( opaqueResize );
563 TQt::Orientation orientation = mReaderWindowBelow ? TQt::Vertical : TQt::Horizontal;
564 mPanner2 =
new TQSplitter( orientation, mPanner1,
"panner 2" );
565 mPanner2->setOpaqueResize( opaqueResize );
566 mPanner2->setChildrenCollapsible(
false );
567 mFolderViewParent = mPanner1;
568 headerParent = mimeParent = messageParent = mPanner2;
572 mPanner1 =
new TQSplitter( TQt::Vertical,
this,
"panner 1" );
573 mPanner1->setOpaqueResize( opaqueResize );
574 mPanner1->setChildrenCollapsible(
false );
575 mPanner2 =
new TQSplitter( TQt::Horizontal, mPanner1,
"panner 2" );
576 mPanner2->setOpaqueResize( opaqueResize );
577 headerParent = mFolderViewParent = mPanner2;
578 mimeParent = messageParent = mPanner1;
582 if( mPanner1 ) mPanner1->dumpObjectTree();
583 if( mPanner2 ) mPanner2->dumpObjectTree();
586 mTopLayout->add( mPanner1 );
594 headerParent->dumpObjectTree();
596 mSearchAndHeaders =
new TQVBox( headerParent );
597 mSearchToolBar =
new TDEToolBar( mSearchAndHeaders,
"search toolbar");
598 mSearchToolBar->setMovingEnabled(
false);
599 mSearchToolBar->boxLayout()->setSpacing( KDialog::spacingHint() );
600 TQLabel *label =
new TQLabel( i18n(
"S&earch:"), mSearchToolBar,
"tde toolbar widget" );
603 mHeaders =
new KMHeaders(
this, mSearchAndHeaders,
"headers");
606 actionCollection(),
"headers quick search line" );
608 mQuickSearchLine =
new HeaderListQuickSearch( mSearchToolBar, mHeaders,
609 actionCollection(),
"headers quick search line" );
611 label->setBuddy( mQuickSearchLine );
612 connect( mQuickSearchLine, TQ_SIGNAL( requestFullSearch() ),
613 this, TQ_SLOT( slotRequestFullSearchFromQuickSearch() ) );
614 mSearchToolBar->setStretchableWidget( mQuickSearchLine );
615 connect( mHeaders, TQ_SIGNAL( messageListUpdated() ),
616 mQuickSearchLine, TQ_SLOT( updateSearch() ) );
617 if ( !GlobalSettings::self()->quickSearchActive() ) mSearchToolBar->hide();
619 if (mReaderWindowActive) {
620 connect(mHeaders, TQ_SIGNAL(selected(
KMMessage*)),
621 this, TQ_SLOT(slotMsgSelected(
KMMessage*)));
623 connect(mHeaders, TQ_SIGNAL(activated(
KMMessage*)),
624 this, TQ_SLOT(slotMsgActivated(
KMMessage*)));
625 connect( mHeaders, TQ_SIGNAL( selectionChanged() ),
626 TQ_SLOT( startUpdateMessageActionsTimer() ) );
627 TQAccel *accel = actionCollection()->tdeaccel();
628 accel->connectItem(accel->insertItem(SHIFT+Key_Left),
629 mHeaders, TQ_SLOT(selectPrevMessage()));
630 accel->connectItem(accel->insertItem(SHIFT+Key_Right),
631 mHeaders, TQ_SLOT(selectNextMessage()));
633 if (mReaderWindowActive) {
634 mMsgView =
new KMReaderWin(messageParent,
this, actionCollection(),
nullptr );
636 mMsgActions->setMessageView( mMsgView );
639 connect(mMsgView, TQ_SIGNAL(replaceMsgByUnencryptedVersion()),
640 this, TQ_SLOT(slotReplaceMsgByUnencryptedVersion()));
641 connect(mMsgView, TQ_SIGNAL(popupMenu(
KMMessage&,
const KURL&,
const TQPoint&)),
642 this, TQ_SLOT(slotMsgPopup(
KMMessage&,
const KURL&,
const TQPoint&)));
643 connect(mMsgView, TQ_SIGNAL(urlClicked(
const KURL&,
int)),
644 mMsgView, TQ_SLOT(slotUrlClicked()));
645 connect(mHeaders, TQ_SIGNAL(maybeDeleting()),
646 mMsgView, TQ_SLOT(clearCache()));
647 connect(mMsgView, TQ_SIGNAL(noDrag()),
648 mHeaders, TQ_SLOT(slotNoDrag()));
649 accel->connectItem(accel->insertItem(Key_Up),
650 mMsgView, TQ_SLOT(slotScrollUp()));
651 accel->connectItem(accel->insertItem(Key_Down),
652 mMsgView, TQ_SLOT(slotScrollDown()));
653 accel->connectItem(accel->insertItem(Key_Prior),
654 mMsgView, TQ_SLOT(slotScrollPrior()));
655 accel->connectItem(accel->insertItem(Key_Next),
656 mMsgView, TQ_SLOT(slotScrollNext()));
663 mMoveMsgToFolderAction =
new TDEAction( i18n(
"Move Message to Folder"), Key_M,
this,
664 TQ_SLOT(slotMoveMsg()), actionCollection(),
665 "move_message_to_folder" );
666 mMoveMsgToFolderAction->plugAccel( actionCollection()->tdeaccel() );
668 action =
new TDEAction( i18n(
"Copy Message to Folder"), Key_C,
this,
669 TQ_SLOT(slotCopyMsg()), actionCollection(),
670 "copy_message_to_folder" );
671 action->plugAccel( actionCollection()->tdeaccel() );
673 action =
new TDEAction( i18n(
"Jump to Folder"), Key_J,
this,
674 TQ_SLOT(slotJumpToFolder()), actionCollection(),
676 action->plugAccel( actionCollection()->tdeaccel() );
679 mFolderViewSplitter =
new TQSplitter( TQt::Vertical, mFolderViewParent );
680 mFolderViewSplitter->setOpaqueResize( TDEGlobalSettings::opaqueResize() );
681 mFavoriteFolderView =
new KMail::FavoriteFolderView(
this, mFolderViewSplitter );
682 if ( mFavoritesCheckMailAction )
683 connect( mFavoritesCheckMailAction, TQ_SIGNAL(activated()), mFavoriteFolderView, TQ_SLOT(checkMail()) );
684 TQWidget *folderTreeParent = mFolderViewParent;
685 if ( GlobalSettings::enableFavoriteFolderView() ) {
686 folderTreeParent = mFolderViewSplitter;
687 mFolderView = mFolderViewSplitter;
689 mFolderTree =
new KMFolderTree(
this, folderTreeParent,
"folderTree");
690 if ( !GlobalSettings::enableFavoriteFolderView() ) {
691 mFolderView = mFolderTree;
693 connect( mFolderTree, TQ_SIGNAL(folderSelected(
KMFolder*)),
694 mFavoriteFolderView, TQ_SLOT(folderTreeSelectionChanged(
KMFolder*)) );
696 connect(mFolderTree, TQ_SIGNAL(folderSelected(
KMFolder*)),
697 this, TQ_SLOT(folderSelected(
KMFolder*)));
698 connect( mFolderTree, TQ_SIGNAL( folderSelected(
KMFolder* ) ),
699 mQuickSearchLine, TQ_SLOT( reset() ) );
700 connect(mFolderTree, TQ_SIGNAL(folderSelectedUnread(
KMFolder*)),
701 this, TQ_SLOT(folderSelectedUnread(
KMFolder*)));
702 connect(mFolderTree, TQ_SIGNAL(folderDrop(
KMFolder*)),
703 this, TQ_SLOT(slotMoveMsgToFolder(
KMFolder*)));
704 connect(mFolderTree, TQ_SIGNAL(folderDropCopy(
KMFolder*)),
705 this, TQ_SLOT(slotCopyMsgToFolder(
KMFolder*)));
706 connect(mFolderTree, TQ_SIGNAL(columnsChanged()),
707 this, TQ_SLOT(slotFolderTreeColumnsChanged()));
709 if ( mFavoriteFolderView ) {
710 connect( mFavoriteFolderView, TQ_SIGNAL(folderDrop(
KMFolder*)), TQ_SLOT(slotMoveMsgToFolder(
KMFolder*)) );
711 connect( mFavoriteFolderView, TQ_SIGNAL(folderDropCopy(
KMFolder*)), TQ_SLOT(slotCopyMsgToFolder(
KMFolder*)) );
715 mRemoveDuplicatesAction =
new TDEAction(
716 i18n(
"Remove Duplicate Messages"), CTRL+Key_Asterisk,
this,
717 TQ_SLOT(removeDuplicates()), actionCollection(),
"remove_duplicate_messages");
718 action->plugAccel( actionCollection()->tdeaccel() );
720 action =
new TDEAction(
721 i18n(
"Abort Current Operation"), Key_Escape, ProgressManager::instance(),
722 TQ_SLOT(slotAbortAll()), actionCollection(),
"cancel" );
723 action->plugAccel( actionCollection()->tdeaccel() );
725 action =
new TDEAction(
726 i18n(
"Focus on Next Folder"), CTRL+Key_Right, mFolderTree,
727 TQ_SLOT(incCurrentFolder()), actionCollection(),
"inc_current_folder");
728 action->plugAccel( actionCollection()->tdeaccel() );
730 action =
new TDEAction(
731 i18n(
"Focus on Previous Folder"), CTRL+Key_Left, mFolderTree,
732 TQ_SLOT(decCurrentFolder()), actionCollection(),
"dec_current_folder");
733 action->plugAccel( actionCollection()->tdeaccel() );
735 action =
new TDEAction(
736 i18n(
"Select Folder with Focus"), CTRL+Key_Space, mFolderTree,
737 TQ_SLOT(selectCurrentFolder()), actionCollection(),
"select_current_folder");
738 action->plugAccel( actionCollection()->tdeaccel() );
740 action =
new TDEAction(
741 i18n(
"Focus on Next Message"), ALT+Key_Right, mHeaders,
742 TQ_SLOT(incCurrentMessage()), actionCollection(),
"inc_current_message");
743 action->plugAccel( actionCollection()->tdeaccel() );
745 action =
new TDEAction(
746 i18n(
"Focus on Previous Message"), ALT+Key_Left, mHeaders,
747 TQ_SLOT(decCurrentMessage()), actionCollection(),
"dec_current_message");
748 action->plugAccel( actionCollection()->tdeaccel() );
750 action =
new TDEAction(
751 i18n(
"Select Message with Focus"), ALT+Key_Space, mHeaders,
752 TQ_SLOT( selectCurrentMessage() ), actionCollection(),
"select_current_message");
753 action->plugAccel( actionCollection()->tdeaccel() );
755 connect( kmkernel->outboxFolder(), TQ_SIGNAL( msgRemoved(
int, TQString) ),
756 TQ_SLOT( startUpdateMessageActionsTimer() ) );
757 connect( kmkernel->outboxFolder(), TQ_SIGNAL( msgAdded(
int) ),
758 TQ_SLOT( startUpdateMessageActionsTimer() ) );
763void KMMainWidget::activatePanners(
void)
766 TQObject::disconnect( mMsgView->copyAction(),
767 TQ_SIGNAL( activated() ),
768 mMsgView, TQ_SLOT( slotCopySelectedText() ));
772 if ( mLongFolderList ) {
773 mSearchAndHeaders->reparent( mPanner2, 0, TQPoint( 0, 0 ) );
775 mMsgView->reparent( mPanner2, 0, TQPoint( 0, 0 ) );
776 mPanner2->moveToLast( mMsgView );
778 mFolderViewParent = mPanner1;
779 mFolderView->reparent( mFolderViewParent, 0, TQPoint( 0, 0 ) );
780 mPanner1->moveToLast( mPanner2 );
781 mPanner1->setSizes( mPanner1Sep );
782 mPanner1->setResizeMode( mFolderView, TQSplitter::KeepSize );
783 mPanner2->setSizes( mPanner2Sep );
784 mPanner2->setResizeMode( mSearchAndHeaders, TQSplitter::KeepSize );
786 mFolderViewParent = mPanner2;
787 mFolderView->reparent( mFolderViewParent, 0, TQPoint( 0, 0 ) );
788 mSearchAndHeaders->reparent( mPanner2, 0, TQPoint( 0, 0 ) );
789 mPanner2->moveToLast( mSearchAndHeaders );
790 mPanner1->moveToFirst( mPanner2 );
792 mMsgView->reparent( mPanner1, 0, TQPoint( 0, 0 ) );
793 mPanner1->moveToLast( mMsgView );
795 mPanner1->setSizes( mPanner1Sep );
796 mPanner2->setSizes( mPanner2Sep );
797 mPanner1->setResizeMode( mPanner2, TQSplitter::KeepSize );
798 mPanner2->setResizeMode( mFolderView, TQSplitter::KeepSize );
802 TQObject::connect( mMsgView->copyAction(),
803 TQ_SIGNAL( activated() ),
804 mMsgView, TQ_SLOT( slotCopySelectedText() ));
810void KMMainWidget::hide()
817void KMMainWidget::show()
823void KMMainWidget::slotSearch()
827 mSearchWin =
new SearchWindow(
this,
"Search", mFolder,
false);
828 connect(mSearchWin, TQ_SIGNAL(destroyed()),
829 this, TQ_SLOT(slotSearchClosed()));
833 mSearchWin->activateFolder(mFolder);
837 KWin::activateWindow( mSearchWin->winId() );
842void KMMainWidget::slotSearchClosed()
844 mSearchWin =
nullptr;
849void KMMainWidget::slotFind()
852 mMsgView->slotFind();
857void KMMainWidget::slotHelp()
859 tdeApp->invokeHelp();
864void KMMainWidget::slotFilter()
866 kmkernel->filterMgr()->openDialog(
this );
871void KMMainWidget::slotPopFilter()
873 kmkernel->popFilterMgr()->openDialog(
this );
876void KMMainWidget::slotManageSieveScripts()
878 if ( !kmkernel->askToGoOnline() ) {
881 KMail::ManageSieveScriptsDialog * dlg =
new KMail::ManageSieveScriptsDialog(
this );
887void KMMainWidget::slotAddrBook()
889 KAddrBookExternal::openAddressBook(
this);
894void KMMainWidget::slotImport()
896 KRun::runCommand(
"kmailcvt");
900void KMMainWidget::slotCheckMail()
902 if ( !kmkernel->askToGoOnline() ) {
905 kmkernel->acctMgr()->checkMail(
true);
909void KMMainWidget::slotCheckOneAccount(
int item)
911 if ( !kmkernel->askToGoOnline() ) {
914 kmkernel->acctMgr()->intCheckMail(item);
918void KMMainWidget::slotMailChecked(
bool newMail,
bool sendOnCheck,
919 const TQMap<TQString, int> & newInFolder )
921 const bool sendOnAll =
922 GlobalSettings::self()->sendOnCheck() == GlobalSettings::EnumSendOnCheck::SendOnAllChecks;
923 const bool sendOnManual =
924 GlobalSettings::self()->sendOnCheck() == GlobalSettings::EnumSendOnCheck::SendOnManualChecks;
925 if( !kmkernel->isOffline() && ( sendOnAll || (sendOnManual && sendOnCheck ) ) )
928 if ( !newMail || newInFolder.isEmpty() )
931 tdeApp->dcopClient()->emitDCOPSignal(
"unreadCountChanged()", TQByteArray() );
934 bool showNotification =
false;
936 TQStringList keys( newInFolder.keys() );
938 for ( TQStringList::const_iterator it = keys.begin();
941 kdDebug(5006) << newInFolder.find( *it ).data() <<
" new message(s) in "
944 KMFolder *folder = kmkernel->findFolderById( *it );
947 showNotification =
true;
948 if ( GlobalSettings::self()->verboseNewMailNotification() ) {
949 summary +=
"<br>" + i18n(
"1 new message in %1",
950 "%n new messages in %1",
951 newInFolder.find( *it ).data() )
961 if ( !showNotification )
964 if ( GlobalSettings::self()->verboseNewMailNotification() ) {
965 summary = i18n(
"%1 is a list of the number of new messages per folder",
966 "<b>New mail arrived</b><br>%1" )
970 summary = i18n(
"New mail arrived" );
973 if(kmkernel->xmlGuiInstance()) {
974 KNotifyClient::Instance instance(kmkernel->xmlGuiInstance());
975 KNotifyClient::event( topLevelWidget()->winId(),
"new-mail-arrived",
979 KNotifyClient::event( topLevelWidget()->winId(),
"new-mail-arrived",
983 KNotifyClient::beep();
989void KMMainWidget::slotCompose()
991 KMail::Composer * win;
997 parser.process(
nullptr, mFolder );
998 win = KMail::makeComposer( msg, mFolder->identity() );
1002 parser.process(
nullptr,
nullptr );
1003 win = KMail::makeComposer( msg );
1012void KMMainWidget::slotShowNewFromTemplate()
1015 const KPIM::Identity & ident =
1016 kmkernel->identityManager()->identityForUoidOrDefault( mFolder->identity() );
1017 mTemplateFolder = kmkernel->folderMgr()->findIdString( ident.templates() );
1019 else mTemplateFolder = kmkernel->templatesFolder();
1020 if ( !mTemplateFolder )
1023 mTemplateMenu->popupMenu()->clear();
1024 for (
int idx = 0; idx<mTemplateFolder->count(); ++idx ) {
1025 KMMsgBase *mb = mTemplateFolder->getMsgBase( idx );
1027 TQString subj = mb->subject();
1028 if ( subj.isEmpty() ) subj = i18n(
"No Subject");
1029 mTemplateMenu->popupMenu()->insertItem(
1030 KStringHandler::rsqueeze( subj.replace(
"&",
"&&" ) ), idx );
1035void KMMainWidget::slotNewFromTemplate(
int id )
1037 if ( !mTemplateFolder )
1039 newFromTemplate(mTemplateFolder->getMsg(
id ) );
1043void KMMainWidget::newFromTemplate(
KMMessage *msg )
1047 KMCommand *command =
new KMUseTemplateCommand(
this, msg );
1052void KMMainWidget::slotPostToML()
1054 if ( mFolder && mFolder->isMailingListEnabled() ) {
1055 KMCommand *command =
new KMMailingListPostCommand(
this, mFolder );
1063void KMMainWidget::slotFolderMailingListProperties()
1065 if (!mFolderTree)
return;
1066 KMFolderTreeItem *item =
static_cast<KMFolderTreeItem*
>( mFolderTree->currentItem() );
1067 if ( !item )
return;
1070 (
new KMail::MailingListFolderPropertiesDialog(
this, folder ) )->show();
1075void KMMainWidget::slotFolderShortcutCommand()
1077 if (!mFolderTree)
return;
1078 KMFolderTreeItem *item =
static_cast<KMFolderTreeItem*
>( mFolderTree->currentItem() );
1080 item->assignShortcut();
1085void KMMainWidget::slotModifyFolder()
1087 if (!mFolderTree)
return;
1088 KMFolderTreeItem *item =
static_cast<KMFolderTreeItem*
>( mFolderTree->currentItem() );
1090 modifyFolder( item );
1094void KMMainWidget::modifyFolder( KMFolderTreeItem* folderItem )
1096 KMFolder* folder = folderItem->folder();
1097 KMFolderTree* folderTree =
static_cast<KMFolderTree *
>( folderItem->listView() );
1099 i18n(
"Properties of Folder %1").arg( folder->
label() ) );
1104 mSystemTray->foldersChanged();
1108void KMMainWidget::slotExpireFolder()
1111 bool canBeExpired =
true;
1113 if (!mFolder)
return;
1115 if (!mFolder->isAutoExpire()) {
1116 canBeExpired =
false;
1117 }
else if (mFolder->getUnreadExpireUnits()==expireNever &&
1118 mFolder->getReadExpireUnits()==expireNever) {
1119 canBeExpired =
false;
1122 if (!canBeExpired) {
1123 str = i18n(
"This folder does not have any expiry options set");
1124 KMessageBox::information(
this, str);
1127 TDEConfig *config = KMKernel::config();
1128 TDEConfigGroupSaver saver(config,
"General");
1130 if (config->readBoolEntry(
"warn-before-expire",
true)) {
1131 str = i18n(
"<qt>Are you sure you want to expire the folder <b>%1</b>?</qt>").arg(TQStyleSheet::escape( mFolder->label() ));
1132 if (KMessageBox::warningContinueCancel(
this, str, i18n(
"Expire Folder"),
1134 != KMessageBox::Continue)
return;
1137 mFolder->expireOldMessages(
true );
1141void KMMainWidget::slotEmptyFolder()
1145 if (!mFolder)
return;
1146 bool isTrash = kmkernel->folderIsTrash(mFolder);
1150 TQString title = (isTrash) ? i18n(
"Empty Trash") : i18n(
"Move to Trash");
1151 TQString text = (isTrash) ?
1152 i18n(
"Are you sure you want to empty the trash folder?") :
1153 i18n(
"<qt>Are you sure you want to move all messages from "
1154 "folder <b>%1</b> to the trash?</qt>").arg( TQStyleSheet::escape( mFolder->label() ) );
1156 if (KMessageBox::warningContinueCancel(
this, text, title, KGuiItem( title,
"edittrash"))
1157 != KMessageBox::Continue)
return;
1164 slotDeleteMsg(
false );
1169 if (mMsgView) mMsgView->clearCache();
1172 BroadcastStatus::instance()->setStatusMsg(i18n(
"Moved all messages to the trash"));
1174 updateMessageActions();
1178 mEmptyFolderAction->setEnabled(
false );
1182void KMMainWidget::slotArchiveFolder()
1184 KMail::ArchiveFolderDialog archiveDialog;
1185 archiveDialog.setFolder( mFolder );
1186 archiveDialog.exec();
1190void KMMainWidget::slotRemoveFolder()
1195 if ( !mFolder )
return;
1196 if ( mFolder->isSystemFolder() )
return;
1197 if ( mFolder->isReadOnly() )
return;
1198 if ( mFolder->mailCheckInProgress() ) {
1199 KMessageBox::sorry(
this, i18n(
"It is not possible to delete this folder right now because it "
1200 "is being syncronized. Please wait until the syncronization of "
1201 "this folder is complete and then try again." ),
1202 i18n(
"Unable to delete folder" ) );
1207 if ( mFolder->folderType() == KMFolderTypeSearch ) {
1208 title = i18n(
"Delete Search");
1209 str = i18n(
"<qt>Are you sure you want to delete the search <b>%1</b>?<br>"
1210 "Any messages it shows will still be available in their original folder.</qt>")
1211 .arg( TQStyleSheet::escape( mFolder->label() ) );
1213 title = i18n(
"Delete Folder");
1214 if ( mFolder->count() == 0 ) {
1215 if ( !mFolder->child() || mFolder->child()->isEmpty() ) {
1216 str = i18n(
"<qt>Are you sure you want to delete the empty folder "
1218 .arg( TQStyleSheet::escape( mFolder->label() ) );
1221 str = i18n(
"<qt>Are you sure you want to delete the empty folder "
1222 "<b>%1</b> and all its subfolders? Those subfolders might "
1223 "not be empty and their contents will be discarded as well. "
1224 "<p><b>Beware</b> that discarded messages are not saved "
1225 "into your Trash folder and are permanently deleted.</qt>")
1226 .arg( TQStyleSheet::escape( mFolder->label() ) );
1229 if ( !mFolder->child() || mFolder->child()->isEmpty() ) {
1230 str = i18n(
"<qt>Are you sure you want to delete the folder "
1231 "<b>%1</b>, discarding its contents? "
1232 "<p><b>Beware</b> that discarded messages are not saved "
1233 "into your Trash folder and are permanently deleted.</qt>")
1234 .arg( TQStyleSheet::escape( mFolder->label() ) );
1237 str = i18n(
"<qt>Are you sure you want to delete the folder <b>%1</b> "
1238 "and all its subfolders, discarding their contents? "
1239 "<p><b>Beware</b> that discarded messages are not saved "
1240 "into your Trash folder and are permanently deleted.</qt>")
1241 .arg( TQStyleSheet::escape( mFolder->label() ) );
1246 if (KMessageBox::warningContinueCancel(
this, str, title,
1247 KGuiItem( i18n(
"&Delete"),
"edit-delete"))
1248 == KMessageBox::Continue)
1250 KMail::FolderUtil::deleteFolder( mFolder,
this );
1255void KMMainWidget::slotMarkAllAsRead()
1259 mFolder->markUnreadAsRead();
1263void KMMainWidget::slotCompactFolder()
1266 int idx = mHeaders->currentItemIndex();
1268 mFolder->compact( KMFolder::CompactNow );
1270 TQString statusMsg = BroadcastStatus::instance()->statusMsg();
1271 mHeaders->setCurrentItemByIndex(idx);
1272 BroadcastStatus::instance()->setStatusMsg( statusMsg );
1278void KMMainWidget::slotRefreshFolder()
1282 if ( mFolder->folderType() == KMFolderTypeImap || mFolder->folderType() == KMFolderTypeCachedImap ) {
1283 if ( !kmkernel->askToGoOnline() ) {
1288 if (mFolder->folderType() == KMFolderTypeImap)
1290 KMFolderImap *imap =
static_cast<KMFolderImap*
>(mFolder->storage());
1291 imap->getAndCheckFolder();
1292 }
else if ( mFolder->folderType() == KMFolderTypeCachedImap ) {
1293 KMFolderCachedImap* f =
static_cast<KMFolderCachedImap*
>( mFolder->storage() );
1294 f->account()->processNewMailInFolder( mFolder );
1299void KMMainWidget::slotTroubleshootFolder()
1303 if ( mFolder->folderType() == KMFolderTypeCachedImap ) {
1304 KMFolderCachedImap* f =
static_cast<KMFolderCachedImap*
>( mFolder->storage() );
1305 f->slotTroubleshoot();
1310void KMMainWidget::slotInvalidateIMAPFolders() {
1311 if ( KMessageBox::warningContinueCancel(
this,
1312 i18n(
"Are you sure you want to refresh the IMAP cache?\n"
1313 "This will remove all changes that you have done "
1314 "locally to your IMAP folders."),
1315 i18n(
"Refresh IMAP Cache"), i18n(
"&Refresh") ) == KMessageBox::Continue )
1316 kmkernel->acctMgr()->invalidateIMAPFolders();
1320void KMMainWidget::slotExpireAll() {
1321 TDEConfig *config = KMKernel::config();
1324 TDEConfigGroupSaver saver(config,
"General");
1326 if (config->readBoolEntry(
"warn-before-expire",
true)) {
1327 ret = KMessageBox::warningContinueCancel(TDEMainWindow::memberList->first(),
1328 i18n(
"Are you sure you want to expire all old messages?"),
1329 i18n(
"Expire Old Messages?"), i18n(
"Expire"));
1330 if (ret != KMessageBox::Continue) {
1335 kmkernel->expireAllFoldersNow();
1339void KMMainWidget::slotCompactAll()
1342 kmkernel->compactAllFolders();
1347void KMMainWidget::slotOverrideHtml()
1349 if( mHtmlPref == mFolderHtmlPref ) {
1350 int result = KMessageBox::warningContinueCancel(
this,
1352 i18n(
"Use of HTML in mail will make you more vulnerable to "
1353 "\"spam\" and may increase the likelihood that your system will be "
1354 "compromised by other present and anticipated security exploits." ),
1355 i18n(
"Security Warning" ),
1357 "OverrideHtmlWarning",
false);
1358 if( result == KMessageBox::Cancel ) {
1359 mPreferHtmlAction->setChecked(
false );
1363 mFolderHtmlPref = !mFolderHtmlPref;
1365 mMsgView->setHtmlOverride(mFolderHtmlPref);
1366 mMsgView->update(
true );
1371void KMMainWidget::slotOverrideHtmlLoadExt()
1373 if( mHtmlLoadExtPref == mFolderHtmlLoadExtPref ) {
1374 int result = KMessageBox::warningContinueCancel(
this,
1376 i18n(
"Loading external references in html mail will make you more vulnerable to "
1377 "\"spam\" and may increase the likelihood that your system will be "
1378 "compromised by other present and anticipated security exploits." ),
1379 i18n(
"Security Warning" ),
1380 i18n(
"Load External References" ),
1381 "OverrideHtmlLoadExtWarning",
false);
1382 if( result == KMessageBox::Cancel ) {
1383 mPreferHtmlLoadExtAction->setChecked(
false );
1387 mFolderHtmlLoadExtPref = !mFolderHtmlLoadExtPref;
1389 mMsgView->setHtmlLoadExtDefault(mFolderHtmlLoadExtPref);
1390 mMsgView->update(
true );
1395void KMMainWidget::slotOverrideThread()
1397 mFolderThreadPref = !mFolderThreadPref;
1398 mHeaders->setNestedOverride(mFolderThreadPref);
1399 mThreadBySubjectAction->setEnabled(mThreadMessagesAction->isChecked());
1403void KMMainWidget::slotToggleSubjectThreading()
1405 mFolderThreadSubjPref = !mFolderThreadSubjPref;
1406 mHeaders->setSubjectThreading(mFolderThreadSubjPref);
1410void KMMainWidget::slotToggleShowQuickSearch()
1412 GlobalSettings::self()->setQuickSearchActive( !GlobalSettings::self()->quickSearchActive() );
1413 if ( GlobalSettings::self()->quickSearchActive() )
1414 mSearchToolBar->show();
1416 mQuickSearchLine->reset();
1417 mSearchToolBar->hide();
1422void KMMainWidget::slotMessageQueuedOrDrafted()
1424 if (!kmkernel->folderIsDraftOrOutbox(mFolder))
1427 mMsgView->update(
true);
1432void KMMainWidget::slotForwardInlineMsg()
1434 KMMessageList* selected = mHeaders->selectedMsgs();
1435 KMCommand *command =
nullptr;
1436 if(selected && !selected->isEmpty()) {
1437 command =
new KMForwardInlineCommand(
this, *selected,
1438 mFolder->identity() );
1440 command =
new KMForwardInlineCommand(
this, mHeaders->currentMsg(),
1441 mFolder->identity() );
1449void KMMainWidget::slotForwardAttachedMsg()
1451 KMMessageList* selected = mHeaders->selectedMsgs();
1452 KMCommand *command =
nullptr;
1453 if(selected && !selected->isEmpty()) {
1454 command =
new KMForwardAttachedCommand(
this, *selected, mFolder->identity() );
1456 command =
new KMForwardAttachedCommand(
this, mHeaders->currentMsg(), mFolder->identity() );
1463void KMMainWidget::slotForwardDigestMsg()
1465 KMMessageList* selected = mHeaders->selectedMsgs();
1466 KMCommand *command =
nullptr;
1467 if(selected && !selected->isEmpty()) {
1468 command =
new KMForwardDigestCommand(
this, *selected, mFolder->identity() );
1470 command =
new KMForwardDigestCommand(
this, mHeaders->currentMsg(), mFolder->identity() );
1477void KMMainWidget::slotUseTemplate()
1479 newFromTemplate( mHeaders->currentMsg() );
1483void KMMainWidget::slotResendMsg()
1485 KMCommand *command =
new KMResendMessageCommand(
this, mHeaders->currentMsg() );
1491void KMMainWidget::slotTrashMsg()
1493 mHeaders->deleteMsg();
1497void KMMainWidget::slotDeleteMsg(
bool confirmDelete )
1499 mHeaders->moveMsgToFolder(
nullptr, confirmDelete );
1503void KMMainWidget::slotTrashThread()
1505 mHeaders->highlightCurrentThread();
1506 mHeaders->deleteMsg();
1510void KMMainWidget::slotDeleteThread(
bool confirmDelete )
1512 mHeaders->highlightCurrentThread();
1513 mHeaders->moveMsgToFolder(
nullptr, confirmDelete );
1517void KMMainWidget::slotRedirectMsg()
1519 KMCommand *command =
new KMRedirectCommand(
this, mHeaders->currentMsg() );
1525void KMMainWidget::slotCustomReplyToMsg(
int tid )
1527 TQString text = mMsgView? mMsgView->copyText() :
"";
1528 TQString tmpl = mCustomTemplates[ tid ];
1529 kdDebug() <<
"Reply with template: " << tmpl <<
" (" << tid <<
")" << endl;
1530 KMCommand *command =
new KMCustomReplyToCommand(
this,
1531 mHeaders->currentMsg(),
1539void KMMainWidget::slotCustomReplyAllToMsg(
int tid )
1541 TQString text = mMsgView? mMsgView->copyText() :
"";
1542 TQString tmpl = mCustomTemplates[ tid ];
1543 kdDebug() <<
"Reply to All with template: " << tmpl <<
" (" << tid <<
")" << endl;
1544 KMCommand *command =
new KMCustomReplyAllToCommand(
this,
1545 mHeaders->currentMsg(),
1553void KMMainWidget::slotCustomForwardMsg(
int tid )
1555 TQString tmpl = mCustomTemplates[ tid ];
1556 kdDebug() <<
"Forward with template: " << tmpl <<
" (" << tid <<
")" << endl;
1557 KMMessageList* selected = mHeaders->selectedMsgs();
1558 KMCommand *command =
nullptr;
1559 if(selected && !selected->isEmpty()) {
1560 command =
new KMCustomForwardCommand(
this, *selected,
1561 mFolder->identity(), tmpl );
1563 command =
new KMCustomForwardCommand(
this, mHeaders->currentMsg(),
1564 mFolder->identity(), tmpl );
1571void KMMainWidget::slotNoQuoteReplyToMsg()
1573 KMCommand *command =
new KMNoQuoteReplyToCommand(
this, mHeaders->currentMsg() );
1578void KMMainWidget::slotSubjectFilter()
1580 KMMessage *msg = mHeaders->currentMsg();
1584 KMCommand *command =
new KMFilterCommand(
"Subject", msg->
subject() );
1589void KMMainWidget::slotMailingListFilter()
1591 KMMessage *msg = mHeaders->currentMsg();
1595 KMCommand *command =
new KMMailingListFilterCommand(
this, msg );
1600void KMMainWidget::slotFromFilter()
1602 KMMessage *msg = mHeaders->currentMsg();
1606 AddrSpecList al = msg->extractAddrSpecs(
"From" );
1609 command =
new KMFilterCommand(
"From", msg->
from() );
1611 command =
new KMFilterCommand(
"From", al.front().asString() );
1616void KMMainWidget::slotToFilter()
1618 KMMessage *msg = mHeaders->currentMsg();
1622 KMCommand *command =
new KMFilterCommand(
"To", msg->
to() );
1627void KMMainWidget::updateListFilterAction()
1632 TQString lname = MailingList::name( mHeaders->currentMsg(), name, value );
1633 mListFilterAction->setText( i18n(
"Filter on Mailing-List...") );
1634 if ( lname.isNull() )
1635 mListFilterAction->setEnabled(
false );
1637 mListFilterAction->setEnabled(
true );
1638 mListFilterAction->setText( i18n(
"Filter on Mailing-List %1..." ).arg( lname ) );
1644void KMMainWidget::slotUndo()
1647 updateMessageActions();
1652void KMMainWidget::slotToggleUnread()
1654 mFolderTree->toggleColumn(KMFolderTree::unread);
1658void KMMainWidget::slotToggleTotalColumn()
1660 mFolderTree->toggleColumn(KMFolderTree::total,
true);
1664void KMMainWidget::slotToggleSizeColumn()
1666 mFolderTree->toggleColumn(KMFolderTree::foldersize);
1671void KMMainWidget::slotJumpToFolder()
1673 KMail::KMFolderSelDlg dlg(
this, i18n(
"Jump to Folder"),
true );
1676 if (!dlg.exec())
return;
1677 if (!(dest = dlg.folder()))
return;
1679 slotSelectFolder( dest );
1683void KMMainWidget::slotMoveMsg()
1685 KMail::KMFolderSelDlg dlg(
this, i18n(
"Move Message to Folder"),
true );
1688 if (!dlg.exec())
return;
1689 if (!(dest = dlg.folder()))
return;
1691 mHeaders->moveMsgToFolder(dest);
1695void KMMainWidget::slotMoveMsgToFolder(
KMFolder *dest)
1697 mHeaders->moveMsgToFolder(dest);
1701void KMMainWidget::slotCopyMsgToFolder(
KMFolder *dest)
1703 mHeaders->copyMsgToFolder(dest);
1707void KMMainWidget::slotApplyFilters()
1709 mHeaders->applyFiltersOnMsg();
1713void KMMainWidget::slotCheckVacation()
1715 updateVactionScripStatus(
false );
1716 if ( !kmkernel->askToGoOnline() )
1719 Vacation *vac =
new Vacation(
this,
true );
1720 connect( vac, TQ_SIGNAL(scriptActive(
bool)), TQ_SLOT(updateVactionScripStatus(
bool)) );
1723void KMMainWidget::slotEditVacation()
1725 if ( !kmkernel->askToGoOnline() ) {
1732 mVacation =
new Vacation(
this );
1733 connect( mVacation, TQ_SIGNAL(scriptActive(
bool)), TQ_SLOT(updateVactionScripStatus(
bool)) );
1734 if ( mVacation->isUsable() ) {
1735 connect( mVacation, TQ_SIGNAL(result(
bool)), mVacation, TQ_SLOT(deleteLater()) );
1737 TQString msg = i18n(
"KMail's Out of Office Reply functionality relies on "
1738 "server-side filtering. You have not yet configured an "
1739 "IMAP server for this.\n"
1740 "You can do this on the \"Filtering\" tab of the IMAP "
1741 "account configuration.");
1742 KMessageBox::sorry(
this, msg, i18n(
"No Server-Side Filtering Configured") );
1749void KMMainWidget::slotDebugSieve()
1752 if ( mSieveDebugDialog )
1756 mSieveDebugDialog->exec();
1757 delete mSieveDebugDialog;
1762void KMMainWidget::slotStartCertManager()
1764 TDEProcess certManagerProc;
1766 certManagerProc <<
"kleopatra";
1768 if( !certManagerProc.start( TDEProcess::DontCare ) )
1769 KMessageBox::error(
this, i18n(
"Could not start certificate manager 'kleopatra'; "
1770 "please check your installation." ),
1771 i18n(
"KMail Error" ) );
1773 kdDebug(5006) << endl
1774 <<
"slotStartCertManager(): certificate manager started." << endl;
1781void KMMainWidget::slotStartWatchGnuPG()
1783 TDEProcess certManagerProc;
1784 certManagerProc <<
"kwatchgnupg";
1786 if( !certManagerProc.start( TDEProcess::DontCare ) )
1787 KMessageBox::error(
this, i18n(
"Could not start GnuPG LogViewer (kwatchgnupg); "
1788 "please check your installation." ),
1789 i18n(
"KMail Error" ) );
1793void KMMainWidget::slotCopyMsg()
1795 KMail::KMFolderSelDlg dlg(
this, i18n(
"Copy Message to Folder"),
true );
1798 if (!dlg.exec())
return;
1799 if (!(dest = dlg.folder()))
return;
1801 mHeaders->copyMsgToFolder(dest);
1805void KMMainWidget::slotPrintMsg()
1807 KMMessage *msg = mHeaders->currentMsg();
1812 bool htmlOverride = mMsgView ? mMsgView->htmlOverride() :
false;
1813 bool htmlLoadExtOverride = mMsgView ? mMsgView->htmlLoadExtOverride() :
false;
1814 TDEConfigGroup reader( KMKernel::config(),
"Reader" );
1815 bool useFixedFont = mMsgView ? mMsgView->isFixedFont()
1816 : reader.readBoolEntry(
"useFixedFont",
false );
1819 const HeaderStrategy *strategy;
1821 style = mMsgView->headerStyle();
1822 strategy = mMsgView->headerStrategy();
1824 style = HeaderStyle::create( reader.readEntry(
"header-style",
"fancy" ) );
1825 strategy = HeaderStrategy::create( reader.readEntry(
"header-set-displayed",
"rich" ) );
1828 KMPrintCommand *command =
1829 new KMPrintCommand(
this, msg,
1831 htmlOverride, htmlLoadExtOverride,
1832 useFixedFont, overrideEncoding() );
1834 command->setOverrideFont( mMsgView->cssHelper()->bodyFont( mMsgView->isFixedFont(),
true ) );
1840void KMMainWidget::setupForwardActions()
1842 disconnect( mForwardActionMenu, TQ_SIGNAL( activated() ),
nullptr,
nullptr );
1843 mForwardActionMenu->remove( mForwardInlineAction );
1844 mForwardActionMenu->remove( mForwardAttachedAction );
1846 if ( GlobalSettings::self()->forwardingInlineByDefault() ) {
1847 mForwardActionMenu->insert( mForwardInlineAction, 0 );
1848 mForwardActionMenu->insert( mForwardAttachedAction, 1 );
1849 mForwardInlineAction->setShortcut( Key_F );
1850 mForwardAttachedAction->setShortcut( SHIFT+Key_F );
1851 connect( mForwardActionMenu, TQ_SIGNAL(activated()),
this,
1852 TQ_SLOT(slotForwardInlineMsg()) );
1855 mForwardActionMenu->insert( mForwardAttachedAction, 0 );
1856 mForwardActionMenu->insert( mForwardInlineAction, 1 );
1857 mForwardInlineAction->setShortcut( SHIFT+Key_F );
1858 mForwardAttachedAction->setShortcut( Key_F );
1859 connect( mForwardActionMenu, TQ_SIGNAL(activated()),
this,
1860 TQ_SLOT(slotForwardAttachedMsg()) );
1865void KMMainWidget::slotConfigChanged()
1868 setupForwardActions();
1869 setupForwardingActionsList();
1873void KMMainWidget::slotSaveMsg()
1875 KMMessage *msg = mHeaders->currentMsg();
1878 KMSaveMsgCommand *saveCommand =
new KMSaveMsgCommand(
this,
1879 *mHeaders->selectedMsgs() );
1881 if (saveCommand->url().isEmpty())
1884 saveCommand->start();
1888void KMMainWidget::slotOpenMsg()
1890 KMOpenMsgCommand *openCommand =
new KMOpenMsgCommand(
this,
nullptr, overrideEncoding() );
1892 openCommand->start();
1896void KMMainWidget::slotSaveAttachments()
1898 KMMessage *msg = mHeaders->currentMsg();
1901 KMSaveAttachmentsCommand *saveCommand =
new KMSaveAttachmentsCommand(
this,
1902 *mHeaders->selectedMsgs() );
1903 saveCommand->start();
1906void KMMainWidget::slotOnlineStatus()
1910 if ( GlobalSettings::self()->networkState() == GlobalSettings::EnumNetworkState::Online ) {
1912 kmkernel->stopNetworkJobs();
1914 kmkernel->resumeNetworkJobs();
1915 slotCheckVacation();
1919void KMMainWidget::slotUpdateOnlineStatus( GlobalSettings::EnumNetworkState::type )
1921 if ( GlobalSettings::self()->networkState() == GlobalSettings::EnumNetworkState::Online )
1922 actionCollection()->action(
"online_status" )->setText( i18n(
"Work Offline") );
1924 actionCollection()->action(
"online_status" )->setText( i18n(
"Work Online") );
1929void KMMainWidget::slotSendQueued()
1931 if ( !kmkernel->askToGoOnline() ) {
1935 kmkernel->msgSender()->sendQueued();
1939void KMMainWidget::slotSendQueuedVia(
int item )
1941 if ( !kmkernel->askToGoOnline() ) {
1946 TQString customTransport = availTransports[ item ];
1948 kmkernel->msgSender()->sendQueued( customTransport );
1952void KMMainWidget::slotViewChange()
1954 if(mBodyPartsMenu->isItemChecked(mBodyPartsMenu->idAt(0)))
1956 mBodyPartsMenu->setItemChecked(mBodyPartsMenu->idAt(0),
false);
1957 mBodyPartsMenu->setItemChecked(mBodyPartsMenu->idAt(1),
true);
1959 else if(mBodyPartsMenu->isItemChecked(mBodyPartsMenu->idAt(1)))
1961 mBodyPartsMenu->setItemChecked(mBodyPartsMenu->idAt(1),
false);
1962 mBodyPartsMenu->setItemChecked(mBodyPartsMenu->idAt(0),
true);
1970void KMMainWidget::folderSelectedUnread(
KMFolder* aFolder )
1972 folderSelected( aFolder,
true );
1973 slotChangeCaption( mFolderTree->currentItem() );
1977void KMMainWidget::folderSelected()
1979 folderSelected( mFolder );
1982 if ( mFolder && mFolder->folderType() == KMFolderTypeImap )
1983 mFolder->close(
"mainwidget");
1987void KMMainWidget::folderSelected(
KMFolder* aFolder,
bool forceJumpToUnread )
1992 mMsgView->clear(
true);
1994 if ( mFolder && mFolder->folderType() == KMFolderTypeImap && !mFolder->noContent() )
1996 KMFolderImap *imap =
static_cast<KMFolderImap*
>(mFolder->storage());
1997 if ( mFolder->needsCompacting() && imap->autoExpunge() )
1998 imap->expungeFolder(imap,
true);
2008 bool newFolder = ( (
KMFolder*)mFolder != aFolder );
2009 bool isNewImapFolder = aFolder && aFolder->
folderType() == KMFolderTypeImap && newFolder;
2011 || ( !isNewImapFolder && mShowBusySplashTimer )
2012 || ( newFolder && mShowingOfflineScreen && !( isNewImapFolder && kmkernel->isOffline() ) ) ) {
2014 mMsgView->enableMsgDisplay();
2015 mMsgView->clear(
true );
2017 if( mSearchAndHeaders && mHeaders )
2018 mSearchAndHeaders->show();
2019 mShowingOfflineScreen =
false;
2023 delete mShowBusySplashTimer;
2024 mShowBusySplashTimer =
nullptr;
2027 writeFolderConfig();
2029 disconnect( mFolder, TQ_SIGNAL( changed() ),
2030 this, TQ_SLOT( updateMarkAsReadAction() ) );
2031 disconnect( mFolder, TQ_SIGNAL( msgHeaderChanged(
KMFolder*,
int ) ),
2032 this, TQ_SLOT( updateMarkAsReadAction() ) );
2033 disconnect( mFolder, TQ_SIGNAL( msgAdded(
int ) ),
2034 this, TQ_SLOT( updateMarkAsReadAction() ) );
2035 disconnect( mFolder, TQ_SIGNAL( msgRemoved(
KMFolder * ) ),
2036 this, TQ_SLOT( updateMarkAsReadAction() ) );
2041 if ( aFolder && aFolder->
folderType() == KMFolderTypeImap )
2043 if ( kmkernel->isOffline() ) {
2047 KMFolderImap *imap =
static_cast<KMFolderImap*
>(aFolder->storage());
2048 if ( newFolder && !mFolder->noContent() )
2050 imap->open(
"mainwidget");
2052 imap->setSelected(
true );
2053 connect( imap, TQ_SIGNAL( folderComplete( KMFolderImap*,
bool ) ),
2054 this, TQ_SLOT( folderSelected() ) );
2055 imap->getAndCheckFolder();
2056 mHeaders->setFolder(
nullptr );
2058 mForceJumpToUnread = forceJumpToUnread;
2062 mShowBusySplashTimer =
new TQTimer(
this );
2063 connect( mShowBusySplashTimer, TQ_SIGNAL( timeout() ),
this, TQ_SLOT( slotShowBusySplash() ) );
2064 mShowBusySplashTimer->start( GlobalSettings::self()->folderLoadingTimeout(),
true );
2068 disconnect( imap, TQ_SIGNAL( folderComplete( KMFolderImap*,
bool ) ),
2069 this, TQ_SLOT( folderSelected() ) );
2070 forceJumpToUnread = mForceJumpToUnread;
2075 connect( mFolder, TQ_SIGNAL( changed() ),
2076 this, TQ_SLOT( updateMarkAsReadAction() ) );
2077 connect( mFolder, TQ_SIGNAL( msgHeaderChanged(
KMFolder*,
int ) ),
2078 this, TQ_SLOT( updateMarkAsReadAction() ) );
2079 connect( mFolder, TQ_SIGNAL( msgAdded(
int ) ),
2080 this, TQ_SLOT( updateMarkAsReadAction() ) );
2081 connect( mFolder, TQ_SIGNAL( msgRemoved(
KMFolder *) ),
2082 this, TQ_SLOT( updateMarkAsReadAction() ) );
2087 mMsgView->setHtmlOverride(mFolderHtmlPref);
2088 mMsgView->setHtmlLoadExtDefault(mFolderHtmlLoadExtPref);
2090 mHeaders->setFolder( mFolder, forceJumpToUnread );
2091 updateMessageActions();
2098void KMMainWidget::slotShowBusySplash()
2100 if ( mReaderWindowActive )
2102 mMsgView->displayBusyPage();
2104 if ( mSearchAndHeaders && mHeaders && mLongFolderList )
2105 mSearchAndHeaders->hide();
2109void KMMainWidget::showOfflinePage()
2111 if ( !mReaderWindowActive )
return;
2112 mShowingOfflineScreen =
true;
2114 mMsgView->displayOfflinePage();
2116 if ( mSearchAndHeaders && mHeaders && mLongFolderList )
2117 mSearchAndHeaders->hide();
2121void KMMainWidget::slotMsgSelected(
KMMessage *msg)
2123 if ( msg && msg->parent() && !msg->
isComplete() )
2128 mMsgView->setWaitingForSerNum( msg->getMsgSerNum() );
2131 disconnect( mJob,
nullptr, mMsgView,
nullptr );
2134 mJob = msg->parent()->createJob( msg, FolderJob::tGetMessage,
nullptr,
2135 "STRUCTURE", mMsgView->attachmentStrategy() );
2136 connect(mJob, TQ_SIGNAL(messageRetrieved(
KMMessage*)),
2137 mMsgView, TQ_SLOT(slotMessageArrived(
KMMessage*)));
2140 mMsgView->setMsg(msg);
2143 mMsgView->setHtmlOverride(mFolderHtmlPref);
2144 mMsgView->setHtmlLoadExtDefault(mFolderHtmlLoadExtPref);
2145 mMsgView->setHtmlLoadExtOverride(
false);
2146 mMsgView->setDecryptMessageOverwrite(
false );
2147 mMsgView->setShowSignatureDetails(
false );
2151void KMMainWidget::slotMsgChanged()
2153 mHeaders->msgChanged();
2157void KMMainWidget::slotSelectFolder(
KMFolder* folder)
2159 TQListViewItem* item = mFolderTree->indexOfFolder(folder);
2161 mFolderTree->ensureItemVisible( item );
2162 mFolderTree->doFolderSelected( item );
2167void KMMainWidget::slotSelectMessage(
KMMessage* msg)
2169 int idx = mFolder->find(msg);
2171 mHeaders->setCurrentMsg(idx);
2173 mMsgView->setMsg(msg);
2175 slotMsgActivated(msg);
2180void KMMainWidget::slotReplaceMsgByUnencryptedVersion()
2182 kdDebug(5006) <<
"KMMainWidget::slotReplaceMsgByUnencryptedVersion()" << endl;
2183 KMMessage* oldMsg = mHeaders->currentMsg();
2185 kdDebug(5006) <<
"KMMainWidget - old message found" << endl;
2187 kdDebug(5006) <<
"KMMainWidget - extra unencrypted message found" << endl;
2191 TQString msgId( oldMsg->
msgId() );
2192 TQString prefix(
"DecryptedMsg.");
2193 int oldIdx = msgId.find(prefix, 0,
false);
2194 if( -1 == oldIdx ) {
2195 int leftAngle = msgId.findRev(
'<' );
2196 msgId = msgId.insert( (-1 == leftAngle) ? 0 : ++leftAngle, prefix );
2201 TQCharRef c = msgId[ oldIdx+2 ];
2207 newMsg->setMsgId( msgId );
2208 mMsgView->setIdOfLastViewedMessage( msgId );
2211 kdDebug(5006) <<
"KMMainWidget - adding unencrypted message to folder" << endl;
2212 mFolder->addMsg( newMsg );
2215 int newMsgIdx = mFolder->find( newMsg );
2216 Q_ASSERT( newMsgIdx != -1 );
2218 mFolder->unGetMsg( newMsgIdx );
2219 int idx = mFolder->find( oldMsg );
2220 Q_ASSERT( idx != -1 );
2223 mHeaders->setCurrentItemByIndex( newMsgIdx );
2226 kdDebug(5006) <<
"KMMainWidget - deleting encrypted message" << endl;
2227 mFolder->take( idx );
2230 kdDebug(5006) <<
"KMMainWidget - updating message actions" << endl;
2231 updateMessageActions();
2233 kdDebug(5006) <<
"KMMainWidget - done." << endl;
2235 kdDebug(5006) <<
"KMMainWidget - NO EXTRA UNENCRYPTED MESSAGE FOUND" << endl;
2237 kdDebug(5006) <<
"KMMainWidget - PANIC: NO OLD MESSAGE FOUND" << endl;
2241void KMMainWidget::slotSetThreadStatusNew()
2243 mHeaders->setThreadStatus(KMMsgStatusNew);
2247void KMMainWidget::slotSetThreadStatusUnread()
2249 mHeaders->setThreadStatus(KMMsgStatusUnread);
2253void KMMainWidget::slotSetThreadStatusFlag()
2255 mHeaders->setThreadStatus(KMMsgStatusFlag,
true);
2259void KMMainWidget::slotSetThreadStatusRead()
2261 mHeaders->setThreadStatus(KMMsgStatusRead);
2265void KMMainWidget::slotSetThreadStatusTodo()
2267 mHeaders->setThreadStatus(KMMsgStatusTodo,
true);
2271void KMMainWidget::slotSetThreadStatusWatched()
2273 mHeaders->setThreadStatus(KMMsgStatusWatched,
true);
2274 if (mWatchThreadAction->isChecked()) {
2275 mIgnoreThreadAction->setChecked(
false);
2280void KMMainWidget::slotSetThreadStatusIgnored()
2282 mHeaders->setThreadStatus(KMMsgStatusIgnored,
true);
2283 if (mIgnoreThreadAction->isChecked()) {
2284 mWatchThreadAction->setChecked(
false);
2289void KMMainWidget::slotNextMessage() { mHeaders->nextMessage(); }
2290void KMMainWidget::slotNextUnreadMessage()
2292 if ( !mHeaders->nextUnreadMessage() )
2293 if ( GlobalSettings::self()->loopOnGotoUnread() == GlobalSettings::EnumLoopOnGotoUnread::LoopInAllFolders )
2294 mFolderTree->nextUnreadFolder(
true);
2296void KMMainWidget::slotNextImportantMessage() {
2299void KMMainWidget::slotPrevMessage() { mHeaders->prevMessage(); }
2300void KMMainWidget::slotPrevUnreadMessage()
2302 if ( !mHeaders->prevUnreadMessage() )
2303 if ( GlobalSettings::self()->loopOnGotoUnread() == GlobalSettings::EnumLoopOnGotoUnread::LoopInAllFolders )
2304 mFolderTree->prevUnreadFolder();
2306void KMMainWidget::slotPrevImportantMessage() {
2310void KMMainWidget::slotDisplayCurrentMessage()
2312 if ( mHeaders->currentMsg() )
2313 slotMsgActivated( mHeaders->currentMsg() );
2317void KMMainWidget::slotMsgActivated(
KMMessage *msg)
2321 FolderJob *job = msg->parent()->createJob( msg );
2322 connect( job, TQ_SIGNAL( messageRetrieved(
KMMessage* ) ),
2323 TQ_SLOT( slotMsgActivated(
KMMessage* ) ) );
2328 if (kmkernel->folderIsDraftOrOutbox( mFolder ) ) {
2329 mMsgActions->editCurrentMessage();
2332 if ( kmkernel->folderIsTemplates( mFolder ) ) {
2338 KMReaderMainWin *win =
new KMReaderMainWin( mFolderHtmlPref, mFolderHtmlLoadExtPref );
2339 TDEConfigGroup reader( KMKernel::config(),
"Reader" );
2340 bool useFixedFont = mMsgView ? mMsgView->isFixedFont()
2341 : reader.readBoolEntry(
"useFixedFont",
false );
2342 win->setUseFixedFont( useFixedFont );
2344 newMessage->setParent( msg->parent() );
2347 win->showMsg( overrideEncoding(), newMessage );
2352void KMMainWidget::slotMarkAll()
2354 mHeaders->selectAll(
true );
2358void KMMainWidget::slotMsgPopup(
KMMessage&,
const KURL &aUrl,
const TQPoint& aPoint)
2360 TDEPopupMenu * menu =
new TDEPopupMenu;
2361 updateMessageMenu();
2364 bool urlMenuAdded =
false;
2366 if (!aUrl.isEmpty())
2368 if (aUrl.protocol() ==
"mailto")
2371 mMsgView->mailToComposeAction()->plug( menu );
2372 mMsgView->mailToReplyAction()->plug( menu );
2373 mMsgView->mailToForwardAction()->plug( menu );
2375 menu->insertSeparator();
2376 mMsgView->addAddrBookAction()->plug( menu );
2377 mMsgView->openAddrBookAction()->plug( menu );
2378 mMsgView->copyURLAction()->plug( menu );
2379 mMsgView->startImChatAction()->plug( menu );
2381 mMsgView->startImChatAction()->setEnabled( kmkernel->imProxy()->initialize() );
2385 mMsgView->urlOpenAction()->plug( menu );
2386 mMsgView->addBookmarksAction()->plug( menu );
2387 mMsgView->urlSaveAsAction()->plug( menu );
2388 mMsgView->copyURLAction()->plug( menu );
2390 if ( aUrl.protocol() ==
"im" )
2395 mMsgView->startImChatAction()->plug( menu );
2399 kdDebug( 0 ) << k_funcinfo <<
" URL is: " << aUrl << endl;
2403 if(mMsgView && !mMsgView->copyText().isEmpty()) {
2405 menu->insertSeparator();
2406 mMsgActions->replyMenu()->plug(menu);
2407 menu->insertSeparator();
2409 mMsgView->copyAction()->plug( menu );
2410 mMsgView->selectAllAction()->plug( menu );
2411 }
else if ( !urlMenuAdded )
2415 if (!mHeaders->currentMsg())
2422 if ( mFolder->isTemplates() ) {
2423 mUseAction->plug( menu );
2425 mMsgActions->replyMenu()->plug( menu );
2426 mForwardActionMenu->plug( menu );
2428 editAction()->plug(menu);
2429 menu->insertSeparator();
2431 mCopyActionMenu->plug( menu );
2432 mMoveActionMenu->plug( menu );
2434 menu->insertSeparator();
2436 mMsgActions->messageStatusMenu()->plug( menu );
2437 menu->insertSeparator();
2439 viewSourceAction()->plug(menu);
2441 mMsgView->toggleFixFontAction()->plug(menu);
2442 mMsgView->toggleMimePartTreeAction()->plug(menu);
2444 menu->insertSeparator();
2445 mPrintAction->plug( menu );
2446 mSaveAsAction->plug( menu );
2447 mSaveAttachmentsAction->plug( menu );
2449 menu->insertSeparator();
2450 if( mFolder->isTrash() )
2451 mDeleteAction->plug( menu );
2453 mTrashAction->plug( menu );
2455 menu->insertSeparator();
2456 mMsgActions->createTodoAction()->plug( menu );
2458 TDEAcceleratorManager::manage(menu);
2459 menu->exec(aPoint, 0);
2464void KMMainWidget::getAccountMenu()
2466 TQStringList actList;
2469 actList = kmkernel->acctMgr()->getAccounts();
2470 TQStringList::Iterator it;
2472 for(it = actList.begin(); it != actList.end() ; ++it,
id++)
2473 mActMenu->insertItem((*it).replace(
"&",
"&&"), id);
2477void KMMainWidget::getTransportMenu()
2479 TQStringList availTransports;
2483 TQStringList::Iterator it;
2485 for(it = availTransports.begin(); it != availTransports.end() ; ++it,
id++)
2486 mSendMenu->insertItem((*it).replace(
"&",
"&&"), id);
2490void KMMainWidget::updateCustomTemplateMenus()
2492 if ( !mCustomTemplateActions.isEmpty() ) {
2493 TQPtrList<TDEAction>::iterator ait = mCustomTemplateActions.begin();
2494 for ( ; ait != mCustomTemplateActions.end() ; ++ait ) {
2495 (*ait)->unplugAll();
2498 mCustomTemplateActions.clear();
2501 delete mCustomReplyActionMenu;
2502 delete mCustomReplyAllActionMenu;
2503 delete mCustomForwardActionMenu;
2505 delete mCustomReplyMapper;
2506 delete mCustomReplyAllMapper;
2507 delete mCustomForwardMapper;
2509 mCustomForwardActionMenu =
2510 new TDEActionMenu( i18n(
"Forward With Custom Template"),
2511 "mail_custom_forward",
2512 actionCollection(),
"custom_forward" );
2513 TQSignalMapper *mCustomForwardMapper =
new TQSignalMapper(
this );
2514 connect( mCustomForwardMapper, TQ_SIGNAL( mapped(
int ) ),
2515 this, TQ_SLOT( slotCustomForwardMsg(
int ) ) );
2516 mForwardActionMenu->insert( mCustomForwardActionMenu );
2518 mCustomReplyActionMenu =
2519 new TDEActionMenu( i18n(
"Reply With Custom Template"),
"mail_custom_reply",
2520 actionCollection(),
"custom_reply" );
2521 TQSignalMapper *mCustomReplyMapper =
new TQSignalMapper(
this );
2522 connect( mCustomReplyMapper, TQ_SIGNAL( mapped(
int ) ),
2523 this, TQ_SLOT( slotCustomReplyToMsg(
int ) ) );
2524 mMsgActions->replyMenu()->insert( mCustomReplyActionMenu );
2526 mCustomReplyAllActionMenu =
2527 new TDEActionMenu( i18n(
"Reply to All With Custom Template"),
2528 "mail_custom_reply_all",
2529 actionCollection(),
"custom_reply_all" );
2530 TQSignalMapper *mCustomReplyAllMapper =
new TQSignalMapper(
this );
2531 connect( mCustomReplyAllMapper, TQ_SIGNAL( mapped(
int ) ),
2532 this, TQ_SLOT( slotCustomReplyAllToMsg(
int ) ) );
2533 mMsgActions->replyMenu()->insert( mCustomReplyAllActionMenu );
2535 mCustomTemplates.clear();
2537 TQStringList list = GlobalSettingsBase::self()->customTemplates();
2538 TQStringList::iterator it = list.begin();
2543 for ( ; it != list.end(); ++it ) {
2544 CTemplates t( *it );
2545 mCustomTemplates.append( *it );
2548 switch ( t.type() ) {
2549 case CustomTemplates::TReply:
2550 action =
new TDEAction( (*it).replace(
"&",
"&&" ),
2551 TDEShortcut( t.shortcut() ),
2556 mCustomReplyMapper->setMapping( action, idx );
2557 mCustomReplyActionMenu->insert( action, idx );
2558 mCustomTemplateActions.append( action );
2561 case CustomTemplates::TReplyAll:
2562 action =
new TDEAction( (*it).replace(
"&",
"&&" ),
2563 TDEShortcut( t.shortcut() ),
2564 mCustomReplyAllMapper,
2568 mCustomReplyAllMapper->setMapping( action, idx );
2569 mCustomReplyAllActionMenu->insert( action, idx );
2570 mCustomTemplateActions.append( action );
2573 case CustomTemplates::TForward:
2574 action =
new TDEAction( (*it).replace(
"&",
"&&" ),
2575 TDEShortcut( t.shortcut() ),
2576 mCustomForwardMapper,
2580 mCustomForwardMapper->setMapping( action, idx );
2581 mCustomForwardActionMenu->insert( action, idx );
2582 mCustomTemplateActions.append( action );
2585 case CustomTemplates::TUniversal:
2586 action =
new TDEAction( (*it).replace(
"&",
"&&" ),
2587 TDEShortcut::null(),
2592 mCustomReplyMapper->setMapping( action, idx );
2593 mCustomReplyActionMenu->insert( action, idx );
2594 mCustomTemplateActions.append( action );
2596 action =
new TDEAction( (*it).replace(
"&",
"&&" ),
2597 TDEShortcut::null(),
2598 mCustomReplyAllMapper,
2602 mCustomReplyAllMapper->setMapping( action, idx );
2603 mCustomReplyAllActionMenu->insert( action, idx );
2604 mCustomTemplateActions.append( action );
2606 action =
new TDEAction( (*it).replace(
"&",
"&&" ),
2607 TDEShortcut::null(),
2608 mCustomForwardMapper,
2612 mCustomForwardMapper->setMapping( action, idx );
2613 mCustomForwardActionMenu->insert( action, idx );
2614 mCustomTemplateActions.append( action );
2622 mCustomReplyActionMenu->popupMenu()->insertItem( i18n(
"(no custom templates)" ), 0 );
2623 mCustomReplyActionMenu->popupMenu()->setItemEnabled( 0,
false );
2624 mCustomReplyActionMenu->setEnabled(
false);
2627 mCustomReplyAllActionMenu->popupMenu()->insertItem( i18n(
"(no custom templates)" ), 0 );
2628 mCustomReplyAllActionMenu->popupMenu()->setItemEnabled( 0,
false );
2629 mCustomReplyAllActionMenu->setEnabled(
false);
2632 mCustomForwardActionMenu->popupMenu()->insertItem( i18n(
"(no custom templates)" ), 0 );
2633 mCustomForwardActionMenu->popupMenu()->setItemEnabled( 0,
false );
2634 mCustomForwardActionMenu->setEnabled(
false);
2641void KMMainWidget::setupActions()
2644 mMsgActions->setMessageView( mMsgView );
2647 mSaveAsAction =
new TDEAction( i18n(
"Save &As..."),
"document-save",
2648 TDEStdAccel::shortcut(TDEStdAccel::Save),
2649 this, TQ_SLOT(slotSaveMsg()), actionCollection(),
"file_save_as" );
2651 mOpenAction = KStdAction::open(
this, TQ_SLOT( slotOpenMsg() ),
2652 actionCollection() );
2654 (void)
new TDEAction( i18n(
"&Compact All Folders"), 0,
2655 this, TQ_SLOT(slotCompactAll()),
2656 actionCollection(),
"compact_all_folders" );
2658 (void)
new TDEAction( i18n(
"&Expire All Folders"), 0,
2659 this, TQ_SLOT(slotExpireAll()),
2660 actionCollection(),
"expire_all_folders" );
2662 (void)
new TDEAction( i18n(
"&Refresh Local IMAP Cache"),
"refresh",
2663 this, TQ_SLOT(slotInvalidateIMAPFolders()),
2664 actionCollection(),
"file_invalidate_imap_cache" );
2666 (void)
new TDEAction( i18n(
"Empty All &Trash Folders"), 0,
2668 actionCollection(),
"empty_trash" );
2670 (void)
new TDEAction( i18n(
"Check &Mail"),
"mail_get", CTRL+Key_L,
2671 this, TQ_SLOT(slotCheckMail()),
2672 actionCollection(),
"check_mail" );
2674 mFavoritesCheckMailAction =
new TDEAction( i18n(
"Check Mail in Favorite Folders"),
2675 "mail_get", CTRL+SHIFT+Key_L,
nullptr,
nullptr,
2676 actionCollection(),
"favorite_check_mail" );
2677 if ( mFavoriteFolderView )
2678 connect( mFavoritesCheckMailAction, TQ_SIGNAL(activated()), mFavoriteFolderView, TQ_SLOT(checkMail()) );
2680 TDEActionMenu *actActionMenu =
new
2681 TDEActionMenu( i18n(
"Check Mail &In"),
"mail_get", actionCollection(),
2683 actActionMenu->setDelayed(
true);
2685 connect(actActionMenu,TQ_SIGNAL(activated()),
this,TQ_SLOT(slotCheckMail()));
2687 mActMenu = actActionMenu->popupMenu();
2688 connect(mActMenu,TQ_SIGNAL(activated(
int)),
this,TQ_SLOT(slotCheckOneAccount(
int)));
2689 connect(mActMenu,TQ_SIGNAL(aboutToShow()),
this,TQ_SLOT(getAccountMenu()));
2691 (void)
new TDEAction( i18n(
"&Send Queued Messages"),
"mail-send", 0,
this,
2692 TQ_SLOT(slotSendQueued()), actionCollection(),
"send_queued");
2694 (void)
new TDEAction( i18n(
"Online Status (unknown)"),
"online_status", 0,
this,
2695 TQ_SLOT(slotOnlineStatus()), actionCollection(),
"online_status");
2697 TDEActionMenu *sendActionMenu =
new
2698 TDEActionMenu( i18n(
"Send Queued Messages Via"),
"mail_send_via", actionCollection(),
2699 "send_queued_via" );
2700 sendActionMenu->setDelayed(
true);
2702 mSendMenu = sendActionMenu->popupMenu();
2703 connect(mSendMenu,TQ_SIGNAL(activated(
int)),
this, TQ_SLOT(slotSendQueuedVia(
int)));
2704 connect(mSendMenu,TQ_SIGNAL(aboutToShow()),
this,TQ_SLOT(getTransportMenu()));
2708 if (parent()->inherits(
"KMMainWin")) {
2709 act =
new TDEAction( i18n(
"&Address Book..."),
"contents", 0,
this,
2710 TQ_SLOT(slotAddrBook()), actionCollection(),
"addressbook" );
2711 if (TDEStandardDirs::findExe(
"kaddressbook").isEmpty()) act->setEnabled(
false);
2714 act =
new TDEAction( i18n(
"Certificate Manager..."),
"pgp-keys", 0,
this,
2715 TQ_SLOT(slotStartCertManager()), actionCollection(),
"tools_start_certman");
2717 if (TDEStandardDirs::findExe(
"kleopatra").isEmpty()) act->setEnabled(
false);
2719 act =
new TDEAction( i18n(
"GnuPG Log Viewer..."),
"pgp-keys", 0,
this,
2720 TQ_SLOT(slotStartWatchGnuPG()), actionCollection(),
"tools_start_kwatchgnupg");
2722 if (TDEStandardDirs::findExe(
"kwatchgnupg").isEmpty()) act->setEnabled(
false);
2724 act =
new TDEAction( i18n(
"&Import Messages..."),
"document-open", 0,
this,
2725 TQ_SLOT(slotImport()), actionCollection(),
"import" );
2726 if (TDEStandardDirs::findExe(
"kmailcvt").isEmpty()) act->setEnabled(
false);
2729 (void)
new TDEAction( i18n(
"&Debug Sieve..."),
2730 "idea", 0,
this, TQ_SLOT(slotDebugSieve()),
2731 actionCollection(),
"tools_debug_sieve" );
2734 if ( GlobalSettings::allowOutOfOfficeSettings() ) {
2735 (void)
new TDEAction( i18n(
"Edit \"Out of Office\" Replies..."),
2736 "configure", 0,
this, TQ_SLOT(slotEditVacation()),
2737 actionCollection(),
"tools_edit_vacation" );
2741 (void)
new TDEAction( i18n(
"Filter &Log Viewer..."), 0,
this,
2742 TQ_SLOT(slotFilterLogViewer()), actionCollection(),
"filter_log_viewer" );
2744 (void)
new TDEAction( i18n(
"&Anti-Spam Wizard..."), 0,
this,
2745 TQ_SLOT(slotAntiSpamWizard()), actionCollection(),
"antiSpamWizard" );
2746 (void)
new TDEAction( i18n(
"&Anti-Virus Wizard..."), 0,
this,
2747 TQ_SLOT(slotAntiVirusWizard()), actionCollection(),
"antiVirusWizard" );
2750 mTrashAction =
new TDEAction( KGuiItem( i18n(
"&Move to Trash"),
"edittrash",
2751 i18n(
"Move message to trashcan") ),
2752 Key_Delete,
this, TQ_SLOT(slotTrashMsg()),
2753 actionCollection(),
"move_to_trash" );
2759 mDeleteAction =
new TDEAction( i18n(
"&Delete"),
"edit-delete", SHIFT+Key_Delete,
this,
2760 TQ_SLOT(slotDeleteMsg()), actionCollection(),
"delete" );
2761 mDeleteAction->plugAccel( actionCollection()->tdeaccel() );
2763 mTrashThreadAction =
new TDEAction( KGuiItem( i18n(
"M&ove Thread to Trash"),
"edittrash",
2764 i18n(
"Move thread to trashcan") ),
2765 CTRL+Key_Delete,
this, TQ_SLOT(slotTrashThread()),
2766 actionCollection(),
"move_thread_to_trash" );
2768 mDeleteThreadAction =
new TDEAction( i18n(
"Delete T&hread"),
"edit-delete", CTRL+SHIFT+Key_Delete,
this,
2769 TQ_SLOT(slotDeleteThread()), actionCollection(),
"delete_thread" );
2772 (void)
new TDEAction( i18n(
"&Find Messages..."),
"mail_find", Key_S,
this,
2773 TQ_SLOT(slotRequestFullSearchFromQuickSearch()), actionCollection(),
"search_messages" );
2775 mFindInMessageAction =
new TDEAction( i18n(
"&Find in Message..."),
"edit-find", TDEStdAccel::shortcut(TDEStdAccel::Find),
this,
2776 TQ_SLOT(slotFind()), actionCollection(),
"find_in_messages" );
2778 (void)
new TDEAction( i18n(
"Select &All Messages"), TDEStdAccel::selectAll(),
this,
2779 TQ_SLOT(slotMarkAll()), actionCollection(),
"mark_all_messages" );
2782 mNewFolderAction =
new TDEAction( i18n(
"&New Folder..."),
"folder-new", 0, mFolderTree,
2783 TQ_SLOT(addChildFolder()), actionCollection(),
"new_folder" );
2785 mModifyFolderAction =
new TDEAction( i18n(
"&Properties"),
"configure", 0,
this,
2786 TQ_SLOT(slotModifyFolder()), actionCollection(),
"modify" );
2788 mFolderMailingListPropertiesAction =
new TDEAction( i18n(
"&Mailing List Management..."),
2789 0,
this, TQ_SLOT( slotFolderMailingListProperties() ),
2790 actionCollection(),
"folder_mailinglist_properties" );
2792 mFolderShortCutCommandAction =
new TDEAction( i18n(
"&Assign Shortcut..."),
"configure_shortcuts",
2793 0,
this, TQ_SLOT( slotFolderShortcutCommand() ), actionCollection(),
2794 "folder_shortcut_command" );
2797 mMarkAllAsReadAction =
new TDEAction( i18n(
"Mark All Messages as &Read"),
"goto", 0,
this,
2798 TQ_SLOT(slotMarkAllAsRead()), actionCollection(),
"mark_all_as_read" );
2800 mExpireFolderAction =
new TDEAction(i18n(
"&Expiration Settings"), 0,
this, TQ_SLOT(slotExpireFolder()),
2801 actionCollection(),
"expire");
2803 mCompactFolderAction =
new TDEAction( i18n(
"&Compact Folder"), 0,
this,
2804 TQ_SLOT(slotCompactFolder()), actionCollection(),
"compact" );
2806 mRefreshFolderAction =
new TDEAction( i18n(
"Check Mail &in This Folder"),
"reload",
2807 TDEStdAccel::shortcut( TDEStdAccel::Reload ),
this,
2808 TQ_SLOT(slotRefreshFolder()),
2809 actionCollection(),
"refresh_folder" );
2810 mTroubleshootFolderAction =
nullptr;
2812 mEmptyFolderAction =
new TDEAction(
"foo" ,
"edittrash", 0,
this,
2813 TQ_SLOT(slotEmptyFolder()), actionCollection(),
"empty" );
2815 mRemoveFolderAction =
new TDEAction(
"foo" ,
"edit-delete", 0,
this,
2816 TQ_SLOT(slotRemoveFolder()), actionCollection(),
"delete_folder" );
2818 mArchiveFolderAction =
new TDEAction( i18n(
"&Archive Folder..." ),
"document-save", 0,
this,
2819 TQ_SLOT( slotArchiveFolder() ), actionCollection(),
2822 mPreferHtmlAction =
new TDEToggleAction( i18n(
"Prefer &HTML to Plain Text"), 0,
this,
2823 TQ_SLOT(slotOverrideHtml()), actionCollection(),
"prefer_html" );
2825 mPreferHtmlLoadExtAction =
new TDEToggleAction( i18n(
"Load E&xternal References"), 0,
this,
2826 TQ_SLOT(slotOverrideHtmlLoadExt()), actionCollection(),
"prefer_html_external_refs" );
2828 mThreadMessagesAction =
new TDEToggleAction( i18n(
"&Thread Messages"), 0,
this,
2829 TQ_SLOT(slotOverrideThread()), actionCollection(),
"thread_messages" );
2831 mThreadBySubjectAction =
new TDEToggleAction( i18n(
"Thread Messages also by &Subject"), 0,
this,
2832 TQ_SLOT(slotToggleSubjectThreading()), actionCollection(),
"thread_messages_by_subject" );
2834 new TDEAction( i18n(
"Copy Folder"),
"edit-copy", SHIFT+CTRL+Key_C, folderTree(),
2835 TQ_SLOT(copyFolder()), actionCollection(),
"copy_folder" );
2836 new TDEAction( i18n(
"Cut Folder"),
"edit-cut", SHIFT+CTRL+Key_X, folderTree(),
2837 TQ_SLOT(cutFolder()), actionCollection(),
"cut_folder" );
2838 new TDEAction( i18n(
"Paste Folder"),
"edit-paste", SHIFT+CTRL+Key_V, folderTree(),
2839 TQ_SLOT(pasteFolder()), actionCollection(),
"paste_folder" );
2841 new TDEAction( i18n(
"Copy Messages"),
"edit-copy", ALT+CTRL+Key_C, headers(),
2842 TQ_SLOT(copyMessages()), actionCollection(),
"copy_messages" );
2843 new TDEAction( i18n(
"Cut Messages"),
"edit-cut", ALT+CTRL+Key_X, headers(),
2844 TQ_SLOT(cutMessages()), actionCollection(),
"cut_messages" );
2845 new TDEAction( i18n(
"Paste Messages"),
"edit-paste", ALT+CTRL+Key_V, headers(),
2846 TQ_SLOT(pasteMessages()), actionCollection(),
"paste_messages" );
2849 (void)
new TDEAction( i18n(
"&New Message..."),
"mail-message-new", TDEStdAccel::shortcut(TDEStdAccel::New),
this,
2850 TQ_SLOT(slotCompose()), actionCollection(),
"new_message" );
2852 new TDEActionMenu( i18n(
"New Message From &Template"),
"document-new",
2853 actionCollection(),
"new_from_template" );
2854 mTemplateMenu->setDelayed(
true );
2855 connect( mTemplateMenu->popupMenu(), TQ_SIGNAL( aboutToShow() ),
this,
2856 TQ_SLOT( slotShowNewFromTemplate() ) );
2857 connect( mTemplateMenu->popupMenu(), TQ_SIGNAL( activated(
int) ),
this,
2858 TQ_SLOT( slotNewFromTemplate(
int) ) );
2860 TDEAction* newToML =
new TDEAction( i18n(
"New Message t&o Mailing-List..."),
"mail_post_to",
2861 CTRL+SHIFT+Key_N,
this,
2862 TQ_SLOT(slotPostToML()), actionCollection(),
"post_message" );
2863 newToML->plugAccel( actionCollection()->tdeaccel() );
2865 mForwardActionMenu =
new TDEActionMenu( i18n(
"Message->",
"&Forward"),
2866 "mail-forward", actionCollection(),
2867 "message_forward" );
2869 mForwardInlineAction =
new TDEAction( i18n(
"&Inline..."),
2870 "mail-forward", 0,
this,
2871 TQ_SLOT(slotForwardInlineMsg()),
2873 "message_forward_inline" );
2875 mForwardAttachedAction =
new TDEAction( i18n(
"Message->Forward->",
"As &Attachment..."),
2876 "mail-forward", 0,
this,
2877 TQ_SLOT(slotForwardAttachedMsg()),
2879 "message_forward_as_attachment" );
2881 mForwardDigestAction =
new TDEAction( i18n(
"Message->Forward->",
"As Di&gest..."),
2882 "mail-forward", 0,
this,
2883 TQ_SLOT(slotForwardDigestMsg()),
2885 "message_forward_as_digest" );
2887 mRedirectAction =
new TDEAction( i18n(
"Message->Forward->",
"&Redirect..."),
2888 "mail-forward", Key_E,
this,
2889 TQ_SLOT(slotRedirectMsg()),
2891 "message_forward_redirect" );
2894 setupForwardActions();
2896 mForwardActionMenu->insert( mForwardDigestAction );
2897 mForwardActionMenu->insert( mRedirectAction );
2899 mSendAgainAction =
new TDEAction( i18n(
"Send A&gain..."), 0,
this,
2900 TQ_SLOT(slotResendMsg()), actionCollection(),
"send_again" );
2904 mFilterMenu =
new TDEActionMenu( i18n(
"&Create Filter"),
"filter", actionCollection(),
"create_filter" );
2905 connect( mFilterMenu, TQ_SIGNAL(activated()),
this,
2906 TQ_SLOT(slotFilter()) );
2907 mSubjectFilterAction =
new TDEAction( i18n(
"Filter on &Subject..."), 0,
this,
2908 TQ_SLOT(slotSubjectFilter()),
2909 actionCollection(),
"subject_filter");
2910 mFilterMenu->insert( mSubjectFilterAction );
2912 mFromFilterAction =
new TDEAction( i18n(
"Filter on &From..."), 0,
this,
2913 TQ_SLOT(slotFromFilter()),
2914 actionCollection(),
"from_filter");
2915 mFilterMenu->insert( mFromFilterAction );
2917 mToFilterAction =
new TDEAction( i18n(
"Filter on &To..."), 0,
this,
2918 TQ_SLOT(slotToFilter()),
2919 actionCollection(),
"to_filter");
2920 mFilterMenu->insert( mToFilterAction );
2922 mListFilterAction =
new TDEAction( i18n(
"Filter on Mailing-&List..."), 0,
this,
2923 TQ_SLOT(slotMailingListFilter()), actionCollection(),
2925 mFilterMenu->insert( mListFilterAction );
2927 mPrintAction = KStdAction::print (
this, TQ_SLOT(slotPrintMsg()), actionCollection());
2929 mUseAction =
new TDEAction( i18n(
"New Message From &Template"),
"document-new",
2930 Key_N,
this, TQ_SLOT( slotUseTemplate() ),
2931 actionCollection(),
"use_template" );
2932 mUseAction->plugAccel( actionCollection()->tdeaccel() );
2935 mThreadStatusMenu =
new TDEActionMenu ( i18n(
"Mark &Thread" ),
2936 actionCollection(),
"thread_status" );
2938 mMarkThreadAsReadAction =
new TDEAction(KGuiItem(i18n(
"Mark Thread as &Read"),
"kmmsgread",
2939 i18n(
"Mark all messages in the selected thread as read")),
2940 0,
this, TQ_SLOT(slotSetThreadStatusRead()),
2941 actionCollection(),
"thread_read");
2942 mThreadStatusMenu->insert( mMarkThreadAsReadAction );
2944 mMarkThreadAsNewAction =
new TDEAction(KGuiItem(i18n(
"Mark Thread as &New"),
"kmmsgnew",
2945 i18n(
"Mark all messages in the selected thread as new")),
2946 0,
this, TQ_SLOT(slotSetThreadStatusNew()),
2947 actionCollection(),
"thread_new");
2948 mThreadStatusMenu->insert( mMarkThreadAsNewAction );
2950 mMarkThreadAsUnreadAction =
new TDEAction(KGuiItem(i18n(
"Mark Thread as &Unread"),
"kmmsgunseen",
2951 i18n(
"Mark all messages in the selected thread as unread")),
2952 0,
this, TQ_SLOT(slotSetThreadStatusUnread()),
2953 actionCollection(),
"thread_unread");
2954 mThreadStatusMenu->insert( mMarkThreadAsUnreadAction );
2956 mThreadStatusMenu->insert(
new TDEActionSeparator(
this ) );
2959 mToggleThreadFlagAction =
new TDEToggleAction(i18n(
"Mark Thread as &Important"),
"mail_flag",
2960 0,
this, TQ_SLOT(slotSetThreadStatusFlag()),
2961 actionCollection(),
"thread_flag");
2962 mToggleThreadFlagAction->setCheckedState( i18n(
"Remove &Important Thread Mark") );
2963 mThreadStatusMenu->insert( mToggleThreadFlagAction );
2965 mToggleThreadTodoAction =
new TDEToggleAction(i18n(
"Mark Thread as &Action Item"),
"mail_todo",
2966 0,
this, TQ_SLOT(slotSetThreadStatusTodo()),
2967 actionCollection(),
"thread_todo");
2968 mToggleThreadTodoAction->setCheckedState( i18n(
"Remove &Action Item Thread Mark") );
2969 mThreadStatusMenu->insert( mToggleThreadTodoAction );
2972 mWatchThreadAction =
new TDEToggleAction(i18n(
"&Watch Thread"),
"kmmsgwatched",
2973 0,
this, TQ_SLOT(slotSetThreadStatusWatched()),
2974 actionCollection(),
"thread_watched");
2976 mIgnoreThreadAction =
new TDEToggleAction(i18n(
"&Ignore Thread"),
"mail_ignore",
2977 0,
this, TQ_SLOT(slotSetThreadStatusIgnored()),
2978 actionCollection(),
"thread_ignored");
2980 mThreadStatusMenu->insert(
new TDEActionSeparator(
this ) );
2981 mThreadStatusMenu->insert( mWatchThreadAction );
2982 mThreadStatusMenu->insert( mIgnoreThreadAction );
2984 mSaveAttachmentsAction =
new TDEAction( i18n(
"Save A&ttachments..."),
"attach",
2985 0,
this, TQ_SLOT(slotSaveAttachments()),
2986 actionCollection(),
"file_save_attachments" );
2988 mMoveActionMenu =
new TDEActionMenu( i18n(
"&Move To" ),
2989 actionCollection(),
"move_to" );
2991 mCopyActionMenu =
new TDEActionMenu( i18n(
"&Copy To" ),
2992 actionCollection(),
"copy_to" );
2994 mApplyAllFiltersAction =
new TDEAction( i18n(
"Appl&y All Filters"),
"filter",
2996 TQ_SLOT(slotApplyFilters()),
2997 actionCollection(),
"apply_filters" );
2999 mApplyFilterActionsMenu =
new TDEActionMenu( i18n(
"A&pply Filter" ),
3001 "apply_filter_actions" );
3005 TDEActionMenu * unreadMenu =
3006 new TDEActionMenu( i18n(
"View->",
"&Unread Count"),
3007 actionCollection(),
"view_unread" );
3008 unreadMenu->setToolTip( i18n(
"Choose how to display the count of unread messages") );
3010 mUnreadColumnToggle =
new TDERadioAction( i18n(
"View->Unread Count",
"View in &Separate Column"), 0,
this,
3011 TQ_SLOT(slotToggleUnread()),
3012 actionCollection(),
"view_unread_column" );
3013 mUnreadColumnToggle->setExclusiveGroup(
"view_unread_group" );
3014 unreadMenu->insert( mUnreadColumnToggle );
3016 mUnreadTextToggle =
new TDERadioAction( i18n(
"View->Unread Count",
"View After &Folder Name"), 0,
this,
3017 TQ_SLOT(slotToggleUnread()),
3018 actionCollection(),
"view_unread_text" );
3019 mUnreadTextToggle->setExclusiveGroup(
"view_unread_group" );
3020 unreadMenu->insert( mUnreadTextToggle );
3023 mTotalColumnToggle =
new TDEToggleAction( i18n(
"View->",
"&Total Column"), 0,
this,
3024 TQ_SLOT(slotToggleTotalColumn()),
3025 actionCollection(),
"view_columns_total" );
3026 mTotalColumnToggle->setToolTip( i18n(
"Toggle display of column showing the "
3027 "total number of messages in folders.") );
3028 mSizeColumnToggle =
new TDEToggleAction( i18n(
"View->",
"&Size Column"), 0,
this,
3029 TQ_SLOT(slotToggleSizeColumn()),
3030 actionCollection(),
"view_columns_size" );
3031 mSizeColumnToggle->setToolTip( i18n(
"Toggle display of column showing the "
3032 "total size of messages in folders.") );
3034 (void)
new TDEAction( KGuiItem( i18n(
"View->",
"&Expand Thread"), TQString(),
3035 i18n(
"Expand the current thread") ),
3037 TQ_SLOT(slotExpandThread()),
3038 actionCollection(),
"expand_thread" );
3040 (void)
new TDEAction( KGuiItem( i18n(
"View->",
"&Collapse Thread"), TQString(),
3041 i18n(
"Collapse the current thread") ),
3043 TQ_SLOT(slotCollapseThread()),
3044 actionCollection(),
"collapse_thread" );
3046 (void)
new TDEAction( KGuiItem( i18n(
"View->",
"Ex&pand All Threads"), TQString(),
3047 i18n(
"Expand all threads in the current folder") ),
3048 CTRL+Key_Period,
this,
3049 TQ_SLOT(slotExpandAllThreads()),
3050 actionCollection(),
"expand_all_threads" );
3052 (void)
new TDEAction( KGuiItem( i18n(
"View->",
"C&ollapse All Threads"), TQString(),
3053 i18n(
"Collapse all threads in the current folder") ),
3054 CTRL+Key_Comma,
this,
3055 TQ_SLOT(slotCollapseAllThreads()),
3056 actionCollection(),
"collapse_all_threads" );
3058 mViewSourceAction =
new TDEAction( i18n(
"&View Source"), Key_V,
this,
3059 TQ_SLOT(slotShowMsgSrc()), actionCollection(),
3062 TDEAction* dukeOfMonmoth =
new TDEAction( i18n(
"&Display Message"), Key_Return,
this,
3063 TQ_SLOT( slotDisplayCurrentMessage() ), actionCollection(),
3064 "display_message" );
3065 dukeOfMonmoth->plugAccel( actionCollection()->tdeaccel() );
3068 new TDEAction( KGuiItem( i18n(
"&Next Message"), TQString(),
3069 i18n(
"Go to the next message") ),
3070 "N;Right",
this, TQ_SLOT(slotNextMessage()),
3071 actionCollection(),
"go_next_message" );
3073 new TDEAction( KGuiItem( i18n(
"Next &Unread Message"),
3074 TQApplication::reverseLayout() ?
"go-previous" :
"go-next",
3075 i18n(
"Go to the next unread message") ),
3076 Key_Plus, this, TQ_SLOT(slotNextUnreadMessage()),
3077 actionCollection(),
"go_next_unread_message" );
3086 new TDEAction( KGuiItem( i18n(
"&Previous Message"), TQString(),
3087 i18n(
"Go to the previous message") ),
3088 "P;Left",
this, TQ_SLOT(slotPrevMessage()),
3089 actionCollection(),
"go_prev_message" );
3091 new TDEAction( KGuiItem( i18n(
"Previous Unread &Message"),
3092 TQApplication::reverseLayout() ?
"go-next" :
"go-previous",
3093 i18n(
"Go to the previous unread message") ),
3094 Key_Minus, this, TQ_SLOT(slotPrevUnreadMessage()),
3095 actionCollection(),
"go_prev_unread_message" );
3105 new TDEAction( KGuiItem( i18n(
"Next Unread &Folder"), TQString(),
3106 i18n(
"Go to the next folder with unread messages") ),
3107 ALT+Key_Plus,
this, TQ_SLOT(slotNextUnreadFolder()),
3108 actionCollection(),
"go_next_unread_folder" );
3109 TDEShortcut shortcut = action->shortcut();
3110 shortcut.append( KKey( CTRL+Key_Plus ) );
3111 action->setShortcut( shortcut );
3114 new TDEAction( KGuiItem( i18n(
"Previous Unread F&older"), TQString(),
3115 i18n(
"Go to the previous folder with unread messages") ),
3116 ALT+Key_Minus,
this, TQ_SLOT(slotPrevUnreadFolder()),
3117 actionCollection(),
"go_prev_unread_folder" );
3118 shortcut = action->shortcut();
3119 shortcut.append( KKey( CTRL+Key_Minus ) );
3120 action->setShortcut( shortcut );
3122 new TDEAction( KGuiItem( i18n(
"Go->",
"Next Unread &Text"), TQString(),
3123 i18n(
"Go to the next unread text"),
3124 i18n(
"Scroll down current message. "
3125 "If at end of current message, "
3126 "go to next unread message.") ),
3127 Key_Space,
this, TQ_SLOT(slotReadOn()),
3128 actionCollection(),
"go_next_unread_text" );
3131 mToggleShowQuickSearchAction =
new TDEToggleAction(i18n(
"Show Quick Search"), TQString(),
3132 0,
this, TQ_SLOT(slotToggleShowQuickSearch()),
3133 actionCollection(),
"show_quick_search");
3134 mToggleShowQuickSearchAction->setChecked( GlobalSettings::self()->quickSearchActive() );
3135 mToggleShowQuickSearchAction->setWhatsThis(
3136 i18n( GlobalSettings::self()->quickSearchActiveItem()->whatsThis().utf8() ) );
3138 (void)
new TDEAction( i18n(
"Configure &Filters..."), 0,
this,
3139 TQ_SLOT(slotFilter()), actionCollection(),
"filter" );
3140 (void)
new TDEAction( i18n(
"Configure &POP Filters..."), 0,
this,
3141 TQ_SLOT(slotPopFilter()), actionCollection(),
"popFilter" );
3142 (void)
new TDEAction( i18n(
"Manage &Sieve Scripts..."), 0,
this,
3143 TQ_SLOT(slotManageSieveScripts()), actionCollection(),
"sieveFilters" );
3145 (void)
new TDEAction( KGuiItem( i18n(
"KMail &Introduction"),
nullptr,
3146 i18n(
"Display KMail's Welcome Page") ),
3147 0,
this, TQ_SLOT(slotIntro()),
3148 actionCollection(),
"help_kmail_welcomepage" );
3152 (void)
new TDEAction( i18n(
"Configure &Notifications..."),
3154 TQ_SLOT(slotEditNotifications()), actionCollection(),
3155 "kmail_configure_notifications" );
3157 (void)
new TDEAction( i18n(
"&Configure KMail..."),
3158 "configure", 0, kmkernel,
3159 TQ_SLOT(slotShowConfigurationDialog()), actionCollection(),
3160 "kmail_configure_kmail" );
3162 KStdAction::undo(
this, TQ_SLOT(slotUndo()), actionCollection(),
"kmail_undo");
3164 KStdAction::tipOfDay(
this, TQ_SLOT( slotShowTip() ), actionCollection() );
3166 menutimer =
new TQTimer(
this,
"menutimer" );
3167 connect( menutimer, TQ_SIGNAL( timeout() ), TQ_SLOT( updateMessageActions() ) );
3168 connect( kmkernel->undoStack(),
3169 TQ_SIGNAL( undoStackChanged() ),
this, TQ_SLOT( slotUpdateUndo() ));
3171 initializeIMAPActions(
false );
3172 updateMessageActions();
3173 updateCustomTemplateMenus();
3177void KMMainWidget::setupForwardingActionsList()
3179 TQPtrList<TDEAction> mForwardActionList;
3180 if ( GlobalSettings::self()->forwardingInlineByDefault() ) {
3181 mGUIClient->unplugActionList(
"forward_action_list" );
3182 mForwardActionList.append( mForwardInlineAction );
3183 mForwardActionList.append( mForwardAttachedAction );
3184 mForwardActionList.append( mForwardDigestAction );
3185 mForwardActionList.append( mRedirectAction );
3186 mGUIClient->plugActionList(
"forward_action_list", mForwardActionList );
3188 mGUIClient->unplugActionList(
"forward_action_list" );
3189 mForwardActionList.append( mForwardAttachedAction );
3190 mForwardActionList.append( mForwardInlineAction );
3191 mForwardActionList.append( mForwardDigestAction );
3192 mForwardActionList.append( mRedirectAction );
3193 mGUIClient->plugActionList(
"forward_action_list", mForwardActionList );
3198void KMMainWidget::slotEditNotifications()
3200 if(kmkernel->xmlGuiInstance())
3201 KNotifyDialog::configure(
this,
nullptr, kmkernel->xmlGuiInstance()->aboutData());
3203 KNotifyDialog::configure(
this);
3206void KMMainWidget::slotEditKeys()
3208 KKeyDialog::configure( actionCollection(),
3214void KMMainWidget::slotReadOn()
3219 if ( !mMsgView->atBottom() ) {
3220 mMsgView->slotJumpDown();
3223 slotNextUnreadMessage();
3226void KMMainWidget::slotNextUnreadFolder() {
3227 if ( !mFolderTree )
return;
3228 mFolderTree->nextUnreadFolder();
3231void KMMainWidget::slotPrevUnreadFolder() {
3232 if ( !mFolderTree )
return;
3233 mFolderTree->prevUnreadFolder();
3236void KMMainWidget::slotExpandThread()
3238 mHeaders->slotExpandOrCollapseThread(
true );
3241void KMMainWidget::slotCollapseThread()
3243 mHeaders->slotExpandOrCollapseThread(
false );
3246void KMMainWidget::slotExpandAllThreads()
3248 mHeaders->slotExpandOrCollapseAllThreads(
true );
3251void KMMainWidget::slotCollapseAllThreads()
3253 mHeaders->slotExpandOrCollapseAllThreads(
false );
3257void KMMainWidget::slotShowMsgSrc()
3260 mMsgView->setUpdateAttachment(
false );
3261 KMMessage *msg = mHeaders->currentMsg();
3264 KMCommand *command =
new KMShowMsgSrcCommand(
this, msg,
3266 ? mMsgView->isFixedFont()
3273void KMMainWidget::moveSelectedToFolder(
int menuId )
3275 if (mMenuToFolder[menuId])
3276 mHeaders->moveMsgToFolder( mMenuToFolder[menuId] );
3281void KMMainWidget::copySelectedToFolder(
int menuId )
3283 if (mMenuToFolder[menuId])
3284 mHeaders->copyMsgToFolder( mMenuToFolder[menuId] );
3289void KMMainWidget::updateMessageMenu()
3291 mMenuToFolder.clear();
3292 folderTree()->folderToPopupMenu( KMFolderTree::MoveMessage,
this,
3293 &mMenuToFolder, mMoveActionMenu->popupMenu() );
3294 folderTree()->folderToPopupMenu( KMFolderTree::CopyMessage,
this,
3295 &mMenuToFolder, mCopyActionMenu->popupMenu() );
3296 updateMessageActions();
3299void KMMainWidget::startUpdateMessageActionsTimer()
3302 menutimer->start( 20,
true );
3305void KMMainWidget::updateMessageActions()
3308 TQPtrList<TQListViewItem> selectedItems;
3311 for (TQListViewItem *item = mHeaders->firstChild(); item; item = item->itemBelow())
3312 if (item->isSelected() )
3313 selectedItems.append(item);
3314 if ( selectedItems.isEmpty() && mFolder->count() )
3317 count = selectedItems.count();
3318 mMsgActions->setCurrentMessage( mHeaders->currentMsg() );
3319 mMsgActions->setSelectedSernums( mHeaders->selectedSernums() );
3320 mMsgActions->setSelectedVisibleSernums( mHeaders->selectedVisibleSernums() );
3322 mMsgActions->setCurrentMessage(
nullptr );
3325 updateListFilterAction();
3327 bool allSelectedInCommonThread =
false;
3328 if ( mHeaders->isThreaded() && count > 1 ) {
3329 allSelectedInCommonThread =
true;
3330 for ( TQPtrListIterator<TQListViewItem> it( selectedItems ) ;
3331 it.current() ; ++ it ) {
3332 TQListViewItem * item = *it;
3333 if ( !item->parent() && item->childCount()==0 ) {
3334 allSelectedInCommonThread =
false;
3339 else if ( mHeaders->isThreaded() && count == 1 ) {
3340 allSelectedInCommonThread =
true;
3343 TQListViewItem *curItemParent = mHeaders->currentItem();
3344 bool parent_thread = 0;
3345 if ( curItemParent && curItemParent->firstChild() ) parent_thread = 1;
3347 bool mass_actions = count >= 1;
3348 bool thread_actions = mass_actions && allSelectedInCommonThread &&
3349 mHeaders->isThreaded();
3350 bool flags_available = GlobalSettings::self()->allowLocalFlags() || !(mFolder ? mFolder->isReadOnly() :
true);
3351 mThreadStatusMenu->setEnabled( thread_actions );
3354 mWatchThreadAction->setEnabled( thread_actions && flags_available );
3355 mIgnoreThreadAction->setEnabled( thread_actions && flags_available );
3356 mMarkThreadAsNewAction->setEnabled( thread_actions );
3357 mMarkThreadAsReadAction->setEnabled( thread_actions );
3358 mMarkThreadAsUnreadAction->setEnabled( thread_actions );
3359 mToggleThreadTodoAction->setEnabled( thread_actions && flags_available );
3360 mToggleThreadFlagAction->setEnabled( thread_actions && flags_available );
3361 mTrashThreadAction->setEnabled( thread_actions && mFolder->canDeleteMessages() );
3362 mDeleteThreadAction->setEnabled( thread_actions && mFolder->canDeleteMessages() );
3364 if (mFolder && mHeaders && mHeaders->currentMsg()) {
3365 if (thread_actions) {
3366 mToggleThreadTodoAction->setChecked(mHeaders->currentMsg()->isTodo());
3367 mToggleThreadFlagAction->setChecked(mHeaders->currentMsg()->isImportant());
3368 mWatchThreadAction->setChecked( mHeaders->currentMsg()->isWatched());
3369 mIgnoreThreadAction->setChecked( mHeaders->currentMsg()->isIgnored());
3373 mMoveActionMenu->setEnabled( mass_actions && mFolder->canDeleteMessages() );
3374 mMoveMsgToFolderAction->setEnabled( mass_actions && mFolder->canDeleteMessages() );
3375 mCopyActionMenu->setEnabled( mass_actions );
3376 mTrashAction->setEnabled( mass_actions && mFolder->canDeleteMessages() );
3377 mDeleteAction->setEnabled( mass_actions && mFolder->canDeleteMessages() );
3378 mFindInMessageAction->setEnabled( mass_actions && !kmkernel->folderIsTemplates( mFolder ) );
3379 mForwardInlineAction->setEnabled( mass_actions && !kmkernel->folderIsTemplates( mFolder ));
3380 mForwardAttachedAction->setEnabled( mass_actions && !kmkernel->folderIsTemplates( mFolder ) );
3381 mForwardDigestAction->setEnabled( ( count > 1 || parent_thread ) && !kmkernel->folderIsTemplates( mFolder ) );
3383 forwardMenu()->setEnabled( mass_actions && !kmkernel->folderIsTemplates( mFolder ));
3385 bool single_actions = count == 1;
3386 mUseAction->setEnabled( single_actions &&
3387 kmkernel->folderIsTemplates( mFolder ) );
3388 filterMenu()->setEnabled( single_actions );
3389 redirectAction()->setEnabled( single_actions && !kmkernel->folderIsTemplates( mFolder ) );
3390 printAction()->setEnabled( single_actions );
3391 viewSourceAction()->setEnabled( single_actions );
3393 mSendAgainAction->setEnabled( single_actions
3394 && ( ( mHeaders->currentMsg() && mHeaders->currentMsg()->isSent() )
3395 || ( mFolder && mHeaders->currentMsg() &&
3396 kmkernel->folderIsSentMailFolder( mFolder ) ) ) );
3397 mSaveAsAction->setEnabled( mass_actions );
3398 bool mails = mFolder && mFolder->count();
3399 bool enable_goto_unread = mails
3400 || (GlobalSettings::self()->loopOnGotoUnread() == GlobalSettings::EnumLoopOnGotoUnread::LoopInAllFolders);
3401 actionCollection()->action(
"go_next_message" )->setEnabled( mails );
3402 actionCollection()->action(
"go_next_unread_message" )->setEnabled( enable_goto_unread );
3403 actionCollection()->action(
"go_prev_message" )->setEnabled( mails );
3404 actionCollection()->action(
"go_prev_unread_message" )->setEnabled( enable_goto_unread );
3405 actionCollection()->action(
"send_queued" )->setEnabled( kmkernel->outboxFolder()->count() > 0 );
3406 actionCollection()->action(
"send_queued_via" )->setEnabled( kmkernel->outboxFolder()->count() > 0 );
3407 slotUpdateOnlineStatus(
static_cast<GlobalSettingsBase::EnumNetworkState::type
>( GlobalSettings::self()->networkState() ) );
3408 if (action(
"edit_undo" ))
3409 action(
"edit_undo" )->setEnabled( mHeaders->canUndo() );
3414 if((aIdx = mHeaders->currentItemIndex()) <= -1)
3416 if(!(msg = mFolder->getMsg(aIdx)))
3419 if ((
KMFolder*)mFolder == kmkernel->outboxFolder())
3423 mApplyAllFiltersAction->setEnabled(count);
3424 mApplyFilterActionsMenu->setEnabled(count);
3428void KMMainWidget::updateMarkAsReadAction()
3430 mMarkAllAsReadAction->setEnabled( mFolder && (mFolder->countUnread() > 0) );
3434void KMMainWidget::updateFolderMenu()
3436 bool folderWithContent = mFolder && !mFolder->noContent();
3437 bool multiFolder = folderTree()->selectedFolders().count() > 1;
3438 mModifyFolderAction->setEnabled( folderWithContent && !multiFolder );
3439 mFolderMailingListPropertiesAction->setEnabled( folderWithContent && !multiFolder );
3440 mCompactFolderAction->setEnabled( folderWithContent && !multiFolder );
3443 bool imap = mFolder && mFolder->folderType() == KMFolderTypeImap;
3444 bool cachedImap = mFolder && mFolder->folderType() == KMFolderTypeCachedImap;
3446 bool knownImapPath = cachedImap && !
static_cast<KMFolderCachedImap*
>( mFolder->storage() )->imapPath().isEmpty();
3447 mRefreshFolderAction->setEnabled( folderWithContent && ( imap
3448 || ( cachedImap && knownImapPath ) ) && !multiFolder );
3449 if ( mTroubleshootFolderAction )
3450 mTroubleshootFolderAction->setEnabled( folderWithContent && ( cachedImap && knownImapPath ) && !multiFolder );
3452 mEmptyFolderAction->setEnabled( folderWithContent &&
3453 ( mFolder->count() > 0 ) && mFolder->canDeleteMessages() &&
3455 mEmptyFolderAction->setText( ( mFolder && kmkernel->folderIsTrash( mFolder ) ) ?
3456 i18n(
"E&mpty Trash" ) :
3457 i18n(
"&Move All Messages to Trash" ) );
3459 mRemoveFolderAction->setEnabled( mFolder &&
3460 !mFolder->isSystemFolder() &&
3461 mFolder->canDeleteMessages() &&
3462 !multiFolder && !mFolder->noContent() &&
3463 !mFolder->mailCheckInProgress() );
3464 mRemoveFolderAction->setText( mFolder &&
3465 mFolder->folderType() == KMFolderTypeSearch ?
3466 i18n(
"&Delete Search" ) :
3467 i18n(
"&Delete Folder" ) );
3469 if ( mArchiveFolderAction )
3470 mArchiveFolderAction->setEnabled( mFolder && !multiFolder );
3471 mExpireFolderAction->setEnabled( mFolder && mFolder->isAutoExpire() && !multiFolder && mFolder->canDeleteMessages() );
3472 updateMarkAsReadAction();
3474 mPreferHtmlAction->setEnabled( mHeaders->folder() ?
true : false );
3475 mPreferHtmlLoadExtAction->setEnabled( mHeaders->folder() && (mHtmlPref ? !mFolderHtmlPref : mFolderHtmlPref) ? true : false );
3476 mThreadMessagesAction->setEnabled( mHeaders->folder() ?
true : false );
3478 mPreferHtmlAction->setChecked( mHtmlPref ? !mFolderHtmlPref : mFolderHtmlPref );
3479 mPreferHtmlLoadExtAction->setChecked( mHtmlLoadExtPref ? !mFolderHtmlLoadExtPref : mFolderHtmlLoadExtPref );
3480 mThreadMessagesAction->setChecked(
3481 mThreadPref ? !mFolderThreadPref : mFolderThreadPref );
3482 mThreadBySubjectAction->setEnabled(
3483 mHeaders->folder() ? ( mThreadMessagesAction->isChecked()) : false );
3484 mThreadBySubjectAction->setChecked( mFolderThreadSubjPref );
3486 mNewFolderAction->setEnabled( !multiFolder && ( mFolder && mFolder->folderType() != KMFolderTypeSearch ));
3487 mRemoveDuplicatesAction->setEnabled( !multiFolder && mFolder && mFolder->canDeleteMessages() );
3488 mFolderShortCutCommandAction->setEnabled( !multiFolder );
3493static TQString fmt(
long n) {
3496 if(n > 1024*1024*1024)
3497 sprintf(buf,
"%0.2f GB", ((
double)n)/1024.0/1024.0/1024.0);
3498 else if(n > 1024*1024)
3499 sprintf(buf,
"%0.2f MB", ((
double)n)/1024.0/1024.0);
3501 sprintf(buf,
"%0.2f KB", ((
double)n)/1024.0);
3503 sprintf(buf,
"%ld Byte", n);
3504 return TQString(buf);
3508void KMMainWidget::slotMemInfo() {
3513 TQString s = TQString(
"\nMALLOC - Info\n\n"
3514 "Number of mmapped regions : %1\n"
3515 "Memory allocated in use : %2\n"
3516 "Memory allocated, not used: %3\n"
3517 "Memory total allocated : %4\n"
3518 "Max. freeable memory : %5\n")
3519 .arg(mi.hblks).arg(fmt(mi.uordblks)).arg(fmt(mi.fordblks))
3520 .arg(fmt(mi.arena)).arg(fmt(mi.keepcost));
3521 KMessageBox::information(0, s,
"Malloc information", s);
3527void KMMainWidget::slotIntro()
3529 if ( !mMsgView )
return;
3531 mMsgView->clear(
true );
3533 if ( mSearchAndHeaders && mHeaders && mLongFolderList )
3534 mSearchAndHeaders->hide();
3537 mMsgView->displayAboutPage();
3542void KMMainWidget::slotShowStartupFolder()
3544 if ( mFolderTree ) {
3545 mFolderTree->reload();
3546 mFolderTree->readConfig();
3548 mFolderTree->cleanupConfigFile();
3551 connect( kmkernel->filterMgr(), TQ_SIGNAL( filterListUpdated() ),
3552 this, TQ_SLOT( initializeFilterActions() ));
3555 initializeFilterActions();
3558 initializeFolderShortcutActions();
3561 if ( kmkernel->firstStart() ||
3562 GlobalSettings::self()->previousNewFeaturesMD5() != newFeaturesMD5 ) {
3563 GlobalSettings::self()->setPreviousNewFeaturesMD5( newFeaturesMD5 );
3569 if ( !mStartupFolder.isEmpty() ) {
3571 startup = kmkernel->findFolderById( mStartupFolder );
3574 startup = kmkernel->inboxFolder();
3576 if ( mFolderTree ) {
3577 mFolderTree->showFolder( startup );
3581void KMMainWidget::slotShowTip()
3583 KTipDialog::showTip(
this, TQString(),
true );
3587void KMMainWidget::slotChangeCaption(TQListViewItem * i)
3592 for ( TQListViewItem * item = i ; item ; item = item->parent() )
3593 names.prepend( item->text(0) );
3594 emit captionChangeRequest( names.join(
"/" ) );
3598void KMMainWidget::removeDuplicates()
3603 mHeaders->setFolder(
nullptr);
3604 TQMap< TQString, TQValueList<int> > idMD5s;
3605 TQValueList<int> redundantIds;
3606 TQValueList<int>::Iterator kt;
3607 mFolder->
open(
"removedups");
3608 for (
int i = mFolder->count() - 1; i >= 0; --i) {
3609 TQString
id = (*mFolder)[i]->msgIdMD5();
3610 if ( !
id.isEmpty() ) {
3611 TQString subjMD5 = (*mFolder)[i]->strippedSubjectMD5();
3613 if ( idMD5s.contains(
id) )
3614 other = idMD5s[
id].first();
3616 idMD5s[id].append( i );
3617 if ( other != -1 ) {
3618 TQString otherSubjMD5 = (*mFolder)[other]->strippedSubjectMD5();
3619 if (otherSubjMD5 == subjMD5)
3620 idMD5s[id].append( i );
3624 TQMap< TQString, TQValueList<int> >::Iterator it;
3625 for ( it = idMD5s.begin(); it != idMD5s.end() ; ++it ) {
3626 TQValueList<int>::Iterator jt;
3627 bool finished =
false;
3628 for ( jt = (*it).begin(); jt != (*it).end() && !finished; ++jt )
3629 if (!((*mFolder)[*jt]->isUnread())) {
3631 (*it).prepend( *jt );
3634 for ( jt = (*it).begin(), ++jt; jt != (*it).end(); ++jt )
3635 redundantIds.append( *jt );
3637 qHeapSort( redundantIds );
3638 kt = redundantIds.end();
3639 int numDuplicates = 0;
3640 if (kt != redundantIds.begin())
do {
3641 mFolder->removeMsg( *(--kt) );
3644 while (kt != redundantIds.begin());
3646 mFolder->close(
"removedups");
3647 mHeaders->setFolder(oFolder);
3649 if ( numDuplicates )
3650 msg = i18n(
"Removed %n duplicate message.",
3651 "Removed %n duplicate messages.", numDuplicates );
3653 msg = i18n(
"No duplicate messages found.");
3654 BroadcastStatus::instance()->setStatusMsg( msg );
3659void KMMainWidget::slotUpdateUndo()
3661 if (actionCollection()->action(
"edit_undo" ))
3662 actionCollection()->action(
"edit_undo" )->setEnabled( mHeaders->canUndo() );
3667void KMMainWidget::clearFilterActions()
3669 if ( !mFilterTBarActions.isEmpty() ) {
3670 if ( mGUIClient->factory() )
3671 mGUIClient->unplugActionList(
"toolbar_filter_actions" );
3672 mFilterTBarActions.clear();
3674 mApplyFilterActionsMenu->popupMenu()->clear();
3675 if ( !mFilterMenuActions.isEmpty() ) {
3676 if ( mGUIClient->factory() )
3677 mGUIClient->unplugActionList(
"menu_filter_actions" );
3678 mFilterMenuActions.clear();
3680 mFilterCommands.clear();
3684void KMMainWidget::initializeFolderShortcutActions()
3690 bool old = actionCollection()->isAutoConnectShortcuts();
3692 actionCollection()->setAutoConnectShortcuts(
true );
3693 TQValueList< TQGuardedPtr< KMFolder > > folders = kmkernel->allFolders();
3694 TQValueList< TQGuardedPtr< KMFolder > >::Iterator it = folders.begin();
3695 while ( it != folders.end() ) {
3698 slotShortcutChanged( folder );
3700 actionCollection()->setAutoConnectShortcuts( old );
3705void KMMainWidget::initializeFilterActions()
3707 TQString filterName, normalizedName;
3708 KMMetaFilterActionCommand *filterCommand;
3709 TDEAction *filterAction =
nullptr;
3711 clearFilterActions();
3712 mApplyAllFiltersAction->plug(mApplyFilterActionsMenu->popupMenu());
3713 bool addedSeparator =
false;
3714 TQValueListConstIterator<KMFilter*> it = kmkernel->filterMgr()->filters().constBegin();
3715 for ( ;it != kmkernel->filterMgr()->filters().constEnd(); ++it ) {
3716 if (!(*it)->isEmpty() && (*it)->configureShortcut()) {
3717 filterName = TQString(
"Filter %1").arg((*it)->name());
3718 normalizedName = filterName.replace(
" ",
"_");
3719 if (action(normalizedName.utf8()))
3721 filterCommand =
new KMMetaFilterActionCommand(*it, mHeaders,
this);
3722 mFilterCommands.append(filterCommand);
3723 TQString as = i18n(
"Filter %1").arg((*it)->name());
3724 TQString icon = (*it)->icon();
3725 if ( icon.isEmpty() )
3727 filterAction =
new TDEAction(as, icon, (*it)->shortcut(), filterCommand,
3728 TQ_SLOT(start()), actionCollection(),
3729 normalizedName.local8Bit());
3730 if(!addedSeparator) {
3731 mApplyFilterActionsMenu->popupMenu()->insertSeparator();
3732 addedSeparator = !addedSeparator;
3733 mFilterMenuActions.append(
new TDEActionSeparator());
3735 filterAction->plug( mApplyFilterActionsMenu->popupMenu() );
3736 mFilterMenuActions.append(filterAction);
3737 if ( (*it)->configureToolbar() )
3738 mFilterTBarActions.append(filterAction);
3741 if ( !mFilterMenuActions.isEmpty() && mGUIClient->factory() )
3742 mGUIClient->plugActionList(
"menu_filter_actions", mFilterMenuActions );
3743 if ( !mFilterTBarActions.isEmpty() && mGUIClient->factory() ) {
3744 mFilterTBarActions.prepend( mToolbarActionSeparator );
3745 mGUIClient->plugActionList(
"toolbar_filter_actions", mFilterTBarActions );
3749void KMMainWidget::slotFolderRemoved(
KMFolder *folder )
3751 mFolderShortcutCommands.remove( folder->
idString() );
3755void KMMainWidget::initializeIMAPActions(
bool setState )
3757 bool hasImapAccount =
false;
3758 for( KMAccount *a = kmkernel->acctMgr()->first(); a;
3759 a = kmkernel->acctMgr()->next() ) {
3760 if ( a->type() ==
"cachedimap" ) {
3761 hasImapAccount =
true;
3765 if (hasImapAccount ==
static_cast<bool>(mTroubleshootFolderAction))
3768 KXMLGUIFactory* factory = mGUIClient->factory();
3770 factory->removeClient( mGUIClient );
3772 if ( !mTroubleshootFolderAction ) {
3773 mTroubleshootFolderAction =
new TDEAction( i18n(
"&Troubleshoot IMAP Cache..."),
"wizard", 0,
3774 this, TQ_SLOT(slotTroubleshootFolder()), actionCollection(),
"troubleshoot_folder" );
3778 delete mTroubleshootFolderAction ;
3779 mTroubleshootFolderAction =
nullptr;
3783 factory->addClient( mGUIClient );
3786bool KMMainWidget::shortcutIsValid(
const TDEShortcut &sc )
const
3788 TDEActionPtrList actions = actionCollection()->actions();
3789 TDEActionPtrList::Iterator it( actions.begin() );
3790 for ( ; it != actions.end(); it++ ) {
3791 if ( (*it)->shortcut() == sc )
return false;
3796void KMMainWidget::slotShortcutChanged(
KMFolder *folder )
3799 mFolderShortcutCommands.remove( folder->
idString() );
3800 if ( folder->shortcut().isNull() )
3803 FolderShortcutCommand *c =
new FolderShortcutCommand(
this, folder );
3804 mFolderShortcutCommands.insert( folder->
idString(), c );
3806 TQString actionlabel = TQString(
"FolderShortcut %1").arg( folder->
prettyURL() );
3807 TQString actionname = TQString(
"FolderShortcut %1").arg( folder->
idString() );
3808 TQString normalizedName = actionname.replace(
" ",
"_");
3810 new TDEAction(actionlabel, folder->shortcut(), c, TQ_SLOT(start()),
3811 actionCollection(), normalizedName.local8Bit());
3812 action->setIcon( folder->unreadIconPath() );
3813 c->setAction( action );
3817TQString KMMainWidget::findCurrentImapPath()
3820 if (!mFolder)
return startPath;
3821 if (mFolder->folderType() == KMFolderTypeImap)
3823 startPath =
static_cast<KMFolderImap*
>(mFolder->storage())->imapPath();
3824 }
else if (mFolder->folderType() == KMFolderTypeCachedImap)
3826 startPath =
static_cast<KMFolderCachedImap*
>(mFolder->storage())->imapPath();
3832ImapAccountBase* KMMainWidget::findCurrentImapAccountBase()
3834 ImapAccountBase* account =
nullptr;
3835 if (!mFolder)
return account;
3836 if (mFolder->folderType() == KMFolderTypeImap)
3838 account =
static_cast<KMFolderImap*
>(mFolder->storage())->account();
3839 }
else if (mFolder->folderType() == KMFolderTypeCachedImap)
3841 account =
static_cast<KMFolderCachedImap*
>(mFolder->storage())->account();
3847void KMMainWidget::slotSubscriptionDialog()
3849 if ( !kmkernel->askToGoOnline() )
3851 ImapAccountBase* account = findCurrentImapAccountBase();
3852 if ( !account )
return;
3853 const TQString startPath = findCurrentImapPath();
3856 SubscriptionDialog * dialog =
3857 new SubscriptionDialog(
this, i18n(
"Subscription"), account, startPath);
3858 if ( dialog->exec() ) {
3860 if (mFolder->folderType() == KMFolderTypeImap)
3861 static_cast<KMFolderImap*
>(mFolder->storage())->account()->listDirectory();
3866void KMMainWidget::slotLocalSubscriptionDialog()
3868 ImapAccountBase* account = findCurrentImapAccountBase();
3869 if ( !account )
return;
3871 const TQString startPath = findCurrentImapPath();
3873 LocalSubscriptionDialog *dialog =
3874 new LocalSubscriptionDialog(
this, i18n(
"Local Subscription"), account, startPath);
3875 if ( dialog->exec() ) {
3877 if (mFolder->folderType() == KMFolderTypeImap)
3878 static_cast<KMFolderImap*
>(mFolder->storage())->account()->listDirectory();
3883void KMMainWidget::slotFolderTreeColumnsChanged()
3885 mTotalColumnToggle->setChecked( mFolderTree->isTotalActive() );
3886 mUnreadColumnToggle->setChecked( mFolderTree->isUnreadActive() );
3887 mSizeColumnToggle->setChecked( mFolderTree->isSizeActive() );
3888 mUnreadTextToggle->setChecked( !mFolderTree->isUnreadActive() );
3891void KMMainWidget::toggleSystemTray()
3893 if ( !mSystemTray && GlobalSettings::self()->systemTrayEnabled() ) {
3896 else if ( mSystemTray && !GlobalSettings::self()->systemTrayEnabled() ) {
3898 kdDebug(5006) <<
"deleting systray" << endl;
3900 mSystemTray =
nullptr;
3905 mSystemTray->setMode( GlobalSettings::self()->systemTrayPolicy() );
3909void KMMainWidget::slotAntiSpamWizard()
3911 AntiSpamWizard wiz( AntiSpamWizard::AntiSpam,
this, folderTree() );
3916void KMMainWidget::slotAntiVirusWizard()
3918 AntiSpamWizard wiz( AntiSpamWizard::AntiVirus,
this, folderTree() );
3923void KMMainWidget::slotFilterLogViewer()
3930void KMMainWidget::updateFileMenu()
3932 TQStringList actList = kmkernel->acctMgr()->getAccounts();
3934 actionCollection()->action(
"check_mail")->setEnabled( actList.size() > 0 );
3935 actionCollection()->action(
"check_mail_in")->setEnabled( actList.size() > 0 );
3936 actionCollection()->action(
"favorite_check_mail")->setEnabled( actList.size() > 0 );
3941void KMMainWidget::setAccelsEnabled(
bool enabled )
3943 actionCollection()->tdeaccel()->setEnabled( enabled );
3954TQString KMMainWidget::overrideEncoding()
const
3957 return mMsgView->overrideEncoding();
3959 return GlobalSettings::self()->overrideCharacterEncoding();
3962void KMMainWidget::slotCreateTodo()
3964 KMMessage *msg = mHeaders->currentMsg();
3967 KMCommand *command =
new CreateTodoCommand(
this, msg );
3971void KMMainWidget::setupFolderView()
3973 if ( GlobalSettings::self()->enableFavoriteFolderView() ) {
3974 mFolderView = mFolderViewSplitter;
3975 mFolderTree->reparent( mFolderViewSplitter, 0, TQPoint( 0, 0 ) );
3976 mFolderViewSplitter->show();
3977 mFavoriteFolderView->show();
3979 mFolderView = mFolderTree;
3980 mFolderViewSplitter->hide();
3981 mFavoriteFolderView->hide();
3983 mFolderView->reparent( mFolderViewParent, 0, TQPoint( 0, 0 ) );
3984 mFolderViewParent->moveToFirst( mFolderView );
3985 mFolderTree->show();
3989void KMMainWidget::slotRequestFullSearchFromQuickSearch()
3995 assert( mSearchWin );
3998 int status = mQuickSearchLine->currenStatus();
3999 if ( status != 0 ) {
4002 mSearchWin->setSearchPattern( pattern );
4005void KMMainWidget::updateVactionScripStatus(
bool active)
4007 mVacationIndicatorActive = active;
4009 mVacationScriptIndicator->setText( i18n(
"Out of office reply active") );
4010 mVacationScriptIndicator->setPaletteBackgroundColor( TQt::yellow );
4011 mVacationScriptIndicator->setCursor( TQCursor( TQt::PointingHandCursor ) );
4012 mVacationScriptIndicator->show();
4014 mVacationScriptIndicator->hide();
sets a cursor and makes sure it's restored on destruction Create a KCursorSaver object when you want ...
Dialog for handling the properties of a mail folder.
TQString idString() const
Returns a string that can be used to identify this folder.
virtual TQString prettyURL() const
URL of the node for visualization purposes.
virtual TQString label() const
Returns the label of the folder for visualization.
bool ignoreNewMail() const
Returns true if the user doesn't want to get notified about new mail in this folder.
KMFolderType folderType() const
Returns the type of this folder.
int open(const char *owner)
Open folder for access.
static KMKernel * self()
normal control stuff
void setReadyToShow(bool v)
Set if the message is ready to be shown.
TQString msgId() const
Get or set the 'Message-Id' header field.
TQString from() const
Get or set the 'From' header field.
TQString to() const
Get or set the 'To' header field.
TQString subject() const
Get or set the 'Subject' header field.
bool transferInProgress() const
Return, if the message should not be deleted.
void setMsgSerNum(unsigned long newMsgSerNum=0)
Sets the message serial number.
KMMessage * unencryptedMsg() const
Returns an unencrypted copy of this message or 0 if none exists.
bool hasUnencryptedMsg() const
Returns true if the message contains an unencrypted copy of itself.
bool isComplete() const
Return true if the complete message is available without referring to the backing store.
void initHeader(uint identity=0)
Initialize header fields.
This class implements a "reader window", that is a window used for reading or viewing messages.
static TQString newFeaturesMD5()
Returns the MD5 hash for the list of new features.
This class is an abstraction of a search over messages.
This class represents a search to be performed against the status of a messsage.
static KMSearchRule * createInstance(const TQCString &field=0, Function function=FuncContains, const TQString &contents=TQString())
Create a search rule of a certain type by instantiating the appro- priate subclass depending on the f...
KMSystemTray extends KSystemTray and handles system tray notification for KMail.
The account manager is responsible for creating accounts of various types via the factory method crea...
KMail Filter Log Collector.
Manages common actions that can be performed on one or more messages.
The SearchWindow class provides a dialog for triggering a search on folders and storing that search a...
Diagnostic info for Sieve.
static TQStringList transportNames()
Returns the list for transport names.
Extends HeaderListQuickSearch to also search inside message bodies using KMMsgIndex.
The TemplateParser transforms a message with a given template.