videocollection/tsrc/stubs/src/hbinputdialog.cpp
changeset 24 7d93ee07fb27
parent 17 69946d1824c4
child 28 c48470be1ba7
--- a/videocollection/tsrc/stubs/src/hbinputdialog.cpp	Fri May 14 15:53:50 2010 +0300
+++ b/videocollection/tsrc/stubs/src/hbinputdialog.cpp	Thu May 27 12:53:14 2010 +0300
@@ -16,37 +16,61 @@
 */
 
 #include "hbinputdialog.h"
+#include "testobjectstore.h"
 
-bool HbInputDialog::mGetTextFails = false;
-QString HbInputDialog::mGetTextReturnValue = QString();
 int HbInputDialog::mGetTextCallCount = 0;
-
+int HbInputDialog::mAttribute = -1;
+QString HbInputDialog::mLastHeading = "";
+QString HbInputDialog::mLastText = "";
+QVariant HbInputDialog::mValueReturnValue = QVariant();
+int HbInputDialog::mValueCallCount = 0;
 
-QString HbInputDialog::getText(const QString &label,const QString &text,
-           bool *ok, QGraphicsScene *scene, QGraphicsItem *parent)
+HbInputDialog::HbInputDialog(QGraphicsItem *parent) : HbWidget(parent) 
 {
-   Q_UNUSED(label);
-   Q_UNUSED(scene);
-   Q_UNUSED(parent);
-   mGetTextCallCount++;
-   QString textReturn;
-   if(HbInputDialog::mGetTextReturnValue.isNull())
-   {
-       textReturn = text;
-   }
-   else
-   {
-       textReturn = mGetTextReturnValue;
-   }
-   if(mGetTextFails)
-   {
-       *ok = false;
-       textReturn = "";
-   }
-   else
-   {
-       *ok = true;            
-   }
-   return textReturn;
+    HbAction *action = new HbAction();
+    mActions.append(action);
+    action = new HbAction();
+    mActions.append(action);
+    
+    TestObjectStore::instance().addObject(this);
 }
 
+HbInputDialog::~HbInputDialog()
+{
+    while(!mActions.isEmpty())
+    {
+        delete mActions.takeFirst();
+    }
+}   
+
+void HbInputDialog::getText(const QString &heading
+        ,QObject *receiver
+        ,const char *member
+        ,const QString &text
+        ,QGraphicsScene *scene
+        ,QGraphicsItem *parent)
+{
+    Q_UNUSED(receiver);
+    Q_UNUSED(member);
+    Q_UNUSED(scene);
+    Q_UNUSED(parent);
+    
+    mLastHeading = heading;
+    mLastText = text;
+    mGetTextCallCount++;
+}
+
+void HbInputDialog::emitDialogFinished( QObject* receiver, const char* member, int actionNum )
+{
+    if(connect(this, SIGNAL(finished(HbAction *)), receiver, member))
+    {
+        emit finished(mActions.value(actionNum));
+        disconnect(this, SIGNAL(finished(HbAction *)), receiver, member);
+    }
+}
+
+void HbInputDialog::setAttribute(int attribute)
+{
+    HbInputDialog::mAttribute = attribute;
+}
+