kspread

kspread_dlg_database.h

00001 /* This file is part of the KDE project
00002    Copyright (C) 2002-2003 Norbert Andres <nandres@web.de>
00003              (C) 2002 Ariya Hidayat <ariya@kde.org>
00004              (C) 2002 Laurent Montel <montel@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 
00022 #ifndef __kspread_dlg_database__
00023 #define __kspread_dlg_database__
00024 
00025 #include <qdialog.h>
00026 #include <qrect.h>
00027 
00028 #include <kwizard.h>
00029 
00030 class QCheckBox;
00031 class QComboBox;
00032 class QFrame;
00033 class QGridLayout;
00034 class QLabel;
00035 class QLineEdit;
00036 class QListViewItem;
00037 class QHBoxLayout;
00038 class QRadioButton;
00039 class QSqlDatabase;
00040 class QTextEdit;
00041 class QVBoxLayout;
00042 class QWidget;
00043 
00044 class KListView;
00045 class KPushButton;
00046 namespace KSpread
00047 {
00048 class View;
00049 
00050 class DatabaseDialog : public KWizard
00051 {
00052   Q_OBJECT
00053 
00054  public:
00055   enum PageId { eDatabase = 0, eSheets = 1, eColumns = 2, eOptions = 3, eResult = 4 };
00056 
00057   DatabaseDialog( View * parent, QRect const & rect, const char * name = 0, bool modal = FALSE, WFlags fl = 0 );
00058   virtual ~DatabaseDialog();
00059 
00060  private slots:
00061   void orBox_clicked();
00062   void andBox_clicked();
00063   void startingCell_clicked();
00064   void startingRegion_clicked();
00065   void connectButton_clicked();
00066   void databaseNameChanged( const QString & s );
00067   void databaseHostChanged( const QString & s );
00068   void databaseDriverChanged( int );
00069   void popupSheetViewMenu( QListViewItem *, const QPoint &, int );
00070   void sheetViewClicked( QListViewItem * );
00071   void accept();
00072 
00073  protected:
00074   void next();
00075   void back();
00076 
00077   QGridLayout  * m_databaseLayout;
00078   QGridLayout  * m_sheetLayout;
00079   QGridLayout  * m_columnsLayout;
00080   QGridLayout  * m_optionsLayout;
00081   QGridLayout  * m_resultLayout;
00082 
00083  private:
00084   int            m_currentPage;
00085   View  * m_pView;
00086   QRect          m_targetRect;
00087   QSqlDatabase * m_dbConnection;
00088 
00089   QWidget      * m_database;
00090   QLabel       * m_databaseStatus;
00091   QLineEdit    * m_username;
00092   QLineEdit    * m_port;
00093   QLineEdit    * m_databaseName;
00094   QComboBox    * m_driver;
00095   QLineEdit    * m_password;
00096   QLineEdit    * m_host;
00097   QLabel       * m_Type;
00098   QWidget      * m_sheet;
00099   QComboBox    * m_databaseList;
00100   KPushButton  * m_connectButton;
00101   QLabel       * m_sheetStatus;
00102   QLabel       * m_SelectSheetLabel;
00103   KListView    * m_sheetView;
00104   QWidget      * m_columns;
00105   KListView    * m_columnView;
00106   QLabel       * m_columnsStatus;
00107   QWidget      * m_options;
00108   QComboBox    * m_columns_1;
00109   QComboBox    * m_columns_2;
00110   QComboBox    * m_columns_3;
00111   QComboBox    * m_operator_1;
00112   QComboBox    * m_operator_2;
00113   QComboBox    * m_operator_3;
00114   QLineEdit    * m_operatorValue_1;
00115   QLineEdit    * m_operatorValue_2;
00116   QLineEdit    * m_operatorValue_3;
00117   QRadioButton * m_andBox;
00118   QRadioButton * m_orBox;
00119   QComboBox    * m_columnsSort_1;
00120   QComboBox    * m_columnsSort_2;
00121   QComboBox    * m_sortMode_1;
00122   QComboBox    * m_sortMode_2;
00123   QCheckBox    * m_distinct;
00124   QWidget      * m_result;
00125   QTextEdit    * m_sqlQuery;
00126   QRadioButton * m_startingRegion;
00127   QLineEdit    * m_cell;
00128   QLineEdit    * m_region;
00129   QRadioButton * m_startingCell;
00130 
00131   void switchPage( int id );
00132   bool databaseDoNext();
00133   bool sheetsDoNext();
00134   bool columnsDoNext();
00135   bool optionsDoNext();
00136 
00137   QString exchangeWildcards(QString const & value);
00138   QString getWhereCondition( QString const &, QString const &, int );
00139 };
00140 
00141 } // namespace KSpread
00142 
00143 #endif
KDE Home | KDE Accessibility Home | Description of Access Keys