windowhelper.cpp 1.6 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071
  1. /*
  2. Copyright 2011 - Tommi Laukkanen (www.substanceofcode.com)
  3. This file is part of TwimGo.
  4. NewsFlow is free software: you can redistribute it and/or modify
  5. it under the terms of the GNU Lesser General Public License as published by
  6. the Free Software Foundation, either version 3 of the License, or
  7. (at your option) any later version.
  8. Foobar is distributed in the hope that it will be useful,
  9. but WITHOUT ANY WARRANTY; without even the implied warranty of
  10. MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  11. GNU Lesser General Public License for more details.
  12. You should have received a copy of the GNU Lesser General Public License
  13. along with NewsFlow. If not, see <http://www.gnu.org/licenses/>.
  14. */
  15. #include "windowhelper.h"
  16. #ifdef Q_WS_MAEMO_5
  17. #include <QtDBus>
  18. #include <QDBusConnection>
  19. #include <QDBusMessage>
  20. #endif
  21. WindowHelper::WindowHelper(QObject *parent) :
  22. QObject(parent)
  23. {
  24. }
  25. Q_INVOKABLE void WindowHelper::minimize()
  26. {
  27. #ifdef Q_WS_MAEMO_5
  28. QDBusConnection c = QDBusConnection::sessionBus();
  29. QDBusMessage m = QDBusMessage::createSignal("/", "com.nokia.hildon_desktop", "exit_app_view");
  30. c.send(m);
  31. c.send(m);
  32. #endif
  33. }
  34. Q_INVOKABLE bool WindowHelper::isMaemo()
  35. {
  36. #ifdef Q_WS_MAEMO_5
  37. return true;
  38. #else
  39. return false;
  40. #endif
  41. }
  42. Q_INVOKABLE bool WindowHelper::isMeeGo()
  43. {
  44. #ifdef Q_WS_MAEMO_5
  45. return false;
  46. #elif defined(Q_OS_SYMBIAN)
  47. return false;
  48. #else
  49. return true;
  50. #endif
  51. }
  52. Q_INVOKABLE bool WindowHelper::isSymbian()
  53. {
  54. #ifdef Q_OS_SYMBIAN
  55. return true;
  56. #else
  57. return false;
  58. #endif
  59. }