1 /*************************************************************************** 2 * Copyright (C) 2004-2017 by Thomas Fischer <fischer@unix-ag.uni-kl.de> * 3 * * 4 * This program is free software; you can redistribute it and/or modify * 5 * it under the terms of the GNU General Public License as published by * 6 * the Free Software Foundation; either version 2 of the License, or * 7 * (at your option) any later version. * 8 * * 9 * This program is distributed in the hope that it will be useful, * 10 * but WITHOUT ANY WARRANTY; without even the implied warranty of * 11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * 12 * GNU General Public License for more details. * 13 * * 14 * You should have received a copy of the GNU General Public License * 15 * along with this program; if not, see <https://www.gnu.org/licenses/>. * 16 ***************************************************************************/ 17 18 #ifndef KBIBTEX_PART_PART_H 19 #define KBIBTEX_PART_PART_H 20 21 #include <QObject> 22 23 #include <KParts/Part> 24 #include <KParts/ReadWritePart> 25 #include <KAboutData> 26 27 #include "notificationhub.h" 28 #include "partwidget.h" 29 30 class KBibTeXPart : public KParts::ReadWritePart, private NotificationListener 31 { 32 Q_OBJECT 33 34 friend class KBibTeXBrowserExtension; 35 36 public: 37 KBibTeXPart(QWidget *parentWidget, QObject *parent, const KAboutData &componentData); 38 ~KBibTeXPart() override; 39 40 void setModified(bool modified) override; 41 42 void notificationEvent(int eventId) override; 43 44 protected: 45 bool openFile() override; 46 bool saveFile() override; 47 48 protected: 49 void setupActions(); 50 51 protected slots: 52 bool documentSave(); 53 bool documentSaveAs(); 54 bool documentSaveCopyAs(); 55 void elementViewDocument(); 56 void elementViewDocumentMenu(QObject *); 57 void elementFindPDF(); 58 void applyDefaultFormatString(); 59 60 private slots: 61 void newElementTriggered(int event); 62 void newEntryTriggered(); 63 void newMacroTriggered(); 64 void newCommentTriggered(); 65 void newPreambleTriggered(); 66 void updateActions(); 67 void fileExternallyChange(const QString &path); 68 69 private: 70 class KBibTeXPartPrivate; 71 KBibTeXPartPrivate *const d; 72 }; 73 74 #endif // KBIBTEX_PART_PART_H 75