summaryrefslogtreecommitdiffabout
path: root/microkde/kdeui/kcmodule.cpp
blob: f646db3ba29a4ac3c5a4cb6ba5ba1a629a7d0033 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
/*
   This file is part of the KDE libraries

   Copyright (c) 2001 Michael Goffioul <goffioul@imec.be>

   This library is free software; you can redistribute it and/or
   modify it under the terms of the GNU Library General Public
   License as published by the Free Software Foundation; either
   version 2 of the License, or (at your option) any later version.

   This library is distributed in the hope that it will be useful,
   but WITHOUT ANY WARRANTY; without even the implied warranty of
   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
   Library General Public License for more details.

   You should have received a copy of the GNU Library General Public License
   along with this library; see the file COPYING.LIB.  If not, write to
   the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
   Boston, MA 02111-1307, USA.

*/

#include "kcmodule.h"
//US#include <kinstance.h>
#include <kglobal.h>
#include <klocale.h>
#include <kdebug.h>

class KCModulePrivate
{
public:
//US        KInstance *_instance;
	QString _rootOnlyMsg;
	bool _useRootOnlyMsg;
        bool _hasOwnInstance;
    KPrefs* _prefs;
};

KCModule::KCModule(KPrefs* prefs, QWidget *parent, const char *name, const QStringList &)
	: QWidget(parent, name), _btn(Help|Default|Apply)
{
    kdDebug() << "KCModule " << name << endl;
    d = new KCModulePrivate;
    d->_useRootOnlyMsg = true;
    d->_prefs = prefs;
/*US
    d->_instance = new KInstance(name);
	if (name && strlen(name)) {
		d->_instance = new KInstance(name);
		KGlobal::locale()->insertCatalogue(name);
	} else
		d->_instance = new KInstance("kcmunnamed");
*/
    d->_hasOwnInstance = true;
//US    KGlobal::setActiveInstance(this->instance());
}

/*US
KCModule::KCModule(KInstance *instance, QWidget *parent, const QStringList & )
    : QWidget(parent, instance ? instance->instanceName().data() : 0), _btn(Help|Default|Apply)
{
    kdDebug() << "KCModule instance " << (instance ? instance->instanceName().data() : "none") << endl;
    d = new KCModulePrivate;
    d->_useRootOnlyMsg = true;
    d->_instance = instance;
    KGlobal::locale()->insertCatalogue(instance->instanceName());
    d->_hasOwnInstance = false;
    KGlobal::setActiveInstance(this->instance());
}
*/
KCModule::~KCModule()
{
/*US
    if (d->_hasOwnInstance)
       delete d->_instance;
*/
	delete d;
}

void KCModule::setRootOnlyMsg(const QString& msg)
{
	d->_rootOnlyMsg = msg;
}

QString KCModule::rootOnlyMsg() const
{
	return d->_rootOnlyMsg;
}

void KCModule::setUseRootOnlyMsg(bool on)
{
	d->_useRootOnlyMsg = on;
}

bool KCModule::useRootOnlyMsg() const
{
	return d->_useRootOnlyMsg;
}

KPrefs* KCModule::getPreferences()
{
  return d->_prefs;
}

/*US
KInstance *KCModule::instance() const
{
    return d->_instance;
}
*/
void KCModule::virtual_hook( int, void* )
{ /*BASE::virtual_hook( id, data );*/ }

//US #include "kcmodule.moc"