src/hbcore/inputfw/hbinputfocusobject.cpp
changeset 30 80e4d18b72f5
parent 28 b7da29130b0e
--- a/src/hbcore/inputfw/hbinputfocusobject.cpp	Fri Sep 17 08:32:10 2010 +0300
+++ b/src/hbcore/inputfw/hbinputfocusobject.cpp	Mon Oct 04 00:38:12 2010 +0300
@@ -41,9 +41,11 @@
 #include "hbevent.h"
 #include "hbwidget.h"
 #include "hbinputmainwindow_p.h"
+#include "hbpopup.h"
+#include "hbpopup_p.h"
 
 /*!
-@beta
+@stable
 @hbcore
 \class HbInputFocusObject
 \brief A helper class for accessing editor widget in abstract way.
@@ -479,6 +481,35 @@
 }
 
 /*!
+Returns a priority value for the editor if the editor is inside a popup and
+in other cases zero is returned.
+*/
+quint8 HbInputFocusObject::editorPriority() const
+{
+    Q_D(const HbInputFocusObject);
+
+    QGraphicsObject *editorWidget = d->mGraphicsObject;
+    if (!editorWidget) {
+        QWidget *widget = d->mWidget;
+        if (widget) {
+            editorWidget = widget->graphicsProxyWidget();
+        }
+    }
+
+    if (editorWidget) {
+        // Check if the editor is inside a popup and if so return the popup priority
+        for (QGraphicsObject *object = editorWidget; object; object = object->parentObject()) {
+            HbPopup *popup = qobject_cast<HbPopup *>(object);
+            if (popup) {
+                return HbPopupPrivate::d_ptr(popup)->priority();
+            }
+        }
+    }
+
+    return 0;
+}
+
+/*!
 Returns input method hints. See QWidget and QGraphicsItem documentation for more information.
 */
 Qt::InputMethodHints HbInputFocusObject::inputMethodHints() const