File indexing completed on 2024-05-19 05:05:51
0001 /*************************************************************************** 0002 * SPDX-License-Identifier: GPL-2.0-or-later 0003 * * 0004 * SPDX-FileCopyrightText: 2004-2019 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_PROGRAM_MDIWIDGET_H 0021 #define KBIBTEX_PROGRAM_MDIWIDGET_H 0022 0023 #include <QStackedWidget> 0024 #include <QModelIndex> 0025 #include <QUrl> 0026 0027 #include <KService> 0028 0029 #include "openfileinfo.h" 0030 0031 class FileView; 0032 0033 namespace KParts 0034 { 0035 class Part; 0036 } 0037 0038 class OpenFileInfo; 0039 0040 class MDIWidget : public QStackedWidget 0041 { 0042 Q_OBJECT 0043 0044 public: 0045 explicit MDIWidget(QWidget *parent); 0046 ~MDIWidget() override; 0047 0048 FileView *fileView(); 0049 OpenFileInfo *currentFile(); 0050 0051 public Q_SLOTS: 0052 /** 0053 * Make the MDI widget show a different file using a part 0054 * as specified by a service. 0055 * If the OpenFileInfo object is NULL, show no file but a 0056 * Welcome widget instead. 0057 * Retrieving the part to be used will be delegated to the 0058 * OpenFileInfo object. 0059 */ 0060 void setFile(OpenFileInfo *openFileInfo, const KPluginMetaData &service); 0061 0062 Q_SIGNALS: 0063 void setCaption(const QString &); 0064 void documentSwitched(FileView *, FileView *); 0065 void activePartChanged(KParts::Part *); 0066 void documentNew(); 0067 void documentOpen(); 0068 void documentOpenURL(const QUrl &); 0069 0070 private: 0071 class MDIWidgetPrivate; 0072 MDIWidgetPrivate *d; 0073 0074 private Q_SLOTS: 0075 void slotStatusFlagsChanged(OpenFileInfo::StatusFlags); 0076 void slotOpenLRU(const QModelIndex &); 0077 }; 0078 0079 #endif // KBIBTEX_PROGRAM_MDIWIDGET_H