author | hgs |
Mon, 18 Oct 2010 18:23:13 +0300 | |
changeset 34 | ed14f46c0e55 |
parent 7 | 923ff622b8b9 |
permissions | -rw-r--r-- |
0
16d8024aca5e
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
1 |
/**************************************************************************** |
16d8024aca5e
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
2 |
** |
16d8024aca5e
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
3 |
** Copyright (C) 2008-2010 Nokia Corporation and/or its subsidiary(-ies). |
16d8024aca5e
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
4 |
** All rights reserved. |
16d8024aca5e
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
5 |
** Contact: Nokia Corporation (developer.feedback@nokia.com) |
16d8024aca5e
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
6 |
** |
16d8024aca5e
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
7 |
** This file is part of the HbCore module of the UI Extensions for Mobile. |
16d8024aca5e
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
8 |
** |
16d8024aca5e
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
9 |
** GNU Lesser General Public License Usage |
16d8024aca5e
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
10 |
** This file may be used under the terms of the GNU Lesser General Public |
16d8024aca5e
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
11 |
** License version 2.1 as published by the Free Software Foundation and |
16d8024aca5e
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
12 |
** appearing in the file LICENSE.LGPL included in the packaging of this file. |
16d8024aca5e
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
13 |
** Please review the following information to ensure the GNU Lesser General |
16d8024aca5e
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
14 |
** Public License version 2.1 requirements will be met: |
16d8024aca5e
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
15 |
** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. |
16d8024aca5e
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
16 |
** |
16d8024aca5e
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
17 |
** In addition, as a special exception, Nokia gives you certain additional |
16d8024aca5e
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
18 |
** rights. These rights are described in the Nokia Qt LGPL Exception |
16d8024aca5e
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
19 |
** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. |
16d8024aca5e
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
20 |
** |
16d8024aca5e
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
21 |
** If you have questions regarding the use of this file, please contact |
16d8024aca5e
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
22 |
** Nokia at developer.feedback@nokia.com. |
16d8024aca5e
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
23 |
** |
16d8024aca5e
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
24 |
****************************************************************************/ |
16d8024aca5e
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
25 |
|
16d8024aca5e
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
26 |
#include "hbpopup.h" |
16d8024aca5e
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
27 |
#include "hbpopup_p.h" |
16d8024aca5e
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
28 |
#include "hbinstance.h" |
16d8024aca5e
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
29 |
#include "hbpopupmanager_p.h" |
16d8024aca5e
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
30 |
#include "hbdeviceprofile.h" |
16d8024aca5e
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
31 |
#include "hbevent.h" |
16d8024aca5e
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
32 |
#include "hbgraphicsscene.h" |
16d8024aca5e
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
33 |
#include "hbgraphicsscene_p.h" |
16d8024aca5e
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
34 |
#include "hbtooltip.h" |
1
f7ac710697a9
Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
35 |
#include "hbglobal_p.h" |
2
06ff229162e9
Revision: 201017
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
1
diff
changeset
|
36 |
#include "hbvgmaskeffect_p.h" |
7
923ff622b8b9
Revision: 201025
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
6
diff
changeset
|
37 |
#include "hbvgchainedeffect_p.h" |
0
16d8024aca5e
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
38 |
#include <QTimer> |
16d8024aca5e
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
39 |
#include <QGraphicsSceneMouseEvent> |
16d8024aca5e
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
40 |
#include <QShowEvent> |
16d8024aca5e
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
41 |
#include <QHideEvent> |
16d8024aca5e
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
42 |
#include <QPointer> |
1
f7ac710697a9
Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
43 |
#include <QDebug> |
f7ac710697a9
Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
44 |
#include <QBitmap> |
7
923ff622b8b9
Revision: 201025
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
6
diff
changeset
|
45 |
#include <hbinstance_p.h> |
34 | 46 |
#include <QGraphicsScene> |
0
16d8024aca5e
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
47 |
#include <QApplication> // krazy:exclude=qclasses |
16d8024aca5e
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
48 |
|
16d8024aca5e
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
49 |
#include <hbwidgetfeedback.h> |
16d8024aca5e
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
50 |
|
16d8024aca5e
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
51 |
#ifdef HB_EFFECTS |
16d8024aca5e
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
52 |
#include "hbeffectinternal_p.h" |
16d8024aca5e
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
53 |
bool HbPopupPrivate::popupEffectsLoaded = false; |
16d8024aca5e
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
54 |
#endif |
16d8024aca5e
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
55 |
/*! |
1
f7ac710697a9
Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
56 |
@beta |
0
16d8024aca5e
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
57 |
@hbcore |
16d8024aca5e
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
58 |
\class HbPopup |
34 | 59 |
\brief The HbPopup class defines a set of properties that control the behavior of |
60 |
the many dialog and popup classes that derive from it. |
|
61 |
||
62 |
Objects of classes derived from %HbPopup are called \b popups. Typically they |
|
63 |
are displayed above other objects within the view, at the highest z-order. The %HbPopup |
|
64 |
class simply defines a frame with a number of properties. If you want to create an |
|
65 |
application dialog with a heading, content and a toolbar, use the HbDialog class (which |
|
66 |
is derived from %HbPopup) or one of its convenience subclasses. |
|
67 |
||
68 |
%HbPopup provides properties that you can use to customize the following aspects of a popup: |
|
69 |
||
70 |
- \b Modality. You can define whether the popup is modal or non-modal. A modal popup stops |
|
71 |
the user interacting with anything outside of the popup until it closes. A non-modal |
|
72 |
popup does not block the user's interaction with things outside of the popup. You |
|
73 |
set and get the modality by calling setModal() and isModal(), respectively. |
|
74 |
||
75 |
- <b>Dismiss policy</b>. You can define which user actions, if any, cause the popup to |
|
76 |
close. Possible values are defined by HbPopup::DismissPolicy. You set and get the dismiss |
|
77 |
policy by calling setDismissPolicy() and dismissPolicy(), respectively. |
|
78 |
||
79 |
- <b>Background fade policy</b>. You can set a policy to fade everything behind the |
|
80 |
popup. This is useful for modal dialogs, because the user cannot interact with |
|
81 |
anything behind the popup. You control this policy by calling setBackgroundFaded() and |
|
82 |
get the current policy by calling isBackgroundFaded(). |
|
83 |
||
84 |
- \b Timeout. You can define a timeout that causes the popup to be dismissed automatically |
|
85 |
after a set a period. You set and get this property by calling setTimeout() and |
|
86 |
timeout(), respectively. Call the setTimeout(HbPopup::DefaultTimeout) overload to use the |
|
87 |
default value for the popup type, which provides a common look and feel. |
|
88 |
||
89 |
- <b>Frame background type</b>. You can define the popup's background style. However, |
|
90 |
the actual appearance of the popup depends on the theme. You set and get this property by |
|
91 |
calling setFrameType() and frameType(), respectively. |
|
92 |
||
93 |
By default, popups are displayed in the center of the screen. Typically you should not override |
|
94 |
the default position of modal dialogs. However, some popups, such as context menus, need to be |
|
95 |
in a specific position. For these, you can use the setPreferredPos() method to set the |
|
96 |
preferred position. |
|
97 |
||
98 |
Popups that contain an editor may be repositioned by the virtual keyboard when it opens. |
|
99 |
When the virtual keyboard closes, it attempts to reposition the popup back to its |
|
100 |
previous position. However, this is not always possible, particularly when there has also |
|
101 |
been an orientation switch. |
|
0
16d8024aca5e
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
102 |
|
34 | 103 |
\section _usecases_hbpopup Using the HbPopup class |
104 |
||
105 |
Although it is possible to create an instance of the HbPopup class, it is designed as a |
|
106 |
base class to provide common features to the many popup and dialog classes that are |
|
107 |
derived from it (such as HbMenu, HbDialog, HbToolBarExtension, HbZoomSliderPopup). |
|
108 |
||
109 |
How you open a popup depends on whether it is modal. It is important to use the |
|
110 |
appropriate method, because this ensures the correct touch event handling. |
|
111 |
||
112 |
<table border="1" style="border-collapse: collapse; border: solid;"> |
|
113 |
<tr><th>To open</TH><TH>Call</th></tr> |
|
114 |
<tr><td>Modal popups</td><td>open()</td></tr> |
|
115 |
<tr><td>Non-modal popups</td><td>\link QGraphicsItem::show() show()\endlink</td></tr> |
|
116 |
</table> |
|
0
16d8024aca5e
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
117 |
|
34 | 118 |
\sa HbDialog, HbMenu |
0
16d8024aca5e
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
119 |
*/ |
16d8024aca5e
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
120 |
|
16d8024aca5e
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
121 |
/*! |
16d8024aca5e
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
122 |
\fn int HbPopup::type() const |
16d8024aca5e
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
123 |
*/ |
16d8024aca5e
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
124 |
|
16d8024aca5e
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
125 |
/*! |
16d8024aca5e
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
126 |
\enum HbPopup::DefaultTimeout |
16d8024aca5e
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
127 |
|
34 | 128 |
Identifies default timeout values for various popup types. The timeout defines a time |
129 |
period after which the popup is automatically closed. Using these default values |
|
130 |
provides a consistent look and feel. |
|
131 |
\sa setTimeout(HbPopup::DefaultTimeout) |
|
0
16d8024aca5e
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
132 |
*/ |
16d8024aca5e
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
133 |
|
16d8024aca5e
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
134 |
/*! |
16d8024aca5e
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
135 |
\var HbPopup::NoTimeout |
34 | 136 |
Defines a permanent popup, for which no timeout is defined. |
0
16d8024aca5e
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
137 |
*/ |
16d8024aca5e
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
138 |
|
16d8024aca5e
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
139 |
/*! |
16d8024aca5e
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
140 |
\var HbPopup::ConfirmationNoteTimeout |
34 | 141 |
The default timeout value for confirmation notes. |
0
16d8024aca5e
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
142 |
*/ |
16d8024aca5e
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
143 |
|
16d8024aca5e
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
144 |
/*! |
16d8024aca5e
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
145 |
\var HbPopup::StandardTimeout |
34 | 146 |
The default timeout value for standard non-permanent popups, such as notes. |
0
16d8024aca5e
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
147 |
*/ |
16d8024aca5e
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
148 |
|
16d8024aca5e
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
149 |
/*! |
16d8024aca5e
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
150 |
\var HbPopup::ContextMenuTimeout |
34 | 151 |
The default timeout value for context menus. |
0
16d8024aca5e
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
152 |
*/ |
16d8024aca5e
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
153 |
|
16d8024aca5e
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
154 |
/*! |
16d8024aca5e
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
155 |
\enum HbPopup::DismissPolicy |
16d8024aca5e
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
156 |
|
34 | 157 |
Defines the available dismiss policy values. The dismiss policy defines which |
158 |
user actions cause the popup to close. |
|
159 |
||
160 |
\sa setDismissPolicy(), dismissPolicy() |
|
0
16d8024aca5e
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
161 |
*/ |
16d8024aca5e
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
162 |
|
16d8024aca5e
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
163 |
/*! |
16d8024aca5e
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
164 |
\var HbPopup::NoDismiss |
34 | 165 |
The popup cannot be closed by the user. |
0
16d8024aca5e
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
166 |
*/ |
16d8024aca5e
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
167 |
|
16d8024aca5e
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
168 |
/*! |
16d8024aca5e
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
169 |
\var HbPopup::TapInside |
34 | 170 |
Closes the popup when the user taps within the popup's bounding rectangle. |
0
16d8024aca5e
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
171 |
*/ |
16d8024aca5e
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
172 |
|
16d8024aca5e
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
173 |
/*! |
16d8024aca5e
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
174 |
\var HbPopup::TapOutside |
16d8024aca5e
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
175 |
|
34 | 176 |
Closes the popup when the user taps outside of the popup's bounding rectangle. |
0
16d8024aca5e
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
177 |
*/ |
16d8024aca5e
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
178 |
|
16d8024aca5e
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
179 |
/*! |
16d8024aca5e
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
180 |
\var HbPopup::TapAnywhere |
34 | 181 |
Closes the popup when the user taps either inside or outside the popup's bounding |
182 |
rectangle. |
|
0
16d8024aca5e
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
183 |
*/ |
16d8024aca5e
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
184 |
|
16d8024aca5e
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
185 |
/*! |
16d8024aca5e
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
186 |
\enum HbPopup::FrameType |
16d8024aca5e
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
187 |
|
34 | 188 |
Identifies the background graphical styles of the popup's frame. |
0
16d8024aca5e
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
189 |
|
34 | 190 |
\sa setFrameType(), frameType() |
0
16d8024aca5e
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
191 |
*/ |
16d8024aca5e
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
192 |
|
16d8024aca5e
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
193 |
/*! |
16d8024aca5e
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
194 |
\var HbPopup::Strong |
34 | 195 |
Use the "strong" frame background style. |
0
16d8024aca5e
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
196 |
*/ |
16d8024aca5e
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
197 |
|
16d8024aca5e
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
198 |
/*! |
16d8024aca5e
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
199 |
\var HbPopup::Weak |
34 | 200 |
Use the "weak" frame background style. |
0
16d8024aca5e
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
201 |
*/ |
16d8024aca5e
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
202 |
|
16d8024aca5e
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
203 |
/*! |
16d8024aca5e
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
204 |
\fn void HbPopup::aboutToShow(); |
16d8024aca5e
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
205 |
|
34 | 206 |
This signal is emitted when the popup is about to be shown; that is, when |
207 |
\link QGraphicsItem::show() show()\endlink is called. |
|
0
16d8024aca5e
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
208 |
*/ |
16d8024aca5e
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
209 |
|
16d8024aca5e
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
210 |
/*! |
16d8024aca5e
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
211 |
\fn void HbPopup::aboutToHide(); |
16d8024aca5e
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
212 |
|
34 | 213 |
This signal is emitted when the popup is about to be hidden; that is, when |
214 |
\link QGraphicsItem::hide() hide()\endlink is called. |
|
0
16d8024aca5e
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
215 |
*/ |
16d8024aca5e
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
216 |
|
16d8024aca5e
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
217 |
|
16d8024aca5e
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
218 |
/*! |
16d8024aca5e
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
219 |
\fn void HbPopup::aboutToClose(); |
16d8024aca5e
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
220 |
|
34 | 221 |
This signal is emitted when the popup is about to close; that is, when |
222 |
\link QGraphicsWidget::close() close()\endlink is called or the popup is dismissed |
|
223 |
by the user or timeout. |
|
0
16d8024aca5e
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
224 |
*/ |
16d8024aca5e
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
225 |
|
6
c3690ec91ef8
Revision: 201023
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
5
diff
changeset
|
226 |
/*! |
c3690ec91ef8
Revision: 201023
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
5
diff
changeset
|
227 |
\enum HbPopup::Placement |
34 | 228 |
Identifies the corners and edges of the popup for use when setting its position |
229 |
using setPreferredPos(). |
|
6
c3690ec91ef8
Revision: 201023
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
5
diff
changeset
|
230 |
*/ |
34 | 231 |
|
232 |
/*! |
|
233 |
\var HbPopup::TopLeftCorner |
|
234 |
The popup's top left corner. |
|
235 |
*/ |
|
236 |
||
237 |
/*! |
|
238 |
\var HbPopup::TopRightCorner |
|
239 |
The popup's top right corner. |
|
240 |
*/ |
|
241 |
||
242 |
/*! |
|
243 |
\var HbPopup::BottomLeftCorner |
|
244 |
The popup's bottom left corner. |
|
245 |
*/ |
|
246 |
||
247 |
/*! |
|
248 |
\var HbPopup::BottomRightCorner |
|
249 |
The popup's bottom right corner. |
|
250 |
*/ |
|
251 |
||
252 |
/*! |
|
253 |
\var HbPopup::TopEdgeCenter |
|
254 |
The center of the popup's top edge. |
|
255 |
*/ |
|
256 |
||
257 |
/*! |
|
258 |
\var HbPopup::RightEdgeCenter |
|
259 |
The center of the popup's rightmost edge. |
|
260 |
*/ |
|
261 |
||
262 |
/*! |
|
263 |
\var HbPopup::BottomEdgeCenter |
|
264 |
The center of the popup's bottom edge. |
|
265 |
*/ |
|
266 |
||
267 |
/*! |
|
268 |
\var HbPopup::LeftEdgeCenter |
|
269 |
The center of the popup's leftmost edge. |
|
270 |
*/ |
|
271 |
||
272 |
/*! |
|
273 |
\var HbPopup::Center |
|
274 |
The center of the popup. |
|
275 |
*/ |
|
6
c3690ec91ef8
Revision: 201023
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
5
diff
changeset
|
276 |
|
34 | 277 |
namespace { |
278 |
//initial values if not found from hbpopup.css |
|
279 |
static const int NO_TIMEOUT = 0; |
|
280 |
static const int CONFIRMATION_NOTE_TIMEOUT = 1500; |
|
281 |
static const int STANDARD_TIMEOUT = 3000; |
|
282 |
static const int CONTEXT_MENU_TIMEOUT = 6000; |
|
283 |
||
284 |
static const QLatin1String NO_TIMEOUT_STRING("no-timeout"); |
|
285 |
static const QLatin1String CONFIRMATION_NOTE_TIMEOUT_STRING("confirmation-note-timeout"); |
|
286 |
static const QLatin1String STANDARD_TIMEOUT_STRING("standard-timeout"); |
|
287 |
static const QLatin1String CONTEXT_MENU_TIMEOUT_STRING("context-menu-timeout"); |
|
288 |
} |
|
289 |
||
290 |
/* |
|
291 |
Currently, virtual keyboard must be able to position a popup |
|
292 |
containing an editor to an arbitrary place. VKB does its best to |
|
293 |
reposition the popup back to original position when needed. At least in |
|
294 |
orientation switch the old position naturally is wrong, hence popup |
|
295 |
must be relayouted. |
|
296 |
||
297 |
It would be unreasonable to make special checks for popup in vkb |
|
298 |
side. It also would be unreasonable to do special checks for vkb in |
|
299 |
popup side. Hence this semi-hidden dynamic property for |
|
300 |
communicating this special case. |
|
301 |
||
302 |
WARNING: Do not count on this special behaviour, we might remove it |
|
303 |
without prior notice. If you do require such a behavior, please |
|
304 |
raise a feature request and we might make this a proper API. |
|
305 |
*/ |
|
306 |
const char* KPositionManagedByVKB("PositionManagedByVKB"); |
|
307 |
||
308 |
/* |
|
6
c3690ec91ef8
Revision: 201023
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
5
diff
changeset
|
309 |
\primitives |
34 | 310 |
\primitive{background} HbFrameItem representing the popup background. The background can be |
311 |
weak or strong (different graphical styles) depending on popup type. |
|
6
c3690ec91ef8
Revision: 201023
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
5
diff
changeset
|
312 |
\primitive{P_Popup_heading_frame} HbFrameItem representing the popup heading text background |
c3690ec91ef8
Revision: 201023
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
5
diff
changeset
|
313 |
*/ |
0
16d8024aca5e
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
314 |
HbPopupBackGround::HbPopupBackGround(HbPopup * popup, QGraphicsItem *parent) : |
16d8024aca5e
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
315 |
QGraphicsItem(parent), |
16d8024aca5e
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
316 |
popup(popup) |
16d8024aca5e
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
317 |
{ |
16d8024aca5e
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
318 |
// This is needed to be able to block moving the focus to items behind background item by |
16d8024aca5e
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
319 |
// clicking on them. |
16d8024aca5e
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
320 |
setFlag(QGraphicsItem::ItemIsFocusable); |
16d8024aca5e
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
321 |
|
16d8024aca5e
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
322 |
#if QT_VERSION >= 0x040600 |
16d8024aca5e
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
323 |
setFlag(QGraphicsItem::ItemHasNoContents, true); |
16d8024aca5e
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
324 |
#endif |
16d8024aca5e
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
325 |
} |
16d8024aca5e
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
326 |
|
16d8024aca5e
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
327 |
HbPopupBackGround::~HbPopupBackGround() |
16d8024aca5e
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
328 |
{ |
16d8024aca5e
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
329 |
// Set backgroundItem to 0 to avoid double deletion |
16d8024aca5e
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
330 |
// e.g. when backgroundItem is deleted by scene before its popup |
16d8024aca5e
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
331 |
if (popup) { |
16d8024aca5e
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
332 |
HbPopupPrivate::d_ptr(popup)->backgroundItem = 0; |
16d8024aca5e
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
333 |
} |
16d8024aca5e
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
334 |
} |
16d8024aca5e
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
335 |
|
16d8024aca5e
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
336 |
void HbPopupBackGround::setRect(QRectF rect) |
16d8024aca5e
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
337 |
{ |
16d8024aca5e
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
338 |
mRect = rect; |
16d8024aca5e
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
339 |
} |
16d8024aca5e
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
340 |
|
16d8024aca5e
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
341 |
QRectF HbPopupBackGround::boundingRect() const |
16d8024aca5e
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
342 |
{ |
16d8024aca5e
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
343 |
if(!mRect.isValid()){ |
16d8024aca5e
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
344 |
// set backgroundItem's size so that it is big enough |
16d8024aca5e
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
345 |
// to cover the screen both landscape and portrait mode |
16d8024aca5e
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
346 |
const QSizeF screenSize = HbDeviceProfile::profile(this).logicalSize(); |
16d8024aca5e
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
347 |
qreal dim = qMax(screenSize.width(), screenSize.height()); |
16d8024aca5e
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
348 |
mRect.adjust(0,0,dim,dim); |
16d8024aca5e
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
349 |
} |
16d8024aca5e
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
350 |
return mRect; |
16d8024aca5e
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
351 |
} |
16d8024aca5e
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
352 |
|
16d8024aca5e
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
353 |
void HbPopupBackGround::paint(QPainter *painter, const QStyleOptionGraphicsItem *option, QWidget *widget ) |
16d8024aca5e
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
354 |
{ |
16d8024aca5e
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
355 |
Q_UNUSED(option) |
16d8024aca5e
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
356 |
Q_UNUSED(widget); |
16d8024aca5e
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
357 |
Q_UNUSED(painter); |
16d8024aca5e
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
358 |
} |
16d8024aca5e
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
359 |
|
16d8024aca5e
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
360 |
bool HbPopupBackGround::sceneEvent(QEvent *event) |
16d8024aca5e
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
361 |
{ |
16d8024aca5e
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
362 |
if (event->type() == QEvent::GraphicsSceneMousePress) { |
16d8024aca5e
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
363 |
HbPopupPrivate::d_ptr(popup)->handleBackgroundMousePressEvent(); |
16d8024aca5e
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
364 |
} |
16d8024aca5e
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
365 |
if (event->type() == QEvent::GraphicsSceneMouseRelease) { |
16d8024aca5e
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
366 |
HbPopupPrivate::d_ptr(popup)->handleBackgroundMouseReleaseEvent(static_cast<QGraphicsSceneMouseEvent *>(event)); |
16d8024aca5e
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
367 |
} |
16d8024aca5e
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
368 |
if (event->type() == QEvent::FocusIn && scene()) { |
16d8024aca5e
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
369 |
// Prevents last focus item losing its focus |
16d8024aca5e
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
370 |
// This event is received only when popup is modal |
16d8024aca5e
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
371 |
QFocusEvent restoreLastFocus(QEvent::FocusIn,Qt::OtherFocusReason); |
16d8024aca5e
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
372 |
QApplication::sendEvent(scene(),&restoreLastFocus); // krazy:exclude=qclasses |
16d8024aca5e
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
373 |
} |
16d8024aca5e
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
374 |
// accept events only for modal popups |
16d8024aca5e
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
375 |
if(popup->isModal()){ |
16d8024aca5e
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
376 |
event->accept(); |
16d8024aca5e
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
377 |
return true; |
16d8024aca5e
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
378 |
} else { |
16d8024aca5e
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
379 |
event->ignore(); |
16d8024aca5e
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
380 |
} |
16d8024aca5e
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
381 |
return QGraphicsItem::sceneEvent(event); |
16d8024aca5e
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
382 |
} |
16d8024aca5e
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
383 |
|
16d8024aca5e
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
384 |
HbPopupPrivate::HbPopupPrivate( ) : |
16d8024aca5e
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
385 |
hasEffects(false), |
16d8024aca5e
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
386 |
closed(false), |
16d8024aca5e
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
387 |
hidingInProgress(true), |
34 | 388 |
showingInProgress(false), |
0
16d8024aca5e
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
389 |
delayedHide(false), |
16d8024aca5e
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
390 |
deleteOnClose(false), |
16d8024aca5e
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
391 |
modal(true), // must be in sync QGraphicsItem::ItemIsFocusable of backgroundItem |
16d8024aca5e
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
392 |
fadeBackground(true), |
16d8024aca5e
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
393 |
inDestruction(false), |
16d8024aca5e
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
394 |
aboutToShowSignalGuard(false), |
16d8024aca5e
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
395 |
duplicateShowEvent(false), |
16d8024aca5e
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
396 |
timedOut(false), |
34 | 397 |
timeout(-1), |
398 |
timeoutPending(true), |
|
399 |
pendingTimeout(HbPopup::StandardTimeout), |
|
0
16d8024aca5e
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
400 |
// priorityValue(HbPopup::Default), |
16d8024aca5e
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
401 |
priorityValue(0), |
16d8024aca5e
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
402 |
dismissPolicy(HbPopup::TapOutside), |
16d8024aca5e
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
403 |
backgroundItem(0), |
16d8024aca5e
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
404 |
mousePressLocation(None), |
16d8024aca5e
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
405 |
frameType(HbPopup::Strong), |
16d8024aca5e
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
406 |
preferredPosSet(false), |
34 | 407 |
placement(HbPopup::TopLeftCorner), |
408 |
mStartEffect(true), |
|
1
f7ac710697a9
Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
409 |
mScreenMargin(0.0), |
5
627c4a0fd0e7
Revision: 201021
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
2
diff
changeset
|
410 |
mAutoLayouting(true), |
6
c3690ec91ef8
Revision: 201023
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
5
diff
changeset
|
411 |
mOriginalAutoLayouting(mAutoLayouting), |
34 | 412 |
mActivePopup(true), |
413 |
mMaskedItem(0), |
|
414 |
mPopupMask(0), |
|
2
06ff229162e9
Revision: 201017
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
1
diff
changeset
|
415 |
mVgMaskEffect(0), |
5
627c4a0fd0e7
Revision: 201021
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
2
diff
changeset
|
416 |
mOrientationEffectHide(false), |
34 | 417 |
mGestureOverride(false), |
418 |
mFullScreen(false), |
|
0
16d8024aca5e
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
419 |
timeoutTimerInstance(0) |
16d8024aca5e
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
420 |
{ |
16d8024aca5e
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
421 |
} |
16d8024aca5e
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
422 |
|
16d8024aca5e
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
423 |
HbPopupPrivate::~HbPopupPrivate() |
16d8024aca5e
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
424 |
{ |
7
923ff622b8b9
Revision: 201025
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
6
diff
changeset
|
425 |
stopTimeout(); |
923ff622b8b9
Revision: 201025
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
6
diff
changeset
|
426 |
delete timeoutTimerInstance; |
34 | 427 |
delete mPopupMask; |
0
16d8024aca5e
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
428 |
} |
16d8024aca5e
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
429 |
|
16d8024aca5e
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
430 |
void HbPopupPrivate::init() |
16d8024aca5e
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
431 |
{ |
16d8024aca5e
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
432 |
Q_Q(HbPopup); |
16d8024aca5e
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
433 |
|
16d8024aca5e
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
434 |
q->setAttribute(Hb::InsidePopup); |
16d8024aca5e
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
435 |
|
16d8024aca5e
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
436 |
// By default popups are focusable |
34 | 437 |
q->setFocusPolicy(Qt::StrongFocus); |
438 |
q->setBackgroundItem(new HbFrameItem(QLatin1String("qtg_fr_popup"), HbFrameDrawer::NinePieces), -1); |
|
7
923ff622b8b9
Revision: 201025
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
6
diff
changeset
|
439 |
q->updatePrimitives(); |
923ff622b8b9
Revision: 201025
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
6
diff
changeset
|
440 |
|
0
16d8024aca5e
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
441 |
|
16d8024aca5e
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
442 |
// Only for popup without parent |
16d8024aca5e
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
443 |
if (!q->parentItem()) { |
16d8024aca5e
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
444 |
backgroundItem = new HbPopupBackGround(q); |
16d8024aca5e
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
445 |
backgroundItem->setVisible(false); |
1
f7ac710697a9
Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
446 |
// Popup is invisible by default (explicit show or open call is required) |
0
16d8024aca5e
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
447 |
q->setVisible(false); |
16d8024aca5e
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
448 |
} |
7
923ff622b8b9
Revision: 201025
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
6
diff
changeset
|
449 |
hidingInProgress = false; |
923ff622b8b9
Revision: 201025
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
6
diff
changeset
|
450 |
QGraphicsItem::GraphicsItemFlags itemFlags = q->flags(); |
923ff622b8b9
Revision: 201025
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
6
diff
changeset
|
451 |
itemFlags |= QGraphicsItem::ItemClipsToShape; |
923ff622b8b9
Revision: 201025
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
6
diff
changeset
|
452 |
itemFlags |= QGraphicsItem::ItemClipsChildrenToShape; |
923ff622b8b9
Revision: 201025
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
6
diff
changeset
|
453 |
itemFlags |= QGraphicsItem::ItemSendsGeometryChanges; |
34 | 454 |
itemFlags |= QGraphicsItem::ItemIsPanel; |
455 |
q->setFlags(itemFlags); |
|
456 |
q->setActive(false); |
|
457 |
||
458 |
q->setAcceptTouchEvents(true); |
|
459 |
||
460 |
defaultTimeouts[HbPopup::NoTimeout] = NO_TIMEOUT; |
|
461 |
defaultTimeouts[HbPopup::ConfirmationNoteTimeout] = CONFIRMATION_NOTE_TIMEOUT; |
|
462 |
defaultTimeouts[HbPopup::StandardTimeout] = STANDARD_TIMEOUT; |
|
463 |
defaultTimeouts[HbPopup::ContextMenuTimeout] = CONTEXT_MENU_TIMEOUT; |
|
7
923ff622b8b9
Revision: 201025
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
6
diff
changeset
|
464 |
} |
34 | 465 |
|
7
923ff622b8b9
Revision: 201025
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
6
diff
changeset
|
466 |
void HbPopupPrivate::_q_appearEffectEnded(HbEffect::EffectStatus status) |
923ff622b8b9
Revision: 201025
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
6
diff
changeset
|
467 |
{ |
34 | 468 |
Q_UNUSED(status); |
469 |
Q_Q(HbPopup); |
|
470 |
||
471 |
showingInProgress = false; |
|
472 |
q->emit popupReady(); |
|
473 |
} |
|
474 |
||
475 |
void HbPopupPrivate::_q_maskEffectDestroyed() |
|
476 |
{ |
|
477 |
mVgMaskEffect = 0; |
|
0
16d8024aca5e
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
478 |
} |
16d8024aca5e
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
479 |
|
7
923ff622b8b9
Revision: 201025
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
6
diff
changeset
|
480 |
CSystemToneService* HbPopupPrivate::systemToneService() |
923ff622b8b9
Revision: 201025
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
6
diff
changeset
|
481 |
{ |
34 | 482 |
return HbInstancePrivate::d_ptr()->systemTone(); |
7
923ff622b8b9
Revision: 201025
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
6
diff
changeset
|
483 |
} |
0
16d8024aca5e
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
484 |
/* |
2
06ff229162e9
Revision: 201017
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
1
diff
changeset
|
485 |
Sets the priority for a popup. |
06ff229162e9
Revision: 201017
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
1
diff
changeset
|
486 |
A popup with higher priority is always shown on top of a popup with lower priority. |
06ff229162e9
Revision: 201017
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
1
diff
changeset
|
487 |
In case of popups with same priority the lastly shown will be on top. |
06ff229162e9
Revision: 201017
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
1
diff
changeset
|
488 |
Default priority is HbPopup::Default |
06ff229162e9
Revision: 201017
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
1
diff
changeset
|
489 |
\sa priority() |
0
16d8024aca5e
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
490 |
*/ |
16d8024aca5e
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
491 |
void HbPopupPrivate::setPriority(quint8 priority) |
16d8024aca5e
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
492 |
{ |
16d8024aca5e
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
493 |
//TODO: consider implementing dynamic change of prorities |
16d8024aca5e
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
494 |
// i.e. if the priority changes while the popup is registered to popupManager |
16d8024aca5e
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
495 |
// then re-register it to get its Z value updated |
16d8024aca5e
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
496 |
priorityValue=priority; |
16d8024aca5e
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
497 |
} |
16d8024aca5e
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
498 |
|
16d8024aca5e
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
499 |
#ifdef HB_EFFECTS |
16d8024aca5e
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
500 |
void HbPopupPrivate::_q_delayedHide(HbEffect::EffectStatus status) |
16d8024aca5e
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
501 |
{ |
16d8024aca5e
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
502 |
Q_UNUSED(status); |
16d8024aca5e
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
503 |
Q_Q(HbPopup); |
16d8024aca5e
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
504 |
|
16d8024aca5e
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
505 |
// Apply forceHide only if the effect started successfully |
16d8024aca5e
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
506 |
if (status.reason != Hb::EffectNotStarted) { |
16d8024aca5e
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
507 |
forceHide(); |
16d8024aca5e
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
508 |
} else { |
16d8024aca5e
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
509 |
delayedHide = false; |
16d8024aca5e
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
510 |
} |
16d8024aca5e
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
511 |
|
16d8024aca5e
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
512 |
if (deleteOnClose) { |
16d8024aca5e
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
513 |
q->deleteLater(); |
16d8024aca5e
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
514 |
} |
16d8024aca5e
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
515 |
hidingInProgress = false; |
34 | 516 |
mGestureOverride = false; |
0
16d8024aca5e
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
517 |
} |
16d8024aca5e
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
518 |
|
5
627c4a0fd0e7
Revision: 201021
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
2
diff
changeset
|
519 |
void HbPopupPrivate::_q_orientationAboutToChange(Qt::Orientation orient, bool animate) |
0
16d8024aca5e
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
520 |
{ |
5
627c4a0fd0e7
Revision: 201021
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
2
diff
changeset
|
521 |
Q_UNUSED(orient); |
0
16d8024aca5e
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
522 |
Q_Q(HbPopup); |
5
627c4a0fd0e7
Revision: 201021
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
2
diff
changeset
|
523 |
if (animate && q->isVisible()) { |
627c4a0fd0e7
Revision: 201021
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
2
diff
changeset
|
524 |
HbEffect::start(q, "HB_POPUP", "orient_disappear"); |
627c4a0fd0e7
Revision: 201021
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
2
diff
changeset
|
525 |
mOrientationEffectHide = true; |
0
16d8024aca5e
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
526 |
} |
5
627c4a0fd0e7
Revision: 201021
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
2
diff
changeset
|
527 |
} |
627c4a0fd0e7
Revision: 201021
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
2
diff
changeset
|
528 |
|
627c4a0fd0e7
Revision: 201021
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
2
diff
changeset
|
529 |
#endif // HB_EFFECTS |
0
16d8024aca5e
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
530 |
|
5
627c4a0fd0e7
Revision: 201021
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
2
diff
changeset
|
531 |
void HbPopupPrivate::_q_orientationChanged() |
627c4a0fd0e7
Revision: 201021
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
2
diff
changeset
|
532 |
{ |
627c4a0fd0e7
Revision: 201021
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
2
diff
changeset
|
533 |
Q_Q(HbPopup); |
627c4a0fd0e7
Revision: 201021
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
2
diff
changeset
|
534 |
if (q->isVisible()) { |
34 | 535 |
QEvent userEvent(QEvent::LayoutRequest); |
5
627c4a0fd0e7
Revision: 201021
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
2
diff
changeset
|
536 |
QCoreApplication::sendEvent(q, &userEvent); |
627c4a0fd0e7
Revision: 201021
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
2
diff
changeset
|
537 |
} |
34 | 538 |
|
539 |
q->repolish(); |
|
5
627c4a0fd0e7
Revision: 201021
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
2
diff
changeset
|
540 |
#ifdef HB_EFFECTS |
627c4a0fd0e7
Revision: 201021
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
2
diff
changeset
|
541 |
if (mOrientationEffectHide) { |
34 | 542 |
QRectF extRect(0.0, |
543 |
-q->boundingRect().height(), |
|
544 |
q->boundingRect().width(), |
|
545 |
0); |
|
5
627c4a0fd0e7
Revision: 201021
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
2
diff
changeset
|
546 |
HbEffect::cancel(q); |
34 | 547 |
HbEffect::start(q, "HB_POPUP", "orient_appear", q, "_q_appearEffectEnded", |
548 |
QVariant(), extRect); |
|
5
627c4a0fd0e7
Revision: 201021
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
2
diff
changeset
|
549 |
mOrientationEffectHide = false; |
34 | 550 |
showingInProgress = true; |
5
627c4a0fd0e7
Revision: 201021
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
2
diff
changeset
|
551 |
} |
627c4a0fd0e7
Revision: 201021
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
2
diff
changeset
|
552 |
#endif |
0
16d8024aca5e
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
553 |
} |
16d8024aca5e
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
554 |
|
16d8024aca5e
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
555 |
void HbPopupPrivate::_q_timeoutFinished() |
16d8024aca5e
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
556 |
{ |
16d8024aca5e
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
557 |
Q_Q(HbPopup); |
16d8024aca5e
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
558 |
timedOut = true; |
16d8024aca5e
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
559 |
q->close(); |
16d8024aca5e
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
560 |
} |
16d8024aca5e
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
561 |
|
16d8024aca5e
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
562 |
void HbPopupPrivate::stopTimeout() |
16d8024aca5e
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
563 |
{ |
16d8024aca5e
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
564 |
if (timeoutTimerInstance) |
16d8024aca5e
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
565 |
timeoutTimerInstance->stop(); |
16d8024aca5e
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
566 |
} |
16d8024aca5e
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
567 |
|
16d8024aca5e
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
568 |
void HbPopupPrivate::startTimeout() |
16d8024aca5e
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
569 |
{ |
16d8024aca5e
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
570 |
if (timeout > 0) { |
16d8024aca5e
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
571 |
timeoutTimer()->start(); |
16d8024aca5e
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
572 |
timedOut = false; |
16d8024aca5e
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
573 |
} |
16d8024aca5e
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
574 |
} |
16d8024aca5e
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
575 |
|
2
06ff229162e9
Revision: 201017
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
1
diff
changeset
|
576 |
void HbPopupPrivate::setTimeout(int msec) |
06ff229162e9
Revision: 201017
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
1
diff
changeset
|
577 |
{ |
06ff229162e9
Revision: 201017
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
1
diff
changeset
|
578 |
Q_Q(HbPopup); |
06ff229162e9
Revision: 201017
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
1
diff
changeset
|
579 |
|
34 | 580 |
timeoutPending = false; |
2
06ff229162e9
Revision: 201017
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
1
diff
changeset
|
581 |
int prevTimeout = timeout; |
06ff229162e9
Revision: 201017
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
1
diff
changeset
|
582 |
timeout = msec; |
06ff229162e9
Revision: 201017
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
1
diff
changeset
|
583 |
if (msec > 0) { |
06ff229162e9
Revision: 201017
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
1
diff
changeset
|
584 |
timeoutTimer()->setInterval(msec); |
06ff229162e9
Revision: 201017
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
1
diff
changeset
|
585 |
// If timeout was 0 and it is now set to something > 0 then start the timer. |
06ff229162e9
Revision: 201017
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
1
diff
changeset
|
586 |
if (q->isVisible() && prevTimeout <= 0) |
06ff229162e9
Revision: 201017
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
1
diff
changeset
|
587 |
startTimeout(); |
06ff229162e9
Revision: 201017
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
1
diff
changeset
|
588 |
} else { |
06ff229162e9
Revision: 201017
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
1
diff
changeset
|
589 |
stopTimeout(); |
06ff229162e9
Revision: 201017
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
1
diff
changeset
|
590 |
} |
06ff229162e9
Revision: 201017
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
1
diff
changeset
|
591 |
} |
06ff229162e9
Revision: 201017
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
1
diff
changeset
|
592 |
|
0
16d8024aca5e
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
593 |
QTimer *HbPopupPrivate::timeoutTimer() |
16d8024aca5e
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
594 |
{ |
16d8024aca5e
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
595 |
Q_Q(HbPopup); |
16d8024aca5e
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
596 |
if (!timeoutTimerInstance) { |
7
923ff622b8b9
Revision: 201025
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
6
diff
changeset
|
597 |
timeoutTimerInstance = new QTimer(); |
0
16d8024aca5e
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
598 |
timeoutTimerInstance->setSingleShot(true); |
16d8024aca5e
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
599 |
q->connect(timeoutTimerInstance, SIGNAL(timeout()), q, SLOT(_q_timeoutFinished())); |
16d8024aca5e
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
600 |
} |
16d8024aca5e
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
601 |
|
16d8024aca5e
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
602 |
return timeoutTimerInstance; |
16d8024aca5e
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
603 |
} |
16d8024aca5e
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
604 |
|
16d8024aca5e
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
605 |
//returns true if popup has been added to scene here. |
16d8024aca5e
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
606 |
bool HbPopupPrivate::addPopupToScene() |
16d8024aca5e
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
607 |
{ |
16d8024aca5e
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
608 |
Q_Q(HbPopup); |
16d8024aca5e
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
609 |
bool popupAdded(false); |
16d8024aca5e
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
610 |
if (!q->parentItem()) { |
1
f7ac710697a9
Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
611 |
if (!q->scene() && !HbInstance::instance()->allMainWindows().isEmpty()) { |
f7ac710697a9
Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
612 |
HbInstance::instance()->allMainWindows().at(0)->scene()->addItem(q); |
0
16d8024aca5e
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
613 |
popupAdded = true; |
16d8024aca5e
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
614 |
if (backgroundItem) { |
16d8024aca5e
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
615 |
q->scene()->addItem(backgroundItem); |
16d8024aca5e
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
616 |
} |
16d8024aca5e
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
617 |
} else if (q->scene() && backgroundItem && backgroundItem->scene() != q->scene()) { |
16d8024aca5e
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
618 |
q->scene()->addItem(backgroundItem); |
16d8024aca5e
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
619 |
} |
16d8024aca5e
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
620 |
} |
16d8024aca5e
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
621 |
return popupAdded; |
16d8024aca5e
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
622 |
} |
16d8024aca5e
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
623 |
|
16d8024aca5e
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
624 |
void HbPopupPrivate::handleBackgroundMousePressEvent() |
16d8024aca5e
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
625 |
{ |
2
06ff229162e9
Revision: 201017
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
1
diff
changeset
|
626 |
Q_Q(HbPopup); |
0
16d8024aca5e
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
627 |
mousePressLocation = Background; |
34 | 628 |
if (dismissPolicy & HbPopup::TapOutside && !modal) { |
2
06ff229162e9
Revision: 201017
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
1
diff
changeset
|
629 |
q->close(); |
06ff229162e9
Revision: 201017
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
1
diff
changeset
|
630 |
} |
0
16d8024aca5e
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
631 |
} |
16d8024aca5e
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
632 |
|
16d8024aca5e
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
633 |
void HbPopupPrivate::handleBackgroundMouseReleaseEvent(QGraphicsSceneMouseEvent *event) |
16d8024aca5e
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
634 |
{ |
16d8024aca5e
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
635 |
Q_Q(HbPopup); |
16d8024aca5e
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
636 |
|
16d8024aca5e
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
637 |
// Handle cases only for Background or Popup originated mouse presses and when |
16d8024aca5e
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
638 |
// any dismiss policy defined |
16d8024aca5e
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
639 |
if (mousePressLocation != None && dismissPolicy != HbPopup::NoDismiss) { |
16d8024aca5e
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
640 |
|
16d8024aca5e
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
641 |
MouseEventLocationType mouseReleaseLocation = Background; |
16d8024aca5e
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
642 |
|
16d8024aca5e
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
643 |
if (q->contains (q->mapFromScene(event->scenePos()))) { |
16d8024aca5e
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
644 |
mouseReleaseLocation = Popup; |
16d8024aca5e
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
645 |
} |
16d8024aca5e
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
646 |
|
16d8024aca5e
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
647 |
// Mouse is released within popup |
16d8024aca5e
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
648 |
if (mouseReleaseLocation == Popup) { |
16d8024aca5e
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
649 |
// Handle cases only when TapInside is set |
16d8024aca5e
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
650 |
if (dismissPolicy & HbPopup::TapInside) { |
16d8024aca5e
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
651 |
// Close popup if mouse press is initiated within popup or TapOutside is set |
16d8024aca5e
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
652 |
if (mousePressLocation == Popup || dismissPolicy & HbPopup::TapOutside) { |
16d8024aca5e
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
653 |
q->close(); |
16d8024aca5e
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
654 |
} |
16d8024aca5e
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
655 |
} |
34 | 656 |
} else if ( mousePressLocation == Background && |
657 |
dismissPolicy & HbPopup::TapOutside && modal) { |
|
658 |
q->close(); |
|
0
16d8024aca5e
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
659 |
} |
16d8024aca5e
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
660 |
} |
16d8024aca5e
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
661 |
|
16d8024aca5e
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
662 |
// reset mousePressLocation |
16d8024aca5e
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
663 |
mousePressLocation = None; |
16d8024aca5e
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
664 |
} |
16d8024aca5e
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
665 |
|
16d8024aca5e
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
666 |
void HbPopupPrivate::forceHide() |
16d8024aca5e
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
667 |
{ |
16d8024aca5e
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
668 |
Q_Q(HbPopup); |
16d8024aca5e
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
669 |
|
16d8024aca5e
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
670 |
delayedHide = false; |
16d8024aca5e
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
671 |
q->hide(); |
16d8024aca5e
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
672 |
delayedHide = hasEffects; |
16d8024aca5e
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
673 |
} |
16d8024aca5e
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
674 |
|
16d8024aca5e
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
675 |
void HbPopupPrivate::addPopupEffects() |
16d8024aca5e
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
676 |
{ |
16d8024aca5e
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
677 |
|
16d8024aca5e
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
678 |
#ifdef HB_EFFECTS |
16d8024aca5e
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
679 |
effectType = "HB_POPUP"; |
16d8024aca5e
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
680 |
hasEffects = popupEffectsLoaded; |
16d8024aca5e
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
681 |
if (popupEffectsLoaded) |
16d8024aca5e
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
682 |
return; |
16d8024aca5e
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
683 |
popupEffectsLoaded = true; |
16d8024aca5e
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
684 |
hasEffects = HbEffectInternal::add("HB_POPUP", |
16d8024aca5e
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
685 |
"popup_appear", |
16d8024aca5e
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
686 |
"appear"); |
16d8024aca5e
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
687 |
if (hasEffects) { |
16d8024aca5e
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
688 |
hasEffects = HbEffectInternal::add("HB_POPUP", |
16d8024aca5e
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
689 |
"popup_disappear", |
16d8024aca5e
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
690 |
"disappear"); |
16d8024aca5e
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
691 |
} |
16d8024aca5e
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
692 |
if (hasEffects ) { |
16d8024aca5e
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
693 |
hasEffects = HbEffectInternal::add("HB_POPUP", |
5
627c4a0fd0e7
Revision: 201021
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
2
diff
changeset
|
694 |
"popup_orient_disappear", |
627c4a0fd0e7
Revision: 201021
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
2
diff
changeset
|
695 |
"orient_disappear"); |
627c4a0fd0e7
Revision: 201021
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
2
diff
changeset
|
696 |
} |
627c4a0fd0e7
Revision: 201021
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
2
diff
changeset
|
697 |
if (hasEffects ) { |
627c4a0fd0e7
Revision: 201021
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
2
diff
changeset
|
698 |
hasEffects = HbEffectInternal::add("HB_POPUP", |
627c4a0fd0e7
Revision: 201021
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
2
diff
changeset
|
699 |
"popup_orient_appear", |
627c4a0fd0e7
Revision: 201021
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
2
diff
changeset
|
700 |
"orient_appear"); |
0
16d8024aca5e
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
701 |
} |
6
c3690ec91ef8
Revision: 201023
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
5
diff
changeset
|
702 |
hasEffects = true; //Workaround until orient appear effects are in place |
0
16d8024aca5e
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
703 |
#endif |
16d8024aca5e
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
704 |
} |
16d8024aca5e
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
705 |
|
16d8024aca5e
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
706 |
|
16d8024aca5e
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
707 |
void HbPopupPrivate::doSetModal( bool modal ) { |
16d8024aca5e
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
708 |
if(backgroundItem) { |
16d8024aca5e
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
709 |
// When the popup is modal background item must receive focus |
16d8024aca5e
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
710 |
// events to be able to prevent last focus item losing its |
16d8024aca5e
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
711 |
// focus |
16d8024aca5e
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
712 |
backgroundItem->setFlag(QGraphicsItem::ItemIsFocusable, modal); |
1
f7ac710697a9
Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
713 |
backgroundItem->setFlag(QGraphicsItem::ItemIsPanel, modal); |
f7ac710697a9
Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
714 |
if(modal) { |
f7ac710697a9
Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
715 |
backgroundItem->setPanelModality(QGraphicsItem::PanelModal); |
f7ac710697a9
Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
716 |
} else { |
f7ac710697a9
Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
717 |
backgroundItem->setPanelModality(QGraphicsItem::NonModal); |
f7ac710697a9
Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
718 |
} |
0
16d8024aca5e
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
719 |
} |
16d8024aca5e
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
720 |
} |
16d8024aca5e
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
721 |
|
34 | 722 |
void HbPopupPrivate::setFullScreen(bool enable) |
723 |
{ |
|
724 |
if (mFullScreen != enable) { |
|
725 |
Q_Q(HbPopup); |
|
726 |
mFullScreen = enable; |
|
727 |
if (enable) { |
|
728 |
q->setBackgroundItem(new HbFrameItem(QLatin1String("qtg_graf_screen_bg_prt"), HbFrameDrawer::OnePiece), -1); |
|
729 |
} else { |
|
730 |
if (frameType == HbPopup::Weak) { |
|
731 |
q->setBackgroundItem(new HbFrameItem(QLatin1String("qtg_fr_popup_secondary"), HbFrameDrawer::NinePieces), -1); |
|
732 |
} else { |
|
733 |
q->setBackgroundItem(new HbFrameItem(QLatin1String("qtg_fr_popup"), HbFrameDrawer::NinePieces), -1); |
|
734 |
} |
|
735 |
} |
|
736 |
q->repolish(); |
|
737 |
} |
|
738 |
} |
|
739 |
||
1
f7ac710697a9
Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
740 |
void HbPopupPrivate::calculateShape() |
f7ac710697a9
Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
741 |
{ |
f7ac710697a9
Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
742 |
Q_Q(HbPopup); |
34 | 743 |
// Only used for HbMenu currently, this is not fully correct as some dialogs may need masking too. |
744 |
if (q->type() != Hb::ItemType_Menu && q->type() != Hb::ItemType_ColorDialog) { |
|
745 |
return; |
|
746 |
} |
|
747 |
// Cannot set up masking if the background item is not available. |
|
748 |
if (!q->backgroundItem() || !q->backgroundItem()->boundingRect().isValid()) { |
|
749 |
return; |
|
750 |
} |
|
7
923ff622b8b9
Revision: 201025
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
6
diff
changeset
|
751 |
// Contrary to the name, HbVgMaskEffect has a software |
923ff622b8b9
Revision: 201025
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
6
diff
changeset
|
752 |
// implementation too, and we will actually force the usage of |
923ff622b8b9
Revision: 201025
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
6
diff
changeset
|
753 |
// that here, ignoring the pure OpenVG version. |
2
06ff229162e9
Revision: 201017
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
1
diff
changeset
|
754 |
if (!mVgMaskEffect) { |
34 | 755 |
if (!mMaskedItem) { |
756 |
mMaskedItem = q; |
|
757 |
} |
|
7
923ff622b8b9
Revision: 201025
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
6
diff
changeset
|
758 |
mVgMaskEffect = new HbVgMaskEffect; |
923ff622b8b9
Revision: 201025
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
6
diff
changeset
|
759 |
// Masking does not work reliably on HW. |
923ff622b8b9
Revision: 201025
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
6
diff
changeset
|
760 |
mVgMaskEffect->setForceSwMode(true); |
923ff622b8b9
Revision: 201025
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
6
diff
changeset
|
761 |
// There may be children (like the scroll area in menus) that |
923ff622b8b9
Revision: 201025
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
6
diff
changeset
|
762 |
// would mess up the masking so exclude those. |
923ff622b8b9
Revision: 201025
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
6
diff
changeset
|
763 |
mVgMaskEffect->setIncludeSourceItemOnly(true); |
34 | 764 |
if (!mMaskedItem->graphicsEffect()) { |
765 |
// Attach the effect. Ownership is transferred to the chain. The |
|
766 |
// ownership of the chain is transferred to q. The chain is needed |
|
767 |
// because we must co-exist with FXML-based filter effects. |
|
768 |
HbVgChainedEffect *c = new HbVgChainedEffect; |
|
769 |
c->add(mVgMaskEffect); |
|
770 |
c->install(mMaskedItem); |
|
7
923ff622b8b9
Revision: 201025
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
6
diff
changeset
|
771 |
} else { |
34 | 772 |
// Avoid replacing already set effects. Do not mask if this is not |
773 |
// possible, otherwise we would unexpectedly delete the previously |
|
774 |
// set graphics effect. However by being able to add the effect to a |
|
775 |
// chain makes it possible to co-exist with FXML-based filter |
|
776 |
// effects. Similar solution is also present in HbEffectGroup. |
|
777 |
HbVgChainedEffect *c = qobject_cast<HbVgChainedEffect *>(mMaskedItem->graphicsEffect()); |
|
7
923ff622b8b9
Revision: 201025
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
6
diff
changeset
|
778 |
if (c) { |
923ff622b8b9
Revision: 201025
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
6
diff
changeset
|
779 |
c->add(mVgMaskEffect); |
923ff622b8b9
Revision: 201025
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
6
diff
changeset
|
780 |
} else { |
923ff622b8b9
Revision: 201025
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
6
diff
changeset
|
781 |
delete mVgMaskEffect; |
34 | 782 |
mVgMaskEffect = 0; |
7
923ff622b8b9
Revision: 201025
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
6
diff
changeset
|
783 |
} |
923ff622b8b9
Revision: 201025
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
6
diff
changeset
|
784 |
} |
34 | 785 |
if (mVgMaskEffect) { |
786 |
// Make sure that mask effect is reset when destroyed |
|
787 |
QObject::connect(mVgMaskEffect, SIGNAL(destroyed()), q, SLOT(_q_maskEffectDestroyed())); |
|
788 |
} |
|
2
06ff229162e9
Revision: 201017
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
1
diff
changeset
|
789 |
} |
34 | 790 |
/*if (!mPopupMask) { |
791 |
mPopupMask= new HbFrameItem(); |
|
792 |
mPopupMask->frameDrawer().setFrameType(HbFrameDrawer::NinePieces); |
|
793 |
mPopupMask->frameDrawer().setFrameGraphicsName(QLatin1String("qtg_fr_popup_mask")); |
|
794 |
} |
|
795 |
mPopupMask->setGeometry(q->boundingRect());*/ |
|
796 |
||
797 |
QPixmap image(q->backgroundItem()->boundingRect().size().toSize()); |
|
1
f7ac710697a9
Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
798 |
image.fill(Qt::transparent); |
f7ac710697a9
Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
799 |
QPainter imagePainter(&image); |
34 | 800 |
//mPopupMask->paint(&imagePainter, 0, 0); |
1
f7ac710697a9
Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
801 |
q->backgroundItem()->paint(&imagePainter, 0, 0); |
f7ac710697a9
Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
802 |
imagePainter.end(); |
2
06ff229162e9
Revision: 201017
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
1
diff
changeset
|
803 |
mVgMaskEffect->setMask(image); |
1
f7ac710697a9
Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
804 |
} |
f7ac710697a9
Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
805 |
|
34 | 806 |
|
807 |
||
0
16d8024aca5e
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
808 |
/*! |
34 | 809 |
Constructs a popup with the given \a parent graphics item. For true popup |
810 |
behavior (which means that it opens above other objects, at the highest z-order) |
|
811 |
set \a parent to 0. This is the primary intended use of this class. |
|
2
06ff229162e9
Revision: 201017
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
1
diff
changeset
|
812 |
|
34 | 813 |
However, it may sometimes be useful to embed a popup into a QGraphicsItem. To do |
814 |
this, pass a non-zero \a parent value. HbPopup objects that have a parent are |
|
815 |
not real popups: they behave like any other QGraphicsWidget object and following |
|
816 |
properties are ignored. In addition the aboutToClose() signal is not emitted. |
|
817 |
||
818 |
- \link isModal() modal\endlink property |
|
819 |
- \link timeout() timeout\endlink property |
|
820 |
- \link isBackgroundFaded() Backgroundfaded\endlink property |
|
821 |
- \link dismissPolicy() dismissPolicy\endlink property |
|
0
16d8024aca5e
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
822 |
*/ |
16d8024aca5e
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
823 |
HbPopup::HbPopup(QGraphicsItem *parent) : |
16d8024aca5e
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
824 |
HbWidget(*new HbPopupPrivate,parent) |
16d8024aca5e
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
825 |
{ |
16d8024aca5e
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
826 |
Q_D(HbPopup); |
16d8024aca5e
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
827 |
d->q_ptr = this; |
34 | 828 |
d->init(); |
0
16d8024aca5e
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
829 |
} |
16d8024aca5e
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
830 |
|
16d8024aca5e
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
831 |
|
16d8024aca5e
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
832 |
/*! |
16d8024aca5e
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
833 |
\internal |
16d8024aca5e
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
834 |
*/ |
16d8024aca5e
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
835 |
HbPopup::HbPopup(HbPopupPrivate &dd, QGraphicsItem *parent) : |
16d8024aca5e
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
836 |
HbWidget(dd, parent) |
16d8024aca5e
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
837 |
{ |
16d8024aca5e
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
838 |
Q_D(HbPopup); |
16d8024aca5e
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
839 |
d->q_ptr = this; |
34 | 840 |
d->init(); |
0
16d8024aca5e
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
841 |
} |
16d8024aca5e
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
842 |
/*! |
34 | 843 |
Destructor. |
0
16d8024aca5e
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
844 |
*/ |
16d8024aca5e
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
845 |
HbPopup::~HbPopup() |
16d8024aca5e
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
846 |
{ |
16d8024aca5e
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
847 |
Q_D(HbPopup); |
16d8024aca5e
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
848 |
d->inDestruction = true; |
16d8024aca5e
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
849 |
|
16d8024aca5e
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
850 |
// Deregister popup from HbPopupManager in case hideEvent() was not called |
16d8024aca5e
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
851 |
// before destruction |
16d8024aca5e
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
852 |
HbGraphicsScene *hbScene = qobject_cast<HbGraphicsScene *>(scene()); |
16d8024aca5e
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
853 |
if (hbScene) { |
16d8024aca5e
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
854 |
hbScene->d_ptr->hidePopup(this); |
16d8024aca5e
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
855 |
} |
16d8024aca5e
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
856 |
|
16d8024aca5e
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
857 |
if (d->backgroundItem) { |
16d8024aca5e
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
858 |
// Set backgroundItem->popup to 0 to avoid double deletion |
16d8024aca5e
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
859 |
// e.g. when popup is deleted by scene before its backgroundItem |
16d8024aca5e
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
860 |
d->backgroundItem->popup = 0; |
16d8024aca5e
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
861 |
|
16d8024aca5e
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
862 |
// Delete the background item only and only if it's not going |
16d8024aca5e
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
863 |
// to be cleaned up by the destructing graphics scene |
16d8024aca5e
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
864 |
QGraphicsScene *scene = d->backgroundItem->scene(); // krazy:exclude=qclasses |
16d8024aca5e
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
865 |
if (!scene || !scene->property("destructed").isValid()) { |
16d8024aca5e
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
866 |
delete d->backgroundItem; |
16d8024aca5e
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
867 |
} |
16d8024aca5e
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
868 |
} |
16d8024aca5e
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
869 |
} |
16d8024aca5e
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
870 |
|
16d8024aca5e
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
871 |
/*! |
34 | 872 |
Returns the popup's timeout property in milliseconds. The timeout causes the popup to |
873 |
be dismissed automatically after the specified time period has elapsed. A value of |
|
874 |
zero or less than zero, means that the popup is permanent and the user must take |
|
875 |
some explicit action in order to close the popup. |
|
876 |
||
877 |
The default value for this property is HbPopup::StandardTimeout. |
|
878 |
||
879 |
\sa setTimeout(), setTimeout(HbPopup::DefaultTimeout) |
|
0
16d8024aca5e
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
880 |
*/ |
16d8024aca5e
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
881 |
int HbPopup::timeout() const |
16d8024aca5e
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
882 |
{ |
16d8024aca5e
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
883 |
Q_D(const HbPopup); |
34 | 884 |
if (d->timeoutPending) { |
885 |
HbStyleParameters params; |
|
886 |
QLatin1String timeoutString(""); |
|
887 |
switch (d->pendingTimeout) { |
|
888 |
case HbPopup::NoTimeout: |
|
889 |
timeoutString = NO_TIMEOUT_STRING; |
|
890 |
break; |
|
891 |
case HbPopup::ContextMenuTimeout: |
|
892 |
timeoutString = CONTEXT_MENU_TIMEOUT_STRING; |
|
893 |
break; |
|
894 |
case HbPopup::StandardTimeout: |
|
895 |
timeoutString = STANDARD_TIMEOUT_STRING; |
|
896 |
break; |
|
897 |
case HbPopup::ConfirmationNoteTimeout: |
|
898 |
timeoutString = CONFIRMATION_NOTE_TIMEOUT_STRING; |
|
899 |
break; |
|
900 |
} |
|
901 |
params.addParameter(timeoutString); |
|
902 |
||
903 |
style()->widgetParameters(params, const_cast<HbPopup *>(this)); |
|
904 |
||
905 |
if (!params.value(timeoutString).isNull()) { |
|
906 |
return params.value(timeoutString).toInt(); |
|
907 |
} else { |
|
908 |
return d->timeout; |
|
909 |
} |
|
910 |
} else { |
|
0
16d8024aca5e
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
911 |
return d->timeout; |
16d8024aca5e
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
912 |
} |
16d8024aca5e
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
913 |
} |
16d8024aca5e
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
914 |
|
16d8024aca5e
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
915 |
/*! |
34 | 916 |
Sets the popup's timeout property in milliseconds. A value of zero or less than zero |
917 |
means that the popup is permanent and is not closed automatically. |
|
918 |
||
919 |
\overload |
|
920 |
\sa timeout() setTimeout(HbPopup::DefaultTimeout), QGraphicsWidget::close() |
|
921 |
*/ |
|
922 |
void HbPopup::setTimeout(int timeout) |
|
923 |
{ |
|
924 |
Q_D(HbPopup); |
|
925 |
d->setTimeout(timeout); |
|
926 |
} |
|
927 |
||
928 |
/*! |
|
929 |
Sets the popup's timeout property to the default value for a standard popup type. |
|
930 |
This has the advantage of creating a common look and feel. |
|
931 |
||
932 |
\overload |
|
933 |
\sa timeout(), setTimeout(int), QGraphicsWidget::close() |
|
0
16d8024aca5e
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
934 |
*/ |
16d8024aca5e
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
935 |
void HbPopup::setTimeout(HbPopup::DefaultTimeout timeout) |
16d8024aca5e
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
936 |
{ |
34 | 937 |
Q_D(HbPopup); |
938 |
if (d->polished) { |
|
939 |
int newTimeout = d->defaultTimeouts.value(timeout); |
|
940 |
setTimeout(newTimeout); |
|
941 |
} else { |
|
942 |
d->timeoutPending = true; |
|
943 |
d->pendingTimeout = timeout; |
|
944 |
} |
|
0
16d8024aca5e
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
945 |
} |
16d8024aca5e
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
946 |
|
16d8024aca5e
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
947 |
/*! |
34 | 948 |
Returns the popup's modality property. A modal popup blocks any user-initiated |
949 |
events outside of the popup until it is closed. |
|
950 |
\sa setModal() |
|
0
16d8024aca5e
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
951 |
*/ |
16d8024aca5e
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
952 |
bool HbPopup::isModal() const |
16d8024aca5e
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
953 |
{ |
16d8024aca5e
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
954 |
Q_D(const HbPopup); |
16d8024aca5e
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
955 |
return d->modal; |
16d8024aca5e
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
956 |
} |
16d8024aca5e
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
957 |
|
16d8024aca5e
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
958 |
/*! |
34 | 959 |
Sets the popup's modality property. |
960 |
||
961 |
To open a modal popup, call open(). To open a non-modal popup, call |
|
962 |
\link QGraphicsItem::show() show()\endlink. |
|
963 |
\sa isModal() |
|
0
16d8024aca5e
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
964 |
*/ |
34 | 965 |
void HbPopup::setModal(bool modal) |
0
16d8024aca5e
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
966 |
{ |
16d8024aca5e
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
967 |
Q_D(HbPopup); |
34 | 968 |
d->modal = modal; |
0
16d8024aca5e
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
969 |
d->doSetModal( d->modal ); |
16d8024aca5e
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
970 |
} |
16d8024aca5e
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
971 |
|
16d8024aca5e
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
972 |
/*! |
34 | 973 |
Sets the popup's background fade policy property. When this is set to true, it causes |
974 |
everything behind the popup to be faded. |
|
975 |
\sa isBackgroundFaded() |
|
0
16d8024aca5e
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
976 |
*/ |
16d8024aca5e
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
977 |
void HbPopup::setBackgroundFaded(bool fadeBackground) |
16d8024aca5e
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
978 |
{ |
16d8024aca5e
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
979 |
Q_D(HbPopup); |
16d8024aca5e
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
980 |
d->fadeBackground = fadeBackground; |
16d8024aca5e
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
981 |
} |
16d8024aca5e
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
982 |
|
16d8024aca5e
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
983 |
/*! |
34 | 984 |
Returns the popup's background fade policy property. This controls whether |
985 |
everything behind the popup is faded while the popup is on the screen. Typically |
|
986 |
this property is set to true for modal dialogs only. The default is true. |
|
987 |
\sa setBackgroundFaded() |
|
0
16d8024aca5e
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
988 |
*/ |
16d8024aca5e
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
989 |
bool HbPopup::isBackgroundFaded() const |
16d8024aca5e
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
990 |
{ |
16d8024aca5e
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
991 |
Q_D(const HbPopup); |
16d8024aca5e
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
992 |
return d->backgroundItem && d->fadeBackground; |
16d8024aca5e
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
993 |
} |
16d8024aca5e
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
994 |
|
16d8024aca5e
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
995 |
/*! |
34 | 996 |
Returns the popup's dismiss policy. This defines which user actions (if any) cause |
997 |
the popup to close. The default is HbPopup::TapOutside. |
|
998 |
\sa setDismissPolicy() |
|
0
16d8024aca5e
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
999 |
*/ |
16d8024aca5e
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
1000 |
HbPopup::DismissPolicy HbPopup::dismissPolicy() const |
16d8024aca5e
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
1001 |
{ |
16d8024aca5e
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
1002 |
Q_D(const HbPopup); |
16d8024aca5e
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
1003 |
return d->dismissPolicy; |
16d8024aca5e
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
1004 |
} |
16d8024aca5e
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
1005 |
|
16d8024aca5e
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
1006 |
/*! |
34 | 1007 |
Sets the popup's dismiss policy property. |
2
06ff229162e9
Revision: 201017
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
1
diff
changeset
|
1008 |
|
34 | 1009 |
\sa dismissPolicy() |
0
16d8024aca5e
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
1010 |
*/ |
16d8024aca5e
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
1011 |
void HbPopup::setDismissPolicy(HbPopup::DismissPolicy dismissPolicy) |
16d8024aca5e
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
1012 |
{ |
16d8024aca5e
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
1013 |
Q_D(HbPopup); |
16d8024aca5e
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
1014 |
d->dismissPolicy = dismissPolicy; |
16d8024aca5e
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
1015 |
} |
16d8024aca5e
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
1016 |
|
16d8024aca5e
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
1017 |
/*! |
34 | 1018 |
Returns the popup's frame type. This controls the popup's background style. However, |
1019 |
the actual appearance depends on the theme. The default value is HbPopup::Strong. |
|
1020 |
||
1021 |
\sa setFrameType() |
|
0
16d8024aca5e
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
1022 |
*/ |
16d8024aca5e
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
1023 |
HbPopup::FrameType HbPopup::frameType() const |
16d8024aca5e
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
1024 |
{ |
16d8024aca5e
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
1025 |
Q_D(const HbPopup); |
16d8024aca5e
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
1026 |
return d->frameType; |
16d8024aca5e
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
1027 |
} |
16d8024aca5e
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
1028 |
|
34 | 1029 |
void HbPopupPrivate::doSetFrameType(HbPopup::FrameType newFrameType) |
1030 |
{ |
|
1031 |
Q_Q(HbPopup); |
|
1032 |
switch( newFrameType ) { |
|
1033 |
case HbPopup::Weak: |
|
1034 |
q->setBackgroundItem(new HbFrameItem(QLatin1String("qtg_fr_popup_secondary"), HbFrameDrawer::NinePieces), -1); |
|
1035 |
break; |
|
1036 |
case HbPopup::Strong: |
|
1037 |
default: |
|
1038 |
q->setBackgroundItem(new HbFrameItem(QLatin1String("qtg_fr_popup"), HbFrameDrawer::NinePieces), -1); |
|
1039 |
break; |
|
1040 |
} |
|
1041 |
} |
|
1042 |
||
0
16d8024aca5e
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
1043 |
/*! |
34 | 1044 |
Sets the popup's frame type, which controls the popup's background style. |
2
06ff229162e9
Revision: 201017
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
1
diff
changeset
|
1045 |
|
34 | 1046 |
\sa frameType() |
0
16d8024aca5e
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
1047 |
*/ |
16d8024aca5e
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
1048 |
void HbPopup::setFrameType(HbPopup::FrameType frameType) |
16d8024aca5e
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
1049 |
{ |
16d8024aca5e
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
1050 |
Q_D(HbPopup); |
16d8024aca5e
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
1051 |
if ( d->frameType != frameType ) { |
16d8024aca5e
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
1052 |
d->frameType = frameType; |
34 | 1053 |
d->doSetFrameType(frameType); |
0
16d8024aca5e
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
1054 |
updatePrimitives(); |
16d8024aca5e
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
1055 |
} |
16d8024aca5e
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
1056 |
} |
16d8024aca5e
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
1057 |
|
34 | 1058 |
/*! |
1059 |
Returns true if the popup is set to occupy the whole screen, false if not. |
|
1060 |
||
1061 |
\sa setFullScreen() |
|
1062 |
*/ |
|
1063 |
bool HbPopup::isFullScreen() const |
|
1064 |
{ |
|
1065 |
Q_D(const HbPopup); |
|
1066 |
return d->mFullScreen; |
|
1067 |
} |
|
0
16d8024aca5e
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
1068 |
|
2
06ff229162e9
Revision: 201017
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
1
diff
changeset
|
1069 |
/*! |
34 | 1070 |
Sets the popup to occupy the whole screen. When the popup is in full screen different |
1071 |
background graphics are used and there are no margins between popup and the main window. |
|
1072 |
||
1073 |
Inherited classes may have different color and graphics for full screen popups. |
|
1074 |
||
1075 |
\param enable A Boolean value; true for full screen popup, false for regular popup. |
|
0
16d8024aca5e
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
1076 |
|
34 | 1077 |
\sa isFullScreen() |
1078 |
*/ |
|
1079 |
void HbPopup::setFullScreen(bool fullScreen) |
|
1080 |
{ |
|
1081 |
Q_D(HbPopup); |
|
1082 |
d->setFullScreen(fullScreen); |
|
1083 |
} |
|
2
06ff229162e9
Revision: 201017
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
1
diff
changeset
|
1084 |
|
34 | 1085 |
/*! |
1086 |
Displays the popup on the screen and returns immediately. This function also |
|
1087 |
connects the popup's aboutToClose() signal to a specified slot. The signal |
|
1088 |
is disconnected from the slot when the popup closes. |
|
1089 |
||
1090 |
Use this function to open modal popups. To open non-modal popups, call |
|
1091 |
\link QGraphicsItem::show() show()\endlink. |
|
1092 |
||
1093 |
\param receiver The object that is to receive the signal. |
|
1094 |
\param member The slot on the receiver to which the signal is to connect. |
|
1095 |
||
1096 |
\sa isModal() |
|
0
16d8024aca5e
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
1097 |
*/ |
16d8024aca5e
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
1098 |
void HbPopup::open( QObject *receiver, const char *member ) |
16d8024aca5e
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
1099 |
{ |
16d8024aca5e
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
1100 |
Q_D(HbPopup); |
1
f7ac710697a9
Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
1101 |
if (receiver) { |
f7ac710697a9
Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
1102 |
connect(this, SIGNAL(aboutToClose()), receiver, member); |
f7ac710697a9
Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
1103 |
} |
0
16d8024aca5e
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
1104 |
d->receiverToDisconnectOnClose = receiver; |
16d8024aca5e
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
1105 |
d->memberToDisconnectOnClose = member; |
16d8024aca5e
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
1106 |
|
34 | 1107 |
d->showingInProgress = true; |
0
16d8024aca5e
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
1108 |
show(); |
16d8024aca5e
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
1109 |
} |
16d8024aca5e
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
1110 |
|
16d8024aca5e
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
1111 |
/*! |
34 | 1112 |
|
0
16d8024aca5e
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
1113 |
*/ |
16d8024aca5e
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
1114 |
QVariant HbPopup::itemChange ( GraphicsItemChange change, const QVariant & value ) |
16d8024aca5e
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
1115 |
{ |
16d8024aca5e
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
1116 |
Q_D(HbPopup); |
16d8024aca5e
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
1117 |
|
34 | 1118 |
if (change == QGraphicsItem::ItemPositionChange) { |
1119 |
// Skipping X-coordinate changes made by VKB since popupmanager handles popup to be in the |
|
1120 |
// center of the screen |
|
1121 |
if (property(KPositionManagedByVKB).isValid() && property(KPositionManagedByVKB).toBool() && |
|
1122 |
!d->mAutoLayouting && value.isValid() && !value.toPointF().isNull()) { |
|
1123 |
QPointF newPointF(geometry().x(), value.toPointF().y()); |
|
1124 |
d->mAutoLayouting = false; |
|
1125 |
return newPointF; |
|
1126 |
} |
|
5
627c4a0fd0e7
Revision: 201021
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
2
diff
changeset
|
1127 |
d->mAutoLayouting = false; |
627c4a0fd0e7
Revision: 201021
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
2
diff
changeset
|
1128 |
} |
627c4a0fd0e7
Revision: 201021
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
2
diff
changeset
|
1129 |
if (change == QGraphicsItem::ItemVisibleHasChanged) { |
2
06ff229162e9
Revision: 201017
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
1
diff
changeset
|
1130 |
if (value.toBool()) { |
34 | 1131 |
if (d->hasEffects && boundingRect().isValid() && d->polished) { |
2
06ff229162e9
Revision: 201017
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
1
diff
changeset
|
1132 |
|
06ff229162e9
Revision: 201017
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
1
diff
changeset
|
1133 |
#ifdef HB_EFFECTS |
06ff229162e9
Revision: 201017
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
1
diff
changeset
|
1134 |
QRectF extRect(0.0, |
06ff229162e9
Revision: 201017
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
1
diff
changeset
|
1135 |
-boundingRect().height(), |
06ff229162e9
Revision: 201017
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
1
diff
changeset
|
1136 |
boundingRect().width(), |
06ff229162e9
Revision: 201017
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
1
diff
changeset
|
1137 |
0); |
5
627c4a0fd0e7
Revision: 201021
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
2
diff
changeset
|
1138 |
HbEffect::cancel(this); |
7
923ff622b8b9
Revision: 201025
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
6
diff
changeset
|
1139 |
d->mStartEffect = false; |
34 | 1140 |
HbEffectInternal::start(this, this, HbEffectInternal::UpdateAtEachStep, |
1141 |
d->effectType, "appear", this, "_q_appearEffectEnded", |
|
1142 |
QVariant(), extRect); |
|
1143 |
d->showingInProgress = true; |
|
1144 |
#endif //HB_EFFECTS |
|
2
06ff229162e9
Revision: 201017
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
1
diff
changeset
|
1145 |
} |
06ff229162e9
Revision: 201017
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
1
diff
changeset
|
1146 |
} |
5
627c4a0fd0e7
Revision: 201021
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
2
diff
changeset
|
1147 |
} |
2
06ff229162e9
Revision: 201017
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
1
diff
changeset
|
1148 |
|
0
16d8024aca5e
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
1149 |
if (change == QGraphicsItem::ItemVisibleChange) { |
16d8024aca5e
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
1150 |
if (value.toBool()) { |
16d8024aca5e
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
1151 |
if(!d->hasEffects){ |
16d8024aca5e
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
1152 |
d->addPopupEffects(); |
16d8024aca5e
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
1153 |
} |
16d8024aca5e
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
1154 |
if (!d->aboutToShowSignalGuard) |
16d8024aca5e
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
1155 |
{ |
16d8024aca5e
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
1156 |
d->aboutToShowSignalGuard = true; |
16d8024aca5e
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
1157 |
emit aboutToShow(); |
16d8024aca5e
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
1158 |
} |
16d8024aca5e
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
1159 |
// Note: when visibility changes to "visible" base class implementation needs |
16d8024aca5e
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
1160 |
// to be called otherwise showEvent() is not called. |
16d8024aca5e
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
1161 |
} else { |
34 | 1162 |
if(isPanel() && isActive() && d->mActivePopup) { |
1163 |
setActive(false); |
|
1164 |
} |
|
0
16d8024aca5e
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
1165 |
d->aboutToShowSignalGuard = false; |
16d8024aca5e
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
1166 |
if (!d->hidingInProgress) { |
16d8024aca5e
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
1167 |
emit aboutToHide(); |
16d8024aca5e
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
1168 |
} |
16d8024aca5e
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
1169 |
if (d->delayedHide && // about to hide and we wanna delay hiding |
16d8024aca5e
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
1170 |
d->hasEffects && !parentItem()) { // only for popup without parent |
6
c3690ec91ef8
Revision: 201023
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
5
diff
changeset
|
1171 |
bool hideDelayed = d->delayedHide; |
0
16d8024aca5e
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
1172 |
if (!d->hidingInProgress) { // Prevent reentrance |
16d8024aca5e
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
1173 |
d->hidingInProgress = true; |
16d8024aca5e
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
1174 |
#ifdef HB_EFFECTS |
16d8024aca5e
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
1175 |
QRectF extRect(0.0, |
16d8024aca5e
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
1176 |
-boundingRect().height(), |
16d8024aca5e
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
1177 |
boundingRect().width(), |
16d8024aca5e
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
1178 |
0); |
5
627c4a0fd0e7
Revision: 201021
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
2
diff
changeset
|
1179 |
HbEffect::cancel(this); |
34 | 1180 |
if (!HbEffectInternal::start(this, this, HbEffectInternal::UpdateAtEachStep, |
1181 |
d->effectType, "disappear", |
|
1182 |
this, "_q_delayedHide", |
|
1183 |
QVariant(), extRect)) { |
|
0
16d8024aca5e
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
1184 |
d->delayedHide = false; |
7
923ff622b8b9
Revision: 201025
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
6
diff
changeset
|
1185 |
return HbWidget::itemChange(change, value); |
0
16d8024aca5e
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
1186 |
} |
34 | 1187 |
d->mGestureOverride = true; |
0
16d8024aca5e
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
1188 |
#endif |
16d8024aca5e
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
1189 |
} |
6
c3690ec91ef8
Revision: 201023
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
5
diff
changeset
|
1190 |
if (hideDelayed) { |
0
16d8024aca5e
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
1191 |
return true; |
16d8024aca5e
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
1192 |
} else { |
16d8024aca5e
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
1193 |
d->delayedHide = d->hasEffects; |
16d8024aca5e
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
1194 |
d->hidingInProgress = false; |
16d8024aca5e
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
1195 |
// fallback to base class imp |
16d8024aca5e
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
1196 |
} |
16d8024aca5e
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
1197 |
} |
16d8024aca5e
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
1198 |
} |
16d8024aca5e
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
1199 |
} else if (change == QGraphicsItem::ItemSceneHasChanged) { |
16d8024aca5e
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
1200 |
HbMainWindow* w(mainWindow()); |
16d8024aca5e
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
1201 |
if ( w ){ |
5
627c4a0fd0e7
Revision: 201021
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
2
diff
changeset
|
1202 |
disconnect(this, SLOT(_q_orientationAboutToChange(Qt::Orientation, bool))); |
627c4a0fd0e7
Revision: 201021
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
2
diff
changeset
|
1203 |
connect( w, SIGNAL(aboutToChangeOrientation(Qt::Orientation, bool)), |
627c4a0fd0e7
Revision: 201021
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
2
diff
changeset
|
1204 |
this, SLOT(_q_orientationAboutToChange(Qt::Orientation, bool)) ); |
6
c3690ec91ef8
Revision: 201023
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
5
diff
changeset
|
1205 |
disconnect(this, SLOT(_q_orientationChanged())); |
0
16d8024aca5e
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
1206 |
connect( w, SIGNAL(orientationChanged(Qt::Orientation)), |
5
627c4a0fd0e7
Revision: 201021
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
2
diff
changeset
|
1207 |
this, SLOT(_q_orientationChanged()) ); |
0
16d8024aca5e
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
1208 |
} |
7
923ff622b8b9
Revision: 201025
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
6
diff
changeset
|
1209 |
|
0
16d8024aca5e
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
1210 |
} |
16d8024aca5e
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
1211 |
return HbWidget::itemChange(change, value); |
16d8024aca5e
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
1212 |
} |
16d8024aca5e
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
1213 |
|
16d8024aca5e
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
1214 |
/*! |
34 | 1215 |
Reimplemented from QGraphicsItem. |
0
16d8024aca5e
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
1216 |
*/ |
16d8024aca5e
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
1217 |
void HbPopup::mousePressEvent(QGraphicsSceneMouseEvent *event ) |
16d8024aca5e
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
1218 |
{ |
16d8024aca5e
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
1219 |
Q_D(HbPopup); |
16d8024aca5e
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
1220 |
|
16d8024aca5e
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
1221 |
Q_UNUSED(event); |
16d8024aca5e
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
1222 |
|
16d8024aca5e
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
1223 |
d->mousePressLocation = HbPopupPrivate::Popup; |
16d8024aca5e
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
1224 |
|
16d8024aca5e
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
1225 |
// We need to reimplement this function otherwise this events will be |
16d8024aca5e
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
1226 |
// ignored by default and we wont get further mouse events |
16d8024aca5e
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
1227 |
// not even mouseReleaseEvent. See doc of QGraphicsItem::mousePressEvent() |
16d8024aca5e
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
1228 |
// for more info. |
16d8024aca5e
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
1229 |
QGraphicsItem::mousePressEvent(event); |
16d8024aca5e
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
1230 |
|
16d8024aca5e
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
1231 |
// Event has to be accepted cause QGraphicsItem::mousePressEvent can mark it |
16d8024aca5e
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
1232 |
// to ignored |
16d8024aca5e
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
1233 |
event->accept(); |
16d8024aca5e
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
1234 |
} |
16d8024aca5e
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
1235 |
|
16d8024aca5e
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
1236 |
/*! |
34 | 1237 |
Reimplemented from QGraphicsItem. |
0
16d8024aca5e
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
1238 |
*/ |
16d8024aca5e
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
1239 |
void HbPopup::mouseReleaseEvent(QGraphicsSceneMouseEvent *event ) |
16d8024aca5e
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
1240 |
{ |
34 | 1241 |
Q_D(HbPopup); |
1242 |
d->handleBackgroundMouseReleaseEvent(event); |
|
1243 |
||
1244 |
QGraphicsItem::mouseReleaseEvent(event); |
|
0
16d8024aca5e
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
1245 |
event->accept(); |
16d8024aca5e
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
1246 |
} |
16d8024aca5e
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
1247 |
|
16d8024aca5e
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
1248 |
/*! |
34 | 1249 |
Reimplemented from QGraphicsWidget. |
0
16d8024aca5e
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
1250 |
*/ |
16d8024aca5e
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
1251 |
// |
16d8024aca5e
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
1252 |
// Shows the popup with an animation and starts the timer to dismiss the popup, |
16d8024aca5e
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
1253 |
// unless it is a permanent popup. |
16d8024aca5e
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
1254 |
// |
16d8024aca5e
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
1255 |
void HbPopup::showEvent(QShowEvent *event) |
16d8024aca5e
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
1256 |
{ |
16d8024aca5e
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
1257 |
Q_D(HbPopup); |
16d8024aca5e
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
1258 |
|
16d8024aca5e
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
1259 |
HbWidget::showEvent(event); |
16d8024aca5e
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
1260 |
|
16d8024aca5e
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
1261 |
// Only for popup without parent |
16d8024aca5e
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
1262 |
// Note: |
16d8024aca5e
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
1263 |
// popups without parent are treated as popups i.e.: |
16d8024aca5e
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
1264 |
// - can have background item |
16d8024aca5e
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
1265 |
// - timeout |
16d8024aca5e
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
1266 |
// - and registered to HbPopupManager |
16d8024aca5e
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
1267 |
// otherwise popup is treated as normal widget |
16d8024aca5e
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
1268 |
if(d->duplicateShowEvent){ |
34 | 1269 |
d->duplicateShowEvent = false; |
1270 |
//setting popup as active panel failed in previous showEvent |
|
1271 |
if (d->mActivePopup) { |
|
1272 |
setActive(true); |
|
1273 |
} |
|
0
16d8024aca5e
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
1274 |
return; |
16d8024aca5e
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
1275 |
} |
16d8024aca5e
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
1276 |
if (!parentItem()) { |
16d8024aca5e
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
1277 |
//check if popup needs to be added to scene.This can result in duplciate show event, |
16d8024aca5e
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
1278 |
// if popup is added to scene here. |
1
f7ac710697a9
Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
1279 |
if(d->addPopupToScene()) { |
0
16d8024aca5e
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
1280 |
d->duplicateShowEvent = true; |
1
f7ac710697a9
Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
1281 |
} |
34 | 1282 |
if (d->mActivePopup) { |
1283 |
setActive(true); |
|
1284 |
} |
|
0
16d8024aca5e
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
1285 |
// Popup clears closed state |
16d8024aca5e
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
1286 |
d->closed = false; |
16d8024aca5e
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
1287 |
if (d->backgroundItem) { |
16d8024aca5e
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
1288 |
d->backgroundItem->setVisible(true); |
1
f7ac710697a9
Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
1289 |
if (isModal()) { |
0
16d8024aca5e
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
1290 |
d->backgroundItem->setFlag(QGraphicsItem::ItemIsPanel); |
1
f7ac710697a9
Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
1291 |
} |
0
16d8024aca5e
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
1292 |
} |
16d8024aca5e
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
1293 |
if (qobject_cast<HbGraphicsScene *>(scene())) { |
16d8024aca5e
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
1294 |
qobject_cast<HbGraphicsScene *>(scene())->d_ptr->showPopup(this); |
16d8024aca5e
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
1295 |
HbWidgetFeedback::triggered(this, Hb::InstantPopupOpened); |
16d8024aca5e
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
1296 |
} |
16d8024aca5e
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
1297 |
|
16d8024aca5e
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
1298 |
//workaround |
16d8024aca5e
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
1299 |
resetTransform(); |
16d8024aca5e
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
1300 |
setOpacity(1); |
16d8024aca5e
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
1301 |
//workaround ends |
16d8024aca5e
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
1302 |
|
16d8024aca5e
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
1303 |
// delay hiding if effects are enabled |
16d8024aca5e
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
1304 |
d->delayedHide = d->hasEffects; |
16d8024aca5e
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
1305 |
|
16d8024aca5e
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
1306 |
// If it is not permanent launch a timer for closing the popup |
16d8024aca5e
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
1307 |
if (0 < d->timeout) { |
16d8024aca5e
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
1308 |
d->timeoutTimer()->setInterval(d->timeout); |
2
06ff229162e9
Revision: 201017
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
1
diff
changeset
|
1309 |
d->startTimeout(); |
0
16d8024aca5e
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
1310 |
} |
16d8024aca5e
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
1311 |
} |
16d8024aca5e
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
1312 |
} |
16d8024aca5e
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
1313 |
|
16d8024aca5e
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
1314 |
/*! |
34 | 1315 |
Reimplemented from QGraphicsWidget. |
0
16d8024aca5e
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
1316 |
*/ |
16d8024aca5e
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
1317 |
void HbPopup::hideEvent(QHideEvent *event) |
16d8024aca5e
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
1318 |
{ |
16d8024aca5e
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
1319 |
Q_D(HbPopup); |
16d8024aca5e
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
1320 |
|
16d8024aca5e
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
1321 |
HbWidget::hideEvent(event); |
16d8024aca5e
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
1322 |
|
16d8024aca5e
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
1323 |
// Only for popup without parent |
16d8024aca5e
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
1324 |
if (!parentItem()) { |
16d8024aca5e
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
1325 |
if (d->backgroundItem) { |
16d8024aca5e
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
1326 |
d->backgroundItem->setVisible(false); |
16d8024aca5e
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
1327 |
} |
16d8024aca5e
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
1328 |
qobject_cast<HbGraphicsScene *>(scene())->d_ptr->hidePopup(this); |
16d8024aca5e
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
1329 |
} |
16d8024aca5e
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
1330 |
|
16d8024aca5e
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
1331 |
HbWidgetFeedback::triggered(this, Hb::InstantPopupClosed); |
16d8024aca5e
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
1332 |
|
16d8024aca5e
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
1333 |
d->doSetModal( d->modal ); |
16d8024aca5e
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
1334 |
} |
16d8024aca5e
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
1335 |
|
16d8024aca5e
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
1336 |
/*! |
34 | 1337 |
Reimplemented from QGraphicsWidget. |
0
16d8024aca5e
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
1338 |
*/ |
16d8024aca5e
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
1339 |
void HbPopup::resizeEvent( QGraphicsSceneResizeEvent * event ) |
1
f7ac710697a9
Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
1340 |
{ |
0
16d8024aca5e
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
1341 |
HbWidget::resizeEvent(event); |
16d8024aca5e
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
1342 |
updatePrimitives(); |
1
f7ac710697a9
Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
1343 |
Q_D(HbPopup); |
f7ac710697a9
Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
1344 |
if (d->polished) { |
f7ac710697a9
Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
1345 |
d->calculateShape(); |
f7ac710697a9
Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
1346 |
} |
0
16d8024aca5e
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
1347 |
} |
16d8024aca5e
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
1348 |
|
16d8024aca5e
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
1349 |
/*! |
34 | 1350 |
Reimplemented from QGraphicsWidget. |
0
16d8024aca5e
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
1351 |
*/ |
16d8024aca5e
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
1352 |
void HbPopup::closeEvent ( QCloseEvent * event ) |
16d8024aca5e
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
1353 |
{ |
16d8024aca5e
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
1354 |
Q_D(HbPopup); |
16d8024aca5e
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
1355 |
d->stopTimeout(); |
16d8024aca5e
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
1356 |
// Only for popup without parent |
16d8024aca5e
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
1357 |
if (!d->closed && !parentItem()) { |
16d8024aca5e
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
1358 |
// Popup goes to closed state |
16d8024aca5e
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
1359 |
d->closed = true; |
16d8024aca5e
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
1360 |
|
16d8024aca5e
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
1361 |
emit aboutToClose(); |
16d8024aca5e
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
1362 |
|
16d8024aca5e
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
1363 |
// prevent delete on close before effects are finished |
16d8024aca5e
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
1364 |
if (d->hasEffects && isVisible()) { |
16d8024aca5e
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
1365 |
d->deleteOnClose = testAttribute(Qt::WA_DeleteOnClose); |
16d8024aca5e
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
1366 |
setAttribute(Qt::WA_DeleteOnClose,false); |
16d8024aca5e
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
1367 |
} |
16d8024aca5e
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
1368 |
HbToolTip::hideText(qobject_cast<HbGraphicsScene *>(scene())); |
16d8024aca5e
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
1369 |
} |
16d8024aca5e
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
1370 |
if (d->receiverToDisconnectOnClose) { |
16d8024aca5e
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
1371 |
disconnect(this, SIGNAL(aboutToClose()), |
16d8024aca5e
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
1372 |
d->receiverToDisconnectOnClose, d->memberToDisconnectOnClose); |
16d8024aca5e
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
1373 |
d->receiverToDisconnectOnClose = 0; |
16d8024aca5e
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
1374 |
} |
16d8024aca5e
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
1375 |
d->memberToDisconnectOnClose.clear(); |
16d8024aca5e
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
1376 |
HbWidget::closeEvent(event); |
16d8024aca5e
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
1377 |
} |
16d8024aca5e
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
1378 |
|
16d8024aca5e
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
1379 |
/*! |
34 | 1380 |
Reimplemented from QGraphicsWidget. |
0
16d8024aca5e
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
1381 |
*/ |
16d8024aca5e
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
1382 |
bool HbPopup::event(QEvent *event) |
16d8024aca5e
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
1383 |
{ |
5
627c4a0fd0e7
Revision: 201021
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
2
diff
changeset
|
1384 |
Q_D(HbPopup); |
6
c3690ec91ef8
Revision: 201023
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
5
diff
changeset
|
1385 |
if ( event->type() == QEvent::DynamicPropertyChange ) { |
c3690ec91ef8
Revision: 201023
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
5
diff
changeset
|
1386 |
QVariant v(property(KPositionManagedByVKB)); |
c3690ec91ef8
Revision: 201023
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
5
diff
changeset
|
1387 |
if (v.isValid() ){ |
c3690ec91ef8
Revision: 201023
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
5
diff
changeset
|
1388 |
if (v.toBool()) { |
c3690ec91ef8
Revision: 201023
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
5
diff
changeset
|
1389 |
// position is now managed by vkb |
c3690ec91ef8
Revision: 201023
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
5
diff
changeset
|
1390 |
d->mOriginalAutoLayouting = d->mAutoLayouting; |
c3690ec91ef8
Revision: 201023
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
5
diff
changeset
|
1391 |
d->mAutoLayouting = false; |
c3690ec91ef8
Revision: 201023
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
5
diff
changeset
|
1392 |
} else { |
c3690ec91ef8
Revision: 201023
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
5
diff
changeset
|
1393 |
d->mAutoLayouting = d->mOriginalAutoLayouting; |
c3690ec91ef8
Revision: 201023
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
5
diff
changeset
|
1394 |
|
c3690ec91ef8
Revision: 201023
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
5
diff
changeset
|
1395 |
// vkb has finished, and we might be on totally wrong |
c3690ec91ef8
Revision: 201023
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
5
diff
changeset
|
1396 |
// place. |
c3690ec91ef8
Revision: 201023
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
5
diff
changeset
|
1397 |
QEvent layoutRequest = QEvent::LayoutRequest; |
c3690ec91ef8
Revision: 201023
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
5
diff
changeset
|
1398 |
QApplication::sendEvent(this, &layoutRequest); |
c3690ec91ef8
Revision: 201023
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
5
diff
changeset
|
1399 |
} |
c3690ec91ef8
Revision: 201023
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
5
diff
changeset
|
1400 |
} |
c3690ec91ef8
Revision: 201023
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
5
diff
changeset
|
1401 |
} else if (event->type() == QEvent::LayoutRequest) { |
1
f7ac710697a9
Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
1402 |
//Workaround when showing first time |
f7ac710697a9
Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
1403 |
#ifdef HB_EFFECTS |
34 | 1404 |
if (d->mStartEffect && boundingRect().isValid()) { |
1
f7ac710697a9
Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
1405 |
d->mStartEffect = false; |
f7ac710697a9
Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
1406 |
QCoreApplication::sendPostedEvents(this, QEvent::LayoutRequest); |
0
16d8024aca5e
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
1407 |
QRectF extRect(0.0, |
16d8024aca5e
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
1408 |
-boundingRect().height(), |
16d8024aca5e
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
1409 |
boundingRect().width(), |
16d8024aca5e
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
1410 |
0); |
5
627c4a0fd0e7
Revision: 201021
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
2
diff
changeset
|
1411 |
HbEffect::cancel(this); |
34 | 1412 |
HbEffectInternal::start(this, this, HbEffectInternal::UpdateAtEachStep, |
1413 |
d->effectType, "appear", this, "_q_appearEffectEnded", |
|
1414 |
QVariant(), extRect); |
|
1415 |
d->showingInProgress = true; |
|
1416 |
} else if (d->mStartEffect) { |
|
0
16d8024aca5e
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
1417 |
} |
34 | 1418 |
#endif //HB_EFFECTS |
1419 |
} else if (event->type() == QEvent::TouchBegin) { |
|
1420 |
// Accept all touch begin events to get the full Begin..End sequence |
|
1421 |
event->accept(); |
|
1422 |
return true; |
|
1423 |
} else if (d->mGestureOverride && event->type() == QEvent::GestureOverride) { |
|
1424 |
event->accept(); |
|
1425 |
return true; |
|
7
923ff622b8b9
Revision: 201025
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
6
diff
changeset
|
1426 |
} |
34 | 1427 |
|
0
16d8024aca5e
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
1428 |
return HbWidget::event(event); |
16d8024aca5e
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
1429 |
} |
16d8024aca5e
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
1430 |
|
16d8024aca5e
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
1431 |
/*! |
34 | 1432 |
Sets the preferred position of the popup. By default, the popup is placed in the middle |
1433 |
of the screen. If you use this function to set the preferred position, it is your |
|
1434 |
responsibility to ensure that this position works correctly on devices with different |
|
1435 |
screen sizes. |
|
1436 |
||
1437 |
Typically you should set the preferred position only for context aware popups, such as |
|
1438 |
context menus and slider popups. The position is not relevant for most dialogs and |
|
1439 |
popups and you should use the default position for these. |
|
5
627c4a0fd0e7
Revision: 201021
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
2
diff
changeset
|
1440 |
|
34 | 1441 |
\param preferredPos Defines the coordinates of preferred position on the screen where |
1442 |
the popup is to open. |
|
1443 |
\param placement The corner or edge of the dialog that is to be placed at \a preferredPos. |
|
0
16d8024aca5e
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
1444 |
|
34 | 1445 |
\b Example: |
1446 |
\code |
|
1447 |
HbPopup *popup = new HbPopup(); |
|
1448 |
||
1449 |
popup->setPreferredPos( QPointF(x,y), HbPopup::BottomEdgeCenter ); |
|
1450 |
popup->show(); |
|
1451 |
\endcode |
|
0
16d8024aca5e
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
1452 |
*/ |
16d8024aca5e
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
1453 |
void HbPopup::setPreferredPos( const QPointF& preferredPos, |
16d8024aca5e
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
1454 |
HbPopup::Placement placement ) |
16d8024aca5e
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
1455 |
{ |
16d8024aca5e
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
1456 |
Q_D(HbPopup); |
16d8024aca5e
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
1457 |
bool layoutFlag = false; |
16d8024aca5e
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
1458 |
if (d->preferredPos != preferredPos ) { |
16d8024aca5e
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
1459 |
d->preferredPos = preferredPos; |
16d8024aca5e
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
1460 |
layoutFlag = true; |
16d8024aca5e
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
1461 |
} |
16d8024aca5e
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
1462 |
if (d->placement != placement) { |
16d8024aca5e
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
1463 |
d->placement = placement; |
16d8024aca5e
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
1464 |
layoutFlag = true; |
16d8024aca5e
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
1465 |
} |
16d8024aca5e
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
1466 |
d->preferredPosSet = true; |
16d8024aca5e
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
1467 |
//If position updated, informing layoutproxy with layoutrequest |
16d8024aca5e
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
1468 |
if (layoutFlag) { |
5
627c4a0fd0e7
Revision: 201021
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
2
diff
changeset
|
1469 |
QEvent layoutRequest = QEvent::LayoutRequest; |
627c4a0fd0e7
Revision: 201021
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
2
diff
changeset
|
1470 |
QApplication::sendEvent(this, &layoutRequest); |
0
16d8024aca5e
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
1471 |
} |
16d8024aca5e
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
1472 |
} |
16d8024aca5e
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
1473 |
|
6
c3690ec91ef8
Revision: 201023
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
5
diff
changeset
|
1474 |
/*! |
34 | 1475 |
Returns the shape of this item as a QPainterPath. |
1476 |
*/ |
|
1
f7ac710697a9
Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
1477 |
QPainterPath HbPopup::shape() const |
f7ac710697a9
Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
1478 |
{ |
2
06ff229162e9
Revision: 201017
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
1
diff
changeset
|
1479 |
#if 0 |
06ff229162e9
Revision: 201017
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
1
diff
changeset
|
1480 |
/*Q_D(const HbPopup); |
1
f7ac710697a9
Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
1481 |
if (backgroundItem() && d->mPath) { |
f7ac710697a9
Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
1482 |
return *d->mPath; |
f7ac710697a9
Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
1483 |
} else { |
f7ac710697a9
Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
1484 |
return HbWidget::shape(); |
2
06ff229162e9
Revision: 201017
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
1
diff
changeset
|
1485 |
}*/ |
1
f7ac710697a9
Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
1486 |
#else |
f7ac710697a9
Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
1487 |
return HbWidget::shape(); |
f7ac710697a9
Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
1488 |
#endif |
f7ac710697a9
Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
1489 |
} |
f7ac710697a9
Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
1490 |
|
34 | 1491 |
/*! |
1492 |
Reimplemented from HbWidget. |
|
1493 |
*/ |
|
1494 |
void HbPopup::polish(HbStyleParameters ¶ms) |
|
1495 |
{ |
|
1496 |
if (isVisible()) { |
|
1497 |
Q_D(HbPopup); |
|
1498 |
||
1499 |
// fetch scrolling parameters from css |
|
1500 |
||
1501 |
params.addParameter(NO_TIMEOUT_STRING); |
|
1502 |
params.addParameter(CONFIRMATION_NOTE_TIMEOUT_STRING); |
|
1503 |
params.addParameter(STANDARD_TIMEOUT_STRING); |
|
1504 |
params.addParameter(CONTEXT_MENU_TIMEOUT_STRING); |
|
1505 |
||
1506 |
HbWidget::polish(params); |
|
1507 |
||
1508 |
if (!params.value(NO_TIMEOUT_STRING).isNull()) { |
|
1509 |
d->defaultTimeouts[HbPopup::NoTimeout] = params.value(NO_TIMEOUT_STRING).toInt(); |
|
1510 |
} |
|
1511 |
if (!params.value(CONFIRMATION_NOTE_TIMEOUT_STRING).isNull()) { |
|
1512 |
d->defaultTimeouts[HbPopup::ConfirmationNoteTimeout] = params.value(CONFIRMATION_NOTE_TIMEOUT_STRING).toInt(); |
|
1513 |
} |
|
1514 |
if (!params.value(STANDARD_TIMEOUT_STRING).isNull()) { |
|
1515 |
d->defaultTimeouts[HbPopup::StandardTimeout] = params.value(STANDARD_TIMEOUT_STRING).toInt(); |
|
1516 |
} |
|
1517 |
if (!params.value(CONTEXT_MENU_TIMEOUT_STRING).isNull()) { |
|
1518 |
d->defaultTimeouts[HbPopup::ContextMenuTimeout] = params.value(CONTEXT_MENU_TIMEOUT_STRING).toInt(); |
|
1519 |
} |
|
1520 |
if (d->timeoutPending) { |
|
1521 |
d->timeout = d->defaultTimeouts[d->pendingTimeout]; |
|
1522 |
if (d->timeout > 0) { |
|
1523 |
d->timeoutTimer()->setInterval(d->timeout); |
|
1524 |
d->startTimeout(); |
|
1525 |
} |
|
1526 |
d->timeoutPending = false; |
|
1527 |
} |
|
1528 |
} else { |
|
1529 |
HbWidget::polish(params); |
|
1530 |
} |
|
1531 |
} |
|
1532 |
||
0
16d8024aca5e
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
1533 |
#include "moc_hbpopup.cpp" |