| 1 | // For license of this file, see <project-root-folder>/LICENSE.md.cxx . . $ `<file>/src/librssguard/miscellaneous/systemfactory.cpp`/ |
| 2 | |
| 3 | #include "miscellaneous/systemfactory.h"cxx . . $ `<file>/src/librssguard/miscellaneous/systemfactory.h`/ |
| 4 | |
| 5 | #include "3rd-party/boolinq/boolinq.h"cxx . . $ `<file>/src/librssguard/3rd-party/boolinq/boolinq.h`/ |
| 6 | #include "exceptions/applicationexception.h"cxx . . $ `<file>/src/librssguard/exceptions/applicationexception.h`/ |
| 7 | #include "gui/dialogs/formmain.h"cxx . . $ `<file>/src/librssguard/gui/dialogs/formmain.h`/ |
| 8 | #include "gui/dialogs/formupdate.h"cxx . . $ `<file>/src/librssguard/gui/dialogs/formupdate.h`/ |
| 9 | #include "miscellaneous/application.h"cxx . . $ `<file>/src/librssguard/miscellaneous/application.h`/ |
| 10 | #include "miscellaneous/settings.h"cxx . . $ `<file>/src/librssguard/miscellaneous/settings.h`/ |
| 11 | #include "miscellaneous/systemfactory.h"cxx . . $ `<file>/src/librssguard/miscellaneous/systemfactory.h`/ |
| 12 | |
| 13 | #if defined(Q_OS_WIN) |
| 14 | #include <QSettings> |
| 15 | #endif |
| 16 | |
| 17 | #include <QDesktopServices> |
| 18 | #include <QDir> |
| 19 | #include <QFile> |
| 20 | #include <QFileInfo> |
| 21 | #include <QJsonArray> |
| 22 | #include <QJsonDocument> |
| 23 | #include <QJsonObject> |
| 24 | #include <QProcess> |
| 25 | #include <QString> |
| 26 | #include <QVersionNumber> |
| 27 | |
| 28 | using UpdateCheckcxx . . $ UpdateCheck# = QPaircxx . . $ QPair#<UpdateInfocxx . . $ UpdateInfo#, QNetworkReplycxx . . $ QNetworkReply#::NetworkErrorcxx . . $ QNetworkReply#NetworkError#>; |
| 29 | |
| 30 | SystemFactorycxx . . $ SystemFactory#::SystemFactorycxx . . $ SystemFactory#SystemFactory(749de1b6ae65bddd).(QObjectcxx . . $ QObject#* parent) : QObjectcxx . . $ QObject#QObject(749de1b6ae65bddd).(parent) {} |
| 31 | |
| 32 | SystemFactorycxx . . $ SystemFactory#::~cxx . . $ SystemFactory#`~SystemFactory`(ced63f7c635d850d).SystemFactorycxx . . $ SystemFactory#() = default; |
| 33 | |
| 34 | QRegularExpressioncxx . . $ QRegularExpression# SystemFactorycxx . . $ SystemFactory#::supportedUpdateFilescxx . . $ SystemFactory#supportedUpdateFiles(665c0c77e8c56958).() { |
| 35 | #if defined(Q_OS_WIN) |
| 36 | return QRegularExpression(QSL(".+win.+\\.(exe|7z)")); |
| 37 | #elif defined(Q_OS_MACOS) |
| 38 | return QRegularExpression(QSL(".dmg")); |
| 39 | #elif defined(Q_OS_LINUXcxx . . $ `<external>/7933076451316529972/qsystemdetection.h:100:11`!) |
| 40 | return QRegularExpressioncxx . . $ QRegularExpression#QRegularExpression(4279d2539df7cd4a).(QSLcxx . . $ `src/librssguard/definitions/definitions.h:442:9`!(".AppImage")); |
| 41 | #else |
| 42 | return QRegularExpression(QSL(".*")); |
| 43 | #endif |
| 44 | } |
| 45 | |
| 46 | SystemFactorycxx . . $ SystemFactory#::AutoStartStatuscxx . . $ SystemFactory#AutoStartStatus# SystemFactorycxx . . $ SystemFactory#::autoStartStatuscxx . . $ SystemFactory#autoStartStatus(c24e8a3ce51f2b39).() const { |
| 47 | // User registry way to auto-start the application on Windows. |
| 48 | #if defined(Q_OS_WIN) |
| 49 | QSettings registry_key(QSL("HKEY_CURRENT_USER\\Software\\Microsoft\\Windows\\CurrentVersion\\Run"), |
| 50 | QSettings::Format::NativeFormat); |
| 51 | const bool autostart_enabled = registry_key.contains(QSL(APP_LOW_NAME)); |
| 52 | |
| 53 | if (autostart_enabled) { |
| 54 | return AutoStartStatus::Enabled; |
| 55 | } |
| 56 | else { |
| 57 | return AutoStartStatus::Disabled; |
| 58 | } |
| 59 | #elif defined(Q_OS_UNIXcxx . . $ `<external>/7933076451316529972/qsystemdetection.h:149:11`!) && !defined(Q_OS_MACOS) |
| 60 | // Use proper freedesktop.org way to auto-start the application. |
| 61 | // INFO: http://standards.freedesktop.org/autostart-spec/latest/ |
| 62 | const QStringcxx . . $ QString# desktop_file_location = autostartDesktopFileLocationcxx . . $ SystemFactory#autostartDesktopFileLocation(6ef7b6c27b00b43d).(); |
| 63 | |
| 64 | // No correct path was found. |
| 65 | if (desktop_file_location.isEmptycxx . . $ QString#isEmpty(3482b152b9333168).()) { |
| 66 | qWarningNNcxx . . $ `src/librssguard/definitions/definitions.h:417:9`! <<cxx . . $ QDebug#`operator<<`(d8a917b173851aad). LOGSEC_GUIcxx . . $ `src/librssguard/definitions/definitions.h:174:9`! <<cxx . . $ QDebug#`operator<<`(d8a917b173851aad). "Searching for auto-start function status failed. HOME variable not found."; |
| 67 | return AutoStartStatuscxx . . $ SystemFactory#AutoStartStatus#::Unavailablecxx . . $ SystemFactory#AutoStartStatus#Unavailable.; |
| 68 | } |
| 69 | |
| 70 | // We found correct path, now check if file exists and return correct status. |
| 71 | if (QFilecxx . . $ QFile#::existscxx . . $ QFile#exists(e1defb592416720d).(desktop_file_location)) { |
| 72 | // File exists, we must read it and check if "Hidden" attribute is defined and what is its value. |
| 73 | QSettingscxx . . $ QSettings# desktop_settingscxx . . $ QSettings#QSettings(3a5f799f337fd20b).(desktop_file_location, QSettingscxx . . $ QSettings#::IniFormatcxx . . $ QSettings#IniFormat.); |
| 74 | bool hidden_value = desktop_settings.valuecxx . . $ QSettings#value(ee46502351c4ec46).(QSLcxx . . $ `src/librssguard/definitions/definitions.h:442:9`!("Desktop Entry/Hidden"), falsecxx . . $ QVariant#QVariant(9f0ba574c1c44ffc).).toBoolcxx . . $ QVariant#toBool(50ce9a9e25b4a850).(); |
| 75 | |
| 76 | return hidden_value ? AutoStartStatuscxx . . $ SystemFactory#AutoStartStatus#::Disabledcxx . . $ SystemFactory#AutoStartStatus#Disabled. : AutoStartStatuscxx . . $ SystemFactory#AutoStartStatus#::Enabledcxx . . $ SystemFactory#AutoStartStatus#Enabled.; |
| 77 | } |
| 78 | else { |
| 79 | return AutoStartStatuscxx . . $ SystemFactory#AutoStartStatus#::Disabledcxx . . $ SystemFactory#AutoStartStatus#Disabled.; |
| 80 | } |
| 81 | #else |
| 82 | // Disable auto-start functionality on unsupported platforms. |
| 83 | return AutoStartStatus::Unavailable; |
| 84 | #endif |
| 85 | } |
| 86 | |
| 87 | #if defined(Q_OS_UNIXcxx . . $ `<external>/7933076451316529972/qsystemdetection.h:149:11`!) && !defined(Q_OS_MACOS) |
| 88 | QStringcxx . . $ QString# SystemFactorycxx . . $ SystemFactory#::autostartDesktopFileLocationcxx . . $ SystemFactory#autostartDesktopFileLocation(6ef7b6c27b00b43d).() const { |
| 89 | const QStringcxx . . $ QString# xdg_config_pathcxx . . $ QString#QString(45672f3c6961a244).(qgetenvcxx . . $ qgetenv(531409eeffcde449).("XDG_CONFIG_HOME")); |
| 90 | QStringcxx . . $ QString# desktop_file_locationcxx . . $ QString#QString(ced63f7c635d850d).; |
| 91 | |
| 92 | if (!xdg_config_path.isEmptycxx . . $ QString#isEmpty(3482b152b9333168).()) { |
| 93 | // XDG_CONFIG_HOME variable is specified. Look for .desktop file |
| 94 | // in 'autostart' subdirectory. |
| 95 | desktop_file_location =cxx . . $ QString#`operator=`(4f35bf974e7f8568). xdg_config_path +cxx . . $ operator+(adfbdceb504720ce). QSLcxx . . $ `src/librssguard/definitions/definitions.h:442:9`!("/autostart/") +cxx . . $ operator+(adfbdceb504720ce). APP_REVERSE_NAMEcxx . . $ `<built-in>:488:9`! +cxx . . $ operator+(adfbdceb504720ce). QSLcxx . . $ `src/librssguard/definitions/definitions.h:442:9`!(".desktop"); |
| 96 | } |
| 97 | else { |
| 98 | // Desired variable is not set, look for the default 'autostart' subdirectory. |
| 99 | const QStringcxx . . $ QString# home_directorycxx . . $ QString#QString(45672f3c6961a244).(qgetenvcxx . . $ qgetenv(531409eeffcde449).("HOME")); |
| 100 | |
| 101 | if (!home_directory.isEmptycxx . . $ QString#isEmpty(3482b152b9333168).()) { |
| 102 | // Home directory exists. Check if target .desktop file exists and |
| 103 | // return according status. |
| 104 | desktop_file_location =cxx . . $ QString#`operator=`(4f35bf974e7f8568). home_directory +cxx . . $ operator+(adfbdceb504720ce). QSLcxx . . $ `src/librssguard/definitions/definitions.h:442:9`!("/.config/autostart/") +cxx . . $ operator+(adfbdceb504720ce). APP_REVERSE_NAMEcxx . . $ `<built-in>:488:9`! +cxx . . $ operator+(adfbdceb504720ce). QSLcxx . . $ `src/librssguard/definitions/definitions.h:442:9`!(".desktop"); |
| 105 | } |
| 106 | } |
| 107 | |
| 108 | return desktop_file_locationcxx . . $ QString#QString(28715ad661ad3cec).; |
| 109 | } |
| 110 | |
| 111 | #endif |
| 112 | |
| 113 | bool SystemFactorycxx . . $ SystemFactory#::setAutoStartStatuscxx . . $ SystemFactory#setAutoStartStatus(f0f15b2958e0b16).(AutoStartStatuscxx . . $ SystemFactory#AutoStartStatus# new_status) { |
| 114 | const SystemFactorycxx . . $ SystemFactory#::AutoStartStatuscxx . . $ SystemFactory#AutoStartStatus# current_status = SystemFactorycxx . . $ SystemFactory#::autoStartStatuscxx . . $ SystemFactory#autoStartStatus(c24e8a3ce51f2b39).(); |
| 115 | |
| 116 | // Auto-start feature is not even available, exit. |
| 117 | if (current_status == AutoStartStatuscxx . . $ SystemFactory#AutoStartStatus#::Unavailablecxx . . $ SystemFactory#AutoStartStatus#Unavailable.) { |
| 118 | return false; |
| 119 | } |
| 120 | |
| 121 | #if defined(Q_OS_WIN) |
| 122 | QSettings registry_key(QSL("HKEY_CURRENT_USER\\Software\\Microsoft\\Windows\\CurrentVersion\\Run"), |
| 123 | QSettings::Format::NativeFormat); |
| 124 | |
| 125 | switch (new_status) { |
| 126 | case AutoStartStatus::Enabled: { |
| 127 | QStringList args = qApp->rawCliArgs(); |
| 128 | auto std_args = boolinq::from(args.begin(), args.end()) |
| 129 | .select([](const QString& arg) { |
| 130 | if (arg.contains(QL1S(" ")) && !arg.startsWith(QL1S("\""))) { |
| 131 | return QSL("\"%1\"").arg(arg); |
| 132 | } |
| 133 | else { |
| 134 | return arg; |
| 135 | } |
| 136 | }) |
| 137 | .toStdList(); |
| 138 | args = FROM_STD_LIST(QStringList, std_args); |
| 139 | |
| 140 | QString app_run_line = args.join(QL1C(' ')); |
| 141 | registry_key.setValue(QSL(APP_LOW_NAME), app_run_line); |
| 142 | return true; |
| 143 | } |
| 144 | |
| 145 | case AutoStartStatus::Disabled: |
| 146 | registry_key.remove(QSL(APP_LOW_NAME)); |
| 147 | return true; |
| 148 | |
| 149 | default: |
| 150 | return false; |
| 151 | } |
| 152 | #elif defined(Q_OS_UNIXcxx . . $ `<external>/7933076451316529972/qsystemdetection.h:149:11`!) && !defined(Q_OS_MACOS) |
| 153 | // Note that we expect here that no other program uses |
| 154 | // "rssguard.desktop" desktop file. |
| 155 | const QStringcxx . . $ QString# destination_file = autostartDesktopFileLocationcxx . . $ SystemFactory#autostartDesktopFileLocation(6ef7b6c27b00b43d).(); |
| 156 | const QStringcxx . . $ QString# destination_folder = QFileInfocxx . . $ QFileInfo#QFileInfo(3520e46b33348bf6).(destination_file).absolutePathcxx . . $ QFileInfo#absolutePath(6ef7b6c27b00b43d).(); |
| 157 | |
| 158 | switch (new_status) { |
| 159 | case AutoStartStatuscxx . . $ SystemFactory#AutoStartStatus#::Enabledcxx . . $ SystemFactory#AutoStartStatus#Enabled.: { |
| 160 | if (QFilecxx . . $ QFile#::existscxx . . $ QFile#exists(e1defb592416720d).(destination_file)) { |
| 161 | if (!QFilecxx . . $ QFile#::removecxx . . $ QFile#remove(e1defb592416720d).(destination_file)) { |
| 162 | return false; |
| 163 | } |
| 164 | } |
| 165 | |
| 166 | if (!QDircxx . . $ QDir#QDir(3520e46b33348bf6).().mkpathcxx . . $ QDir#mkpath(48f7a61be61bdeff).(destination_folder)) { |
| 167 | return false; |
| 168 | } |
| 169 | |
| 170 | const QStringcxx . . $ QString# source_autostart_desktop_file = |
| 171 | QStringcxx . . $ QString#(APP_DESKTOP_ENTRY_PATHcxx . . $ `src/librssguard/definitions/definitions.h:398:9`!) +cxx . . $ operator+(adfbdceb504720ce). QDircxx . . $ QDir#::separatorcxx . . $ QDir#separator(44eb9225326fcbf5).() +cxx . . $ operator+(adfbdceb504720ce). APP_DESKTOP_ENTRY_FILEcxx . . $ `src/librssguard/definitions/definitions.h:396:9`!; |
| 172 | |
| 173 | try { |
| 174 | QStringcxx . . $ QString# desktop_file_contents = QStringcxx . . $ QString#::fromUtf8cxx . . $ QString#fromUtf8(4e15edac36d215be).(IOFactorycxx . . $ IOFactory#::readFilecxx . . $ IOFactory#readFile(743b31b35d83e992).(source_autostart_desktop_file)); |
| 175 | |
| 176 | QStringListcxx . . $ QStringList# args = qAppcxx . . $ `src/librssguard/miscellaneous/application.h:30:9`!->rawCliArgscxx . . $ Application#rawCliArgs(2b25566bdf736d18).(); |
| 177 | auto std_args = boolinqcxx . . $ boolinq/::fromcxx . . $ boolinq/from(b7d1e764049f5e37).(args.begincxx . . $ QList#begin(ca2520f641887418).(), args.endcxx . . $ QList#end(ca2520f641887418).()) |
| 178 | .selectcxx . . $ boolinq/Linq#select(a3f5bd4cd382e0ee).([](const QStringcxx . . $ QString#& arg) { |
| 179 | if (arg.containscxx . . $ QString#contains(9b0c247ef39438e0).(QL1Scxx . . $ `src/librssguard/definitions/definitions.h:449:9`!(" ")) && !arg.startsWithcxx . . $ QString#startsWith(9b0c247ef39438e0).(QL1Scxx . . $ `src/librssguard/definitions/definitions.h:449:9`!("\""))) { |
| 180 | return QSLcxx . . $ `src/librssguard/definitions/definitions.h:442:9`!("\"%1\"").argcxx . . $ QString#arg(ad0bca07273edcc2).(arg); |
| 181 | } |
| 182 | else { |
| 183 | return argcxx . . $ QString#QString(132dd6869045752b).; |
| 184 | } |
| 185 | }) |
| 186 | .toStdListcxx . . $ boolinq/Linq#toStdList(2989115be80c3067).(); |
| 187 | args =cxx . . $ QList#`operator=`(da1cd3e1ddeb0856). FROM_STD_LISTcxx . . $ `src/librssguard/definitions/definitions.h:405:9`!(QStringList, std_args); |
| 188 | |
| 189 | #if defined(IS_FLATPAK_BUILD) |
| 190 | const QString flatpak_run = QSL("flatpak run %1").arg(APP_REVERSE_NAME); |
| 191 | |
| 192 | args = args.mid(1); |
| 193 | args.prepend(flatpak_run); |
| 194 | #endif |
| 195 | |
| 196 | desktop_file_contents.replacecxx . . $ QString#replace(192e628656427d1c).("Exec=@APP_LOW_NAME@"cxx . . $ QString#QString(85c52e162fed56f9)., QSLcxx . . $ `src/librssguard/definitions/definitions.h:442:9`!("Exec=") +cxx . . $ operator+(adfbdceb504720ce). args.joincxx . . $ QListSpecialMethods#join(227e33e1a3bf1f91).(QL1Ccxx . . $ `src/librssguard/definitions/definitions.h:455:9`!(' '))); |
| 197 | desktop_file_contents.replacecxx . . $ QString#replace(192e628656427d1c).("@APPDATA_SUMMARY@"cxx . . $ QString#QString(85c52e162fed56f9)., APPDATA_SUMMARYcxx . . $ `<built-in>:480:9`!); |
| 198 | desktop_file_contents.replacecxx . . $ QString#replace(192e628656427d1c).("@APPDATA_NAME@"cxx . . $ QString#QString(85c52e162fed56f9)., APPDATA_NAMEcxx . . $ `<built-in>:479:9`!); |
| 199 | desktop_file_contents.replacecxx . . $ QString#replace(192e628656427d1c).("@APP_REVERSE_NAME@"cxx . . $ QString#QString(85c52e162fed56f9)., APP_REVERSE_NAMEcxx . . $ `<built-in>:488:9`!); |
| 200 | desktop_file_contents.replacecxx . . $ QString#replace(192e628656427d1c).("@APP_LOW_NAME@"cxx . . $ QString#QString(85c52e162fed56f9)., APP_LOW_NAMEcxx . . $ `<built-in>:486:9`!); |
| 201 | |
| 202 | IOFactorycxx . . $ IOFactory#::writeFilecxx . . $ IOFactory#writeFile(88f4c41ca0e941aa).(destination_file, desktop_file_contents.toUtf8cxx . . $ QString#toUtf8(ef52b713090bc85a).()); |
| 203 | } |
| 204 | catch (const ApplicationExceptioncxx . . $ ApplicationException#& ex) { |
| 205 | return false; |
| 206 | } |
| 207 | |
| 208 | return true; |
| 209 | } |
| 210 | |
| 211 | case AutoStartStatuscxx . . $ SystemFactory#AutoStartStatus#::Disabledcxx . . $ SystemFactory#AutoStartStatus#Disabled.: |
| 212 | return QFilecxx . . $ QFile#::removecxx . . $ QFile#remove(e1defb592416720d).(destination_file); |
| 213 | |
| 214 | default: |
| 215 | return false; |
| 216 | } |
| 217 | #else |
| 218 | return false; |
| 219 | #endif |
| 220 | } |
| 221 | |
| 222 | QStringcxx . . $ QString# SystemFactorycxx . . $ SystemFactory#::loggedInUsercxx . . $ SystemFactory#loggedInUser(6ef7b6c27b00b43d).() const { |
| 223 | QStringcxx . . $ QString# name = qEnvironmentVariablecxx . . $ qEnvironmentVariable(89a325da49db1678).("USER"); |
| 224 | |
| 225 | if (name.isEmptycxx . . $ QString#isEmpty(3482b152b9333168).()) { |
| 226 | name =cxx . . $ QString#`operator=`(4f35bf974e7f8568). qEnvironmentVariablecxx . . $ qEnvironmentVariable(89a325da49db1678).("USERNAME"); |
| 227 | } |
| 228 | |
| 229 | if (name.isEmptycxx . . $ QString#isEmpty(3482b152b9333168).()) { |
| 230 | name =cxx . . $ QString#`operator=`(4f35bf974e7f8568). trcxx . . $ SystemFactory#tr(75d9f1c324b4579d).("anonymous"); |
| 231 | } |
| 232 | |
| 233 | return namecxx . . $ QString#QString(28715ad661ad3cec).; |
| 234 | } |
| 235 | |
| 236 | void SystemFactorycxx . . $ SystemFactory#::checkForUpdatescxx . . $ SystemFactory#checkForUpdates(83f5f38750778ac8).() const { |
| 237 | auto* downloader = new Downloadercxx . . $ Downloader#(); |
| 238 | |
| 239 | connectcxx . . $ QObject#connect(dad3a9587f3dce3c).(downloader, &Downloadercxx . . $ Downloader#::completedcxx . . $ Downloader#completed(2e59411b5306353b)., this, [this, downloader]() { |
| 240 | QPaircxx . . $ QPair#<QListcxx . . $ QList#<UpdateInfocxx . . $ UpdateInfo#>, QNetworkReplycxx . . $ QNetworkReply#::NetworkErrorcxx . . $ QNetworkReply#NetworkError#> resultcxx . . $ std/pair#pair(49f6e7a06ebc5aa8).; |
| 241 | result.secondcxx . . $ std/pair#second. = downloader->lastOutputErrorcxx . . $ Downloader#lastOutputError(c916dcceceba1ae7).(); |
| 242 | |
| 243 | if (result.secondcxx . . $ std/pair#second. == QNetworkReplycxx . . $ QNetworkReply#::NoErrorcxx . . $ QNetworkReply#NoError.) { |
| 244 | QByteArraycxx . . $ QByteArray# obtained_data = downloader->lastOutputDatacxx . . $ Downloader#lastOutputData(a96750bfbcb1fbe9).(); |
| 245 | result.firstcxx . . $ std/pair#first. =cxx . . $ QList#`operator=`(34784ef49231bb02). parseUpdatesFilecxx . . $ SystemFactory#parseUpdatesFile(630d206876e6bdcc).(obtained_data); |
| 246 | } |
| 247 | |
| 248 | emitcxx . . $ `<external>/4830994369567095248/qtmetamacros.h:51:10`! updatesCheckedcxx . . $ SystemFactory#updatesChecked(3f40250543adfaa5).(resultcxx . . $ std/pair#pair(31533a781ed7dba3).); |
| 249 | downloader->deleteLatercxx . . $ QObject#deleteLater(49f6e7a06ebc5aa8).(); |
| 250 | }); |
| 251 | downloader->downloadFilecxx . . $ Downloader#downloadFile(59dca4567f557537).(QSLcxx . . $ `src/librssguard/definitions/definitions.h:442:9`!(RELEASES_LISTcxx . . $ `src/librssguard/definitions/definitions.h:62:9`!)); |
| 252 | } |
| 253 | |
| 254 | void SystemFactorycxx . . $ SystemFactory#::checkForUpdatesOnStartupcxx . . $ SystemFactory#checkForUpdatesOnStartup(49f6e7a06ebc5aa8).() { |
| 255 | #if !defined(NO_UPDATE_CHECK) |
| 256 | if (qAppcxx . . $ `src/librssguard/miscellaneous/application.h:30:9`!->settingscxx . . $ Application#settings(951936487a2d9252).()->valuecxx . . $ Settings#value(8f1f29a69568d71a).(GROUPcxx . . $ `src/librssguard/miscellaneous/settings.h:32:9`!(General), SETTINGcxx . . $ `src/librssguard/miscellaneous/settings.h:30:9`!(General::UpdateOnStartup)).toBoolcxx . . $ QVariant#toBool(50ce9a9e25b4a850).()) { |
| 257 | QObjectcxx . . $ QObject#::connectcxx . . $ QObject#connect(dad3a9587f3dce3c).(qAppcxx . . $ `src/librssguard/miscellaneous/application.h:30:9`!->systemcxx . . $ Application#system(4ec014040ff5a0f7).(), |
| 258 | &SystemFactorycxx . . $ SystemFactory#::updatesCheckedcxx . . $ SystemFactory#updatesChecked(3f40250543adfaa5)., |
| 259 | this, |
| 260 | [&](const QPaircxx . . $ QPair#<QListcxx . . $ QList#<UpdateInfocxx . . $ UpdateInfo#>, QNetworkReplycxx . . $ QNetworkReply#::NetworkErrorcxx . . $ QNetworkReply#NetworkError#>& updates) { |
| 261 | QObjectcxx . . $ QObject#::disconnectcxx . . $ QObject#disconnect(bea847693c2a9ff4).(qAppcxx . . $ `src/librssguard/miscellaneous/application.h:30:9`!->systemcxx . . $ Application#system(4ec014040ff5a0f7).(), &SystemFactorycxx . . $ SystemFactory#::updatesCheckedcxx . . $ SystemFactory#updatesChecked(3f40250543adfaa5)., this, nullptr); |
| 262 | |
| 263 | if (!updates.firstcxx . . $ std/pair#first..isEmptycxx . . $ QList#isEmpty(3482b152b9333168).() && updates.secondcxx . . $ std/pair#second. == QNetworkReplycxx . . $ QNetworkReply#::NetworkErrorcxx . . $ QNetworkReply#NetworkError#::NoErrorcxx . . $ QNetworkReply#NoError. && |
| 264 | SystemFactorycxx . . $ SystemFactory#::isVersionNewercxx . . $ SystemFactory#isVersionNewer(edf9e4f73813982f).(updates.firstcxx . . $ std/pair#first..atcxx . . $ QList#at(c7965f769b39929).(0).m_availableVersioncxx . . $ UpdateInfo#m_availableVersion., QSLcxx . . $ `src/librssguard/definitions/definitions.h:442:9`!(APP_VERSIONcxx . . $ `<built-in>:496:9`!))) { |
| 265 | qAppcxx . . $ `src/librssguard/miscellaneous/application.h:30:9`!->showGuiMessagecxx . . $ Application#showGuiMessage(cf433640a87c3b52).(Notificationcxx . . $ Notification#::Eventcxx . . $ Notification#Event#::NewAppVersionAvailablecxx . . $ Notification#Event#NewAppVersionAvailable., |
| 266 | {cxx . . $ GuiMessage#GuiMessage(b833bfd374dccacd).QObjectcxx . . $ QObject#::trcxx . . $ QObject#tr(75d9f1c324b4579d).("New version available"), |
| 267 | QObjectcxx . . $ QObject#::trcxx . . $ QObject#tr(75d9f1c324b4579d).("Click the bubble for more information."), |
| 268 | QSystemTrayIconcxx . . $ QSystemTrayIcon#::Informationcxx . . $ QSystemTrayIcon#Information.}, |
| 269 | {cxx . . $ GuiMessageDestination#GuiMessageDestination(9e113dd3a0d25c95).}, |
| 270 | {cxx . . $ GuiAction#GuiAction(7d816f6132cf943f).trcxx . . $ SystemFactory#tr(75d9f1c324b4579d).("See new version info"), [cxx . . $ std/function#function(bdc3712e480e4d04).] { |
| 271 | FormUpdatecxx . . $ FormUpdate#(qAppcxx . . $ `src/librssguard/miscellaneous/application.h:30:9`!->mainFormcxx . . $ Application#mainForm(da73b49c3e1670d9).()).execcxx . . $ QDialog#exec(b126dc7c1de90089).(); |
| 272 | }}); |
| 273 | } |
| 274 | }); |
| 275 | checkForUpdatescxx . . $ SystemFactory#checkForUpdates(83f5f38750778ac8).(); |
| 276 | } |
| 277 | #endif |
| 278 | } |
| 279 | |
| 280 | bool SystemFactorycxx . . $ SystemFactory#::isVersionNewercxx . . $ SystemFactory#isVersionNewer(edf9e4f73813982f).(const QStringcxx . . $ QString#& new_version, const QStringcxx . . $ QString#& base_version) { |
| 281 | QVersionNumbercxx . . $ QVersionNumber# nw = QVersionNumbercxx . . $ QVersionNumber#::fromStringcxx . . $ QVersionNumber#fromString(65c6dfcd1a357790).(new_versioncxx . . $ QAnyStringView#QAnyStringView(132dd6869045752b).); |
| 282 | QVersionNumbercxx . . $ QVersionNumber# bs = QVersionNumbercxx . . $ QVersionNumber#::fromStringcxx . . $ QVersionNumber#fromString(65c6dfcd1a357790).(base_versioncxx . . $ QAnyStringView#QAnyStringView(132dd6869045752b).); |
| 283 | |
| 284 | return nw >cxx . . $ `operator>`(6fc8c8b9b6cf52c7). bs; |
| 285 | } |
| 286 | |
| 287 | bool SystemFactorycxx . . $ SystemFactory#::isVersionEqualOrNewercxx . . $ SystemFactory#isVersionEqualOrNewer(edf9e4f73813982f).(const QStringcxx . . $ QString#& new_version, const QStringcxx . . $ QString#& base_version) { |
| 288 | return new_version ==cxx . . $ `operator==`(5bc2975d2d751687). base_version || isVersionNewercxx . . $ SystemFactory#isVersionNewer(edf9e4f73813982f).(new_version, base_version); |
| 289 | } |
| 290 | |
| 291 | bool SystemFactorycxx . . $ SystemFactory#::openFolderFilecxx . . $ SystemFactory#openFolderFile(e1defb592416720d).(const QStringcxx . . $ QString#& file_path) { |
| 292 | #if defined(Q_OS_WIN) |
| 293 | return QProcess::startDetached(QSL("explorer.exe"), {"/select,", QDir::toNativeSeparators(file_path)}); |
| 294 | #else |
| 295 | const QStringcxx . . $ QString# folder = QDircxx . . $ QDir#::toNativeSeparatorscxx . . $ QDir#toNativeSeparators(fd988a2ab94d906b).(QFileInfocxx . . $ QFileInfo#QFileInfo(3520e46b33348bf6).(file_path).absoluteDircxx . . $ QFileInfo#absoluteDir(ac6552cf9b6b4ed1).().absolutePathcxx . . $ QDir#absolutePath(6ef7b6c27b00b43d).()); |
| 296 | |
| 297 | return QDesktopServicescxx . . $ QDesktopServices#::openUrlcxx . . $ QDesktopServices#openUrl(3c1e6c2c1d0bcefc).(QUrlcxx . . $ QUrl#::fromLocalFilecxx . . $ QUrl#fromLocalFile(daf4b0201622af21).(folder)); |
| 298 | #endif |
| 299 | } |
| 300 | |
| 301 | QListcxx . . $ QList#<UpdateInfocxx . . $ UpdateInfo#> SystemFactorycxx . . $ SystemFactory#::parseUpdatesFilecxx . . $ SystemFactory#parseUpdatesFile(630d206876e6bdcc).(const QByteArraycxx . . $ QByteArray#& updates_file) const { |
| 302 | QListcxx . . $ QList#<UpdateInfocxx . . $ UpdateInfo#> updatescxx . . $ QList#QList(ced63f7c635d850d).; |
| 303 | QJsonArraycxx . . $ QJsonArray# document = QJsonDocumentcxx . . $ QJsonDocument#::fromJsoncxx . . $ QJsonDocument#fromJson(731a4d2b2d08d93c).(updates_file).arraycxx . . $ QJsonDocument#array(98974f179f8308bf).(); |
| 304 | |
| 305 | for (QJsonValueRefcxx . . $ QJsonValueRef# i : document) { |
| 306 | QJsonObjectcxx . . $ QJsonObject# release = i.toObjectcxx . . $ QJsonValueRef#toObject(ac8af9874357714b).(); |
| 307 | |
| 308 | if (release[cxx . . $ QJsonObject#`operator[]`(6d95a036fce085b4).QSLcxx . . $ `src/librssguard/definitions/definitions.h:442:9`!("tag_name")].toStringcxx . . $ QJsonValueRef#toString(5555d9024dcf93fb).() ==cxx . . $ `operator==`(5bc2975d2d751687). QSLcxx . . $ `src/librssguard/definitions/definitions.h:442:9`!("devbuild")) { |
| 309 | continue; |
| 310 | } |
| 311 | |
| 312 | UpdateInfocxx . . $ UpdateInfo# update; |
| 313 | |
| 314 | update.m_availableVersioncxx . . $ UpdateInfo#m_availableVersion. =cxx . . $ QString#`operator=`(4f35bf974e7f8568). release[cxx . . $ QJsonObject#`operator[]`(6d95a036fce085b4).QSLcxx . . $ `src/librssguard/definitions/definitions.h:442:9`!("tag_name")].toStringcxx . . $ QJsonValueRef#toString(5555d9024dcf93fb).(); |
| 315 | update.m_datecxx . . $ UpdateInfo#m_date. =cxx . . $ QDateTime#`operator=`(6dbf9ff24243cdf2). QDateTimecxx . . $ QDateTime#::fromStringcxx . . $ QDateTime#fromString(a8b8e7782c8add4).(release[cxx . . $ QJsonObject#`operator[]`(6d95a036fce085b4).QSLcxx . . $ `src/librssguard/definitions/definitions.h:442:9`!("published_at")].toStringcxx . . $ QJsonValueRef#toString(5555d9024dcf93fb).(), QSLcxx . . $ `src/librssguard/definitions/definitions.h:442:9`!("yyyy-MM-ddTHH:mm:ssZ")); |
| 316 | update.m_changescxx . . $ UpdateInfo#m_changes. =cxx . . $ QString#`operator=`(4f35bf974e7f8568). release[cxx . . $ QJsonObject#`operator[]`(6d95a036fce085b4).QSLcxx . . $ `src/librssguard/definitions/definitions.h:442:9`!("body")].toStringcxx . . $ QJsonValueRef#toString(5555d9024dcf93fb).(); |
| 317 | QJsonArraycxx . . $ QJsonArray# assets = release[cxx . . $ QJsonObject#`operator[]`(6d95a036fce085b4).QSLcxx . . $ `src/librssguard/definitions/definitions.h:442:9`!("assets")].toArraycxx . . $ QJsonValueRef#toArray(98974f179f8308bf).(); |
| 318 | |
| 319 | for (QJsonValueRefcxx . . $ QJsonValueRef# j : assets) { |
| 320 | QJsonObjectcxx . . $ QJsonObject# asset = j.toObjectcxx . . $ QJsonValueRef#toObject(ac8af9874357714b).(); |
| 321 | UpdateUrlcxx . . $ UpdateUrl# url; |
| 322 | |
| 323 | url.m_fileUrlcxx . . $ UpdateUrl#m_fileUrl. =cxx . . $ QString#`operator=`(4f35bf974e7f8568). asset[cxx . . $ QJsonObject#`operator[]`(6d95a036fce085b4).QSLcxx . . $ `src/librssguard/definitions/definitions.h:442:9`!("browser_download_url")].toStringcxx . . $ QJsonValueRef#toString(5555d9024dcf93fb).(); |
| 324 | url.m_namecxx . . $ UpdateUrl#m_name. =cxx . . $ QString#`operator=`(4f35bf974e7f8568). asset[cxx . . $ QJsonObject#`operator[]`(6d95a036fce085b4).QSLcxx . . $ `src/librssguard/definitions/definitions.h:442:9`!("name")].toStringcxx . . $ QJsonValueRef#toString(5555d9024dcf93fb).(); |
| 325 | url.m_sizecxx . . $ UpdateUrl#m_size. =cxx . . $ QString#`operator=`(4f35bf974e7f8568). asset[cxx . . $ QJsonObject#`operator[]`(6d95a036fce085b4).QSLcxx . . $ `src/librssguard/definitions/definitions.h:442:9`!("size")].toVariantcxx . . $ QJsonValueRef#toVariant(23280f95d1ccaa1f).().toStringcxx . . $ QVariant#toString(6ef7b6c27b00b43d).() +cxx . . $ operator+(adfbdceb504720ce). trcxx . . $ SystemFactory#tr(75d9f1c324b4579d).(" bytes"); |
| 326 | update.m_urlscxx . . $ UpdateInfo#m_urls..appendcxx . . $ QList#append(200d2dc08238a4ed).(url); |
| 327 | } |
| 328 | |
| 329 | updates.appendcxx . . $ QList#append(200d2dc08238a4ed).(update); |
| 330 | } |
| 331 | |
| 332 | stdcxx . . $ std/::sortcxx . . $ std/sort(4d3091562df4e52e).(updates.begincxx . . $ QList#begin(ca2520f641887418).(), updates.endcxx . . $ QList#end(ca2520f641887418).(), [](const UpdateInfocxx . . $ UpdateInfo#& a, const UpdateInfocxx . . $ UpdateInfo#& b) -> bool { |
| 333 | return a.m_datecxx . . $ UpdateInfo#m_date. >cxx . . $ `operator>`(ae3dca24290d889b). b.m_datecxx . . $ UpdateInfo#m_date.; |
| 334 | }); |
| 335 | return updates; |
| 336 | } |