phonebookui/pbkcommonui/inc/cntbaseview.h
changeset 24 0ba2181d7c28
equal deleted inserted replaced
0:e686773b3f54 24:0ba2181d7c28
       
     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 
       
    18 #ifndef CNTBASEVIEW_H
       
    19 #define CNTBASEVIEW_H
       
    20 
       
    21 #include <hbview.h>
       
    22 #include <hbapplication.h>
       
    23 
       
    24 #include "cntviewmanager.h"
       
    25 #include "cntmodelprovider.h"
       
    26 #include "cntactions.h"
       
    27 #include "cntcommands.h"
       
    28 #include "qtpbkglobal.h"
       
    29 #include "cntdocumentloader.h"
       
    30 
       
    31 // forward declarations
       
    32 class HbAbstractViewItem;
       
    33 
       
    34 QTM_USE_NAMESPACE
       
    35 
       
    36 class QTPBK_EXPORT CntBaseView : public HbView
       
    37 {
       
    38     Q_OBJECT
       
    39 
       
    40 public:
       
    41     CntBaseView(CntViewManager *viewManager, QGraphicsItem *parent = 0);
       
    42     virtual ~CntBaseView();
       
    43     virtual void setupView();
       
    44     CntActions *actions();
       
    45     CntViewManager *viewManager();
       
    46 
       
    47 public:
       
    48     virtual void deActivateView() { }
       
    49     virtual void activateView(const CntViewParameters &viewParameters){ Q_UNUSED(viewParameters); }
       
    50     virtual CntViewParameters::ViewId viewId() const = 0;
       
    51 
       
    52 public slots:
       
    53     virtual void aboutToCloseView() { }
       
    54     virtual void keyPressEvent(QKeyEvent *event);
       
    55     virtual void setOrientation(Qt::Orientation orientation) { Q_UNUSED(orientation); }
       
    56 
       
    57 #ifdef PBK_UNIT_TEST
       
    58 public:
       
    59 #else
       
    60 protected:
       
    61 #endif
       
    62 
       
    63     MobCntModel *contactModel();
       
    64     QContactManager *contactManager();
       
    65 
       
    66     //toolbar
       
    67     virtual void addActionsToToolBar() { }
       
    68     void addToolBar();
       
    69     void clearToolBar();
       
    70     virtual void setToolBarOrientation();
       
    71 
       
    72     // top right corner button
       
    73     virtual void addSoftkeyAction();
       
    74 
       
    75     // menu
       
    76     virtual void addMenuItems() { }
       
    77 
       
    78     CntCommands *commands();
       
    79 
       
    80     // XML related code
       
    81     CntDocumentLoader &documentLoader();
       
    82     bool loadDocument(const char *aDocument);
       
    83     bool loadDocument(const char *aDocument, const char *aSection);
       
    84     QGraphicsWidget* findWidget(const QString& aWidget);
       
    85     QObject* findObject(const QString& aObject);
       
    86 
       
    87 #ifdef PBK_UNIT_TEST
       
    88 public:
       
    89 #else
       
    90 private:
       
    91 #endif
       
    92     CntViewManager      *mViewManager;
       
    93     CntModelProvider    *mModelProvider;
       
    94     CntActions          *mActions;
       
    95     CntCommands         *mCommands;
       
    96     CntViewParameters   mViewParameters;
       
    97     HbAction            *mSoftKeyBackAction;
       
    98     CntDocumentLoader    mDocumentLoader;    
       
    99 
       
   100 };
       
   101 
       
   102 #endif // CNTBASEVIEW_H