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

mailcommon

  • sources
  • kde-4.12
  • kdepim
  • mailcommon
  • filter
filteractionplaysound.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 "filteractionplaysound.h"
21 
22 #include "dialog/filteractionmissingargumentdialog.h"
23 
24 #ifndef Q_OS_WINCE
25 #include <phonon/mediaobject.h>
26 #endif
27 
28 #include <KDE/KLocale>
29 
30 #include <QtCore/QFile>
31 #include <QPointer>
32 
33 using namespace MailCommon;
34 
35 FilterActionPlaySound::FilterActionPlaySound( )
36  : FilterActionWithTest( QLatin1String("play sound"), i18n( "Play Sound" ) )
37  #ifndef Q_OS_WINCE
38  , mPlayer( 0 )
39  #endif
40 {
41 }
42 
43 FilterActionPlaySound::~FilterActionPlaySound()
44 {
45 #ifndef Q_OS_WINCE
46  delete mPlayer;
47 #endif
48 }
49 
50 FilterAction* FilterActionPlaySound::newAction()
51 {
52  return new FilterActionPlaySound();
53 }
54 
55 FilterAction::ReturnCode FilterActionPlaySound::process(ItemContext& , bool) const
56 {
57  if ( mParameter.isEmpty() )
58  return ErrorButGoOn;
59 
60 #ifndef Q_OS_WINCE
61  if ( !mPlayer )
62  mPlayer = Phonon::createPlayer( Phonon::NotificationCategory );
63 
64  mPlayer->setCurrentSource( mParameter );
65  mPlayer->play();
66 #endif
67 
68  return GoOn;
69 }
70 
71 SearchRule::RequiredPart FilterActionPlaySound::requiredPart() const
72 {
73  return SearchRule::Envelope;
74 }
75 
76 
77 bool FilterActionPlaySound::argsFromStringInteractive( const QString &argsStr, const QString &filterName )
78 {
79  bool needUpdate = false;
80  argsFromString( argsStr );
81  if (!QFile(mParameter).exists()){
82  QPointer<FilterActionMissingSoundUrlDialog> dlg = new FilterActionMissingSoundUrlDialog( filterName, argsStr );
83  if ( dlg->exec() ) {
84  mParameter = dlg->soundUrl();
85  needUpdate = true;
86  }
87  delete dlg;
88  }
89  return needUpdate;
90 }
91 
92 #include "filteractionplaysound.moc"
MailCommon::FilterActionPlaySound::process
ReturnCode process(ItemContext &context, bool applyOnOutbound) const
Execute action on given message (inside the item context).
Definition: filteractionplaysound.cpp:55
MailCommon::FilterAction::GoOn
Go on with applying filter actions.
Definition: filteraction.h:62
MailCommon::FilterActionWithTest::argsFromString
virtual void argsFromString(const QString &argsStr)
Read extra arguments from given string.
Definition: filteractionwithtest.cpp:70
filteractionmissingargumentdialog.h
MailCommon::FilterActionWithTest
Definition: filteractionwithtest.h:27
MailCommon::FilterAction
Abstract base class for mail filter actions.
Definition: filteraction.h:52
MailCommon::FilterAction::ErrorButGoOn
A non-critical error occurred.
Definition: filteraction.h:63
MailCommon::FilterActionPlaySound::newAction
static FilterAction * newAction()
Definition: filteractionplaysound.cpp:50
FilterActionMissingSoundUrlDialog
Definition: filteractionmissingargumentdialog.h:171
MailCommon::SearchRule::RequiredPart
RequiredPart
Definition: searchpattern.h:104
MailCommon::SearchRule::Envelope
Definition: searchpattern.h:105
MailCommon::FilterAction::ReturnCode
ReturnCode
Describes the possible return codes of filter processing:
Definition: filteraction.h:60
MailCommon::FilterActionPlaySound::FilterActionPlaySound
FilterActionPlaySound()
Definition: filteractionplaysound.cpp:35
filteractionplaysound.h
MailCommon::FilterActionPlaySound::~FilterActionPlaySound
~FilterActionPlaySound()
Definition: filteractionplaysound.cpp:43
MailCommon::FilterActionPlaySound::argsFromStringInteractive
bool argsFromStringInteractive(const QString &argsStr, const QString &filterName)
Read extra arguments from given string.
Definition: filteractionplaysound.cpp:77
MailCommon::ItemContext
A helper class for the filtering process.
Definition: itemcontext.h:39
MailCommon::FilterActionPlaySound::requiredPart
SearchRule::RequiredPart requiredPart() const
Returns the required part from the item that is needed for the action to operate. ...
Definition: filteractionplaysound.cpp:71
MailCommon::FilterActionWithTest::mParameter
QString mParameter
Definition: filteractionwithtest.h:82
This file is part of the KDE documentation.
Documentation copyright © 1996-2014 The KDE developers.
Generated on Tue Oct 14 2014 22:55:14 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

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