/usr/include/kactivities-models/resourcemodel.h is in libkactivities-dev 4:4.13.0-0ubuntu1.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 | /*
* Copyright (C) 2012 Ivan Cukic <ivan.cukic(at)kde.org>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License version 2,
* or (at your option) any later version, as published by the Free
* Software Foundation
*
* 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 KACTIVITIES_MODELS_RESOURCE_MODEL_H
#define KACTIVITIES_MODELS_RESOURCE_MODEL_H
#include <QAbstractListModel>
#include "kactivities_models_export.h"
class QModelIndex;
namespace KActivities {
namespace Models {
/**
* ResourceModel
*/
class KACTIVITIES_MODELS_EXPORT ResourceModel: public QAbstractListModel {
Q_OBJECT
Q_PROPERTY(QString activity READ activity WRITE setActivity NOTIFY activityChanged)
Q_PROPERTY(QString application READ application WRITE setApplication NOTIFY applicationChanged)
Q_PROPERTY(int limit READ limit WRITE setLimit NOTIFY limitChanged)
public:
ResourceModel(QObject * parent = 0);
virtual ~ResourceModel();
/**
* What should the model display?
*/
enum ContentMode {
Favorites, // Show linked resources first, then the top rated (default)
Linked, // Show only linked resources
TopRated, // Show only top rated resources
Recent // Show recently used resources
};
enum Roles {
ResourceUrl = Qt::UserRole,
ResourceScore,
ResourceIconName
};
virtual int rowCount(const QModelIndex & parent = QModelIndex()) const;
virtual QVariant data(const QModelIndex & index, int role = Qt::DisplayRole) const;
virtual QVariant headerData(int section, Qt::Orientation orientation, int role = Qt::DisplayRole) const;
public Q_SLOTS:
/**
* Shows resources related to specific activity
* @param activity activity id.
* @note if the activity id is empty, the model
* will display resources linked to the current activity
* (default)
*/
void setActivity(const QString & activity);
/**
* @returns which activity the model displays
*/
QString activity() const;
/**
* Shows resources related to a specific application
* @param application application id
* @note if empty, shows resources for all applications
* aggregated (default)
*/
void setApplication(const QString & application);
/**
* @returns for which application the resources are shown
*/
QString application() const;
/**
* Limit the number of items to show
* @param count number of items to show
* @note default is 10, increasing it significantely
* can lead to performance degradation
*/
void setLimit(int count);
/**
* @returns the item count limit
*/
int limit() const;
/**
* Sets the list mode
*/
void setContentMode(ContentMode mode);
/**
* @returns display mode
*/
ContentMode contentMode() const;
Q_SIGNALS:
void applicationChanged(const QString & application);
void activityChanged(const QString & activity);
void limitChanged(int limit);
private:
Q_PRIVATE_SLOT(d, void servicePresenceChanged(bool))
Q_PRIVATE_SLOT(d, void resourceScoreUpdated(QString, QString, QString, double))
Q_PRIVATE_SLOT(d, void newEntries(QList<Nepomuk2::Query::Result>))
Q_PRIVATE_SLOT(d, void entriesRemoved(QList<QUrl>))
Q_PRIVATE_SLOT(d, void error(QString))
Q_PRIVATE_SLOT(d, void setCurrentActivity(QString))
friend class Private;
class Private;
Private * const d;
};
} // namespace Models
} // namespace KActivities
#endif // KACTIVITIES_MODELS_RESOURCE_MODEL_H
|