added basic history window
authorinsilmaril
Tue, 11 Apr 2006 14:34:14 +0000
changeset 2943492af261af2
parent 293 68495946fe33
child 295 f6fecd518011
added basic history window
main.cpp
mainwindow.cpp
mainwindow.h
mapeditor.cpp
     1.1 --- a/main.cpp	Tue Apr 11 14:34:14 2006 +0000
     1.2 +++ b/main.cpp	Tue Apr 11 14:34:14 2006 +0000
     1.3 @@ -59,7 +59,7 @@
     1.4  QAction *actionEditAddBranchHere;
     1.5  QAction *actionEditAddBranchAbove;
     1.6  QAction *actionEditAddBranchBelow;
     1.7 -QAction *actionEditRemoveBranchHere;
     1.8 +QAction *actionEditRemoveBranchKeepChilds;
     1.9  QAction *actionEditRemoveChilds;
    1.10  QAction *actionEditImportAdd;
    1.11  QAction *actionEditImportReplace;
    1.12 @@ -95,6 +95,7 @@
    1.13  QAction *actionFormatLinkStylePolyParabel;
    1.14  
    1.15  QAction *actionViewToggleNoteEditor;
    1.16 +QAction *actionViewToggleHistoryWindow;
    1.17  
    1.18  QAction *actionSettingsAutoselectHeading;
    1.19  QAction *actionSettingsAutoselectText;
     2.1 --- a/mainwindow.cpp	Tue Apr 11 14:34:14 2006 +0000
     2.2 +++ b/mainwindow.cpp	Tue Apr 11 14:34:14 2006 +0000
     2.3 @@ -73,7 +73,7 @@
     2.4  extern QAction *actionEditAddBranchHere;
     2.5  extern QAction *actionEditAddBranchAbove;
     2.6  extern QAction *actionEditAddBranchBelow;
     2.7 -extern QAction *actionEditRemoveBranchHere;
     2.8 +extern QAction *actionEditRemoveBranchKeepChilds;
     2.9  extern QAction *actionEditRemoveChilds;
    2.10  extern QAction *actionEditImportAdd;
    2.11  extern QAction *actionEditImportReplace;
    2.12 @@ -109,6 +109,7 @@
    2.13  extern QAction *actionFormatHideLinkUnselected;
    2.14  
    2.15  extern QAction *actionViewToggleNoteEditor;
    2.16 +extern QAction *actionViewToggleHistoryWindow;
    2.17  
    2.18  extern QAction* actionSettingsAutoedit;
    2.19  extern QAction* actionSettingsAutoselectHeading;
    2.20 @@ -628,10 +629,10 @@
    2.21  
    2.22  	// Only remove branch, not its childs
    2.23      a = new QAction( tr( "Remove only branch and keep its childs" ),tr( "Remove only branch " ), ALT + Key_Delete, this, "removeBranchHere" );
    2.24 -    connect( a, SIGNAL( activated() ), this, SLOT( editRemoveBranchHere() ) );
    2.25 +    connect( a, SIGNAL( activated() ), this, SLOT( editRemoveBranchKeepChilds() ) );
    2.26  	a->setEnabled (false);
    2.27  	actionListBranches.append(a);
    2.28 -	actionEditRemoveBranchHere=a;
    2.29 +	actionEditRemoveBranchKeepChilds=a;
    2.30  
    2.31  	// Only remove childs of a branch
    2.32      a = new QAction( tr( "Remove childs of branch" ),tr( "Remove childs" ), SHIFT + Key_Delete, this, "removeBranchChilds" );
    2.33 @@ -787,6 +788,8 @@
    2.34      connect( a, SIGNAL( activated() ), this, SLOT( viewZoomOut() ) );
    2.35      a->addTo( tb );
    2.36      a->addTo( menu );
    2.37 +
    2.38 +
    2.39      a = new QAction( tr( "Toggle Note Editor" ), QPixmap(flagsPath+"flag-note.png"), tr( "Toggle Note Editor" ), CTRL + Key_E , this, "noteEditor" );
    2.40      connect( a, SIGNAL( activated() ), this, SLOT(windowToggleNoteEditor() ) );
    2.41  	a->setToggleAction(true);
    2.42 @@ -797,6 +800,13 @@
    2.43      a->addTo( tb );
    2.44      a->addTo( menu );
    2.45  	actionViewToggleNoteEditor=a;
    2.46 +
    2.47 +    a = new QAction( tr( "Toggle history window" ), QPixmap(), tr( "Toggle history window" ), CTRL + Key_H , this, "historyWindow" );
    2.48 +    connect( a, SIGNAL( activated() ), this, SLOT(windowToggleHistory() ) );
    2.49 +	a->setToggleAction(false);
    2.50 +    a->addTo( menu );
    2.51 +	actionViewToggleHistoryWindow=a;
    2.52 +
    2.53      a = new QAction( tr( "&Next Window" ), QPixmap(), tr( "Next Window" ), ALT + Key_N , this, "nextWindow" );
    2.54      connect( a, SIGNAL( activated() ), this, SLOT(windowNextEditor() ) );
    2.55      a->addTo( menu );
    2.56 @@ -1132,7 +1142,7 @@
    2.57  		branchRemoveContextMenu =new QPopupMenu (this);
    2.58  		actionEditCut->addTo ( branchRemoveContextMenu );
    2.59  		actionEditDelete->addTo ( branchRemoveContextMenu );
    2.60 -		actionEditRemoveBranchHere->addTo( branchRemoveContextMenu );
    2.61 +		actionEditRemoveBranchKeepChilds->addTo( branchRemoveContextMenu );
    2.62  		actionEditRemoveChilds->addTo( branchRemoveContextMenu );
    2.63  		
    2.64  	branchContextMenu->insertItem (tr("Add"),branchAddContextMenu);	
    2.65 @@ -2283,7 +2293,7 @@
    2.66  void Main::editToggleHideExport()
    2.67  {
    2.68  	if (currentMapEditor())
    2.69 -		currentMapEditor()->setHideExport();	
    2.70 +		currentMapEditor()->toggleHideExport();	
    2.71  }
    2.72  
    2.73  void Main::editMapInfo()
    2.74 @@ -2365,10 +2375,10 @@
    2.75  	fileSaveAs (PartOfMap);
    2.76  }
    2.77  
    2.78 -void Main::editRemoveBranchHere()
    2.79 +void Main::editRemoveBranchKeepChilds()
    2.80  {
    2.81  	if (currentMapEditor())
    2.82 -		currentMapEditor()->removeBranchHere();
    2.83 +		currentMapEditor()->removeBranchKeepChilds();
    2.84  }
    2.85  
    2.86  void Main::editRemoveChilds()
    2.87 @@ -2628,6 +2638,12 @@
    2.88  		windowShowNoteEditor();
    2.89  }
    2.90  
    2.91 +void Main::windowToggleHistory()
    2.92 +{
    2.93 +	if (currentMapEditor())
    2.94 +		currentMapEditor()->toggleHistoryWindow();
    2.95 +}
    2.96 +
    2.97  void Main::updateNoteFlag()
    2.98  {
    2.99  	if (currentMapEditor())
     3.1 --- a/mainwindow.h	Tue Apr 11 14:34:14 2006 +0000
     3.2 +++ b/mainwindow.h	Tue Apr 11 14:34:14 2006 +0000
     3.3 @@ -115,7 +115,7 @@
     3.4      void editImportAdd();
     3.5      void editImportReplace();
     3.6      void editSaveBranch();
     3.7 -    void editRemoveBranchHere();
     3.8 +    void editRemoveBranchKeepChilds();
     3.9      void editRemoveChilds();
    3.10      void editDeleteSelection();
    3.11      void editUpperBranch();
    3.12 @@ -159,6 +159,7 @@
    3.13  	bool settingsURL();
    3.14  
    3.15  	void windowToggleNoteEditor();
    3.16 +	void windowToggleHistory();
    3.17  	void updateNoteFlag();
    3.18  
    3.19  private slots:
     4.1 --- a/mapeditor.cpp	Tue Apr 11 14:34:14 2006 +0000
     4.2 +++ b/mapeditor.cpp	Tue Apr 11 14:34:14 2006 +0000
     4.3 @@ -159,7 +159,7 @@
     4.4      printer=NULL;
     4.5  
     4.6      lineedit = new QLineEdit(this, "lineedit"  );
     4.7 -    connect( lineedit, SIGNAL( returnPressed() ), SLOT( finishedLineEditNoSave() ) );
     4.8 +    connect( lineedit, SIGNAL( returnPressed() ), SLOT( finishedLineEdit() ) );
     4.9      lineedit->hide();
    4.10  
    4.11      actColor=black; setColor (actColor);
    4.12 @@ -197,7 +197,7 @@
    4.13  	
    4.14  	zipped=true;
    4.15  	filePath="";
    4.16 -	fileName="unnamed";
    4.17 +	fileName=tr("unnamed");
    4.18  	mapName="";
    4.19  
    4.20  	undosTotal=settings.readNumEntry("/vym/mapeditor/undoLevels",50);
    4.21 @@ -224,6 +224,10 @@
    4.22  	// Initially set movingCentre
    4.23  	updateViewCenter();
    4.24  
    4.25 +	// For testing purposes create history window
    4.26 +	historyWindow = new ShowTextDialog (this);
    4.27 +	historyWindow->setCaption (fileName);
    4.28 +
    4.29  	mapCenter->reposition();	//	for positioning heading
    4.30  }
    4.31  
    4.32 @@ -327,6 +331,18 @@
    4.33  	return blockReposition;
    4.34  }
    4.35  
    4.36 +QString MapEditor::getName (LinkableMapObj *lmo)
    4.37 +{
    4.38 +	if (!lmo) return QString("NULL has no name!");
    4.39 +
    4.40 +	if ((typeid(*lmo) == typeid(BranchObj) ||
    4.41 +				      typeid(*lmo) == typeid(MapCenterObj))) 
    4.42 +		return QString("branch (%1)").arg(((BranchObj*)lmo)->getHeading());
    4.43 +	if ((typeid(*lmo) == typeid(FloatImageObj) ))
    4.44 +		return QString ("floatimage [%1]").arg(((FloatImageObj*)lmo)->getOriginalFilename());
    4.45 +	return QString("Unknown type has no name!");
    4.46 +}
    4.47 +
    4.48  void MapEditor::makeTmpDirs()
    4.49  {
    4.50  	// Create unique temporary directories
    4.51 @@ -416,19 +432,19 @@
    4.52  	return s;
    4.53  }
    4.54  
    4.55 -void MapEditor::saveState()
    4.56 +void MapEditor::saveState(const QString &comment)
    4.57  {
    4.58  	// Save complete map
    4.59 -	saveState (CompleteMap,"",NULL,"",NULL);
    4.60 +	saveState (CompleteMap,"",NULL,"",NULL, comment);
    4.61  }
    4.62  
    4.63 -void MapEditor::saveState(LinkableMapObj *undoSel)
    4.64 +void MapEditor::saveState(LinkableMapObj *undoSel, const QString &comment)
    4.65  {
    4.66  	// save the given part of the map 
    4.67 -	saveState (PartOfMap,"",undoSel,"",NULL);
    4.68 +	saveState (PartOfMap,"",undoSel,"",NULL, comment);
    4.69  }
    4.70  
    4.71 -void MapEditor::saveState(const QString &uc, const QString &rc)
    4.72 +void MapEditor::saveState(const QString &uc, const QString &rc, const QString &comment)
    4.73  {
    4.74  	// selection does not change during action,
    4.75  	// so just save commands for undo and redo
    4.76 @@ -437,15 +453,15 @@
    4.77  		unsel=selection;
    4.78  	else
    4.79  		unsel=NULL;
    4.80 -	saveState (UndoCommand,uc,unsel,rc,unsel);
    4.81 +	saveState (UndoCommand,uc,unsel,rc,unsel, comment);
    4.82  }
    4.83  
    4.84 -void MapEditor::saveState(const QString & uncom, LinkableMapObj *unsel) 
    4.85 +void MapEditor::saveState(const QString & uncom, LinkableMapObj *unsel, const QString &comment) 
    4.86  {
    4.87 -	saveState (UndoCommand,uncom,unsel,"FIXME-redoCom",NULL);
    4.88 +	saveState (UndoCommand,uncom,unsel,"FIXME-redoCom",NULL, comment);
    4.89  }
    4.90  
    4.91 -void MapEditor::saveState(const SaveMode &savemode, const QString &undoCom, LinkableMapObj *undoSel, const QString &redoCom, LinkableMapObj *redoSel)
    4.92 +void MapEditor::saveState(const SaveMode &savemode, const QString &undoCom, LinkableMapObj *undoSel, const QString &redoCom, LinkableMapObj *redoSel, const QString &comment)
    4.93  {
    4.94  	// Main saveState
    4.95  
    4.96 @@ -458,6 +474,9 @@
    4.97  	cout << "       undoNum="<<undoNum<<endl;
    4.98  	cout << "    ---------------------------"<<endl;
    4.99  	*/
   4.100 +
   4.101 +	historyWindow->append (comment);
   4.102 +	
   4.103  	setChanged();
   4.104  
   4.105  	// Find out current undo directory
   4.106 @@ -510,6 +529,7 @@
   4.107  	set.setEntry (QString("undoSelection"),undoSelection);
   4.108  	set.setEntry (QString("redoCommand"),redoCom);
   4.109  	set.setEntry (QString("redoSelection"),redoSelection);
   4.110 +	set.setEntry (QString("comment"),comment);
   4.111  	set.writeSettings(QString(bakMapDir+"/commands"));
   4.112  
   4.113  	/* TODO remove after testing
   4.114 @@ -517,6 +537,8 @@
   4.115  	cout << "    undosAvail="<<undosAvail<<endl;
   4.116  	cout << "       undoNum="<<undoNum<<endl;
   4.117  	cout << "    ---------------------------"<<endl;
   4.118 +	cout << "    comment="<<comment<<endl;
   4.119 +	cout << "    ---------------------------"<<endl;
   4.120  	cout << "    undoCom="<<undoCommand<<endl;
   4.121  	cout << "    undoSel="<<undoSelection<<endl;
   4.122  	cout << "    ---------------------------"<<endl;
   4.123 @@ -640,7 +662,7 @@
   4.124  }
   4.125  
   4.126  
   4.127 -void MapEditor::finishedLineEditNoSave()
   4.128 +void MapEditor::finishedLineEdit()
   4.129  {
   4.130  	// This is called by finishedLineEdit or any MapEditor method,
   4.131  	// which wants to assure, that lineedits finish, before e.g. a branch is 
   4.132 @@ -652,6 +674,7 @@
   4.133  
   4.134      if (editingBO!=NULL) 
   4.135  	{
   4.136 +		saveState("setHeading (\""+editingBO->getHeading()+"\")",editingBO, QString("Set heading of %1 to \"%2\"").arg(getName(editingBO)).arg(lineedit->text()) );
   4.137  		editingBO->setHeading(lineedit->text() );
   4.138  		editingBO=NULL;
   4.139  		lineedit->releaseKeyboard();
   4.140 @@ -663,6 +686,14 @@
   4.141      }		
   4.142  }
   4.143  
   4.144 +void MapEditor::toggleHistoryWindow()
   4.145 +{
   4.146 +	if (historyWindow->isVisible())
   4.147 +		historyWindow->hide();
   4.148 +	else	
   4.149 +		historyWindow->show();
   4.150 +}
   4.151 +
   4.152  
   4.153  bool MapEditor::isDefault()
   4.154  {
   4.155 @@ -692,7 +723,7 @@
   4.156  void MapEditor::closeMap()
   4.157  {
   4.158  	// Finish open lineEdits
   4.159 -	if (lineedit) finishedLineEditNoSave();
   4.160 +	if (lineedit) finishedLineEdit();
   4.161  
   4.162  	// Unselect before disabling the toolbar actions
   4.163  	if (selection) selection->unselect();
   4.164 @@ -731,6 +762,9 @@
   4.165  
   4.166  		// Forget the .vym (or .xml) for name of map
   4.167  		mapName=fileName.left(fileName.findRev(".",-1,true) );
   4.168 +
   4.169 +		// Adjust history window
   4.170 +		historyWindow->setCaption (fileName);
   4.171  	}
   4.172  }
   4.173  
   4.174 @@ -757,7 +791,7 @@
   4.175  ErrorCode MapEditor::load (QString fname, LoadMode lmode)
   4.176  {
   4.177  	// Finish open lineEdits
   4.178 -	if (lineedit) finishedLineEditNoSave();
   4.179 +	if (lineedit) finishedLineEdit();
   4.180  
   4.181  	ErrorCode err=success;
   4.182  
   4.183 @@ -770,7 +804,7 @@
   4.184  		// (map state is set later at end of load...)
   4.185  	} else
   4.186  	{
   4.187 -		saveState(selection);
   4.188 +		saveState(selection,"Load map");
   4.189  	}	
   4.190  	
   4.191      
   4.192 @@ -826,7 +860,7 @@
   4.193  int MapEditor::save (const SaveMode &savemode)
   4.194  {
   4.195  	// Finish open lineEdits
   4.196 -	if (lineedit) finishedLineEditNoSave();
   4.197 +	if (lineedit) finishedLineEdit();
   4.198  
   4.199  	int returnCode=0;
   4.200  
   4.201 @@ -876,7 +910,7 @@
   4.202  void MapEditor::print()
   4.203  {
   4.204  	// Finish open lineEdits
   4.205 -	if (lineedit) finishedLineEditNoSave();
   4.206 +	if (lineedit) finishedLineEdit();
   4.207  
   4.208  	if ( !printer ) 
   4.209  	{
   4.210 @@ -1052,7 +1086,7 @@
   4.211  void MapEditor::exportImage(QString fn)
   4.212  {
   4.213  	// Finish open lineEdits
   4.214 -	if (lineedit) finishedLineEditNoSave();
   4.215 +	if (lineedit) finishedLineEdit();
   4.216  
   4.217  	setExportMode (true);
   4.218  	QPixmap pix (getPixmap());
   4.219 @@ -1073,7 +1107,7 @@
   4.220  void MapEditor::exportImage(QString fn, int item)
   4.221  {
   4.222  	// Finish open lineEdits
   4.223 -	if (lineedit) finishedLineEditNoSave();
   4.224 +	if (lineedit) finishedLineEdit();
   4.225  
   4.226  	setExportMode (true);
   4.227  	QPixmap pix (getPixmap());
   4.228 @@ -1142,7 +1176,7 @@
   4.229  void MapEditor::copy()
   4.230  {
   4.231  	// Finish open lineEdits
   4.232 -	if (lineedit) finishedLineEditNoSave();
   4.233 +	if (lineedit) finishedLineEdit();
   4.234  
   4.235  	if (selection) 
   4.236  	{
   4.237 @@ -1173,7 +1207,7 @@
   4.238  void MapEditor::redo()
   4.239  {
   4.240  	// Finish open lineEdits
   4.241 -	if (lineedit) finishedLineEditNoSave();
   4.242 +	if (lineedit) finishedLineEdit();
   4.243  
   4.244  	blockSaveState=true;
   4.245  	
   4.246 @@ -1234,7 +1268,7 @@
   4.247  void MapEditor::undo()
   4.248  {
   4.249  	// Finish open lineEdits
   4.250 -	if (lineedit) finishedLineEditNoSave();
   4.251 +	if (lineedit) finishedLineEdit();
   4.252  
   4.253  	blockSaveState=true;
   4.254  	
   4.255 @@ -1341,7 +1375,7 @@
   4.256  void MapEditor::pasteNoSave()
   4.257  {
   4.258  	// Finish open lineEdits
   4.259 -	if (lineedit) finishedLineEditNoSave();
   4.260 +	if (lineedit) finishedLineEdit();
   4.261  
   4.262  	load (clipboardDir+"/part.xml",ImportAdd);
   4.263  }
   4.264 @@ -1357,7 +1391,7 @@
   4.265  	if (selection && (typeid(*selection) == typeid(BranchObj) ||
   4.266  				      typeid(*selection) == typeid(MapCenterObj))) 
   4.267  	{
   4.268 -		saveState(selection);
   4.269 +		saveState(selection,QString("Paste to %1").arg( getName(selection)));
   4.270  		pasteNoSave();
   4.271  		mapCenter->reposition();
   4.272  		adjustCanvasSize();
   4.273 @@ -1366,7 +1400,7 @@
   4.274  
   4.275  void MapEditor::cut()
   4.276  {
   4.277 -	saveState(selection->getParObj());
   4.278 +	saveState(selection->getParObj(),QString("Cut %1").arg(getName(selection)));
   4.279  	copy();
   4.280  	cutNoSave();
   4.281  	mapCenter->reposition();
   4.282 @@ -1384,7 +1418,7 @@
   4.283  void MapEditor::moveBranchUp()
   4.284  {
   4.285  	// Finish open lineEdits
   4.286 -	if (lineedit) finishedLineEditNoSave();
   4.287 +	if (lineedit) finishedLineEdit();
   4.288  
   4.289  	BranchObj* bo;
   4.290  	BranchObj* par;
   4.291 @@ -1395,7 +1429,7 @@
   4.292  		selection->unselect();
   4.293  		selection=par->moveBranchUp (bo);
   4.294  		selection->select();
   4.295 -		saveState("moveBranchDown ()",bo);
   4.296 +		saveState("moveBranchDown ()",bo,QString("Move up %1").arg(getName(bo)));
   4.297  		mapCenter->reposition();
   4.298  		ensureSelectionVisible();
   4.299  	}
   4.300 @@ -1404,7 +1438,7 @@
   4.301  void MapEditor::moveBranchDown()
   4.302  {
   4.303  	// Finish open lineEdits
   4.304 -	if (lineedit) finishedLineEditNoSave();
   4.305 +	if (lineedit) finishedLineEdit();
   4.306  
   4.307  	BranchObj* bo;
   4.308  	BranchObj* par;
   4.309 @@ -1415,7 +1449,7 @@
   4.310  		selection->unselect(); 
   4.311  		selection=par->moveBranchDown(bo);
   4.312  		selection->select();
   4.313 -		saveState("moveBranchUp ()",bo);
   4.314 +		saveState("moveBranchUp ()",bo,QString("Move down %1").arg(getName(bo)));
   4.315  		mapCenter->reposition();
   4.316  		ensureSelectionVisible();
   4.317  	}	
   4.318 @@ -1424,14 +1458,13 @@
   4.319  void MapEditor::editHeading()
   4.320  {
   4.321  	// Finish open lineEdits
   4.322 -	if (lineedit) finishedLineEditNoSave();
   4.323 +	if (lineedit) finishedLineEdit();
   4.324  
   4.325  	if (selection  &&  
   4.326  		 (typeid(*selection) == typeid(BranchObj) || 
   4.327  		  typeid(*selection) == typeid(MapCenterObj) ) ) 
   4.328  	{
   4.329  		editingBO=(BranchObj*)selection;
   4.330 -		saveState("setHeading (\""+((BranchObj*)selection)->getHeading()+"\")",editingBO );
   4.331  
   4.332  		ensureSelectionVisible();
   4.333  		QPoint p = worldMatrix().map(QPoint (editingBO->x(),editingBO->y()));
   4.334 @@ -1492,15 +1525,15 @@
   4.335  void MapEditor::addNewBranch(int pos)
   4.336  {
   4.337  	// Finish open lineEdits
   4.338 -	if (lineedit) finishedLineEditNoSave();
   4.339 +	if (lineedit) finishedLineEdit();
   4.340  
   4.341  	if (selection  &&  
   4.342  		 (typeid(*selection) == typeid(BranchObj) || 
   4.343  		  typeid(*selection) == typeid(MapCenterObj) ) ) 
   4.344  	{
   4.345 -		saveState(selection);	//TODO undoCommand
   4.346 -
   4.347  		BranchObj* bo1 = (BranchObj*) selection;
   4.348 +		saveState(selection, QString("Add new branch to %1").arg(getName(bo1)));	//TODO undoCommand
   4.349 +
   4.350  		bool wasScrolled=false;
   4.351  		BranchObj *newbo=NULL;
   4.352  		if (pos==0)
   4.353 @@ -1558,14 +1591,14 @@
   4.354  void MapEditor::addNewBranchHere()
   4.355  {
   4.356  	// Finish open lineEdits
   4.357 -	if (lineedit) finishedLineEditNoSave();
   4.358 +	if (lineedit) finishedLineEdit();
   4.359  
   4.360  	if (selection  &&  
   4.361  		 (typeid(*selection) == typeid(BranchObj) ) )
   4.362  	{
   4.363 -		saveState(selection);
   4.364 -
   4.365  		BranchObj* bo1 = (BranchObj*) selection;
   4.366 +		saveState(selection, QString("Add new branch here").arg(getName(bo1)));
   4.367 +
   4.368  		bool wasScrolled=false;
   4.369  		BranchObj *newbo=NULL;
   4.370  		BranchObj *parbo=(BranchObj*)(selection->getParObj());
   4.371 @@ -1607,21 +1640,21 @@
   4.372  void MapEditor::deleteSelection()
   4.373  {
   4.374  	// Finish open lineEdits
   4.375 -	if (lineedit) finishedLineEditNoSave();
   4.376 +	if (lineedit) finishedLineEdit();
   4.377  
   4.378  	if (selection  && typeid(*selection) ==typeid(BranchObj) ) 
   4.379  	{
   4.380 +		BranchObj* bo=dynamic_cast <BranchObj*> (selection);
   4.381 +		BranchObj* par=(BranchObj*)(bo->getParObj());
   4.382 +		bo->unselect();
   4.383  		if (selection->getDepth()>1)
   4.384  			// Normal branch, save parent with childs
   4.385 -			saveState(selection->getParObj());
   4.386 +			saveState(par,QString("Delete %1").arg(getName(bo)));
   4.387  		else
   4.388  			// Mainbranch, save whole map
   4.389  			// TODO Better would be to insert mainbranch again at pos
   4.390  			// But undoCommand is missing right now
   4.391 -			saveState();
   4.392 -		BranchObj* bo=dynamic_cast <BranchObj*> (selection);
   4.393 -		BranchObj* par=(BranchObj*)(bo->getParObj());
   4.394 -		bo->unselect();
   4.395 +			saveState(QString("Delete %1").arg(getName(bo)));
   4.396  		selection=NULL;
   4.397  		par->removeBranch(bo);
   4.398  		selection=par;
   4.399 @@ -1632,9 +1665,9 @@
   4.400  	}
   4.401  	if (selection  && typeid(*selection) ==typeid(FloatImageObj) ) 
   4.402  	{
   4.403 -		saveState(selection->getParObj());
   4.404  		FloatImageObj* fio=dynamic_cast <FloatImageObj*> (selection);
   4.405  		BranchObj* par=(BranchObj*)(fio->getParObj());
   4.406 +		saveState(par, QString("Delete %1").arg(getName(fio)));
   4.407  		fio->unselect();
   4.408  		selection=NULL;
   4.409  		par->removeFloatImage(fio);
   4.410 @@ -1864,7 +1897,7 @@
   4.411  void MapEditor::selectUpperBranch()
   4.412  {
   4.413  	// Finish open lineEdits
   4.414 -	if (lineedit) finishedLineEditNoSave();
   4.415 +	if (lineedit) finishedLineEdit();
   4.416  
   4.417  	if (selection) 
   4.418  	{
   4.419 @@ -1884,7 +1917,7 @@
   4.420  void MapEditor::selectLowerBranch()
   4.421  {
   4.422  	// Finish open lineEdits
   4.423 -	if (lineedit) finishedLineEditNoSave();
   4.424 +	if (lineedit) finishedLineEdit();
   4.425  
   4.426  	if (selection) 
   4.427  	{
   4.428 @@ -1905,7 +1938,7 @@
   4.429  void MapEditor::selectLeftBranch()
   4.430  {
   4.431  	// Finish open lineEdits
   4.432 -	if (lineedit) finishedLineEditNoSave();
   4.433 +	if (lineedit) finishedLineEdit();
   4.434  
   4.435  	BranchObj* bo;
   4.436  	BranchObj* par;
   4.437 @@ -1967,7 +2000,7 @@
   4.438  void MapEditor::selectRightBranch()
   4.439  {
   4.440  	// Finish open lineEdits
   4.441 -	if (lineedit) finishedLineEditNoSave();
   4.442 +	if (lineedit) finishedLineEdit();
   4.443  
   4.444  	BranchObj* bo;
   4.445  	BranchObj* par;
   4.446 @@ -2027,7 +2060,7 @@
   4.447  void MapEditor::selectFirstBranch()
   4.448  {
   4.449  	// Finish open lineEdits
   4.450 -	if (lineedit) finishedLineEditNoSave();
   4.451 +	if (lineedit) finishedLineEdit();
   4.452  
   4.453  	BranchObj *bo1;
   4.454  	BranchObj *bo2;
   4.455 @@ -2052,7 +2085,7 @@
   4.456  void MapEditor::selectLastBranch()
   4.457  {
   4.458  	// Finish open lineEdits
   4.459 -	if (lineedit) finishedLineEditNoSave();
   4.460 +	if (lineedit) finishedLineEdit();
   4.461  
   4.462  	BranchObj *bo1;
   4.463  	BranchObj *bo2;
   4.464 @@ -2082,12 +2115,12 @@
   4.465  void MapEditor::selectBackgroundColor()
   4.466  {
   4.467  	// Finish open lineEdits
   4.468 -	if (lineedit) finishedLineEditNoSave();
   4.469 +	if (lineedit) finishedLineEdit();
   4.470  
   4.471  	QColor col = QColorDialog::getColor( mapCanvas->backgroundColor(), this );
   4.472  	if ( !col.isValid() ) return;
   4.473  	setBackgroundColor( col );
   4.474 -	saveState();
   4.475 +	saveState(QString("Set background color of map to %1").arg(col.name()));
   4.476  }
   4.477  
   4.478  void MapEditor::setBackgroundColor(QColor c)
   4.479 @@ -2116,8 +2149,8 @@
   4.480  		if (typeid(*selection) == typeid(BranchObj) ||
   4.481  			typeid(*selection) == typeid(MapCenterObj))
   4.482  		{
   4.483 -			saveState(selection);	//TODO undoCommand
   4.484  			BranchObj *bo=(BranchObj*)selection;
   4.485 +			saveState(selection, QString("Set color of %1 to %2").arg(getName(bo)).arg(actColor.name()));	//TODO undoCommand
   4.486  			bo->setColor(actColor); // color branch
   4.487  		}    
   4.488  	}
   4.489 @@ -2130,8 +2163,8 @@
   4.490  		if (typeid(*selection) == typeid(BranchObj) ||
   4.491  			typeid(*selection) == typeid(MapCenterObj))
   4.492  		{
   4.493 -			saveState(selection);	//TODO undoCommand
   4.494  			BranchObj *bo=(BranchObj*)selection;
   4.495 +			saveState(selection, QString ("Set color of %1 and childs to %2").arg(getName(bo)).arg(actColor.name()));	//TODO undoCommand
   4.496  			bo->setColorChilds(actColor); // color links, color childs
   4.497  		}    
   4.498  	}
   4.499 @@ -2142,8 +2175,14 @@
   4.500  {
   4.501  	if (selection)
   4.502  	{
   4.503 -		saveState(selection);// TODO undoCommand	
   4.504 -		((BranchObj*)selection)->toggleStandardFlag (f,actionSettingsUseFlagGroups);
   4.505 +		BranchObj *bo=(BranchObj*)selection;
   4.506 +		QString s;
   4.507 +		if (bo->isSetStandardFlag(f))
   4.508 +			s="Unset";
   4.509 +		else
   4.510 +			s="Set";
   4.511 +		saveState(selection, QString("%1 standard flag \"%2\" of %3").arg(s).arg(f).arg(getName(bo)));// TODO undoCommand	
   4.512 +		bo->toggleStandardFlag (f,actionSettingsUseFlagGroups);
   4.513  		adjustCanvasSize();
   4.514  	}	
   4.515  }
   4.516 @@ -2232,7 +2271,7 @@
   4.517  		if ( ok) 
   4.518  		{
   4.519  			// user entered something and pressed OK
   4.520 -			saveState("setURL (\""+bo->getURL()+"\")","setURL (\""+text+"\")");	
   4.521 +			saveState("setURL (\""+bo->getURL()+"\")","setURL (\""+text+"\")", QString("Set URL of %1 to %21").arg(getName(bo)).arg(text));	
   4.522  			bo->setURL (text);
   4.523  			updateActions();
   4.524  		}	
   4.525 @@ -2254,7 +2293,7 @@
   4.526  			typeid(*selection) == typeid(MapCenterObj)) )
   4.527  	{		
   4.528  		BranchObj *bo=(BranchObj*)selection;
   4.529 -		saveState("setURL (\""+bo->getURL()+"\")","setURL (\""+bo->getHeading()+"\")");	
   4.530 +		saveState("setURL (\""+bo->getURL()+"\")","setURL (\""+bo->getHeading()+"\")",QString("Copy heading of %1 to URL").arg(getName(bo)));	
   4.531  		bo->setURL (bo->getHeading());
   4.532  		updateActions();
   4.533  	}
   4.534 @@ -2267,7 +2306,7 @@
   4.535  	{		
   4.536  		BranchObj *bo=(BranchObj*)selection;
   4.537  		QString url= "https://bugzilla.novell.com/show_bug.cgi?id="+bo->getHeading();
   4.538 -		saveState("setURL (\""+bo->getURL()+"\")","setURL (\""+url+"\")");	
   4.539 +		saveState("setURL (\""+bo->getURL()+"\")","setURL (\""+url+"\")",QString("Use heading of %1 as link to Bugzilla").arg(getName(bo)));	
   4.540  		bo->setURL (url);
   4.541  		updateActions();
   4.542  	}
   4.543 @@ -2280,7 +2319,7 @@
   4.544  	{		
   4.545  		BranchObj *bo=(BranchObj*)selection;
   4.546  		QString url= "http://keeper.suse.de:8080/webfate/match/id?value=ID"+bo->getHeading();
   4.547 -		saveState("setURL (\""+bo->getURL()+"\")","setURL (\""+url+"\")");	
   4.548 +		saveState("setURL (\""+bo->getURL()+"\")","setURL (\""+url+"\")",QString("Use heading of %1 as link to FATE").arg(getName(bo)));	
   4.549  		bo->setURL (url);
   4.550  		updateActions();
   4.551  	}
   4.552 @@ -2302,7 +2341,7 @@
   4.553  		QString fn;
   4.554  		if ( fd->exec() == QDialog::Accepted )
   4.555  		{
   4.556 -			saveState("setVymLink (\""+bo->getVymLink()+"\")","setVymLink (\""+fd->selectedFile()+"\")");	
   4.557 +			saveState("setVymLink (\""+bo->getVymLink()+"\")","setVymLink (\""+fd->selectedFile()+"\")",QString("Set vymlink of %1 to %2").arg(getName(bo)).arg(fd->selectedFile()));	
   4.558  			bo->setVymLink (fd->selectedFile() );
   4.559  			updateActions();
   4.560  			mapCenter->reposition();
   4.561 @@ -2318,7 +2357,7 @@
   4.562  			typeid(*selection) == typeid(MapCenterObj)) )
   4.563  	{		
   4.564  		BranchObj *bo=(BranchObj*)selection;
   4.565 -		saveState("setVymLink (\""+bo->getVymLink()+"\")","setVymLink (\"\")");	
   4.566 +		saveState("setVymLink (\""+bo->getVymLink()+"\")","setVymLink (\"\")",QString("Unset vymlink of %1").arg(getName(bo)));	
   4.567  		bo->setVymLink ("" );
   4.568  		updateActions();
   4.569  		mapCenter->reposition();
   4.570 @@ -2327,23 +2366,6 @@
   4.571  	}
   4.572  }
   4.573  
   4.574 -void MapEditor::setHideExport()
   4.575 -{
   4.576 -	if (selection && (typeid(*selection) == typeid(BranchObj) ||
   4.577 -			typeid(*selection) == typeid(MapCenterObj)) ||
   4.578 -			(typeid(*selection)==typeid(FloatImageObj))
   4.579 -			)
   4.580 -	{		
   4.581 -		saveState();	//TODO undoCommand
   4.582 -		OrnamentedObj *oo=(OrnamentedObj*)selection;
   4.583 -		oo->setHideInExport(actionEditToggleHideExport->isOn());
   4.584 -		updateActions();
   4.585 -		mapCenter->reposition();
   4.586 -		adjustCanvasSize();
   4.587 -		canvas()->update();
   4.588 -	}
   4.589 -}
   4.590 -
   4.591  void MapEditor::toggleHideExport()
   4.592  {
   4.593  	if (selection && (typeid(*selection) == typeid(BranchObj) ||
   4.594 @@ -2351,12 +2373,19 @@
   4.595  			(typeid(*selection)==typeid(FloatImageObj))
   4.596  			)
   4.597  	{		
   4.598 -		saveState();	//TODO undoCommand
   4.599  		OrnamentedObj *oo=(OrnamentedObj*)selection;
   4.600 +		QString s;
   4.601  		if (oo->hideInExport())
   4.602 +		{
   4.603  			oo->setHideInExport(false);
   4.604 +			s="Unset";
   4.605 +		}	
   4.606  		else	
   4.607 +		{
   4.608  			oo->setHideInExport(true);
   4.609 +			s="Set";
   4.610 +		}	
   4.611 +		saveState(QString ("%1 hide export flag of %2").arg(s).arg(getName(selection)));	//TODO undoCommand
   4.612  		actionEditToggleHideExport->setOn (oo->hideInExport());	
   4.613  		updateActions();
   4.614  		mapCenter->reposition();
   4.615 @@ -2376,16 +2405,17 @@
   4.616  	
   4.617  }
   4.618  
   4.619 -void MapEditor::removeBranchHere()
   4.620 +void MapEditor::removeBranchKeepChilds()
   4.621  {
   4.622  	if (selection && (typeid(*selection) == typeid(BranchObj) ))
   4.623  	{		
   4.624  		BranchObj* bo=(BranchObj*)selection;
   4.625  		BranchObj* par=(BranchObj*)(bo->getParObj());
   4.626 +		QString s=QString("Remove %1 and keep its childs").arg(getName(bo));
   4.627  		if (bo->getDepth()==1)
   4.628 -			saveState();
   4.629 +			saveState(s);
   4.630  		else	
   4.631 -			saveState(selection->getParObj());	// TODO undoCommand
   4.632 +			saveState(selection->getParObj(),s);	// TODO undoCommand
   4.633  		QString sel=selection->getSelectString();
   4.634  		unselect();
   4.635  		par->removeBranchHere(bo);
   4.636 @@ -2398,7 +2428,7 @@
   4.637  {
   4.638  	if (selection && (typeid(*selection) == typeid(BranchObj) ))
   4.639  	{		
   4.640 -		saveState(selection->getParObj());
   4.641 +		saveState(selection->getParObj(), QString("Remove childs of branch").arg(getName(selection)));
   4.642  		((BranchObj*)selection)->removeChilds();
   4.643  		mapCenter->reposition();
   4.644  	}	
   4.645 @@ -2442,7 +2472,7 @@
   4.646  	// Finally show dialog
   4.647  	if (dia.exec() == QDialog::Accepted)
   4.648  	{
   4.649 -		saveState();	//TODO undoCommand
   4.650 +		saveState("Edit info about map");	//TODO undoCommand
   4.651  		mapCenter->setAuthor (dia.getAuthor() );
   4.652  		mapCenter->setComment (dia.getComment() );
   4.653  	}
   4.654 @@ -2627,7 +2657,7 @@
   4.655  {
   4.656  	linkstyle=ls;
   4.657  
   4.658 -	saveState();	// TODO undoCommand
   4.659 +	saveState("Set link style");	// TODO undoCommand
   4.660  	BranchObj *bo;
   4.661  	bo=mapCenter->first();
   4.662  	bo=bo->next();
   4.663 @@ -2716,12 +2746,12 @@
   4.664  void MapEditor::selectLinkColor()
   4.665  {
   4.666  	// Finish open lineEdits
   4.667 -	if (lineedit) finishedLineEditNoSave();
   4.668 +	if (lineedit) finishedLineEdit();
   4.669  
   4.670  	QColor col = QColorDialog::getColor( defLinkColor, this );
   4.671  	if ( !col.isValid() ) return;
   4.672  	setLinkColor( col );
   4.673 -	saveState();	//TODO undoCommand
   4.674 +	saveState(QString("Set link color to %1").arg(col.name()));	//TODO undoCommand
   4.675  
   4.676  }
   4.677  
   4.678 @@ -2732,7 +2762,12 @@
   4.679  		BranchObj *bo=((BranchObj*)selection);
   4.680  		if (bo->countBranches()==0) return;
   4.681  		if (bo->getDepth()==0) return;
   4.682 -		saveState(selection);
   4.683 +		QString s;
   4.684 +		if (bo->isScrolled())
   4.685 +			s="Unscroll";
   4.686 +		else	
   4.687 +			s="Scroll";
   4.688 +		saveState(selection, QString ("%1 %2").arg(s).arg(getName(bo)));
   4.689  		bo->toggleScroll();
   4.690  		adjustCanvasSize();
   4.691  		canvas()->update();
   4.692 @@ -2772,7 +2807,7 @@
   4.693  		QString fn;
   4.694  		if ( fd->exec() == QDialog::Accepted )
   4.695  		{
   4.696 -			saveState(selection);
   4.697 +			saveState(selection, QString("Add floatimage to %1").arg(getName(selection)));
   4.698  			lastImageDir=fn.left(fn.findRev ("/"));
   4.699  			QStringList flist = fd->selectedFiles();
   4.700  			QStringList::Iterator it = flist.begin();
   4.701 @@ -3002,7 +3037,7 @@
   4.702  				}
   4.703  				if (dia.deleteXLink())
   4.704  					((BranchObj*)selection)->deleteXLinkAt(i);
   4.705 -				saveState();	//TODO undoCommand
   4.706 +				saveState("Edit xLink");	//TODO undoCommand
   4.707  			}
   4.708  		}	
   4.709  	}
   4.710 @@ -3108,7 +3143,7 @@
   4.711  void MapEditor::contentsMousePressEvent(QMouseEvent* e)
   4.712  {
   4.713  	// Finish open lineEdits
   4.714 -	if (lineedit) finishedLineEditNoSave();
   4.715 +	if (lineedit) finishedLineEdit();
   4.716  	
   4.717      QPoint p = inverseWorldMatrix().map(e->pos());
   4.718      LinkableMapObj* lmo=mapCenter->findMapObj(p, NULL);
   4.719 @@ -3253,7 +3288,9 @@
   4.720  		if (typeid(*selection) == typeid(FloatImageObj))
   4.721  		{
   4.722  			FloatObj *fo=(FloatObj*)selection;
   4.723 -			saveState("move "+qpointToString(movingObj_orgPos),fo->getSelectString() );
   4.724 +			saveState(
   4.725 +				"move "+qpointToString(movingObj_orgPos),fo->getSelectString() ,
   4.726 +				QString("Move %1").arg(getName(selection)));
   4.727  			fo->move   (p.x() -movingObj_start.x(), p.y()-movingObj_start.y() );		
   4.728  			fo->setRelPos();
   4.729  			fo->reposition();
   4.730 @@ -3268,7 +3305,7 @@
   4.731  			{
   4.732  				if (typeid(*fo) == typeid(FloatImageObj)) 
   4.733  				{
   4.734 -					saveState();
   4.735 +					saveState(QString("Relink %1 to %2").arg(getName(fo)).arg(getName(lmo) ) );
   4.736  					FloatImageObj *fio=(FloatImageObj*)(fo);
   4.737  					((BranchObj*)(lmo))->addFloatImage (fio);
   4.738  					fio->unselect();
   4.739 @@ -3402,7 +3439,7 @@
   4.740  			tmpXLink->setEnd ( ((BranchObj*)(dst)) );
   4.741  			tmpXLink->updateXLink();
   4.742  			tmpXLink->activate();
   4.743 -			saveState();	//TODO undoCommand
   4.744 +			saveState(QString("Activate xLink from %1 to %2").arg(getName(tmpXLink->getBegin())).arg(getName(tmpXLink->getEnd())) );	//TODO undoCommand
   4.745  		} else
   4.746  		{
   4.747  			delete(tmpXLink);
   4.748 @@ -3468,11 +3505,11 @@
   4.749  					if (dst->getDepth()==0) 
   4.750  						bs->move (savePos);
   4.751  				} 
   4.752 -				saveState (undoCom,bs->getSelectString() );
   4.753 +				saveState (undoCom,bs->getSelectString(),QString("Relink %1 to %2").arg(getName(bs)).arg(getName(dst)) );
   4.754  			} else
   4.755  				if (selection->getDepth()==1)
   4.756  					// If we have moved mainbranch only save endposition
   4.757 -					saveState("move "+qpointToString(movingObj_orgPos), selection->getSelectString() );
   4.758 +					saveState("move "+qpointToString(movingObj_orgPos), selection->getSelectString(), QString("Move %1 to %2").arg(getName(selection)).arg(qpointToString(movingObj_orgPos)));
   4.759  			
   4.760  			// Draw the original link, before selection was moved around
   4.761  			mapCenter->reposition();
   4.762 @@ -3490,7 +3527,7 @@
   4.763  void MapEditor::contentsMouseDoubleClickEvent(QMouseEvent* e)
   4.764  {
   4.765  	// Finish open lineEdits
   4.766 -	if (lineedit) finishedLineEditNoSave();
   4.767 +	if (lineedit) finishedLineEdit();
   4.768  	
   4.769  	if (e->button() == QMouseEvent::LeftButton )
   4.770  	{
   4.771 @@ -3501,7 +3538,6 @@
   4.772  			if (selection) selection->unselect();
   4.773  			selection=lmo;
   4.774  			selection->select();
   4.775 -			saveState(selection);
   4.776  			editHeading();
   4.777  		}
   4.778  	}
   4.779 @@ -3670,7 +3706,8 @@
   4.780  
   4.781  		if (update) 
   4.782  		{
   4.783 -			saveState();	//TODO undo Command
   4.784 +			//FIXME saveState has to be called earlier for each of the drops...
   4.785 +			saveState("Drop Event");	//TODO undo Command
   4.786  			mapCenter->reposition();
   4.787  			adjustCanvasSize();
   4.788  			canvas()->update();
   4.789 @@ -3685,7 +3722,7 @@
   4.790        (typeid(*selection) == typeid(MapCenterObj))  )
   4.791    {
   4.792      BranchObj *bo=((BranchObj*)selection);
   4.793 -    saveState(selection);
   4.794 +    saveState(selection,QString("Add floatimage to %1").arg(getName(bo)));
   4.795      //QString fn=fd->selectedFile();
   4.796      //lastImageDir=fn.left(fn.findRev ("/"));
   4.797      bo->addFloatImage();