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

kremotecontrol

  • sources
  • kde-4.12
  • kdeutils
  • kremotecontrol
  • libkremotecontrol
profileaction.cpp
Go to the documentation of this file.
1 /*
2  Copyright (C) 2010 Michael Zanetti <michael_zanetti@gmx.net>
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 along
15  with this program; if not, write to the Free Software Foundation, Inc.,
16  51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
17 
18 */
19 
20 #include "profileaction.h"
21 #include "profileserver.h"
22 
23 ProfileAction::ProfileAction(): DBusAction() {
24  //change type from DBusAction (c'tor) to ProfileAction
25  m_type = Action::ProfileAction;
26 }
27 
28 ProfileAction::ProfileAction(const QString& button, const QString &profileName, const QString &actionTemplate)
29  : DBusAction(button), m_profileId(profileName), m_template(actionTemplate) {
30  //change type from DBusAction (c'tor) to ProfileAction
31  m_type = Action::ProfileAction;
32 }
33 
34 QString ProfileAction::profileId() const {
35  return m_profileId;
36 }
37 
38 void ProfileAction::setProfileId(const QString& profileId) {
39  m_profileId = profileId;
40 }
41 
42 QString ProfileAction::actionTemplateId() const {
43  return m_template;
44 }
45 
46 void ProfileAction::setActionTemplateId(const QString& actionTemplateId) {
47  m_template = actionTemplateId;
48 }
49 
50 QString ProfileAction::name() const {
51  foreach(const Profile *profile, ProfileServer::allProfiles()){
52  if(profile->profileId() == m_profileId){
53  return profile->name();
54  }
55  }
56  return m_profileId;
57 }
58 
59 QString ProfileAction::description() const {
60  foreach(const Profile *profile, ProfileServer::allProfiles()){
61  if(profile->profileId() == m_profileId){
62  foreach(const ProfileActionTemplate &actionTemplate, profile->actionTemplates()){
63  if(actionTemplate.actionTemplateId() == m_template && actionTemplate.profileId() == m_profileId){
64  return actionTemplate.actionName();
65  }
66  }
67  }
68  }
69  return m_function.name();
70 }
71 
72 void ProfileAction::saveToConfig(KConfigGroup &config) {
73  DBusAction::saveToConfig(config);
74  config.writeEntry("ProfileId", m_profileId);
75  config.writeEntry("Template", m_template);
76 }
77 
78 void ProfileAction::loadFromConfig(const KConfigGroup &config) {
79  DBusAction::loadFromConfig(config);
80  m_profileId = config.readEntry("ProfileId");
81  m_template = config.readEntry("Template");
82 }
83 
84 Action* ProfileAction::clone() const {
85  ProfileAction *action = new ProfileAction();
86  action->setActionTemplateId(m_template);
87  action->setProfileId(m_profileId);
88  action->setApplication(m_application);
89  action->setAutostart(m_autostart);
90  action->setDestination(m_destination);
91  action->setFunction(m_function);
92  action->setInterface(m_interface);
93  action->setNode(m_node);
94  action->setRepeat(m_repeat);
95  action->setButton(m_button);
96  return action;
97 }
DBusAction::m_node
QString m_node
Definition: dbusaction.h:61
ProfileAction::name
virtual QString name() const
Definition: profileaction.cpp:50
ProfileActionTemplate
Definition: profileactiontemplate.h:31
ProfileAction::profileId
QString profileId() const
Definition: profileaction.cpp:34
DBusAction::loadFromConfig
virtual void loadFromConfig(const KConfigGroup &config)
Definition: dbusaction.cpp:87
ProfileAction::m_template
QString m_template
Definition: profileaction.h:48
Prototype::name
QString name() const
Definition: prototype.cpp:28
ProfileAction::saveToConfig
virtual void saveToConfig(KConfigGroup &config)
Definition: profileaction.cpp:72
ProfileAction::clone
virtual Action * clone() const
Definition: profileaction.cpp:84
Action::m_type
ActionType m_type
Definition: action.h:64
ProfileAction::description
virtual QString description() const
Definition: profileaction.cpp:59
ProfileServer::allProfiles
QList< Profile * > allProfiles()
Definition: profileserver.cpp:89
profileserver.h
DBusAction::saveToConfig
virtual void saveToConfig(KConfigGroup &config)
Definition: dbusaction.cpp:71
DBusAction::setInterface
void setInterface(const QString &interface)
Definition: dbusaction.cpp:50
Action::m_autostart
bool m_autostart
Definition: action.h:66
Action
Definition: action.h:30
ProfileActionTemplate::actionTemplateId
QString actionTemplateId() const
Definition: profileactiontemplate.cpp:62
DBusAction::setApplication
void setApplication(const QString &application)
Definition: dbusaction.cpp:33
DBusAction
Definition: dbusaction.h:32
DBusAction::setFunction
void setFunction(const Prototype &function)
Definition: dbusaction.cpp:59
Action::setRepeat
void setRepeat(bool repeat)
Definition: action.cpp:49
Action::setButton
void setButton(const QString &button)
Definition: action.cpp:41
ProfileActionTemplate::profileId
QString profileId() const
Definition: profileactiontemplate.cpp:58
DBusAction::m_application
QString m_application
Definition: dbusaction.h:60
Action::setDestination
void setDestination(ActionDestination destination)
Definition: action.cpp:65
DBusAction::m_interface
QString m_interface
Definition: dbusaction.h:62
ProfileAction::m_profileId
QString m_profileId
Definition: profileaction.h:47
Action::m_repeat
bool m_repeat
Definition: action.h:66
Action::ProfileAction
Definition: action.h:33
ProfileAction::actionTemplateId
QString actionTemplateId() const
Definition: profileaction.cpp:42
ProfileAction::setActionTemplateId
void setActionTemplateId(const QString &actionTemplateID)
Definition: profileaction.cpp:46
DBusAction::m_function
Prototype m_function
Definition: dbusaction.h:63
profileaction.h
Profile::actionTemplates
QList< ProfileActionTemplate > actionTemplates() const
Definition: profile.cpp:76
Profile::profileId
QString profileId() const
Definition: profile.cpp:68
ProfileAction::ProfileAction
ProfileAction()
Definition: profileaction.cpp:23
Action::setAutostart
void setAutostart(bool autostart)
Definition: action.cpp:57
Action::m_button
QString m_button
Definition: action.h:65
ProfileServer::profile
Profile * profile(const QString &profileId)
Definition: profileserver.cpp:93
ProfileAction::setProfileId
void setProfileId(const QString &profileId)
Definition: profileaction.cpp:38
Action::m_destination
ActionDestination m_destination
Definition: action.h:67
Profile
Definition: profile.h:26
Profile::name
QString name() const
Definition: profile.cpp:56
DBusAction::setNode
void setNode(const QString &node)
Definition: dbusaction.cpp:41
ProfileAction::loadFromConfig
virtual void loadFromConfig(const KConfigGroup &config)
Definition: profileaction.cpp:78
ProfileActionTemplate::actionName
QString actionName() const
Definition: profileactiontemplate.cpp:66
ProfileAction
Definition: profileaction.h:26
This file is part of the KDE documentation.
Documentation copyright © 1996-2014 The KDE developers.
Generated on Tue Oct 14 2014 23:07:43 by doxygen 1.8.7 written by Dimitri van Heesch, © 1997-2006

KDE's Doxygen guidelines are available online.

kremotecontrol

Skip menu "kremotecontrol"
  • Main Page
  • Namespace List
  • Namespace Members
  • Alphabetical List
  • Class List
  • Class Hierarchy
  • Class Members
  • File List
  • File Members

kdeutils API Reference

Skip menu "kdeutils API Reference"
  • ark
  • filelight
  • kcalc
  • kcharselect
  • kdf
  • kfloppy
  • kgpg
  • kremotecontrol
  • ktimer
  • kwallet
  • superkaramba
  • sweeper

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