File indexing completed on 2024-04-21 05:48:59
0001 /* 0002 SPDX-FileCopyrightText: 2010 Marco Mentasti <marcomentasti@gmail.com> 0003 0004 SPDX-License-Identifier: LGPL-2.0-only 0005 */ 0006 0007 #pragma once 0008 0009 class SQLManager; 0010 class KComboBox; 0011 class KLineEdit; 0012 class KPasswordLineEdit; 0013 class QSpinBox; 0014 class KUrlRequester; 0015 0016 #include "connection.h" 0017 0018 #include <qwizard.h> 0019 0020 class ConnectionWizard : public QWizard 0021 { 0022 public: 0023 enum { Page_Driver, Page_Standard_Server, Page_SQLite_Server, Page_Save }; 0024 0025 ConnectionWizard(SQLManager *manager, Connection *conn, QWidget *parent = nullptr, Qt::WindowFlags flags = {}); 0026 ~ConnectionWizard() override; 0027 0028 SQLManager *manager() 0029 { 0030 return m_manager; 0031 } 0032 Connection *connection() 0033 { 0034 return m_connection; 0035 } 0036 0037 private: 0038 SQLManager *m_manager; 0039 Connection *m_connection; 0040 }; 0041 0042 class ConnectionDriverPage : public QWizardPage 0043 { 0044 public: 0045 explicit ConnectionDriverPage(QWidget *parent = nullptr); 0046 void initializePage() override; 0047 int nextId() const override; 0048 0049 private: 0050 KComboBox *driverComboBox; 0051 }; 0052 0053 class ConnectionStandardServerPage : public QWizardPage 0054 { 0055 public: 0056 explicit ConnectionStandardServerPage(QWidget *parent = nullptr); 0057 ~ConnectionStandardServerPage() override; 0058 void initializePage() override; 0059 bool validatePage() override; 0060 int nextId() const override; 0061 0062 private: 0063 KLineEdit *hostnameLineEdit; 0064 KLineEdit *usernameLineEdit; 0065 KPasswordLineEdit *passwordLineEdit; 0066 KLineEdit *databaseLineEdit; 0067 KLineEdit *optionsLineEdit; 0068 QSpinBox *portSpinBox; 0069 }; 0070 0071 class ConnectionSQLiteServerPage : public QWizardPage 0072 { 0073 public: 0074 explicit ConnectionSQLiteServerPage(QWidget *parent = nullptr); 0075 void initializePage() override; 0076 bool validatePage() override; 0077 int nextId() const override; 0078 0079 private: 0080 // KLineEdit *pathLineEdit; 0081 KUrlRequester *pathUrlRequester; 0082 0083 KLineEdit *optionsLineEdit; 0084 }; 0085 0086 class ConnectionSavePage : public QWizardPage 0087 { 0088 public: 0089 explicit ConnectionSavePage(QWidget *parent = nullptr); 0090 void initializePage() override; 0091 bool validatePage() override; 0092 int nextId() const override; 0093 0094 private: 0095 KLineEdit *connectionNameLineEdit; 0096 };