kconfigdialog.h

00001 /*
00002  *  This file is part of the KDE libraries
00003  *  Copyright (C) 2003 Benjamin C Meyer (ben+kdelibs at meyerhome dot net)
00004  *  Copyright (C) 2003 Waldo Bastian <bastian@kde.org>
00005  *
00006  *  This library is free software; you can redistribute it and/or
00007  *  modify it under the terms of the GNU Library General Public
00008  *  License as published by the Free Software Foundation; either
00009  *  version 2 of the License, or (at your option) any later version.
00010  *
00011  *  This library is distributed in the hope that it will be useful,
00012  *  but WITHOUT ANY WARRANTY; without even the implied warranty of
00013  *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
00014  *  Library General Public License for more details.
00015  *
00016  *  You should have received a copy of the GNU Library General Public License
00017  *  along with this library; see the file COPYING.LIB.  If not, write to
00018  *  the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
00019  *  Boston, MA 02110-1301, USA.
00020  */
00021 #ifndef KCONFIGDIALOG_H
00022 #define KCONFIGDIALOG_H
00023 
00024 class KConfig;
00025 class KConfigSkeleton;
00026 class KConfigDialogManager;
00027 #include <kdialogbase.h>
00028 #include <qasciidict.h>
00029 
00072 class KDEUI_EXPORT KConfigDialog : public KDialogBase {
00073 Q_OBJECT
00074 
00075 signals:
00079   void widgetModified();
00080 
00085   void settingsChanged();
00086 
00095   void settingsChanged(const char *dialogName);
00096 
00097 public:
00121   // KDE4: Add the "separator" parameter as in KDialogBase
00122   //       Make "dialogType" an int
00123   KConfigDialog( QWidget *parent, const char *name,
00124                  KConfigSkeleton *config,
00125                  DialogType dialogType = IconList,
00126                  int dialogButtons = Default|Ok|Apply|Cancel|Help,
00127                  ButtonCode defaultButton = Ok,
00128                  bool modal=false );
00129 
00135   ~KConfigDialog();
00136 
00151   // KDE4: Add a default value for itemName & pixmapName
00152   void addPage( QWidget *page, const QString &itemName,
00153                 const QString &pixmapName,
00154                 const QString &header=QString::null,
00155                 bool manage=true );
00156 
00173   // KDE4: Add a default value for itemName & pixmapName
00174   void addPage( QWidget *page, KConfigSkeleton *config,
00175                 const QString &itemName,
00176                 const QString &pixmapName,
00177                 const QString &header=QString::null );
00178 
00185   static KConfigDialog* exists( const char* name );
00186 
00193   static bool showDialog( const char* name );
00194 
00198   virtual void show();
00199 
00200 protected slots:
00207   virtual void updateSettings();
00208 
00216   virtual void updateWidgets();
00217 
00224   virtual void updateWidgetsDefault();
00225 
00226 protected:
00227 
00233   virtual bool hasChanged() { return false; }
00234 
00239   virtual bool isDefault() { return true; }
00240 
00241 protected slots:
00245   void updateButtons();
00246 
00250   void settingsChangedSlot();
00251 
00252 private:
00256   void addPageInternal(QWidget *page, const QString &itemName,
00257                            const QString &pixmapName, const QString &header);
00258 
00263   void setupManagerConnections(KConfigDialogManager *manager);
00264 
00265 private:
00269   static QAsciiDict<KConfigDialog> openDialogs;
00270 
00271   class KConfigDialogPrivate;
00275   KConfigDialogPrivate *d;
00276 };
00277 
00278 #endif //KCONFIGDIALOG_H
00279 
KDE Home | KDE Accessibility Home | Description of Access Keys