• 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
keypressaction.cpp
Go to the documentation of this file.
1 /*
2  Copyright (C) 2010 Michael Zanetti <mzanetti@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 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 "keypressaction.h"
21 
22 #include <KDebug>
23 #include <KLocale>
24 
25 KeypressAction::KeypressAction(const QString &button): Action(Action::KeypressAction, button) {
26 
27 }
28 
29 KeypressAction::KeypressAction(): Action(Action::KeypressAction) {
30 }
31 
32 QString KeypressAction::name() const {
33  return i18n("Workspace");
34 }
35 
36 QString KeypressAction::description() const {
37  QString ret = i18n("Keypress:");
38  ret.append(' ');
39  for(int i = 0; i < m_keySequenceList.count(); ++i) {
40  if(i != 0) {
41  ret.append(", ");
42  }
43  ret.append(m_keySequenceList.at(i).toString(QKeySequence::NativeText));
44  }
45 
46  return ret;
47 }
48 
49 void KeypressAction::saveToConfig(KConfigGroup& config) {
50  Action::saveToConfig(config);
51  for(int i = 0; i < m_keySequenceList.count(); ++i) {
52  config.writeEntry("KeySequence" + QString::number(i), m_keySequenceList.at(i).toString(QKeySequence::PortableText));
53  }
54 
55 }
56 
57 void KeypressAction::loadFromConfig(const KConfigGroup& config) {
58  Action::loadFromConfig(config);
59  int i = 0;
60  while(!config.readEntry("KeySequence" + QString::number(i)).isEmpty()) {
61  m_keySequenceList.append(QKeySequence(config.readEntry("KeySequence" + QString::number(i++)),QKeySequence::PortableText));
62  }
63 }
64 
65 Action* KeypressAction::clone() const {
66  KeypressAction *action = new KeypressAction();
67  action->setKeySequenceList(m_keySequenceList);
68  action->setRepeat(m_repeat);
69  return action;
70 }
71 
72 void KeypressAction::setKeySequenceList(const QList<QKeySequence> &keySequenceList) {
73  m_keySequenceList = keySequenceList;
74 }
75 
76 QList<QKeySequence> KeypressAction::keySequenceList() const {
77  return m_keySequenceList;
78 }
KeypressAction::KeypressAction
KeypressAction()
Definition: keypressaction.cpp:29
KeypressAction::saveToConfig
virtual void saveToConfig(KConfigGroup &config)
Definition: keypressaction.cpp:49
KeypressAction
Definition: keypressaction.h:27
keypressaction.h
Action::loadFromConfig
virtual void loadFromConfig(const KConfigGroup &config)
Definition: action.cpp:94
KeypressAction::m_keySequenceList
QList< QKeySequence > m_keySequenceList
Definition: keypressaction.h:46
Action
Definition: action.h:30
Action::setRepeat
void setRepeat(bool repeat)
Definition: action.cpp:49
Action::m_repeat
bool m_repeat
Definition: action.h:66
KeypressAction::name
virtual QString name() const
Definition: keypressaction.cpp:32
KeypressAction::loadFromConfig
virtual void loadFromConfig(const KConfigGroup &config)
Definition: keypressaction.cpp:57
KeypressAction::description
virtual QString description() const
Definition: keypressaction.cpp:36
Action::saveToConfig
virtual void saveToConfig(KConfigGroup &config)
Definition: action.cpp:69
KeypressAction::clone
virtual Action * clone() const
Definition: keypressaction.cpp:65
KeypressAction::setKeySequenceList
void setKeySequenceList(const QList< QKeySequence > &keySequenceList)
Definition: keypressaction.cpp:72
KeypressAction::keySequenceList
QList< QKeySequence > keySequenceList() const
Definition: keypressaction.cpp:76
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