summaryrefslogtreecommitdiffstats
path: root/shared/system.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'shared/system.cpp')
-rw-r--r--shared/system.cpp27
1 files changed, 20 insertions, 7 deletions
diff --git a/shared/system.cpp b/shared/system.cpp
index 51d21dc..4029816 100644
--- a/shared/system.cpp
+++ b/shared/system.cpp
@@ -30,6 +30,7 @@
****************************************************************************/
#include <QTimer>
+#include <QWidget>
#include "system.h"
@@ -57,32 +58,44 @@ System *System::instance()
return &result;
}
-void System::setViewMode(ViewMode mode)
+void System::setViewMode(QWidget *window, ViewMode mode)
{
+#if defined(Q_OS_SYMBIAN)
+ Q_UNUSED(window);
+
+ // we need to use singleshot since CAknAppUi object is only
+ // available in the main loop
if (mode == PortraitMode)
QTimer::singleShot(0, instance(), SLOT(setPortraitMode()));
else
QTimer::singleShot(0, instance(), SLOT(setLandscapeMode()));
+
+#elif defined(Q_WS_MAEMO_5)
+ bool enabled = (mode == PortraitMode);
+ widget->setAttribute(Qt::WA_Maemo5ForcePortraitOrientation, enabled);
+ widget->setAttribute(Qt::WA_Maemo5ForceLandscapeOrientation, !enabled);
+#else
+ Q_UNUSED(window);
+ Q_UNUSED(mode);
+#endif
}
+#ifdef Q_OS_SYMBIAN
+
void System::setPortraitMode()
{
-#ifdef Q_OS_SYMBIAN
CAknAppUi *aknAppUi = dynamic_cast<CAknAppUi *>(CEikonEnv::Static()->AppUi());
if (aknAppUi)
aknAppUi->SetOrientationL(CAknAppUi::EAppUiOrientationPortrait);
-#endif
- // XXX: add support to hildon portrait mode
}
void System::setLandscapeMode()
{
-#ifdef Q_OS_SYMBIAN
CAknAppUi *aknAppUi = dynamic_cast<CAknAppUi *>(CEikonEnv::Static()->AppUi());
if (aknAppUi)
aknAppUi->SetOrientationL(CAknAppUi::EAppUiOrientationLandscape);
-#endif
- // XXX: add support to hildon landscape mode
}
+
+#endif