[win-nix] keep key for analysis of the portal registration

This commit is contained in:
Maxim Kadushkin
2017-04-06 17:16:58 +03:00
parent 37aece01e4
commit d0de0da9ae
2 changed files with 51 additions and 1 deletions

View File

@ -120,6 +120,11 @@ procedure GetSystemTimeAsFileTime(var lpFileTime: TFileTime); external 'GetSyste
function SendTextMessageTimeout(hWnd: HWND; Msg: UINT; wParam: WPARAM; lParam: PAnsiChar; fuFlags: UINT; uTimeout: UINT; out lpdwResult: DWORD): LRESULT;
external 'SendMessageTimeoutA@user32.dll stdcall';
function GetCommandlineParam(inParamName: String):String; forward;
function StartsWith(SubStr, S: String) : Boolean; forward;
function StringReplace(S, oldSubString, newSubString: String) : String; forward;
//procedure checkArchitectureVersion; forward;
function GetHKLM: Integer; forward;
@ -320,6 +325,7 @@ end;
procedure CurStepChanged(CurStep: TSetupStep);
var
commonCachePath, userCachePath: string;
paramStore: string;
begin
if CurStep = ssPostInstall then
begin
@ -334,6 +340,44 @@ begin
DirectoryCopy(commonCachePath, userCachePath);
end
end;
paramStore := GetCommandlineParam('/store');
if Length(paramStore) > 0 then
begin
RegWriteStringValue(HKEY_LOCAL_MACHINE, ExpandConstant('{#APP_REG_PATH}'), 'Store', paramStore);
end;
end;
function StartsWith(SubStr, S: String) : Boolean;
begin
Result := Pos(SubStr, S) = 1;
end;
function StringReplace(S, oldSubString, newSubString: String) : String;
var
stringCopy : String;
begin
stringCopy := S; //Prevent modification to the original string
StringChange(stringCopy, oldSubString, newSubString);
Result := stringCopy;
end;
function GetCommandlineParam(inParamName: String) : String;
var
paramNameAndValue: String;
i: Integer;
begin
Result := '';
for i:= 1 to ParamCount do
begin
paramNameAndValue := Lowercase(ParamStr(i));
if StartsWith(inParamName, paramNameAndValue) then
begin
Result := StringReplace(paramNameAndValue, inParamName + ':', '');
break;
end;
end;
end;

View File

@ -1205,7 +1205,13 @@ void CMainPanel::onPortalNew(QString in)
void CMainPanel::onPortalCreate()
{
int res = m_pTabs->newPortal(URL_SIGNUP, tr("Sign Up"));
QString _url = URL_SIGNUP;
GET_REGISTRY_SYSTEM(reg_system)
if ( reg_system.contains("Store") )
_url += "&store=" + reg_system.value("Store").toString();
int res = m_pTabs->newPortal(_url, tr("Sign Up"));
if (res == 2) { RecalculatePlaces(); }
QTimer::singleShot(200, this, [=]{