kexi

KexiProjectSelector.h

00001 /* This file is part of the KDE project
00002    Copyright (C) 2003 Jaroslaw Staniek <js@iidea.pl>
00003 
00004    This program is free software; you can redistribute it and/or
00005    modify it under the terms of the GNU Library General Public
00006    License as published by the Free Software Foundation; either
00007    version 2 of the License, or (at your option) any later version.
00008 
00009    This program is distributed in the hope that it will be useful,
00010    but WITHOUT ANY WARRANTY; without even the implied warranty of
00011    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
00012    Library General Public License for more details.
00013 
00014    You should have received a copy of the GNU Library General Public License
00015    along with this program; see the file COPYING.  If not, write to
00016    the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
00017  * Boston, MA 02110-1301, USA.
00018  */
00019 
00020 #ifndef KEXIPROJECTSELECTOR_H
00021 #define KEXIPROJECTSELECTOR_H
00022 
00023 #include "KexiProjectSelectorBase.h"
00024 #include "kexiprojectset.h"
00025 
00026 #include <kdialogbase.h>
00027 #include <qwidgetstack.h>
00028 
00029 class KexiNewFileDBWidget;
00030 class KexiProjectSelectorWidgetPrivate;
00031 
00034 class KEXIMAIN_EXPORT KexiProjectSelectorWidget : public KexiProjectSelectorBase
00035 {
00036     Q_OBJECT
00037 
00038 public:
00039 //  enum ConnType { FileBased=1, ServerBased=2 };
00040 
00047     KexiProjectSelectorWidget( QWidget* parent = 0, const char* name = 0, 
00048         KexiProjectSet* prj_set = 0, bool showProjectNameColumn = true,
00049         bool showConnectionColumns = true );
00050     
00051     ~KexiProjectSelectorWidget();
00052     
00055     KexiProjectData* selectedProjectData() const;
00056 
00060     void setProjectSet( KexiProjectSet* prj_set );
00061     
00063     inline KexiProjectSet *projectSet() { return m_prj_set; }
00064 
00068     void setSelectable(bool set);
00069     
00071     bool isSelectable() const;
00072 
00073 public slots:
00074     
00075 signals:
00076     void projectExecuted(KexiProjectData*);
00077     void selectionChanged(KexiProjectData*);
00078 
00079 protected slots:
00080     void slotItemExecuted(QListViewItem*);
00081     void slotItemSelected();
00082     virtual void languageChange() { KexiProjectSelectorBase::languageChange(); }
00083 
00084 protected:
00085     KexiProjectSet *m_prj_set;
00086     
00087     KexiProjectSelectorWidgetPrivate *d;
00088     
00089     friend class ProjectDataLVItem;
00090 };
00091 
00093 class KexiProjectSelectorDialog : public KDialogBase
00094 {
00095     Q_OBJECT
00096 public:
00100     KexiProjectSelectorDialog( QWidget *parent, const char *name,
00101         KexiProjectSet* prj_set, 
00102         bool showProjectNameColumn = true, bool showConnectionColumns = true);
00103 
00108     KexiProjectSelectorDialog( QWidget *parent, const char *name,
00109         KexiDB::ConnectionData* cdata, 
00110         bool showProjectNameColumn = true, bool showConnectionColumns = true);
00111     
00112     ~KexiProjectSelectorDialog();
00113     
00116     KexiProjectData* selectedProjectData() const;
00117 
00119     inline KexiProjectSet *projectSet() { return m_sel->projectSet(); }
00120 
00121     virtual void show();
00122 
00123 protected slots:
00124     void slotProjectExecuted(KexiProjectData*);
00125     void slotProjectSelectionChanged(KexiProjectData*);
00126 
00127 protected:
00128     void init(KexiProjectSet* prj_set, bool showProjectNameColumn, bool showConnectionColumns);
00129     
00130     KexiProjectSelectorWidget* m_sel;
00131 };
00132 
00133 #endif
00134 
KDE Home | KDE Accessibility Home | Description of Access Keys