taskswitcher/server/inc/tsstorage.h
changeset 117 c63ee96dbe5f
equal deleted inserted replaced
115:3ab5c078b490 117:c63ee96dbe5f
       
     1 /*
       
     2 * Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
       
     3 * All rights reserved.
       
     4 * This component and the accompanying materials are made available
       
     5 * under the terms of "Eclipse Public License v1.0"
       
     6 * which accompanies this distribution, and is available
       
     7 * at the URL "http://www.eclipse.org/legal/epl-v10.html".
       
     8 *
       
     9 * Initial Contributors:
       
    10 * Nokia Corporation - initial contribution.
       
    11 *
       
    12 * Contributors:
       
    13 *
       
    14 * Description:
       
    15 *
       
    16 */
       
    17 #ifndef TSSTORAGE_H
       
    18 #define TSSTORAGE_H
       
    19 #include <e32base.h>
       
    20 
       
    21 #include "tsmodel.h"
       
    22 #include "tsmodelobserver.h"
       
    23 #include "tsdataobserver.h"
       
    24 #include "tsdatastorage.h"
       
    25 
       
    26 class CTsStorage: public CBase,
       
    27                   public MTsModel,
       
    28                   public MTsModelObserver,
       
    29                   public MTsDataObserver,
       
    30                   public MTsDataStorage
       
    31 {
       
    32 public:
       
    33     static CTsStorage* NewL(const TArray<MTsModel*> &dataProviders);
       
    34     ~CTsStorage();
       
    35     
       
    36 private:
       
    37     CTsStorage();
       
    38     void ConstructL(const TArray<MTsModel*> &dataProviders);
       
    39     TInt resetModel();
       
    40     void resetModelL();
       
    41     void pullDataL(const MTsModel& src);
       
    42     void reorderDataL();
       
    43 
       
    44 public://from MTsModelObserver
       
    45     void dataChanged(MTsModel &model);
       
    46     void dataChanged(const TTsModelItem &item);
       
    47 
       
    48 public://from MTsModel
       
    49     TInt count() const;
       
    50     void setObserver(MTsModelObserver *observer);
       
    51     
       
    52 private://from MTsModel
       
    53     const TDesC& displayNameL(TInt offset) const;
       
    54     TInt iconHandleL(TInt offset) const;
       
    55     TTime timestampL(TInt offset) const;
       
    56     TTsModelItemKey keyL(TInt offset) const;
       
    57     TBool isActiveL(TInt offset) const;
       
    58     TBool isClosableL(TInt offset) const;
       
    59     TBool closeL(TTsModelItemKey key) const;
       
    60     TBool launchL(TTsModelItemKey key) const;
       
    61     TTsModelItem findL(TTsModelItemKey key) const;
       
    62 
       
    63 public://from MTsDataObserver
       
    64     void DataChanged();
       
    65 
       
    66 public://from MTsDataStorage
       
    67     TBool isSupported(TInt function) const;
       
    68     void handleDataL(TInt function, RReadStream& dataStream);
       
    69 
       
    70 private:
       
    71     RPointerArray<MTsModel> mDataProviders;
       
    72     RArray<TTsModelItem> mData;
       
    73     MTsModelObserver* mDataObserver;
       
    74 
       
    75 };
       
    76 
       
    77 #endif //TSSTORAGE_H