emailservices/nmutilities/inc/nmuieventsnotifier.h
changeset 65 478bc57ad291
equal deleted inserted replaced
59:16ed8d08d0b1 65:478bc57ad291
       
     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 #ifndef NMUIEVENTSNOTIFIER_H
       
    19 #define NMUIEVENTSNOTIFIER_H
       
    20 
       
    21 #include <QObject>
       
    22 #include <XQSettingsKey>
       
    23 #include <XQSettingsManager>
       
    24 #include <QVariant>
       
    25 #include <nmcommon.h> // For NmId.
       
    26 #include <nmuiviewids.h>
       
    27 
       
    28 #include "emailutilitiesdef.h"
       
    29 
       
    30 
       
    31 
       
    32 class EMAIL_UTILITIES_EXPORT NmUiEventsNotifier : public QObject
       
    33 {
       
    34     Q_OBJECT
       
    35     Q_ENUMS(NmUiEventType)
       
    36 
       
    37 public: // Data types
       
    38 
       
    39     enum NmUiEventType {
       
    40         NmInvalidUiEvent = 0,
       
    41         NmViewShownEvent,
       
    42         NmViewHiddenEvent
       
    43     };
       
    44 
       
    45 
       
    46 public:
       
    47 
       
    48     NmUiEventsNotifier(QObject *parent = NULL);
       
    49 
       
    50     ~NmUiEventsNotifier();
       
    51 
       
    52 
       
    53 public:
       
    54 
       
    55     static bool notifyViewStateChanged(const NmUiEventType eventType,
       
    56                                        const NmUiViewId viewId,
       
    57                                        const NmId &mailboxId);
       
    58 
       
    59 
       
    60 private:
       
    61 
       
    62     bool keysEqual(const XQSettingsKey& settingsKey,
       
    63                    const XQPublishAndSubscribeSettingsKey& psSettingsKey) const;
       
    64 
       
    65     bool parseKeyValue(const QByteArray &array,
       
    66                        NmUiEventType &eventType,
       
    67                        NmUiViewId &viewId,
       
    68                        NmId &mailboxId) const;
       
    69 
       
    70 
       
    71 private slots:
       
    72 
       
    73     void valueChanged(const XQSettingsKey &key, const QVariant &value);
       
    74 
       
    75 
       
    76 Q_SIGNALS:
       
    77 
       
    78     void viewStateChanged(NmUiEventsNotifier::NmUiEventType eventType,
       
    79                           NmUiViewId viewId,
       
    80                           NmId mailboxId);
       
    81 
       
    82 
       
    83 private: // Data
       
    84 
       
    85     XQSettingsManager mSettingsManager;
       
    86 };
       
    87 
       
    88 
       
    89 #endif /* NMUIEVENTSNOTIFIER_H */
       
    90 
       
    91 // End of file.