r18858 by jghali - #12104: Crash when right clicking after style renaming

scribus-commit scribus-commit at lists.scribus.net
Sat Mar 1 23:00:16 UTC 2014


Author: jghali
Date: Sat Mar  1 23:00:16 2014
New Revision: 18858

URL: http://scribus.net/websvn/listing.php?repname=Scribus&sc=1&rev=18858
Log:
#12104: Crash when right clicking after style renaming

Modified:
    trunk/Scribus/scribus/ui/stylemanager.cpp

Modified: trunk/Scribus/scribus/ui/stylemanager.cpp
URL: http://scribus.net/websvn/diff.php?repname=Scribus&rev=18858&path=/trunk/Scribus/scribus/ui/stylemanager.cpp
==============================================================================
--- trunk/Scribus/scribus/ui/stylemanager.cpp (original)
+++ trunk/Scribus/scribus/ui/stylemanager.cpp Sat Mar  1 23:00:16 2014
@@ -604,20 +604,20 @@
 		
 
 		// Add "Apply" menu entry
-		if(m_selectedStyleAction)
+		if (m_selectedStyleAction)
 		{
 			m_rightClickPopup->removeAction(m_selectedStyleAction);
 			m_selectedStyleAction = 0;
 		}
-		if(styleView->selectedItems().count() == 1)
+		if (styleView->selectedItems().count() == 1)
 		{
 			QString key = item->rootName() + SEPARATOR + item->text(NAME_COL);
-			if(m_styleActions.contains(key))
+			if (m_styleActions.contains(key))
 			{
 				m_selectedStyleAction = m_styleActions[key];
-				if(m_selectedStyleAction)
+				if (m_selectedStyleAction)
 				{
-					m_rightClickPopup->insertAction( m_rightClickPopup->actions().first(), m_selectedStyleAction);
+					m_rightClickPopup->insertAction(m_rightClickPopup->actions().first(), m_selectedStyleAction);
 				}
 			}
 		}
@@ -635,7 +635,7 @@
 		m_rcType = m_styleClassesPS[item->text(0)];
 		loadType(m_rcType);
 		
-		if(m_selectedStyleAction)
+		if (m_selectedStyleAction)
 		{
 			m_rightClickPopup->removeAction(m_selectedStyleAction);
 			m_selectedStyleAction = 0;
@@ -651,7 +651,7 @@
 		m_rcpCloneId->setEnabled(false);
 //		m_rcpToScrapId->setEnabled(false);
 		
-		if(m_selectedStyleAction)
+		if (m_selectedStyleAction)
 		{
 			m_rightClickPopup->removeAction(m_selectedStyleAction);
 			m_selectedStyleAction = 0;
@@ -877,7 +877,7 @@
 			if (m_styleActions.contains(key))
 				continue;
 
-			m_styleActions[key] = new ScrAction(ScrAction::DataQString, QPixmap(), QPixmap(), tr("&Apply") ,	shortcutValue, m_doc->view(), 0, 0.0, key);
+			m_styleActions[key] = new ScrAction(ScrAction::DataQString, QPixmap(), QPixmap(), tr("&Apply"), shortcutValue, m_doc->view(), 0, 0.0, key);
 			connect(m_styleActions[key], SIGNAL(triggeredData(QString)), this, SLOT(slotApplyStyle(QString)));
 		}
 	}
@@ -1035,9 +1035,14 @@
 	{
 		ScrAction *a = m_styleActions[oldKey];
 		disconnect(a, SIGNAL(triggeredData(QString)), this, SLOT(slotApplyStyle(QString)));
-		ScrAction *b = new ScrAction(ScrAction::DataQString, QPixmap(), QPixmap(), "",
+		ScrAction *b = new ScrAction(ScrAction::DataQString, QPixmap(), QPixmap(), tr("&Apply"),
 			               a->shortcut(), m_doc->view(), 0, 0.0, newKey);
 		m_styleActions.remove(oldKey);
+		if (m_selectedStyleAction == a)
+		{
+			m_rightClickPopup->removeAction(m_selectedStyleAction);
+			m_selectedStyleAction = 0;
+		}
 		delete a;
 		m_styleActions[newKey] = b;
 		connect(b, SIGNAL(triggeredData(QString)), this, SLOT(slotApplyStyle(QString)));
@@ -1070,7 +1075,7 @@
 	else
 	{
 		m_styleActions[key] =
-			new ScrAction(ScrAction::DataQString, QPixmap(), QPixmap(), "", shortcut, m_doc->view(), 0, 0.0, key);
+			new ScrAction(ScrAction::DataQString, QPixmap(), QPixmap(), tr("&Apply"), shortcut, m_doc->view(), 0, 0.0, key);
 		connect(m_styleActions[key], SIGNAL(triggeredData(QString)),
 		        this, SLOT(slotApplyStyle(QString)));
 	}




More information about the scribus-commit mailing list