Make coding style more consistent
[presencevnc] / src / mainwindow.cpp
index 07bcf51..cf9dfdb 100644 (file)
@@ -181,7 +181,7 @@ void MainWindow::about()
                        tr("<center><h1>Presence VNC 0.8</h1>\
                 <p>A touchscreen friendly VNC client</p>\
                 <p><a href=\"http://presencevnc.garage.maemo.org/\">http://presencevnc.garage.maemo.org/</a></p></center>\
-                <small><p>&copy;2010 Christian Pulvermacher &lt;pulvermacher@gmx.de&gt;<br />\
+                <small><p>&copy;2010-2012 Christian Pulvermacher &lt;pulvermacher@gmx.de&gt;<br />\
                 Based on KRDC, &copy; 2007-2008 Urs Wolfer<br />\
                 and LibVNCServer, &copy; 2001-2003 Johannes E. Schindelin</p>\
                 <p>This program is free software; License: <a href=\"http://www.gnu.org/licenses/gpl-2.0.html\">GNU GPL 2</a> or later.</p></small>"));
@@ -271,7 +271,7 @@ void MainWindow::statusChanged(RemoteView::RemoteStatus status)
 
         //exit fullscreen mode
         if(windowState() & Qt::WindowFullScreen)
-            setWindowState(windowState() ^ Qt::WindowFullScreen);
+            toggleFullscreen();
         break;
     case RemoteView::Disconnected:
 #ifdef Q_WS_MAEMO_5
@@ -321,7 +321,11 @@ void MainWindow::toggleFullscreen()
 void MainWindow::showKeyMenu()
 {
     key_menu->exec();
-    vnc_view->sendKeySequence(key_menu->getKeySequence());
+    if(!key_menu)
+        return;
+
+    if(vnc_view)
+        vnc_view->sendKeySequence(key_menu->getKeySequence());
     key_menu_button->setChecked(key_menu->isAltChecked() or key_menu->isWinChecked());
 }
 
@@ -359,8 +363,11 @@ void MainWindow::resizeEvent(QResizeEvent *event)
         vnc_view->setZoomLevel(zoom_slider->value());
 
 #ifdef Q_WS_MAEMO_5
-    //hide zoom slider in portrait mode
-    zoom_slider->setVisible(height() < width());
+    //in portrait mode, show only zoom slider and fullscreen button
+    //(opening HW keyboard or OSK will return to landscape)
+    const bool portrait = height() > width();
+    for(int i = 0; i < 7; i++)
+        toolbar->actions()[i]->setVisible(!portrait);
 #endif
 }