File indexing completed on 2024-05-12 16:40:15
0001 /* This file is part of the KDE project 0002 Copyright (C) 2004 Adam Pigg <adam@piggz.co.uk> 0003 Copyright (C) 2004-2016 Jarosław Staniek <staniek@kde.org> 0004 Copyright (C) 2005 Martin Ellis <martin.ellis@kdemail.net> 0005 0006 This library is free software; you can redistribute it and/or 0007 modify it under the terms of the GNU Library General Public 0008 License as published by the Free Software Foundation; either 0009 version 2 of the License, or (at your option) any later version. 0010 0011 This library is distributed in the hope that it will be useful, 0012 but WITHOUT ANY WARRANTY; without even the implied warranty of 0013 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 0014 Library General Public License for more details. 0015 0016 You should have received a copy of the GNU Library General Public License 0017 along with this library; see the file COPYING.LIB. If not, write to 0018 the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, 0019 * Boston, MA 02110-1301, USA. 0020 */ 0021 0022 #ifndef KEXIMIGRATIONIMPORTWIZARD_H 0023 #define KEXIMIGRATIONIMPORTWIZARD_H 0024 0025 #include "migratemanager.h" 0026 0027 #include <KDbTristate> 0028 0029 #include <KAssistantDialog> 0030 0031 #include <QLabel> 0032 0033 class QMimeType; 0034 class QLabel; 0035 class KPageWidgetItem; 0036 0037 namespace Kexi 0038 { 0039 class ObjectStatus; 0040 } 0041 0042 namespace KexiMigration 0043 { 0044 0045 class KexiMigrate; 0046 0047 //! GUI for importing external databases (file-based and server-based) 0048 class KEXIMIGRATE_EXPORT ImportWizard : public KAssistantDialog 0049 { 0050 Q_OBJECT 0051 public: 0052 /*! Creates wizard's instance. 0053 \a args contains arguments that can be parsed by parseArguments(). 0054 \a *arg will be also set to imported project's filename on success 0055 and to null value on failure or cancellation. */ 0056 explicit ImportWizard(QWidget *parent = 0, QMap<QString, QString>* args = 0); 0057 virtual ~ImportWizard(); 0058 0059 public Q_SLOTS: 0060 void progressUpdated(int percent); 0061 0062 protected Q_SLOTS: 0063 virtual void next() override; 0064 virtual void back() override; 0065 void slot_currentPageChanged(KPageWidgetItem*,KPageWidgetItem*); 0066 virtual void accept() override; 0067 virtual void reject() override; 0068 void helpClicked(); 0069 void slotOptionsButtonClicked(); 0070 void destinationCaptionTextChanged(const QString &text); 0071 void sourceConnectionSelected(bool selected); 0072 0073 private: 0074 void parseArguments(); 0075 0076 void setupIntro(); 0077 void setupSrcConn(); 0078 void setupSrcDB(); 0079 void setupDstType(); 0080 void setupDstCaption(); 0081 void setupDst(); 0082 void setupFinish(); 0083 void setupImportType(); 0084 void setupImporting(); 0085 bool checkUserInput(); 0086 0087 KexiMigrate* prepareImport(Kexi::ObjectStatus& result); 0088 0089 /*! Performs import. \return true/false on success/faulure 0090 or cancelled when user cancelled importing (mainly 0091 because didn't allow overwriting an existing database by a new one). */ 0092 tristate import(); 0093 0094 bool fileBasedSrcSelected() const; 0095 bool fileBasedDstSelected() const; 0096 QString driverIdForSelectedSource() const; 0097 QString driverIdForMimeType(const QMimeType &mime) const; 0098 QString findDriverIdForSelectedSource(); 0099 0100 void arriveSrcConnPage(); 0101 void arriveSrcDBPage(); 0102 void arriveDstCaptionPage(); 0103 void arriveDstPage(); 0104 void arriveFinishPage(); 0105 void arriveImportingPage(); 0106 0107 //! @return source filename selected by user or preselected one (if present) 0108 QString selectedSourceFileName() const; 0109 0110 void updateDestinationDBFileName(); 0111 0112 class Private; 0113 Private * const d; 0114 }; 0115 0116 } 0117 0118 #endif