From 37333bf25ad9a4c538250f5af2f9f1d666362883 Mon Sep 17 00:00:00 2001 From: toma Date: Wed, 25 Nov 2009 17:56:58 +0000 Subject: 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 --- lilo-config/qt/Details.cpp | 144 +++++++++++++++++++++++++++++++++++++++++ lilo-config/qt/Details.h | 61 +++++++++++++++++ lilo-config/qt/InputBox.cpp | 56 ++++++++++++++++ lilo-config/qt/InputBox.h | 49 ++++++++++++++ lilo-config/qt/Makefile.am | 21 ++++++ lilo-config/qt/configure.in.in | 4 ++ lilo-config/qt/standalone.cpp | 126 ++++++++++++++++++++++++++++++++++++ lilo-config/qt/standalone.h | 64 ++++++++++++++++++ 8 files changed, 525 insertions(+) create mode 100644 lilo-config/qt/Details.cpp create mode 100644 lilo-config/qt/Details.h create mode 100644 lilo-config/qt/InputBox.cpp create mode 100644 lilo-config/qt/InputBox.h create mode 100644 lilo-config/qt/Makefile.am create mode 100644 lilo-config/qt/configure.in.in create mode 100644 lilo-config/qt/standalone.cpp create mode 100644 lilo-config/qt/standalone.h (limited to 'lilo-config/qt') diff --git a/lilo-config/qt/Details.cpp b/lilo-config/qt/Details.cpp new file mode 100644 index 0000000..eae3ed5 --- /dev/null +++ b/lilo-config/qt/Details.cpp @@ -0,0 +1,144 @@ +/* Details.cpp +** +** Copyright (C) 2000,2001 by Bernhard Rosenkraenzer +** +*/ + +/* +** 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 "Details.moc" +#include +#include +#include +#include +#include + +Details::Details(liloimage *lilo, QWidget *parent, const char *name, WFlags f):QDialog(parent, name, true, f) +{ + l=lilo; + + QVBoxLayout *layout=new QVBoxLayout(this); + layout->setMargin(SPACE_MARGIN); + layout->setSpacing(SPACE_INSIDE); + + QHBox *vgab=new QHBox(this); + QLabel *vlbl=new QLabel(_("&Graphics mode on text console:"), vgab); + vga=new QComboBox(false, vgab); + vlbl->setBuddy(vga); + QWhatsThis::add(vgab, _("You can select the graphics mode for this kernel here.
If you intend to use a VGA graphics mode, you must compile the kernel with support for framebuffer devices. The ask setting brings up a prompt at boot time.")); + 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)")); + layout->addWidget(vgab); + + readonly=new QCheckBox(_("Mount root filesystem &read-only"), this); + QWhatsThis::add(readonly, _("Mount the root filesystem for this kernel read-only. Since the init scripts normally take care of remounting the root filesystem in read-write mode after running some checks, this should always be turned on.
Don't turn this off unless you know what you're doing.")); + layout->addWidget(readonly); + + unsafe=new QCheckBox(_("Do not check &partition table"), this); + QWhatsThis::add(unsafe, _("This turns off some sanity checks while writing the configuration. This shouldn't be used under \"normal\" circumstances, but it's useful, for example, for installing the possibility to boot from a floppy disk without having a floppy in the drive every time you run lilo.
This sets the unsafe keyword in lilo.conf.")); + layout->addWidget(unsafe); + + QHBox *opts=new QHBox(this); + lock=new QCheckBox(_("&Record boot command lines for defaults"), opts); + QWhatsThis::add(lock, ""+_("Checking this box enables automatic recording of boot command lines as the default for the following bootups. This way, lilo \"locks\" on a choice until it is manually overridden.
This sets the lock option in lilo.conf")); + restricted=new QCheckBox(_("R&estrict parameters"), opts); + 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 linux, but not linux single or linux init=/bin/sh).\nThis sets the restricted option in lilo.conf.")); + layout->addWidget(opts); + + QHBox *pw=new QHBox(this); + use_password=new QCheckBox(_("Require &password:"), pw); + connect(use_password, SIGNAL(clicked()), SLOT(check_pw())); + password=new QLineEdit(pw); + password->setMaxLength(15); + password->setEchoMode(QLineEdit::Password); + QWhatsThis::add(pw, _("Enter the password required for bootup (if any) here. If restricted above is checked, the password is required for additional parameters only.
WARNING: 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.")); + layout->addWidget(pw); + + QHBox *btns=new QHBox(this); + ok=new QPushButton(_("&OK"), btns); + cancel=new QPushButton(_("&Cancel"), btns); + layout->addWidget(btns); + connect(cancel, SIGNAL(clicked()), SLOT(reject())); + connect(ok, SIGNAL(clicked()), SLOT(accept())); + + if(l) { + QString mode=l->get("vga", "").cstr(); + if(mode.isEmpty()) + vga->setCurrentItem(0); + else if(mode=="ask") + vga->setCurrentItem(1); + else + for(int i=0; icount(); i++) { + if(vga->text(i).contains("(" + mode + ")")) { + vga->setCurrentItem(i); + break; + } + } + readonly->setChecked(!l->grep("[ \t]*read-only[ \t]*").empty()); + unsafe->setChecked(!l->grep("[ \t]*unsafe[ \t]*").empty()); + lock->setChecked(!l->grep("[ \t]*lock[ \t]*").empty()); + restricted->setChecked(!l->grep("[ \t]*restricted[ \t]*").empty()); + password->setText(l->get("password").cstr()); + } + + check_pw(); +} +void Details::check_pw() +{ + password->setEnabled(restricted->isChecked() || use_password->isChecked()); +} +QString Details::vgaMode() const +{ + QString s=vga->currentText(); + if(s=="default") + return ""; + else if(s!="ask") { + s=s.mid(s.find('(')+1); + s=s.left(s.length()-1); + } + return s; +} diff --git a/lilo-config/qt/Details.h b/lilo-config/qt/Details.h new file mode 100644 index 0000000..f189430 --- /dev/null +++ b/lilo-config/qt/Details.h @@ -0,0 +1,61 @@ +/* Details.h +** +** Copyright (C) 2000,2001 by Bernhard Rosenkraenzer +** +*/ + +/* +** 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 _DETAILS_H_ +#define _DETAILS_H_ 1 +#include +#include +#include +#include +#include +#include +class Details:public QDialog +{ + Q_OBJECT +public: + Details(liloimage *lilo, QWidget *parent=0, const char *name=0, WFlags f=0); + bool isReadOnly() const { return readonly->isChecked(); }; + QString vgaMode() const; + bool isUnsafe() const { return unsafe->isChecked(); }; + bool isLocked() const { return lock->isChecked(); }; + bool isRestricted() const { return restricted->isChecked(); }; + bool usePassword() const { return use_password->isChecked(); }; + QString Password() const { return password->text(); }; +private slots: + void check_pw(); +private: + liloimage *l; + QCheckBox *readonly; + QComboBox *vga; + QCheckBox *unsafe; + QCheckBox *lock; + QCheckBox *restricted; + QCheckBox *use_password; + QLineEdit *password; + QPushButton *ok; + QPushButton *cancel; +}; +#endif diff --git a/lilo-config/qt/InputBox.cpp b/lilo-config/qt/InputBox.cpp new file mode 100644 index 0000000..f95989b --- /dev/null +++ b/lilo-config/qt/InputBox.cpp @@ -0,0 +1,56 @@ +/* InputBox.cpp +** +** Copyright (C) 2000,2001 by Bernhard Rosenkraenzer +** +*/ + +/* +** 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 "InputBox.moc" +#include +#include +#include +#include + +InputBox::InputBox(entries e, QWidget *parent, const char *name, bool hasCancel, WFlags f):QDialog(parent, name, true, f) +{ + QVBoxLayout *layout=new QVBoxLayout(this); + layout->setMargin(SPACE_MARGIN); + layout->setSpacing(SPACE_INSIDE); + for(entries::iterator it=e.begin(); it!=e.end(); it++) { + EditWidget *ed=new EditWidget((*it).label, (*it).dflt, (*it).isFile, this); + QWhatsThis::add(ed, (*it).help); + layout->addWidget(ed); + edit.insert(edit.end(), ed); + } + if(hasCancel) { + QHBox *btns=new QHBox(this); + ok=new QPushButton(_("&OK"), btns); + cancel=new QPushButton(_("&Cancel"), btns); + layout->addWidget(btns); + connect(cancel, SIGNAL(clicked()), SLOT(reject())); + } else { + ok=new QPushButton(_("&OK"), this); + layout->addWidget(ok); + } + connect(ok, SIGNAL(clicked()), SLOT(accept())); +} diff --git a/lilo-config/qt/InputBox.h b/lilo-config/qt/InputBox.h new file mode 100644 index 0000000..da2371b --- /dev/null +++ b/lilo-config/qt/InputBox.h @@ -0,0 +1,49 @@ +/* InputBox.h +** +** Copyright (C) 2000,2001 by Bernhard Rosenkraenzer +** +*/ + +/* +** 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 _INPUTBOX_H_ +#define _INPUTBOX_H_ 1 +#include +#include +#include +#include +#include "EditWidget.h" +#include +class InputBox:public QDialog +{ + Q_OBJECT +public: + typedef struct { QString label; QString dflt; bool isFile; QString help; } entry; + typedef std::list entries; + InputBox(entries e, QWidget *parent=0, const char *name=0, bool hasCancel=true, WFlags f=0); + QStringList const text() const { QStringList s; for(std::list::const_iterator it=edit.begin(); it!=edit.end(); it++) s << (*it)->text(); return s; }; +private: + std::list edit; + QPushButton *ok; + QPushButton *cancel; +}; +#endif diff --git a/lilo-config/qt/Makefile.am b/lilo-config/qt/Makefile.am new file mode 100644 index 0000000..fa0fd6c --- /dev/null +++ b/lilo-config/qt/Makefile.am @@ -0,0 +1,21 @@ +libwidgets.a: ../kde-qt-common/*.cpp ../kde-qt-common/*.h + rm -f ../kde-qt-common/.COMPILED_KDE + if ! test -e ../kde-qt-common/.COMPILED_QT; then \ + perl -pi -e "s,^AM_CXXFLAGS.*,AM_CXXFLAGS = -UUSE_KDE," ../kde-qt-common/Makefile.am; \ + perl -pi -e "s,libwidgets_la_LIBADD.*,libwidgets_la_LIBADD = -lqt ../common/libcommon.la," ../kde-qt-common/Makefile.am; \ + make -C ../kde-qt-common clean; fi + make -C ../kde-qt-common + install -c -m755 ../kde-qt-common/.libs/libwidgets.a . + touch ../kde-qt-common/.COMPILED_QT + +INCLUDES= -I../common -I../kde-qt-common $(all_includes) + +bin_PROGRAMS = lilo-config + +lilo_config_SOURCES = standalone.cpp Details.cpp InputBox.cpp +lilo_config_LDFLAGS = $(all_libraries) +lilo_config_LDADD = $(LIB_QT) libwidgets.a +lilo_config_METASOURCES = AUTO +AM_CXXFLAGS = -UUSE_KDE + +KDE_OPTIONS = qtonly diff --git a/lilo-config/qt/configure.in.in b/lilo-config/qt/configure.in.in new file mode 100644 index 0000000..db37557 --- /dev/null +++ b/lilo-config/qt/configure.in.in @@ -0,0 +1,4 @@ +# There's no point in compiling the Qt-only frontend inside a KDE package... +# Leaving it out, but there's not much of a point in removing the code (it still +# has its uses), and it's quite short, so... +DO_NOT_COMPILE="$DO_NOT_COMPILE qt" diff --git a/lilo-config/qt/standalone.cpp b/lilo-config/qt/standalone.cpp new file mode 100644 index 0000000..268ad21 --- /dev/null +++ b/lilo-config/qt/standalone.cpp @@ -0,0 +1,126 @@ +/* standalone.cpp +** +** Copyright (C) 2000,2001 by Bernhard Rosenkraenzer +** +*/ + +/* +** 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 +#include +#include +#include +#include +#include +#include "standalone.moc" + +Standalone::Standalone(QWidget *parent, const char *name):QWidget(parent,name) +{ + m=new MainWidget(this); + connect(m, SIGNAL(configChanged()), SLOT(configChanged())); + actions=new QHButtonGroup(this); + _whatsthis=new QPushButton(_("&What's This?"), actions); + _whatsthis->setAccel(SHIFT+Key_F1); + QWhatsThis::add(_whatsthis, _("The What's This? button is part of this program's help system. Click on the What's This? button then on any widget in the window to get information (like this) on it.")); + connect(_whatsthis, SIGNAL(clicked()), SLOT(whatsthis())); + _help=new QPushButton(_("&Help"), actions); + _help->setAccel(Key_F1); + QWhatsThis::add(_help, _("This button calls up the program's online help system. If it does nothing, no help file has been written (yet); in that case, use the What's This button on the left.")); + connect(_help, SIGNAL(clicked()), this, SLOT(help())); + _deflt=new QPushButton(_("&Default"), actions); + QWhatsThis::add(_deflt, _("This button resets all parameters to some (hopefully sane) default values.")); + connect(_deflt, SIGNAL(clicked()), this, SLOT(defaults())); + _reset=new QPushButton(_("&Reset"), actions); + QWhatsThis::add(_reset, _("This button resets all parameters to what they were before you started the program.")); + connect(_reset, SIGNAL(clicked()), this, SLOT(reset())); + _apply=new QPushButton(_("&Apply"), actions); + QWhatsThis::add(_apply, _("This button saves all your changes without exiting.")); + connect(_apply, SIGNAL(clicked()), this, SLOT(apply())); + _ok=new QPushButton(_("&OK"), actions); + QWhatsThis::add(_ok, _("This button saves all your changes and exits the program.")); + connect(_ok, SIGNAL(clicked()), this, SLOT(ok())); + _cancel=new QPushButton(_("&Cancel"), actions); + QWhatsThis::add(_cancel, _("This button exits the program without saving your changes.")); + connect(_cancel, SIGNAL(clicked()), this, SLOT(cancel())); + _apply->setEnabled(false); + setMinimumWidth(actions->sizeHint().width()+10); + arrangeWidgets(); +} + +void Standalone::arrangeWidgets() +{ + m->setGeometry(SPACE_MARGIN, SPACE_MARGIN, width()-2*SPACE_MARGIN, height()-actions->sizeHint().height()-SPACE_MARGIN-SPACE_INSIDE); + actions->setGeometry(SPACE_MARGIN, height()-actions->sizeHint().height()-SPACE_MARGIN, width()-2*SPACE_MARGIN, actions->sizeHint().height()); +} + +void Standalone::resizeEvent(QResizeEvent *e) +{ + QWidget::resizeEvent(e); + arrangeWidgets(); +} + +void Standalone::whatsthis() +{ + QWhatsThis::enterWhatsThisMode(); +} +void Standalone::help() +{ +} +void Standalone::defaults() +{ + m->defaults(); +} +void Standalone::reset() +{ + m->reset(); +} +void Standalone::apply() +{ + m->save(); +} +void Standalone::ok() +{ + m->save(); + emit done(); +} +void Standalone::cancel() +{ + emit done(); +} + +void Standalone::configChanged() // SLOT +{ + _apply->setEnabled(true); +} + +int main(int argc, char **argv) { + QApplication a(argc, argv); + Standalone *s=new Standalone(0); + int ret; + a.setStyle(new QWindowsStyle()); + a.setMainWidget(s); + QObject::connect(s, SIGNAL(done()), &a, SLOT(quit())); + s->show(); + ret=a.exec(); + delete s; + return ret; +} diff --git a/lilo-config/qt/standalone.h b/lilo-config/qt/standalone.h new file mode 100644 index 0000000..8b0fa16 --- /dev/null +++ b/lilo-config/qt/standalone.h @@ -0,0 +1,64 @@ +/* standalone.h +** +** Copyright (C) 2000,2001 by Bernhard Rosenkraenzer +** +*/ + +/* +** 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 _STANDALONE_H_ +#define _STANDALONE_H_ 1 +#include +#include +#include +#include +#include "mainwidget.h" +class Standalone: public QWidget +{ + Q_OBJECT +public: + Standalone(QWidget *parent=0, const char *name=0); + void resizeEvent(QResizeEvent *e); +public slots: + void whatsthis(); + void help(); + void defaults(); + void reset(); + void apply(); + void ok(); + void cancel(); + void configChanged(); +signals: + void done(); +private: + void arrangeWidgets(); + MainWidget *m; + QHButtonGroup *actions; + QPushButton *_whatsthis; + QPushButton *_help; + QPushButton *_deflt; + QPushButton *_reset; + QPushButton *_apply; + QPushButton *_ok; + QPushButton *_cancel; +}; +#endif -- cgit v1.2.3