1 /* This file is part of the KDE project 2 Copyright (c) 2000 Simon Hausmann <hausmann@kde.org> 3 2006 Martin Pfeiffer <hubipete@gmx.net> 4 5 This library is free software; you can redistribute it and/or 6 modify it under the terms of the GNU Library General Public 7 License as published by the Free Software Foundation; either 8 version 2 of the License, or (at your option) any later version. 9 10 This library is distributed in the hope that it will be useful, 11 but WITHOUT ANY WARRANTY; without even the implied warranty of 12 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 13 Library General Public License for more details. 14 15 You should have received a copy of the GNU Library General Public License 16 along with this library; see the file COPYING.LIB. If not, write to 17 the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, 18 * Boston, MA 02110-1301, USA. 19 */ 20 21 #ifndef __koDocumentInfoDlg_h__ 22 #define __koDocumentInfoDlg_h__ 23 24 #include <kpagedialog.h> 25 26 class KoDocumentInfo; 27 class KPageWidgetItem; 28 class KoPageWidgetItem; 29 30 #include "kritawidgets_export.h" 31 32 /** 33 * @short The dialog that shows information about the document 34 * @author Simon Hausmann <hausmann@kde.org> 35 * @author Martin Pfeiffer <hubipete@gmx.net> 36 * @see KoDocumentInfo 37 * 38 * This dialog is invoked by KoMainWindow and shows the content 39 * of the given KoDocumentInfo class. It consists of several pages, 40 * one showing general information about the document and an other 41 * showing information about the author. 42 * This dialog implements only things that are stored in the OASIS 43 * meta.xml file and therefore available through the KoDocumentInfo 44 * class. 45 * The widgets shown in the tabs are koDocumentInfoAboutWidget and 46 * koDocumentInfoAuthorWidget. This class here is derived from 47 * KPageDialog and uses the face type Tabbed. 48 */ 49 50 class KRITAWIDGETS_EXPORT KoDocumentInfoDlg : public KPageDialog 51 { 52 Q_OBJECT 53 54 public: 55 /** 56 * The constructor 57 * @param parent a pointer to the parent widget 58 * @param docInfo a pointer to the shown KoDocumentInfo 59 */ 60 KoDocumentInfoDlg(QWidget *parent, KoDocumentInfo* docInfo); 61 62 /** The destructor */ 63 ~KoDocumentInfoDlg() override; 64 65 QList<KPageWidgetItem*> pages() const; 66 67 /** Returns true if the document was saved when the dialog was closed */ 68 bool isDocumentSaved(); 69 70 /** Sets all fields to read-only mode. Used by the property dialog. */ 71 void setReadOnly(bool ro); 72 73 void addPageItem(KoPageWidgetItem *item); 74 75 public Q_SLOTS: // QDialog API 76 void accept() override; 77 78 protected: // QWidget API 79 void hideEvent(QHideEvent * event) override; 80 81 private Q_SLOTS: 82 /** Connected with clicked() from pbReset - Reset parts of the metadata */ 83 void slotResetMetaData(); 84 85 Q_SIGNALS: 86 void saveRequested(); 87 88 private: 89 /** Sets up the aboutWidget and fills the widgets with content */ 90 void initAboutTab(); 91 /** Sets up the authorWidget and fills the widgets with content */ 92 void initAuthorTab(); 93 /** Saves the changed data back to the KoDocumentInfo class */ 94 void saveAboutData(); 95 96 void updateEditingTime(); 97 98 class KoDocumentInfoDlgPrivate; 99 KoDocumentInfoDlgPrivate * const d; 100 }; 101 102 #endif 103