taskswitcher/server/inc/tsstorage.h
changeset 117 c63ee96dbe5f
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/taskswitcher/server/inc/tsstorage.h	Thu Sep 16 12:11:40 2010 +0100
@@ -0,0 +1,77 @@
+/*
+* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:
+*
+*/
+#ifndef TSSTORAGE_H
+#define TSSTORAGE_H
+#include <e32base.h>
+
+#include "tsmodel.h"
+#include "tsmodelobserver.h"
+#include "tsdataobserver.h"
+#include "tsdatastorage.h"
+
+class CTsStorage: public CBase,
+                  public MTsModel,
+                  public MTsModelObserver,
+                  public MTsDataObserver,
+                  public MTsDataStorage
+{
+public:
+    static CTsStorage* NewL(const TArray<MTsModel*> &dataProviders);
+    ~CTsStorage();
+    
+private:
+    CTsStorage();
+    void ConstructL(const TArray<MTsModel*> &dataProviders);
+    TInt resetModel();
+    void resetModelL();
+    void pullDataL(const MTsModel& src);
+    void reorderDataL();
+
+public://from MTsModelObserver
+    void dataChanged(MTsModel &model);
+    void dataChanged(const TTsModelItem &item);
+
+public://from MTsModel
+    TInt count() const;
+    void setObserver(MTsModelObserver *observer);
+    
+private://from MTsModel
+    const TDesC& displayNameL(TInt offset) const;
+    TInt iconHandleL(TInt offset) const;
+    TTime timestampL(TInt offset) const;
+    TTsModelItemKey keyL(TInt offset) const;
+    TBool isActiveL(TInt offset) const;
+    TBool isClosableL(TInt offset) const;
+    TBool closeL(TTsModelItemKey key) const;
+    TBool launchL(TTsModelItemKey key) const;
+    TTsModelItem findL(TTsModelItemKey key) const;
+
+public://from MTsDataObserver
+    void DataChanged();
+
+public://from MTsDataStorage
+    TBool isSupported(TInt function) const;
+    void handleDataL(TInt function, RReadStream& dataStream);
+
+private:
+    RPointerArray<MTsModel> mDataProviders;
+    RArray<TTsModelItem> mData;
+    MTsModelObserver* mDataObserver;
+
+};
+
+#endif //TSSTORAGE_H