Warning, file /office/calligra/libs/main/KoOpenPane.h was not indexed or was modified since last indexation (in which case cross-reference links may be missing, inaccurate or erroneous).

0001 /* This file is part of the KDE project
0002    Copyright (C) 2005 Peter Simonsson <psn@linux.se>
0003 
0004    This library is free software; you can redistribute it and/or
0005    modify it under the terms of the GNU Library General Public
0006    License as published by the Free Software Foundation; either
0007    version 2 of the License, or (at your option) any later version.
0008 
0009    This library is distributed in the hope that it will be useful,
0010    but WITHOUT ANY WARRANTY; without even the implied warranty of
0011    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
0012    Library General Public License for more details.
0013 
0014    You should have received a copy of the GNU Library General Public License
0015    along with this library; see the file COPYING.LIB.  If not, write to
0016    the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
0017  * Boston, MA 02110-1301, USA.
0018 */
0019 #ifndef KOOPENPANE_H
0020 #define KOOPENPANE_H
0021 
0022 #include <QWidget>
0023 #include <QList>
0024 
0025 class KoOpenPanePrivate;
0026 class QPixmap;
0027 class KoTemplatesPane;
0028 class KoDetailsPane;
0029 class QUrl;
0030 class QTreeWidgetItem;
0031 class QString;
0032 class QStringList;
0033 
0034 /// \internal
0035 class KoOpenPane : public QWidget
0036 {
0037     Q_OBJECT
0038 
0039 public:
0040     /**
0041      * Constructor
0042      * @param parent the parent widget
0043      * @param mimeFilter the MIME type filter that should be selected on creation.
0044      * @param templatesResourcePath the path for template resources.
0045      */
0046     KoOpenPane(QWidget *parent, const QStringList& mimeFilter, const QString& templatesResourcePath = QString());
0047     ~KoOpenPane() override;
0048 
0049     QTreeWidgetItem* addPane(const QString &title, const QString &iconName, QWidget *widget, int sortWeight);
0050     QTreeWidgetItem* addPane(const QString& title, const QPixmap& icon, QWidget* widget, int sortWeight);
0051 
0052     /**
0053      * If the application has a way to create a document not based on a template, but on user
0054      * provided settings, the widget showing these gets set here.
0055      * @see KoDocument::createCustomDocumentWidget()
0056      * @param widget the widget.
0057      * @param title the title shown in the sidebar
0058      * @param icon the icon shown in the sidebar
0059      */
0060     void addCustomDocumentWidget(QWidget *widget, const QString& title = QString(), const QString& icon = QString());
0061 
0062 
0063 protected Q_SLOTS:
0064     void updateSelectedWidget();
0065     void itemClicked(QTreeWidgetItem* item);
0066 
0067     /// Saves the splitter sizes for KoDetailsPaneBase based panes
0068     void saveSplitterSizes(KoDetailsPane* sender, const QList<int>& sizes);
0069 
0070 private Q_SLOTS:
0071     /// when clicked "Open Existing Document" button
0072     void openFileDialog();
0073 
0074 Q_SIGNALS:
0075     void openExistingFile(const QUrl&);
0076     void openTemplate(const QUrl&);
0077 
0078     /// Emitted when the always use template has changed
0079     void alwaysUseChanged(KoTemplatesPane* sender, const QString& alwaysUse);
0080 
0081     /// Emitted when one of the detail panes have changed it's splitter
0082     void splitterResized(KoDetailsPane* sender, const QList<int>& sizes);
0083 
0084 protected:
0085     void initRecentDocs();
0086     /**
0087      * Populate the list with all templates the user can choose.
0088      * @param templatesResourcePath the template-type (group) that should be selected on creation.
0089      */
0090     void initTemplates(const QString& templatesResourcePath);
0091 
0092     // QWidget overrides
0093     void dragEnterEvent(QDragEnterEvent * event) override;
0094     void dropEvent(QDropEvent * event) override;
0095 
0096 private:
0097     QStringList m_mimeFilter;
0098 
0099     KoOpenPanePrivate * const d;
0100 };
0101 
0102 #endif //KOOPENPANE_H