Runs basically on Mac now. Undo debug output still enabled qt4-port
authorinsilmaril
Tue, 29 Aug 2006 08:31:42 +0000
branchqt4-port
changeset 1641c3d7f9f532
parent 15 699f28529079
child 17 557239819c45
Runs basically on Mac now. Undo debug output still enabled
aboutdialog.cpp
exportoofiledialog.cpp
exports.cpp
exportxhtmldialog.ui.h
main.cpp
mainwindow.cpp
mainwindow.h
mapeditor.cpp
mapeditor.h
ornamentedobj.cpp
ornamentedobj.h
selection.cpp
selection.h
settings.cpp
settings.h
version.h
     1.1 --- a/aboutdialog.cpp	Tue Aug 15 12:01:14 2006 +0000
     1.2 +++ b/aboutdialog.cpp	Tue Aug 29 08:31:42 2006 +0000
     1.3 @@ -190,6 +190,6 @@
     1.4  void AboutTextBrowser::setSource(const QUrl &url )
     1.5  {
     1.6  	QProcess *proc= new QProcess ();
     1.7 -	proc->start( settings.value("/vym/mainwindow/readerURL").toString(),QStringList ()<<url.toString());
     1.8 +	proc->start( settings.value("/mainwindow/readerURL").toString(),QStringList ()<<url.toString());
     1.9  	if (!proc->waitForStarted() &&mainWindow->settingsURL() ) setSource(url);
    1.10  }
     2.1 --- a/exportoofiledialog.cpp	Tue Aug 15 12:01:14 2006 +0000
     2.2 +++ b/exportoofiledialog.cpp	Tue Aug 29 08:31:42 2006 +0000
     2.3 @@ -90,7 +90,7 @@
     2.4  				configPaths.append (fi.absFilePath());
     2.5  				set.clear();
     2.6  				set.readSettings (fi.absFilePath());
     2.7 -				addFilter (set.readEntry("Name") + " (*.odp)");
     2.8 +				addFilter (set.readEntry(QString("Name")) + " (*.odp)");
     2.9  			}		
    2.10          }
    2.11  	}		
     3.1 --- a/exports.cpp	Tue Aug 15 12:01:14 2006 +0000
     3.2 +++ b/exports.cpp	Tue Aug 29 08:31:42 2006 +0000
     3.3 @@ -129,8 +129,7 @@
     3.4  	// Main loop over all branches
     3.5  	QString s;
     3.6  	QString actIndent("");
     3.7 -	int i;
     3.8 -	uint j;
     3.9 +	int i,j;
    3.10  	BranchObj *bo;
    3.11  	bo=mapCenter->first();
    3.12  	while (bo) 
     4.1 --- a/exportxhtmldialog.ui.h	Tue Aug 15 12:01:14 2006 +0000
     4.2 +++ b/exportxhtmldialog.ui.h	Tue Aug 29 08:31:42 2006 +0000
     4.3 @@ -25,42 +25,42 @@
     4.4  void ExportXHTMLDialog::readSettings()
     4.5  {
     4.6  
     4.7 -	dir=settings.readLocalEntry (filepath,"/vym/export/xhtml/exportDir",vymBaseDir.currentDirPath() );
     4.8 +	dir=settings.readLocalEntry (filepath,"/export/xhtml/exportDir",vymBaseDir.currentDirPath() );
     4.9  	lineEditDir->setText(dir);
    4.10  	
    4.11 -    if ( settings.readLocalEntry (filepath,"/vym/export/xhtml/useImage","yes")=="yes")
    4.12 +    if ( settings.readLocalEntry (filepath,"/export/xhtml/useImage","yes")=="yes")
    4.13  		useImage=true;
    4.14  	else	
    4.15  		useImage=false;
    4.16  	imageButton->setChecked(useImage);
    4.17  		
    4.18 -	if ( settings.readLocalEntry (filepath,"/vym/export/xhtml/useTextColor","no")=="yes")
    4.19 +	if ( settings.readLocalEntry (filepath,"/export/xhtml/useTextColor","no")=="yes")
    4.20  		useTextColor=true;
    4.21  	else	
    4.22  		useTextColor=false;
    4.23  	textColorButton->setChecked(useTextColor);
    4.24  	
    4.25  /* FIXME this was used in old html export, is not yet in new stylesheet
    4.26 -	if ( settings.readEntry ("/vym/export/html/useHeading","no")=="yes")
    4.27 +	if ( settings.readEntry ("/export/html/useHeading","no")=="yes")
    4.28  		useHeading=true;
    4.29  	else	
    4.30  		useHeading=false;
    4.31  	checkBox4_2->setChecked(useHeading);
    4.32  */		
    4.33  
    4.34 -	if ( settings.readLocalEntry (filepath,"/vym/export/xhtml/saveSettingsInMap","no")=="yes")
    4.35 +	if ( settings.readLocalEntry (filepath,"/export/xhtml/saveSettingsInMap","no")=="yes")
    4.36  		saveSettingsInMap=true;
    4.37  	else	
    4.38  		saveSettingsInMap=false;
    4.39  	saveSettingsInMapButton->setChecked(saveSettingsInMap);
    4.40  
    4.41 -	if ( settings.readEntry ("/vym/export/xhtml/showWarnings","yes")=="yes")
    4.42 +	if ( settings.readEntry ("/export/xhtml/showWarnings","yes")=="yes")
    4.43  		showWarnings=true;
    4.44  	else	
    4.45  		showWarnings=false;
    4.46  	warningsButton->setChecked(showWarnings);
    4.47  	
    4.48 -	if ( settings.readEntry ("/vym/export/xhtml/showOutput","no")=="yes")
    4.49 +	if ( settings.readEntry ("/export/xhtml/showOutput","no")=="yes")
    4.50  		showOutput=true;
    4.51  	else	
    4.52  		showOutput=false;
    4.53 @@ -74,19 +74,19 @@
    4.54  	} else
    4.55  	{
    4.56  		xsl=settings.readLocalEntry 
    4.57 -			(filepath,"/vym/export/xhtml/xsl","/usr/share/vym/styles/vym2xhtml.xsl");
    4.58 +			(filepath,"/export/xhtml/xsl","/usr/share/vym/styles/vym2xhtml.xsl");
    4.59  		css=settings.readLocalEntry 
    4.60 -			(filepath,"/vym/export/xhtml/css","/usr/share/vym/styles/vym.css");	
    4.61 +			(filepath,"/export/xhtml/css","/usr/share/vym/styles/vym.css");	
    4.62  	}
    4.63  	lineEditXSL->setText(xsl);
    4.64  	lineEditCSS->setText(css);
    4.65  	
    4.66  	prescript=settings.readLocalEntry
    4.67 -		(filepath,"/vym/export/xhtml/prescript","");
    4.68 +		(filepath,"/export/xhtml/prescript","");
    4.69  	lineEditPreScript->setText (prescript);	
    4.70  	
    4.71  	postscript=settings.readLocalEntry
    4.72 -		(filepath,"/vym/export/xhtml/postscript","");
    4.73 +		(filepath,"/export/xhtml/postscript","");
    4.74  	lineEditPostScript->setText (postscript);	
    4.75  
    4.76  	if (!prescript.isEmpty() || !postscript.isEmpty())
    4.77 @@ -251,38 +251,38 @@
    4.78  	// Save options to settings file 
    4.79  	// (but don't save at destructor, which
    4.80  	// is called for "cancel", too)
    4.81 -	settings.setLocalEntry (filepath,"/vym/export/xhtml/exportDir",dir);
    4.82 -	settings.setLocalEntry (filepath,"/vym/export/xhtml/prescript",prescript);
    4.83 -	settings.setLocalEntry (filepath,"/vym/export/xhtml/postscript",postscript);
    4.84 +	settings.setLocalEntry (filepath,"/export/xhtml/exportDir",dir);
    4.85 +	settings.setLocalEntry (filepath,"/export/xhtml/prescript",prescript);
    4.86 +	settings.setLocalEntry (filepath,"/export/xhtml/postscript",postscript);
    4.87  
    4.88      if (useImage)
    4.89 -		settings.setLocalEntry (filepath,"/vym/export/xhtml/useImage","yes");
    4.90 +		settings.setLocalEntry (filepath,"/export/xhtml/useImage","yes");
    4.91      else
    4.92 -		settings.setLocalEntry (filepath,"/vym/export/xhtml/useImage","no");	
    4.93 +		settings.setLocalEntry (filepath,"/export/xhtml/useImage","no");	
    4.94  	
    4.95    if (useTextColor)
    4.96 -		settings.setLocalEntry (filepath,"/vym/export/xhtml/useTextColor","yes");
    4.97 +		settings.setLocalEntry (filepath,"/export/xhtml/useTextColor","yes");
    4.98      else
    4.99 -		settings.setLocalEntry (filepath,"/vym/export/xhtml/useTextColor","no");	
   4.100 +		settings.setLocalEntry (filepath,"/export/xhtml/useTextColor","no");	
   4.101  	
   4.102     if (showWarnings)
   4.103 -		settings.writeEntry ("/vym/export/xhtml/showWarnings","yes");
   4.104 +		settings.writeEntry ("/export/xhtml/showWarnings","yes");
   4.105      else
   4.106 -		settings.writeEntry ("/vym/export/xhtml/showWarnings","no");	
   4.107 +		settings.writeEntry ("/export/xhtml/showWarnings","no");	
   4.108  			
   4.109  	if (showOutput)
   4.110 -		settings.writeEntry ("/vym/export/xhtml/showOutput","yes");
   4.111 +		settings.writeEntry ("/export/xhtml/showOutput","yes");
   4.112  	else
   4.113 -		settings.writeEntry ("/vym/export/xhtml/showOutput","no");	
   4.114 +		settings.writeEntry ("/export/xhtml/showOutput","no");	
   4.115  
   4.116  	QString ipath;	
   4.117  	ipath=vymBaseDir.path()+"/flags/flag-url-16x16.png";
   4.118  	if (!options.isOn ("local"))
   4.119  	{
   4.120  		settings.setLocalEntry 
   4.121 -			(filepath,"/vym/export/xhtml/xsl",xsl);
   4.122 +			(filepath,"/export/xhtml/xsl",xsl);
   4.123  		settings.setLocalEntry 
   4.124 -			(filepath,"/vym/export/xhtml/css",css);	
   4.125 +			(filepath,"/export/xhtml/css",css);	
   4.126  	}
   4.127  
   4.128  	// Provide a smaller URL-icon to improve Layout
   4.129 @@ -294,10 +294,10 @@
   4.130  	if(!pm.save (dir + "flags/flag-url-16x16.png","PNG"))
   4.131  		QMessageBox::warning( 0, tr( "Warning" ),tr("Could not write %1").arg(ipath));
   4.132  	if (!saveSettingsInMap)
   4.133 -		settings.clearLocal("/vym/export/xhtml");
   4.134 +		settings.clearLocal("/export/xhtml");
   4.135  	else	
   4.136  		settings.setLocalEntry 
   4.137 -			(filepath,"/vym/export/xhtml/saveSettingsInMap","yes");
   4.138 +			(filepath,"/export/xhtml/saveSettingsInMap","yes");
   4.139  
   4.140  	// Copy CSS file
   4.141  	QFile css_src (css);
     5.1 --- a/main.cpp	Tue Aug 15 12:01:14 2006 +0000
     5.2 +++ b/main.cpp	Tue Aug 29 08:31:42 2006 +0000
     5.3 @@ -46,6 +46,7 @@
     5.4  QAction *actionEditToggleScroll;
     5.5  QAction *actionEditOpenURL;
     5.6  QAction *actionEditOpenURLTab;
     5.7 +QAction *actionEditOpenMultipleURLTabs;
     5.8  QAction *actionEditURL;
     5.9  QAction *actionEditHeading2URL;
    5.10  QAction *actionEditBugzilla2URL;
    5.11 @@ -120,7 +121,8 @@
    5.12  QMenu* fileExportMenu;
    5.13  
    5.14  
    5.15 -Settings settings ("vym","vym"); // Organization, Application name
    5.16 +Settings settings ("InSilmaril","vym"); // Organization, Application name
    5.17 +
    5.18  Options options;
    5.19  ImageIO imageIO;
    5.20  
     6.1 --- a/mainwindow.cpp	Tue Aug 15 12:01:14 2006 +0000
     6.2 +++ b/mainwindow.cpp	Tue Aug 29 08:31:42 2006 +0000
     6.3 @@ -63,6 +63,7 @@
     6.4  extern QAction *actionEditToggleScroll;
     6.5  extern QAction* actionEditOpenURL;
     6.6  extern QAction* actionEditOpenURLTab;
     6.7 +extern QAction* actionEditOpenMultipleURLTabs;
     6.8  extern QAction* actionEditURL;
     6.9  extern QAction* actionEditHeading2URL;
    6.10  extern QAction* actionEditBugzilla2URL;
    6.11 @@ -214,6 +215,9 @@
    6.12  	connect( tabWidget, SIGNAL( currentChanged( QWidget * ) ), 
    6.13  		this, SLOT( editorChanged( QWidget * ) ) );
    6.14  
    6.15 +	lineedit=new QLineEdit (this);
    6.16 +	lineedit->hide();
    6.17 +
    6.18  	setCentralWidget(tabWidget);	
    6.19  
    6.20      setupFileActions();
    6.21 @@ -459,14 +463,13 @@
    6.22  	editMenu->addAction (a);
    6.23  	actionEditUndo=a;
    6.24      
    6.25 -    if (settings.value( "/mainwindow/showTestMenu",false).toBool()) 
    6.26 -	{
    6.27 -		a = new QAction( QPixmap( iconPath+"redo.png"), tr( "&Redo" ), this); 
    6.28 -		a->setStatusTip (tr( "Redo" ));
    6.29 -		a->setShortcut (Qt::CTRL + Qt::Key_Y );
    6.30 -		editMenu->addAction (a);
    6.31 -		connect( a, SIGNAL( triggered() ), this, SLOT( editRedo() ) );
    6.32 -	}
    6.33 +	a = new QAction( QPixmap( iconPath+"redo.png"), tr( "&Redo" ), this); 
    6.34 +	a->setStatusTip (tr( "Redo" ));
    6.35 +	a->setShortcut (Qt::CTRL + Qt::Key_Y );
    6.36 +    tb->addAction (a);
    6.37 +	editMenu->addAction (a);
    6.38 +	connect( a, SIGNAL( triggered() ), this, SLOT( editRedo() ) );
    6.39 +	actionEditRedo=a;
    6.40     
    6.41  	editMenu->addSeparator();
    6.42      a = new QAction(QPixmap( iconPath+"editcopy.png"), tr( "&Copy" ), this);
    6.43 @@ -500,14 +503,14 @@
    6.44      a = new QAction(tr( "Edit heading" ),this);
    6.45  	a->setStatusTip ( tr( "edit Heading" ));
    6.46  	a->setShortcut ( Qt::Key_Enter);
    6.47 -	a->setShortcutContext (Qt::WindowShortcut);
    6.48 +//	a->setShortcutContext (Qt::WindowShortcut);
    6.49  	addAction (a);
    6.50      connect( a, SIGNAL( triggered() ), this, SLOT( editHeading() ) );
    6.51  	actionListBranches.append(a);
    6.52      a = new QAction( tr( "Edit heading" ), this);
    6.53  	a->setStatusTip (tr( "edit Heading" ));
    6.54  	a->setShortcut (Qt::Key_Return );
    6.55 -	a->setShortcutContext (Qt::WindowShortcut);
    6.56 +	//a->setShortcutContext (Qt::WindowShortcut);
    6.57  	addAction (a);
    6.58      connect( a, SIGNAL( triggered() ), this, SLOT( editHeading() ) );
    6.59  	actionListBranches.append(a);
    6.60 @@ -675,6 +678,13 @@
    6.61      connect( a, SIGNAL( triggered() ), this, SLOT( editOpenURLTab() ) );
    6.62  	actionEditOpenURLTab=a;
    6.63  
    6.64 +	a = new QAction( tr( "Open all URLs in subtree" ), this);
    6.65 +	a->setStatusTip (tr( "Open all URLs in subtree" ));
    6.66 +	a->setShortcut (Qt::CTRL+Qt::Key_U );
    6.67 +	addAction(a);
    6.68 +    connect( a, SIGNAL( triggered() ), this, SLOT( editOpenMultipleURLTabs() ) );
    6.69 +	actionEditOpenMultipleURLTabs=a;
    6.70 +
    6.71  	a = new QAction(QPixmap(), tr( "Edit URL"+QString("...") ), this);
    6.72  	a->setStatusTip ( tr( "Edit URL" ) );
    6.73  	a->setShortcut (Qt::SHIFT + Qt::CTRL + Qt::Key_U );
    6.74 @@ -1503,7 +1513,6 @@
    6.75  		branchAddContextMenu->addSeparator();	
    6.76  		branchAddContextMenu->addAction ( actionEditLoadImage);
    6.77  		branchAddContextMenu->addSeparator();	
    6.78 -		branchAddContextMenu->addAction ( actionEditLoadImage);
    6.79  		branchAddContextMenu->addAction ( actionEditImportAdd );
    6.80  		branchAddContextMenu->addAction ( actionEditImportReplace );
    6.81  
    6.82 @@ -1520,10 +1529,11 @@
    6.83  	branchContextMenu->addSeparator();	
    6.84  	branchContextMenu->addAction ( actionEditOpenURL );
    6.85  	branchContextMenu->addAction ( actionEditOpenURLTab );
    6.86 +	branchContextMenu->addAction ( actionEditOpenMultipleURLTabs );
    6.87  	branchContextMenu->addAction ( actionEditURL );
    6.88  	branchContextMenu->addAction ( actionEditHeading2URL );
    6.89  	branchContextMenu->addAction ( actionEditBugzilla2URL );
    6.90 -    if (settings.value( "/mainwindow/showTestMenu",false).toBool() )
    6.91 +    if (settings.value( "/mainwindow/showTestMenu",true).toBool() )
    6.92  	{
    6.93  		branchContextMenu->addAction ( actionEditFATE2URL );
    6.94  	}	
    6.95 @@ -2433,6 +2443,7 @@
    6.96  				QMessageBox::Cancel | QMessageBox::Escape );
    6.97  			mb.setButtonText( QMessageBox::Yes, tr("Save map") );
    6.98  			mb.setButtonText( QMessageBox::No, tr("Discard changes") );
    6.99 +			mb.setModal (true);
   6.100  			mb.show();
   6.101  			mb.setActiveWindow();
   6.102  			switch( mb.exec() ) {
   6.103 @@ -2508,20 +2519,86 @@
   6.104  	currentMapEditor()->findReset();
   6.105  }
   6.106  
   6.107 +void Main::openTabs(QStringList urls)
   6.108 +{
   6.109 +	if (!urls.isEmpty())
   6.110 +	{	
   6.111 +		bool success=true;
   6.112 +		QStringList args;
   6.113 +		QString browser=settings.value("/mainwindow/readerURL" ).toString();
   6.114 +		QProcess *p;
   6.115 +		if (!procBrowser ||  procBrowser->state()!=QProcess::Running)
   6.116 +		{
   6.117 +			QString u=urls.takeFirst();
   6.118 +			procBrowser = new QProcess( this );
   6.119 +			args<<u;
   6.120 +			procBrowser->start(browser,args);
   6.121 +			if ( !procBrowser->waitForStarted())
   6.122 +			{
   6.123 +				// try to set path to browser
   6.124 +				QMessageBox::warning(0, 
   6.125 +					tr("Warning"),
   6.126 +					tr("Couldn't find a viewer to open %1.\n").arg(u)+
   6.127 +					tr("Please use Settings->")+tr("Set application to open an URL"));
   6.128 +				return;
   6.129 +			}
   6.130 +			sleep (3);
   6.131 +		}
   6.132 +		if (browser.contains("konqueror"))
   6.133 +		{
   6.134 +			for (int i=0; i<urls.size(); i++)
   6.135 +			{
   6.136 +				// Open new browser
   6.137 +				// Try to open new tab in existing konqueror started previously by vym
   6.138 +				p=new QProcess (this);
   6.139 +				args.clear();
   6.140 +				args<< QString("konqueror-%1").arg(procBrowser->pid())<< 
   6.141 +					"konqueror-mainwindow#1"<< 
   6.142 +					"newTab" << 
   6.143 +					urls.at(i);
   6.144 +				p->start ("dcop",args);
   6.145 +				if ( !p->waitForStarted() ) success=false;
   6.146 +			}
   6.147 +			if (!success)
   6.148 +				QMessageBox::warning(0, 
   6.149 +					tr("Warning"),
   6.150 +					tr("Couldn't start %1 to open a new tab in %2.").arg("dcop").arg("konqueror"));
   6.151 +			return;		
   6.152 +		} else if (browser.contains ("firefox") || browser.contains ("mozilla") )
   6.153 +		{
   6.154 +			for (int i=0; i<urls.size(); i++)
   6.155 +			{
   6.156 +				// Try to open new tab in firefox
   6.157 +				p=new QProcess (this);
   6.158 +				args<< "-remote"<< QString("openurl(%1,new-tab)").arg(urls.at(i));
   6.159 +				p->start (browser,args);
   6.160 +				if ( !p->waitForStarted() ) success=false;
   6.161 +			}			
   6.162 +			if (!success)
   6.163 +				QMessageBox::warning(0, 
   6.164 +					tr("Warning"),
   6.165 +					tr("Couldn't start %1 to open a new tab").arg(browser));
   6.166 +			return;		
   6.167 +		}			
   6.168 +		QMessageBox::warning(0, 
   6.169 +			tr("Warning"),
   6.170 +			tr("Sorry, currently only Konqueror and Mozilla support tabbed browsing."));
   6.171 +	}	
   6.172 +}
   6.173 +
   6.174  void Main::editOpenURL()
   6.175  {
   6.176  	// Open new browser
   6.177  	if (currentMapEditor())
   6.178  	{	
   6.179  	    QString url=currentMapEditor()->getURL();
   6.180 +		QStringList args;
   6.181  		if (url=="") return;
   6.182  		QString browser=settings.value("/mainwindow/readerURL" ).toString();
   6.183 -		procBrowser = new Q3Process( this );
   6.184 -
   6.185 -		procBrowser->addArgument( browser);
   6.186 -		procBrowser->addArgument( url);
   6.187 -
   6.188 -		if ( !procBrowser->start() ) 
   6.189 +		procBrowser = new QProcess( this );
   6.190 +		args<<url;
   6.191 +		procBrowser->start(browser,args);
   6.192 +		if ( !procBrowser->waitForStarted())
   6.193  		{
   6.194  			// try to set path to browser
   6.195  			QMessageBox::warning(0, 
   6.196 @@ -2536,45 +2613,24 @@
   6.197  {
   6.198  	if (currentMapEditor())
   6.199  	{	
   6.200 -	    QString url=currentMapEditor()->getURL();
   6.201 -		if (url=="") return;
   6.202 -		QString browser=settings.value("/mainwindow/readerURL" ).toString();
   6.203 -		if (procBrowser && procBrowser->isRunning())
   6.204 -		{
   6.205 -			if (browser.contains("konqueror"))
   6.206 -			{
   6.207 -				// Try to open new tab in existing konqueror started previously by vym
   6.208 -				Q3Process *p=new Q3Process (this);
   6.209 -				p->addArgument ("dcop");
   6.210 -				p->addArgument (QString("konqueror-%1").arg(procBrowser->processIdentifier()));
   6.211 -				p->addArgument ("konqueror-mainwindow#1");
   6.212 -				p->addArgument ("newTab");
   6.213 -				p->addArgument (url);
   6.214 -				if ( !p->start() ) 
   6.215 -					// try to set browser
   6.216 -					QMessageBox::warning(0, 
   6.217 -						tr("Warning"),
   6.218 -						tr("Couldn't start %1 to open a new tab in %2.").arg("dcop").arg("konqueror"));
   6.219 -				return;		
   6.220 -			} else if (browser.contains ("firefox") || browser.contains ("mozilla") )
   6.221 -			{
   6.222 -				// Try to open new tab in firefox
   6.223 -				Q3Process *p=new Q3Process (this);
   6.224 -				p->addArgument (browser);
   6.225 -				p->addArgument ("-remote");
   6.226 -				p->addArgument (QString("openurl(%1,new-tab)").arg(url));
   6.227 -				if ( !p->start() ) 
   6.228 -					// try to set browser
   6.229 -					QMessageBox::warning(0, 
   6.230 -						tr("Warning"),
   6.231 -						tr("Couldn't start %1 to open a new tab").arg(browser));
   6.232 -				return;		
   6.233 -			}
   6.234 -		}
   6.235 -		// Open new browser
   6.236 -		editOpenURL();
   6.237 +	    QStringList urls;
   6.238 +		urls.append(currentMapEditor()->getURL());
   6.239 +		openTabs (urls);
   6.240  	}	
   6.241  }
   6.242 +void Main::editOpenMultipleURLTabs()
   6.243 +{
   6.244 +	if (currentMapEditor())
   6.245 +	{	
   6.246 +	    QStringList urls;
   6.247 +		urls.append ("www.suse.de");
   6.248 +		urls.append ("www.google.de");
   6.249 +		urls.append ("www.heise.de");
   6.250 +		urls.append ("www.insilmaril.de");
   6.251 +		openTabs (urls);
   6.252 +	}	
   6.253 +}
   6.254 +
   6.255  
   6.256  void Main::editURL()
   6.257  {
   6.258 @@ -2600,6 +2656,54 @@
   6.259  	    currentMapEditor()->editFATE2URL();
   6.260  }
   6.261  
   6.262 +void Main::editHeading()
   6.263 +{
   6.264 +	if (lineedit->isVisible())
   6.265 +	{
   6.266 +		if (currentMapEditor())
   6.267 +			currentMapEditor()->setHeading(lineedit->text());
   6.268 +		lineedit->releaseKeyboard();
   6.269 +		lineedit->hide();
   6.270 +		setFocus();
   6.271 +	} else
   6.272 +	{
   6.273 +		if (currentMapEditor())
   6.274 +		{
   6.275 +			bool ok;
   6.276 +			QPoint p;
   6.277 +			QString s=currentMapEditor()->getHeading(ok,p);
   6.278 +
   6.279 +			if (ok)
   6.280 +			{
   6.281 +#if defined(Q_OS_MACX)
   6.282 +				p = currentMapEditor()->mapToGlobal( currentMapEditor()->worldMatrix().map( p));
   6.283 +				QDialog *d =new QDialog(NULL);
   6.284 +				QLineEdit *le=new QLineEdit (d);
   6.285 +				d->setWindowFlags (Qt::FramelessWindowHint);
   6.286 +				d->setGeometry(p.x(),p.y(),200,25);
   6.287 +				le->resize (d->size());
   6.288 +				le->setText (s);
   6.289 +				le->selectAll();
   6.290 +				connect (le, SIGNAL (returnPressed()), d, SLOT (accept()));
   6.291 +				d->activateWindow();
   6.292 +				d->exec();
   6.293 +				currentMapEditor()->setHeading (le->text());
   6.294 +#else
   6.295 +				p = currentMapEditor()->mapTo(this, currentMapEditor()->worldMatrix().map( p));
   6.296 +				lineedit->setGeometry(p.x(),p.y(),200,25);
   6.297 +				lineedit->setText(s);
   6.298 +				lineedit->setCursorPosition(1);
   6.299 +				lineedit->selectAll();
   6.300 +				lineedit->show();
   6.301 +				lineedit->grabKeyboard();
   6.302 +				lineedit->setFocus();
   6.303 +#endif
   6.304 +
   6.305 +			}
   6.306 +		}
   6.307 +	}
   6.308 +}
   6.309 +
   6.310  void Main::editOpenVymLink()
   6.311  {
   6.312  	// Get current path to map
   6.313 @@ -2689,15 +2793,10 @@
   6.314  	}	
   6.315  }
   6.316  
   6.317 -void Main::editHeading()
   6.318 -{
   6.319 -	if (currentMapEditor())
   6.320 -		currentMapEditor()->editHeading();
   6.321 -}
   6.322 -
   6.323  void Main::editNewBranch()
   6.324  {
   6.325 -	if (currentMapEditor())
   6.326 +
   6.327 +	if (!lineedit->isVisible() && currentMapEditor())
   6.328  		currentMapEditor()->addNewBranch(0);
   6.329  }
   6.330  
     7.1 --- a/mainwindow.h	Tue Aug 15 12:01:14 2006 +0000
     7.2 +++ b/mainwindow.h	Tue Aug 29 08:31:42 2006 +0000
     7.3 @@ -1,17 +1,12 @@
     7.4  #ifndef MAINWINDOW_H 
     7.5  #define MAINWINDOW_H
     7.6  
     7.7 -#include <q3popupmenu.h>
     7.8 -#include <q3textedit.h>
     7.9 -#include <q3intdict.h>
    7.10 -#include <q3canvas.h>
    7.11 -#include <qlineedit.h>
    7.12  #include <QAction>
    7.13 +#include <QCursor>
    7.14  #include <QMainWindow>
    7.15 +#include <QProcess>
    7.16  #include <QToolBar>
    7.17 -#include <qcursor.h>
    7.18 -#include <qtabwidget.h>
    7.19 -#include <qmap.h>
    7.20 +#include <QTabWidget>
    7.21  //Added by qt3to4:
    7.22  #include <QCloseEvent>
    7.23  #include <QShowEvent>
    7.24 @@ -94,16 +89,20 @@
    7.25      void editOpenFindWindow();
    7.26  	void editFind(QString);
    7.27  	void editFindChanged();
    7.28 +private:
    7.29 +	void openTabs(QStringList);
    7.30  public slots:
    7.31  	void editOpenURL();
    7.32  	void editOpenURLTab();
    7.33  private slots:
    7.34 +	void editOpenMultipleURLTabs();
    7.35  	void editURL();
    7.36  	void editHeading2URL();
    7.37  	void editBugzilla2URL();
    7.38  	void editFATE2URL();
    7.39  	void editVymLink();
    7.40  public slots:
    7.41 +    void editHeading();
    7.42  	void editOpenVymLink();
    7.43  private slots:
    7.44  	void editDeleteVymLink();
    7.45 @@ -113,7 +112,6 @@
    7.46      void editMoveDown();	
    7.47      void editToggleScroll();
    7.48      void editUnScrollAll();
    7.49 -    void editHeading();
    7.50      void editNewBranch();
    7.51      void editNewBranchHere();
    7.52      void editNewBranchAbove();
    7.53 @@ -188,9 +186,11 @@
    7.54  	FindWindow *findWindow;
    7.55  	QStringList lastMaps;
    7.56  	int maxLastMaps;
    7.57 -	Q3Process *procBrowser;
    7.58 +	QProcess *procBrowser;
    7.59  
    7.60  	QStringList imageTypes;
    7.61 +
    7.62 +	QLineEdit *lineedit;	// to enter headings of branches
    7.63  };
    7.64  
    7.65  
     8.1 --- a/mapeditor.cpp	Tue Aug 15 12:01:14 2006 +0000
     8.2 +++ b/mapeditor.cpp	Tue Aug 29 08:31:42 2006 +0000
     8.3 @@ -44,7 +44,6 @@
     8.4  #include "linkablemapobj.h"
     8.5  #include "mainwindow.h"
     8.6  #include "misc.h"
     8.7 -#include "settings.h"
     8.8  #include "texteditor.h"
     8.9  #include "warningdialog.h"
    8.10  #include "xml.h"
    8.11 @@ -63,6 +62,7 @@
    8.12  
    8.13  extern QAction *actionFileSave;
    8.14  extern QAction *actionEditUndo;
    8.15 +extern QAction *actionEditRedo;
    8.16  extern QAction *actionEditCopy;
    8.17  extern QAction *actionEditCut;
    8.18  extern QAction *actionEditPaste;
    8.19 @@ -177,10 +177,6 @@
    8.20  
    8.21      printer=NULL;
    8.22  
    8.23 -    lineedit = new QLineEdit(this, "lineedit"  );
    8.24 -    connect( lineedit, SIGNAL( returnPressed() ), SLOT( finishedLineEdit() ) );
    8.25 -    lineedit->hide();
    8.26 -
    8.27      actColor=Qt::black; setColor (actColor);
    8.28  	defLinkColor=QColor (0,0,255);
    8.29  	defXLinkColor=QColor (180,180,180);
    8.30 @@ -207,6 +203,8 @@
    8.31      selectionLast=NULL;
    8.32      movingObj=NULL;
    8.33  
    8.34 +	xelection.setMapCenter (mapCenter);
    8.35 +
    8.36  	defXLinkWidth=1;
    8.37  	defXLinkColor=QColor (230,230,230);
    8.38  
    8.39 @@ -220,8 +218,6 @@
    8.40  	mapName="";
    8.41  
    8.42  	undosTotal=settings.readNumEntry("/mapeditor/undoLevels",50);
    8.43 -	undosAvail=0;	
    8.44 -	undoNum=0;
    8.45  	
    8.46  	// Initialize find routine
    8.47  	itFind=NULL;				
    8.48 @@ -248,6 +244,8 @@
    8.49  	historyWindow->setCaption (fileName);
    8.50  
    8.51  	mapCenter->reposition();	//	for positioning heading
    8.52 +
    8.53 +
    8.54  }
    8.55  
    8.56  MapEditor::~MapEditor()
    8.57 @@ -372,7 +370,8 @@
    8.58  void MapEditor::makeTmpDirs()
    8.59  {
    8.60  	// Create unique temporary directories
    8.61 -	tmpMapDir=tmpVymDir+QString("/mapeditor-%1").arg(mapNum);
    8.62 +	tmpMapDir=QDir::convertSeparators (tmpVymDir+QString("/mapeditor-%1").arg(mapNum));
    8.63 +	histPath=QDir::convertSeparators (tmpMapDir+"/history");
    8.64  	QDir d;
    8.65  	d.mkdir (tmpMapDir,true);
    8.66  }
    8.67 @@ -458,32 +457,29 @@
    8.68  	return s;
    8.69  }
    8.70  
    8.71 -void MapEditor::saveState(const QString &comment)
    8.72 +void MapEditor::saveStateComplete(const QString &comment)
    8.73  {
    8.74  	// Save complete map
    8.75  	saveState (CompleteMap,"",NULL,"",NULL, comment);
    8.76  }
    8.77  
    8.78 -void MapEditor::saveState(LinkableMapObj *undoSel, const QString &comment)
    8.79 +void MapEditor::saveStatePart(LinkableMapObj *undoSel, const QString &comment)
    8.80  {
    8.81 -	// save the given part of the map 
    8.82 +	// save the selected part of the map 
    8.83  	saveState (PartOfMap,"",undoSel,"",NULL, comment);
    8.84  }
    8.85  
    8.86 -void MapEditor::saveState(const QString &uc, const QString &rc, const QString &comment)
    8.87 +void MapEditor::saveStateConstSelection(const QString &uc, const QString &rc, const QString &comment)
    8.88  {
    8.89  	// selection does not change during action,
    8.90  	// so just save commands for undo and redo
    8.91 -	LinkableMapObj *unsel;
    8.92 -	if (selection)
    8.93 -		unsel=selection;
    8.94 -	else
    8.95 -		unsel=NULL;
    8.96 -	saveState (UndoCommand,uc,unsel,rc,unsel, comment);
    8.97 +	// and use current selection
    8.98 +	saveState (UndoCommand,uc,selection,rc,selection, comment);
    8.99  }
   8.100  
   8.101 -void MapEditor::saveState(const QString & uncom, LinkableMapObj *unsel, const QString &comment) 
   8.102 +void MapEditor::saveStateX(LinkableMapObj *unsel, const QString &uncom, const QString &comment) 
   8.103  {
   8.104 +	// 
   8.105  	saveState (UndoCommand,uncom,unsel,"FIXME-redoCom",NULL, comment);
   8.106  }
   8.107  
   8.108 @@ -494,24 +490,24 @@
   8.109  	if (blockSaveState) return;
   8.110  
   8.111  	/* TODO remove after testing
   8.112 +	*/
   8.113  	cout << "ME::saveState()  begin\n"<<endl;
   8.114  	cout << "    undosTotal="<<undosTotal<<endl;
   8.115 -	cout << "    undosAvail="<<undosAvail<<endl;
   8.116 -	cout << "       undoNum="<<undoNum<<endl;
   8.117  	cout << "    ---------------------------"<<endl;
   8.118 -	*/
   8.119  
   8.120  	historyWindow->append (comment);
   8.121  	
   8.122  	setChanged();
   8.123  
   8.124 +	int undosAvail=undoSet.readNumEntry ("/history/undosAvail",0);
   8.125 +	int curStep=undoSet.readNumEntry ("/history/curStep",0);
   8.126  	// Find out current undo directory
   8.127  	if (undosAvail<undosTotal) undosAvail++;
   8.128 -	undoNum++;
   8.129 -	if (undoNum>undosTotal) undoNum=1;
   8.130 +	curStep++;
   8.131 +	if (curStep>undosTotal) curStep=1;
   8.132  	
   8.133  	QString backupXML;
   8.134 -	QString bakMapDir=QDir::convertSeparators (QString(tmpMapDir+"/undo-%1").arg(undoNum));
   8.135 +	QString bakMapDir=QDir::convertSeparators (QString(tmpMapDir+"/undo-%1").arg(curStep));
   8.136  	QString bakMapPath=QDir::convertSeparators(bakMapDir+"/map.xml");
   8.137  
   8.138  	// Create bakMapDir if not available
   8.139 @@ -550,28 +546,27 @@
   8.140  		// Write XML Data to disk
   8.141  		saveStringToDisk (QString(bakMapPath),backupXML);
   8.142  
   8.143 -	SimpleSettings set;
   8.144 -	set.setEntry (QString("undoCommand"),undoCommand);
   8.145 -	set.setEntry (QString("undoSelection"),undoSelection);
   8.146 -	set.setEntry (QString("redoCommand"),redoCom);
   8.147 -	set.setEntry (QString("redoSelection"),redoSelection);
   8.148 -	set.setEntry (QString("comment"),comment);
   8.149 -	set.writeSettings(QString(bakMapDir+"/commands"));
   8.150 +	undoSet.setEntry ("/history/undosAvail",QString::number(undosAvail));
   8.151 +	undoSet.setEntry ("/history/curStep",QString::number(curStep));
   8.152 +	undoSet.setEntry (QString("/history/step-%1/undoCommand").arg(curStep),undoCommand);
   8.153 +	undoSet.setEntry (QString("/history/step-%1/undoSelection").arg(curStep),undoSelection);
   8.154 +	undoSet.setEntry (QString("/history/step-%1/redoCommand").arg(curStep),redoCom);
   8.155 +	undoSet.setEntry (QString("/history/step-%1/redoSelection").arg(curStep),redoSelection);
   8.156 +	undoSet.setEntry (QString("/history/step-%1/comment").arg(curStep),comment);
   8.157 +	undoSet.writeSettings(histPath);
   8.158  
   8.159  	/* TODO remove after testing
   8.160 -	cout << "          into="<< bakMapDir<<endl;
   8.161 +	*/
   8.162 +	cout << "          into="<< histPath.toStdString()<<endl;
   8.163  	cout << "    undosAvail="<<undosAvail<<endl;
   8.164 -	cout << "       undoNum="<<undoNum<<endl;
   8.165 +	cout << "       curStep="<<curStep<<endl;
   8.166  	cout << "    ---------------------------"<<endl;
   8.167 -	cout << "    comment="<<comment<<endl;
   8.168 -	cout << "    ---------------------------"<<endl;
   8.169 -	cout << "    undoCom="<<undoCommand<<endl;
   8.170 -	cout << "    undoSel="<<undoSelection<<endl;
   8.171 -	cout << "    ---------------------------"<<endl;
   8.172 -	cout << "    redoCom="<<redoCom<<endl;
   8.173 -	cout << "    redoSel="<<redoSelection<<endl;
   8.174 +	cout << "    comment="<<comment.toStdString()<<endl;
   8.175 +	cout << "    undoCom="<<undoCommand.toStdString()<<endl;
   8.176 +	cout << "    undoSel="<<undoSelection.toStdString()<<endl;
   8.177 +	cout << "    redoCom="<<redoCom.toStdString()<<endl;
   8.178 +	cout << "    redoSel="<<redoSelection.toStdString()<<endl;
   8.179  	cout << "    ---------------------------"<<endl<<endl;
   8.180 -	*/
   8.181  }
   8.182  
   8.183  void MapEditor::parseAtom(const QString &atom)
   8.184 @@ -602,6 +597,17 @@
   8.185  			}
   8.186  		}	
   8.187  	}
   8.188 +	else if (com=="delete")
   8.189 +	{
   8.190 +		if (api.checkParamCount(1) && selection )
   8.191 +		{	
   8.192 +			s=api.parString(ok,0);
   8.193 +			if (ok)
   8.194 +			{
   8.195 +				if (select (s)) deleteSelection();
   8.196 +			}
   8.197 +		}	
   8.198 +	}	
   8.199  	else if (com=="linkBranchToPos")
   8.200  	{
   8.201  		if (selection && typeid(*selection) == typeid(BranchObj) ) 
   8.202 @@ -637,23 +643,46 @@
   8.203  		if (api.checkParamCount(1))
   8.204  		{
   8.205  			s=api.parString (ok,0);
   8.206 -			if (ok) setHeading (s);
   8.207 +			if (ok) 
   8.208 +				setHeading (s);
   8.209  		}	
   8.210  	} else if (com=="setURL")
   8.211  	{
   8.212  		if (api.checkParamCount(1))
   8.213  		{
   8.214  			s=api.parString (ok,0);
   8.215 -			if (ok) setURL(s);
   8.216 +			if (ok) setURLInt(s);
   8.217  		}	
   8.218  	} else if (com=="setVymLink")
   8.219  	{
   8.220  		if (api.checkParamCount(1))
   8.221  		{
   8.222  			s=api.parString (ok,0);
   8.223 -			if (ok) setVymLink(s);
   8.224 +			if (ok) setVymLinkInt(s);
   8.225  		}	
   8.226  	}
   8.227 +	else if (com=="setFlag")
   8.228 +	{
   8.229 +		if (selection && typeid(*selection) == typeid(BranchObj) ) 
   8.230 +		{
   8.231 +			if (api.checkParamCount(1) )
   8.232 +			{	
   8.233 +				s=api.parString(ok,0);
   8.234 +				if (ok) ((BranchObj*)selection)->activateStandardFlag(s);
   8.235 +			}	
   8.236 +		}
   8.237 +	}	
   8.238 +	else if (com=="unsetFlag")
   8.239 +	{
   8.240 +		if (selection && typeid(*selection) == typeid(BranchObj) ) 
   8.241 +		{
   8.242 +			if (api.checkParamCount(1) )
   8.243 +			{	
   8.244 +				s=api.parString(ok,0);
   8.245 +				if (ok) ((BranchObj*)selection)->deactivateStandardFlag(s);
   8.246 +			}	
   8.247 +		}
   8.248 +	}	
   8.249  	// Internal commands, used for undo etc.	
   8.250  	else if (com==QString("undoMap"))
   8.251  	{
   8.252 @@ -687,31 +716,6 @@
   8.253  	}	
   8.254  }
   8.255  
   8.256 -
   8.257 -void MapEditor::finishedLineEdit()
   8.258 -{
   8.259 -	// This is called by finishedLineEdit or any MapEditor method,
   8.260 -	// which wants to assure, that lineedits finish, before e.g. a branch is 
   8.261 -	// deleted
   8.262 -    
   8.263 -	// After calling LineEdit and using the clipboard, the 
   8.264 -    // focus is not any longer on the main widget, we
   8.265 -    // have to restore it using parentWidget()->setFocus()
   8.266 -
   8.267 -    if (editingBO!=NULL) 
   8.268 -	{
   8.269 -		saveState("setHeading (\""+editingBO->getHeading()+"\")",editingBO, QString("Set heading of %1 to \"%2\"").arg(getName(editingBO)).arg(lineedit->text()) );
   8.270 -		editingBO->setHeading(lineedit->text() );
   8.271 -		editingBO=NULL;
   8.272 -		lineedit->releaseKeyboard();
   8.273 -		lineedit->hide();
   8.274 -		parentWidget()->setFocus();
   8.275 -		mapCenter->reposition();
   8.276 -		adjustCanvasSize();
   8.277 -		ensureSelectionVisible();
   8.278 -    }		
   8.279 -}
   8.280 -
   8.281  void MapEditor::toggleHistoryWindow()
   8.282  {
   8.283  	if (historyWindow->isVisible())
   8.284 @@ -748,9 +752,6 @@
   8.285  
   8.286  void MapEditor::closeMap()
   8.287  {
   8.288 -	// Finish open lineEdits
   8.289 -	if (lineedit) finishedLineEdit();
   8.290 -
   8.291  	// Unselect before disabling the toolbar actions
   8.292  	if (selection) selection->unselect();
   8.293  	selection=NULL;
   8.294 @@ -816,9 +817,6 @@
   8.295  
   8.296  ErrorCode MapEditor::load (QString fname, LoadMode lmode)
   8.297  {
   8.298 -	// Finish open lineEdits
   8.299 -	if (lineedit) finishedLineEdit();
   8.300 -
   8.301  	ErrorCode err=success;
   8.302  
   8.303  	if (lmode==NewMap)
   8.304 @@ -830,7 +828,7 @@
   8.305  		// (map state is set later at end of load...)
   8.306  	} else
   8.307  	{
   8.308 -		saveState(selection,"Load map");
   8.309 +		saveStatePart(selection,"Load map");
   8.310  	}	
   8.311  	
   8.312      
   8.313 @@ -885,9 +883,6 @@
   8.314  
   8.315  int MapEditor::save (const SaveMode &savemode)
   8.316  {
   8.317 -	// Finish open lineEdits
   8.318 -	if (lineedit) finishedLineEdit();
   8.319 -
   8.320  	int returnCode=0;
   8.321  
   8.322  	// The SaveMode UndoCommand is not supported here
   8.323 @@ -935,9 +930,6 @@
   8.324  
   8.325  void MapEditor::print()
   8.326  {
   8.327 -	// Finish open lineEdits
   8.328 -	if (lineedit) finishedLineEdit();
   8.329 -
   8.330  	if ( !printer ) 
   8.331  	{
   8.332  		printer = new QPrinter;
   8.333 @@ -1111,9 +1103,6 @@
   8.334  
   8.335  void MapEditor::exportImage(QString fn)
   8.336  {
   8.337 -	// Finish open lineEdits
   8.338 -	if (lineedit) finishedLineEdit();
   8.339 -
   8.340  	setExportMode (true);
   8.341  	QPixmap pix (getPixmap());
   8.342  	pix.save(fn, "PNG");
   8.343 @@ -1132,9 +1121,6 @@
   8.344  
   8.345  void MapEditor::exportImage(QString fn, QString format)
   8.346  {
   8.347 -	// Finish open lineEdits
   8.348 -	if (lineedit) finishedLineEdit();
   8.349 -
   8.350  	setExportMode (true);
   8.351  	QPixmap pix (getPixmap());
   8.352  	pix.save(fn, format);
   8.353 @@ -1201,9 +1187,6 @@
   8.354  
   8.355  void MapEditor::copy()
   8.356  {
   8.357 -	// Finish open lineEdits
   8.358 -	if (lineedit) finishedLineEdit();
   8.359 -
   8.360  	if (selection) 
   8.361  	{
   8.362  		// write to directory
   8.363 @@ -1232,124 +1215,134 @@
   8.364  
   8.365  void MapEditor::redo()
   8.366  {
   8.367 -	// Finish open lineEdits
   8.368 -	if (lineedit) finishedLineEdit();
   8.369 -
   8.370  	blockSaveState=true;
   8.371  	
   8.372 +	// Restore variables
   8.373 +	int curStep=undoSet.readNumEntry (QString("/history/curStep"));
   8.374 +	int undosAvail=undoSet.readNumEntry (QString("/history/undosAvail"));
   8.375 +	int redosAvail=undoSet.readNumEntry (QString("/history/redosAvail"));
   8.376 +	if (redosAvail>0) redosAvail--;
   8.377 +	if (undosAvail<undosTotal) undosAvail++;
   8.378 +	curStep++;
   8.379 +	if (curStep>undosTotal) curStep=1;
   8.380 +	QString undoCommand=  undoSet.readEntry (QString("/history/step-%1/undoCommand").arg(curStep));
   8.381 +	QString undoSelection=undoSet.readEntry (QString("/history/step-%1/undoSelection").arg(curStep));
   8.382 +	QString redoCommand=  undoSet.readEntry (QString("/history/step-%1/redoCommand").arg(curStep));
   8.383 +	QString redoSelection=undoSet.readEntry (QString("/history/step-%1/redoSelection").arg(curStep));
   8.384 +	QString comment=undoSet.readEntry (QString("/history/step-%1/comment").arg(curStep));
   8.385 +
   8.386  	// Find out current undo directory
   8.387 -	QString bakMapDir=QDir::convertSeparators (QString(tmpMapDir+"/undo-%1").arg(undoNum));
   8.388 -
   8.389 -	// Restore variables
   8.390 -	QString undoCommand;
   8.391 -	QString undoSelection;
   8.392 -	QString redoCommand;
   8.393 -	QString redoSelection;
   8.394 -	SimpleSettings set;
   8.395 -	set.readSettings(QString(bakMapDir+"/commands"));
   8.396 -	undoCommand=set.readEntry ("undoCommand");
   8.397 -	undoSelection=set.readEntry ("undoSelection");
   8.398 -	redoCommand=set.readEntry ("redoCommand");
   8.399 -	redoSelection=set.readEntry ("redoSelection");
   8.400 +	QString bakMapDir=QDir::convertSeparators (QString(tmpMapDir+"/undo-%1").arg(curStep));
   8.401 +
   8.402 +/* TODO remove testing
   8.403 +*/
   8.404 +	cout << "ME::redo() begin\n";
   8.405 +	cout << "    undosAvail="<<undosAvail<<endl;
   8.406 +	cout << "    redosAvail="<<redosAvail<<endl;
   8.407 +	cout << "       curStep="<<curStep<<endl;
   8.408 +	cout << "    ---------------------------"<<endl;
   8.409 +	cout << "    comment="<<comment.toStdString()<<endl;
   8.410 +	cout << "    undoCom="<<undoCommand.toStdString()<<endl;
   8.411 +	cout << "    undoSel="<<undoSelection.toStdString()<<endl;
   8.412 +	cout << "    redoCom="<<redoCommand.toStdString()<<endl;
   8.413 +	cout << "    redoSel="<<redoSelection.toStdString()<<endl;
   8.414 +	cout << "    ---------------------------"<<endl<<endl;
   8.415  
   8.416  	// select  object before redo
   8.417 +	// FIXME better give up if no selection there...
   8.418  	if (!redoSelection.isEmpty())
   8.419  		select (redoSelection);
   8.420  
   8.421 +
   8.422 +	parseAtom (redoCommand);
   8.423 +	mapCenter->reposition();
   8.424 +
   8.425 +	//if (!redoSelection.isEmpty())
   8.426 +	//	select (redoSelection);
   8.427 +
   8.428 +	blockSaveState=false;
   8.429  /* TODO remove testing
   8.430 -	cout << "ME::redo() begin\n";
   8.431 -	cout << "    undosTotal="<<undosTotal<<endl;
   8.432 +*/	
   8.433 +	cout << "ME::redo() end\n";
   8.434  	cout << "    undosAvail="<<undosAvail<<endl;
   8.435 -	cout << "       undoNum="<<undoNum<<endl;
   8.436 +	cout << "    redosAvail="<<redosAvail<<endl;
   8.437 +	cout << "       curStep="<<curStep<<endl;
   8.438 +	cout << "    ---------------------------"<<endl<<endl;
   8.439 +
   8.440 +
   8.441 +	undoSet.setEntry ("/history/undosAvail",QString::number(undosAvail));
   8.442 +	undoSet.setEntry ("/history/redosAvail",QString::number(redosAvail));
   8.443 +	undoSet.setEntry ("/history/curStep",QString::number(curStep));
   8.444 +	undoSet.writeSettings(histPath);
   8.445 +
   8.446 +	updateActions();
   8.447 +}
   8.448 +
   8.449 +void MapEditor::undo()
   8.450 +{
   8.451 +	blockSaveState=true;
   8.452 +	
   8.453 +	// Restore variables
   8.454 +	int curStep=undoSet.readNumEntry (QString("/history/curStep"));
   8.455 +	int undosAvail=undoSet.readNumEntry (QString("/history/undosAvail"));
   8.456 +	int redosAvail=undoSet.readNumEntry (QString("/history/redosAvail"));
   8.457 +	QString undoCommand=  undoSet.readEntry (QString("/history/step-%1/undoCommand").arg(curStep));
   8.458 +	QString undoSelection=undoSet.readEntry (QString("/history/step-%1/undoSelection").arg(curStep));
   8.459 +	QString redoCommand=  undoSet.readEntry (QString("/history/step-%1/redoCommand").arg(curStep));
   8.460 +	QString redoSelection=undoSet.readEntry (QString("/history/step-%1/redoSelection").arg(curStep));
   8.461 +	QString comment=undoSet.readEntry (QString("/history/step-%1/comment").arg(curStep));
   8.462 +
   8.463 +	// Find out current undo directory
   8.464 +	QString bakMapDir=QDir::convertSeparators (QString(tmpMapDir+"/undo-%1").arg(curStep));
   8.465 +
   8.466 +	// select  object before undo
   8.467 +	if (!undoSelection.isEmpty())
   8.468 +		select (undoSelection);
   8.469 +
   8.470 +/* TODO testing
   8.471 +*/	
   8.472 +	cout << "ME::undo() begin\n";
   8.473 +	cout << "    undosAvail="<<undosAvail<<endl;
   8.474 +	cout << "    redosAvail="<<redosAvail<<endl;
   8.475 +	cout << "       curStep="<<curStep<<endl;
   8.476  	cout << "    ---------------------------"<<endl;
   8.477 -	cout << "    undoCom="<<undoCommand<<endl;
   8.478 -	cout << "    undoSel="<<undoSelection<<endl;
   8.479 -	cout << "    ---------------------------"<<endl;
   8.480 -	cout << "    redoCom="<<redoCommand<<endl;
   8.481 -	cout << "    redoSel="<<redoSelection<<endl;
   8.482 -	cout << "    ---------------------------"<<endl;
   8.483 -*/
   8.484 +	cout << "    comment="<<comment.toStdString()<<endl;
   8.485 +	cout << "    undoCom="<<undoCommand.toStdString()<<endl;
   8.486 +	cout << "    undoSel="<<undoSelection.toStdString()<<endl;
   8.487 +	cout << "    redoCom="<<redoCommand.toStdString()<<endl;
   8.488 +	cout << "    redoSel="<<redoSelection.toStdString()<<endl;
   8.489 +	cout << "    ---------------------------"<<endl<<endl;
   8.490  	parseAtom (undoCommand);
   8.491  	mapCenter->reposition();
   8.492  
   8.493  	//if (!redoSelection.isEmpty())
   8.494  	//	select (redoSelection);
   8.495  
   8.496 +	
   8.497  	undosAvail--;
   8.498  	if (undosAvail<1)
   8.499  		// Undo not longer available now
   8.500  		actionEditUndo->setEnabled (false);
   8.501  	else	
   8.502 -		undoNum--; if (undoNum<1) undoNum=undosTotal;
   8.503 +		curStep--; if (curStep<1) curStep=undosTotal;
   8.504 +
   8.505 +	redosAvail++;
   8.506  
   8.507  	blockSaveState=false;
   8.508  /* TODO remove testing
   8.509 -	cout << "ME::redo() end\n";
   8.510 -	cout << "    undosAvail="<<undosAvail<<endl;
   8.511 -	cout << "       undoNum="<<undoNum<<endl;
   8.512 -	cout << "    ---------------------------"<<endl<<endl;
   8.513 -*/	
   8.514 -}
   8.515 -
   8.516 -void MapEditor::undo()
   8.517 -{
   8.518 -	// Finish open lineEdits
   8.519 -	if (lineedit) finishedLineEdit();
   8.520 -
   8.521 -	blockSaveState=true;
   8.522 -	
   8.523 -	// Find out current undo directory
   8.524 -	QString bakMapDir=QDir::convertSeparators (QString(tmpMapDir+"/undo-%1").arg(undoNum));
   8.525 -
   8.526 -	// Restore variables
   8.527 -	QString undoCommand;
   8.528 -	QString undoSelection;
   8.529 -	QString redoCommand;
   8.530 -	QString redoSelection;
   8.531 -	SimpleSettings set;
   8.532 -	set.readSettings(QString(bakMapDir+"/commands"));
   8.533 -	undoCommand=  set.readEntry ("undoCommand");
   8.534 -	undoSelection=set.readEntry ("undoSelection");
   8.535 -	redoCommand=  set.readEntry ("redoCommand");
   8.536 -	redoSelection=set.readEntry ("redoSelection");
   8.537 -
   8.538 -	// select  object before undo
   8.539 -	if (!undoSelection.isEmpty())
   8.540 -		select (undoSelection);
   8.541 -
   8.542 -/* TODO testing
   8.543 -	cout << "ME::undo() begin\n";
   8.544 -	cout << "    undosTotal="<<undosTotal<<endl;
   8.545 -	cout << "    undosAvail="<<undosAvail<<endl;
   8.546 -	cout << "       undoNum="<<undoNum<<endl;
   8.547 -	cout << "    ---------------------------"<<endl;
   8.548 -	cout << "    undoCom="<<undoCommand<<endl;
   8.549 -	cout << "    undoSel="<<undoSelection<<endl;
   8.550 -	cout << "    ---------------------------"<<endl;
   8.551 -	cout << "    redoCom="<<redoCommand<<endl;
   8.552 -	cout << "    redoSel="<<redoSelection<<endl;
   8.553 -	cout << "    ---------------------------"<<endl;
   8.554 -*/	
   8.555 -	parseAtom (undoCommand);
   8.556 -	mapCenter->reposition();
   8.557 -
   8.558 -	//if (!redoSelection.isEmpty())
   8.559 -	//	select (redoSelection);
   8.560 -
   8.561 -	undosAvail--;
   8.562 -	if (undosAvail<1)
   8.563 -		// Undo not longer available now
   8.564 -		actionEditUndo->setEnabled (false);
   8.565 -	else	
   8.566 -		undoNum--; if (undoNum<1) undoNum=undosTotal;
   8.567 -
   8.568 -	blockSaveState=false;
   8.569 -/* TODO remove testing
   8.570 +*/
   8.571  	cout << "ME::undo() end\n";
   8.572  	cout << "    undosAvail="<<undosAvail<<endl;
   8.573 -	cout << "       undoNum="<<undoNum<<endl;
   8.574 +	cout << "    redosAvail="<<redosAvail<<endl;
   8.575 +	cout << "       curStep="<<curStep<<endl;
   8.576  	cout << "    ---------------------------"<<endl<<endl;
   8.577 -*/
   8.578 +
   8.579 +	undoSet.setEntry ("/history/undosAvail",QString::number(undosAvail));
   8.580 +	undoSet.setEntry ("/history/redosAvail",QString::number(undosAvail));
   8.581 +	undoSet.setEntry ("/history/curStep",QString::number(curStep));
   8.582 +	undoSet.writeSettings(histPath);
   8.583 +
   8.584 +	updateActions();
   8.585  }
   8.586  
   8.587  void MapEditor::undoXML(const QString &undoSel, const QString &bakMapPath)
   8.588 @@ -1400,9 +1393,6 @@
   8.589  
   8.590  void MapEditor::pasteNoSave()
   8.591  {
   8.592 -	// Finish open lineEdits
   8.593 -	if (lineedit) finishedLineEdit();
   8.594 -
   8.595  	load (clipboardDir+"/part.xml",ImportAdd);
   8.596  }
   8.597  
   8.598 @@ -1417,7 +1407,7 @@
   8.599  	if (selection && (typeid(*selection) == typeid(BranchObj) ||
   8.600  				      typeid(*selection) == typeid(MapCenterObj))) 
   8.601  	{
   8.602 -		saveState(selection,QString("Paste to %1").arg( getName(selection)));
   8.603 +		saveStatePart(selection,QString("Paste to %1").arg( getName(selection)));
   8.604  		pasteNoSave();
   8.605  		mapCenter->reposition();
   8.606  		adjustCanvasSize();
   8.607 @@ -1426,7 +1416,7 @@
   8.608  
   8.609  void MapEditor::cut()
   8.610  {
   8.611 -	saveState(selection->getParObj(),QString("Cut %1").arg(getName(selection)));
   8.612 +	saveStatePart(selection->getParObj(),QString("Cut %1").arg(getName(selection)));
   8.613  	copy();
   8.614  	cutNoSave();
   8.615  	mapCenter->reposition();
   8.616 @@ -1443,9 +1433,6 @@
   8.617  
   8.618  void MapEditor::moveBranchUp()
   8.619  {
   8.620 -	// Finish open lineEdits
   8.621 -	if (lineedit) finishedLineEdit();
   8.622 -
   8.623  	BranchObj* bo;
   8.624  	BranchObj* par;
   8.625  	if (typeid(*selection) == typeid(BranchObj)  ) 
   8.626 @@ -1456,7 +1443,7 @@
   8.627  		selection->unselect();
   8.628  		selection=par->moveBranchUp (bo);
   8.629  		selection->select();
   8.630 -		saveState("moveBranchDown ()",bo,QString("Move up %1").arg(getName(bo)));
   8.631 +		saveStateX(bo,"moveBranchDown ()",QString("Move up %1").arg(getName(bo)));
   8.632  		mapCenter->reposition();
   8.633  		ensureSelectionVisible();
   8.634  	}
   8.635 @@ -1464,9 +1451,6 @@
   8.636  
   8.637  void MapEditor::moveBranchDown()
   8.638  {
   8.639 -	// Finish open lineEdits
   8.640 -	if (lineedit) finishedLineEdit();
   8.641 -
   8.642  	BranchObj* bo;
   8.643  	BranchObj* par;
   8.644  	if (typeid(*selection) == typeid(BranchObj)  ) 
   8.645 @@ -1477,7 +1461,7 @@
   8.646  		selection->unselect(); 
   8.647  		selection=par->moveBranchDown(bo);
   8.648  		selection->select();
   8.649 -		saveState("moveBranchUp ()",bo,QString("Move down %1").arg(getName(bo)));
   8.650 +		saveStateX(bo,"moveBranchUp ()",QString("Move down %1").arg(getName(bo)));
   8.651  		mapCenter->reposition();
   8.652  		ensureSelectionVisible();
   8.653  	}	
   8.654 @@ -1485,32 +1469,56 @@
   8.655  
   8.656  void MapEditor::editHeading()
   8.657  {
   8.658 -	// Finish open lineEdits
   8.659 -	if (lineedit->isVisible()) 
   8.660 -	{	
   8.661 -		finishedLineEdit();
   8.662 -		return;
   8.663 -	}	
   8.664 -
   8.665 +/* FIXME not needed any longer
   8.666  	if (selection  &&  
   8.667  		 (typeid(*selection) == typeid(BranchObj) || 
   8.668  		  typeid(*selection) == typeid(MapCenterObj) ) ) 
   8.669  	{
   8.670  		editingBO=(BranchObj*)selection;
   8.671 -
   8.672  		ensureSelectionVisible();
   8.673  		QPoint p = worldMatrix().map(QPoint (editingBO->x(),editingBO->y()));
   8.674 -		lineedit->setGeometry(p.x()-contentsX(),p.y()-contentsY(),200,25);
   8.675 -		QString s=editingBO->getHeading();
   8.676 -		lineedit->setText(s);
   8.677 -		lineedit->setCursorPosition(1);
   8.678 -		if (actionSettingsAutoselectText->isOn() && !s.isEmpty() && actionSettingsPasteNewHeading->isOn() )
   8.679 -			lineedit->selectAll();
   8.680 -		lineedit->show();
   8.681 -		lineedit->setFocus();
   8.682 -		lineedit->grabKeyboard();
   8.683 -		cout << "le="<<lineedit<<"  kgrabber="<<keyboardGrabber()<<endl;
   8.684 -	}				
   8.685 +
   8.686 +		QDialog *d =new QDialog(NULL);
   8.687 +		QLineEdit *le=new QLineEdit (d);
   8.688 +		d->setWindowFlags (Qt::FramelessWindowHint);
   8.689 +		QPoint q=mapToGlobal (QPoint(0,0));
   8.690 +		d->setGeometry(p.x()+q.x(),p.y()+q.y(),200,25);
   8.691 +		le->resize (d->size());
   8.692 +		le->setText (editingBO->getHeading());
   8.693 +		le->selectAll();
   8.694 +		connect (le, SIGNAL (returnPressed()), d, SLOT (accept()));
   8.695 +		d->activateWindow();
   8.696 +		d->exec();
   8.697 +
   8.698 +		saveStateConstSelection(
   8.699 +			"setHeading (\""+editingBO->getHeading()+"\")", 
   8.700 +			"setHeading (\""+le->text()+"\")", 
   8.701 +			QString("Set heading of %1 to \"%2\"").arg(getName(editingBO)).arg(le->text()) );
   8.702 +		editingBO->setHeading(le->text() );
   8.703 +		editingBO=NULL;
   8.704 +		mapCenter->reposition();
   8.705 +		adjustCanvasSize();
   8.706 +		ensureSelectionVisible();
   8.707 +		activateWindow();
   8.708 +	}	
   8.709 +*/	
   8.710 +}
   8.711 +
   8.712 +QString MapEditor::getHeading(bool &ok, QPoint &p)
   8.713 +{
   8.714 +	if (selection  &&  
   8.715 +		 (typeid(*selection) == typeid(BranchObj) || 
   8.716 +		  typeid(*selection) == typeid(MapCenterObj) ) ) 
   8.717 +	{
   8.718 +		ok=true;
   8.719 +		ensureSelectionVisible();
   8.720 +		p = ((BranchObj*)selection)->getAbsPos();
   8.721 +		p.setY(p.y()+((BranchObj*)selection)->height()/2);
   8.722 +//		p = mapTo(mainWindow,worldMatrix().map( p));
   8.723 +		return ((BranchObj*)selection)->getHeading();
   8.724 +	}
   8.725 +	ok=false;
   8.726 +	return QString();
   8.727  }
   8.728  
   8.729  void MapEditor::setHeading(const QString &s)
   8.730 @@ -1520,14 +1528,20 @@
   8.731  		 (typeid(*selection) == typeid(BranchObj) || 
   8.732  		  typeid(*selection) == typeid(MapCenterObj) ) ) 
   8.733  	{
   8.734 -		((BranchObj*)selection)->setHeading(s);
   8.735 +		editingBO=(BranchObj*)selection;
   8.736 +		saveStateConstSelection(
   8.737 +			"setHeading (\""+editingBO->getHeading()+"\")", 
   8.738 +			"setHeading (\""+s+"\")", 
   8.739 +			QString("Set heading of %1 to \"%2\"").arg(getName(editingBO)).arg(s) );
   8.740 +		editingBO->setHeading(s );
   8.741 +		editingBO=NULL;
   8.742  		mapCenter->reposition();
   8.743  		adjustCanvasSize();
   8.744  		ensureSelectionVisible();
   8.745  	}
   8.746  }
   8.747  
   8.748 -void MapEditor::setURL (const QString &s)
   8.749 +void MapEditor::setURLInt (const QString &s)
   8.750  {
   8.751  	// Internal function, no saveState needed
   8.752  	if (selection  &&  
   8.753 @@ -1541,7 +1555,20 @@
   8.754  	}
   8.755  }
   8.756  
   8.757 -void MapEditor::setVymLink (const QString &s)
   8.758 +void MapEditor::setHeadingInt(const QString &s)
   8.759 +{
   8.760 +	if (selection  &&  
   8.761 +		 (typeid(*selection) == typeid(BranchObj) || 
   8.762 +		  typeid(*selection) == typeid(MapCenterObj) ) ) 
   8.763 +	{
   8.764 +		((BranchObj*)selection)->setHeading(s);
   8.765 +		mapCenter->reposition();
   8.766 +		adjustCanvasSize();
   8.767 +		ensureSelectionVisible();
   8.768 +	}
   8.769 +}
   8.770 +
   8.771 +void MapEditor::setVymLinkInt (const QString &s)
   8.772  {
   8.773  	// Internal function, no saveState needed
   8.774  	if (selection  &&  
   8.775 @@ -1557,15 +1584,11 @@
   8.776  
   8.777  void MapEditor::addNewBranch(int pos)
   8.778  {
   8.779 -	// Finish open lineEdits
   8.780 -	if (lineedit) finishedLineEdit();
   8.781 -
   8.782  	if (selection  &&  
   8.783  		 (typeid(*selection) == typeid(BranchObj) || 
   8.784  		  typeid(*selection) == typeid(MapCenterObj) ) ) 
   8.785  	{
   8.786  		BranchObj* bo1 = (BranchObj*) selection;
   8.787 -		saveState(selection, QString("Add new branch to %1").arg(getName(bo1)));	//TODO undoCommand
   8.788  
   8.789  		bool wasScrolled=false;
   8.790  		BranchObj *newbo=NULL;
   8.791 @@ -1588,14 +1611,65 @@
   8.792  					newbo=parbo->insertBranch(bo1->getNum()+1);
   8.793  			} else
   8.794  				// This should not happen...
   8.795 +				// ...but it happens if CTRL-A is pressed on MCO,
   8.796 +				// ignore it then
   8.797  				return;
   8.798 -			
   8.799  		}	
   8.800 +		saveStateX(selection,QString ("delete (\"%1\")").arg(newbo->getSelectString()),QString("Add new branch to %1").arg(getName(bo1)));	//TODO undoCommand
   8.801  
   8.802  		LinkableMapObj *oldselection=selection;
   8.803  
   8.804  		mapCenter->reposition();
   8.805  		adjustCanvasSize();
   8.806 +
   8.807 +
   8.808 +		if (actionSettingsAutoedit->isOn() ||
   8.809 +			actionSettingsAutoselectHeading->isOn() )
   8.810 +		{
   8.811 +			selection->unselect();
   8.812 +			selection=newbo;
   8.813 +			selection->select();
   8.814 +			if (actionSettingsPasteNewHeading->isOn() )
   8.815 +			{
   8.816 +				BranchObj *bo2= (BranchObj*)selection;
   8.817 +				bo2->setHeading("");
   8.818 +			}	
   8.819 +			if (actionSettingsAutoedit->isOn() )
   8.820 +				mainWindow->editHeading();
   8.821 +			if (!actionSettingsAutoselectHeading->isOn()
   8.822 +				&& !wasScrolled)
   8.823 +			{
   8.824 +				selection->unselect();
   8.825 +				selection=oldselection;
   8.826 +				selection->select();
   8.827 +			}
   8.828 +		}	
   8.829 +	}	
   8.830 +}
   8.831 +
   8.832 +
   8.833 +void MapEditor::addNewBranchHere()
   8.834 +{
   8.835 +	if (selection  &&  
   8.836 +		 (typeid(*selection) == typeid(BranchObj) ) )
   8.837 +	{
   8.838 +		BranchObj* bo1 = (BranchObj*) selection;
   8.839 +		saveStatePart(selection, QString("Add new branch here").arg(getName(bo1)));
   8.840 +
   8.841 +		bool wasScrolled=false;
   8.842 +		BranchObj *newbo=NULL;
   8.843 +		BranchObj *parbo=(BranchObj*)(selection->getParObj());
   8.844 +		if (parbo)
   8.845 +		{
   8.846 +			// add below selection
   8.847 +			newbo=parbo->insertBranch(bo1->getNum()+1);
   8.848 +		} 
   8.849 +
   8.850 +		LinkableMapObj *oldselection=selection;
   8.851 +		((BranchObj*)selection)->moveBranchTo (newbo,-1);
   8.852 +
   8.853 +		mapCenter->reposition();
   8.854 +		adjustCanvasSize();
   8.855  		if (actionSettingsAutoedit->isOn() ||
   8.856  			actionSettingsAutoselectHeading->isOn() )
   8.857  		{
   8.858 @@ -1620,61 +1694,8 @@
   8.859  	}	
   8.860  }
   8.861  
   8.862 -
   8.863 -void MapEditor::addNewBranchHere()
   8.864 -{
   8.865 -	// Finish open lineEdits
   8.866 -	if (lineedit) finishedLineEdit();
   8.867 -
   8.868 -	if (selection  &&  
   8.869 -		 (typeid(*selection) == typeid(BranchObj) ) )
   8.870 -	{
   8.871 -		BranchObj* bo1 = (BranchObj*) selection;
   8.872 -		saveState(selection, QString("Add new branch here").arg(getName(bo1)));
   8.873 -
   8.874 -		bool wasScrolled=false;
   8.875 -		BranchObj *newbo=NULL;
   8.876 -		BranchObj *parbo=(BranchObj*)(selection->getParObj());
   8.877 -		if (parbo)
   8.878 -		{
   8.879 -			// add below selection
   8.880 -			newbo=parbo->insertBranch(bo1->getNum()+1);
   8.881 -		} 
   8.882 -
   8.883 -		LinkableMapObj *oldselection=selection;
   8.884 -		((BranchObj*)selection)->moveBranchTo (newbo,-1);
   8.885 -
   8.886 -		mapCenter->reposition();
   8.887 -		adjustCanvasSize();
   8.888 -		if (actionSettingsAutoedit->isOn() ||
   8.889 -			actionSettingsAutoselectHeading->isOn() )
   8.890 -		{
   8.891 -			selection->unselect();
   8.892 -			selection=newbo;
   8.893 -			selection->select();
   8.894 -			if (actionSettingsPasteNewHeading->isOn() )
   8.895 -			{
   8.896 -				BranchObj *bo2= (BranchObj*)selection;
   8.897 -				bo2->setHeading("");
   8.898 -			}	
   8.899 -			if (actionSettingsAutoedit->isOn() )
   8.900 -				editHeading();
   8.901 -			if (!actionSettingsAutoselectHeading->isOn()
   8.902 -				&& !wasScrolled)
   8.903 -			{
   8.904 -				selection->unselect();
   8.905 -				selection=oldselection;
   8.906 -				selection->select();
   8.907 -			}
   8.908 -		}	
   8.909 -	}	
   8.910 -}
   8.911 -
   8.912  void MapEditor::deleteSelection()
   8.913  {
   8.914 -	// Finish open lineEdits
   8.915 -	if (lineedit) finishedLineEdit();
   8.916 -
   8.917  	if (selection  && typeid(*selection) ==typeid(BranchObj) ) 
   8.918  	{
   8.919  		BranchObj* bo=dynamic_cast <BranchObj*> (selection);
   8.920 @@ -1682,12 +1703,12 @@
   8.921  		bo->unselect();
   8.922  		if (selection->getDepth()>1)
   8.923  			// Normal branch, save parent with childs
   8.924 -			saveState(par,QString("Delete %1").arg(getName(bo)));
   8.925 +			saveStatePart(par,QString("Delete %1").arg(getName(bo)));
   8.926  		else
   8.927  			// Mainbranch, save whole map
   8.928  			// TODO Better would be to insert mainbranch again at pos
   8.929  			// But undoCommand is missing right now
   8.930 -			saveState(QString("Delete %1").arg(getName(bo)));
   8.931 +			saveStateComplete(QString("Delete %1").arg(getName(bo)));
   8.932  		selection=NULL;
   8.933  		par->removeBranch(bo);
   8.934  		selection=par;
   8.935 @@ -1700,7 +1721,7 @@
   8.936  	{
   8.937  		FloatImageObj* fio=dynamic_cast <FloatImageObj*> (selection);
   8.938  		BranchObj* par=(BranchObj*)(fio->getParObj());
   8.939 -		saveState(par, QString("Delete %1").arg(getName(fio)));
   8.940 +		saveStatePart(par, QString("Delete %1").arg(getName(fio)));
   8.941  		fio->unselect();
   8.942  		selection=NULL;
   8.943  		par->removeFloatImage(fio);
   8.944 @@ -1754,7 +1775,7 @@
   8.945  	return false;
   8.946  }
   8.947  
   8.948 -void MapEditor::select (LinkableMapObj *lmo)
   8.949 +void MapEditor::selectInt (LinkableMapObj *lmo)
   8.950  {
   8.951  	if (lmo && selection != lmo)
   8.952  	{
   8.953 @@ -1768,7 +1789,7 @@
   8.954  
   8.955  }
   8.956  
   8.957 -void MapEditor::selectNextBranch()
   8.958 +void MapEditor::selectNextBranchInt()
   8.959  {
   8.960  	// Increase number of branch
   8.961  	if (selection)
   8.962 @@ -1848,7 +1869,7 @@
   8.963  	}	
   8.964  }
   8.965  
   8.966 -void MapEditor::selectPrevBranch()
   8.967 +void MapEditor::selectPrevBranchInt()
   8.968  {
   8.969  	// Decrease number of branch
   8.970  	if (selection)
   8.971 @@ -1929,40 +1950,34 @@
   8.972  
   8.973  void MapEditor::selectUpperBranch()
   8.974  {
   8.975 -	// Finish open lineEdits
   8.976 -	if (lineedit) finishedLineEdit();
   8.977 -
   8.978  	if (selection) 
   8.979  	{
   8.980  		if (typeid(*selection) == typeid(BranchObj))
   8.981  		{
   8.982  			if (selection->getOrientation()==OrientRightOfCenter)
   8.983 -				selectPrevBranch();
   8.984 +				selectPrevBranchInt();
   8.985  			else
   8.986  				if (selection->getDepth()==1)
   8.987 -					selectNextBranch();
   8.988 +					selectNextBranchInt();
   8.989  				else
   8.990 -					selectPrevBranch();
   8.991 +					selectPrevBranchInt();
   8.992  		}		
   8.993  	}
   8.994  }
   8.995  
   8.996  void MapEditor::selectLowerBranch()
   8.997  {
   8.998 -	// Finish open lineEdits
   8.999 -	if (lineedit) finishedLineEdit();
  8.1000 -
  8.1001  	if (selection) 
  8.1002  	{
  8.1003  		if (typeid(*selection) == typeid(BranchObj))
  8.1004  		{
  8.1005  			if (selection->getOrientation()==OrientRightOfCenter)
  8.1006 -				selectNextBranch();
  8.1007 +				selectNextBranchInt();
  8.1008  			else
  8.1009  				if (selection->getDepth()==1)
  8.1010 -					selectPrevBranch();
  8.1011 +					selectPrevBranchInt();
  8.1012  				else
  8.1013 -					selectNextBranch();
  8.1014 +					selectNextBranchInt();
  8.1015  		}		
  8.1016  	}
  8.1017  }
  8.1018 @@ -1970,9 +1985,6 @@
  8.1019  
  8.1020  void MapEditor::selectLeftBranch()
  8.1021  {
  8.1022 -	// Finish open lineEdits
  8.1023 -	if (lineedit) finishedLineEdit();
  8.1024 -
  8.1025  	BranchObj* bo;
  8.1026  	BranchObj* par;
  8.1027  	if (selection) 
  8.1028 @@ -2032,9 +2044,6 @@
  8.1029  
  8.1030  void MapEditor::selectRightBranch()
  8.1031  {
  8.1032 -	// Finish open lineEdits
  8.1033 -	if (lineedit) finishedLineEdit();
  8.1034 -
  8.1035  	BranchObj* bo;
  8.1036  	BranchObj* par;
  8.1037  
  8.1038 @@ -2046,7 +2055,7 @@
  8.1039  			bo=par->getLastSelectedBranch();
  8.1040  			if (bo)
  8.1041  			{
  8.1042 -				// Workaround for relecting on left and right side
  8.1043 +				// Workaround for reselecting on left and right side
  8.1044  				if (bo->getOrientation()==OrientLeftOfCenter)
  8.1045  					bo=par->getFirstBranch();
  8.1046  				if (bo)
  8.1047 @@ -2092,9 +2101,6 @@
  8.1048  
  8.1049  void MapEditor::selectFirstBranch()
  8.1050  {
  8.1051 -	// Finish open lineEdits
  8.1052 -	if (lineedit) finishedLineEdit();
  8.1053 -
  8.1054  	BranchObj *bo1;
  8.1055  	BranchObj *bo2;
  8.1056  	BranchObj* par;
  8.1057 @@ -2117,9 +2123,6 @@
  8.1058  
  8.1059  void MapEditor::selectLastBranch()
  8.1060  {
  8.1061 -	// Finish open lineEdits
  8.1062 -	if (lineedit) finishedLineEdit();
  8.1063 -
  8.1064  	BranchObj *bo1;
  8.1065  	BranchObj *bo2;
  8.1066  	BranchObj* par;
  8.1067 @@ -2147,13 +2150,11 @@
  8.1068  
  8.1069  void MapEditor::selectBackgroundColor()
  8.1070  {
  8.1071 -	// Finish open lineEdits
  8.1072 -	if (lineedit) finishedLineEdit();
  8.1073 -
  8.1074  	QColor col = QColorDialog::getColor( mapCanvas->backgroundColor(), this );
  8.1075  	if ( !col.isValid() ) return;
  8.1076  	setBackgroundColor( col );
  8.1077 -	saveState(QString("Set background color of map to %1").arg(col.name()));
  8.1078 +	//TODO undocomm
  8.1079 +	saveStateComplete(QString("Set background color of map to %1").arg(col.name()));
  8.1080  }
  8.1081  
  8.1082  void MapEditor::setBackgroundColor(QColor c)
  8.1083 @@ -2183,7 +2184,7 @@
  8.1084  			typeid(*selection) == typeid(MapCenterObj))
  8.1085  		{
  8.1086  			BranchObj *bo=(BranchObj*)selection;
  8.1087 -			saveState(selection, QString("Set color of %1 to %2").arg(getName(bo)).arg(actColor.name()));	//TODO undoCommand
  8.1088 +			saveStatePart(selection, QString("Set color of %1 to %2").arg(getName(bo)).arg(actColor.name()));	//TODO undoCommand
  8.1089  			bo->setColor(actColor); // color branch
  8.1090  		}    
  8.1091  	}
  8.1092 @@ -2197,7 +2198,7 @@
  8.1093  			typeid(*selection) == typeid(MapCenterObj))
  8.1094  		{
  8.1095  			BranchObj *bo=(BranchObj*)selection;
  8.1096 -			saveState(selection, QString ("Set color of %1 and childs to %2").arg(getName(bo)).arg(actColor.name()));	//TODO undoCommand
  8.1097 +			saveStatePart(selection, QString ("Set color of %1 and childs to %2").arg(getName(bo)).arg(actColor.name()));	//TODO undoCommand
  8.1098  			bo->setColorChilds(actColor); // color links, color childs
  8.1099  		}    
  8.1100  	}
  8.1101 @@ -2212,12 +2213,20 @@
  8.1102  			typeid(*selection) == typeid(MapCenterObj))
  8.1103  		{
  8.1104  			BranchObj *bo=(BranchObj*)selection;
  8.1105 -			QString s;
  8.1106 +			QString u,r;
  8.1107  			if (bo->isSetStandardFlag(f))
  8.1108 -				s="Unset";
  8.1109 +			{
  8.1110 +				r="unsetFlag";
  8.1111 +				u="setFlag";
  8.1112 +			}	
  8.1113  			else
  8.1114 -				s="Set";
  8.1115 -			saveState(selection, QString("%1 standard flag \"%2\" of %3").arg(s).arg(f).arg(getName(bo)));// TODO undoCommand	
  8.1116 +			{
  8.1117 +				u="unsetFlag";
  8.1118 +				r="setFlag";
  8.1119 +			}	
  8.1120 +			saveStateConstSelection(QString("%1 (\"%2\")").arg(u).arg(f), 
  8.1121 +				QString("%1 (\"%2\")").arg(r).arg(f),
  8.1122 +				QString("Toggling standard flag \"%1\" of %2").arg(f).arg(getName(bo)));
  8.1123  			bo->toggleStandardFlag (f,actionSettingsUseFlagGroups->isOn());
  8.1124  			adjustCanvasSize();
  8.1125  		}
  8.1126 @@ -2311,7 +2320,7 @@
  8.1127  		if ( ok) 
  8.1128  		{
  8.1129  			// user entered something and pressed OK
  8.1130 -			saveState("setURL (\""+bo->getURL()+"\")","setURL (\""+text+"\")", QString("Set URL of %1 to %21").arg(getName(bo)).arg(text));	
  8.1131 +			saveStateConstSelection("setURL (\""+bo->getURL()+"\")","setURL (\""+text+"\")", QString("Set URL of %1 to %21").arg(getName(bo)).arg(text));	
  8.1132  			bo->setURL (text);
  8.1133  			updateActions();
  8.1134  		}	
  8.1135 @@ -2333,7 +2342,7 @@
  8.1136  			typeid(*selection) == typeid(MapCenterObj)) )
  8.1137  	{		
  8.1138  		BranchObj *bo=(BranchObj*)selection;
  8.1139 -		saveState("setURL (\""+bo->getURL()+"\")","setURL (\""+bo->getHeading()+"\")",QString("Copy heading of %1 to URL").arg(getName(bo)));	
  8.1140 +		saveStateConstSelection("setURL (\""+bo->getURL()+"\")","setURL (\""+bo->getHeading()+"\")",QString("Copy heading of %1 to URL").arg(getName(bo)));	
  8.1141  		bo->setURL (bo->getHeading());
  8.1142  		updateActions();
  8.1143  	}
  8.1144 @@ -2346,7 +2355,7 @@
  8.1145  	{		
  8.1146  		BranchObj *bo=(BranchObj*)selection;
  8.1147  		QString url= "https://bugzilla.novell.com/show_bug.cgi?id="+bo->getHeading();
  8.1148 -		saveState("setURL (\""+bo->getURL()+"\")","setURL (\""+url+"\")",QString("Use heading of %1 as link to Novell Bugzilla").arg(getName(bo)));	
  8.1149 +		saveStateConstSelection("setURL (\""+bo->getURL()+"\")","setURL (\""+url+"\")",QString("Use heading of %1 as link to Novell Bugzilla").arg(getName(bo)));	
  8.1150  		bo->setURL (url);
  8.1151  		updateActions();
  8.1152  	}
  8.1153 @@ -2359,7 +2368,7 @@
  8.1154  	{		
  8.1155  		BranchObj *bo=(BranchObj*)selection;
  8.1156  		QString url= "http://keeper.suse.de:8080/webfate/match/id?value=ID"+bo->getHeading();
  8.1157 -		saveState("setURL (\""+bo->getURL()+"\")","setURL (\""+url+"\")",QString("Use heading of %1 as link to FATE").arg(getName(bo)));	
  8.1158 +		saveStateConstSelection("setURL (\""+bo->getURL()+"\")","setURL (\""+url+"\")",QString("Use heading of %1 as link to FATE").arg(getName(bo)));	
  8.1159  		bo->setURL (url);
  8.1160  		updateActions();
  8.1161  	}
  8.1162 @@ -2381,7 +2390,7 @@
  8.1163  		QString fn;
  8.1164  		if ( fd->exec() == QDialog::Accepted )
  8.1165  		{
  8.1166 -			saveState("setVymLink (\""+bo->getVymLink()+"\")","setVymLink (\""+fd->selectedFile()+"\")",QString("Set vymlink of %1 to %2").arg(getName(bo)).arg(fd->selectedFile()));	
  8.1167 +			saveStateConstSelection("setVymLink (\""+bo->getVymLink()+"\")","setVymLink (\""+fd->selectedFile()+"\")",QString("Set vymlink of %1 to %2").arg(getName(bo)).arg(fd->selectedFile()));	
  8.1168  			bo->setVymLink (fd->selectedFile() );
  8.1169  			updateActions();
  8.1170  			mapCenter->reposition();
  8.1171 @@ -2397,7 +2406,7 @@
  8.1172  			typeid(*selection) == typeid(MapCenterObj)) )
  8.1173  	{		
  8.1174  		BranchObj *bo=(BranchObj*)selection;
  8.1175 -		saveState("setVymLink (\""+bo->getVymLink()+"\")","setVymLink (\"\")",QString("Unset vymlink of %1").arg(getName(bo)));	
  8.1176 +		saveStateConstSelection("setVymLink (\""+bo->getVymLink()+"\")","setVymLink (\"\")",QString("Unset vymlink of %1").arg(getName(bo)));	
  8.1177  		bo->setVymLink ("" );
  8.1178  		updateActions();
  8.1179  		mapCenter->reposition();
  8.1180 @@ -2425,7 +2434,7 @@
  8.1181  			oo->setHideInExport(true);
  8.1182  			s="Set";
  8.1183  		}	
  8.1184 -		saveState(QString ("%1 hide export flag of %2").arg(s).arg(getName(selection)));	//TODO undoCommand
  8.1185 +		saveStateComplete(QString ("%1 hide export flag of %2").arg(s).arg(getName(selection)));	//TODO undoCommand
  8.1186  		actionEditToggleHideExport->setOn (oo->hideInExport());	
  8.1187  		updateActions();
  8.1188  		mapCenter->reposition();
  8.1189 @@ -2453,9 +2462,9 @@
  8.1190  		BranchObj* par=(BranchObj*)(bo->getParObj());
  8.1191  		QString s=QString("Remove %1 and keep its childs").arg(getName(bo));
  8.1192  		if (bo->getDepth()==1)
  8.1193 -			saveState(s);
  8.1194 +			saveStateComplete(s);
  8.1195  		else	
  8.1196 -			saveState(selection->getParObj(),s);	// TODO undoCommand
  8.1197 +			saveStatePart(selection->getParObj(),s);	// TODO undoCommand
  8.1198  		QString sel=selection->getSelectString();
  8.1199  		unselect();
  8.1200  		par->removeBranchHere(bo);
  8.1201 @@ -2468,7 +2477,7 @@
  8.1202  {
  8.1203  	if (selection && (typeid(*selection) == typeid(BranchObj) ))
  8.1204  	{		
  8.1205 -		saveState(selection->getParObj(), QString("Remove childs of branch %1").arg(getName(selection)));
  8.1206 +		saveStatePart(selection->getParObj(), QString("Remove childs of branch %1").arg(getName(selection)));
  8.1207  		((BranchObj*)selection)->removeChilds();
  8.1208  		mapCenter->reposition();
  8.1209  	}	
  8.1210 @@ -2512,7 +2521,7 @@
  8.1211  	// Finally show dialog
  8.1212  	if (dia.exec() == QDialog::Accepted)
  8.1213  	{
  8.1214 -		saveState("Edit info about map");	//TODO undoCommand
  8.1215 +		saveStateComplete("Edit info about map");	//TODO undoCommand
  8.1216  		mapCenter->setAuthor (dia.getAuthor() );
  8.1217  		mapCenter->setComment (dia.getComment() );
  8.1218  	}
  8.1219 @@ -2550,8 +2559,16 @@
  8.1220      pix.fill( defLinkColor );
  8.1221      actionFormatLinkColor->setIconSet( pix );
  8.1222  
  8.1223 -	actionEditUndo->setEnabled( mapChanged );
  8.1224  	actionFileSave->setEnabled( mapUnsaved );
  8.1225 +	if (undoSet.readNumEntry("/history/undosAvail",0)>0)
  8.1226 +		actionEditUndo->setEnabled( true);
  8.1227 +	else	
  8.1228 +		actionEditUndo->setEnabled( false);
  8.1229 +
  8.1230 +	if (undoSet.readNumEntry("/history/redosAvail",0)>0)
  8.1231 +		actionEditRedo->setEnabled( true);
  8.1232 +	else	
  8.1233 +		actionEditRedo->setEnabled( false);
  8.1234  
  8.1235  	if (selection)
  8.1236  	{
  8.1237 @@ -2710,7 +2727,7 @@
  8.1238  {
  8.1239  	linkstyle=ls;
  8.1240  
  8.1241 -	saveState("Set link style");	// TODO undoCommand
  8.1242 +	saveStateComplete("Set link style");	// TODO undoCommand
  8.1243  	BranchObj *bo;
  8.1244  	bo=mapCenter->first();
  8.1245  	bo=bo->next();
  8.1246 @@ -2798,13 +2815,10 @@
  8.1247  
  8.1248  void MapEditor::selectLinkColor()
  8.1249  {
  8.1250 -	// Finish open lineEdits
  8.1251 -	if (lineedit) finishedLineEdit();
  8.1252 -
  8.1253  	QColor col = QColorDialog::getColor( defLinkColor, this );
  8.1254  	if ( !col.isValid() ) return;
  8.1255  	setLinkColor( col );
  8.1256 -	saveState(QString("Set link color to %1").arg(col.name()));	//TODO undoCommand
  8.1257 +	saveStateComplete(QString("Set link color to %1").arg(col.name()));	//TODO undoCommand
  8.1258  
  8.1259  }
  8.1260  
  8.1261 @@ -2820,7 +2834,7 @@
  8.1262  			s="Unscroll";
  8.1263  		else	
  8.1264  			s="Scroll";
  8.1265 -		saveState(selection, QString ("%1 %2").arg(s).arg(getName(bo)));
  8.1266 +		saveStatePart(selection, QString ("%1 %2").arg(s).arg(getName(bo)));
  8.1267  		bo->toggleScroll();
  8.1268  		adjustCanvasSize();
  8.1269  		canvas()->update();
  8.1270 @@ -2860,7 +2874,7 @@
  8.1271  		QString fn;
  8.1272  		if ( fd->exec() == QDialog::Accepted )
  8.1273  		{
  8.1274 -			saveState(selection, QString("Add floatimage to %1").arg(getName(selection)));
  8.1275 +			saveStatePart(selection, QString("Add floatimage to %1").arg(getName(selection)));
  8.1276  			// FIXME in QT4 use:	lastImageDir=fd->directory();
  8.1277  			lastImageDir=QDir (fd->dirPath());
  8.1278  			QStringList flist = fd->selectedFiles();
  8.1279 @@ -2968,7 +2982,7 @@
  8.1280  		selection->setHideLinkUnselected(b);
  8.1281  }
  8.1282  
  8.1283 -void MapEditor::importDir(BranchObj *dst, QDir d)
  8.1284 +void MapEditor::importDirInt(BranchObj *dst, QDir d)
  8.1285  {
  8.1286  	if (selection && 
  8.1287  		(typeid(*selection) == typeid(BranchObj)) || 
  8.1288 @@ -2996,7 +3010,7 @@
  8.1289  				else 
  8.1290  				{
  8.1291  					// Recursively add subdirs
  8.1292 -					importDir (bo,d);
  8.1293 +					importDirInt (bo,d);
  8.1294  					d.cdUp();
  8.1295  				}
  8.1296  			}	
  8.1297 @@ -3034,7 +3048,7 @@
  8.1298  		if ( fd->exec() == QDialog::Accepted )
  8.1299  		{
  8.1300  			BranchObj *bo=((BranchObj*)selection);
  8.1301 -			importDir (bo,QDir(fd->selectedFile()) );
  8.1302 +			importDirInt (bo,QDir(fd->selectedFile()) );
  8.1303  			mapCenter->reposition();
  8.1304  			adjustCanvasSize();
  8.1305  			canvas()->update();
  8.1306 @@ -3061,7 +3075,7 @@
  8.1307  
  8.1308  void MapEditor::editXLink(int i)
  8.1309  {
  8.1310 -	qDebug ("ko.");
  8.1311 +	qDebug ("ko.");  //FIXME Huh?
  8.1312  	if (selection && 
  8.1313  		(typeid(*selection) == typeid(BranchObj)) || 
  8.1314  		(typeid(*selection) == typeid(MapCenterObj))  )
  8.1315 @@ -3081,7 +3095,7 @@
  8.1316  				}
  8.1317  				if (dia.deleteXLink())
  8.1318  					((BranchObj*)selection)->deleteXLinkAt(i);
  8.1319 -				saveState("Edit xLink");	//TODO undoCommand
  8.1320 +				saveStateComplete("Edit xLink");	//TODO undoCommand
  8.1321  			}
  8.1322  		}	
  8.1323  	}
  8.1324 @@ -3091,32 +3105,43 @@
  8.1325  {
  8.1326  	cout << "MapEditor::testFunction() called\n";
  8.1327  
  8.1328 -	mapCenter->positionBBox();
  8.1329 +/*
  8.1330 +	bool ok;
  8.1331 +	QString text = QInputDialog::getText(
  8.1332 +		this, 
  8.1333 +		tr("QInputDialog::getText()"),
  8.1334 +		 tr("User name:"), QLineEdit::Normal,
  8.1335 +		 QDir::home().dirName(), &ok, Qt::FramelessWindowHint);
  8.1336 +*/
  8.1337 +
  8.1338 +	QDialog *d =new QDialog(NULL);
  8.1339 +	QLineEdit *le=new QLineEdit (d);
  8.1340 +//	d->setModal (true);
  8.1341 +	d->setWindowFlags (Qt::FramelessWindowHint);
  8.1342 +	le->setFocus();
  8.1343 +	le->setText ("Foo");
  8.1344 +	le->selectAll();
  8.1345 +	connect (le, SIGNAL (returnPressed()), d, SLOT (accept()));
  8.1346 +	d->exec();
  8.1347 +	qWarning( le->text());
  8.1348  	return;
  8.1349 -
  8.1350 +	
  8.1351 +
  8.1352 +
  8.1353 +/*
  8.1354  	WarningDialog dia;
  8.1355  	dia.setCancelButton (true);
  8.1356  	dia.setText("This is a longer \nWarning");
  8.1357  	dia.setCaption("Warning: Flux problem");
  8.1358  	dia.setShowAgainName("/warnings/mapeditor");
  8.1359 +	dia.setWindowFlags (Qt::FramelessWindowHint);
  8.1360  	if (dia.exec()==QDialog::Accepted)
  8.1361  		cout << "accepted!\n";
  8.1362  	else	
  8.1363  		cout << "canceled!\n";
  8.1364  	return;
  8.1365 -
  8.1366 -	QString ub=vymBaseDir.path()+"/scripts/update-bookmarks";
  8.1367 -
  8.1368 -	QProcess *proc= new QProcess (this);
  8.1369 -	proc->start( ub);
  8.1370 -	if (!proc->waitForStarted());
  8.1371 -	{
  8.1372 -		QMessageBox::warning(0, 
  8.1373 -			tr("Warning"),
  8.1374 -			tr("Couldn't find script %1\nto notifiy Browsers of changed bookmarks.").arg(ub));
  8.1375 -	}	
  8.1376 -
  8.1377 -	
  8.1378 +*/
  8.1379 +
  8.1380  /* Hide hidden stuff temporary, maybe add this as regular function somewhere
  8.1381  	if (hidemode==HideNone)
  8.1382  	{
  8.1383 @@ -3222,9 +3247,6 @@
  8.1384  		return;
  8.1385  	}
  8.1386  
  8.1387 -	// Finish open lineEdits
  8.1388 -	if (lineedit) finishedLineEdit();
  8.1389 -	
  8.1390      QPoint p = inverseWorldMatrix().map(e->pos());
  8.1391      LinkableMapObj* lmo=mapCenter->findMapObj(p, NULL);
  8.1392  	
  8.1393 @@ -3239,7 +3261,7 @@
  8.1394  		if (!foname.isEmpty())
  8.1395  		{
  8.1396  			// systemFlag clicked
  8.1397 -			select (lmo);
  8.1398 +			selectInt (lmo);
  8.1399  			if (foname=="url") 
  8.1400  			{
  8.1401  				if (e->state() & Qt::ControlModifier)
  8.1402 @@ -3297,7 +3319,7 @@
  8.1403  	}
  8.1404      if (lmo) 
  8.1405  	{	
  8.1406 -		select (lmo);
  8.1407 +		selectInt (lmo);
  8.1408  		// Left Button	    Move Branches
  8.1409  		if (e->button() == Qt::LeftButton )
  8.1410  		{
  8.1411 @@ -3370,7 +3392,7 @@
  8.1412  		if (typeid(*selection) == typeid(FloatImageObj))
  8.1413  		{
  8.1414  			FloatObj *fo=(FloatObj*)selection;
  8.1415 -			saveState(
  8.1416 +			saveStateConstSelection(
  8.1417  				"move "+qpointToString(movingObj_orgPos),fo->getSelectString() ,
  8.1418  				QString("Move %1").arg(getName(selection)));
  8.1419  			fo->move   (p.x() -movingObj_start.x(), p.y()-movingObj_start.y() );		
  8.1420 @@ -3387,7 +3409,8 @@
  8.1421  			{
  8.1422  				if (typeid(*fo) == typeid(FloatImageObj)) 
  8.1423  				{
  8.1424 -					saveState(QString("Relink %1 to %2").arg(getName(fo)).arg(getName(lmo) ) );
  8.1425 +					//TODO undocom
  8.1426 +					saveStateComplete(QString("Relink %1 to %2").arg(getName(fo)).arg(getName(lmo) ) );
  8.1427  					FloatImageObj *fio=(FloatImageObj*)(fo);
  8.1428  					((BranchObj*)(lmo))->addFloatImage (fio);
  8.1429  					fio->unselect();
  8.1430 @@ -3513,7 +3536,7 @@
  8.1431  			tmpXLink->setEnd ( ((BranchObj*)(dst)) );
  8.1432  			tmpXLink->updateXLink();
  8.1433  			tmpXLink->activate();
  8.1434 -			saveState(QString("Activate xLink from %1 to %2").arg(getName(tmpXLink->getBegin())).arg(getName(tmpXLink->getEnd())) );	//TODO undoCommand
  8.1435 +			saveStateComplete(QString("Activate xLink from %1 to %2").arg(getName(tmpXLink->getBegin())).arg(getName(tmpXLink->getEnd())) );	//TODO undoCommand
  8.1436  		} else
  8.1437  		{
  8.1438  			delete(tmpXLink);
  8.1439 @@ -3578,11 +3601,11 @@
  8.1440  					if (dst->getDepth()==0) 
  8.1441  						bs->move (savePos);
  8.1442  				} 
  8.1443 -				saveState (undoCom,bs->getSelectString(),QString("Relink %1 to %2").arg(getName(bs)).arg(getName(dst)) );
  8.1444 +				saveStateConstSelection (undoCom,bs->getSelectString(),QString("Relink %1 to %2").arg(getName(bs)).arg(getName(dst)) );
  8.1445  			} else
  8.1446  				if (selection->getDepth()==1)
  8.1447  					// If we have moved mainbranch only save endposition
  8.1448 -					saveState("move "+qpointToString(movingObj_orgPos), selection->getSelectString(), QString("Move %1 to %2").arg(getName(selection)).arg(qpointToString(movingObj_orgPos)));
  8.1449 +					saveStateConstSelection("move "+qpointToString(movingObj_orgPos), selection->getSelectString(), QString("Move %1 to %2").arg(getName(selection)).arg(qpointToString(movingObj_orgPos)));
  8.1450  			
  8.1451  			// Draw the original link, before selection was moved around
  8.1452  			mapCenter->reposition();
  8.1453 @@ -3599,9 +3622,6 @@
  8.1454  
  8.1455  void MapEditor::contentsMouseDoubleClickEvent(QMouseEvent* e)
  8.1456  {
  8.1457 -	// Finish open lineEdits
  8.1458 -	if (lineedit) finishedLineEdit();
  8.1459 -	
  8.1460  	if (e->button() == Qt::LeftButton )
  8.1461  	{
  8.1462  		QPoint p = inverseWorldMatrix().map(e->pos());
  8.1463 @@ -3782,7 +3802,7 @@
  8.1464  		if (update) 
  8.1465  		{
  8.1466  			//FIXME saveState has to be called earlier for each of the drops...
  8.1467 -			saveState("Drop Event");	//TODO undo Command
  8.1468 +			saveStateComplete("Drop Event");	//TODO undo Command
  8.1469  			mapCenter->reposition();
  8.1470  			adjustCanvasSize();
  8.1471  			canvas()->update();
  8.1472 @@ -3797,7 +3817,7 @@
  8.1473        (typeid(*selection) == typeid(MapCenterObj))  )
  8.1474    {
  8.1475      BranchObj *bo=((BranchObj*)selection);
  8.1476 -    saveState(selection,QString("Add floatimage to %1").arg(getName(bo)));
  8.1477 +    saveStatePart(selection,QString("Add floatimage to %1").arg(getName(bo)));
  8.1478      //QString fn=fd->selectedFile();
  8.1479      //lastImageDir=fn.left(fn.findRev ("/"));
  8.1480      bo->addFloatImage();
     9.1 --- a/mapeditor.h	Tue Aug 15 12:01:14 2006 +0000
     9.2 +++ b/mapeditor.h	Tue Aug 29 08:31:42 2006 +0000
     9.3 @@ -2,23 +2,24 @@
     9.4  #define MAPEDITOR_H
     9.5  
     9.6  #include <q3canvas.h>
     9.7 -#include <qlineedit.h>
     9.8 -#include <qcursor.h>
     9.9 -#include <q3filedialog.h>
    9.10 -#include <qevent.h>
    9.11 -#include <q3process.h>
    9.12 +#include <QCursor>
    9.13 +//#include <q3filedialog.h>
    9.14 +#include <QEvent>
    9.15 +//#include <q3process.h>
    9.16  #include <qbuffer.h>
    9.17 -//Added by qt3to4:
    9.18 +#include <QDragEnterEvent>
    9.19  #include <QContextMenuEvent>
    9.20  #include <QDropEvent>
    9.21 +#include <QLineEdit>
    9.22 +#include <QMouseEvent>
    9.23 +#include <QPixmap>
    9.24  #include <QResizeEvent>
    9.25 -#include <QPixmap>
    9.26 -#include <QMouseEvent>
    9.27 -#include <QDragEnterEvent>
    9.28  
    9.29  #include "mapcenterobj.h"
    9.30  #include "file.h"
    9.31  #include "misc.h"
    9.32 +#include "selection.h"
    9.33 +#include "settings.h"
    9.34  #include "showtextdialog.h"
    9.35  
    9.36  class Q3NetworkOperation;
    9.37 @@ -41,17 +42,16 @@
    9.38  	QString getName(LinkableMapObj*);	// Get e.g. heading or filename
    9.39  	void makeTmpDirs();		// create temporary directories
    9.40      QString saveToDir(const QString&,const QString &,bool, const QPoint &,LinkableMapObj*);
    9.41 -    void saveState(const QString &);	// save actual state to backup
    9.42 -    void saveState(LinkableMapObj *, const QString &);
    9.43 -    void saveState(const QString &, const QString &, const QString &);
    9.44 -    void saveState(const QString &, LinkableMapObj *, const QString &);
    9.45 +    void saveStateComplete       (const QString &);					
    9.46 +    void saveStatePart           (LinkableMapObj *, const QString &);
    9.47 +    void saveStateConstSelection (const QString &, const QString &, const QString &);
    9.48 +    void saveStateX				 (LinkableMapObj *, const QString &, const QString &);
    9.49      void saveState(const SaveMode&, const QString &, LinkableMapObj *, const QString &, LinkableMapObj *, const QString &);
    9.50      void parseAtom(const QString &);	
    9.51  
    9.52      void addFloatImage(const QPixmap &img);
    9.53  
    9.54    private slots:
    9.55 -    void finishedLineEdit();
    9.56      void fetchImage(const QString &img);
    9.57      void imageDataFetched(const QByteArray &, Q3NetworkOperation *);
    9.58      void imageDataFinished(Q3NetworkOperation *);
    9.59 @@ -99,11 +99,13 @@
    9.60      void move(const int &,const int&);
    9.61      void moveBranchUp();
    9.62      void moveBranchDown();
    9.63 -    void editHeading();					// Start editing heading 
    9.64 +    void editHeading();						// Start editing heading 
    9.65 +	QString getHeading (bool &,QPoint &);	// Get heading, ok if selection is branch
    9.66 +	void setHeading(const QString &);
    9.67  private:
    9.68 -	void setHeading(const QString &);	// Just set the heading for selection
    9.69 -	void setURL(const QString &);		// Just set the URL for selection
    9.70 -	void setVymLink(const QString &);	// Set vymLink for selection
    9.71 +	void setHeadingInt(const QString &);
    9.72 +	void setURLInt(const QString &);		// Just set the URL for selection
    9.73 +	void setVymLinkInt(const QString &);	// Set vymLink for selection
    9.74  public:	
    9.75      void addNewBranch(int);			// pos allows to add above/below selection
    9.76      void addNewBranchHere();		// insert and make selection its
    9.77 @@ -113,9 +115,9 @@
    9.78  	void reselect();				// after  changing current noteedit
    9.79  	bool select(const QString &);	// Select 
    9.80  private:	
    9.81 -	void select(LinkableMapObj*);	
    9.82 -	void selectNextBranch();		// Increment number of branch
    9.83 -	void selectPrevBranch();		// Decrement number of branch
    9.84 +	void selectInt(LinkableMapObj*);	
    9.85 +	void selectNextBranchInt();		// Increment number of branch
    9.86 +	void selectPrevBranchInt();		// Decrement number of branch
    9.87  public:	
    9.88      void selectUpperBranch();
    9.89      void selectLowerBranch();
    9.90 @@ -170,7 +172,7 @@
    9.91  	void setHideLinkUnselected (bool);
    9.92  	bool getHideLinkUnselected ();
    9.93  private:	
    9.94 -    void importDir(BranchObj *,QDir);
    9.95 +    void importDirInt(BranchObj *,QDir);
    9.96  public:	
    9.97      void importDir();
    9.98  	void followXLink (int);
    9.99 @@ -194,7 +196,6 @@
   9.100  
   9.101  	bool adjustCanvasRequested;	// collect requests until end of user event
   9.102  	BranchObj *editingBO;		// entering Text into BO
   9.103 -    QLineEdit* lineedit;
   9.104  
   9.105      QColor actColor;			// actual color
   9.106  	QColor defLinkColor;		// default color for links
   9.107 @@ -209,7 +210,8 @@
   9.108  	bool drawingLink;			// true while creating a link
   9.109  	bool copyingObj;			// true while creating a link
   9.110  	XLinkObj* tmpXLink;
   9.111 -	
   9.112 +
   9.113 +	Selection xelection;
   9.114      LinkableMapObj* selection;		// select a LinkableMapObj
   9.115      LinkableMapObj* selectionLast;	// last selection 
   9.116      MapObj* movingObj;				// moving a MapObj
   9.117 @@ -238,9 +240,9 @@
   9.118  
   9.119  	bool isInteractive;			// non interactive don't need tmpdirs
   9.120  	QString tmpMapDir;			// tmp directory with data for undo/redo
   9.121 +	QString histPath;			// Path to history file
   9.122  	int undosTotal;				// total number of undos 
   9.123 -	int undoNum;				// current number of bakMapDir to be used 
   9.124 -	int undosAvail;				// how many actions can currently be undone
   9.125 +	SimpleSettings undoSet;		// undo/redo commands
   9.126  	bool blockReposition;		// block while load or undo
   9.127  	bool blockSaveState;		// block while load or undo
   9.128  
    10.1 --- a/ornamentedobj.cpp	Tue Aug 15 12:01:14 2006 +0000
    10.2 +++ b/ornamentedobj.cpp	Tue Aug 29 08:31:42 2006 +0000
    10.3 @@ -281,6 +281,15 @@
    10.4  	forceReposition();
    10.5  }
    10.6  
    10.7 +void OrnamentedObj::deactivateStandardFlag(QString f)
    10.8 +{
    10.9 +	standardFlags->deactivate(f);
   10.10 +	calcBBoxSize();
   10.11 +	positionBBox();
   10.12 +	move (absPos.x(), absPos.y() );
   10.13 +	forceReposition();
   10.14 +}
   10.15 +
   10.16  bool OrnamentedObj::isSetStandardFlag (QString f)
   10.17  {
   10.18  	return standardFlags->isActive(f);
    11.1 --- a/ornamentedobj.h	Tue Aug 15 12:01:14 2006 +0000
    11.2 +++ b/ornamentedobj.h	Tue Aug 29 08:31:42 2006 +0000
    11.3 @@ -35,6 +35,7 @@
    11.4  
    11.5  	virtual void toggleStandardFlag(QString, bool);
    11.6  	virtual void activateStandardFlag(QString);
    11.7 +	virtual void deactivateStandardFlag(QString);
    11.8  	virtual bool isSetStandardFlag(QString);
    11.9  	virtual QString getSystemFlagName (const QPoint &p);
   11.10  	virtual bool isActiveFlag(const QString&);	// check if flag is set
    12.1 --- a/selection.cpp	Tue Aug 15 12:01:14 2006 +0000
    12.2 +++ b/selection.cpp	Tue Aug 29 08:31:42 2006 +0000
    12.3 @@ -5,21 +5,19 @@
    12.4  {
    12.5  }
    12.6  
    12.7 -Selection::Selection(const Selection &other)
    12.8 -{
    12.9 -}
   12.10 -
   12.11  Selection::~Selection()
   12.12  {
   12.13  }
   12.14  
   12.15 -void Selection::init()
   12.16 +void Selection::setMapCenter(MapCenterObj *mco)
   12.17  {
   12.18 -	selectList.setAutoDelete(true);
   12.19 +	mapCenter=mco;
   12.20  }
   12.21  
   12.22  void Selection::copy(const Selection &other)
   12.23  {
   12.24 +	mapCenter=other.mapCenter;
   12.25 +	selectList=other.selectList;
   12.26  }
   12.27  
   12.28  void Selection::clear()
   12.29 @@ -29,11 +27,29 @@
   12.30  
   12.31  bool Selection::select(LinkableMapObj *lmo)
   12.32  {
   12.33 +	clear();
   12.34 +	selectList.append (lmo);
   12.35  	return false;
   12.36  }
   12.37  
   12.38 -void Selection::unselect(LinkableMapObj *lmo)
   12.39 +bool Selection::select (const QString &s)
   12.40  {
   12.41 +	LinkableMapObj *lmo=mapCenter->findObjBySelect(s);
   12.42 +
   12.43 +	// Finally select the found object
   12.44 +	if (lmo)
   12.45 +	{
   12.46 +		clear();
   12.47 +		select (lmo);
   12.48 +		return true;
   12.49 +	} 
   12.50 +	return false;
   12.51 +
   12.52 +}
   12.53 +
   12.54 +void Selection::unselect()
   12.55 +{
   12.56 +	clear();
   12.57  }
   12.58  
   12.59  bool Selection::isEmpty()
   12.60 @@ -45,3 +61,14 @@
   12.61  {
   12.62  	return selectList.count();
   12.63  }
   12.64 +
   12.65 +QString Selection::getSelectString()
   12.66 +{
   12.67 +	// TODO multiselection (maybe separated by ";")
   12.68 +	if (selectList.count()==1)
   12.69 +		return selectList.first()->getSelectString();
   12.70 +	else
   12.71 +		return"";
   12.72 +}
   12.73 +
   12.74 +
    13.1 --- a/selection.h	Tue Aug 15 12:01:14 2006 +0000
    13.2 +++ b/selection.h	Tue Aug 29 08:31:42 2006 +0000
    13.3 @@ -1,26 +1,32 @@
    13.4 -#ifndef SELECTIONOBJ_H
    13.5 -#define SELECTIONOBJ_H
    13.6 +#ifndef SELECTION_H
    13.7 +#define SELECTION_H
    13.8 +
    13.9 +#include <q3ptrlist.h>
   13.10  
   13.11  #include "linkablemapobj.h"
   13.12 -#include <q3ptrlist.h>
   13.13 +#include "mapcenterobj.h"
   13.14  
   13.15  class Selection 
   13.16  {
   13.17  public:
   13.18  	Selection ();
   13.19 -	Selection (const Selection&);
   13.20  	~Selection();
   13.21 -	void init();
   13.22  	void copy(const Selection&);
   13.23  	void clear();
   13.24 +	void setMapCenter (MapCenterObj *);
   13.25  	
   13.26  	bool select (LinkableMapObj*);
   13.27 -	void unselect (LinkableMapObj*);
   13.28 +	bool select (const QString &);
   13.29 +	void unselect ();
   13.30  	bool isEmpty();
   13.31  	uint count();
   13.32  
   13.33 +	QString getSelectString();
   13.34 +
   13.35  private:
   13.36 -	Q3PtrList <LinkableMapObj> selectList;
   13.37 +	void init();
   13.38 +	QList <LinkableMapObj*> selectList;
   13.39 +	MapCenterObj *mapCenter;
   13.40  };
   13.41  #endif
   13.42  
    14.1 --- a/settings.cpp	Tue Aug 15 12:01:14 2006 +0000
    14.2 +++ b/settings.cpp	Tue Aug 29 08:31:42 2006 +0000
    14.3 @@ -61,6 +61,7 @@
    14.4  		qWarning ("SimpleSettings::writeSettings() Couldn't write "+path);
    14.5  }
    14.6  
    14.7 +/*
    14.8  QString SimpleSettings::readEntry (const QString &key)
    14.9  {
   14.10  	QStringList::Iterator itk=keylist.begin();
   14.11 @@ -77,6 +78,46 @@
   14.12  	qWarning ("SimpleSettings::readEntry()  Couldn't find key "+key);
   14.13  	return "";
   14.14  }
   14.15 +*/
   14.16 +
   14.17 +QString SimpleSettings::readEntry (const QString &key, const QString &def)
   14.18 +{
   14.19 +	QStringList::Iterator itk=keylist.begin();
   14.20 +	QStringList::Iterator itv=valuelist.begin();
   14.21 +
   14.22 +	// First search for value in settings saved in map
   14.23 +	while (itk !=keylist.end() )
   14.24 +	{
   14.25 +		if (*itk == key)
   14.26 +			return *itv;
   14.27 +		itk++;
   14.28 +		itv++;
   14.29 +	}
   14.30 +	return def;
   14.31 +}
   14.32 +
   14.33 +int SimpleSettings::readNumEntry (const QString &key, int def)
   14.34 +{
   14.35 +	QStringList::Iterator itk=keylist.begin();
   14.36 +	QStringList::Iterator itv=valuelist.begin();
   14.37 +
   14.38 +	// First search for value in settings saved in map
   14.39 +	while (itk !=keylist.end() )
   14.40 +	{
   14.41 +		if (*itk == key)
   14.42 +		{
   14.43 +			bool ok;
   14.44 +			int i=(*itv).toInt(&ok,10);
   14.45 +			if (ok)
   14.46 +				return i;
   14.47 +			else
   14.48 +				return def;
   14.49 +		}	
   14.50 +		itk++;
   14.51 +		itv++;
   14.52 +	}
   14.53 +	return def;
   14.54 +}
   14.55  
   14.56  void SimpleSettings::setEntry (const QString &key, const QString &value)
   14.57  {
    15.1 --- a/settings.h	Tue Aug 15 12:01:14 2006 +0000
    15.2 +++ b/settings.h	Tue Aug 29 08:31:42 2006 +0000
    15.3 @@ -18,7 +18,8 @@
    15.4  	void clear();
    15.5  	void readSettings(const QString &);
    15.6  	void writeSettings(const QString &);
    15.7 -	QString readEntry (const QString &);
    15.8 +	QString readEntry (const QString &key, const QString &def=QString());
    15.9 +	int readNumEntry (const QString &, int=0);
   15.10  	void setEntry (const QString &,const QString &);
   15.11  private:	
   15.12  	QStringList keylist;
    16.1 --- a/version.h	Tue Aug 15 12:01:14 2006 +0000
    16.2 +++ b/version.h	Tue Aug 29 08:31:42 2006 +0000
    16.3 @@ -2,7 +2,7 @@
    16.4  #define VERSION_H
    16.5  
    16.6  #define __VYM "VYM"
    16.7 -#define __VYM_VERSION "1.8.52"
    16.8 -#define __BUILD_DATE "August 15, 2006"
    16.9 +#define __VYM_VERSION "1.8.53"
   16.10 +#define __BUILD_DATE "August 23, 2006"
   16.11  
   16.12  #endif