taskswitcherapp/tsdevicedialogplugin/src/tsdevicedialogplugin.cpp
changeset 51 4785f57bf3d4
parent 39 4e8ebe173323
child 55 03646e8da489
--- a/taskswitcherapp/tsdevicedialogplugin/src/tsdevicedialogplugin.cpp	Fri May 14 15:43:04 2010 +0300
+++ b/taskswitcherapp/tsdevicedialogplugin/src/tsdevicedialogplugin.cpp	Thu May 27 12:46:08 2010 +0300
@@ -26,7 +26,6 @@
 #include "tstasksgriditem.h"
 #include "tsdocumentloader.h"
 #include "tsmodel.h"
-#include <caservice.h>
 
 /*!
     \class TsDeviceDialogPlugin
@@ -39,7 +38,7 @@
 /*!
     Constructor.
  */
-TsDeviceDialogPlugin::TsDeviceDialogPlugin() : mError(0), mModel(0), mStorage(CaService::instance()), mLongPressed(false)
+TsDeviceDialogPlugin::TsDeviceDialogPlugin() : mError(0), mModel(0), mStorage(0)
 {
 }
 
@@ -70,6 +69,10 @@
     TsDeviceDialog *dialog(0);
     if (deviceDialogType == KTsDialogType) {
         if (0 == mModel) {
+            mStorage = new TsTaskMonitor(this);
+            if (0 == mStorage) {
+                return 0;
+            }
             QtMobility::QServiceManager serviceManager;
             QObject *objPtr(serviceManager.loadInterface("com.nokia.qt.activities.ActivityManager"));
             if (objPtr) {
@@ -96,23 +99,17 @@
         grid->setItemPrototype(new TsTasksGridItem());
         grid->setModel(mModel);
 
-        static_cast<TsModel *>(mModel)->updateModel();
+        //static_cast<TsModel *>(mModel)->updateModel();
 
         // connect the grid and model
         qRegisterMetaType<QModelIndex>("QModelIndex");
         
-        disconnect(grid, SIGNAL(activated(QModelIndex)), this, SLOT(activated(QModelIndex)));
-        disconnect(grid, SIGNAL(pressed(QModelIndex)), this, SLOT(pressed()));
-        disconnect(grid, SIGNAL(longPressed(HbAbstractViewItem *, QPointF)), this, SLOT(longPressed()));
-        disconnect(this, SIGNAL(activate(QModelIndex)), mModel, SLOT(openApplication(QModelIndex)));
-        disconnect(this, SIGNAL(activate(QModelIndex)), dialog, SLOT(close()));
+        disconnect(grid, SIGNAL(activated(QModelIndex)), mModel, SLOT(openApplication(QModelIndex)));
+        disconnect(grid, SIGNAL(activated(QModelIndex)), dialog, SLOT(close()));
         disconnect(grid, SIGNAL(deleteButtonClicked(QModelIndex)), mModel, SLOT(closeApplication(QModelIndex)));
         
-        connect(grid, SIGNAL(activated(QModelIndex)), this, SLOT(activated(QModelIndex)));
-        connect(grid, SIGNAL(pressed(QModelIndex)), this, SLOT(pressed()));
-        connect(grid, SIGNAL(longPressed(HbAbstractViewItem *, QPointF)), this, SLOT(longPressed()));
-        connect(this, SIGNAL(activate(QModelIndex)), mModel, SLOT(openApplication(QModelIndex)));
-        connect(this, SIGNAL(activate(QModelIndex)), dialog, SLOT(close()));
+        connect(grid, SIGNAL(activated(QModelIndex)), mModel, SLOT(openApplication(QModelIndex)));
+        connect(grid, SIGNAL(activated(QModelIndex)), dialog, SLOT(close()));
         connect(grid, SIGNAL(deleteButtonClicked(QModelIndex)), mModel, SLOT(closeApplication(QModelIndex)), Qt::QueuedConnection);
     }
     return dialog;
@@ -157,21 +154,4 @@
     return mError;
 }
 
-void TsDeviceDialogPlugin::activated(QModelIndex index)
-{
-    if (!mLongPressed) {
-        emit activate(index);
-    }
-}
-
-void TsDeviceDialogPlugin::pressed()
-{
-    mLongPressed = false;
-}
-
-void TsDeviceDialogPlugin::longPressed()
-{
-    mLongPressed = true;
-}
-
 Q_EXPORT_PLUGIN2(tsdevicedialogplugin, TsDeviceDialogPlugin)