void wfe_Progress(MWContext *pContext, const char *pMessage) { if(pMessage == NULL || *pMessage == '\0') { if(pContext->defaultStatus) { FE_Progress(pContext, pContext->defaultStatus); } else { FE_Progress(pContext, ABSTRACTCX(pContext)->m_pLastStatus); } } else { ABSTRACTCX(pContext)->Progress(pContext,pMessage); } }
void CFE_AllConnectionsComplete(MWContext *pContext) { if(ABSTRACTCX(pContext)->IsDestroyed()) { // Don't allow this to happen if the context has been destroyed... TRACE("Context %p Destroyed :: AllConnectionsComplete Blocking\n", pContext); return; } #ifdef MOZ_MAIL_NEWS if (IS_MESSAGE_COMPOSE(pContext)) { MSG_Pane *pPane = MSG_FindPane( pContext, MSG_COMPOSITIONPANE ); ASSERT( pPane ); MSG_MailCompositionAllConnectionsComplete ( pPane ); } if (NET_IsOffline()) { FE_Progress(pContext, szLoadString(IDS_STATUS_OFFLINE)); } else #endif { // Set the progress to be complete. FE_Progress(pContext, szLoadString(IDS_DOC_DONE)); } ABSTRACTCX(pContext)->AllConnectionsComplete(pContext); FE_DeleteDNSList(pContext); #ifdef EDITOR #ifdef XP_WIN16 if( EDT_IS_EDITOR(pContext) ){ // For some bizzare reason, we don't get proper focus // when starting an Edit frame+View in Win16 // This fixes that ::SetFocus(PANECX(pContext)->GetPane()); } #endif #endif #ifdef DEBUG_WHITEBOX // AfxMessageBox("cfe.cpp: Try Again?"); if (IS_MAIL_READER(pContext)) { if (QATestCaseStarted == FALSE) { QADoDeleteMessageEventHandler(); } } #endif }
/* Free the object ** --------------- ** */ extern "C" void disk_stream_complete (NET_StreamClass *stream) { DataObject * data = (DataObject *)stream->data_object; if(!data) return; if(data->fp) { fclose(data->fp); data->fp = NULL; } FE_Progress(data->context, szLoadString(IDS_DOC_LOAD_COMPLETE)); if(FEU_Execute(data->context, data->command, data->params)) { FE_Progress(data->context, szLoadString(IDS_SPAWNING_EXTERNAL_VIEWER)); } if(data->address) { XP_FREE(data->address); data->address = NULL; } if(data->filename) { XP_FREE(data->filename); data->filename = NULL; } if(data->params) { XP_FREE(data->params); data->params = NULL; } delete data; return; }
void CFE_Progress(MWContext *pContext, const char *pMessage) { if(ABSTRACTCX(pContext)->IsDestroyed()) { // Don't allow this to happen if the context has been destroyed... TRACE("Context %p Destroyed :: Progress Blocking\n", pContext); return; } // Only allocate a last status if we're not simply passing in the // same last status. if (pMessage != ABSTRACTCX(pContext)->m_pLastStatus) { // Free off the old last status. if (ABSTRACTCX(pContext)->m_pLastStatus) { XP_FREE(ABSTRACTCX(pContext)->m_pLastStatus); } // Determine what the last status is depending on the message. if (pMessage && *pMessage) { // Make a copy of the message into last status. ABSTRACTCX(pContext)->m_pLastStatus = XP_STRDUP(pMessage); } else { // No last status. ABSTRACTCX(pContext)->m_pLastStatus = NULL; } } // We may be changing what we show if pMessage is NULL or has no context. if(pMessage == NULL || *pMessage == '\0') { // There is no message string (missing). // If the context has a default string we should show, do that instead. if(pContext->defaultStatus && *(pContext->defaultStatus)) { FE_Progress(pContext, pContext->defaultStatus); } else { // There was no message text and no default text so it looks like // someone wants the text cleared altogether. ABSTRACTCX(pContext)->Progress(pContext, " "); } } else { // Display the message if present. ABSTRACTCX(pContext)->Progress(pContext, pMessage); } }
void nsTopProgressManager::UpdateStatusMessage(AggregateTransferInfo& info) { // Compute how much time has elapsed nsInt64 dt = nsTime(PR_Now()) - fActualStart; PRUint32 elapsed = dt / nsInt64((PRUint32) PR_USEC_PER_SEC); char buf[256]; *buf = 0; if (info.ObjectCount == 1 || info.CompleteCount == 0) { // If we only have one object that we're transferring, or if // nothing has completed yet, show the default status message PL_strncpy(buf, fDefaultStatus, sizeof(buf)); } if (elapsed > TIME_UNTIL_DETAILS) { char details[256]; *details = 0; if (!info.UnknownLengthCount && info.ContentLength > 0) { formatKnownContentLength(details, sizeof(details), info.BytesReceived, info.ContentLength, elapsed); } else if (info.BytesReceived > 0) { formatUnknownContentLength(details, sizeof(details), info.BytesReceived, elapsed); } if (*details) { // XXX needs to go to allxpstr.h if (*buf) PL_strcatn(buf, sizeof(buf), ", "); PL_strcatn(buf, sizeof(buf), details); } } FE_Progress(fContext, buf); }
void nsTopProgressManager::Tick(void) { TRACE_PROGRESS(("nsProgressManager.Tick: aggregating information for active objects\n")); AggregateTransferInfo info = { 0, 0, 0, 0, 0, 0, 0 }; PL_HashTableEnumerateEntries(fURLs, pm_AggregateTransferInfo, (void*) &info); TRACE_PROGRESS(("nsProgressManager.Tick: %ld of %ld objects complete, " "%ldms left, " "%ld of %ld bytes xferred\n", info.CompleteCount, info.ObjectCount, info.MSecRemaining, info.BytesReceived, info.ContentLength)); PR_ASSERT(info.ObjectCount > 0); if (info.ObjectCount == 0) return; UpdateProgressBar(info); UpdateStatusMessage(info); // Check to see if we're done. if (info.CompleteCount == info.ObjectCount) { TRACE_PROGRESS(("Complete: %ld/%ld objects loaded\n", info.CompleteCount, info.ObjectCount)); // XXX needs to go to allxpstr.h FE_Progress(fContext, " "); PL_HashTableDestroy(fURLs); fURLs = NULL; fTimeout = NULL; } else { // Reset the timeout to fire again... fTimeout = FE_SetTimeout(nsTopProgressManager::TimeoutCallback, (void*) this, 500); } }
nsTopProgressManager::~nsTopProgressManager(void) { if (fDefaultStatus) { PL_strfree(fDefaultStatus); fDefaultStatus = NULL; } if (fURLs) { PL_HashTableDestroy(fURLs); fURLs = NULL; } if (fTimeout) { FE_ClearTimeout(fTimeout); fTimeout = NULL; } // XXX Needs to go to allxpstr.h FE_Progress(fContext, "Done."); }
void CFE_GraphProgress(MWContext *pContext, URL_Struct *pURL, int32 lBytesReceived, int32 lBytesSinceLastTime, int32 lContentLength) { if(ABSTRACTCX(pContext)->IsDestroyed()) { // Don't allow this to happen if the context has been destroyed... TRACE("Context %p Destroyed :: GraphProgress Blocking\n", pContext); return; } ABSTRACTCX(pContext)->GraphProgress(pContext, pURL, lBytesReceived, lBytesSinceLastTime, lContentLength); time_t ttCurTime = theApp.GetTime(); if(ABSTRACTCX(pContext)->ProgressReady(ttCurTime) == TRUE) { const char *pProgress = XP_ProgressText(lContentLength, lBytesReceived, 1, ABSTRACTCX(pContext)->GetElapsedSeconds(ttCurTime) + 1); if(pProgress != NULL) { FE_Progress(pContext, pProgress); // If the context has ncapi data, have it pass off this information to // external applications too. if(ABSTRACTCX(pContext)->m_pNcapiUrlData != NULL) { ABSTRACTCX(pContext)->m_pNcapiUrlData->MakingProgress(pProgress, CASTINT(lContentLength != 0 ? (lBytesReceived * 100 / lContentLength) % 100 : 0)); } } } }