r16472 by jghali - #9864 : search/replace doesn't work for in story editor for fonts (regression)

scribus-commit scribus-commit at lists.scribus.net
Mon Mar 21 23:18:34 CET 2011


Author: jghali
Date: Mon Mar 21 22:18:33 2011
New Revision: 16472

URL: http://scribus.info/websvn/listing.php?repname=Scribus&sc=1&rev=16472
Log:
#9864 : search/replace doesn't work for in story editor for fonts (regression)

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

Modified: trunk/Scribus/scribus/ui/search.cpp
URL: http://scribus.info/websvn/diff.php?repname=Scribus&rev=16472&path=/trunk/Scribus/scribus/ui/search.cpp
==============================================================================
--- trunk/Scribus/scribus/ui/search.cpp (original)
+++ trunk/Scribus/scribus/ui/search.cpp Mon Mar 21 22:18:33 2011
@@ -706,6 +706,28 @@
 		if (Doc->scMW()->CurrStED != NULL)
 		{
 			StoryEditor* se=Doc->scMW()->CurrStED;
+			if (RText->isChecked())
+			{
+				disconnect(se->Editor, SIGNAL(cursorPositionChanged()), se, SLOT(updateProps()));
+				int SelStart = se->Editor->textCursor().selectionStart();
+				int SelEnd = se->Editor->textCursor().selectionEnd();
+//					se->Editor->insChars(RTextVal->text());
+				se->Editor->textCursor().setPosition(SelStart);
+				se->Editor->textCursor().setPosition(SelEnd, QTextCursor::KeepAnchor);
+				se->Editor->textCursor().removeSelectedText();
+//FIXME				se->Editor->setStyle(se->Editor->CurrentStyle);
+				QString newText = RTextVal->text();
+				se->Editor->insertPlainText(newText);
+				if (newText.length() > 0)
+				{
+					QTextCursor textCursor = se->Editor->textCursor();
+					textCursor.setPosition(SelStart);
+					textCursor.setPosition(SelStart + newText.length(), QTextCursor::KeepAnchor);
+					se->Editor->setTextCursor(textCursor);
+				}
+				connect(se->Editor, SIGNAL(cursorPositionChanged()), se, SLOT(updateProps()));
+//				se->newAlign(se->Editor->currentParaStyle);
+			}
 			if (RStyle->isChecked())
 				se->newAlign(RStyleVal->currentIndex());
 			if (RFill->isChecked())
@@ -722,21 +744,6 @@
 				se->newTxSize(RSizeVal->value());
 			if (REffect->isChecked())
 				se->newTxStyle(REffVal->getStyle());
-			if (RText->isChecked())
-			{
-				disconnect(se->Editor, SIGNAL(cursorPositionChanged()), se, SLOT(updateProps()));
-				int SelStart, SelEnd;
-				SelStart = se->Editor->textCursor().selectionStart();
-				SelEnd = se->Editor->textCursor().selectionEnd();
-//					se->Editor->insChars(RTextVal->text());
-				se->Editor->textCursor().setPosition(SelStart);
-				se->Editor->textCursor().setPosition(SelEnd, QTextCursor::KeepAnchor);
-				se->Editor->textCursor().removeSelectedText();
-//FIXME				se->Editor->setStyle(se->Editor->CurrentStyle);
-				se->Editor->insertPlainText(RTextVal->text());
-				connect(se->Editor, SIGNAL(cursorPositionChanged()), se, SLOT(updateProps()));
-//				se->newAlign(se->Editor->currentParaStyle);
-			}
 		}
 	}
 	DoReplace->setEnabled(false);




More information about the scribus-commit mailing list