taskswitcherapp/tsserviceplugin/src/tsitemprovider.cpp
changeset 36 cdae8c6c3876
parent 35 f9ce957a272c
equal deleted inserted replaced
35:f9ce957a272c 36:cdae8c6c3876
    23 #include <caservice.h>
    23 #include <caservice.h>
    24 
    24 
    25 #include "tsrecentapplicationsmodel.h"
    25 #include "tsrecentapplicationsmodel.h"
    26 #include "tsclosedapplicationsfiltermodel.h"
    26 #include "tsclosedapplicationsfiltermodel.h"
    27 #include "tsdataroles.h"
    27 #include "tsdataroles.h"
       
    28 
       
    29 /*!
       
    30     \class TsItemProvider
       
    31     \ingroup group_tsserviceplugin
       
    32     \brief Returns items that should be presented in TS.
       
    33 	
       
    34 	Service providing information about items that should be presented in TS. It also allows to
       
    35 	start some action on it (open/close).
       
    36 */
    28 
    37 
    29 TsItemProvider::TsItemProvider(QObject *parent) : TsItemProviderInterface(parent), mService(CaService::instance())
    38 TsItemProvider::TsItemProvider(QObject *parent) : TsItemProviderInterface(parent), mService(CaService::instance())
    30 {
    39 {
    31     TsRecentApplicationsModel *recentAppModel = new TsRecentApplicationsModel(this);
    40     TsRecentApplicationsModel *recentAppModel = new TsRecentApplicationsModel(this);
    32     mModel = new TsClosedApplicationsFilterModel(this);
    41     mModel = new TsClosedApplicationsFilterModel(this);
    61     }
    70     }
    62 }
    71 }
    63 
    72 
    64 void TsItemProvider::closeAllApplications()
    73 void TsItemProvider::closeAllApplications()
    65 {
    74 {
       
    75     QList<int> closableList;
    66     for (int row(0); row < mModel->rowCount(); ++row) {
    76     for (int row(0); row < mModel->rowCount(); ++row) {
    67         closeApplication(mModel->index(row, 0));
    77         if (mModel->index(row, 0).data(TsDataRoles::Closable).toBool()) {
       
    78             QVariant entryId = mModel->index(row, 0).data(TsDataRoles::EntryId);
       
    79             if (entryId.isValid()) {
       
    80                 closableList.append(entryId.toInt());
       
    81             }
       
    82         }
       
    83     }
       
    84     foreach (int entryId, closableList) {
       
    85         mModel->addId(entryId);
       
    86         mService->executeCommand(entryId, QString("close"));        
    68     }
    87     }
    69 }
    88 }
    70 
    89 
    71 void TsItemProvider::clearClosedApplicationList()
    90 void TsItemProvider::clearClosedApplicationList()
    72 {
    91 {