Show Syncthing version in Dolphin integration

So even if there are no actions there's at least some bit of information
showing to verify the integration could connect to Syncthing.
This commit is contained in:
Martchus 2022-10-11 18:55:50 +02:00
parent af1529c396
commit a79a594238
1 changed files with 13 additions and 0 deletions

View File

@ -262,6 +262,19 @@ QList<QAction *> SyncthingFileItemAction::createActions(const KFileItemListPrope
connect(&data, &SyncthingFileItemActionStaticData::currentErrorChanged, errorAction, &QAction::changed);
actions << errorAction;
// show Syncthing version
if (!connection.syncthingVersion().isEmpty()) {
static const auto versionRegex = QRegularExpression("(syncthing.*v.* \".*\").*");
auto *const versionAction = new QAction(parent);
if (const auto match = versionRegex.match(connection.syncthingVersion()); match.isValid()) {
versionAction->setText(match.captured(1));
} else {
versionAction->setText(connection.syncthingVersion());
}
versionAction->setEnabled(false);
actions << versionAction;
}
// add config items
QAction *const configFileAction = new QAction(QIcon::fromTheme(QStringLiteral("settings-configure")), tr("Select Syncthing config ..."), parent);
connect(configFileAction, &QAction::triggered, &data, &SyncthingFileItemActionStaticData::selectSyncthingConfig);