File indexing completed on 2024-04-28 15:52:03

0001 /*
0002     SPDX-FileCopyrightText: 2021 Jiří Wolker <woljiri@gmail.com>
0003 
0004     SPDX-License-Identifier: GPL-2.0-or-later
0005 */
0006 
0007 #ifndef WELCOMESCREEN_H
0008 #define WELCOMESCREEN_H
0009 
0010 #include "shell/ui_welcomescreen.h"
0011 
0012 #include <QFrame>
0013 #include <QUrl>
0014 
0015 class KRecentFilesAction;
0016 class QListWidgetItem;
0017 class RecentItemsModel;
0018 class RecentsListItemDelegate;
0019 
0020 class WelcomeScreen : public QWidget, Ui::WelcomeScreen
0021 {
0022     Q_OBJECT
0023 public:
0024     explicit WelcomeScreen(QWidget *parent = nullptr);
0025     ~WelcomeScreen() override;
0026 
0027     void loadRecents();
0028 
0029 Q_SIGNALS:
0030     void openClicked();
0031     void closeClicked();
0032     void recentItemClicked(QUrl const &url);
0033     void forgetAllRecents();
0034     void forgetRecentItem(QUrl const &url);
0035 
0036 protected:
0037     void showEvent(QShowEvent *e) override;
0038 
0039 private Q_SLOTS:
0040     void recentsItemActivated(QModelIndex const &index);
0041     void recentListChanged();
0042 
0043 private:
0044     int recentsCount();
0045 
0046     RecentItemsModel *m_recentsModel;
0047     RecentsListItemDelegate *m_recentsItemDelegate;
0048 
0049     QLabel *m_noRecentsLabel;
0050 };
0051 
0052 #endif // WELCOMESCREEN_H