• 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
action.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 "action.h"
21 
22 Action::Action(ActionType type, const QString &button): m_type(type), m_button(button) {
23 }
24 
25 Action::Action(const Action& action): m_button(action.button()) {
26  m_type = action.type();
27 }
28 
29 Action::Action(ActionType type) {
30  m_type = type;
31 }
32 
33 Action::ActionType Action::type() const {
34  return m_type;
35 }
36 
37 QString Action::button() const {
38  return m_button;
39 }
40 
41 void Action::setButton(const QString& button) {
42  m_button = button;
43 }
44 
45 bool Action::repeat() const {
46  return m_repeat;
47 }
48 
49 void Action::setRepeat(bool repeat) {
50  m_repeat = repeat;
51 }
52 
53 bool Action::autostart() const {
54  return m_autostart;
55 }
56 
57 void Action::setAutostart(bool autostart) {
58  m_autostart = autostart;
59 }
60 
61 Action::ActionDestination Action::destination() const {
62  return m_destination;
63 }
64 
65 void Action::setDestination(Action::ActionDestination destination) {
66  m_destination = destination;
67 }
68 
69 void Action::saveToConfig(KConfigGroup& config) {
70  config.writeEntry("Type", (int)m_type);
71  config.writeEntry("Button", m_button);
72  switch(m_destination){
73  case Unique:
74  config.writeEntry("Destination", "Unique");
75  break;
76  case Top:
77  config.writeEntry("Destination", "Top");
78  break;
79  case Bottom:
80  config.writeEntry("Destination", "Bottom");
81  break;
82  case None:
83  config.writeEntry("Destination", "None");
84  break;
85  case All:
86  default:
87  config.writeEntry("Destination", "All");
88  break;
89  }
90  config.writeEntry("Autostart", m_autostart);
91  config.writeEntry("Repeat", m_repeat);
92 }
93 
94 void Action::loadFromConfig(const KConfigGroup &config) {
95  m_type = (ActionType)config.readEntry("Type").toInt();
96  m_button = config.readEntry("Button");
97  QString destination = config.readEntry("Destination");
98  if(destination == QLatin1String( "Unique" )){
99  m_destination = Unique;
100  }
101  else if(destination == QLatin1String( "Top" )){
102  m_destination = Top;
103  }
104  else if(destination == QLatin1String( "Bottom" )){
105  m_destination = Bottom;
106  }
107  else if(destination == QLatin1String( "None" )){
108  m_destination = None;
109  }
110  else if(destination == QLatin1String( "All" )){
111  m_destination = All;
112  }
113  m_autostart = config.readEntry("Autostart", QVariant(false)).toBool();
114  m_repeat = config.readEntry("Repeat", QVariant(false)).toBool();
115 }
Action::Bottom
Definition: action.h:34
Action::destination
ActionDestination destination() const
Definition: action.cpp:61
Action::type
ActionType type() const
Definition: action.cpp:33
Action::ActionType
ActionType
Definition: action.h:33
Action::autostart
bool autostart() const
Definition: action.cpp:53
Action::m_type
ActionType m_type
Definition: action.h:64
Action::button
QString button() const
Definition: action.cpp:37
Action::All
Definition: action.h:34
Action::loadFromConfig
virtual void loadFromConfig(const KConfigGroup &config)
Definition: action.cpp:94
Action::m_autostart
bool m_autostart
Definition: action.h:66
Action::ActionDestination
ActionDestination
Definition: action.h:34
Action
Definition: action.h:30
Action::Action
Action(ActionType type, const QString &button)
Definition: action.cpp:22
Action::setRepeat
void setRepeat(bool repeat)
Definition: action.cpp:49
Action::setButton
void setButton(const QString &button)
Definition: action.cpp:41
Action::Unique
Definition: action.h:34
action.h
Action::Top
Definition: action.h:34
Action::setDestination
void setDestination(ActionDestination destination)
Definition: action.cpp:65
Action::m_repeat
bool m_repeat
Definition: action.h:66
Action::setAutostart
void setAutostart(bool autostart)
Definition: action.cpp:57
Action::m_button
QString m_button
Definition: action.h:65
Action::None
Definition: action.h:34
Action::saveToConfig
virtual void saveToConfig(KConfigGroup &config)
Definition: action.cpp:69
Action::m_destination
ActionDestination m_destination
Definition: action.h:67
Action::repeat
bool repeat() const
Definition: action.cpp:45
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