Krita Source Code Documentation
Loading...
Searching...
No Matches
krecentfilesaction.h
Go to the documentation of this file.
1/* This file is part of the KDE libraries
2 SPDX-FileCopyrightText: 1999 Reginald Stadlbauer <reggie@kde.org>
3 SPDX-FileCopyrightText: 1999 Simon Hausmann <hausmann@kde.org>
4 SPDX-FileCopyrightText: 2000 Nicolas Hadacek <haadcek@kde.org>
5 SPDX-FileCopyrightText: 2000 Kurt Granroth <granroth@kde.org>
6 SPDX-FileCopyrightText: 2000 Michael Koch <koch@kde.org>
7 SPDX-FileCopyrightText: 2001 Holger Freyther <freyther@kde.org>
8 SPDX-FileCopyrightText: 2002 Ellis Whitehead <ellis@kde.org>
9 SPDX-FileCopyrightText: 2003 Andras Mantia <amantia@kde.org>
10 SPDX-FileCopyrightText: 2005-2006 Hamish Rodda <rodda@kde.org>
11 SPDX-FileCopyrightText: 2022 Alvin Wong <alvin@alvinhc.com>
12
13 SPDX-License-Identifier: LGPL-2.0-only
14*/
15
16#ifndef KRECENTFILESACTION_H
17#define KRECENTFILESACTION_H
18
19#include <kselectaction.h>
20#include <qurl.h>
21#include <kritawidgetutils_export.h>
22
23class KConfigGroup;
25
26class QIcon;
27class QStandardItemModel;
28class QStandardItem;
29
40class KRITAWIDGETUTILS_EXPORT KRecentFilesAction : public KSelectAction
41{
42 Q_OBJECT
43 Q_DECLARE_PRIVATE(KRecentFilesAction)
44
45public:
51 explicit KRecentFilesAction(QObject *parent);
52
65 KRecentFilesAction(const QString &text, QObject *parent);
66
78 KRecentFilesAction(const QIcon &icon, const QString &text, QObject *parent);
79
83 ~KRecentFilesAction() override;
84
91 void addAction(QAction *action, const QUrl &url, const QString &name);
92
96 QAction *removeAction(QAction *action) override;
97
98private Q_SLOTS:
103 virtual void clearActionTriggered();
104
105public:
106 void setRecentFilesModel(const QStandardItemModel *model);
107
108Q_SIGNALS:
114 void urlSelected(const QUrl &url);
115
116private:
117 //Internal
118 void clearEntries();
119 // Don't warn about the virtual overload. As the comment of the other
120 // addAction() says, addAction( QAction* ) should not be used.
121 using KSelectAction::addAction;
122
124
125 Q_PRIVATE_SLOT(d_func(), void _k_urlSelected(QAction *))
126
127 void rebuildEntries();
128
129private Q_SLOTS:
130 void fileAdded(const QUrl &url);
131 void fileRemoved(const QUrl &url);
132 void listRenewed();
133
134 void modelItemChanged(QStandardItem *item);
135 void modelRowsInserted(const QModelIndex &parent, int first, int last);
136
137 void menuAboutToShow();
138};
139
140#endif
Recent files action.
Q_PRIVATE_SLOT(d_func(), void _k_urlSelected(QAction *)) void rebuildEntries()
void urlSelected(const QUrl &url)
KRecentFilesActionPrivate * d_ptr