configpage.h

00001 /*
00002     This file is part of libkresources.
00003 
00004     Copyright (c) 2002 Tobias Koenig <tokoe@kde.org>
00005     Copyright (c) 2002 Jan-Pascal van Best <janpascal@vanbest.org>
00006     Copyright (c) 2003 Cornelius Schumacher <schumacher@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 KRESOURCES_CONFIGPAGE_H
00024 #define KRESOURCES_CONFIGPAGE_H
00025 
00026 #include <ksharedptr.h>
00027 #include <qstringlist.h>
00028 #include <qwidget.h>
00029 
00030 #include "manager.h"
00031 
00032 class KComboBox;
00033 class KListView;
00034 
00035 class QListViewItem;
00036 class QPushButton;
00037 
00038 namespace KRES {
00039 
00040 class KRESOURCES_EXPORT ResourcePageInfo : public KShared
00041 {
00042   public:
00043     ResourcePageInfo();
00044     ~ResourcePageInfo();
00045     Manager<Resource> *mManager;
00046     KConfig *mConfig;
00047 };
00048 
00049 class Resource;
00050 class ConfigViewItem;
00051 
00052 class KRESOURCES_EXPORT ConfigPage : public QWidget, public ManagerObserver<Resource>
00053 {
00054   Q_OBJECT
00055 
00056   public:
00057     ConfigPage( QWidget *parent = 0, const char *name = 0 );
00058     virtual ~ConfigPage();
00059 
00060     void load();
00061     void save();
00062     virtual void defaults();
00063 
00064   public slots:
00065     void slotFamilyChanged( int );
00066     void slotAdd();
00067     void slotRemove();
00068     void slotEdit();
00069     void slotStandard();
00070     void slotSelectionChanged();
00071 
00072   public:
00073     // From ManagerObserver<Resource>
00074     virtual void resourceAdded( Resource *resource );
00075     virtual void resourceModified( Resource *resource );
00076     virtual void resourceDeleted( Resource *resource );
00077 
00078   protected:
00079     ConfigViewItem *findItem( Resource *resource );
00080 
00081   protected slots:
00082     void slotItemClicked( QListViewItem * );
00083 
00084   signals:
00085     void changed( bool );
00086 
00087   private:
00088     void loadManager( const QString& family );
00089     void saveResourceSettings();
00090 
00091     Manager<Resource>* mCurrentManager;
00092     KConfig* mCurrentConfig;
00093     KConfig* mConfig;
00094     QString mFamily;
00095     QStringList mFamilyMap;
00096     QValueList<KSharedPtr<ResourcePageInfo> > mInfoMap;
00097 
00098     KComboBox* mFamilyCombo;
00099     KListView* mListView;
00100     QPushButton* mAddButton;
00101     QPushButton* mRemoveButton;
00102     QPushButton* mEditButton;
00103     QPushButton* mStandardButton;
00104 
00105     QListViewItem* mLastItem;
00106 };
00107 
00108 }
00109 
00110 #endif
KDE Home | KDE Accessibility Home | Description of Access Keys