You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
799 lines
21 KiB
799 lines
21 KiB
15 years ago
|
/*
|
||
13 years ago
|
This file is part of libtdepim.
|
||
15 years ago
|
|
||
|
Copyright (c) 2001-2003 Cornelius Schumacher <schumacher@kde.org>
|
||
|
Copyright (C) 2003-2004 Reinhold Kainhofer <reinhold@kainhofer.com>
|
||
|
Copyright (C) 2005 Allen Winter <winter@kde.org>
|
||
|
|
||
|
This library is free software; you can redistribute it and/or
|
||
|
modify it under the terms of the GNU Library General Public
|
||
|
License as published by the Free Software Foundation; either
|
||
|
version 2 of the License, or (at your option) any later version.
|
||
|
|
||
|
This library 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
|
||
|
Library General Public License for more details.
|
||
|
|
||
|
You should have received a copy of the GNU Library General Public License
|
||
|
along with this library; see the file COPYING.LIB. If not, write to
|
||
|
the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
|
||
|
Boston, MA 02110-1301, USA.
|
||
|
*/
|
||
|
#ifndef KPREFSDIALOG_H
|
||
|
#define KPREFSDIALOG_H
|
||
|
|
||
15 years ago
|
#include <tqptrlist.h>
|
||
|
#include <tqlineedit.h>
|
||
|
#include <tqvaluelist.h>
|
||
|
#include <tqdatetimeedit.h>
|
||
15 years ago
|
|
||
|
#include <kdialogbase.h>
|
||
|
#include <kcmodule.h>
|
||
|
#include <kconfigskeleton.h>
|
||
|
#include <kfile.h>
|
||
13 years ago
|
#include <tdepimmacros.h>
|
||
15 years ago
|
|
||
|
|
||
|
class KColorButton;
|
||
15 years ago
|
class TQCheckBox;
|
||
|
class TQComboBox;
|
||
|
class TQLabel;
|
||
|
class TQSpinBox;
|
||
|
class TQButtonGroup;
|
||
14 years ago
|
class TQTimeEdit;
|
||
15 years ago
|
class KTimeEdit;
|
||
|
class KDateEdit;
|
||
|
class KURLRequester;
|
||
|
|
||
|
/**
|
||
|
@short Base class for GUI control elements used by @ref KPrefsDialog.
|
||
|
@author Cornelius Schumacher
|
||
|
@see KPrefsDialog
|
||
|
|
||
|
This class provides the interface for the GUI control elements used by
|
||
|
KPrefsDialog. The control element consists of a set of widgets for handling
|
||
|
a certain type of configuration information.
|
||
|
*/
|
||
14 years ago
|
class KDE_EXPORT KPrefsWid : public TQObject
|
||
15 years ago
|
{
|
||
|
Q_OBJECT
|
||
14 years ago
|
TQ_OBJECT
|
||
15 years ago
|
public:
|
||
|
/**
|
||
|
This function is called to read value of the setting from the
|
||
|
stored configuration and display it in the widget.
|
||
|
*/
|
||
|
virtual void readConfig() = 0;
|
||
|
/**
|
||
|
This function is called to write the current setting of the widget to the
|
||
|
stored configuration.
|
||
|
*/
|
||
|
virtual void writeConfig() = 0;
|
||
|
|
||
|
/**
|
||
|
Return a list of widgets used by this control element.
|
||
|
*/
|
||
15 years ago
|
virtual TQValueList<TQWidget *> widgets() const;
|
||
15 years ago
|
|
||
|
signals:
|
||
|
/**
|
||
|
Emitted when widget value has changed.
|
||
|
*/
|
||
|
void changed();
|
||
|
};
|
||
|
|
||
|
/**
|
||
|
@short Widgets for bool settings in @ref KPrefsDialog.
|
||
|
|
||
|
This class provides a control element for configuring bool values. It is meant
|
||
14 years ago
|
to be used by KPrefsDialog. The user is responsible for the tqlayout management.
|
||
15 years ago
|
*/
|
||
|
class KDE_EXPORT KPrefsWidBool : public KPrefsWid
|
||
|
{
|
||
|
public:
|
||
|
/**
|
||
14 years ago
|
Create a bool value control element consisting of a TQCheckbox.
|
||
15 years ago
|
|
||
|
@param item The KConfigSkeletonItem representing the preferences entry.
|
||
14 years ago
|
@param parent Parent widget.
|
||
15 years ago
|
*/
|
||
14 years ago
|
KPrefsWidBool( KConfigSkeleton::ItemBool *item, TQWidget *parent );
|
||
15 years ago
|
|
||
|
/**
|
||
14 years ago
|
Return the TQCheckbox used by this control element.
|
||
15 years ago
|
*/
|
||
15 years ago
|
TQCheckBox *checkBox();
|
||
15 years ago
|
|
||
|
void readConfig();
|
||
|
void writeConfig();
|
||
|
|
||
15 years ago
|
TQValueList<TQWidget *> widgets() const;
|
||
15 years ago
|
|
||
|
private:
|
||
|
KConfigSkeleton::ItemBool *mItem;
|
||
|
|
||
15 years ago
|
TQCheckBox *mCheck;
|
||
15 years ago
|
};
|
||
|
|
||
|
/**
|
||
|
@short Widgets for int settings in @ref KPrefsDialog.
|
||
|
|
||
|
This class provides a control element for configuring integer values. It is
|
||
14 years ago
|
meant to be used by KPrefsDialog. The user is responsible for the tqlayout
|
||
15 years ago
|
management.
|
||
|
*/
|
||
|
class KDE_EXPORT KPrefsWidInt : public KPrefsWid
|
||
|
{
|
||
|
public:
|
||
|
/**
|
||
|
Create a integer value control element consisting of a label and a
|
||
|
spinbox.
|
||
|
|
||
|
@param item The KConfigSkeletonItem representing the preferences entry.
|
||
14 years ago
|
@param parent Parent widget.
|
||
15 years ago
|
*/
|
||
14 years ago
|
KPrefsWidInt( KConfigSkeleton::ItemInt *item, TQWidget *parent );
|
||
15 years ago
|
|
||
|
/**
|
||
15 years ago
|
Return TQLabel used by this control element.
|
||
15 years ago
|
*/
|
||
15 years ago
|
TQLabel *label();
|
||
15 years ago
|
|
||
|
/**
|
||
15 years ago
|
Return the TQSpinBox used by this control element.
|
||
15 years ago
|
*/
|
||
15 years ago
|
TQSpinBox *spinBox();
|
||
15 years ago
|
|
||
|
void readConfig();
|
||
|
void writeConfig();
|
||
|
|
||
15 years ago
|
TQValueList<TQWidget *> widgets() const;
|
||
15 years ago
|
|
||
|
private:
|
||
|
KConfigSkeleton::ItemInt *mItem;
|
||
|
|
||
15 years ago
|
TQLabel *mLabel;
|
||
|
TQSpinBox *mSpin;
|
||
15 years ago
|
};
|
||
|
|
||
|
/**
|
||
|
@short Widgets for time settings in @ref KPrefsDialog.
|
||
|
|
||
|
This class provides a control element for configuring time values. It is
|
||
14 years ago
|
meant to be used by KPrefsDialog. The user is responsible for the tqlayout
|
||
15 years ago
|
management.
|
||
|
*/
|
||
|
class KDE_EXPORT KPrefsWidTime : public KPrefsWid
|
||
|
{
|
||
|
public:
|
||
|
/**
|
||
|
Create a time value control element consisting of a label and a spinbox.
|
||
|
|
||
|
@param item The KConfigSkeletonItem representing the preferences entry.
|
||
14 years ago
|
@param parent Parent widget.
|
||
15 years ago
|
*/
|
||
14 years ago
|
KPrefsWidTime( KConfigSkeleton::ItemDateTime *item, TQWidget *parent );
|
||
15 years ago
|
|
||
|
/**
|
||
15 years ago
|
Return TQLabel used by this widget.
|
||
15 years ago
|
*/
|
||
15 years ago
|
TQLabel *label();
|
||
15 years ago
|
/**
|
||
15 years ago
|
Return TQSpinBox used by this widget.
|
||
15 years ago
|
*/
|
||
|
KTimeEdit *timeEdit();
|
||
|
|
||
|
void readConfig();
|
||
|
void writeConfig();
|
||
|
|
||
|
private:
|
||
|
KConfigSkeleton::ItemDateTime *mItem;
|
||
|
|
||
15 years ago
|
TQLabel *mLabel;
|
||
15 years ago
|
KTimeEdit *mTimeEdit;
|
||
|
};
|
||
|
|
||
|
/**
|
||
|
@short Widgets for duration settings in @ref KPrefsDialog.
|
||
|
|
||
|
This class provides a control element for configuring duration values. It is
|
||
14 years ago
|
meant to be used by KPrefsDialog. The user is responsible for the tqlayout
|
||
15 years ago
|
management.
|
||
|
*/
|
||
|
class KDE_EXPORT KPrefsWidDuration : public KPrefsWid
|
||
|
{
|
||
|
public:
|
||
|
/**
|
||
|
Create a duration value control element consisting of a label and a
|
||
|
spinbox.
|
||
|
|
||
|
@param item The KConfigSkeletonItem representing the preferences entry.
|
||
14 years ago
|
@param parent Parent widget.
|
||
15 years ago
|
*/
|
||
14 years ago
|
KPrefsWidDuration( KConfigSkeleton::ItemDateTime *item, TQWidget *parent );
|
||
15 years ago
|
|
||
|
/**
|
||
15 years ago
|
Return TQLabel used by this widget.
|
||
15 years ago
|
*/
|
||
15 years ago
|
TQLabel *label();
|
||
15 years ago
|
/**
|
||
15 years ago
|
Return TQSpinBox used by this widget.
|
||
15 years ago
|
*/
|
||
14 years ago
|
TQTimeEdit *timeEdit();
|
||
15 years ago
|
|
||
|
void readConfig();
|
||
|
void writeConfig();
|
||
|
|
||
|
private:
|
||
|
KConfigSkeleton::ItemDateTime *mItem;
|
||
|
|
||
15 years ago
|
TQLabel *mLabel;
|
||
14 years ago
|
TQTimeEdit *mTimeEdit;
|
||
15 years ago
|
};
|
||
|
|
||
|
/**
|
||
|
@short Widgets for time settings in @ref KPrefsDialog.
|
||
|
|
||
|
This class provides a control element for configuring date values. It is
|
||
14 years ago
|
meant to be used by KPrefsDialog. The user is responsible for the tqlayout
|
||
15 years ago
|
management.
|
||
|
*/
|
||
|
class KDE_EXPORT KPrefsWidDate : public KPrefsWid
|
||
|
{
|
||
|
public:
|
||
|
/**
|
||
|
Create a time value control element consisting of a label and a date box.
|
||
|
|
||
|
@param item The KConfigSkeletonItem representing the preferences entry.
|
||
14 years ago
|
@param parent Parent widget.
|
||
15 years ago
|
*/
|
||
14 years ago
|
KPrefsWidDate( KConfigSkeleton::ItemDateTime *item, TQWidget *parent );
|
||
15 years ago
|
|
||
|
/**
|
||
15 years ago
|
Return TQLabel used by this widget.
|
||
15 years ago
|
*/
|
||
15 years ago
|
TQLabel *label();
|
||
15 years ago
|
/**
|
||
15 years ago
|
Return TQSpinBox used by this widget.
|
||
15 years ago
|
*/
|
||
|
KDateEdit *dateEdit();
|
||
|
|
||
|
void readConfig();
|
||
|
void writeConfig();
|
||
|
|
||
|
private:
|
||
|
KConfigSkeleton::ItemDateTime *mItem;
|
||
|
|
||
15 years ago
|
TQLabel *mLabel;
|
||
15 years ago
|
KDateEdit *mDateEdit;
|
||
|
};
|
||
|
|
||
|
/**
|
||
|
@short Widgets for color settings in @ref KPrefsDialog.
|
||
|
|
||
|
This class provides a control element for configuring color values. It is
|
||
14 years ago
|
meant to be used by KPrefsDialog. The user is responsible for the tqlayout
|
||
15 years ago
|
management.
|
||
|
*/
|
||
|
class KDE_EXPORT KPrefsWidColor : public KPrefsWid
|
||
|
{
|
||
|
Q_OBJECT
|
||
14 years ago
|
TQ_OBJECT
|
||
15 years ago
|
public:
|
||
|
/**
|
||
|
Create a color value control element consisting of a test field and a
|
||
|
button for opening a color dialog.
|
||
|
|
||
|
@param item The KConfigSkeletonItem representing the preferences entry.
|
||
14 years ago
|
@param parent Parent widget.
|
||
15 years ago
|
*/
|
||
14 years ago
|
KPrefsWidColor( KConfigSkeleton::ItemColor *item, TQWidget *parent );
|
||
15 years ago
|
/**
|
||
|
Destruct color setting widget.
|
||
|
*/
|
||
|
~KPrefsWidColor();
|
||
|
|
||
|
/**
|
||
15 years ago
|
Return TQLabel for the button
|
||
15 years ago
|
*/
|
||
15 years ago
|
TQLabel *label();
|
||
15 years ago
|
/**
|
||
|
Return button opening the color dialog.
|
||
|
*/
|
||
|
KColorButton *button();
|
||
|
|
||
|
void readConfig();
|
||
|
void writeConfig();
|
||
|
|
||
|
private:
|
||
|
KConfigSkeleton::ItemColor *mItem;
|
||
|
|
||
15 years ago
|
TQLabel *mLabel;
|
||
15 years ago
|
KColorButton *mButton;
|
||
|
};
|
||
|
|
||
|
/**
|
||
|
@short Widgets for font settings in @ref KPrefsDialog.
|
||
|
|
||
|
This class provides a control element for configuring font values. It is meant
|
||
14 years ago
|
to be used by KPrefsDialog. The user is responsible for the tqlayout management.
|
||
15 years ago
|
*/
|
||
|
class KDE_EXPORT KPrefsWidFont : public KPrefsWid
|
||
|
{
|
||
|
Q_OBJECT
|
||
14 years ago
|
TQ_OBJECT
|
||
15 years ago
|
public:
|
||
|
/**
|
||
|
Create a font value control element consisting of a test field and a
|
||
|
button for opening a font dialog.
|
||
|
|
||
|
@param item The KConfigSkeletonItem representing the preferences entry.
|
||
14 years ago
|
@param parent Parent widget.
|
||
15 years ago
|
@param sampleText Sample text for previewing the selected font.
|
||
|
*/
|
||
|
KPrefsWidFont( KConfigSkeleton::ItemFont *item,
|
||
14 years ago
|
TQWidget *parent, const TQString &sampleText );
|
||
15 years ago
|
/**
|
||
|
Destruct font setting widget.
|
||
|
*/
|
||
|
~KPrefsWidFont();
|
||
|
|
||
|
/**
|
||
15 years ago
|
Return TQLabel.
|
||
15 years ago
|
*/
|
||
15 years ago
|
TQLabel *label();
|
||
15 years ago
|
/**
|
||
15 years ago
|
Return TQFrame used as preview field.
|
||
15 years ago
|
*/
|
||
15 years ago
|
TQFrame *preview();
|
||
15 years ago
|
/**
|
||
|
Return button opening the font dialog.
|
||
|
*/
|
||
15 years ago
|
TQPushButton *button();
|
||
15 years ago
|
|
||
|
void readConfig();
|
||
|
void writeConfig();
|
||
|
|
||
|
protected slots:
|
||
|
void selectFont();
|
||
|
|
||
|
private:
|
||
|
KConfigSkeleton::ItemFont *mItem;
|
||
|
|
||
15 years ago
|
TQLabel *mLabel;
|
||
|
TQLabel *mPreview;
|
||
|
TQPushButton *mButton;
|
||
15 years ago
|
};
|
||
|
|
||
|
/**
|
||
|
@short Widgets for settings represented by a group of radio buttons in
|
||
|
@ref KPrefsDialog.
|
||
|
|
||
|
This class provides a control element for configuring selections. It is meant
|
||
14 years ago
|
to be used by KPrefsDialog. The user is responsible for the tqlayout management.
|
||
15 years ago
|
|
||
|
The setting is interpreted as an int value, corresponding to the position of
|
||
|
the radio button. The position of the button is defined by the sequence of
|
||
|
@ref addRadio() calls, starting with 0.
|
||
|
*/
|
||
|
class KDE_EXPORT KPrefsWidRadios : public KPrefsWid
|
||
|
{
|
||
|
public:
|
||
|
/**
|
||
|
Create a control element for selection of an option. It consists of a box
|
||
|
with several radio buttons.
|
||
|
|
||
|
@param item The KConfigSkeletonItem representing the preferences entry.
|
||
14 years ago
|
@param parent Parent widget.
|
||
15 years ago
|
*/
|
||
14 years ago
|
KPrefsWidRadios( KConfigSkeleton::ItemEnum *item, TQWidget *parent );
|
||
15 years ago
|
virtual ~KPrefsWidRadios();
|
||
|
|
||
|
/**
|
||
|
Add a radio button.
|
||
|
|
||
|
@param text Text of the button.
|
||
|
@param whatsThis What's This help for the button.
|
||
|
*/
|
||
15 years ago
|
void addRadio( const TQString &text,
|
||
14 years ago
|
const TQString &whatsThis = TQString() );
|
||
15 years ago
|
|
||
|
/**
|
||
|
Return the box widget used by this widget.
|
||
|
*/
|
||
15 years ago
|
TQButtonGroup *groupBox();
|
||
15 years ago
|
|
||
|
void readConfig();
|
||
|
void writeConfig();
|
||
|
|
||
15 years ago
|
TQValueList<TQWidget *> widgets() const;
|
||
15 years ago
|
|
||
|
private:
|
||
|
KConfigSkeleton::ItemEnum *mItem;
|
||
|
|
||
15 years ago
|
TQButtonGroup *mBox;
|
||
15 years ago
|
};
|
||
|
|
||
|
/**
|
||
|
@short Widgets for settings represented by a combo box in
|
||
|
@ref KPrefsDialog.
|
||
|
|
||
|
This class provides a control element for configuring selections. It is meant
|
||
14 years ago
|
to be used by KPrefsDialog. The user is responsible for the tqlayout management.
|
||
15 years ago
|
|
||
|
The setting is interpreted as an int value, corresponding to the index in
|
||
|
the combo box.
|
||
|
*/
|
||
|
class KDE_EXPORT KPrefsWidCombo : public KPrefsWid
|
||
|
{
|
||
|
public:
|
||
|
/**
|
||
|
Create a control element for selection of an option. It consists of a
|
||
|
combo box.
|
||
|
|
||
|
@param item The KConfigSkeletonItem representing the preferences entry.
|
||
14 years ago
|
@param parent Parent widget.
|
||
15 years ago
|
*/
|
||
14 years ago
|
KPrefsWidCombo( KConfigSkeleton::ItemEnum *item, TQWidget *parent );
|
||
15 years ago
|
virtual ~KPrefsWidCombo();
|
||
|
|
||
|
void readConfig();
|
||
|
void writeConfig();
|
||
|
|
||
15 years ago
|
TQComboBox *comboBox();
|
||
|
TQValueList<TQWidget *> widgets() const;
|
||
15 years ago
|
|
||
|
private:
|
||
|
KConfigSkeleton::ItemEnum *mItem;
|
||
15 years ago
|
TQComboBox *mCombo;
|
||
15 years ago
|
};
|
||
|
|
||
|
|
||
|
|
||
|
/**
|
||
|
@short Widgets for string settings in @ref KPrefsDialog.
|
||
|
|
||
|
This class provides a control element for configuring string values. It is
|
||
14 years ago
|
meant to be used by KPrefsDialog. The user is responsible for the tqlayout
|
||
15 years ago
|
management.
|
||
|
*/
|
||
|
class KDE_EXPORT KPrefsWidString : public KPrefsWid
|
||
|
{
|
||
|
public:
|
||
|
/**
|
||
|
Create a string value control element consisting of a test label and a
|
||
|
line edit.
|
||
|
|
||
|
@param item The KConfigSkeletonItem representing the preferences entry.
|
||
14 years ago
|
@param parent Parent widget.
|
||
15 years ago
|
@param echomode Describes how a line edit should display its contents.
|
||
|
*/
|
||
14 years ago
|
KPrefsWidString( KConfigSkeleton::ItemString *item, TQWidget *parent,
|
||
15 years ago
|
TQLineEdit::EchoMode echomode=TQLineEdit::Normal );
|
||
15 years ago
|
/**
|
||
|
Destructor.
|
||
|
*/
|
||
|
virtual ~KPrefsWidString();
|
||
|
|
||
|
/**
|
||
15 years ago
|
Return TQLabel used by this widget.
|
||
15 years ago
|
*/
|
||
15 years ago
|
TQLabel *label();
|
||
15 years ago
|
/**
|
||
15 years ago
|
Return TQLineEdit used by this widget.
|
||
15 years ago
|
*/
|
||
15 years ago
|
TQLineEdit *lineEdit();
|
||
15 years ago
|
|
||
|
void readConfig();
|
||
|
void writeConfig();
|
||
|
|
||
15 years ago
|
TQValueList<TQWidget *> widgets() const;
|
||
15 years ago
|
|
||
|
private:
|
||
|
KConfigSkeleton::ItemString *mItem;
|
||
|
|
||
15 years ago
|
TQLabel *mLabel;
|
||
|
TQLineEdit *mEdit;
|
||
15 years ago
|
};
|
||
|
|
||
|
|
||
|
/**
|
||
|
@short Widgets for string settings in @ref KPrefsDialog.
|
||
|
|
||
|
This class provides a control element for configuring string values. It is
|
||
14 years ago
|
meant to be used by KPrefsDialog. The user is responsible for the tqlayout
|
||
15 years ago
|
management.
|
||
|
*/
|
||
|
class KDE_EXPORT KPrefsWidPath : public KPrefsWid
|
||
|
{
|
||
|
public:
|
||
|
/**
|
||
|
Create a string value control element consisting of a test label and a
|
||
|
line edit.
|
||
|
|
||
|
@param item The KConfigSkeletonItem representing the preferences entry.
|
||
14 years ago
|
@param parent Parent widget.
|
||
15 years ago
|
@param filter URLRequester filter
|
||
|
@param mode Describes how a line edit should display its contents.
|
||
|
*/
|
||
14 years ago
|
KPrefsWidPath( KConfigSkeleton::ItemPath *item, TQWidget *parent,
|
||
14 years ago
|
const TQString &filter = TQString(), uint mode = KFile::File );
|
||
15 years ago
|
/**
|
||
|
Destructor.
|
||
|
*/
|
||
|
virtual ~KPrefsWidPath();
|
||
|
|
||
|
/**
|
||
15 years ago
|
Return TQLabel used by this widget.
|
||
15 years ago
|
*/
|
||
15 years ago
|
TQLabel *label();
|
||
15 years ago
|
/**
|
||
15 years ago
|
Return TQLineEdit used by this widget.
|
||
15 years ago
|
*/
|
||
|
KURLRequester *urlRequester();
|
||
|
|
||
|
void readConfig();
|
||
|
void writeConfig();
|
||
|
|
||
15 years ago
|
TQValueList<TQWidget *> widgets() const;
|
||
15 years ago
|
|
||
|
private:
|
||
|
KConfigSkeleton::ItemPath *mItem;
|
||
|
|
||
15 years ago
|
TQLabel *mLabel;
|
||
15 years ago
|
KURLRequester *mURLRequester;
|
||
|
};
|
||
|
|
||
|
|
||
|
/**
|
||
|
@short Class for managing KPrefsWid objects.
|
||
|
|
||
|
This class manages standard configuration widgets provided bz the KPrefsWid
|
||
|
subclasses. It handles creation, loading, saving and default values in a
|
||
|
transparent way. The user has to add the widgets by the corresponding addWid
|
||
|
functions and KPrefsWidManager handles the rest automatically.
|
||
|
*/
|
||
|
class KDE_EXPORT KPrefsWidManager
|
||
|
{
|
||
|
public:
|
||
|
/**
|
||
|
Create a KPrefsWidManager object for a KPrefs object.
|
||
|
|
||
|
@param prefs KPrefs object used to access te configuration.
|
||
|
*/
|
||
|
KPrefsWidManager( KConfigSkeleton *prefs );
|
||
|
/**
|
||
|
Destructor.
|
||
|
*/
|
||
|
virtual ~KPrefsWidManager();
|
||
|
|
||
|
KConfigSkeleton *prefs() const { return mPrefs; }
|
||
|
|
||
|
/**
|
||
|
Register a custom KPrefsWid object.
|
||
|
*/
|
||
|
virtual void addWid( KPrefsWid * );
|
||
|
|
||
|
/**
|
||
|
Register a @ref KPrefsWidBool object.
|
||
|
|
||
|
@param item The KConfigSkeletonItem representing the preferences entry.
|
||
14 years ago
|
@param parent Parent widget.
|
||
15 years ago
|
*/
|
||
|
KPrefsWidBool *addWidBool( KConfigSkeleton::ItemBool *item,
|
||
14 years ago
|
TQWidget *parent );
|
||
15 years ago
|
|
||
|
/**
|
||
|
Register a @ref KPrefsWidInt object.
|
||
|
|
||
|
@param item The KConfigSkeletonItem representing the preferences entry.
|
||
14 years ago
|
@param parent Parent widget.
|
||
15 years ago
|
*/
|
||
|
KPrefsWidInt *addWidInt( KConfigSkeleton::ItemInt *item,
|
||
14 years ago
|
TQWidget *parent );
|
||
15 years ago
|
|
||
|
/**
|
||
|
Register a @ref KPrefsWidDate object.
|
||
|
|
||
|
@param item The KConfigSkeletonItem representing the preferences entry.
|
||
14 years ago
|
@param parent Parent widget.
|
||
15 years ago
|
*/
|
||
|
KPrefsWidDate *addWidDate( KConfigSkeleton::ItemDateTime *item,
|
||
14 years ago
|
TQWidget *parent );
|
||
15 years ago
|
|
||
|
/**
|
||
|
Register a @ref KPrefsWidTime object.
|
||
|
|
||
|
@param item The KConfigSkeletonItem representing the preferences entry.
|
||
14 years ago
|
@param parent Parent widget.
|
||
15 years ago
|
*/
|
||
|
KPrefsWidTime *addWidTime( KConfigSkeleton::ItemDateTime *item,
|
||
14 years ago
|
TQWidget *parent );
|
||
15 years ago
|
|
||
|
/**
|
||
|
Register a @ref KPrefsWidDuration object.
|
||
|
|
||
|
@param item The KConfigSkeletonItem representing the preferences entry.
|
||
14 years ago
|
@param parent Parent widget.
|
||
15 years ago
|
*/
|
||
|
KPrefsWidDuration *addWidDuration( KConfigSkeleton::ItemDateTime *item,
|
||
14 years ago
|
TQWidget *parent );
|
||
15 years ago
|
|
||
|
/**
|
||
|
Register a @ref KPrefsWidColor object.
|
||
|
|
||
|
@param item The KConfigSkeletonItem representing the preferences entry.
|
||
14 years ago
|
@param parent Parent widget.
|
||
15 years ago
|
*/
|
||
|
KPrefsWidColor *addWidColor( KConfigSkeleton::ItemColor *item,
|
||
14 years ago
|
TQWidget *parent );
|
||
15 years ago
|
|
||
|
/**
|
||
|
Register a @ref KPrefsWidRadios object. The choices represented by the
|
||
|
given item object are automatically added as radio buttons.
|
||
|
|
||
|
@param item The KConfigSkeletonItem representing the preferences entry.
|
||
14 years ago
|
@param parent Parent widget.
|
||
15 years ago
|
*/
|
||
|
KPrefsWidRadios *addWidRadios( KConfigSkeleton::ItemEnum *item,
|
||
14 years ago
|
TQWidget *parent );
|
||
15 years ago
|
|
||
|
/**
|
||
|
Register a @ref KPrefsWidCombo object. The choices represented by the
|
||
|
given item object are automatically added to the combo box.
|
||
|
|
||
|
@param item The KConfigSkeletonItem representing the preferences entry.
|
||
14 years ago
|
@param parent Parent widget.
|
||
15 years ago
|
*/
|
||
|
KPrefsWidCombo *addWidCombo( KConfigSkeleton::ItemEnum *item,
|
||
14 years ago
|
TQWidget *parent );
|
||
15 years ago
|
|
||
|
/**
|
||
|
Register a @ref KPrefsWidString object.
|
||
|
|
||
|
@param item The KConfigSkeletonItem representing the preferences entry.
|
||
14 years ago
|
@param parent Parent widget.
|
||
15 years ago
|
*/
|
||
|
KPrefsWidString *addWidString( KConfigSkeleton::ItemString *item,
|
||
14 years ago
|
TQWidget *parent );
|
||
15 years ago
|
|
||
|
/**
|
||
|
Register a path @ref KPrefsWidPath object.
|
||
|
|
||
|
@param item The KConfigSkeletonItem representing the preferences entry.
|
||
14 years ago
|
@param parent Parent widget.
|
||
15 years ago
|
@param filter URLRequester filter
|
||
|
@param mode URLRequester mode
|
||
|
*/
|
||
14 years ago
|
KPrefsWidPath *addWidPath ( KConfigSkeleton::ItemPath *item, TQWidget *parent,
|
||
14 years ago
|
const TQString &filter = TQString(),
|
||
15 years ago
|
uint mode = KFile::File );
|
||
|
|
||
|
/**
|
||
15 years ago
|
Register a password @ref KPrefsWidString object, with echomode set to TQLineEdit::Password.
|
||
15 years ago
|
|
||
|
@param item The KConfigSkeletonItem representing the preferences entry.
|
||
14 years ago
|
@param parent Parent widget.
|
||
15 years ago
|
*/
|
||
|
KPrefsWidString *addWidPassword ( KConfigSkeleton::ItemString *item,
|
||
14 years ago
|
TQWidget *parent );
|
||
15 years ago
|
|
||
|
/**
|
||
|
Register a @ref KPrefsWidFont object.
|
||
|
|
||
|
@param item The KConfigSkeletonItem representing the preferences
|
||
|
entry.
|
||
14 years ago
|
@param parent Parent widget.
|
||
15 years ago
|
@param sampleText Sample text for previewing the selected font.
|
||
|
*/
|
||
|
KPrefsWidFont *addWidFont( KConfigSkeleton::ItemFont *item,
|
||
14 years ago
|
TQWidget *parent, const TQString &sampleText );
|
||
15 years ago
|
|
||
|
/** Set all widgets to default values. */
|
||
|
void setWidDefaults();
|
||
|
|
||
|
/** Read preferences from config file. */
|
||
|
void readWidConfig();
|
||
|
|
||
|
/** Write preferences to config file. */
|
||
|
void writeWidConfig();
|
||
|
|
||
|
private:
|
||
|
KConfigSkeleton *mPrefs;
|
||
|
|
||
15 years ago
|
TQPtrList<KPrefsWid> mPrefsWids;
|
||
15 years ago
|
};
|
||
|
|
||
|
|
||
|
/**
|
||
|
@short Base class for a preferences dialog.
|
||
|
|
||
|
This class provides the framework for a preferences dialog. You have to
|
||
|
subclass it and add the code to create the actual configuration widgets and
|
||
14 years ago
|
do the tqlayout management.
|
||
15 years ago
|
|
||
|
KPrefsDialog provides functions to add subclasses of @ref KPrefsWid via
|
||
|
KPrefsWidManager. For these widgets the reading, writing and setting to
|
||
|
default values is handled automatically. Custom widgets have to be handled in
|
||
|
the functions @ref usrReadConfig() and @ref usrWriteConfig().
|
||
|
*/
|
||
|
class KDE_EXPORT KPrefsDialog : public KDialogBase, public KPrefsWidManager
|
||
|
{
|
||
|
Q_OBJECT
|
||
14 years ago
|
TQ_OBJECT
|
||
15 years ago
|
public:
|
||
|
/**
|
||
|
Create a KPrefsDialog for a KPrefs object.
|
||
|
|
||
|
@param prefs KPrefs object used to access te configuration.
|
||
14 years ago
|
@param parent Parent widget.
|
||
15 years ago
|
@param name Widget name.
|
||
|
@param modal true, if dialog has to be modal, false for non-modal.
|
||
|
*/
|
||
14 years ago
|
KPrefsDialog( KConfigSkeleton *prefs, TQWidget *parent = 0, char *name = 0,
|
||
15 years ago
|
bool modal = false );
|
||
|
/**
|
||
|
Destructor.
|
||
|
*/
|
||
|
virtual ~KPrefsDialog();
|
||
|
|
||
|
void autoCreate();
|
||
|
|
||
|
public slots:
|
||
|
/** Set all widgets to default values. */
|
||
|
void setDefaults();
|
||
|
|
||
|
/** Read preferences from config file. */
|
||
|
void readConfig();
|
||
|
|
||
|
/** Write preferences to config file. */
|
||
|
void writeConfig();
|
||
|
|
||
|
signals:
|
||
|
/** Emitted when the a changed configuration has been stored. */
|
||
|
void configChanged();
|
||
|
|
||
|
protected slots:
|
||
|
/** Apply changes to preferences */
|
||
|
void slotApply();
|
||
|
|
||
|
/** Accept changes to preferences and close dialog */
|
||
|
void slotOk();
|
||
|
|
||
|
/** Set preferences to default values */
|
||
|
void slotDefault();
|
||
|
|
||
|
protected:
|
||
|
/** Implement this to read custom configuration widgets. */
|
||
|
virtual void usrReadConfig() {}
|
||
|
/** Implement this to write custom configuration widgets. */
|
||
|
virtual void usrWriteConfig() {}
|
||
|
};
|
||
|
|
||
|
|
||
|
class KDE_EXPORT KPrefsModule : public KCModule, public KPrefsWidManager
|
||
|
{
|
||
|
Q_OBJECT
|
||
14 years ago
|
TQ_OBJECT
|
||
15 years ago
|
public:
|
||
14 years ago
|
KPrefsModule( KConfigSkeleton *, TQWidget *parent = 0, const char *name = 0 );
|
||
15 years ago
|
|
||
|
virtual void addWid( KPrefsWid * );
|
||
|
|
||
|
void load();
|
||
|
void save();
|
||
|
void defaults();
|
||
|
|
||
|
protected slots:
|
||
|
void slotWidChanged();
|
||
|
|
||
|
protected:
|
||
|
/** Implement this to read custom configuration widgets. */
|
||
|
virtual void usrReadConfig() {}
|
||
|
/** Implement this to write custom configuration widgets. */
|
||
|
virtual void usrWriteConfig() {}
|
||
|
};
|
||
|
|
||
|
#endif
|