creator/src/notifications.cpp
changeset 24 6053b7ae82ab
parent 17 4f2773374eff
child 25 31fc1277642e
--- a/creator/src/notifications.cpp	Fri May 14 15:53:02 2010 +0300
+++ b/creator/src/notifications.cpp	Thu May 13 20:59:38 2010 +0300
@@ -31,48 +31,38 @@
 
 #include "notifications.h"
 
-// ---------------------------------------------------------------------------
 
-void Notifications::showMessageBox(HbMessageBox::MessageBoxType type, const QString &text, const QString &label, int timeout )
-{
-    HbMessageBox *messageBox = new HbMessageBox(type);
-    messageBox->setText(text);
-    if(label.length())
-        {
-        HbLabel *header = new HbLabel(label, messageBox);
-        messageBox->setHeadingWidget(header);
-        }
-    messageBox->setAttribute(Qt::WA_DeleteOnClose);
-    messageBox->setTimeout(timeout);
-    messageBox->open();
-}
 
 // ---------------------------------------------------------------------------
 
 void Notifications::about()
 {
-    showMessageBox(HbMessageBox::MessageTypeInformation,
-        "Version 6.0.0 - April 23rd 2010. Copyright © 2010 Nokia Corporation and/or its subsidiary(-ies). All rights reserved. Licensed under Eclipse Public License v1.0.",
-        "About Creator", 
-        HbPopup::NoTimeout
-        );
+    HbMessageBox *messageBox = new HbMessageBox(HbMessageBox::MessageTypeInformation);
+        messageBox->setText("Version 6.0.0 - April 23rd 2010. Copyright © 2010 Nokia Corporation and/or its subsidiary(-ies). All rights reserved. Licensed under Eclipse Public License v1.0.");
+        HbLabel *header = new HbLabel("About Creator", messageBox);
+        messageBox->setHeadingWidget(header);
+        messageBox->setAttribute(Qt::WA_DeleteOnClose);
+        messageBox->setTimeout(HbPopup::NoTimeout);
+        messageBox->open();
 }
 
 // ---------------------------------------------------------------------------
 
 void Notifications::error(const QString& errorMessage)
 {
-    showMessageBox(HbMessageBox::MessageTypeWarning, errorMessage, QString("Error"), 3000);
+    HbMessageBox::warning(errorMessage, new HbLabel("Error"));
 }
 
 
 // ---------------------------------------------------------------------------
 
+
 HbProgressDialog* Notifications::showProgressBar(const QString& text, int max)
 {
 	HbProgressDialog *note = new HbProgressDialog(HbProgressDialog::ProgressDialog);
     note->setText(text);
     note->setMaximum(max);
+
     note->show();
     return note;
 
@@ -80,9 +70,12 @@
 
 // ---------------------------------------------------------------------------
 
-void Notifications::showGlobalNote(const QString& text, HbMessageBox::MessageBoxType type, HbPopup::DefaultTimeout timeout)
+void Notifications::showGlobalNote(const QString& text, HbMessageBox::MessageBoxType type, HbPopup::DefaultTimeout /*timeout*/)
 {
-    showMessageBox(type, text, QString("Creator"), timeout);
+	if (type == HbMessageBox::HbMessageBox::MessageTypeInformation)
+		HbMessageBox::information(text, new HbLabel("Information"));
+	else
+		HbMessageBox::information(text, new HbLabel("Information"));
 }
 
 // ---------------------------------------------------------------------------
@@ -122,14 +115,13 @@
     popup->setSecondaryAction(actionCancel);
 
     // Launch popup syncronously
-    popup->setAttribute(Qt::WA_DeleteOnClose);
-    // TODO: handle dialog close & user input
-    popup->open();
+    HbAction *action = 0;
+    action = popup->exec();
 
 	// continue if ok selected and valid user input exists in line editor
-    /*if (action && action->text() == "Ok" && edit->text() != "") {
+    if (action && action->text() == "Ok" && edit->text() != "") {
 		numberOfEntries = edit->text().toInt(&err, 10);
-	}*/
+	}
 	return err;
 }
 
@@ -163,15 +155,14 @@
     popup->setSecondaryAction(actionCancel);
 
     // Launch popup syncronously
-    popup->setAttribute(Qt::WA_DeleteOnClose);
-    // TODO: handle dialog close & user input
-    popup->open();
+    HbAction *action = 0;
+    action = popup->exec();
 
 	// continue if ok selected and valid user input exists in line editor
-    /*if (action && action->text() == "Ok" && edit->text() != "") {
+    if (action && action->text() == "Ok" && edit->text() != "") {
 		date = QDate::fromString(edit->text());
         err = true;
-	}*/
+	}
 	return err;    
 }
 
@@ -179,8 +170,7 @@
 
 bool Notifications::yesNoQueryDialog(const QString& text)
 {
-    HbMessageBox::question(text, 0, 0);
-    return false;
+    return HbMessageBox::question(text);
 }
 
 // ---------------------------------------------------------------------------
@@ -220,15 +210,14 @@
     popup->setSecondaryAction(actionCancel);
 
     // Launch popup syncronously
-    popup->setAttribute(Qt::WA_DeleteOnClose);
-    // TODO: handle dialog close & user input
-    popup->open();
+    HbAction *action = 0;
+    action = popup->exec();
 
 	// continue if ok selected and valid user input exists in line editor
-    /*if (action && action->text() == "Ok" && edit->text() != "") {
+    if (action && action->text() == "Ok" && edit->text() != "") {
 		directory = edit->text();
 		err = true;
-	}*/
+	}
 	return err;
 }