phoneapp/phoneuiqtviewadapter/src/phonenotecontroller.cpp
changeset 27 2f8f8080a020
parent 22 6bb1b21d2484
child 30 ebdbd102c78a
--- a/phoneapp/phoneuiqtviewadapter/src/phonenotecontroller.cpp	Fri Apr 16 14:58:25 2010 +0300
+++ b/phoneapp/phoneuiqtviewadapter/src/phonenotecontroller.cpp	Mon May 03 12:31:11 2010 +0300
@@ -73,16 +73,29 @@
             HbDeviceMessageBox messageBox(noteString, type);
             messageBox.setTimeout(HbDialog::StandardTimeout);
             messageBox.exec();
-        } else {    
-            HbDeviceMessageBox *messageBox = new HbDeviceMessageBox(
-                    noteString, type);
-            messageBox->setTimeout(HbDialog::StandardTimeout);
-            m_messageBoxList.append(messageBox);
+        } else {
+            bool showNote(true);
+            for (int i = 0;i<m_messageBoxList.count(); ++i) {
+                // Do not show same note/text several times, e.g when user hits
+                // the end button several times we should show only one "not allowed"
+                // note.
+                if (noteString == m_messageBoxList.at(i)->text()) {
+                    showNote = false;
+                    break;
+                }
+            }
             
-            if (1 == m_messageBoxList.size()) {
-                QObject::connect(messageBox, SIGNAL(aboutToClose()), 
-                                 this, SLOT(destroyDialog()));            
-                messageBox->show();
+            if (showNote) {
+                HbDeviceMessageBox *messageBox = new HbDeviceMessageBox(
+                        noteString, type);
+                messageBox->setTimeout(HbDialog::StandardTimeout);
+                m_messageBoxList.append(messageBox);
+                
+                if (1 == m_messageBoxList.size()) {
+                    QObject::connect(messageBox, SIGNAL(aboutToClose()), 
+                                     this, SLOT(destroyDialog()));            
+                    messageBox->show();
+                }
             }
         }
     }