File indexing completed on 2024-04-28 05:47:34
0001 /* 0002 SPDX-FileCopyrightText: 2007 Henrique Pinto <henrique.pinto@kdemail.net> 0003 SPDX-FileCopyrightText: 2008 Harald Hvaal <haraldhv@stud.ntnu.no> 0004 SPDX-FileCopyrightText: 2021 Jiří Wolker <woljiri@gmail.com> 0005 0006 SPDX-License-Identifier: GPL-2.0-or-later 0007 */ 0008 #ifndef MAINWINDOW_H 0009 #define MAINWINDOW_H 0010 0011 #include <KParts/MainWindow> 0012 #include <KParts/OpenUrlArguments> 0013 #include <QStackedWidget> 0014 0015 #include "welcomeview/welcomeview.h" 0016 0017 namespace KParts 0018 { 0019 class ReadWritePart; 0020 } 0021 0022 class KRecentFilesMenu; 0023 class Sidebar; 0024 0025 class MainWindow : public KParts::MainWindow 0026 { 0027 Q_OBJECT 0028 public: 0029 explicit MainWindow(QWidget *parent = nullptr); 0030 ~MainWindow() override; 0031 0032 bool loadPart(); 0033 KRecentFilesMenu *recentFilesMenu() const; 0034 0035 void dragEnterEvent(class QDragEnterEvent *event) override; 0036 void dropEvent(class QDropEvent *event) override; 0037 void dragMoveEvent(class QDragMoveEvent *event) override; 0038 0039 public Q_SLOTS: 0040 void openUrl(const QUrl &url); 0041 void setShowExtractDialog(bool); 0042 0043 void showWelcomeScreen(); 0044 void hideWelcomeScreen(); 0045 0046 protected: 0047 void closeEvent(QCloseEvent *event) override; 0048 QSize sizeHint() const override; 0049 0050 private Q_SLOTS: 0051 void updateActions(); 0052 void newArchive(); 0053 void openArchive(); 0054 void quit(); 0055 void showSettings(); 0056 void writeSettings(); 0057 void addPartUrl(); 0058 0059 private: 0060 void setupActions(); 0061 void updateHamburgerMenu(); 0062 0063 KParts::ReadWritePart *m_part; 0064 KRecentFilesMenu *m_recentFilesMenu; 0065 QAction *m_openAction; 0066 QAction *m_newAction; 0067 KParts::OpenUrlArguments m_openArgs; 0068 WelcomeView *m_welcomeView; 0069 QStackedWidget *m_windowContents; 0070 Sidebar *m_sidebar = nullptr; 0071 QAction *m_showSidebarAction = nullptr; 0072 QAction *m_lockSidebarAction = nullptr; 0073 }; 0074 0075 #endif // MAINWINDOW_H