• Skip to content
  • Skip to link menu
Trinity API Reference
  • Trinity API Reference
  • tdeui
 

tdeui

  • tdeui
tdecmodule.cpp
1 /*
2  This file is part of the KDE libraries
3 
4 <<<Copyright (c) 2001 Michael Goffioul <tdeprint@swing.be>
5  Copyright (C) 2004 Frans Englich <frans.englich@telia.com>
6 
7  This library is free software; you can redistribute it and/or
8  modify it under the terms of the GNU Library General Public
9  License as published by the Free Software Foundation; either
10  version 2 of the License, or (at your option) any later version.
11 
12  This library is distributed in the hope that it will be useful,
13  but WITHOUT ANY WARRANTY; without even the implied warranty of
14  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
15  Library General Public License for more details.
16 
17  You should have received a copy of the GNU Library General Public License
18  along with this library; see the file COPYING.LIB. If not, write to
19  the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
20  Boston, MA 02110-1301, USA.
21 
22 */
23 
24 #include <tqlayout.h>
25 
26 #include <tdeaboutdata.h>
27 #include <tdeconfigskeleton.h>
28 #include <tdeconfigdialogmanager.h>
29 #include <kdebug.h>
30 #include <tdeglobal.h>
31 #include <kinstance.h>
32 #include <tdelocale.h>
33 
34 #include "tdecmodule.h"
35 #include "tdecmodule.moc"
36 
37 class TDECModulePrivate
38 {
39 public:
40  TDECModulePrivate():
41  _about( 0 ),
42  _useRootOnlyMsg( false ),
43  _hasOwnInstance( true ),
44  _unmanagedWidgetChangeState( false )
45  { }
46 
47  TDEInstance *_instance;
48  TDEAboutData *_about;
49  TQString _rootOnlyMsg;
50  bool _useRootOnlyMsg;
51  bool _hasOwnInstance;
52  TQPtrList<TDEConfigDialogManager> managers;
53  TQString _quickHelp;
54 
55  // this member is used to record the state on non-automatically
56  // managed widgets, allowing for mixed TDEConfigXT-drive and manual
57  // widgets to coexist peacefully and do the correct thing with
58  // the changed(bool) signal
59  bool _unmanagedWidgetChangeState;
60 };
61 
62 TDECModule::TDECModule(TQWidget *parent, const char *name, const TQStringList &)
63  : TQWidget(parent, name)
64 {
65  init();
66  if (name && strlen(name)) {
67  d->_instance = new TDEInstance(name);
68  TDEGlobal::locale()->insertCatalogue(name);
69  } else
70  d->_instance = new TDEInstance("kcmunnamed");
71  TDEGlobal::setActiveInstance(this->instance());
72 
73  d->managers.setAutoDelete( true );
74 
75 }
76 
77 TDECModule::TDECModule(TDEInstance *instance, TQWidget *parent, const TQStringList & )
78  : TQWidget(parent, instance ? instance->instanceName().data() : 0)
79 {
80  init();
81  d->_instance = instance;
82 
83  if (instance)
84  {
85  TDEGlobal::locale()->insertCatalogue(instance->instanceName());
86  }
87 
88  d->_hasOwnInstance = false;
89  TDEGlobal::setActiveInstance(this->instance());
90 }
91 
92 void TDECModule::init()
93 {
94  d = new TDECModulePrivate;
95  _btn = Help|Default|Apply;
96 }
97 
98 TDEConfigDialogManager* TDECModule::addConfig( TDEConfigSkeleton *config, TQWidget* widget )
99 {
100  TDEConfigDialogManager* manager = new TDEConfigDialogManager( widget, config, name() );
101  connect( manager, TQ_SIGNAL( widgetModified() ), TQ_SLOT( widgetChanged() ));
102  d->managers.append( manager );
103  return manager;
104 }
105 
106 TDECModule::~TDECModule()
107 {
108  if (d->_hasOwnInstance)
109  delete d->_instance;
110  delete d->_about;
111  delete d;
112 }
113 
114 void TDECModule::load()
115 {
116  TDEConfigDialogManager* manager;
117  for( manager = d->managers.first(); manager; manager = d->managers.next() )
118  manager->updateWidgets();
119 }
120 
121 void TDECModule::save()
122 {
123  TDEConfigDialogManager* manager;
124  for( manager = d->managers.first(); manager; manager = d->managers.next() )
125  manager->updateSettings();
126  emit( changed( false ));
127 }
128 
129 void TDECModule::defaults()
130 {
131  TDEConfigDialogManager* manager;
132  for( manager = d->managers.first(); manager; manager = d->managers.next() )
133  manager->updateWidgetsDefault();
134 }
135 
136 void TDECModule::widgetChanged()
137 {
138  emit changed(d->_unmanagedWidgetChangeState || managedWidgetChangeState());
139 }
140 
141 bool TDECModule::managedWidgetChangeState() const
142 {
143  TDEConfigDialogManager* manager;
144  for( manager = d->managers.first(); manager; manager = d->managers.next() )
145  {
146  if ( manager->hasChanged() )
147  return true;
148  }
149 
150  return false;
151 }
152 
153 void TDECModule::unmanagedWidgetChangeState(bool changed)
154 {
155  d->_unmanagedWidgetChangeState = changed;
156  widgetChanged();
157 }
158 
159 const TDEAboutData *TDECModule::aboutData() const
160 {
161  return d->_about;
162 }
163 
164 void TDECModule::setAboutData( TDEAboutData* about )
165 {
166  delete d->_about;
167  d->_about = about;
168 }
169 
170 void TDECModule::setRootOnlyMsg(const TQString& msg)
171 {
172  d->_rootOnlyMsg = msg;
173 }
174 
175 TQString TDECModule::rootOnlyMsg() const
176 {
177  return d->_rootOnlyMsg;
178 }
179 
180 void TDECModule::setUseRootOnlyMsg(bool on)
181 {
182  d->_useRootOnlyMsg = on;
183 }
184 
185 bool TDECModule::useRootOnlyMsg() const
186 {
187  return d->_useRootOnlyMsg;
188 }
189 
190 void TDECModule::changed()
191 {
192  emit changed(true);
193 }
194 
195 TDEInstance *TDECModule::instance() const
196 {
197  return d->_instance;
198 }
199 
200 void TDECModule::setQuickHelp( const TQString& help )
201 {
202  d->_quickHelp = help;
203  emit( quickHelpChanged() );
204 }
205 
206 TQString TDECModule::quickHelp() const
207 {
208  return d->_quickHelp;
209 }
210 
211 TQString TDECModule::handbookDocPath() const
212 {
213  return TQString::null;
214 }
215 
216 TQString TDECModule::handbookSection() const
217 {
218  return TQString::null;
219 }
220 
221 const TQPtrList<TDEConfigDialogManager>& TDECModule::configs() const
222 {
223  return d->managers;
224 }
225 
226 void TDECModule::virtual_hook( int, void* )
227 { /*BASE::virtual_hook( id, data );*/ }
TDEAboutData
TDECModule::quickHelp
virtual TQString quickHelp() const
Return a quick-help text.
Definition: tdecmodule.cpp:206
TDECModule::unmanagedWidgetChangeState
void unmanagedWidgetChangeState(bool)
Call this method when your manually managed widgets change state between changed and not changed.
Definition: tdecmodule.cpp:153
TDECModule::handbookDocPath
virtual TQString handbookDocPath() const
If the handbook's docPath string of the currently displayed content (for example in tabbed control ce...
Definition: tdecmodule.cpp:211
TDECModule::setAboutData
void setAboutData(TDEAboutData *about)
This sets the TDEAboutData returned by aboutData()
Definition: tdecmodule.cpp:164
TDECModule::setRootOnlyMsg
void setRootOnlyMsg(const TQString &msg)
Sets the RootOnly message.
Definition: tdecmodule.cpp:170
TDECModule::configs
const TQPtrList< TDEConfigDialogManager > & configs() const
Definition: tdecmodule.cpp:221
TDECModule::changed
void changed()
Calling this slot is equivalent to emitting changed(true).
Definition: tdecmodule.cpp:190
TDECModule::useRootOnlyMsg
bool useRootOnlyMsg() const
Tell if KControl should show a RootOnly message when run as a normal user.
Definition: tdecmodule.cpp:185
TDECModule::setQuickHelp
void setQuickHelp(const TQString &help)
Sets the quick help.
Definition: tdecmodule.cpp:200
TDECModule::addConfig
TDEConfigDialogManager * addConfig(TDEConfigSkeleton *config, TQWidget *widget)
Adds a TDEConfigskeleton config to watch the widget widget.
Definition: tdecmodule.cpp:98
TDECModule::rootOnlyMsg
TQString rootOnlyMsg() const
Get the RootOnly message for this module.
Definition: tdecmodule.cpp:175
TDECModule::defaults
virtual void defaults()
Sets the configuration to sensible default values.
Definition: tdecmodule.cpp:129
TDECModule::widgetChanged
void widgetChanged()
A managed widget was changed, the widget settings and the current settings are compared and a corresp...
Definition: tdecmodule.cpp:136
TDECModule::handbookSection
virtual TQString handbookSection() const
If a specific handbook section is relevant to the currently displayed content (for example tabbed con...
Definition: tdecmodule.cpp:216
TDECModule::quickHelpChanged
void quickHelpChanged()
Indicate that the module's quickhelp has changed.
TDECModule::load
virtual void load()
Load the configuration data into the module.
Definition: tdecmodule.cpp:114
TDECModule::managedWidgetChangeState
bool managedWidgetChangeState() const
Returns the changed state of automatically managed widgets in this dialog.
Definition: tdecmodule.cpp:141
TDECModule::aboutData
virtual const TDEAboutData * aboutData() const
This is generally only called for the KBugReport.
Definition: tdecmodule.cpp:159
TDECModule::save
virtual void save()
Save the configuration data.
Definition: tdecmodule.cpp:121
TDECModule::setUseRootOnlyMsg
void setUseRootOnlyMsg(bool on)
Change whether or not the RootOnly message should be shown.
Definition: tdecmodule.cpp:180
TDEConfigDialogManager
TDEConfigDialogManager::updateWidgets
void updateWidgets()
TDEConfigDialogManager::updateWidgetsDefault
void updateWidgetsDefault()
TDEConfigDialogManager::hasChanged
bool hasChanged()
TDEConfigDialogManager::updateSettings
void updateSettings()
TDEConfigSkeleton
TDEGlobal::locale
static TDELocale * locale()
TDEGlobal::setActiveInstance
static void setActiveInstance(TDEInstance *d)
TDEInstance
TDEInstance::instanceName
TQCString instanceName() const
TDELocale::insertCatalogue
void insertCatalogue(const TQString &catalog)
KNotifyClient::instance
TDEInstance * instance()
TDEStdAccel::name
TQString name(StdAccel id)
tdelocale.h

tdeui

Skip menu "tdeui"
  • Main Page
  • Namespace List
  • Class Hierarchy
  • Alphabetical List
  • Class List
  • File List
  • Namespace Members
  • Class Members
  • Related Pages

tdeui

Skip menu "tdeui"
  • arts
  • dcop
  • dnssd
  • interfaces
  •   kspeech
  •     interface
  •     library
  •   tdetexteditor
  • kate
  • kded
  • kdoctools
  • kimgio
  • kjs
  • libtdemid
  • libtdescreensaver
  • tdeabc
  • tdecmshell
  • tdecore
  • tdefx
  • tdehtml
  • tdeinit
  • tdeio
  •   bookmarks
  •   httpfilter
  •   kpasswdserver
  •   kssl
  •   tdefile
  •   tdeio
  •   tdeioexec
  • tdeioslave
  •   http
  • tdemdi
  •   tdemdi
  • tdenewstuff
  • tdeparts
  • tdeprint
  • tderandr
  • tderesources
  • tdespell2
  • tdesu
  • tdeui
  • tdeunittest
  • tdeutils
  • tdewallet
Generated for tdeui by doxygen 1.9.1
This website is maintained by Timothy Pearson.