# HG changeset patch
# User hgs
# Date 1279039162 -19800
# Node ID b1f0785c289d8af78ae93ad1dccf633cf580cf78
# Parent 25fe1fe642e395b0f67edc6998d1018b6a7b1e47
201027_03
diff -r 25fe1fe642e3 -r b1f0785c289d messagingapp/msgservices/msgserviceapp/msgserviceapp.pro
--- a/messagingapp/msgservices/msgserviceapp/msgserviceapp.pro Fri Jul 09 14:46:10 2010 +0530
+++ b/messagingapp/msgservices/msgserviceapp/msgserviceapp.pro Tue Jul 13 22:09:22 2010 +0530
@@ -50,8 +50,6 @@
TARGET.CAPABILITY = ALL -TCB
TARGET.UID3 = 0x2002E6DA
-RESOURCES += msgserviceapp.qrc
-
LIBS += -lxqservice \
-lxqserviceutil \
-lconvergedmessageutils \
diff -r 25fe1fe642e3 -r b1f0785c289d messagingapp/msgservices/msgserviceapp/msgserviceapp.qrc
--- a/messagingapp/msgservices/msgserviceapp/msgserviceapp.qrc Fri Jul 09 14:46:10 2010 +0530
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,5 +0,0 @@
-
-
- resources/messaging_en_GB
-
-
diff -r 25fe1fe642e3 -r b1f0785c289d messagingapp/msgservices/msgserviceapp/resources/messaging_en_GB
Binary file messagingapp/msgservices/msgserviceapp/resources/messaging_en_GB has changed
diff -r 25fe1fe642e3 -r b1f0785c289d messagingapp/msgservices/msgserviceapp/src/main.cpp
--- a/messagingapp/msgservices/msgserviceapp/src/main.cpp Fri Jul 09 14:46:10 2010 +0530
+++ b/messagingapp/msgservices/msgserviceapp/src/main.cpp Tue Jul 13 22:09:22 2010 +0530
@@ -77,17 +77,15 @@
{
HbApplication app( argc, argv );
- //TODO: Uncomment the lines when actual
- //translation files are available in sdk and remove loading locally.
+ //installing translator.
QString locale = QLocale::system().name();
QString path = "z:/resource/qt/translations/";
QTranslator translator;
- //QTranslator translator_comm;
- //translator.load(path + QString("messaging_") + locale);
- //translator_comm.load(path + QString("common_") + locale);
- translator.load( "messaging_en_GB", ":/translations" );
+ QTranslator translator_comm;
+ translator.load(path + "messaging_" + locale);
+ translator_comm.load(path + "common_" + locale);
app.installTranslator(&translator);
- //app.installTranslator(&translator_comm);
+ app.installTranslator(&translator_comm);
app.setApplicationName(LOC_TITLE);
diff -r 25fe1fe642e3 -r b1f0785c289d messagingapp/msgsettings/msginit/inc/cmobilesignalstrengthhandler.h
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/messagingapp/msgsettings/msginit/inc/cmobilesignalstrengthhandler.h Tue Jul 13 22:09:22 2010 +0530
@@ -0,0 +1,176 @@
+/*
+* Copyright (c) 2010 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description: Signal strength handler implementation over telephony API
+*
+*/
+
+
+
+#ifndef MOBILESIGNALSTRENGTHHANDLER_H
+#define MOBILESIGNALSTRENGTHHANDLER_H
+
+// INCLUDES
+#include
+#include
+#include "msignalstrengthhandler.h"
+
+// FORWARD DECLARATIONS
+class MSignalStrengthObserver;
+
+// CLASS DECLARATION
+
+/**
+* Class implementing a signal strength handler over the telephony API
+*/
+
+class CMobileSignalStrengthHandler : public CActive, public MSignalStrengthHandler
+{
+ public:
+ /**
+ * Two-phased constructor.
+ */
+ static CMobileSignalStrengthHandler* NewL( );
+
+ /**
+ * Destructor.
+ */
+ ~CMobileSignalStrengthHandler();
+
+ private:
+ /**
+ * C++ default constructor.
+ */
+ CMobileSignalStrengthHandler();
+
+ /**
+ * By default Symbian 2nd phase constructor is private.
+ */
+ void ConstructL();
+
+ public: // from CActive
+ /**
+ * RunL
+ */
+ void RunL();
+
+ /**
+ * RunError
+ * @param aError the error returned
+ * @return error
+ */
+ TInt RunError( TInt aError );
+
+ /**
+ * DoCancel
+ */
+ void DoCancel();
+
+ public:
+ /**
+ * Returns ETrue if signal observing is supported, EFalse otherwise.
+ * @return ETrue if signal observing is supported, EFalse otherwise.
+ */
+ TBool ObservingSupported();
+
+ /**
+ * Returns ETrue if signal strength requests are supported, EFalse otherwise.
+ * @return ETrue if signal strength requests are supported, EFalse otherwise.
+ */
+ TBool RequestsSupported();
+
+ /**
+ * Sets the signal strength observer. May leave with KErrNotSupported
+ * if signal strength observing is not supported.
+ * @param aObserver Observer for signal strength. Ownership is not passed.
+ */
+ void SetSignalStrengthObserverL( MSignalStrengthObserver* aObserver );
+
+ /**
+ * Starts observing the signal strength. May leave with KErrNotSupported
+ * if signal strength observing is not supported.
+ */
+ void StartObservingL();
+
+ /**
+ * Stops the signal strength observing.
+ */
+ void StopObservingL();
+
+ /**
+ * Returns the current signal strength. May leave with KErrNotSupported
+ * if signal strength requests are not supported.
+ * @return The current signal strength.
+ */
+ TInt SignalStrengthL();
+
+ /**
+ * Returns the current bar value. May leave with KErrNotSupported
+ * if bar value requests are not supported.
+ * @return The current signal strength.
+ */
+ TInt BarValueL();
+
+ private: // New methods
+
+ /**
+ * Initializes server sessions.
+ */
+ void InitializeSessionsL();
+
+ /**
+ * Updates the current value of the signal strength.
+ */
+ void UpdateSignalStrengthL();
+
+ /**
+ * Notifiers observer about signal strength.
+ */
+ void NotifyObserver();
+
+ private:
+ /**
+ * Pointer to signal strength observer, may be NULL. Also not owned by the instance.
+ */
+ MSignalStrengthObserver* iObserver;
+
+ /**
+ * State variable for observation.
+ */
+ TBool iObserving;
+
+ /**
+ * Current value of the signal strength.
+ */
+ TInt32 iSignalStrength;
+
+ /**
+ * Network bars value.
+ */
+ TInt8 iBars;
+
+ /**
+ * Mobile phone.
+ */
+ RMobilePhone iMobilePhone;
+
+ /**
+ * Telephony server session.
+ */
+ RTelServer iTelServer;
+};
+
+
+#endif // MOBILESIGNALSTRENGTHHANDLER_H
+
+// End of File
diff -r 25fe1fe642e3 -r b1f0785c289d messagingapp/msgsettings/msginit/inc/coutboxobserver.h
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/messagingapp/msgsettings/msginit/inc/coutboxobserver.h Tue Jul 13 22:09:22 2010 +0530
@@ -0,0 +1,125 @@
+/*
+ * Copyright (c) 2010 Nokia Corporation and/or its subsidiary(-ies).
+ * All rights reserved.
+ * This component and the accompanying materials are made available
+ * under the terms of "Eclipse Public License v1.0"
+ * which accompanies this distribution, and is available
+ * at the URL "http://www.eclipse.org/legal/epl-v10.html".
+ *
+ * Initial Contributors:
+ * Nokia Corporation - initial contribution.
+ *
+ * Contributors:
+ *
+ * Description:
+ * The purpose of this class is to observe if there are messages
+ * in the outbox.
+ *
+ */
+
+#ifndef OUTBOXOBSERVER_H
+#define OUTBOXOBSERVER_H
+
+// INCLUDES
+#include
+#include // for MMsvSessionObserver
+#include "msignalstrengthobserver.h"
+
+// FORWARD DECLARATIONS
+
+class CMsvSession;
+class COutboxSender;
+class MSignalStrengthHandler;
+
+// CLASS DECLARATION
+
+/**
+ * Observes if there are messages in the OutBox..
+ */
+class COutboxObserver: public CBase, public MMsvEntryObserver, public MSignalStrengthObserver
+{
+public:
+ // Constructors and destructor
+
+ /**
+ * A Two-phased constructor.
+ */
+ static COutboxObserver* NewL();
+
+ /**
+ * Destructor.
+ */
+ virtual ~COutboxObserver();
+
+private:
+ // From MSignalStrengthObserver
+
+ void SignalStrengthAndBarUpdatedL(TInt aNewSignalValue, TInt aNewBarValue);
+
+public:
+
+ void HandleMsvSessionReadyL(CMsvSession& aMsvSession);
+ void HandleMsvSessionClosedL();
+
+public:
+
+ /**
+ * The messaging server sends notifications of changes in the
+ * observed entry to CNcnOutboxObserver by calling this method.
+ */
+ void
+ HandleEntryEventL(TMsvEntryEvent aEvent, TAny* /*aArg1*/, TAny* /*aArg2*/, TAny* /*aArg3*/);
+
+public:
+ // New functions
+
+ /**
+ * Informs the networkstatus to Outbox Sender
+ */
+ void InformOutboxSenderL(const TInt& aNetworkBars);
+
+private:
+
+ /**
+ * A C++ constructor.
+ */
+ COutboxObserver();
+
+ /**
+ * By default Symbian OS constructor is private.
+ */
+ void ConstructL();
+
+ /**
+ * By default, prohibit copy constructor
+ */
+ COutboxObserver(const COutboxObserver&);
+
+ /**
+ * Prohibit assigment operator
+ */
+ COutboxObserver& operator=(const COutboxObserver&);
+
+ /**
+ * Creates the Msv Session and sets the outbox
+ * observer and outbox sender.
+ * @param aMsvSession The Msv session to use.
+ */
+ void StartSessionsL(CMsvSession& aMsvSession);
+
+ /**
+ * Delete session, outbox observer and outbox sender.
+ */
+ void EndSessions();
+
+private:
+ // In-box folder entry. Note that the entry is not owned by this class.
+ CMsvEntry* iOutboxFolder;
+ // Pointer to Outbox Sender.
+ COutboxSender* iOutboxSender;
+ // Signal strength handler. Owned.
+ MSignalStrengthHandler* iSignalStrengthHandler;
+};
+
+#endif // OUTBOXOBSERVER_H
+// End of File
diff -r 25fe1fe642e3 -r b1f0785c289d messagingapp/msgsettings/msginit/inc/coutboxsender.h
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/messagingapp/msgsettings/msginit/inc/coutboxsender.h Tue Jul 13 22:09:22 2010 +0530
@@ -0,0 +1,145 @@
+/*
+ * Copyright (c) 2010 Nokia Corporation and/or its subsidiary(-ies).
+ * All rights reserved.
+ * This component and the accompanying materials are made available
+ * under the terms of "Eclipse Public License v1.0"
+ * which accompanies this distribution, and is available
+ * at the URL "http://www.eclipse.org/legal/epl-v10.html".
+ *
+ * Initial Contributors:
+ * Nokia Corporation - initial contribution.
+ *
+ * Contributors:
+ *
+ * Description:
+ * This class follows the offline status of the phone. When the mode is
+ * changed from online to offline, the sending operation is started. When
+ * the mode is changed from online to offline, the current sending
+ * operation is cancelled.
+ *
+ */
+
+#ifndef __OUTBOXSENDER_H__
+#define __OUTBOXSENDER_H__
+
+// INCLUDES
+#include
+#include
+#include
+
+// FORWARD DECLARATIONS
+class CRepository;
+
+// CLASS DECLARATION
+/**
+ * COutboxSender
+ * Sends sms messages from the outbox when offline is changed back to online.
+ * It only tries to send message once. If sending fails due to other reasons
+ * than offline mode, then it is up to the user to go to outbox and send it.
+ * Note: At the moment only sms'es are sent. MMS messages are sent by mms mtm
+ * and emails are saved to outbox as 'During next connection' and those must
+ * not be sent.
+ */
+class COutboxSender: public CBase, public MMsvSingleOpWatcher, public MCenRepNotifyHandlerCallback
+{
+public:
+ // Constructors and destructor
+
+ /**
+ * A two-phased constructor.
+ */
+ static COutboxSender* NewL(CMsvSession& aMsvSession);
+
+ /**
+ * A destructor.
+ */
+ virtual ~COutboxSender();
+
+public:
+ // New functions
+
+ /**
+ * Starts the message sending operation for sms-messages.
+ */
+ void StartSendingL();
+
+ /**
+ * Cancels current message sending operation.
+ */
+ void CancelSending();
+
+ /**
+ * Checks if the sending operation is currently active.
+ */
+ TBool IsSending() const;
+
+ /**
+ * Confirms the network status and starts sending messages
+ */
+ void CheckAndStartSendingL(const TInt& aNetworkBars);
+
+public:
+ // Functions from base classes
+
+ /**
+ * From MMsvSingleOpWatcher. Deletes the sending operation.
+ */
+ virtual void OpCompleted(CMsvSingleOpWatcher& aOpWatcher, TInt aCompletionCode);
+
+ /**
+ * From MCentRepNotifyHandlerCallback.
+ */
+ void HandleNotifyInt(TUint32 aId, TInt aNewValue);
+
+ /**
+ * From MCentRepNotifyHandlerCallback.
+ */
+ void HandleNotifyError(TUint32 aId, TInt aError, CCenRepNotifyHandler* aHandler);
+
+ /**
+ * From MCentRepNotifyHandlerCallback.
+ */
+ void HandleNotifyGeneric(TUint32 aId);
+
+private:
+ /**
+ * A C++ Constructor
+ */
+ COutboxSender(CMsvSession& aMsvSession);
+
+ /**
+ * Creates the connection to shared data and
+ * begins listening the KGSNetworkConnectionAllowed-key.
+ */
+ void ConstructL();
+
+ /**
+ * Checks whether SMS sending is needed in boot-phase and
+ * launches the sending operation
+ */
+ void CheckBootPhaseL();
+
+private:
+ enum TCleanupFlags
+ {
+ EUserSettingsConnected = 0x01,
+ EUserSettingsNotifierSet = 0x02,
+ EOffllineSendingNeeded = 0x10
+ };
+
+private:
+ // Reference to Msv Session
+ CMsvSession& iMsvSession;
+ // Pointer to sending operation
+ CMsvSingleOpWatcher* iRunningOperation;
+ CCenRepNotifyHandler* iNotifyHandler;
+ CRepository* iSession;
+ // Flags to indicate status of Outbox Sender
+ TInt8 iFlags;
+ // Last known network coverage
+ TInt iNetworkBars;
+
+};
+
+#endif // __OUTBOXSENDER_H__
+// End of file
diff -r 25fe1fe642e3 -r b1f0785c289d messagingapp/msgsettings/msginit/inc/coutboxsendoperation.h
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/messagingapp/msgsettings/msginit/inc/coutboxsendoperation.h Tue Jul 13 22:09:22 2010 +0530
@@ -0,0 +1,170 @@
+/*
+* Copyright (c) 2010 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:
+* When the phone mode is changed from offline to online mode, this class
+* sends the messages in outbox, that are in suspended or failed state
+* because of the offline mode. When phone is changed from online to
+* offline mode, the currently running sending operation will be
+* cancelled.
+*
+*/
+
+
+
+#ifndef __COUTBOXSENDOPERATION_H__
+#define __COUTBOXSENDOPERATION_H__
+
+// INCLUDES
+#include
+#include
+
+
+// FORWARD DECLARATIONS
+class CMsvEntrySelection;
+
+// CLASS DECLARATION
+
+/**
+* Sends messages from Outbox when user selects "Start" in Outbox.
+*/
+class COutboxSendOperation : public CMsvOperation
+ {
+ public:
+
+ /**
+ * A two-phased constructor.
+ */
+ static COutboxSendOperation* NewL(
+ CMsvSession& aMsvSession, TRequestStatus& aObserverRequestStatus);
+
+ /**
+ * A destructor.
+ */
+ virtual ~COutboxSendOperation();
+
+ /**
+ * Returns the current operation.
+ */
+ virtual const TDesC8& ProgressL();
+
+ private:
+
+ /**
+ * A C++ constructor
+ */
+ COutboxSendOperation(
+ CMsvSession& aMsvSession, TRequestStatus& aObserverRequestStatus);
+
+ /**
+ * Creates the sending operation session.
+ */
+ void ConstructL();
+
+ private: // Functions from base classes
+
+ /**
+ * Cancels sending operation.
+ */
+ void DoCancel();
+
+ /**
+ * Keeps the message sending operaion active until all
+ * messages are sent.
+ */
+ void RunL();
+
+ /**
+ * Handles the runtime error events
+ */
+ TInt RunError( TInt aError );
+
+ private: // New functions
+
+ /**
+ * Starts sending operation for next selection.
+ */
+ void StartSendingL();
+
+ /**
+ * Sets the selected messages to sending state.
+ */
+ void SendWaitingSMSMessages();
+
+ /**
+ * Sets the selected messages to sending state.
+ */
+ void SendWaitingSMSMessagesL();
+
+ /**
+ * Creates selection of spesified type of messages in outbox
+ */
+ void CreateSelectionL(
+ const TUid& aUidForSel,
+ const TMsvId& aServiceId,
+ CMsvEntrySelection*& aSelection );
+
+ /**
+ * Checks if MTM is available and creates selection
+ */
+ TBool CheckAndCreateSelectionL();
+
+ /**
+ * Completes operation and cancels notify
+ */
+ void CompleteObserver( TInt aStatus );
+
+ /**
+ * Deletes the selection
+ */
+ void RemoveSelection();
+
+ /**
+ * Checks if there is need to continue sending operation
+ */
+ TBool IsSendingNeeded( TUid& aMtm ) const;
+
+ /**
+ * Removes the sending flag
+ */
+ void RemoveSendingFlag( const TUid& aMtm );
+
+ /**
+ * Complete own request
+ */
+ void CompleteSelf( TInt aValue );
+
+
+ private: // Data
+ enum
+ {
+ ESupportsSmsSending = 0x01,
+ ESendSms = 0x10,
+ };
+
+ // Selection queue
+ CArrayPtrFlat iSelections;
+ // Services selection
+ CMsvEntrySelection iServices;
+ // Pointer to Msv Operation
+ CMsvOperation* iOperation;
+ // Entry pointer
+ CMsvEntry* iEntry;
+ // Supported message types
+ TUint iSupportedMsgs;
+ };
+
+
+#endif // __COUTBOXSENDOPERATION_H__
+
+// End of file
diff -r 25fe1fe642e3 -r b1f0785c289d messagingapp/msgsettings/msginit/inc/msignalstrengthhandler.h
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/messagingapp/msgsettings/msginit/inc/msignalstrengthhandler.h Tue Jul 13 22:09:22 2010 +0530
@@ -0,0 +1,94 @@
+/*
+* Copyright (c) 2010 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description: Interface for signal strength handler.
+*
+*/
+
+
+
+#ifndef MSIGNALSTRENGTHHANDLER_H
+#define MSIGNALSTRENGTHHANDLER_H
+
+// INCLUDES
+#include
+
+// FORWARD DECLARATIONS
+class MSignalStrengthObserver;
+
+// CLASS DECLARATION
+
+/**
+* Interface for a class which handles changes
+* in phone signal strength.
+*/
+class MSignalStrengthHandler
+ {
+ public: // Constructors and destructor
+
+ /**
+ * Destructor.
+ */
+ virtual ~MSignalStrengthHandler() {};
+
+ public: // New functions
+
+ /**
+ * Returns ETrue if signal observing is supported, EFalse otherwise.
+ * @return ETrue if signal observing is supported, EFalse otherwise.
+ */
+ virtual TBool ObservingSupported() = 0;
+
+ /**
+ * Returns ETrue if signal strength requests are supported, EFalse otherwise.
+ * @return ETrue if signal strength requests are supported, EFalse otherwise.
+ */
+ virtual TBool RequestsSupported() = 0;
+
+ /**
+ * Sets the signal strength observer. May leave with KErrNotSupported
+ * if signal strength observing is not supported.
+ * @param aObserver Observer for signal strength. Ownership is not passed.
+ */
+ virtual void SetSignalStrengthObserverL( MSignalStrengthObserver* aObserver ) = 0;
+
+ /**
+ * Starts observing the signal strength. May leave with KErrNotSupported
+ * if signal strength observing is not supported.
+ */
+ virtual void StartObservingL() = 0;
+
+ /**
+ * Stops the signal strength observing.
+ */
+ virtual void StopObservingL() = 0;
+
+ /**
+ * Returns the current signal strength. May leave with KErrNotSupported
+ * if signal strength requests are not supported.
+ * @return The current signal strength.
+ */
+ virtual TInt SignalStrengthL() = 0;
+
+ /**
+ * Returns the current bar value. May leave with KErrNotSupported
+ * if bar value requests are not supported.
+ * @return The current signal strength.
+ */
+ virtual TInt BarValueL() = 0;
+
+ };
+
+#endif // MSIGNALSTRENGTHHANDLER_H
+
+// End of File
diff -r 25fe1fe642e3 -r b1f0785c289d messagingapp/msgsettings/msginit/inc/msignalstrengthobserver.h
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/messagingapp/msgsettings/msginit/inc/msignalstrengthobserver.h Tue Jul 13 22:09:22 2010 +0530
@@ -0,0 +1,53 @@
+/*
+* Copyright (c) 2010 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description: Observer for signal strength handler
+*
+*/
+
+
+
+#ifndef MSIGNALSTRENGTHOBSERVER_H
+#define MSIGNALSTRENGTHOBSERVER_H
+
+// INCLUDES
+#include
+
+// CLASS DECLARATION
+
+/**
+* Interface for a class which observes if there are any changes
+* in phone signal strength.
+*/
+class MSignalStrengthObserver
+ {
+ public: // Constructors and destructor
+
+ /**
+ * Destructor.
+ */
+ virtual ~MSignalStrengthObserver() {};
+
+ public: // New functions
+
+ /**
+ * Notifies about updates in signal bars and strength.
+ * @param aNewSignalValue New value for the signal strength.
+ * @param aNewBarValue New value for the signal bars.
+ */
+ virtual void SignalStrengthAndBarUpdatedL( TInt aNewSignalValue, TInt aNewBarValue ) = 0;
+ };
+
+#endif // MSIGNALSTRENGTHOBSERVER_H
+
+// End of File
diff -r 25fe1fe642e3 -r b1f0785c289d messagingapp/msgsettings/msginit/inc/simscnumberdetector.h
--- a/messagingapp/msgsettings/msginit/inc/simscnumberdetector.h Fri Jul 09 14:46:10 2010 +0530
+++ b/messagingapp/msgsettings/msginit/inc/simscnumberdetector.h Tue Jul 13 22:09:22 2010 +0530
@@ -49,6 +49,7 @@
class CClientMtmRegistry;
class CStartUpMonitor;
class CRepository;
+class COutboxObserver;
/**
* Observer to indicate when SIM operation has been completed.
@@ -200,7 +201,7 @@
CStartUpMonitor* iStartupMonitor;
MSimOperationObserver& iObserver;
CRepository* iCenRepSession;
-
+ COutboxObserver* iOutBoxObserver;
};
diff -r 25fe1fe642e3 -r b1f0785c289d messagingapp/msgsettings/msginit/msginit.pro
--- a/messagingapp/msgsettings/msginit/msginit.pro Fri Jul 09 14:46:10 2010 +0530
+++ b/messagingapp/msgsettings/msginit/msginit.pro Tue Jul 13 22:09:22 2010 +0530
@@ -59,14 +59,27 @@
HEADERS += inc/startupmonitor.h \
inc/simscnumberdetector.h \
- inc/msgsimnumberdetector.h
+ inc/msgsimnumberdetector.h \
+ inc/cmobilesignalstrengthhandler.h \
+ inc/coutboxobserver.h \
+ inc/coutboxsender.h \
+ inc/coutboxsendoperation.h \
+ inc/msignalstrengthhandler.h \
+ inc/msignalstrengthobserver.h
SOURCES += src/startupmonitor.cpp \
src/simscnumberdetector.cpp \
- src/msgsimnumberdetector.cpp
-
+ src/msgsimnumberdetector.cpp \
+ src/cmobilesignalstrengthhandler.cpp \
+ src/coutboxobserver.cpp \
+ src/coutboxsendoperation.cpp \
+ src/coutboxsender.cpp
+
LIBS += -lsmcm \
-lmsgs \
-lcentralrepository \
-lcenrepnotifhandler \
- -letelmm
+ -letelmm \
+ -letel \
+ -lmuiuutils
+
diff -r 25fe1fe642e3 -r b1f0785c289d messagingapp/msgsettings/msginit/src/cmobilesignalstrengthhandler.cpp
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/messagingapp/msgsettings/msginit/src/cmobilesignalstrengthhandler.cpp Tue Jul 13 22:09:22 2010 +0530
@@ -0,0 +1,297 @@
+/*
+* Copyright (c) 2010 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description: Mobile signal strength handler implementation
+*
+*/
+
+
+
+// INCLUDE FILES
+#include
+#include "cmobilesignalstrengthhandler.h"
+#include "msignalstrengthobserver.h"
+#include "debugtraces.h"
+
+// -----------------------------------------------------------------
+// CMobileSignalStrengthHandler::NewL
+// -----------------------------------------------------------------
+CMobileSignalStrengthHandler* CMobileSignalStrengthHandler::NewL( )
+ {
+ CMobileSignalStrengthHandler* self = new (ELeave) CMobileSignalStrengthHandler();
+ CleanupStack::PushL( self );
+ self->ConstructL();
+ CleanupStack::Pop( self );
+ return self;
+ }
+
+// -----------------------------------------------------------------
+// CMobileSignalStrengthHandler::~CMobileSignalStrengthHandler
+// -----------------------------------------------------------------
+CMobileSignalStrengthHandler::~CMobileSignalStrengthHandler()
+ {
+ Cancel();
+ iMobilePhone.Close();
+ iTelServer.Close();
+ }
+
+// -----------------------------------------------------------------
+// CMobileSignalStrengthHandler::CMobileSignalStrengthHandler
+// -----------------------------------------------------------------
+CMobileSignalStrengthHandler::CMobileSignalStrengthHandler() :
+ CActive( EPriorityNormal )
+ {
+
+ }
+
+// -----------------------------------------------------------------
+// CMobileSignalStrengthHandler::ConstructL
+// -----------------------------------------------------------------
+void CMobileSignalStrengthHandler::ConstructL()
+ {
+ QDEBUG_WRITE("CMobileSignalStrengthHandler::ConstructL - Enter ");
+ CActiveScheduler::Add( this );
+ InitializeSessionsL();
+ QDEBUG_WRITE("CMobileSignalStrengthHandler::ConstructL - Exit");
+ }
+
+// -----------------------------------------------------------------
+// CMobileSignalStrengthHandler::RunL
+// -----------------------------------------------------------------
+void CMobileSignalStrengthHandler::RunL()
+ {
+ // if operation completed successfully
+ if( iStatus.Int() == KErrNone )
+ {
+ QDEBUG_WRITE_FORMAT("CMobileSignalStrengthHandler::RunL - Signal strength updated ",iSignalStrength );
+ NotifyObserver();
+ }
+
+ // if observing is still active reissue the notification request
+ if( iObserving )
+ {
+ QDEBUG_WRITE( "CMobileSignalStrengthHandler::RunL - NotifySignalStrengthChange" );
+ // reissue the request
+ iMobilePhone.NotifySignalStrengthChange( iStatus, iSignalStrength, iBars );
+ SetActive();
+ }
+ }
+
+// -----------------------------------------------------------------
+// CMobileSignalStrengthHandler::RunError
+// -----------------------------------------------------------------
+TInt CMobileSignalStrengthHandler::RunError( TInt /*aError*/)
+ {
+ return KErrNone;
+ }
+
+// -----------------------------------------------------------------
+// CMobileSignalStrengthHandler::DoCancel
+// -----------------------------------------------------------------
+void CMobileSignalStrengthHandler::DoCancel()
+ {
+ if( iObserving )
+ {
+ iMobilePhone.CancelAsyncRequest( EMobilePhoneNotifySignalStrengthChange );
+ }
+ }
+
+// -----------------------------------------------------------------
+// CMobileSignalStrengthHandler::ObservingSupported
+// -----------------------------------------------------------------
+TBool CMobileSignalStrengthHandler::ObservingSupported()
+ {
+ TUint32 caps;
+ iMobilePhone.GetSignalCaps( caps );
+ return ( caps & RMobilePhone::KCapsNotifySignalStrengthChange );
+ }
+
+// -----------------------------------------------------------------
+// CMobileSignalStrengthHandler::RequestsSupported
+// -----------------------------------------------------------------
+TBool CMobileSignalStrengthHandler::RequestsSupported()
+ {
+ TUint32 caps;
+ iMobilePhone.GetSignalCaps( caps );
+ return ( caps & RMobilePhone::KCapsGetSignalStrength );
+ }
+
+// -----------------------------------------------------------------
+// CMobileSignalStrengthHandler::SetSignalStrengthObserverL
+// -----------------------------------------------------------------
+void CMobileSignalStrengthHandler::SetSignalStrengthObserverL(
+ MSignalStrengthObserver* aObserver )
+ {
+ // leave if observing is not supported
+ if( !ObservingSupported() )
+ {
+ User::Leave( KErrNotSupported );
+ }
+ iObserver = aObserver;
+ }
+
+// -----------------------------------------------------------------
+// CMobileSignalStrengthHandler::StartObservingL
+// -----------------------------------------------------------------
+void CMobileSignalStrengthHandler::StartObservingL()
+ {
+ // leave if observing is not supported
+ if( !ObservingSupported() )
+ {
+ User::Leave( KErrNotSupported );
+ }
+
+ // update signal str
+ TRAPD( err, UpdateSignalStrengthL() );
+
+ // check operation
+ if( err != KErrNone )
+ {
+ QDEBUG_WRITE_FORMAT("CMobileSignalStrengthHandler::StartObservingL - Failed to initialize signal strength (err = )",err );
+ iSignalStrength = 0;
+ }
+ else
+ {
+ QDEBUG_WRITE_FORMAT("CMobileSignalStrengthHandler::StartObservingL - Signal strength initialized to ",iSignalStrength );
+ }
+
+ // update state
+ iObserving = ETrue;
+
+ // Notify current observer about signal strength
+ NotifyObserver();
+
+ // request for notification
+ iMobilePhone.NotifySignalStrengthChange( iStatus, iSignalStrength, iBars );
+ SetActive();
+ }
+
+// -----------------------------------------------------------------
+// CMobileSignalStrengthHandler::StopObservingL
+// -----------------------------------------------------------------
+void CMobileSignalStrengthHandler::StopObservingL()
+ {
+ if( !iObserving )
+ {
+ User::Leave( KErrGeneral );
+ }
+
+ // cancel the request
+ Cancel();
+
+ // update state
+ iObserving = EFalse;
+ }
+
+// -----------------------------------------------------------------
+// CMobileSignalStrengthHandler::SignalStrengthL
+// -----------------------------------------------------------------
+TInt CMobileSignalStrengthHandler::SignalStrengthL()
+ {
+ // leave if requests are not supported
+ if( !RequestsSupported() )
+ {
+ User::Leave( KErrNotSupported );
+ }
+ // if we're not observing we have to update the value manually,
+ // otherwise value is up-to-date
+ if( !iObserving )
+ {
+ UpdateSignalStrengthL();
+ }
+
+ // return the current value
+ return iSignalStrength;
+ }
+
+// -----------------------------------------------------------------
+// CMobileSignalStrengthHandler::BarValueL
+// -----------------------------------------------------------------
+TInt CMobileSignalStrengthHandler::BarValueL()
+ {
+ // leave if requests are not supported
+ if( !RequestsSupported() )
+ {
+ User::Leave( KErrNotSupported );
+ }
+ if( !iObserving )
+ {
+ UpdateSignalStrengthL();
+ }
+
+ // return the current value
+ return iBars;
+ }
+
+// -----------------------------------------------------------------
+// CMobileSignalStrengthHandler::InitializeSessionsL
+// -----------------------------------------------------------------
+void CMobileSignalStrengthHandler::InitializeSessionsL()
+ {
+ QDEBUG_WRITE("CMobileSignalStrengthHandler::InitializeSessionsL - Enter");
+
+ User::LeaveIfError( iTelServer.Connect() );
+
+ RTelServer::TPhoneInfo phoneInfo;
+ TInt numPhone;
+
+ // load tsy module and get number of phones
+ User::LeaveIfError( iTelServer.LoadPhoneModule( KMmTsyModuleName ) );
+ User::LeaveIfError( iTelServer.EnumeratePhones( numPhone) );
+
+ // find the correct phone
+ for (TInt i(0); i < numPhone; i++)
+ {
+ TName tsyName;
+ User::LeaveIfError( iTelServer.GetPhoneInfo( i, phoneInfo ) );
+ User::LeaveIfError( iTelServer.GetTsyName( i,tsyName ) );
+
+ if ( tsyName.CompareF( KMmTsyModuleName ) == 0)
+ {
+ break;
+ }
+ }
+ // open mobile phone session
+ User::LeaveIfError( iMobilePhone.Open( iTelServer, phoneInfo.iName ) );
+ QDEBUG_WRITE("CMobileSignalStrengthHandler::InitializeSessionsL - Exit");
+ }
+
+// -----------------------------------------------------------------
+// CMobileSignalStrengthHandler::UpdateSignalStrengthL
+// -----------------------------------------------------------------
+void CMobileSignalStrengthHandler::UpdateSignalStrengthL()
+ {
+ // only update the value if requests are supported
+ if( RequestsSupported() )
+ {
+ TRequestStatus status;
+ iMobilePhone.GetSignalStrength( status, iSignalStrength, iBars );
+ User::WaitForRequest( status );
+ QDEBUG_WRITE_FORMAT("CMobileSignalStrengthHandler::UpdateSignalStrengthL - GetSignalStrength returned with", status.Int() );
+ User::LeaveIfError( status.Int() );
+ }
+ }
+
+// -----------------------------------------------------------------
+// CMobileSignalStrengthHandler::NotifyObserver
+// -----------------------------------------------------------------
+void CMobileSignalStrengthHandler::NotifyObserver()
+ {
+ // notify observer, if set
+ if( iObserver )
+ {
+ TRAP_IGNORE( iObserver->SignalStrengthAndBarUpdatedL( iSignalStrength, iBars ) );
+ }
+ }
+
+// End of File
diff -r 25fe1fe642e3 -r b1f0785c289d messagingapp/msgsettings/msginit/src/coutboxobserver.cpp
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/messagingapp/msgsettings/msginit/src/coutboxobserver.cpp Tue Jul 13 22:09:22 2010 +0530
@@ -0,0 +1,191 @@
+/*
+ * Copyright (c) 2010 Nokia Corporation and/or its subsidiary(-ies).
+ * All rights reserved.
+ * This component and the accompanying materials are made available
+ * under the terms of "Eclipse Public License v1.0"
+ * which accompanies this distribution, and is available
+ * at the URL "http://www.eclipse.org/legal/epl-v10.html".
+ *
+ * Initial Contributors:
+ * Nokia Corporation - initial contribution.
+ *
+ * Contributors:
+ *
+ * Description: Implements the class
+ *
+ */
+
+// INCLUDE FILES
+#include
+#include // Entry Ids
+#include
+#include
+#include "coutboxsender.h"
+#include "coutboxobserver.h"
+#include "cmobilesignalstrengthhandler.h"
+#include "debugtraces.h"
+
+// ================= MEMBER FUNCTIONS =======================
+
+// ---------------------------------------------------------
+// COutboxObserver::COutboxObserver
+// ---------------------------------------------------------
+//
+COutboxObserver::COutboxObserver(){}
+
+// ---------------------------------------------------------
+// COutboxObserver::ConstructL
+// ---------------------------------------------------------
+//
+void COutboxObserver::ConstructL()
+{
+ QDEBUG_WRITE( "COutboxObserver::ConstructL Enter" );
+ // instantiate the signal strength handler
+ iSignalStrengthHandler = CMobileSignalStrengthHandler::NewL();
+
+ if (iSignalStrengthHandler->ObservingSupported())
+ {
+ iSignalStrengthHandler->SetSignalStrengthObserverL(this);
+ iSignalStrengthHandler->StartObservingL();
+ }
+ else
+ {
+ QDEBUG_WRITE( "COutboxObserver::ConstructL else part" );
+ }
+ QDEBUG_WRITE( "COutboxObserver::ConstructL Exit" );
+}
+
+// ---------------------------------------------------------
+// COutboxObserver::NewL
+// ---------------------------------------------------------
+//
+COutboxObserver* COutboxObserver::NewL()
+{
+ // Create the instance of the outbox observer
+ COutboxObserver* self = new (ELeave) COutboxObserver();
+ // Push it to stack while executing the constructor
+ CleanupStack::PushL(self);
+ self->ConstructL();
+ CleanupStack::Pop();
+ return self;
+}
+
+// ---------------------------------------------------------
+// COutboxObserver::~COutboxObserver
+// ---------------------------------------------------------
+//
+COutboxObserver::~COutboxObserver()
+{
+ delete iSignalStrengthHandler;
+ EndSessions();
+}
+
+// ---------------------------------------------------------
+// COutboxObserver::SignalStrengthUpdatedL
+// ---------------------------------------------------------
+//
+void COutboxObserver::SignalStrengthAndBarUpdatedL(TInt /*aNewSignalValue*/, TInt aNewBarValue)
+{
+ QDEBUG_WRITE_FORMAT( "COutboxObserver::SignalStrengthUpdatedL - Signal bars ", aNewBarValue );
+ // pass new bar value to outbox sender
+ InformOutboxSenderL(aNewBarValue);
+}
+
+// ---------------------------------------------------------
+// COutboxObserver::InformOutboxSenderL
+// ---------------------------------------------------------
+//
+void COutboxObserver::InformOutboxSenderL(const TInt& aNetworkBars)
+{
+ if (iOutboxSender) {
+ QDEBUG_WRITE( "COutboxObserver::InformOutboxSenderL - Informing outbox sender." );
+
+ iOutboxSender->CheckAndStartSendingL(aNetworkBars);
+ }
+ else {
+ QDEBUG_WRITE( "COutboxObserver::InformOutboxSenderL - Outbox sender not initialized." );
+ }
+}
+
+// ---------------------------------------------------------
+// COutboxObserver::StartSessionsL
+// ---------------------------------------------------------
+//
+void COutboxObserver::StartSessionsL(CMsvSession& aMsvSession)
+{
+ // Set outbox folder
+ iOutboxFolder = aMsvSession.GetEntryL(KMsvGlobalOutBoxIndexEntryId);
+ iOutboxFolder->AddObserverL(*this);
+
+ // Remove the Sender, if it exists
+ delete iOutboxSender;
+ iOutboxSender = NULL;
+
+ QDEBUG_WRITE("COutboxObserver::StartSessionsL - Initializing outbox sender.." );
+ iOutboxSender = COutboxSender::NewL(aMsvSession);
+
+ QDEBUG_WRITE( "COutboxObserver::StartSessionsL - Informing outbox sender of network status.." );
+
+ // get current signal bar value
+ TInt signalBars = 0;
+ TRAPD( err, signalBars = iSignalStrengthHandler->BarValueL() );
+
+ // check error
+ if (err == KErrNone)
+ {
+ QDEBUG_WRITE_FORMAT("COutboxObserver::StartSessionsL - Got signal bar value notifying..", signalBars );
+ iOutboxSender->CheckAndStartSendingL(signalBars);
+ }
+ else
+ {
+ QDEBUG_WRITE_FORMAT( "COutboxObserver::StartSessionsL - Failed to get signal bar value (err = )", err );
+ }
+
+}
+
+// ---------------------------------------------------------
+// COutboxObserver::EndSessions
+// ---------------------------------------------------------
+//
+void COutboxObserver::EndSessions()
+{
+ // Delete Outbox sender
+ delete iOutboxSender;
+ iOutboxSender = NULL;
+
+ if (iOutboxFolder) {
+ // Delete outbox folder
+ iOutboxFolder->RemoveObserver(*this);
+ delete iOutboxFolder;
+ iOutboxFolder = NULL;
+ }
+}
+
+// ---------------------------------------------------------
+// COutboxObserver::HandleMsvSessionReadyL
+// ---------------------------------------------------------
+//
+void COutboxObserver::HandleMsvSessionReadyL(CMsvSession& aMsvSession)
+{
+ StartSessionsL(aMsvSession);
+}
+// ---------------------------------------------------------
+// COutboxObserver::HandleMsvSessionClosedL
+// ---------------------------------------------------------
+//
+void COutboxObserver::HandleMsvSessionClosedL()
+{
+ EndSessions();
+}
+
+// ---------------------------------------------------------
+// COutboxObserver::HandleEntryEventL
+// ---------------------------------------------------------
+//
+void COutboxObserver::HandleEntryEventL(TMsvEntryEvent /*aEvent*/, TAny* /*aArg1*/,
+ TAny* /*aArg2*/, TAny* /*aArg3*/)
+{
+
+}
+
+// End of File
diff -r 25fe1fe642e3 -r b1f0785c289d messagingapp/msgsettings/msginit/src/coutboxsender.cpp
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/messagingapp/msgsettings/msginit/src/coutboxsender.cpp Tue Jul 13 22:09:22 2010 +0530
@@ -0,0 +1,258 @@
+/*
+ * Copyright (c) 2010 Nokia Corporation and/or its subsidiary(-ies).
+ * All rights reserved.
+ * This component and the accompanying materials are made available
+ * under the terms of "Eclipse Public License v1.0"
+ * which accompanies this distribution, and is available
+ * at the URL "http://www.eclipse.org/legal/epl-v10.html".
+ *
+ * Initial Contributors:
+ * Nokia Corporation - initial contribution.
+ *
+ * Contributors:
+ *
+ * Description: Implements class
+ *
+ */
+
+// INCLUDE FILES
+
+#include
+#include // Entry Uids
+#include "coutboxsendoperation.h"
+#include "coutboxsender.h"
+#include "debugtraces.h"
+
+// CONSTANTS
+const TInt KListBar0(0);
+
+// ================= MEMBER FUNCTIONS =======================
+
+// ----------------------------------------------------
+// COutboxSender::NewL
+// ----------------------------------------------------
+//
+COutboxSender* COutboxSender::NewL(CMsvSession& aMsvSession)
+{
+ COutboxSender* self = new (ELeave) COutboxSender(aMsvSession);
+ CleanupStack::PushL(self);
+ self->ConstructL();
+ CleanupStack::Pop();
+ return self;
+}
+
+// ----------------------------------------------------
+// COutboxSender::COutboxSender
+// ----------------------------------------------------
+//
+COutboxSender::COutboxSender(CMsvSession& aMsvSession) :
+ iMsvSession(aMsvSession)
+{
+}
+
+// ----------------------------------------------------
+// COutboxSender::~COutboxSender
+// ----------------------------------------------------
+//
+COutboxSender::~COutboxSender()
+{
+ // Stop and delete the sending operation
+ delete iRunningOperation;
+
+ // Check if notification is set
+ if (iFlags & EUserSettingsNotifierSet)
+ {
+ // Remove the notification from list
+ if (iNotifyHandler)
+ {
+ iNotifyHandler->StopListening();
+ delete iNotifyHandler;
+ }
+
+ delete iSession;
+ }
+
+}
+
+// ----------------------------------------------------
+// COutboxSender::ConstructL
+// ----------------------------------------------------
+//
+void COutboxSender::ConstructL()
+{
+ iNetworkBars = KListBar0;
+ iSession = CRepository::NewL(KCRUidCoreApplicationUIs);
+ iNotifyHandler = CCenRepNotifyHandler::NewL(*this, *iSession, CCenRepNotifyHandler::EIntKey,
+ KCoreAppUIsNetworkConnectionAllowed);
+ iNotifyHandler->StartListeningL();
+
+ // Turn flag on for possible error handling cases
+ iFlags |= EUserSettingsNotifierSet;
+
+ CheckBootPhaseL();
+}
+
+// ----------------------------------------------------
+// COutboxSender::StartSendingL
+// ----------------------------------------------------
+//
+void COutboxSender::StartSendingL()
+{
+ // Check if the sending is already in progress
+ if (!IsSending())
+ {
+ // Create instance of Single Operation Watcher
+ CMsvSingleOpWatcher* singleOpWatcher = CMsvSingleOpWatcher::NewL(*this);
+
+ // Push to cleanup stack while creating sending operation
+ CleanupStack::PushL(singleOpWatcher);
+ CMsvOperation* op = COutboxSendOperation::NewL(iMsvSession, singleOpWatcher->iStatus);
+ CleanupStack::Pop(singleOpWatcher);
+
+ // Set operation
+ singleOpWatcher->SetOperation(op); // takes immediately ownership
+ iRunningOperation = singleOpWatcher;
+ }
+}
+
+// ----------------------------------------------------
+// COutboxSender::CancelSending
+// ----------------------------------------------------
+//
+void COutboxSender::CancelSending()
+{
+ // Remove the running operation
+ delete iRunningOperation;
+ iRunningOperation = NULL;
+}
+
+// ----------------------------------------------------
+// COutboxSender::IsSending
+// ----------------------------------------------------
+//
+TBool COutboxSender::IsSending() const
+{
+ return (iRunningOperation != NULL);
+}
+
+// ----------------------------------------------------
+// COutboxSender::OpCompleted
+// ----------------------------------------------------
+//
+void COutboxSender::OpCompleted(CMsvSingleOpWatcher& /*aOpWatcher*/, TInt /*aCompletionCode*/)
+{
+ delete iRunningOperation;
+ iRunningOperation = NULL;
+}
+
+// ----------------------------------------------------
+// COutboxSender::HandleNotifyInt
+// ----------------------------------------------------
+//
+void COutboxSender::HandleNotifyInt(const TUint32 aID, const TInt aNewValue)
+{
+ QDEBUG_WRITE(("COutboxSender::HandleNotifyInt"));
+ // Check if key is for offline-connecton
+ if (aID == KCoreAppUIsNetworkConnectionAllowed)
+ {
+ QDEBUG_WRITE(("COutboxSender::HandleNotifyInt KCoreAppUIsNetworkConnectionAllowed"));
+ // Check if connection is established
+ if (aNewValue == ECoreAppUIsNetworkConnectionAllowed)
+ {
+ QDEBUG_WRITE(("COutboxSender::HandleNotifyInt ECoreAppUIsNetworkConnectionAllowed 1"));
+ // Phone switched on again!
+ iFlags |= EOffllineSendingNeeded;
+
+ QDEBUG_WRITE_FORMAT(("COutboxSender::HandleNotifyInt iNetworkBars = %d"), iNetworkBars );
+ if (iNetworkBars > KListBar0)
+ {
+ QDEBUG_WRITE_FORMAT(("COutboxSender::HandleNotifyInt sending now, iNetworkBars = %d"), iNetworkBars );
+ TRAP_IGNORE( StartSendingL() );
+ }
+ }
+ else
+ {
+ QDEBUG_WRITE("COutboxSender::HandleNotifyInt ECoreAppUIsNetworkConnectionAllowed 0");
+ // Clear flag
+ iFlags &= ~EOffllineSendingNeeded;
+ // Stop sending
+ CancelSending();
+ // Set the coverage to 0 in case it didn't come from network in time
+ iNetworkBars = KListBar0;
+ }
+ }
+}
+
+// ----------------------------------------------------
+// COutboxSender::HandleNotifyGeneric
+// ----------------------------------------------------
+//
+void COutboxSender::HandleNotifyGeneric(const TUint32 /*aID*/)
+{
+ //NO OPERATION
+}
+
+// ----------------------------------------------------
+// COutboxSender::HandleNotifyError
+// ----------------------------------------------------
+//
+void COutboxSender::HandleNotifyError(const TUint32 /*aID*/, const TInt /*aError*/,
+ CCenRepNotifyHandler* /*aHandler*/)
+{
+ //NO OPERATION
+}
+
+// ----------------------------------------------------
+// COutboxSender::CheckAndStartSendingL
+// ----------------------------------------------------
+//
+void COutboxSender::CheckAndStartSendingL(const TInt& aNetworkBars)
+{
+ QDEBUG_WRITE_FORMAT("COutboxSender::CheckAndStartSendingL aNetworkBars = ", aNetworkBars );
+ iNetworkBars = aNetworkBars;
+ // Check if sending is needed and network is available
+ if (aNetworkBars > KListBar0)
+ {
+ QDEBUG_WRITE_FORMAT("COutboxSender::CheckAndStartSendingL sending now, iNetworkBars ", iNetworkBars );
+ // Start sending
+ StartSendingL();
+ }
+ else
+ {
+ QDEBUG_WRITE_FORMAT("COutboxSender::CheckAndStartSendingL not sending, iNetworkBars = ", iNetworkBars );
+ }
+}
+
+// ----------------------------------------------------
+// COutboxSender::CheckBootPhaseL
+// ----------------------------------------------------
+//
+void COutboxSender::CheckBootPhaseL()
+{
+ TInt connection;
+
+ TInt err = iSession->Get(KCoreAppUIsNetworkConnectionAllowed, connection);
+
+ if (err == KErrNone)
+ {
+ // Check if connection is established
+ if (connection)
+ {
+ QDEBUG_WRITE("COutboxSender::CheckBootPhaseL KGSNetworkConnectionAllowed 1");
+ // Phone switched on again!
+ iFlags |= EOffllineSendingNeeded;
+
+ if (iNetworkBars > KListBar0)
+ {
+ QDEBUG_WRITE_FORMAT("COutboxSender::CheckBootPhaseL sending now, iNetworkBars = ", iNetworkBars );
+ StartSendingL();
+ }
+ }
+ }
+ else
+ {
+ QDEBUG_WRITE("COutboxSender::CheckBootPhaseL Cannot access shared data");
+ }
+}
+
+// End of file
diff -r 25fe1fe642e3 -r b1f0785c289d messagingapp/msgsettings/msginit/src/coutboxsendoperation.cpp
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/messagingapp/msgsettings/msginit/src/coutboxsendoperation.cpp Tue Jul 13 22:09:22 2010 +0530
@@ -0,0 +1,409 @@
+/*
+* Copyright (c) 2010 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description: Implements class
+*
+*/
+
+
+
+// INCLUDE FILES
+
+#include "coutboxsendoperation.h" // header
+
+#include // MTM Uids
+#include // Entry Ids
+#include // SMS sending failure error codes
+#include
+#include "debugtraces.h"
+
+// ================= MEMBER FUNCTIONS =======================
+
+// Two-phased constructor.
+COutboxSendOperation* COutboxSendOperation::NewL(
+ CMsvSession& aMsvSession,
+ TRequestStatus& aObserverRequestStatus )
+ {
+ // Create the instance of sending operation
+ COutboxSendOperation* self =
+ new (ELeave) COutboxSendOperation(
+ aMsvSession, aObserverRequestStatus );
+
+ // Push self into cleanup stack during construction
+ CleanupStack::PushL(self);
+ self->ConstructL();
+ CleanupStack::Pop();
+
+ // Return the object
+ return self;
+ }
+
+// C++ default constructor can NOT contain any code that
+// might leave.
+//
+COutboxSendOperation::COutboxSendOperation(
+ CMsvSession& aMsvSession,
+ TRequestStatus& aObserverRequestStatus )
+ :
+ CMsvOperation( aMsvSession, CActive::EPriorityStandard, aObserverRequestStatus ),
+ iSelections( 4 ),
+ iServices(),
+ iSupportedMsgs( COutboxSendOperation::ESupportsSmsSending )
+ {
+ // Start scheduler
+ CActiveScheduler::Add(this);
+ }
+
+//destructor
+COutboxSendOperation::~COutboxSendOperation()
+ {
+ // Cancel sending
+ Cancel();
+
+ // Delete sending operation
+ delete iOperation;
+ iOperation = NULL;
+
+ // Delete entry
+ delete iEntry;
+ iEntry = NULL;
+
+ // Remove services from queue and destroy message selections
+ iServices.Reset();
+ iSelections.ResetAndDestroy();
+ }
+
+// ----------------------------------------------------
+// COutboxSendOperation::ConstructL
+// ----------------------------------------------------
+//
+void COutboxSendOperation::ConstructL()
+ {
+ // Get rootindex entry
+ iEntry = iMsvSession.GetEntryL( KMsvRootIndexEntryId );
+ iEntry->SetSortTypeL(
+ TMsvSelectionOrdering( KMsvNoGrouping, EMsvSortByNone, ETrue ) );
+
+ // Set sending flags
+ iSupportedMsgs |= ESendSms;
+
+ // Start sending
+ StartSendingL();
+ }
+
+// ----------------------------------------------------
+// COutboxSendOperation::RunL
+// ----------------------------------------------------
+//
+void COutboxSendOperation::RunL()
+ {
+ QDEBUG_WRITE("COutboxSendOperation::RunL");
+ User::LeaveIfError( iStatus.Int() );
+
+ // Check and start sending, if needed
+ TUid sendMtm;
+
+ // Check if messages needs to be sent
+ if( IsSendingNeeded( sendMtm ) )
+ {
+ StartSendingL();
+ }
+ // Nothing to send, complete operation
+ else
+ {
+ CompleteObserver( iStatus.Int() );
+ }
+ }
+
+// ----------------------------------------------------
+// COutboxSendOperation::RunError
+// ----------------------------------------------------
+//
+TInt COutboxSendOperation::RunError( TInt aError )
+ {
+ CompleteObserver( aError );
+ return aError;
+ }
+
+// ----------------------------------------------------
+// COutboxSendOperation::DoCancel
+// ----------------------------------------------------
+//
+void COutboxSendOperation::DoCancel()
+ {
+ // Check if sending operation is running
+ if( iOperation )
+ {
+ // Cancel it
+ iOperation->Cancel();
+ }
+
+ // Complete operation with current status
+ CompleteObserver( iStatus.Int() );
+ }
+
+// ----------------------------------------------------
+// COutboxSendOperation::ProgressL
+// ----------------------------------------------------
+//
+const TDesC8& COutboxSendOperation::ProgressL()
+ {
+ // Check if operation exists
+ if( iOperation )
+ {
+ // Return the operation
+ return iOperation->ProgressL();
+ }
+
+ // If no operation, return blank information
+ return KNullDesC8();
+ }
+
+// ---------------------------------------------------------
+// COutboxSendOperation::CompleteOperation
+// ---------------------------------------------------------
+//
+void COutboxSendOperation::CompleteObserver( TInt aStatus )
+ {
+ // Get the observer status
+ TRequestStatus* status = &iObserverRequestStatus;
+ User::RequestComplete( status, aStatus );
+ }
+
+// ----------------------------------------------------
+// COutboxSendOperation::StartSendingL
+// ----------------------------------------------------
+//
+void COutboxSendOperation::StartSendingL()
+ {
+ // Remove any sending operation that currently may be running
+ delete iOperation;
+ iOperation = NULL;
+
+
+ // Check if there was errors with creating selection
+ if ( CheckAndCreateSelectionL() )
+ {
+ // Create new operation and trap any errors
+ SendWaitingSMSMessages();
+ RemoveSelection();
+ }
+ else
+ {
+ CompleteSelf( KErrNone );
+ }
+ }
+
+ // if error, then complete this pass with the error code
+void COutboxSendOperation::SendWaitingSMSMessages()
+ {
+ TRAPD( err, SendWaitingSMSMessagesL() );
+ if ( err != KErrNone )
+ {
+ ASSERT( !IsActive() );
+ CompleteSelf( err );
+ }
+ }
+
+// ----------------------------------------------------
+// COutboxSendOperation::SendWaitingSMSMessagesL
+// ----------------------------------------------------
+//
+void COutboxSendOperation::SendWaitingSMSMessagesL()
+ {
+ // Get first selection from queue
+ CMsvEntrySelection& selection = ( *iSelections[0] );
+
+ // Get count of messages in queue
+ TInt count = selection.Count();
+
+ // Go through all messages
+ while( count-- )
+ {
+ // Select message
+ iEntry->SetEntryL( selection[count] );
+ TMsvEntry entry( iEntry->Entry() );
+
+ // Check if the message is tried to send when in offline
+ if( ( entry.SendingState() == KMsvSendStateSuspended ||
+ entry.SendingState() == KMsvSendStateFailed) &&
+ ( entry.iError == KErrGsmOfflineOpNotAllowed ||
+ entry.iError == KErrGsmOfflineSimOpNotAllowed) )
+ {
+ // Set message to wait sending
+ entry.SetSendingState( KMsvSendStateWaiting );
+ iEntry->ChangeL( entry );
+ }
+ else
+ {
+ selection.Delete( count );
+ }
+ }
+ selection.Compress();
+
+ // Set entry to outbox
+ iMtm = iEntry->Entry().iMtm;
+ iEntry->SetEntryL( KMsvGlobalOutBoxIndexEntryId );
+ if ( selection.Count() )
+ {
+ iOperation = iEntry->CopyL( selection, iServices[0], iStatus );
+ SetActive();
+ }
+ else
+ {
+ // Nothing to send, but we must complete the observer via our RunL callback
+ CompleteSelf( KErrNone );
+ }
+ }
+
+
+// ----------------------------------------------------
+// COutboxSendOperation::RemoveSelection
+// ----------------------------------------------------
+//
+void COutboxSendOperation::RemoveSelection()
+ {
+ // Clear the the current selection.
+ iServices.Delete(0);
+
+ // Delete selection object and index
+ delete iSelections[0];
+ iSelections.Delete(0);
+ }
+
+// ----------------------------------------------------
+// COutboxSendOperation::CreateSelectionL
+// ----------------------------------------------------
+//
+void COutboxSendOperation::CreateSelectionL(
+ const TUid &aUidForSel,
+ const TMsvId& aServiceId,
+ CMsvEntrySelection*& aSelection )
+ {
+ // Set entry to outbox and get messages from outbox
+ iEntry->SetEntryL( KMsvGlobalOutBoxIndexEntryId );
+ aSelection = iEntry->ChildrenWithMtmL( *&aUidForSel );
+
+ // Check if there is anything to put into array
+ if( aSelection->Count() )
+ {
+ // Put selection to queue
+ CleanupStack::PushL( aSelection );
+ iSelections.AppendL( aSelection );
+ CleanupStack::Pop( aSelection );
+
+ // Put service to queue
+ iServices.AppendL( aServiceId );
+ }
+ else
+ {
+ // Remove selection
+ delete aSelection;
+ aSelection = NULL;
+ }
+ }
+
+// ----------------------------------------------------
+// COutboxSendOperation::CheckAndCreateSelectionL
+// ----------------------------------------------------
+//
+TBool COutboxSendOperation::CheckAndCreateSelectionL()
+ {
+ // Get root index
+ iEntry->SetEntryL( KMsvRootIndexEntryId );
+
+ // MTM, for which the selection is collected
+ TUid sendMtm;
+
+ // Selection of messages for sending
+ CMsvEntrySelection* smsSelection = NULL;
+
+ // While MTM's available for sending
+ while( smsSelection == NULL && IsSendingNeeded( sendMtm ) )
+ {
+ // Find default SMS service
+ TMsvId serviceId =0;
+ TSmsUtilities::ServiceIdL(*iEntry, serviceId);
+ QDEBUG_WRITE_FORMAT("COutboxSendOperation::CheckAndCreateSelectionL ",serviceId );
+ // Check if the service ID is found
+ if( serviceId != KMsvNullIndexEntryId )
+ {
+ // Create selection of messages of specified MTM
+ CreateSelectionL( sendMtm, serviceId, smsSelection );
+ }
+ // Selection has been created, remove the flag
+ RemoveSendingFlag( *&sendMtm );
+ }
+
+ const TBool selectionAvailable = ( smsSelection != NULL );
+ return selectionAvailable;
+ }
+
+// ----------------------------------------------------
+// COutboxSendOperation::RemoveSendingFlag
+// ----------------------------------------------------
+//
+void COutboxSendOperation::RemoveSendingFlag( const TUid& aMtm )
+ {
+ // Decide actions by mtm
+ switch( aMtm.iUid )
+ {
+ // SMS-messages
+ case KSenduiMtmSmsUidValue:
+ iSupportedMsgs &= ~ESendSms;
+ break;
+ default:
+ break;
+ }
+ }
+
+// ----------------------------------------------------
+// COutboxSendOperation::IsSendingNeeded
+// ----------------------------------------------------
+//
+TBool COutboxSendOperation::IsSendingNeeded(
+ TUid& aMtm ) const
+ {
+ // Set starting condition
+ TBool needSending = EFalse;
+
+ // Check if sms-sending is supported and messages need to be sent
+ if( iSupportedMsgs & ESupportsSmsSending &&
+ iSupportedMsgs & ESendSms )
+ {
+ aMtm = KSenduiMtmSmsUid;
+ needSending = ETrue;
+ }
+ // Otherwise nothing needs to be done
+ else
+ {
+ aMtm.iUid = 0;
+ needSending = EFalse;
+ }
+
+ // Return the result
+ return needSending;
+ }
+
+// ----------------------------------------------------
+// COutboxSendOperation::CompleteSelf
+// ----------------------------------------------------
+//
+void COutboxSendOperation::CompleteSelf( TInt aValue )
+ {
+ TRequestStatus* status = &iStatus;
+ User::RequestComplete( status, aValue );
+ SetActive();
+ }
+
+// End of file
diff -r 25fe1fe642e3 -r b1f0785c289d messagingapp/msgsettings/msginit/src/simscnumberdetector.cpp
--- a/messagingapp/msgsettings/msginit/src/simscnumberdetector.cpp Fri Jul 09 14:46:10 2010 +0530
+++ b/messagingapp/msgsettings/msginit/src/simscnumberdetector.cpp Tue Jul 13 22:09:22 2010 +0530
@@ -28,6 +28,7 @@
#include
#include
+#include "coutboxobserver.h"
#include "simscnumberdetector.h"
#include "startupmonitor.h"
@@ -67,6 +68,8 @@
// initialise
iMsvSession = CMsvSession::OpenSyncL(*this);
+
+ iOutBoxObserver = COutboxObserver::NewL();
// Create the SMS Service
TMsvId serviceId = CreateSmsServiceL();
@@ -80,6 +83,9 @@
// Start the System state monitor
iStartupMonitor = CStartUpMonitor::NewL(this);
+
+ // Start the Auto-send AO, to handle offline SMS messages
+ iOutBoxObserver->HandleMsvSessionReadyL(*iMsvSession);
QDEBUG_WRITE("CMsgSimOperation::ConstructL exit")
}
@@ -297,6 +303,10 @@
delete iSimOperation;
delete iSmsClientMtm;
delete iClientRegistry;
+
+ delete iOutBoxObserver;
+ iOutBoxObserver = NULL;
+
delete iMsvSession;
delete iStartupMonitor;
iStartupMonitor = NULL;
@@ -487,7 +497,11 @@
delete iClientRegistry;
iClientRegistry = NULL;
-
+
+ iOutBoxObserver->HandleMsvSessionClosedL();
+ delete iOutBoxObserver;
+ iOutBoxObserver = NULL;
+
delete iMsvSession;
iMsvSession = NULL;
diff -r 25fe1fe642e3 -r b1f0785c289d messagingapp/msgsettings/msgsettings.pro
--- a/messagingapp/msgsettings/msgsettings.pro Fri Jul 09 14:46:10 2010 +0530
+++ b/messagingapp/msgsettings/msgsettings.pro Tue Jul 13 22:09:22 2010 +0530
@@ -21,3 +21,4 @@
SUBDIRS += settingsview/settingsview.pro
SUBDIRS += msginit/msginit.pro
+SUBDIRS += settingsserviceapp/settingsserviceapp.pro
diff -r 25fe1fe642e3 -r b1f0785c289d messagingapp/msgsettings/settingsserviceapp/inc/settingsserviceinterface.h
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/messagingapp/msgsettings/settingsserviceapp/inc/settingsserviceinterface.h Tue Jul 13 22:09:22 2010 +0530
@@ -0,0 +1,61 @@
+/*
+ * Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
+ * All rights reserved.
+ * This component and the accompanying materials are made available
+ * under the terms of "Eclipse Public License v1.0"
+ * which accompanies this distribution, and is available
+ * at the URL "http://www.eclipse.org/legal/epl-v10.html".
+ *
+ * Initial Contributors:
+ * Nokia Corporation - initial contribution.
+ *
+ * Contributors:
+ *
+ * Description: Interface for launching settings view as
+ * Qthighway service
+ *
+ */
+
+#ifndef __SETTINGS_VIEW_INTERFACE_H__
+#define __SETTINGS_VIEW_INTERFACE_H__
+
+#include
+#include
+
+class HbMainWindow;
+class HbAction;
+
+class SettingsViewInterface : public XQServiceProvider
+ {
+ Q_OBJECT
+
+public:
+ /**
+ * Constructor
+ */
+ SettingsViewInterface(HbMainWindow *mainWindow,QObject* parent=0);
+
+ /**
+ * Destructor
+ */
+ ~SettingsViewInterface();
+
+public slots:
+ /**
+ * Function which launches the settings view
+ * @param view, holds MsgSettingsView::SettingsView enum
+ */
+ void launchSettings(int view);
+
+private:
+ /**
+ * Main Window instance
+ * Not owned
+ */
+ HbMainWindow *mMainWindow;
+
+ HbAction* mBackAction;
+
+ };
+
+#endif /* __SETTINGS_VIEW_INTERFACE_H__ */
diff -r 25fe1fe642e3 -r b1f0785c289d messagingapp/msgsettings/settingsserviceapp/resources/messaging_en_GB
Binary file messagingapp/msgsettings/settingsserviceapp/resources/messaging_en_GB has changed
diff -r 25fe1fe642e3 -r b1f0785c289d messagingapp/msgsettings/settingsserviceapp/rom/settingsserviceapp.iby
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/messagingapp/msgsettings/settingsserviceapp/rom/settingsserviceapp.iby Tue Jul 13 22:09:22 2010 +0530
@@ -0,0 +1,25 @@
+/*
+ * Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
+ * All rights reserved.
+ * This component and the accompanying materials are made available
+ * under the terms of "Eclipse Public License v1.0""
+ * which accompanies this distribution, and is available
+ * at the URL "http://www.eclipse.org/legal/epl-v10.html".
+ *
+ * Initial Contributors:
+ * Nokia Corporation - initial contribution.
+ *
+ * Contributors:
+ *
+ * Description:
+ *
+ */
+
+#ifndef __SETTINGS_SERVICEAPP_IBY__
+#define __SETTINGS_SERVICEAPP_IBY__
+
+file=ABI_DIR\UREL\settingsserviceapp.exe SHARED_LIB_DIR\settingsserviceapp.exe
+data=DATAZ_\resource\apps\settingsserviceapp.rsc resource\apps\settingsserviceapp.rsc
+data=DATAZ_\private\10003a3f\import\apps\settingsserviceapp_reg.rsc private\10003a3f\import\apps\settingsserviceapp_reg.rsc
+
+#endif
diff -r 25fe1fe642e3 -r b1f0785c289d messagingapp/msgsettings/settingsserviceapp/service_conf.xml
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/messagingapp/msgsettings/settingsserviceapp/service_conf.xml Tue Jul 13 22:09:22 2010 +0530
@@ -0,0 +1,11 @@
+
+
+ messagesettings
+ No path
+ Messaging services
+
+ com.nokia.symbian.IMessageSettings
+ 1.0
+ Message Settings Interface
+
+
diff -r 25fe1fe642e3 -r b1f0785c289d messagingapp/msgsettings/settingsserviceapp/settingsserviceapp.pro
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/messagingapp/msgsettings/settingsserviceapp/settingsserviceapp.pro Tue Jul 13 22:09:22 2010 +0530
@@ -0,0 +1,50 @@
+# Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
+# All rights reserved.
+# This component and the accompanying materials are made available
+# under the terms of "Eclipse Public License v1.0"
+# which accompanies this distribution, and is available
+# at the URL "http://www.eclipse.org/legal/epl-v10.html".
+# Initial Contributors:
+# Nokia Corporation - initial contribution.
+# Contributors:
+# Description:
+
+TEMPLATE = app
+TARGET = settingsserviceapp
+
+CONFIG += hb service
+
+DEPENDPATH += . inc src
+SERVICE.FILE = service_conf.xml
+SERVICE.OPTIONS = embeddable
+SERVICE.OPTIONS += hidden
+
+INCLUDEPATH += inc
+INCLUDEPATH += ../../../inc
+INCLUDEPATH += ../../msgui/inc
+INCLUDEPATH += ../settingsview/inc
+
+INCLUDEPATH += $$APP_LAYER_SYSTEMINCLUDE
+
+# Input
+HEADERS += inc/settingsserviceinterface.h
+
+SOURCES += src/main.cpp \
+ src/settingsserviceinterface.cpp
+
+# Capability
+TARGET.CAPABILITY = ALL -TCB
+TARGET.UID3 = 0x2001FE6A
+
+RESOURCES += settingsserviceapp.qrc
+
+TRANSLATIONS = messaging.ts
+
+
+LIBS += -lxqservice \
+ -lxqserviceutil \
+ -lsettingsview
+
+
+BLD_INF_RULES.prj_exports += "$${LITERAL_HASH}include " \
+ ".\rom\settingsserviceapp.iby CORE_APP_LAYER_IBY_EXPORT_PATH(settingsserviceapp.iby)"
diff -r 25fe1fe642e3 -r b1f0785c289d messagingapp/msgsettings/settingsserviceapp/settingsserviceapp.qrc
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/messagingapp/msgsettings/settingsserviceapp/settingsserviceapp.qrc Tue Jul 13 22:09:22 2010 +0530
@@ -0,0 +1,5 @@
+
+
+ resources/messaging_en_GB
+
+
diff -r 25fe1fe642e3 -r b1f0785c289d messagingapp/msgsettings/settingsserviceapp/src/main.cpp
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/messagingapp/msgsettings/settingsserviceapp/src/main.cpp Tue Jul 13 22:09:22 2010 +0530
@@ -0,0 +1,114 @@
+/*
+* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description: Messaging service application startup main().
+*
+*/
+
+#include
+#include
+#include
+#include
+#include
+#include
+#include
+
+#include "settingsserviceinterface.h"
+#include "debugtraces.h"
+
+//Localised constants
+#define LOC_TITLE hbTrId("txt_messaging_title_messaging")
+
+const QString debugFileName("c:/settingsservice_app.txt");
+
+#ifdef _DEBUG_TRACES_
+void debugInit(QtMsgType type, const char *msg)
+{
+
+ QFile ofile(debugFileName);
+ if (!ofile.open(QIODevice::Append | QIODevice::Text))
+ {
+ qFatal("error opening results file");
+ return;
+ }
+ QDateTime dt = QDateTime::currentDateTime();
+
+ QTextStream out(&ofile);
+ switch (type)
+ {
+ case QtDebugMsg:
+ out << " DEBUG:";
+ out << msg;
+ break;
+ case QtWarningMsg:
+ out << " WARN:";
+ out << msg;
+ break;
+ case QtCriticalMsg:
+ out << "\n ";
+ out << dt.toString("dd/MM/yyyy hh:mm:ss.zzz:ap");
+ out << " CRITICAL:";
+ out << msg;
+ break;
+ case QtFatalMsg:
+ out << " FATAL:";
+ out << msg;
+ abort();
+ break;
+ default:
+ out << " No Log Selection Type:";
+ out << msg;
+ break;
+
+ }
+}
+#endif
+
+int main(int argc, char **argv)
+{
+ HbApplication app( argc, argv );
+
+ //TODO: Uncomment the lines when actual translation files are available in sdk and remove loading locally.
+ QString locale = QLocale::system().name();
+ QString path = "z:/resource/qt/translations/";
+ QTranslator translator;
+ QTranslator translator_comm;
+ translator.load(path + QString("messaging_") + locale);
+ translator_comm.load(path + QString("common_") + locale);
+ app.installTranslator(&translator);
+ app.installTranslator(&translator_comm);
+
+ app.setApplicationName(LOC_TITLE);
+
+#ifdef _DEBUG_TRACES_
+ //Debug Logs
+ QFile ofile;
+ if (ofile.exists(debugFileName))
+ {
+ ofile.remove(debugFileName);
+ }
+ qInstallMsgHandler(debugInit);
+#endif
+
+
+ HbMainWindow *window = new HbMainWindow();
+
+ SettingsViewInterface *settingsViewInterface = new SettingsViewInterface(window);
+ window->show();
+
+ int rv = app.exec();
+ delete window;
+ delete settingsViewInterface;
+ return rv;
+}
+
diff -r 25fe1fe642e3 -r b1f0785c289d messagingapp/msgsettings/settingsserviceapp/src/settingsserviceinterface.cpp
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/messagingapp/msgsettings/settingsserviceapp/src/settingsserviceinterface.cpp Tue Jul 13 22:09:22 2010 +0530
@@ -0,0 +1,69 @@
+/*
+ * Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
+ * All rights reserved.
+ * This component and the accompanying materials are made available
+ * under the terms of "Eclipse Public License v1.0"
+ * which accompanies this distribution, and is available
+ * at the URL "http://www.eclipse.org/legal/epl-v10.html".
+ *
+ * Initial Contributors:
+ * Nokia Corporation - initial contribution.
+ *
+ * Contributors:
+ *
+ * Description: Interface for launching settings view as
+ * Qthighway service
+ *
+ */
+
+#include "settingsserviceinterface.h"
+#include
+#include
+#include
+
+#include "msgsettingsview.h"
+#include "debugtraces.h"
+
+//----------------------------------------------------------------------------
+// SettingsViewInterface::SettingsViewInterface
+// @see header
+//----------------------------------------------------------------------------
+SettingsViewInterface::SettingsViewInterface(HbMainWindow *mainWindow,QObject* parent)
+:XQServiceProvider(QLatin1String("messagesettings.com.nokia.symbian.IMessageSettings"),parent),
+mMainWindow(mainWindow)
+ {
+ publishAll();
+
+ //creating back action.
+ mBackAction = new HbAction(Hb::BackNaviAction, this);
+ connect(mBackAction, SIGNAL(triggered()), qApp, SLOT(quit()));
+
+ }
+
+//----------------------------------------------------------------------------
+// SettingsViewInterface::~SettingsViewInterface
+// @see header
+//----------------------------------------------------------------------------
+SettingsViewInterface::~SettingsViewInterface()
+ {
+ }
+
+//----------------------------------------------------------------------------
+// SettingsViewInterface::launchSettings
+// @see header
+//----------------------------------------------------------------------------
+void SettingsViewInterface::launchSettings(int view)
+ {
+ QDEBUG_WRITE("Entered launchSettings")
+ MsgSettingsView* settingsView = new MsgSettingsView((MsgSettingsView::SettingsView)view);
+ settingsView->setNavigationAction(mBackAction);
+ mMainWindow->addView(settingsView);
+
+ if(view != MsgSettingsView::SMSView)
+ {
+ mMainWindow->setCurrentView(settingsView);
+ }
+ }
+
+//EOF
+
diff -r 25fe1fe642e3 -r b1f0785c289d messagingapp/msgsettings/settingsview/src/msgsettingsform.cpp
--- a/messagingapp/msgsettings/settingsview/src/msgsettingsform.cpp Fri Jul 09 14:46:10 2010 +0530
+++ b/messagingapp/msgsettings/settingsview/src/msgsettingsform.cpp Tue Jul 13 22:09:22 2010 +0530
@@ -157,8 +157,7 @@
if (settingsView == MsgSettingsView::MMSView)
{
//set MMS Settings as expanded
- //TODO: dataform issue on expanding one group item
-// expandGroup(mmsGroup,true);
+ expandGroup(mmsGroup,true);
}
}
diff -r 25fe1fe642e3 -r b1f0785c289d messagingapp/msgsettings/settingsview/src/msgsettingsview.cpp
--- a/messagingapp/msgsettings/settingsview/src/msgsettingsview.cpp Fri Jul 09 14:46:10 2010 +0530
+++ b/messagingapp/msgsettings/settingsview/src/msgsettingsview.cpp Tue Jul 13 22:09:22 2010 +0530
@@ -101,11 +101,18 @@
//remove the view
mMainWindow->removeView(mSMSCenterView);
- //refresh the form
- mSettingsForm->refreshViewForm();
-
- //add the current view on top
- mMainWindow->setCurrentView(this);
+ // This check is needed in case when smsc center view is
+ // launched directly
+ if(mMainWindow->views().count() > 0)
+ {
+ QCRITICAL_WRITE("MsgViewManager::onSmsCenterEditViewClosed count>0");
+
+ //refresh the form
+ mSettingsForm->refreshViewForm();
+
+ //add the current view on top
+ mMainWindow->setCurrentView(this);
+ }
}
//eof
diff -r 25fe1fe642e3 -r b1f0785c289d messagingapp/msgsettings/settingsview/src/smssettingsprivate.cpp
--- a/messagingapp/msgsettings/settingsview/src/smssettingsprivate.cpp Fri Jul 09 14:46:10 2010 +0530
+++ b/messagingapp/msgsettings/settingsview/src/smssettingsprivate.cpp Tue Jul 13 22:09:22 2010 +0530
@@ -170,9 +170,7 @@
{
flag = true;
}
-
- //remove the service center
- //smsSettings->RemoveServiceCenter(index);
+
//add a new service center
smsSettings->AddServiceCenterL(name->Des(), address->Des());
@@ -182,15 +180,10 @@
smsSettings->ServiceCenterCount()- 1);
}
- smsAccount->SaveSettingsL(*smsSettings);
-
- smsAccount->LoadSettingsL(*smsSettings);
- if (flag == true)
- {
- smsSettings->RemoveServiceCenter(index);
- }
+ //remove the service center
+ smsSettings->RemoveServiceCenter(index);
- smsAccount->SaveSettingsL(*smsSettings);
+ smsAccount->SaveSettingsL(*smsSettings);
CleanupStack::PopAndDestroy(2);
}
diff -r 25fe1fe642e3 -r b1f0785c289d messagingapp/msgui/appengine/src/conversationsmodel.cpp
--- a/messagingapp/msgui/appengine/src/conversationsmodel.cpp Fri Jul 09 14:46:10 2010 +0530
+++ b/messagingapp/msgui/appengine/src/conversationsmodel.cpp Tue Jul 13 22:09:22 2010 +0530
@@ -555,7 +555,14 @@
{
QFile file(objectList[index]->path());
file.open(QIODevice::ReadOnly);
- textContent = file.readAll();
+ QByteArray textArray;
+ textArray = file.readAll();
+ char *data = new char[textArray.size()+1];
+ strcpy(data,textArray.data());
+ //This is needed since MMS text content
+ //is stored in UTF8 format
+ textContent = textContent.fromUtf8(data,strlen(data));
+ delete []data;
item.setData(textContent, BodyText);
isBodyTextSet = true;
file.close();
diff -r 25fe1fe642e3 -r b1f0785c289d messagingapp/msgui/conversationview/inc/msgconversationview.h
--- a/messagingapp/msgui/conversationview/inc/msgconversationview.h Fri Jul 09 14:46:10 2010 +0530
+++ b/messagingapp/msgui/conversationview/inc/msgconversationview.h Tue Jul 13 22:09:22 2010 +0530
@@ -330,6 +330,13 @@
*/
void saveVCard();
+ /**
+ * Tells is mms is shared among conversations.
+ * @param messageId, message id.
+ * @return true is shared among conversations.
+ */
+ bool isSharedMessage(qint32 messageId);
+
signals:
/**
* Signal emitted to inform close the conversation view.
diff -r 25fe1fe642e3 -r b1f0785c289d messagingapp/msgui/conversationview/src/msgconversationview.cpp
--- a/messagingapp/msgui/conversationview/src/msgconversationview.cpp Fri Jul 09 14:46:10 2010 +0530
+++ b/messagingapp/msgui/conversationview/src/msgconversationview.cpp Tue Jul 13 22:09:22 2010 +0530
@@ -58,6 +58,8 @@
#include "mmsconformancecheck.h"
#include "msgsettingsview.h"
#include "msgaudiofetcherview.h"
+#include "unieditorpluginloader.h"
+#include "unieditorplugininterface.h"
//Item specific menu.
@@ -69,6 +71,7 @@
#define LOC_COMMON_SAVE hbTrId("txt_common_menu_save")
#define LOC_DELETE_MESSAGE hbTrId("txt_messaging_dialog_delete_message")
+#define LOC_DELETE_SHARED_MESSAGE hbTrId("txt_messaging_dialog_same_message_exists_in_multip")
#define LOC_SAVE_TO_CONTACTS hbTrId("txt_messaging_menu_save_to_contacts")
//main menu
@@ -362,7 +365,7 @@
if( ((direction == ConvergedMessage::Outgoing) &&
(messageSubType != ConvergedMessage::VCard))&&
((sendingState == ConvergedMessage::Resend ) ||
- (sendingState == ConvergedMessage::Suspended )||
+
(sendingState == ConvergedMessage::Failed )))
{
HbAction *contextItem = contextMenu->addAction(LOC_COMMON_SEND);
@@ -400,6 +403,7 @@
if( ((sendingState == ConvergedMessage::SentState) ||
(sendingState == ConvergedMessage::Resend) ||
(sendingState == ConvergedMessage::Failed) ||
+ (sendingState == ConvergedMessage::Suspended )||
(direction == ConvergedMessage::Incoming) ) &&
canForwardMessage)
{
@@ -731,8 +735,29 @@
// Deletes the message
//---------------------------------------------------------------
void MsgConversationView::deleteItem()
+{
+ QString str = LOC_DELETE_MESSAGE;
+
+ QModelIndex index = mConversationList->currentIndex();
+ if(index.isValid())
{
- HbMessageBox::question(LOC_DELETE_MESSAGE,this,SLOT(onDialogdeleteMsg(HbAction*)),
+ int messageType = index.data(MessageType).toInt();
+ int direction = index.data(Direction).toInt();
+
+ if ( direction == ConvergedMessage::Outgoing &&
+ messageType == ConvergedMessage::Mms )
+ {
+ qint32 messageId = index.data(ConvergedMsgId).toLongLong();
+
+ if(isSharedMessage(messageId))
+ {
+ str = LOC_DELETE_SHARED_MESSAGE;
+ }
+ }
+ }
+
+
+ HbMessageBox::question(str,this,SLOT(onDialogdeleteMsg(HbAction*)),
HbMessageBox::Delete | HbMessageBox::Cancel);
}
@@ -954,6 +979,15 @@
int location = index.data(MessageLocation).toInt();
int sendingState = index.data(SendingState).toInt();
+ // For suspended message both short tap and long tap needs to show the same
+ // context menu.....
+ if(direction == ConvergedMessage::Outgoing
+ &&sendingState == ConvergedMessage::Suspended )
+ {
+ handleShortTap();
+ return;
+ }
+
//If message is in any other state other than 'Sent'
//do not open the message
if(direction == ConvergedMessage::Outgoing
@@ -1446,4 +1480,39 @@
}
}
}
+
+//---------------------------------------------------------------
+// MsgConversationView::isSharedMessage
+// @see header file
+//---------------------------------------------------------------
+bool MsgConversationView::isSharedMessage(qint32 messageId)
+{
+ bool shared = false;
+
+ UniEditorPluginLoader* pluginLoader = new UniEditorPluginLoader();
+
+ UniEditorPluginInterface* pluginInterface =
+ pluginLoader->getUniEditorPlugin(ConvergedMessage::Mms);
+
+ ConvergedMessage* msg = pluginInterface->convertFrom(messageId);
+ if(msg)
+ {
+ int count = 0;
+ count += msg->toAddressList().count();
+ count += msg->ccAddressList().count();
+ count += msg->bccAddressList().count();
+
+ if(count > 1)
+ {
+ shared = true;
+ }
+
+ delete msg;
+ }
+
+ delete pluginLoader;
+
+ return shared;
+}
+
// EOF
diff -r 25fe1fe642e3 -r b1f0785c289d messagingapp/msgui/msgapp/inc/msgviewmanager.h
--- a/messagingapp/msgui/msgapp/inc/msgviewmanager.h Fri Jul 09 14:46:10 2010 +0530
+++ b/messagingapp/msgui/msgapp/inc/msgviewmanager.h Tue Jul 13 22:09:22 2010 +0530
@@ -261,6 +261,7 @@
int mMessageId;
QVariantList mEditorData;
+ QVariantList mViewerData;
};
#endif /* MSGVIEWMANAGER_H_ */
diff -r 25fe1fe642e3 -r b1f0785c289d messagingapp/msgui/msgapp/src/main.cpp
--- a/messagingapp/msgui/msgapp/src/main.cpp Fri Jul 09 14:46:10 2010 +0530
+++ b/messagingapp/msgui/msgapp/src/main.cpp Tue Jul 13 22:09:22 2010 +0530
@@ -110,7 +110,7 @@
app.setApplicationName(LOC_TITLE);
- #ifdef _DEBUG_TRACES_
+#ifdef _DEBUG_TRACES_
//Debug Logs
QFile ofile;
if (ofile.exists(debugFileName))
diff -r 25fe1fe642e3 -r b1f0785c289d messagingapp/msgui/msgapp/src/msgviewmanager.cpp
--- a/messagingapp/msgui/msgapp/src/msgviewmanager.cpp Fri Jul 09 14:46:10 2010 +0530
+++ b/messagingapp/msgui/msgapp/src/msgviewmanager.cpp Tue Jul 13 22:09:22 2010 +0530
@@ -179,10 +179,31 @@
completeServiceRequest();
}
else {
- //switch to clv.
+ //switch to previous view.
QVariantList param;
- param << MsgBaseView::CLV;
+ param << mPreviousView;
param << MsgBaseView::UNIEDITOR;
+
+ if(mPreviousView == MsgBaseView::CV) {
+ param << mConversationId;
+ }
+ else if(mPreviousView == MsgBaseView::UNIVIEWER){
+ qint32 contactId = mViewerData.at(0).toLongLong();
+ qint32 messageId = mViewerData.at(1).toInt();
+ int msgCount = mViewerData.at(2).toInt();
+ int canForwardMessage = mViewerData.at(3).toInt();
+
+ param << contactId;
+ param << messageId;
+ param << msgCount;
+ param << canForwardMessage;
+ }
+ else if(mPreviousView == MsgBaseView::UNIEDITOR){
+ //TODO: Remove error handling once Audio fetcher
+ //becomes dialog
+ param[0] = MsgBaseView::CLV;
+ }
+
switchView(param);
}
@@ -256,16 +277,15 @@
}
case MsgBaseView::CLV:
{
- switchToClv(data);
- break;
- }
+ switchToClv(data);
+ break;
+ }
- case MsgBaseView::CV:
- {
-
- switchToCv(data);
- break;
- }
+ case MsgBaseView::CV:
+ {
+ switchToCv(data);
+ break;
+ }
case MsgBaseView::DLV:
{
@@ -545,6 +565,8 @@
void MsgViewManager::switchToCv(const QVariantList& data)
{
+ QCRITICAL_WRITE("MsgViewManager::switchToCv start.");
+
//switch to CV.
mCurrentView = MsgBaseView::CV;
mPreviousView = data.at(1).toInt();
@@ -634,10 +656,19 @@
mConversationView->openConversation(conversationId);
mMainWindow->setCurrentView(mConversationView);
+
+ QCRITICAL_WRITE("MsgViewManager::switchToCv end.");
}
void MsgViewManager::switchToDlv(const QVariantList& data)
{
+ //delete UniEditor
+ if (mUniEditor)
+ {
+ appendViewToBeDeleted(mUniEditor);
+ mUniEditor = NULL;
+ }
+
//switch to DLV.
mCurrentView = MsgBaseView::DLV;
mPreviousView = data.at(1).toInt();
@@ -655,6 +686,8 @@
void MsgViewManager::switchToUniEditor(const QVariantList& data)
{
+ QCRITICAL_WRITE("MsgViewManager::switchToUniEditor start.");
+
/**
* Editor is tried to open again before exiting the previously
* opened editor. Multi taping in DLV or Forward.
@@ -723,6 +756,8 @@
}
mMainWindow->setCurrentView(mUniEditor);
+
+ QCRITICAL_WRITE("MsgViewManager::switchToUniEditor end.");
}
void MsgViewManager::switchToUniViewer(const QVariantList& data)
@@ -735,6 +770,9 @@
return;
}
+ //Clear the old viewer data
+ mViewerData.clear();
+
mCurrentView = MsgBaseView::UNIVIEWER;
mPreviousView = data.at(1).toInt();
@@ -745,6 +783,12 @@
int msgCount = data.at(4).toInt();
int canForwardMessage = data.at(5).toInt();
+ //Save the viewer data to be used when u come back from Editor
+ mViewerData << contactId;
+ mViewerData << messageId;
+ mViewerData << msgCount;
+ mViewerData << canForwardMessage;
+
if (!mUniViewer) {
mUniViewer = new UnifiedViewer(messageId, canForwardMessage);
mUniViewer->setNavigationAction(mBackAction);
@@ -764,29 +808,45 @@
}
void MsgViewManager::switchToMsgSettings(const QVariantList& data)
{
- mCurrentView = MsgBaseView::MSGSETTINGS;
- mPreviousView = data.at(1).toInt();
-
- if (!mSettingsView) {
-
- MsgSettingsView::SettingsView view = MsgSettingsView::DefaultView;
- if (mPreviousView == MsgBaseView::UNIEDITOR || mPreviousView
- == MsgBaseView::CV)
- {
- view = (MsgSettingsView::SettingsView)data.at(2).toInt();
- }
+ int previousView = data.at(1).toInt();
+
+ MsgSettingsView::SettingsView view = MsgSettingsView::DefaultView;
+ if (previousView == MsgBaseView::UNIEDITOR || previousView
+ == MsgBaseView::CV)
+ {
+ view = (MsgSettingsView::SettingsView)data.at(2).toInt();
+ }
- mSettingsView = new MsgSettingsView(view);
- mSettingsView->setNavigationAction(mBackAction);
- mMainWindow->addView(mSettingsView);
-
- if(view != MsgSettingsView::SMSView)
+ //launch settings service
+ QList args;
+ QString serviceName("messagesettings");
+ QString interfaceName("com.nokia.symbian.IMessageSettings");
+ QString operation("launchSettings(int)");
+ XQAiwRequest* request;
+ XQApplicationManager appManager;
+ request = appManager.create(serviceName, interfaceName, operation, true); //embedded
+ if ( request == NULL )
{
- mMainWindow->setCurrentView(mSettingsView);
+ return;
+ }
+
+ args << view;
+
+ request->setArguments(args);
+
+ if(previousView==MsgBaseView::CV && mConversationView){
+ mConversationView->setPSCVId(false);
}
- }
- if(mPreviousView==MsgBaseView::CV && mConversationView){
- mConversationView->setPSCVId(false);
+
+ if(!request->send())
+ {
+ QDEBUG_WRITE("launchSettings failed")
+ }
+ delete request;
+
+
+ if(previousView==MsgBaseView::CV && mConversationView){
+ mConversationView->setPSCVId(true);
}
}
@@ -970,9 +1030,11 @@
// ----------------------------------------------------------------------------
void MsgViewManager::populateUniEditorAfterViewReady(const QVariantList& editorData)
{
+ QCRITICAL_WRITE("MsgViewManager::populateUniEditorAfterViewReady start.");
//Save the editor data and use it in ViewReady handler
mEditorData = editorData;
connect(mMainWindow, SIGNAL(viewReady()), this, SLOT(populateUniEditorView()));
+ QCRITICAL_WRITE("MsgViewManager::populateUniEditorAfterViewReady end.");
}
// ----------------------------------------------------------------------------
@@ -981,6 +1043,7 @@
// ----------------------------------------------------------------------------
void MsgViewManager::populateUniEditorView()
{
+ QCRITICAL_WRITE("MsgViewManager::populateUniEditorView start.");
if (mUniEditor)
{
mUniEditor->openDraftsMessage(mEditorData);
@@ -989,6 +1052,7 @@
disconnect(mMainWindow, SIGNAL(viewReady()), this,
SLOT(populateUniEditorView()));
+ QCRITICAL_WRITE("MsgViewManager::populateUniEditorView end.");
}
// ----------------------------------------------------------------------------
diff -r 25fe1fe642e3 -r b1f0785c289d messagingapp/msgui/msgaudiofetcher/src/msgaudiofetcherwidget.cpp
--- a/messagingapp/msgui/msgaudiofetcher/src/msgaudiofetcherwidget.cpp Fri Jul 09 14:46:10 2010 +0530
+++ b/messagingapp/msgui/msgaudiofetcher/src/msgaudiofetcherwidget.cpp Tue Jul 13 22:09:22 2010 +0530
@@ -33,7 +33,7 @@
MsgAudioFetcherWidget::MsgAudioFetcherWidget()
- : HbWidget(this),
+ : HbWidget(NULL),
mLabel(0),
mListView(0),
mLayout(0),
diff -r 25fe1fe642e3 -r b1f0785c289d messagingapp/msgui/unifiedviewer/src/univiewerbodywidget.cpp
--- a/messagingapp/msgui/unifiedviewer/src/univiewerbodywidget.cpp Fri Jul 09 14:46:10 2010 +0530
+++ b/messagingapp/msgui/unifiedviewer/src/univiewerbodywidget.cpp Tue Jul 13 22:09:22 2010 +0530
@@ -199,7 +199,16 @@
if (mimeType.contains(TEXT_MIMETYPE)) {
QFile file(info->path());
if (file.open(QIODevice::ReadOnly)) {
- QString textContent(file.readAll());
+ QString textContent;
+ QByteArray textArray;
+ textArray = file.readAll();
+ char *data = new char[textArray.size()+1];
+ strcpy(data,textArray.data());
+ //This is needed since MMS text content
+ //is stored in UTF8 format
+ textContent = textContent.fromUtf8(data,strlen(data));
+ file.close();
+ delete []data;
setText(textContent);
}
}
diff -r 25fe1fe642e3 -r b1f0785c289d messagingapp/msgui/unifiedviewer/src/univiewertextitem.cpp
--- a/messagingapp/msgui/unifiedviewer/src/univiewertextitem.cpp Fri Jul 09 14:46:10 2010 +0530
+++ b/messagingapp/msgui/unifiedviewer/src/univiewertextitem.cpp Tue Jul 13 22:09:22 2010 +0530
@@ -42,7 +42,7 @@
const QString EMAIL_PATTERN("[a-zA-Z0-9!#$%&'*+/=?^_`{|}~-]+(?:\\.[a-zA-Z0-9!#$%&'*+/=?^_`{|}~-]+)*@(?:[a-zA-Z0-9](?:[a-zA-Z0-9-]*[a-zA-Z0-9])?\\.)+[a-zA-Z0-9](?:[a-zA-Z0-9-]*[a-zA-Z0-9])?");
-const QString URL_PATTERN("(((ht|f|rt)(tp|sp)(s?)\\:\\/\\/)|(www|wap)(?:\\.))(([-\\w]*[0-9a-zA-Z])+(:(0-9)*)*(\\/?)([a-zA-Z0-9\\-\\?\\,\'\\/\\\\+&%\\$#_=~]*)(\\.)([-\\w]*[0-9a-zA-Z])+(:(0-9)*)*(\\/?)([a-zA-Z0-9\\-\\?\\,\'\\/\\\\+&%\\$#_=~]*))+[a-zA-Z0-9/]");
+const QString URL_PATTERN("(((ht|f|rt)(tp|sp)(s?)\\:\\/\\/)|(www|wap)(?:\\.))(([-\\w]*[0-9a-zA-Z])+(:(0-9)*)*(\\/?)([a-zA-Z0-9\\-\\?\'\\/\\\\+&%\\$#_=~]*)(\\.)([-\\w]*[0-9a-zA-Z])+(:(0-9)*)*(\\/?)([a-zA-Z0-9\\-\\?\'\\/\\\\+&%\\$#_=~]*))+[a-zA-Z0-9/]");
//rules
const QString URL_RULE("0_URL_RULE");
diff -r 25fe1fe642e3 -r b1f0785c289d messagingapp/msgutils/unieditorutils/unieditorplugins/unieditormmsplugin/inc/unieditormmsplugin_p.h
--- a/messagingapp/msgutils/unieditorutils/unieditorplugins/unieditormmsplugin/inc/unieditormmsplugin_p.h Fri Jul 09 14:46:10 2010 +0530
+++ b/messagingapp/msgutils/unieditorutils/unieditorplugins/unieditormmsplugin/inc/unieditormmsplugin_p.h Tue Jul 13 22:09:22 2010 +0530
@@ -225,6 +225,11 @@
* Populates converged message for replyAll case
*/
void convertFromReplyAllHandlerL(ConvergedMessage* aMessage);
+
+ /**
+ * Populates converged message for default case
+ */
+ void convertFromDefaultHandlerL(ConvergedMessage* aMessage);
private:
// Data
diff -r 25fe1fe642e3 -r b1f0785c289d messagingapp/msgutils/unieditorutils/unieditorplugins/unieditormmsplugin/src/unieditormmsplugin_p.cpp
--- a/messagingapp/msgutils/unieditorutils/unieditorplugins/unieditormmsplugin/src/unieditormmsplugin_p.cpp Fri Jul 09 14:46:10 2010 +0530
+++ b/messagingapp/msgutils/unieditorutils/unieditorplugins/unieditormmsplugin/src/unieditormmsplugin_p.cpp Tue Jul 13 22:09:22 2010 +0530
@@ -149,6 +149,10 @@
{
convertFromReplyAllHandlerL(msg);
}
+ else if(aOperation == UniEditorPluginInterface::Default)
+ {
+ convertFromDefaultHandlerL(msg);
+ }
CleanupStack::Pop(msg);
QDEBUG_WRITE("Exit convertFromL");
return msg;
@@ -285,11 +289,18 @@
if( slideContentList.at(i)->mimetype().contains("text") )
{
QString textContent;
+ QByteArray textArray;
QFile file(slideContentList.at(i)->path());
if (file.open(QIODevice::ReadOnly)) {
- textContent = file.readAll();
+ textArray = file.readAll();
+ char *data = new char[textArray.size()+1];
+ strcpy(data,textArray.data());
+ //This is needed since MMS text content
+ //is stored in UTF8 format
+ textContent = textContent.fromUtf8(data,strlen(data));
aMessage.setBodyText(textContent);
file.close();
+ delete []data;
}
else {
return;
@@ -1109,4 +1120,60 @@
aMessage->setSubject(subject);
}
+// -----------------------------------------------------------------------------
+// convertFromDefaultHandlerL
+// @see Header
+// -----------------------------------------------------------------------------
+void CUniEditorMmsPluginPrivate::convertFromDefaultHandlerL(ConvergedMessage* aMessage)
+{
+ QDEBUG_WRITE("Enter convertFromDefaultHandlerL");
+
+ TMsvEntry entry = MmsMtmL()->Entry().Entry();
+
+ if( entry.Parent() == KMsvGlobalInBoxIndexEntryIdValue )
+ {
+ // get sender address
+ HBufC* fromAddress = (MmsMtmL()->Sender()).AllocLC();
+ HBufC* pureAddr = TMmsGenUtils::PureAddress(*fromAddress).AllocLC();
+ HBufC* aliasAddr = TMmsGenUtils::Alias(*fromAddress).AllocLC();
+
+ if(pureAddr->Length() > 0)
+ {
+ ConvergedMessageAddress messageAddress(
+ XQConversions::s60DescToQString(*pureAddr),
+ XQConversions::s60DescToQString(*aliasAddr));
+ aMessage->addFromRecipient(messageAddress);
+ }
+ CleanupStack::PopAndDestroy(3, fromAddress );
+ }
+ else
+ {
+ populateRecipientsL(*aMessage);
+ }
+
+ //populate convergedmessage with the subject prepended with FW:
+ QString subject = XQConversions::s60DescToQString(MmsMtmL()->SubjectL());
+ aMessage->setSubject(subject);
+
+ // Priority
+ TMsvPriority priority = entry.Priority();
+ if( EMsvHighPriority == priority )
+ {
+ aMessage->setPriority(ConvergedMessage::High);
+ }
+ else if( EMsvLowPriority == priority )
+ {
+ aMessage->setPriority(ConvergedMessage::Low);
+ }
+ else if( EMsvMediumPriority == priority )
+ {
+ aMessage->setPriority(ConvergedMessage::Normal);
+ }
+
+ //Populate body and attachments
+ //The region info inside slides is not maintained
+ populateMessageBodyL(*aMessage);
+
+ QDEBUG_WRITE("Exit convertFromDefaultHandlerL");
+}
// End of File