Warning, file /plasma/latte-dock/app/layout/storage.h was not indexed or was modified since last indexation (in which case cross-reference links may be missing, inaccurate or erroneous).

0001 /*
0002 *  Copyright 2019  Michail Vourlakos <mvourlakos@gmail.com>
0003 *
0004 *  This file is part of Latte-Dock
0005 *
0006 *  Latte-Dock is free software; you can redistribute it and/or
0007 *  modify it under the terms of the GNU General Public License as
0008 *  published by the Free Software Foundation; either version 2 of
0009 *  the License, or (at your option) any later version.
0010 *
0011 *  Latte-Dock is distributed in the hope that it will be useful,
0012 *  but WITHOUT ANY WARRANTY; without even the implied warranty of
0013 *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
0014 *  GNU General Public License for more details.
0015 *
0016 *  You should have received a copy of the GNU General Public License
0017 *  along with this program.  If not, see <http://www.gnu.org/licenses/>.
0018 */
0019 
0020 #ifndef LAYOUTSTORAGE_H
0021 #define LAYOUTSTORAGE_H
0022 
0023 #include "genericlayout.h"
0024 
0025 // Qt
0026 #include <QObject>
0027 
0028 namespace Plasma{
0029 class Containment;
0030 }
0031 
0032 namespace Latte {
0033 namespace Layout {
0034 
0035 class Storage : public QObject
0036 {
0037     Q_OBJECT
0038 
0039 public:
0040     Storage(GenericLayout *parent);
0041     ~Storage() override;
0042 
0043     bool isWritable() const;
0044     bool isLatteContainment(Plasma::Containment *containment) const;
0045     bool isLatteContainment(const KConfigGroup &group) const;
0046     bool layoutIsBroken(QStringList &errors) const;
0047 
0048     void importToCorona();
0049     void lock(); //! make it only read-only
0050     void unlock(); //! make it writable which it should be the default
0051 
0052     void copyView(Plasma::Containment *containment);
0053     void syncToLayoutFile(bool removeLayoutId);
0054 
0055     /// STATIC
0056     //! Check if an applet config group is valid or belongs to removed applet
0057     static bool appletGroupIsValid(KConfigGroup appletGroup);
0058 
0059     //! Functions used from Layout Reports
0060     //! [containment id, list<systrays ids>], list<systrays ids>, list[systrays ids]
0061     void systraysInformation(QHash<int, QList<int>> &systrays, QList<int> &assignedSystrays, QList<int> &orphanSystrays);
0062     //! list<screens ids>
0063     QList<int> viewsScreens();
0064     //! list<ViewData>
0065     QList<ViewData> viewsData(const QHash<int, QList<int>> &systrays);
0066 
0067 private:
0068     //! STORAGE !////
0069     QString availableId(QStringList all, QStringList assigned, int base);
0070     //! provides a new file path based the provided file. The new file
0071     //! has updated ids for containments and applets based on the corona
0072     //! loaded ones
0073     QString newUniqueIdsLayoutFromFile(QString file);
0074     //! imports a layout file and returns the containments for the docks
0075     QList<Plasma::Containment *> importLayoutFile(QString file);
0076 
0077 private:
0078     GenericLayout *m_layout;
0079 };
0080 
0081 }
0082 }
0083 
0084 #endif