File indexing completed on 2024-04-28 04:18:52

0001 // vim: set tabstop=4 shiftwidth=4 expandtab:
0002 /*
0003 Gwenview: an image viewer
0004 Copyright 2009 Aurélien Gâteau <agateau@kde.org>
0005 Copyright 2014 Tomas Mecir <mecirt@gmail.com>
0006 
0007 This program is free software; you can redistribute it and/or
0008 modify it under the terms of the GNU General Public License
0009 as published by the Free Software Foundation; either version 2
0010 of the License, or (at your option) any later version.
0011 
0012 This program is distributed in the hope that it will be useful,
0013 but WITHOUT ANY WARRANTY; without even the implied warranty of
0014 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
0015 GNU General Public License for more details.
0016 
0017 You should have received a copy of the GNU General Public License
0018 along with this program; if not, write to the Free Software
0019 Foundation, Inc., 51 Franklin Street, Fifth Floor, Cambridge, MA 02110-1301, USA.
0020 
0021 */
0022 #ifndef RECENTFILESMODEL_H
0023 #define RECENTFILESMODEL_H
0024 
0025 // Qt
0026 #include <QStandardItemModel>
0027 
0028 // KF
0029 
0030 // Local
0031 #include <lib/gwenviewlib_export.h>
0032 
0033 class QUrl;
0034 
0035 namespace Gwenview
0036 {
0037 struct RecentFilesModelPrivate;
0038 /**
0039  * A model which maintains a list of urls in the dir specified by the
0040  * storageDir parameter of its ctor.
0041  * Each url is stored in a separate KConfig file to avoid concurrency issues.
0042  */
0043 class GWENVIEWLIB_EXPORT RecentFilesModel : public QStandardItemModel
0044 {
0045     Q_OBJECT
0046 public:
0047     explicit RecentFilesModel(QObject *parent);
0048     ~RecentFilesModel() override;
0049 
0050     void addUrl(const QUrl &);
0051 
0052     bool removeRows(int row, int count, const QModelIndex &parent = QModelIndex()) override;
0053 
0054 private:
0055     RecentFilesModelPrivate *const d;
0056 };
0057 
0058 } // namespace
0059 
0060 #endif /* RECENTFILESMODEL_H */