File indexing completed on 2024-05-05 17:04:26

0001 /* This file is part of the KDE project
0002  * Copyright (C) 2012 Boudewijn Rempt <boud@kogmbh.com>
0003  *
0004  *  This program is free software; you can redistribute it and/or modify
0005  *  it under the terms of the GNU General Public License as published by
0006  *  the Free Software Foundation; either version 2 of the License, or
0007  *  (at your option) any later version.
0008  *
0009  *  This program is distributed in the hope that it will be useful,
0010  *  but WITHOUT ANY WARRANTY; without even the implied warranty of
0011  *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
0012  *  GNU General Public License for more details.
0013  *
0014  *  You should have received a copy of the GNU General Public License
0015  *  along with this program; if not, write to the Free Software
0016  *  Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
0017  */
0018 #ifndef RECENTFILEMANAGER_H
0019 #define RECENTFILEMANAGER_H
0020 
0021 #include <QObject>
0022 
0023 /**
0024  * @brief The RecentFileManager class keeps track of recent files
0025  */
0026 class RecentFileManager : public QObject
0027 {
0028     Q_OBJECT
0029 public:
0030     explicit RecentFileManager(QObject *parent = 0);
0031     ~RecentFileManager() override;
0032 
0033     /// @return the size of the recent files list
0034     Q_INVOKABLE int size();
0035 
0036     /// @return the recent file at position index or an empty string
0037     QString recentFile(int index) const;
0038 
0039     /// @return the recent filename at position index or an empty string
0040     QString recentFileName(int index) const;
0041 
0042     /// @return the list of filenames without their paths
0043     QStringList recentFileNames() const;
0044 
0045     /// @return the list of recent files with their paths
0046     QStringList recentFiles() const;
0047 
0048 
0049 Q_SIGNALS:
0050 
0051     void recentFilesListChanged();
0052 
0053 public Q_SLOTS:
0054 
0055 
0056     /// add the given filename to the front of the list of recent filenames
0057     void addRecent(const QString &_url);
0058 
0059 private:
0060     class Private;
0061     Private* d;
0062 
0063 };
0064 
0065 #endif // FILEMANAGER_H