videocollection/videocollectionview/tsrc/testvideolistselectiondialog/inc/videolistselectiondialogtester.h
changeset 62 0e1e938beb1a
parent 46 adbe7d5ba2f5
child 66 adb51f74b890
equal deleted inserted replaced
59:a76e86df7ccd 62:0e1e938beb1a
    41     void finishedSignal(HbAction*);
    41     void finishedSignal(HbAction*);
    42     
    42     
    43 public:
    43 public:
    44     
    44     
    45     VideoListSelectionDialogTesterHelper(VideoListSelectionDialog *testable = 0) 
    45     VideoListSelectionDialogTesterHelper(VideoListSelectionDialog *testable = 0) 
    46     : mTestable(testable) {};
    46     : mTestable(testable), mSignalsConnected(false) {};
    47     
    47     
    48     ~VideoListSelectionDialogTesterHelper() {};
    48     ~VideoListSelectionDialogTesterHelper() {};
    49     
    49     
    50     bool connectSignals()
    50     bool connectSignals()
    51     {
    51     {
    52         if(!mTestable)
    52         if(!mTestable || mSignalsConnected)
    53         {
    53         {
    54             return false;
    54             return false;
    55         }
    55         }
    56         // disconnect first to make sure there signals are not connected twice
    56         mSignalsConnected = true;
    57         disconnectSignals();
    57 
    58         if(!connect(this, SIGNAL(markAllSignal(int)), mTestable, SLOT(markAllStateChangedSlot(int))))
    58         if(!connect(this, SIGNAL(markAllSignal(int)), mTestable, SLOT(markAllStateChangedSlot(int))))
    59         {
    59         {
    60             return false;
    60             return false;
    61         }
    61         }
    62         if(!connect(this, SIGNAL(selectionChangedSignal(const QItemSelection&, const QItemSelection&)), 
    62         if(!connect(this, SIGNAL(selectionChangedSignal(const QItemSelection&, const QItemSelection&)), 
    89         return true;
    89         return true;
    90     }
    90     }
    91     
    91     
    92     void disconnectSignals()
    92     void disconnectSignals()
    93     {
    93     {
    94         if(mTestable)
    94         if(mTestable && mSignalsConnected)
    95         {
    95         {
       
    96             mSignalsConnected = false;
    96             disconnect(this, SIGNAL(markAllSignal(int)), mTestable, SLOT(markAllStateChangedSlot(int)));
    97             disconnect(this, SIGNAL(markAllSignal(int)), mTestable, SLOT(markAllStateChangedSlot(int)));
    97             disconnect(this, SIGNAL(selectionChangedSignal(const QItemSelection&, const QItemSelection&)), 
    98             disconnect(this, SIGNAL(selectionChangedSignal(const QItemSelection&, const QItemSelection&)), 
    98                             mTestable, SLOT(selectionChangedSlot(const QItemSelection&, const QItemSelection&)));
    99                             mTestable, SLOT(selectionChangedSlot(const QItemSelection&, const QItemSelection&)));
    99             disconnect(this, SIGNAL(singleItemSelectedSignal(const QModelIndex&)), 
   100             disconnect(this, SIGNAL(singleItemSelectedSignal(const QModelIndex&)), 
   100                             mTestable, SLOT(singleItemSelectedSlot(const QModelIndex&)));
   101                             mTestable, SLOT(singleItemSelectedSlot(const QModelIndex&)));
   140     {
   141     {
   141         emit finishedSignal(action);
   142         emit finishedSignal(action);
   142     }
   143     }
   143     
   144     
   144     VideoListSelectionDialog *mTestable;
   145     VideoListSelectionDialog *mTestable;
       
   146     
       
   147     /**
       
   148      * flag indicating if signals are connected. 
       
   149      */
       
   150     bool mSignalsConnected;    
   145 };
   151 };
   146 
   152 
   147 #endif
   153 #endif