Bug 566804 - implement task switcher in Qt builds. r=dougt
authorWolfgang Rosenauer <wr@rosenauer.org>
Thu, 20 May 2010 07:14:35 +0200
changeset 66235 1e697b88f098af8bfabc2b80137e21371d398c15
parent 66234 6ef91dfc79915ebb05ac11b36a949be7084feb0d
child 66236 56ae6a09a05b3cce5f87121ef4bd33ade1004b1e
push id1
push userroot
push dateTue, 26 Apr 2011 22:38:44 +0000
treeherdermozilla-beta@bfdb6e623a36 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersdougt
bugs566804
Bug 566804 - implement task switcher in Qt builds. r=dougt
mobile/components/phone/Makefile.in
mobile/components/phone/nsPhoneSupport.cpp
--- a/mobile/components/phone/Makefile.in
+++ b/mobile/components/phone/Makefile.in
@@ -60,19 +60,25 @@ CPPSRCS   = nsPhoneSupport.cpp
 XPIDLSRCS = nsIPhoneSupport.idl
 
 
 EXTRA_DSO_LDOPTS += \
 	$(XPCOM_GLUE_LDOPTS) \
 	$(NSPR_LIBS) \
 	$(NULL)
 
-ifdef MOZ_PLATFORM_MAEMO
+
+ifeq ($(MOZ_PLATFORM_MAEMO),5)
 LOCAL_INCLUDES   += $(MOZ_DBUS_GLIB_CFLAGS)
 EXTRA_DSO_LDOPTS += $(MOZ_DBUS_GLIB_LIBS)
 endif
 
+ifneq (,$(filter $(MOZ_WIDGET_TOOLKIT),qt))
+LOCAL_INCLUDES += $(MOZ_QT_CFLAGS)
+EXTRA_DSO_LDOPTS += $(MOZ_QT_LIBS)
+endif
+
 ifdef WINCE
 OS_LIBS += $(call EXPAND_LIBNAME, aygshell cellcore)
 endif
 
 include $(topsrcdir)/config/rules.mk
 
--- a/mobile/components/phone/nsPhoneSupport.cpp
+++ b/mobile/components/phone/nsPhoneSupport.cpp
@@ -39,20 +39,25 @@
  *
  * ***** END LICENSE BLOCK ***** */
 
 #ifdef WINCE_WINDOWS_MOBILE
 #include <windows.h>
 #include <phone.h>
 #endif
 
-#ifdef MOZ_PLATFORM_MAEMO
+#if (MOZ_PLATFORM_MAEMO == 5)
 #include <dbus/dbus.h>
 #endif
 
+#ifdef MOZ_WIDGET_QT
+#include <QtGui/QApplication>
+#include <QtGui/QWidget>
+#endif
+
 #include "nsStringAPI.h"
 #include "nsIPhoneSupport.h"
 #include "nsIGenericFactory.h"
 
 class nsPhoneSupport : public nsIPhoneSupport
 {
 public:
 
@@ -93,32 +98,37 @@ nsPhoneSupport::MakeCall(const PRUnichar
 #endif
 
   return (result == 0) ? NS_OK : NS_ERROR_FAILURE;
 }
 
 NS_IMETHODIMP
 nsPhoneSupport::SwitchTask()
 {
-#ifdef MOZ_PLATFORM_MAEMO // 5 only?
+#if (MOZ_PLATFORM_MAEMO == 5)
   DBusError error;
   dbus_error_init(&error);
 
   DBusConnection *conn = dbus_bus_get(DBUS_BUS_SESSION, &error);
 
   DBusMessage *msg = dbus_message_new_signal("/com/nokia/hildon_desktop",
                                              "com.nokia.hildon_desktop",
                                              "exit_app_view");
 
   if (msg) {
       dbus_connection_send(conn, msg, NULL);
       dbus_message_unref(msg);
       dbus_connection_flush(conn);
   }
   return NS_OK;
+#elif MOZ_WIDGET_QT
+  QWidget * window = QApplication::activeWindow();
+  if (window)
+      window->showMinimized();
+  return NS_OK;
 #else
   return NS_ERROR_NOT_IMPLEMENTED;
 #endif
 }
 
 #ifdef WINCE
 
 ///////////////////////////////////////////////////////////////////////////////