taskswitcherapp/tsdevicedialogplugin/src/tsdevicedialog.cpp
branchGCC_SURGE
changeset 68 4c11ecddf6b2
parent 53 f75922b9e380
parent 61 2b1b11a301d2
equal deleted inserted replaced
53:f75922b9e380 68:4c11ecddf6b2
     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: Default Screensaver runtime.
       
    15 *
       
    16 */
       
    17 
       
    18 #include <HbMainWindow>
       
    19 #include <HbDocumentLoader>
       
    20 
       
    21 #include "tsdevicedialog.h"
       
    22 
       
    23 /*!
       
    24     \class TsDeviceDialog
       
    25     \ingroup group_tsdevicedialogplugin
       
    26     \brief TaskSwitcher Device Dialog.
       
    27  */
       
    28 
       
    29 /*!
       
    30     Constructor.
       
    31     \param parent Parent.
       
    32  */
       
    33 TsDeviceDialog::TsDeviceDialog(HbDocumentLoader &loader, QGraphicsItem *parent) : HbDialog(parent), mLoader(loader)
       
    34 {
       
    35     connect(mainWindow(), SIGNAL(orientationChanged(Qt::Orientation)), this, SLOT(changeOrientation(Qt::Orientation)));
       
    36     connect(this, SIGNAL(aboutToClose()), this, SIGNAL(deviceDialogClosed()));
       
    37 }
       
    38 
       
    39 TsDeviceDialog::~TsDeviceDialog()
       
    40 {
       
    41     qDebug("Destruction");
       
    42 }
       
    43 
       
    44 /*!
       
    45     Sets device dialog parameters.
       
    46     \param parameters Device Dialog's parameters to be set.
       
    47     \ret return true if parameters are correct.
       
    48  */
       
    49 bool TsDeviceDialog::setDeviceDialogParameters(const QVariantMap &parameters)
       
    50 {
       
    51     Q_UNUSED(parameters);
       
    52     return false;
       
    53 }
       
    54 
       
    55 /*!
       
    56     Returns error code.
       
    57     \ret error code.
       
    58  */
       
    59 int TsDeviceDialog::deviceDialogError() const
       
    60 {
       
    61     return 0;
       
    62 }
       
    63 
       
    64 /*!
       
    65     Closes device dialog.
       
    66     \param byClient If dialog is close by client.
       
    67  */
       
    68 void TsDeviceDialog::closeDeviceDialog(bool byClient)
       
    69 {
       
    70     Q_UNUSED(byClient)
       
    71     hide();
       
    72     emit deviceDialogClosed();
       
    73 }
       
    74 
       
    75 /*!
       
    76     Returns device dialog instance.
       
    77     \ret Device dialog instance.
       
    78  */
       
    79 HbPopup *TsDeviceDialog::deviceDialogWidget() const
       
    80 {
       
    81     return const_cast<TsDeviceDialog *>(this);
       
    82 }
       
    83 
       
    84 void TsDeviceDialog::changeOrientation(Qt::Orientation orientation)
       
    85 {
       
    86     qDebug("Loading DOCML data for orientation %d", orientation);
       
    87     bool ok(true);
       
    88     if (orientation == Qt::Horizontal) {
       
    89         mLoader.load(":/xml/resource/layout.docml", "landscape", &ok);
       
    90     } else {
       
    91         mLoader.load(":/xml/resource/layout.docml", "portrait", &ok);
       
    92     }
       
    93     Q_ASSERT(ok);
       
    94 }