diff --git a/appsmodel.h b/appsmodel.h index 84e8bc7a4..97823b475 100644 --- a/appsmodel.h +++ b/appsmodel.h @@ -1,159 +1,158 @@ /*************************************************************************** * Copyright (C) 2012 Aurélien Gâteau * * Copyright (C) 2013-2015 by Eike Hein * * * * This program is free software; you can redistribute it and/or modify * * it under the terms of the GNU General Public License as published by * * the Free Software Foundation; either version 2 of the License, or * * (at your option) any later version. * * * * This program is distributed in the hope that it will be useful, * * but WITHOUT ANY WARRANTY; without even the implied warranty of * * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * * GNU General Public License for more details. * * * * You should have received a copy of the GNU General Public License * * along with this program; if not, write to the * * Free Software Foundation, Inc., * * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA . * ***************************************************************************/ #ifndef APPSMODEL_H #define APPSMODEL_H #include "abstractmodel.h" #include "appentry.h" #include #include -class AppGroupEntry; class QTimer; class AppsModel : public AbstractModel, public QQmlParserStatus { Q_OBJECT Q_INTERFACES(QQmlParserStatus) Q_PROPERTY(bool autoPopulate READ autoPopulate WRITE setAutoPopulate NOTIFY autoPopulateChanged) Q_PROPERTY(bool paginate READ paginate WRITE setPaginate NOTIFY paginateChanged) Q_PROPERTY(int pageSize READ pageSize WRITE setPageSize NOTIFY pageSizeChanged) Q_PROPERTY(bool flat READ flat WRITE setFlat NOTIFY flatChanged) Q_PROPERTY(bool sorted READ sorted WRITE setSorted NOTIFY sortedChanged) Q_PROPERTY(bool showSeparators READ showSeparators WRITE setShowSeparators NOTIFY showSeparatorsChanged) Q_PROPERTY(bool showTopLevelItems READ showTopLevelItems WRITE setShowTopLevelItems NOTIFY showTopLevelItemsChanged) Q_PROPERTY(int appNameFormat READ appNameFormat WRITE setAppNameFormat NOTIFY appNameFormatChanged) Q_PROPERTY(QObject* appletInterface READ appletInterface WRITE setAppletInterface NOTIFY appletInterfaceChanged) public: explicit AppsModel(const QString &entryPath = QString(), bool paginate = false, int pageSize = 24, bool flat = false, bool sorted = true, bool separators = true, QObject *parent = nullptr); explicit AppsModel(const QList entryList, bool deleteEntriesOnDestruction, QObject *parent = nullptr); ~AppsModel() override; QString description() const override; void setDescription(const QString &text); QVariant data(const QModelIndex &index, int role = Qt::DisplayRole) const override; QModelIndex index(int row, int column, const QModelIndex &parent = QModelIndex()) const override; int rowCount(const QModelIndex &parent = QModelIndex()) const override; Q_INVOKABLE bool trigger(int row, const QString &actionId, const QVariant &argument) override; bool autoPopulate() const; void setAutoPopulate(bool populate); Q_INVOKABLE AbstractModel *modelForRow(int row) override; Q_INVOKABLE int rowForModel(AbstractModel *model) override; int separatorCount() const override; bool paginate() const; void setPaginate(bool paginate); int pageSize() const; void setPageSize(int size); bool flat() const; void setFlat(bool flat); bool sorted() const; void setSorted(bool sorted); bool showSeparators() const; void setShowSeparators(bool showSeparators); bool showTopLevelItems() const; void setShowTopLevelItems(bool showTopLevelItems); int appNameFormat() const; void setAppNameFormat(int format); QObject *appletInterface() const; void setAppletInterface(QObject *appletInterface); QStringList hiddenEntries() const; void entryChanged(AbstractEntry *entry) override; void classBegin() override; void componentComplete() override; Q_SIGNALS: void cleared() const; void autoPopulateChanged() const; void paginateChanged() const; void pageSizeChanged() const; void flatChanged() const; void sortedChanged() const; void showSeparatorsChanged() const; void showTopLevelItemsChanged() const; void appNameFormatChanged() const; void appletInterfaceChanged() const; void hiddenEntriesChanged() const; protected Q_SLOTS: void refresh() override; protected: void refreshInternal(); bool m_complete; bool m_paginate; int m_pageSize; QList m_entryList; bool m_deleteEntriesOnDestruction; int m_separatorCount; bool m_showSeparators; bool m_showTopLevelItems; QObject *m_appletInterface; private Q_SLOTS: void checkSycocaChanges(const QStringList &changes); private: void processServiceGroup(KServiceGroup::Ptr group); void sortEntries(); bool m_autoPopulate; QString m_description; QString m_entryPath; bool m_staticEntryList; QTimer *m_changeTimer; bool m_flat; bool m_sorted; AppEntry::NameFormat m_appNameFormat; QStringList m_hiddenEntries; static MenuEntryEditor *m_menuEntryEditor; }; #endif diff --git a/containmentinterface.h b/containmentinterface.h index b512457b9..5a8c3375b 100644 --- a/containmentinterface.h +++ b/containmentinterface.h @@ -1,59 +1,58 @@ /*************************************************************************** * Copyright (C) 2014 by Eike Hein * * * * This program is free software; you can redistribute it and/or modify * * it under the terms of the GNU General Public License as published by * * the Free Software Foundation; either version 2 of the License, or * * (at your option) any later version. * * * * This program is distributed in the hope that it will be useful, * * but WITHOUT ANY WARRANTY; without even the implied warranty of * * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * * GNU General Public License for more details. * * * * You should have received a copy of the GNU General Public License * * along with this program; if not, write to the * * Free Software Foundation, Inc., * * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA . * ***************************************************************************/ #ifndef CONTAINMENTINTERFACE_H #define CONTAINMENTINTERFACE_H #include #include namespace Plasma { - class Applet; class Containment; } class ContainmentInterface : public QObject { Q_OBJECT public: enum Target { Desktop = 0, Panel, TaskManager }; Q_ENUM(Target) explicit ContainmentInterface(QObject *parent = nullptr); ~ContainmentInterface() override; static Q_INVOKABLE bool mayAddLauncher(QObject *appletInterface, Target target, const QString &entryPath = QString()); static Q_INVOKABLE void addLauncher(QObject *appletInterface, Target target, const QString &entryPath); static Q_INVOKABLE QObject* screenContainment(QObject *appletInterface); static Q_INVOKABLE bool screenContainmentMutable(QObject *appletInterface); static Q_INVOKABLE void ensureMutable(Plasma::Containment *containment); private: static QStringList m_knownTaskManagers; }; #endif diff --git a/kastatsfavoritesmodel.h b/kastatsfavoritesmodel.h index 570940929..4322172dc 100644 --- a/kastatsfavoritesmodel.h +++ b/kastatsfavoritesmodel.h @@ -1,117 +1,116 @@ /*************************************************************************** * Copyright (C) 2014-2015 by Eike Hein * * Copyright (C) 2016-2017 by Ivan Cukic * * * * This program is free software; you can redistribute it and/or modify * * it under the terms of the GNU General Public License as published by * * the Free Software Foundation; either version 2 of the License, or * * (at your option) any later version. * * * * This program is distributed in the hope that it will be useful, * * but WITHOUT ANY WARRANTY; without even the implied warranty of * * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * * GNU General Public License for more details. * * * * You should have received a copy of the GNU General Public License * * along with this program; if not, write to the * * Free Software Foundation, Inc., * * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA . * ***************************************************************************/ #ifndef FAVORITESMODEL_H #define FAVORITESMODEL_H #include "placeholdermodel.h" #include #include #include class PlaceholderModel; namespace KActivities { class Consumer; namespace Stats { - class ResultModel; namespace Terms { class Activity; } // namespace Terms } // namespace Stats } // namespace KActivities class KAStatsFavoritesModel : public PlaceholderModel { Q_OBJECT Q_PROPERTY(bool enabled READ enabled WRITE setEnabled NOTIFY enabledChanged) Q_PROPERTY(QStringList favorites READ favorites WRITE setFavorites NOTIFY favoritesChanged) Q_PROPERTY(int maxFavorites READ maxFavorites WRITE setMaxFavorites NOTIFY maxFavoritesChanged) Q_PROPERTY(QObject* activities READ activities CONSTANT) public: explicit KAStatsFavoritesModel(QObject *parent = nullptr); ~KAStatsFavoritesModel() override; QString description() const override; Q_INVOKABLE bool trigger(int row, const QString &actionId, const QVariant &argument) override; bool enabled() const; void setEnabled(bool enable); QStringList favorites() const; void setFavorites(const QStringList &favorites); int maxFavorites() const; void setMaxFavorites(int max); Q_INVOKABLE bool isFavorite(const QString &id) const; Q_INVOKABLE void addFavorite(const QString &id, int index = -1); Q_INVOKABLE void removeFavorite(const QString &id); Q_INVOKABLE void addFavoriteTo(const QString &id, const QString &activityId, int index = -1); Q_INVOKABLE void removeFavoriteFrom(const QString &id, const QString &activityId); Q_INVOKABLE void setFavoriteOn(const QString &id, const QString &activityId); Q_INVOKABLE void portOldFavorites(const QStringList &ids); Q_INVOKABLE QStringList linkedActivitiesFor(const QString &id) const; Q_INVOKABLE void moveRow(int from, int to); Q_INVOKABLE void initForClient(const QString &client); QObject *activities() const; Q_INVOKABLE QString activityNameForId(const QString &activityId) const; AbstractModel* favoritesModel() override; public Q_SLOTS: void refresh() override; Q_SIGNALS: void enabledChanged() const; void favoritesChanged() const; void maxFavoritesChanged() const; private: class Private; Private * d; AbstractEntry *favoriteFromId(const QString &id) const; void addFavoriteTo(const QString &id, const KActivities::Stats::Terms::Activity &activityId, int index = -1); void removeFavoriteFrom(const QString &id, const KActivities::Stats::Terms::Activity &activityId); bool m_enabled; int m_maxFavorites; KActivities::Consumer *m_activities; }; #endif diff --git a/submenu.h b/submenu.h index 722f9a9be..699bafc03 100644 --- a/submenu.h +++ b/submenu.h @@ -1,57 +1,56 @@ /*************************************************************************** * Copyright (C) 2014 by David Edmundson * * Copyright (C) 2014 by Eike Hein * * * * This program is free software; you can redistribute it and/or modify * * it under the terms of the GNU General Public License as published by * * the Free Software Foundation; either version 2 of the License, or * * (at your option) any later version. * * * * This program is distributed in the hope that it will be useful, * * but WITHOUT ANY WARRANTY; without even the implied warranty of * * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * * GNU General Public License for more details. * * * * You should have received a copy of the GNU General Public License * * along with this program; if not, write to the * * Free Software Foundation, Inc., * * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA . * ***************************************************************************/ #ifndef SUBMENU_H #define SUBMENU_H #include -class QScreen; class SubMenu : public PlasmaQuick::Dialog { Q_OBJECT Q_PROPERTY(int offset READ offset WRITE setOffset NOTIFY offsetChanged) Q_PROPERTY(bool facingLeft READ facingLeft NOTIFY facingLeftChanged) public: explicit SubMenu(QQuickItem *parent = nullptr); ~SubMenu() override; Q_INVOKABLE QRect availableScreenRectForItem(QQuickItem *item) const; QPoint popupPosition(QQuickItem *item, const QSize &size) override; int offset() const; void setOffset(int offset); bool facingLeft() const { return m_facingLeft; } Q_SIGNALS: void offsetChanged() const; void facingLeftChanged() const; private: int m_offset; bool m_facingLeft; }; #endif