chxavwaitnote.cpp
上传用户:zhongxx05
上传日期:2007-06-06
资源大小:33641k
文件大小:4k
- /************************************************************************
- * chxavwaitnote.h
- * ---------------
- *
- * Synopsis:
- * Description:
- *
- * (c) 1995-2003 RealNetworks, Inc. Patents pending. All rights reserved.
- *
- ************************************************************************/
- // Symbian includes...
- #include <aknwaitdialog.h>
- // Includes from this project...
- #include "chxavmisc.h"
- #include "chxavutil.h"
- #include "chxavwaitnote.h"
- #include "chxavthread.h"
- #include "hxsym_debug.h"
- ///////////////////////////////////
- // ctor
- CHXAvWaitNote::CHXAvWaitNote()
- : m_wpWaitNote(0)
- , m_idSoftkey(R_AVKON_SOFTKEYS_EMPTY)
- , m_bDismissPending(false)
- {
- }
- ///////////////////////////////////
- // dtor
- CHXAvWaitNote::~CHXAvWaitNote()
- {
- HX_ASSERT(!m_wpWaitNote);
- }
- ////////////////////////////////////////
- //
- void CHXAvWaitNote::ClearCancelCommand()
- {
- m_spUserCancelCmd = 0;
- m_idSoftkey = R_AVKON_SOFTKEYS_EMPTY;
- }
- ////////////////////////////////////////
- // userCancelCmd - command to execute when cancel button is pressed
- // idSoftkey - resource (see avkon.rsg) for cba (softkey text)
- //
- void CHXAvWaitNote::SetCancelCommandL(const CHXAvCommand& userCancelCmd, TInt idSoftkey)
- {
- m_spUserCancelCmd = userCancelCmd.CloneL();
- m_idSoftkey = idSoftkey;
- }
- ////////////////////////////////////////
- // MProgressDialogCallback
- //
- // called when user cancels or we close it (because
- // time consuming event has completed)
- //
- // note: we might get simulated cancel event (e.g., from dialog shutter)
- //
- void CHXAvWaitNote::DialogDismissedL(TInt bid)
- {
- DPRINTF(SYMP_INFO, ("WaitNote::DialogDismissedL() button id = %ld; ptr = %pn", bid, m_wpWaitNote));
-
- HX_ASSERT(m_bDismissPending);
- if( m_bDismissPending )
- {
- m_bDismissPending = false;
- if(m_spUserCancelCmd)
- {
- m_spUserCancelCmd->Execute();
- }
- }
-
- }
- ////////////////////////////////////////////////
- //
- void CHXAvWaitNote::StartAndKickL()
- {
- StartL(false);
- // process active objects so dialog has a chance to display itself (in case blocking processing follows)
- CHXAvThread::ProcessPendingRequests();
- }
-
- ////////////////////////////////////////////////
- //
- // bDelayVisibility - if true, wait 1.5 secs before displaying (in case wait turns
- // out to be very short
- //
- void CHXAvWaitNote::StartL(bool bDelayVisibility)
- {
- DPRINTF(SYMP_INFO, ("WaitNote::StartL()n"));
- HX_ASSERT(!m_bDismissPending);
- HX_ASSERT(!m_wpWaitNote);
-
- m_wpWaitNote = new (ELeave) CAknWaitDialog( reinterpret_cast<CEikDialog**>(&m_wpWaitNote), !bDelayVisibility);
-
- // not modal; modal requires EEikDialogFlagWait
- m_wpWaitNote->PrepareLC(R_AVP_WAIT_NOTE);
- // save cleanupstack init until LD
- {
- AUTO_PUSH_POP(m_wpWaitNote);
- m_wpWaitNote->SetTextL(*m_spText);
- //m_wpWaitNote->SetCurrentLabelL(EGeneralQuery, *m_spText);
-
- m_wpWaitNote->SetCallback(this);
- // set softkey (default is empty)
- m_wpWaitNote->ButtonGroupContainer().SetCommandSetL(m_idSoftkey);
-
- m_bDismissPending = true;
- }
- m_wpWaitNote->RunLD();
- }
- ////////////////////////////////////////////////
- //
- void CHXAvWaitNote::EndL()
- {
- DPRINTF(SYMP_INFO, ("WaitNote::EndL() pNote = %pn", m_wpWaitNote));
- if(m_bDismissPending && m_wpWaitNote)
- {
- m_bDismissPending = false;
- m_wpWaitNote->SetCallback(0); // just in case; we don't need callback after this
- m_wpWaitNote->ProcessFinishedL();
- // sometimes m_wpWaitNote lingers; self-destructs a bit later! (e.g., if you start and then end it quickly)
- // HX_ASSERT(0 == m_wpWaitNote);
- }
- }
-