Exemplo n.º 1
1
void CCheckForUpdatesDlg::FillChangelog(CAutoConfig& versioncheck, bool official)
{
	ProjectProperties pp;
	pp.lProjectLanguage = -1;
	if (versioncheck.GetString(_T("tortoisegit.issuesurl"), pp.sUrl))
		pp.sUrl = _T("https://tortoisegit.org/issue/%BUGID%");
	if (!pp.sUrl.IsEmpty())
	{
		pp.SetCheckRe(_T("[Ii]ssues?:?(\\s*(,|and)?\\s*#?\\d+)+"));
		pp.SetBugIDRe(_T("(\\d+)"));
	}
	m_cLogMessage.Init(pp);

	CString sChangelogURL;
	versioncheck.GetString(_T("TortoiseGit.changelogurl"), sChangelogURL);
	if (sChangelogURL.IsEmpty())
		sChangelogURL = _T("https://versioncheck.tortoisegit.org/changelog.txt");
	else
	{
		CString tmp(sChangelogURL);
		sChangelogURL.FormatMessage(tmp, TGIT_VERMAJOR, TGIT_VERMINOR, TGIT_VERMICRO, m_updateDownloader->m_sWindowsPlatform, m_updateDownloader->m_sWindowsVersion, m_updateDownloader->m_sWindowsServicePack);
	}

	CString tempchangelogfile = CTempFiles::Instance().GetTempFilePath(true).GetWinPathString();
	DWORD err;
	if ((err = m_updateDownloader->DownloadFile(sChangelogURL, tempchangelogfile, false)) != ERROR_SUCCESS)
	{
		CString msg = _T("Could not load changelog.\r\nError: ") + GetWinINetError(err) + _T(" (on ") + sChangelogURL + _T(")");
		::SendMessage(m_hWnd, WM_USER_FILLCHANGELOG, 0, reinterpret_cast<LPARAM>((LPCTSTR)msg));
		return;
	}
	if (official)
	{
		CString signatureTempfile = CTempFiles::Instance().GetTempFilePath(true).GetWinPathString();
		if ((err = m_updateDownloader->DownloadFile(sChangelogURL + SIGNATURE_FILE_ENDING, signatureTempfile, false)) != ERROR_SUCCESS || VerifyIntegrity(tempchangelogfile, signatureTempfile, m_updateDownloader))
		{
			CString error = _T("Could not verify digital signature.");
			if (err)
				error += _T("\r\nError: ") + GetWinINetError(err) + _T(" (on ") + sChangelogURL + SIGNATURE_FILE_ENDING + _T(")");
			::SendMessage(m_hWnd, WM_USER_FILLCHANGELOG, 0, reinterpret_cast<LPARAM>((LPCTSTR)error));
			DeleteUrlCacheEntry(sChangelogURL);
			DeleteUrlCacheEntry(sChangelogURL + SIGNATURE_FILE_ENDING);
			return;
		}
	}

	CString temp;
	CStdioFile file;
	if (file.Open(tempchangelogfile, CFile::modeRead | CFile::typeBinary))
	{
		auto buf = std::make_unique<BYTE[]>((UINT)file.GetLength());
		UINT read = file.Read(buf.get(), (UINT)file.GetLength());
		bool skipBom = read >= 3 && buf[0] == 0xEF && buf[1] == 0xBB && buf[2] == 0xBF;
		CGit::StringAppend(&temp, buf.get() + (skipBom ? 3 : 0), CP_UTF8, read - (skipBom ? 3 : 0));
	}
	else
		temp = _T("Could not open downloaded changelog file.");
	::SendMessage(m_hWnd, WM_USER_FILLCHANGELOG, 0, reinterpret_cast<LPARAM>((LPCTSTR)temp));
}
Exemplo n.º 2
0
void ShowMessage(int headerId, int bodyId, int footerId, HRESULT hr)
{
	HWND hwndExcel = FindCurrentExcelWindow();
	try
	{
		CString addInFullPath = AddInFullPath();

		CPath addInFileName = addInFullPath;
		addInFileName.StripPath();

		CString msgTitle;
		msgTitle.FormatMessage(IDS_MSG_TITLE, addInFileName);

		CString header;
		header.LoadString(headerId);
		CString body;
		body.LoadString(bodyId);
		CString footer;
		footer.LoadString(footerId);
		CString hresult = "";
		if (hr != S_OK)
		{
			hresult.FormatMessage(IDS_MSG_HRESULT, hr);
		}

		CString msg;
		msg.FormatMessage(IDS_MSG_TEMPLATE, header, body, footer, hresult, addInFullPath);

		MessageBox(hwndExcel, msg, msgTitle, MB_ICONEXCLAMATION);
	}
	catch (...)
	{
		ShowMessageError(hwndExcel);
	}
}
Exemplo n.º 3
0
BOOL CSettingGitRemote::SaveGeneral(CString key, CString value)
{
	if (value.IsEmpty())
	{
		// don't check result code. it fails if the entry not exist
		g_Git.UnsetConfigValue(key, CONFIG_LOCAL);
		if (!g_Git.GetConfigValue(key).IsEmpty())
		{
			CString msg;
			msg.FormatMessage(IDS_PROC_SAVECONFIGFAILED, static_cast<LPCTSTR>(key), static_cast<LPCTSTR>(value));
			CMessageBox::Show(GetSafeHwnd(), msg, L"TortoiseGit", MB_OK | MB_ICONERROR);
			return FALSE;
		}
		return TRUE;
	}

	if (g_Git.SetConfigValue(key, value, CONFIG_LOCAL))
	{
		CString msg;
		msg.FormatMessage(IDS_PROC_SAVECONFIGFAILED, static_cast<LPCTSTR>(key), static_cast<LPCTSTR>(value));
		CMessageBox::Show(GetSafeHwnd(), msg, L"TortoiseGit", MB_OK | MB_ICONERROR);
		return FALSE;
	}

	return TRUE;
}
Exemplo n.º 4
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;
}
Exemplo n.º 5
0
CString CP4FileStats::GetFormattedChangeFile(BOOL showFileType, BOOL showOpenAction) const
{
	// Format name + haveRev+headRev for display
	CString temp;
	int openAction= m_MyOpenAction;

	if(showOpenAction && m_OtherOpens && !m_MyOpenAction)
	{
		openAction= m_OtherOpenAction;
	}

	if(showFileType)
	{
		CString type = (m_Type == _T("unknown")) ? m_HeadType : m_Type;
		if(showOpenAction)
			temp.FormatMessage(IDS_FSTAT_s_n_s_s, m_DepotPath, m_HaveRev, 
								type, nameByAction((FileAction)openAction));
		else
			temp.FormatMessage(IDS_FSTAT_s_n_s, m_DepotPath, m_HaveRev, type);
	}
	else
	{
		if(showOpenAction)
			temp.FormatMessage(IDS_FSTAT_s_n_s, m_DepotPath, m_HaveRev, nameByAction((FileAction)openAction));
		else
			temp.FormatMessage(IDS_FSTAT_s_n, m_DepotPath, m_HaveRev);
	}	
	return temp;
}
Exemplo n.º 6
0
CString CNBLogicalDevice::GetName()
{
	ATLASSERT(m_mapUnitDevices.size());

	CString strText;

	if(0 == m_mapUnitDevices.size())
	{
		strText.FormatMessage(IDS_LOGDEV_TYPE_UNKNOWN_FMT, NMT_INVALID);
	}
	else if(IsGroup())
	{
		strText = GetRaidStatusString();
		switch(GetType()) {
			case NMT_AGGREGATE: strText.LoadString(IDS_LOGDEV_TYPE_AGGREGATED_DISK); break;
			case NMT_MIRROR: strText.LoadString(IDS_LOGDEV_TYPE_MIRRORED_DISK); break;
			case NMT_RAID0: strText.LoadString(IDS_LOGDEV_TYPE_DISK_RAID0); break;
			case NMT_RAID1: strText.LoadString(IDS_LOGDEV_TYPE_DISK_RAID1); break;
			case NMT_RAID1R2: strText.LoadString(IDS_LOGDEV_TYPE_DISK_RAID1R2); break;
			case NMT_RAID1R3: strText.LoadString(IDS_LOGDEV_TYPE_DISK_RAID1R3); break;	
			case NMT_RAID4: strText.LoadString(IDS_LOGDEV_TYPE_DISK_RAID4); break;
			case NMT_RAID4R2: strText.LoadString(IDS_LOGDEV_TYPE_DISK_RAID4R2); break;
			case NMT_RAID4R3: strText.LoadString(IDS_LOGDEV_TYPE_DISK_RAID4R3); break;	
			default:		strText.FormatMessage(IDS_LOGDEV_TYPE_UNKNOWN_FMT, GetType());
		}
	}
	else
	{
		ATLASSERT(1 == m_mapUnitDevices.size() && m_mapUnitDevices.count(0));

		strText = m_mapUnitDevices[0]->GetName();
	}

	return strText;
}
Exemplo n.º 7
0
CString CP4FileStats::GetFormattedFilename(BOOL showFileType) const
{
	CString filename = GET_P4REGPTR( )->ShowEntireDepot( ) <= SDF_DEPOT
		             ? GetDepotFilename() : GetClientFilename();

	// Format name + haveRev+headRev for display
	CString temp;

	if(m_HeadAction == F_DELETE)
	{
		// If the user has the file at < headrev, let the user know
		if( m_HaveRev > 0 && m_HaveRev < m_HeadRev )
			temp.FormatMessage(IDS_FSTAT_s_n_n_s_HEAD_REV_DELETED, filename, m_HaveRev, m_HeadRev, m_HeadType);
		else if(showFileType)
			temp.FormatMessage(IDS_FSTAT_s_n_n_s_DELETED, filename, m_HaveRev, m_HeadRev, m_HeadType);
		else
			temp.FormatMessage(IDS_FSTAT_s_n_n_DELETED, filename, m_HaveRev, m_HeadRev);
	}
	else
	{
		if (!m_HeadRev && !m_HaveRev)
			temp = filename;
		else if(showFileType)
			temp.FormatMessage(IDS_FSTAT_s_n_n_s, filename, m_HaveRev, m_HeadRev, m_HeadType);
		else
			temp.FormatMessage(IDS_FSTAT_s_n_n, filename, m_HaveRev, m_HeadRev);
	}
	return temp;
}
Exemplo n.º 8
0
bool SVNDiff::ShowUnifiedDiff(const CTSVNPath& url1, const SVNRev& rev1,
                              const CTSVNPath& url2, const SVNRev& rev2,
                              SVNRev peg,
                              const CString& options,
                              bool bIgnoreAncestry /* = false */,
                              bool /*blame*/,
                              bool bIgnoreProperties /* = true */)
{
    CTSVNPath tempfile;
    if (UnifiedDiff(tempfile, url1, rev1, url2, rev2, peg, options, bIgnoreAncestry, bIgnoreProperties))
    {
        CString title;
        CTSVNPathList list;
        list.AddPath(url1);
        list.AddPath(url2);
        if (url1.IsEquivalentTo(url2))
            title.FormatMessage(IDS_SVNDIFF_ONEURL, (LPCTSTR)rev1.ToString(), (LPCTSTR)rev2.ToString(), (LPCTSTR)url1.GetUIFileOrDirectoryName());
        else
        {
            CTSVNPath root = list.GetCommonRoot();
            CString u1 = url1.GetUIPathString().Mid(root.GetUIPathString().GetLength());
            CString u2 = url2.GetUIPathString().Mid(root.GetUIPathString().GetLength());
            title.FormatMessage(IDS_SVNDIFF_TWOURLS, (LPCTSTR)rev1.ToString(), (LPCTSTR)u1, (LPCTSTR)rev2.ToString(), (LPCTSTR)u2);
        }
        return !!CAppUtils::StartUnifiedDiffViewer(tempfile.GetWinPathString(), title);
    }
    return false;
}
Exemplo n.º 9
0
LRESULT CClientListCtrl::OnP4ClientList(WPARAM wParam, LPARAM lParam)
{
	CCmd_Clients *pCmd= (CCmd_Clients *) wParam;

	if(!pCmd->GetError())
	{
		CString msg;
		CObList const *clients= pCmd->GetList();
		int count = clients->GetCount();

		SetRedraw(FALSE);
    	int index = 0;
		CString curclient = GET_P4REGPTR()->GetP4Client();
		CString defclient = GET_P4REGPTR()->GetP4Client(TRUE);
		CString user      = GET_P4REGPTR()->GetP4User();
		for(int subItem=0; subItem < CLIENT_MAXCOL; subItem++)
			m_ListAll.column[subItem].SetSize(clients->GetCount(), 100);
		for(POSITION pos= clients->GetHeadPosition(); pos != NULL; index++)
		{
			CP4Client *client=(CP4Client *) clients->GetNext(pos);
			InsertClient(client, index, &curclient, &defclient, &user);
			if ((index & 0x1FFF) == 0)
			{
				msg.FormatMessage(IDS_INSERTING_CLIENTS, count - index);
				MainFrame()->UpdateStatus(msg);
			}
		}
        SetRedraw(TRUE);

		msg.FormatMessage( IDS_NUMBER_OF_CLIENTS_n, index );
		AddToStatus( msg, SV_COMPLETION );

		ReSort();

		// Make sure previous item is re-selected
		if(clients->GetCount() > 0)
		{
			int i = FindInList(m_Active.IsEmpty() ? GET_P4REGPTR()->GetP4Client() : m_Active);
			if (i < 0)	i=0;
			SetItemState(i, LVIS_SELECTED|LVIS_FOCUSED, LVIS_SELECTED|LVIS_FOCUSED);
			EnsureVisible(i, FALSE);
		}

		CP4ListCtrl::SetUpdateDone();
		// Notify the mainframe that we have finished getting the clients,
		// hence the entire set of async command have finished.
		MainFrame()->ExpandDepotIfNeedBe();
		if (m_PostViewUpdateMsg)
			PostMessage(m_PostViewUpdateMsg, m_PostViewUpdateWParam, m_PostViewUpdateLParam);
	}
	else
		CP4ListCtrl::SetUpdateFailed();
	
	delete pCmd;
	m_PostViewUpdateMsg = 0;
	MainFrame()->ClearStatus();
	return 0;
}
Exemplo n.º 10
0
/**
 * Passed a value and two resource string ids
 * if count is 1 then FormatString is called with format_1 and the value
 * otherwise format_2 is used
 * the formatted string is returned
*/
CString CLoglistUtils::ExpandRelativeTime(int count, UINT format_1, UINT format_n)
{
	CString answer;
	if (count == 1)
		answer.FormatMessage(format_1, count);
	else
		answer.FormatMessage(format_n, count);

	return answer;
}
Exemplo n.º 11
0
UINT CAddListDlg::VerifyOKToContinue()
{
    CString warning;
    if(m_AddFileCount == m_WarnLimit)
        warning.FormatMessage(IDS_THIS_FILE_ADD_OPERATION_HAS_ALREADY_FOUND_OVER_n, m_AddFileCount); 
    else
        warning.FormatMessage(IDS_THIS_FILE_ADD_OPERATION_HAS_NOW_ADDED_n, m_AddFileCount); 

    return AfxMessageBox(warning, MB_YESNO|MB_ICONEXCLAMATION);
}
Exemplo n.º 12
0
UINT ValidateUpdate(
	ISetupUI* pSetupUI,
	LPTSTR szUpdatePath, 
	LPCTSTR szModuleFile, 
	ULONG ulMinVer)
{
    UINT uiRet = ERROR_SUCCESS;

    TCHAR szShortPath[MAX_PATH] = {0};

    // ensure Update is right version for Windows Installer upgrade
    if (!pIsUpdateRequiredVersion(szUpdatePath, ulMinVer))
    {
		// Update won't get us the right upgrade

		uiRet = ERROR_INVALID_PARAMETER;
		CString str; str.FormatMessage(IDS_INCORRECT_UPDATE_FMT, szUpdatePath);
		pSetupUI->PostErrorMessageBox(uiRet, str);

        return uiRet;
    }

	pSetupUI->SetProgressBar(40);

    // upgrade msi
    uiRet = pExecuteUpgradeMsi(szUpdatePath);

	pSetupUI->SetProgressBar(90);

    switch (uiRet)
    {
    case ERROR_SUCCESS:
    case ERROR_SUCCESS_REBOOT_REQUIRED:    
        {
            // nothing required at this time
            break;
        }
    case ERROR_FILE_NOT_FOUND:
        {
            // Update executable not found
			CString str; str.FormatMessage(IDS_NOUPDATE_FMT, szUpdatePath);
			pSetupUI->PostErrorMessageBox(uiRet, str);
            break;
        }
    default: // failure
        {
			// report error
			CString str; str.LoadString(IDS_FAILED_TO_UPGRADE_MSI);
			pSetupUI->PostErrorMessageBox(uiRet, str);
            break;
        }
    }
    return uiRet;
}
Exemplo n.º 13
0
void CUserListCtrl::OnUserCreatenewuser() 
{
	if (m_EditInProgress)
	{
		CantEditRightNow(IDS_USER);
		return;
	}

	MainFrame()->ViewUsers();
	m_olduser = GET_P4REGPTR()->GetP4User( );

	//		let user type in the new name. if it's blank the user bailed.
	//

	CNewClientDlg newdlg;
	newdlg.SetNew( NEWUSER );
	if (FindInList(m_Active) != -1)
		newdlg.m_Active = m_Active;
	if( newdlg.DoModal( ) == IDCANCEL )
		return;

	CString saveActive = m_Active;
	m_Active = newdlg.GetName( ) ;
	if ( m_Active.IsEmpty( ) )
	{
		m_Active = saveActive;
		return;
	}
	if (FindInListNoCase(m_Active) != -1)
	{
		CString msg;
		UINT nType;
		if (FindInList(m_Active) != -1)
		{
			msg.FormatMessage ( IDS_USER_s_ALREADY_EXIST, m_Active );
			nType = MB_OK;
		}
		else
		{
			msg.FormatMessage ( IDS_USER_s_DIFFCASE_EXIST, m_Active );
			nType = MB_YESNO;
		}
		if (IDYES != AfxMessageBox( msg, nType ))
		{
			m_Active = saveActive;
			return;
		}
	}

    if ( SetP4User( ) ) 
		OnEditSpec( m_Active, TRUE );
}
/**
 * Passed a value and two resource string ids
 * if count is 1 then FormatString is called with format_1 and the value
 * otherwise format_2 is used
 * the formatted string is returned
*/
CString CAppUtils::ExpandRelativeTime( int count, UINT format_1, UINT format_n )
{
	CString answer;
	if ( count == 1 )
	{
		answer.FormatMessage( format_1, count );
	}
	else
	{
		answer.FormatMessage( format_n, count );
	}
	return answer;
}
Exemplo n.º 15
0
void CBaseDialog::UpdateTitleBarText(_In_opt_z_ LPCTSTR szMsg)
{
	CString szTitle;

	if (szMsg)
	{
		szTitle.FormatMessage(IDS_TITLEBARMESSAGE, (LPCTSTR)m_szTitle, szMsg);
	}
	else
	{
		szTitle.FormatMessage(IDS_TITLEBARPLAIN, (LPCTSTR)m_szTitle);
	}
	// set the title bar
	SetWindowText(szTitle);
} // CBaseDialog::UpdateTitleBarText
Exemplo n.º 16
0
void CDirstatApp::RestartApplication()
{
	// First, try to create the suspended process
	STARTUPINFO si;
	ZeroMemory(&si, sizeof(si));
	si.cb= sizeof(si);

	PROCESS_INFORMATION pi;
	ZeroMemory(&pi, sizeof(pi));

	BOOL success = CreateProcess(GetAppFileName(), NULL, NULL, NULL, false, CREATE_SUSPENDED, NULL, NULL, &si, &pi);
	if (!success)
	{
		CString s;
		s.FormatMessage(IDS_CREATEPROCESSsFAILEDs, GetAppFileName(), MdGetWinerrorText(GetLastError()));
		AfxMessageBox(s);
		return;
	}

	// We _send_ the WM_CLOSE here to ensure that all CPersistence-Settings
	// like column widths an so on are saved before the new instance is resumed.
	// This will post a WM_QUIT message.
	GetMainFrame()->SendMessage(WM_CLOSE);

	DWORD dw= ::ResumeThread(pi.hThread);
	if (dw != 1)
		TRACE(_T("ResumeThread() didn't return 1\r\n"));

	CloseHandle(pi.hProcess);
	CloseHandle(pi.hThread);
}
void 
CNdasDevicePropGeneralPage::OnRename(UINT, int, HWND)
{
	CNdasDeviceRenameDlg wndRename;
	wndRename.SetName(m_pDevice->GetName());
	
	INT_PTR iResult = wndRename.DoModal();
	if (IDOK == iResult) 
	{
		CString strNewName = wndRename.GetName();
		if (0 != strNewName.Compare(m_pDevice->GetName())) 
		{
			if (!m_pDevice->SetName(strNewName)) 
			{
				ErrorMessageBox(m_hWnd, IDS_ERROR_RENAME_DEVICE);
			} 
			else 
			{
				m_wndDeviceName.SetWindowText(strNewName);

				CString strTitle;
				strTitle.FormatMessage(IDS_DEVICE_PROP_TITLE, strNewName);
				GetParent().SetWindowText(strTitle);
				_UpdateDeviceData();
			}
		}
	}
}
Exemplo n.º 18
0
void 
CMainFrame::OnNdasLogDeviceDisconnected(
	NDAS_LOGICALDEVICE_ID logDevId)
{
	ATLTRACE("Logical Device(%d) disconnected.\n", logDevId);
	pUpdateMenuItems();

	CString szDevices = MAKEINTRESOURCE(IDS_DEVICE_UNKNOWN);

	BOOL fUseDisconnectAlert = pGetAppConfigBOOL(_T("UseDisconnectAlert"), TRUE);
	if (!fUseDisconnectAlert) 
	{
		return;
	}

	pLogicalDeviceString(szDevices, logDevId);

	CString strMessage;
	strMessage.FormatMessage(IDS_BT_DISCONNECTED_INFO, szDevices);

	m_taskbarIcon.ShowBalloonToolTip(
		static_cast<LPCTSTR>(strMessage), 
		IDS_BT_DISCONNECTED_INFO_TITLE, 
		NIIF_ERROR, 
		5000);
}
Exemplo n.º 19
0
BOOL CGetPwdDlg::OnInitDialog() 
{
	CDialog::OnInitDialog();
	
	GetWindowRect(&m_InitRect);
	m_LastRect = m_InitRect;

	while (!MainFrameCWnd)			// wait until MainFrame is intitialzed
		Sleep(100);
	CMainFrame * mainWnd = (CMainFrame *)AfxGetMainWnd();
	mainWnd->UpdateCaption();

	CString msg;
    msg.FormatMessage(IDS_PASSWORD_FOR_USER_s, GET_P4REGPTR()->GetP4User( ));
	GetDlgItem( IDC_STATICMSG )->SetWindowText( msg );

	if (GET_SERVERLEVEL() >= 18)
	{
		m_IsPermanent = FALSE;
		GetDlgItem(IDC_CHECK1)->EnableWindow(FALSE);
		GetDlgItem(IDC_CHECK1)->ShowWindow(SW_HIDE);
		// Set a timer so we can check for Caps Lock toggles
		m_Timer= SetTimer( MISC_TIMER, 200, NULL);
	}
	
	UpdateData(FALSE);
	return m_InitDialogDone = TRUE;  // return TRUE unless you set the focus to a control
	              // EXCEPTION: OCX Property Pages should return FALSE
}
Exemplo n.º 20
0
BOOL CClientListCtrl::ClientSpecSwitch(CString switchTo, BOOL bAlways /*=FALSE*/, BOOL portWasChanged /*= FALSE*/) 
{
	CCmd_Describe *pCmd = new CCmd_Describe;
	pCmd->Init( NULL, RUN_SYNC );
	BOOL cmdStarted= pCmd->Run( P4CLIENT_SPEC, switchTo );
	if(cmdStarted && !pCmd->GetError())
	{
		CString options= TheApp()->GetClientSpecField( _T("Options"), pCmd->GetDescription() );
		if (( options.Find(_T("unlocked")) == -1 ) && ( options.Find(_T("locked")) != -1 ))
		{
			CString lockedby= TheApp()->GetClientSpecField( _T("Owner"), pCmd->GetDescription() );
			if ( lockedby.Compare( GET_P4REGPTR()->GetP4User() ) != 0 )
			{
				CString errmsg;
                errmsg.FormatMessage(IDS_CLIENT_s_IS_LOCKED_BY_USER_s_AND_CANT_BE_USED_BY_s,
                    switchTo, lockedby, GET_P4REGPTR()->GetP4User());
				AddToStatus( errmsg, SV_WARNING );  
				AfxMessageBox( errmsg, MB_ICONEXCLAMATION );
				delete pCmd;
				return FALSE;
			}
		}
	}
	delete pCmd;

	m_Active = switchTo;

	if ( SetP4Client( bAlways ) )
		MainFrame()->OnPerforceOptions( FALSE, portWasChanged ) ;
	return TRUE;
}
Exemplo n.º 21
0
void CCopyDlg::OnComError( HRESULT hr )
{
    COMError ce(hr);
    CString sErr;
    sErr.FormatMessage(IDS_ERR_FAILEDISSUETRACKERCOM, m_bugtraq_association.GetProviderName(), ce.GetMessageAndDescription().c_str());
    ::MessageBox(m_hWnd, sErr, L"TortoiseSVN", MB_ICONERROR);
}
Exemplo n.º 22
0
ERMsg CDib::SaveImage(const CString& filePath, REFGUID guidFileType, int bpp)const
{
	ASSERT( guidFileType != GUID_NULL || !UtilWin::GetFileExtension(filePath).IsEmpty() );
	ERMsg message;

	if( bpp == -1)
	{
		bpp = GetBPP();
	}
	else if( bpp != GetBPP())
	{
		CDib dib;
		dib.Copy( *this, bpp);
		return dib.SaveImage(filePath, guidFileType);
	}

	

	if( FAILED(Save(filePath, guidFileType)))
	{
		CString error;
		error.FormatMessage(IDS_BSC_UNABLE_OPEN_WRITE, filePath );
		message.ajoute( UtilWin::ToUTF8(error) );
	}

	return message;
}
Exemplo 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);
	}
}
Exemplo n.º 24
0
void CSetBugTraqAdv::OnBnClickedOptions()
{
    m_provider_clsid = GUID_NULL;

    int index = m_cProviderCombo.GetCurSel();
    if (index != CB_ERR)
    {
        CBugTraqProvider *provider = (CBugTraqProvider *)m_cProviderCombo.GetItemDataPtr(index);
        m_provider_clsid = provider->clsid;
    }

    CComPtr<IBugTraqProvider2> pProvider;
    HRESULT hr = pProvider.CoCreateInstance(m_provider_clsid);

    if (SUCCEEDED(hr))
    {
        ATL::CComBSTR temp;
        CString p;
        GetDlgItemText(IDC_BUGTRAQPARAMETERS, p);
        ATL::CComBSTR params;
        params.Attach(p.AllocSysString());
        hr = pProvider->ShowOptionsDialog(GetSafeHwnd(), params, &temp);
        if (SUCCEEDED(hr))
        {
            SetDlgItemText(IDC_BUGTRAQPARAMETERS, temp == 0 ? "" : temp);
        }
        else
        {
            COMError ce(hr);
            CString sErr;
            sErr.FormatMessage(IDS_ERR_FAILEDISSUETRACKERCOM, ce.GetSource().c_str(), ce.GetMessageAndDescription().c_str());
            ::MessageBox(m_hWnd, sErr, L"TortoiseSVN", MB_ICONERROR);
        }
    }
}
Exemplo n.º 25
0
bool DisplayHelp()
{
	CPath path;
	if (!::GetModuleFileName(NULL, CStrBufA(path, MAX_PATH), MAX_PATH))
		return false;
	path.StripPath();

	CString str;
	str.FormatMessage(
		_T("Checks the security descriptor on a named object.\n")
		_T("\n")
		_T("Usage: %1 [-?] [-at|-no_at] [-file|-regkey|-service|-kernel|-printer] [objectname]*\n")
		_T("  -?        Display this help message\n")
		_T("  -at       Examine the process access token (default)\n")
		_T("  -no_at    Don't examine the process access token\n")
		_T("  -file     objectname is the name of a file to examine (default)\n")
		_T("  -regkey   objectname is the name of a registry key to examine\n")
		_T("  -service  objectname is the name of a service to examine\n")
		_T("  -kernel   objectname is the name of a kernel object to examine\n")
		_T("            these can be semaphores, events, mutexes, waitable timers, and file mappings\n")
		_T("  -printer  objectname is the name of a printer to examine\n")
		_T("  objectname defaults to \\\\.\\A:\n")
		_T("Example: %1 C:\\boot.ini\n")
		_T("\n")
		_T("Note: \\\\.\\A: is not the same as A:\n")
		_T("Checking \\\\.\\A: checks access to the floppy drive,\n")
		_T("Checking A: checks access to the root directory"),
		path);
	Log(str);

	return false;
}
Exemplo n.º 26
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;
}
Exemplo n.º 27
0
void CSetupApp::DoInstall()
{
	try
	{
		CProgressDlg progress;

		CopyWinDirStatFiles(&progress);
		if (m_shortcutStartMenu)
			CreateStartMenuShortcut(&progress);
		if (m_shortcutDesktop)
			CreateDesktopShortcut(&progress);
		if (m_shortcutSendTo)
			CreateSendToShortcut(&progress);
	}
	catch (CException *pe)
	{
		m_errorMessage= MdGetExceptionMessage(pe);
		pe->Delete();
		if (m_canStartApplication)
		{
			CString msg;
			msg.FormatMessage(IDS_HOWEVERWINDIRSTATOKINs, m_destFolder);
			m_errorMessage+= msg;
		}
	}
}
Exemplo n.º 28
0
	void OnCreateAttr(UINT /*uNotifyCode*/, int /*nID*/, HWND /*hWnd*/)
	{
		CString name;
		if ( ::ShowSimplePrompt(m_hWnd,_T("Create File"),_T("Name:"),name) )
		{
			//because this is in EclLib, don't want to use it at this time
			//if ( !::IsValidIdentifier(std::_tstring(name)) )

			//just do the spaces check
			if ( name.Find(' ') >= 0 )
			{
				CString prompt;
				prompt.FormatMessage(IDS_BAD_ATTRNAME, (const TCHAR *)name );
				MessageBox(prompt);
			}
			else
			{
				m_attr = m_module->InsertAttribute(name, CreateIAttributeECLType());
				if (m_attr.p)
				{
					CWaitCursor cursor;
					m_view.SendMessage(CWM_RESET);
					m_view.Select(m_attr);
					m_view.Invalidate(); //doesn't seem to paint without this
					m_view.UpdateWindow();
				}
				else
				{
					CString prompt;
					prompt.LoadString(IDS_GQB_NOCREATEATTR);
					MessageBox(prompt);
				}
			}
		}
	}
Exemplo n.º 29
0
/****************************************************************************
 * Print Konsole
 * 
 *  
 *****************************************************************************/
void CPIC32UBLDlg::PrintKonsole(CString string)
{

	cstringEditConsole += string;
	string.FormatMessage("\n");
	cstringEditConsole += string;
	
}
Exemplo n.º 30
0
void CLabelListCtrl::OnUpdateLabelListfiles(CCmdUI* pCmdUI) 
{
	CString selUser = TruncateString(GetSelectedItemText(), 50);
    CString txt;
    txt.FormatMessage(IDS_LIST_FILES_AT_s, selUser);
	pCmdUI->SetText ( txt );
	pCmdUI->Enable(!SERVER_BUSY() && !selUser.IsEmpty());	
}