• 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
  • filteractions
filteractionmove.cpp
Go to the documentation of this file.
1 /*
2  * Copyright (c) 1996-1998 Stefan Taferner <taferner@kde.org>
3  *
4  * This program is free software; you can redistribute it and/or modify
5  * it under the terms of the GNU General Public License as published by
6  * the Free Software Foundation; either version 2 of the License, or
7  * (at your option) any later version.
8  *
9  * This program is distributed in the hope that it will be useful,
10  * but WITHOUT ANY WARRANTY; without even the implied warranty of
11  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12  * GNU General Public License for more details.
13  *
14  * You should have received a copy of the GNU General Public License
15  * along with this program; if not, write to the Free Software
16  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
17  *
18  */
19 
20 #include "filteractionmove.h"
21 #include "mailcommon/util/mailutil.h"
22 
23 #include "kernel/mailkernel.h"
24 
25 #include <KDE/KLocale>
26 
27 using namespace MailCommon;
28 
29 FilterAction* FilterActionMove::newAction()
30 {
31  return new FilterActionMove;
32 }
33 
34 FilterActionMove::FilterActionMove( QObject *parent )
35  : FilterActionWithFolder( QLatin1String("transfer"), i18n( "Move Into Folder" ), parent )
36 {
37 }
38 
39 FilterAction::ReturnCode FilterActionMove::process(ItemContext &context , bool) const
40 {
41  if ( !mFolder.isValid() ) {
42  const Akonadi::Collection targetFolder = CommonKernel->collectionFromId( mFolder.id() );
43  if ( !targetFolder.isValid() )
44  return ErrorButGoOn;
45 
46  context.setMoveTargetCollection( targetFolder );
47  } else {
48  context.setMoveTargetCollection( mFolder );
49  }
50  return GoOn;
51 }
52 
53 SearchRule::RequiredPart FilterActionMove::requiredPart() const
54 {
55  return SearchRule::Envelope;
56 }
57 
58 QString FilterActionMove::sieveCode() const
59 {
60  QString path;
61  if ( KernelIf->collectionModel() )
62  path = MailCommon::Util::fullCollectionPath( mFolder );
63  else
64  path = QString::number(mFolder.id());
65  const QString result = QString::fromLatin1("fileinto \"%1\";").arg(path);
66  return result;
67 }
68 
69 QStringList FilterActionMove::sieveRequires() const
70 {
71  return QStringList() << QLatin1String("fileinto");
72 }
73 
74 QString FilterActionMove::informationAboutNotValidAction() const
75 {
76  //KF5 add i18n
77  return QString::fromLatin1("Folder destination was not defined.");
78 }
79 
MailCommon::FilterActionWithFolder
Abstract base class for filter actions with a mail folder as parameter.
Definition: filteractionwithfolder.h:41
MailCommon::FilterAction::GoOn
Go on with applying filter actions.
Definition: filteraction.h:62
KernelIf
#define KernelIf
Definition: mailkernel.h:191
MailCommon::FilterActionMove::newAction
static FilterAction * newAction()
Definition: filteractionmove.cpp:29
MailCommon::FilterActionMove::informationAboutNotValidAction
QString informationAboutNotValidAction() const
Definition: filteractionmove.cpp:74
MailCommon::FilterActionMove::FilterActionMove
FilterActionMove(QObject *parent=0)
Definition: filteractionmove.cpp:34
filteractionmove.h
MailCommon::FilterActionMove::sieveCode
QString sieveCode() const
Definition: filteractionmove.cpp:58
MailCommon::FilterAction
Abstract base class for mail filter actions.
Definition: filteraction.h:52
QString::number
QString number(int n, int base)
MailCommon::FilterAction::ErrorButGoOn
A non-critical error occurred.
Definition: filteraction.h:63
QObject
MailCommon::SearchRule::RequiredPart
RequiredPart
Definition: searchrule.h:79
QString
MailCommon::ItemContext::setMoveTargetCollection
void setMoveTargetCollection(const Akonadi::Collection &collection)
Sets the target collection the item should be moved to.
Definition: itemcontext.cpp:34
QStringList
MailCommon::SearchRule::Envelope
Definition: searchrule.h:80
CommonKernel
#define CommonKernel
Definition: mailkernel.h:194
MailCommon::FilterActionWithFolder::mFolder
Akonadi::Collection mFolder
Definition: filteractionwithfolder.h:102
MailCommon::FilterAction::ReturnCode
ReturnCode
Describes the possible return codes of filter processing:
Definition: filteraction.h:60
QLatin1String
mailkernel.h
MailCommon::Util::fullCollectionPath
MAILCOMMON_EXPORT QString fullCollectionPath(const Akonadi::Collection &collection)
Definition: mailutil.cpp:115
context
const char * context
Definition: searchpatternedit.cpp:54
QString::fromLatin1
QString fromLatin1(const char *str, int size)
MailCommon::FilterActionMove::process
ReturnCode process(ItemContext &context, bool applyOnOutbound) const
Execute action on given message (inside the item context).
Definition: filteractionmove.cpp:39
MailCommon::FilterActionMove::sieveRequires
QStringList sieveRequires() const
Definition: filteractionmove.cpp:69
MailCommon::ItemContext
A helper class for the filtering process.
Definition: itemcontext.h:39
QString::arg
QString arg(qlonglong a, int fieldWidth, int base, const QChar &fillChar) const
mailutil.h
MailCommon::FilterActionMove::requiredPart
SearchRule::RequiredPart requiredPart() const
Returns the required part from the item that is needed for the action to operate. ...
Definition: filteractionmove.cpp:53
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