r19130 by craig - #12317: Add ability to append lorem ipsum text instead of just overwriting existing text

scribus-commit scribus-commit at lists.scribus.net
Tue May 20 20:37:25 UTC 2014


Author: craig
Date: Tue May 20 20:37:25 2014
New Revision: 19130

URL: http://scribus.net/websvn/listing.php?repname=Scribus&sc=1&rev=19130
Log:
#12317: Add ability to append lorem ipsum text instead of just overwriting existing text

Modified:
    trunk/Scribus/scribus/ui/loremipsum.cpp
    trunk/Scribus/scribus/ui/loremipsum.h

Modified: trunk/Scribus/scribus/ui/loremipsum.cpp
URL: http://scribus.net/websvn/diff.php?repname=Scribus&rev=19130&path=/trunk/Scribus/scribus/ui/loremipsum.cpp
==============================================================================
--- trunk/Scribus/scribus/ui/loremipsum.cpp (original)
+++ trunk/Scribus/scribus/ui/loremipsum.cpp Tue May 20 20:37:25 2014
@@ -170,12 +170,19 @@
 	paraBox->setMinimum( 1 );
 	paraBox->setValue(PrefsManager::instance()->appPrefs.miscPrefs.paragraphsLI);
 	layout2->addWidget( paraBox );
-	randomCheckBox = new QCheckBox(this);
-	randomCheckBox->setChecked(true);
-	layout2->addWidget( randomCheckBox );
+
 	paraSpacer = new QSpacerItem( 2, 2, QSizePolicy::Expanding, QSizePolicy::Minimum );
 	layout2->addItem( paraSpacer );
 	layout3->addLayout( layout2 );
+
+	randomCheckBox = new QCheckBox(this);
+	randomCheckBox->setChecked(true);
+	layout3->addWidget( randomCheckBox );
+	appendCheckBox = new QCheckBox(this);
+	appendCheckBox->setChecked(false);
+	layout3->addWidget( appendCheckBox );
+
+//	layout3->addLayout( layout4 );
 
 	layout1 = new QHBoxLayout;
 	layout1->setMargin(0);
@@ -263,6 +270,7 @@
 	setWindowTitle( tr( "Lorem Ipsum" ) );
 	paraLabel->setText( tr( "Paragraphs:" ) );
 	randomCheckBox->setText( tr("Random Paragraphs"));
+	appendCheckBox->setText( tr("Append to existing text"));
 	okButton->setText( CommonStrings::tr_OK );
 	okButton->setShortcut( QKeySequence( tr( "Alt+O" ) ) );
 	cancelButton->setText( CommonStrings::tr_Cancel );
@@ -295,7 +303,7 @@
 		if (!i2->asTextFrame())
 			continue;
 		UndoTransaction* activeTransaction = NULL;
-		if (i2->itemText.length() != 0)
+		if (!appendCheckBox->isChecked() && i2->itemText.length() != 0)
 		{
 			if (UndoManager::undoEnabled())
 				activeTransaction = new UndoTransaction(undoManager->beginTransaction(Um::Selection, Um::IGroup, Um::AddLoremIpsum, "", Um::ICreate));
@@ -316,23 +324,6 @@
 			qDebug("LoremManager::okButton_clicked() *lp == NULL");
 			return;
 		}
-
-#if 0		
-// 		Set up the gtWriter instance with the selected paragraph style
-		gtWriter* writer = new gtWriter(false, currItem);
-		if (writer != NULL)
-		{
-				writer->setUpdateParagraphStyles(false);
-				writer->setOverridePStyleFont(false);
-				gtFrameStyle* fstyle = writer->getDefaultStyle();
-				gtParagraphStyle* pstyle = new gtParagraphStyle(*fstyle);
-				pstyle->setName(i2->currentStyle().name());
-				writer->setParagraphStyle(pstyle);
-				done = true;
-				writer->append(lp->createLorem(paraCount));
-		}
-		delete writer;		
-#endif
 		
 		// K.I.S.S.:
 		QString sampleText = lp->createLorem(paraCount, random);
@@ -349,7 +340,8 @@
 			delete activeTransaction;
 			activeTransaction = NULL;
 		}
-		i2->itemText.insertChars(0, sampleText);
+		int l=i2->itemText.length();
+		i2->itemText.insertChars(l, sampleText);
 		delete lp;
 		if (m_Doc->docHyphenator->AutoCheck)
 			m_Doc->docHyphenator->slotHyphenate(i2);

Modified: trunk/Scribus/scribus/ui/loremipsum.h
URL: http://scribus.net/websvn/diff.php?repname=Scribus&rev=19130&path=/trunk/Scribus/scribus/ui/loremipsum.h
==============================================================================
--- trunk/Scribus/scribus/ui/loremipsum.h (original)
+++ trunk/Scribus/scribus/ui/loremipsum.h Tue May 20 20:37:25 2014
@@ -114,6 +114,7 @@
 	QLabel* paraLabel;
 	QSpinBox* paraBox;
 	QCheckBox* randomCheckBox;
+	QCheckBox* appendCheckBox;
 	QPushButton* okButton;
 	QPushButton* cancelButton;
 	QGridLayout* LoremManagerLayout;




More information about the scribus-commit mailing list