kexi

importwizard.h

00001 /* This file is part of the KDE project
00002    Copyright (C) 2004 Adam Pigg <adam@piggz.co.uk>
00003    Copyright (C) 2004-2006 Jaroslaw Staniek <js@iidea.pl>
00004    Copyright (C) 2005 Martin Ellis <martin.ellis@kdemail.net>
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 KEXIMIGRATIONIMPORTWIZARD_H
00023 #define KEXIMIGRATIONIMPORTWIZARD_H
00024 
00025 #include <kwizard.h>
00026 #include <kprogress.h>
00027 #include <kapplication.h>
00028 
00029 #include <kexiutils/tristate.h> 
00030 #include "migratemanager.h"
00031 
00032 class QLabel;
00033 class QCheckBox;
00034 class QPushButton;
00035 class QHBoxLayout;
00036 class QVBoxLayout;
00037 class QVButtonGroup;
00038 class KComboBox;
00039 class KListView;
00040 class KLineEdit;
00041 class KActiveLabel;
00042 class KexiConnSelectorWidget;
00043 class KexiProjectSelectorWidget;
00044 class KexiProjectSet;
00045 class KexiDBTitlePage;
00046 class KexiDBDriverComboBox;
00047 
00048 namespace Kexi
00049 {
00050     class ObjectStatus;
00051 }
00052 
00053 namespace KexiDB
00054 {
00055     class ConnectionData;
00056 }
00057 
00058 namespace KexiMigration {
00059 
00060 class KexiMigrate;
00061 
00063 class KEXIMIGR_EXPORT ImportWizard : public KWizard
00064 {
00065 Q_OBJECT
00066 public:
00071     ImportWizard(QWidget *parent = 0, QMap<QString,QString>* args = 0);
00072     virtual ~ImportWizard();
00073 
00074 public slots:
00075     void progressUpdated(int percent);
00076 
00077 protected slots:
00078     virtual void next();
00079     virtual void back();
00080     void pageSelected(const QString &);
00081     virtual void accept();
00082     virtual void reject();
00083     void helpClicked();
00084     void slotOptionsButtonClicked();
00085 
00086 private:
00087     void parseArguments();
00088     void setupIntro();
00089 //  void setupSrcType();
00090     void setupSrcConn();
00091     void setupSrcDB();
00092     void setupDstType();
00093     void setupDstTitle();
00094     void setupDst();
00095     void setupFinish();
00096     void setupImportType();
00097     void setupImporting();
00098     bool checkUserInput();
00099 
00100     KexiMigrate* prepareImport(Kexi::ObjectStatus& result);
00101 
00105     tristate import();
00106 
00107     bool fileBasedSrcSelected() const;
00108     bool fileBasedDstSelected() const;
00109     QString driverNameForSelectedSource();
00110 //  void checkIfSrcTypeFileBased(const QString& srcType);
00111 //  void checkIfDstTypeFileBased(const QString& dstType);
00112 
00113     void arriveSrcConnPage();
00114     void arriveSrcDBPage();
00115     void arriveDstTitlePage();
00116     void arriveDstPage();
00117     void arriveFinishPage();
00118     void arriveImportingPage();
00119 
00120     QWidget *m_introPage, /* *m_srcTypePage,*/ *m_srcConnPage, *m_srcDBPage, 
00121         *m_dstTypePage, *m_dstPage, *m_importTypePage, *m_importingPage, *m_finishPage;
00122 
00123     QVButtonGroup *m_importTypeButtonGroup;
00124     KexiDBTitlePage* m_dstTitlePage;
00125 
00126     KComboBox *m_srcTypeCombo;
00127     KexiDBDriverComboBox *m_dstTypeCombo;
00128 
00129     KexiConnSelectorWidget *m_srcConn, *m_dstConn;
00130     KLineEdit *m_dstNewDBNameLineEdit;
00131     KexiProjectSelectorWidget *m_srcDBName;
00132 
00133     QLabel *m_lblImportingTxt;
00134     KActiveLabel *m_lblImportingErrTxt, *m_finishLbl;
00135     QCheckBox *m_openImportedProjectCheckBox;
00136     bool m_fileBasedDstWasPresented, m_setupFileBasedSrcNeeded, 
00137         m_importExecuted; 
00138     KexiProjectSet* m_prjSet;
00139     KProgress *m_progressBar;
00140     QPushButton* m_importOptionsButton;
00141     QMap<QString,QString> *m_args;
00142     QString m_predefinedDatabaseName, m_predefinedMimeType;
00143     KexiDB::ConnectionData *m_predefinedConnectionData;
00144     MigrateManager m_migrateManager; 
00145 
00148     QString m_sourceDBEncoding;
00149 };
00150 
00151 }
00152 
00153 #endif
KDE Home | KDE Accessibility Home | Description of Access Keys