creator/src/notifications.cpp
changeset 51 b048e15729d6
parent 31 e7a04a6385be
child 52 36d60d12b4af
equal deleted inserted replaced
44:5db69f4c3d06 51:b048e15729d6
    37 
    37 
    38 void Notifications::showMessageBox(HbMessageBox::MessageBoxType type, const QString &text, const QString &label, int timeout )
    38 void Notifications::showMessageBox(HbMessageBox::MessageBoxType type, const QString &text, const QString &label, int timeout )
    39 {
    39 {
    40     HbMessageBox *messageBox = new HbMessageBox(type);
    40     HbMessageBox *messageBox = new HbMessageBox(type);
    41     messageBox->setText(text);
    41     messageBox->setText(text);
       
    42     messageBox->setStandardButtons( HbMessageBox::Ok );
    42     if(label.length())
    43     if(label.length())
    43         {
    44         {
    44         HbLabel *header = new HbLabel(label, messageBox);
    45         HbLabel *header = new HbLabel(label, messageBox);
    45         messageBox->setHeadingWidget(header);
    46         messageBox->setHeadingWidget(header);
    46         }
    47         }
    52 // ---------------------------------------------------------------------------
    53 // ---------------------------------------------------------------------------
    53 
    54 
    54 void Notifications::about()
    55 void Notifications::about()
    55 {
    56 {
    56     showMessageBox(HbMessageBox::MessageTypeInformation,
    57     showMessageBox(HbMessageBox::MessageTypeInformation,
    57         "Version 6.1.0 - June 18th 2010. Copyright © 2010 Nokia Corporation and/or its subsidiary(-ies). All rights reserved. Licensed under Eclipse Public License v1.0.",
    58         "Version 6.1.1 - August 27th 2010. Copyright © 2010 Nokia Corporation and/or its subsidiary(-ies). All rights reserved. Licensed under Eclipse Public License v1.0.",
    58         "About Creator", 
    59         "About Creator", 
    59         HbPopup::NoTimeout
    60         HbPopup::NoTimeout
    60         );
    61         );
    61 }
    62 }
    62 
    63 
    81 
    82 
    82 }
    83 }
    83 
    84 
    84 // ---------------------------------------------------------------------------
    85 // ---------------------------------------------------------------------------
    85 
    86 
    86 void Notifications::showGlobalNote(const QString& text, HbMessageBox::MessageBoxType type, HbPopup::DefaultTimeout timeout)
    87 void Notifications::showGlobalNote(const QString& text, HbMessageBox::MessageBoxType type, int timeout)
    87 {
    88 {
    88     showMessageBox(type, text, QString("Creator"), timeout);
    89     showMessageBox(type, text, QString("Creator"), timeout);
    89 }
    90 }
    90 
    91 
    91 
    92 
    98 }
    99 }
    99 
   100 
   100 void CreatorYesNoDialog::launch(const QString& text, const QString& label, MUIObserver* observer, int userData) throw(std::exception)
   101 void CreatorYesNoDialog::launch(const QString& text, const QString& label, MUIObserver* observer, int userData) throw(std::exception)
   101 {
   102 {
   102     CreatorYesNoDialog* dlg = new CreatorYesNoDialog(observer, userData);
   103     CreatorYesNoDialog* dlg = new CreatorYesNoDialog(observer, userData);
       
   104     dlg->setStandardButtons( HbMessageBox::Yes | HbMessageBox::No );
   103     dlg->setText(text);
   105     dlg->setText(text);
   104     if(label.length())
   106     if(label.length())
   105         dlg->setHeadingWidget(new HbLabel(label, dlg));
   107         dlg->setHeadingWidget(new HbLabel(label, dlg));
   106     dlg->setAttribute(Qt::WA_DeleteOnClose);
   108     dlg->setAttribute(Qt::WA_DeleteOnClose);
   107     dlg->setTimeout(HbPopup::NoTimeout);
   109     dlg->setTimeout(HbPopup::NoTimeout);
   141     dlg->setPromptText(label);
   143     dlg->setPromptText(label);
   142     dlg->setInputMode(IntInput);
   144     dlg->setInputMode(IntInput);
   143     HbValidator *validator = new HbValidator(dlg);
   145     HbValidator *validator = new HbValidator(dlg);
   144     QString tmp;
   146     QString tmp;
   145     if (acceptsZero == false) {
   147     if (acceptsZero == false) {
   146         tmp.append("[1-9]{1}\\d{1,4}");
   148         tmp.append("^[1-9]{1}\\d{0,4}");
   147     }
   149     }
   148     else {
   150     else {
   149         tmp.append("^[0-9]{5}");
   151         tmp.append("^[0-9]{1,5}");
   150     }
   152     }
   151         
   153         
   152     QRegExp rxBasic(tmp);
   154     QRegExp rxBasic(tmp);
   153     validator->addField(new QRegExpValidator(rxBasic, 0), "");
   155     validator->addField(new QRegExpValidator(rxBasic, 0), "");
   154     dlg->setValidator(validator);
   156     dlg->setValidator(validator);
   211     CreatorSelectionDialog* dlg = new CreatorSelectionDialog(selectedItem, observer, userData);
   213     CreatorSelectionDialog* dlg = new CreatorSelectionDialog(selectedItem, observer, userData);
   212     if(label.length())
   214     if(label.length())
   213         dlg->setHeadingWidget(new HbLabel(label, dlg));
   215         dlg->setHeadingWidget(new HbLabel(label, dlg));
   214     dlg->setStringItems(items);
   216     dlg->setStringItems(items);
   215     dlg->setSelectionMode(HbAbstractItemView::SingleSelection); 
   217     dlg->setSelectionMode(HbAbstractItemView::SingleSelection); 
       
   218     dlg->setSelectedItems(QList<QVariant>());
   216     dlg->setAttribute(Qt::WA_DeleteOnClose);
   219     dlg->setAttribute(Qt::WA_DeleteOnClose);
   217     dlg->open(dlg, SLOT(DialogClosed(HbAction*)));
   220     dlg->open(dlg, SLOT(DialogClosed(HbAction*)));
   218 }
   221 }
   219 
   222 
   220 void CreatorSelectionDialog::launch(const QString& label, const QStringList& items, CArrayFixFlat<TInt>* selectedItems, MUIObserver* observer, int userData) throw(std::exception)
   223 void CreatorSelectionDialog::launch(const QString& label, const QStringList& items, CArrayFixFlat<TInt>* selectedItems, MUIObserver* observer, int userData) throw(std::exception)