1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144
|
/* This file is part of the KDE project
Copyright (C) 2002-2003 Norbert Andres <nandres@web.de>
(C) 2002 Ariya Hidayat <ariya@kde.org>
(C) 2002 Laurent Montel <montel@kde.org>
This library is free software; you can redistribute it and/or
modify it under the terms of the GNU Library General Public
License as published by the Free Software Foundation; either
version 2 of the License, or (at your option) any later version.
This library is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
Library General Public License for more details.
You should have received a copy of the GNU Library General Public License
along with this library; see the file COPYING.LIB. If not, write to
the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
Boston, MA 02110-1301, USA.
*/
#ifndef CALLIGRA_SHEETS_DATABASE_DIALOG
#define CALLIGRA_SHEETS_DATABASE_DIALOG
#include <QRect>
#include <QFrame>
#include <QLabel>
#include <kassistantdialog.h>
#include <QSqlDatabase>
class QCheckBox;
class KComboBox;
class QFrame;
class QLabel;
class KLineEdit;
class QTreeWidget;
class QListWidget;
class QListWidgetItem;
class QRadioButton;
class KTextEdit;
class KPageWidgetItem;
class KPushButton;
namespace Calligra
{
namespace Sheets
{
class Selection;
/**
* \ingroup UI
* Dialog to import data from a database.
*/
class DatabaseDialog : public KAssistantDialog
{
Q_OBJECT
public:
enum PageId { eDatabase = 0, eTables = 1, eColumns = 2, eOptions = 3, eResult = 4 };
DatabaseDialog(QWidget* parent, Selection* selection);
virtual ~DatabaseDialog();
private slots:
void orBox_clicked();
void andBox_clicked();
void startingCell_clicked();
void startingRegion_clicked();
void connectButton_clicked();
void databaseNameChanged(const QString & s);
void databaseHostChanged(const QString & s);
void databaseDriverChanged(int);
//void popupTableViewMenu( QListWidgetItem *, const QPoint &, int );
void tableViewClicked(QListWidgetItem *);
void accept();
protected:
void next();
void back();
private:
int m_currentPage;
Selection * m_selection;
QRect m_targetRect;
QSqlDatabase m_dbConnection;
KPageWidgetItem * m_database;
QLabel * m_databaseStatus;
KLineEdit * m_username;
KLineEdit * m_port;
KLineEdit * m_databaseName;
KComboBox * m_driver;
KLineEdit * m_password;
KLineEdit * m_host;
QLabel * m_Type;
KPageWidgetItem * m_table;
KComboBox * m_databaseList;
KPushButton * m_connectButton;
QLabel * m_tableStatus;
QLabel * m_SelectTableLabel;
QListWidget * m_tableView;
KPageWidgetItem * m_columns;
QTreeWidget * m_columnView;
QLabel * m_columnsStatus;
KPageWidgetItem * m_options;
KComboBox * m_columns_1;
KComboBox * m_columns_2;
KComboBox * m_columns_3;
KComboBox * m_operator_1;
KComboBox * m_operator_2;
KComboBox * m_operator_3;
KLineEdit * m_operatorValue_1;
KLineEdit * m_operatorValue_2;
KLineEdit * m_operatorValue_3;
QRadioButton * m_andBox;
QRadioButton * m_orBox;
KComboBox * m_columnsSort_1;
KComboBox * m_columnsSort_2;
KComboBox * m_sortMode_1;
KComboBox * m_sortMode_2;
QCheckBox * m_distinct;
KPageWidgetItem * m_result;
KTextEdit * m_sqlQuery;
QRadioButton * m_startingRegion;
KLineEdit * m_cell;
KLineEdit * m_region;
QRadioButton * m_startingCell;
void switchPage(int id);
bool databaseDoNext();
bool tablesDoNext();
bool columnsDoNext();
bool optionsDoNext();
QString exchangeWildcards(QString const & value);
QString getWhereCondition(QString const &, QString const &, int);
};
} // namespace Sheets
} // namespace Calligra
#endif // CALLIGRA_SHEETS_DATABASE_DIALOG
|