clientprovisioning/cpqtsp/src/CpQtSpMainWindow.cpp
changeset 30 d3981f4fe6a4
child 62 03849bd79877
equal deleted inserted replaced
27:516a867811c3 30:d3981f4fe6a4
       
     1 /*
       
     2 * Copyright (c) 2002 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 *     Bio control for Provisioning documents.
       
    16 *
       
    17 */
       
    18 
       
    19 #include <hbmainwindow.h>
       
    20 #include <CpQtSpMainWindow.h>
       
    21 #include <CpQtSpView.h>
       
    22 #include <HbScrollArea>
       
    23 #include <HbWidget>
       
    24 #include <HbAction>
       
    25 #include <QCoreApplication>
       
    26 
       
    27 // ----------------------------------------------------------------------------
       
    28 // CpQtSpMainWindow::CpQtSpMainWindow
       
    29 // Description: Construtor
       
    30 // ----------------------------------------------------------------------------
       
    31 
       
    32 CpQtSpMainWindow::CpQtSpMainWindow(QWidget *parent)
       
    33     : HbMainWindow(parent)
       
    34 {
       
    35     iServiceProvider = new CpQtSp(this);
       
    36     connect(iServiceProvider,SIGNAL(showView()),this, SLOT(showView()));        
       
    37     connect(this,SIGNAL(aboutToChangeOrientation()),this,SLOT(OrientationChange()));
       
    38     iView = new CpQtSpView(iServiceProvider,this);
       
    39     }
       
    40 
       
    41 // ----------------------------------------------------------------------------
       
    42 // CpQtSpMainWindow::~CpQtSpMainWindow
       
    43 // Description: Destructor
       
    44 // ----------------------------------------------------------------------------
       
    45 
       
    46 CpQtSpMainWindow::~CpQtSpMainWindow()
       
    47 {    
       
    48     delete iServiceProvider;
       
    49 }
       
    50 
       
    51 // ----------------------------------------------------------------------------
       
    52 // CpQtSpMainWindow::OrientationChange
       
    53 // Description: Slot for orientation change notification
       
    54 // ----------------------------------------------------------------------------
       
    55 
       
    56 void CpQtSpMainWindow::OrientationChange()
       
    57 	{
       
    58     if(iView->getOrientationFlag())
       
    59         {
       
    60 		if(orientation() == Qt::Horizontal)
       
    61 			{
       
    62 				iView->setHorizontal();
       
    63 			}
       
    64 			else
       
    65 			{
       
    66 				iView->setVertical();
       
    67 			}
       
    68         }
       
    69 	}
       
    70 
       
    71 // ----------------------------------------------------------------------------
       
    72 // CpQtSpMainWindow::showView
       
    73 // Description: Slot for construction of provisioning view - called by CpQtSp
       
    74 // ----------------------------------------------------------------------------
       
    75 
       
    76 void CpQtSpMainWindow::showView()
       
    77 {  
       
    78    iView->constructView();
       
    79 }
       
    80 
       
    81 void CpQtSpMainWindow::buildView()
       
    82  {
       
    83     HbScrollArea *area = new HbScrollArea();
       
    84     area->setFlag(QGraphicsItem::ItemClipsChildrenToShape, false);    
       
    85     area->setScrollDirections(Qt::Horizontal|Qt::Vertical);     
       
    86     area->setVerticalScrollBarPolicy(HbScrollArea::ScrollBarAsNeeded);
       
    87     area->setHorizontalScrollBarPolicy(HbScrollArea::ScrollBarAsNeeded);
       
    88                 
       
    89     HbWidget* cont = new HbWidget();
       
    90     layout = new QGraphicsLinearLayout(Qt::Vertical);
       
    91     iView->buildView(layout);    
       
    92     cont->setLayout(layout);
       
    93     area->setContentWidget(cont);    
       
    94     HbToolBar* toolBar = iView->toolBar();
       
    95     HbAction* saveAction = new HbAction(hbTrId("txt_device_update_button_save"));     
       
    96     connect(saveAction, SIGNAL(triggered()), iView, SLOT(saveProvisoningMessage()));        
       
    97     HbAction* DeleteAction = new HbAction(hbTrId("txt_device_update_menu_delete"));
       
    98     connect(DeleteAction, SIGNAL(triggered()), iView, SLOT(deleteMessage()));
       
    99     toolBar->addAction(saveAction);
       
   100     toolBar->addAction(DeleteAction);
       
   101     toolBar->setOrientation(Qt::Horizontal);
       
   102     iView->setWidget(area);        
       
   103     addView(iView);
       
   104 }
       
   105 
       
   106 void CpQtSpMainWindow::closeWindow()
       
   107     {
       
   108     this->close();
       
   109     }
       
   110