1 /* |
|
2 * Copyright (c) 2010 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: LocationPickerToolBar implementation |
|
15 * |
|
16 */ |
|
17 |
|
18 #include "locationpickertoolbar.h" |
|
19 #include "locationpickertypes.h" |
|
20 #include "locationpickerappwindow.h" |
|
21 |
|
22 |
|
23 // -------------------------------------------------- |
|
24 // LocationPickerToolBar::LocationPickerToolBar() |
|
25 // -------------------------------------------------- |
|
26 LocationPickerToolBar::LocationPickerToolBar( LocationPickerAppWindow* aWindow, QGraphicsItem* aParent ): |
|
27 HbToolBar( aParent ) |
|
28 { |
|
29 mWindow = aWindow; |
|
30 |
|
31 // Add all tab and connect to the slot |
|
32 mAllAction = addAction(HbIcon(KAllTab),QString("")); |
|
33 connect(mAllAction, SIGNAL(triggered()), this, SLOT(AllTabTriggered())); |
|
34 |
|
35 // Add collection tab and connect to the slot |
|
36 mCollectionAction = addAction(HbIcon(KCollectionTab),QString("")); |
|
37 connect(mCollectionAction, SIGNAL(triggered()), this, SLOT(CollectionTabTriggered())); |
|
38 |
|
39 // Add search tab and connect to the slot |
|
40 mSearchAction = addAction(HbIcon(KSearchTab),QString("")); |
|
41 connect(mSearchAction, SIGNAL(triggered()), this, SLOT(SearchTabTriggered())); |
|
42 } |
|
43 |
|
44 // -------------------------------------------------- |
|
45 // LocationPickerToolBar::disableTabs() |
|
46 // -------------------------------------------------- |
|
47 void LocationPickerToolBar::disableTabs() |
|
48 { |
|
49 mAllAction->setDisabled( true ); |
|
50 mCollectionAction->setDisabled( true ); |
|
51 mSearchAction->setDisabled( true ); |
|
52 } |
|
53 // -------------------------------------------------- |
|
54 // LocationPickerToolBar::AllTabTriggered() |
|
55 // -------------------------------------------------- |
|
56 void LocationPickerToolBar::AllTabTriggered() |
|
57 { |
|
58 int viewIndex = mWindow->currentViewIndex(); |
|
59 mWindow->setCurrentViewIndex(0); |
|
60 |
|
61 if( viewIndex > KNumberOfMainViews-1 ) |
|
62 { |
|
63 // the current view is collection view, so delete before switching to another view |
|
64 mWindow->deleteCollectionContentView(); |
|
65 } |
|
66 } |
|
67 |
|
68 // -------------------------------------------------- |
|
69 // LocationPickerToolBar::CollectionTabTriggered() |
|
70 // -------------------------------------------------- |
|
71 void LocationPickerToolBar::CollectionTabTriggered() |
|
72 { |
|
73 int viewIndex = mWindow->currentViewIndex(); |
|
74 mWindow->setCurrentViewIndex(2); |
|
75 |
|
76 if( viewIndex > KNumberOfMainViews-1 ) |
|
77 { |
|
78 // the current view is collection view, so delete before switching to another view |
|
79 mWindow->deleteCollectionContentView(); |
|
80 } |
|
81 } |
|
82 |
|
83 // -------------------------------------------------- |
|
84 // LocationPickerToolBar::SearchTabTriggered() |
|
85 // -------------------------------------------------- |
|
86 void LocationPickerToolBar::SearchTabTriggered() |
|
87 { |
|
88 int viewIndex = mWindow->currentViewIndex(); |
|
89 mWindow->setCurrentViewIndex(1); |
|
90 |
|
91 if( viewIndex > KNumberOfMainViews-1 ) |
|
92 { |
|
93 // the current view is collection view, so delete before switching to another view |
|
94 mWindow->deleteCollectionContentView(); |
|
95 } |
|
96 } |
|