videocollection/tsrc/stubs/src/hbmessagebox.cpp
changeset 38 ff53afa8ad05
parent 34 bbb98528c666
child 44 518105d52e45
equal deleted inserted replaced
37:4eb2df7f7cbe 38:ff53afa8ad05
    17 
    17 
    18 #include <qstring.h>
    18 #include <qstring.h>
    19 
    19 
    20 #include "hbmessagebox.h"
    20 #include "hbmessagebox.h"
    21 #include "hbmessageboxdata.h"
    21 #include "hbmessageboxdata.h"
       
    22 #include "testobjectstore.h"
    22 
    23 
    23 bool HbMessageBoxData::mQuestionReturnValue = false;
    24 bool HbMessageBoxData::mQuestionReturnValue = false;
    24 QString HbMessageBoxData::mLatestTxt = "";
    25 QString HbMessageBoxData::mLatestTxt = "";
    25 int HbMessageBoxData::mWarningCallCount = 0;
    26 int HbMessageBoxData::mWarningCallCount = 0;
    26 int HbMessageBoxData::mInformationCallCount = 0;
    27 int HbMessageBoxData::mInformationCallCount = 0;
       
    28 int HbMessageBoxData::mType = -1;
       
    29 int HbMessageBoxData::mAttribute = -1;
       
    30 int HbMessageBoxData::mOpenCallCount = 0;
       
    31 int HbMessageBoxData::mShowCallCount = 0;
    27 
    32 
    28 bool HbMessageBox::question(const QString &questionText,
    33 HbMessageBox::HbMessageBox(MessageBoxType type, QGraphicsItem *parent)
    29     const QString &primaryButtonText,
       
    30     const QString &secondaryButtonText,
       
    31     QGraphicsWidget *headWidget,
       
    32     QGraphicsScene *scene,
       
    33     QGraphicsItem *parent)
       
    34 {
    34 {
    35     Q_UNUSED(primaryButtonText);
       
    36     Q_UNUSED(secondaryButtonText);
       
    37     Q_UNUSED(headWidget);
       
    38     Q_UNUSED(scene);
       
    39     Q_UNUSED(parent);
    35     Q_UNUSED(parent);
       
    36     HbMessageBoxData::mType = type;
       
    37 
       
    38     HbAction *action = new HbAction();
       
    39     mActions.append(action);
       
    40     action = new HbAction();
       
    41     mActions.append(action);
    40     
    42     
    41     HbMessageBoxData::mLatestTxt = questionText;
    43     TestObjectStore::instance().addObject(this);
    42     return HbMessageBoxData::mQuestionReturnValue;
    44 }
       
    45         
       
    46 HbMessageBox::HbMessageBox(const QString &text, MessageBoxType type, QGraphicsItem *parent)
       
    47 {
       
    48     Q_UNUSED(parent);
       
    49     HbMessageBoxData::mLatestTxt = text;
       
    50     HbMessageBoxData::mType = type;
       
    51     
       
    52     HbAction *action = new HbAction();
       
    53     mActions.append(action);
       
    54     action = new HbAction();
       
    55     mActions.append(action);
       
    56     
       
    57     TestObjectStore::instance().addObject(this);
       
    58 }
       
    59 
       
    60 HbMessageBox::~HbMessageBox()
       
    61 {
       
    62     while(!mActions.isEmpty())
       
    63     {
       
    64         delete mActions.takeFirst();
       
    65     }
       
    66 }
       
    67 
       
    68 void HbMessageBox::show()
       
    69 {
       
    70     HbMessageBoxData::mShowCallCount++;
       
    71 }
       
    72 
       
    73 void HbMessageBox::open( QObject* receiver, const char* member )
       
    74 {
       
    75     Q_UNUSED(receiver);
       
    76     Q_UNUSED(member);
       
    77     HbMessageBoxData::mOpenCallCount++;
       
    78 }
       
    79 
       
    80 void HbMessageBox::emitDialogFinished( QObject* receiver, const char* member, int actionNum )
       
    81 {
       
    82     if(connect(this, SIGNAL(finished(HbAction *)), receiver, member))
       
    83     {
       
    84         emit finished(mActions.value(actionNum));
       
    85         disconnect(this, SIGNAL(finished(HbAction *)), receiver, member);
       
    86     }
    43 }
    87 }
    44 
    88 
    45 void HbMessageBox::information(const QString &informationText,
    89 void HbMessageBox::information(const QString &informationText,
    46     QGraphicsWidget *headWidget,
    90     QGraphicsWidget *headWidget,
    47     QGraphicsScene *scene,
    91     QGraphicsScene *scene,
    66 
   110 
    67     HbMessageBoxData::mLatestTxt = warningText;
   111     HbMessageBoxData::mLatestTxt = warningText;
    68     HbMessageBoxData::mWarningCallCount++;
   112     HbMessageBoxData::mWarningCallCount++;
    69 }
   113 }
    70 
   114 
       
   115 void HbMessageBox::setAttribute(int attribute)
       
   116 {
       
   117     HbMessageBoxData::mAttribute = attribute;
       
   118 }
       
   119 
    71 // end of file
   120 // end of file