53
|
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 |
#include "cntfetchmarkall.h"
|
|
19 |
|
|
20 |
#include <QGraphicsLinearLayout>
|
|
21 |
#include <hbcheckbox.h>
|
|
22 |
#include <hbtextitem.h>
|
|
23 |
#include <hbframeitem.h>
|
|
24 |
|
|
25 |
CntFetchMarkAll::CntFetchMarkAll(QGraphicsItem *aParent)
|
|
26 |
: HbWidget(aParent),
|
|
27 |
mCheckBox(NULL),
|
|
28 |
mCounterLabel(NULL),
|
|
29 |
mContactCount( 0 ),
|
|
30 |
mSelectionCount( 0 )
|
|
31 |
{
|
|
32 |
setSizePolicy( QSizePolicy::MinimumExpanding, QSizePolicy::Fixed );
|
|
33 |
|
|
34 |
mCheckBox = new HbCheckBox(this);
|
|
35 |
mCheckBox->setText(hbTrId("txt_common_list_mark_all_items"));
|
|
36 |
mCheckBox->setSizePolicy(QSizePolicy::MinimumExpanding, QSizePolicy::MinimumExpanding);
|
|
37 |
|
|
38 |
connect(mCheckBox, SIGNAL(stateChanged(int)), this, SIGNAL(markAll(int)) );
|
|
39 |
|
|
40 |
mCounterLabel = new HbTextItem( this );
|
|
41 |
|
|
42 |
mFrame = new HbFrameItem(this);
|
|
43 |
mFrame->frameDrawer().setFrameGraphicsName("qtg_fr_groupbox_normal");
|
|
44 |
mFrame->frameDrawer().setFrameType(HbFrameDrawer::NinePieces);
|
|
45 |
mFrame->setZValue(-2);
|
|
46 |
style()->setItemName(mFrame, "background");
|
|
47 |
|
|
48 |
HbStyle::setItemName(mCheckBox,"checkbox");
|
|
49 |
HbStyle::setItemName(mCounterLabel,"counter");
|
|
50 |
}
|
|
51 |
|
|
52 |
void CntFetchMarkAll::setMaxContactCount( int aContactCount )
|
|
53 |
{
|
|
54 |
mContactCount = aContactCount;
|
|
55 |
mCounterLabel->setText( QString("%1/%2").arg(mSelectionCount).arg(mContactCount) );
|
|
56 |
}
|
|
57 |
|
|
58 |
void CntFetchMarkAll::setSelectedContactCount( int aSelectedCount )
|
|
59 |
{
|
|
60 |
mSelectionCount = aSelectedCount;
|
|
61 |
mCounterLabel->setText( QString("%1/%2").arg(mSelectionCount).arg(mContactCount) );
|
54
|
62 |
|
|
63 |
if ( mSelectionCount < mContactCount )
|
|
64 |
{
|
|
65 |
blockSignals( true );
|
|
66 |
mCheckBox->setCheckState( Qt::Unchecked );
|
|
67 |
blockSignals( false );
|
|
68 |
}
|
53
|
69 |
}
|
|
70 |
|
|
71 |
CntFetchMarkAll::~CntFetchMarkAll()
|
|
72 |
{
|
54
|
73 |
delete mCheckBox;
|
|
74 |
mCheckBox = NULL;
|
|
75 |
delete mCounterLabel;
|
|
76 |
mCounterLabel = NULL;
|
|
77 |
delete mFrame;
|
|
78 |
mFrame = NULL;
|
53
|
79 |
}
|
|
80 |
|
|
81 |
// EOF
|