tsdevicedialog/tsdevicedialogplugin/src/tsdevicedialogplugin.cpp
changeset 112 dbfb5e38438b
parent 107 b34d53f6acdf
child 116 305818acdca4
equal deleted inserted replaced
107:b34d53f6acdf 112:dbfb5e38438b
    13 *
    13 *
    14 * Description:
    14 * Description:
    15 *
    15 *
    16 */
    16 */
    17 
    17 
       
    18 #include "tsdevicedialogplugin.h"
       
    19 
    18 #include <QTranslator>
    20 #include <QTranslator>
    19 #include <QCoreApplication>
    21 #include <QCoreApplication>
    20 #include <QLocale>
    22 #include <QLocale>
    21 #include <QtPlugin>
    23 #include <QtPlugin>
    22 #include <qservicemanager.h>
    24 
    23 #include <hbdevicedialog.h>
    25 #include <QValueSpacePublisher>
       
    26 #include <QServiceManager>
       
    27 
       
    28 #include <HbDeviceDialog>
    24 #include <HbMainWindow>
    29 #include <HbMainWindow>
    25 
    30 
    26 #include "tsdevicedialogplugin.h"
    31 #include <tspropertydefs.h>
       
    32 
    27 #include "tsdevicedialogcontainer.h"
    33 #include "tsdevicedialogcontainer.h"
    28 #include "tstasksgrid.h"
    34 #include "tstasksgrid.h"
    29 #include "tstasksgriditem.h"
    35 #include "tstasksgriditem.h"
    30 #include "tsdocumentloader.h"
    36 #include "tsdocumentloader.h"
    31 #include "tsmodel.h"
    37 #include "tsmodel.h"
       
    38 
       
    39 QTM_USE_NAMESPACE
    32 
    40 
    33 /*!
    41 /*!
    34     \class TsDeviceDialogPlugin
    42     \class TsDeviceDialogPlugin
    35     \ingroup group_tsdevicedialogplugin
    43     \ingroup group_tsdevicedialogplugin
    36     \brief TaskSwitcher Device Dialog Plug-in.
    44     \brief TaskSwitcher Device Dialog Plug-in.
   111             Q_ASSERT(translationLoaded);
   119             Q_ASSERT(translationLoaded);
   112             qApp->installTranslator(translator);
   120             qApp->installTranslator(translator);
   113         }
   121         }
   114     
   122     
   115         // lazy loading of model
   123         // lazy loading of model
   116         if (0 == mModel) {
   124         if (!mModel) {
   117             mStorage = new TsTaskMonitor(this);
   125             mStorage = new TsTaskMonitor(this);
   118             if (0 == mStorage) {
       
   119                 return 0; // provider of running application list is critical
       
   120             }
       
   121             
   126             
   122             QtMobility::QServiceManager serviceManager;
   127             QServiceManager serviceManager;
   123             QObject *activityManager(serviceManager.loadInterface(KActivityManaged));
   128             QObject *activityManager(serviceManager.loadInterface(KActivityManaged));
   124             if (0 != activityManager) {
   129             if (activityManager) {
   125                 activityManager->setParent(this); //make it autodestructed
   130                 activityManager->setParent(this); //make it autodestructed
   126             } else {
   131             } else {
   127                 activityManager = this; //activity plugin is not present. provide invalid instance because its not critical functionality.
   132                 activityManager = this; //activity plugin is not present. provide invalid instance because its not critical functionality.
   128                 //QMetaObject::invokeMethod is safe to use in such a case.
   133                 //QMetaObject::invokeMethod is safe to use in such a case.
   129             }
   134             }
   130             mModel = new TsModel(*mStorage, *activityManager);
   135             mModel = new TsModel(*mStorage, *activityManager);
   131         }
   136         }
       
   137             
       
   138         // ensure the dismiss request property is set to false
       
   139 
       
   140         QValueSpacePublisher dismissRequestPublisher(TsProperty::KTsPath);
       
   141         dismissRequestPublisher.setValue(TsProperty::KDismissRequestPath, static_cast<int>(false));
       
   142         dismissRequestPublisher.sync();
       
   143 
   132         
   144         
       
   145         // create device dialog
   133         dialogInterface = new TsDeviceDialogContainer(mModel);
   146         dialogInterface = new TsDeviceDialogContainer(mModel);
   134     }
   147     }
   135     return dialogInterface;
   148     return dialogInterface;
   136 }
   149 }
   137 
   150