diff --git a/src/app/cmdoptions.cpp b/src/app/cmdoptions.cpp index cebfcbbf7..fa80a57dc 100644 --- a/src/app/cmdoptions.cpp +++ b/src/app/cmdoptions.cpp @@ -198,13 +198,15 @@ namespace int value(const QString &arg) const { - QString val = StringOption::value(arg); + const QString val = StringOption::value(arg); bool ok = false; - int res = val.toInt(&ok); + const int res = val.toInt(&ok); if (!ok) + { throw CommandLineParameterError(QObject::tr("Parameter '%1' must follow syntax '%1=%2'", "e.g. Parameter '--webui-port' must follow syntax '--webui-port='") .arg(fullParameter(), u""_qs)); + } return res; } diff --git a/src/base/rss/rss_parser.cpp b/src/base/rss/rss_parser.cpp index e07e7811d..ec940825a 100644 --- a/src/base/rss/rss_parser.cpp +++ b/src/base/rss/rss_parser.cpp @@ -723,13 +723,16 @@ void RSS::Private::Parser::parseAtomArticle(QXmlStreamReader &xml) : xml.attributes().value(u"href"_qs).toString()); if (link.startsWith(u"magnet:", Qt::CaseInsensitive)) + { article[Article::KeyTorrentURL] = link; // magnet link instead of a news URL + } else + { // Atom feeds can have relative links, work around this and // take the stress of figuring article full URI from UI // Assemble full URI article[Article::KeyLink] = (m_baseUrl.isEmpty() ? link : m_baseUrl + link); - + } } else if ((name == u"summary") || (name == u"content")) { diff --git a/src/gui/powermanagement/powermanagement_x11.cpp b/src/gui/powermanagement/powermanagement_x11.cpp index 18f244ea5..d6e197bab 100644 --- a/src/gui/powermanagement/powermanagement_x11.cpp +++ b/src/gui/powermanagement/powermanagement_x11.cpp @@ -57,27 +57,21 @@ void PowerManagementInhibitor::requestIdle() if ((m_state == Error) || (m_state == Idle) || (m_state == RequestIdle) || (m_state == RequestBusy)) return; - qDebug("D-Bus: PowerManagementInhibitor: Requesting idle"); - - QDBusMessage call; - if (!m_useGSM) - call = QDBusMessage::createMethodCall( - u"org.freedesktop.PowerManagement"_qs, - u"/org/freedesktop/PowerManagement/Inhibit"_qs, - u"org.freedesktop.PowerManagement.Inhibit"_qs, - u"UnInhibit"_qs); - else - call = QDBusMessage::createMethodCall( - u"org.gnome.SessionManager"_qs, - u"/org/gnome/SessionManager"_qs, - u"org.gnome.SessionManager"_qs, - u"Uninhibit"_qs); - m_state = RequestIdle; + qDebug("D-Bus: PowerManagementInhibitor: Requesting idle"); - QList args; - args << m_cookie; - call.setArguments(args); + QDBusMessage call = m_useGSM + ? QDBusMessage::createMethodCall( + u"org.gnome.SessionManager"_qs, + u"/org/gnome/SessionManager"_qs, + u"org.gnome.SessionManager"_qs, + u"Uninhibit"_qs) + : QDBusMessage::createMethodCall( + u"org.freedesktop.PowerManagement"_qs, + u"/org/freedesktop/PowerManagement/Inhibit"_qs, + u"org.freedesktop.PowerManagement.Inhibit"_qs, + u"UnInhibit"_qs); + call.setArguments({m_cookie}); QDBusPendingCall pcall = QDBusConnection::sessionBus().asyncCall(call, 1000); auto *watcher = new QDBusPendingCallWatcher(pcall, this); @@ -91,28 +85,27 @@ void PowerManagementInhibitor::requestBusy() if ((m_state == Error) || (m_state == Busy) || (m_state == RequestBusy) || (m_state == RequestIdle)) return; + m_state = RequestBusy; qDebug("D-Bus: PowerManagementInhibitor: Requesting busy"); - QDBusMessage call; - if (!m_useGSM) - call = QDBusMessage::createMethodCall( + QDBusMessage call = m_useGSM + ? QDBusMessage::createMethodCall( + u"org.gnome.SessionManager"_qs, + u"/org/gnome/SessionManager"_qs, + u"org.gnome.SessionManager"_qs, + u"Inhibit"_qs) + : QDBusMessage::createMethodCall( u"org.freedesktop.PowerManagement"_qs, u"/org/freedesktop/PowerManagement/Inhibit"_qs, u"org.freedesktop.PowerManagement.Inhibit"_qs, u"Inhibit"_qs); - else - call = QDBusMessage::createMethodCall( - u"org.gnome.SessionManager"_qs, - u"/org/gnome/SessionManager"_qs, - u"org.gnome.SessionManager"_qs, - u"Inhibit"_qs); - - m_state = RequestBusy; QList args = {u"qBittorrent"_qs}; - if (m_useGSM) args << 0u; + if (m_useGSM) + args << 0u; args << u"Active torrents are presented"_qs; - if (m_useGSM) args << 8u; + if (m_useGSM) + args << 8u; call.setArguments(args); QDBusPendingCall pcall = QDBusConnection::sessionBus().asyncCall(call, 1000); diff --git a/src/gui/rss/feedlistwidget.cpp b/src/gui/rss/feedlistwidget.cpp index dba3a7b25..000e32bfe 100644 --- a/src/gui/rss/feedlistwidget.cpp +++ b/src/gui/rss/feedlistwidget.cpp @@ -243,15 +243,12 @@ void FeedListWidget::dragMoveEvent(QDragMoveEvent *event) QTreeWidget::dragMoveEvent(event); QTreeWidgetItem *item = itemAt(event->pos()); - // Prohibit dropping onto global unread counter - if (item == m_unreadStickyItem) - event->ignore(); - // Prohibit dragging of global unread counter - else if (selectedItems().contains(m_unreadStickyItem)) - event->ignore(); - // Prohibit dropping onto feeds - else if (item && isFeed(item)) + if ((item == m_unreadStickyItem) // Prohibit dropping onto global unread counter + || selectedItems().contains(m_unreadStickyItem) // Prohibit dragging of global unread counter + || (item && isFeed(item))) // Prohibit dropping onto feeds + { event->ignore(); + } } void FeedListWidget::dropEvent(QDropEvent *event) diff --git a/src/webui/api/synccontroller.cpp b/src/webui/api/synccontroller.cpp index 6e77396ce..e63d8bd0a 100644 --- a/src/webui/api/synccontroller.cpp +++ b/src/webui/api/synccontroller.cpp @@ -331,17 +331,23 @@ namespace for (const QVariant &item : data) { if (!prevData.contains(item)) + { // new list item found - append it to syncData syncData.append(item); + } else + { // unchanged list item found - remove it from prevData prevData.removeOne(item); + } } if (!prevData.isEmpty()) + { // prevData contains only items that are missing now - // put them in removedItems removedItems = prevData; + } } } diff --git a/src/webui/webapplication.cpp b/src/webui/webapplication.cpp index 93d73e0f8..0ef09b4ff 100644 --- a/src/webui/webapplication.cpp +++ b/src/webui/webapplication.cpp @@ -730,9 +730,11 @@ bool WebApplication::isCrossSiteRequest(const Http::Request &request) const { const bool isInvalid = !isSameOrigin(urlFromHostHeader(targetOrigin), originValue); if (isInvalid) + { LogMsg(tr("WebUI: Origin header & Target origin mismatch! Source IP: '%1'. Origin header: '%2'. Target origin: '%3'") .arg(m_env.clientAddress.toString(), originValue, targetOrigin) , Log::WARNING); + } return isInvalid; } @@ -740,9 +742,11 @@ bool WebApplication::isCrossSiteRequest(const Http::Request &request) const { const bool isInvalid = !isSameOrigin(urlFromHostHeader(targetOrigin), refererValue); if (isInvalid) + { LogMsg(tr("WebUI: Referer header & Target origin mismatch! Source IP: '%1'. Referer header: '%2'. Target origin: '%3'") .arg(m_env.clientAddress.toString(), refererValue, targetOrigin) , Log::WARNING); + } return isInvalid; }