Browse Source

Add curly braces

adaptive-webui-19844
Chocobo1 2 years ago
parent
commit
179a61d75e
No known key found for this signature in database
GPG Key ID: 210D9C873253A68C
  1. 6
      src/app/cmdoptions.cpp
  2. 5
      src/base/rss/rss_parser.cpp
  3. 57
      src/gui/powermanagement/powermanagement_x11.cpp
  4. 13
      src/gui/rss/feedlistwidget.cpp
  5. 6
      src/webui/api/synccontroller.cpp
  6. 4
      src/webui/webapplication.cpp

6
src/app/cmdoptions.cpp

@ -198,13 +198,15 @@ namespace @@ -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=<value>'")
.arg(fullParameter(), u"<integer value>"_qs));
}
return res;
}

5
src/base/rss/rss_parser.cpp

@ -723,13 +723,16 @@ void RSS::Private::Parser::parseAtomArticle(QXmlStreamReader &xml) @@ -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"))
{

57
src/gui/powermanagement/powermanagement_x11.cpp

@ -57,27 +57,21 @@ void PowerManagementInhibitor::requestIdle() @@ -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<QVariant> 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() @@ -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<QVariant> 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);

13
src/gui/rss/feedlistwidget.cpp

@ -243,15 +243,12 @@ void FeedListWidget::dragMoveEvent(QDragMoveEvent *event) @@ -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)

6
src/webui/api/synccontroller.cpp

@ -331,17 +331,23 @@ namespace @@ -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;
}
}
}

4
src/webui/webapplication.cpp

@ -730,9 +730,11 @@ bool WebApplication::isCrossSiteRequest(const Http::Request &request) const @@ -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 @@ -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;
}

Loading…
Cancel
Save