r19100 by craig - Update ScrAction to use the QVariant data property of QActions instead of the custom ones we had.

scribus-commit scribus-commit at lists.scribus.net
Wed May 7 21:03:52 UTC 2014


Author: craig
Date: Wed May  7 21:03:52 2014
New Revision: 19100

URL: http://scribus.net/websvn/listing.php?repname=Scribus&sc=1&rev=19100
Log:
Update ScrAction to use the QVariant data property of QActions instead of the custom ones we had.

Modified:
    trunk/Scribus/scribus/actionmanager.cpp
    trunk/Scribus/scribus/scraction.cpp
    trunk/Scribus/scribus/scraction.h
    trunk/Scribus/scribus/scribus.cpp
    trunk/Scribus/scribus/scribus.h
    trunk/Scribus/scribus/ui/filetoolbar.h
    trunk/Scribus/scribus/ui/storyeditor.cpp
    trunk/Scribus/scribus/ui/storyeditor.h
    trunk/Scribus/scribus/ui/stylemanager.cpp

Modified: trunk/Scribus/scribus/actionmanager.cpp
URL: http://scribus.net/websvn/diff.php?repname=Scribus&rev=19100&path=/trunk/Scribus/scribus/actionmanager.cpp
==============================================================================
--- trunk/Scribus/scribus/actionmanager.cpp (original)
+++ trunk/Scribus/scribus/actionmanager.cpp Wed May  7 21:03:52 2014
@@ -630,19 +630,19 @@
 {
 	QString name;
 	name="viewFitInWindow";
-	scrActions->insert(name, new ScrAction(ScrAction::DataDouble, QPixmap(), QPixmap(), "", defaultKey(name), mainWindow, 0, -100.0));
+	scrActions->insert(name, new ScrAction(ScrAction::DataDouble, QPixmap(), QPixmap(), "", defaultKey(name), mainWindow, -100.0));
 	name="viewFitWidth";
-	scrActions->insert(name, new ScrAction(ScrAction::DataDouble, QPixmap(), QPixmap(), "", defaultKey(name), mainWindow, 0, -200.0));
+	scrActions->insert(name, new ScrAction(ScrAction::DataDouble, QPixmap(), QPixmap(), "", defaultKey(name), mainWindow, -200.0));
 	name="viewFit50";
-	scrActions->insert(name, new ScrAction(ScrAction::DataDouble, QPixmap(), QPixmap(), "", defaultKey(name), mainWindow, 0, 50.0));
+	scrActions->insert(name, new ScrAction(ScrAction::DataDouble, QPixmap(), QPixmap(), "", defaultKey(name), mainWindow, 50.0));
 	name="viewFit75";
-	scrActions->insert(name, new ScrAction(ScrAction::DataDouble, QPixmap(), QPixmap(), "", defaultKey(name), mainWindow, 0, 75.0));
+	scrActions->insert(name, new ScrAction(ScrAction::DataDouble, QPixmap(), QPixmap(), "", defaultKey(name), mainWindow, 75.0));
 	name="viewFit100";
-	scrActions->insert(name, new ScrAction(ScrAction::DataDouble, loadIcon("16/zoom-original.png"), loadIcon("22/zoom-original.png"), "", defaultKey(name), mainWindow, 0, 100.0));
+	scrActions->insert(name, new ScrAction(ScrAction::DataDouble, loadIcon("16/zoom-original.png"), loadIcon("22/zoom-original.png"), "", defaultKey(name), mainWindow, 100.0));
 	name="viewFit200";
-	scrActions->insert(name, new ScrAction(ScrAction::DataDouble, QPixmap(), QPixmap(), "", defaultKey(name), mainWindow, 0, 200.0));
+	scrActions->insert(name, new ScrAction(ScrAction::DataDouble, QPixmap(), QPixmap(), "", defaultKey(name), mainWindow, 200.0));
 	name="viewFit400";
-	scrActions->insert(name, new ScrAction(ScrAction::DataDouble, QPixmap(), QPixmap(), "", defaultKey(name), mainWindow, 0, 400.0));
+	scrActions->insert(name, new ScrAction(ScrAction::DataDouble, QPixmap(), QPixmap(), "", defaultKey(name), mainWindow, 400.0));
 	name="viewPreviewMode";
 	scrActions->insert(name, new ScrAction(loadIcon("previewOn.png"), loadIcon("previewOn.png"), "", defaultKey(name), mainWindow));
 	name="viewEditInPreview";
@@ -971,13 +971,13 @@
 	name="helpManual";
 	scrActions->insert(name, new ScrAction(loadIcon("16/help-browser.png"), QPixmap(), "", defaultKey(name), mainWindow));
 	name="helpOnlineWWW";
-	scrActions->insert(name, new ScrAction(ScrAction::DataQString, QPixmap(), QPixmap(), "", defaultKey(name), mainWindow, 0, 0.0, "http://www.scribus.net"));
+	scrActions->insert(name, new ScrAction(ScrAction::DataQString, QPixmap(), QPixmap(), "", defaultKey(name), mainWindow, "http://www.scribus.net"));
 	name="helpOnlineDocs";
-	scrActions->insert(name, new ScrAction(ScrAction::DataQString, QPixmap(), QPixmap(), "", defaultKey(name), mainWindow, 0, 0.0, "http://docs.scribus.net"));
+	scrActions->insert(name, new ScrAction(ScrAction::DataQString, QPixmap(), QPixmap(), "", defaultKey(name), mainWindow, "http://docs.scribus.net"));
 	name="helpOnlineWiki";
-	scrActions->insert(name, new ScrAction(ScrAction::DataQString, QPixmap(), QPixmap(), "", defaultKey(name), mainWindow, 0, 0.0, "http://wiki.scribus.net"));
+	scrActions->insert(name, new ScrAction(ScrAction::DataQString, QPixmap(), QPixmap(), "", defaultKey(name), mainWindow, "http://wiki.scribus.net"));
 	name="helpOnlineTutorial1";
-	scrActions->insert(name, new ScrAction(ScrAction::DataQString, QPixmap(), QPixmap(), "", defaultKey(name), mainWindow, 0, 0.0, ""));
+	scrActions->insert(name, new ScrAction(ScrAction::DataQString, QPixmap(), QPixmap(), "", defaultKey(name), mainWindow, ""));
 	name="helpCheckUpdates";
 	scrActions->insert(name, new ScrAction("", defaultKey(name), mainWindow));
 
@@ -1002,113 +1002,113 @@
 	QString name;
 	//typography
 	name="unicodeSoftHyphen";
-	actionMap->insert(name, new ScrAction(defaultKey(name), actionParent, SpecialChars::SHYPHEN.unicode(), name));
+	actionMap->insert(name, new ScrAction(defaultKey(name), actionParent, SpecialChars::SHYPHEN.unicode()));
 	name="unicodeNonBreakingHyphen";
-	actionMap->insert(name, new ScrAction(defaultKey(name), actionParent, SpecialChars::NBHYPHEN.unicode(), name));
+	actionMap->insert(name, new ScrAction(defaultKey(name), actionParent, SpecialChars::NBHYPHEN.unicode()));
 	name="unicodeNonBreakingSpace";
-	actionMap->insert(name, new ScrAction(defaultKey(name), actionParent, SpecialChars::NBSPACE.unicode(), name));
+	actionMap->insert(name, new ScrAction(defaultKey(name), actionParent, SpecialChars::NBSPACE.unicode()));
 	name="unicodePageNumber";
-	actionMap->insert(name, new ScrAction(defaultKey(name), actionParent, SpecialChars::PAGENUMBER.unicode(), name));
+	actionMap->insert(name, new ScrAction(defaultKey(name), actionParent, SpecialChars::PAGENUMBER.unicode()));
 	name="unicodePageCount";
-	actionMap->insert(name, new ScrAction(defaultKey(name), actionParent, SpecialChars::PAGECOUNT.unicode(), name));
+	actionMap->insert(name, new ScrAction(defaultKey(name), actionParent, SpecialChars::PAGECOUNT.unicode()));
 	//Spaces
 	name="unicodeSpaceEN";
-	actionMap->insert(name, new ScrAction(defaultKey(name), actionParent, 0x2002, name));
+	actionMap->insert(name, new ScrAction(defaultKey(name), actionParent, 0x2002));
 	name="unicodeSpaceEM";
-	actionMap->insert(name, new ScrAction(defaultKey(name), actionParent, 0x2003, name));
+	actionMap->insert(name, new ScrAction(defaultKey(name), actionParent, 0x2003));
 	name="unicodeSpaceThin";
-	actionMap->insert(name, new ScrAction(defaultKey(name), actionParent, 0x2009, name));
+	actionMap->insert(name, new ScrAction(defaultKey(name), actionParent, 0x2009));
 	name="unicodeSpaceThick";
-	actionMap->insert(name, new ScrAction(defaultKey(name), actionParent, 0x2004, name));
+	actionMap->insert(name, new ScrAction(defaultKey(name), actionParent, 0x2004));
 	name="unicodeSpaceMid";
-	actionMap->insert(name, new ScrAction(defaultKey(name), actionParent, 0x2005, name));
+	actionMap->insert(name, new ScrAction(defaultKey(name), actionParent, 0x2005));
 	name="unicodeSpaceHair";
-	actionMap->insert(name, new ScrAction(defaultKey(name), actionParent, 0x200A, name));
+	actionMap->insert(name, new ScrAction(defaultKey(name), actionParent, 0x200A));
 	//Breaks
 	name="unicodeNewLine";
-	actionMap->insert(name, new ScrAction(defaultKey(name), actionParent, SpecialChars::LINEBREAK.unicode(), name));
+	actionMap->insert(name, new ScrAction(defaultKey(name), actionParent, SpecialChars::LINEBREAK.unicode()));
 	name="unicodeFrameBreak";
-	actionMap->insert(name, new ScrAction(defaultKey(name), actionParent, SpecialChars::FRAMEBREAK.unicode(), name));
+	actionMap->insert(name, new ScrAction(defaultKey(name), actionParent, SpecialChars::FRAMEBREAK.unicode()));
 	name="unicodeColumnBreak";
-	actionMap->insert(name, new ScrAction(defaultKey(name), actionParent, SpecialChars::COLBREAK.unicode(), name));
+	actionMap->insert(name, new ScrAction(defaultKey(name), actionParent, SpecialChars::COLBREAK.unicode()));
 	name="unicodeZerowidthSpace";
-	actionMap->insert(name, new ScrAction(defaultKey(name), actionParent, SpecialChars::ZWSPACE.unicode(), name));
+	actionMap->insert(name, new ScrAction(defaultKey(name), actionParent, SpecialChars::ZWSPACE.unicode()));
 	name="unicodeZerowidthNonBreakingSpace";
-	actionMap->insert(name, new ScrAction(defaultKey(name), actionParent, SpecialChars::ZWNBSPACE.unicode(), name));
+	actionMap->insert(name, new ScrAction(defaultKey(name), actionParent, SpecialChars::ZWNBSPACE.unicode()));
 	//Special
 	name="unicodeCopyRight";
-	actionMap->insert(name, new ScrAction(defaultKey(name), actionParent, 0x0A9, name));
+	actionMap->insert(name, new ScrAction(defaultKey(name), actionParent, 0x0A9));
 	name="unicodeRegdTM";
-	actionMap->insert(name, new ScrAction(defaultKey(name), actionParent, 0x00AE, name));
+	actionMap->insert(name, new ScrAction(defaultKey(name), actionParent, 0x00AE));
 	name="unicodeTM";
-	actionMap->insert(name, new ScrAction(defaultKey(name), actionParent, 0x2122, name));
+	actionMap->insert(name, new ScrAction(defaultKey(name), actionParent, 0x2122));
 	name="unicodeBullet";
-	actionMap->insert(name, new ScrAction(defaultKey(name), actionParent, 0x2022, name));
+	actionMap->insert(name, new ScrAction(defaultKey(name), actionParent, 0x2022));
 	name="unicodeMidpoint";
-	actionMap->insert(name, new ScrAction(defaultKey(name), actionParent, 0x00B7, name));
+	actionMap->insert(name, new ScrAction(defaultKey(name), actionParent, 0x00B7));
 	name="unicodeSolidus";
-	actionMap->insert(name, new ScrAction(defaultKey(name), actionParent, 0x2044, name));
+	actionMap->insert(name, new ScrAction(defaultKey(name), actionParent, 0x2044));
 	//Dashes
 	name="unicodeDashEm";
-	actionMap->insert(name, new ScrAction(defaultKey(name), actionParent, 0x2014, name));
+	actionMap->insert(name, new ScrAction(defaultKey(name), actionParent, 0x2014));
 	name="unicodeDashEn";
-	actionMap->insert(name, new ScrAction(defaultKey(name), actionParent, 0x2013, name));
+	actionMap->insert(name, new ScrAction(defaultKey(name), actionParent, 0x2013));
 	name="unicodeDashFigure";
-	actionMap->insert(name, new ScrAction(defaultKey(name), actionParent, 0x2012, name));
+	actionMap->insert(name, new ScrAction(defaultKey(name), actionParent, 0x2012));
 	name="unicodeDashQuotation";
-	actionMap->insert(name, new ScrAction(defaultKey(name), actionParent, 0x2015, name));
+	actionMap->insert(name, new ScrAction(defaultKey(name), actionParent, 0x2015));
 	//Quotes
 	name="unicodeQuoteApostrophe";
-	actionMap->insert(name, new ScrAction(defaultKey(name), actionParent, 0x0027, name));
+	actionMap->insert(name, new ScrAction(defaultKey(name), actionParent, 0x0027));
 	name="unicodeQuoteStraight";
-	actionMap->insert(name, new ScrAction(defaultKey(name), actionParent, 0x0022, name));
+	actionMap->insert(name, new ScrAction(defaultKey(name), actionParent, 0x0022));
 	name="unicodeQuoteSingleLeft";
-	actionMap->insert(name, new ScrAction(defaultKey(name), actionParent, 0x2018, name));
+	actionMap->insert(name, new ScrAction(defaultKey(name), actionParent, 0x2018));
 	name="unicodeQuoteSingleRight";
-	actionMap->insert(name, new ScrAction(defaultKey(name), actionParent, 0x2019, name));
+	actionMap->insert(name, new ScrAction(defaultKey(name), actionParent, 0x2019));
 	name="unicodeQuoteDoubleLeft";
-	actionMap->insert(name, new ScrAction(defaultKey(name), actionParent, 0x201C, name));
+	actionMap->insert(name, new ScrAction(defaultKey(name), actionParent, 0x201C));
 	name="unicodeQuoteDoubleRight";
-	actionMap->insert(name, new ScrAction(defaultKey(name), actionParent, 0x201D, name));
+	actionMap->insert(name, new ScrAction(defaultKey(name), actionParent, 0x201D));
 	name="unicodeQuoteSingleReversed";
-	actionMap->insert(name, new ScrAction(defaultKey(name), actionParent, 0x201B, name));
+	actionMap->insert(name, new ScrAction(defaultKey(name), actionParent, 0x201B));
 	name="unicodeQuoteDoubleReversed";
-	actionMap->insert(name, new ScrAction(defaultKey(name), actionParent, 0x201F, name));
+	actionMap->insert(name, new ScrAction(defaultKey(name), actionParent, 0x201F));
 	name="unicodeQuoteSingleLeftGuillemet";
-	actionMap->insert(name, new ScrAction(defaultKey(name), actionParent, 0x2039, name));
+	actionMap->insert(name, new ScrAction(defaultKey(name), actionParent, 0x2039));
 	name="unicodeQuoteSingleRightGuillemet";
-	actionMap->insert(name, new ScrAction(defaultKey(name), actionParent, 0x203A, name));
+	actionMap->insert(name, new ScrAction(defaultKey(name), actionParent, 0x203A));
 	name="unicodeQuoteDoubleLeftGuillemet";
-	actionMap->insert(name, new ScrAction(defaultKey(name), actionParent, 0x00AB, name));
+	actionMap->insert(name, new ScrAction(defaultKey(name), actionParent, 0x00AB));
 	name="unicodeQuoteDoubleRightGuillemet";
-	actionMap->insert(name, new ScrAction(defaultKey(name), actionParent, 0x00BB, name));
+	actionMap->insert(name, new ScrAction(defaultKey(name), actionParent, 0x00BB));
 	name="unicodeQuoteLowSingleComma";
-	actionMap->insert(name, new ScrAction(defaultKey(name), actionParent, 0x201A, name));
+	actionMap->insert(name, new ScrAction(defaultKey(name), actionParent, 0x201A));
 	name="unicodeQuoteLowDoubleComma";
-	actionMap->insert(name, new ScrAction(defaultKey(name), actionParent, 0x201E, name));
+	actionMap->insert(name, new ScrAction(defaultKey(name), actionParent, 0x201E));
 	name="unicodeQuoteCJKSingleLeft";
-	actionMap->insert(name, new ScrAction(defaultKey(name), actionParent, 0x300C, name));
+	actionMap->insert(name, new ScrAction(defaultKey(name), actionParent, 0x300C));
 	name="unicodeQuoteCJKSingleRight";
-	actionMap->insert(name, new ScrAction(defaultKey(name), actionParent, 0x300D, name));
+	actionMap->insert(name, new ScrAction(defaultKey(name), actionParent, 0x300D));
 	name="unicodeQuoteCJKDoubleLeft";
-	actionMap->insert(name, new ScrAction(defaultKey(name), actionParent, 0x300E, name));
+	actionMap->insert(name, new ScrAction(defaultKey(name), actionParent, 0x300E));
 	name="unicodeQuoteCJKDoubleRight";
-	actionMap->insert(name, new ScrAction(defaultKey(name), actionParent, 0x300F, name));
+	actionMap->insert(name, new ScrAction(defaultKey(name), actionParent, 0x300F));
 	//Ligatures
 	name="unicodeLigature_ff";
-	actionMap->insert(name, new ScrAction(defaultKey(name), actionParent, 0xFB00, name));
+	actionMap->insert(name, new ScrAction(defaultKey(name), actionParent, 0xFB00));
 	name="unicodeLigature_fi";
-	actionMap->insert(name, new ScrAction(defaultKey(name), actionParent, 0xFB01, name));
+	actionMap->insert(name, new ScrAction(defaultKey(name), actionParent, 0xFB01));
 	name="unicodeLigature_fl";
-	actionMap->insert(name, new ScrAction(defaultKey(name), actionParent, 0xFB02, name));
+	actionMap->insert(name, new ScrAction(defaultKey(name), actionParent, 0xFB02));
 	name="unicodeLigature_ffi";
-	actionMap->insert(name, new ScrAction(defaultKey(name), actionParent, 0xFB03, name));
+	actionMap->insert(name, new ScrAction(defaultKey(name), actionParent, 0xFB03));
 	name="unicodeLigature_ffl";
-	actionMap->insert(name, new ScrAction(defaultKey(name), actionParent, 0xFB04, name));
+	actionMap->insert(name, new ScrAction(defaultKey(name), actionParent, 0xFB04));
 	name="unicodeLigature_ft";
-	actionMap->insert(name, new ScrAction(defaultKey(name), actionParent, 0xFB05, name));
+	actionMap->insert(name, new ScrAction(defaultKey(name), actionParent, 0xFB05));
 	name="unicodeLigature_st";
-	actionMap->insert(name, new ScrAction(defaultKey(name), actionParent, 0xFB06, name));
+	actionMap->insert(name, new ScrAction(defaultKey(name), actionParent, 0xFB06));
 
 	//Spaces and special characters
 
@@ -1139,7 +1139,7 @@
 	//Ligatures
 	*actionNamesList << "unicodeLigature_ff" << "unicodeLigature_fi" << "unicodeLigature_fl" << "unicodeLigature_ffi" << "unicodeLigature_ffl" << "unicodeLigature_ft" << "unicodeLigature_st";
 	for ( QStringList::Iterator it = actionNamesList->begin(); it != actionNamesList->end(); ++it )
-		connect( (*actionMap)[*it], SIGNAL(triggeredUnicodeShortcut(const QString&, int)), actionParent, SLOT(specialActionKeyEvent(const QString&, int)) );
+		connect( (*actionMap)[*it], SIGNAL(triggeredUnicodeShortcut(int)), actionParent, SLOT(specialActionKeyEvent(int)) );
 }
 
 void ActionManager::initSpecialActions()

Modified: trunk/Scribus/scribus/scraction.cpp
URL: http://scribus.net/websvn/diff.php?repname=Scribus&rev=19100&path=/trunk/Scribus/scribus/scraction.cpp
==============================================================================
--- trunk/Scribus/scribus/scraction.cpp (original)
+++ trunk/Scribus/scribus/scraction.cpp Wed May  7 21:03:52 2014
@@ -37,104 +37,27 @@
 	initScrAction();
 }
 
-ScrAction::ScrAction( ActionType aType, const QString & menuText, QKeySequence accel, QObject * parent, int extraInt, double extraDouble, QString extraQString ) : QAction( menuText, parent )
-{
-	setShortcut(accel);
-	initScrAction();
+ScrAction::ScrAction(ActionType aType, const QString & menuText, QKeySequence accel, QObject * parent, QVariant d) : QAction( menuText, parent )
+{
+	setShortcut(accel);
+	initScrAction();
+	setData(d);
 	_actionType=aType;
+
 	if (_actionType!=Normal)
 		connect (this, SIGNAL(triggered()), this, SLOT(triggeredToTriggeredData()));
-	switch (_actionType)
-	{
-		case DataInt:
-			_dataInt=extraInt;
-			break;
-		case DataDouble:
-			_dataDouble=extraDouble;
-			break;
-		case DataQString:
-			_dataQString=extraQString;
-			break;
-		case RecentFile:
-			_dataQString=extraQString;
-			break;
-		case RecentPaste:
-			_dataQString=extraQString;
-			break;
-		case DLL:
-			pluginID=extraInt;
-			break;
-		case Window:
-			windowID=extraInt;
-			break;
-		case RecentScript:
-			break;
-		case UnicodeChar:
-			_dataInt=extraInt;
-			_dataQString=extraQString;
-			break;
-		case Layer:
-			layerID=extraInt;
-			break;
-		case Normal:
-		default:
-			break;
-	}
-}
-
-ScrAction::ScrAction( ActionType aType, const QPixmap & icon16, const QPixmap & icon22, const QString & menuText, QKeySequence accel, QObject * parent, int extraInt, double extraDouble, QString extraQString ) : QAction( QIcon(icon16), menuText, parent )
+}
+
+ScrAction::ScrAction(ActionType aType, const QPixmap & icon16, const QPixmap & icon22, const QString & menuText, QKeySequence accel, QObject * parent, QVariant d) : QAction( QIcon(icon16), menuText, parent )
 {
 	setShortcut(accel);
 	initScrAction();
 	icon().addPixmap(icon22, QIcon::Normal, QIcon::On);
-/*
-	QPixmap gray_icon16(icon16);
-	iconToGrayscale(&gray_icon16);
-	m_icon.addPixmap(icon16, QIcon::Active, QIcon::On);
-	m_icon.addPixmap(icon16, QIcon::Active, QIcon::Off);
-	m_icon.addPixmap(gray_icon16, QIcon::Normal, QIcon::On);
-	m_icon.addPixmap(gray_icon16, QIcon::Normal, QIcon::Off);
-	setIcon(m_icon.pixmap(QSize(16,16), QIcon::Normal, QIcon::Off));
-*/
+
 	_actionType=aType;
+	setData(d);
 	if (_actionType!=Normal)
 		connect (this, SIGNAL(triggered()), this, SLOT(triggeredToTriggeredData()));
-	switch (_actionType)
-	{
-		case DataInt:
-			_dataInt=extraInt;
-			break;
-		case DataDouble:
-			_dataDouble=extraDouble;
-			break;
-		case DataQString:
-			_dataQString=extraQString;
-			break;
-		case RecentFile:
-			_dataQString=extraQString;
-			break;
-		case RecentPaste:
-			_dataQString=extraQString;
-			break;
-		case DLL:
-			pluginID=extraInt;
-			break;
-		case Window:
-			windowID=extraInt;
-			break;
-		case RecentScript:
-			break;
-		case UnicodeChar:
-			_dataInt=extraInt;
-			_dataQString=extraQString;
-			break;
-		case Layer:
-			layerID=extraInt;
-			break;
-		case Normal:
-		default:
-			break;
-	}
 }
 
 ScrAction::ScrAction( const QPixmap & icon16, const QPixmap & icon22, const QString & menuText, QKeySequence accel, QObject * parent ) : QAction( QIcon(icon16), menuText, parent )
@@ -146,18 +69,17 @@
 }
 
 
-ScrAction::ScrAction(QKeySequence accel, QObject * parent, int extraInt, QString extraQString) 
+ScrAction::ScrAction(QKeySequence accel, QObject * parent, QVariant d)
 	: QAction( QIcon(QPixmap()), "", parent )
 {
 	setShortcut(accel);
 	initScrAction();
 	icon().addPixmap(QPixmap(), QIcon::Normal, QIcon::On);
 	_actionType=UnicodeChar;
-
+	setData(d);
 	connect (this, SIGNAL(triggered()), this, SLOT(triggeredToTriggeredData()));
-	_dataInt=extraInt;
-	_dataQString=extraQString;
-}
+}
+
 
 void ScrAction::initScrAction()
 {
@@ -175,25 +97,29 @@
 void ScrAction::triggeredToTriggeredData()
 {
 	if (_actionType==ScrAction::DataInt)
-		emit triggeredData(_dataInt);
+		emit triggeredData(data().toInt());
 	if (_actionType==ScrAction::DataDouble)
-		emit triggeredData(_dataDouble);
+		emit triggeredData(data().toDouble());
 	if (_actionType==ScrAction::DataQString)
-		emit triggeredData(_dataQString);
+		emit triggeredData(data().toString());
 	if (_actionType==ScrAction::DLL)
-		emit triggeredData(pluginID);
+		qDebug()<<"if (_actionType==ScrAction::DLL): please fix in ScrAction::triggeredToTriggeredData()";
+//		emit triggeredData(pluginID);
 	if (_actionType==ScrAction::Window)
-		emit triggeredData(windowID);
+		qDebug()<<"if (_actionType==ScrAction::Window): please fix in ScrAction::triggeredToTriggeredData()";
+//		emit triggeredData(windowID);
 	if (_actionType==ScrAction::RecentFile)
-		emit triggeredData(_dataQString);
+		emit triggeredData(data().toString());
 	if (_actionType==ScrAction::RecentPaste)
-		emit triggeredData(_dataQString);
+		emit triggeredData(data().toString());
 	if (_actionType==ScrAction::RecentScript)
-		emit triggeredData(text());
+		qDebug()<<"if (_actionType==ScrAction::RecentScript): please fix in ScrAction::triggeredToTriggeredData()";
+//		emit triggeredData(text());
 	if (_actionType==ScrAction::UnicodeChar)
-		emit triggeredUnicodeShortcut(_dataQString, _dataInt);
+		emit triggeredUnicodeShortcut(data().toInt());
 	if (_actionType==ScrAction::Layer)
-		emit triggeredData(layerID);
+		qDebug()<<"if (_actionType==ScrAction::Layer): please fix in ScrAction::triggeredToTriggeredData()";
+//		emit triggeredData(layerID);
 	if (_actionType==ScrAction::ActionDLL)
 		emit triggeredData(((ScribusMainWindow*)parent())->doc);
 }
@@ -203,23 +129,24 @@
 	if (isCheckable())
 	{
 		if (_actionType==ScrAction::DataInt)
-			emit toggledData(ison, _dataInt);
+			emit toggledData(ison, data().toInt());
 		if (_actionType==ScrAction::DataDouble)
-			emit toggledData(ison, _dataDouble);
+			emit toggledData(ison, data().toDouble());
 		if (_actionType==ScrAction::DataQString)
-			emit toggledData(ison, _dataQString);
+			emit toggledData(ison, data().toString());
 		if (_actionType==ScrAction::DLL)
-			emit toggledData(ison, pluginID);
+			qDebug()<<"if (_actionType==ScrAction::DLL): please fix in ScrAction::toggledToToggledData(bool ison)";
+//			emit toggledData(ison, pluginID);
 		if (_actionType==ScrAction::Window)
-			emit toggledData(ison, windowID);
+			emit toggledData(ison, data().toInt());
 		if (_actionType==ScrAction::RecentFile)
-			emit toggledData(ison, _dataQString);
+			emit toggledData(ison, data().toString());
 		if (_actionType==ScrAction::RecentPaste)
-			emit toggledData(ison, _dataQString);
+			emit toggledData(ison, data().toString());
 		if (_actionType==ScrAction::RecentScript)
 			emit toggledData(ison, text());
 		if (_actionType==ScrAction::Layer)
-			emit toggledData(ison, layerID);
+			emit toggledData(ison, data().toInt());
 		// no toggle for UnicodeChar
 	}
 }
@@ -272,7 +199,7 @@
 int ScrAction::dllID() const
 {
 	if (_actionType==ScrAction::DLL)
-		return pluginID;
+		return data().toInt();
 	return -1;
 }
 
@@ -319,17 +246,17 @@
 
 int ScrAction::actionInt() const
 {
-	return _dataInt;
+	return data().toInt();
 }
 
 double ScrAction::actionDouble() const
 {
-	return _dataDouble;
+	return data().toDouble();
 }
 
 const QString ScrAction::actionQString()
 {
-	return _dataQString;
+	return data().toString();
 }
 
 void ScrAction::setTexts(const QString &newText)//#9114, qt3-qt4 change of behaviour bug:, bool setTextToo)
@@ -348,6 +275,6 @@
 
 void ScrAction::setActionQString(const QString &s)
 {
-	_dataQString=s;
-}
-
+	setData(s);
+}
+

Modified: trunk/Scribus/scribus/scraction.h
URL: http://scribus.net/websvn/diff.php?repname=Scribus&rev=19100&path=/trunk/Scribus/scribus/scraction.h
==============================================================================
--- trunk/Scribus/scribus/scraction.h (original)
+++ trunk/Scribus/scribus/scraction.h Wed May  7 21:03:52 2014
@@ -70,11 +70,9 @@
 		\param extraQString extra QString value
 	 */
 	ScrAction( ActionType aType,
-			   const QString &menuText, QKeySequence accel, QObject *parent,
-			   int extraInt = 0, double extraDouble = 0.0, QString extraQString = QString::null );		
+			   const QString &menuText, QKeySequence accel, QObject *parent, QVariant d = QVariant());
 	ScrAction( ActionType aType, const QPixmap & icon16, const QPixmap & icon22,
-			   const QString &menuText, QKeySequence accel, QObject *parent,
-			   int extraInt = 0, double extraDouble = 0.0, QString extraQString = QString::null );		
+			   const QString &menuText, QKeySequence accel, QObject *parent, QVariant d = QVariant());
 	/*!
 		\author Craig Bradney
 		\date Jan 2005
@@ -94,7 +92,7 @@
 	\param extraInt extra int value
 	\param extraQString extra QString value
 	 */
-	ScrAction( QKeySequence accel, QObject *parent, int extraInt, QString extraQString);
+	ScrAction( QKeySequence accel, QObject *parent, QVariant data = QVariant());
 	~ScrAction();
 	
 	/*!
@@ -176,6 +174,7 @@
 	void toggle();
 	
 signals:
+	void triggeredData(QVariant);
 	void triggeredData(int);
 	void triggeredData(double);
 	void triggeredData(QString);
@@ -184,17 +183,11 @@
 	void toggledData(bool, int);
 	void toggledData(bool, double);
 	void toggledData(bool, QString);
-	void triggeredUnicodeShortcut(const QString&, int);
+	void triggeredUnicodeShortcut(int);
 	
 protected:
 	void initScrAction();
 	int menuIndex;
-	int pluginID;
-	int windowID;
-	int layerID;
-	int _dataInt;
-	double _dataDouble;
-	QString _dataQString;
 	ActionType _actionType;
 	QMenu *popupMenuAddedTo;
 	QKeySequence savedKeySequence;

Modified: trunk/Scribus/scribus/scribus.cpp
URL: http://scribus.net/websvn/diff.php?repname=Scribus&rev=19100&path=/trunk/Scribus/scribus/scribus.cpp
==============================================================================
--- trunk/Scribus/scribus/scribus.cpp (original)
+++ trunk/Scribus/scribus/scribus.cpp Wed May  7 21:03:52 2014
@@ -971,7 +971,7 @@
 	scrMenuMgr->addMenuItemString("unicodeQuoteCJKDoubleLeft", "InsertQuote");
 	scrMenuMgr->addMenuItemString("unicodeQuoteCJKDoubleRight", "InsertQuote");
 
-	scrMenuMgr->createMenu("InsertSpace", tr("S&paces && Breaks"), "Insert");
+	scrMenuMgr->createMenu("InsertSpace", tr("S&paces / Breaks"), "Insert");
 	scrMenuMgr->addMenuItemString("InsertSpace", "Insert");
 	scrMenuMgr->addMenuItemString("unicodeNonBreakingSpace", "InsertSpace");
 	scrMenuMgr->addMenuItemString("unicodeSpaceEN", "InsertSpace");
@@ -1369,8 +1369,9 @@
 
 //Special keys assigned to actions are stolen by the action and not passed to
 //keyPressEvent so process them here.
-void ScribusMainWindow::specialActionKeyEvent(const QString& actionName, int unicodevalue)
-{
+void ScribusMainWindow::specialActionKeyEvent(int unicodevalue)
+{
+	const QString& actionName="";
 	if (HaveDoc)
 	{
 		if (doc->m_Selection->count() == 1)
@@ -1421,7 +1422,7 @@
 							activeTransaction = NULL;
 						}
 					}
-					else if (actionName=="unicodeSoftHyphen") //ignore the char as we use an attribute if the text item, for now.
+					else if (unicodevalue==SpecialChars::SHYPHEN.unicode()) //ignore the char as we use an attribute if the text item, for now.
 					{
 						// this code is currently dead since unicodeSoftHyphen
 						// doesnt have unicodevalue == -1 any more
@@ -3386,7 +3387,7 @@
 		strippedName = localName = QDir::toNativeSeparators(RecentDocs[m]);
 		strippedName.remove(QDir::separator());
 		strippedName.prepend(QString("%1").arg(m+1, 2, 10, QChar('0')));
-		scrRecentFileActions.insert(strippedName, new ScrAction(ScrAction::RecentFile, QPixmap(), QPixmap(), QString("%1 &%2").arg(m+1).arg(localName.replace("&","&&")), QKeySequence(), this, 0,0.0,RecentDocs[m]));
+		scrRecentFileActions.insert(strippedName, new ScrAction(ScrAction::RecentFile, QPixmap(), QPixmap(), QString("%1 &%2").arg(m+1).arg(localName.replace("&","&&")), QKeySequence(), this, RecentDocs[m]));
 		connect( scrRecentFileActions[strippedName], SIGNAL(triggeredData(QString)), this, SLOT(loadRecent(QString)) );
 		scrMenuMgr->addMenuItemString(strippedName, "FileOpenRecent");
 	}
@@ -3410,7 +3411,7 @@
 		{
 			strippedName = it.key();
 			QPixmap pm = it.value().Preview;
-			scrRecentPasteActions.insert(strippedName, new ScrAction(ScrAction::RecentPaste, pm, QPixmap(), QString("&%1 %2").arg(m+1).arg(strippedName), QKeySequence(), this, 0,0.0,it.key()));
+			scrRecentPasteActions.insert(strippedName, new ScrAction(ScrAction::RecentPaste, pm, QPixmap(), QString("&%1 %2").arg(m+1).arg(strippedName), QKeySequence(), this, it.key()));
 			connect( scrRecentPasteActions[strippedName], SIGNAL(triggeredData(QString)), this, SLOT(pasteRecent(QString)) );
 			scrMenuMgr->addMenuItemString(strippedName, "EditPasteRecent");
 			it--;

Modified: trunk/Scribus/scribus/scribus.h
URL: http://scribus.net/websvn/diff.php?repname=Scribus&rev=19100&path=/trunk/Scribus/scribus/scribus.h
==============================================================================
--- trunk/Scribus/scribus/scribus.h (original)
+++ trunk/Scribus/scribus/scribus.h Wed May  7 21:03:52 2014
@@ -275,7 +275,7 @@
 public slots:
 	void languageChange();
 	void statusBarLanguageChange();
-	void specialActionKeyEvent(const QString& actionName, int unicodevalue);
+	void specialActionKeyEvent(int unicodevalue);
 	void newView();
 	void ToggleStickyTools();
 	void ToggleAllGuides();

Modified: trunk/Scribus/scribus/ui/filetoolbar.h
URL: http://scribus.net/websvn/diff.php?repname=Scribus&rev=19100&path=/trunk/Scribus/scribus/ui/filetoolbar.h
==============================================================================
--- trunk/Scribus/scribus/ui/filetoolbar.h (original)
+++ trunk/Scribus/scribus/ui/filetoolbar.h Wed May  7 21:03:52 2014
@@ -28,7 +28,6 @@
 #include <QMap>
 #include <QPointer>
 #include "scribusapi.h"
-#include "scraction.h"
 #include "ui/sctoolbar.h"
 
 class ScribusMainWindow;

Modified: trunk/Scribus/scribus/ui/storyeditor.cpp
URL: http://scribus.net/websvn/diff.php?repname=Scribus&rev=19100&path=/trunk/Scribus/scribus/ui/storyeditor.cpp
==============================================================================
--- trunk/Scribus/scribus/ui/storyeditor.cpp (original)
+++ trunk/Scribus/scribus/ui/storyeditor.cpp Wed May  7 21:03:52 2014
@@ -3331,7 +3331,7 @@
 	return m_doc;
 }
 
-void StoryEditor::specialActionKeyEvent(const QString& /*actionName*/, int unicodevalue)
+void StoryEditor::specialActionKeyEvent(int unicodevalue)
 {
 	QString guiInsertString=QChar(unicodevalue);
 	bool setColor=false;

Modified: trunk/Scribus/scribus/ui/storyeditor.h
URL: http://scribus.net/websvn/diff.php?repname=Scribus&rev=19100&path=/trunk/Scribus/scribus/ui/storyeditor.h
==============================================================================
--- trunk/Scribus/scribus/ui/storyeditor.h (original)
+++ trunk/Scribus/scribus/ui/storyeditor.h Wed May  7 21:03:52 2014
@@ -474,7 +474,7 @@
 	void setSmart(bool);
 	void languageChange();
 
-	void specialActionKeyEvent(const QString& actionName, int unicodevalue);
+	void specialActionKeyEvent(int unicodevalue);
 	/*! \brief Slot to insert special characters from charSelect widget. */
 	void slot_insertSpecialChar();
 	void slot_insertUserSpecialChar(QChar, QString);

Modified: trunk/Scribus/scribus/ui/stylemanager.cpp
URL: http://scribus.net/websvn/diff.php?repname=Scribus&rev=19100&path=/trunk/Scribus/scribus/ui/stylemanager.cpp
==============================================================================
--- trunk/Scribus/scribus/ui/stylemanager.cpp (original)
+++ trunk/Scribus/scribus/ui/stylemanager.cpp Wed May  7 21:03:52 2014
@@ -876,7 +876,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(), key);
 			connect(m_styleActions[key], SIGNAL(triggeredData(QString)), this, SLOT(slotApplyStyle(QString)));
 		}
 	}
@@ -1035,7 +1035,7 @@
 		ScrAction *a = m_styleActions[oldKey];
 		disconnect(a, SIGNAL(triggeredData(QString)), this, SLOT(slotApplyStyle(QString)));
 		ScrAction *b = new ScrAction(ScrAction::DataQString, QPixmap(), QPixmap(), tr("&Apply"),
-			               a->shortcut(), m_doc->view(), 0, 0.0, newKey);
+						   a->shortcut(), m_doc->view(), newKey);
 		m_styleActions.remove(oldKey);
 		if (m_selectedStyleAction == a)
 		{
@@ -1073,10 +1073,8 @@
 		m_styleActions[key]->setShortcut(shortcut);
 	else
 	{
-		m_styleActions[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)));
+		m_styleActions[key] = new ScrAction(ScrAction::DataQString, QPixmap(), QPixmap(), tr("&Apply"), shortcut, m_doc->view(), key);
+		connect(m_styleActions[key], SIGNAL(triggeredData(QString)), this, SLOT(slotApplyStyle(QString)));
 	}
 
 	if (m_item)




More information about the scribus-commit mailing list