File indexing completed on 2024-05-05 05:51:37
0001 #pragma once 0002 /* Description : Kate CTags plugin 0003 * 0004 * SPDX-FileCopyrightText: 2008-2011 Kare Sars <kare.sars@iki.fi> 0005 * 0006 * This program is free software; you can redistribute it and/or 0007 * modify it under the terms of the GNU General Public 0008 * License as published by the Free Software Foundation; either 0009 * version 2.1 of the License, or (at your option) version 3, or any 0010 * later version accepted by the membership of KDE e.V. (or its 0011 * successor approved by the membership of KDE e.V.), which shall 0012 * act as a proxy defined in Section 6 of version 3 of the license. 0013 * 0014 * This program is distributed in the hope that it will be useful, 0015 * but WITHOUT ANY WARRANTY; without even the implied warranty of 0016 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 0017 * General Public License for more details. 0018 * 0019 * You should have received a copy of the GNU General Public 0020 * License along with this program. If not, see <http://www.gnu.org/licenses/>. 0021 */ 0022 0023 #include <ktexteditor/document.h> 0024 #include <ktexteditor/view.h> 0025 0026 #include <KTextEditor/ConfigPage> 0027 #include <KTextEditor/Plugin> 0028 #include <ktexteditor/application.h> 0029 #include <ktexteditor/mainwindow.h> 0030 0031 #include "kate_ctags_view.h" 0032 #include "ui_CTagsGlobalConfig.h" 0033 0034 //******************************************************************/ 0035 class KateCTagsPlugin : public KTextEditor::Plugin 0036 { 0037 Q_OBJECT 0038 0039 public: 0040 explicit KateCTagsPlugin(QObject *parent = nullptr, const QVariantList & = QVariantList()); 0041 ~KateCTagsPlugin() override 0042 { 0043 } 0044 0045 QObject *createView(KTextEditor::MainWindow *mainWindow) override; 0046 0047 int configPages() const override 0048 { 0049 return 1; 0050 } 0051 KTextEditor::ConfigPage *configPage(int number = 0, QWidget *parent = nullptr) override; 0052 void readConfig(); 0053 0054 KateCTagsView *m_view = nullptr; 0055 }; 0056 0057 //******************************************************************/ 0058 class KateCTagsConfigPage : public KTextEditor::ConfigPage 0059 { 0060 Q_OBJECT 0061 public: 0062 explicit KateCTagsConfigPage(QWidget *parent = nullptr); 0063 ~KateCTagsConfigPage() override 0064 { 0065 } 0066 0067 QString name() const override; 0068 QString fullName() const override; 0069 QIcon icon() const override; 0070 0071 void apply() override; 0072 void reset() override; 0073 void defaults() override 0074 { 0075 } 0076 0077 private Q_SLOTS: 0078 void addGlobalTagTarget(); 0079 void delGlobalTagTarget(); 0080 void updateGlobalDB(); 0081 void updateDone(int exitCode, QProcess::ExitStatus status); 0082 0083 private: 0084 bool listContains(const QString &target); 0085 0086 QProcess m_proc; 0087 Ui_CTagsGlobalConfig m_confUi{}; 0088 };