wxString CViewTransfers::GetKeyValue2(int iRowIndex) { CTransfer* transfer; if (GetTransferCacheAtIndex(transfer, m_iSortedIndexes[iRowIndex])) { return wxEmptyString; } return transfer->m_strProjectURL; }
wxString CViewTransfers::GetProgressText( long item) { CTransfer* transfer; wxString strBuffer = wxEmptyString; GetTransferCacheAtIndex(transfer, m_iSortedIndexes[item]); if (transfer) { strBuffer = transfer->m_strProgress; } return strBuffer; }
void CViewTransfers::OnTransfersAbort( wxCommandEvent& WXUNUSED(event) ) { wxLogTrace(wxT("Function Start/End"), wxT("CViewTransfers::OnTransfersAbort - Function Begin")); wxInt32 iAnswer = 0; wxString strMessage = wxEmptyString; CMainDocument* pDoc = wxGetApp().GetDocument(); CAdvancedFrame* pFrame = wxDynamicCast(GetParent()->GetParent()->GetParent(), CAdvancedFrame); CTransfer* pTransfer = NULL; int row; wxASSERT(pDoc); wxASSERT(wxDynamicCast(pDoc, CMainDocument)); wxASSERT(pFrame); wxASSERT(wxDynamicCast(pFrame, CAdvancedFrame)); wxASSERT(m_pListPane); if (!pDoc->IsUserAuthorized()) return; pFrame->UpdateStatusText(_("Aborting transfer...")); row = -1; while (1) { // Step through all selected items row = m_pListPane->GetNextItem(row, wxLIST_NEXT_ALL, wxLIST_STATE_SELECTED); if (row < 0) break; if (GetTransferCacheAtIndex(pTransfer, m_iSortedIndexes[row])) { return; } strMessage.Printf( _("Are you sure you want to abort this file transfer '%s'?\nNOTE: Aborting a transfer will invalidate a task and you\nwill not receive credit for it."), pTransfer->m_strFileName.c_str() ); iAnswer = wxGetApp().SafeMessageBox( strMessage, _("Abort File Transfer"), wxYES_NO | wxICON_QUESTION, this ); if (wxYES == iAnswer) { pDoc->TransferAbort(m_iSortedIndexes[row]); } } pFrame->UpdateStatusText(wxT("")); UpdateSelection(); pFrame->FireRefreshView(); wxLogTrace(wxT("Function Start/End"), wxT("CViewTransfers::OnTransfersAbort - Function End")); }
int CViewTransfers::FindRowIndexByKeyValues(wxString& key1, wxString& key2) { CTransfer* transfer; unsigned int iRowIndex, n = GetCacheCount(); for(iRowIndex=0; iRowIndex < n; iRowIndex++) { if (GetTransferCacheAtIndex(transfer, m_iSortedIndexes[iRowIndex])) { continue; } if(! (transfer->m_strFileName).IsSameAs(key1)) continue; if((transfer->m_strProjectURL).IsSameAs(key2)) return iRowIndex; } return -1; }
wxString CViewTransfers::GetKeyValue2(int iRowIndex) { CTransfer* transfer; if (GetTransferCacheAtIndex(transfer, 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], transfer->m_strProjectURL); } return transfer->m_strProjectURL; }
wxString CViewTransfers::GetKeyValue1(int iRowIndex) { CTransfer* transfer; if (GetTransferCacheAtIndex(transfer, m_iSortedIndexes[iRowIndex])) { return wxEmptyString; } if (m_iColumnIDToColumnIndex[COLUMN_FILE] < 0) { // Column is hidden, so SynchronizeCacheItem() did not set its value GetDocFileName(m_iSortedIndexes[iRowIndex], transfer->m_strFileName); } return transfer->m_strFileName; }
bool CViewTransfers::SynchronizeCacheItem(wxInt32 iRowIndex, wxInt32 iColumnIndex) { wxString strDocumentText = wxEmptyString; wxString strDocumentText2 = wxEmptyString; float fDocumentFloat = 0.0; double fDocumentDouble = 0.0, fDocumentDouble2 = 0.0; CTransfer* transfer; bool bNeedRefresh = false; strDocumentText.Empty(); if (GetTransferCacheAtIndex(transfer, m_iSortedIndexes[iRowIndex])) { return false; } switch(iColumnIndex) { case COLUMN_PROJECT: GetDocProjectName(m_iSortedIndexes[iRowIndex], strDocumentText); GetDocProjectURL(m_iSortedIndexes[iRowIndex], strDocumentText2); if (!strDocumentText.IsSameAs(transfer->m_strProjectName) || !strDocumentText2.IsSameAs(transfer->m_strProjectURL)) { transfer->m_strProjectName = strDocumentText; transfer->m_strProjectURL = strDocumentText2; bNeedRefresh = true; } break; case COLUMN_FILE: GetDocFileName(m_iSortedIndexes[iRowIndex], strDocumentText); if (!strDocumentText.IsSameAs(transfer->m_strFileName)) { transfer->m_strFileName = strDocumentText; bNeedRefresh = true; } break; case COLUMN_PROGRESS: GetDocProgress(m_iSortedIndexes[iRowIndex], fDocumentFloat); if (fDocumentFloat != transfer->m_fProgress) { transfer->m_fProgress = fDocumentFloat; FormatProgress(fDocumentFloat, transfer->m_strProgress); bNeedRefresh = true; } break; case COLUMN_SIZE: GetDocBytesXferred(m_iSortedIndexes[iRowIndex], fDocumentDouble); GetDocTotalBytes(m_iSortedIndexes[iRowIndex], fDocumentDouble2); if (( fDocumentDouble != transfer->m_fBytesXferred) || (fDocumentDouble2 != transfer->m_fTotalBytes) ) { transfer->m_fBytesXferred = fDocumentDouble; transfer->m_fTotalBytes = fDocumentDouble2; FormatSize(fDocumentDouble, fDocumentDouble2, transfer->m_strSize); bNeedRefresh = true; } break; case COLUMN_TIME: GetDocTime(m_iSortedIndexes[iRowIndex], fDocumentDouble); if (fDocumentDouble != transfer->m_dTime) { transfer->m_dTime = fDocumentDouble; FormatTime(fDocumentDouble, transfer->m_strTime); bNeedRefresh = true; } break; case COLUMN_SPEED: GetDocSpeed(m_iSortedIndexes[iRowIndex], fDocumentDouble); if (fDocumentDouble != transfer->m_dSpeed) { transfer->m_dSpeed = fDocumentDouble; FormatSpeed(fDocumentDouble, transfer->m_strSpeed); bNeedRefresh = true; } break; case COLUMN_STATUS: GetDocStatus(m_iSortedIndexes[iRowIndex], strDocumentText); if (!strDocumentText.IsSameAs(transfer->m_strStatus)) { transfer->m_strStatus = strDocumentText; return true; } break; } return bNeedRefresh; }