videocollection/tsrc/stubs/src/hbinputdialog.cpp
changeset 24 7d93ee07fb27
parent 17 69946d1824c4
child 28 c48470be1ba7
equal deleted inserted replaced
20:b9e04db066d4 24:7d93ee07fb27
    14 * Description: stub hbinputdialog
    14 * Description: stub hbinputdialog
    15 * 
    15 * 
    16 */
    16 */
    17 
    17 
    18 #include "hbinputdialog.h"
    18 #include "hbinputdialog.h"
       
    19 #include "testobjectstore.h"
    19 
    20 
    20 bool HbInputDialog::mGetTextFails = false;
       
    21 QString HbInputDialog::mGetTextReturnValue = QString();
       
    22 int HbInputDialog::mGetTextCallCount = 0;
    21 int HbInputDialog::mGetTextCallCount = 0;
       
    22 int HbInputDialog::mAttribute = -1;
       
    23 QString HbInputDialog::mLastHeading = "";
       
    24 QString HbInputDialog::mLastText = "";
       
    25 QVariant HbInputDialog::mValueReturnValue = QVariant();
       
    26 int HbInputDialog::mValueCallCount = 0;
    23 
    27 
    24 
    28 HbInputDialog::HbInputDialog(QGraphicsItem *parent) : HbWidget(parent) 
    25 QString HbInputDialog::getText(const QString &label,const QString &text,
       
    26            bool *ok, QGraphicsScene *scene, QGraphicsItem *parent)
       
    27 {
    29 {
    28    Q_UNUSED(label);
    30     HbAction *action = new HbAction();
    29    Q_UNUSED(scene);
    31     mActions.append(action);
    30    Q_UNUSED(parent);
    32     action = new HbAction();
    31    mGetTextCallCount++;
    33     mActions.append(action);
    32    QString textReturn;
    34     
    33    if(HbInputDialog::mGetTextReturnValue.isNull())
    35     TestObjectStore::instance().addObject(this);
    34    {
       
    35        textReturn = text;
       
    36    }
       
    37    else
       
    38    {
       
    39        textReturn = mGetTextReturnValue;
       
    40    }
       
    41    if(mGetTextFails)
       
    42    {
       
    43        *ok = false;
       
    44        textReturn = "";
       
    45    }
       
    46    else
       
    47    {
       
    48        *ok = true;            
       
    49    }
       
    50    return textReturn;
       
    51 }
    36 }
    52 
    37 
       
    38 HbInputDialog::~HbInputDialog()
       
    39 {
       
    40     while(!mActions.isEmpty())
       
    41     {
       
    42         delete mActions.takeFirst();
       
    43     }
       
    44 }   
       
    45 
       
    46 void HbInputDialog::getText(const QString &heading
       
    47         ,QObject *receiver
       
    48         ,const char *member
       
    49         ,const QString &text
       
    50         ,QGraphicsScene *scene
       
    51         ,QGraphicsItem *parent)
       
    52 {
       
    53     Q_UNUSED(receiver);
       
    54     Q_UNUSED(member);
       
    55     Q_UNUSED(scene);
       
    56     Q_UNUSED(parent);
       
    57     
       
    58     mLastHeading = heading;
       
    59     mLastText = text;
       
    60     mGetTextCallCount++;
       
    61 }
       
    62 
       
    63 void HbInputDialog::emitDialogFinished( QObject* receiver, const char* member, int actionNum )
       
    64 {
       
    65     if(connect(this, SIGNAL(finished(HbAction *)), receiver, member))
       
    66     {
       
    67         emit finished(mActions.value(actionNum));
       
    68         disconnect(this, SIGNAL(finished(HbAction *)), receiver, member);
       
    69     }
       
    70 }
       
    71 
       
    72 void HbInputDialog::setAttribute(int attribute)
       
    73 {
       
    74     HbInputDialog::mAttribute = attribute;
       
    75 }
       
    76