/* * Event Handler Functions _________________________________________________________________ * */ static void OnInitDialog(HWND hwndDlg) { hDlg = hwndDlg; g_pWiz->EnableButtons(BACK_BUTTON | NEXT_BUTTON); g_pWiz->SetButtonText(IDNEXT, IDS_NEXT); g_pWiz->SetDefaultControl(IDNEXT); if (g_CfgData.bFirstServer) { ShowStatusMsg(IDS_MUST_CREATE_ROOT_AFS); g_CfgData.configRootVolumes = CS_CONFIGURE; return; } if (g_CfgData.configRootVolumes == CS_ALREADY_CONFIGURED) { ShowStatusMsg(IDS_ROOT_AFS_ALREADY_EXISTS); return; } // If the existence of the root volumes could not be determined, we'll // ask the user if they want to create them if they don't already exist. if (!g_CfgData.bRootVolumesExistanceKnown) { SetWndText(hDlg, IDC_ROOT_AFS_QUESTION, IDS_CREATE_ROOT_VOLUMES_IF_NECESSARY_PROMPT); SetCheck(hDlg, IDC_CREATE_ROOT_VOLUMES); g_CfgData.configRootVolumes = CS_CONFIGURE; return; } // Should this step be disabled? Yes, if this machine does // not have a partition to make root.afs on. if (!ConfiguredOrConfiguring(g_CfgData.configPartition)) { ShowStatusMsg(IDS_NO_PARTITION_EXISTS); EnableStep(g_CfgData.configRootVolumes, FALSE); return; } // If root.afs exists already but root.cell does not exist, then // the wizard cannot make root.cell and must disable this option. // However, since the root volumes don't both exist, we will leave // this option enabled, and only disable the yes check box. // TODO: We should handle this better in a future version where we can // add new messages. The message catalog is frozen for this version // so we have to handle this case without adding new messages. if (g_CfgData.bRootAfsExists && !g_CfgData.bRootCellExists) { EnableWnd(hDlg, IDC_CREATE_ROOT_VOLUMES, FALSE); SetCheck(hDlg, IDC_DONT_CREATE_ROOT_VOLUMES); g_CfgData.configRootVolumes = CS_DONT_CONFIGURE; return; } // Must do this in case it was disabled on the last run through EnableStep(g_CfgData.configRootVolumes); if (g_CfgData.configRootVolumes == CS_DONT_CONFIGURE) SetCheck(hDlg, IDC_DONT_CREATE_ROOT_VOLUMES); else SetCheck(hDlg, IDC_CREATE_ROOT_VOLUMES); }
void nsFolderCompactState::ShowCompactingStatusMsg() { nsString statusString; nsresult rv = m_folder->GetStringWithFolderNameFromBundle("compactingFolder", statusString); if (!statusString.IsEmpty() && NS_SUCCEEDED(rv)) ShowStatusMsg(statusString); }
nsresult nsOfflineStoreCompactState::FinishCompact() { // All okay time to finish up the compact process nsCOMPtr<nsILocalFile> path; PRUint32 flags; // get leaf name and database name of the folder m_folder->GetFlags(&flags); nsresult rv = m_folder->GetFilePath(getter_AddRefs(path)); nsCString leafName; path->GetNativeLeafName(leafName); if (m_fileStream) { // close down the temp file stream; preparing for deleting the old folder // and its database; then rename the temp folder and database m_fileStream->Flush(); m_fileStream->Close(); m_fileStream = nsnull; } // make sure the new database is valid nsCOMPtr <nsIDBFolderInfo> dbFolderInfo; m_db->GetDBFolderInfo(getter_AddRefs(dbFolderInfo)); if (dbFolderInfo) dbFolderInfo->SetExpungedBytes(0); // this forces the m_folder to update mExpungedBytes from the db folder info. PRUint32 expungedBytes; m_folder->GetExpungedBytes(&expungedBytes); m_folder->UpdateSummaryTotals(true); m_db->SetSummaryValid(true); // remove the old folder path->Remove(false); // rename the copied folder to be the original folder m_file->MoveToNative((nsIFile *) nsnull, leafName); ShowStatusMsg(EmptyString()); m_folder->NotifyCompactCompleted(); if (m_compactAll) rv = CompactNextFolder(); return rv; }
void nsFolderCompactState::ShowDoneStatus() { if (m_folder) { nsString statusString; nsCOMPtr <nsIStringBundle> bundle; nsresult rv = GetBaseStringBundle(getter_AddRefs(bundle)); NS_ENSURE_SUCCESS_VOID(rv); nsAutoString expungedAmount; FormatFileSize(m_totalExpungedBytes, true, expungedAmount); const char16_t* params[] = { expungedAmount.get() }; rv = bundle->FormatStringFromName(u"compactingDone", params, 1, getter_Copies(statusString)); if (!statusString.IsEmpty() && NS_SUCCEEDED(rv)) ShowStatusMsg(statusString); } }