File indexing completed on 2024-05-19 05:05:46
0001 /*************************************************************************** 0002 * SPDX-License-Identifier: GPL-2.0-or-later 0003 * * 0004 * SPDX-FileCopyrightText: 2004-2020 Thomas Fischer <fischer@unix-ag.uni-kl.de> 0005 * * 0006 * This program is free software; you can redistribute it and/or modify * 0007 * it under the terms of the GNU General Public License as published by * 0008 * the Free Software Foundation; either version 2 of the License, or * 0009 * (at your option) any later version. * 0010 * * 0011 * This program 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 * 0014 * GNU General Public License for more details. * 0015 * * 0016 * You should have received a copy of the GNU General Public License * 0017 * along with this program; if not, see <https://www.gnu.org/licenses/>. * 0018 ***************************************************************************/ 0019 0020 #ifndef KBIBTEX_PART_PART_H 0021 #define KBIBTEX_PART_PART_H 0022 0023 #include <QObject> 0024 0025 #include <kparts_version.h> 0026 #include <KParts/Part> 0027 #include <KParts/ReadWritePart> 0028 0029 #include <NotificationHub> 0030 #include <file/PartWidget> 0031 0032 #if KPARTS_VERSION >= 0x054D00 // >= 5.77.0 0033 class KPluginMetaData; 0034 #else // KPARTS_VERSION < 0x054D00 // < 5.77.0 0035 class KAboutData; 0036 #endif // KPARTS_VERSION >= 0x054D00 // >= 5.77.0 0037 0038 class KBibTeXPart : public KParts::ReadWritePart, private NotificationListener 0039 { 0040 Q_OBJECT 0041 0042 friend class KBibTeXBrowserExtension; 0043 0044 public: 0045 KBibTeXPart(QWidget *parentWidget, QObject *parent, 0046 #if KPARTS_VERSION >= 0x054D00 // >= 5.77.0 0047 const KPluginMetaData &metaData 0048 #else // KPARTS_VERSION < 0x054D00 // < 5.77.0 0049 const KAboutData &componentData 0050 #endif // KPARTS_VERSION >= 0x054D00 // >= 5.77.0 0051 , const QVariantList &); 0052 ~KBibTeXPart() override; 0053 0054 void setModified(bool modified) override; 0055 0056 void notificationEvent(int eventId) override; 0057 0058 protected: 0059 bool openFile() override; 0060 bool saveFile() override; 0061 0062 protected: 0063 void setupActions(); 0064 0065 protected Q_SLOTS: 0066 bool documentSave(); 0067 bool documentSaveAs(); 0068 bool documentSaveCopyAs(); 0069 bool documentSaveSelection(); 0070 void elementViewDocument(); 0071 void elementFindPDF(); 0072 void applyDefaultFormatString(); 0073 0074 private Q_SLOTS: 0075 void newEntryTriggered(); 0076 void newMacroTriggered(); 0077 void newCommentTriggered(); 0078 void newPreambleTriggered(); 0079 void updateActions(); 0080 void fileExternallyChange(const QString &path); 0081 0082 private: 0083 class KBibTeXPartPrivate; 0084 KBibTeXPartPrivate *const d; 0085 }; 0086 0087 #endif // KBIBTEX_PART_PART_H