KActivitiesStats 5.109.0
Public Types | Public Slots | Public Member Functions | List of all members
KActivities::Stats::ResultModel

Provides a model which displays the resources matching the specified Query. More...

#include <KActivities/Stats/ResultModel>

Public Types

enum  Roles {
  ResourceRole = Qt::UserRole , TitleRole = Qt::UserRole + 1 , ScoreRole = Qt::UserRole + 2 , FirstUpdateRole = Qt::UserRole + 3 ,
  LastUpdateRole = Qt::UserRole + 4 , LinkStatusRole = Qt::UserRole + 5 , LinkedActivitiesRole = Qt::UserRole + 6 , MimeType = Qt::UserRole + 7
}
 

Public Slots

void forgetAllResources ()
 Clears the history of all resources that match the current model query.
 
void forgetResource (const QString &resource)
 Removes the specified resource from the history.
 
void forgetResource (int row)
 Removes the specified resource from the history.
 
void forgetResources (const QList< QString > &resources)
 Removes specified list of resources from the history.
 
void setResultPosition (const QString &resource, int position)
 Moves the resource to the specified position.
 
void sortItems (Qt::SortOrder sortOrder)
 Sort the items by title.
 

Public Member Functions

 ResultModel (Query query, const QString &clientId, QObject *parent=nullptr)
 
 ResultModel (Query query, QObject *parent=nullptr)
 
bool canFetchMore (const QModelIndex &parent) const override
 
QVariant data (const QModelIndex &item, int role=Qt::DisplayRole) const override
 
void fetchMore (const QModelIndex &parent) override
 
QVariant headerData (int section, Qt::Orientation orientation, int role=Qt::DisplayRole) const override
 
void linkToActivity (const QUrl &resource, const Terms::Activity &activity=Terms::Activity(QStringList()), const Terms::Agent &agent=Terms::Agent(QStringList()))
 
QHash< int, QByteArray > roleNames () const override
 
int rowCount (const QModelIndex &parent=QModelIndex()) const override
 
void unlinkFromActivity (const QUrl &resource, const Terms::Activity &activity=Terms::Activity(QStringList()), const Terms::Agent &agent=Terms::Agent(QStringList()))
 

Detailed Description

Provides a model which displays the resources matching the specified Query.

Member Function Documentation

◆ forgetAllResources

void KActivities::Stats::ResultModel::forgetAllResources ( )
slot

Clears the history of all resources that match the current model query.

◆ forgetResource [1/2]

void KActivities::Stats::ResultModel::forgetResource ( const QString &  resource)
slot

Removes the specified resource from the history.

◆ forgetResource [2/2]

void KActivities::Stats::ResultModel::forgetResource ( int  row)
slot

Removes the specified resource from the history.

◆ forgetResources

void KActivities::Stats::ResultModel::forgetResources ( const QList< QString > &  resources)
slot

Removes specified list of resources from the history.

◆ setResultPosition

void KActivities::Stats::ResultModel::setResultPosition ( const QString &  resource,
int  position 
)
slot

Moves the resource to the specified position.

Note that this only applies to the linked resources since the recently/frequently used ones have their natural order.

Note
This requires the clientId to be specified on construction.

◆ sortItems

void KActivities::Stats::ResultModel::sortItems ( Qt::SortOrder  sortOrder)
slot

Sort the items by title.

Note that this only affects the linked resources since the recently/frequently used ones have their natural order.

Note
This requires the clientId to be specified on construction.