summaryrefslogtreecommitdiffstats
path: root/src/other/widgetmanager.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/other/widgetmanager.cpp')
-rw-r--r--src/other/widgetmanager.cpp32
1 files changed, 32 insertions, 0 deletions
diff --git a/src/other/widgetmanager.cpp b/src/other/widgetmanager.cpp
index 28c9cb2..01d50ac 100644
--- a/src/other/widgetmanager.cpp
+++ b/src/other/widgetmanager.cpp
@@ -85,6 +85,7 @@ WidgetManager::WidgetManager(DisplayWidget *dw, QObject *parent)
connect(this, SIGNAL(topWidgetChanged(Widget*)), this, SLOT(updateSymbianSoftKeys()));
connect(this, SIGNAL(topWidgetChanged(Widget*)), this, SLOT(maybeFullscreen(Widget *)));
connect(this, SIGNAL(topWidgetChanged(Widget*)), this, SLOT(updateMaemoNavigate(Widget*)));
+ connect(this, SIGNAL(topWidgetChanged(Widget*)), this, SLOT(handleTopOrientation(Widget*)));
}
WidgetManager::~WidgetManager()
@@ -659,3 +660,34 @@ QString WidgetManager::freeSharedMemoryName()
qFatal("Could not find a free shared memory area");
return QString();
}
+
+void WidgetManager::setOrientationAttribute(int id, int orientation, bool on)
+{
+ Qt::WidgetAttribute realOrientation = static_cast<Qt::WidgetAttribute>(orientation);
+ switch (realOrientation) {
+ case Qt::WA_LockLandscapeOrientation:
+ case Qt::WA_LockPortraitOrientation:
+ case Qt::WA_AutoOrientation:
+ break;
+ default:
+ return;
+ }
+
+ Widget* w = widgetForId(id);
+ if (!w)
+ return;
+ if (w->orientation() == realOrientation && !on)
+ realOrientation = Qt::WA_AutoOrientation;
+ w->setOrientation(realOrientation);
+ if (topWidget() == w) {
+ emit topOrientationChanged(realOrientation);
+ }
+}
+
+void WidgetManager::handleTopOrientation(Widget *topWidget)
+{
+ if (!topWidget)
+ emit topOrientationChanged(Qt::WA_AutoOrientation);
+ else
+ emit topOrientationChanged(topWidget->orientation());
+}