ipsservices/nmipssettings/inc/nmipssettingsdeletemailboxop.h
changeset 76 38bf5461e270
equal deleted inserted replaced
74:6c59112cfd31 76:38bf5461e270
       
     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 NMIPSSETTINGSDELETEMAILBOXOP_H
       
    19 #define NMIPSSETTINGSDELETEMAILBOXOP_H
       
    20 
       
    21 #include <QObject>
       
    22 #include <nmcommon.h>
       
    23 
       
    24 class CMailboxDisconnectWait;
       
    25 class NmIpsSettingsManagerBase;
       
    26 class HbMessageBox;
       
    27 class HbProgressDialog;
       
    28 class HbAction;
       
    29 
       
    30 /// Operation results
       
    31 enum NmDeleteMailboxOpResults {
       
    32     /// Operation successful. Errorcode is always 0
       
    33     DeleteMbResultSuccess,
       
    34     /// Operation has failed. Errorcode will identify the error
       
    35     DeleteMbResultFailure,
       
    36     /// Operation was canceled. Errorcode is always 0
       
    37     DeleteMbResultCanceled
       
    38 };
       
    39 
       
    40 class NmIpsSettingsDeleteMailboxOp : public QObject
       
    41 {
       
    42     Q_OBJECT
       
    43 
       
    44 public:
       
    45     NmIpsSettingsDeleteMailboxOp(NmIpsSettingsManagerBase &settingsManager);
       
    46     ~NmIpsSettingsDeleteMailboxOp();
       
    47 
       
    48     void startOperation();
       
    49 
       
    50 public slots:
       
    51     void mailboxDisconnected();
       
    52     
       
    53 signals:
       
    54     void operationComplete(int result, int error);
       
    55     void goOffline(NmId mailboxId);
       
    56     void stateChanged();
       
    57 
       
    58 private:
       
    59     /// Operation states
       
    60     enum DeleteOpStates {
       
    61         StateConfirmation,
       
    62         StateDisconnect,
       
    63         StateDelete,
       
    64         StateUnregisterMailbox,
       
    65         StateDone
       
    66     };
       
    67 
       
    68 private:
       
    69     void complete(int result, int error);
       
    70     
       
    71 private slots:
       
    72     void handleConfimationDlg(HbAction *action);
       
    73     void handleDisconnectTimeout();
       
    74     void processState();
       
    75     void changeState(DeleteOpStates nextState);
       
    76 
       
    77     
       
    78 private: // data
       
    79     // Owned. Messaging server observer (Symbian class)
       
    80     CMailboxDisconnectWait *mDisconnectWait;
       
    81     // Settings manager
       
    82     NmIpsSettingsManagerBase &mSettingsManager;
       
    83     // Owned. Confirmation query dialog
       
    84     HbMessageBox *mDeleteConfirmationDlg;
       
    85     // Owned. Wait dialog
       
    86     HbProgressDialog* mDeleteProgressDlg;
       
    87     // Current state
       
    88     DeleteOpStates mState;
       
    89     // How many retry attempts is left
       
    90     int mRetryCount;
       
    91     // Operation error code
       
    92     int mError;
       
    93     // Operation result (NmDeleteMailboxOpResults)
       
    94     int mResult;
       
    95 };
       
    96 
       
    97 #endif // NMIPSSETTINGSDELETEMAILBOXOP_H