Show note in Dolphin integration when current directory is not shared

* Otherwise it can be confusing if no actions are present
* See https://github.com/Martchus/syncthingtray/issues/159
This commit is contained in:
Martchus 2022-10-11 18:46:13 +02:00
parent d7adcaf950
commit af1529c396
1 changed files with 11 additions and 5 deletions

View File

@ -239,13 +239,19 @@ QList<QAction *> SyncthingFileItemAction::createActions(const KFileItemListPrope
actions << *statusActions; actions << *statusActions;
} }
// add separator // add note if no actions are available within the current folder
if (!actions.isEmpty()) { if (actions.isEmpty()) {
QAction *const separator = new QAction(parent); auto *const note = new QAction(parent);
separator->setSeparator(true); note->setText(tr("Not a shared directory"));
actions << separator; note->setEnabled(false);
actions << note;
} }
// add separator
auto *const separator = new QAction(parent);
separator->setSeparator(true);
actions << separator;
// add error action // add error action
QAction *const errorAction = new SyncthingInfoAction(parent); QAction *const errorAction = new SyncthingInfoAction(parent);
errorAction->setText(data.currentError()); errorAction->setText(data.currentError());