Example #1
0
CSubFormCollection::~CSubFormCollection()
{
    // Free all sub forms on destruction
    for (int i = 0; i <=  m_Forms.GetUpperBound(); i++) {
        CDialog* pDlg = m_Forms.GetAt(i);
        pDlg->DestroyWindow();
        delete pDlg;
    }
}
Example #2
0
LRESULT CLabelListCtrl::OnP4EndSpecEdit( WPARAM wParam, LPARAM lParam )
{
	CCmd_EditSpec *pCmd= (CCmd_EditSpec *) wParam;
	int index;

	if (lParam != IDCANCEL && lParam != IDABORT)
	{
		if (m_UpdateState == LIST_UPDATED)
		{
			if(m_NewLabel && FindInList(m_pNewSpec->GetLabelName()) == -1)
			{
				InsertLabel(m_pNewSpec, GetItemCount());
				ReSort();
				index= FindInList(m_pNewSpec->GetLabelName());
			}
			else
			{
				index= FindInList(m_pNewSpec->GetLabelName());
				UpdateLabel(m_pNewSpec, index);
			}
			EnsureVisible(index, TRUE );
			SetItemState(index, LVIS_SELECTED|LVIS_FOCUSED, LVIS_DROPHILITED|LVIS_SELECTED|LVIS_FOCUSED );
		}
		else
			if ( m_pNewSpec ) delete m_pNewSpec;
	}
	else
		if ( m_pNewSpec ) delete m_pNewSpec;

	if (lParam != IDABORT)
	{
		MainFrame()->ClearStatus();
		if (pCmd->HaveServerLock())
			pCmd->ReleaseServerLock();
		CDialog *dlg = (CDialog *)pCmd->GetSpecSheet();
		dlg->DestroyWindow();
	}
	delete pCmd;
	m_EditInProgress = FALSE;
	return 0;
}
Example #3
0
LRESULT CUserListCtrl::OnP4EndSpecEdit( WPARAM wParam, LPARAM lParam )
{
	CCmd_EditSpec *pCmd= (CCmd_EditSpec *) wParam;
	int i, j;

	if (lParam != IDCANCEL && lParam != IDABORT)
	{
		if (m_UpdateState == LIST_UPDATED)
		{
			// we have to set 'index' again in case user's name got changed
			int index = FindInList(m_pNewSpec->GetUserName());
			if(index > -1 )
				UpdateUser(m_pNewSpec, index);
			else
			{
				InsertUser(m_pNewSpec, GetItemCount());
				ReSort();

				if( m_Active != m_olduser )
				{
					if (GET_P4REGPTR()->GetExpandFlag() == 1)
						GET_P4REGPTR()->AddMRUPcuPath(MainFrame()->GetCurrentItemPath());
					m_Active = m_olduser;
					GET_P4REGPTR()->SetP4User( m_olduser, TRUE, FALSE, FALSE );
					MainFrame()->UpdateCaption( ) ;	
				}
			}
		}
		else
			if ( m_pNewSpec ) delete m_pNewSpec;

	    CString specOut(pCmd->GetSpecOut());
		if ((i = specOut.Find(_T("\n\nJobView:\t"))) != -1)
		{
			i += lstrlen(_T("\n\nJobView:\n"));
			if ((j = specOut.Find(_T('\n'),i)) != -1)
			{
				// if JobView has changed, we have to refresh the changelists (and depot)
				if (m_oldJobView != specOut.Mid(i, j-i))
					MainFrame()->UpdateDepotandChangeViews(TRUE);
			}
		}
	}
	else
		if ( m_pNewSpec ) delete m_pNewSpec;

	if (lParam != IDABORT)
	{
		MainFrame()->ClearStatus();
		if (pCmd->HaveServerLock())
			pCmd->ReleaseServerLock();
		CDialog *dlg = (CDialog *)pCmd->GetSpecSheet();
		dlg->DestroyWindow();
	}

	if ((lParam == IDCANCEL) && pCmd->GetIsNewUser())	// if canceled, cleanup newly created user
	{
		m_Active = pCmd->GetItemName();
		CString msg;
		msg.FormatMessage ( IDS_DELETENEWUSER_s, m_Active );
		// ask if they want to delete the newly created user
		if( AfxMessageBox( msg, MB_YESNO|MB_ICONQUESTION ) == IDYES)
		{
			// fire off the delete of the newly created user
			CCmd_Delete *pCmdDel = new CCmd_Delete;
			pCmdDel->Init( m_hWnd, RUN_ASYNC );
			pCmdDel->SetSwitch2User( m_olduser );
			if( pCmdDel->Run( P4USER_DEL, m_Active ) )
				MainFrame()->UpdateStatus( LoadStringResource(IDS_DELETING) );
			else
				delete pCmdDel;
		}
		else
		{
			OnViewUpdate();
		}
	}

	delete pCmd;
	m_EditInProgress = FALSE;
	return 0;
}
Example #4
0
LRESULT CClientListCtrl::OnP4EndSpecEdit( WPARAM wParam, LPARAM lParam )
{
	CCmd_EditSpec *pCmd= (CCmd_EditSpec *) wParam;
	BOOL chainedCommand = FALSE;
	BOOL need2Refresh = FALSE;

	if (lParam != IDCANCEL && lParam != IDABORT)
	{
		// Get the Sync flag
		int syncAfter = SYNC_DONT;
		BOOL bHasChgs = TRUE;
		if (m_PrevNbrCli < 1)
		{
			int key= pCmd->HaveServerLock() ? pCmd->GetServerKey() : 0;
			CCmd_Changes *pCmd2= new CCmd_Changes;
			pCmd2->Init( m_hWnd, RUN_SYNC, key ? HOLD_LOCK : LOSE_LOCK, key);
			if( pCmd2->Run(SUBMITTED_CHANGES, FALSE, NULL, 1) )
			{
				if (!pCmd2->GetChanges()->GetCount())
					bHasChgs = FALSE;
			}
			delete pCmd2;
		}
		if (m_isNew && !GET_P4REGPTR()->DontShowYouHaveCr8NewClient() && bHasChgs)
		{
			BOOL b;
			switch(MsgBox(IDS_YOU_HAVE_CREATED_NEW_CLIENT,
						MB_ICONEXCLAMATION | MB_DEFBUTTON1, 0, this, &b))
			{
			case IDC_BUTTON1:
				syncAfter = SYNC_HEAD;
				break;
			case IDC_BUTTON2:
				syncAfter = SYNC_DONT;
				break;
			}
			GET_P4REGPTR()->SetDontShowYouHaveCr8NewClient(b);
		}
		else if ((pCmd->IsSyncAfter() || pCmd->IsAutoUpdateSpec())
			  && !GET_P4REGPTR()->DontShowYouHaveChgClientView() && bHasChgs)
		{
			BOOL b;
			switch(MsgBox(pCmd->IsAutoUpdateSpec() ? IDS_DOYOUWANTOTSYNCYOURNEWCLIENT 
												   : IDS_YOU_HAVE_CHANGED_CLIENTS_VIEW,
												   MB_ICONQUESTION | MB_DEFBUTTON1, 0, this, 
												   pCmd->IsAutoUpdateSpec() ? NULL : &b))
			{
			case IDC_BUTTON1:
				syncAfter = SYNC_HEAD;
				break;
			case IDC_BUTTON2:
				syncAfter = pCmd->IsAutoUpdateSpec() ? SYNC_DONT : SYNC_HAVE;
				break;
			case IDC_BUTTON3:
				syncAfter = SYNC_DONT;
				break;
			}
			if (!pCmd->IsAutoUpdateSpec())
				GET_P4REGPTR()->SetDontShowYouHaveChgClientView(b);
		}

		BOOL bDeld = FALSE;
		if (m_UpdateState == LIST_UPDATED)
		{
			// we have to set 'index' again in case client's name got changed
			int index= FindInList(m_pNewSpec->GetClientName());
			int ixAll= FindInListAll(m_pNewSpec->GetClientName());
			if (ixAll == -1)	// not in either list
			{
				ASSERT(index == -1);
				CString curclient = GET_P4REGPTR()->GetP4Client();
				CString defclient = GET_P4REGPTR()->GetP4Client(TRUE);
				InsertClient(m_pNewSpec, GetItemCount(), &curclient, &defclient);
			}
			else if (index > -1)	// in both lists
			{
				ASSERT(ixAll > -1);
				if (MainFrame()->IsClientFilteredOut(m_pNewSpec))	// should it no longer be shown?
				{
					need2Refresh = TRUE;
					delete m_pNewSpec;
				}
				else
				{
					UpdateClient(m_pNewSpec, index);
					UpdateClientAll(m_pNewSpec, ixAll);
				}
			}
			else	// not in visible list; is in list of all
			{
				if (MainFrame()->IsClientFilteredOut(m_pNewSpec))	// should it now be shown?
					need2Refresh = TRUE;
				else
					UpdateClientAll(m_pNewSpec, ixAll);
				if (pCmd->IsAutoUpdateSpec())
					m_OldClient = m_pNewSpec->GetClientName();
				delete m_pNewSpec;
				bDeld = TRUE;
			}
			ReSort();
			if (pCmd->IsAutoUpdateSpec() || pCmd->IsSpecForceSwitch())
			{
				if (bDeld)
					need2Refresh = TRUE;
				else
				{
					int i = FindInList(m_OldClient = m_pNewSpec->GetClientName());
					if (i < 0)	
						i = 0;
					SetItemState(i, LVIS_SELECTED|LVIS_FOCUSED, LVIS_SELECTED|LVIS_FOCUSED);
					EnsureVisible(i, FALSE);
				}
				m_Active = _T("@");			// force switch to new client
			}
		}
		else
			if ( m_pNewSpec ) delete m_pNewSpec;

		int key= pCmd->HaveServerLock() ? pCmd->GetServerKey() : 0;
		if( m_Active == m_saveclientnew )	// active-client == saved new client name
			m_OldClient = m_saveclientnew;	//   means they decided to edit the current client
		if( m_Active != m_OldClient )		// If current client is not now the client when this
		{									//   all started, switch to the new current client
			if (GET_P4REGPTR()->GetExpandFlag() == 1)
				GET_P4REGPTR()->AddMRUPcuPath(MainFrame()->GetCurrentItemPath());
			m_Active = m_OldClient;
			GET_P4REGPTR()->SetP4Client( m_Active, TRUE, FALSE, FALSE);
			MainFrame()->UpdateCaption( );
			if (syncAfter)
				chainedCommand = SyncAfter(key, syncAfter);
        }
		else if( syncAfter || GET_P4REGPTR()->GetClearAndReload()
				|| AfxMessageBox(IDS_YOU_HAVE_UPDATED_YOUR_CLIENT_WORKSPACE__CLEAR_AND_RELOAD, 
								MB_YESNO |MB_ICONQUESTION ) == IDYES )
		{
			if (syncAfter)
				chainedCommand = SyncAfter(key, syncAfter);
			else
			{
				int key= pCmd->HaveServerLock() ? pCmd->GetServerKey() : 0;
				MainFrame()->UpdateDepotandChangeViews(REDRILL, key);
				chainedCommand=TRUE;
			}
		}
		if (GET_SERVERLEVEL() >= 22)
			TheApp()->Set_m_ClientSubOpts(TheApp()->GetClientSpecField( _T("SubmitOptions"), pCmd->GetSpecOut()));
    }
	else
	{
		if ( m_pNewSpec )
			delete m_pNewSpec;
		if (lParam == IDCANCEL && pCmd->GetIsRequestingNew())
		{
			m_Active = pCmd->GetOldClient();	// switch back to the previous client
			GET_P4REGPTR()->SetP4Client( m_Active, TRUE, FALSE, FALSE);
			MainFrame()->UpdateCaption( );
		}
	}

	if (lParam != IDABORT)
	{
		MainFrame()->ClearStatus();
		if (!chainedCommand && pCmd->HaveServerLock())
			pCmd->ReleaseServerLock();
		CDialog *dlg = (CDialog *)pCmd->GetSpecSheet();
		dlg->DestroyWindow();
	}
	delete pCmd;
	m_EditInProgress = FALSE;

	if (need2Refresh && !chainedCommand)
		OnViewUpdate();

	if (TheApp()->m_RunClientWizOnly && !chainedCommand)
		::PostMessage(MainFrame()->m_hWnd, WM_COMMAND, ID_APP_EXIT, 0);
	return 0;
}