summaryrefslogtreecommitdiffstats
path: root/lilo-config/kde-qt-common/mainwidget.cpp
blob: bb966f283c7f6b11cb7538eba6462b50147bbe27 (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
/* mainwidget.cpp
**
** Copyright (C) 2000,2001 by Bernhard Rosenkraenzer
**
** Contributions by M. Laurent and W. Bastian.
**
*/

/*
** 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 in a file called COPYING; if not, write to
** the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
** MA 02110-1301, USA.
*/

/*
** Bug reports and questions can be sent to kde-devel@kde.org
*/
#include "mainwidget.moc"
#include "ui.h"

MainWidget::MainWidget(TQWidget *parent, const char *name)
  : TQTabWidget(parent, name)
{
	l=new liloconf();
	general=new General(l, this);
	connect(general, TQT_SIGNAL(configChanged()), TQT_SIGNAL(configChanged()));
	images=new Images(l, this);
	connect(images, TQT_SIGNAL(configChanged()), TQT_SIGNAL(configChanged()));
	expert=new Expert(l, this);
	connect(expert, TQT_SIGNAL(configChanged()), TQT_SIGNAL(configChanged()));
	connect(expert, TQT_SIGNAL(configChanged()), images, TQT_SLOT(update()));
	addTab(general, _("&General Options"));
	addTab(images, _("&Operating Systems"));
	addTab(expert, _("&Expert"));
	connect(this, TQT_SIGNAL(selected(const TQString &)), TQT_SLOT(tabChanged(const TQString &)));
	load();
	arrangeWidgets();
}

void MainWidget::makeReadOnly()
{
    general->makeReadOnly();
    images->makeReadOnly();
    expert->makeReadOnly();
}

void MainWidget::load()
{
	defaults();
}

void MainWidget::save()
{
	if(previous==_("&Expert"))
		expert->saveChanges();
	else {
		general->saveChanges();
		images->saveChanges();
	}
	l->checked=false;
	if(!l->isOk()) {
		if(WarningYesNo(this, "About to write a faulty lilo.conf", "WARNING: the config file is currently NOT ok.\nDo you really want to override /etc/lilo.conf?\n\nIf you aren't sure, select \"no\" and click the \"Check configuration\" button to see the details.\nIf you don't know what's wrong, try clicking the \"Probe\" button to auto-generate a working lilo.conf.\nIf you're getting this message after using the \"Probe\" button, please send a full bug report,\nincluding the output of \"Check configuration\" and the generated lilo.conf (displayed in the \"Expert\" tab),\nto bero@kde.org.")!=IDYES)
			return;
	}
	l->writeFile("/etc/lilo.conf");
	l->install();
}

void MainWidget::defaults()
{
}

void MainWidget::reset()
{
	load();
}

void MainWidget::arrangeWidgets()
{
}
void MainWidget::tabChanged(TQString const &lbl) // SLOT
{
	if(previous==_("&Expert"))
		expert->saveChanges();
	else if(previous==_("&General options"))
		general->saveChanges();
	else if(previous==_("&Operating systems"))
		images->saveChanges();
	if(lbl==_("&Expert"))
		expert->update();
	else if(lbl==_("&Operating systems"))
		images->update();
	else if(lbl==_("&General options"))
		general->update();
	previous=lbl;
}