File indexing completed on 2024-05-12 09:54:49
0001 /* 0002 SPDX-FileCopyrightText: 2010 Marco Mentasti <marcomentasti@gmail.com> 0003 0004 This library is free software; you can redistribute it and/or 0005 modify it under the terms of the GNU Library General Public 0006 License version 2 as published by the Free Software Foundation. 0007 0008 This library is distributed in the hope that it will be useful, 0009 but WITHOUT ANY WARRANTY; without even the implied warranty of 0010 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 0011 Library General Public License for more details. 0012 0013 You should have received a copy of the GNU Library General Public License 0014 along with this library; see the file COPYING.LIB. If not, write to 0015 the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, 0016 Boston, MA 02110-1301, USA 0017 */ 0018 0019 #pragma once 0020 0021 class KateSQLOutputWidget; 0022 class SchemaBrowserWidget; 0023 class SQLManager; 0024 0025 class KConfigBase; 0026 class KComboBox; 0027 0028 class QSqlQuery; 0029 class QActionGroup; 0030 0031 #include <KXMLGUIClient> 0032 0033 #include <ktexteditor/mainwindow.h> 0034 #include <ktexteditor/sessionconfiginterface.h> 0035 0036 class KateSQLView : public QObject, public KXMLGUIClient, public KTextEditor::SessionConfigInterface 0037 { 0038 Q_OBJECT 0039 Q_INTERFACES(KTextEditor::SessionConfigInterface) 0040 public: 0041 KateSQLView(KTextEditor::Plugin *plugin, KTextEditor::MainWindow *mw); 0042 ~KateSQLView() override; 0043 0044 void readSessionConfig(const KConfigGroup &group) override; 0045 void writeSessionConfig(KConfigGroup &group) override; 0046 0047 SchemaBrowserWidget *schemaBrowserWidget() const 0048 { 0049 return m_schemaBrowserWidget; 0050 } 0051 0052 public Q_SLOTS: 0053 void slotConnectionCreate(); 0054 void slotConnectionEdit(); 0055 void slotConnectionRemove(); 0056 void slotConnectionReconnect(); 0057 void slotConnectionChanged(int currentIndex); 0058 void slotRunQuery(); 0059 void slotError(const QString &message); 0060 void slotSuccess(const QString &message); 0061 void slotQueryActivated(QSqlQuery &query, const QString &connection); 0062 void slotConnectionCreated(const QString &name); 0063 void slotGlobalSettingsChanged(); 0064 void slotSQLMenuAboutToShow(); 0065 void slotConnectionSelectedFromMenu(QAction *action); 0066 void slotConnectionAboutToBeClosed(const QString &name); 0067 0068 protected: 0069 void setupActions(); 0070 0071 private: 0072 QWidget *m_outputToolView; 0073 QWidget *m_schemaBrowserToolView; 0074 QActionGroup *m_connectionsGroup; 0075 0076 KateSQLOutputWidget *m_outputWidget; 0077 0078 SchemaBrowserWidget *m_schemaBrowserWidget; 0079 0080 KComboBox *m_connectionsComboBox; 0081 0082 SQLManager *m_manager; 0083 0084 QString m_currentResultsetConnection; 0085 0086 KTextEditor::MainWindow *m_mainWindow; 0087 };