File indexing completed on 2024-05-19 04:29:23

0001 /*
0002     This file is part of the KDE project
0003 
0004     SPDX-FileCopyrightText: 2000 Simon Hausmann <hausmann@kde.org>
0005     SPDX-FileCopyrightText: 2006 Martin Pfeiffer <hubipete@gmx.net>
0006 
0007     SPDX-License-Identifier: LGPL-2.0-or-later
0008 */
0009 
0010 #ifndef __koDocumentInfoDlg_h__
0011 #define __koDocumentInfoDlg_h__
0012 
0013 #include <kpagedialog.h>
0014 
0015 class KoDocumentInfo;
0016 class KPageWidgetItem;
0017 class KoPageWidgetItem;
0018 
0019 #include "kritaui_export.h"
0020 
0021 /**
0022  * @short The dialog that shows information about the document
0023  * @author Simon Hausmann <hausmann@kde.org>
0024  * @author Martin Pfeiffer <hubipete@gmx.net>
0025  * @see KoDocumentInfo
0026  *
0027  * This dialog is invoked by KoMainWindow and shows the content
0028  * of the given KoDocumentInfo class. It consists of several pages,
0029  * one showing general information about the document and another
0030  * showing information about the author.
0031  * This dialog implements only things that are stored in the OASIS
0032  * meta.xml file and therefore available through the KoDocumentInfo
0033  * class.
0034  * The widgets shown in the tabs are koDocumentInfoAboutWidget and
0035  * koDocumentInfoAuthorWidget. This class here is derived from
0036  * KPageDialog and uses the face type Tabbed.
0037  */
0038 
0039 class KRITAUI_EXPORT KoDocumentInfoDlg : public KPageDialog
0040 {
0041     Q_OBJECT
0042 
0043 public:
0044     /**
0045      * The constructor
0046      * @param parent a pointer to the parent widget
0047      * @param docInfo a pointer to the shown KoDocumentInfo
0048      */
0049     KoDocumentInfoDlg(QWidget *parent, KoDocumentInfo* docInfo);
0050 
0051     /** The destructor */
0052     ~KoDocumentInfoDlg() override;
0053 
0054     QList<KPageWidgetItem*> pages() const;
0055 
0056     /** Returns true if the document was saved when the dialog was closed */
0057     bool isDocumentSaved();
0058 
0059     /** Sets all fields to read-only mode. Used by the property dialog. */
0060     void setReadOnly(bool ro);
0061 
0062     void addPageItem(KoPageWidgetItem *item);
0063 
0064 public Q_SLOTS:  // QDialog API
0065     void accept() override;
0066 
0067 protected:  // QWidget API
0068     void hideEvent(QHideEvent * event) override;
0069 
0070 private Q_SLOTS:
0071     /** Connected with clicked() from pbReset - Reset parts of the metadata */
0072     void slotResetMetaData();
0073 
0074 Q_SIGNALS:
0075     void saveRequested();
0076 
0077 private:
0078     /** Sets up the aboutWidget and fills the widgets with content */
0079     void initAboutTab();
0080     /** Sets up the authorWidget and fills the widgets with content */
0081     void initAuthorTab();
0082     /** Saves the changed data back to the KoDocumentInfo class */
0083     void saveAboutData();
0084 
0085     void updateEditingTime();
0086 
0087     class KoDocumentInfoDlgPrivate;
0088     KoDocumentInfoDlgPrivate * const d;
0089 };
0090 
0091 #endif