quickhash icon indicating copy to clipboard operation
quickhash copied to clipboard

Window properties not saved

Open darealshinji opened this issue 6 years ago • 2 comments

QH doesn't seem to save the last window properties in ~/.quickhash. It always remains the same:

<?xml version="1.0" encoding="utf-8"?>
<CONFIG>
  <TApplication>
    <MainForm MainForm_Position="poScreenCenter"/>
  </TApplication>
</CONFIG>

This is on Linux, I haven't checked the behavior on Windows yet.

By the way, using the following code seems to help to save the file in a specific user directory, which would help to install QH on Windows in a directory without write access for regular users:

  {$ifdef Windows}
    envVar := GetEnvironmentVariable('LocalAppData'); // XP only has %AppData%
    if envVar <> '' then
    begin
      if DirectoryExists(envVar + '/QuickHash') = false then
      begin
        CreateDir(envVar + '/QuickHash');
      end;
      if DirectoryExists(envVar + '/QuickHash') = true then
      begin
        QH_MainFormXMLPropStorage.FileName := envVar + '/QuickHash/PropStorage.xml';
      end;
    end;
  {$endif}

  {$ifdef UNIX}
    envVar := GetEnvironmentVariable('HOME');
    if envVar <> '' then
    begin
      // $HOME/.config should already exist on Mac and Linux
      if DirectoryExists(envVar + '/.config/QuickHash') = false then
      begin
        CreateDir(envVar + '/.config/QuickHash');
      end;
      if DirectoryExists(envVar + '/.config/QuickHash') = true then
      begin
        QH_MainFormXMLPropStorage.FileName := envVar + '/.config/QuickHash/PropStorage.xml';
      end;
    end;
  {$endif}

darealshinji avatar Jan 18 '19 16:01 darealshinji

looks sensible. Except the ifdef for windows needs to be backslash instead of forward slash.

tedsmith avatar Jan 19 '19 15:01 tedsmith

I need to use SysUtils.GetEnvironmentVariable() to compile it on Windows. Forward slashes as directory delimiters are working fine. The xml file is stored in the right AppData directory, but the issue that the actual window properties aren't saved in there remains (it's the same with self-compile and your pre-compiled versions). Since nobody has had an issue with that so far I'd say the TXMLPropStorage stuff could be removed.

PS: the 32 bit and 64 bit releases only need their 32/64 bit versions of sqlite in the same directory and not both. Cause currently your zip packages ship both dlls for each binary.

darealshinji avatar Jan 21 '19 19:01 darealshinji