summaryrefslogtreecommitdiffstats
path: root/lilo-config/kde-qt-common
diff options
context:
space:
mode:
authortoma <toma@283d02a7-25f6-0310-bc7c-ecb5cbfe19da>2009-11-25 17:56:58 +0000
committertoma <toma@283d02a7-25f6-0310-bc7c-ecb5cbfe19da>2009-11-25 17:56:58 +0000
commit37333bf25ad9a4c538250f5af2f9f1d666362883 (patch)
treec45e8df5b9efbffe07eb3d9340df7811c7e16943 /lilo-config/kde-qt-common
downloadtdeadmin-37333bf25ad9a4c538250f5af2f9f1d666362883.tar.gz
tdeadmin-37333bf25ad9a4c538250f5af2f9f1d666362883.zip
Copy the KDE 3.5 branch to branches/trinity for new KDE 3.5 features.
BUG:215923 git-svn-id: svn://anonsvn.kde.org/home/kde/branches/trinity/kdeadmin@1054174 283d02a7-25f6-0310-bc7c-ecb5cbfe19da
Diffstat (limited to 'lilo-config/kde-qt-common')
-rw-r--r--lilo-config/kde-qt-common/EditWidget.cpp81
-rw-r--r--lilo-config/kde-qt-common/EditWidget.h92
-rw-r--r--lilo-config/kde-qt-common/Makefile.am14
-rw-r--r--lilo-config/kde-qt-common/expert.cpp63
-rw-r--r--lilo-config/kde-qt-common/expert.h53
-rw-r--r--lilo-config/kde-qt-common/general.cpp229
-rw-r--r--lilo-config/kde-qt-common/general.h62
-rw-r--r--lilo-config/kde-qt-common/images.cpp334
-rw-r--r--lilo-config/kde-qt-common/images.h82
-rw-r--r--lilo-config/kde-qt-common/mainwidget.cpp107
-rw-r--r--lilo-config/kde-qt-common/mainwidget.h60
-rw-r--r--lilo-config/kde-qt-common/ui.h77
12 files changed, 1254 insertions, 0 deletions
diff --git a/lilo-config/kde-qt-common/EditWidget.cpp b/lilo-config/kde-qt-common/EditWidget.cpp
new file mode 100644
index 0000000..fad957a
--- /dev/null
+++ b/lilo-config/kde-qt-common/EditWidget.cpp
@@ -0,0 +1,81 @@
+/* EditWidget.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 "EditWidget.moc"
+#include "ui.h"
+EditWidget::EditWidget(QString const label, QString const text, bool isFile, QWidget *parent, const char *name, WFlags f, bool allowLines):QHBox(allowLines, parent, name, f)
+{
+ setMargin(SPACE_MARGIN);
+ setSpacing(SPACE_INSIDE);
+ lbl=new QLabel(label, this);
+ setStretchFactor(lbl, 0);
+ line=new QLineEdit(text, this);
+ setStretchFactor(line, 1);
+ connect(line, SIGNAL(textChanged(const QString &)), SIGNAL(textChanged(const QString &)));
+ connect(line, SIGNAL(returnPressed()), SIGNAL(returnPressed()));
+ lbl->setBuddy(line);
+ if(isFile) {
+ select=new QPushButton(_("Select..."), this);
+ connect(select, SIGNAL(clicked()), SLOT(selectFileClicked()));
+ select->resize(select->minimumSizeHint());
+ setStretchFactor(select, 0);
+ } else
+ select=0;
+}
+void EditWidget::selectFileClicked()
+{
+ QString filename=FileDlg::getOpenFileName(QString::null, QString::null, this);
+ if(!filename.isEmpty())
+ line->setText(filename);
+}
+QSize EditWidget::sizeHint() const
+{
+ int w=2*SPACE_MARGIN+lbl->sizeHint().width()+SPACE_INSIDE+line->sizeHint().width();
+ int h=lbl->sizeHint().height();
+ if(h<line->sizeHint().height())
+ h=line->sizeHint().height();
+ if(select!=0) {
+ w+=SPACE_INSIDE+select->sizeHint().width();
+ if(h<select->sizeHint().height())
+ h=select->sizeHint().height();
+ }
+ return QSize(w, h);
+}
+QSize EditWidget::minimumSizeHint() const
+{
+ int w=2*SPACE_MARGIN+lbl->minimumSizeHint().width()+SPACE_INSIDE+line->minimumSizeHint().width();
+ int h=lbl->minimumSizeHint().height();
+ if(h<line->minimumSizeHint().height())
+ h=line->minimumSizeHint().height();
+ if(select!=0) {
+ w+=SPACE_INSIDE+select->minimumSizeHint().width();
+ if(h<select->minimumSizeHint().height())
+ h=select->minimumSizeHint().height();
+ }
+ return QSize(w, h);
+}
diff --git a/lilo-config/kde-qt-common/EditWidget.h b/lilo-config/kde-qt-common/EditWidget.h
new file mode 100644
index 0000000..515c65e
--- /dev/null
+++ b/lilo-config/kde-qt-common/EditWidget.h
@@ -0,0 +1,92 @@
+/* EditWidget.h
+**
+** 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
+*/
+#ifndef _EDITWIDGET_H_
+#define _EDITWIDGET_H_ 1
+#include <qhbox.h>
+#include <qlabel.h>
+#include <qlineedit.h>
+#include <qpushbutton.h>
+class EditWidget:public QHBox
+{
+ Q_OBJECT
+public:
+ EditWidget(QString const label="", QString const text="", bool isFile=false, QWidget *parent=0, const char *name=0, WFlags f=0, bool allowLines=true);
+ void setLabel(QString const &label) { lbl->setText(label); };
+ QString text() const { return line->text(); };
+ QString displayText() const { return line->displayText(); };
+ int maxLength() const { return line->maxLength(); };
+ virtual void setMaxLength(int l) { line->setMaxLength(l); };
+ virtual void setFrame(bool b) { line->setFrame(b); };
+ bool frame() const { return line->frame(); };
+ virtual void setEchoMode(QLineEdit::EchoMode e) { line->setEchoMode(e); };
+ QLineEdit::EchoMode echoMode() const { return line->echoMode(); };
+ void setReadOnly(bool b) const { line->setReadOnly(b); };
+ bool isReadOnly() const { return line->isReadOnly(); };
+ virtual void setValidator(const QValidator *v) { line->setValidator(v); };
+ const QValidator *validator() const { return line->validator(); };
+ virtual void setSelection(int s, int e) { line->setSelection(s, e); };
+ virtual void setCursorPosition(int p) { line->setCursorPosition(p); };
+ int cursorPosition() const { return line->cursorPosition(); };
+ bool validateAndSet(const QString &s, int a, int b, int c) { return line->validateAndSet(s, a, b, c); };
+ void cut() { line->cut(); };
+ void copy() const { line->copy(); };
+ void paste() { line->paste(); };
+ void setAlignment(int flag) { line->setAlignment(flag); };
+ int alignment() const { return line->alignment(); };
+ void cursorLeft(bool mark, int steps=1) { line->cursorLeft(mark, steps); };
+ void cursorRight(bool mark, int steps=1) { line->cursorRight(mark, steps); };
+ void cursorWordForward(bool mark) { line->cursorWordForward(mark); };
+ void cursorWordBackward(bool mark) { line->cursorWordBackward(mark); };
+ void backspace() { line->backspace(); };
+ void del() { line->del(); };
+ void home(bool mark) { line->home(mark); };
+ void end(bool mark) { line->end(mark); };
+ void setEdited(bool e) { line->setEdited(e); };
+ bool edited() const { return line->edited(); };
+ bool hasMarkedText() const { return line->hasMarkedText(); };
+ QString markedText() const { return line->markedText(); };
+ virtual QSize sizeHint() const;
+ virtual QSize minimumSizeHint() const;
+public slots:
+ virtual void setText(const QString &text) { line->setText(text); };
+ void selectAll() { line->selectAll(); };
+ void deselect() { line->deselect(); };
+ void clearValidator() { line->clearValidator(); };
+ void insert(const QString &s) { line->insert(s); };
+ void clear() { line->clear(); };
+ void selectFileClicked();
+signals:
+ void textChanged(const QString &);
+ void returnPressed();
+private:
+ QLabel *lbl;
+ QLineEdit *line;
+ QPushButton *select;
+};
+#endif
diff --git a/lilo-config/kde-qt-common/Makefile.am b/lilo-config/kde-qt-common/Makefile.am
new file mode 100644
index 0000000..f5b57eb
--- /dev/null
+++ b/lilo-config/kde-qt-common/Makefile.am
@@ -0,0 +1,14 @@
+AM_CXXFLAGS = -DUSE_KDE
+INCLUDES= -I$(srcdir)/../common -I$(srcdir)/.. -I. $(all_includes)
+
+noinst_LTLIBRARIES=libwidgets.la
+
+libwidgets_la_SOURCES = \
+ mainwidget.cpp general.cpp images.cpp expert.cpp \
+ EditWidget.cpp
+libwidgets_la_LIBADD = $(LIB_QT) ../common/libcommon.la
+libwidgets_la_METASOURCES = AUTO
+
+noinst_HEADERS = \
+ mainwidget.h ui.h general.h images.h expert.h \
+ EditWidget.h
diff --git a/lilo-config/kde-qt-common/expert.cpp b/lilo-config/kde-qt-common/expert.cpp
new file mode 100644
index 0000000..dea58e9
--- /dev/null
+++ b/lilo-config/kde-qt-common/expert.cpp
@@ -0,0 +1,63 @@
+/* expert.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 "expert.moc"
+#include <ui.h>
+#include <qwhatsthis.h>
+#include <String.h>
+#include <strstream>
+Expert::Expert(liloconf *l, QWidget *parent, const char *name):QWidget(parent, name)
+{
+ lilo=l;
+ layout=new QHBoxLayout(this);
+ edit=new QMultiLineEdit(this);
+ layout->addWidget(edit);
+ connect(edit, SIGNAL(textChanged()), SIGNAL(configChanged()));
+ QWhatsThis::add(edit, _("You can edit the lilo.conf file directly here. All changes you make here are automatically transferred to the graphical interface."));
+ update();
+}
+Expert::~Expert()
+{
+ delete edit;
+}
+void Expert::update()
+{
+ bool blocked = signalsBlocked();
+ blockSignals(true);
+ edit->setText(((String)*lilo).cstr());
+ blockSignals(blocked);
+}
+void Expert::saveChanges()
+{
+ lilo->set(edit->text().latin1());
+}
+
+void Expert::makeReadOnly()
+{
+ edit->setEnabled( false );
+}
diff --git a/lilo-config/kde-qt-common/expert.h b/lilo-config/kde-qt-common/expert.h
new file mode 100644
index 0000000..d9d6afb
--- /dev/null
+++ b/lilo-config/kde-qt-common/expert.h
@@ -0,0 +1,53 @@
+/* expert.h
+**
+** 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
+*/
+#ifndef _EXPERT_H_
+#define _EXPERT_H_ 1
+#include <lilo.h>
+#include <qwidget.h>
+#include <qmultilineedit.h>
+#include <qlayout.h>
+class Expert:public QWidget
+{
+ Q_OBJECT
+public:
+ Expert(liloconf *l=0, QWidget *parent=0, const char *name=0);
+ ~Expert();
+ void setCfg(liloconf *l) { lilo=l; };
+ void makeReadOnly();
+public slots:
+ void update();
+ void saveChanges();
+signals:
+ void configChanged();
+private:
+ liloconf *lilo;
+ QHBoxLayout *layout;
+ QMultiLineEdit *edit;
+};
+#endif
diff --git a/lilo-config/kde-qt-common/general.cpp b/lilo-config/kde-qt-common/general.cpp
new file mode 100644
index 0000000..7944409
--- /dev/null
+++ b/lilo-config/kde-qt-common/general.cpp
@@ -0,0 +1,229 @@
+/* general.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 "general.moc"
+#include "EditWidget.h"
+#include <Disks.h>
+#include <qlayout.h>
+#include <ui.h>
+#include <qwhatsthis.h>
+
+#include <stdlib.h>
+
+General::General(liloconf *l, QWidget *parent, const char *name):QWidget(parent, name)
+{
+ lilo=l;
+ QVBoxLayout *layout=new QVBoxLayout(this);
+ layout->setMargin(SPACE_MARGIN);
+ layout->setSpacing(SPACE_INSIDE);
+ QHBox *drv=new QHBox(this);
+ QLabel *drive_lbl=new QLabel(_("Install &boot record to drive/partition:"), drv);
+ drive=new QComboBox(false, drv);
+ drive_lbl->setBuddy(drive);
+ StringList p=ptable::disklist();
+ p+=ptable::partlist();
+ p.sort();
+ for(StringList::const_iterator it=p.begin(); it!=p.end(); it++)
+ drive->insertItem((*it).cstr());
+ connect(drive, SIGNAL(activated(int)), SIGNAL(configChanged()));
+ layout->addWidget(drv);
+ QWhatsThis::add(drv, _("Select the drive or partition you want to install the LILO boot loader to here. Unless you intend to use other boot managers in addition to LILO, this should be the MBR (master boot record) of your boot drive.<br>In this case, you should probably select <i>/dev/hda</i> if your boot drive is an IDE drive or <i>/dev/sda</i> if your boot drive is SCSI."));
+
+ QHBox *to=new QHBox(this);
+ QLabel *to_lbl=new QLabel(_("Boot the default kernel/OS &after:"), to);
+ timeout=new QSpinBox(0, 1000000, 1, to);
+ timeout->setSuffix(_("/10 seconds"));
+ connect(timeout, SIGNAL(valueChanged(int)), SIGNAL(configChanged()));
+ to_lbl->setBuddy(timeout);
+ layout->addWidget(to);
+ QWhatsThis::add(to, _("LILO will wait the amount of time specified here before booting the kernel (or OS) marked as <i>default</i> in the <b>Images</b> tab."));
+
+ QHBox *modes=new QHBox(this);
+ linear=new QCheckBox(_("Use &linear mode"), modes);
+ connect(linear, SIGNAL(clicked()), SIGNAL(configChanged()));
+ QWhatsThis::add(linear, _("Check this box if you want to use the linear mode.<br>Linear mode tells the boot loader the location of kernels in linear addressing rather than sector/head/cylinder.<br>linear mode is required for some SCSI drives, and shouldn't hurt unless you're planning to create a boot disk to be used with a different computer.<br>See the lilo.conf man page for details."));
+ compact=new QCheckBox(_("Use &compact mode"), modes);
+ connect(compact, SIGNAL(clicked()), SIGNAL(configChanged()));
+ QWhatsThis::add(compact, _("Check this box if you want to use the compact mode.<br>The compact mode tries to merge read requests for adjacent sectors into a single read request. This reduces load time and keeps the boot map smaller, but will not work on all systems."));
+ layout->addWidget(modes);
+
+ QHBox *opts=new QHBox(this);
+ lock=new QCheckBox(_("&Record boot command lines for defaults"), opts);
+ connect(lock, SIGNAL(clicked()), SIGNAL(configChanged()));
+ QWhatsThis::add(lock, "<qt>"+_("Checking this box enables automatic recording of boot command lines as the defaults for the following boots. This way, lilo \"locks\" on a choice until it is manually overridden.\nThis sets the <b>lock</b> option in lilo.conf."));
+ restricted=new QCheckBox(_("R&estrict parameters"), opts);
+ connect(restricted, SIGNAL(clicked()), SIGNAL(configChanged()));
+ connect(restricted, SIGNAL(clicked()), SLOT(check_pw()));
+ QWhatsThis::add(restricted, _("If this box is checked, a password (entered below) is required only if any parameters are changed (i.e. the user can boot <i>linux</i>, but not <i>linux single</i> or <i>linux init=/bin/sh</i>).\nThis sets the <b>restricted</b> option in lilo.conf.<br>This sets a default for all Linux kernels you want to boot. If you need a per-kernel setting, go to the <i>Operating systems</i> tab and select <i>Details</i>."));
+ layout->addWidget(opts);
+
+ QHBox *pw=new QHBox(this);
+ use_password=new QCheckBox(_("Require &password:"), pw);
+ connect(use_password, SIGNAL(clicked()), SIGNAL(configChanged()));
+ connect(use_password, SIGNAL(clicked()), SLOT(check_pw()));
+ password=new QLineEdit(pw);
+ password->setMaxLength(15);
+ password->setEchoMode(QLineEdit::Password);
+ connect(password, SIGNAL(textChanged(const QString &)), SIGNAL(configChanged()));
+ QWhatsThis::add(pw, _("Enter the password required for bootup (if any) here. If <i>restricted</i> above is checked, the password is required for additional parameters only.<br><b>WARNING:</b> The password is stored in clear text in /etc/lilo.conf. You'll want to make sure nobody untrusted can read this file. Also, you probably don't want to use your normal/root password here.<br>This sets a default for all Linux kernels you want to boot. If you need a per-kernel setting, go to the <i>Operating systems</i> tab and select <i>Details</i>."));
+ layout->addWidget(pw);
+
+ QHBox *vgab=new QHBox(this);
+ QLabel *vlbl=new QLabel(_("&Default graphics mode on text console:"), vgab);
+ vga=new QComboBox(false, vgab);
+ vlbl->setBuddy(vga);
+ QWhatsThis::add(vgab, _("You can select the default graphics mode here.<br>If you intend to use a VGA graphics mode, you must compile the kernel with support for framebuffer devices. The <i>ask</i> setting brings up a prompt at boot time.<br>This sets a default for all Linux kernels you want to boot. If you need a per-kernel setting, go to the <i>Operating systems</i> tab and select <i>Details</i>."));
+ vga->insertItem(_("default"));
+ vga->insertItem(_("ask"));
+ vga->insertItem(_("text 80x25 (0)"));
+ vga->insertItem(_("text 80x50 (1)"));
+ vga->insertItem(_("text 80x43 (2)"));
+ vga->insertItem(_("text 80x28 (3)"));
+ vga->insertItem(_("text 80x30 (4)"));
+ vga->insertItem(_("text 80x34 (5)"));
+ vga->insertItem(_("text 80x60 (6)"));
+ vga->insertItem(_("text 40x25 (7)"));
+ vga->insertItem(_("VGA 640x480, 256 colors (769)"));
+ vga->insertItem(_("VGA 640x480, 32767 colors (784)"));
+ vga->insertItem(_("VGA 640x480, 65536 colors (785)"));
+ vga->insertItem(_("VGA 640x480, 16.7M colors (786)"));
+ vga->insertItem(_("VGA 800x600, 256 colors (771)"));
+ vga->insertItem(_("VGA 800x600, 32767 colors (787)"));
+ vga->insertItem(_("VGA 800x600, 65536 colors (788)"));
+ vga->insertItem(_("VGA 800x600, 16.7M colors (789)"));
+ vga->insertItem(_("VGA 1024x768, 256 colors (773)"));
+ vga->insertItem(_("VGA 1024x768, 32767 colors (790)"));
+ vga->insertItem(_("VGA 1024x768, 65536 colors (791)"));
+ vga->insertItem(_("VGA 1024x768, 16.7M colors (792)"));
+ vga->insertItem(_("VGA 1280x1024, 256 colors (775)"));
+ vga->insertItem(_("VGA 1280x1024, 32767 colors (793)"));
+ vga->insertItem(_("VGA 1280x1024, 65536 colors (794)"));
+ vga->insertItem(_("VGA 1280x1024, 16.7M colors (795)"));
+ connect( vga, SIGNAL(activated ( int )), SIGNAL(configChanged()));
+ layout->addWidget(vgab);
+
+ prompt=new QCheckBox(_("Enter LILO &prompt automatically"), this);
+ QWhatsThis::add(prompt, _("If this box is checked, LILO goes to the LILO prompt whether or not a key is pressed. If it is turned off, LILO boots the default operating system unless shift is pressed (in that case, it goes to the LILO prompt).<br>This sets the <i>prompt</i> option in lilo.conf."));
+ connect(prompt, SIGNAL(clicked()), SIGNAL(configChanged()));
+
+ layout->addWidget(prompt);
+
+ update();
+}
+void General::saveChanges()
+{
+ QString to;
+ to.sprintf("%u", timeout->value());
+ QString boot = drive->currentText();
+ lilo->defaults.set("boot", boot.isEmpty() ? "" : boot.latin1());
+ lilo->defaults.set("timeout", to.latin1());
+ if(compact->isChecked() && lilo->defaults.grep("^[ \t]*compact[ \t]*$").empty())
+ lilo->defaults += "compact";
+ else if(!compact->isChecked() && !lilo->defaults.grep("^[ \t]*compact[ \t]*$").empty())
+ lilo->defaults.remove(lilo->defaults.grep("^[ \t]*compact[ \t]*$"));
+ if(linear->isChecked() && lilo->defaults.grep("^[ \t]*linear[ \t]*$").empty())
+ lilo->defaults += "linear";
+ else if(!linear->isChecked() && !lilo->defaults.grep("^[ \t]*linear[ \t]*$").empty())
+ lilo->defaults.remove(lilo->defaults.grep("^[ \t]*linear[ \t]*$"));
+ if(lock->isChecked() && lilo->defaults.grep("^[ \t]*lock[ \t]*$").empty())
+ lilo->defaults += "lock";
+ else if(!lock->isChecked() && !lilo->defaults.grep("^[ \t]*lock[ \t]*$").empty())
+ lilo->defaults.remove(lilo->defaults.grep("^[ \t]*lock[ \t]*$"));
+ if(restricted->isChecked() && lilo->defaults.grep("^[ \t]*restricted[ \t]*$").empty())
+ lilo->defaults += "restricted";
+ else if(!restricted->isChecked() && !lilo->defaults.grep("^[ \t]*restricted[ \t]*$").empty())
+ lilo->defaults.remove(lilo->defaults.grep("^[ \t]*restricted[ \t]*$"));
+ if(restricted->isChecked() || use_password->isChecked())
+ lilo->defaults.set("password", password->text().latin1());
+ else
+ lilo->defaults.remove(lilo->defaults.grep("^[ \t]*password[ \t]*=.*"));
+ if(vga->currentText()=="default") {
+ if(!lilo->defaults.grep("[ \t]*vga[ \t]*=").empty())
+ lilo->defaults.remove(lilo->defaults.grep("[ \t]*vga[ \t]*="));
+ } else {
+ QString mode=vga->currentText();
+ if(mode!="ask") {
+ mode=mode.mid(mode.find('(')+1);
+ mode=mode.left(mode.length()-1);
+ }
+ lilo->defaults.set("vga", mode.latin1());
+ }
+ if(prompt->isChecked() && lilo->defaults.grep("^[ \t]*prompt[ \t]*$").empty())
+ lilo->defaults += "prompt";
+ else if(!prompt->isChecked() && !lilo->defaults.grep("^[ \t]*prompt[ \t]*$").empty())
+ lilo->defaults.remove(lilo->defaults.grep("^[ \t]*prompt[ \t]*$"));
+}
+void General::update()
+{
+ QString boot=lilo->defaults.get("boot").cstr();
+ for(int i=0; i<drive->count(); i++)
+ if(drive->text(i)==boot)
+ drive->setCurrentItem(i);
+ timeout->setValue(atoi(lilo->defaults.get("timeout")));
+ compact->setChecked(!lilo->defaults.grep("^[ \t]*compact[ \t]*$").empty());
+ linear->setChecked(!lilo->defaults.grep("^[ \t]*linear[ \t]*$").empty());
+ lock->setChecked(!lilo->defaults.grep("^[ \t]*lock[ \t]*$").empty());
+ restricted->setChecked(!lilo->defaults.grep("^[ \t]*restricted[ \t]*$").empty());
+ String pw=lilo->defaults.grep("^[ \t]*password[ \t]*=.*");
+ use_password->setChecked(!pw.empty());
+ if(!pw.empty())
+ password->setText(lilo->defaults.get("password").cstr());
+ check_pw();
+ QString mode=lilo->defaults.get("vga", "").cstr();
+ if(mode.isEmpty())
+ vga->setCurrentItem(0);
+ else if(mode=="ask")
+ vga->setCurrentItem(1);
+ else
+ for(int i=0; i<vga->count(); i++) {
+ if(vga->text(i).contains("(" + mode + ")")) {
+ vga->setCurrentItem(i);
+ break;
+ }
+ }
+ prompt->setChecked(!lilo->defaults.grep("^[ \t]*prompt[ \t]*$").empty());
+}
+void General::check_pw()
+{
+ password->setEnabled(restricted->isChecked() || use_password->isChecked());
+}
+
+void General::makeReadOnly()
+{
+ drive->setEnabled( false );
+ timeout->setEnabled( false );
+ linear->setEnabled( false );
+ compact->setEnabled( false );
+ lock->setEnabled( false );
+ restricted->setEnabled( false );
+ use_password->setEnabled( false );
+ password->setEnabled( false );
+ vga->setEnabled( false );
+ prompt->setEnabled( false );
+
+}
diff --git a/lilo-config/kde-qt-common/general.h b/lilo-config/kde-qt-common/general.h
new file mode 100644
index 0000000..7e88a90
--- /dev/null
+++ b/lilo-config/kde-qt-common/general.h
@@ -0,0 +1,62 @@
+/* general.h
+**
+** 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
+*/
+#ifndef _GENERAL_H_
+#define _GENERAL_H_ 1
+#include <lilo.h>
+#include <qwidget.h>
+#include <qcombobox.h>
+#include <qspinbox.h>
+#include <qcheckbox.h>
+class General:public QWidget
+{
+ Q_OBJECT
+public:
+ General(liloconf *l=0, QWidget *parent=0, const char *name=0);
+ void makeReadOnly();
+signals:
+ void configChanged();
+public slots:
+ void saveChanges();
+ void update();
+private slots:
+ void check_pw();
+private:
+ liloconf *lilo;
+ QComboBox *drive;
+ QSpinBox *timeout;
+ QCheckBox *linear;
+ QCheckBox *compact;
+ QCheckBox *lock;
+ QCheckBox *restricted;
+ QCheckBox *use_password;
+ QLineEdit *password;
+ QComboBox *vga;
+ QCheckBox *prompt;
+};
+#endif
diff --git a/lilo-config/kde-qt-common/images.cpp b/lilo-config/kde-qt-common/images.cpp
new file mode 100644
index 0000000..98dd1cb
--- /dev/null
+++ b/lilo-config/kde-qt-common/images.cpp
@@ -0,0 +1,334 @@
+/* images.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 "images.moc"
+#include <ui.h>
+#include <qwhatsthis.h>
+#include <qregexp.h>
+#include <qstring.h>
+
+#ifdef USE_KDE
+#include "kde/InputBox.h"
+#include "kde/Details.h"
+#else
+#include "qt/InputBox.h"
+#include "qt/Details.h"
+#endif
+
+Images::Images(liloconf *l, QWidget *parent, const char *name):QWidget(parent, name)
+{
+ current=""; previous=""; // Using QString::null gives problems!
+ lilo=l;
+ layout=new QHBoxLayout(this);
+ layout->setMargin(SPACE_MARGIN);
+ layout->setSpacing(SPACE_INSIDE);
+ images=new QListBox(this);
+ layout->addWidget(images, 1);
+ connect(images, SIGNAL(highlighted(const QString &)), SLOT(imageSelected(const QString &)));
+ QWhatsThis::add(images, _("This is the list of kernels and operating systems you can currently boot. Select which one you want to edit here."));
+
+ parameters=new QVBox(this);
+ parameters->setMargin(SPACE_MARGIN);
+ parameters->setSpacing(SPACE_INSIDE);
+ layout->addWidget(parameters, 2);
+ image=new EditWidget(_("&Kernel:"), "", true, parameters);
+ QWhatsThis::add(image, _("Enter the filename of the kernel you want to boot here."));
+ connect(image, SIGNAL(textChanged(const QString &)), this, SIGNAL(configChanged()));
+ label=new EditWidget(_("&Label:"), "", false, parameters);
+ QWhatsThis::add(label, _("Enter the label (name) of the kernel you want to boot here."));
+ connect(label, SIGNAL(textChanged(const QString &)), this, SIGNAL(configChanged()));
+ root=new EditWidget(_("&Root filesystem:"), "", true, parameters);
+ QWhatsThis::add(root, _("Enter the root filesystem (i.e. the partition that will be mounted as / at boot time) for the kernel you want to boot here."));
+ connect(root, SIGNAL(textChanged(const QString &)), this, SIGNAL(configChanged()));
+ initrd=new EditWidget(_("&Initial ramdisk:"), "", true, parameters);
+ QWhatsThis::add(initrd, _("If you want to use an initial ramdisk (initrd) for this kernel, enter its filename here. Leave this field blank if you don't intend to use an initial ramdisk for this kernel."));
+ connect(initrd, SIGNAL(textChanged(const QString &)), this, SIGNAL(configChanged()));
+ append=new EditWidget(_("E&xtra parameters:"), "", false, parameters);
+ QWhatsThis::add(append, _("Enter any extra parameters you wish to pass to the kernel here. Usually, this can be left blank.<br>This sets the <i>append</i> option in lilo.conf."));
+ connect(append, SIGNAL(textChanged(const QString &)), this, SIGNAL(configChanged()));
+
+ actions=new QVBox(this);
+ actions->setMargin(SPACE_MARGIN);
+ actions->setSpacing(SPACE_INSIDE);
+ layout->addWidget(actions);
+ dflt=new QPushButton(_("Set &Default"), actions);
+ QWhatsThis::add(dflt, _("Boot this kernel/OS if the user doesn't make a different choice"));
+ connect(dflt, SIGNAL(clicked()), SLOT(dfltClicked()));
+ details=new QPushButton(_("De&tails"), actions);
+ QWhatsThis::add(details, _("This button brings up a dialog box with further, less commonly used, options."));
+ connect(details, SIGNAL(clicked()), SLOT(detailsClicked()));
+ probe=new QPushButton(_("&Probe"), actions);
+ connect(probe, SIGNAL(clicked()), SLOT(probeClicked()));
+ QWhatsThis::add(probe, _("Automatically generate a (hopefully) reasonable lilo.conf for your system"));
+ check=new QPushButton(_("&Check Configuration"), actions);
+ connect(check, SIGNAL(clicked()), SLOT(checkClicked()));
+ QWhatsThis::add(check, _("Run LILO in test mode to see if the configuration is ok"));
+ addKrnl=new QPushButton(_("Add &Kernel..."), actions);
+ connect(addKrnl, SIGNAL(clicked()), SLOT(addKrnlClicked()));
+ QWhatsThis::add(addKrnl, _("Add a new Linux kernel to the boot menu"));
+ addOS=new QPushButton(_("Add Other &OS..."), actions);
+ connect(addOS, SIGNAL(clicked()), SLOT(addOSClicked()));
+ QWhatsThis::add(addOS, _("Add a non-Linux OS to the boot menu"));
+ remove=new QPushButton(_("&Remove Entry"), actions);
+ connect(remove, SIGNAL(clicked()), SLOT(removeClicked()));
+ QWhatsThis::add(remove, _("Remove entry from the boot menu"));
+ update();
+}
+Images::~Images()
+{
+ delete probe;
+}
+void Images::update() // SLOT
+{
+ int selection=images->currentItem();
+ if(selection==-1) selection=0;
+ String dflt=lilo->dflt();
+ String entry;
+ StringList imgs=lilo->entries();
+ images->clear();
+ for(StringList::const_iterator it=imgs.begin(); it!=imgs.end(); it++) {
+ if(*it==dflt)
+ entry=*it + " (default)";
+ else
+ entry=*it;
+ images->insertItem(entry.cstr());
+ }
+ if((unsigned int)selection>images->count()) selection=images->count();
+ images->setSelected(selection, true);
+ imageSelected(images->text(selection));
+}
+void Images::probeClicked() // SLOT
+{
+ lilo->probe();
+ update();
+ emit configChanged();
+}
+void Images::dfltClicked() // SLOT
+{
+ if (images->currentItem() < 0) return;
+ lilo->setDefault(images->currentText().replace(QRegExp(" (default)", true, true), "").latin1());
+ update();
+ emit configChanged();
+}
+void Images::detailsClicked() // SLOT
+{
+ liloimage *l=lilo->images[current.latin1()];
+ Details *d = new Details(l, this);
+ if(d->exec()==QDialog::Accepted) {
+ String tmp;
+ tmp=l->grep("^[ \t]*read-only[ \t]*");
+ if(d->isReadOnly() && tmp.empty())
+ l->insert(l->end(), "\tread-only");
+ else if(!d->isReadOnly() && !tmp.empty())
+ l->remove(tmp);
+ l->set("vga", d->vgaMode().latin1(), true, true, "\t");
+ tmp=l->grep("^[ \t]*unsafe[ \t]*");
+ if(d->isUnsafe() && tmp.empty())
+ l->insert(l->end(), "\tunsafe");
+ else if(!d->isUnsafe() && !tmp.empty())
+ l->remove(tmp);
+ tmp=l->grep("^[ \t]*lock[ \t]*");
+ if(d->isLocked() && tmp.empty())
+ l->insert(l->end(), "\tlock");
+ else if(!d->isLocked() && !tmp.empty())
+ l->remove(tmp);
+ tmp=l->grep("^[ \t]*restricted[ \t]*");
+ if(d->isRestricted() && tmp.empty())
+ l->insert(l->end(), "\trestricted");
+ else if(!d->isRestricted() && !tmp.empty())
+ l->remove(tmp);
+ if(d->isRestricted() || d->usePassword())
+ l->set("password", d->Password().latin1(), true, true, "\t");
+
+ l->set("password", d->Password().latin1(), true, true, "\t");
+ emit configChanged();
+ }
+ delete d;
+}
+void Images::checkClicked() // SLOT
+{
+ QString LiloOut=lilo->liloOut().cstr();
+ if(lilo->isOk()) {
+ LiloOut=_("Configuration ok. LILO said:\n")+LiloOut;
+ InformationOK(this, LiloOut, _("Configuration OK"), "lilo-config.confOK");
+ } else {
+ LiloOut=_("Configuration NOT ok. LILO said:\n")+LiloOut;
+ ErrorOK(this, _("Configuration NOT ok"), LiloOut);
+ }
+}
+void Images::addKrnlClicked() // SLOT
+{
+ InputBox::entries e;
+ InputBox::entry l0={ _("&Kernel filename:"), "", true, _("Enter the filename of the kernel you want to boot here.") };
+ InputBox::entry l1={ _("&Label:"), "", false, _("Enter the label (name) of the kernel you want to boot here.") };
+ InputBox::entry l2={ _("&Root filesystem:"), "", true, _("Enter the root filesystem (i.e. the partition that will be mounted as / at boot time) for the kernel you want to boot here.") };
+ InputBox::entry l3={ _("&Initial ramdisk:"), "", true, _("If you want to use an initial ramdisk (initrd) for this kernel, enter its filename here. Leave this field blank if you don't intend to use an initial ramdisk for this kernel.") };
+ e.insert(e.end(), l0);
+ e.insert(e.end(), l1);
+ e.insert(e.end(), l2);
+ e.insert(e.end(), l3);
+ InputBox *label=new InputBox(e, this);
+ if(label->exec()==QDialog::Accepted) {
+ QStringList s=label->text();
+ QStringList::Iterator it=s.begin();
+ String kernel=(*it).latin1();
+ it++;
+ String label=(*it).latin1();
+ it++;
+ String root=(*it).latin1();
+ it++;
+ String initrd=(*it).latin1();
+ lilo->addLinux(label, kernel, root, initrd);
+ update();
+ emit configChanged();
+ }
+ delete label;
+}
+void Images::addOSClicked() // SLOT
+{
+ InputBox::entries e;
+ InputBox::entry l0={_("Boot from dis&k:"), "", true, _("Enter the partition containing the operating system you'd like to boot here.") };
+ InputBox::entry l1={_("&Label:"), "", false, _("Enter the label (name) of the operating system here.") };
+ e.insert(e.end(), l0);
+ e.insert(e.end(), l1);
+ InputBox *label=new InputBox(e, this);
+ if(label->exec()==QDialog::Accepted) {
+ QStringList s=label->text();
+ QStringList::Iterator it=s.begin();
+ String disk=(*it).latin1();
+ it++;
+ String label=(*it).latin1();
+ lilo->addOther(label, disk);
+ update();
+ emit configChanged();
+ }
+ delete label;
+}
+void Images::removeClicked() // SLOT
+{
+ if(images->currentItem()==-1)
+ return;
+ QString s=images->currentText();
+ if(s.right(10)==" (default)")
+ s=s.left(s.length()-10);
+ if (s.isNull())
+ s = "";
+ lilo->images.remove(s.latin1());
+ previous=""; current="";
+ update();
+ emit configChanged();
+}
+
+QString value(QString const &s)
+{
+ QString r=s.mid(s.find('=')+1).simplifyWhiteSpace();
+ if(r.left(1)=="\"")
+ r=r.mid(1);
+ if(r.right(1)=="\"")
+ r=r.left(r.length()-1);
+ if (r.isNull())
+ r = "";
+ return r;
+}
+
+void Images::imageSelected(const QString &i) // SLOT
+{
+ bool blocked = signalsBlocked();
+ blockSignals(true);
+ QString s=i;
+ if(s.right(10)==" (default)")
+ s=s.left(s.length()-10);
+ if(previous!=s && !previous.isEmpty()) {
+ previous=s;
+ saveChanges();
+ } else if(previous.isEmpty())
+ previous=s;
+
+ if (s.isNull())
+ s = "";
+ current=s;
+ liloimage *l=lilo->images[s.latin1()];
+ if(l) {
+ QString img=value(l->grep("^[ \t]*(image|other)[ \t]*=").cstr());
+ image->setText(img);
+ label->setText(s);
+ if(l->isLinux()) {
+ image->setLabel(_("&Kernel:"));
+ String rt=l->grep("^[ \t]*root[ \t]*=");
+ if(!rt.empty())
+ root->setText(value(rt.cstr()));
+ else
+ root->setText("");
+ String rd=l->grep("^[ \t]*initrd[ \t]*=");
+ if(!rd.empty())
+ initrd->setText(value(rd.cstr()));
+ else
+ initrd->setText("");
+ append->setText(l->get("append").cstr());
+ root->show();
+ initrd->show();
+ append->show();
+ } else {
+ image->setLabel(_("Dis&k:"));
+ root->hide();
+ initrd->hide();
+ append->hide();
+ }
+ }
+ blockSignals(blocked);
+}
+void Images::saveChanges() // SLOT
+{
+ if(!current.isEmpty()) {
+ liloimage *l=lilo->images[current.latin1()];
+ if(l) {
+ l->set("image", image->text().latin1(), true, true);
+ l->set("label", label->text().latin1(), true, true, "\t");
+ l->set("root", root->text().latin1(), true, true, "\t");
+ l->set("initrd", initrd->text().latin1(), true, true, "\t");
+ l->set("append", append->text().latin1(), true, true, "\t");
+ }
+ }
+}
+
+void Images::makeReadOnly()
+{
+ images->setEnabled( false );
+ image->setEnabled( false );
+ label->setEnabled( false );
+ root->setEnabled( false );
+ initrd->setEnabled( false );
+ append->setEnabled( false );
+ dflt->setEnabled( false );
+ details->setEnabled( false );
+ probe->setEnabled( false );
+ check->setEnabled( false );
+ addKrnl->setEnabled( false );
+ addOS->setEnabled( false );
+ remove->setEnabled( false );
+}
diff --git a/lilo-config/kde-qt-common/images.h b/lilo-config/kde-qt-common/images.h
new file mode 100644
index 0000000..62c6124
--- /dev/null
+++ b/lilo-config/kde-qt-common/images.h
@@ -0,0 +1,82 @@
+/* images.h
+**
+** 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
+*/
+#ifndef _IMAGES_H_
+#define _IMAGES_H_ 1
+#include <lilo.h>
+#include <qwidget.h>
+#include <qmultilineedit.h>
+#include <qlayout.h>
+#include <qpushbutton.h>
+#include <qlistbox.h>
+#include <qvbox.h>
+#include "EditWidget.h"
+class Images:public QWidget
+{
+ Q_OBJECT
+public:
+ Images(liloconf *l=0, QWidget *parent=0, const char *name=0);
+ ~Images();
+ void setCfg(liloconf *l) { lilo=l; };
+ void makeReadOnly();
+public slots:
+ void update();
+ void saveChanges();
+private slots:
+ void probeClicked();
+ void dfltClicked();
+ void detailsClicked();
+ void checkClicked();
+ void addKrnlClicked();
+ void addOSClicked();
+ void removeClicked();
+ void imageSelected(const QString &i);
+signals:
+ void configChanged();
+private:
+ liloconf *lilo;
+ QString previous;
+ QString current;
+ QHBoxLayout *layout;
+ QListBox *images;
+ QVBox *parameters;
+ EditWidget *image;
+ EditWidget *label;
+ EditWidget *root;
+ EditWidget *initrd;
+ EditWidget *append;
+ QVBox *actions;
+ QPushButton *dflt;
+ QPushButton *details;
+ QPushButton *probe;
+ QPushButton *check;
+ QPushButton *addKrnl;
+ QPushButton *addOS;
+ QPushButton *remove;
+};
+#endif
diff --git a/lilo-config/kde-qt-common/mainwidget.cpp b/lilo-config/kde-qt-common/mainwidget.cpp
new file mode 100644
index 0000000..6d76dc5
--- /dev/null
+++ b/lilo-config/kde-qt-common/mainwidget.cpp
@@ -0,0 +1,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(QWidget *parent, const char *name)
+ : QTabWidget(parent, name)
+{
+ l=new liloconf();
+ general=new General(l, this);
+ connect(general, SIGNAL(configChanged()), SIGNAL(configChanged()));
+ images=new Images(l, this);
+ connect(images, SIGNAL(configChanged()), SIGNAL(configChanged()));
+ expert=new Expert(l, this);
+ connect(expert, SIGNAL(configChanged()), SIGNAL(configChanged()));
+ connect(expert, SIGNAL(configChanged()), images, SLOT(update()));
+ addTab(general, _("&General Options"));
+ addTab(images, _("&Operating Systems"));
+ addTab(expert, _("&Expert"));
+ connect(this, SIGNAL(selected(const QString &)), SLOT(tabChanged(const QString &)));
+ 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(QString 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;
+}
diff --git a/lilo-config/kde-qt-common/mainwidget.h b/lilo-config/kde-qt-common/mainwidget.h
new file mode 100644
index 0000000..46696e8
--- /dev/null
+++ b/lilo-config/kde-qt-common/mainwidget.h
@@ -0,0 +1,60 @@
+/* mainwidget.h
+**
+** 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
+*/
+#ifndef _MAINWIDGET_H_
+#define _MAINWIDGET_H_ 1
+#include <qwidget.h>
+#include <qlistbox.h>
+#include <qtabwidget.h>
+#include <qevent.h>
+#include "general.h"
+#include "images.h"
+#include "expert.h"
+
+class MainWidget: public QTabWidget {
+ Q_OBJECT
+public:
+ MainWidget(QWidget *parent, const char *name=0);
+ void arrangeWidgets();
+ void makeReadOnly();
+public slots:
+ void load();
+ void save();
+ void reset();
+ void defaults();
+ void tabChanged(const QString &lbl);
+signals:
+ void configChanged();
+private:
+ QString previous;
+ General *general;
+ Images *images;
+ Expert *expert;
+ liloconf *l;
+};
+#endif
diff --git a/lilo-config/kde-qt-common/ui.h b/lilo-config/kde-qt-common/ui.h
new file mode 100644
index 0000000..e672847
--- /dev/null
+++ b/lilo-config/kde-qt-common/ui.h
@@ -0,0 +1,77 @@
+/* ui.h
+**
+** 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
+*/
+/* UI definitions... Coding these things twice (with and without KDE)
+ * wouldn't make sense... */
+
+#ifndef _UI_H
+#define _UI_H
+
+#ifdef USE_KDE
+#include <kmessagebox.h>
+#include <klocale.h>
+#include <ktabctl.h>
+#include <kdialog.h>
+#include <kfiledialog.h>
+#define _(x) i18n(x)
+#define WarningYesNo(parent, caption, text) \
+ KMessageBox::warningYesNo(parent, text, caption)
+#define ErrorOK(parent, caption, text) \
+ KMessageBox::sorry(parent, text, caption)
+#define InformationOK(parent, text, caption, dontShowAgainName) \
+ KMessageBox::information(parent, text, caption, dontShowAgainName)
+#define CriticalErrorOK(parent, text, caption) \
+ KMessageBox::error(parent, text, caption)
+#define TabBar KTabCtl
+#define FileDlg KFileDialog
+#define SPACE_MARGIN KDialog::marginHint()
+#define SPACE_INSIDE KDialog::spacingHint()
+#else
+#include <qmessagebox.h>
+#include <qtabwidget.h>
+#include <qdialog.h>
+#include <qfiledialog.h>
+#define _(x) tr(x)
+#define WarningYesNo(parent, caption, text) \
+ QMessageBox::warning(parent, caption, text, QMessageBox::Yes, QMessageBox::No)
+#define ErrorOK(parent, caption, text) \
+ QMessageBox::information(parent, caption, text)
+#define InformationOK(parent, text, caption, dontShowAgainName) \
+ QMessageBox::information(parent, caption, text)
+#define CriticalErrorOK(parent, text, caption) \
+ QMessageBox::critical(parent, caption, text)
+#define TabBar QTabWidget
+#define FileDlg QFileDialog
+#define SPACE_MARGIN 5
+#define SPACE_INSIDE 5
+#endif
+#define IDYES 3
+#define IDNO 4
+
+#endif
+