equal
deleted
inserted
replaced
32 if (mainWindows.count() > 0) |
32 if (mainWindows.count() > 0) |
33 { |
33 { |
34 HbMainWindow *primaryWindow = mainWindows[0]; |
34 HbMainWindow *primaryWindow = mainWindows[0]; |
35 |
35 |
36 setTitle(primaryWindow->currentView()->title()); |
36 setTitle(primaryWindow->currentView()->title()); |
37 setItemVisible(Hb::AllItems, true); // ensure that all needed view items stay visible |
|
38 |
37 |
39 // set view as parent because action will be removed on view exit |
38 HbAction *backAction = new HbAction(Hb::BackNaviAction); |
40 mBackAction = new HbAction(Hb::BackAction, this); |
39 connect(backAction, SIGNAL(triggered()), SIGNAL(closeRequested())); |
41 primaryWindow->addSoftKeyAction(Hb::SecondarySoftKey, mBackAction); |
40 setNavigationAction(backAction); |
42 connect(mBackAction, SIGNAL(triggered()), SLOT(closeView())); |
|
43 |
41 |
44 QGraphicsLinearLayout *layout = new QGraphicsLinearLayout(Qt::Vertical); |
42 QGraphicsLinearLayout *layout = new QGraphicsLinearLayout(Qt::Vertical); |
45 HANDLE_ERROR_NULL(layout); |
43 HANDLE_ERROR_NULL(layout); |
46 if (layout) |
44 if (layout) |
47 { |
45 { |
64 setLayout(layout); |
62 setLayout(layout); |
65 } |
63 } |
66 } |
64 } |
67 } |
65 } |
68 |
66 |
69 void HgTestView::closeView() |
|
70 { |
|
71 FUNC_LOG; |
|
72 |
|
73 QList<HbMainWindow *> mainWindows = hbInstance->allMainWindows(); |
|
74 if (mainWindows.count() > 0) |
|
75 { |
|
76 HbMainWindow *primaryWindow = mainWindows[0]; |
|
77 primaryWindow->removeView(this); |
|
78 primaryWindow->setViewSwitchingEnabled(true); |
|
79 primaryWindow->removeSoftKeyAction(Hb::SecondarySoftKey, mBackAction); // restores original action |
|
80 } |
|
81 delete this; // ownership transferred back from HbMainWindow |
|
82 } |
|
83 |
|
84 void HgTestView::resizeEvent(QGraphicsSceneResizeEvent *event) |
67 void HgTestView::resizeEvent(QGraphicsSceneResizeEvent *event) |
85 { |
68 { |
86 FUNC_LOG; |
69 FUNC_LOG; |
87 |
70 |
88 if (mIconLabel && event) |
71 if (mIconLabel && event) |