File indexing completed on 2024-05-12 16:39:40

0001 /* This file is part of the KDE project
0002    Copyright (C) 2011-2014 Jarosław Staniek <staniek@kde.org>
0003 
0004    This program is free software; you can redistribute it and/or
0005    modify it under the terms of the GNU Library General Public
0006    License as published by the Free Software Foundation; either
0007    version 2 of the License, or (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 GNU
0012    Library General Public License for more details.
0013 
0014    You should have received a copy of the GNU Library General Public License
0015    along with this program; see the file COPYING.  If not, write to
0016    the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
0017  * Boston, MA 02110-1301, USA.
0018  */
0019 
0020 #ifndef KEXIRECENTPROJECTS_H
0021 #define KEXIRECENTPROJECTS_H
0022 
0023 #include "kexiprojectset.h"
0024 
0025 //! @short Stores information about recent projects opened by Kexi.
0026 /*! The location is share/apps/kexi/recent_projects directory.
0027  Information about one project is store in one .kexis file.
0028  The loading process is deferred.
0029 */
0030 class KEXICORE_EXPORT KexiRecentProjects : protected KexiProjectSet
0031 {
0032 public:
0033     ~KexiRecentProjects();
0034 
0035     /*! Adds @a data as project data.
0036      While saved, data will be merged with earlier saved data. */
0037     void addProjectData(const KexiProjectData &data);
0038 
0039     //! @return list of data items.
0040     KexiProjectData::List list() const;
0041 
0042     /*! @return path to project shortcut that defines @a data or empty string
0043      if @a data is not a part this recent projects set
0044      or if @a data has not been created by loading shortcut. */
0045     QString shortcutPath(const KexiProjectData& data) const;
0046 
0047 protected:
0048     //! Creates recent projects container.
0049     explicit KexiRecentProjects(KDbMessageHandler* handler = 0);
0050 
0051     void addProjectDataInternal(KexiProjectData *data);
0052 
0053     KexiProjectData* takeProjectDataInternal(KexiProjectData *data);
0054 
0055 private:
0056     class Private;
0057     Private * const d;
0058     friend class KexiInternal;
0059     friend class Private;
0060 };
0061 
0062 #endif // KEXIRECENTPROJECTS_H