qthighway/examples/serviceapp/src/serviceapp.h
changeset 4 90517678cc4f
parent 1 2b40d63a9c3d
child 19 46686fb6258c
--- a/qthighway/examples/serviceapp/src/serviceapp.h	Fri Apr 16 15:51:22 2010 +0300
+++ b/qthighway/examples/serviceapp/src/serviceapp.h	Mon May 03 13:18:40 2010 +0300
@@ -28,6 +28,7 @@
 #include <QStringList>
 #include <xqserviceprovider.h>
 #include <xqsharablefile.h>
+#include <cntservicescontact.h>
 
 class QLineEdit;
 class QPushButton;
@@ -36,6 +37,9 @@
 class QLabel;
 class FileService;
 class XQSharableFile;
+class NewDialerService;
+class NewUriService;
+class NewFileService;
 
 class ServiceApp : public QWidget
 {
@@ -51,16 +55,20 @@
     
 public slots:
     void quit();
-    void answer();
-    void handleAnswerDelivered();
+    void answerDial();
+    void answerUri();
+    void answerFile();
     
 private:
     QLabel *mLabel;
     QLineEdit *mNumber;
     //QPushButton *mEndCallButton;
-    DialerService* mService;
+    DialerService* mDialService;
     UriService* mUriService;
     FileService* mFileService;
+    NewDialerService* mNewDialService;
+    NewUriService* mNewUriService;
+    NewFileService* mNewFileService;
 };
 
 class DialerService : public XQServiceProvider
@@ -71,27 +79,66 @@
     ~DialerService();
     
     void complete(QString number);
-    bool asyncAnswer() {return mAsyncAnswer;}
+    bool asyncAnswer() {return mAsyncReqIds.count() > 0;}
+    
 public slots:
     int dial(const QString& number, bool asyncAnswer);
+    QVariant testVariant(QVariant variant);
+    CntServicesContactList testContactList(CntServicesContactList list);
 
-private slots:
+protected slots:
    void handleClientDisconnect();
+   void handleAnswerDelivered();
 
-private:
+protected:
+    void showRecipients(QVariant &value);
+    void showRecipients(CntServicesContactList &value);
+
+protected:
     ServiceApp* mServiceApp;
     QString mNumber;
-    bool mAsyncAnswer;
-    int mAsyncReqId;
+    QMap<quint32,int> mAsyncReqIds;
 };
 
+
+class NewDialerService : public XQServiceProvider
+{
+    Q_OBJECT
+    public:
+        NewDialerService( ServiceApp *parent = 0 );
+        ~NewDialerService();
+
+        void complete(QString number);
+        bool asyncAnswer() {return mAsyncReqIds.count() > 0;}
+
+    public slots:
+            int dial(const QString& number, bool asyncAnswer);
+    QVariant testVariant(QVariant variant);
+    CntServicesContactList testContactList(CntServicesContactList list);
+
+    protected slots:
+            void handleClientDisconnect();
+    void handleAnswerDelivered();
+
+    protected:
+        void showRecipients(QVariant &value);
+        void showRecipients(CntServicesContactList &value);
+
+    protected:
+        ServiceApp* mServiceApp;
+        QString mNumber;
+        QMap<quint32,int> mAsyncReqIds;
+};
+
+
+
 class UriService : public XQServiceProvider
 {
     Q_OBJECT
     public:
         UriService( ServiceApp *parent = 0 );
         ~UriService();
-        bool asyncAnswer() {return mAsyncAnswer;}
+        bool asyncAnswer() {return mAsyncReqIds.count() > 0;}
         void complete(bool ok);
         
     public slots:
@@ -100,21 +147,70 @@
         
     private slots:
         void handleClientDisconnect();
+        void handleAnswerDelivered();
 
     private:
         ServiceApp* mServiceApp;
-        bool mAsyncAnswer;
-        int mAsyncReqId;
+        QMap<quint32,int> mAsyncReqIds;
         bool mRetValue;
 };
 
+
+class NewUriService : public XQServiceProvider
+{
+    Q_OBJECT
+    public:
+        NewUriService( ServiceApp *parent = 0 );
+        ~NewUriService();
+        bool asyncAnswer() {return mAsyncReqIds.count() > 0;}
+        void complete(bool ok);
+
+    public slots:
+            bool view(const QString& uri);
+    bool view(const QString& uri, bool returnValue);
+
+    private slots:
+            void handleClientDisconnect();
+    void handleAnswerDelivered();
+
+    private:
+        ServiceApp* mServiceApp;
+        QMap<quint32,int> mAsyncReqIds;
+        bool mRetValue;
+};
+
+
 class FileService : public XQServiceProvider
 {
     Q_OBJECT
     public:
         FileService( ServiceApp *parent = 0 );
         ~FileService();
-        bool asyncAnswer() {return mAsyncAnswer;}
+        bool asyncAnswer() {return mAsyncReqIds.count() > 0;}
+        void complete(bool ok);
+
+    public slots:
+            bool view(QString file);
+    bool view(XQSharableFile file);
+
+    private slots:
+            void handleClientDisconnect();
+    void handleAnswerDelivered();
+
+    private:
+        ServiceApp* mServiceApp;
+        QMap<quint32,int> mAsyncReqIds;
+        bool mRetValue;
+};
+
+
+class NewFileService : public XQServiceProvider
+{
+    Q_OBJECT
+    public:
+        NewFileService( ServiceApp *parent = 0 );
+        ~NewFileService();
+        bool asyncAnswer() {return mAsyncReqIds.count() > 0;}
         void complete(bool ok);
 
     public slots:
@@ -123,13 +219,15 @@
         
     private slots:
         void handleClientDisconnect();
+        void handleAnswerDelivered();
 
     private:
         ServiceApp* mServiceApp;
-        bool mAsyncAnswer;
-        int mAsyncReqId;
+        QMap<quint32,int> mAsyncReqIds;
         bool mRetValue;
 };
 
 
+
+
 #endif