wxString CViewWork::GetKeyValue2(int iRowIndex) { CWork* work; if (GetWorkCacheAtIndex(work, m_iSortedIndexes[iRowIndex])) { return wxEmptyString; } return work->m_strProjectURL; }
int CViewWork::FindRowIndexByKeyValues(wxString& key1, wxString& key2) { CWork* work; unsigned int iRowIndex, n = GetCacheCount(); for(iRowIndex=0; iRowIndex < n; iRowIndex++) { if (GetWorkCacheAtIndex(work, m_iSortedIndexes[iRowIndex])) { continue; } if(! (work->m_strName).IsSameAs(key1)) continue; if((work->m_strProjectURL).IsSameAs(key2)) return iRowIndex; } return -1; }
wxString CViewWork::GetProgressText( long item) { CWork* work = NULL; wxString strBuffer = wxEmptyString; if (GetWorkCacheAtIndex(work, m_iSortedIndexes[item])) { strBuffer = wxEmptyString; } else { strBuffer = work->m_strProgress; } return strBuffer; }
wxString CViewWork::GetKeyValue2(int iRowIndex) { CWork* work; if (GetWorkCacheAtIndex(work, m_iSortedIndexes[iRowIndex])) { return wxEmptyString; } if (m_iColumnIDToColumnIndex[COLUMN_PROJECT] < 0) { // Column is hidden, so SynchronizeCacheItem() did not set its value GetDocProjectURL(m_iSortedIndexes[iRowIndex], work->m_strProjectURL); } return work->m_strProjectURL; }
wxString CViewWork::GetKeyValue1(int iRowIndex) { CWork* work; if (GetWorkCacheAtIndex(work, m_iSortedIndexes[iRowIndex])) { return wxEmptyString; } if (m_iColumnIDToColumnIndex[COLUMN_NAME] < 0) { // Column is hidden, so SynchronizeCacheItem() did not set its value GetDocName(m_iSortedIndexes[iRowIndex], work->m_strName); } return work->m_strName; }
bool CViewWork::SynchronizeCacheItem(wxInt32 iRowIndex, wxInt32 iColumnIndex) { wxString strDocumentText = wxEmptyString; wxString strDocumentText2 = wxEmptyString; float fDocumentFloat = 0.0; time_t tDocumentTime = (time_t)0; CWork* work; strDocumentText.Empty(); if (GetWorkCacheAtIndex(work, m_iSortedIndexes[iRowIndex])) { return false; } switch (iColumnIndex) { case COLUMN_PROJECT: GetDocProjectName(m_iSortedIndexes[iRowIndex], strDocumentText); GetDocProjectURL(m_iSortedIndexes[iRowIndex], strDocumentText2); if (!strDocumentText.IsSameAs(work->m_strProjectName) || !strDocumentText2.IsSameAs(work->m_strProjectURL)) { work->m_strProjectName = strDocumentText; work->m_strProjectURL = strDocumentText2; return true; } break; case COLUMN_APPLICATION: GetDocApplicationName(m_iSortedIndexes[iRowIndex], strDocumentText); if (!strDocumentText.IsSameAs(work->m_strApplicationName)) { work->m_strApplicationName = strDocumentText; return true; } break; case COLUMN_NAME: GetDocName(m_iSortedIndexes[iRowIndex], strDocumentText); if (!strDocumentText.IsSameAs(work->m_strName)) { work->m_strName = strDocumentText; return true; } break; case COLUMN_CPUTIME: GetDocCPUTime(m_iSortedIndexes[iRowIndex], fDocumentFloat); if (fDocumentFloat != work->m_fCPUTime) { work->m_fCPUTime = fDocumentFloat; FormatCPUTime(fDocumentFloat, work->m_strCPUTime); return true; } break; case COLUMN_PROGRESS: GetDocProgress(m_iSortedIndexes[iRowIndex], fDocumentFloat); if (fDocumentFloat != work->m_fProgress) { work->m_fProgress = fDocumentFloat; FormatProgress(fDocumentFloat, work->m_strProgress); return true; } break; case COLUMN_TOCOMPLETION: GetDocTimeToCompletion(m_iSortedIndexes[iRowIndex], fDocumentFloat); if (fDocumentFloat != work->m_fTimeToCompletion) { work->m_fTimeToCompletion = fDocumentFloat; FormatTimeToCompletion(fDocumentFloat, work->m_strTimeToCompletion); return true; } break; case COLUMN_REPORTDEADLINE: GetDocReportDeadline(m_iSortedIndexes[iRowIndex], tDocumentTime); if (tDocumentTime != work->m_tReportDeadline) { work->m_tReportDeadline = tDocumentTime; FormatReportDeadline(tDocumentTime, work->m_strReportDeadline); return true; } break; case COLUMN_STATUS: int i = m_iSortedIndexes[iRowIndex]; RESULT* result = wxGetApp().GetDocument()->result(i); strDocumentText = result_description(result); if (!strDocumentText.IsSameAs(work->m_strStatus)) { work->m_strStatus = strDocumentText; return true; } break; } return false; }
void CViewWork::OnWorkAbort( wxCommandEvent& WXUNUSED(event) ) { wxLogTrace(wxT("Function Start/End"), wxT("CViewWork::OnWorkAbort - Function Begin")); wxInt32 iAnswer = 0; wxString strMessage = wxEmptyString; CMainDocument* pDoc = wxGetApp().GetDocument(); CAdvancedFrame* pFrame = wxDynamicCast(GetParent()->GetParent()->GetParent(), CAdvancedFrame); CWork* work; int row, n; wxASSERT(pDoc); wxASSERT(pFrame); wxASSERT(wxDynamicCast(pDoc, CMainDocument)); wxASSERT(wxDynamicCast(pFrame, CAdvancedFrame)); wxASSERT(m_pTaskPane); wxASSERT(m_pListPane); if (!pDoc->IsUserAuthorized()) return; n = m_pListPane->GetSelectedItemCount(); if (n == 1) { row = -1; row = m_pListPane->GetNextItem(row, wxLIST_NEXT_ALL, wxLIST_STATE_SELECTED); if (row < 0) return; if (GetWorkCacheAtIndex(work, m_iSortedIndexes[row])) { return; } strMessage.Printf( _("Are you sure you want to abort this task '%s'?\n(Progress: %s, Status: %s)"), (work->m_strName).c_str(), (work->m_strProgress).c_str(), (work->m_strStatus).c_str() ); } else { strMessage.Printf(_("Are you sure you want to abort these %d tasks?"), n); } iAnswer = wxGetApp().SafeMessageBox( strMessage, _("Abort task"), wxYES_NO | wxICON_QUESTION, this ); if (wxYES != iAnswer) { return; } pFrame->UpdateStatusText(_("Aborting result...")); row = -1; while (1) { // Step through all selected items row = m_pListPane->GetNextItem(row, wxLIST_NEXT_ALL, wxLIST_STATE_SELECTED); if (row < 0) break; RESULT* result = pDoc->result(m_iSortedIndexes[row]); if (result) { pDoc->WorkAbort(result->project_url, result->name); } } pFrame->UpdateStatusText(wxT("")); UpdateSelection(); pFrame->FireRefreshView(); wxLogTrace(wxT("Function Start/End"), wxT("CViewWork::OnWorkAbort - Function End")); }