launcher/src/notifications.cpp
branchRCL_3
changeset 22 fad26422216a
parent 21 b3cee849fa46
child 23 f8280f3bfeb7
equal deleted inserted replaced
21:b3cee849fa46 22:fad26422216a
     1 /*
       
     2 * Copyright (c) 2010 Nokia Corporation and/or its subsidiary(-ies).
       
     3 * All rights reserved.
       
     4 * This component and the accompanying materials are made available
       
     5 * under the terms of "Eclipse Public License v1.0"
       
     6 * which accompanies this distribution, and is available
       
     7 * at the URL "http://www.eclipse.org/legal/epl-v10.html".
       
     8 *
       
     9 * Initial Contributors:
       
    10 * Nokia Corporation - initial contribution.
       
    11 *
       
    12 * Contributors:
       
    13 *
       
    14 * Description:
       
    15 *
       
    16 */
       
    17 
       
    18 
       
    19 #include <hblabel.h>
       
    20 #include <hbdeviceprogressdialog.h>
       
    21 #include <hbmessagebox.h>
       
    22 
       
    23 
       
    24 #include "notifications.h"
       
    25 
       
    26 // ---------------------------------------------------------------------------
       
    27 
       
    28 void Notifications::showMessageBox(HbMessageBox::MessageBoxType type, const QString &text, const QString &label, int timeout )
       
    29 {
       
    30     HbMessageBox *messageBox = new HbMessageBox(type);
       
    31     messageBox->setText(text);
       
    32     if(label.length())
       
    33         {
       
    34         HbLabel *header = new HbLabel(label, messageBox);
       
    35         messageBox->setHeadingWidget(header);
       
    36         }
       
    37     messageBox->setAttribute(Qt::WA_DeleteOnClose);
       
    38     messageBox->setTimeout(timeout);
       
    39     messageBox->open();
       
    40 }
       
    41 
       
    42 // ---------------------------------------------------------------------------
       
    43 
       
    44 void Notifications::about()
       
    45 {
       
    46     Notifications::showMessageBox( 
       
    47         HbMessageBox::MessageTypeInformation, 
       
    48         "Version 4.0.1 - 21st May 2010. Copyright © 2010 Nokia Corporation and/or its subsidiary(-ies). All rights reserved. Licensed under Eclipse Public License v1.0.", 
       
    49         "About Launcher"
       
    50         );
       
    51 }
       
    52 
       
    53 // ---------------------------------------------------------------------------
       
    54 
       
    55 HbDeviceProgressDialog* Notifications::showWaitDialog(const QString &text)
       
    56 {
       
    57     HbDeviceProgressDialog *note = new HbDeviceProgressDialog( HbProgressDialog::WaitDialog );
       
    58     note->setText( text );
       
    59     note->setAction(0);
       
    60     note->show();
       
    61     return note;
       
    62 }
       
    63 
       
    64 // ---------------------------------------------------------------------------
       
    65 
       
    66 void Notifications::showInformationNote(const QString &text)
       
    67 {
       
    68     Notifications::showMessageBox( 
       
    69         HbMessageBox::MessageTypeInformation,
       
    70         text, 
       
    71         "", // no label
       
    72         3000
       
    73         );
       
    74 }
       
    75 
       
    76 // ---------------------------------------------------------------------------
       
    77 
       
    78 void Notifications::showErrorNote(const QString &text)
       
    79 {
       
    80     Notifications::showMessageBox( 
       
    81         HbMessageBox::MessageTypeWarning,
       
    82         text, 
       
    83         "", // no label
       
    84         3000
       
    85         );
       
    86 }
       
    87 
       
    88 // ---------------------------------------------------------------------------