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

scribus-commit scribus-commit at lists.scribus.net
Sat Mar 1 23:01:51 UTC 2014


Author: jghali
Date: Sat Mar  1 23:01:51 2014
New Revision: 18859

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

Modified:
    branches/Version14x/Scribus/scribus/stylemanager.cpp

Modified: branches/Version14x/Scribus/scribus/stylemanager.cpp
URL: http://scribus.net/websvn/diff.php?repname=Scribus&rev=18859&path=/branches/Version14x/Scribus/scribus/stylemanager.cpp
==============================================================================
--- branches/Version14x/Scribus/scribus/stylemanager.cpp (original)
+++ branches/Version14x/Scribus/scribus/stylemanager.cpp Sat Mar  1 23:01:51 2014
@@ -602,18 +602,18 @@
 		loadType(m_styleClassesPS[item->rootName()]);
 
 		// 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);
 				}
@@ -634,7 +634,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;
@@ -650,7 +650,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 @@
 				continue;
 
 			m_styleActions[key] =
-					new ScrAction(ScrAction::DataQString, QPixmap(), QPixmap(), tr("&Apply") ,	shortcutValue, m_doc->view(), 0, 0.0, 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)));
 		}
@@ -1036,9 +1036,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)));
@@ -1071,7 +1076,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