Members of the KDE Community are recommended to subscribe to the kde-community mailing list at https://mail.kde.org/mailman/listinfo/kde-community to allow them to participate in important discussions and receive other important announcements

Commit aaf7fe65 authored by Sven Langkamp's avatar Sven Langkamp

block updates for the popup palette while overwriting presets

BUG:295015
parent 227652a2
......@@ -488,6 +488,8 @@ void KisPaintopBox::slotSaveActivePreset()
if (!curPreset)
return;
m_view->canvasBase()->favoriteResourceManager()->setBlockUpdates(true);
KisPaintOpPreset* newPreset = curPreset->clone();
KoResourceServer<KisPaintOpPreset>* rServer = KisResourceServerProvider::instance()->paintOpPresetServer();
QString saveLocation = rServer->saveLocation();
......@@ -510,6 +512,7 @@ void KisPaintopBox::slotSaveActivePreset()
foreach(const QString& tag, tags) {
rServer->addTag(newPreset, tag);
}
m_view->canvasBase()->favoriteResourceManager()->setBlockUpdates(false);
}
void KisPaintopBox::slotUpdatePreset()
......
......@@ -45,6 +45,7 @@ KoFavoriteResourceManager::KoFavoriteResourceManager(KisPaintopBox *paintopBox,
,m_popupPalette(0)
,m_paintopBox(paintopBox)
,m_colorList(0)
,m_blockUpdates(false)
{
//connect(paintopBox, SIGNAL(signalPaintopChanged(KisPaintOpPresetSP)), this, SLOT(slotChangePaintopLabel(KisPaintOpPresetSP)));
......@@ -270,6 +271,9 @@ void KoFavoriteResourceManager::addRecentColor(const KoColor& color)
void KoFavoriteResourceManager::removingResource(KisPaintOpPreset* resource)
{
if(m_blockUpdates) {
return;
}
removeFavoritePreset(resource->name());
}
......@@ -281,4 +285,9 @@ void KoFavoriteResourceManager::resourceChanged(KisPaintOpPreset* /*resource*/)
{
}
void KoFavoriteResourceManager::setBlockUpdates(bool block)
{
m_blockUpdates = block;
}
#include "ko_favorite_resource_manager.moc"
......@@ -81,6 +81,12 @@ public:
virtual void resourceAdded(KisPaintOpPreset* resource);
virtual void resourceChanged(KisPaintOpPreset* resource);
/**
Set palette to block updates, paintops won't be deleted when they are deleted from server
Used when overwriting a resource
**/
void setBlockUpdates(bool block);
signals:
void sigSetFGColor(const KoColor& c);
......@@ -109,6 +115,7 @@ private:
KisPaletteManager *m_favoriteBrushManager;
KisPopupPalette* m_popupPalette;
KisPaintopBox* m_paintopBox;
bool m_blockUpdates;
QStringList m_favoritePresetsList;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment