View Issue Details

IDProjectCategoryView StatusLast Update
0010865ScribusUsabilitypublic2012-11-13 20:37
Reportergreyscale Assigned ToChelen  
PrioritynormalSeverityminorReproducibilityalways
Status closedResolutionfixed 
PlatformMacOSOSXOS Version10.6
Product Version1.4.1 
Fixed in Version1.5.0svn 
Summary0010865: Usage of cmd / alt / ctrl / shift keys causes a change in file
DescriptionWhen the cursor is placed inside a text frame (or inside an image frame), the action of pressing the Cmd key produces an invisible modificiation in
the document (the title bar gets a * appended, indicating a not-saved
state). The same occurs when pressing Atl, Ctrl, Esc or Shift, or when using the arrow key.
Steps To Reproduce1. In a new document, draw a text box.
2. Click inside the text box so that you are editing the content.
3. Save the document.
4. Close the document with the Cmd-W shortcut.

Expected result:
The document should close, since no change has been made.

Actual result:
Scribus shows a modal window saying "Document XXX has been changed since the last save".
Additional InformationThis little misbehaviour has the consequence that we cannot use the keyboard to close a file. A typical sequence of keystrokes when closing a document is: Cmd-S for saving the project, then Cmd-W for closing.

Because of this defect, every use of Cmd-W for closing a project triggers a
modal window that asks for "Don't Save/Cancel/Save" (the highlighted option being "Cancel").

The use of the mouse or trackpad is therefore mandatory to be able to save a file.
TagsNo tags attached.
Patch

Relationships

related to 0010978 closedChelen [PATCH] Snap to Item functionnality and other features 

Activities

ale

2012-07-12 20:04

manager   ~0028430

entering edit mode and exiting it with ESC also marks the document as changed.

exiting by clicking on the desktop does not.

Chelen

2012-07-23 09:34

reporter   ~0028563

Last edited: 2012-07-23 09:40

in fact every keystroke in editmode change the save flag. I fixed it in my current git repo. I just way for a commit of my work

Chelen

2012-07-23 09:36

reporter  

flagEditmode.diff (4,561 bytes)   
diff --git a/Scribus/scribus/pageitem_textframe.cpp b/Scribus/scribus/pageitem_textframe.cpp
index c4718ba..4dfdc8a 100644
--- a/Scribus/scribus/pageitem_textframe.cpp
+++ b/Scribus/scribus/pageitem_textframe.cpp
@@ -3376,7 +3376,7 @@ void PageItem_TextFrame::handleModeEditKey(QKeyEvent *k, bool& keyRepeat)
 		return;
 	}
 	//>>
-	
+
 	ScribusView* view = m_Doc->view();	
 	switch (kk)
 	{
@@ -3428,14 +3428,31 @@ void PageItem_TextFrame::handleModeEditKey(QKeyEvent *k, bool& keyRepeat)
 			unicodeInputString = "";
 			if (ok)
 			{
+				UndoTransaction trans(undoManager->beginTransaction(Um::Selection,Um::ITextFrame,Um::InsertText,"",Um::IDelete));
 				if (itemText.lengthOfSelection() > 0)
 					deleteSelectedTextFromFrame();
 				if (conv < 31)
 					conv = 32;
+				if (UndoManager::undoEnabled())
+				{
+					SimpleState *ss = dynamic_cast<SimpleState*>(undoManager->getLastUndo());
+					if(ss && ss->get("ETEA") == "insert_frametext")
+							ss->set("TEXT_STR",ss->get("TEXT_STR") + QString(QChar(conv)));
+					else {
+						ss = new SimpleState(Um::InsertText,"",Um::ICreate);
+						ss->set("INSERT_FRAMETEXT", "insert_frametext");
+						ss->set("ETEA", QString("insert_frametext"));
+						ss->set("TEXT_STR", QString(QChar(conv)));
+						ss->set("START", itemText.cursorPosition());
+						undoManager->action(this, ss);
+					}
+				}
 				itemText.insertChars(QString(QChar(conv)), true);
+				trans.commit();
 //				Tinput = true;
 				m_Doc->scMW()->setTBvals(this);
 				update();
+				doc()->changed();
 				keyRepeat = false;
 				return;
 			}
@@ -3739,14 +3756,18 @@ void PageItem_TextFrame::handleModeEditKey(QKeyEvent *k, bool& keyRepeat)
 		if (itemText.lengthOfSelection() == 0)
 			itemText.select(itemText.cursorPosition(), 1, true);
 		deleteSelectedTextFromFrame();
+		updateLayout();
+		if (oldLast != lastInFrame() && NextBox != 0 && NextBox->invalid)
+			NextBox->updateLayout();
 		update();
 //		Tinput = false;
-		if ((cr == QChar(13)) && (itemText.length() != 0))
-		{
+//		if ((cr == QChar(13)) && (itemText.length() != 0))
+//		{
 //			m_Doc->chAbStyle(this, findParagraphStyle(m_Doc, itemText.paragraphStyle(qMax(itemText.cursorPosition()-1,0))));
 //			Tinput = false;
-		}
+//		}
 		m_Doc->scMW()->setTBvals(this);
+		doc()->changed();
 //		view->RefreshItem(this);
 		break;
 	case Qt::Key_Backspace:
@@ -3793,6 +3814,7 @@ void PageItem_TextFrame::handleModeEditKey(QKeyEvent *k, bool& keyRepeat)
 		}
 		m_Doc->scMW()->setTBvals(this);
 		update();
+		doc()->changed();
 //		view->RefreshItem(this);
 		break;
 	default:
@@ -3905,12 +3927,12 @@ void PageItem_TextFrame::handleModeEditKey(QKeyEvent *k, bool& keyRepeat)
 			updateLayout();
 			if (oldLast != lastInFrame() && NextBox != 0 && NextBox->invalid)
 				NextBox->updateLayout();
+			doc()->changed();
 		}
 		//check if cursor need to jump to next linked frame
 		if ((itemText.cursorPosition() > lastInFrame() + 1) && (lastInFrame() < (itemText.length() - 2)) && NextBox != 0)
 		{
 			view->Deselect(true);
-			view->Deselect(true);
 			NextBox->update();
 			m_Doc->scMW()->selectItemsFromOutlines(NextBox);
 		}
@@ -3919,10 +3941,7 @@ void PageItem_TextFrame::handleModeEditKey(QKeyEvent *k, bool& keyRepeat)
 // 	update();
 //	view->slotDoCurs(true);
 	if ((kk == Qt::Key_Left) || (kk == Qt::Key_Right) || (kk == Qt::Key_Up) || (kk == Qt::Key_Down))
-	{
 		keyRepeat = false;
-		return;
-	}
 }
 
 void PageItem_TextFrame::deleteSelectedTextFromFrame()
diff --git a/Scribus/scribus/scribus.cpp b/Scribus/scribus/scribus.cpp
index 8eb4d5e..a948b01 100644
--- a/Scribus/scribus/scribus.cpp
+++ b/Scribus/scribus/scribus.cpp
@@ -1346,8 +1346,6 @@ void ScribusMainWindow::keyPressEvent(QKeyEvent *k)
 	QList<QMdiSubWindow *> windows;
 	QMdiSubWindow* w = NULL;
 	int kk = k->key();
-	QString uc = k->text();
-// 	QString cr, Tcha, Twort;
 	if (HaveDoc)
 	{
 		if ((doc->appMode == modeMagnifier) && (kk == Qt::Key_Shift))
@@ -1598,16 +1596,16 @@ void ScribusMainWindow::keyPressEvent(QKeyEvent *k)
 				if (currItem->asImageFrame() && !currItem->locked())
 				{
 					currItem->handleModeEditKey(k, keyrep);
+					slotDocCh(false);
 				}
 //FIXME:av		view->oldCp = currItem->CPos;
-				if (currItem->itemType() == PageItem::TextFrame)
+				else if (currItem->itemType() == PageItem::TextFrame)
 				{
 					bool kr=keyrep;
 					view->canvasMode()->keyPressEvent(k); //Hack for 1.4.x for stopping the cursor blinking while moving about
 					currItem->handleModeEditKey(k, keyrep);
 					keyrep=kr;
 				}
-				slotDocCh(false);
 			}
 		}
 	}
flagEditmode.diff (4,561 bytes)   

Issue History

Date Modified Username Field Change
2012-07-10 19:58 greyscale New Issue
2012-07-12 20:04 ale Note Added: 0028430
2012-07-23 09:34 Chelen Note Added: 0028563
2012-07-23 09:35 Chelen File Added: flagEditmode.diff
2012-07-23 09:36 Chelen File Deleted: flagEditmode.diff
2012-07-23 09:36 Chelen File Added: flagEditmode.diff
2012-07-23 09:40 Chelen Note Edited: 0028563
2012-07-31 19:35 cbradney Relationship added related to 0010978
2012-07-31 20:18 cbradney Status new => resolved
2012-07-31 20:18 cbradney Fixed in Version => 1.5.0svn
2012-07-31 20:18 cbradney Resolution open => fixed
2012-07-31 20:18 cbradney Assigned To => cbradney
2012-08-01 20:52 cbradney Assigned To cbradney => Chelen
2012-11-13 20:37 cbradney Status resolved => closed