• Skip to content
  • Skip to link menu
KDE 4.2 API Reference
  • KDE API Reference
  • kdepim
  • Sitemap
  • Contact Us
 

libkdepim

kprefsdialog.h

Go to the documentation of this file.
00001 /*
00002   This file is part of libkdepim.
00003 
00004   Copyright (c) 2001-2003 Cornelius Schumacher <schumacher@kde.org>
00005   Copyright (C) 2003-2004 Reinhold Kainhofer <reinhold@kainhofer.com>
00006   Copyright (C) 2005,2008 Allen Winter <winter@kde.org>
00007 
00008   This library is free software; you can redistribute it and/or
00009   modify it under the terms of the GNU Library General Public
00010   License as published by the Free Software Foundation; either
00011   version 2 of the License, or (at your option) any later version.
00012 
00013   This library is distributed in the hope that it will be useful,
00014   but WITHOUT ANY WARRANTY; without even the implied warranty of
00015   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
00016   Library General Public License for more details.
00017 
00018   You should have received a copy of the GNU Library General Public License
00019   along with this library; see the file COPYING.LIB.  If not, write to
00020   the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
00021   Boston, MA 02110-1301, USA.
00022 */
00023 #ifndef KDEPIM_KPREFSDIALOG_H
00024 #define KDEPIM_KPREFSDIALOG_H
00025 
00026 #include "kdepim_export.h"
00027 
00028 #define KDE3_SUPPORT
00029 #include <KCModule>
00030 #undef KDE3_SUPPORT
00031 #include <KConfigSkeleton>
00032 #include <KFile>
00033 #include <KLineEdit>
00034 #include <KPageDialog>
00035 
00036 #include <QVariantList>
00037 
00038 class KColorButton;
00039 class KComboBox;
00040 class KComponentData;
00041 class KUrlRequester;
00042 
00043 class QCheckBox;
00044 class QLabel;
00045 class QSpinBox;
00046 class QTimeEdit;
00047 class Q3ButtonGroup;
00048 
00049 namespace KPIM {
00050 
00051 class KDateEdit;
00052 class KTimeEdit;
00053 
00063 class KDEPIM_EXPORT KPrefsWid : public QObject
00064 {
00065   Q_OBJECT
00066   public:
00071     virtual void readConfig() = 0;
00076     virtual void writeConfig() = 0;
00077 
00081     virtual QList<QWidget *> widgets() const;
00082 
00083   Q_SIGNALS:
00087     void changed();
00088 };
00089 
00096 class KDEPIM_EXPORT KPrefsWidBool : public KPrefsWid
00097 {
00098   public:
00105     explicit KPrefsWidBool( KConfigSkeleton::ItemBool *item, QWidget *parent = 0 );
00106 
00110     QCheckBox *checkBox();
00111 
00112     void readConfig();
00113     void writeConfig();
00114 
00115     QList<QWidget *> widgets() const;
00116 
00117   private:
00118     KConfigSkeleton::ItemBool *mItem;
00119 
00120     QCheckBox *mCheck;
00121 };
00122 
00130 class KDEPIM_EXPORT KPrefsWidInt : public KPrefsWid
00131 {
00132   public:
00140     explicit KPrefsWidInt( KConfigSkeleton::ItemInt *item, QWidget *parent = 0 );
00141 
00145     QLabel *label();
00146 
00150     QSpinBox *spinBox();
00151 
00152     void readConfig();
00153     void writeConfig();
00154 
00155     QList<QWidget *> widgets() const;
00156 
00157   private:
00158     KConfigSkeleton::ItemInt *mItem;
00159 
00160     QLabel *mLabel;
00161     QSpinBox *mSpin;
00162 };
00163 
00171 class KDEPIM_EXPORT KPrefsWidTime : public KPrefsWid
00172 {
00173   public:
00180     explicit KPrefsWidTime( KConfigSkeleton::ItemDateTime *item, QWidget *parent = 0 );
00181 
00185     QLabel *label();
00189     KTimeEdit *timeEdit();
00190 
00191     void readConfig();
00192     void writeConfig();
00193 
00194   private:
00195     KConfigSkeleton::ItemDateTime *mItem;
00196 
00197     QLabel *mLabel;
00198     KTimeEdit *mTimeEdit;
00199 };
00200 
00208 class KDEPIM_EXPORT KPrefsWidDuration : public KPrefsWid
00209 {
00210   public:
00218     explicit KPrefsWidDuration( KConfigSkeleton::ItemDateTime *item, QWidget *parent = 0 );
00219 
00223     QLabel *label();
00227     QTimeEdit *timeEdit();
00228 
00229     void readConfig();
00230     void writeConfig();
00231 
00232   private:
00233     KConfigSkeleton::ItemDateTime *mItem;
00234 
00235     QLabel *mLabel;
00236     QTimeEdit *mTimeEdit;
00237 };
00238 
00246 class KDEPIM_EXPORT KPrefsWidDate : public KPrefsWid
00247 {
00248   public:
00255     explicit KPrefsWidDate( KConfigSkeleton::ItemDateTime *item, QWidget *parent = 0 );
00256 
00260     QLabel *label();
00264     KDateEdit *dateEdit();
00265 
00266     void readConfig();
00267     void writeConfig();
00268 
00269   private:
00270     KConfigSkeleton::ItemDateTime *mItem;
00271 
00272     QLabel *mLabel;
00273     KDateEdit *mDateEdit;
00274 };
00275 
00283 class KDEPIM_EXPORT KPrefsWidColor : public KPrefsWid
00284 {
00285   Q_OBJECT
00286   public:
00294     explicit KPrefsWidColor( KConfigSkeleton::ItemColor *item, QWidget *parent = 0 );
00295 
00299     ~KPrefsWidColor();
00300 
00304     QLabel *label();
00308     KColorButton *button();
00309 
00310     void readConfig();
00311     void writeConfig();
00312 
00313   private:
00314     KConfigSkeleton::ItemColor *mItem;
00315 
00316     QLabel *mLabel;
00317     KColorButton *mButton;
00318 };
00319 
00326 class KDEPIM_EXPORT KPrefsWidFont : public KPrefsWid
00327 {
00328   Q_OBJECT
00329   public:
00338     explicit KPrefsWidFont( KConfigSkeleton::ItemFont *item,
00339                             QWidget *parent = 0, const QString &sampleText = QString() );
00343     ~KPrefsWidFont();
00344 
00348     QLabel *label();
00349 
00353     QFrame *preview();
00354 
00358     QPushButton *button();
00359 
00360     void readConfig();
00361     void writeConfig();
00362 
00363   protected Q_SLOTS:
00364     void selectFont();
00365 
00366   private:
00367     KConfigSkeleton::ItemFont *mItem;
00368 
00369     QLabel *mLabel;
00370     QLabel *mPreview;
00371     QPushButton *mButton;
00372 };
00373 
00385 class KDEPIM_EXPORT KPrefsWidRadios : public KPrefsWid
00386 {
00387   public:
00395     explicit KPrefsWidRadios( KConfigSkeleton::ItemEnum *item, QWidget *parent = 0 );
00396     virtual ~KPrefsWidRadios();
00397 
00405     void addRadio( const QString &text,
00406                    const QString &toolTip = QString(),
00407                    const QString &whatsThis = QString() );
00408 
00412     Q3ButtonGroup *groupBox();
00413 
00414     void readConfig();
00415     void writeConfig();
00416 
00417     QList<QWidget *> widgets() const;
00418 
00419   private:
00420     KConfigSkeleton::ItemEnum *mItem;
00421 
00422     Q3ButtonGroup *mBox;
00423 };
00424 
00435 class KDE_EXPORT KPrefsWidCombo : public KPrefsWid
00436 {
00437   public:
00445     explicit KPrefsWidCombo( KConfigSkeleton::ItemEnum *item, QWidget *parent );
00446     virtual ~KPrefsWidCombo();
00447 
00448     void readConfig();
00449     void writeConfig();
00450 
00451     KComboBox *comboBox();
00452     QList<QWidget *> widgets() const;
00453 
00454   private:
00455     KConfigSkeleton::ItemEnum *mItem;
00456     KComboBox *mCombo;
00457 };
00458 
00466 class KDEPIM_EXPORT KPrefsWidString : public KPrefsWid
00467 {
00468   public:
00477     explicit KPrefsWidString( KConfigSkeleton::ItemString *item,
00478                               QWidget *parent = 0,
00479                               KLineEdit::EchoMode echomode=KLineEdit::Normal );
00483     virtual ~KPrefsWidString();
00484 
00488     QLabel *label();
00492     KLineEdit *lineEdit();
00493 
00494     void readConfig();
00495     void writeConfig();
00496 
00497     QList<QWidget *> widgets() const;
00498 
00499   private:
00500     KConfigSkeleton::ItemString *mItem;
00501 
00502     QLabel *mLabel;
00503     KLineEdit *mEdit;
00504 };
00505 
00513 class KDEPIM_EXPORT KPrefsWidPath : public KPrefsWid
00514 {
00515   public:
00525     explicit KPrefsWidPath( KConfigSkeleton::ItemPath *item,
00526                             QWidget *parent = 0,
00527                             const QString &filter = QString(),
00528                             KFile::Modes = KFile::File );
00529 
00533     virtual ~KPrefsWidPath();
00534 
00538     QLabel *label();
00539 
00543     KUrlRequester *urlRequester();
00544 
00545     void readConfig();
00546     void writeConfig();
00547 
00548     QList<QWidget *> widgets() const;
00549 
00550   private:
00551     KConfigSkeleton::ItemPath *mItem;
00552 
00553     QLabel *mLabel;
00554     KUrlRequester *mURLRequester;
00555 };
00556 
00565 class KDEPIM_EXPORT KPrefsWidManager
00566 {
00567   public:
00573     explicit KPrefsWidManager( KConfigSkeleton *prefs );
00574 
00578     virtual ~KPrefsWidManager();
00579 
00580     KConfigSkeleton *prefs() const { return mPrefs; }
00581 
00585     virtual void addWid( KPrefsWid * );
00586 
00593     KPrefsWidBool *addWidBool( KConfigSkeleton::ItemBool *item,
00594                                QWidget *parent = 0 );
00595 
00602     KPrefsWidInt *addWidInt( KConfigSkeleton::ItemInt *item,
00603                              QWidget *parent = 0 );
00604 
00611     KPrefsWidDate *addWidDate( KConfigSkeleton::ItemDateTime *item,
00612                                QWidget *parent = 0 );
00613 
00620     KPrefsWidTime *addWidTime( KConfigSkeleton::ItemDateTime *item,
00621                                QWidget *parent = 0 );
00622 
00629     KPrefsWidDuration *addWidDuration( KConfigSkeleton::ItemDateTime *item,
00630                                        QWidget *parent = 0 );
00631 
00638     KPrefsWidColor *addWidColor( KConfigSkeleton::ItemColor *item,
00639                                  QWidget *parent = 0 );
00640 
00648     KPrefsWidRadios *addWidRadios( KConfigSkeleton::ItemEnum *item,
00649                                    QWidget *parent = 0 );
00650 
00658     KPrefsWidCombo *addWidCombo( KConfigSkeleton::ItemEnum *item,
00659                                  QWidget *parent = 0 );
00660 
00667     KPrefsWidString *addWidString( KConfigSkeleton::ItemString *item,
00668                                    QWidget *parent = 0 );
00669 
00678     KPrefsWidPath *addWidPath ( KConfigSkeleton::ItemPath *item,
00679                                 QWidget *parent = 0,
00680                                 const QString &filter = QString(),
00681                                 KFile::Modes mode = KFile::File );
00682 
00689     KPrefsWidString *addWidPassword ( KConfigSkeleton::ItemString *item,
00690                                       QWidget *parent = 0 );
00691 
00700     KPrefsWidFont *addWidFont( KConfigSkeleton::ItemFont *item,
00701                                QWidget *parent = 0,
00702                                const QString &sampleText = QString() );
00703 
00705     void setWidDefaults();
00706 
00708     void readWidConfig();
00709 
00711     void writeWidConfig();
00712 
00713   private:
00714     KConfigSkeleton *mPrefs;
00715 
00716     QList<KPrefsWid*> mPrefsWids;
00717 };
00718 
00731 class KDEPIM_EXPORT KPrefsDialog : public KPageDialog, public KPrefsWidManager
00732 {
00733   Q_OBJECT
00734   public:
00743     explicit KPrefsDialog( KConfigSkeleton *prefs, QWidget *parent = 0,
00744                            bool modal = false );
00745 
00749     virtual ~KPrefsDialog();
00750 
00751     void autoCreate();
00752 
00753   public Q_SLOTS:
00755     void setDefaults();
00756 
00758     void readConfig();
00759 
00761     void writeConfig();
00762 
00763   Q_SIGNALS:
00765     void configChanged();
00766 
00767   protected Q_SLOTS:
00769     void slotApply();
00770 
00772     void slotOk();
00773 
00775     void slotDefault();
00776 
00777   protected:
00779     virtual void usrReadConfig() {}
00781     virtual void usrWriteConfig() {}
00782 };
00783 
00784 class KDEPIM_EXPORT KPrefsModule : public KCModule, public KPrefsWidManager
00785 {
00786   Q_OBJECT
00787   public:
00788     KPrefsModule( KConfigSkeleton *, const KComponentData &instance,
00789                   QWidget *parent=0, const QVariantList &args=QVariantList() );
00790 
00791     virtual void addWid( KPrefsWid * );
00792 
00793     void load();
00794     void save();
00795     void defaults();
00796 
00797   protected Q_SLOTS:
00798     void slotWidChanged();
00799 
00800   protected:
00802     virtual void usrReadConfig() {}
00804     virtual void usrWriteConfig() {}
00805 };
00806 
00807 }
00808 
00809 #endif

libkdepim

Skip menu "libkdepim"
  • Main Page
  • Modules
  • Namespace List
  • Class Hierarchy
  • Alphabetical List
  • Class List
  • File List
  • Namespace Members
  • Class Members
  • Related Pages

kdepim

Skip menu "kdepim"
  • akonadi
  •   clients
  •   kabc
  •   kcal
  •   kcm
  • akregator
  • console
  •   kabcclient
  •   konsolekalendar
  • kaddressbook
  • kalarm
  •   lib
  • kdgantt
  • kdgantt1
  • kjots
  • kleopatra
  • kmail
  • kmobiletools
  • knode
  • knotes
  • kontact
  • kontactinterfaces
  • korganizer
  •   korgac
  • kpilot
  • ktimetracker
  •   doc
  • libkdepim
  • libkholidays
  • libkleo
  • libkpgp
  • maildir
Generated for kdepim by doxygen 1.5.4
This website is maintained by Adriaan de Groot and Allen Winter.
KDE® and the K Desktop Environment® logo are registered trademarks of KDE e.V. | Legal