--- a/iaupdate/IAD/api/client/inc/iaupdateclient.h Thu Aug 19 10:02:49 2010 +0300
+++ b/iaupdate/IAD/api/client/inc/iaupdateclient.h Tue Aug 31 15:21:33 2010 +0300
@@ -20,195 +20,93 @@
#ifndef IA_UPDATE_CLIENT_H
#define IA_UPDATE_CLIENT_H
-#include <AknServerApp.h>
+
#include <e32std.h>
#include <e32cmn.h>
+#include <iaupdateobserver.h>
+#include <QObject>
class CIAUpdateParameters;
-
-/**
- * RIAUpdateClient object provides methods to delegate update actions
- * to the server side. Updating will be targeted to the update items that
- * qualify the requirements of CIAUpdateParameters objects. In asynchronous
- * actions, observers will be informed about the completion of update action.
- *
- * Because this object is R-class, it does not provide constructor or destructor.
- * Usage:
- * - First, call Open-function.
- * - Second, use update functions to start update.
- * - Finally, user has to call Close-function to terminate object.
- * Otherwise, memory leaks may occur.
- *
- * @see CIAUpdateParameters
- * @see CIAUpdate
- *
- * @since S60 v3.2
- */
-NONSHARABLE_CLASS( RIAUpdateClient ) : public RAknAppServiceBase
- {
-
-public:
-
- /**
- * Constructor.
- */
-
- RIAUpdateClient();
-
- /**
- * This function will open the update action.
- *
- * @note This has to be called before calling operation functions.
- *
- * @return System wide error code.
- *
- * @since S60 v3.2
- */
- TInt Open();
-
- /**
- * Close releases the resources allocated by this class object.
- * After Close is called, this R-class object may go out of scope.
- *
- * @note If Close is called before asynchronous operation has finished,
- * the operation will continue but callback functions of the observer
- * will not be called when operation progresses.
- *
- * @since S60 v3.2
- */
- TInt OpenToBackroundAsync( TRequestStatus& aStatus );
-
- TInt ConnectToApp();
-
- void Close();
+class MIAUpdateObserver;
+class XQServiceRequest;
- /**
- * @see CIAUpdate::CheckUpdates
- *
- * @note The client server connection has to be opened by calling
- * Open function before this function can be called.
- *
- * @param aAvailableUpdates Number of the updates that were found available.
- * @param aStatus The status will be updated when the operation
- * has been completed.
- * @return Informs if the initialization of server request failed.
- * System wide error code.
- *
- * @since S60 v3.2
- */
- TInt CheckUpdates( const CIAUpdateParameters& aUpdateParameters,
- TInt& aAvailableUpdates,
- TRequestStatus& aStatus );
+class IAUpdateClient : public QObject
+//NONSHARABLE_CLASS( IAUpdateClient ) : public QObject
+ {
+ Q_OBJECT
+public:
+ enum RequestType
+ {
+ /**
+ * No operation is going on.
+ */
+ NoOperation,
+
+ /**
+ * Update check has been requested.
+ */
+ CheckUpdates,
+
+ /**
+ * Show Update operation has been requested.
+ */
+ ShowUpdates,
+
+ /**
+ * Update query has been requested.
+ */
+ UpdateQuery,
+ /**
+ * Bring to foreground has been requested.
+ */
+ BroughtToForeground
+ };
+
+ IAUpdateClient(MIAUpdateObserver& aObserver);
+
+
+ ~IAUpdateClient();
+
+ int initRequest(const CIAUpdateParameters* updateParameters, const QString& message, bool toBackground);
+
+ void checkUpdates(const CIAUpdateParameters& updateParameters);
+
+ void showUpdates(const CIAUpdateParameters& updateParameters);
+
+ void updateQuery();
+
+ void update();
- /**
- * @see CIAUpdate::ShowUpdates
- *
- * @note The client server connection has to be opened by calling
- * Open function before this function can be called.
- *
- * @param aNumberOfSuccessfullUpdates Number of the successfull updates
- * that were done during the update.
- * @param aNumberOfFailedUpdates Number of the failed updates
- * that were done during the update.
- * @param aNumberOfCancelledUpdates Number of the cancelled updates
- * during the update.
- * @param aStatus The status will be updated when the operation
- * has been completed.
- * @return Informs if the initialization of server request failed.
- * System wide error code.
- *
- * @since S60 v3.2
- */
- TInt ShowUpdates( const CIAUpdateParameters& aUpdateParameters,
- TInt& aNumberOfSuccessfullUpdates,
- TInt& aNumberOfFailedUpdates,
- TInt& aNumberOfCancelledUpdates,
- TRequestStatus& aStatus );
-
+ void broughtToForeground();
+
+protected slots:
-
-
- /**
- * @see CIAUpdate::Update
- *
- * @note The client server connection has to be opened by calling
- * Open function before this function can be called.
- *
- * @param aUpdateNow Value depending on a user's choice
- * @param aStatus The status will be updated when the operation
- * has been completed.
- * @return Informs if the initialization of server request failed.
- * System wide error code.
- *
- * @since S60 v3.2
- */
- TInt UpdateQuery( TBool& aUpdateNow, TRequestStatus& aStatus );
-
-
- void BroughtToForeground();
+ void requestCompleted(const QVariant& value);
-
- /**
- * Cancels the ongoing asynchronous operation.
- * The active object that has started the update operation
- * will be informed when the requested update operation
- * has been cancelled.
- *
- * @since S60 v3.2
- */
- void CancelAsyncRequest();
-
-
-public: // RAknAppServiceBase
-
- /**
- * @see RAknAppServiceBase::ServiceUid
- *
- * @since S60 v3.2
- */
- TUid ServiceUid() const;
+ void requestError(int err);
private:
-
- // These functions send the operation requests to the server.
-
- TInt SendCheckUpdatesRequest( TInt aUpdateFunction,
- const CIAUpdateParameters& aUpdateParameters,
- TInt& aCount,
- TRequestStatus& aStatus );
+
+ QString qStringFromTDesC16( const TDesC16& aDes16 );
+
+ QString qStringFromTDesC8( const TDesC8& aDes8 );
+
+ QString qStringFromTDesC( const TDesC& aDes );
- TInt SendUpdateRequest( TInt aUpdateFunction,
- const CIAUpdateParameters& aUpdateParameters,
- TInt& aNumberOfSuccessfullUpdates,
- TInt& aNumberOfFailedUdpdates,
- TInt& aNumberOfCancelledUpdates,
- TRequestStatus& aStatus );
-
- void ConnectNewAppToBackgroundL( TUid aAppUid );
-
- void StartNewAppToBackgroundL( TUid aAppUid, TRequestStatus& aStatus );
-
- void ServerName(TName& aServerName, TUid aAppServerUid, TUint aServerDifferentiator);
-
- TUint GenerateServerDifferentiatorAndName(TName& aServerName, TUid aAppServerUid);
-
private: //data
-
- HBufC8* iData;
- TBool iConnected;
+ XQServiceRequest* mServiceRequest;
- TInt iOwnWgId;
-
- TUint iDifferentiator;
+ // Informs what kind of operation is going on.
+ RequestType mCurrentRequestType;
- TPtr8 iPtr1;
- TPtr8 iPtr2;
- TPtr8 iPtr3;
+ // Observer who will be informed about the completion of the operations.
+ MIAUpdateObserver& mObserver;
+
};
#endif // IA_UPDATE_CLIENT_H