photosgallery/viewframework/uiutilities/src/glxprogressindicator.cpp
branchRCL_3
changeset 30 a60acebbbd9d
parent 22 2dac0fdba72b
child 35 420f6808bf21
equal deleted inserted replaced
25:191387a8b767 30:a60acebbbd9d
    74     TRACER("CGlxProgressIndicator::~CGlxProgressIndicator()");
    74     TRACER("CGlxProgressIndicator::~CGlxProgressIndicator()");
    75     if (iProgressbarTicker)
    75     if (iProgressbarTicker)
    76         {
    76         {
    77         iProgressbarTicker->Cancel();
    77         iProgressbarTicker->Cancel();
    78         delete iProgressbarTicker;
    78         delete iProgressbarTicker;
    79         }
    79         iProgressbarTicker = NULL;
    80     if(iProgressDialog)
    80         }
    81         {
    81 
    82         iProgressDialog->ProcessFinishedL();
    82     // Stop force generation of thumbnails when progress dialog is dismissed
    83         }
       
    84 
       
    85 	// Stop force generation of thumbnails when progress dialog is dismissed
       
    86     if (iUiUtility)
    83     if (iUiUtility)
    87         {
    84         {
    88         iUiUtility->StopTNMDaemon();
    85         iUiUtility->StopTNMDaemon();
    89         iUiUtility->Close();
    86         iUiUtility->Close();
    90         }
    87         }
    97 void CGlxProgressIndicator::ConstructL()
    94 void CGlxProgressIndicator::ConstructL()
    98     {
    95     {
    99     TRACER("CGlxProgressIndicator::ConstructL()");
    96     TRACER("CGlxProgressIndicator::ConstructL()");
   100     iUiUtility->StartTNMDaemon();
    97     iUiUtility->StartTNMDaemon();
   101 
    98 
   102     if(!iProgressbarTicker)
    99     if (!iProgressbarTicker)
   103         {
   100         {
   104         iProgressbarTicker = CPeriodic::NewL(CActive::EPriorityStandard);
   101         iProgressbarTicker = CPeriodic::NewL(CActive::EPriorityStandard);
   105         }
   102         }
   106 
   103 
   107     iFinalCount = iUiUtility->GetItemsLeftCount();
   104     iFinalCount = iUiUtility->GetItemsLeftCount();
   108     GLX_LOG_INFO1("final count in viewactivate = %d",iFinalCount);
   105     GLX_LOG_INFO1("final count in viewactivate = %d",iFinalCount);
   109 
       
   110     }
   106     }
   111 
   107 
   112 
   108 
   113 // -----------------------------------------------------------------------------
   109 // -----------------------------------------------------------------------------
   114 // Callback from periodic timer
   110 // Callback from periodic timer
   115 // -----------------------------------------------------------------------------
   111 // -----------------------------------------------------------------------------
   116 //
   112 //
   117 TInt CGlxProgressIndicator::PeriodicCallbackL(TAny* aPtr )
   113 TInt CGlxProgressIndicator::PeriodicCallbackL(TAny* aPtr )
   118     {
   114     {
   119     TRACER("CGlxProgressIndicator::PeriodicCallbackL");
   115     TRACER("CGlxProgressIndicator::PeriodicCallbackL");
   120     static_cast< CGlxProgressIndicator* >( aPtr )->DisplayProgressBarL();
   116     static_cast<CGlxProgressIndicator*> (aPtr)->DisplayProgressBarL();
   121     return KErrNone;
   117     return KErrNone;
   122     }
   118     }
   123 
   119 
   124 // -----------------------------------------------------------------------------
   120 // -----------------------------------------------------------------------------
   125 // Callback from periodic timer-- non static
   121 // Callback from periodic timer-- non static
   129     {
   125     {
   130     TRACER("CGlxProgressIndicator::DisplayProgressBarL");
   126     TRACER("CGlxProgressIndicator::DisplayProgressBarL");
   131     TInt itemsLeft = iUiUtility->GetItemsLeftCount();
   127     TInt itemsLeft = iUiUtility->GetItemsLeftCount();
   132     GLX_LOG_INFO1("itemsLeft in DisplayProgressBarL = %d",iFinalCount);
   128     GLX_LOG_INFO1("itemsLeft in DisplayProgressBarL = %d",iFinalCount);
   133     UpdateProgressBar();
   129     UpdateProgressBar();
   134     if(!itemsLeft)
   130     if (!itemsLeft)
   135         {
   131         {
   136         if(iProgressbarTicker->IsActive())
   132         if (iProgressbarTicker->IsActive())
   137             {
   133             {
   138             iProgressbarTicker->Cancel();
   134             iProgressbarTicker->Cancel();
   139             }
   135             }
   140         StartProgressNoteL(iFinalCount,EFalse);
   136         StartProgressNoteL(iFinalCount, EFalse);
   141         }
   137         }
   142     }
   138     }
   143 
   139 
   144 // -----------------------------------------------------------------------------
   140 // -----------------------------------------------------------------------------
   145 // StartProgressNoteL
   141 // StartProgressNoteL
   147 //
   143 //
   148 void CGlxProgressIndicator::StartProgressNoteL(TInt aFinalValue,TBool aShow)
   144 void CGlxProgressIndicator::StartProgressNoteL(TInt aFinalValue,TBool aShow)
   149     {
   145     {
   150     TRACER("CGlxProgressIndicator::StartProgressNoteL()");
   146     TRACER("CGlxProgressIndicator::StartProgressNoteL()");
   151     TInt itemsLeft = iUiUtility->GetItemsLeftCount();
   147     TInt itemsLeft = iUiUtility->GetItemsLeftCount();
   152     if(aShow)
   148     if (aShow)
   153         {
   149         {
   154         if(!iProgressDialog)
   150         if (!iProgressDialog)
   155             {
   151             {
   156             iProgressDialog = new (ELeave) CAknProgressDialog(
   152             iProgressDialog = new (ELeave) CAknProgressDialog(
   157                     (reinterpret_cast<CEikDialog**> (&iProgressDialog)),
   153                     (reinterpret_cast<CEikDialog**> (&iProgressDialog)),
   158                     ETrue);
   154                     ETrue);
   159             }
   155             }
   160         iProgressDialog->PrepareLC(R_PROGRESS_NOTE);
   156         iProgressDialog->PrepareLC(R_PROGRESS_NOTE);
   161         
   157 
   162         iProgressInfo = iProgressDialog->GetProgressInfoL();
   158         iProgressInfo = iProgressDialog->GetProgressInfoL();
   163         
   159 
   164         iProgressDialog->SetCallback(this);
   160         iProgressDialog->SetCallback(this);
   165         
   161 
   166         HBufC* processingInfo = 
   162         HBufC* processingInfo = StringLoader::LoadLC(
   167                     StringLoader::LoadLC(R_GLX_MAIN_LIST_VIEW_PROCESSING_DIALOG);
   163                 R_GLX_MAIN_LIST_VIEW_PROCESSING_DIALOG);
   168         iProgressDialog->SetTextL(*processingInfo);
   164         iProgressDialog->SetTextL(*processingInfo);
   169         CleanupStack::PopAndDestroy(processingInfo );
   165         CleanupStack::PopAndDestroy(processingInfo);
   170         iProgressInfo->SetFinalValue(aFinalValue);
   166         iProgressInfo->SetFinalValue(aFinalValue);
   171         iProgressInfo->SetAndDraw(iFinalCount-itemsLeft);
   167         iProgressInfo->SetAndDraw(iFinalCount - itemsLeft);
   172         iProgressDialog->RunLD();
   168         iProgressDialog->RunLD();
   173         }
   169         }
   174     else
   170     else
   175         {
   171         {
   176         iProgressDialog->ProcessFinishedL();
   172         iProgressDialog->ProcessFinishedL();
   177         iGlxGridViewNotifyObserver.HandleDialogDismissedL();
   173         iGlxGridViewNotifyObserver.HandleDialogDismissedL();
   178         if(iProgressDialog)
   174         if (iProgressDialog)
   179             {
   175             {
   180             iProgressDialog = NULL;
   176             iProgressDialog = NULL;
   181             iProgressInfo = NULL;
   177             iProgressInfo = NULL;
   182             }
   178             }
   183         }
   179         }
   184      
       
   185     }
   180     }
   186     
   181     
   187 // -----------------------------------------------------------------------------
   182 // -----------------------------------------------------------------------------
   188 // UpdateProgressBar
   183 // UpdateProgressBar
   189 // -----------------------------------------------------------------------------
   184 // -----------------------------------------------------------------------------
   190 //
   185 //
   191 void CGlxProgressIndicator::UpdateProgressBar()
   186 void CGlxProgressIndicator::UpdateProgressBar()
   192     {   
   187     {
   193     TRACER("CGlxProgressIndicator::UpdateProgressBar()");
   188     TRACER("CGlxProgressIndicator::UpdateProgressBar()");
   194     if(iProgressInfo)
   189     if (iProgressInfo)
   195         {
   190         {
   196         /*
   191         /*
   197          * to show a number string in the progress bar use the below code
   192          * to show a number string in the progress bar use the below code
   198          * in rss it should have %d or %N format
   193          * in rss it should have %d or %N format
   199          * TBuf<256> text;
   194          * TBuf<256> text;
   206     
   201     
   207 // -----------------------------------------------------------------------------
   202 // -----------------------------------------------------------------------------
   208 // DialogDismissedL
   203 // DialogDismissedL
   209 // -----------------------------------------------------------------------------
   204 // -----------------------------------------------------------------------------
   210 //  
   205 //  
   211 void CGlxProgressIndicator::DialogDismissedL(TInt aButtonId)
   206 void CGlxProgressIndicator::DialogDismissedL(TInt /*aButtonId*/)
   212     {
   207     {
   213     TRACER("CGlxProgressIndicator::DialogDismissedL()");
   208     TRACER("CGlxProgressIndicator::DialogDismissedL()");
   214     if(iProgressbarTicker)
   209     if (iProgressbarTicker)
   215         {
   210         {
   216         iProgressbarTicker->Cancel();
   211         iProgressbarTicker->Cancel();
       
   212         delete iProgressbarTicker;
   217         iProgressbarTicker = NULL;
   213         iProgressbarTicker = NULL;
   218         }
   214         }
   219 
   215     iProgressDialog = NULL;
   220     if(iProgressDialog)
   216     iProgressInfo = NULL;
   221         {
       
   222         iProgressDialog = NULL;
       
   223         iProgressInfo = NULL;
       
   224         }
       
   225     }
   217     }
   226 
   218 
   227 // -----------------------------------------------------------------------------
   219 // -----------------------------------------------------------------------------
   228 // CalculateDisplayBarIncrement
   220 // CalculateDisplayBarIncrement
   229 // -----------------------------------------------------------------------------
   221 // -----------------------------------------------------------------------------
   281         {
   273         {
   282         GLX_LOG_INFO("Reset the RProperty flag to EFalse");
   274         GLX_LOG_INFO("Reset the RProperty flag to EFalse");
   283         iUiUtility->StopTNMDaemon();
   275         iUiUtility->StopTNMDaemon();
   284         }
   276         }
   285     }
   277     }
       
   278 
       
   279 // -----------------------------------------------------------------------------
       
   280 // DismissProgressDialog
       
   281 // -----------------------------------------------------------------------------
       
   282 //
       
   283 EXPORT_C void CGlxProgressIndicator::DismissProgressDialog()
       
   284     {
       
   285     TRACER("CGlxProgressIndicator::DismissProgressDialog");
       
   286     
       
   287     if(iProgressDialog)
       
   288         {
       
   289         TRAP_IGNORE(iProgressDialog->ProcessFinishedL());
       
   290         }
       
   291     }
       
   292