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

lokalize

  • sources
  • kde-4.14
  • kdesdk
  • lokalize
  • src
actionproxy.cpp
Go to the documentation of this file.
1 /* ****************************************************************************
2  This file is part of Lokalize
3 
4  Copyright (C) 2008 by Nick Shaforostoff <shafff@ukr.net>
5 
6  This program is free software; you can redistribute it and/or
7  modify it under the terms of the GNU General Public License as
8  published by the Free Software Foundation; either version 2 of
9  the License or (at your option) version 3 or any later version
10  accepted by the membership of KDE e.V. (or its successor approved
11  by the membership of KDE e.V.), which shall act as a proxy
12  defined in Section 14 of version 3 of the license.
13 
14  This program is distributed in the hope that it will be useful,
15  but WITHOUT ANY WARRANTY; without even the implied warranty of
16  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
17  GNU General Public License for more details.
18 
19  You should have received a copy of the GNU General Public License
20  along with this program. If not, see <http://www.gnu.org/licenses/>.
21 
22 **************************************************************************** */
23 
24 #include "actionproxy.h"
25 
26 #include <kdebug.h>
27 #include <KStatusBar>
28 
29 #if 0
30 #include <QAction>
31 
32 
33 ActionProxy::ActionProxy(QObject* parent,QObject* receiver,const char* slot)
34  : QObject(parent)
35  , m_currentAction(0)
36  , m_disabled(false)
37  , m_checked(false)
38 // , m_checkable(false)
39 {
40  if (receiver)
41  connect(this,SIGNAL(triggered(bool)),receiver,slot);
42 
43  connect(this,SIGNAL(toggled(bool)),this,SLOT(handleToggled(bool)));
44 }
45 
46 ActionProxy::~ActionProxy()
47 {
48  // if the view is closed...
49 }
50 
51 void ActionProxy::registerAction(QAction* a)
52 {
53  if (a==m_currentAction)
54  return;
55 
56  m_currentAction=a;
57  a->setChecked(m_checked);
58  a->setDisabled(m_disabled);
59  a->setStatusTip(m_statusTip);
60  m_keySequence=a->shortcut();
61 
62  connect(a,SIGNAL(triggered(bool)),this,SIGNAL(triggered(bool)));
63  connect(a,SIGNAL(toggled(bool)),this,SIGNAL(toggled(bool)));
64 }
65 void ActionProxy::unregisterAction(/*QAction**/)
66 {
67  disconnect(m_currentAction,SIGNAL(triggered(bool)),this,SIGNAL(triggered(bool)));
68  disconnect(m_currentAction,SIGNAL(toggled(bool)),this,SIGNAL(toggled(bool)));
69  m_currentAction->setStatusTip(QString());
70  m_currentAction=0;
71 }
72 
73 void ActionProxy::handleToggled(bool checked)
74 {
75  m_checked=checked;
76 }
77 
78 void ActionProxy::setDisabled(bool disabled)
79 {
80  if (m_currentAction)
81  m_currentAction->setDisabled(disabled);
82 
83  m_disabled=disabled;
84 }
85 
86 void ActionProxy::setChecked(bool checked)
87 {
88  if (m_currentAction)
89  m_currentAction->setChecked(checked); //handleToggled is called implicitly via signal/slot mechanism
90  else
91  m_checked=checked;
92 }
93 
94 
95 #endif
96 
97 void StatusBarProxy::insert(int key,const QString& str)
98 {
99  if (m_currentStatusBar)
100  m_currentStatusBar->changeItem(str,key);
101  QMap<int,QString>::insert(key,str);
102 }
103 
104 void StatusBarProxy::registerStatusBar(KStatusBar* bar)
105 {
106  m_currentStatusBar=bar;
107 
108  QMap<int,QString>::const_iterator i = constBegin();
109  while (i != constEnd())
110  {
111  bar->changeItem(i.value(),i.key());
112  ++i;
113  }
114 }
115 
QAction::setDisabled
void setDisabled(bool b)
StatusBarProxy::insert
void insert(int, const QString &)
Definition: actionproxy.cpp:97
StatusBarProxy::registerStatusBar
void registerStatusBar(KStatusBar *)
Definition: actionproxy.cpp:104
QAction::setChecked
void setChecked(bool)
QMap< int, QString >::constBegin
const_iterator constBegin() const
QMap
QObject
QMap< int, QString >::constEnd
const_iterator constEnd() const
QString
QAction::shortcut
shortcut
QMap::key
const Key key(const T &value) const
QAction::setStatusTip
void setStatusTip(const QString &statusTip)
QAction
QMap::insert
iterator insert(const Key &key, const T &value)
actionproxy.h
QMap::value
const T value(const Key &key) const
This file is part of the KDE documentation.
Documentation copyright © 1996-2020 The KDE developers.
Generated on Mon Jun 22 2020 13:40:06 by doxygen 1.8.7 written by Dimitri van Heesch, © 1997-2006

KDE's Doxygen guidelines are available online.

lokalize

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

kdesdk API Reference

Skip menu "kdesdk API Reference"
  • kapptemplate
  • kcachegrind
  • kompare
  • lokalize
  • umbrello
  •   umbrello

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