--- a/controlpanelui/src/cpprofilewrapper/src/cpprofilemonitor_p.cpp Thu Sep 02 17:11:27 2010 +0800
+++ b/controlpanelui/src/cpprofilewrapper/src/cpprofilemonitor_p.cpp Thu Sep 30 16:15:53 2010 +0800
@@ -17,7 +17,8 @@
#include "cpprofilemonitor_p.h"
#include "cpprofilemonitor.h"
-
+#include "cpprofilemodel.h"
+#include <ProEngFactory.h>
#include <CProfileChangeNotifyHandler.h>
/*
@@ -34,6 +35,7 @@
*/
CpProfileMonitorPrivate::~CpProfileMonitorPrivate()
{
+ delete mProfileModel;
delete mProfileNotifier;
}
@@ -43,26 +45,46 @@
void CpProfileMonitorPrivate::initialize(CpProfileMonitor *parent)
{
q_ptr = parent;
- TRAP_IGNORE(mProfileNotifier = CProfileChangeNotifyHandler::NewL(this));
+ mProfileModel = new CpProfileModel();
+ TRAP_IGNORE(mProfileNotifier = ProEngFactory::NewNotifyHandlerL());
+ TRAP_IGNORE(mProfileNotifier->RequestProfileActivationNotificationsL(*this));
+ TRAP_IGNORE(mProfileNotifier->RequestProfileNameArrayNotificationsL(*this));
+ TRAP_IGNORE(mProfileNotifier->RequestProfileNotificationsL(*this, EProfileWrapperGeneralId));
+ TRAP_IGNORE(mProfileNotifier->RequestProfileNotificationsL(*this, EProfileWrapperMeetingId));
+}
+
+/*
+ * From MProEngProfileObserver
+ */
+void CpProfileMonitorPrivate::HandleProfileModifiedL( TInt aProfileId )
+{
+ if (aProfileId == mProfileModel->activeProfileId()) {
+ q_ptr->avtiveProfileModified();
+ } else {
+ q_ptr->profileModified(aProfileId);
+ }
}
/*
- * From MProfileChangeObserver, monitor the profile event
+ * From MProEngProfileActivationObserver
*/
-void CpProfileMonitorPrivate::HandleActiveProfileEventL(TProfileEvent aProfileEvent, TInt aProfileId)
+void CpProfileMonitorPrivate::HandleProfileActivatedL( TInt aProfileId )
{
- switch (aProfileEvent) {
- case EProfileNewActiveProfile:
- {
- q_ptr->profileActivated(aProfileId);
- break;
- }
- case EProfileActiveProfileModified:
- {
- q_ptr->activeProfileModified(aProfileId);
- break;
- }
- default:
- break;
- }
+ q_ptr->profileActivated( aProfileId );
}
+
+/*
+ * From MProEngProfileNameArrayObserver
+ */
+void CpProfileMonitorPrivate::HandleProfileNameArrayModificationL()
+{
+ q_ptr->profileNameModified();
+}
+
+/*
+ * Stop receiveing notification
+ */
+void CpProfileMonitorPrivate::stopMonitoring()
+{
+ mProfileNotifier->CancelAll();
+}