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
int value(const QString &arg) const int value(const QString &arg) const
{ {
QString val = StringOption::value(arg); const QString val = StringOption::value(arg);
bool ok = false; bool ok = false;
int res = val.toInt(&ok); const int res = val.toInt(&ok);
if (!ok) if (!ok)
{
throw CommandLineParameterError(QObject::tr("Parameter '%1' must follow syntax '%1=%2'", throw CommandLineParameterError(QObject::tr("Parameter '%1' must follow syntax '%1=%2'",
"e.g. Parameter '--webui-port' must follow syntax '--webui-port=<value>'") "e.g. Parameter '--webui-port' must follow syntax '--webui-port=<value>'")
.arg(fullParameter(), u"<integer value>"_qs)); .arg(fullParameter(), u"<integer value>"_qs));
}
return res; return res;
} }

5
src/base/rss/rss_parser.cpp

@ -723,13 +723,16 @@ void RSS::Private::Parser::parseAtomArticle(QXmlStreamReader &xml)
: xml.attributes().value(u"href"_qs).toString()); : xml.attributes().value(u"href"_qs).toString());
if (link.startsWith(u"magnet:", Qt::CaseInsensitive)) if (link.startsWith(u"magnet:", Qt::CaseInsensitive))
{
article[Article::KeyTorrentURL] = link; // magnet link instead of a news URL article[Article::KeyTorrentURL] = link; // magnet link instead of a news URL
}
else else
{
// Atom feeds can have relative links, work around this and // Atom feeds can have relative links, work around this and
// take the stress of figuring article full URI from UI // take the stress of figuring article full URI from UI
// Assemble full URI // Assemble full URI
article[Article::KeyLink] = (m_baseUrl.isEmpty() ? link : m_baseUrl + link); article[Article::KeyLink] = (m_baseUrl.isEmpty() ? link : m_baseUrl + link);
}
} }
else if ((name == u"summary") || (name == u"content")) else if ((name == u"summary") || (name == u"content"))
{ {

57
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)) if ((m_state == Error) || (m_state == Idle) || (m_state == RequestIdle) || (m_state == RequestBusy))
return; 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; m_state = RequestIdle;
qDebug("D-Bus: PowerManagementInhibitor: Requesting idle");
QList<QVariant> args; QDBusMessage call = m_useGSM
args << m_cookie; ? QDBusMessage::createMethodCall(
call.setArguments(args); 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); QDBusPendingCall pcall = QDBusConnection::sessionBus().asyncCall(call, 1000);
auto *watcher = new QDBusPendingCallWatcher(pcall, this); 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)) if ((m_state == Error) || (m_state == Busy) || (m_state == RequestBusy) || (m_state == RequestIdle))
return; return;
m_state = RequestBusy;
qDebug("D-Bus: PowerManagementInhibitor: Requesting busy"); qDebug("D-Bus: PowerManagementInhibitor: Requesting busy");
QDBusMessage call; QDBusMessage call = m_useGSM
if (!m_useGSM) ? QDBusMessage::createMethodCall(
call = 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"_qs,
u"/org/freedesktop/PowerManagement/Inhibit"_qs, u"/org/freedesktop/PowerManagement/Inhibit"_qs,
u"org.freedesktop.PowerManagement.Inhibit"_qs, u"org.freedesktop.PowerManagement.Inhibit"_qs,
u"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}; QList<QVariant> args = {u"qBittorrent"_qs};
if (m_useGSM) args << 0u; if (m_useGSM)
args << 0u;
args << u"Active torrents are presented"_qs; args << u"Active torrents are presented"_qs;
if (m_useGSM) args << 8u; if (m_useGSM)
args << 8u;
call.setArguments(args); call.setArguments(args);
QDBusPendingCall pcall = QDBusConnection::sessionBus().asyncCall(call, 1000); QDBusPendingCall pcall = QDBusConnection::sessionBus().asyncCall(call, 1000);

13
src/gui/rss/feedlistwidget.cpp

@ -243,15 +243,12 @@ void FeedListWidget::dragMoveEvent(QDragMoveEvent *event)
QTreeWidget::dragMoveEvent(event); QTreeWidget::dragMoveEvent(event);
QTreeWidgetItem *item = itemAt(event->pos()); QTreeWidgetItem *item = itemAt(event->pos());
// Prohibit dropping onto global unread counter if ((item == m_unreadStickyItem) // Prohibit dropping onto global unread counter
if (item == m_unreadStickyItem) || selectedItems().contains(m_unreadStickyItem) // Prohibit dragging of global unread counter
event->ignore(); || (item && isFeed(item))) // Prohibit dropping onto feeds
// Prohibit dragging of global unread counter {
else if (selectedItems().contains(m_unreadStickyItem))
event->ignore();
// Prohibit dropping onto feeds
else if (item && isFeed(item))
event->ignore(); event->ignore();
}
} }
void FeedListWidget::dropEvent(QDropEvent *event) void FeedListWidget::dropEvent(QDropEvent *event)

6
src/webui/api/synccontroller.cpp

@ -331,17 +331,23 @@ namespace
for (const QVariant &item : data) for (const QVariant &item : data)
{ {
if (!prevData.contains(item)) if (!prevData.contains(item))
{
// new list item found - append it to syncData // new list item found - append it to syncData
syncData.append(item); syncData.append(item);
}
else else
{
// unchanged list item found - remove it from prevData // unchanged list item found - remove it from prevData
prevData.removeOne(item); prevData.removeOne(item);
}
} }
if (!prevData.isEmpty()) if (!prevData.isEmpty())
{
// prevData contains only items that are missing now - // prevData contains only items that are missing now -
// put them in removedItems // put them in removedItems
removedItems = prevData; removedItems = prevData;
}
} }
} }

4
src/webui/webapplication.cpp

@ -730,9 +730,11 @@ bool WebApplication::isCrossSiteRequest(const Http::Request &request) const
{ {
const bool isInvalid = !isSameOrigin(urlFromHostHeader(targetOrigin), originValue); const bool isInvalid = !isSameOrigin(urlFromHostHeader(targetOrigin), originValue);
if (isInvalid) if (isInvalid)
{
LogMsg(tr("WebUI: Origin header & Target origin mismatch! Source IP: '%1'. Origin header: '%2'. Target origin: '%3'") LogMsg(tr("WebUI: Origin header & Target origin mismatch! Source IP: '%1'. Origin header: '%2'. Target origin: '%3'")
.arg(m_env.clientAddress.toString(), originValue, targetOrigin) .arg(m_env.clientAddress.toString(), originValue, targetOrigin)
, Log::WARNING); , Log::WARNING);
}
return isInvalid; return isInvalid;
} }
@ -740,9 +742,11 @@ bool WebApplication::isCrossSiteRequest(const Http::Request &request) const
{ {
const bool isInvalid = !isSameOrigin(urlFromHostHeader(targetOrigin), refererValue); const bool isInvalid = !isSameOrigin(urlFromHostHeader(targetOrigin), refererValue);
if (isInvalid) if (isInvalid)
{
LogMsg(tr("WebUI: Referer header & Target origin mismatch! Source IP: '%1'. Referer header: '%2'. Target origin: '%3'") LogMsg(tr("WebUI: Referer header & Target origin mismatch! Source IP: '%1'. Referer header: '%2'. Target origin: '%3'")
.arg(m_env.clientAddress.toString(), refererValue, targetOrigin) .arg(m_env.clientAddress.toString(), refererValue, targetOrigin)
, Log::WARNING); , Log::WARNING);
}
return isInvalid; return isInvalid;
} }

Loading…
Cancel
Save