Have directory ID still accessible in recent changes despite showing name

Show it as tool tip and allow copying it via the context menu
This commit is contained in:
Martchus 2022-04-09 14:52:00 +02:00
parent bc3cc22d60
commit 28aa9a516c
3 changed files with 13 additions and 0 deletions

View File

@ -120,6 +120,8 @@ QVariant SyncthingRecentChangesModel::data(const QModelIndex &index, int role) c
% QString::fromStdString(change.fileChange.eventTime.toString(DateTimeOutputFormat::DateAndTime, true)));
case 1:
return change.deviceId.isEmpty() ? change.fileChange.modifiedBy : change.deviceId;
case 2:
return change.directoryId;
case 3:
return change.fileChange.path; // usually too long so add a tooltip
}

View File

@ -98,6 +98,9 @@ Item {
function copyDeviceId() {
plasmoid.nativeInterface.copyToClipboard(modifiedBy)
}
function copyFolderId() {
plasmoid.nativeInterface.copyToClipboard(folderId)
}
}
PlasmaComponents.Menu {
@ -112,6 +115,11 @@ Item {
icon: "network-server-symbolic"
onClicked: recentChangesView.currentItem.copyDeviceId()
}
PlasmaComponents.MenuItem {
text: qsTr("Copy directory ID")
icon: "folder"
onClicked: recentChangesView.currentItem.copyFolderId()
}
}
}
}

View File

@ -597,6 +597,9 @@ void TrayWidget::showRecentChangesContextMenu(const QPoint &position)
QIcon(QStringLiteral(":/icons/hicolor/scalable/places/network-workgroup.svg"))),
tr("Copy device ID")),
&QAction::triggered, this, copyRole(SyncthingRecentChangesModel::ModifiedBy));
connect(menu.addAction(QIcon::fromTheme(QStringLiteral("folder"), QIcon(QStringLiteral(":/icons/hicolor/scalable/places/folder.svg"))),
tr("Copy directory ID")),
&QAction::triggered, this, copyRole(SyncthingRecentChangesModel::DirectoryId));
showViewMenu(position, *m_ui->recentChangesTreeView, menu);
}