• 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
filteractionwithtest.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 "filteractionwithtest.h"
21 
22 #include "soundtestwidget.h"
23 
24 #include <QTextDocument>
25 
26 using namespace MailCommon;
27 
28 FilterActionWithTest::FilterActionWithTest( const QString &name, const QString &label, QObject *parent )
29  : FilterAction( name, label, parent )
30 {
31 }
32 
33 FilterActionWithTest::~FilterActionWithTest()
34 {
35 }
36 
37 bool FilterActionWithTest::isEmpty() const
38 {
39  return mParameter.trimmed().isEmpty();
40 }
41 
42 QWidget* FilterActionWithTest::createParamWidget( QWidget *parent ) const
43 {
44  SoundTestWidget *soundWidget = new SoundTestWidget( parent );
45  soundWidget->setObjectName(QLatin1String("soundwidget"));
46  soundWidget->setUrl( mParameter );
47 
48  connect( soundWidget, SIGNAL(textChanged(QString)),
49  this, SIGNAL(filterActionModified()) );
50 
51  return soundWidget;
52 }
53 
54 void FilterActionWithTest::applyParamWidgetValue( QWidget *paramWidget )
55 {
56  mParameter = static_cast<SoundTestWidget*>( paramWidget )->url();
57 }
58 
59 void FilterActionWithTest::setParamWidgetValue( QWidget *paramWidget ) const
60 {
61  static_cast<SoundTestWidget*>( paramWidget )->setUrl( mParameter );
62 }
63 
64 void FilterActionWithTest::clearParamWidget( QWidget *paramWidget ) const
65 {
66  static_cast<SoundTestWidget*>( paramWidget )->clear();
67 }
68 
69 void FilterActionWithTest::argsFromString( const QString &argsStr )
70 {
71  mParameter = argsStr;
72 }
73 
74 QString FilterActionWithTest::argsAsString() const
75 {
76  return mParameter;
77 }
78 
79 QString FilterActionWithTest::displayString() const
80 {
81  return label() + QLatin1String( " \"" ) + Qt::escape( argsAsString() ) + QLatin1String( "\"" );
82 }
83 
MailCommon::FilterActionWithTest::setParamWidgetValue
virtual void setParamWidgetValue(QWidget *paramWidget) const
The filter action shall set it's widget's contents from it's parameter.
Definition: filteractionwithtest.cpp:59
QWidget
MailCommon::FilterActionWithTest::argsFromString
virtual void argsFromString(const QString &argsStr)
Read extra arguments from given string.
Definition: filteractionwithtest.cpp:69
soundtestwidget.h
MailCommon::SoundTestWidget
A widget to play a sound from a given URL.
Definition: soundtestwidget.h:34
MailCommon::FilterActionWithTest::clearParamWidget
virtual void clearParamWidget(QWidget *paramWidget) const
The filter action shall clear it's parameter widget's contents.
Definition: filteractionwithtest.cpp:64
MailCommon::FilterActionWithTest::applyParamWidgetValue
virtual void applyParamWidgetValue(QWidget *paramWidget)
The filter action shall set it's parameter from the widget's contents.
Definition: filteractionwithtest.cpp:54
MailCommon::FilterActionWithTest::FilterActionWithTest
FilterActionWithTest(const QString &name, const QString &label, QObject *parent=0)
Creates a new filter action.
Definition: filteractionwithtest.cpp:28
MailCommon::FilterActionWithTest::createParamWidget
virtual QWidget * createParamWidget(QWidget *parent) const
Creates a widget for setting the filter action parameter.
Definition: filteractionwithtest.cpp:42
MailCommon::FilterAction
Abstract base class for mail filter actions.
Definition: filteraction.h:52
QObject
QObject::setObjectName
void setObjectName(const QString &name)
QString::isEmpty
bool isEmpty() const
QString::trimmed
QString trimmed() const
QString
MailCommon::FilterAction::label
QString label() const
Returns i18n'd label, ie.
Definition: filteraction.cpp:45
MailCommon::SoundTestWidget::setUrl
void setUrl(const QString &url)
Sets the url of the sound file to play.
Definition: soundtestwidget.cpp:130
filteractionwithtest.h
QLatin1String
Qt::escape
QString escape(const QString &plain)
MailCommon::FilterAction::filterActionModified
void filterActionModified()
Called to notify that the current FilterAction has had some value modification.
MailCommon::FilterActionWithTest::displayString
virtual QString displayString() const
Returns a translated string describing this filter for visualization purposes, e.g.
Definition: filteractionwithtest.cpp:79
MailCommon::FilterActionWithTest::argsAsString
virtual QString argsAsString() const
Return extra arguments as string.
Definition: filteractionwithtest.cpp:74
MailCommon::FilterActionWithTest::isEmpty
virtual bool isEmpty() const
Determines whether this action is valid.
Definition: filteractionwithtest.cpp:37
QObject::connect
bool connect(const QObject *sender, const char *signal, const QObject *receiver, const char *method, Qt::ConnectionType type)
MailCommon::FilterActionWithTest::~FilterActionWithTest
~FilterActionWithTest()
Destroys the filter action.
Definition: filteractionwithtest.cpp:33
MailCommon::FilterActionWithTest::mParameter
QString mParameter
Definition: filteractionwithtest.h:82
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