• Skip to content
  • Skip to link menu
KDE API Reference
  • KDE API Reference
  • kdepim API Reference
  • KDE Home
  • Contact Us
 

mailcommon

  • sources
  • kde-4.14
  • kdepim
  • mailcommon
  • filter
kmfilterdialog.cpp
Go to the documentation of this file.
1 /*
2  Filter Dialog
3  Author: Marc Mutz <mutz@kde.org>
4  based upon work by Stefan Taferner <taferner@kde.org>
5 
6  Copyright (c) 2011-2015 Laurent Montel <montel@kde.org>
7 
8  This program is free software; you can redistribute it and/or modify
9  it under the terms of the GNU General Public License as published by
10  the Free Software Foundation; either version 2 of the License, or
11  (at your option) any later version.
12 
13  This program is distributed in the hope that it will be useful,
14  but WITHOUT ANY WARRANTY; without even the implied warranty of
15  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16  GNU General Public License for more details.
17 
18  You should have received a copy of the GNU General Public License along
19  with this program; if not, write to the Free Software Foundation, Inc.,
20  51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
21 */
22 
23 #include "kmfilterdialog.h"
24 #include "kmfilterlistbox.h"
25 
26 #include "filteractions/filteractiondict.h"
27 #include "filteractions/filteractionwidget.h"
28 #include "filterimporterexporter.h"
29 #include "filterselectiondialog.h"
30 #include "kmfilteraccountlist.h"
31 using MailCommon::FilterImporterExporter;
32 #include "filtermanager.h"
33 #include "folderrequester.h"
34 #include "kernel/mailkernel.h"
35 #include "util/mailutil.h"
36 #include "search/searchpatternedit.h"
37 #include "filterconverter/filterconverttosieve.h"
38 
39 #include <Akonadi/ItemFetchJob>
40 
41 #include <KConfigGroup>
42 #include <KDebug>
43 #include <KIconLoader>
44 #include <KInputDialog>
45 #include <KJob>
46 #include <KKeySequenceWidget>
47 #include <KListWidgetSearchLine>
48 #include <KLocale>
49 #include <KMessageBox>
50 #include <KPushButton>
51 #include <KTabWidget>
52 #include <KWindowSystem>
53 #include <KIconButton>
54 
55 #include <QApplication>
56 #include <QHeaderView>
57 #include <QButtonGroup>
58 #include <QCheckBox>
59 #include <QGridLayout>
60 #include <QLabel>
61 #include <QListWidget>
62 #include <QMenu>
63 #include <QRadioButton>
64 #include <QTreeWidget>
65 #include <QVBoxLayout>
66 #include <QShortcut>
67 #include <QSplitter>
68 #include <QPointer>
69 #include <QKeyEvent>
70 
71 Q_DECLARE_METATYPE(MailCommon::FilterImporterExporter::FilterType)
72 using namespace MailCommon;
73 
74 namespace MailCommon {
75 
76 //=============================================================================
77 //
78 // class KMFilterDialog (the filter dialog)
79 //
80 //=============================================================================
81 
82 
83 
84 KMFilterDialog::KMFilterDialog( const QList<KActionCollection*> &actionCollection,
85  QWidget *parent, bool createDummyFilter )
86  : KDialog( parent ),
87  mFilter( 0 ),
88  mDoNotClose( false ),
89  mIgnoreFilterUpdates( true )
90 {
91  setCaption( i18n( "Filter Rules" ) );
92  setButtons( Help|Ok|Apply|Cancel|User1|User2|User3);
93  setModal( false );
94  setButtonFocus( Ok );
95  KWindowSystem::setIcons( winId(),
96  qApp->windowIcon().pixmap( IconSize( KIconLoader::Desktop ),
97  IconSize( KIconLoader::Desktop ) ),
98  qApp->windowIcon().pixmap( IconSize( KIconLoader::Small ),
99  IconSize( KIconLoader::Small ) ) );
100  setHelp( QLatin1String("filters"), QLatin1String("kmail") );
101  setButtonText( User1, i18n( "Import..." ) );
102  setButtonText( User2, i18n( "Export..." ) );
103  setButtonText( User3, i18n( "Convert to..." ) );
104  QMenu *menu = new QMenu();
105 
106  QAction *act = new QAction( i18n( "KMail filters" ), this );
107  act->setData( QVariant::fromValue(MailCommon::FilterImporterExporter::KMailFilter) );
108  menu->addAction( act );
109 
110  act = new QAction( i18n( "Thunderbird filters" ), this );
111  act->setData( QVariant::fromValue(MailCommon::FilterImporterExporter::ThunderBirdFilter) );
112  menu->addAction( act );
113 
114  act = new QAction( i18n( "Evolution filters" ), this );
115  act->setData( QVariant::fromValue(MailCommon::FilterImporterExporter::EvolutionFilter) );
116  menu->addAction( act );
117 
118  act = new QAction( i18n( "Sylpheed filters" ), this );
119  act->setData( QVariant::fromValue(MailCommon::FilterImporterExporter::SylpheedFilter) );
120  menu->addAction( act );
121 
122  act = new QAction( i18n( "Procmail filters" ), this );
123  act->setData( QVariant::fromValue(MailCommon::FilterImporterExporter::ProcmailFilter) );
124  menu->addAction( act );
125 
126  act = new QAction( i18n( "Balsa filters" ), this );
127  act->setData( QVariant::fromValue(MailCommon::FilterImporterExporter::BalsaFilter) );
128  menu->addAction( act );
129 
130  act = new QAction( i18n( "Claws Mail filters" ), this );
131  act->setData( QVariant::fromValue(MailCommon::FilterImporterExporter::ClawsMailFilter) );
132  menu->addAction( act );
133 
134  act = new QAction( i18n( "Icedove Mail filters" ), this );
135  act->setData( QVariant::fromValue(MailCommon::FilterImporterExporter::IcedoveFilter) );
136  menu->addAction( act );
137 #if 0
138  //KF5 add i18n
139  act = new QAction( QLatin1String( "GMail filters" ), this );
140  act->setData( QVariant::fromValue(MailCommon::FilterImporterExporter::GmailFilter) );
141  menu->addAction( act );
142 #endif
143  connect( menu, SIGNAL(triggered(QAction*)), SLOT(slotImportFilter(QAction*)) );
144 
145  button( KDialog::User1 )->setMenu( menu );
146 
147  menu = new QMenu();
148 
149  act = new QAction( i18n( "Sieve script" ), this );
150  connect(act, SIGNAL(triggered(bool)), SLOT(slotExportAsSieveScript()));
151  menu->addAction( act );
152  button( KDialog::User3 )->setMenu( menu );
153 
154 
155  connect( this, SIGNAL(user2Clicked()),
156  this, SLOT(slotExportFilters()) );
157  enableButtonApply( false );
158 
159  QWidget *w = new QWidget( this );
160  setMainWidget( w );
161  QVBoxLayout *topVLayout = new QVBoxLayout( w );
162  QHBoxLayout *topLayout = new QHBoxLayout;
163  topVLayout->addLayout( topLayout );
164  topLayout->setSpacing( spacingHint() );
165  topLayout->setMargin( 0 );
166  QVBoxLayout *vbl2 = 0;
167 
168  QSplitter *splitter = new QSplitter;
169  splitter->setChildrenCollapsible(false);
170  topLayout->addWidget(splitter);
171 
172  mFilterList = new KMFilterListBox( i18n( "Available Filters" ) );
173  splitter->addWidget(mFilterList);
174  KTabWidget *tabWidget = new KTabWidget;
175  splitter->addWidget(tabWidget);
176 
177  QWidget *page1 = new QWidget( tabWidget );
178  tabWidget->addTab( page1, i18nc( "General mail filter settings.", "General" ) );
179  QHBoxLayout * hbl = new QHBoxLayout( page1 );
180  hbl->setSpacing( spacingHint() );
181  hbl->setMargin( marginHint() );
182 
183  QWidget *page2 = new QWidget( tabWidget );
184  tabWidget->addTab( page2, i18nc( "Advanced mail filter settings.","Advanced" ) );
185  vbl2 = new QVBoxLayout( page2 );
186  vbl2->setSpacing( spacingHint() );
187  vbl2->setMargin( marginHint() );
188 
189  QVBoxLayout *vbl = new QVBoxLayout();
190  hbl->addLayout( vbl );
191  vbl->setSpacing( spacingHint() );
192  hbl->setStretchFactor( vbl, 2 );
193 
194  QGroupBox *patternGroupBox = new QGroupBox( i18n( "Filter Criteria" ), page1 );
195  QHBoxLayout *layout = new QHBoxLayout( patternGroupBox );
196  mPatternEdit =
197  new MailCommon::SearchPatternEdit(
198  patternGroupBox, MailCommon::SearchPatternEdit::MatchAllMessages );
199  layout->addWidget( mPatternEdit );
200 
201  vbl->addWidget( patternGroupBox, 0, Qt::AlignTop );
202 
203  QGroupBox *agb = new QGroupBox( i18n( "Filter Actions" ), page1 );
204  QHBoxLayout *layout2 = new QHBoxLayout;
205  mActionLister = new MailCommon::FilterActionWidgetLister( agb );
206  layout2->addWidget( mActionLister );
207  agb->setLayout( layout2 );
208  vbl->addWidget( agb, 0, Qt::AlignTop );
209 
210  mAdvOptsGroup = new QGroupBox( i18n( "Advanced Options" ), page2 );
211  {
212  QGridLayout *gl = new QGridLayout();
213  QVBoxLayout *vbl3 = new QVBoxLayout();
214  gl->addLayout( vbl3, 0, 0 );
215  vbl3->setSpacing( spacingHint() );
216  vbl3->addStretch( 1 );
217 
218  mApplyOnIn = new QCheckBox( i18n( "Apply this filter to incoming messages:" ), mAdvOptsGroup );
219  vbl3->addWidget( mApplyOnIn );
220 
221  QButtonGroup *bg = new QButtonGroup( mAdvOptsGroup );
222 
223  mApplyOnForAll = new QRadioButton( i18n( "from all accounts" ), mAdvOptsGroup );
224  bg->addButton( mApplyOnForAll );
225  vbl3->addWidget( mApplyOnForAll );
226 
227  mApplyOnForTraditional =
228  new QRadioButton( i18n( "from all but online IMAP accounts" ), mAdvOptsGroup );
229  bg->addButton( mApplyOnForTraditional );
230  vbl3->addWidget( mApplyOnForTraditional );
231 
232  mApplyOnForChecked =
233  new QRadioButton( i18n( "from checked accounts only" ), mAdvOptsGroup );
234  bg->addButton( mApplyOnForChecked );
235  vbl3->addWidget( mApplyOnForChecked );
236  vbl3->addStretch( 2 );
237 
238  mAccountList = new KMFilterAccountList( mAdvOptsGroup );
239  gl->addWidget( mAccountList, 0, 1, 4, 3 );
240 
241  mApplyOnOut =
242  new QCheckBox( i18n( "Apply this filter to &sent messages" ), mAdvOptsGroup );
243  mApplyOnOut->setToolTip(
244  i18n( "<p>The filter will be triggered <b>after</b> the message is sent "
245  "and it will only affect the local copy of the message.</p>"
246  "<p>If the recipient's copy also needs to be modified, "
247  "please use \"Apply this filter <b>before</b> sending messages\".</p>" ) );
248  gl->addWidget( mApplyOnOut, 4, 0, 1, 4 );
249 
250  mApplyBeforeOut =
251  new QCheckBox( i18n( "Apply this filter &before sending messages" ), mAdvOptsGroup );
252  mApplyBeforeOut->setToolTip(
253  i18n( "<p>The filter will be triggered <b>before</b> the message is sent "
254  "and it will affect both the local copy and the sent copy of the message.</p>"
255  "<p>This is required if the recipient's copy also needs to be modified.</p>" ) );
256  gl->addWidget( mApplyBeforeOut, 5, 0, 1, 4 );
257 
258 
259  mApplyOnCtrlJ =
260  new QCheckBox( i18n( "Apply this filter on manual &filtering" ), mAdvOptsGroup );
261  gl->addWidget( mApplyOnCtrlJ, 6, 0, 1, 4 );
262 
263  mStopProcessingHere =
264  new QCheckBox( i18n( "If this filter &matches, stop processing here" ), mAdvOptsGroup );
265  gl->addWidget( mStopProcessingHere, 7, 0, 1, 4 );
266 
267  mConfigureShortcut =
268  new QCheckBox( i18n( "Add this filter to the Apply Filter menu" ), mAdvOptsGroup );
269  gl->addWidget( mConfigureShortcut, 8, 0, 1, 2 );
270 
271  QLabel *keyButtonLabel = new QLabel( i18n( "Shortcut:" ), mAdvOptsGroup );
272  keyButtonLabel->setAlignment( Qt::AlignVCenter | Qt::AlignRight );
273  gl->addWidget( keyButtonLabel, 8, 2, 1, 1 );
274 
275  mKeySeqWidget = new KKeySequenceWidget( mAdvOptsGroup );
276  mKeySeqWidget->setObjectName( QLatin1String("FilterShortcutSelector") );
277  gl->addWidget( mKeySeqWidget, 8, 3, 1, 1 );
278  mKeySeqWidget->setEnabled( false );
279  mKeySeqWidget->setModifierlessAllowed( true );
280  mKeySeqWidget->setCheckActionCollections( actionCollection );
281 
282  mConfigureToolbar =
283  new QCheckBox( i18n( "Additionally add this filter to the toolbar" ), mAdvOptsGroup );
284  gl->addWidget( mConfigureToolbar, 9, 0, 1, 4 );
285  mConfigureToolbar->setEnabled( false );
286 
287  KHBox *hbox = new KHBox( mAdvOptsGroup );
288  mFilterActionLabel = new QLabel( i18n( "Icon for this filter:" ), hbox );
289  mFilterActionLabel->setEnabled( false );
290 
291  mFilterActionIconButton = new KIconButton( hbox );
292  mFilterActionLabel->setBuddy( mFilterActionIconButton );
293  mFilterActionIconButton->setIconType( KIconLoader::NoGroup, KIconLoader::Action, false );
294  mFilterActionIconButton->setIconSize( 16 );
295  mFilterActionIconButton->setIcon( QLatin1String("system-run") );
296  mFilterActionIconButton->setEnabled( false );
297 
298  gl->addWidget( hbox, 10, 0, 1, 4 );
299 
300  mAdvOptsGroup->setLayout( gl );
301  }
302  vbl2->addWidget( mAdvOptsGroup, 0, Qt::AlignTop );
303 
304  QHBoxLayout *applySpecificFiltersLayout = new QHBoxLayout;
305  QLabel *lab = new QLabel( i18n( "Run selected filter(s) on: " ) );
306  applySpecificFiltersLayout->addWidget( lab );
307  mFolderRequester = new MailCommon::FolderRequester;
308  mFolderRequester->setNotAllowToCreateNewFolder(true);
309  applySpecificFiltersLayout->addWidget( mFolderRequester );
310  connect( mFolderRequester, SIGNAL(folderChanged(Akonadi::Collection)),
311  this, SLOT(slotFolderChanged(Akonadi::Collection)) );
312  mRunNow = new KPushButton( i18n( "Run Now" ) );
313  mRunNow->setEnabled( false );
314  applySpecificFiltersLayout->addWidget( mRunNow );
315  connect( mRunNow, SIGNAL(clicked()), this, SLOT(slotRunFilters()) );
316  topVLayout->addLayout( applySpecificFiltersLayout );
317  // spacer:
318  vbl->addStretch( 1 );
319 
320  // load the filter parts into the edit widgets
321  connect( mFilterList, SIGNAL(filterSelected(MailCommon::MailFilter*)),
322  this, SLOT(slotFilterSelected(MailCommon::MailFilter*)) );
323 
324  // transfer changes from the 'Apply this filter on...'
325  // combo box to the filter
326  connect( mApplyOnIn, SIGNAL(clicked()),
327  this, SLOT(slotApplicabilityChanged()) );
328  connect( mApplyOnForAll, SIGNAL(clicked()),
329  this, SLOT(slotApplicabilityChanged()) );
330  connect( mApplyOnForTraditional, SIGNAL(clicked()),
331  this, SLOT(slotApplicabilityChanged()) );
332  connect( mApplyOnForChecked, SIGNAL(clicked()),
333  this, SLOT(slotApplicabilityChanged()) );
334  connect( mApplyBeforeOut, SIGNAL(clicked()),
335  this, SLOT(slotApplicabilityChanged()) );
336  connect( mApplyOnOut, SIGNAL(clicked()),
337  this, SLOT(slotApplicabilityChanged()) );
338  connect( mApplyOnCtrlJ, SIGNAL(clicked()),
339  this, SLOT(slotApplicabilityChanged()) );
340  connect( mAccountList, SIGNAL(itemChanged(QTreeWidgetItem*,int)),
341  this, SLOT(slotApplicableAccountsChanged()) );
342 
343  // transfer changes from the 'stop processing here'
344  // check box to the filter
345  connect( mStopProcessingHere, SIGNAL(toggled(bool)),
346  this, SLOT(slotStopProcessingButtonToggled(bool)) );
347 
348  connect( mConfigureShortcut, SIGNAL(toggled(bool)),
349  this, SLOT(slotConfigureShortcutButtonToggled(bool)) );
350 
351  connect( mKeySeqWidget, SIGNAL(keySequenceChanged(QKeySequence)),
352  this, SLOT(slotShortcutChanged(QKeySequence)) );
353 
354  connect( mConfigureToolbar, SIGNAL(toggled(bool)),
355  this, SLOT(slotConfigureToolbarButtonToggled(bool)) );
356 
357  connect( mFilterActionIconButton, SIGNAL(iconChanged(QString)),
358  this, SLOT(slotFilterActionIconChanged(QString)) );
359 
360  // reset all widgets here
361  connect( mFilterList, SIGNAL(resetWidgets()),
362  this, SLOT(slotReset()) );
363 
364  connect( mFilterList, SIGNAL(applyWidgets()),
365  this, SLOT(slotUpdateFilter()) );
366 
367  // support auto-naming the filter
368  connect( mPatternEdit, SIGNAL(maybeNameChanged()),
369  mFilterList, SLOT(slotUpdateFilterName()) );
370 
371  // save filters on 'Apply' or 'OK'
372  connect( this, SIGNAL(buttonClicked(KDialog::ButtonCode)),
373  mFilterList, SLOT(slotApplyFilterChanges(KDialog::ButtonCode)) );
374  connect( button( KDialog::Apply ), SIGNAL(clicked(bool)), this, SLOT(slotApply()) );
375 
376  // save dialog size on 'OK'
377  connect( this, SIGNAL(okClicked()),
378  this, SLOT(slotSaveSize()) );
379 
380  // destruct the dialog on close and Cancel
381  connect( this, SIGNAL(closeClicked()),
382  this, SLOT(slotFinished()) );
383  connect( this, SIGNAL(cancelClicked()),
384  this, SLOT(slotFinished()) );
385 
386  // disable closing when user wants to continue editing
387  connect( mFilterList, SIGNAL(abortClosing()),
388  this, SLOT(slotDisableAccept()) );
389 
390  connect( mFilterList, SIGNAL(filterCreated()), this, SLOT(slotDialogUpdated()) );
391  connect( mFilterList, SIGNAL(filterRemoved(QList<MailCommon::MailFilter*>)),
392  this, SLOT(slotDialogUpdated()) );
393  connect( mFilterList, SIGNAL(filterUpdated(MailCommon::MailFilter*)),
394  this, SLOT(slotDialogUpdated()) );
395  connect( mFilterList, SIGNAL(filterOrderAltered()), this, SLOT(slotDialogUpdated()) );
396  connect( mPatternEdit, SIGNAL(patternChanged()), this, SLOT(slotDialogUpdated()) );
397  connect( mActionLister, SIGNAL(widgetAdded(QWidget*)), this, SLOT(slotDialogUpdated()) );
398  connect( mActionLister, SIGNAL(widgetRemoved()), this, SLOT(slotDialogUpdated()) );
399  connect( mActionLister, SIGNAL(filterModified()), this, SLOT(slotDialogUpdated()) );
400  connect( mActionLister, SIGNAL(clearWidgets()), this, SLOT(slotDialogUpdated()) );
401  KConfigGroup myGroup( KernelIf->config(), "Geometry" );
402  const QSize size = myGroup.readEntry( "filterDialogSize", QSize() );
403  if ( size != QSize() ) {
404  resize( size );
405  } else {
406  adjustSize();
407  }
408 
409  // load the filter list (emits filterSelected())
410  mFilterList->loadFilterList( createDummyFilter );
411  mIgnoreFilterUpdates = false;
412 }
413 
414 void KMFilterDialog::createFilter(const QByteArray &field, const QString &value)
415 {
416  mFilterList->createFilter( field, value );
417 }
418 
419 void KMFilterDialog::accept()
420 {
421  if ( mDoNotClose ) {
422  mDoNotClose = false; // only abort current close attempt
423  } else {
424  KDialog::accept();
425  slotFinished();
426  }
427 }
428 
429 bool KMFilterDialog::event(QEvent* e)
430 {
431  // Close the bar when pressing Escape.
432  // Not using a QShortcut for this because it could conflict with
433  // window-global actions (e.g. Emil Sedgh binds Esc to "close tab").
434  // With a shortcut override we can catch this before it gets to kactions.
435  const bool shortCutOverride = (e->type() == QEvent::ShortcutOverride);
436  if (shortCutOverride || e->type() == QEvent::KeyPress ) {
437  QKeyEvent* kev = static_cast<QKeyEvent* >(e);
438  if (kev->key() == Qt::Key_Escape) {
439  e->ignore();
440  return true;
441  }
442  }
443  return KDialog::event(e);
444 }
445 
446 
447 void KMFilterDialog::slotApply()
448 {
449  enableButtonApply( false );
450 }
451 
452 void KMFilterDialog::slotFinished()
453 {
454  deleteLater();
455 }
456 
457 void KMFilterDialog::slotFolderChanged( const Akonadi::Collection &collection )
458 {
459  mRunNow->setEnabled( collection.isValid() );
460 }
461 
462 void KMFilterDialog::slotRunFilters()
463 {
464  if ( !mFolderRequester->collection().isValid() ) {
465  KMessageBox::information(
466  this,
467  i18nc( "@info",
468  "Unable to apply this filter since there are no folders selected." ),
469  i18n( "No folder selected." ) );
470  return;
471  }
472 
473  if ( isButtonEnabled( KDialog::Apply ) ) {
474  KMessageBox::information(
475  this,
476  i18nc( "@info",
477  "Some filters were changed and not saved yet. "
478  "You must save your filters before they can be applied." ),
479  i18n( "Filters changed." ) );
480  return;
481  }
482  SearchRule::RequiredPart requiredPart = SearchRule::Envelope;
483  const QStringList selectedFiltersId = mFilterList->selectedFilterId( requiredPart, mFolderRequester->collection().resource() );
484  if ( selectedFiltersId.isEmpty() ) {
485  KMessageBox::information(
486  this,
487  i18nc( "@info",
488  "Unable to apply a filter since there are no filters currently selected." ),
489  i18n( "No filters selected." ) );
490  return;
491  }
492  Akonadi::ItemFetchJob *job = new Akonadi::ItemFetchJob( mFolderRequester->collection(), this );
493  job->setProperty( "requiredPart", QVariant::fromValue( requiredPart ) );
494  job->setProperty( "listFilters", QVariant::fromValue( selectedFiltersId ) );
495 
496  connect( job, SIGNAL(result(KJob*)),
497  this, SLOT(slotFetchItemsForFolderDone(KJob*)) );
498 
499  mRunNow->setEnabled( false ); //Disable it
500 }
501 
502 void KMFilterDialog::slotFetchItemsForFolderDone( KJob *job )
503 {
504  Akonadi::ItemFetchJob *fjob = dynamic_cast<Akonadi::ItemFetchJob*>( job );
505  Q_ASSERT( fjob );
506 
507  QStringList filtersId;
508  if ( fjob->property( "listFilters" ).isValid() ) {
509  filtersId = fjob->property( "listFilters" ).toStringList();
510  }
511 
512  SearchRule::RequiredPart requiredPart = SearchRule::Envelope;
513  if ( fjob->property( "requiredPart" ).isValid() ) {
514  requiredPart = fjob->property( "requiredPart" ).value<SearchRule::RequiredPart>();
515  }
516  Akonadi::Item::List items = fjob->items();
517  mRunNow->setEnabled( true );
518  MailCommon::FilterManager::instance()->filter( items, requiredPart, filtersId );
519 }
520 
521 void KMFilterDialog::slotSaveSize() {
522  KConfigGroup myGroup( KernelIf->config(), "Geometry" );
523  myGroup.writeEntry( "filterDialogSize", size() );
524  myGroup.sync();
525 }
526 
527 void KMFilterDialog::slotFilterSelected( MailFilter *aFilter )
528 {
529  Q_ASSERT( aFilter );
530  mIgnoreFilterUpdates = true;
531  mActionLister->setActionList( aFilter->actions() );
532 
533  mAdvOptsGroup->setEnabled( true );
534 
535  mPatternEdit->setSearchPattern( aFilter->pattern() );
536  mFilter = aFilter;
537 
538  kDebug() << "apply on inbound ==" << aFilter->applyOnInbound();
539  kDebug() << "apply on outbound ==" << aFilter->applyOnOutbound();
540  kDebug() << "apply before outbound == " << aFilter->applyBeforeOutbound();
541  kDebug() << "apply on explicit ==" << aFilter->applyOnExplicit();
542 
543  // NOTE: setting these values activates the slot that sets them in
544  // the filter! So make sure we have the correct values _before_ we
545  // set the first one:
546  const bool applyOnIn = aFilter->applyOnInbound();
547  const bool applyOnForAll = aFilter->applicability() == MailFilter::All;
548  const bool applyOnTraditional = aFilter->applicability() == MailFilter::ButImap;
549  const bool applyBeforeOut = aFilter->applyBeforeOutbound();
550  const bool applyOnOut = aFilter->applyOnOutbound();
551  const bool applyOnExplicit = aFilter->applyOnExplicit();
552  const bool stopHere = aFilter->stopProcessingHere();
553  const bool configureShortcut = aFilter->configureShortcut();
554  const bool configureToolbar = aFilter->configureToolbar();
555  const QString icon = aFilter->icon();
556  const KShortcut shortcut( aFilter->shortcut() );
557 
558  mApplyOnIn->setChecked( applyOnIn );
559  mApplyOnForAll->setEnabled( applyOnIn );
560  mApplyOnForTraditional->setEnabled( applyOnIn );
561  mApplyOnForChecked->setEnabled( applyOnIn );
562  mApplyOnForAll->setChecked( applyOnForAll );
563  mApplyOnForTraditional->setChecked( applyOnTraditional );
564  mApplyOnForChecked->setChecked( !applyOnForAll && !applyOnTraditional );
565  mAccountList->setEnabled( mApplyOnForChecked->isEnabled() && mApplyOnForChecked->isChecked() );
566  slotUpdateAccountList();
567  mApplyBeforeOut->setChecked( applyBeforeOut );
568  mApplyOnOut->setChecked( applyOnOut );
569  mApplyOnCtrlJ->setChecked( applyOnExplicit );
570  mStopProcessingHere->setChecked( stopHere );
571  mConfigureShortcut->setChecked( configureShortcut );
572  mKeySeqWidget->setKeySequence( shortcut.primary(),
573  KKeySequenceWidget::NoValidate );
574  mConfigureToolbar->setChecked( configureToolbar );
575  mFilterActionIconButton->setIcon( icon );
576  mIgnoreFilterUpdates = false;
577 }
578 
579 void KMFilterDialog::slotReset()
580 {
581  mFilter = 0;
582  mPatternEdit->reset();
583 
584  mActionLister->reset();
585  mAdvOptsGroup->setEnabled( false );
586  slotUpdateAccountList();
587 }
588 
589 void KMFilterDialog::slotUpdateFilter()
590 {
591  mPatternEdit->updateSearchPattern();
592  mActionLister->updateActionList();
593 }
594 
595 void KMFilterDialog::slotApplicabilityChanged()
596 {
597  if ( mFilter ) {
598  mFilter->setApplyOnInbound( mApplyOnIn->isChecked() );
599  mFilter->setApplyBeforeOutbound( mApplyBeforeOut->isChecked() );
600  mFilter->setApplyOnOutbound( mApplyOnOut->isChecked() );
601  mFilter->setApplyOnExplicit( mApplyOnCtrlJ->isChecked() );
602  if ( mApplyOnForAll->isChecked() ) {
603  mFilter->setApplicability( MailFilter::All );
604  } else if ( mApplyOnForTraditional->isChecked() ) {
605  mFilter->setApplicability( MailFilter::ButImap );
606  } else if ( mApplyOnForChecked->isChecked() ) {
607  mFilter->setApplicability( MailFilter::Checked );
608  }
609 
610  mApplyOnForAll->setEnabled( mApplyOnIn->isChecked() );
611  mApplyOnForTraditional->setEnabled( mApplyOnIn->isChecked() );
612  mApplyOnForChecked->setEnabled( mApplyOnIn->isChecked() );
613  mAccountList->setEnabled( mApplyOnForChecked->isEnabled() && mApplyOnForChecked->isChecked() );
614 
615  // Advanced tab functionality - Update list of accounts this filter applies to
616  mAccountList->applyOnAccount(mFilter);
617 
618  // Enable the apply button
619  slotDialogUpdated();
620 
621  kDebug() << "Setting filter to be applied at"
622  << ( mFilter->applyOnInbound() ? "incoming " : "" )
623  << ( mFilter->applyOnOutbound() ? "outgoing " : "" )
624  << ( mFilter->applyBeforeOutbound() ? "before_outgoing " : "" )
625  << ( mFilter->applyOnExplicit() ? "explicit CTRL-J" : "" );
626  }
627 }
628 
629 void KMFilterDialog::slotApplicableAccountsChanged()
630 {
631  // Advanced tab functionality - Update list of accounts this filter applies to
632  if ( mFilter && mApplyOnForChecked->isEnabled() && mApplyOnForChecked->isChecked() ) {
633 
634  QTreeWidgetItemIterator it( mAccountList );
635 
636  while ( QTreeWidgetItem *item = *it ) {
637  const QString id = item->text( 2 );
638  mFilter->setApplyOnAccount( id, item->checkState( 0 ) == Qt::Checked );
639  ++it;
640  }
641 
642  // Enable the apply button
643  slotDialogUpdated();
644  }
645 }
646 
647 void KMFilterDialog::slotStopProcessingButtonToggled( bool aChecked )
648 {
649  if ( mFilter ) {
650  mFilter->setStopProcessingHere( aChecked );
651 
652  // Enable the apply button
653  slotDialogUpdated();
654  }
655 }
656 
657 void KMFilterDialog::slotConfigureShortcutButtonToggled( bool aChecked )
658 {
659  if ( mFilter ) {
660  mFilter->setConfigureShortcut( aChecked );
661  mKeySeqWidget->setEnabled( aChecked );
662  mConfigureToolbar->setEnabled( aChecked );
663  mFilterActionIconButton->setEnabled( aChecked );
664  mFilterActionLabel->setEnabled( aChecked );
665 
666  // Enable the apply button
667  slotDialogUpdated();
668  }
669 }
670 
671 void KMFilterDialog::slotShortcutChanged( const QKeySequence &newSeq )
672 {
673  if ( mFilter ) {
674  mKeySeqWidget->applyStealShortcut();
675  mFilter->setShortcut( KShortcut( newSeq ) );
676 
677  // Enable the apply button
678  slotDialogUpdated();
679  }
680 }
681 
682 void KMFilterDialog::slotConfigureToolbarButtonToggled( bool aChecked )
683 {
684  if ( mFilter ) {
685  mFilter->setConfigureToolbar( aChecked );
686  // Enable the apply button
687  slotDialogUpdated();
688  }
689 }
690 
691 void KMFilterDialog::slotFilterActionIconChanged( const QString &icon )
692 {
693  if ( mFilter ) {
694  mFilter->setIcon( icon );
695  // Enable the apply button
696  slotDialogUpdated();
697  }
698 }
699 
700 void KMFilterDialog::slotUpdateAccountList()
701 {
702  mAccountList->updateAccountList(mFilter);
703 }
704 
705 void KMFilterDialog::slotImportFilter( QAction *act )
706 {
707  if ( act ) {
708  importFilters( act->data().value<MailCommon::FilterImporterExporter::FilterType>() );
709  }
710 }
711 
712 void KMFilterDialog::importFilters( MailCommon::FilterImporterExporter::FilterType type )
713 {
714  FilterImporterExporter importer( this );
715  bool canceled = false;
716  QList<MailFilter *> filters = importer.importFilters( canceled, type );
717  if ( canceled ) {
718  return;
719  }
720 
721  if ( filters.isEmpty() ) {
722  KMessageBox::information( this, i18n( "No filter was imported." ) );
723  return;
724  }
725  QStringList listOfFilter;
726  QList<MailFilter*>::ConstIterator end( filters.constEnd() );
727 
728  for ( QList<MailFilter*>::ConstIterator it = filters.constBegin(); it != end; ++it ) {
729  mFilterList->appendFilter( *it ); // no need to deep copy, ownership passes to the list
730  listOfFilter << (*it)->name();
731  }
732 
733  KMessageBox::informationList(
734  this,
735  i18n( "Filters which were imported:" ),
736  listOfFilter );
737 }
738 
739 void KMFilterDialog::slotExportFilters()
740 {
741  FilterImporterExporter exporter( this );
742  bool wasCanceled = false;
743  const QList<MailFilter *> filters = mFilterList->filtersForSaving( false, wasCanceled );
744  exporter.exportFilters( filters );
745 }
746 
747 void KMFilterDialog::slotDisableAccept()
748 {
749  mDoNotClose = true;
750 }
751 
752 void KMFilterDialog::slotDialogUpdated()
753 {
754  kDebug() << "Detected a change in data bound to the dialog!";
755  if ( !mIgnoreFilterUpdates ) {
756  enableButtonApply( true );
757  }
758 }
759 
760 void KMFilterDialog::slotExportAsSieveScript()
761 {
762  if ( isButtonEnabled( KDialog::Apply ) ) {
763  KMessageBox::information(
764  this,
765  i18nc( "@info",
766  "Some filters were changed and not saved yet.<br>"
767  "You must save your filters before they can be exported." ),
768  i18n( "Filters changed." ) );
769  return;
770  }
771  KMessageBox::information(this, i18n("We cannot convert all KMail filters to sieve scripts but we can try :)"), i18n("Convert KMail filters to sieve scripts"));
772  bool wasCanceled = false;
773  const QList<MailFilter *> filters = mFilterList->filtersForSaving( false, wasCanceled );
774  QPointer<FilterSelectionDialog> dlg = new FilterSelectionDialog( this );
775  dlg->setFilters( filters );
776  if ( dlg->exec() == QDialog::Accepted ) {
777  QList<MailFilter*> lst = dlg->selectedFilters();
778  if (!lst.isEmpty()) {
779  FilterConvertToSieve convert(lst);
780  convert.convert();
781  qDeleteAll(lst);
782  } else {
783  KMessageBox::information(this, i18n("No filters selected."), i18n("Convert KMail filters to sieve scripts"));
784  }
785  }
786  delete dlg;
787 }
788 
789 }
790 
MailCommon::KMFilterDialog::mKeySeqWidget
KKeySequenceWidget * mKeySeqWidget
Definition: kmfilterdialog.h:241
MailCommon::MailFilter::setConfigureShortcut
void setConfigureShortcut(bool aShort)
Set whether this filter should be plugged into the filter menu.
Definition: mailfilter.cpp:319
MailCommon::MailFilter::applyOnExplicit
bool applyOnExplicit() const
Definition: mailfilter.cpp:234
folderrequester.h
QEvent
MailCommon::KMFilterDialog::mApplyOnCtrlJ
QCheckBox * mApplyOnCtrlJ
Definition: kmfilterdialog.h:227
QWidget
QEvent::type
Type type() const
MailCommon::KMFilterDialog::createFilter
void createFilter(const QByteArray &field, const QString &value)
Called from KMFilterMgr.
Definition: kmfilterdialog.cpp:414
KernelIf
#define KernelIf
Definition: mailkernel.h:191
MailCommon::KMFilterAccountList::updateAccountList
void updateAccountList(MailCommon::MailFilter *filter)
Definition: kmfilteraccountlist.cpp:51
MailCommon::SearchPatternEdit::updateSearchPattern
void updateSearchPattern()
Updates the search pattern according to the current widget values.
Definition: searchpatternedit.cpp:601
MailCommon::KMFilterDialog::mApplyOnIn
QCheckBox * mApplyOnIn
Lets the user select whether to apply this filter on inbound/outbound messages, both, or only on explicit CTRL-J.
Definition: kmfilterdialog.h:227
MailCommon::KMFilterDialog::mApplyOnOut
QCheckBox * mApplyOnOut
Definition: kmfilterdialog.h:227
MailCommon::KMFilterDialog::mFilterActionIconButton
KIconButton * mFilterActionIconButton
Definition: kmfilterdialog.h:240
MailCommon::KMFilterDialog::slotRunFilters
void slotRunFilters()
Definition: kmfilterdialog.cpp:462
MailCommon::FilterImporterExporter::ClawsMailFilter
Definition: filterimporterexporter.h:63
kmfilteraccountlist.h
QGridLayout::addWidget
void addWidget(QWidget *widget, int row, int column, QFlags< Qt::AlignmentFlag > alignment)
QByteArray
MailCommon::KMFilterDialog::slotApply
void slotApply()
Called wherenever the apply button is pressed.
Definition: kmfilterdialog.cpp:447
QButtonGroup::addButton
void addButton(QAbstractButton *button)
filterselectiondialog.h
MailCommon::KMFilterDialog::slotStopProcessingButtonToggled
void slotStopProcessingButtonToggled(bool aChecked)
Definition: kmfilterdialog.cpp:647
MailCommon::FilterImporterExporter::BalsaFilter
Definition: filterimporterexporter.h:62
MailCommon::FilterActionWidgetLister::reset
void reset()
Resets the action widgets.
Definition: filteractionwidget.cpp:392
MailCommon::FilterActionWidgetLister
A container widget for a list of FilterActionWidgets.
Definition: filteractionwidget.h:115
MailCommon::KMFilterDialog::slotFilterActionIconChanged
void slotFilterActionIconChanged(const QString &icon)
Definition: kmfilterdialog.cpp:691
MailCommon::MailFilter::shortcut
const KShortcut & shortcut() const
Definition: mailfilter.cpp:350
QAction::data
QVariant data() const
QTreeWidgetItemIterator
QMenu::addAction
void addAction(QAction *action)
QPointer
searchpatternedit.h
MailCommon::KMFilterDialog::slotApplicableAccountsChanged
void slotApplicableAccountsChanged()
Definition: kmfilterdialog.cpp:629
QHBoxLayout
MailCommon::MailFilter::setApplyOnOutbound
void setApplyOnOutbound(bool aApply=true)
Set whether this filter should be applied on outbound messages (aApply == true) or not...
Definition: mailfilter.cpp:199
QVariant::value
T value() const
MailCommon::KMFilterDialog::mConfigureShortcut
QCheckBox * mConfigureShortcut
Definition: kmfilterdialog.h:237
QLabel::setAlignment
void setAlignment(QFlags< Qt::AlignmentFlag >)
MailCommon::MailFilter::setShortcut
void setShortcut(const KShortcut &shortcut)
Set the shortcut to be used if plugged into the filter menu or toolbar.
Definition: mailfilter.cpp:345
QGridLayout
MailCommon::KMFilterDialog::mAdvOptsGroup
QGroupBox * mAdvOptsGroup
Definition: kmfilterdialog.h:242
MailCommon::KMFilterDialog::slotFinished
void slotFinished()
Called when the dialog is closed (finished).
Definition: kmfilterdialog.cpp:452
KDialog
MailCommon::MailFilter::actions
QList< FilterAction * > * actions()
Provides a reference to the internal action list.
Definition: mailfilter.cpp:179
MailCommon::KMFilterListBox::appendFilter
void appendFilter(MailCommon::MailFilter *aFilter)
Definition: kmfilterlistbox.cpp:840
MailCommon::KMFilterListBox::loadFilterList
void loadFilterList(bool createDummyFilter)
Loads the filter list and selects the first filter.
Definition: kmfilterlistbox.cpp:781
MailCommon::KMFilterDialog::mActionLister
MailCommon::FilterActionWidgetLister * mActionLister
The widget that allows editing of the filter actions.
Definition: kmfilterdialog.h:223
MailCommon::MailFilter::ButImap
Definition: mailfilter.h:70
MailCommon::FilterActionWidgetLister::setActionList
void setActionList(QList< MailCommon::FilterAction * > *list)
Sets the list of filter actions, the lister will create FilterActionWidgets for.
Definition: filteractionwidget.cpp:292
MailCommon::KMFilterDialog::mPatternEdit
MailCommon::SearchPatternEdit * mPatternEdit
The widget that allows editing of the filter pattern.
Definition: kmfilterdialog.h:220
QButtonGroup
MailCommon::FilterManager::filter
void filter(const Akonadi::Item &item, const QString &identifier, const QString &resourceId) const
Apply filters interface.
Definition: filtermanager.cpp:218
kmfilterlistbox.h
QSplitter::addWidget
void addWidget(QWidget *widget)
MailCommon::KMFilterDialog::mDoNotClose
bool mDoNotClose
Definition: kmfilterdialog.h:247
QLabel::setBuddy
void setBuddy(QWidget *buddy)
MailCommon::FilterImporterExporter::IcedoveFilter
Definition: filterimporterexporter.h:64
MailCommon::FolderRequester::collection
Akonadi::Collection collection() const
Returns the selected collection.
Definition: folderrequester.cpp:105
MailCommon::KMFilterDialog::slotDisableAccept
void slotDisableAccept()
Called when a user decides to continue editing invalid filters.
Definition: kmfilterdialog.cpp:747
MailCommon::MailFilter::setStopProcessingHere
void setStopProcessingHere(bool aStop)
Definition: mailfilter.cpp:309
MailCommon::FilterImporterExporter::GmailFilter
Definition: filterimporterexporter.h:65
QWidget::setEnabled
void setEnabled(bool)
QBoxLayout::addWidget
void addWidget(QWidget *widget, int stretch, QFlags< Qt::AlignmentFlag > alignment)
MailCommon::KMFilterDialog::slotUpdateFilter
void slotUpdateFilter()
Definition: kmfilterdialog.cpp:589
MailCommon::KMFilterDialog::slotFolderChanged
void slotFolderChanged(const Akonadi::Collection &)
Definition: kmfilterdialog.cpp:457
QEvent::ignore
void ignore()
MailCommon::SearchPatternEdit
Definition: searchpatternedit.h:77
MailCommon::MailFilter::setApplyBeforeOutbound
void setApplyBeforeOutbound(bool aApply=true)
Set whether this filter should be applied on outbound messages before sending (aApply == TRUE) or not...
Definition: mailfilter.cpp:204
MailCommon::KMFilterAccountList
Definition: kmfilteraccountlist.h:23
MailCommon::KMFilterDialog::mFolderRequester
MailCommon::FolderRequester * mFolderRequester
Definition: kmfilterdialog.h:245
QWidget::setLayout
void setLayout(QLayout *layout)
QSplitter::setChildrenCollapsible
void setChildrenCollapsible(bool)
QGroupBox
filteractionwidget.h
kmfilterdialog.h
MailCommon::KMFilterDialog::slotFilterSelected
void slotFilterSelected(MailCommon::MailFilter *aFilter)
Internally connected to KMFilterListBox::filterSelected.
Definition: kmfilterdialog.cpp:527
MailCommon::FilterImporterExporter
Utility class that provides persisting of filters to/from KConfig.
Definition: filterimporterexporter.h:53
QCheckBox
QList::isEmpty
bool isEmpty() const
MailCommon::KMFilterDialog::slotFetchItemsForFolderDone
void slotFetchItemsForFolderDone(KJob *job)
Definition: kmfilterdialog.cpp:502
MailCommon::FolderRequester
A widget that contains a KLineEdit which shows the current folder and a button that fires a FolderSel...
Definition: folderrequester.h:59
MailCommon::SearchPatternEdit::reset
void reset()
Called when the widget should let go of the currently referenced filter and disable itself...
Definition: searchpatternedit.cpp:703
MailCommon::MailFilter::applyOnOutbound
bool applyOnOutbound() const
Definition: mailfilter.cpp:209
MailCommon::MailFilter::configureShortcut
bool configureShortcut() const
Definition: mailfilter.cpp:325
QVBoxLayout
MailCommon::MailFilter::configureToolbar
bool configureToolbar() const
Definition: mailfilter.cpp:335
MailCommon::KMFilterDialog::event
bool event(QEvent *e)
Definition: kmfilterdialog.cpp:429
MailCommon::SearchRule::RequiredPart
RequiredPart
Definition: searchrule.h:79
QString
QList
QLayout::setMargin
void setMargin(int margin)
QStringList
MailCommon::FilterImporterExporter::FilterType
FilterType
Definition: filterimporterexporter.h:56
MailCommon::MailFilter::applyOnInbound
bool applyOnInbound() const
Definition: mailfilter.cpp:224
MailCommon::FilterImporterExporter::SylpheedFilter
Definition: filterimporterexporter.h:60
QAction::setData
void setData(const QVariant &userData)
QKeyEvent::key
int key() const
QMenu
MailCommon::KMFilterDialog::mApplyOnForChecked
QRadioButton * mApplyOnForChecked
Definition: kmfilterdialog.h:231
QSize
MailCommon::MailFilter::stopProcessingHere
bool stopProcessingHere() const
Definition: mailfilter.cpp:314
MailCommon::FilterManager::instance
static FilterManager * instance()
Returns the global filter manager object.
Definition: filtermanager.cpp:98
MailCommon::KMFilterDialog::slotConfigureToolbarButtonToggled
void slotConfigureToolbarButtonToggled(bool aChecked)
Definition: kmfilterdialog.cpp:682
MailCommon::FolderRequester::setNotAllowToCreateNewFolder
void setNotAllowToCreateNewFolder(bool notCreateNewFolder)
Definition: folderrequester.cpp:190
MailCommon::KMFilterListBox::createFilter
void createFilter(const QByteArray &field, const QString &value)
Called from KMFilterDialog.
Definition: kmfilterlistbox.cpp:284
MailCommon::FilterConvertToSieve
Definition: filterconverttosieve.h:25
QVariant::fromValue
QVariant fromValue(const T &value)
MailCommon::KMFilterDialog::slotExportFilters
void slotExportFilters()
Called when a user clicks the export filters button.
Definition: kmfilterdialog.cpp:739
MailCommon::SearchRule::Envelope
Definition: searchrule.h:80
MailCommon::FilterImporterExporter::ProcmailFilter
Definition: filterimporterexporter.h:61
QAbstractButton::setChecked
void setChecked(bool)
QGridLayout::addLayout
void addLayout(QLayout *layout, int row, int column, QFlags< Qt::AlignmentFlag > alignment)
QKeyEvent
MailCommon::KMFilterDialog::mApplyOnForAll
QRadioButton * mApplyOnForAll
For a filter applied to inbound messages selects whether to apply this filter to all accounts or to s...
Definition: kmfilterdialog.h:231
MailCommon::MailFilter::All
Definition: mailfilter.h:70
QSplitter
MailCommon::SearchPatternEdit::setSearchPattern
void setSearchPattern(MailCommon::SearchPattern *aPattern)
Sets the search pattern.
Definition: searchpatternedit.cpp:680
MailCommon::KMFilterAccountList::applyOnAccount
void applyOnAccount(MailCommon::MailFilter *filter)
Definition: kmfilteraccountlist.cpp:89
MailCommon::MailFilter::setIcon
void setIcon(const QString &icon)
Set the icon to be used if plugged into the filter menu or toolbar.
Definition: mailfilter.cpp:355
MailCommon::FilterImporterExporter::exportFilters
void exportFilters(const QList< MailFilter * > &filters, const KUrl &fileName=KUrl(), bool saveAll=false)
Exports the given filters to a file which is asked from the user.
Definition: filterimporterexporter.cpp:362
MailCommon::KMFilterDialog::slotSaveSize
void slotSaveSize()
Definition: kmfilterdialog.cpp:521
MailCommon::MailFilter::applicability
AccountType applicability() const
Definition: mailfilter.cpp:244
QTreeWidgetItem
MailCommon::MailFilter::setApplicability
void setApplicability(AccountType aApply=All)
Set whether this filter should be applied on inbound messages for all accounts (aApply == All) or inb...
Definition: mailfilter.cpp:239
QLatin1String
QKeySequence
mailkernel.h
QBoxLayout::addStretch
void addStretch(int stretch)
filterimporterexporter.h
QRadioButton
MailCommon::KMFilterListBox::filtersForSaving
QList< MailCommon::MailFilter * > filtersForSaving(bool closeAfterSaving, bool &wasCanceled) const
Returns a list of copies of the current list of filters.
Definition: kmfilterlistbox.cpp:373
MailCommon::KMFilterDialog::slotUpdateAccountList
void slotUpdateAccountList()
Update the list of accounts shown in the advanced tab.
Definition: kmfilterdialog.cpp:700
MailCommon::KMFilterDialog::slotApplicabilityChanged
void slotApplicabilityChanged()
Definition: kmfilterdialog.cpp:595
QAction
MailCommon::MailFilter::icon
QString icon() const
Definition: mailfilter.cpp:360
MailCommon::KMFilterDialog::slotShortcutChanged
void slotShortcutChanged(const QKeySequence &newSeq)
Definition: kmfilterdialog.cpp:671
MailCommon::MailFilter::setConfigureToolbar
void setConfigureToolbar(bool aTool)
Set whether this filter should be plugged into the toolbar.
Definition: mailfilter.cpp:330
MailCommon::KMFilterDialog::mFilterList
KMFilterListBox * mFilterList
The widget that contains the ListBox showing the filters, and the controls to remove filters...
Definition: kmfilterdialog.h:217
MailCommon::KMFilterDialog::mAccountList
KMFilterAccountList * mAccountList
ListView that shows the accounts in the advanced tab.
Definition: kmfilterdialog.h:234
MailCommon::KMFilterDialog::slotConfigureShortcutButtonToggled
void slotConfigureShortcutButtonToggled(bool aChecked)
Definition: kmfilterdialog.cpp:657
MailCommon::KMFilterListBox
Definition: kmfilterlistbox.h:71
MailCommon::SearchPatternEdit::MatchAllMessages
Definition: searchpatternedit.h:86
MailCommon::KMFilterDialog::slotDialogUpdated
void slotDialogUpdated()
Called whenever a change in the filters configuration is detected, to enable the Apply button...
Definition: kmfilterdialog.cpp:752
MailCommon::KMFilterDialog::mApplyOnForTraditional
QRadioButton * mApplyOnForTraditional
Definition: kmfilterdialog.h:231
MailCommon::MailFilter::setApplyOnExplicit
void setApplyOnExplicit(bool aApply=true)
Set whether this filter should be applied on explicit (CTRL-J) filtering (aApply == true) or not...
Definition: mailfilter.cpp:229
MailCommon::MailFilter::setApplyOnInbound
void setApplyOnInbound(bool aApply=true)
Set whether this filter should be applied on inbound messages (aApply == true) or not...
Definition: mailfilter.cpp:219
MailCommon::KMFilterDialog::mConfigureToolbar
QCheckBox * mConfigureToolbar
Definition: kmfilterdialog.h:238
MailCommon::MailFilter::Checked
Definition: mailfilter.h:70
MailCommon::KMFilterDialog::mFilterActionLabel
QLabel * mFilterActionLabel
Definition: kmfilterdialog.h:239
KHBox
QWidget::setToolTip
void setToolTip(const QString &)
filtermanager.h
MailCommon::MailFilter::setApplyOnAccount
void setApplyOnAccount(const QString &id, bool aApply=true)
Set whether this filter should be applied on inbound messages for the account with id (id)...
Definition: mailfilter.cpp:282
MailCommon::KMFilterListBox::selectedFilterId
QStringList selectedFilterId(SearchRule::RequiredPart &requiredPart, const QString &resource) const
Definition: kmfilterlistbox.cpp:591
QList::constEnd
const_iterator constEnd() const
MailCommon::FilterSelectionDialog
Definition: filterselectiondialog.h:35
QList::constBegin
const_iterator constBegin() const
MailCommon::MailFilter::applyBeforeOutbound
bool applyBeforeOutbound() const
Definition: mailfilter.cpp:214
MailCommon::KMFilterDialog::mFilter
MailCommon::MailFilter * mFilter
Definition: kmfilterdialog.h:244
QLabel
MailCommon::KMFilterDialog::accept
virtual void accept()
Override QDialog::accept to allow disabling close.
Definition: kmfilterdialog.cpp:419
MailCommon::KMFilterDialog::mRunNow
KPushButton * mRunNow
Definition: kmfilterdialog.h:246
MailCommon::MailFilter::pattern
SearchPattern * pattern()
Provides a reference to the internal pattern.
Definition: mailfilter.cpp:189
MailCommon::MailFilter
Definition: mailfilter.h:42
MailCommon::KMFilterDialog::mStopProcessingHere
QCheckBox * mStopProcessingHere
Definition: kmfilterdialog.h:236
mailutil.h
MailCommon::FilterImporterExporter::EvolutionFilter
Definition: filterimporterexporter.h:59
MailCommon::KMFilterDialog::mIgnoreFilterUpdates
bool mIgnoreFilterUpdates
Definition: kmfilterdialog.h:248
QBoxLayout::setStretchFactor
bool setStretchFactor(QWidget *widget, int stretch)
QBoxLayout::setSpacing
void setSpacing(int spacing)
MailCommon::FilterActionWidgetLister::updateActionList
void updateActionList()
Updates the action list according to the current action widget values.
Definition: filteractionwidget.cpp:387
MailCommon::KMFilterDialog::slotReset
void slotReset()
Definition: kmfilterdialog.cpp:579
MailCommon::KMFilterDialog::mApplyBeforeOut
QCheckBox * mApplyBeforeOut
Definition: kmfilterdialog.h:227
filteractiondict.h
QBoxLayout::addLayout
void addLayout(QLayout *layout, int stretch)
MailCommon::KMFilterDialog::slotImportFilter
void slotImportFilter(QAction *)
Called when a user clicks the import filters button.
Definition: kmfilterdialog.cpp:705
filterconverttosieve.h
MailCommon::FilterImporterExporter::ThunderBirdFilter
Definition: filterimporterexporter.h:58
MailCommon::FilterImporterExporter::KMailFilter
Definition: filterimporterexporter.h:57
This file is part of the KDE documentation.
Documentation copyright © 1996-2020 The KDE developers.
Generated on Mon Jun 22 2020 13:31:40 by doxygen 1.8.7 written by Dimitri van Heesch, © 1997-2006

KDE's Doxygen guidelines are available online.

mailcommon

Skip menu "mailcommon"
  • Main Page
  • Namespace List
  • Namespace Members
  • Alphabetical List
  • Class List
  • Class Hierarchy
  • Class Members
  • File List
  • File Members
  • Related Pages

kdepim API Reference

Skip menu "kdepim API Reference"
  • akonadi_next
  • akregator
  • blogilo
  • calendarsupport
  • console
  •   kabcclient
  •   konsolekalendar
  • kaddressbook
  • kalarm
  •   lib
  • kdgantt2
  • kjots
  • kleopatra
  • kmail
  • knode
  • knotes
  • kontact
  • korgac
  • korganizer
  • ktimetracker
  • libkdepim
  • libkleo
  • libkpgp
  • mailcommon
  • messagelist
  • messageviewer
  • pimprint

Search



Report problems with this website to our bug tracking system.
Contact the specific authors with questions and comments about the page contents.

KDE® and the K Desktop Environment® logo are registered trademarks of KDE e.V. | Legal