diff --git a/src/board/UBLibraryController.cpp b/src/board/UBLibraryController.cpp index 745187d2..1374e5d4 100644 --- a/src/board/UBLibraryController.cpp +++ b/src/board/UBLibraryController.cpp @@ -83,6 +83,11 @@ UBLibraryController::UBLibraryController(QWidget *pParentWidget, UBBoardControll } +bool UBLibraryController::canItemsOnElementBeDeleted(UBLibElement *pElement) +{ + return !pElement->path().toLocalFile().startsWith(UBSettings::settings()->uniboardShapeLibraryDirectory()); +} + void UBLibraryController::createInternalWidgetItems() { QStringList toolUris = UBToolsManager::manager()->allToolIDs(); diff --git a/src/board/UBLibraryController.h b/src/board/UBLibraryController.h index 2a84361d..2596d87c 100644 --- a/src/board/UBLibraryController.h +++ b/src/board/UBLibraryController.h @@ -109,6 +109,7 @@ class UBLibraryController : public QObject QString favoritePath(); void createNewFolder(QString name, UBLibElement* parentElem); + bool canItemsOnElementBeDeleted(UBLibElement *pElement); signals: void dialogClosed(int state); diff --git a/src/gui/UBLibActionBar.cpp b/src/gui/UBLibActionBar.cpp index 2ebd73ea..d02e36f6 100644 --- a/src/gui/UBLibActionBar.cpp +++ b/src/gui/UBLibActionBar.cpp @@ -337,7 +337,7 @@ void UBLibActionBar::onSelectionChanged(QList itemList, bool isI mpFavoriteAction->setEnabled(bEnable); mpSocialAction->setEnabled(bEnable); - mpDeleteAction->setEnabled(bEnable); + mpDeleteAction->setEnabled(bEnable && libraryController()->canItemsOnElementBeDeleted(itemList.at(0))); } /**