kexi

KexiConnSelector.h

00001 /* This file is part of the KDE project
00002    Copyright (C) 2003,2005 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 KEXICONNSELECTOR_H
00021 #define KEXICONNSELECTOR_H
00022 
00023 #include <kexidbconnectionset.h>
00024 #include <kexidb/driver.h>
00025 #include "KexiStartupFileDialog.h"
00026 
00027 #include <kdialogbase.h>
00028 #include <klistview.h>
00029 
00030 #include <qguardedptr.h>
00031 
00032 class KexiConnSelectorBase;
00033 
00035 class ConnectionDataLVItem : public QListViewItem
00036 {
00037     public:
00038         ConnectionDataLVItem(KexiDB::ConnectionData *data, 
00039             const KexiDB::Driver::Info& info, QListView *list);
00040         ~ConnectionDataLVItem();
00041 
00042         void update(const KexiDB::Driver::Info& info);
00043         KexiDB::ConnectionData *data() const { return m_data; }
00044     
00045     protected:
00046         KexiDB::ConnectionData *m_data;
00047 };
00048 
00049 
00050 //class KexiOpenExistingFile;
00051 class KexiConnSelectorWidgetPrivate;
00052 
00055 class KEXIMAIN_EXPORT KexiConnSelectorWidget : public QWidget
00056 {
00057     Q_OBJECT
00058 
00059     public:
00060         enum ConnType { FileBased=1, ServerBased=2 };
00061 
00067         KexiConnSelectorWidget( KexiDBConnectionSet& conn_set, 
00068             const QString& startDirOrVariable, 
00069             QWidget* parent = 0, const char* name = 0 );
00070 
00071         virtual ~KexiConnSelectorWidget();
00072         
00075         int selectedConnectionType() const;
00076 
00082         KexiDB::ConnectionData* selectedConnectionData() const;
00083 
00089         QString selectedFileName();
00090 
00093         void setSelectedFileName(const QString& fileName);
00094 
00095 //      //! Usable when we want to do other things for "back" button
00096 //      void disconnectShowSimpleConnButton();
00097 
00098         QListView* connectionsList() const;
00099         
00100         KexiConnSelectorBase *m_remote;
00101 //      KexiOpenExistingFile *m_file;
00102         KexiStartupFileDialog *m_fileDlg;
00103 
00106         void setConfirmOverwrites(bool set);
00107 
00108         bool confirmOverwrites() const;
00109 
00110     signals:
00111         void connectionItemExecuted(ConnectionDataLVItem *item);
00112         void connectionItemHighlighted(ConnectionDataLVItem *item);
00113 
00114     public slots:
00115         void showSimpleConn();
00116         void showAdvancedConn();
00117         virtual void setFocus();
00118         
00124         void hideHelpers();
00125         void hideConnectonIcon();
00126 
00127     protected slots:
00128         void slotConnectionItemExecuted(QListViewItem *item);
00129         void slotRemoteAddBtnClicked();
00130         void slotRemoteEditBtnClicked();
00131         void slotRemoteRemoveBtnClicked();
00132         void slotConnectionSelectionChanged();
00133         void slotPrjTypeSelected(int id);
00134 
00135     private:
00136         ConnectionDataLVItem* addConnectionData( KexiDB::ConnectionData* data );
00137         ConnectionDataLVItem* selectedConnectionDataItem() const;
00138         
00139         KexiConnSelectorWidgetPrivate *d;
00140 };
00141 
00142 #endif // KEXICONNSELECTOR_H
KDE Home | KDE Accessibility Home | Description of Access Keys