@@ -581,18 +581,18 @@ int main(int argc, char **argv)
581581 QEventLoop loop;
582582 auto *csjob = new CheckServerJob (account);
583583 csjob->setIgnoreCredentialFailure (true );
584- QObject::connect (csjob, &CheckServerJob::instanceFound, [&](const QUrl &, const QJsonObject &info) {
584+ QObject::connect (csjob, &CheckServerJob::instanceFound, &loop, [&](const QUrl &, const QJsonObject &info) {
585585 // see ConnectionValidator::slotCapabilitiesRecieved: only set server version if not empty
586586 QString serverVersion = CheckServerJob::version (info);
587587 if (!serverVersion.isEmpty ()) {
588588 account->setServerVersion (serverVersion);
589589 }
590590 loop.quit ();
591591 });
592- QObject::connect (csjob, &CheckServerJob::instanceNotFound, [&]() {
592+ QObject::connect (csjob, &CheckServerJob::instanceNotFound, &loop, [&]() {
593593 loop.quit ();
594594 });
595- QObject::connect (csjob, &CheckServerJob::timeout, [&](const QUrl &) {
595+ QObject::connect (csjob, &CheckServerJob::timeout, &loop, [&](const QUrl &) {
596596 loop.quit ();
597597 });
598598 csjob->start ();
@@ -604,12 +604,12 @@ int main(int argc, char **argv)
604604 }
605605
606606 auto *job = new JsonApiJob (account, QLatin1String (" ocs/v1.php/cloud/capabilities" ));
607- QObject::connect (job, &JsonApiJob::jsonReceived, [&](const QJsonDocument &json) {
607+ QObject::connect (job, &JsonApiJob::jsonReceived, &loop, [&](const QJsonDocument &json) {
608608 auto caps = json.object ().value (" ocs" ).toObject ().value (" data" ).toObject ().value (" capabilities" ).toObject ();
609609 qDebug () << " Server capabilities" << caps;
610610 account->setCapabilities (caps.toVariantMap ());
611611 // see ConnectionValidator::slotCapabilitiesRecieved: only set server version if not empty
612- QString serverVersion = caps[" core" ].toObject ()[ " status" ] .toObject ()[ " version" ] .toString ();
612+ QString serverVersion = caps[" core" ].toObject (). value ( " status" ) .toObject (). value ( " version" ) .toString ();
613613 if (!serverVersion.isEmpty ()) {
614614 account->setServerVersion (serverVersion);
615615 }
@@ -624,7 +624,7 @@ int main(int argc, char **argv)
624624 }
625625
626626 job = new JsonApiJob (account, QLatin1String (" ocs/v1.php/cloud/user" ));
627- QObject::connect (job, &JsonApiJob::jsonReceived, [&](const QJsonDocument &json) {
627+ QObject::connect (job, &JsonApiJob::jsonReceived, &loop, [&](const QJsonDocument &json) {
628628 const QJsonObject data = json.object ().value (" ocs" ).toObject ().value (" data" ).toObject ();
629629 account->setDavUser (data.value (" id" ).toString ());
630630 account->setDavDisplayName (data.value (" display-name" ).toString ());
@@ -648,7 +648,9 @@ int main(int argc, char **argv)
648648 qCritical () << " Could not open file containing the list of unsynced folders: " << options.unsyncedfolders ;
649649 } else {
650650 // filter out empty lines and comments
651- selectiveSyncList = QString::fromUtf8 (f.readAll ()).split (' \n ' ).filter (QRegularExpression (" \\ S+" )).filter (QRegularExpression (" ^[^#]" ));
651+ static const auto filterComments = QRegularExpression (" ^[^#]" );
652+ static const auto filterEmptyLines = QRegularExpression (" \\ S+" );
653+ selectiveSyncList = QString::fromUtf8 (f.readAll ()).split (' \n ' ).filter (filterEmptyLines).filter (filterComments);
652654
653655 for (int i = 0 ; i < selectiveSyncList.count (); ++i) {
654656 if (!selectiveSyncList.at (i).endsWith (QLatin1Char (' /' ))) {
0 commit comments