summaryrefslogtreecommitdiffstats
path: root/ktalkd/kcmktalkd/main.cpp
blob: a1ff8878b2c0763717a6033d9d0faa55cb109b75 (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
/*
  main.cpp - The KControl module for ktalkd

  Copyright (C) 1998 by David Faure, faure@kde.org
  
  This program is free software; you can redistribute it and/or modify
  it under the terms of the GNU General Public License as published by
  the Free Software Foundation; either version 2 of the License, or
  (at your option) any later version.
  
  This program 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 General Public License for more details.
  
  You should have received a copy of the GNU General Public License
  along with this program; if not, write to the Free Software
  Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA.
   
  */


#include "main.h"
#include "soundpage.h"
#include "answmachpage.h"
#include "forwmachpage.h"
#include <ksimpleconfig.h>
#include <klocale.h>
#include <kglobal.h>
#include <tqtabwidget.h>
#include <tqlayout.h>

KTalkdConfigModule::KTalkdConfigModule(TQWidget *tqparent, const char *name)
    : KCModule(tqparent, name)
{
    config = new KSimpleConfig("ktalkdrc");
    announceconfig = new KSimpleConfig("ktalkannouncerc");

	TQVBoxLayout *tqlayout = new TQVBoxLayout(this);
    
	tab = new TQTabWidget(this);
    
	tqlayout->addWidget(tab);

	soundpage = new KSoundPageConfig(this, "soundpage", config, announceconfig);
	answmachpage = new KAnswmachPageConfig(this, "answmachpage", config);
	forwmachpage = new KForwmachPageConfig(this, "forwmachpage", config);

	tab->addTab(soundpage, i18n("&Announcement"));
	tab->addTab(answmachpage, i18n("Ans&wering Machine"));
	tab->addTab(forwmachpage, i18n("forward call", "&Forward"));
	    
	connect(soundpage, TQT_SIGNAL(changed(bool)), this, TQT_SIGNAL(changed(bool)));
	connect(answmachpage, TQT_SIGNAL(changed(bool)), this, TQT_SIGNAL(changed(bool)));
	connect(forwmachpage, TQT_SIGNAL(changed(bool)), this, TQT_SIGNAL(changed(bool)));
	    }
	    
KTalkdConfigModule::~KTalkdConfigModule() {
	delete config;
	delete announceconfig;
	}

void KTalkdConfigModule::defaults() 
{
    if (soundpage) soundpage->defaults();
    if (answmachpage) answmachpage->defaults();    
    if (forwmachpage) forwmachpage->defaults();    
}

void KTalkdConfigModule::save()
{
    if (soundpage) soundpage->save();
    if (answmachpage) answmachpage->save();
    if (forwmachpage) forwmachpage->save();
}

void KTalkdConfigModule::load()
{
    if (soundpage) soundpage->load();
    if (answmachpage) answmachpage->load();
    if (forwmachpage) forwmachpage->load();
}

void KTalkdConfigModule::resizeEvent(TQResizeEvent *)
{
	tab->setGeometry(0,0,width(),height());
}

extern "C"
{
	KDE_EXPORT KCModule *create_ktalkd(TQWidget *tqparent, const char *)
	{
		return new KTalkdConfigModule(tqparent, "kcmktalkd");
}

	KDE_EXPORT KCModule *create_ktalkd_answmach(TQWidget *tqparent, const char *)
{
		return new KAnswmachPageConfig(tqparent, "kcmktalkd");
	}

	KDE_EXPORT KCModule *create_ktalkd_sound(TQWidget *tqparent, const char *)
	{
		return new KSoundPageConfig(tqparent, "kcmktalkd");
	}

	KDE_EXPORT KCModule *create_ktalkd_forwmach(TQWidget *tqparent, const char *)
	{
		return new KForwmachPageConfig(tqparent, "kcmktalkd");
	}
}

#include "main.moc"