src/hbcore/devicedialogbase/devicedialogserver/hbdevicedialogmanager_p.cpp
changeset 6 c3690ec91ef8
parent 5 627c4a0fd0e7
child 7 923ff622b8b9
equal deleted inserted replaced
5:627c4a0fd0e7 6:c3690ec91ef8
   167     int error(0);
   167     int error(0);
   168 
   168 
   169     HbDeviceDialogInterface *deviceDialogIf =
   169     HbDeviceDialogInterface *deviceDialogIf =
   170         mPluginManager.createWidget(QString(indicatorMenu), QVariantMap(), recycled, error);
   170         mPluginManager.createWidget(QString(indicatorMenu), QVariantMap(), recycled, error);
   171     if (deviceDialogIf) {
   171     if (deviceDialogIf) {
   172         HbPopup *popup = deviceDialogIf->deviceDialogWidget();
   172         connectIndicatorStatus(deviceDialogIf);
   173 #if defined(Q_OS_SYMBIAN)
       
   174         mIndicatorPluginManager->connectTo(popup);
       
   175 #else
       
   176         HbIndicatorPrivate::pluginManager()->connectTo(popup);
       
   177 #endif
       
   178         mPluginManager.freeWidget(deviceDialogIf);
   173         mPluginManager.freeWidget(deviceDialogIf);
   179     }
   174     }
   180     TRACE_EXIT
   175     TRACE_EXIT
   181 }
   176 }
   182 
   177 
   346 void HbDeviceDialogManagerPrivate::moveToForeground(bool foreground)
   341 void HbDeviceDialogManagerPrivate::moveToForeground(bool foreground)
   347 {
   342 {
   348     TRACE_ENTRY_ARGS(foreground)
   343     TRACE_ENTRY_ARGS(foreground)
   349     
   344     
   350     if (foreground) {
   345     if (foreground) {
   351         if(!mMainWindow->isVisible()) {
   346         if(!mMainWindow->isVisible() || !mMainWindow->isActiveWindow()) {
   352             mMainWindow->showFullScreen();
   347             mMainWindow->showFullScreen();
   353             doMoveToForeground(foreground, ECoeWinPriorityAlwaysAtFront);
   348             doMoveToForeground(foreground, ECoeWinPriorityAlwaysAtFront);
   354         }
   349         }
   355     } else {
   350     } else {
   356         if(mMainWindow->isVisible()) {
   351         if(mMainWindow->isVisible()) {
   619         return deviceDialogIf;
   614         return deviceDialogIf;
   620     }
   615     }
   621     connect(sender, SIGNAL(deviceDialogData(QVariantMap)),
   616     connect(sender, SIGNAL(deviceDialogData(QVariantMap)),
   622         SLOT(deviceDialogUpdate(const QVariantMap)));
   617         SLOT(deviceDialogUpdate(const QVariantMap)));
   623 
   618 
   624     if (!recycled && deviceDialogInfo.group == HbDeviceDialogPlugin::IndicatorGroup) {
   619     if (!recycled && (deviceDialogInfo.flags & HbDeviceDialogPlugin::ReceiveIndicatorStatus)) {
   625         // Connect plugin manager signals to indicator menu slots, so that
   620         // Connect plugin manager signals to indicator menu slots, so that
   626         // it will get indicator updates. If the widget is reused, signals
   621         // it will get indicator updates. If the widget is reused, signals
   627         // are already connected.
   622         // are already connected.
   628 #if defined(Q_OS_SYMBIAN)
   623         connectIndicatorStatus(deviceDialogIf);
   629         mIndicatorPluginManager->connectTo(popup);
       
   630 #else
       
   631         HbIndicatorPrivate::pluginManager()->connectTo(popup);
       
   632 #endif
       
   633     }
   624     }
   634 
   625 
   635     // Set popup priority
   626     // Set popup priority
   636     setDialogPriority(popup, deviceDialogInfo.group);
   627     setDialogPriority(popup, deviceDialogInfo.group);
   637 
   628 
   751             } else {
   742             } else {
   752                 closeReason = static_cast<int>(HbDeviceDialog::CancelledError);
   743                 closeReason = static_cast<int>(HbDeviceDialog::CancelledError);
   753             }
   744             }
   754         }
   745         }
   755         emit q->deviceDialogClosed(id, closeReason);
   746         emit q->deviceDialogClosed(id, closeReason);
       
   747         disconnectDialogSignals(current.widget());
   756         mDialogs.remove(current);
   748         mDialogs.remove(current);
   757         removeRegionRect(id);
   749         removeRegionRect(id);
   758     }
   750     }
   759     showDialogs();
   751     showDialogs();
   760     setupWindowRegion();
   752     setupWindowRegion();
   799             criticalGroup|showing).isValid();
   791             criticalGroup|showing).isValid();
   800     }
   792     }
   801     
   793     
   802     if (showingSecurity && !moreDialogs) {
   794     if (showingSecurity && !moreDialogs) {
   803 #if defined(Q_OS_SYMBIAN)
   795 #if defined(Q_OS_SYMBIAN)
   804         doMoveToForeground(false, ECoeWinPriorityAlwaysAtFront-1);
   796         doMoveToForeground(false, ECoeWinPriorityAlwaysAtFront-1);        
   805         mMainWindow->hide(); 
       
   806 #endif
   797 #endif
   807     }    
   798     }    
   808     TRACE_EXIT
   799     TRACE_EXIT
   809 }
   800 }
   810 
   801 
  1034         // Find next one
  1025         // Find next one
  1035         current = &mDialogs.next(*current, HbDeviceDialogsContainer::Dialog::ClientTag,
  1026         current = &mDialogs.next(*current, HbDeviceDialogsContainer::Dialog::ClientTag,
  1036             clientTag);
  1027             clientTag);
  1037     }
  1028     }
  1038 }
  1029 }
       
  1030 
       
  1031 // Connect indicators status (activate/deactivate) signals to device dialog (indicator menu
       
  1032 // and screen saver)
       
  1033 void HbDeviceDialogManagerPrivate::connectIndicatorStatus(HbDeviceDialogInterface *dialogInterface)
       
  1034 {
       
  1035     HbIndicatorPluginManager *indicatorPluginManager;
       
  1036 #if defined(Q_OS_SYMBIAN)
       
  1037     indicatorPluginManager = mIndicatorPluginManager;
       
  1038 #else
       
  1039     indicatorPluginManager = HbIndicatorPrivate::pluginManager();
       
  1040 #endif
       
  1041 
       
  1042     QObject *receiver = dialogSignaler(dialogInterface);
       
  1043     indicatorPluginManager->disconnect(receiver);
       
  1044 
       
  1045     // Connect indicator plugin manager signals to device dialog slots for it to get
       
  1046     // indicator updates
       
  1047     receiver->connect(indicatorPluginManager, SIGNAL(indicatorActivated(HbIndicatorInterface*)),
       
  1048         SLOT(indicatorActivated(HbIndicatorInterface*)));
       
  1049     receiver->connect(indicatorPluginManager, SIGNAL(indicatorRemoved(HbIndicatorInterface*)),
       
  1050         SLOT(indicatorDeactivated(HbIndicatorInterface*)));
       
  1051 
       
  1052     indicatorPluginManager->signalActiveIndicators(receiver);
       
  1053 }
       
  1054 
       
  1055 // Disconnect device dialog signals
       
  1056 void HbDeviceDialogManagerPrivate::disconnectDialogSignals(HbDeviceDialogInterface *dialogInterface)
       
  1057 {
       
  1058     dialogSignaler(dialogInterface)->disconnect(this); // disconnect signals
       
  1059 }
       
  1060 
       
  1061 // Return device dialog signals source/target
       
  1062 QObject *HbDeviceDialogManagerPrivate::dialogSignaler(HbDeviceDialogInterface *dialogInterface)
       
  1063 {
       
  1064     // Plugin can specify signal source/target by signalSender() or allow default which is device
       
  1065     // dialog widget
       
  1066     QObject *signalSourceAndTarget = dialogInterface->signalSender();
       
  1067     if (!signalSourceAndTarget) {
       
  1068         signalSourceAndTarget = dialogInterface->deviceDialogWidget();
       
  1069     }
       
  1070     return signalSourceAndTarget;
       
  1071 }