+ if (rotate) {
+ QDBusConnection::systemBus() \
+ .call(QDBusMessage::createMethodCall(MCE_SERVICE,
+ MCE_REQUEST_PATH,
+ MCE_REQUEST_IF,
+ MCE_ACCELEROMETER_ENABLE_REQ));
+ QDBusConnection::systemBus().connect(QString(), MCE_SIGNAL_PATH, MCE_SIGNAL_IF,
+ MCE_DEVICE_ORIENTATION_SIG,
+ this, SLOT(rotateScreen(QString)));
+ }
+}
+
+void QuickWidget::rotateScreen(const QString& orientation) {
+
+ qreal angle = 90;
+ if (orientation == QLatin1String(MCE_ORIENTATION_PORTRAIT) ||
+ orientation == QLatin1String(MCE_ORIENTATION_PORTRAIT_INVERTED)) {
+ if (!landscape_) {
+ return;
+ }
+ angle = -90;
+ landscape_ = false;
+ } else {
+ if (landscape_) {
+ return;
+ }
+ landscape_ = true;
+ }
+ size_.transpose();
+ view_->resize(size_);
+ view_->rotate(angle);