Commit Graph

114 Commits

Author SHA1 Message Date
Martchus c1284331be Handle redirections more nicely
* Log redirections in accordance with logging settings
* Load self-signed certificate as needed
2023-12-30 20:11:34 +01:00
Martchus 51e266fbac Fix compilation with Qt 6.7.0beta1
Fix the wrong placement of the `-->`; not sure why this was not detected as
invalid XML before.
2023-12-21 18:24:50 +01:00
Martchus efa6775369 Update lookup of Syncthing config dir for Unix platforms
* Adapt to Syncthing commit b5082f6af8b0a70afd3bc42977dad26920e72b68
* See https://github.com/Martchus/syncthingtray/issues/216
  and https://github.com/syncthing/syncthing/issues/9178
2023-12-10 12:39:53 +01:00
Martchus becf6e873b Enable timeout for long-polling requests by default
This setting does work quite well in my testing so far and it can help with
the issue of the connection becoming stale (see
https://github.com/Martchus/syncthingtray/issues/209).
2023-11-25 23:31:42 +01:00
Martchus 9360bf8bc8 Fix grammar mistakes in German translation after replacing "Verzeichnis" with "Ordner" 2023-11-10 13:17:16 +01:00
Martchus 9c49c41990 Adapt integration test for auth changes in Syncthing v1.26.0 2023-11-07 12:48:38 +01:00
Martchus 7c932fdb31 Update translations 2023-11-07 11:58:55 +01:00
Martchus fada3c98dd Allow configuring long-polling timeout 2023-11-06 15:06:40 +01:00
Martchus 8aedecf5f5 Update translations 2023-10-03 14:14:01 +02:00
Martchus aa524aa8b7 Make event handling of `syncthingctl wait-for-idle` more efficient
Don't go though the list of dirs/devs for every dir/dev change event. Just
go though the list once after receiving new events. This makes also the
code a little bit easier to follow.
2023-09-20 18:12:55 +02:00
Martchus 230532d15e Do the directory/folder replacement also in German translation 2023-09-18 22:34:30 +02:00
Martchus 2073692968 Update translations 2023-09-18 22:13:41 +02:00
Martchus 63bd9bb306 Merge remote-tracking branch 'JohnVeness/folder' 2023-09-18 22:07:24 +02:00
Martchus 978636b5aa Fix crash in `syncthingctl cat` after f5795d45c2 2023-09-18 22:05:25 +02:00
John Veness c2a0eee029 Change Directory to Folder in user-facing strings 2023-09-17 19:33:31 +01:00
Martchus bc02a70ae9 Update translations 2023-09-16 23:10:09 +02:00
Martchus f5795d45c2 Show this/own device always as first device
See https://github.com/Martchus/syncthingtray/issues/203
2023-09-16 23:07:00 +02:00
Martchus 5fa69e4f5a Rename `SyncthingDevStatus::OwnDevice` in accordance with UI change 2023-09-16 22:28:35 +02:00
Martchus d623dfdf5e Replace "own device" with "this device" where it makes sense
* Be consistent with official UI
* See https://github.com/Martchus/syncthingtray/issues/203
2023-09-16 22:19:04 +02:00
Martchus 081def0a9e Update translations 2023-09-04 20:35:57 +02:00
Martchus 669923dbb6 Ensure redirects to HTTPS are enabled/allowed regardless of the Qt version
Technically, this is not completely true because it is not supported on Qt
versions older than 5.9.
2023-09-04 20:33:32 +02:00
Martchus b7d19ea904 Avoid duplicated code in functions for locating config files 2023-09-04 20:23:32 +02:00
Martchus bd924330ad Remove identical branches
GCC warns about this so let's just remove this leftover.
2023-09-04 20:20:51 +02:00
Martchus c3233a8954 Update translations 2023-09-01 23:36:04 +02:00
Martchus 25c8d3f69a Use consistent/new coding style in `readDirEvent` as well 2023-09-01 23:34:26 +02:00
Martchus 92b305aa89 Store the disconnect reason in the device info 2023-09-01 23:33:50 +02:00
Martchus 3696869a99 Remove useless and possibly problematic code when handling device events 2023-09-01 23:25:06 +02:00
Martchus ae319f604b Fix reading device events
* Fix logic error that prevented the `devStatusChanged()` event
  from being emitted when a device has connected
* Fix reading device ID from event data
2023-09-01 23:21:01 +02:00
Martchus 968fcb988c Fix finding Syncthing dir by path on Windows
The path needs to be normalized so inconsistent uses of `/` and `\` are not
a problem.
2023-08-19 19:16:16 +02:00
Martchus 66a8dda244 Improve test setup
* 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
2023-08-02 17:36:26 +02:00
Martchus e4bbe852bd Avoid CMake deprecation warning by bumping version 2023-07-23 21:05:22 +02:00
Martchus 00f444484c Update translations 2023-07-14 02:14:32 +02:00
Martchus 7e651be694 Fix compilation against Qt < 5.15 for Leap 15.3 builds 2023-07-11 11:55:39 +02:00
Martchus 8f481b0168 Update translations 2023-07-04 19:38:52 +02:00
Martchus 69568ea6dd Set default transfer timeout to infinity
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.
2023-07-04 19:33:30 +02:00
Martchus faeefba03f Do not apply transfer timeout to long-polling requests
This leads to "disconnects" from Syncthing otherwise.
2023-07-04 19:26:48 +02:00
Martchus 690804be5c Add the request timeout to SyncthingConnectionSettings 2023-07-04 19:01:08 +02:00
Martchus ac07982596 Allow setting transfer timeout for network requests of SyncthingConnection 2023-07-04 18:39:14 +02:00
Martchus 4b5bd05221 Remove TODO for unification with `InternalError::isRelevant()`
The code is not similar enough to unify it.
2023-06-30 12:46:01 +02:00
Martchus 8b8854d243 Avoid warning about sign conversion
This is actually about the conversion of the `-1` literal in case the
process ID is already `qint64` (e.g. on Windows).
2023-06-10 18:19:28 +02:00
Martchus dd936b4a81 Workaround lupdate not understanding "enum class" in some cases
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.
2023-06-07 23:14:48 +02:00
Martchus bccd953274 Avoid C++20 compatibility warning 2023-05-21 18:56:56 +02:00
Martchus dfe7759116 Update translations 2023-05-11 23:48:58 +02:00
Martchus 42a0d9c9f7 Show the connection type of a device 2023-05-11 23:44:10 +02:00
Martchus 35eb90e88c Ignore deprecation warning of `wait_for`
This function might not be completely reliable but it is
supposedly good enough for the use cases of
`SyncthingProcess::waitForFinished()`.
2023-05-11 17:57:04 +02:00
Martchus 208391acf7 Ensure `_WIN32_WINNT` is set for Boost.Process
Apparently is is not always set when using MSVC (not sure in which cases it
is missing).
2023-05-01 20:58:40 +02:00
Martchus e9135d735a Update translations 2023-04-29 21:08:29 +02:00
Martchus ae6b8712cb Re-connect if Syncthing appears to be restarted
* 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.
2023-04-15 22:51:55 +02:00
Martchus c6a5b40a1d Re-connect when event ID is decreasing 2023-04-15 22:25:12 +02:00
Martchus c07f9345b1 Improve wording of comment 2023-04-15 22:25:07 +02:00
Martchus 8c74b24045 Remove uneffective code when handling reply
Calling `handleAdditionalRequestCanceled();` when `handleAborting`
is true is useless because then also `m_abortingAllRequests` is true
and therefore `handleAdditionalRequestCanceled();` always returns
early doing nothing.
2023-04-15 22:02:43 +02:00
Martchus d510b34abb Update translations 2023-04-15 20:36:18 +02:00
Martchus fc8ab2e845 Improve coding style
Improve coding style, mainly in SynctingConnection, for better
consistency with more recently added code.
2023-04-15 20:28:51 +02:00
Martchus d3901cee37 Don't reset last event IDs when connecting again
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()`).
2023-04-15 20:08:21 +02:00
Martchus 843f164df1 Avoid potentially losing events
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.)
2023-04-15 16:18:23 +02:00
Martchus 83225dbed6 Fix error when generating D-Bus properties interface header
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.
2023-04-04 21:55:00 +02:00
Martchus 0f6ea4f88e Track "SubState" of systemd service correctly
Due to short-circuing the previous code might not have taken a
changed "SubState" into account. This change should fix it and
therefore might fix
https://github.com/Martchus/syncthingtray/issues/179.
2023-04-03 19:19:45 +02:00
Martchus 76209e2922 Improve handling changed properties in `SyncthingService`
* 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.
2023-04-03 19:16:52 +02:00
Martchus f524a18b83 Fix condition for triggering connection once service is back
Skipping the connection attempt if the timer interval is lower
anyways only makes sense if the timer is also active.
2023-04-03 18:47:50 +02:00
Martchus 1d221120fe Apply clang-format 2023-03-31 22:46:48 +02:00
Martchus 033cd21d83 Improve lookup of Chromium-based browser binary
* Consider Edge and Chrome as well
* Read the binary path from the "Application Registration" under Windows
  (see https://learn.microsoft.com/en-us/windows/win32/shell/app-registration)
2023-03-28 22:32:03 +02:00
Martchus db657bb1aa Use QByteArrayLiteral for such literals 2023-03-28 17:20:59 +02:00
Martchus 57d826dfd5 Fix crashes in SyncthingProcess code with MSVC 2022 and Qt 6.5.0
Not sure why `QString::toStdWString()` doesn't work with this compiler and
the official Qt 6.5.0 build. However, instantiating an `std::wstring`
manually works so let's just use this as a workaround.

Note that with GCC/mingw-w64 and Qt 6.4.3 the `QString::toStdWString()`
function works just fine.
2023-03-28 00:02:35 +02:00
Martchus 96e92f13a3 Avoid relying on symlink for include directories
Symlinks aren't working very well with Git under Windows so better avoid
them.
2023-02-27 18:27:33 +01:00