filebrowser/ui/src/notifications.cpp
branchRCL_3
changeset 19 b3cee849fa46
equal deleted inserted replaced
18:48060abbbeaf 19:b3cee849fa46
       
     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 #include "notifications.h"
       
    18 
       
    19 #include <HbLabel>
       
    20 #include <HbProgressDialog>
       
    21 #include <HbMessageBox>
       
    22 
       
    23 // ---------------------------------------------------------------------------
       
    24 
       
    25 void Notifications::showMessageBox(HbMessageBox::MessageBoxType type, const QString &text, const QString &label, int timeout)
       
    26 {
       
    27     HbMessageBox *messageBox = new HbMessageBox(type);
       
    28     messageBox->setText(text);
       
    29     if (label.length()) {
       
    30         HbLabel *header = new HbLabel(label, messageBox);
       
    31         messageBox->setHeadingWidget(header);
       
    32     }
       
    33     messageBox->setAttribute(Qt::WA_DeleteOnClose);
       
    34     messageBox->setTimeout(timeout);
       
    35     messageBox->open();
       
    36 }
       
    37 
       
    38 void Notifications::showAboutNote()
       
    39 {
       
    40     showMessageBox(HbMessageBox::MessageTypeInformation,
       
    41                    "Version 5.1.0 - 18th June 2010. Copyright © 2010 Nokia Corporation"
       
    42                         "and/or its subsidiary(-ies). All rights reserved."
       
    43                         "Licensed under Eclipse Public License v1.0.",
       
    44                    "About File Browser"
       
    45         );
       
    46 }
       
    47 
       
    48 // ---------------------------------------------------------------------------
       
    49 
       
    50 void Notifications::showInformationNote(const QString &text, const QString &title)
       
    51 {
       
    52     showMessageBox(HbMessageBox::MessageTypeInformation, text, title, 3000);
       
    53 }
       
    54 
       
    55 // ---------------------------------------------------------------------------
       
    56 
       
    57 void Notifications::showErrorNote(const QString &text, bool noTimeout)
       
    58 {
       
    59     showMessageBox(HbMessageBox::MessageTypeWarning, text, "",
       
    60                    noTimeout ? HbPopup::NoTimeout : 3000 /*HbPopup::StandardTimeout*/);
       
    61 }
       
    62 
       
    63 // ---------------------------------------------------------------------------
       
    64 
       
    65 void Notifications::showConfirmationNote(const QString &text, bool noTimeout)
       
    66 {
       
    67     showMessageBox(HbMessageBox::MessageTypeInformation, text, "",
       
    68                    noTimeout ? HbPopup::NoTimeout : 3000 /*HbPopup::ConfirmationNoteTimeout*/);
       
    69 }
       
    70 
       
    71 // ---------------------------------------------------------------------------
       
    72 
       
    73 bool Notifications::showConfirmationQuery(const QString &aText)
       
    74 {
       
    75     Q_UNUSED(aText);
       
    76     return false; //HbMessageBox::question(aText);
       
    77 }
       
    78 
       
    79 // ---------------------------------------------------------------------------