|
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 * |
|
15 * Description: |
|
16 * The source file of the time query of file manager |
|
17 */ |
|
18 |
|
19 #include "fmtimequery.h" |
|
20 |
|
21 #include <QGraphicsItem> |
|
22 #include <QGraphicsLinearLayout> |
|
23 |
|
24 #include <hbdatetimepicker.h> |
|
25 |
|
26 |
|
27 FmTimeQuery::FmTimeQuery( QGraphicsItem *parent ) : FmDialog( parent ) |
|
28 { |
|
29 setObjectName( "timeQueryDialog" ); |
|
30 mContentWidget = new QGraphicsWidget(); |
|
31 setContentWidget(mContentWidget); |
|
32 mContentWidget->setObjectName( "timeQueryContentWidget" ); |
|
33 QGraphicsLinearLayout *vLayout = new QGraphicsLinearLayout(); |
|
34 vLayout->setOrientation( Qt::Vertical ); |
|
35 |
|
36 mTimeWidget = new HbDateTimePicker(); |
|
37 mTimeWidget->setObjectName( "timeQueryTimeWidget" ); |
|
38 vLayout->addItem( mTimeWidget ); |
|
39 |
|
40 mTimeWidget->setFontSpec( HbFontSpec( HbFontSpec::Primary ) ); |
|
41 mTimeWidget->setDisplayFormat( "hh:mm" ); |
|
42 mTimeWidget->setDateTime( QDateTime::currentDateTime() ); |
|
43 |
|
44 this->setTimeout( NoTimeout ); |
|
45 mContentWidget->setLayout( vLayout ); |
|
46 } |
|
47 |
|
48 FmTimeQuery::~FmTimeQuery(void) |
|
49 { |
|
50 } |
|
51 |
|
52 void FmTimeQuery::setTime( const QTime &time ) |
|
53 { |
|
54 QDateTime dateTime = QDateTime::currentDateTime(); |
|
55 dateTime.setTime( time ); |
|
56 mTimeWidget->setDateTime( dateTime ); |
|
57 } |
|
58 |
|
59 QTime FmTimeQuery::getTime() |
|
60 { |
|
61 return mTimeWidget->dateTime().time(); |
|
62 } |