From b7397db519096ff8f222004cfe0dcab22c10682d Mon Sep 17 00:00:00 2001 From: Claudio Valerio Date: Thu, 5 May 2011 10:54:33 +0200 Subject: [PATCH] Fixed Sankore-7 issue --- src/board/UBLibraryController.cpp | 5 +++++ src/board/UBLibraryController.h | 1 + src/gui/UBLibActionBar.cpp | 2 +- 3 files changed, 7 insertions(+), 1 deletion(-) 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))); } /**