/*
* Copyright (C) 2002 Roman Zippel <zippel@linux-m68k.org>
* Released under the terms of the GNU GPL v2.0.
*/
#include <qglobal.h>
#include <QMainWindow>
#include <QList>
#include <qtextbrowser.h>
#include <QAction>
#include <QFileDialog>
#include <QMenu>
#include <qapplication.h>
#include <qdesktopwidget.h>
#include <qtoolbar.h>
#include <qlayout.h>
#include <qsplitter.h>
#include <qlineedit.h>
#include <qlabel.h>
#include <qpushbutton.h>
#include <qmenubar.h>
#include <qmessagebox.h>
#include <qregexp.h>
#include <qevent.h>
#include <stdlib.h>
#include "lkc.h"
#include "qconf.h"
#include "qconf.moc"
#include "images.c"
#ifdef _
# undef _
# define _ qgettext
#endif
static QApplication *configApp;
static ConfigSettings *configSettings;
QAction *ConfigMainWindow::saveAction;
static inline QString qgettext(const char* str)
{
return QString::fromLocal8Bit(gettext(str));
}
static inline QString qgettext(const QString& str)
{
return QString::fromLocal8Bit(gettext(str.toLatin1()));
}
ConfigSettings::ConfigSettings()
: QSettings("kernel.org", "qconf")
{
}
/**
* Reads a list of integer values from the application settings.
*/
QList<int> ConfigSettings::readSizes(const QString& key, bool *ok)
{
QList<int> result;
QStringList entryList = value(key).toStringList();
QStringList::Iterator it;
for (it = entryList.begin(); it != entryList.end(); ++it)
result.push_back((*it).toInt());
return result;
}
/**
* Writes a list of integer values to the application settings.
*/
bool ConfigSettings::writeSizes(const QString& key, const QList<int>& value)
{
QStringList stringList;
QList<int>::ConstIterator it;
for (it = value.begin(); it != value.end(); ++it)
stringList.push_back(QString::number(*it));
setValue(key, stringList);
return true;
}
/*
* set the new data
* TODO check the value
*/
void ConfigItem::okRename(int col)
{
}
/*
* update the displayed of a menu entry
*/
void ConfigItem::updateMenu(void)
{
}
void ConfigItem::testUpdateMenu(bool v)
{
}
/*
* construct a menu entry
*/
void ConfigItem::init(void)
{
}
/*
* destruct a menu entry
*/
ConfigItem::~ConfigItem(void)
{
}
ConfigLineEdit::ConfigLineEdit(ConfigView* parent)
: Parent(parent)
{
connect(this, SIGNAL(editingFinished()), SLOT(hide()));
}
void ConfigLineEdit::show(ConfigItem* i)
{
item = i;
Parent::show();
setFocus();
}
void ConfigLineEdit::keyPressEvent(QKeyEvent* e)
{
switch (e->key()) {
case Qt::Key_Escape:
break;
case Qt::Key_Return:
case Qt::Key_Enter:
parent()->updateList(item);
break;
default:
Parent::keyPressEvent(e);
return;
}
e->accept();
parent()->list->setFocus();
hide();
}
ConfigList::ConfigList(ConfigView* p, const char *name)
: Parent(p),
updateAll(false),
symbolYesPix(xpm_symbol_yes), symbolModPix(xpm_symbol_mod), symbolNoPix(xpm_symbol_no),
choiceYesPix(xpm_choice_yes), choiceNoPix(xpm_choice_no),
menuPix(xpm_menu), menuInvPix(xpm_menu_inv), menuBackPix(xpm_menuback), voidPix(xpm_void),
showName(false), showRange(false), showData(false), optMode(normalOpt),
rootEntry(0), headerPopup(0)
{
}
void ConfigList::reinit(void)
{
}
void ConfigList::saveSettings(void)
{
}
ConfigItem* ConfigList::findConfigItem(struct menu *menu)
{
}
void ConfigList::updateSelection(void)
{
}
void ConfigList::updateList(ConfigItem* item)
{
}
void ConfigList::setValue(ConfigItem* item, tristate val)
{
}
void ConfigList::changeValue(ConfigItem* item)
{
}
void ConfigList::setRootMenu(struct menu *menu)
{
}
void ConfigList::setParentMenu(void)
{
}
/*
* update all the children of a menu entry
* removes/adds the entries from the parent widget as necessary
*
* parent: either the menu list widget or a menu entry widget
* menu: entry to be updated
*/
template <class P>
void ConfigList::updateMenuList(P* parent