Ejemplo n.º 1
0
void 
CXRefreshToolbar::HandleError(const CString &errorMessage)
{
	CString message = LoadStringResource(IDS_ERROR_BASEMESSAGE);
	message += errorMessage;
	::MessageBox(NULL, message, LoadStringResource(IDS_TOOLBAR_NAME), MB_OK | MB_ICONERROR);
}
Ejemplo n.º 2
0
void CForceSyncDlg::OnOK() 
{
	m_WinPos.SaveWindowPosition();
	UpdateData( );
	if (m_Action == 1)
	{
		if (IDYES != AfxMessageBox(IDS_ASK_FORCE_RESYNC, MB_YESNO | MB_ICONQUESTION))
			return;
	}
	else
	{
		int index=m_ChangeCombo.GetCurSel();
		CString txt;
		m_ChangeCombo.GetLBText(index, txt);
		if(txt.Compare(LoadStringResource(IDS_DEFAULTCHANGELISTNAME)) == 0)
			m_SelectedChange= 0;
		else if(txt.Compare(LoadStringResource(IDS_NEWCHANGELISTNAME)) == 0)
		{
			m_SelectedChange= MainFrame()->CreateNewChangeList(m_Key);
			if (m_SelectedChange == -1)	// the user bailed
				return;
		}
		else
			m_SelectedChange=_ttol(txt);
	}
	CDialog::OnOK();
}
Ejemplo n.º 3
0
void CBookmarks::OnAddSubmenu() 
{
	if (m_NbrSubMenus < MAX_BOOKMARK_SUBMENUS)
	{
		CToolsAdd dlg;
		dlg.SetTitle(LoadStringResource(IDS_ADD_BOOKMARK_SUBMENU));
		dlg.SetRadioShow(3);
		if ((dlg.DoModal() == IDOK) && ((dlg.GetNewMenuName()).GetLength()))
		{
			UpdateData();
			CString txt = dlg.GetNewMenuName();
			if ((m_CurSel = m_MenuItemList.AddString(txt)) >= 0)
			{
				txt += LoadStringResource(IDS_A_SUBMENU);
				m_MenuItemList.DeleteString(m_CurSel);
				m_MenuItemList.InsertString(m_CurSel, txt);
				m_BkMkMenuName[m_CurSel] = dlg.GetNewMenuName();
				m_NbrSubMenus++;
				m_BkMkIsSubMenu[m_CurSel] = TRUE;
				if (m_CurSel < m_1stSubmenu)
					m_1stSubmenu = m_CurSel;
				UpdateData( FALSE );
				m_MenuItemList.SetCurSel(m_CurSel);
				if (m_CurSel >= MAX_BOOKMARKS-1)
					GetDlgItem(IDC_ADD)->EnableWindow(FALSE);
				GetDlgItem(IDC_CHANGE)->EnableWindow(TRUE);
				GetDlgItem(IDC_REMOVE)->EnableWindow(TRUE);
				GetDlgItem(IDC_EXPORT)->EnableWindow(TRUE);
				UpdateData( FALSE );
			}
		}
	}
}
Ejemplo n.º 4
0
void CBookmarks::OnChangeSubmenu() 
{
	if (m_CurSel == -1)
	{
		MessageBeep(0);
		return;
	}
	CToolsAdd dlg;
	dlg.SetTitle(LoadStringResource(IDS_EDIT_BOOKMARK_SUBMENU));
	dlg.SetNewMenuName(m_BkMkMenuName[m_CurSel]);
	dlg.SetIsSubMenu(TRUE);
	dlg.SetRadioShow(3);
	if ((m_NbrSubMenus < MAX_BOOKMARK_SUBMENUS) || m_BkMkIsSubMenu[m_CurSel])
		dlg.SetCanCr8SubMenu(TRUE);
	if ((dlg.DoModal() == IDOK) && ((dlg.GetNewMenuName()).GetLength()))
	{
		m_BkMkMenuName[m_CurSel] = dlg.GetNewMenuName();
		CString txt = dlg.GetNewMenuName() + LoadStringResource(IDS_A_SUBMENU);
		m_MenuItemList.DeleteString(m_CurSel);
		m_MenuItemList.InsertString(m_CurSel, txt);
		if (m_CurSel < m_1stSubmenu)
		{
			m_1stSubmenu = m_CurSel;
			LoadMenuItemList();
		}
		UpdateData( FALSE );
		m_MenuItemList.SetCurSel(m_CurSel);
	}
}
Ejemplo n.º 5
0
LRESULT CLabelListCtrl::OnDoLabelSync(WPARAM wParam, LPARAM lParam)
{
	BOOL preview = FALSE;
	if (wParam == IDOK)
	{
		preview = lParam;
		if (!preview)
			GET_P4REGPTR()->SetLabelAddRplDefault(m_AddReplaceDlg->m_DefaultFlag);
		if (m_AddReplaceList.GetCount())
		{
			CCmd_LabelSynch *pCmd= new CCmd_LabelSynch;
			pCmd->Init( m_hWnd, RUN_ASYNC);
			if( pCmd->Run( m_AddReplaceName, &m_AddReplaceList, preview, FALSE, 
							m_AddReplaceDlg->m_FilesFlag==2 ) )
				MainFrame()->UpdateStatus( LoadStringResource(IDS_SYNCING_LABEL) );	
			else
				delete pCmd;
		}
		else AddToStatus(LoadStringResource(IDS_NOTHING_SELECTED_NOTHING_TO_DO));
	}
	if (m_AddReplaceDlg && !preview)
	{
		m_AddReplaceDlg->DestroyWindow();	// deletes m_AddReplaceDlg
		m_AddReplaceDlg = 0;
		MainFrame()->SetModelessUp(FALSE);
	}
	return 0;
}
Ejemplo n.º 6
0
CString CClientListCtrl::SetCaption()
{
	int i = GET_P4REGPTR()->GetClientFilteredFlags();
	if (i)
    {
        CString filter;
		CString txt;

		if (i & 0x10)
			txt = LoadStringResource(IDS_CURRENT_USER);
		else if (i & 0x01)
			txt = GET_P4REGPTR()->GetClientFilterOwner();
		if (i & 0x22)
		{
			if (!txt.IsEmpty())
				txt += _T(", ");
			txt += i & 0x20 ? GET_P4REGPTR()->GetHostname() : GET_P4REGPTR()->GetClientFilterHost();
		}
		if (i & 0x04)
		{
			if (!txt.IsEmpty())
				txt += _T(", ");
			txt += CString(_T("\"")) + GET_P4REGPTR()->GetClientFilterDesc() + _T("\"");
		}
		filter.FormatMessage(IDS_FILTERED, txt);
		m_caption = LoadStringResource(IDS_PERFORCE_CLIENTS) + filter;
    }
	else
		m_caption = LoadStringResource(IDS_PERFORCE_CLIENTS);

	CP4PaneContent::GetView()->SetCaption();

	return m_caption;
}
Ejemplo n.º 7
0
void CLabelListCtrl::OnContextMenu(CWnd* pWnd, CPoint point) 
{
	//		make sure window is active
	//
	GetParentFrame()->ActivateFrame();

	// If one of the label modeless dialogs is up, don't display a context menu
	// instead set the focus to the modeless dialog.
	if (m_AddReplaceDlg)
	{
		m_AddReplaceDlg->SetFocus();
		return;
	}
	if (m_DelSyncDlg)
	{
		m_DelSyncDlg->SetFocus();
		return;
	}

	///////////////////////////////
	// See ContextMenuRules.txt for order of menu commands!

	//		create an empty context menu
	//
	CP4Menu popMenu;
	popMenu.CreatePopupMenu();

	int	index;
    SetIndexAndPoint( index, point );

	// Can always create new label
	popMenu.AppendMenu(MF_ENABLED | MF_STRING, ID_LABEL_NEW );

	if(index != -1)
	{
		// Make sure item is selected
		SetItemState(index, LVIS_SELECTED|LVIS_FOCUSED, LVIS_DROPHILITED|LVIS_SELECTED|LVIS_FOCUSED );

		popMenu.AppendMenu(MF_ENABLED | MF_STRING, ID_LABEL_EDIT_SPEC );
		popMenu.AppendMenu(MF_ENABLED | MF_STRING, ID_LABEL_DESCRIBE );
		popMenu.AppendMenu(MF_ENABLED | MF_STRING, ID_LABEL_DELETE );
		popMenu.AppendMenu(MF_ENABLED | MF_STRING, ID_LABEL_TEMPLATE );
		popMenu.AppendMenu(MF_SEPARATOR);
		popMenu.AppendMenu(MF_ENABLED | MF_STRING, ID_LABEL_LISTFILES );
		popMenu.AppendMenu(MF_ENABLED | MF_STRING, ID_LABEL_SYNC );
		popMenu.AppendMenu(MF_ENABLED | MF_STRING, ID_LABEL_DELETEFILES );
		popMenu.AppendMenu(MF_ENABLED | MF_STRING, ID_LABEL_SYNC_CLIENT );
		popMenu.AppendMenu(MF_ENABLED | MF_STRING, ID_LABEL_ADDTOLABELVIEW );
		popMenu.AppendMenu(MF_ENABLED | MF_STRING, ID_LABEL_DIFF2, LoadStringResource(IDS_LABEL_DIFF2) );
	}	

	popMenu.AppendMenu( MF_SEPARATOR );
	if(m_LabelFilterView.GetCount() > 0)
		popMenu.AppendMenu(MF_ENABLED | MF_STRING, ID_LABELFILTER_CLEARVIEW, LoadStringResource( IDS_CLEARFILTER ) );
	popMenu.AppendMenu(MF_ENABLED | MF_STRING, ID_VIEW_UPDATE, LoadStringResource(IDS_REFRESH) );
	
	MainFrame()->AddToolsToContextMenu(&popMenu);

	popMenu.TrackPopupMenu(TPM_LEFTALIGN | TPM_RIGHTBUTTON,	point.x, point.y, AfxGetMainWnd());
}
Ejemplo n.º 8
0
CUserListCtrl::CUserListCtrl()
{
    m_SortAscending=TRUE;
    m_viewType = P4USER_SPEC;
	m_OldDefUser = m_OldCurUser = _T("@");

    m_CF_DEPOT = static_cast<CLIPFORMAT>(RegisterClipboardFormat(LoadStringResource(IDS_DRAGFROMDEPOT)));
	m_CF_USER  = static_cast<CLIPFORMAT>(RegisterClipboardFormat(LoadStringResource(IDS_DRAGFROMUSER)));
	m_caption  = m_captionplain = LoadStringResource(IDS_PERFORCE_USERS);
}
Ejemplo n.º 9
0
void CViewerDlg::OnFindviewer() 
{
	// Fire up a common dlg to find new file
	CFileDialog fDlg(TRUE, LoadStringResource(IDS_VIEWERDLG_EXTENSION), NULL,  
		OFN_FILEMUSTEXIST | OFN_HIDEREADONLY | OFN_NONETWORKBUTTON | OFN_PATHMUSTEXIST,
		LoadStringResource(IDS_VIEWERDLG_FILTER), this,
		MainFrame()->m_osVer.dwMajorVersion < 5 ? OPENFILENAME_SIZE_VERSION_400 : sizeof(OPENFILENAME)); 

	if(fDlg.DoModal() == IDOK)
	{
		m_Viewer= fDlg.GetPathName();
		EndDialog(IDOK);
	}
}
Ejemplo n.º 10
0
CClientListCtrl::CClientListCtrl()
{
	m_SortAscending=TRUE;
	m_LastSortCol=0;
	m_OldClient = GET_P4REGPTR()->GetP4Client();
	m_ClientNew.Empty();
	m_NewClicked = m_NewClient = FALSE;
	m_viewType = P4CLIENT_SPEC;
	m_OldDefClient = m_OldCurClient = _T("@");
	m_PrevNbrCli = -1;

	m_CF_DEPOT = RegisterClipboardFormat(LoadStringResource(IDS_DRAGFROMDEPOT));
	m_CF_CLIENT= RegisterClipboardFormat(LoadStringResource(IDS_DRAGFROMCLIENT));
	m_caption =  m_captionplain = LoadStringResource(IDS_PERFORCE_CLIENTS);
}
Ejemplo n.º 11
0
BOOL CCmd_Delete::HandledCmdSpecificError(LPCTSTR errBuf, LPCTSTR errMsg)
{
	m_FatalError = TRUE;

    if( StrStr(errBuf, _T("use -f to force delete")))
	{
		CString m;
        m.FormatMessage(IDS_CANT_DELETE_PRIVELEGE_s, 
            CString(errBuf, StrStr(errBuf, _T("; use -f")) - errBuf ));
		TheApp()->StatusAdd( m, SV_ERROR);
		return m_FatalError;
	}

	if(StrStr(errBuf, _T("Can't delete client")) && StrStr(errBuf, _T("owned by")))
	{
		TheApp()->StatusAdd(LoadStringResource(IDS_CANT_DELETE_UNOWNED_CLIENT), SV_ERROR);
		return m_FatalError;
	}

	if(StrStr(errBuf, _T("Can't delete label")))
	{
		if(StrStr(errBuf, _T("owned by")))
			TheApp()->StatusAdd( LoadStringResource(IDS_CANT_DELETE_UNOWNED_LABEL), SV_ERROR);
		else
			TheApp()->StatusAdd(errMsg, SV_ERROR );
		return m_FatalError;
	}

	if(StrStr(errBuf, _T("Can't delete branch")))
	{
		if(StrStr(errBuf, _T("owned by")))
			TheApp()->StatusAdd( LoadStringResource(IDS_CANT_DELETE_UNOWNED_BRANCH), SV_ERROR);
		else
			TheApp()->StatusAdd(errMsg, SV_ERROR);
		return m_FatalError;
	}

	if (( StrStr(errBuf, _T("don't have permission"))) 
	 || ( StrStr(errBuf, _T("is locked and can't be deleted"))))

	{
		TheApp()->StatusAdd( errMsg, SV_ERROR );
		return m_FatalError;
	}

	m_FatalError = FALSE;
	return m_FatalError;
}
Ejemplo n.º 12
0
BOOL CCmd_SendSpec::HandledCmdSpecificError(LPCTSTR errBuf, LPCTSTR errMsg)
{
    m_ErrorTxt.Empty();

    // Omit message about line number, if present
    CString omit= _T("\nError detected at line");

    LPCTSTR pStartOmit= StrStr(errMsg, omit);

    if( pStartOmit )
    {
        LPCTSTR pEndOmit = StrChr(pStartOmit+1, _T('\n'));

        if( pEndOmit )
            m_ErrorTxt = CString(errMsg).Left(pStartOmit - errMsg) + pEndOmit;
    }
    else
        m_ErrorTxt = errMsg;

	if (StrStr(errBuf, _T("You cannot use the default branch view;")))
		m_ErrorTxt += LoadStringResource(IDS_YOUMUSTCHANGETHEVIEW);

    // replace message about submit failure, if present
    int startSubmit = m_ErrorTxt.Find(_T("Submit failed"));
    if(startSubmit > -1)
	{
		m_ErrorTxt = m_ErrorTxt.Left(startSubmit)
            + LoadStringResource(IDS_SUBMIT_FAILED_CORRECT_AND_RESUBMIT);
	}
	else if ((errBuf != errMsg) && StrStr(errBuf, _T("Submit failed")))
	{
		m_ErrorTxt.TrimRight();
		startSubmit = m_ErrorTxt.ReverseFind(_T('\n'));
		if(startSubmit > -1)
		{
			m_ErrorTxt = m_ErrorTxt.Left(startSubmit+1)
				+ LoadStringResource(IDS_SUBMIT_FAILED_CORRECT_AND_RESUBMIT);
		}
		m_ErrorTxt += _T("\n");
	}

    // Put the error into the status bar.  Let the UI thread pop the
	// error dialog so there isnt a window on-topness problem
	TheApp()->StatusAdd( m_ErrorTxt, SV_WARNING );

	m_FatalError= TRUE;
	return TRUE;
}
Ejemplo n.º 13
0
BOOL CClientListCtrl::AutoCreateClientSpec(LPCTSTR clientName, LPCTSTR clientRoot, 
										   BOOL bEdit, BOOL bTmpl, LPCTSTR tmplate)
{
	m_pNewSpec= new CP4Client;

	CCmd_EditSpec *pCmd= new CCmd_EditSpec;
	pCmd->Init(m_hWnd, RUN_ASYNC, HOLD_LOCK);
	if (bTmpl && !(CString(GET_P4REGPTR()->GetLocalCliTemplate()).IsEmpty())
	 && CString(tmplate) == CString(LOCALDEFTEMPLATE))
	{
		pCmd->SetUseLocalDefTmplate(TRUE);
		bTmpl = FALSE;
		bEdit = TRUE;
	}
	else
		pCmd->SetNewClientRoot(clientRoot);
	pCmd->SetAutoUpdateSpec(bEdit ? FALSE : TRUE);
	BOOL b;
	if (bTmpl)
		b = pCmd->Run( P4CLIENT_SPEC, clientName, tmplate, m_pNewSpec );
	else
		b = pCmd->Run( P4CLIENT_SPEC, clientName, m_pNewSpec );
	if( b )
	{
		MainFrame()->UpdateStatus( LoadStringResource(IDS_EDITING_CLIENT_SPEC) ) ;
		return TRUE;
	}
	delete pCmd;
	delete m_pNewSpec;
	return FALSE;
}
Ejemplo n.º 14
0
LRESULT CForceSyncDlg::OnP4Diff(WPARAM wParam, LPARAM lParam)
{
	CCmd_Diff *pCmd= (CCmd_Diff *) wParam;
    
	if(!pCmd->GetError())
	{
		int cnt;
		if ((cnt = pCmd->GetDiffRunCount()) == 0)
		{
			if (pCmd->GetDiffNbrFiles() == 1)
            {
                CString msg;
                msg.FormatMessage(IDS_CLIENT_FILE_s_DOES_NOT_DIFFER_FROM_DEPOT_FILE,
						pCmd->GetDiffFileName());
				AddToStatus(msg, SV_COMPLETION);
            }
			else if (pCmd->GetDiffErrCount() == 0)
				AddToStatus(LoadStringResource(IDS_NONE_OF_THE_SELECTED_CLIENT_FILES_DIFFER), SV_COMPLETION);
		}
		else if (cnt < pCmd->GetDiffNbrFiles())
		{
			CString txt;
			int i = pCmd->GetDiffNbrFiles() - cnt;
            if(i == 1)
                txt.FormatMessage(IDS_ONECLIENTFILEDOESNOTDIFFER);
            else
                txt.FormatMessage(IDS_SEVERALCLIENTFILESDONOTDIFFER_n, i);
			AddToStatus(txt, SV_COMPLETION);
		}
	}
    
	delete pCmd;
	MainFrame()->ClearStatus();
	return 0;
}
Ejemplo n.º 15
0
void CP4ListBrowse::OnDescribe( void )
{
    int nItem=m_P4ListCtrl.GetNextItem( -1, LVNI_ALL | LVNI_SELECTED );
    if (nItem != -1)
    {
        TCHAR str[ LISTVIEWNAMEBUFSIZE + 1 ];
        ListView_GetItemText( m_P4ListCtrl.m_hWnd, nItem, 0, str, LISTVIEWNAMEBUFSIZE );
        m_SelectedP4Object = str;
        if ( m_SelectedP4Object.IsEmpty( ) )
            return;
    }
    else
        return;

    CCmd_Describe *pCmd = new CCmd_Describe;
    pCmd->Init( m_pParent->m_hWnd, RUN_ASYNC );
    pCmd->SetCaller(this);
    pCmd->SetListCtrl(&m_P4ListCtrl);
    if( pCmd->Run( m_viewType, m_SelectedP4Object ) )
    {
        MainFrame()->UpdateStatus( LoadStringResource(IDS_FETCHING_SPEC) );
        return;
    }
    else
    {
        delete pCmd;
        return;
    }
}
Ejemplo n.º 16
0
BOOL CCmd_Fstat::HandledCmdSpecificError(LPCTSTR errBuf, LPCTSTR errMsg)
{
    if ((StrStr(errBuf, _T(" - file(s) not in client view")))
	 ||	(StrStr(errBuf, _T(" - protected namespace - access denied")))
	 || (m_bWorking && StrStr(errBuf, _T(" - file(s) not opened on this client"))))
	{
        return TRUE;
	}
    else if ((GET_P4REGPTR( )->ShowEntireDepot( ) > SDF_DEPOT)
		  && (StrStr(errBuf, _T(" - no mappings in client view"))))
	{
		m_ErrorList.AddHead(errBuf);
        return TRUE;
	}
	else if ( StrStr(errBuf, _T("no such file") )  )
	{
		TheApp()->StatusAdd( LoadStringResource(IDS_NO_FILES_UNDER_FOLDER), SV_DEBUG );  
		return TRUE ; 
	}
	else if ( StrStr(errBuf, _T(" database access failed.") )  )
	{
		m_FatalError = TRUE;
		return FALSE;
	}

	return StrStr(errBuf, _T("up-to-date.") ) != 0;
}
Ejemplo n.º 17
0
void CLabelListCtrl::OnLabelFilterClear() 
{
	ClearLabelFilter();
    m_caption = LoadStringResource(!m_FilterOwnerFlag 
			  ? IDS_PERFORCE_LABELS : IDS_PERFORCE_FILTERED_LABELS_BY_OWNER);
	OnViewReloadall();
}
Ejemplo n.º 18
0
void CLabelListCtrl::OnLabelTemplate()
{
	if( SERVER_BUSY() || m_Active.IsEmpty() || m_EditInProgress || GET_SERVERLEVEL() < 6)
		return;
	
	CStringList list;
    m_Active= GetSelectedItemText();
	list.AddHead( m_Active );

    // Prompt for the new label name
    CTemplateNameDlg dlg;
    dlg.SetTemplateName( m_Active );
    dlg.SetVerbotenSpecNames(&list);
    dlg.SetNewSpecName(_T(""));
	dlg.SetSpecType( P4LABEL_SPEC );

    if(dlg.DoModal() != IDCANCEL)
    {
        CString newName=dlg.GetNewSpecName();
		
		// Let OnP4LabelSpec() determine if this is a new label
		m_NewLabel=TRUE;
		
		m_pNewSpec= new CP4Label;
		CCmd_EditSpec *pCmd= new CCmd_EditSpec;
		pCmd->Init( m_hWnd, RUN_ASYNC, HOLD_LOCK);
		if( pCmd->Run( P4LABEL_SPEC, newName, m_Active, m_pNewSpec ) )
			MainFrame()->UpdateStatus( LoadStringResource(IDS_EDITING_LABEL_SPEC) );	
		else
		{
			delete pCmd;
			delete m_pNewSpec;
		}
	}
}
Ejemplo n.º 19
0
void CNewWindowDlg::OnBrowseClients()
{
	if (m_bSamePort)
	{
		::SendMessage(MainFrame()->ClientWnd(), WM_FETCHOBJECTLIST, 
						(WPARAM)(this->m_hWnd), WM_BROWSECALLBACK1);
	}
	else if (EditPort())
	{
		CString old_port = GET_P4REGPTR()->GetP4Port();
		CString old_user = GET_P4REGPTR()->GetP4User();
		UpdateData(TRUE);
		GET_P4REGPTR()->SetP4Port(m_port, TRUE, FALSE, FALSE);
		GET_P4REGPTR()->SetP4User(m_user, TRUE, FALSE, FALSE);
		CCmd_Clients *pCmd= new CCmd_Clients;
		pCmd->Init( m_hWnd, RUN_ASYNC );
		if( pCmd->Run( ) )
			MainFrame()->UpdateStatus( LoadStringResource(IDS_REQUESTING_CLIENT_LISTING) );
		else
			delete pCmd;
		SET_BUSYCURSOR();
		do
		{
			if ( !MainFrame()->PumpMessages( ) )
				break;
			Sleep(100);
		} while (SERVER_BUSY());
		GET_P4REGPTR()->SetP4Port(old_port, TRUE, FALSE, FALSE);
		GET_P4REGPTR()->SetP4User(old_user, TRUE, FALSE, FALSE);
	}
}
Ejemplo n.º 20
0
void CNewWindowDlg::OnBrowseUsers()
{
	if (m_bSamePort)
	{
		::SendMessage(MainFrame()->UserWnd(), WM_FETCHOBJECTLIST, 
						(WPARAM)(this->m_hWnd), WM_BROWSECALLBACK2);
	}
	else if (EditPort())
	{
		CString old_port = GET_P4REGPTR()->GetP4Port();
		CString old_user = GET_P4REGPTR()->GetP4User();
		GET_P4REGPTR()->SetP4Port(m_port, TRUE, FALSE, FALSE);
		GET_P4REGPTR()->SetP4User(_T(""), TRUE, FALSE, FALSE);
		CCmd_Users *pCmd= new CCmd_Users;
		pCmd->Init( m_hWnd, RUN_ASYNC );
		if( pCmd->Run( ) )
			MainFrame()->UpdateStatus( LoadStringResource(IDS_REQUESTING_USER_LISTING) );
		else
			delete pCmd;
		SET_BUSYCURSOR();
		int i = 0;
		do
		{
			Sleep(200);
		} while (SERVER_BUSY() && ++i < 10);
		GET_P4REGPTR()->SetP4Port(old_port, TRUE, FALSE, FALSE);
		GET_P4REGPTR()->SetP4User(old_user, TRUE, FALSE, FALSE);
	}
}
Ejemplo n.º 21
0
void CLabelListCtrl::OnViewUpdate() 
{
	m_Active = GetSelectedItemText();
	CCmd_Labels *pCmd= new CCmd_Labels;
	pCmd->Init( m_hWnd, RUN_ASYNC);

	if (GET_SERVERLEVEL() >= 11)
	{
		// Make a copy of the filter view, because CCmd_Labels will
		// destroy that copy
		POSITION pos=m_LabelFilterView.GetHeadPosition();
		m_StrList.RemoveAll();
		while(pos != NULL)
			m_StrList.AddTail(m_LabelFilterView.GetNext(pos));
	}
	else if (m_LabelFilterView.GetCount())
	{
        OnLabelFilterClear();
		return;
	}

	if( pCmd->Run( &m_StrList ) )
	{
		MainFrame()->UpdateStatus( LoadStringResource(IDS_REQUESTING_LABEL_LISTING) );
		MainFrame()->SetLabelUpdateTime(GetTickCount());
		Clear();		
		CP4ListCtrl::OnViewUpdate();
	}
	else
		delete pCmd;
}
Ejemplo n.º 22
0
void CLabelListCtrl::OnLabelListfiles() 
{
	m_Active = GetSelectedItemText();
	m_LabelFileCount=0;
	m_LabelFiles.Empty();
	m_LabelFilesInDialog = GET_P4REGPTR()->LabelFilesInDialog( );

	CString spec;
	spec.Format(_T("//...@%s"), m_Active);

	// Call Fstat, w/ suppress==FALSE
	CCmd_Fstat *pCmd= new CCmd_Fstat;
	pCmd->Init( m_hWnd, RUN_ASYNC, LOSE_LOCK);

	//		okay, this is weird, but let's set show entire depot
	//		to true, since we want this command to 
	//		read 'p4 fstat //...@mynumber WITHOUT the -C
	//		that would run otherwise. 
	//		after all, we all the files to show, not just
	//		the ones on the client view.
	//
	BOOL bshowEntireDepot = TRUE;
	if( pCmd->Run( FALSE, spec, bshowEntireDepot, 0 ) )
	{
		MainFrame()->UpdateStatus( LoadStringResource(IDS_REQUESTING_LABEL_CONTENTS) );
	}
	else
	{
		delete pCmd;
		MainFrame()->ClearStatus();
	}
}
Ejemplo n.º 23
0
void CLabelListCtrl::OnLabelDeletefiles() 
{
	if (MainFrame()->IsModlessUp())
		return;

	m_Active = GetSelectedItemText();
	m_LabelFileCount=0;
	m_LabelFiles.Empty();

	m_DelSyncDlg = new CLabelDelSync(this);
	if (!m_DelSyncDlg)
	{
		ASSERT(0);
		AfxMessageBox(IDS_COULD_NOT_CREATE_LABEL_DIALOG_BOX, MB_ICONSTOP);
		return;
	}
	MainFrame()->SetModelessUp(TRUE);

	m_DelSyncDlg->SetActive(m_DelSyncName = m_Active);
	CString caption;
	caption.FormatMessage(IDS_DELETE_FILES_FROM_LIST_IN_LABEL_s, m_Active);
	m_DelSyncDlg->SetCaption( caption );
	m_DelSyncDlg->SetBtnText( LoadStringResource(IDS_DELETE_CHECKED_FILES_FROM_LIST_IN_LABEL) );
	MainFrame()->AssembleDepotStringList(&m_StringList, TRUE);
	m_DelSyncDlg->SetSelected(&m_StringList);
	m_DelSyncDlg->SetOutputList(&m_DelSyncList);
	m_DelSyncDlg->SetReturnMsg(WM_DOLABELDELFILES);
	if (!m_DelSyncDlg->Create(IDD_LABEL_DEL_SYNC, this))	// display the remove files from label dialog
	{
		delete m_DelSyncDlg;
		MainFrame()->SetModelessUp(FALSE);
	}
}
Ejemplo n.º 24
0
void CLabelListCtrl::OnClearFilterByOwner()
{
	GET_P4REGPTR()->SetLabelFilterByOwnerFlag(m_FilterOwnerFlag = 0);
    m_caption = LoadStringResource(m_LabelFilterView.IsEmpty() 
			  ? IDS_PERFORCE_LABELS : IDS_PERFORCE_FILTERED_LABELS);
	OnViewReloadall();
}
Ejemplo n.º 25
0
void CLabelListCtrl::OnLabelFilterSetviewRev()
{
    if( !SERVER_BUSY() && (GET_SERVERLEVEL() >= 11))
    {
	    ::SendMessage(m_depotWnd, WM_GETSELLIST, (WPARAM) &m_LabelFilterView, 0);
	    if(m_LabelFilterView.GetCount() > 0)
		{
			// make a temp copy of the selection strings
			CStringList tempList;
			POSITION pos=m_LabelFilterView.GetHeadPosition();
			while(pos != NULL)
				tempList.AddTail(m_LabelFilterView.GetNext(pos));
			// now copy the selection back to m_LabelFilterView
			// and add #have,have to the end to filter on just the current rev
			m_LabelFilterView.RemoveAll();
			pos=tempList.GetHeadPosition();
			while(pos != NULL)
			{
				CString str = tempList.GetNext(pos) + _T("#have,have");
				m_LabelFilterView.AddTail(str);
			}
			m_caption = LoadStringResource(!m_FilterOwnerFlag 
					  ? IDS_PERFORCE_FILTERED_LABELS : IDS_PERFORCE_FILTERED_LABELS_BY_BOTH);
		}
	    OnViewReloadall();	
    }
}
Ejemplo n.º 26
0
void CBookmarks::OnChangeBkMkItem() 
{
	int i, k;

	if (m_CurSel == -1)
	{
		MessageBeep(0);
		return;
	}
	CBookMarkAdd dlg;
	dlg.SetTitle(LoadStringResource(IDS_EDIT_BOOKMARK));
	dlg.SetLabelText(LoadStringResource(IDS_PATH));
	CString txt = m_BkMkMenuName[m_CurSel];
	if ((k = txt.Find(_T('\t'))) != -1)
		txt.SetAt(k, _T('#'));
	dlg.SetNewMenuName(txt);
	dlg.SetIsSubMenu(FALSE);
	dlg.SetRadioShow(3);
	dlg.SetCanCr8SubMenu(FALSE);
	if ((dlg.DoModal() == IDOK) && ((dlg.GetNewMenuName()).GetLength()))
	{
		m_BkMkMenuName[m_CurSel] = dlg.GetNewMenuName();
		txt = dlg.GetNewMenuName();
		if ((k = txt.Find(_T('#'))) != -1)
			txt.SetAt(k, _T('\t'));
		if (m_CurSel > m_1stSubmenu)
			txt = _T("    ") + txt;
		m_MenuItemList.DeleteString(m_CurSel);
		m_MenuItemList.InsertString(m_CurSel, txt);
		if (m_1stSubmenu == m_CurSel)
		{
			m_1stSubmenu = MAX_BOOKMARKS+1;
			for (i = m_CurSel; ++i < MAX_BOOKMARKS; )
			{
				if (m_BkMkIsSubMenu[i])
				{
					m_1stSubmenu = i;
					break;
				}
			}
			LoadMenuItemList();
		}
		UpdateData( FALSE );
		m_MenuItemList.SetCurSel(m_CurSel);
	}
}
Ejemplo n.º 27
0
int CUserListCtrl::OnCreate(LPCREATESTRUCT lpCreateStruct) 
{
	if (CP4ListCtrl::OnCreate(lpCreateStruct) == -1)
		return -1;
	
	CStringArray colnames;
	colnames.Add ( LoadStringResource(IDS_NAME) );
	colnames.Add ( LoadStringResource(IDS_E_MAIL) );
	colnames.Add ( LoadStringResource(IDS_FULL_NAME) );
	colnames.Add ( LoadStringResource(IDS_ACCESS) );
	ASSERT( USER_MAXCOL == colnames.GetSize( ) );
	int width[ USER_MAXCOL ]={90,150,150,90};
	RestoreSavedWidths( width, colnames.GetSize( ), sRegValue_UserList );
	InsertColumnHeaders( colnames, width );

	return 0;
}
Ejemplo n.º 28
0
void CLabelListCtrl::ClearLabelFilter()
{
	Clear();
	m_LabelFilterView.RemoveAll(); 
	m_caption = LoadStringResource(!m_FilterOwnerFlag 
			  ? IDS_PERFORCE_LABELS : IDS_PERFORCE_FILTERED_LABELS_BY_OWNER);
	CP4PaneContent::GetView()->SetCaption();
}
Ejemplo n.º 29
0
void CClientListCtrl::OnEditTemplate( LPCTSTR templateName )
{
    // Get a list of all clients, so the dialog can check
    // for a bungle like trying to create a client that
    // already exists
    CStringList list;
    int index=-1;
	m_NewClicked=m_NewClient=FALSE;
	if( GET_SERVERLEVEL() >= 6 )
		list.AddHead( templateName );
	else
	{
		while(1)
		{
			index=GetNextItem(index, LVNI_ALL);
			if( index == -1)
				break;

			TCHAR str[ 1024 ];
			GetItemText(index, 0, str, 1024 );
			list.AddHead(str);
		}
    }

    // Prompt for the new client name, using p4client as a
    // default value
    CTemplateNameDlg dlg;
    dlg.SetTemplateName(templateName);
    dlg.SetVerbotenSpecNames(&list);
    dlg.SetNewSpecName(GET_P4REGPTR()->GetP4Client( ));
	dlg.SetSpecType( P4CLIENT_SPEC );

    if(dlg.DoModal() != IDCANCEL)
    {
		CString saveActive = m_Active;
        m_Active = dlg.GetNewSpecName();	//set and switch to new client
		if (SetP4Client( TRUE ))
		{
			m_pNewSpec= new CP4Client;
			CCmd_EditSpec *pCmd= new CCmd_EditSpec;
			pCmd->Init( m_hWnd, RUN_ASYNC, HOLD_LOCK);
			if( pCmd->Run( P4CLIENT_SPEC, m_Active, templateName, m_pNewSpec ) )
			{
				MainFrame()->UpdateStatus( LoadStringResource(IDS_EDITING_CLIENT_SPEC) ) ;
				m_NewClicked = m_NewClient = TRUE;
				m_ClientNew = m_Active;
			}
			else
			{
				delete pCmd;
				delete m_pNewSpec;
				m_Active = saveActive;
				SetP4Client( TRUE );
			}
		}
    }
}
Ejemplo n.º 30
0
int CUserListCtrl::OnUserPasswordDlg(BOOL bLogin, int key) 
{
	CSetPwdDlg dlg;
	dlg.m_bLogin = bLogin;
	dlg.m_Key = key;
	if (bLogin)
		dlg.m_Caption = LoadStringResource(IDS_MUST_SET_PASSWORD);
	return dlg.DoModal();
}