* Improve code for reading environment variables
* Make tests work when the temp directory is not `/tmp` because e.g. `TEMP`
has been set or tests are executed under Windows
Apparently the default before introducing the request timeout was not 30000
(which is the value of QNetworkRequest::TransferTimeoutConstant). There was
actually no timeout. So let's restore this behavior for now as the main
intention was to make the timeout configurable but not change any defaults.
Apparently this is still problematic leading to errors like
`Qualifying with unknown namespace/class`. It seems that moving the enum to
a different header file works. The trick to use a macro to define
`enum class` ceased to work on the other hand.
Specifying a function with the namespace like
`void QtGui::FinalWizardPage::showResults()` leads to the same problem and
also needs to be avoided.
* This is now required after 843f164d which uses event IDs
instead of time stamps and event IDs reset when Syncthing has
been restarted.
* It is likely a good idea to cleanly re-connect anyways.
* This change re-introduces the previously uneffective and hence
removed code (see 8c74b240). It fixes the code to effectively
make sure a re-connect is continued once it has been started.
So this change should fix the re-connect not working in
certain cases.
Calling `handleAdditionalRequestCanceled();` when `handleAborting`
is true is useless because then also `m_abortingAllRequests` is true
and therefore `handleAdditionalRequestCanceled();` always returns
early doing nothing.
When connecting again, no data is cleared. Since we now keep
track of event IDs and not just timestamps it makes sense to not
forget what the last event IDs were. To still run into the
"limit" case the flags for having events at all can be used
(which is also reset on just `connect()`).
I have observed that Syncthing Tray can get stuck thinking a remote device
still needs data. Likely the update got lost. The code contains certain
conditions in which folder completion events and requesting completion are
supressed. Those conditions are based on timestamps. That is not ideal as
the accuracy is only one second (so different timestamps might be
considered equal as they are rounded to be the same). Additionally, it
makes no sense to assume a timestamp upon receiving a response as the
information might be older than the time it was received.
This change avoids those conditions. It rather uses the event ID to
decide what event/reply is newer.
This change also uses quint64 instead of int for event IDs to avoid running
into an overflow (or rather conversion error) when deserializing the ID
which might be bigger than int. (Not sure how big the ID can become; this
is to be on the safe side.)
Fixes the following error
```
qdbusxml2cpp: Got unknown type `a{sv}' processing '/build/static-compat-syncthingtray/src/syncthingtray/syncthingconnector/org.freedesktop.DBus.Properties.xml'
You should add <annotation name="org.qtproject.QtDBus.QtTypeName.Out1" value="<type>"/> to the XML description for 'changed_properties'
```
by following the suggestion of that error. Not sure why this
error occurs only now. Maybe `qdbusxml2cpp` changed in Qt 6.5.0.
* Check directly whether changed properties contain a property
instead of checking indirectly whether the returned QVariant
is invalid.
* Avoid copying the QVariant.
* Effectively this should not change anything; the code is just
more readable and possibly more efficient.