MCPcopy Create free account
hub / github.com/Martchus/syncthingtray / initDevCompletion

Method initDevCompletion

cli/application.cpp:1205–1229  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

1203}
1204
1205void Application::initDevCompletion(Argument &arg, const ArgumentOccurrence &)
1206{
1207 // prevent this initialization if we're not in shell completion mode
1208 if (m_argsRead) {
1209 return;
1210 }
1211 // load config and wait for connected
1212 if (loadConfig()) {
1213 return;
1214 }
1215 m_settings.requestTimeout = 5000; // avoid blocking shell for too long
1216 waitForConfigAndStatus();
1217 // set device IDs and names as completion values
1218 QStringList completionValues;
1219 const size_t valueCount = m_connection.devInfo().size() << 2;
1220 if (valueCount > numeric_limits<int>::max()) {
1221 return;
1222 }
1223 completionValues.reserve(static_cast<int>(valueCount));
1224 for (const SyncthingDev &dev : m_connection.devInfo()) {
1225 completionValues << dev.id << dev.name;
1226 }
1227 m_devCompletion = completionValues.join(QChar(' ')).toUtf8();
1228 arg.setPreDefinedCompletionValues(m_devCompletion.data());
1229}
1230
1231RelevantDir Application::findDirectory(const QString &dirIdentifier)
1232{

Callers

nothing calls this directly

Calls 3

devInfoMethod · 0.80
sizeMethod · 0.45
dataMethod · 0.45

Tested by

no test coverage detected