Moved the qt4-port branch to HEAD
authorinsilmaril
Tue Sep 05 09:47:14 2006 +0000 (2006-09-05)
changeset 366e95081c21da2
parent 365 1cc73bd7ee1f
child 367 b1e3a4d88f13
Moved the qt4-port branch to HEAD
exportoofiledialog.h
exports.cpp
file.cpp
file.h
flagobj.cpp
flagobj.h
flagrowobj.cpp
flagrowobj.h
floatimageobj.cpp
floatimageobj.h
floatobj.cpp
floatobj.h
frameobj.cpp
frameobj.h
headingobj.cpp
headingobj.h
imageobj.cpp
imageobj.h
imports.cpp
linkablemapobj.cpp
linkablemapobj.h
main.cpp
mainwindow.cpp
mainwindow.h
mapeditor.cpp
mapeditor.h
mapobj.cpp
mapobj.h
misc.cpp
options.cpp
options.h
ornamentedobj.cpp
ornamentedobj.h
process.h
settings.cpp
settings.h
texteditor.cpp
texteditor.h
version.h
vym.pro
warningdialog.ui.h
xlinkobj.cpp
xlinkobj.h
xml.cpp
     1.1 --- a/exportoofiledialog.h	Tue Sep 05 09:47:13 2006 +0000
     1.2 +++ b/exportoofiledialog.h	Tue Sep 05 09:47:14 2006 +0000
     1.3 @@ -1,8 +1,8 @@
     1.4  #ifndef EXPORTOOFILEDIALOG
     1.5  #define EXPORTOOFILEDIALOG
     1.6  
     1.7 -#include <qfiledialog.h>
     1.8 -#include <qstringlist.h>
     1.9 +#include <QFileDialog>
    1.10 +#include <QStringList>
    1.11  
    1.12  #include "settings.h"
    1.13  
    1.14 @@ -12,18 +12,18 @@
    1.15  public:
    1.16  	ExportOOFileDialog();
    1.17  
    1.18 -	ExportOOFileDialog (QWidget * parent = 0, const char * name = 0, bool
    1.19 -	modal = false);
    1.20 +	ExportOOFileDialog (QWidget * parent = 0, const  QString &caption=QString());
    1.21  	bool foundConfig();
    1.22  	QString selectedConfig();
    1.23  	QString selectedFile();
    1.24 -	void addFilter(const QString &);
    1.25 +	void show();
    1.26  	 
    1.27  private slots:
    1.28  	void  newConfigPath (const QString&f);
    1.29  
    1.30  private:
    1.31  	void init();
    1.32 +	void addFilter(const QString &);
    1.33  	void scanExportConfigs(QDir );
    1.34  	QStringList configPaths;
    1.35  	QStringList filters;
     2.1 --- a/exports.cpp	Tue Sep 05 09:47:13 2006 +0000
     2.2 +++ b/exports.cpp	Tue Sep 05 09:47:14 2006 +0000
     2.3 @@ -1,6 +1,8 @@
     2.4 -#include <qfiledialog.h>
     2.5 +#include <q3filedialog.h>
     2.6  #include <qmessagebox.h>
     2.7 -#include <qprocess.h>
     2.8 +#include <QProcess>
     2.9 +//Added by qt3to4:
    2.10 +#include <QTextStream>
    2.11  
    2.12  #include "exports.h"
    2.13  #include "file.h"
    2.14 @@ -18,7 +20,10 @@
    2.15  {
    2.16  	indentPerDepth="  ";
    2.17  	// Create tmpdir
    2.18 -	tmpDir.setPath (makeUniqueDir("/tmp/vym-XXXXXX"));
    2.19 +	// FIXME not neededtmpDir.setPath (makeUniqueDir("/tmp/vym-XXXXXX"));
    2.20 +	if (!tmpDir.cd ("tmp"))
    2.21 +		qWarning ("Could not access temporary directory for export");
    2.22 +		// FIXME there's more needed here...
    2.23  }
    2.24  
    2.25  ExportBase::~ExportBase()
    2.26 @@ -57,7 +62,7 @@
    2.27  	if (mapCenter && mapCenter->getMapEditor())
    2.28  	{
    2.29  		QFileDialog *fd=new QFileDialog( mapCenter->getMapEditor(), caption);
    2.30 -		fd->addFilter (filter);
    2.31 +		fd->setFilter (filter);
    2.32  		fd->setCaption(caption);
    2.33  		fd->setMode( QFileDialog::AnyFile );
    2.34  		fd->show();
    2.35 @@ -71,7 +76,7 @@
    2.36  				QMessageBox::Warning,
    2.37  				QMessageBox::Yes | QMessageBox::Default,
    2.38  				QMessageBox::Cancel | QMessageBox::Escape,
    2.39 -				QMessageBox::NoButton );
    2.40 +				Qt::NoButton );
    2.41  				mb.setButtonText( QMessageBox::Yes, QObject::tr("Overwrite") );
    2.42  				mb.setButtonText( QMessageBox::No, QObject::tr("Cancel"));
    2.43  				ExportBase ex;
    2.44 @@ -116,9 +121,8 @@
    2.45  void ExportASCII::doExport()
    2.46  {
    2.47  	QFile file (outputFile);
    2.48 -	if ( !file.open( IO_WriteOnly ) )
    2.49 +	if ( !file.open( QIODevice::WriteOnly ) )
    2.50  	{
    2.51 -		// FIXME experimental, testing
    2.52  		qWarning ("ExportBase::exportXML  couldn't open "+outputFile);
    2.53  		return;
    2.54  	}
    2.55 @@ -127,8 +131,7 @@
    2.56  	// Main loop over all branches
    2.57  	QString s;
    2.58  	QString actIndent("");
    2.59 -	int i;
    2.60 -	uint j;
    2.61 +	int i,j;
    2.62  	BranchObj *bo;
    2.63  	bo=mapCenter->first();
    2.64  	while (bo) 
    2.65 @@ -184,17 +187,14 @@
    2.66  			p.process();
    2.67  
    2.68  			QString ub=vymBaseDir.path()+"/scripts/update-bookmarks";
    2.69 -			QProcess *proc = new QProcess( );
    2.70 -			proc->addArgument(ub);
    2.71 -
    2.72 -			if ( !proc->start() ) 
    2.73 +			QProcess *proc= new QProcess ();
    2.74 +			proc->start( ub);
    2.75 +			if (!proc->waitForStarted());
    2.76  			{
    2.77  				QMessageBox::warning(0, 
    2.78  					QObject::tr("Warning"),
    2.79  					QObject::tr("Couldn't find script %1\nto notifiy Browsers of changed bookmarks.").arg(ub));
    2.80  			}	
    2.81 -
    2.82 -
    2.83  		}
    2.84  	}
    2.85  
    2.86 @@ -248,8 +248,6 @@
    2.87  	if (me)
    2.88  	{
    2.89  		me->exportXML(tmpDir.path());
    2.90 -		//FIXME testing
    2.91 -		cout << "tmpDir="<<tmpDir.path()<<endl;
    2.92  
    2.93  		XSLTProc p;
    2.94  		p.setInputFile (tmpDir.path()+"/"+me->getMapName()+".xml");
    2.95 @@ -269,7 +267,7 @@
    2.96  	// it will not add a preamble, or anything 
    2.97  	// that makes a full LaTex document.
    2.98    QFile file (outputFile);
    2.99 -  if ( !file.open( IO_WriteOnly ) ) {
   2.100 +  if ( !file.open( QIODevice::WriteOnly ) ) {
   2.101  	QMessageBox::critical (0,QObject::tr("Critical Export Error"),QObject::tr("Could not write %1").arg(outputFile));
   2.102  	mainWindow->statusMessage(QString(QObject::tr("Export failed.")));
   2.103      return;
   2.104 @@ -405,7 +403,7 @@
   2.105  
   2.106  	// Write modified content
   2.107  	QFile f (contentFile);
   2.108 -    if ( !f.open( IO_WriteOnly ) ) 
   2.109 +    if ( !f.open( QIODevice::WriteOnly ) ) 
   2.110  	{
   2.111  		QMessageBox::critical (0,QObject::tr("Critical Export Error"),QObject::tr("Could not write %1").arg(contentFile));
   2.112  		mainWindow->statusMessage(QString(QObject::tr("Export failed.")));
     3.1 --- a/file.cpp	Tue Sep 05 09:47:13 2006 +0000
     3.2 +++ b/file.cpp	Tue Sep 05 09:47:14 2006 +0000
     3.3 @@ -1,5 +1,9 @@
     3.4  #include <qobject.h>
     3.5  #include <qmessagebox.h>
     3.6 +//Added by qt3to4:
     3.7 +#include <QPixmap>
     3.8 +#include <QLabel>
     3.9 +#include <QTextStream>
    3.10  #include <iostream>
    3.11  
    3.12  #include "file.h"
    3.13 @@ -45,8 +49,8 @@
    3.14  		}
    3.15  
    3.16  		// Now take care of paths where we have to go back first
    3.17 -		int srcsep=s.contains("/");
    3.18 -		int dstsep=d.contains("/");
    3.19 +		int srcsep=s.count("/");
    3.20 +		int dstsep=d.count("/");
    3.21  		if (srcsep <=  dstsep )
    3.22  		{
    3.23  			// find path to go up first and then back to dst
    3.24 @@ -61,11 +65,12 @@
    3.25  	return d;
    3.26  }
    3.27  
    3.28 -QString makeUniqueDir (QString s)
    3.29 +QString makeUniqueDir (bool &ok,QString s)
    3.30  {
    3.31  	// Create unique directory e.g. s="/tmp/vym-XXXXXX"
    3.32  
    3.33  	// Convert QString to string first
    3.34 +	ok=true;
    3.35  	char *p;
    3.36  	int bytes=s.length();
    3.37  	p=(char*) malloc (bytes+1);
    3.38 @@ -74,6 +79,7 @@
    3.39  		p[i]=s.at(i).latin1();
    3.40  	p[bytes]=0;	
    3.41  	QString r=mkdtemp (p);
    3.42 +	if (r.isEmpty()) ok=false;
    3.43  	free (p);
    3.44  	return r;
    3.45  }
    3.46 @@ -89,16 +95,16 @@
    3.47  
    3.48  	// Traverse directories
    3.49  	d.setFilter( QDir::Dirs| QDir::Hidden | QDir::NoSymLinks );
    3.50 -	const QFileInfoList *dirlist = d.entryInfoList();
    3.51 -	QFileInfoListIterator itdir( *dirlist );
    3.52 -	QFileInfo *fi;
    3.53 +	QFileInfoList list = d.entryInfoList();
    3.54 +	QFileInfo fi;
    3.55  
    3.56 -	while ( (fi = itdir.current()) != 0 ) 
    3.57 +	for (int i = 0; i < list.size(); ++i) 
    3.58  	{
    3.59 -		if (fi->fileName() != "." && fi->fileName() != ".." )
    3.60 +		fi=list.at(i);
    3.61 +		if (fi.fileName() != "." && fi.fileName() != ".." )
    3.62  		{
    3.63 -			if ( !d.cd(fi->fileName()) ) 
    3.64 -				qWarning ("removeDir() cannot find the directory "+fi->fileName());
    3.65 +			if ( !d.cd(fi.fileName()) ) 
    3.66 +				qWarning ("removeDir() cannot find the directory "+fi.fileName());
    3.67  			else 
    3.68  			{
    3.69  				// Recursively remove subdirs
    3.70 @@ -106,18 +112,16 @@
    3.71  				d.cdUp();
    3.72  			}
    3.73  		}	
    3.74 -		++itdir;
    3.75 -	}		
    3.76 +	}
    3.77 +
    3.78  	// Traverse files
    3.79  	d.setFilter( QDir::Files| QDir::Hidden | QDir::NoSymLinks );
    3.80 -	const QFileInfoList *filelist = d.entryInfoList();
    3.81 -	QFileInfoListIterator itfile( *filelist );
    3.82 +	list = d.entryInfoList();
    3.83  
    3.84 -	while ( (fi = itfile.current()) != 0 ) 
    3.85 +	for (int i = 0; i < list.size(); ++i) 
    3.86  	{
    3.87 -		QFile (fi->filePath()).remove();
    3.88 -		
    3.89 -		++itfile;
    3.90 +		fi=list.at(i);
    3.91 +		QFile (fi.filePath()).remove(); 
    3.92  	}	
    3.93  
    3.94  	if (!d.rmdir(d.path()))
    3.95 @@ -228,7 +232,7 @@
    3.96  {
    3.97  	s="";
    3.98  	QFile file ( fname);
    3.99 -	if ( !file.open( IO_ReadOnly ) ) return false;
   3.100 +	if ( !file.open( QIODevice::ReadOnly ) ) return false;
   3.101  
   3.102  	QTextStream ts( &file );
   3.103  	ts.setEncoding (QTextStream::UnicodeUTF8);
   3.104 @@ -243,7 +247,7 @@
   3.105  	QFile file( fname);
   3.106  
   3.107  	file.setName ( fname);
   3.108 -	if ( !file.open( IO_WriteOnly ) ) 
   3.109 +	if ( !file.open( QIODevice::WriteOnly ) ) 
   3.110  	{
   3.111  		file.close();
   3.112  		return false;
   3.113 @@ -260,10 +264,10 @@
   3.114  
   3.115  ImagePreview::ImagePreview (QWidget *par=0): QLabel (par)
   3.116  {
   3.117 -	fdia=(QFileDialog*)par;
   3.118 +	fdia=(Q3FileDialog*)par;
   3.119  }
   3.120  
   3.121 -void ImagePreview::previewUrl( const QUrl &u )
   3.122 +void ImagePreview::previewUrl( const Q3Url &u )
   3.123  {
   3.124      QString path = u.path();
   3.125      QPixmap pix( path );
   3.126 @@ -301,3 +305,39 @@
   3.127  	}	
   3.128  }
   3.129  
   3.130 +ImageIO::ImageIO ()
   3.131 +{
   3.132 +	// Create list with supported image types
   3.133 +	// foreach (QByteArray format, QImageWriter::supportedImageFormats()) 
   3.134 +	// imageTypes.append( tr("%1...").arg(QString(format).toUpper()));
   3.135 +	imageFilters.append ("Images (*.png *.jpg *.jpeg *.bmp *.bmp *.ppm *.xpm *.xbm)");
   3.136 +	imageTypes.append ("PNG");
   3.137 +	imageFilters.append ("Portable Network Graphics (*.png)");
   3.138 +	imageTypes.append ("PNG");
   3.139 +	imageFilters.append ("Joint Photographic Experts Group (*.jpg)");
   3.140 +	imageTypes.append ("JPG");
   3.141 +	imageFilters.append ("Joint Photographic Experts Group (*.jpeg)");
   3.142 +	imageTypes.append ("JPG");
   3.143 +	imageFilters.append ("Windows Bitmap (*.bmp)");
   3.144 +	imageTypes.append ("BMP");
   3.145 +	imageFilters.append ("Portable Pixmap (*.ppm)");
   3.146 +	imageTypes.append ("PPM");
   3.147 +	imageFilters.append ("X11 Bitmap (*.xpm)");
   3.148 +	imageTypes.append ("XPM");
   3.149 +	imageFilters.append ("X11 Bitmap (*.xbm)");
   3.150 +	imageTypes.append ("XBM");
   3.151 +}
   3.152 +
   3.153 +QStringList ImageIO::getFilters()
   3.154 +{
   3.155 +	return imageFilters;
   3.156 +}
   3.157 +
   3.158 +QString ImageIO::getType(QString filter)
   3.159 +{
   3.160 +	for (int i=0;i<imageFilters.count()+1;i++)
   3.161 +		if (imageFilters.at(i)==filter) return imageTypes.at(i);
   3.162 +	return QString();	
   3.163 +}
   3.164 +
   3.165 +
     4.1 --- a/file.h	Tue Sep 05 09:47:13 2006 +0000
     4.2 +++ b/file.h	Tue Sep 05 09:47:14 2006 +0000
     4.3 @@ -11,7 +11,7 @@
     4.4  /////////////////////////////////////////////////////////////////////////////
     4.5  QString maskPath (QString );
     4.6  QString convertToRel (const QString &,const QString &);
     4.7 -QString makeUniqueDir (QString);
     4.8 +QString makeUniqueDir (bool &,QString);
     4.9  void removeDir(QDir);
    4.10  void makeSubDirs (const QString &);
    4.11  ErrorCode zipDir (const QDir &,const QString&);
    4.12 @@ -21,16 +21,32 @@
    4.13  
    4.14  /////////////////////////////////////////////////////////////////////////////
    4.15  #include <qlabel.h>
    4.16 -#include <qfiledialog.h>
    4.17 +#include <q3filedialog.h>
    4.18  #include <qpixmap.h>
    4.19  
    4.20 -class ImagePreview : public QLabel, public QFilePreview
    4.21 +class ImagePreview : public QLabel, public Q3FilePreview
    4.22  {
    4.23  public:
    4.24      ImagePreview( QWidget * );
    4.25 -    void previewUrl( const QUrl & );
    4.26 +    void previewUrl( const Q3Url & );
    4.27  protected:
    4.28 -	QFileDialog *fdia;
    4.29 +	Q3FileDialog *fdia;
    4.30 +};
    4.31 +
    4.32 +
    4.33 +//////////////////////////////////////////////////////////
    4.34 +// Helper function to select image format while in SaveDialogs
    4.35 +
    4.36 +class ImageIO
    4.37 +{
    4.38 +public:
    4.39 +	ImageIO ();
    4.40 +	QStringList getFilters();
    4.41 +	QString getType ( QString );
    4.42 +
    4.43 +private:	
    4.44 +	QStringList imageFilters;
    4.45 +	QStringList imageTypes;
    4.46  };
    4.47  
    4.48  #endif
     5.1 --- a/flagobj.cpp	Tue Sep 05 09:47:13 2006 +0000
     5.2 +++ b/flagobj.cpp	Tue Sep 05 09:47:14 2006 +0000
     5.3 @@ -1,4 +1,6 @@
     5.4  #include "flagobj.h"
     5.5 +//Added by qt3to4:
     5.6 +#include <QPixmap>
     5.7  
     5.8  /////////////////////////////////////////////////////////////////
     5.9  // FlagObj
    5.10 @@ -9,7 +11,7 @@
    5.11      init ();
    5.12  }
    5.13  
    5.14 -FlagObj::FlagObj(QCanvas* c):MapObj(c) 
    5.15 +FlagObj::FlagObj(Q3Canvas* c):MapObj(c) 
    5.16  {
    5.17  //	cout << "Const FlagObj  canvas="<<c<<endl;
    5.18      init ();
    5.19 @@ -34,8 +36,8 @@
    5.20  
    5.21  	icon=new ImageObj (canvas);
    5.22  	icon->move (absPos.x(), absPos.y() );
    5.23 -	button=NULL;
    5.24  	state=false;
    5.25 +	action=NULL;
    5.26  }
    5.27  
    5.28  void FlagObj::copy (FlagObj* other)
    5.29 @@ -46,10 +48,8 @@
    5.30  	tooltip=other->tooltip;
    5.31  	state=other->state;
    5.32  	icon->copy(other->icon);
    5.33 +	action=other->action;
    5.34  	setVisibility (other->isVisibleObj() );
    5.35 -	// button is not copied, because
    5.36 -	// we won't copy to a parentRow and
    5.37 -	// all others don't need a button
    5.38  }
    5.39  
    5.40  void FlagObj::move(double x, double y)
    5.41 @@ -117,24 +117,21 @@
    5.42  	return tooltip;
    5.43  }
    5.44  
    5.45 -void FlagObj::setButton(QAction* b)
    5.46 -{
    5.47 -    button=b;
    5.48 -}
    5.49 -
    5.50 -void FlagObj::updateButton()
    5.51 -{
    5.52 -	if (button)
    5.53 -		button->setOn(state);
    5.54 -	else
    5.55 -		qWarning ("FlagObj::updateButton  no button defined");
    5.56 -}
    5.57 -
    5.58  QPixmap FlagObj::getPixmap()
    5.59  {
    5.60  	return icon->getPixmap();
    5.61  }
    5.62  
    5.63 +void FlagObj::setAction (QAction* a)
    5.64 +{
    5.65 +	action=a;
    5.66 +}
    5.67 +
    5.68 +void FlagObj::updateAction ()
    5.69 +{
    5.70 +	if (action) action->setChecked(state);
    5.71 +}
    5.72 +
    5.73  bool FlagObj::isActive()
    5.74  {
    5.75  	return state;
    5.76 @@ -170,12 +167,6 @@
    5.77  	}	
    5.78  }
    5.79  
    5.80 -void FlagObj::setEnabled(bool b)
    5.81 -{
    5.82 -	button->setEnabled (b);
    5.83 -}	
    5.84 -	
    5.85 -
    5.86  void FlagObj::setUsed (bool b)
    5.87  {
    5.88  	used=b;
     6.1 --- a/flagobj.h	Tue Sep 05 09:47:13 2006 +0000
     6.2 +++ b/flagobj.h	Tue Sep 05 09:47:14 2006 +0000
     6.3 @@ -2,8 +2,10 @@
     6.4  #define FLAGOBJ_H
     6.5  
     6.6  
     6.7 -#include <qcanvas.h>
     6.8 +#include <q3canvas.h>
     6.9  #include <qaction.h>
    6.10 +//Added by qt3to4:
    6.11 +#include <QPixmap>
    6.12  
    6.13  #include "mapobj.h"
    6.14  #include "imageobj.h"
    6.15 @@ -12,7 +14,7 @@
    6.16  class FlagObj:public MapObj {
    6.17  public:
    6.18      FlagObj ();
    6.19 -    FlagObj (QCanvas*);
    6.20 +    FlagObj (Q3Canvas*);
    6.21      FlagObj (FlagObj*);
    6.22      ~FlagObj ();
    6.23      virtual void init ();
    6.24 @@ -28,14 +30,13 @@
    6.25  	const QString getGroup();
    6.26  	void setToolTip(const QString&);
    6.27  	const QString getToolTip();
    6.28 -	void setButton (QAction*);
    6.29 -	void updateButton ();
    6.30  	QPixmap getPixmap();
    6.31 +	void setAction(QAction*);
    6.32 +	void updateAction ();
    6.33  	bool isActive();
    6.34  	void toggle();
    6.35  	void activate();
    6.36  	void deactivate();
    6.37 -	void setEnabled (bool);
    6.38  	void setUsed (bool);
    6.39  	bool isUsed();
    6.40  	void saveToDir (const QString&, const QString&);
    6.41 @@ -50,7 +51,7 @@
    6.42      virtual void calcBBoxSize();
    6.43  private:
    6.44  	ImageObj* icon;
    6.45 -	QAction* button;
    6.46 +	QAction* action;
    6.47  };
    6.48  
    6.49  #endif
     7.1 --- a/flagrowobj.cpp	Tue Sep 05 09:47:13 2006 +0000
     7.2 +++ b/flagrowobj.cpp	Tue Sep 05 09:47:14 2006 +0000
     7.3 @@ -1,5 +1,7 @@
     7.4  #include "flagrowobj.h"
     7.5  
     7.6 +#include <QToolBar>
     7.7 +
     7.8  /////////////////////////////////////////////////////////////////
     7.9  // FlagRowObj
    7.10  /////////////////////////////////////////////////////////////////
    7.11 @@ -9,7 +11,7 @@
    7.12      init ();
    7.13  }
    7.14  
    7.15 -FlagRowObj::FlagRowObj(QCanvas* c):MapObj(c) 
    7.16 +FlagRowObj::FlagRowObj(Q3Canvas* c):MapObj(c) 
    7.17  {
    7.18  //    cout << "Const FlagRowObj\n";
    7.19      init ();
    7.20 @@ -232,15 +234,16 @@
    7.21  	}	
    7.22  }
    7.23  
    7.24 +void FlagRowObj::setToolBar(QToolBar *tb)
    7.25 +{
    7.26 +	toolbar=tb;
    7.27 +}
    7.28 +
    7.29  void FlagRowObj::setEnabled (bool b)
    7.30  {
    7.31 -	// If we have no parent, we are the default FlagRowObj
    7.32 -	// and have QToolbarButtons
    7.33 -	if (!parentRow)
    7.34 +	if (toolbar)
    7.35  	{
    7.36 -		FlagObj *fo;
    7.37 -		for (fo=flag.first();fo; fo=flag.next() )
    7.38 -			fo->setEnabled (b);
    7.39 +		toolbar->setEnabled (b);
    7.40  	}
    7.41  }
    7.42  
    7.43 @@ -286,44 +289,13 @@
    7.44  	name=n;
    7.45  }
    7.46  
    7.47 -void FlagRowObj::makeToolbar (QMainWindow *w, const QString &n)
    7.48 -{
    7.49 -	//Only make toolbar for the parentrow, not each row in branches
    7.50 -	if (!parentRow)
    7.51 -	{
    7.52 -		// create bar and buttons
    7.53 -		QToolBar* tb = new QToolBar( w);
    7.54 -		tb->setLabel (n);
    7.55 -		QAction *a;
    7.56 -		FlagObj *fo;
    7.57 -		for (fo=flag.first();fo; fo=flag.next() )
    7.58 -		{
    7.59 -			a=new QAction (
    7.60 -				fo->getToolTip(),
    7.61 -				fo->getPixmap(),
    7.62 -				fo->getName(),
    7.63 -				0,
    7.64 -				w,
    7.65 -				fo->getName()
    7.66 -			);
    7.67 -			a->setToggleAction(true);
    7.68 -			// FIXME should not be enabled by default, later in updateToolbar
    7.69 -			a->setEnabled(true);
    7.70 -			a->addTo (tb);
    7.71 -			fo->setButton (a);
    7.72 -			connect(a, SIGNAL( activated() ), 
    7.73 -					w, SLOT( standardFlagChanged() ) );
    7.74 -		}
    7.75 -	} else
    7.76 -		qWarning ("FlagRowObj::makeToolbar must not be called for ordinary rows");
    7.77 -}
    7.78 -
    7.79  void  FlagRowObj::updateToolbar()
    7.80  {
    7.81  	FlagObj *fo;
    7.82  	if (parentRow)
    7.83  	{
    7.84  		// We are just a branch, not the toolbar default
    7.85 +		// but state has to be copied from ourselves to parentrow!
    7.86  		parentRow->deactivateAll();
    7.87  		// In parentRow activate all existing (==active) flags
    7.88  		for (fo=flag.first();fo; fo=flag.next() ) 
    7.89 @@ -332,8 +304,12 @@
    7.90  	} else
    7.91  	{
    7.92  		// We are the toolbar default
    7.93 -		for (fo=flag.first();fo; fo=flag.next() ) 
    7.94 -			fo->updateButton();
    7.95 +		if (toolbar)
    7.96 +		{
    7.97 +			// Update state of actions in toolbar
    7.98 +			for (fo=flag.first();fo; fo=flag.next() ) 
    7.99 +				fo->updateAction();
   7.100 +		}	
   7.101  	}
   7.102  }
   7.103  
     8.1 --- a/flagrowobj.h	Tue Sep 05 09:47:13 2006 +0000
     8.2 +++ b/flagrowobj.h	Tue Sep 05 09:47:14 2006 +0000
     8.3 @@ -1,7 +1,9 @@
     8.4  #ifndef FLAGROWOBJ_H
     8.5  #define FLAGROWOBJ_H
     8.6  
     8.7 -#include <qmainwindow.h>
     8.8 +#include <QMainWindow>
     8.9 +//Added by qt3to4:
    8.10 +#include <Q3PtrList>
    8.11  
    8.12  #include "mapobj.h"
    8.13  #include "flagobj.h"
    8.14 @@ -9,7 +11,7 @@
    8.15  class FlagRowObj:public QObject,public MapObj {
    8.16  public:
    8.17      FlagRowObj ();
    8.18 -    FlagRowObj (QCanvas*);
    8.19 +    FlagRowObj (Q3Canvas*);
    8.20      ~FlagRowObj ();
    8.21      virtual void init ();
    8.22      virtual void copy (FlagRowObj*);
    8.23 @@ -27,6 +29,7 @@
    8.24  	void deactivate(const QString&);
    8.25  	void deactivateAll();
    8.26  	void deactivateGroup(FlagObj *);
    8.27 +	void setToolBar (QToolBar *);
    8.28  	void setEnabled (bool);
    8.29  	void setShowFlags (bool);
    8.30  	void resetUsedCounter();
    8.31 @@ -37,7 +40,8 @@
    8.32  private:	
    8.33  	FlagRowObj* parentRow;					// look for flags in this row
    8.34  	FlagObj* findFlag (const QString&);
    8.35 -    QPtrList <FlagObj> flag; 
    8.36 +    Q3PtrList <FlagObj> flag; 
    8.37 +	QToolBar *toolbar;
    8.38  	QString name;
    8.39  	bool showFlags;							// FloatObjects want to hide their flags
    8.40  };
     9.1 --- a/floatimageobj.cpp	Tue Sep 05 09:47:13 2006 +0000
     9.2 +++ b/floatimageobj.cpp	Tue Sep 05 09:47:14 2006 +0000
     9.3 @@ -1,5 +1,7 @@
     9.4  #include "floatimageobj.h"
     9.5  #include "branchobj.h"
     9.6 +//Added by qt3to4:
     9.7 +#include <QPixmap>
     9.8  
     9.9  
    9.10  /////////////////////////////////////////////////////////////////
    9.11 @@ -17,7 +19,7 @@
    9.12      depth=-1;
    9.13  }
    9.14  
    9.15 -FloatImageObj::FloatImageObj (QCanvas* c):FloatObj(c)
    9.16 +FloatImageObj::FloatImageObj (Q3Canvas* c):FloatObj(c)
    9.17  {
    9.18   //   cout << "Const FloatImageObj (c)  called from MapCenterObj (c)\n";
    9.19      setParObj (this);	
    9.20 @@ -25,7 +27,7 @@
    9.21      depth=-1;
    9.22  }
    9.23  
    9.24 -FloatImageObj::FloatImageObj (QCanvas* c, OrnamentedObj* p):FloatObj(c,p)
    9.25 +FloatImageObj::FloatImageObj (Q3Canvas* c, OrnamentedObj* p):FloatObj(c,p)
    9.26  {
    9.27   //   cout << "Const FloatImageObj (c,p)\n";
    9.28      init();
    9.29 @@ -94,7 +96,7 @@
    9.30  		bbox.setSize (QSize(icon->size().width()+8, icon->size().height()+8));
    9.31  		positionBBox();
    9.32  		filename=fn;
    9.33 -		filetype=QPixmap::imageFormat (fn);
    9.34 +//FIXME QT3 was		filetype=QPixmap::imageFormat (fn);
    9.35  		setOriginalFilename (fn);
    9.36  		return true;
    9.37  	} else
    9.38 @@ -102,9 +104,9 @@
    9.39  	
    9.40  }
    9.41  
    9.42 -void FloatImageObj::save (const QString &fn, const char *format)
    9.43 +void FloatImageObj::save (const QString &fn, const QString &format)
    9.44  {	
    9.45 -	icon->save (fn,format);
    9.46 +	icon->save (fn,qPrintable (format));
    9.47  }
    9.48  
    9.49  void FloatImageObj::setOriginalFilename(const QString & fn)
    9.50 @@ -180,14 +182,10 @@
    9.51  	QString zAttr=attribut ("zPlane",QString().setNum(zPlane));
    9.52  	QString url;
    9.53  
    9.54 -	// prevent saving as GIF
    9.55 -	if (filetype=="GIF")
    9.56 -		filetype="PNG";
    9.57 -		
    9.58  	url="images/"+prefix+"image-" + QString().number(saveCounter,10) + "." +filetype;
    9.59  
    9.60  	// And really save the image
    9.61 -	icon->save (tmpdir + "/" + url, filetype);
    9.62 +	icon->save (tmpdir + "/" + url, "PNG");
    9.63   
    9.64  	QString nameAttr=attribut ("orgName",originalFilename);
    9.65  
    10.1 --- a/floatimageobj.h	Tue Sep 05 09:47:13 2006 +0000
    10.2 +++ b/floatimageobj.h	Tue Sep 05 09:47:14 2006 +0000
    10.3 @@ -2,13 +2,15 @@
    10.4  #define FLOATIMAGEOBJ_H
    10.5  
    10.6  #include "floatobj.h"
    10.7 +//Added by qt3to4:
    10.8 +#include <QPixmap>
    10.9  
   10.10  /////////////////////////////////////////////////////////////////////////////
   10.11  class FloatImageObj:public FloatObj {
   10.12  public:
   10.13      FloatImageObj ();
   10.14 -    FloatImageObj (QCanvas*);
   10.15 -    FloatImageObj (QCanvas*, OrnamentedObj* parent);
   10.16 +    FloatImageObj (Q3Canvas*);
   10.17 +    FloatImageObj (Q3Canvas*, OrnamentedObj* parent);
   10.18      ~FloatImageObj ();
   10.19      virtual void init ();
   10.20      virtual void copy (FloatImageObj*);
   10.21 @@ -17,7 +19,7 @@
   10.22  
   10.23  	virtual void load (const QPixmap &);
   10.24  	virtual bool load (const QString &);
   10.25 -	virtual void save (const QString &, const char *);
   10.26 +	virtual void save (const QString &, const QString&);
   10.27  	virtual void setOriginalFilename(const QString &);
   10.28  	virtual QString getOriginalFilename();
   10.29      virtual void setVisibility(bool);	    // set vis. for w
    11.1 --- a/floatobj.cpp	Tue Sep 05 09:47:13 2006 +0000
    11.2 +++ b/floatobj.cpp	Tue Sep 05 09:47:14 2006 +0000
    11.3 @@ -14,7 +14,7 @@
    11.4      depth=-1;
    11.5  }
    11.6  
    11.7 -FloatObj::FloatObj (QCanvas* c):OrnamentedObj(c)
    11.8 +FloatObj::FloatObj (Q3Canvas* c):OrnamentedObj(c)
    11.9  {
   11.10  //	cout << "Const FloatObj (c)  called from MapCenterObj (c)\n";
   11.11      setParObj (this);	
   11.12 @@ -22,7 +22,7 @@
   11.13      depth=-1;
   11.14  }
   11.15  
   11.16 -FloatObj::FloatObj (QCanvas* c, LinkableMapObj* p):OrnamentedObj (c)
   11.17 +FloatObj::FloatObj (Q3Canvas* c, LinkableMapObj* p):OrnamentedObj (c)
   11.18  {
   11.19  //    cout << "Const FloatObj (c,p)\n";
   11.20      setParObj (p);	
    12.1 --- a/floatobj.h	Tue Sep 05 09:47:13 2006 +0000
    12.2 +++ b/floatobj.h	Tue Sep 05 09:47:14 2006 +0000
    12.3 @@ -7,8 +7,8 @@
    12.4  class FloatObj:public OrnamentedObj {
    12.5  public:
    12.6      FloatObj ();
    12.7 -    FloatObj (QCanvas*);
    12.8 -    FloatObj (QCanvas*, LinkableMapObj* parent);
    12.9 +    FloatObj (Q3Canvas*);
   12.10 +    FloatObj (Q3Canvas*, LinkableMapObj* parent);
   12.11      ~FloatObj ();
   12.12      virtual void init ();
   12.13      virtual void copy (FloatObj*);
    13.1 --- a/frameobj.cpp	Tue Sep 05 09:47:13 2006 +0000
    13.2 +++ b/frameobj.cpp	Tue Sep 05 09:47:14 2006 +0000
    13.3 @@ -11,7 +11,7 @@
    13.4      init ();
    13.5  }
    13.6  
    13.7 -FrameObj::FrameObj(QCanvas* c) :MapObj(c)
    13.8 +FrameObj::FrameObj(Q3Canvas* c) :MapObj(c)
    13.9  {
   13.10  //    cout << "Const FrameObj\n";
   13.11      init ();
   13.12 @@ -117,7 +117,7 @@
   13.13  				break;
   13.14  			case Rectangle:
   13.15  				border=10;
   13.16 -				rectFrame = new QCanvasRectangle (canvas);
   13.17 +				rectFrame = new Q3CanvasRectangle (canvas);
   13.18  				rectFrame->setZ(Z_FRAME);
   13.19  				rectFrame->setBrush( QColor("white") );
   13.20  				rectFrame->setPen( QPen(QColor("black") ));
    14.1 --- a/frameobj.h	Tue Sep 05 09:47:13 2006 +0000
    14.2 +++ b/frameobj.h	Tue Sep 05 09:47:14 2006 +0000
    14.3 @@ -8,7 +8,7 @@
    14.4  class FrameObj:public MapObj {
    14.5  public:
    14.6      FrameObj();
    14.7 -    FrameObj(QCanvas*);
    14.8 +    FrameObj(Q3Canvas*);
    14.9      ~FrameObj();
   14.10      void init();
   14.11      void clear();
   14.12 @@ -26,7 +26,7 @@
   14.13  
   14.14  protected:
   14.15      FrameType type;
   14.16 -    QCanvasRectangle* rectFrame;
   14.17 +    Q3CanvasRectangle* rectFrame;
   14.18      int border;									// distance text - frame
   14.19  };
   14.20  #endif
    15.1 --- a/headingobj.cpp	Tue Sep 05 09:47:13 2006 +0000
    15.2 +++ b/headingobj.cpp	Tue Sep 05 09:47:14 2006 +0000
    15.3 @@ -10,7 +10,7 @@
    15.4      init ();
    15.5  }
    15.6  
    15.7 -HeadingObj::HeadingObj(QCanvas* c) :MapObj(c)
    15.8 +HeadingObj::HeadingObj(Q3Canvas* c) :MapObj(c)
    15.9  {
   15.10  //    cout << "Const HeadingObj\n";
   15.11      init ();
   15.12 @@ -50,7 +50,7 @@
   15.13  		h=textline.first()->boundingRect().height();
   15.14      else
   15.15  		h=2;
   15.16 -    QCanvasText *t;
   15.17 +    Q3CanvasText *t;
   15.18      ho=0;
   15.19      for (t=textline.first(); t; t=textline.next() )
   15.20      {
   15.21 @@ -80,7 +80,7 @@
   15.22  	// then no selection would be visible, thus we prevent it in ::setText()
   15.23  	if (!textline.isEmpty() )
   15.24  	{
   15.25 -		QCanvasText *t;
   15.26 +		Q3CanvasText *t;
   15.27  		for (t=textline.first(); t; t=textline.next() )
   15.28  		{
   15.29  			h+=t->boundingRect().height();
   15.30 @@ -91,10 +91,10 @@
   15.31      bbox.setSize (QSize(w,h));
   15.32  }
   15.33  
   15.34 -QCanvasText* HeadingObj::newLine(QString s)
   15.35 +Q3CanvasText* HeadingObj::newLine(QString s)
   15.36  {
   15.37 -    QCanvasText *t;
   15.38 -    t = new QCanvasText(canvas);
   15.39 +    Q3CanvasText *t;
   15.40 +    t = new Q3CanvasText(canvas);
   15.41      t->setFont (font);
   15.42      t->setColor (color);
   15.43      t->setZ(Z_TEXT);
   15.44 @@ -220,7 +220,7 @@
   15.45      if (color!=c)
   15.46      {
   15.47  		color=c;
   15.48 -		QCanvasText *t;
   15.49 +		Q3CanvasText *t;
   15.50  		for (t=textline.first(); t; t=textline.next() )
   15.51  			t->setColor(c);
   15.52      }	    
   15.53 @@ -234,7 +234,7 @@
   15.54  void HeadingObj::setVisibility (bool v)
   15.55  {
   15.56      MapObj::setVisibility(v);
   15.57 -    QCanvasText *t;
   15.58 +    Q3CanvasText *t;
   15.59      for (t=textline.first(); t; t=textline.next() )
   15.60  		if (v)
   15.61  			t->show();
    16.1 --- a/headingobj.h	Tue Sep 05 09:47:13 2006 +0000
    16.2 +++ b/headingobj.h	Tue Sep 05 09:47:14 2006 +0000
    16.3 @@ -2,11 +2,13 @@
    16.4  #define HEADINGOBJ_H
    16.5  
    16.6  #include "mapobj.h"
    16.7 +//Added by qt3to4:
    16.8 +#include <Q3PtrList>
    16.9  
   16.10  class HeadingObj:public MapObj {
   16.11  public:
   16.12      HeadingObj();
   16.13 -    HeadingObj(QCanvas*);
   16.14 +    HeadingObj(Q3Canvas*);
   16.15      virtual ~HeadingObj();
   16.16      virtual void init();
   16.17      virtual void copy(HeadingObj*);
   16.18 @@ -15,7 +17,7 @@
   16.19      virtual void positionBBox();
   16.20  	virtual void calcBBoxSize();
   16.21  private:
   16.22 -    QCanvasText* newLine(QString);				// generate new textline
   16.23 +    Q3CanvasText* newLine(QString);				// generate new textline
   16.24  public:    
   16.25      virtual void setText(QString);
   16.26      virtual QString text();
   16.27 @@ -30,7 +32,7 @@
   16.28  protected:
   16.29      QString heading;
   16.30      uint textwidth;								// width for formatting text
   16.31 -    QPtrList <QCanvasText> textline;			// a part of e.g. the parabel
   16.32 +    Q3PtrList <Q3CanvasText> textline;			// a part of e.g. the parabel
   16.33      QColor color;
   16.34      QFont font;
   16.35  };
    17.1 --- a/imageobj.cpp	Tue Sep 05 09:47:13 2006 +0000
    17.2 +++ b/imageobj.cpp	Tue Sep 05 09:47:14 2006 +0000
    17.3 @@ -1,10 +1,12 @@
    17.4  #include "imageobj.h"
    17.5 +//Added by qt3to4:
    17.6 +#include <QPixmap>
    17.7  
    17.8  /////////////////////////////////////////////////////////////////
    17.9  // ImageObj
   17.10  /////////////////////////////////////////////////////////////////
   17.11 -ImageObj::ImageObj( QCanvas *canvas )
   17.12 -    : QCanvasRectangle( canvas )
   17.13 +ImageObj::ImageObj( Q3Canvas *canvas )
   17.14 +    : Q3CanvasRectangle( canvas )
   17.15  {
   17.16  //	cout << "Const ImageObj (canvas)\n";
   17.17      setZ(Z_ICON);	
   17.18 @@ -54,7 +56,7 @@
   17.19  	type=qimage;
   17.20  
   17.21  #if !defined(Q_WS_QWS)
   17.22 -    pixmap.convertFromImage(image, OrderedAlphaDither);
   17.23 +    pixmap.convertFromImage(image, Qt::OrderedAlphaDither);
   17.24  #endif
   17.25  	return true;
   17.26  }
   17.27 @@ -78,7 +80,7 @@
   17.28  {
   17.29  	type=qimage;
   17.30  	image=img;
   17.31 -    pixmap.convertFromImage(image, OrderedAlphaDither);
   17.32 +    pixmap.convertFromImage(image, Qt::OrderedAlphaDither);
   17.33  }
   17.34  
   17.35  QPixmap ImageObj::getPixmap()
   17.36 @@ -91,7 +93,7 @@
   17.37  // On Qt/Embedded, we can paint a QImage as fast as a QPixmap,
   17.38  // but on other platforms, we need to use a QPixmap.
   17.39  #if defined(Q_WS_QWS)
   17.40 -    p.drawImage( int(x()), int(y()), image, 0, 0, -1, -1, OrderedAlphaDither );
   17.41 +    p.drawImage( int(x()), int(y()), image, 0, 0, -1, -1, Qt::OrderedAlphaDither );
   17.42  #else
   17.43      p.drawPixmap( int(x()), int(y()), pixmap );
   17.44  #endif
    18.1 --- a/imageobj.h	Tue Sep 05 09:47:13 2006 +0000
    18.2 +++ b/imageobj.h	Tue Sep 05 09:47:14 2006 +0000
    18.3 @@ -2,17 +2,19 @@
    18.4  #define IMAGEOBJ_H
    18.5  
    18.6  #include <qimage.h>
    18.7 -#include <qcanvas.h>
    18.8 +#include <q3canvas.h>
    18.9  #include <qpainter.h>
   18.10 +//Added by qt3to4:
   18.11 +#include <QPixmap>
   18.12  
   18.13  #include "mapobj.h"
   18.14  
   18.15  enum ImageType {qimage,qpixmap,undef};
   18.16  
   18.17 -class ImageObj: public QCanvasRectangle
   18.18 +class ImageObj: public Q3CanvasRectangle
   18.19  {
   18.20  public:
   18.21 -    ImageObj( QCanvas *canvas );
   18.22 +    ImageObj( Q3Canvas *canvas );
   18.23      ~ImageObj();
   18.24  	virtual void copy (ImageObj*);
   18.25      virtual void setVisibility(bool);
    19.1 --- a/imports.cpp	Tue Sep 05 09:47:13 2006 +0000
    19.2 +++ b/imports.cpp	Tue Sep 05 09:47:14 2006 +0000
    19.3 @@ -1,4 +1,6 @@
    19.4 -#include <qmessagebox.h>
    19.5 +#include <QMessageBox>
    19.6 +//Added by qt3to4:
    19.7 +#include <QTextStream>
    19.8  
    19.9  #include "file.h"
   19.10  #include "imports.h"
   19.11 @@ -13,7 +15,10 @@
   19.12  ImportBase::ImportBase()
   19.13  {
   19.14  	// Create tmpdir
   19.15 -	tmpDir.setPath (makeUniqueDir("/tmp/vym-XXXXXX"));
   19.16 +	// FIXME not neededtmpDir.setPath (makeUniqueDir("/tmp/vym-XXXXXX"));
   19.17 +	if (!tmpDir.cd ("tmp"))
   19.18 +		qWarning ("Could not access temporary directory for export");
   19.19 +		// FIXME
   19.20  }
   19.21  
   19.22  
   19.23 @@ -70,7 +75,7 @@
   19.24  
   19.25  	QStringList lines;
   19.26  	QFile file( inputFile );
   19.27 -	if ( file.open( IO_ReadOnly ) ) 
   19.28 +	if ( file.open( QIODevice::ReadOnly ) ) 
   19.29  	{
   19.30  		QTextStream stream( &file );
   19.31  		while ( !stream.atEnd() ) 
   19.32 @@ -90,7 +95,6 @@
   19.33  	// try to unzip 
   19.34  	if (success==unzipDir (tmpDir, inputFile))
   19.35  	{
   19.36 -		cout << "Unzipped "<<inputFile<<" to "<<tmpDir.path()<<endl;
   19.37  		
   19.38  		// Set short name, too. Search from behind:
   19.39  		transformedFile=inputFile;
   19.40 @@ -98,7 +102,6 @@
   19.41  		if (i>=0) transformedFile=transformedFile.remove (0,i+1);
   19.42  		transformedFile.replace(".mmap",".xml");
   19.43  		transformedFile=tmpDir.path()+"/"+transformedFile;
   19.44 -		cout << "  transformedFile="<<transformedFile<<endl;
   19.45  
   19.46  		XSLTProc p;
   19.47  		p.setInputFile (tmpDir.path()+"/Document.xml");
    20.1 --- a/linkablemapobj.cpp	Tue Sep 05 09:47:13 2006 +0000
    20.2 +++ b/linkablemapobj.cpp	Tue Sep 05 09:47:14 2006 +0000
    20.3 @@ -5,6 +5,8 @@
    20.4  #include "mapeditor.h"
    20.5  
    20.6  #include "version.h"
    20.7 +//Added by qt3to4:
    20.8 +#include <Q3PointArray>
    20.9  
   20.10  
   20.11  /////////////////////////////////////////////////////////////////
   20.12 @@ -17,7 +19,7 @@
   20.13      init ();
   20.14  }
   20.15  
   20.16 -LinkableMapObj::LinkableMapObj(QCanvas* c) :MapObj(c)
   20.17 +LinkableMapObj::LinkableMapObj(Q3Canvas* c) :MapObj(c)
   20.18  {
   20.19  //    cout << "Const LinkableMapObj\n";
   20.20      init ();
   20.21 @@ -77,15 +79,15 @@
   20.22  	linkpos=LinkBottom;
   20.23      segment.setAutoDelete (TRUE);
   20.24      arcsegs=13;
   20.25 -	QPointArray pa(arcsegs*2+2);
   20.26 +	Q3PointArray pa(arcsegs*2+2);
   20.27      
   20.28 -    bottomline=new QCanvasLine(canvas);
   20.29 +    bottomline=new Q3CanvasLine(canvas);
   20.30      bottomline->setPen( QPen(linkcolor, 1) );
   20.31      bottomline->setZ(Z_LINK);
   20.32      bottomline->show();
   20.33  
   20.34      // Prepare showing the selection of a MapObj
   20.35 -    selbox = new QCanvasRectangle (canvas);
   20.36 +    selbox = new Q3CanvasRectangle (canvas);
   20.37      selbox->setZ(Z_SELBOX);
   20.38      selbox->setBrush( QColor(255,255,0) );
   20.39      selbox->setPen( QPen(QColor(255,255,0) ));
   20.40 @@ -152,8 +154,7 @@
   20.41  {
   20.42  	if (parObj)
   20.43  	{	
   20.44 -		relPos.setX (absPos.x() - parObj->getChildPos().x() );
   20.45 -		relPos.setY (absPos.y() - parObj->getChildPos().y() );
   20.46 +		relPos=getRelPos();
   20.47  
   20.48  		parObj->calcBBoxSize();
   20.49  		parObj->requestReposition();
   20.50 @@ -169,6 +170,14 @@
   20.51  	}	
   20.52  }
   20.53  
   20.54 +QPoint LinkableMapObj::getRelPos()
   20.55 +{
   20.56 +	if (!parObj) return QPoint();
   20.57 +	relPos.setX (absPos.x() - parObj->getChildPos().x() );
   20.58 +	relPos.setY (absPos.y() - parObj->getChildPos().y() );
   20.59 +	return relPos;
   20.60 +}
   20.61 +
   20.62  int LinkableMapObj::getTopPad()
   20.63  {
   20.64  	return topPad;
   20.65 @@ -225,14 +234,14 @@
   20.66      if (childObj!=NULL && parObj != NULL)
   20.67      {
   20.68  		int i;
   20.69 -		QCanvasLine* cl;
   20.70 +		Q3CanvasLine* cl;
   20.71  		switch (style)
   20.72  		{
   20.73  			case StyleUndef:
   20.74  				bottomline->hide();
   20.75  				break;
   20.76  			case StyleLine: 
   20.77 -				l = new QCanvasLine(canvas);
   20.78 +				l = new Q3CanvasLine(canvas);
   20.79  				l->setPen( QPen(linkcolor, 1) );
   20.80  				l->setZ(Z_LINK);
   20.81  				if (visible)
   20.82 @@ -243,7 +252,7 @@
   20.83  			case StyleParabel:
   20.84  				for (i=0;i<arcsegs;i++)
   20.85  				{
   20.86 -					cl = new QCanvasLine(canvas);
   20.87 +					cl = new Q3CanvasLine(canvas);
   20.88  					cl->setPen( QPen(linkcolor, 1) );
   20.89  					cl->setPoints( 0,0,i*10,100);
   20.90  					cl->setZ(Z_LINK);
   20.91 @@ -256,7 +265,7 @@
   20.92  				pa0.resize (arcsegs+1);
   20.93  				break;
   20.94  			case StylePolyLine:	
   20.95 -				p = new QCanvasPolygon(canvas);
   20.96 +				p = new Q3CanvasPolygon(canvas);
   20.97  				p->setBrush( linkcolor );
   20.98  				p->setZ(Z_LINK);
   20.99  				if (visible)
  20.100 @@ -266,7 +275,7 @@
  20.101  				pa0.resize (3);
  20.102  				// TODO a bit awkward: draw the lines additionally to polygon, to avoid
  20.103  				// missing pixels, when polygon is extremly flat
  20.104 -				l = new QCanvasLine(canvas);
  20.105 +				l = new Q3CanvasLine(canvas);
  20.106  				l->setPen( QPen(linkcolor, 1) );
  20.107  				l->setZ(Z_LINK);
  20.108  				if (visible)
  20.109 @@ -275,7 +284,7 @@
  20.110  					l->hide();
  20.111  				break;
  20.112  			case StylePolyParabel:	
  20.113 -				p = new QCanvasPolygon(canvas);
  20.114 +				p = new Q3CanvasPolygon(canvas);
  20.115  				p->setBrush( linkcolor );
  20.116  				p->setZ(Z_LINK);
  20.117  				if (visible)
  20.118 @@ -291,7 +300,7 @@
  20.119  				// if polygon is extremly flat
  20.120  				for (i=0;i<arcsegs;i++)
  20.121  				{
  20.122 -					cl = new QCanvasLine(canvas);
  20.123 +					cl = new Q3CanvasLine(canvas);
  20.124  					cl->setPen( QPen(linkcolor, 1) );
  20.125  					cl->setPoints( 0,0,i*10,100);
  20.126  					cl->setZ(Z_LINK);
  20.127 @@ -348,7 +357,7 @@
  20.128  {
  20.129  	linkcolor=col;
  20.130      bottomline->setPen( QPen(linkcolor, 1) );
  20.131 -	QCanvasLine *cl;
  20.132 +	Q3CanvasLine *cl;
  20.133  	switch (style)
  20.134  	{
  20.135  		case StyleLine:
  20.136 @@ -400,7 +409,7 @@
  20.137  
  20.138  void LinkableMapObj::setVisibility (bool v)
  20.139  {
  20.140 -	QCanvasLine* cl;
  20.141 +	Q3CanvasLine* cl;
  20.142  	MapObj::setVisibility (v);
  20.143  	bool visnow=visible;
  20.144  
  20.145 @@ -550,7 +559,7 @@
  20.146  	// "turning point" for drawing polygonal links
  20.147  	QPoint tp (-qRound(sin (a)*thickness_start), qRound(cos (a)*thickness_start));	
  20.148  	
  20.149 -	QCanvasLine *cl;
  20.150 +	Q3CanvasLine *cl;
  20.151  
  20.152  	int i;
  20.153  
  20.154 @@ -663,21 +672,6 @@
  20.155      return parPos;
  20.156  }
  20.157  
  20.158 -QPoint LinkableMapObj::getRelPos()
  20.159 -{
  20.160 -	return relPos;
  20.161 -/* FIXME not needed? relPos was moved in 1.7.10 from
  20.162 -   floatobj to linkablemapobj. Before we had:
  20.163 -	
  20.164 -	if (!parObj) return QPoint (0,0);
  20.165 -    return QPoint(
  20.166 -		absPos.x() - parObj->x(),
  20.167 -		absPos.y() - parObj->y()
  20.168 -	);
  20.169 -*/	
  20.170 -}
  20.171 -
  20.172 -
  20.173  void LinkableMapObj::setUseOrientation (const bool &b)
  20.174  {	
  20.175  	if (useOrientation!=b)
  20.176 @@ -802,7 +796,7 @@
  20.177  	setVisibility (visible);
  20.178  }
  20.179  
  20.180 -void LinkableMapObj::parabel (QPointArray &ya, double p1x, double p1y, double p2x, double p2y)
  20.181 +void LinkableMapObj::parabel (Q3PointArray &ya, double p1x, double p1y, double p2x, double p2y)
  20.182  
  20.183  {
  20.184  	double vx=p2x - p1x;	// V=P2-P1
    21.1 --- a/linkablemapobj.h	Tue Sep 05 09:47:13 2006 +0000
    21.2 +++ b/linkablemapobj.h	Tue Sep 05 09:47:14 2006 +0000
    21.3 @@ -5,6 +5,9 @@
    21.4  #include "noteobj.h"
    21.5  #include "headingobj.h"
    21.6  #include "flagrowobj.h"
    21.7 +//Added by qt3to4:
    21.8 +#include <Q3PointArray>
    21.9 +#include <Q3PtrList>
   21.10  
   21.11  #define MAX_DEPTH 999
   21.12  
   21.13 @@ -23,7 +26,7 @@
   21.14  	Q_OBJECT
   21.15  public:
   21.16      LinkableMapObj ();
   21.17 -    LinkableMapObj (QCanvas*);
   21.18 +    LinkableMapObj (Q3Canvas*);
   21.19      LinkableMapObj (LinkableMapObj*);
   21.20      ~LinkableMapObj ();
   21.21  	virtual void delLink();
   21.22 @@ -38,6 +41,7 @@
   21.23  	virtual void setUseRelPos (const bool&);
   21.24  	virtual void setRelPos();				// set relPos to current parentPos
   21.25  	virtual void setRelPos(const QPoint&);	
   21.26 +	virtual QPoint getRelPos();
   21.27  	virtual void setUseOrientation (const bool &);
   21.28  
   21.29  
   21.30 @@ -68,7 +72,6 @@
   21.31  	virtual void setDockPos();				// sets childPos and parPos
   21.32      QPoint getChildPos();					// returns pos where childs dock
   21.33      QPoint getParPos();						// returns pos where parents dock
   21.34 -    QPoint getRelPos();						// get position relative to parent (or (0,0))
   21.35      LinkOrient getOrientation();			// get orientation
   21.36      virtual int getDepth();					// return depth
   21.37  	virtual void setMapEditor(MapEditor*);	// set MapEditor (needed in LMO::updateNoteFlag)
   21.38 @@ -93,7 +96,7 @@
   21.39  	virtual QString saveToDir (const QString&,const QString&, const QPoint&)=0;// Save data to tempdir
   21.40  
   21.41  protected:
   21.42 -	void parabel(QPointArray &,double,double,double,double);	// Create Parabel connecting two points
   21.43 +	void parabel(Q3PointArray &,double,double,double,double);	// Create Parabel connecting two points
   21.44  	QString getLinkAttr();
   21.45  
   21.46      QPoint childPos;
   21.47 @@ -114,19 +117,19 @@
   21.48      LinkStyle style;				// Current style
   21.49  	LinkPos linkpos;				// Link at bottom of object or middle of height
   21.50      QColor linkcolor;               // Link color
   21.51 -    QCanvasLine* l;                 // line style
   21.52 -	QCanvasPolygon* p;				// poly styles
   21.53 +    Q3CanvasLine* l;                 // line style
   21.54 +	Q3CanvasPolygon* p;				// poly styles
   21.55      int arcsegs;                    // arc: number of segments
   21.56 -    QPtrList <QCanvasLine> segment; // a part of e.g. the parabel
   21.57 -	QPointArray pa0;				// For drawing of PolyParabel and PolyLine
   21.58 -	QPointArray pa1;				// For drawing of PolyParabel 
   21.59 -	QPointArray pa2;				// For drawing of PolyParabel	
   21.60 -    QCanvasLine* bottomline;        // on bottom of BBox
   21.61 +    Q3PtrList <Q3CanvasLine> segment; // a part of e.g. the parabel
   21.62 +	Q3PointArray pa0;				// For drawing of PolyParabel and PolyLine
   21.63 +	Q3PointArray pa1;				// For drawing of PolyParabel 
   21.64 +	Q3PointArray pa2;				// For drawing of PolyParabel	
   21.65 +    Q3CanvasLine* bottomline;        // on bottom of BBox
   21.66  	bool repositionRequest;			// 
   21.67  
   21.68  	bool selected;					// Used for marking the selection
   21.69  	bool hideLinkUnselected;		// to hide links if unselected
   21.70 -	QCanvasRectangle* selbox;
   21.71 +	Q3CanvasRectangle* selbox;
   21.72  	FrameObj *frame;				// frame around object
   21.73  	int topPad, botPad,
   21.74  		leftPad, rightPad;          // padding within bbox
    22.1 --- a/main.cpp	Tue Sep 05 09:47:13 2006 +0000
    22.2 +++ b/main.cpp	Tue Sep 05 09:47:14 2006 +0000
    22.3 @@ -1,16 +1,16 @@
    22.4 -#include <qapplication.h>
    22.5 -#include <qpixmap.h>
    22.6 -#include <qtranslator.h>
    22.7 -#include <qdir.h>
    22.8 -#include <qptrlist.h>
    22.9 -#include <qtextcodec.h>
   22.10 -#include <qnetwork.h>
   22.11 -#include <qmime.h>
   22.12 +#include <QApplication>
   22.13 +#include <QPixmap>
   22.14 +#include <QTranslator>
   22.15 +#include <QDir>
   22.16 +#include <q3ptrlist.h>
   22.17 +#include <QTextCodec>
   22.18 +#include <q3network.h>
   22.19 +#include <QMenu>
   22.20 +#include <QActionGroup>
   22.21  
   22.22  #include "settings.h"
   22.23  #include "options.h"
   22.24  #include "mainwindow.h"
   22.25 -
   22.26  #include "flagrowobj.h"
   22.27  
   22.28  // Global variables
   22.29 @@ -21,6 +21,8 @@
   22.30  QString tmpVymDir;				// All temp files go there, created in mainwindow
   22.31  QString clipboardDir;			// Clipboard used in all mapEditors
   22.32  QDir vymBaseDir;				// Containing all styles, scripts, images, ...
   22.33 +QDir lastImageDir;
   22.34 +QDir lastFileDir;
   22.35  QString iconPath;				// Pointing to icons used for toolbars
   22.36  QString flagsPath;				// Pointing to flags
   22.37  bool clipboardEmpty;			
   22.38 @@ -29,7 +31,7 @@
   22.39  
   22.40  // Lists of actions
   22.41  // (QActionGroup could not be "enabled")
   22.42 -QPtrList <QAction> actionListBranches;
   22.43 +Q3PtrList <QAction> actionListBranches;
   22.44  
   22.45  // Actions which change sometimes
   22.46  QAction *actionFileSave;
   22.47 @@ -44,11 +46,13 @@
   22.48  QAction *actionEditToggleScroll;
   22.49  QAction *actionEditOpenURL;
   22.50  QAction *actionEditOpenURLTab;
   22.51 +QAction *actionEditOpenMultipleURLTabs;
   22.52  QAction *actionEditURL;
   22.53  QAction *actionEditHeading2URL;
   22.54  QAction *actionEditBugzilla2URL;
   22.55  QAction *actionEditFATE2URL;
   22.56  QAction *actionEditOpenVymLink;
   22.57 +QAction *actionEditOpenMultipleVymLinks;
   22.58  QAction *actionEditVymLink;
   22.59  QAction *actionEditToggleHideExport;
   22.60  QAction *actionEditDeleteVymLink;
   22.61 @@ -99,33 +103,36 @@
   22.62  
   22.63  QAction *actionSettingsAutoselectHeading;
   22.64  QAction *actionSettingsAutoselectText;
   22.65 -QAction *actionSettingsPasteNewHeading;
   22.66  QAction *actionSettingsAutoedit;
   22.67  QAction *actionSettingsUseDelKey;
   22.68  QAction *actionSettingsUseFlagGroups;
   22.69  QAction *actionSettingsUseHideExport;
   22.70  
   22.71 -QPopupMenu *branchContextMenu;
   22.72 -QPopupMenu *branchAddContextMenu;
   22.73 -QPopupMenu *branchRemoveContextMenu;
   22.74 -QPopupMenu *branchLinksContextMenu;
   22.75 -QPopupMenu *branchLinksContextMenuDup;
   22.76 -QPopupMenu *floatimageContextMenu;
   22.77 -QPopupMenu *saveImageFormatMenu;
   22.78 -QPopupMenu *canvasContextMenu;
   22.79 -QPopupMenu *lastMapsMenu;
   22.80 -QPopupMenu *importMenu;
   22.81 -QPopupMenu *exportMenu;
   22.82 -QPopupMenu *exportImageFormatMenu;
   22.83  
   22.84 +QMenu* branchContextMenu;
   22.85 +QMenu* branchAddContextMenu;
   22.86 +QMenu* branchRemoveContextMenu;
   22.87 +QMenu* branchLinksContextMenu;
   22.88 +QMenu* branchXLinksContextMenuEdit;
   22.89 +QMenu* branchXLinksContextMenuFollow;
   22.90 +QMenu* floatimageContextMenu;
   22.91 +QMenu* canvasContextMenu;
   22.92 +QMenu* fileLastMapsMenu;
   22.93 +QMenu* fileImportMenu;
   22.94 +QMenu* fileExportMenu;
   22.95  
   22.96 -Settings settings;
   22.97 +
   22.98 +Settings settings ("InSilmaril","vym"); // Organization, Application name
   22.99 +
  22.100  Options options;
  22.101 +ImageIO imageIO;
  22.102  
  22.103  int statusbarTime=3500;
  22.104  
  22.105  int main(int argc, char** argv)
  22.106  {
  22.107 +//FIXME	Q_INIT_RESOURCE (application);
  22.108 +
  22.109      QApplication app(argc,argv);
  22.110  
  22.111  
  22.112 @@ -144,14 +151,14 @@
  22.113  		"http://www.InSilmaril.de/vym\n");
  22.114  	if (options.parse())
  22.115  	{
  22.116 -		cout << endl << options.getHelpText()<<endl;
  22.117 +		cout << endl << options.getHelpText().ascii()<<endl;
  22.118  		return 1;
  22.119  	}
  22.120  
  22.121  	if (options.isOn ("version"))
  22.122  	{
  22.123  		cout << "vym version "<<__VYM_VERSION
  22.124 -			<<"  (c) 2004 Uwe Drechsel - "
  22.125 +			<<"  (c) 2004-2006 Uwe Drechsel - "
  22.126  			<<__BUILD_DATE<<endl;
  22.127  			
  22.128  		return 0;	
  22.129 @@ -182,22 +189,17 @@
  22.130  	iconPath=vymBaseDir.path()+"/icons/";
  22.131  	flagsPath=vymBaseDir.path()+"/flags/";
  22.132  
  22.133 +	// Some directories
  22.134 +	lastImageDir=QDir().current();
  22.135 +	lastFileDir=QDir().current();
  22.136 +
  22.137  	if (options.isOn ("help"))
  22.138  	{
  22.139 -		cout << options.getHelpText()<<endl;
  22.140 +		cout << options.getHelpText().ascii()<<endl;
  22.141  		return 0;	
  22.142  	}	
  22.143  
  22.144 -	if (options.isOn ("test"))
  22.145 -	{
  22.146 -		// FIXME testing string option only
  22.147 -		cout << "Testing: "<<options.getArg("test")<< endl;
  22.148 -	}	
  22.149 -
  22.150 -
  22.151 -    QMimeSourceFactory *factory = QMimeSourceFactory::defaultFactory();
  22.152 -    factory->setPixmap("vym-128x128", QPixmap(iconPath+"vym-128x128.png"));
  22.153 -    qInitNetworkProtocols();
  22.154 +    q3InitNetworkProtocols();
  22.155  
  22.156  
  22.157  	// Initialize translations
    23.1 --- a/mainwindow.cpp	Tue Sep 05 09:47:13 2006 +0000
    23.2 +++ b/mainwindow.cpp	Tue Sep 05 09:47:14 2006 +0000
    23.3 @@ -1,20 +1,25 @@
    23.4  #include "mainwindow.h"
    23.5  
    23.6 -#include <qstatusbar.h>
    23.7 -#include <qmessagebox.h>
    23.8 -#include <qmenubar.h>
    23.9 -#include <qapplication.h>
   23.10 -#include <qpainter.h>
   23.11 -#include <qprinter.h>
   23.12 -#include <qfile.h>
   23.13 -#include <qfiledialog.h>
   23.14 -#include <qcolor.h>
   23.15 -#include <qcolordialog.h>
   23.16 -#include <qbitmap.h>
   23.17 -#include <qinputdialog.h>
   23.18 +#include <QtGui>
   23.19 +#include <QPainter>
   23.20 +#include <QPrinter>
   23.21 +#include <QFile>
   23.22 +#include <q3filedialog.h>
   23.23 +#include <QColor>
   23.24 +#include <QColorDialog>
   23.25 +#include <QBitmap>
   23.26 +#include <QInputDialog>
   23.27 +//Added by qt3to4:
   23.28 +#include <Q3StrList>
   23.29 +#include <QPixmap>
   23.30 +#include <QCloseEvent>
   23.31 +#include <QShowEvent>
   23.32 +#include <QHideEvent>
   23.33 +#include <Q3PopupMenu>
   23.34 +#include <QActionGroup>
   23.35 +#include <Q3PtrList>
   23.36  //#include <qdatetime.h>			// for random seed
   23.37  
   23.38 -
   23.39  #include <iostream>
   23.40  #include <cstdlib>
   23.41  #include <typeinfo>
   23.42 @@ -44,7 +49,7 @@
   23.43  extern FlagRowObj* standardFlagsDefault;
   23.44  extern FlagRowObj* systemFlagsDefault;
   23.45  
   23.46 -extern QPtrList <QAction> actionListBranches;
   23.47 +extern Q3PtrList <QAction> actionListBranches;
   23.48  
   23.49  extern QAction* actionFileSave;
   23.50  extern QAction* actionFilePrint;
   23.51 @@ -58,11 +63,13 @@
   23.52  extern QAction *actionEditToggleScroll;
   23.53  extern QAction* actionEditOpenURL;
   23.54  extern QAction* actionEditOpenURLTab;
   23.55 +extern QAction* actionEditOpenMultipleURLTabs;
   23.56  extern QAction* actionEditURL;
   23.57  extern QAction* actionEditHeading2URL;
   23.58  extern QAction* actionEditBugzilla2URL;
   23.59  extern QAction* actionEditFATE2URL;
   23.60  extern QAction *actionEditOpenVymLink;
   23.61 +extern QAction *actionEditOpenMultipleVymLinks;
   23.62  extern QAction *actionEditVymLink;
   23.63  extern QAction *actionEditDeleteVymLink;
   23.64  extern QAction *actionEditToggleHideExport;
   23.65 @@ -115,36 +122,34 @@
   23.66  extern QAction* actionSettingsAutoselectHeading;
   23.67  extern QAction* actionSettingsAutoselectHeading;
   23.68  extern QAction* actionSettingsAutoselectText;
   23.69 -extern QAction* actionSettingsPasteNewHeading;
   23.70  extern QAction* actionSettingsUseDelKey;
   23.71  extern QAction* actionSettingsUseFlagGroups;
   23.72  extern QAction* actionSettingsUseHideExport;
   23.73  
   23.74 -extern QPopupMenu* branchContextMenu;
   23.75 -extern QPopupMenu* branchAddContextMenu;
   23.76 -extern QPopupMenu* branchRemoveContextMenu;
   23.77 -extern QPopupMenu* branchLinksContextMenu;
   23.78 -extern QPopupMenu* branchLinksContextMenuDup;
   23.79 -extern QPopupMenu* floatimageContextMenu;
   23.80 -extern QPopupMenu* saveImageFormatMenu;
   23.81 -extern QPopupMenu* canvasContextMenu;
   23.82 -extern QPopupMenu* lastMapsMenu;
   23.83 -extern QPopupMenu* importMenu;
   23.84 -extern QPopupMenu* exportMenu;
   23.85 -extern QPopupMenu* exportImageFormatMenu;
   23.86 +extern QMenu* branchContextMenu;
   23.87 +extern QMenu* branchAddContextMenu;
   23.88 +extern QMenu* branchRemoveContextMenu;
   23.89 +extern QMenu* branchLinksContextMenu;
   23.90 +extern QMenu* branchXLinksContextMenuEdit;
   23.91 +extern QMenu* branchXLinksContextMenuFollow;
   23.92 +extern QMenu* floatimageContextMenu;
   23.93 +extern QMenu* canvasContextMenu;
   23.94 +extern QMenu* fileLastMapsMenu;
   23.95 +extern QMenu* fileImportMenu;
   23.96 +extern QMenu* fileExportMenu;
   23.97  
   23.98  
   23.99  extern Settings settings;
  23.100  extern Options options;
  23.101 +extern ImageIO imageIO;
  23.102 +
  23.103  extern QDir vymBaseDir;
  23.104 +extern QDir lastImageDir;
  23.105 +extern QDir lastFileDir;
  23.106  extern QString iconPath;
  23.107  extern QString flagsPath;
  23.108  
  23.109 -#if defined(Q_OS_LINUX)
  23.110 -extern void qt_wait_for_window_manager( QWidget* w );
  23.111 -#endif
  23.112 -
  23.113 -Main::Main(QWidget* parent, const char* name, WFlags f) :
  23.114 +Main::Main(QWidget* parent, const char* name, Qt::WFlags f) :
  23.115      QMainWindow(parent,name,f)
  23.116  {
  23.117  	mainWindow=this;
  23.118 @@ -152,14 +157,18 @@
  23.119  	setCaption ("VYM - View Your Mind");
  23.120  
  23.121  	// Load window settings
  23.122 -	resize (settings.readNumEntry( "/vym/mainwindow/geometry/width", 800),
  23.123 -	        settings.readNumEntry( "/vym/mainwindow/geometry/height",600));
  23.124 -	move   (settings.readNumEntry( "/vym/mainwindow/geometry/posX", 100),
  23.125 -	        settings.readNumEntry( "/vym/mainwindow/geometry/posY", 100));
  23.126 +	resize (settings.value( "/mainwindow/geometry/size",QSize (800,600)).toSize());
  23.127 +	move   (settings.value( "/mainwindow/geometry/pos", QPoint(300,100)).toPoint());
  23.128  
  23.129  
  23.130  	// Create unique temporary directory
  23.131 -	tmpVymDir=makeUniqueDir ("/tmp/vym-XXXXXX");
  23.132 +	bool ok;
  23.133 +	tmpVymDir=makeUniqueDir (ok,"/tmp/vym-XXXXXX");
  23.134 +	if (!ok)
  23.135 +	{
  23.136 +		qWarning ("Mainwindow: Could not create temporary directory, failed to start vym");
  23.137 +		exit (1);
  23.138 +	}
  23.139  
  23.140  	// Create direcctory for clipboard
  23.141  	clipboardDir=tmpVymDir+"/clipboard";
  23.142 @@ -180,30 +189,30 @@
  23.143  	QString p,s;
  23.144  
  23.145  		// application to open URLs
  23.146 -		p="/vym/mainwindow/readerURL";
  23.147 +		p="/mainwindow/readerURL";
  23.148  		#if defined(Q_OS_LINUX)
  23.149 -			s=settings.readEntry (p,"konqueror");
  23.150 +			s=settings.value (p,"konqueror").toString();
  23.151  		#else
  23.152  			#if defined(Q_OS_MACX)
  23.153 -				s=settings.readEntry (p,"/usr/bin/open");
  23.154 +				s=settings.value (p,"/usr/bin/open").toString();
  23.155  			#else
  23.156 -				s=settings.readEntry (p,"mozilla");
  23.157 +				s=settings.value (p,"mozilla");
  23.158  			#endif
  23.159  		#endif
  23.160 -		settings.writeEntry( p,s);
  23.161 +		settings.setValue( p,s);
  23.162  
  23.163  		// application to open PDFs
  23.164 -		p="/vym/mainwindow/readerPDF";
  23.165 +		p="/mainwindow/readerPDF";
  23.166  		#if defined(Q_OS_LINUX)
  23.167 -			s=settings.readEntry (p,"acroread");
  23.168 +			s=settings.value (p,"acroread").toString();
  23.169  		#else
  23.170  			#if defined(Q_OS_MACX)
  23.171 -				s=settings.readEntry (p,"/usr/bin/open");
  23.172 +				s=settings.value (p,"/usr/bin/open").toString();
  23.173  			#else
  23.174 -				s=settings.readEntry (p,"acroread");
  23.175 +				s=settings.value (p,"acroread").toString();
  23.176  			#endif
  23.177  		#endif
  23.178 -		settings.writeEntry( p,s);
  23.179 +		settings.setValue( p,s);
  23.180  
  23.181  	
  23.182  	maxLastMaps=9;
  23.183 @@ -213,6 +222,9 @@
  23.184  	connect( tabWidget, SIGNAL( currentChanged( QWidget * ) ), 
  23.185  		this, SLOT( editorChanged( QWidget * ) ) );
  23.186  
  23.187 +	lineedit=new QLineEdit (this);
  23.188 +	lineedit->hide();
  23.189 +
  23.190  	setCentralWidget(tabWidget);	
  23.191  
  23.192      setupFileActions();
  23.193 @@ -223,14 +235,12 @@
  23.194  	setupFlagActions();
  23.195      setupSettingsActions();
  23.196  	setupContextMenus();
  23.197 -    if (settings.readBoolEntry( "/vym/mainwindow/showTestMenu",false)) setupTestActions();
  23.198 +    if (settings.value( "/mainwindow/showTestMenu",false).toBool()) setupTestActions();
  23.199      setupHelpActions();
  23.200      
  23.201 -	// After menu is created, we can enable some actions
  23.202 -	actionFilePrint->setEnabled (true);
  23.203 -
  23.204      statusBar();
  23.205  
  23.206 +	restoreState (settings.value("/mainwindow/state",0).toByteArray());
  23.207  
  23.208  	// Initialize Find window
  23.209  	findWindow=new FindWindow(NULL,"findwindow");
  23.210 @@ -248,31 +258,29 @@
  23.211  Main::~Main()
  23.212  {
  23.213  	// Save Settings
  23.214 -	settings.writeEntry( "/vym/mainwindow/geometry/width", width() );
  23.215 -	settings.writeEntry( "/vym/mainwindow/geometry/height", height() );
  23.216 -	settings.writeEntry( "/vym/mainwindow/geometry/posX", pos().x() );
  23.217 -	settings.writeEntry( "/vym/mainwindow/geometry/posY", pos().y() );
  23.218 -
  23.219 -	settings.writeEntry( "/vym/version/version", __VYM_VERSION );
  23.220 -	settings.writeEntry( "/vym/version/builddate", __BUILD_DATE );
  23.221 -
  23.222 -	settings.writeEntry( "/vym/mapeditor/editmode/autoselectheading",actionSettingsAutoselectHeading->isOn() );
  23.223 -	settings.writeEntry( "/vym/mapeditor/editmode/autoselecttext",actionSettingsAutoselectText->isOn() );
  23.224 -	settings.writeEntry( "/vym/mapeditor/editmode/pastenewheading",actionSettingsPasteNewHeading->isOn() );
  23.225 -	settings.writeEntry( "/vym/mapeditor/editmode/autoedit",actionSettingsAutoedit->isOn() );
  23.226 -	settings.writeEntry( "/vym/mapeditor/editmode/useDelKey",actionSettingsUseDelKey->isOn() );
  23.227 -	settings.writeEntry( "/vym/mapeditor/editmode/useFlagGroups",actionSettingsUseFlagGroups->isOn() );
  23.228 -	settings.writeEntry( "/vym/export/useHideExport",actionSettingsUseHideExport->isOn() );
  23.229 +	settings.setValue ( "/mainwindow/geometry/size", size() );
  23.230 +	settings.setValue ( "/mainwindow/geometry/pos", pos() );
  23.231 +
  23.232 +	settings.setValue ("/mainwindow/state",saveState(0));
  23.233 +
  23.234 +	settings.setValue( "/version/version", __VYM_VERSION );
  23.235 +	settings.setValue( "/version/builddate", __BUILD_DATE );
  23.236 +
  23.237 +	settings.setValue( "/mapeditor/editmode/autoSelectHeading",actionSettingsAutoselectHeading->isOn() );
  23.238 +	settings.setValue( "/mapeditor/editmode/autoSelectText",actionSettingsAutoselectText->isOn() );
  23.239 +	settings.setValue( "/mapeditor/editmode/autoEdit",actionSettingsAutoedit->isOn() );
  23.240 +	settings.setValue( "/mapeditor/editmode/useDelKey",actionSettingsUseDelKey->isOn() );
  23.241 +	settings.setValue( "/mapeditor/editmode/useFlagGroups",actionSettingsUseFlagGroups->isOn() );
  23.242 +	settings.setValue( "/export/useHideExport",actionSettingsUseHideExport->isOn() );
  23.243  
  23.244  	QString s;
  23.245  	int maps=lastMaps.count();
  23.246 -	settings.writeEntry( "/vym/lastMaps/number",maps );
  23.247 +	settings.setValue( "/lastMaps/number",maps );
  23.248  	for (int i=1;i<=maps;i++)
  23.249  	{
  23.250 -		QStringList::Iterator it = lastMaps.at(i-1);
  23.251 -		s=QString("/vym/lastMaps/map-%1").arg(i);
  23.252 +		s=QString("/lastMaps/map-%1").arg(i);
  23.253  		if (!s.isEmpty() && i<=maxLastMaps) 
  23.254 -			settings.writeEntry (s, *it);
  23.255 +			settings.setValue (s, lastMaps.at(i-1));
  23.256  	}
  23.257  
  23.258  
  23.259 @@ -315,215 +323,327 @@
  23.260  // File Actions
  23.261  void Main::setupFileActions()
  23.262  {
  23.263 -    QToolBar *tb = new QToolBar( this );
  23.264 -    tb->setLabel( "File Actions" );
  23.265 -    QPopupMenu *menu = new QPopupMenu( this );
  23.266 -    menuBar()->insertItem( tr( "&File" ), menu );
  23.267 -
  23.268 -	// Keycodes:  /usr/lib64/qt3/include/qnamespace.h
  23.269 +	QMenu *fileMenu = menuBar()->addMenu ( tr ("&Map") );
  23.270 +    QToolBar *tb = addToolBar( tr ("&Map") );
  23.271 +	tb->setObjectName ("mapTB");
  23.272  
  23.273      QAction *a;
  23.274 -    a = new QAction( tr( "New map","File menu" ), QPixmap( iconPath+"filenew.png"), tr( "&New..." ), CTRL + Key_N, this, "fileNew" );
  23.275 -    connect( a, SIGNAL( activated() ), this, SLOT( fileNew() ) );
  23.276 +    a = new QAction(QPixmap( iconPath+"filenew.png"), tr( "&New..." ),this);
  23.277 +	a->setStatusTip ( tr( "New map","File menu" ) );
  23.278 +	a->setShortcut ( Qt::CTRL + Qt::Key_N );
  23.279      a->addTo( tb );
  23.280 -    a->addTo( menu );
  23.281 +	fileMenu->addAction (a);
  23.282 +    connect( a, SIGNAL( triggered() ), this, SLOT( fileNew() ) );
  23.283  	
  23.284 -    a = new QAction( tr( "Open","File menu" ), QPixmap( iconPath+"fileopen.png"), tr( "&Open..." ), CTRL + Key_O, this, "fileOpen" );
  23.285 -    connect( a, SIGNAL( activated() ), this, SLOT( fileLoad() ) );
  23.286 +    a = new QAction( QPixmap( iconPath+"fileopen.png"), tr( "&Open..." ),this);
  23.287 +	a->setStatusTip (tr( "Open","File menu" ) );
  23.288 +	a->setShortcut ( Qt::CTRL + Qt::Key_O );
  23.289      a->addTo( tb );
  23.290 -    a->addTo( menu );
  23.291 +	fileMenu->addAction (a);
  23.292 +    connect( a, SIGNAL( triggered() ), this, SLOT( fileLoad() ) );
  23.293  	
  23.294 -	lastMapsMenu = new QPopupMenu (this);
  23.295 -
  23.296 -    menu->insertItem (tr("Open Recent"),lastMapsMenu );
  23.297 -    menu->insertSeparator();
  23.298 +	fileLastMapsMenu = fileMenu->addMenu (tr("Open Recent"));
  23.299 +	fileMenu->addSeparator();
  23.300  	
  23.301 -    a = new QAction( tr( "Save" ), QPixmap( iconPath+"filesave.png"), tr( "&Save..." ), CTRL + Key_S, this, "fileSave" );
  23.302 -    connect( a, SIGNAL( activated() ), this, SLOT( fileSave() ) );
  23.303 +    a = new QAction( QPixmap( iconPath+"filesave.png"), tr( "&Save..." ), this);
  23.304 +	a->setStatusTip ( tr( "Save" ));
  23.305 +	a->setShortcut (Qt::CTRL + Qt::Key_S );
  23.306      a->addTo( tb );
  23.307 -    a->addTo( menu );
  23.308 +	fileMenu->addAction (a);
  23.309 +    connect( a, SIGNAL( triggered() ), this, SLOT( fileSave() ) );
  23.310  	actionFileSave=a;
  23.311  	
  23.312 -    a = new QAction( tr( "Save &As" ), QPixmap(iconPath+"filesaveas.png"), tr( "Save &As..." ), 0, this, "fileSaveAs" );
  23.313 -    connect( a, SIGNAL( activated() ), this, SLOT( fileSaveAs() ) );
  23.314 -    a->addTo( menu );
  23.315 -
  23.316 -    menu->insertSeparator();
  23.317 -
  23.318 -	importMenu = new QPopupMenu (this);
  23.319 -    menu->insertItem (tr("Import"),importMenu );
  23.320 -
  23.321 -	a = new QAction( tr( "Import")+" "+tr("KDE Bookmarks" ), QPixmap(), tr("KDE Bookmarks"), 0, this, "importKDEBookmarks" );
  23.322 -	connect( a, SIGNAL( activated() ), this, SLOT( fileImportKDEBookmarks() ) );
  23.323 -	a->addTo (importMenu);
  23.324 -
  23.325 -    if (settings.readBoolEntry( "/vym/mainwindow/showTestMenu",false)) 
  23.326 +    a = new QAction( QPixmap(iconPath+"filesaveas.png"), tr( "Save &As..." ), this);
  23.327 +	a->setStatusTip (tr( "Save &As" ) );
  23.328 +	fileMenu->addAction (a);
  23.329 +    connect( a, SIGNAL( triggered() ), this, SLOT( fileSaveAs() ) );
  23.330 +
  23.331 +	fileMenu->addSeparator();
  23.332 +
  23.333 +	fileImportMenu = fileMenu->addMenu (tr("Import"));
  23.334 +
  23.335 +	a = new QAction(tr("KDE Bookmarks"), this);
  23.336 +	a->setStatusTip ( tr( "Import")+" "+tr("KDE Bookmarks" ));
  23.337 +	a->addTo (fileImportMenu);
  23.338 +	connect( a, SIGNAL( triggered() ), this, SLOT( fileImportKDEBookmarks() ) );
  23.339 +
  23.340 +    if (settings.value( "/mainwindow/showTestMenu",false).toBool()) 
  23.341  	{
  23.342 -		a = new QAction( tr( "Import")+" "+tr("Firefox Bookmarks" ), QPixmap(), tr("Firefox Bookmarks"), 0, this, "importFirefoxBookmarks" );
  23.343 -		connect( a, SIGNAL( activated() ), this, SLOT( fileImportFirefoxBookmarks() ) );
  23.344 -		a->addTo (importMenu);
  23.345 +		a = new QAction( QPixmap(), tr("Firefox Bookmarks"),this);
  23.346 +		a->setStatusTip (tr( "Import")+" "+tr("Firefox Bookmarks" ) );
  23.347 +		a->addTo (fileImportMenu);
  23.348 +		connect( a, SIGNAL( triggered() ), this, SLOT( fileImportFirefoxBookmarks() ) );
  23.349  	}	
  23.350  
  23.351 -	a = new QAction( tr( "Import")+" Mind Manager" , QPixmap(), "Mind Manager...", 0, this, "importMM" );
  23.352 -	connect( a, SIGNAL( activated() ), this, SLOT( fileImportMM() ) );
  23.353 -	a->addTo (importMenu);
  23.354 -
  23.355 -    a = new QAction( tr( "Import directory structure (experimental)" ), QPixmap(), tr( "Import Dir"+QString("...") ), 0, this, "export" );
  23.356 -    connect( a, SIGNAL( activated() ), this, SLOT( fileImportDir() ) );
  23.357 -    a->addTo( importMenu);
  23.358 -
  23.359 -	exportMenu = new QPopupMenu (this);
  23.360 -    menu->insertItem (tr("Export"),exportMenu );
  23.361 -
  23.362 -    menu->insertSeparator();
  23.363 -
  23.364 -
  23.365 -    a = new QAction( tr( "Print" ), QPixmap( iconPath+"fileprint.png"), tr( "&Print")+QString("..."), CTRL + Key_P, this, "filePrint" );
  23.366 -    connect( a, SIGNAL( activated() ), this, SLOT( filePrint() ) );
  23.367 +	a = new QAction("Mind Manager...",this);
  23.368 +	a->setStatusTip ( tr( "Import")+" Mind Manager"  );
  23.369 +	fileImportMenu->addAction (a);
  23.370 +	connect( a, SIGNAL( triggered() ), this, SLOT( fileImportMM() ) );
  23.371 +
  23.372 +    a = new QAction( tr( "Import Dir"+QString("...") ), this);
  23.373 +	a->setStatusTip (tr( "Import directory structure (experimental)" ) );
  23.374 +	fileImportMenu->addAction (a);
  23.375 +    connect( a, SIGNAL( triggered() ), this, SLOT( fileImportDir() ) );
  23.376 +
  23.377 +	fileExportMenu = fileMenu->addMenu (tr("Export"));
  23.378 +
  23.379 +	a = new QAction( tr("Image")+QString("..."), this);
  23.380 +	a->setStatusTip( tr( "Export map as image" ));
  23.381 +	connect( a, SIGNAL( triggered() ), this, SLOT( fileExportImage() ) );
  23.382 +	fileExportMenu->addAction (a);
  23.383 +
  23.384 +	a = new QAction( "Open Office"+QString("..."), this);
  23.385 +	a->setStatusTip( tr( "Export in Open Document Format used e.g. in Open Office " ));
  23.386 +	connect( a, SIGNAL( triggered() ), this, SLOT( fileExportOOPresentation() ) );
  23.387 +	fileExportMenu->addAction (a);
  23.388 +
  23.389 +	a = new QAction(  "Webpage (XHTML)...",this );
  23.390 +	a->setShortcut (Qt::ALT + Qt::Key_X);
  23.391 +	a->setStatusTip ( tr( "Export as")+" webpage (XHTML)");
  23.392 +    connect( a, SIGNAL( triggered() ), this, SLOT( fileExportXHTML() ) );
  23.393 +	fileExportMenu->addAction (a);
  23.394 +
  23.395 +    a = new QAction( "Text (ASCII)...", this);
  23.396 +	a->setStatusTip ( tr( "Export as")+" ASCII"+" "+tr("(still experimental)" ));
  23.397 +    connect( a, SIGNAL( triggered() ), this, SLOT( fileExportASCII() ) );
  23.398 +	fileExportMenu->addAction (a);
  23.399 +
  23.400 +	a = new QAction( tr("KDE Bookmarks"), this);
  23.401 +	a->setStatusTip( tr( "Export as")+" "+tr("KDE Bookmarks" ));
  23.402 +	connect( a, SIGNAL( triggered() ), this, SLOT( fileExportKDEBookmarks() ) );
  23.403 +	fileExportMenu->addAction (a);
  23.404 +
  23.405 +    a = new QAction( "Taskjuggler...", this );
  23.406 +    a->setStatusTip( tr( "Export as")+" Taskjuggler"+" "+tr("(still experimental)" ));
  23.407 +    connect( a, SIGNAL( triggered() ), this, SLOT( fileExportTaskjuggler() ) );
  23.408 +	fileExportMenu->addAction (a);
  23.409 +
  23.410 +    a = new QAction( "LaTeX...", this);
  23.411 +    a->setStatusTip( tr( "Export as")+" LaTeX"+" "+tr("(still experimental)" ));
  23.412 +    connect( a, SIGNAL( triggered() ), this, SLOT( fileExportLaTeX() ) );
  23.413 +	fileExportMenu->addAction (a);
  23.414 +
  23.415 +	a = new QAction( "XML..." , this );
  23.416 +	a->setStatusTip (tr( "Export as")+" XML");
  23.417 +    connect( a, SIGNAL( triggered() ), this, SLOT( fileExportXML() ) );
  23.418 +	fileExportMenu->addAction (a);
  23.419 +
  23.420 +	fileMenu->addSeparator();
  23.421 +
  23.422 +    a = new QAction(QPixmap( iconPath+"fileprint.png"), tr( "&Print")+QString("..."), this);
  23.423 +	a->setStatusTip ( tr( "Print" ) );
  23.424 +	a->setShortcut (Qt::CTRL + Qt::Key_P );
  23.425      a->addTo( tb );
  23.426 -    a->addTo( menu );
  23.427 +	fileMenu->addAction (a);
  23.428 +    connect( a, SIGNAL( triggered() ), this, SLOT( filePrint() ) );
  23.429  	actionFilePrint=a;
  23.430  
  23.431 -    a = new QAction( tr( "Close Map" ), QPixmap(iconPath+"fileclose.png"), tr( "&Close Map" ), ALT + Key_C, this, "fileCloseMap" );
  23.432 -    connect( a, SIGNAL( activated() ), this, SLOT( fileCloseMap() ) );
  23.433 -    a->addTo( menu );
  23.434 -
  23.435 -    a = new QAction( tr( "Exit")+" "+__VYM, QPixmap(iconPath+"exit.png"), tr( "E&xit")+" "+__VYM, CTRL + Key_Q, this, "fileExitVYM" );
  23.436 -    connect( a, SIGNAL( activated() ), this, SLOT( fileExitVYM() ) );
  23.437 -    a->addTo( menu );
  23.438 +    a = new QAction( QPixmap(iconPath+"fileclose.png"), tr( "&Close Map" ), this);
  23.439 +	a->setStatusTip (tr( "Close Map" ) );
  23.440 +	a->setShortcut (Qt::ALT + Qt::Key_C );
  23.441 +	fileMenu->addAction (a);
  23.442 +    connect( a, SIGNAL( triggered() ), this, SLOT( fileCloseMap() ) );
  23.443 +
  23.444 +    a = new QAction(QPixmap(iconPath+"exit.png"), tr( "E&xit")+" "+__VYM, this);
  23.445 +	a->setStatusTip ( tr( "Exit")+" "+__VYM );
  23.446 +	a->setShortcut (Qt::CTRL + Qt::Key_Q );
  23.447 +	fileMenu->addAction (a);
  23.448 +    connect( a, SIGNAL( triggered() ), this, SLOT( fileExitVYM() ) );
  23.449  }
  23.450  
  23.451  
  23.452  //Edit Actions
  23.453  void Main::setupEditActions()
  23.454  {
  23.455 -    QToolBar *tb = new QToolBar( this );
  23.456 +    QToolBar *tb = addToolBar( tr ("&Actions") );
  23.457      tb->setLabel( "Edit Actions" );
  23.458 -    QPopupMenu *menu = new QPopupMenu( this );
  23.459 -    menuBar()->insertItem( tr( "&Edit" ), menu );
  23.460 +	tb->setObjectName ("actionsTB");
  23.461 +    QMenu *editMenu = menuBar()->addMenu( tr("&Edit") );
  23.462  
  23.463      QAction *a;
  23.464  	QAction *alt;
  23.465 -    a = new QAction( tr( "Undo" ), QPixmap( iconPath+"undo.png"), tr( "&Undo" ), CTRL + Key_Z, this, "editUndo" );
  23.466 -    connect( a, SIGNAL( activated() ), this, SLOT( editUndo() ) );
  23.467 +    a = new QAction( QPixmap( iconPath+"undo.png"), tr( "&Undo" ),this);
  23.468 +    connect( a, SIGNAL( triggered() ), this, SLOT( editUndo() ) );
  23.469 +	a->setStatusTip (tr( "Undo" ) );
  23.470 +	a->setShortcut ( Qt::CTRL + Qt::Key_Z );
  23.471  	a->setEnabled (false);
  23.472 -    a->addTo( tb );
  23.473 -    a->addTo( menu );
  23.474 +    tb->addAction (a);
  23.475 +	editMenu->addAction (a);
  23.476  	actionEditUndo=a;
  23.477      
  23.478 -    if (settings.readBoolEntry( "/vym/mainwindow/showTestMenu",false)) 
  23.479 -	{
  23.480 -		a = new QAction( tr( "Redo" ), QPixmap( iconPath+"redo.png"), tr( "&Redo" ), CTRL + Key_Y, this, "editRedo" ); 
  23.481 -		connect( a, SIGNAL( activated() ), this, SLOT( editRedo() ) );
  23.482 -		a->addTo( tb );
  23.483 -		a->addTo( menu );
  23.484 -	}
  23.485 +	a = new QAction( QPixmap( iconPath+"redo.png"), tr( "&Redo" ), this); 
  23.486 +	a->setStatusTip (tr( "Redo" ));
  23.487 +	a->setShortcut (Qt::CTRL + Qt::Key_Y );
  23.488 +    tb->addAction (a);
  23.489 +	editMenu->addAction (a);
  23.490 +	connect( a, SIGNAL( triggered() ), this, SLOT( editRedo() ) );
  23.491 +	actionEditRedo=a;
  23.492     
  23.493 -    menu->insertSeparator();
  23.494 -    a = new QAction( tr( "Copy" ), QPixmap( iconPath+"editcopy.png"), tr( "&Copy" ), CTRL + Key_C, this, "editCopy" );
  23.495 -    connect( a, SIGNAL( activated() ), this, SLOT( editCopy() ) );
  23.496 +	editMenu->addSeparator();
  23.497 +    a = new QAction(QPixmap( iconPath+"editcopy.png"), tr( "&Copy" ), this);
  23.498 +	a->setStatusTip ( tr( "Copy" ) );
  23.499 +	a->setShortcut (Qt::CTRL + Qt::Key_C );
  23.500  	a->setEnabled (false);
  23.501 -    a->addTo( tb );
  23.502 -    a->addTo( menu );
  23.503 +    tb->addAction (a);
  23.504 +	editMenu->addAction (a);
  23.505 +    connect( a, SIGNAL( triggered() ), this, SLOT( editCopy() ) );
  23.506  	actionEditCopy=a;
  23.507 -    a = new QAction( tr( "Cut" ), QPixmap( iconPath+"editcut.png" ), tr( "Cu&t" ), CTRL + Key_X, this, "editCut" );
  23.508 -    connect( a, SIGNAL( activated() ), this, SLOT( editCut() ) );
  23.509 +	
  23.510 +    a = new QAction(QPixmap( iconPath+"editcut.png" ), tr( "Cu&t" ), this);
  23.511 +	a->setStatusTip ( tr( "Cut" ) );
  23.512 +	a->setShortcut (Qt::CTRL + Qt::Key_X );
  23.513  	a->setEnabled (false);
  23.514 -    a->addTo( tb );
  23.515 -    a->addTo( menu );
  23.516 +    tb->addAction (a);
  23.517 +	editMenu->addAction (a);
  23.518  	actionEditCut=a;
  23.519 -    a = new QAction( tr( "Paste" ), QPixmap( iconPath+"editpaste.png"), tr( "&Paste" ), CTRL + Key_V, this, "editPaste" );
  23.520 -    connect( a, SIGNAL( activated() ), this, SLOT( editPaste() ) );
  23.521 +    connect( a, SIGNAL( triggered() ), this, SLOT( editCut() ) );
  23.522 +	
  23.523 +    a = new QAction(QPixmap( iconPath+"editpaste.png"), tr( "&Paste" ),this);
  23.524 +    connect( a, SIGNAL( triggered() ), this, SLOT( editPaste() ) );
  23.525 +	a->setStatusTip ( tr( "Paste" ) );
  23.526 +	a->setShortcut ( Qt::CTRL + Qt::Key_V );
  23.527  	a->setEnabled (false);
  23.528 -    a->addTo( tb );
  23.529 -    a->addTo( menu );
  23.530 +    tb->addAction (a);
  23.531 +	editMenu->addAction (a);
  23.532  	actionEditPaste=a;
  23.533  
  23.534      // Shortcuts to modify heading:
  23.535 -    a = new QAction( tr( "edit Heading" ),tr( "Edit heading" ), Key_Enter, this, "editHeading" );
  23.536 -    connect( a, SIGNAL( activated() ), this, SLOT( editHeading() ) );
  23.537 +    a = new QAction(tr( "Edit heading" ),this);
  23.538 +	a->setStatusTip ( tr( "edit Heading" ));
  23.539 +	a->setShortcut ( Qt::Key_Enter);
  23.540 +//	a->setShortcutContext (Qt::WindowShortcut);
  23.541 +	addAction (a);
  23.542 +    connect( a, SIGNAL( triggered() ), this, SLOT( editHeading() ) );
  23.543  	actionListBranches.append(a);
  23.544 -    a = new QAction( tr( "edit Heading" ),tr( "Edit heading" ), Key_Return, this, "editHeading" );
  23.545 -    connect( a, SIGNAL( activated() ), this, SLOT( editHeading() ) );
  23.546 +    a = new QAction( tr( "Edit heading" ), this);
  23.547 +	a->setStatusTip (tr( "edit Heading" ));
  23.548 +	a->setShortcut (Qt::Key_Return );
  23.549 +	//a->setShortcutContext (Qt::WindowShortcut);
  23.550 +	addAction (a);
  23.551 +    connect( a, SIGNAL( triggered() ), this, SLOT( editHeading() ) );
  23.552  	actionListBranches.append(a);
  23.553 +	editMenu->addAction (a);
  23.554  	actionEditHeading=a;
  23.555 -    a = new QAction( tr( "edit Heading" ),tr( "Edit heading" ), Key_F2, this, "editHeading" );
  23.556 -    connect( a, SIGNAL( activated() ), this, SLOT( editHeading() ) );
  23.557 -	a->setEnabled (false);
  23.558 -	actionEditHeading=a;
  23.559 +    a = new QAction( tr( "Edit heading" ), this);
  23.560 +	a->setStatusTip (tr( "edit Heading" ));
  23.561 +	a->setShortcut ( Qt::Key_F2 );
  23.562 +	a->setShortcutContext (Qt::WindowShortcut);
  23.563 +	addAction (a);
  23.564 +    connect( a, SIGNAL( triggered() ), this, SLOT( editHeading() ) );
  23.565  	actionListBranches.append(a);
  23.566      
  23.567      // Shortcut to delete selection
  23.568 -    a = new QAction( tr( "Delete Selection" ),tr( "Delete Selection" ), Key_Delete, this, "deleteBranch" );
  23.569 -    connect( a, SIGNAL( activated() ), this, SLOT( editDeleteSelection() ) );
  23.570 -	a->setEnabled (false);
  23.571 +    a = new QAction( tr( "Delete Selection" ),this);
  23.572 +	a->setStatusTip (tr( "Delete Selection" ));
  23.573 +	a->setShortcut ( Qt::Key_Delete);
  23.574 +	a->setShortcutContext (Qt::WindowShortcut);
  23.575 +	addAction (a);
  23.576 +    connect( a, SIGNAL( triggered() ), this, SLOT( editDeleteSelection() ) );
  23.577  	actionEditDelete=a;
  23.578      
  23.579      // Shortcut to add branch
  23.580 -	alt = new QAction( tr( "Add a branch as child of selection" ),QPixmap(iconPath+"newbranch.png"),tr( "Add branch as child" ), Key_A, this, "newBranch" );
  23.581 -    connect( alt, SIGNAL( activated() ), this, SLOT( editNewBranch() ) );
  23.582 -		a = new QAction( tr( "Add a branch as child of selection" ),QPixmap(iconPath+"newbranch.png"),tr( "Add branch as child" ), Key_Insert, this, "newBranch" );
  23.583 -    connect( a, SIGNAL( activated() ), this, SLOT( editNewBranch() ) );
  23.584 -	a->setEnabled (false);
  23.585 +	alt = new QAction(QPixmap(iconPath+"newbranch.png"), tr( "Add branch as child" ), this);
  23.586 +	alt->setStatusTip ( tr( "Add a branch as child of selection" ));
  23.587 +	alt->setShortcut (Qt::Key_A);
  23.588 +	alt->setShortcutContext (Qt::WindowShortcut);
  23.589 +	addAction (alt);
  23.590 +	connect( alt, SIGNAL( triggered() ), this, SLOT( editNewBranch() ) );
  23.591 +	a = new QAction(QPixmap(iconPath+"newbranch.png"), tr( "Add branch as child" ), this);
  23.592 +	a->setStatusTip ( tr( "Add a branch as child of selection" ));
  23.593 +	a->setShortcut (Qt::Key_Insert);	
  23.594 +	connect( a, SIGNAL( triggered() ), this, SLOT( editNewBranch() ) );
  23.595  	actionListBranches.append(a);
  23.596  	#if defined (Q_OS_MACX)
  23.597 -		// In OSX show different shortcut in menues, the keys work independtly always			
  23.598 +		// In OSX show different shortcut in menues, the keys work indepently always			
  23.599  		actionEditAddBranch=alt;
  23.600  	#else	
  23.601  		actionEditAddBranch=a;
  23.602  	#endif	
  23.603 -    actionEditAddBranch->addTo( menu );
  23.604 -    actionEditAddBranch->addTo( tb );
  23.605 +	editMenu->addAction (actionEditAddBranch);
  23.606 +	tb->addAction (actionEditAddBranch);
  23.607 +
  23.608  
  23.609      // Add branch by inserting it at selection
  23.610 -	a = new QAction( tr( "Add a branch by inserting and making selection its child" ),tr( "Add branch (insert)" ), ALT + Key_Insert, this, "newBranchHere" );
  23.611 -    connect( a, SIGNAL( activated() ), this, SLOT( editNewBranchHere() ) );
  23.612 +	a = new QAction(tr( "Add branch (insert)" ), this);
  23.613 +	a->setStatusTip ( tr( "Add a branch by inserting and making selection its child" ));
  23.614 +	a->setShortcut (Qt::ALT + Qt::Key_Insert );
  23.615 +	a->setShortcutContext (Qt::WindowShortcut);
  23.616 +	addAction (a);
  23.617 +    connect( a, SIGNAL( triggered() ), this, SLOT( editNewBranchHere() ) );
  23.618  	a->setEnabled (false);
  23.619  	actionListBranches.append(a);
  23.620  	actionEditAddBranchHere=a;
  23.621 -	a = new QAction( tr( "Add a branch by inserting and making selection its child" ),tr( "Add branch (insert)" ), ALT + Key_A, this, "newBranchHere" );
  23.622 -    connect( a, SIGNAL( activated() ), this, SLOT( editNewBranchHere() ) );
  23.623 +	a = new QAction(tr( "Add branch (insert)" ),this);
  23.624 +	a->setStatusTip ( tr( "Add a branch by inserting and making selection its child" ));
  23.625 +	a->setShortcut ( Qt::ALT + Qt::Key_A );
  23.626 +	a->setShortcutContext (Qt::WindowShortcut);
  23.627 +	addAction (a);
  23.628 +    connect( a, SIGNAL( triggered() ), this, SLOT( editNewBranchHere() ) );
  23.629  	actionListBranches.append(a);
  23.630  
  23.631  	// Add branch above
  23.632 -    a = new QAction( tr( "Add a branch above selection" ),tr( "Add branch above" ), SHIFT+Key_Insert, this, "newBranch" );
  23.633 -    connect( a, SIGNAL( activated() ), this, SLOT( editNewBranchAbove() ) );
  23.634 +    a = new QAction(tr( "Add branch above" ), this);
  23.635 +	a->setStatusTip ( tr( "Add a branch above selection" ));
  23.636 +	a->setShortcut (Qt::SHIFT+Qt::Key_Insert );
  23.637 +	a->setShortcutContext (Qt::WindowShortcut);
  23.638 +	addAction (a);
  23.639 +    connect( a, SIGNAL( triggered() ), this, SLOT( editNewBranchAbove() ) );
  23.640  	a->setEnabled (false);
  23.641  	actionListBranches.append(a);
  23.642  	actionEditAddBranchAbove=a;
  23.643 -    a = new QAction( tr( "Add a branch above selection" ),tr( "Add branch above" ), SHIFT+Key_A, this, "newBranch" );
  23.644 -    connect( a, SIGNAL( activated() ), this, SLOT( editNewBranchAbove() ) );
  23.645 +    a = new QAction(tr( "Add branch above" ), this);
  23.646 +	a->setStatusTip ( tr( "Add a branch above selection" ));
  23.647 +	a->setShortcut (Qt::SHIFT+Qt::Key_A );
  23.648 +	a->setShortcutContext (Qt::WindowShortcut);
  23.649 +	addAction (a);
  23.650 +    connect( a, SIGNAL( triggered() ), this, SLOT( editNewBranchAbove() ) );
  23.651  	actionListBranches.append(a);
  23.652  
  23.653  	// Add branch below 
  23.654 -    a = new QAction( tr( "Add a branch below selection" ),tr( "Add branch below" ), CTRL +Key_Insert, this, "newBranch" );
  23.655 -    connect( a, SIGNAL( activated() ), this, SLOT( editNewBranchBelow() ) );
  23.656 +    a = new QAction(tr( "Add branch below" ), this);
  23.657 +	a->setStatusTip ( tr( "Add a branch below selection" ));
  23.658 +	a->setShortcut (Qt::CTRL +Qt::Key_Insert );
  23.659 +	a->setShortcutContext (Qt::WindowShortcut);
  23.660 +	addAction (a);
  23.661 +    connect( a, SIGNAL( triggered() ), this, SLOT( editNewBranchBelow() ) );
  23.662  	a->setEnabled (false);
  23.663  	actionListBranches.append(a);
  23.664  	actionEditAddBranchBelow=a;
  23.665 -    a = new QAction( tr( "Add a branch below selection" ),tr( "Add branch below" ), CTRL +Key_A, this, "newBranch" );
  23.666 -    connect( a, SIGNAL( activated() ), this, SLOT( editNewBranchBelow() ) );
  23.667 +    a = new QAction(tr( "Add branch below" ), this);
  23.668 +	a->setStatusTip ( tr( "Add a branch below selection" ));
  23.669 +	a->setShortcut (Qt::CTRL +Qt::Key_A );
  23.670 +	a->setShortcutContext (Qt::WindowShortcut);
  23.671 +	addAction (a);
  23.672 +    connect( a, SIGNAL( triggered() ), this, SLOT( editNewBranchBelow() ) );
  23.673  	actionListBranches.append(a);
  23.674  
  23.675 -    a = new QAction( tr( "Move branch up" ), QPixmap(iconPath+"up.png" ), tr( "Move up" ), Key_PageUp, this, "editMoveUp" );
  23.676 -    connect( a, SIGNAL( activated() ), this, SLOT( editMoveUp() ) );
  23.677 +    a = new QAction(QPixmap(iconPath+"up.png" ), tr( "Move up" ), this);
  23.678 +	a->setStatusTip ( tr( "Move branch up" ) );
  23.679 +	a->setShortcut (Qt::Key_PageUp );
  23.680  	a->setEnabled (false);
  23.681 -    a->addTo( tb );
  23.682 -    a->addTo( menu );
  23.683 +    tb->addAction (a);
  23.684 +	editMenu->addAction (a);
  23.685 +    connect( a, SIGNAL( triggered() ), this, SLOT( editMoveUp() ) );
  23.686  	actionEditMoveUp=a;
  23.687  
  23.688 -    a = new QAction( tr( "Move branch down" ), QPixmap( iconPath+"down.png"), tr( "Move down" ), Key_PageDown, this, "editMoveDown" );
  23.689 -    connect( a, SIGNAL( activated() ), this, SLOT( editMoveDown() ) );
  23.690 +    a = new QAction( QPixmap( iconPath+"down.png"), tr( "Move down" ),this);
  23.691 +    connect( a, SIGNAL( triggered() ), this, SLOT( editMoveDown() ) );
  23.692 +	a->setStatusTip (tr( "Move branch down" ) );
  23.693 +	a->setShortcut ( Qt::Key_PageDown );
  23.694  	a->setEnabled (false);
  23.695 -    a->addTo( tb );
  23.696 -    a->addTo( menu );
  23.697 +    tb->addAction (a);
  23.698 +	editMenu->addAction (a);
  23.699  	actionEditMoveDown=a;
  23.700  	
  23.701  
  23.702 -	a = new QAction( tr( "Scroll branch" ), QPixmap(flagsPath+"flag-scrolled-right.png"), tr( "Scroll branch" ), Key_ScrollLock, this, "scroll" );
  23.703 -    connect( a, SIGNAL( activated() ), this, SLOT( editToggleScroll() ) );
  23.704 -	alt = new QAction( tr( "Scroll branch" ), QPixmap(flagsPath+"flag-scrolled-right.png"), tr( "Scroll branch" ), Key_S, this, "scroll" );
  23.705 -    connect( alt, SIGNAL( activated() ), this, SLOT( editToggleScroll() ) );
  23.706 +	a = new QAction( QPixmap(flagsPath+"flag-scrolled-right.png"), tr( "Scroll branch" ),this);
  23.707 +	a->setShortcut ( Qt::Key_ScrollLock );
  23.708 +	a->setStatusTip (tr( "Scroll branch" ) );
  23.709 +    connect( a, SIGNAL( triggered() ), this, SLOT( editToggleScroll() ) );
  23.710 +	alt = new QAction( QPixmap(flagsPath+"flag-scrolled-right.png"), tr( "Scroll branch" ), this);
  23.711 +	alt->setShortcut ( Qt::Key_S );
  23.712 +	alt->setStatusTip (tr( "Scroll branch" )); 
  23.713 +    connect( alt, SIGNAL( triggered() ), this, SLOT( editToggleScroll() ) );
  23.714  	#if defined(Q_OS_MACX)
  23.715  		actionEditToggleScroll=alt;
  23.716  	#else	
  23.717 @@ -531,147 +651,215 @@
  23.718  	#endif	
  23.719  	actionEditToggleScroll->setEnabled (false);
  23.720  	actionEditToggleScroll->setToggleAction(true);
  23.721 -    actionEditToggleScroll->addTo( tb );
  23.722 -    actionEditToggleScroll->addTo( menu );
  23.723 +    tb->addAction (actionEditToggleScroll);
  23.724 +    editMenu->addAction ( actionEditToggleScroll);
  23.725 +	editMenu->addAction (actionEditToggleScroll);
  23.726  	actionListBranches.append(actionEditToggleScroll);
  23.727  	
  23.728 -    a = new QAction( tr( "Unscroll all" ), QPixmap(), tr( "Unscroll all scrolled branches" ), 0, this, "scroll" );
  23.729 -    connect( a, SIGNAL( activated() ), this, SLOT( editUnScrollAll() ) );
  23.730 -    a->addTo( menu );
  23.731 +    a = new QAction( tr( "Unscroll all scrolled branches" ), this);
  23.732 +	a->setStatusTip (tr( "Unscroll all" ));
  23.733 +	editMenu->addAction (a);
  23.734 +    connect( a, SIGNAL( triggered() ), this, SLOT( editUnScrollAll() ) );
  23.735  	
  23.736 -    menu->insertSeparator();
  23.737 -
  23.738 -	a = new QAction( tr( "Find" ), QPixmap(iconPath+"find.png"), tr( "Find"+QString("...") ), CTRL + Key_F, this, "find" );
  23.739 -    connect( a, SIGNAL( activated() ), this, SLOT( editOpenFindWindow() ) );
  23.740 -    a->addTo( menu );
  23.741 +	editMenu->addSeparator();
  23.742 +
  23.743 +	a = new QAction( QPixmap(iconPath+"find.png"), tr( "Find"+QString("...") ), this);
  23.744 +	a->setStatusTip (tr( "Find" ) );
  23.745 +	a->setShortcut (Qt::CTRL + Qt::Key_F );
  23.746 +	editMenu->addAction (a);
  23.747 +    connect( a, SIGNAL( triggered() ), this, SLOT( editOpenFindWindow() ) );
  23.748      
  23.749 -	menu->insertSeparator();
  23.750 -
  23.751 -	a = new QAction( tr( "Open URL" ), QPixmap(flagsPath+"flag-url.png"), tr( "Open URL" ), CTRL + Key_U, this, "url" );
  23.752 -    connect( a, SIGNAL( activated() ), this, SLOT( editOpenURL() ) );
  23.753 -    a->addTo( tb );
  23.754 -	a->setEnabled (false);
  23.755 +	editMenu->addSeparator();
  23.756 +
  23.757 +	a = new QAction( QPixmap(flagsPath+"flag-url.png"), tr( "Open URL" ), this);
  23.758 +	a->setShortcut (Qt::CTRL + Qt::Key_U );
  23.759 +	a->setShortcut (tr( "Open URL" ));
  23.760 +    tb->addAction (a);
  23.761 +	addAction(a);
  23.762 +    connect( a, SIGNAL( triggered() ), this, SLOT( editOpenURL() ) );
  23.763  	actionEditOpenURL=a;
  23.764  
  23.765 -	a = new QAction( tr( "Open URL in new tab" ), QPixmap(), tr( "Open URL in new tab" ), CTRL + Key_U, this, "urltab" );
  23.766 -    connect( a, SIGNAL( activated() ), this, SLOT( editOpenURLTab() ) );
  23.767 -	a->setEnabled (false);
  23.768 +	a = new QAction( tr( "Open URL in new tab" ), this);
  23.769 +	a->setStatusTip (tr( "Open URL in new tab" ));
  23.770 +	a->setShortcut (Qt::CTRL+Qt::Key_U );
  23.771 +	addAction(a);
  23.772 +    connect( a, SIGNAL( triggered() ), this, SLOT( editOpenURLTab() ) );
  23.773  	actionEditOpenURLTab=a;
  23.774  
  23.775 -	a = new QAction( tr( "Edit URL" ), QPixmap(), tr( "Edit URL"+QString("...") ), SHIFT + CTRL + Key_U, this, "url" );
  23.776 -    connect( a, SIGNAL( activated() ), this, SLOT( editURL() ) );
  23.777 +	a = new QAction( tr( "Open all URLs in subtree" ), this);
  23.778 +	a->setStatusTip (tr( "Open all URLs in subtree" ));
  23.779 +	addAction(a);
  23.780 +	actionListBranches.append(a);
  23.781 +    connect( a, SIGNAL( triggered() ), this, SLOT( editOpenMultipleURLTabs() ) );
  23.782 +	actionEditOpenMultipleURLTabs=a;
  23.783 +
  23.784 +	a = new QAction(QPixmap(), tr( "Edit URL"+QString("...") ), this);
  23.785 +	a->setStatusTip ( tr( "Edit URL" ) );
  23.786 +	a->setShortcut (Qt::SHIFT + Qt::CTRL + Qt::Key_U );
  23.787 +	//a->setShortcut ( Qt::Key_U );
  23.788 +	a->setShortcutContext (Qt::WindowShortcut);
  23.789 +	actionListBranches.append(a);
  23.790 +	addAction(a);
  23.791 +    connect( a, SIGNAL( triggered() ), this, SLOT( editURL() ) );
  23.792 +	actionEditURL=a;
  23.793 +	
  23.794 +	a = new QAction( tr( "Use heading for URL" ), this);
  23.795 +	a->setStatusTip ( tr( "Use heading of selected branch as URL" ));
  23.796  	a->setEnabled (false);
  23.797  	actionListBranches.append(a);
  23.798 -	actionEditURL=a;
  23.799 -	
  23.800 -	a = new QAction( tr( "Use heading of selected branch as URL" ), QPixmap(), tr( "Use heading for URL" ), 0, this, "heading2url" );
  23.801 -    connect( a, SIGNAL( activated() ), this, SLOT( editHeading2URL() ) );
  23.802 +    connect( a, SIGNAL( triggered() ), this, SLOT( editHeading2URL() ) );
  23.803 +	actionEditHeading2URL=a;
  23.804 +    
  23.805 +	a = new QAction(tr( "Create URL to Bugzilla" ), this);
  23.806 +	a->setStatusTip ( tr( "Create URL to Bugzilla" ));
  23.807  	a->setEnabled (false);
  23.808  	actionListBranches.append(a);
  23.809 -	actionEditHeading2URL=a;
  23.810 +    connect( a, SIGNAL( triggered() ), this, SLOT( editBugzilla2URL() ) );
  23.811 +	actionEditBugzilla2URL=a;
  23.812      
  23.813 -	a = new QAction( tr( "Create URL to Bugzilla" ), QPixmap(), tr( "Create URL to Bugzilla" ), 0, this, "bugzilla2url" );
  23.814 -    connect( a, SIGNAL( activated() ), this, SLOT( editBugzilla2URL() ) );
  23.815 +	a = new QAction(tr( "Create URL to FATE" ), this);
  23.816 +	a->setStatusTip ( tr( "Create URL to FATE" ));
  23.817  	a->setEnabled (false);
  23.818  	actionListBranches.append(a);
  23.819 -	actionEditBugzilla2URL=a;
  23.820 -    
  23.821 -	a = new QAction( tr( "Create URL to FATE" ), QPixmap(), tr( "Create URL to FATE" ), 0, this, "FATE2url" );
  23.822 -    connect( a, SIGNAL( activated() ), this, SLOT( editFATE2URL() ) );
  23.823 +    connect( a, SIGNAL( triggered() ), this, SLOT( editFATE2URL() ) );
  23.824 +	actionEditFATE2URL=a;
  23.825 +	
  23.826 +    a = new QAction(QPixmap(flagsPath+"flag-vymlink.png"), tr( "Open xlinked map" ), this);
  23.827 +	a->setStatusTip ( tr( "Jump to another vym map, if needed load it first" ));
  23.828 +    tb->addAction (a);
  23.829 +	a->setEnabled (false);
  23.830 +    connect( a, SIGNAL( triggered() ), this, SLOT( editOpenVymLink() ) );
  23.831 +	actionEditOpenVymLink=a;
  23.832 +	
  23.833 +    a = new QAction(QPixmap(), tr( "Open all vym links in subtree" ), this);
  23.834 +	a->setStatusTip ( tr( "Open all vym links in subtree" ));
  23.835  	a->setEnabled (false);
  23.836  	actionListBranches.append(a);
  23.837 -	actionEditFATE2URL=a;
  23.838 +    connect( a, SIGNAL( triggered() ), this, SLOT( editOpenMultipleVymLinks() ) );
  23.839 +	actionEditOpenMultipleVymLinks=a;
  23.840  	
  23.841 -    a = new QAction( tr( "Jump to another vym map, if needed load it first" ), QPixmap(flagsPath+"flag-vymlink.png"), tr( "Jump to map" ), 0, this, "jumpMap" );
  23.842 -    connect( a, SIGNAL( activated() ), this, SLOT( editOpenVymLink() ) );
  23.843 -    a->addTo( tb );
  23.844 +
  23.845 +    a = new QAction(tr( "Edit vym link"+QString("...") ), this);
  23.846  	a->setEnabled (false);
  23.847 -	actionEditOpenVymLink=a;
  23.848 -	
  23.849 -    a = new QAction( tr( "Edit link to another vym map" ), QPixmap(), tr( "Edit vym link"+QString("...") ), 0, this, "editLinkMap" );
  23.850 -    connect( a, SIGNAL( activated() ), this, SLOT( editVymLink() ) );
  23.851 -	a->setEnabled (false);
  23.852 +	a->setStatusTip ( tr( "Edit link to another vym map" ));
  23.853 +    connect( a, SIGNAL( triggered() ), this, SLOT( editVymLink() ) );
  23.854  	actionListBranches.append(a);
  23.855  	actionEditVymLink=a;
  23.856  
  23.857 -    a = new QAction( tr( "Delete link to another vym map" ), QPixmap(), tr( "Delete vym link" ), 0, this, "deleteLinkMap" );
  23.858 -    connect( a, SIGNAL( activated() ), this, SLOT( editDeleteVymLink() ) );
  23.859 +    a = new QAction(tr( "Delete vym link" ),this);
  23.860 +	a->setStatusTip ( tr( "Delete link to another vym map" ));
  23.861  	a->setEnabled (false);
  23.862 +    connect( a, SIGNAL( triggered() ), this, SLOT( editDeleteVymLink() ) );
  23.863  	actionEditDeleteVymLink=a;
  23.864  
  23.865 -    a = new QAction( tr( "Hide object in exports" ), QPixmap(flagsPath+"flag-hideexport.png"), tr( "Hide in exports" ), Key_H, this, "hideExport" );
  23.866 -    connect( a, SIGNAL( activated() ), this, SLOT( editToggleHideExport() ) );
  23.867 +    a = new QAction(QPixmap(flagsPath+"flag-hideexport.png"), tr( "Hide in exports" ), this);
  23.868 +	a->setStatusTip ( tr( "Hide object in exports" ) );
  23.869 +	a->setShortcut (Qt::Key_H );
  23.870  	a->setToggleAction(true);
  23.871 -    a->addTo( tb );
  23.872 +    tb->addAction (a);
  23.873  	a->setEnabled (false);
  23.874 +    connect( a, SIGNAL( triggered() ), this, SLOT( editToggleHideExport() ) );
  23.875  	actionEditToggleHideExport=a;
  23.876  
  23.877 -    a = new QAction( tr( "Edit Map Info" ), QPixmap(), tr( "Edit Map Info"+QString("...") ), 0, this, "editMapInfo" );
  23.878 -    connect( a, SIGNAL( activated() ), this, SLOT( editMapInfo() ) );
  23.879 +    a = new QAction(tr( "Edit Map Info"+QString("...") ),this);
  23.880 +	a->setStatusTip ( tr( "Edit Map Info" ));
  23.881  	a->setEnabled (true);
  23.882 +    connect( a, SIGNAL( triggered() ), this, SLOT( editMapInfo() ) );
  23.883  	actionEditMapInfo=a;
  23.884  
  23.885 -	menu->insertSeparator();
  23.886 +	editMenu->addSeparator();
  23.887  
  23.888  	// Import at selection (adding to selection)
  23.889 -    a = new QAction( tr( "Add map at selection" ),tr( "Add map (insert)" ), 0, this, "importAdd" );
  23.890 -    connect( a, SIGNAL( activated() ), this, SLOT( editImportAdd() ) );
  23.891 +    a = new QAction( tr( "Add map (insert)" ),this);
  23.892 +	a->setStatusTip (tr( "Add map at selection" ));
  23.893 +    connect( a, SIGNAL( triggered() ), this, SLOT( editImportAdd() ) );
  23.894  	a->setEnabled (false);
  23.895  	actionListBranches.append(a);
  23.896  	actionEditImportAdd=a;
  23.897  
  23.898  	// Import at selection (replacing selection)
  23.899 -    a = new QAction( tr( "Replace selection with map" ),tr( "Add map (replace)" ), 0, this, "importReplace" );
  23.900 -    connect( a, SIGNAL( activated() ), this, SLOT( editImportReplace() ) );
  23.901 +    a = new QAction( tr( "Add map (replace)" ), this);
  23.902 +	a->setStatusTip (tr( "Replace selection with map" ));
  23.903 +    connect( a, SIGNAL( triggered() ), this, SLOT( editImportReplace() ) );
  23.904  	a->setEnabled (false);
  23.905  	actionListBranches.append(a);
  23.906  	actionEditImportReplace=a;
  23.907  
  23.908  	// Save selection 
  23.909 -    a = new QAction( tr( "Save selection" ),tr( "Save selection" ), 0, this, "saveSelection" );
  23.910 -    connect( a, SIGNAL( activated() ), this, SLOT( editSaveBranch() ) );
  23.911 +    a = new QAction( tr( "Save selection" ), this);
  23.912 +	a->setStatusTip (tr( "Save selection" ));
  23.913 +    connect( a, SIGNAL( triggered() ), this, SLOT( editSaveBranch() ) );
  23.914  	a->setEnabled (false);
  23.915  	actionListBranches.append(a);
  23.916  	actionEditSaveBranch=a;
  23.917  
  23.918  	// Only remove branch, not its childs
  23.919 -    a = new QAction( tr( "Remove only branch and keep its childs" ),tr( "Remove only branch " ), ALT + Key_Delete, this, "removeBranchHere" );
  23.920 -    connect( a, SIGNAL( activated() ), this, SLOT( editRemoveBranchKeepChilds() ) );
  23.921 +    a = new QAction(tr( "Remove only branch " ), this);
  23.922 +	a->setStatusTip ( tr( "Remove only branch and keep its childs" ));
  23.923 +	a->setShortcut (Qt::ALT + Qt::Key_Delete );
  23.924 +    connect( a, SIGNAL( triggered() ), this, SLOT( editRemoveBranchKeepChilds() ) );
  23.925  	a->setEnabled (false);
  23.926  	actionListBranches.append(a);
  23.927  	actionEditRemoveBranchKeepChilds=a;
  23.928  
  23.929  	// Only remove childs of a branch
  23.930 -    a = new QAction( tr( "Remove childs of branch" ),tr( "Remove childs" ), SHIFT + Key_Delete, this, "removeBranchChilds" );
  23.931 -    connect( a, SIGNAL( activated() ), this, SLOT( editRemoveChilds() ) );
  23.932 +    a = new QAction( tr( "Remove childs" ), this);
  23.933 +	a->setStatusTip (tr( "Remove childs of branch" ));
  23.934 +	a->setShortcut (Qt::SHIFT + Qt::Key_Delete );
  23.935 +    connect( a, SIGNAL( triggered() ), this, SLOT( editRemoveChilds() ) );
  23.936  	a->setEnabled (false);
  23.937  	actionListBranches.append(a);
  23.938  	actionEditRemoveChilds=a;
  23.939  
  23.940      // Shortcuts for navigating with cursor:
  23.941 -    a = new QAction( tr( "Select upper branch" ),tr( "Select upper branch" ), Key_Up, this, "upperBranch" );
  23.942 -    connect( a, SIGNAL( activated() ), this, SLOT( editUpperBranch() ) );
  23.943 -    a = new QAction( tr( "Select lower branch" ),tr( "Select lower branch" ), Key_Down, this, "lowerBranch" );
  23.944 -    connect( a, SIGNAL( activated() ), this, SLOT( editLowerBranch() ) );
  23.945 -    a = new QAction( tr( "Select left branch" ),tr( "Select left branch" ), Key_Left, this, "upperBranch" );
  23.946 -    connect( a, SIGNAL( activated() ), this, SLOT( editLeftBranch() ) );
  23.947 -    a = new QAction( tr( "Select right branch" ),tr( "Select child branch" ), Key_Right, this, "rightBranch" );
  23.948 -    connect( a, SIGNAL( activated() ), this, SLOT( editRightBranch() ) );
  23.949 -    a = new QAction( tr( "Select first branch" ),tr( "Select first branch" ), Key_Home, this, "firstBranch" );
  23.950 +    a = new QAction(tr( "Select upper branch" ), this);
  23.951 +	a->setStatusTip ( tr( "Select upper branch" ));
  23.952 +	a->setShortcut (Qt::Key_Up );
  23.953 +	a->setShortcutContext (Qt::WindowShortcut);
  23.954 +	addAction (a);
  23.955 +    connect( a, SIGNAL( triggered() ), this, SLOT( editUpperBranch() ) );
  23.956 +    a = new QAction( tr( "Select lower branch" ),this);
  23.957 +	a->setStatusTip (tr( "Select lower branch" ));
  23.958 +	a->setShortcut ( Qt::Key_Down );
  23.959 +	a->setShortcutContext (Qt::WindowShortcut);
  23.960 +	addAction (a);
  23.961 +    connect( a, SIGNAL( triggered() ), this, SLOT( editLowerBranch() ) );
  23.962 +    a = new QAction(tr( "Select left branch" ), this);
  23.963 +	a->setStatusTip ( tr( "Select left branch" ));
  23.964 +	a->setShortcut (Qt::Key_Left );
  23.965 +	a->setShortcutContext (Qt::WindowShortcut);
  23.966 +	addAction (a);
  23.967 +    connect( a, SIGNAL( triggered() ), this, SLOT( editLeftBranch() ) );
  23.968 +    a = new QAction( tr( "Select child branch" ), this);
  23.969 +	a->setStatusTip (tr( "Select right branch" ));
  23.970 +	a->setShortcut (Qt::Key_Right);
  23.971 +	a->setShortcutContext (Qt::WindowShortcut);
  23.972 +	addAction (a);
  23.973 +    connect( a, SIGNAL( triggered() ), this, SLOT( editRightBranch() ) );
  23.974 +    a = new QAction( tr( "Select first branch" ), this);
  23.975 +	a->setStatusTip (tr( "Select first branch" ));
  23.976 +	a->setShortcut (Qt::Key_Home );
  23.977 +	a->setShortcutContext (Qt::WindowShortcut);
  23.978 +	addAction (a);
  23.979  	a->setEnabled (false);
  23.980 -    a->addTo ( menu );
  23.981 +	editMenu->addAction (a);
  23.982  	actionListBranches.append(a);
  23.983  	actionEditSelectFirst=a;
  23.984 -    connect( a, SIGNAL( activated() ), this, SLOT( editFirstBranch() ) );
  23.985 -    a = new QAction( tr( "Select last branch" ),tr( "Select last branch" ), Key_End, this, "lastBranch" );
  23.986 -    connect( a, SIGNAL( activated() ), this, SLOT( editLastBranch() ) );
  23.987 +    connect( a, SIGNAL( triggered() ), this, SLOT( editFirstBranch() ) );
  23.988 +    a = new QAction( tr( "Select last branch" ),this);
  23.989 +	a->setStatusTip (tr( "Select last branch" ));
  23.990 +	a->setShortcut ( Qt::Key_End );
  23.991 +	a->setShortcutContext (Qt::WindowShortcut);
  23.992 +	addAction (a);
  23.993 +    connect( a, SIGNAL( triggered() ), this, SLOT( editLastBranch() ) );
  23.994  	a->setEnabled (false);
  23.995 -    a->addTo ( menu );
  23.996 +	editMenu->addAction (a);
  23.997  	actionListBranches.append(a);
  23.998  	actionEditSelectLast=a;
  23.999  
 23.1000 -    a = new QAction( tr( "Add Image" ),tr( "Add Image" )+QString("..."), 0, this, "loadImage" );
 23.1001 -    connect( a, SIGNAL( activated() ), this, SLOT( editLoadImage() ) );
 23.1002 +    a = new QAction( tr( "Add Image" )+QString("..."), this);
 23.1003 +	a->setStatusTip (tr( "Add Image" ));
 23.1004 +    connect( a, SIGNAL( triggered() ), this, SLOT( editLoadImage() ) );
 23.1005  	actionEditLoadImage=a;
 23.1006  
 23.1007  }
 23.1008 @@ -679,147 +867,194 @@
 23.1009  // Format Actions
 23.1010  void Main::setupFormatActions()
 23.1011  {
 23.1012 -    QPopupMenu *menu = new QPopupMenu( this );
 23.1013 -    menuBar()->insertItem( tr( "F&ormat" ), menu );
 23.1014 -
 23.1015 -    QToolBar *tb = new QToolBar( this );
 23.1016 +    QMenu *formatMenu = menuBar()->addMenu (tr ("F&ormat"));
 23.1017 +
 23.1018 +    QToolBar *tb = addToolBar( tr("Format Actions","Toolbars"));
 23.1019 +	tb->setObjectName ("formatTB");
 23.1020      QAction *a;
 23.1021      QPixmap pix( 16,16);
 23.1022 -    pix.fill (black);
 23.1023 -    actionFormatColor= new QAction( tr( "Set Color" ), pix, tr( "Set &Color" )+QString("..."), 0, this, "formatColor" );
 23.1024 -    connect( actionFormatColor, SIGNAL( activated() ), this, SLOT( formatSelectColor() ) );
 23.1025 -    actionFormatColor->addTo( tb );
 23.1026 -    actionFormatColor->addTo( menu );
 23.1027 -    a= new QAction( tr( "Pick color\nHint: You can pick a color from another branch and color using CTRL+Left Button" ), QPixmap(iconPath+"formatcolorpicker.png"), tr( "Pic&k color" ), CTRL + Key_K, this, "pickColor" );
 23.1028 -    connect( a, SIGNAL( activated() ), this, SLOT( formatPickColor() ) );
 23.1029 +    pix.fill (Qt::black);
 23.1030 +    a= new QAction(pix, tr( "Set &Color" )+QString("..."), this);
 23.1031 +	a->setStatusTip ( tr( "Set Color" ));
 23.1032 +    connect( a, SIGNAL( triggered() ), this, SLOT( formatSelectColor() ) );
 23.1033 +    a->addTo( tb );
 23.1034 +	formatMenu->addAction (a);
 23.1035 +	actionFormatColor=a;
 23.1036 +    a= new QAction( QPixmap(iconPath+"formatcolorpicker.png"), tr( "Pic&k color" ), this);
 23.1037 +	a->setStatusTip (tr( "Pick color\nHint: You can pick a color from another branch and color using CTRL+Left Button" ) );
 23.1038 +	a->setShortcut (Qt::CTRL + Qt::Key_K );
 23.1039 +    connect( a, SIGNAL( triggered() ), this, SLOT( formatPickColor() ) );
 23.1040  	a->setEnabled (false);
 23.1041      a->addTo( tb );
 23.1042 -    a->addTo( menu );
 23.1043 +	formatMenu->addAction (a);
 23.1044  	actionListBranches.append(a);
 23.1045  	actionFormatPickColor=a;
 23.1046 -    a= new QAction( tr( "Color branch" ), QPixmap(iconPath+"formatcoloritem.png"), tr( "Color &branch" ), CTRL + Key_I, this, "colorItem" );
 23.1047 -    connect( a, SIGNAL( activated() ), this, SLOT( formatColorItem() ) );
 23.1048 +
 23.1049 +    a= new QAction(QPixmap(iconPath+"formatcoloritem.png"), tr( "Color &branch" ), this);
 23.1050 +	a->setStatusTip ( tr( "Color branch" ) );
 23.1051 +	a->setShortcut (Qt::CTRL + Qt::Key_I);
 23.1052 +    connect( a, SIGNAL( triggered() ), this, SLOT( formatColorItem() ) );
 23.1053  	a->setEnabled (false);
 23.1054      a->addTo( tb );
 23.1055 -    a->addTo( menu );
 23.1056 +	formatMenu->addAction (a);
 23.1057  	actionListBranches.append(a);
 23.1058  	actionFormatColorBranch=a;
 23.1059 -    a= new QAction( tr( "Color Subtree" ), QPixmap(iconPath+"formatcolorbranch.png"), tr( "Color sub&tree" ), CTRL + Key_T, this, "colorBranch" );
 23.1060 -    connect( a, SIGNAL( activated() ), this, SLOT( formatColorBranch() ) );
 23.1061 +
 23.1062 +    a= new QAction(QPixmap(iconPath+"formatcolorbranch.png"), tr( "Color sub&tree" ), this);
 23.1063 +	a->setStatusTip ( tr( "Color Subtree" ));
 23.1064 +	a->setShortcut (Qt::CTRL + Qt::Key_T);
 23.1065 +    connect( a, SIGNAL( triggered() ), this, SLOT( formatColorBranch() ) );
 23.1066  	a->setEnabled (false);
 23.1067 -    a->addTo( menu );
 23.1068 +	formatMenu->addAction (a);
 23.1069      a->addTo( tb );
 23.1070  	actionListBranches.append(a);
 23.1071  	actionFormatColorSubtree=a;
 23.1072  
 23.1073 -    menu->insertSeparator();
 23.1074 -	actionGroupFormatLinkStyles=new QActionGroup ( this, "formatLinkStyles");
 23.1075 +	formatMenu->addSeparator();
 23.1076 +	actionGroupFormatLinkStyles=new QActionGroup ( this);
 23.1077  	actionGroupFormatLinkStyles->setExclusive (true);
 23.1078 -    a= new QAction( tr( "Line" ), QPixmap(), tr( "Linkstyle Line" ), 0, actionGroupFormatLinkStyles, "formatLinkStyleLine" );
 23.1079 +    a= new QAction( tr( "Linkstyle Line" ), actionGroupFormatLinkStyles);
 23.1080 +	a->setStatusTip (tr( "Line" ));
 23.1081  	a->setToggleAction(true);
 23.1082 -    connect( a, SIGNAL( activated() ), this, SLOT( formatLinkStyleLine() ) );
 23.1083 +    connect( a, SIGNAL( triggered() ), this, SLOT( formatLinkStyleLine() ) );
 23.1084 +	formatMenu->addAction (a);
 23.1085  	actionFormatLinkStyleLine=a;
 23.1086 -    a= new QAction( tr( "Line" ), QPixmap(), tr( "Linkstyle Parabel" ), 0, actionGroupFormatLinkStyles, "formatLinkStyleLine" );
 23.1087 +    a= new QAction( tr( "Linkstyle Parabel" ), actionGroupFormatLinkStyles);
 23.1088 +	a->setStatusTip (tr( "Line" ));
 23.1089  	a->setToggleAction(true);
 23.1090 -    connect( a, SIGNAL( activated() ), this, SLOT( formatLinkStyleParabel() ) );
 23.1091 +    connect( a, SIGNAL( triggered() ), this, SLOT( formatLinkStyleParabel() ) );
 23.1092 +	formatMenu->addAction (a);
 23.1093  	actionFormatLinkStyleParabel=a;
 23.1094 -    a= new QAction( tr( "PolyLine" ), QPixmap(), tr( "Linkstyle Thick Line" ), 0, actionGroupFormatLinkStyles, "formatLinkStyleLine" );
 23.1095 +    a= new QAction( tr( "Linkstyle Thick Line" ), actionGroupFormatLinkStyles );
 23.1096 +	a->setStatusTip (tr( "PolyLine" ));
 23.1097  	a->setToggleAction(true);
 23.1098 -    connect( a, SIGNAL( activated() ), this, SLOT( formatLinkStylePolyLine() ) );
 23.1099 +    connect( a, SIGNAL( triggered() ), this, SLOT( formatLinkStylePolyLine() ) );
 23.1100 +	formatMenu->addAction (a);
 23.1101  	actionFormatLinkStylePolyLine=a;
 23.1102 -    a= new QAction( tr( "PolyParabel" ), QPixmap(), tr( "Linkstyle Thick Parabel" ), 0, actionGroupFormatLinkStyles, "formatLinkStylePolyParabel" );
 23.1103 +    a= new QAction( tr( "Linkstyle Thick Parabel" ), actionGroupFormatLinkStyles);
 23.1104 +	a->setStatusTip (tr( "PolyParabel" ) );
 23.1105  	a->setToggleAction(true);
 23.1106 -    connect( a, SIGNAL( activated() ), this, SLOT( formatLinkStylePolyParabel() ) );
 23.1107 +	a->setChecked (true);
 23.1108 +    connect( a, SIGNAL( triggered() ), this, SLOT( formatLinkStylePolyParabel() ) );
 23.1109 +	formatMenu->addAction (a);
 23.1110  	actionFormatLinkStylePolyParabel=a;
 23.1111 -	actionGroupFormatLinkStyles->addTo (menu);
 23.1112  	
 23.1113 -	actionGroupFormatFrameTypes=new QActionGroup ( this, "formatFrameTypes");
 23.1114 +	actionGroupFormatFrameTypes=new QActionGroup ( this);
 23.1115  	actionGroupFormatFrameTypes->setExclusive (true);
 23.1116 -    a = new QAction( tr( "No Frame" ),tr( "No Frame" ), 0, actionGroupFormatFrameTypes, "frameNone" );
 23.1117 +    a = new QAction( tr( "No Frame" ), actionGroupFormatFrameTypes );
 23.1118 +	a->setStatusTip (tr("No Frame"));
 23.1119  	a->setToggleAction(true);
 23.1120 -    connect( a, SIGNAL( activated() ), this, SLOT( formatFrameNone() ) );
 23.1121 +    connect( a, SIGNAL( triggered() ), this, SLOT( formatFrameNone() ) );
 23.1122  	actionFormatFrameNone=a;
 23.1123 -    a = new QAction( tr( "Rectangle" ),tr( "Rectangle" ), 0, actionGroupFormatFrameTypes, "frameRectangle" );
 23.1124 +    a = new QAction( tr( "Rectangle" ), actionGroupFormatFrameTypes);
 23.1125 +	a->setStatusTip (tr( "Rectangle" ));
 23.1126  	a->setToggleAction(true);
 23.1127 -    connect( a, SIGNAL( activated() ), this, SLOT( formatFrameRectangle() ) );
 23.1128 +    connect( a, SIGNAL( triggered() ), this, SLOT( formatFrameRectangle() ) );
 23.1129  	actionFormatFrameRectangle=a;
 23.1130  
 23.1131 -    a = new QAction( tr ("Include top and bottom position of images into branch"), tr( "Include images vertically" ), 0, actionFormatIncludeImagesVer, "includeImagesVer" );
 23.1132 +    a = new QAction( tr( "Include images vertically" ),  actionFormatIncludeImagesVer);
 23.1133 +	a->setStatusTip ( tr ("Include top and bottom position of images into branch"));
 23.1134  	a->setToggleAction(true);
 23.1135 -    connect( a, SIGNAL( activated() ), this, SLOT( formatIncludeImagesVer() ) );
 23.1136 +    connect( a, SIGNAL( triggered() ), this, SLOT( formatIncludeImagesVer() ) );
 23.1137  	actionFormatIncludeImagesVer=a;
 23.1138  
 23.1139 -    a = new QAction( tr ("Include left and right position of images into branch"), tr( "Include images horizontally" ), 0, actionFormatIncludeImagesHor, "includeImagesHor" );
 23.1140 +    a = new QAction( tr( "Include images horizontally" ),  actionFormatIncludeImagesHor );
 23.1141 +	a->setStatusTip ( tr ("Include left and right position of images into branch"));
 23.1142  	a->setToggleAction(true);
 23.1143 -    connect( a, SIGNAL( activated() ), this, SLOT( formatIncludeImagesHor() ) );
 23.1144 +    connect( a, SIGNAL( triggered() ), this, SLOT( formatIncludeImagesHor() ) );
 23.1145  	actionFormatIncludeImagesHor=a;
 23.1146  
 23.1147 -    a = new QAction( tr( "Hide link" ),tr( "Hide link if object is not selected" ), 0, actionFormatHideLinkUnselected, "hideLinkUnselected" );
 23.1148 +    a = new QAction( tr( "Hide link if object is not selected" ), actionFormatHideLinkUnselected);
 23.1149 +	a->setStatusTip (tr( "Hide link" ));
 23.1150  	a->setToggleAction(true);
 23.1151 -    connect( a, SIGNAL( activated() ), this, SLOT( formatHideLinkUnselected() ) );
 23.1152 +    connect( a, SIGNAL( triggered() ), this, SLOT( formatHideLinkUnselected() ) );
 23.1153  	actionFormatHideLinkUnselected=a;
 23.1154  
 23.1155 -    menu->insertSeparator();
 23.1156 -    a= new QAction( tr( "Use same color for links and headings" ), QPixmap(), tr( "&Use color of heading for link" ), 0, this, "formatLinkColorHint" );
 23.1157 +	formatMenu->addSeparator();
 23.1158 +    a= new QAction( tr( "&Use color of heading for link" ),  this);
 23.1159 +	a->setStatusTip (tr( "Use same color for links and headings" ));
 23.1160  	a->setToggleAction(true);
 23.1161 -    connect( a, SIGNAL( activated() ), this, SLOT( formatToggleLinkColorHint() ) );
 23.1162 -	a->addTo( menu );
 23.1163 +    connect( a, SIGNAL( triggered() ), this, SLOT( formatToggleLinkColorHint() ) );
 23.1164 +	formatMenu->addAction (a);
 23.1165  	actionFormatLinkColorHint=a;
 23.1166 -    pix.fill (white);
 23.1167 -    actionFormatLinkColor= new QAction( tr( "Set Link Color" ), pix, tr( "Set &Link Color"+QString("...") ), 0, this, "formatLinkColor" );
 23.1168 -    connect( actionFormatLinkColor, SIGNAL( activated() ), this, SLOT( formatSelectLinkColor() ) );
 23.1169 -    actionFormatLinkColor->addTo( menu );
 23.1170 -    actionFormatBackColor= new QAction( tr( "Set Background Color" ), pix, tr( "Set &Background Color" )+QString("..."), 0, this, "formatBackColor" );
 23.1171 -    connect( actionFormatBackColor, SIGNAL( activated() ), this, SLOT( formatSelectBackColor() ) );
 23.1172 -    actionFormatBackColor->addTo( menu );
 23.1173 +
 23.1174 +    pix.fill (Qt::white);
 23.1175 +    a= new QAction( pix, tr( "Set &Link Color"+QString("...") ), this  );
 23.1176 +	a->setStatusTip (tr( "Set Link Color" ));
 23.1177 +	formatMenu->addAction (a);
 23.1178 +    connect( a, SIGNAL( triggered() ), this, SLOT( formatSelectLinkColor() ) );
 23.1179 +    actionFormatLinkColor=a;
 23.1180 +
 23.1181 +    a= new QAction( pix, tr( "Set &Background Color" )+QString("..."), this );
 23.1182 +	a->setStatusTip (tr( "Set Background Color" ));
 23.1183 +	formatMenu->addAction (a);
 23.1184 +    connect( a, SIGNAL( triggered() ), this, SLOT( formatSelectBackColor() ) );
 23.1185 +    actionFormatBackColor=a;
 23.1186  }
 23.1187  
 23.1188  // View Actions
 23.1189  void Main::setupViewActions()
 23.1190  {
 23.1191 -    QToolBar *tb = new QToolBar( this );
 23.1192 +    QToolBar *tb = addToolBar( tr("View Actions","Toolbars") );
 23.1193      tb->setLabel( "View Actions" );
 23.1194 -    QPopupMenu *menu = new QPopupMenu( this );
 23.1195 -    menuBar()->insertItem( tr( "&View" ), menu );
 23.1196 +	tb->setObjectName ("viewTB");
 23.1197 +    QMenu *viewMenu = menuBar()->addMenu ( tr( "&View" ));
 23.1198  
 23.1199      QAction *a;
 23.1200 -    a = new QAction( tr( "Zoom reset" ), QPixmap(iconPath+"viewmag-reset.png"), tr( "reset Zoom" ), CTRL + Key_0, this, "zoomReset" );
 23.1201 -    connect( a, SIGNAL( activated() ), this, SLOT(viewZoomReset() ) );
 23.1202 +    a = new QAction(QPixmap(iconPath+"viewmag-reset.png"), tr( "reset Zoom" ), this);
 23.1203 +	a->setStatusTip ( tr( "Zoom reset" ) );
 23.1204 +	a->setShortcut (Qt::CTRL + Qt::Key_0 );
 23.1205      a->addTo( tb );
 23.1206 -    a->addTo( menu );
 23.1207 -    a = new QAction( tr( "Zoom in" ), QPixmap(iconPath+"viewmag+.png"), tr( "Zoom in" ), CTRL + Key_Plus, this, "zoomIn" );
 23.1208 -    connect( a, SIGNAL( activated() ), this, SLOT(viewZoomIn() ) );
 23.1209 +	viewMenu->addAction (a);
 23.1210 +    connect( a, SIGNAL( triggered() ), this, SLOT(viewZoomReset() ) );
 23.1211 +	
 23.1212 +    a = new QAction( QPixmap(iconPath+"viewmag+.png"), tr( "Zoom in" ), this);
 23.1213 +	a->setStatusTip (tr( "Zoom in" ));
 23.1214 +	a->setShortcut (Qt::CTRL + Qt::Key_Plus);
 23.1215      a->addTo( tb );
 23.1216 -    a->addTo( menu );
 23.1217 -    a = new QAction( tr( "Zoom out" ), QPixmap(iconPath+"viewmag-.png"), tr( "Zoom out" ), CTRL + Key_Minus, this, "zoomOut" );
 23.1218 -    connect( a, SIGNAL( activated() ), this, SLOT( viewZoomOut() ) );
 23.1219 +	viewMenu->addAction (a);
 23.1220 +    connect( a, SIGNAL( triggered() ), this, SLOT(viewZoomIn() ) );
 23.1221 +	
 23.1222 +    a = new QAction( QPixmap(iconPath+"viewmag-.png"), tr( "Zoom out" ), this);
 23.1223 +	a->setStatusTip (tr( "Zoom out" ));
 23.1224 +	a->setShortcut (Qt::CTRL + Qt::Key_Minus );
 23.1225      a->addTo( tb );
 23.1226 -    a->addTo( menu );
 23.1227 -
 23.1228 -
 23.1229 -    a = new QAction( tr( "Show Note Editor" ), QPixmap(flagsPath+"flag-note.png"), tr( "Show Note Editor" ), CTRL + Key_E , this, "noteEditor" );
 23.1230 -    connect( a, SIGNAL( activated() ), this, SLOT(windowToggleNoteEditor() ) );
 23.1231 +	viewMenu->addAction (a);
 23.1232 +    connect( a, SIGNAL( triggered() ), this, SLOT( viewZoomOut() ) );
 23.1233 +
 23.1234 +
 23.1235 +    a = new QAction(QPixmap(flagsPath+"flag-note.png"), tr( "Show Note Editor" ),this);
 23.1236 +	a->setStatusTip ( tr( "Show Note Editor" ));
 23.1237 +	a->setShortcut ( Qt::CTRL + Qt::Key_E );
 23.1238  	a->setToggleAction(true);
 23.1239  	if (textEditor->showWithMain())
 23.1240  		a->setOn(true);
 23.1241  	else	
 23.1242  		a->setOn(false);
 23.1243      a->addTo( tb );
 23.1244 -    a->addTo( menu );
 23.1245 +	viewMenu->addAction (a);
 23.1246 +    connect( a, SIGNAL( triggered() ), this, SLOT(windowToggleNoteEditor() ) );
 23.1247  	actionViewToggleNoteEditor=a;
 23.1248  
 23.1249 -    a = new QAction( tr( "Show history window" ), QPixmap(), tr( "Show history window" ), CTRL + Key_H , this, "historyWindow" );
 23.1250 -    connect( a, SIGNAL( activated() ), this, SLOT(windowToggleHistory() ) );
 23.1251 +    a = new QAction(  tr( "Show history window" ),this );
 23.1252 +	a->setStatusTip ( tr( "Show history window" ));
 23.1253 +	a->setShortcut ( Qt::CTRL + Qt::Key_H  );
 23.1254  	a->setToggleAction(false);
 23.1255 -    a->addTo( menu );
 23.1256 +	viewMenu->addAction (a);
 23.1257 +    connect( a, SIGNAL( triggered() ), this, SLOT(windowToggleHistory() ) );
 23.1258  	actionViewToggleHistoryWindow=a;
 23.1259  
 23.1260 -    a = new QAction( tr( "&Next Window" ), QPixmap(), tr( "Next Window" ), ALT + Key_N , this, "nextWindow" );
 23.1261 -    connect( a, SIGNAL( activated() ), this, SLOT(windowNextEditor() ) );
 23.1262 -    a->addTo( menu );
 23.1263 -    a = new QAction( tr( "&Previous Window" ), QPixmap(), tr( "Previous Window" ), ALT + Key_P , this, "previousWindow" );
 23.1264 -    connect( a, SIGNAL( activated() ), this, SLOT(windowPreviousEditor() ) );
 23.1265 -    a->addTo( menu );
 23.1266 +    a = new QAction(tr( "Next Window" ), this);
 23.1267 +	a->setStatusTip ( tr( "&Next Window" ) );
 23.1268 +	a->setShortcut (Qt::ALT + Qt::Key_N );
 23.1269 +	viewMenu->addAction (a);
 23.1270 +    connect( a, SIGNAL( triggered() ), this, SLOT(windowNextEditor() ) );
 23.1271 +
 23.1272 +    a = new QAction (tr( "Previous Window" ), this );
 23.1273 +	a->setStatusTip (tr( "&Previous Window" ));
 23.1274 +	a->setShortcut (Qt::ALT + Qt::Key_P );
 23.1275 +	viewMenu->addAction (a);
 23.1276 +    connect( a, SIGNAL( triggered() ), this, SLOT(windowPreviousEditor() ) );
 23.1277  }
 23.1278  
 23.1279  // Mode Actions
 23.1280 @@ -828,23 +1063,29 @@
 23.1281      //QPopupMenu *menu = new QPopupMenu( this );
 23.1282      //menuBar()->insertItem( tr( "&Mode (using modifiers)" ), menu );
 23.1283  
 23.1284 -    QToolBar *tb = new QToolBar( this );
 23.1285 -    tb->setLabel( tr ("Modes when using modifiers") );
 23.1286 +    QToolBar *tb = addToolBar( tr ("Modes when using modifiers","Toolbars") );
 23.1287 +	tb->setObjectName ("modesTB");
 23.1288      QAction *a;
 23.1289 -	actionGroupModModes=new QActionGroup ( this, "formatLinkStyles");
 23.1290 +	actionGroupModModes=new QActionGroup ( this);
 23.1291  	actionGroupModModes->setExclusive (true);
 23.1292 -    a= new QAction( tr( "Use modifier to color branches" ), QPixmap(iconPath+"modecolor.png"), 0, Key_J, actionGroupModModes, "modModeColor" );
 23.1293 +    a= new QAction( QPixmap(iconPath+"modecolor.png"), tr( "Use modifier to color branches" ), actionGroupModModes);
 23.1294 +	a->setShortcut (Qt::Key_J);
 23.1295 +    a->setStatusTip ( tr( "Use modifier to color branches" ));
 23.1296  	a->setToggleAction(true);
 23.1297  	a->addTo (tb);
 23.1298  	a->setOn(true);
 23.1299  	actionModModeColor=a;
 23.1300  	
 23.1301 -    a= new QAction( tr( "Use modifier to copy" ), QPixmap(iconPath+"modecopy.png"), 0, Key_K, actionGroupModModes, "modModeCopy" );
 23.1302 +    a= new QAction( QPixmap(iconPath+"modecopy.png"), tr( "Use modifier to copy" ), actionGroupModModes );
 23.1303 +	a->setShortcut( Qt::Key_K); 
 23.1304 +    a->setStatusTip( tr( "Use modifier to copy" ));
 23.1305  	a->setToggleAction(true);
 23.1306  	a->addTo (tb);
 23.1307  	actionModModeCopy=a;
 23.1308  
 23.1309 -    a= new QAction( tr( "Use modifier to draw xLinks" ), QPixmap(iconPath+"modelink.png"), 0, Key_L, actionGroupModModes, "modModeLink" );
 23.1310 +    a= new QAction(QPixmap(iconPath+"modelink.png"), tr( "Use modifier to draw xLinks" ), actionGroupModModes );
 23.1311 +	a->setShortcut (Qt::Key_L);
 23.1312 +    a->setStatusTip( tr( "Use modifier to draw xLinks" ));
 23.1313  	a->setToggleAction(true);
 23.1314  	a->addTo (tb);
 23.1315  	actionModModeLink=a;
 23.1316 @@ -890,239 +1131,379 @@
 23.1317  	systemFlagsDefault->addFlag (fo);
 23.1318  
 23.1319  	// Create Standard Flags
 23.1320 +	QToolBar *tb=addToolBar (tr ("Standard Flags","Standard Flag Toolbar"));
 23.1321 +	tb->setObjectName ("standardFlagTB");
 23.1322 +
 23.1323  	standardFlagsDefault = new FlagRowObj ();
 23.1324  	standardFlagsDefault->setVisibility (false);
 23.1325  	standardFlagsDefault->setName ("standardFlagsDef");
 23.1326 +	standardFlagsDefault->setToolBar (tb);
 23.1327  
 23.1328  	fo->load(QPixmap(flagsPath+"flag-exclamationmark.png"));
 23.1329  	fo->setName ("exclamationmark");
 23.1330  	fo->setGroup("standard-mark");
 23.1331 -	fo->setToolTip(tr("Take care!","Standardflag"));
 23.1332 +	QAction *a=new QAction (fo->getPixmap(),fo->getName(),this);
 23.1333 +	tb->addAction (a);
 23.1334 +	fo->setAction (a);
 23.1335 +	a->setCheckable(true);
 23.1336 +	a->setObjectName(fo->getName());
 23.1337 +	a->setToolTip(tr("Take care!","Standardflag"));
 23.1338 +	connect (a, SIGNAL( triggered() ), this, SLOT( standardFlagChanged() ) );
 23.1339  	standardFlagsDefault->addFlag (fo);	// makes deep copy
 23.1340  	
 23.1341  	fo->load(QPixmap(flagsPath+"flag-questionmark.png"));
 23.1342  	fo->setName("questionmark");
 23.1343  	fo->setGroup("standard-mark");
 23.1344 -	fo->setToolTip(tr("Really?","Standardflag"));
 23.1345 +	a=new QAction (fo->getPixmap(),fo->getName(),this);
 23.1346 +	tb->addAction (a);
 23.1347 +	fo->setAction (a);
 23.1348 +	a->setCheckable(true);
 23.1349 +	a->setObjectName(fo->getName());
 23.1350 +	a->setToolTip(tr("Really?","Standardflag"));
 23.1351 +	connect (a, SIGNAL( triggered() ), this, SLOT( standardFlagChanged() ) );
 23.1352  	standardFlagsDefault->addFlag (fo);	
 23.1353  
 23.1354  	fo->load(QPixmap(flagsPath+"flag-hook-green.png"));
 23.1355  	fo->setName("hook-green");
 23.1356  	fo->setGroup("standard-hook");
 23.1357 -	fo->setToolTip(tr("ok!","Standardflag"));
 23.1358 +	a=new QAction (fo->getPixmap(),fo->getName(),this);
 23.1359 +	tb->addAction (a);
 23.1360 +	fo->setAction (a);
 23.1361 +	a->setCheckable(true);
 23.1362 +	a->setObjectName(fo->getName());
 23.1363 +	a->setToolTip(tr("ok!","Standardflag"));
 23.1364 +	connect (a, SIGNAL( triggered() ), this, SLOT( standardFlagChanged() ) );
 23.1365  	standardFlagsDefault->addFlag (fo);	
 23.1366  
 23.1367  	fo->load(QPixmap(flagsPath+"flag-cross-red.png"));
 23.1368  	fo->setName("cross-red");
 23.1369  	fo->setGroup("standard-hook");
 23.1370 -	fo->setToolTip(tr("Not ok!","Standardflag"));
 23.1371 +	a=new QAction (fo->getPixmap(),fo->getName(),this);
 23.1372 +	tb->addAction (a);
 23.1373 +	fo->setAction (a);
 23.1374 +	a->setCheckable(true);
 23.1375 +	a->setObjectName(fo->getName());
 23.1376 +	a->setToolTip(tr("Not ok!","Standardflag"));
 23.1377 +	connect (a, SIGNAL( triggered() ), this, SLOT( standardFlagChanged() ) );
 23.1378  	standardFlagsDefault->addFlag (fo);	
 23.1379  
 23.1380  	fo->load(QPixmap(flagsPath+"flag-stopsign.png"));
 23.1381  	fo->setName("stopsign");
 23.1382 -	fo->setToolTip(tr("This won't work!","Standardflag"));
 23.1383 +	a=new QAction (fo->getPixmap(),fo->getName(),this);
 23.1384 +	tb->addAction (a);
 23.1385 +	fo->setAction (a);
 23.1386 +	a->setCheckable(true);
 23.1387 +	a->setObjectName(fo->getName());
 23.1388 +	a->setToolTip(tr("This won't work!","Standardflag"));
 23.1389 +	connect (a, SIGNAL( triggered() ), this, SLOT( standardFlagChanged() ) );
 23.1390  	standardFlagsDefault->addFlag (fo);	
 23.1391  
 23.1392  	fo->load(QPixmap(flagsPath+"flag-smiley-good.png"));
 23.1393  	fo->setName("smiley-good");
 23.1394  	fo->setGroup("standard-smiley");
 23.1395 -	fo->setToolTip(tr("Good","Standardflag"));
 23.1396 +	a=new QAction (fo->getPixmap(),fo->getName(),this);
 23.1397 +	tb->addAction (a);
 23.1398 +	fo->setAction (a);
 23.1399 +	a->setCheckable(true);
 23.1400 +	a->setObjectName(fo->getName());
 23.1401 +	a->setToolTip(tr("Good","Standardflag"));
 23.1402 +	connect (a, SIGNAL( triggered() ), this, SLOT( standardFlagChanged() ) );
 23.1403  	standardFlagsDefault->addFlag (fo);	
 23.1404  
 23.1405  	fo->load(QPixmap(flagsPath+"flag-smiley-sad.png"));
 23.1406  	fo->setName("smiley-sad");
 23.1407  	fo->setGroup("standard-smiley");
 23.1408 -	fo->setToolTip(tr("Bad","Standardflag"));
 23.1409 +	a=new QAction (fo->getPixmap(),fo->getName(),this);
 23.1410 +	tb->addAction (a);
 23.1411 +	fo->setAction (a);
 23.1412 +	a->setCheckable(true);
 23.1413 +	a->setObjectName(fo->getName());
 23.1414 +	a->setToolTip(tr("Bad","Standardflag"));
 23.1415 +	connect (a, SIGNAL( triggered() ), this, SLOT( standardFlagChanged() ) );
 23.1416  	standardFlagsDefault->addFlag (fo);	
 23.1417  
 23.1418  	fo->load(QPixmap(flagsPath+"flag-smiley-omg.png"));
 23.1419  	// Original omg.png (in KDE emoticons)
 23.1420  	fo->setName("smiley-omg");
 23.1421  	fo->setGroup("standard-smiley");
 23.1422 -	fo->setToolTip(tr("Oh no!","Standardflag"));
 23.1423 +	a=new QAction (fo->getPixmap(),fo->getName(),this);
 23.1424 +	tb->addAction (a);
 23.1425 +	fo->setAction (a);
 23.1426 +	a->setCheckable(true);
 23.1427 +	a->setObjectName(fo->getName());
 23.1428 +	a->setToolTip(tr("Oh no!","Standardflag"));
 23.1429 +	connect (a, SIGNAL( triggered() ), this, SLOT( standardFlagChanged() ) );
 23.1430  	standardFlagsDefault->addFlag (fo);	
 23.1431  
 23.1432  	fo->load(QPixmap(flagsPath+"flag-kalarm.png"));
 23.1433  	fo->setName("clock");
 23.1434 -	fo->setToolTip(tr("Time critical","Standardflag"));
 23.1435 +	a=new QAction (fo->getPixmap(),fo->getName(),this);
 23.1436 +	tb->addAction (a);
 23.1437 +	fo->setAction (a);
 23.1438 +	a->setCheckable(true);
 23.1439 +	a->setObjectName(fo->getName());
 23.1440 +	a->setToolTip(tr("Time critical","Standardflag"));
 23.1441 +	connect (a, SIGNAL( triggered() ), this, SLOT( standardFlagChanged() ) );
 23.1442  	standardFlagsDefault->addFlag (fo);	
 23.1443  
 23.1444  	fo->load(QPixmap(flagsPath+"flag-phone.png"));
 23.1445  	fo->setName("phone");
 23.1446 -	fo->setToolTip(tr("Call...","Standardflag"));
 23.1447 +	a=new QAction (fo->getPixmap(),fo->getName(),this);
 23.1448 +	tb->addAction (a);
 23.1449 +	fo->setAction (a);
 23.1450 +	a->setCheckable(true);
 23.1451 +	a->setObjectName(fo->getName());
 23.1452 +	a->setToolTip(tr("Call...","Standardflag"));
 23.1453 +	connect (a, SIGNAL( triggered() ), this, SLOT( standardFlagChanged() ) );
 23.1454  	standardFlagsDefault->addFlag (fo);	
 23.1455  
 23.1456  	fo->load(QPixmap(flagsPath+"flag-lamp.png"));
 23.1457  	fo->setName("lamp");
 23.1458 -	fo->setToolTip(tr("Idea!","Standardflag"));
 23.1459 +	a=new QAction (fo->getPixmap(),fo->getName(),this);
 23.1460 +	tb->addAction (a);
 23.1461 +	fo->setAction (a);
 23.1462 +	a->setCheckable(true);
 23.1463 +	a->setObjectName(fo->getName());
 23.1464 +	a->setToolTip(tr("Idea!","Standardflag"));
 23.1465 +	connect (a, SIGNAL( triggered() ), this, SLOT( standardFlagChanged() ) );
 23.1466  	standardFlagsDefault->addFlag (fo);	
 23.1467  
 23.1468  	fo->load(QPixmap(flagsPath+"flag-arrow-up.png"));
 23.1469  	fo->setName("arrow-up");
 23.1470  	fo->setGroup("standard-arrow");
 23.1471 -	fo->setToolTip(tr("Important","Standardflag"));
 23.1472 +	a=new QAction (fo->getPixmap(),fo->getName(),this);
 23.1473 +	tb->addAction (a);
 23.1474 +	fo->setAction (a);
 23.1475 +	a->setCheckable(true);
 23.1476 +	a->setObjectName(fo->getName());
 23.1477 +	a->setToolTip(tr("Important","Standardflag"));
 23.1478 +	connect (a, SIGNAL( triggered() ), this, SLOT( standardFlagChanged() ) );
 23.1479  	standardFlagsDefault->addFlag (fo);	
 23.1480  
 23.1481  	fo->load(QPixmap(flagsPath+"flag-arrow-down.png"));
 23.1482  	fo->setName("arrow-down");
 23.1483  	fo->setGroup("standard-arrow");
 23.1484 -	fo->setToolTip(tr("Unimportant","Standardflag"));
 23.1485 +	a=new QAction (fo->getPixmap(),fo->getName(),this);
 23.1486 +	tb->addAction (a);
 23.1487 +	fo->setAction (a);
 23.1488 +	a->setCheckable(true);
 23.1489 +	a->setObjectName(fo->getName());
 23.1490 +	a->setToolTip(tr("Unimportant","Standardflag"));
 23.1491 +	connect (a, SIGNAL( triggered() ), this, SLOT( standardFlagChanged() ) );
 23.1492  	standardFlagsDefault->addFlag (fo);	
 23.1493  
 23.1494  	fo->load(QPixmap(flagsPath+"flag-arrow-2up.png"));
 23.1495  	fo->setName("2arrow-up");
 23.1496  	fo->setGroup("standard-arrow");
 23.1497 -	fo->setToolTip(tr("Very important!","Standardflag"));
 23.1498 +	a=new QAction (fo->getPixmap(),fo->getName(),this);
 23.1499 +	tb->addAction (a);
 23.1500 +	fo->setAction (a);
 23.1501 +	a->setCheckable(true);
 23.1502 +	a->setObjectName(fo->getName());
 23.1503 +	a->setToolTip(tr("Very important!","Standardflag"));
 23.1504 +	connect (a, SIGNAL( triggered() ), this, SLOT( standardFlagChanged() ) );
 23.1505  	standardFlagsDefault->addFlag (fo);	
 23.1506  
 23.1507  	fo->load(QPixmap(flagsPath+"flag-arrow-2down.png"));
 23.1508  	fo->setName("2arrow-down");
 23.1509  	fo->setGroup("standard-arrow");
 23.1510 -	fo->setToolTip(tr("Very unimportant!","Standardflag"));
 23.1511 +	a=new QAction (fo->getPixmap(),fo->getName(),this);
 23.1512 +	tb->addAction (a);
 23.1513 +	fo->setAction (a);
 23.1514 +	a->setCheckable(true);
 23.1515 +	a->setObjectName(fo->getName());
 23.1516 +	a->setToolTip(tr("Very unimportant!","Standardflag"));
 23.1517 +	connect (a, SIGNAL( triggered() ), this, SLOT( standardFlagChanged() ) );
 23.1518  	standardFlagsDefault->addFlag (fo);	
 23.1519  
 23.1520  	fo->load(QPixmap(flagsPath+"flag-thumb-up.png"));
 23.1521  	fo->setName("thumb-up");
 23.1522  	fo->setGroup("standard-thumb");
 23.1523 -	fo->setToolTip(tr("I like this","Standardflag"));
 23.1524 +	a=new QAction (fo->getPixmap(),fo->getName(),this);
 23.1525 +	tb->addAction (a);
 23.1526 +	fo->setAction (a);
 23.1527 +	a->setCheckable(true);
 23.1528 +	a->setObjectName(fo->getName());
 23.1529 +	a->setToolTip(tr("I like this","Standardflag"));
 23.1530 +	connect (a, SIGNAL( triggered() ), this, SLOT( standardFlagChanged() ) );
 23.1531  	standardFlagsDefault->addFlag (fo);	
 23.1532  
 23.1533  	fo->load(QPixmap(flagsPath+"flag-thumb-down.png"));
 23.1534  	fo->setName("thumb-down");
 23.1535  	fo->setGroup("standard-thumb");
 23.1536 -	fo->setToolTip(tr("I like this","Standardflag"));
 23.1537 -	fo->setToolTip(tr("I do not like this","Standardflag"));
 23.1538 +	a=new QAction (fo->getPixmap(),fo->getName(),this);
 23.1539 +	tb->addAction (a);
 23.1540 +	fo->setAction (a);
 23.1541 +	a->setCheckable(true);
 23.1542 +	a->setObjectName(fo->getName());
 23.1543 +	a->setToolTip(tr("I do not like this","Standardflag"));
 23.1544 +	connect (a, SIGNAL( triggered() ), this, SLOT( standardFlagChanged() ) );
 23.1545  	standardFlagsDefault->addFlag (fo);	
 23.1546  	
 23.1547  	fo->load(QPixmap(flagsPath+"flag-rose.png"));
 23.1548  	fo->setName("rose");
 23.1549 -	fo->setToolTip(tr("Rose","Standardflag"));
 23.1550 +	a=new QAction (fo->getPixmap(),fo->getName(),this);
 23.1551 +	tb->addAction (a);
 23.1552 +	fo->setAction (a);
 23.1553 +	a->setCheckable(true);
 23.1554 +	a->setObjectName(fo->getName());
 23.1555 +	a->setToolTip(tr("Rose","Standardflag"));
 23.1556 +	connect (a, SIGNAL( triggered() ), this, SLOT( standardFlagChanged() ) );
 23.1557  	standardFlagsDefault->addFlag (fo);	
 23.1558  
 23.1559  	fo->load(QPixmap(flagsPath+"flag-heart.png"));
 23.1560  	fo->setName("heart");
 23.1561 -	fo->setToolTip(tr("I just love... ","Standardflag"));
 23.1562 +	a=new QAction (fo->getPixmap(),fo->getName(),this);
 23.1563 +	tb->addAction (a);
 23.1564 +	a->setCheckable(true);
 23.1565 +	a->setObjectName(fo->getName());
 23.1566 +	a->setToolTip(tr("I just love... ","Standardflag"));
 23.1567 +	connect (a, SIGNAL( triggered() ), this, SLOT( standardFlagChanged() ) );
 23.1568  	standardFlagsDefault->addFlag (fo);	
 23.1569  
 23.1570  	fo->load(QPixmap(flagsPath+"flag-present.png"));
 23.1571  	fo->setName("present");
 23.1572 -	fo->setToolTip(tr("Surprise!","Standardflag"));
 23.1573 +	a=new QAction (fo->getPixmap(),fo->getName(),this);
 23.1574 +	tb->addAction (a);
 23.1575 +	fo->setAction (a);
 23.1576 +	a->setCheckable(true);
 23.1577 +	a->setObjectName(fo->getName());
 23.1578 +	a->setToolTip(tr("Surprise!","Standardflag"));
 23.1579 +	connect (a, SIGNAL( triggered() ), this, SLOT( standardFlagChanged() ) );
 23.1580  	standardFlagsDefault->addFlag (fo);	
 23.1581  
 23.1582  	fo->load(QPixmap(flagsPath+"flag-flash.png"));
 23.1583  	fo->setName("flash");
 23.1584 -	fo->setToolTip(tr("Dangerous","Standardflag"));
 23.1585 +	a=new QAction (fo->getPixmap(),fo->getName(),this);
 23.1586 +	tb->addAction (a);
 23.1587 +	fo->setAction (a);
 23.1588 +	a->setCheckable(true);
 23.1589 +	a->setObjectName(fo->getName());
 23.1590 +	a->setToolTip(tr("Dangerous","Standardflag"));
 23.1591 +	connect (a, SIGNAL( triggered() ), this, SLOT( standardFlagChanged() ) );
 23.1592  	standardFlagsDefault->addFlag (fo);	
 23.1593  	
 23.1594  	fo->load(QPixmap(flagsPath+"flag-info.png"));
 23.1595  	// Original: xsldbg_output.png
 23.1596  	fo->setName("info");
 23.1597 -	fo->setToolTip(tr("Info","Standardflag"));
 23.1598 +	a=new QAction (fo->getPixmap(),fo->getName(),this);
 23.1599 +	tb->addAction (a);
 23.1600 +	fo->setAction (a);
 23.1601 +	a->setCheckable(true);
 23.1602 +	a->setObjectName(fo->getName());
 23.1603 +	a->setToolTip(tr("Info","Standardflag"));
 23.1604 +	connect (a, SIGNAL( triggered() ), this, SLOT( standardFlagChanged() ) );
 23.1605  	standardFlagsDefault->addFlag (fo);	
 23.1606  
 23.1607  	fo->load(QPixmap(flagsPath+"flag-lifebelt.png"));
 23.1608  	// Original khelpcenter.png
 23.1609  	fo->setName("lifebelt");
 23.1610 -	fo->setToolTip(tr("This will help","Standardflag"));
 23.1611 +	a=new QAction (fo->getPixmap(),fo->getName(),this);
 23.1612 +	tb->addAction (a);
 23.1613 +	fo->setAction (a);
 23.1614 +	a->setCheckable(true);
 23.1615 +	a->setObjectName(fo->getName());
 23.1616 +	a->setToolTip(tr("This will help","Standardflag"));
 23.1617 +	connect (a, SIGNAL( triggered() ), this, SLOT( standardFlagChanged() ) );
 23.1618  	standardFlagsDefault->addFlag (fo);	
 23.1619  
 23.1620  	delete (fo);
 23.1621 -
 23.1622 -	standardFlagsDefault->makeToolbar(this, "Standard Flags");
 23.1623  }
 23.1624  
 23.1625  // Settings Actions
 23.1626  void Main::setupSettingsActions()
 23.1627  {
 23.1628 -    QPopupMenu *menu = new QPopupMenu( this );
 23.1629 -    menuBar()->insertItem( tr( "&Settings" ), menu );
 23.1630 +    QMenu *settingsMenu = menuBar()->addMenu( tr( "&Settings" ));
 23.1631  
 23.1632  	QAction *a;
 23.1633  
 23.1634 -
 23.1635 -    a = new QAction( tr( "Set application to open pdf files"), QPixmap(), tr( "Set application to open pdf files  ...") , 0, this, "setPDF" );
 23.1636 -    connect( a, SIGNAL( activated() ), this, SLOT( settingsPDF() ) );
 23.1637 -    a->addTo( menu );
 23.1638 -
 23.1639 -    a = new QAction( tr( "Set application to open external links"), QPixmap(), tr( "Set application to open external links..."), 0, this, "setURL" );
 23.1640 -    connect( a, SIGNAL( activated() ), this, SLOT( settingsURL() ) );
 23.1641 -    a->addTo( menu );
 23.1642 -
 23.1643 -    menu->insertSeparator();
 23.1644 -    a = new QAction( tr( "Edit branch after adding it" ), QPixmap(), tr( "Edit branch after adding it" ), 0, this, "autoedit" );
 23.1645 +    a = new QAction( tr( "Set application to open pdf files"), this);
 23.1646 +    a->setStatusTip ( tr( "Set application to open pdf files"));
 23.1647 +    connect( a, SIGNAL( triggered() ), this, SLOT( settingsPDF() ) );
 23.1648 +	settingsMenu->addAction (a);
 23.1649 +
 23.1650 +    a = new QAction( tr( "Set application to open external links"), this);
 23.1651 +    a->setStatusTip( tr( "Set application to open external links"));
 23.1652 +    connect( a, SIGNAL( triggered() ), this, SLOT( settingsURL() ) );
 23.1653 +	settingsMenu->addAction (a);
 23.1654 +
 23.1655 +	settingsMenu->addSeparator();
 23.1656 +    a = new QAction( tr( "Edit branch after adding it" ), this );
 23.1657 +    a->setStatusTip( tr( "Edit branch after adding it" ));
 23.1658  	a->setToggleAction(true);
 23.1659 -	a->setOn ( settings.readBoolEntry ("/vym/mapeditor/editmode/autoedit",true) );
 23.1660 -    a->addTo( menu );
 23.1661 +	a->setOn ( settings.value ("/mapeditor/editmode/autoEdit",true).toBool());
 23.1662 +	settingsMenu->addAction (a);
 23.1663  	actionSettingsAutoedit=a;
 23.1664  
 23.1665 -    a= new QAction( tr( "Select branch after adding it" ), QPixmap(), tr( "Select branch after adding it" ), 0, this, "autoselectheading" );
 23.1666 +    a= new QAction( tr( "Select branch after adding it" ), this );
 23.1667 +    a->setStatusTip( tr( "Select branch after adding it" ));
 23.1668  	a->setToggleAction(true);
 23.1669 -	a->setOn ( settings.readBoolEntry ("/vym/mapeditor/editmode/autoselect",false) );
 23.1670 -    a->addTo( menu );
 23.1671 +	a->setOn ( settings.value ("/mapeditor/editmode/autoSelectHeading",false).toBool() );
 23.1672 +	settingsMenu->addAction (a);
 23.1673  	actionSettingsAutoselectHeading=a;
 23.1674  	
 23.1675 -    a= new QAction( tr( "Select heading before editing" ), QPixmap(), tr( "Select existing heading" ), 0, this, "autoselectexistingtext" );
 23.1676 +    a= new QAction(tr( "Select existing heading" ), this);
 23.1677 +    a->setStatusTip( tr( "Select heading before editing" ));
 23.1678  	a->setToggleAction(true);
 23.1679 -	a->setOn ( settings.readBoolEntry ("/vym/mapeditor/editmode/autoselectexistingtext",true) );
 23.1680 -    a->addTo( menu );
 23.1681 +	a->setOn ( settings.value ("/mapeditor/editmode/autoSelectText",true).toBool() );
 23.1682 +	settingsMenu->addAction (a);
 23.1683  	actionSettingsAutoselectText=a;
 23.1684  	
 23.1685 -    a= new QAction( tr( "Pasting into new branch" ), QPixmap(), tr( "pasting into new branch" ), 0, this, "pastenewheading" );
 23.1686 +    a= new QAction( tr( "Delete key" ), this);
 23.1687 +    a->setStatusTip( tr( "Delete key for deleting branches" ));
 23.1688  	a->setToggleAction(true);
 23.1689 -	a->setOn ( settings.readBoolEntry ("/vym/mapeditor/editmode/newheadingisempty",true) );
 23.1690 -    a->addTo( menu );
 23.1691 -	actionSettingsPasteNewHeading=a;
 23.1692 -	
 23.1693 -    a= new QAction( tr( "Delete key for deleting branches" ), QPixmap(), tr( "Delete key" ), 0, this, "delkey" );
 23.1694 +	a->setOn ( settings.value ("/mapeditor/editmode/useDelKey",false).toBool() );
 23.1695 +	settingsMenu->addAction (a);
 23.1696 +    connect( a, SIGNAL( triggered() ), this, SLOT( settingsToggleDelKey() ) );
 23.1697 +	actionSettingsUseDelKey=a;
 23.1698 +
 23.1699 +    a= new QAction( tr( "Exclusive flags" ), this);
 23.1700 +    a->setStatusTip( tr( "Use exclusive flags in flag toolbars" ));
 23.1701  	a->setToggleAction(true);
 23.1702 -	a->setOn ( settings.readBoolEntry ("/vym/mapeditor/editmode/useDelKey",false) );
 23.1703 -    a->addTo( menu );
 23.1704 -    connect( a, SIGNAL( activated() ), this, SLOT( settingsToggleDelKey() ) );
 23.1705 -	actionSettingsUseDelKey=a;
 23.1706 -
 23.1707 -    a= new QAction( tr( "Use exclusive flags in flag toolbars" ), QPixmap(), tr( "Exclusive flags" ), 0, this, "flaggroups" );
 23.1708 -	a->setToggleAction(true);
 23.1709 -	a->setOn ( settings.readBoolEntry ("/vym/mapeditor/editmode/useFlagGroups",true) );
 23.1710 -    a->addTo( menu );
 23.1711 +	a->setOn ( settings.value ("/mapeditor/editmode/useFlagGroups",true).toBool() );
 23.1712 +	settingsMenu->addAction (a);
 23.1713  	actionSettingsUseFlagGroups=a;
 23.1714  	
 23.1715 -    a= new QAction( tr( "Use hide flag during exports " ), QPixmap(), tr( "Use hide flags" ), 0, this, "hideexport" );
 23.1716 +    a= new QAction( tr( "Use hide flags" ), this);
 23.1717 +    a->setStatusTip( tr( "Use hide flag during exports " ));
 23.1718  	a->setToggleAction(true);
 23.1719 -	a->setOn ( settings.readBoolEntry ("/vym/export/useHideExport",true) );
 23.1720 -    a->addTo( menu );
 23.1721 +	a->setOn ( settings.value ("/export/useHideExport",true).toBool() );
 23.1722 +	settingsMenu->addAction (a);
 23.1723  	actionSettingsUseHideExport=a;
 23.1724  }
 23.1725  
 23.1726  // Test Actions
 23.1727  void Main::setupTestActions()
 23.1728  {
 23.1729 -    QPopupMenu *menu = new QPopupMenu( this );
 23.1730 -    menuBar()->insertItem( tr( "&Test" ), menu );
 23.1731 +    QMenu *testMenu = menuBar()->addMenu( tr( "&Test" ));
 23.1732  
 23.1733      QAction *a;
 23.1734 -    a = new QAction( tr( "Call test function" ), QPixmap(), tr( "test flag" ), 0, this, "flag" );
 23.1735 -    connect( a, SIGNAL( activated() ), this, SLOT( testFunction() ) );
 23.1736 -    a->addTo( menu );
 23.1737 +    a = new QAction( tr( "test flag" ), this);
 23.1738 +    a->setStatusTip( tr( "Call test function" ));
 23.1739 +    connect( a, SIGNAL( triggered() ), this, SLOT( testFunction() ) );
 23.1740 +	testMenu->addAction (a);
 23.1741  }
 23.1742  
 23.1743  // Help Actions
 23.1744  void Main::setupHelpActions()
 23.1745  {
 23.1746 -    QPopupMenu *menu = new QPopupMenu( this );
 23.1747 -    menuBar()->insertItem( tr( "&Help" ), menu );
 23.1748 +    QMenu *helpMenu = menuBar()->addMenu ( tr( "&Help" ));
 23.1749  
 23.1750      QAction *a;
 23.1751 -    a = new QAction( tr( "Open VYM Documentation (pdf)" ), QPixmap(), tr( "Open VYM Documentation (pdf) " ), 0, this, "about" );
 23.1752 -    connect( a, SIGNAL( activated() ), this, SLOT( helpDoc() ) );
 23.1753 -    a->addTo( menu );
 23.1754 -
 23.1755 -    a = new QAction( tr( "About VYM")+" "__VYM, QPixmap(), tr( "About VYM" ), 0, this, "about" );
 23.1756 -    connect( a, SIGNAL( activated() ), this, SLOT( helpAbout() ) );
 23.1757 -    a->addTo( menu );
 23.1758 -
 23.1759 -    a = new QAction( tr( "Information about QT toolkit" ), QPixmap(), tr( "About QT" ), 0, this, "about" );
 23.1760 -    connect( a, SIGNAL( activated() ), this, SLOT( helpAboutQT() ) );
 23.1761 -    a->addTo( menu );
 23.1762 +    a = new QAction(  tr( "Open VYM Documentation (pdf) " ), this );
 23.1763 +    a->setStatusTip( tr( "Open VYM Documentation (pdf)" ));
 23.1764 +    connect( a, SIGNAL( triggered() ), this, SLOT( helpDoc() ) );
 23.1765 +	helpMenu->addAction (a);
 23.1766 +
 23.1767 +    a = new QAction( tr( "About VYM" ), this);
 23.1768 +    a->setStatusTip( tr( "About VYM")+" "__VYM);
 23.1769 +    connect( a, SIGNAL( triggered() ), this, SLOT( helpAbout() ) );
 23.1770 +	helpMenu->addAction (a);
 23.1771 +
 23.1772 +    a = new QAction( tr( "About QT" ), this);
 23.1773 +    a->setStatusTip( tr( "Information about QT toolkit" ));
 23.1774 +    connect( a, SIGNAL( triggered() ), this, SLOT( helpAboutQT() ) );
 23.1775 +	helpMenu->addAction (a);
 23.1776  }
 23.1777  
 23.1778  // Context Menus
 23.1779 @@ -1131,130 +1512,87 @@
 23.1780  	QAction*a;
 23.1781  
 23.1782  	// Context Menu for branch or mapcenter
 23.1783 -	branchContextMenu =new QPopupMenu (this);
 23.1784 +	branchContextMenu =new QMenu (this);
 23.1785  
 23.1786  		// Submenu "Add"
 23.1787 -		branchAddContextMenu =new QPopupMenu (this);
 23.1788 -		actionEditPaste->addTo ( branchAddContextMenu );
 23.1789 -		actionEditAddBranch->addTo ( branchAddContextMenu );
 23.1790 -		actionEditAddBranchHere->addTo ( branchAddContextMenu );
 23.1791 -		actionEditAddBranchAbove->addTo ( branchAddContextMenu );
 23.1792 -		actionEditAddBranchBelow->addTo ( branchAddContextMenu );
 23.1793 -		branchAddContextMenu->insertSeparator();	
 23.1794 -		actionEditLoadImage->addTo( branchAddContextMenu );
 23.1795 -		branchAddContextMenu->insertSeparator();	
 23.1796 -		actionEditImportAdd->addTo ( branchAddContextMenu );
 23.1797 -		actionEditImportReplace->addTo ( branchAddContextMenu );
 23.1798 +		branchAddContextMenu =branchContextMenu->addMenu (tr("Add"));
 23.1799 +		branchAddContextMenu->addAction (actionEditPaste );
 23.1800 +		branchAddContextMenu->addAction ( actionEditAddBranch );
 23.1801 +		branchAddContextMenu->addAction ( actionEditAddBranchHere );
 23.1802 +		branchAddContextMenu->addAction ( actionEditAddBranchAbove);
 23.1803 +		branchAddContextMenu->addAction ( actionEditAddBranchBelow );
 23.1804 +		branchAddContextMenu->addSeparator();	
 23.1805 +		branchAddContextMenu->addAction ( actionEditLoadImage);
 23.1806 +		branchAddContextMenu->addSeparator();	
 23.1807 +		branchAddContextMenu->addAction ( actionEditImportAdd );
 23.1808 +		branchAddContextMenu->addAction ( actionEditImportReplace );
 23.1809  
 23.1810  		// Submenu "Remove"
 23.1811 -		branchRemoveContextMenu =new QPopupMenu (this);
 23.1812 -		actionEditCut->addTo ( branchRemoveContextMenu );
 23.1813 -		actionEditDelete->addTo ( branchRemoveContextMenu );
 23.1814 -		actionEditRemoveBranchKeepChilds->addTo( branchRemoveContextMenu );
 23.1815 -		actionEditRemoveChilds->addTo( branchRemoveContextMenu );
 23.1816 +		branchRemoveContextMenu =branchContextMenu->addMenu (tr ("Remove"));
 23.1817 +		branchRemoveContextMenu->addAction (actionEditCut);
 23.1818 +		branchRemoveContextMenu->addAction ( actionEditDelete );
 23.1819 +		branchRemoveContextMenu->addAction ( actionEditRemoveBranchKeepChilds );
 23.1820 +		branchRemoveContextMenu->addAction ( actionEditRemoveChilds );
 23.1821  		
 23.1822 -	branchContextMenu->insertItem (tr("Add"),branchAddContextMenu);	
 23.1823 -	branchContextMenu->insertItem (tr("Remove"),branchRemoveContextMenu);	
 23.1824  
 23.1825  	actionEditSaveBranch->addTo( branchContextMenu );
 23.1826  
 23.1827 -	branchContextMenu->insertSeparator();	
 23.1828 -	actionEditOpenURL->addTo ( branchContextMenu );
 23.1829 -	actionEditOpenURLTab->addTo ( branchContextMenu );
 23.1830 -	actionEditURL->addTo ( branchContextMenu );
 23.1831 -	actionEditHeading2URL->addTo ( branchContextMenu );
 23.1832 -	actionEditBugzilla2URL->addTo( branchContextMenu );
 23.1833 -    if (settings.readBoolEntry( "/vym/mainwindow/showTestMenu",false)) 
 23.1834 -	{
 23.1835 -		actionEditFATE2URL->addTo( branchContextMenu );
 23.1836 -	}	
 23.1837 -	branchContextMenu->insertSeparator();	
 23.1838 -	actionEditOpenVymLink->addTo ( branchContextMenu );
 23.1839 -	actionEditVymLink->addTo ( branchContextMenu );
 23.1840 -	actionEditDeleteVymLink->addTo ( branchContextMenu );
 23.1841 -	
 23.1842 -	branchContextMenu->insertSeparator();	
 23.1843 -	actionGroupFormatFrameTypes->addTo( branchContextMenu );
 23.1844 -
 23.1845 -	branchContextMenu->insertSeparator();	
 23.1846 -	actionFormatIncludeImagesVer->addTo( branchContextMenu );
 23.1847 -	actionFormatIncludeImagesHor->addTo( branchContextMenu );
 23.1848 -	actionFormatHideLinkUnselected->addTo( branchContextMenu );
 23.1849 -
 23.1850 -	// Context Menu for links in a branch menu
 23.1851 +	branchContextMenu->addSeparator();	
 23.1852 +	branchContextMenu->addAction ( actionFormatFrameNone );
 23.1853 +	branchContextMenu->addAction ( actionFormatFrameRectangle);
 23.1854 +
 23.1855 +	branchContextMenu->addSeparator();	
 23.1856 +	branchContextMenu->addAction ( actionFormatIncludeImagesVer );
 23.1857 +	branchContextMenu->addAction ( actionFormatIncludeImagesHor );
 23.1858 +	branchContextMenu->addAction ( actionFormatHideLinkUnselected );
 23.1859 +
 23.1860 +	// Submenu for Links (URLs, vymLinks)
 23.1861 +	branchLinksContextMenu =new QMenu (this);
 23.1862 +
 23.1863 +		branchContextMenu->addSeparator();	
 23.1864 +		branchLinksContextMenu=branchContextMenu->addMenu(tr("URLs and vymLinks"));	
 23.1865 +		branchLinksContextMenu->addAction ( actionEditOpenURL );
 23.1866 +		branchLinksContextMenu->addAction ( actionEditOpenURLTab );
 23.1867 +		branchLinksContextMenu->addAction ( actionEditOpenMultipleURLTabs );
 23.1868 +		branchLinksContextMenu->addAction ( actionEditURL );
 23.1869 +		branchLinksContextMenu->addAction ( actionEditHeading2URL );
 23.1870 +		branchLinksContextMenu->addAction ( actionEditBugzilla2URL );
 23.1871 +		if (settings.value( "/mainwindow/showTestMenu",true).toBool() )
 23.1872 +		{
 23.1873 +			branchLinksContextMenu->addAction ( actionEditFATE2URL );
 23.1874 +		}	
 23.1875 +		branchLinksContextMenu->addSeparator();	
 23.1876 +		branchLinksContextMenu->addAction ( actionEditOpenVymLink );
 23.1877 +		branchLinksContextMenu->addAction ( actionEditOpenMultipleVymLinks );
 23.1878 +		branchLinksContextMenu->addAction ( actionEditVymLink );
 23.1879 +		branchLinksContextMenu->addAction ( actionEditDeleteVymLink );
 23.1880 +		
 23.1881 +
 23.1882 +	// Context Menu for XLinks in a branch menu
 23.1883  	// This will be populated "on demand" in MapEditor::updateActions
 23.1884 -	branchContextMenu->insertSeparator();	
 23.1885 -	branchLinksContextMenu =new QPopupMenu (this);
 23.1886 -	branchLinksContextMenuDup =new QPopupMenu (this);
 23.1887 -	branchContextMenu->insertItem (tr("Edit XLink"),branchLinksContextMenuDup);
 23.1888 -	connect( branchLinksContextMenuDup, SIGNAL( activated(int) ), this, SLOT( editEditXLink(int ) ) );
 23.1889 -
 23.1890 -	branchContextMenu->insertItem (tr("Goto XLink"),branchLinksContextMenu);
 23.1891 -	connect( branchLinksContextMenu, SIGNAL( activated(int) ), this, SLOT( editFollowXLink(int ) ) );
 23.1892 +	branchContextMenu->addSeparator();	
 23.1893 +	branchXLinksContextMenuEdit =branchContextMenu->addMenu (tr ("Edit XLink"));
 23.1894 +	branchXLinksContextMenuFollow =branchContextMenu->addMenu (tr ("Follow XLink"));
 23.1895 +	connect( branchXLinksContextMenuFollow, SIGNAL( triggered(QAction *) ), this, SLOT( editFollowXLink(QAction * ) ) );
 23.1896 +	connect( branchXLinksContextMenuEdit, SIGNAL( triggered(QAction *) ), this, SLOT( editEditXLink(QAction * ) ) );
 23.1897 + 	
 23.1898  	
 23.1899  	// Context menu for floatimage
 23.1900 -	floatimageContextMenu =new QPopupMenu (this);
 23.1901 -	saveImageFormatMenu=new QPopupMenu (this);
 23.1902 -	exportImageFormatMenu=new QPopupMenu (this);
 23.1903 -
 23.1904 -	QStrList fmt = QImage::outputFormats();
 23.1905 -	for (const char* f = fmt.first(); f; f = fmt.next()) 
 23.1906 -	{
 23.1907 -		saveImageFormatMenu->insertItem( f );
 23.1908 -		exportImageFormatMenu->insertItem( f );
 23.1909 -	}	
 23.1910 -	connect( saveImageFormatMenu, SIGNAL( activated(int) ), this, SLOT( editSaveImage(int ) ) );
 23.1911 -	connect( exportImageFormatMenu, SIGNAL( activated(int) ), this, SLOT( fileExportImage(int ) ) );
 23.1912 -	floatimageContextMenu->insertItem( tr("Save image"),saveImageFormatMenu );
 23.1913 -	
 23.1914 -	floatimageContextMenu->insertSeparator();	
 23.1915 +	floatimageContextMenu =new QMenu (this);
 23.1916 +	a= new QAction (tr ("Save image"),this);
 23.1917 +	connect (a, SIGNAL (triggered()), this, SLOT (editSaveImage()));
 23.1918 +	floatimageContextMenu->addAction (a);
 23.1919 +
 23.1920 +	floatimageContextMenu->addSeparator();	
 23.1921  	actionEditCopy->addTo( floatimageContextMenu );
 23.1922  	actionEditCut->addTo( floatimageContextMenu );
 23.1923  
 23.1924 -/* FIXME not needed any longer
 23.1925 -	floatimageContextMenu->insertSeparator();	
 23.1926 -    a = new QAction( tr( "Use for Export" ), QPixmap(), tr( "Use for Export"), 0, this, "useForExport" );
 23.1927 -	a->setToggleAction(true);
 23.1928 -    connect( a, SIGNAL( activated() ), this, SLOT( editToggleFloatExport() ) );
 23.1929 -    a->addTo( floatimageContextMenu);
 23.1930 -	actionEditToggleFloatExport=a;
 23.1931 -	*/
 23.1932 -
 23.1933 -	floatimageContextMenu->insertSeparator();	
 23.1934 -	actionFormatHideLinkUnselected->addTo( floatimageContextMenu );
 23.1935 -
 23.1936 -	exportMenu->insertItem ( tr("Export as")+" Image",exportImageFormatMenu);
 23.1937 -
 23.1938 -	a = new QAction( tr( "Export in Open Document Format used e.g. in Open Office " ), QPixmap(), "Open Office"+QString("..."), 0, this, "exportOOPresentation" );
 23.1939 -	connect( a, SIGNAL( activated() ), this, SLOT( fileExportOOPresentation() ) );
 23.1940 -	a->addTo (exportMenu);
 23.1941 -
 23.1942 -	a = new QAction( tr( "Export as")+" webpage (XHTML)" , QPixmap(), "Webpage (XHTML)...", ALT + Key_X, this, "exportXHTML" );
 23.1943 -    connect( a, SIGNAL( activated() ), this, SLOT( fileExportXHTML() ) );
 23.1944 -    a->addTo( exportMenu );
 23.1945 -
 23.1946 -    a = new QAction( tr( "Export as")+" ASCII"+" "+tr("(still experimental)" ), QPixmap(), "Text (ASCII)...", 0, this, "exportASCII" );
 23.1947 -    connect( a, SIGNAL( activated() ), this, SLOT( fileExportASCII() ) );
 23.1948 -	a->addTo( exportMenu );
 23.1949 -
 23.1950 -	a = new QAction( tr( "Export as")+" "+tr("KDE Bookmarks" ), QPixmap(), tr("KDE Bookmarks"), 0, this, "importKDEBookmarks" );
 23.1951 -	connect( a, SIGNAL( activated() ), this, SLOT( fileExportKDEBookmarks() ) );
 23.1952 -	a->addTo (exportMenu);
 23.1953 -
 23.1954 -    a = new QAction( tr( "Export as")+" Taskjuggler"+" "+tr("(still experimental)" ), QPixmap(), "Taskjuggler...", 0, this, "exportTJ" );
 23.1955 -    connect( a, SIGNAL( activated() ), this, SLOT( fileExportTaskjuggler() ) );
 23.1956 -	a->addTo( exportMenu );
 23.1957 -
 23.1958 -    a = new QAction( tr( "Export as")+" LaTeX"+" "+tr("(still experimental)" ), QPixmap(), "LaTeX...", 0, this, "exportLaTeX" );
 23.1959 -    connect( a, SIGNAL( activated() ), this, SLOT( fileExportLaTeX() ) );
 23.1960 -	a->addTo( exportMenu );
 23.1961 -
 23.1962 -	a = new QAction( tr( "Export as")+" XML" , QPixmap(), "XML...",  0, this, "exportXML" );
 23.1963 -    connect( a, SIGNAL( activated() ), this, SLOT( fileExportXML() ) );
 23.1964 -    a->addTo( exportMenu );
 23.1965 +	floatimageContextMenu->addSeparator();	
 23.1966 +	floatimageContextMenu->addAction ( actionFormatHideLinkUnselected );
 23.1967 +
 23.1968  	
 23.1969  	// Context menu for canvas
 23.1970 -	canvasContextMenu =new QPopupMenu (this);
 23.1971 +	canvasContextMenu =new QMenu (this);
 23.1972  	actionEditMapInfo->addTo( canvasContextMenu );
 23.1973  	canvasContextMenu->insertSeparator();	
 23.1974  	actionGroupFormatLinkStyles->addTo( canvasContextMenu );
 23.1975 @@ -1266,15 +1604,15 @@
 23.1976  	// Menu for last opened files
 23.1977  	// Read settings initially
 23.1978  	QString s;
 23.1979 -	int j=settings.readNumEntry( "/vym/lastMaps/number",0);
 23.1980 +	int j=settings.readNumEntry( "/lastMaps/number",0);
 23.1981  	for (int i=1;i<=j;i++)
 23.1982  	{
 23.1983 -		s=settings.readEntry(QString("/vym/lastMaps/map-%1").arg(i),"");
 23.1984 +		s=settings.value(QString("/lastMaps/map-%1").arg(i),"").toString();
 23.1985  		if (!s.isEmpty() && j<=maxLastMaps) 
 23.1986  			lastMaps.append(s);
 23.1987  	}
 23.1988  	setupLastMapsMenu();
 23.1989 -	connect( lastMapsMenu, SIGNAL( activated(int) ), this, SLOT( fileLoadLast(int ) ) );
 23.1990 +	connect( fileLastMapsMenu, SIGNAL( triggered(QAction *) ), this, SLOT( fileLoadLast(QAction*) ) );
 23.1991  }
 23.1992  
 23.1993  void Main::setupLastMapsMenu()
 23.1994 @@ -1300,10 +1638,9 @@
 23.1995  	while ((int)(lastMaps.count()) > maxLastMaps) lastMaps.pop_back();
 23.1996  	
 23.1997  	// build Menu from lastMaps string list
 23.1998 -	lastMapsMenu->clear();
 23.1999 +	fileLastMapsMenu->clear();
 23.2000  	for (it = lastMaps.begin(); it != lastMaps.end(); ++it ) 
 23.2001 -		lastMapsMenu->insertItem (*it );
 23.2002 -		
 23.2003 +		fileLastMapsMenu->addAction (*it );
 23.2004  }
 23.2005  
 23.2006  void Main::hideEvent (QHideEvent * )
 23.2007 @@ -1347,8 +1684,8 @@
 23.2008  
 23.2009  QString Main::browseDirectory (const QString &caption)
 23.2010  {
 23.2011 -	QFileDialog fd(this,caption);
 23.2012 -	fd.setMode (QFileDialog::DirectoryOnly);
 23.2013 +	Q3FileDialog fd(this,caption);
 23.2014 +	fd.setMode (Q3FileDialog::DirectoryOnly);
 23.2015  	fd.setCaption(__VYM " - "+caption);
 23.2016  	fd.show();
 23.2017  	
 23.2018 @@ -1370,7 +1707,7 @@
 23.2019  void Main::newView() 
 23.2020  {
 23.2021      // Open a new view... have it delete when closed.
 23.2022 -    Main *m = new Main(0, 0, WDestructiveClose);
 23.2023 +    Main *m = new Main(0, 0, Qt::WDestructiveClose);
 23.2024      qApp->setMainWidget(m);
 23.2025      m->show();
 23.2026      qApp->setMainWidget(0);
 23.2027 @@ -1397,12 +1734,12 @@
 23.2028  void Main::fileNew()
 23.2029  {
 23.2030  	QString fn="unnamed";
 23.2031 -	MapEditor* medit = new MapEditor (tabWidget, true);
 23.2032 +	MapEditor* medit = new MapEditor ( NULL,true);
 23.2033  	tabWidget->addTab (medit,fn);
 23.2034  	tabWidget->showPage(medit);
 23.2035  	medit->viewport()->setFocus();
 23.2036 -		// For the very first map we do not have flagrows yet...
 23.2037 -		medit->select("mc:");
 23.2038 +	// For the very first map we do not have flagrows yet...
 23.2039 +	medit->select("mc:");
 23.2040  }
 23.2041  
 23.2042  ErrorCode Main::fileLoad(QString fn, const LoadMode &lmode)
 23.2043 @@ -1435,7 +1772,7 @@
 23.2044  					QMessageBox::Warning,
 23.2045  					QMessageBox::Yes | QMessageBox::Default,
 23.2046  					QMessageBox::Cancel | QMessageBox::Escape,
 23.2047 -					QMessageBox::QMessageBox::NoButton);
 23.2048 +					QMessageBox::NoButton);
 23.2049  				mb.setButtonText( QMessageBox::Yes, tr("Open anyway") );
 23.2050  				mb.setButtonText( QMessageBox::Cancel, tr("Cancel"));
 23.2051  				switch( mb.exec() ) 
 23.2052 @@ -1465,7 +1802,7 @@
 23.2053  		// create a new mapeditor in a new tab
 23.2054  		if ( lmode==NewMap && (!me || !me->isDefault() ) )
 23.2055  		{
 23.2056 -			me = new MapEditor (tabWidget,true);
 23.2057 +			me= new MapEditor ( NULL,true);
 23.2058  			tabWidget->addTab (me,fn);
 23.2059  			tabIndex=tabWidget->indexOf (me);
 23.2060  			tabWidget->setCurrentPage (tabIndex);
 23.2061 @@ -1480,7 +1817,7 @@
 23.2062  				QMessageBox::Question,
 23.2063  				QMessageBox::Yes ,
 23.2064  				QMessageBox::Cancel | QMessageBox::Default,
 23.2065 -				QMessageBox::QMessageBox::NoButton );
 23.2066 +				QMessageBox::NoButton );
 23.2067  
 23.2068  			mb.setButtonText( QMessageBox::Yes, tr("Create"));
 23.2069  			mb.setButtonText( QMessageBox::No, tr("Cancel"));
 23.2070 @@ -1603,10 +1940,9 @@
 23.2071  
 23.2072  void Main::fileLoad(const LoadMode &lmode)
 23.2073  {
 23.2074 -	QFileDialog *fd=new QFileDialog( this);
 23.2075 -	if (!lastFileDir.isEmpty()) 
 23.2076 -		fd->setDir (lastFileDir);
 23.2077 -	fd->setMode (QFileDialog::ExistingFiles);
 23.2078 +	Q3FileDialog *fd=new Q3FileDialog( this);
 23.2079 +	fd->setDir (lastFileDir);
 23.2080 +	fd->setMode (Q3FileDialog::ExistingFiles);
 23.2081  	fd->addFilter ("XML (*.xml)");
 23.2082  	fd->addFilter ("VYM map (*.vym *.vyp)");
 23.2083  	switch (lmode)
 23.2084 @@ -1644,9 +1980,9 @@
 23.2085  	fileLoad (NewMap);
 23.2086  }
 23.2087  
 23.2088 -void Main::fileLoadLast(int i)
 23.2089 +void Main::fileLoadLast(QAction *a)
 23.2090  {
 23.2091 -	fileLoad(*lastMaps.at(lastMapsMenu->indexOf (i) ),NewMap);			   
 23.2092 +	fileLoad(lastMaps.at(fileLastMapsMenu->actions().indexOf(a)) ,NewMap);
 23.2093  }
 23.2094  
 23.2095  void Main::fileSave(const SaveMode &savemode)
 23.2096 @@ -1770,9 +2106,9 @@
 23.2097  	if (currentMapEditor())
 23.2098  	{
 23.2099  		if (savemode==CompleteMap)
 23.2100 -			fn = QFileDialog::getSaveFileName( QString::null, "VYM map (*.vym)", this );
 23.2101 +			fn = Q3FileDialog::getSaveFileName( QString::null, "VYM map (*.vym)", this );
 23.2102  		else		
 23.2103 -			fn = QFileDialog::getSaveFileName( QString::null, "VYM part of map (*.vyp)", this );
 23.2104 +			fn = Q3FileDialog::getSaveFileName( QString::null, "VYM part of map (*.vyp)", this );
 23.2105  		if ( !fn.isEmpty() ) 
 23.2106  		{
 23.2107  			// Check for existing file
 23.2108 @@ -1783,7 +2119,7 @@
 23.2109  					QMessageBox::Warning,
 23.2110  					QMessageBox::Yes | QMessageBox::Default,
 23.2111  					QMessageBox::Cancel | QMessageBox::Escape,
 23.2112 -					QMessageBox::QMessageBox::NoButton);
 23.2113 +					QMessageBox::NoButton);
 23.2114  				mb.setButtonText( QMessageBox::Yes, tr("Overwrite") );
 23.2115  				mb.setButtonText( QMessageBox::Cancel, tr("Cancel"));
 23.2116  				switch( mb.exec() ) 
 23.2117 @@ -1842,9 +2178,9 @@
 23.2118  
 23.2119  void Main::fileImportFirefoxBookmarks()
 23.2120  {
 23.2121 -	QFileDialog *fd=new QFileDialog( this);
 23.2122 +	Q3FileDialog *fd=new Q3FileDialog( this);
 23.2123  	fd->setDir (vymBaseDir.homeDirPath()+"/.mozilla/firefox");
 23.2124 -	fd->setMode (QFileDialog::ExistingFiles);
 23.2125 +	fd->setMode (Q3FileDialog::ExistingFiles);
 23.2126  	fd->addFilter ("Firefox "+tr("Bookmarks")+" (*.html)");
 23.2127  	fd->setCaption(tr("Import")+" "+"Firefox "+tr("Bookmarks"));
 23.2128  	fd->show();
 23.2129 @@ -1871,10 +2207,9 @@
 23.2130  {
 23.2131  	ImportMM im;
 23.2132  
 23.2133 -	QFileDialog *fd=new QFileDialog( this);
 23.2134 -	if (!lastFileDir.isEmpty()) 
 23.2135 -		fd->setDir (lastFileDir);
 23.2136 -	fd->setMode (QFileDialog::ExistingFiles);
 23.2137 +	Q3FileDialog *fd=new Q3FileDialog( this);
 23.2138 +	fd->setDir (lastFileDir);
 23.2139 +	fd->setMode (Q3FileDialog::ExistingFiles);
 23.2140  	fd->addFilter ("Mind Manager (*.mmap)");
 23.2141  	fd->setCaption(tr("Import")+" "+"Mind Manager");
 23.2142  	fd->show();
 23.2143 @@ -1949,18 +2284,23 @@
 23.2144  	}	
 23.2145  }
 23.2146  
 23.2147 -void Main::fileExportImage(int item)
 23.2148 +void Main::fileExportImage()
 23.2149  {
 23.2150  	MapEditor *me=currentMapEditor();
 23.2151  	if (me)
 23.2152  	{
 23.2153 -		QString fn = QFileDialog::getSaveFileName( QString::null, "Image  (*.bmp *.jpg *.pbm *.pgm *.png *.ppm *xbm *.xpm)",
 23.2154 -							   this );
 23.2155 -		if ( !fn.isEmpty() ) 
 23.2156 -			me->exportImage(fn,item);
 23.2157 -		else 
 23.2158 -			statusBar()->message( tr("Couldn't save %1").arg(fn), statusbarTime );
 23.2159 -		
 23.2160 +		QStringList fl;
 23.2161 +		QFileDialog *fd=new QFileDialog (this);
 23.2162 +		fd->setCaption (tr("Export map as image"));
 23.2163 +		fd->setFileMode(QFileDialog::AnyFile);
 23.2164 +		fd->setFilters  (imageIO.getFilters() );
 23.2165 +		fd->setDirectory (lastImageDir);
 23.2166 +		if (fd->exec())
 23.2167 +		{
 23.2168 +			fl=fd->selectedFiles();
 23.2169 +			qWarning ("Selected "+fl.first()+"  filter: "+fd->selectedFilter());
 23.2170 +			me->exportImage (fl.first(), imageIO.getType (fd->selectedFilter() ) );
 23.2171 +		} 
 23.2172  	}
 23.2173  }
 23.2174  
 23.2175 @@ -2032,13 +2372,13 @@
 23.2176  void Main::fileExportOOPresentation()
 23.2177  {
 23.2178  	ExportOOFileDialog *fd=new ExportOOFileDialog( this,__VYM " - "+tr("Export to")+" Open Office");
 23.2179 -	// FIXME add extra info in dialog
 23.2180 +	// TODO add preview in dialog
 23.2181  	//ImagePreview *p =new ImagePreview (fd);
 23.2182  	//fd->setContentsPreviewEnabled( TRUE );
 23.2183  	//fd->setContentsPreview( p, p );
 23.2184  	//fd->setPreviewMode( QFileDialog::Contents );
 23.2185  	fd->setCaption(__VYM " - " +tr("Export to")+" Open Office");
 23.2186 -	//fd->setDir (lastImageDir);
 23.2187 +	fd->setDir (QDir().current());
 23.2188  	if (fd->foundConfig())
 23.2189  	{
 23.2190  		fd->show();
 23.2191 @@ -2046,6 +2386,9 @@
 23.2192  		if ( fd->exec() == QDialog::Accepted )
 23.2193  		{
 23.2194  			QString fn=fd->selectedFile();
 23.2195 +			if (!fn.contains (".odp"))
 23.2196 +				fn +=".odp";
 23.2197 +
 23.2198  			//lastImageDir=fn.left(fn.findRev ("/"));
 23.2199  			if (currentMapEditor())
 23.2200  				currentMapEditor()->exportOOPresentation(fn,fd->selectedConfig());	
 23.2201 @@ -2053,8 +2396,8 @@
 23.2202  	} else
 23.2203  	{
 23.2204  		QMessageBox::warning(0, 
 23.2205 -			tr("Warning"),
 23.2206 -			tr("Couldn't find configuration for export to Open Office\n"));
 23.2207 +		tr("Warning"),
 23.2208 +		tr("Couldn't find configuration for export to Open Office\n"));
 23.2209  	}
 23.2210  }
 23.2211  
 23.2212 @@ -2121,13 +2464,8 @@
 23.2213  				QMessageBox::Cancel | QMessageBox::Escape );
 23.2214  			mb.setButtonText( QMessageBox::Yes, tr("Save map") );
 23.2215  			mb.setButtonText( QMessageBox::No, tr("Discard changes") );
 23.2216 +			mb.setModal (true);
 23.2217  			mb.show();
 23.2218 -			// Call undocumented function: setActiveWindow is only
 23.2219 -			// possible, if widget is visible. This depends on
 23.2220 -			// windowmanager...
 23.2221 -#if defined(Q_OS_LINUX)
 23.2222 -			qt_wait_for_window_manager( this);
 23.2223 -#endif			
 23.2224  			mb.setActiveWindow();
 23.2225  			switch( mb.exec() ) {
 23.2226  				case QMessageBox::Yes:
 23.2227 @@ -2180,13 +2518,6 @@
 23.2228  {
 23.2229  	findWindow->popup();
 23.2230  	findWindow->raise();
 23.2231 -
 23.2232 -	// Call undocumented function: setActiveWindow is only
 23.2233 -	// possible, if widget is visible. This depends on
 23.2234 -	// windowmanager...
 23.2235 -#if defined(Q_OS_LINUX)
 23.2236 -	qt_wait_for_window_manager( this);
 23.2237 -#endif	
 23.2238  	findWindow->setActiveWindow();
 23.2239  }
 23.2240  
 23.2241 @@ -2209,20 +2540,86 @@
 23.2242  	currentMapEditor()->findReset();
 23.2243  }
 23.2244  
 23.2245 +void Main::openTabs(QStringList urls)
 23.2246 +{
 23.2247 +	if (!urls.isEmpty())
 23.2248 +	{	
 23.2249 +		bool success=true;
 23.2250 +		QStringList args;
 23.2251 +		QString browser=settings.value("/mainwindow/readerURL" ).toString();
 23.2252 +		QProcess *p;
 23.2253 +		if (!procBrowser ||  procBrowser->state()!=QProcess::Running)
 23.2254 +		{
 23.2255 +			QString u=urls.takeFirst();
 23.2256 +			procBrowser = new QProcess( this );
 23.2257 +			args<<u;
 23.2258 +			procBrowser->start(browser,args);
 23.2259 +			if ( !procBrowser->waitForStarted())
 23.2260 +			{
 23.2261 +				// try to set path to browser
 23.2262 +				QMessageBox::warning(0, 
 23.2263 +					tr("Warning"),
 23.2264 +					tr("Couldn't find a viewer to open %1.\n").arg(u)+
 23.2265 +					tr("Please use Settings->")+tr("Set application to open an URL"));
 23.2266 +				return;
 23.2267 +			}
 23.2268 +			sleep (3);
 23.2269 +		}
 23.2270 +		if (browser.contains("konqueror"))
 23.2271 +		{
 23.2272 +			for (int i=0; i<urls.size(); i++)
 23.2273 +			{
 23.2274 +				// Open new browser
 23.2275 +				// Try to open new tab in existing konqueror started previously by vym
 23.2276 +				p=new QProcess (this);
 23.2277 +				args.clear();
 23.2278 +				args<< QString("konqueror-%1").arg(procBrowser->pid())<< 
 23.2279 +					"konqueror-mainwindow#1"<< 
 23.2280 +					"newTab" << 
 23.2281 +					urls.at(i);
 23.2282 +				p->start ("dcop",args);
 23.2283 +				if ( !p->waitForStarted() ) success=false;
 23.2284 +			}
 23.2285 +			if (!success)
 23.2286 +				QMessageBox::warning(0, 
 23.2287 +					tr("Warning"),
 23.2288 +					tr("Couldn't start %1 to open a new tab in %2.").arg("dcop").arg("konqueror"));
 23.2289 +			return;		
 23.2290 +		} else if (browser.contains ("firefox") || browser.contains ("mozilla") )
 23.2291 +		{
 23.2292 +			for (int i=0; i<urls.size(); i++)
 23.2293 +			{
 23.2294 +				// Try to open new tab in firefox
 23.2295 +				p=new QProcess (this);
 23.2296 +				args<< "-remote"<< QString("openurl(%1,new-tab)").arg(urls.at(i));
 23.2297 +				p->start (browser,args);
 23.2298 +				if ( !p->waitForStarted() ) success=false;
 23.2299 +			}			
 23.2300 +			if (!success)
 23.2301 +				QMessageBox::warning(0, 
 23.2302 +					tr("Warning"),
 23.2303 +					tr("Couldn't start %1 to open a new tab").arg(browser));
 23.2304 +			return;		
 23.2305 +		}			
 23.2306 +		QMessageBox::warning(0, 
 23.2307 +			tr("Warning"),
 23.2308 +			tr("Sorry, currently only Konqueror and Mozilla support tabbed browsing."));
 23.2309 +	}	
 23.2310 +}
 23.2311 +
 23.2312  void Main::editOpenURL()
 23.2313  {
 23.2314  	// Open new browser
 23.2315  	if (currentMapEditor())
 23.2316  	{	
 23.2317  	    QString url=currentMapEditor()->getURL();
 23.2318 +		QStringList args;
 23.2319  		if (url=="") return;
 23.2320 -		QString browser=settings.readEntry("/vym/mainwindow/readerURL" );
 23.2321 +		QString browser=settings.value("/mainwindow/readerURL" ).toString();
 23.2322  		procBrowser = new QProcess( this );
 23.2323 -
 23.2324 -		procBrowser->addArgument( browser);
 23.2325 -		procBrowser->addArgument( url);
 23.2326 -
 23.2327 -		if ( !procBrowser->start() ) 
 23.2328 +		args<<url;
 23.2329 +		procBrowser->start(browser,args);
 23.2330 +		if ( !procBrowser->waitForStarted())
 23.2331  		{
 23.2332  			// try to set path to browser
 23.2333  			QMessageBox::warning(0, 
 23.2334 @@ -2237,45 +2634,21 @@
 23.2335  {
 23.2336  	if (currentMapEditor())
 23.2337  	{	
 23.2338 -	    QString url=currentMapEditor()->getURL();
 23.2339 -		if (url=="") return;
 23.2340 -		QString browser=settings.readEntry("/vym/mainwindow/readerURL" );
 23.2341 -		if (procBrowser && procBrowser->isRunning())
 23.2342 -		{
 23.2343 -			if (browser.contains("konqueror"))
 23.2344 -			{
 23.2345 -				// Try to open new tab in existing konqueror started previously by vym
 23.2346 -				QProcess *p=new QProcess (this);
 23.2347 -				p->addArgument ("dcop");
 23.2348 -				p->addArgument (QString("konqueror-%1").arg(procBrowser->processIdentifier()));
 23.2349 -				p->addArgument ("konqueror-mainwindow#1");
 23.2350 -				p->addArgument ("newTab");
 23.2351 -				p->addArgument (url);
 23.2352 -				if ( !p->start() ) 
 23.2353 -					// try to set browser
 23.2354 -					QMessageBox::warning(0, 
 23.2355 -						tr("Warning"),
 23.2356 -						tr("Couldn't start %1 to open a new tab in %2.").arg("dcop").arg("konqueror"));
 23.2357 -				return;		
 23.2358 -			} else if (browser.contains ("firefox") || browser.contains ("mozilla") )
 23.2359 -			{
 23.2360 -				// Try to open new tab in firefox
 23.2361 -				QProcess *p=new QProcess (this);
 23.2362 -				p->addArgument (browser);
 23.2363 -				p->addArgument ("-remote");
 23.2364 -				p->addArgument (QString("openurl(%1,new-tab)").arg(url));
 23.2365 -				if ( !p->start() ) 
 23.2366 -					// try to set browser
 23.2367 -					QMessageBox::warning(0, 
 23.2368 -						tr("Warning"),
 23.2369 -						tr("Couldn't start %1 to open a new tab").arg(browser));
 23.2370 -				return;		
 23.2371 -			}
 23.2372 -		}
 23.2373 -		// Open new browser
 23.2374 -		editOpenURL();
 23.2375 +	    QStringList urls;
 23.2376 +		urls.append(currentMapEditor()->getURL());
 23.2377 +		openTabs (urls);
 23.2378  	}	
 23.2379  }
 23.2380 +void Main::editOpenMultipleURLTabs()
 23.2381 +{
 23.2382 +	if (currentMapEditor())
 23.2383 +	{	
 23.2384 +	    QStringList urls;
 23.2385 +		urls=currentMapEditor()->getURLs();
 23.2386 +		openTabs (urls);
 23.2387 +	}	
 23.2388 +}
 23.2389 +
 23.2390  
 23.2391  void Main::editURL()
 23.2392  {
 23.2393 @@ -2301,13 +2674,66 @@
 23.2394  	    currentMapEditor()->editFATE2URL();
 23.2395  }
 23.2396  
 23.2397 -void Main::editOpenVymLink()
 23.2398 +void Main::editHeading()
 23.2399  {
 23.2400 -	// Get current path to map
 23.2401 -	QString currentVymLink;
 23.2402 -	if (currentMapEditor())
 23.2403 +	if (lineedit->isVisible())
 23.2404  	{
 23.2405 -		currentVymLink=currentMapEditor()->getVymLink();	
 23.2406 +		if (currentMapEditor())
 23.2407 +		{	
 23.2408 +			MapEditor *me=currentMapEditor();
 23.2409 +			QString oldSel=me->getSelectString();
 23.2410 +			if (me->select (editSel))
 23.2411 +				me->setHeading(lineedit->text());
 23.2412 +			me->select (oldSel);
 23.2413 +		}	
 23.2414 +		lineedit->releaseKeyboard();
 23.2415 +		lineedit->hide();
 23.2416 +		setFocus();
 23.2417 +	} else
 23.2418 +	{
 23.2419 +		if (currentMapEditor())
 23.2420 +		{
 23.2421 +			bool ok;
 23.2422 +			QPoint p;
 23.2423 +			QString s=currentMapEditor()->getHeading(ok,p);
 23.2424 +
 23.2425 +			if (ok)
 23.2426 +			{
 23.2427 +#if defined(Q_OS_MACX)
 23.2428 +				p = currentMapEditor()->mapToGlobal( currentMapEditor()->worldMatrix().map( p));
 23.2429 +				QDialog *d =new QDialog(NULL);
 23.2430 +				QLineEdit *le=new QLineEdit (d);
 23.2431 +				d->setWindowFlags (Qt::FramelessWindowHint);
 23.2432 +				d->setGeometry(p.x(),p.y(),200,25);
 23.2433 +				le->resize (d->size());
 23.2434 +				le->setText (s);
 23.2435 +				le->selectAll();
 23.2436 +				connect (le, SIGNAL (returnPressed()), d, SLOT (accept()));
 23.2437 +				d->activateWindow();
 23.2438 +				d->exec();
 23.2439 +				currentMapEditor()->setHeading (le->text());
 23.2440 +#else
 23.2441 +				p = currentMapEditor()->mapTo(this, currentMapEditor()->worldMatrix().map( p));
 23.2442 +				lineedit->setGeometry(p.x(),p.y(),200,25);
 23.2443 +				lineedit->setText(s);
 23.2444 +				lineedit->setCursorPosition(1);
 23.2445 +				lineedit->selectAll();
 23.2446 +				lineedit->show();
 23.2447 +				lineedit->grabKeyboard();
 23.2448 +				lineedit->setFocus();
 23.2449 +
 23.2450 +				editSel=currentMapEditor()->getSelectString();
 23.2451 +#endif
 23.2452 +
 23.2453 +			}
 23.2454 +		}
 23.2455 +	}
 23.2456 +}
 23.2457 +
 23.2458 +void Main::openVymLinks(const QStringList &vl)
 23.2459 +{
 23.2460 +	for (int j=0; j<vl.size(); j++)
 23.2461 +	{
 23.2462  		// compare path with already loaded maps
 23.2463  		int index=-1;
 23.2464  		int i;
 23.2465 @@ -2315,7 +2741,7 @@
 23.2466  		for (i=0;i<=tabWidget->count() -1;i++)
 23.2467  		{
 23.2468  			me=(MapEditor*)tabWidget->page(i);
 23.2469 -			if (currentVymLink==me->getFilePath() )
 23.2470 +			if (vl.at(j)==me->getFilePath() )
 23.2471  			{
 23.2472  				index=i;
 23.2473  				break;
 23.2474 @@ -2324,12 +2750,12 @@
 23.2475  		if (index<0)
 23.2476  		// Load map
 23.2477  		{
 23.2478 -			if (!QFile(currentVymLink).exists() )
 23.2479 +			if (!QFile(vl.at(j)).exists() )
 23.2480  				QMessageBox::critical( 0, tr( "Critical Error" ),
 23.2481 -				   tr("Couldn't open map %1").arg(currentVymLink));
 23.2482 +				   tr("Couldn't open map %1").arg(vl.at(j)));
 23.2483  			else
 23.2484  			{
 23.2485 -				fileLoad (currentVymLink, NewMap);
 23.2486 +				fileLoad (vl.at(j), NewMap);
 23.2487  				tabWidget->setCurrentPage (tabWidget->count()-1);	
 23.2488  			}
 23.2489  		} else
 23.2490 @@ -2338,6 +2764,26 @@
 23.2491  	}
 23.2492  }
 23.2493  
 23.2494 +void Main::editOpenVymLink()
 23.2495 +{
 23.2496 +	if (currentMapEditor())
 23.2497 +	{
 23.2498 +		QStringList vl;
 23.2499 +		vl.append(currentMapEditor()->getVymLink());	
 23.2500 +		openVymLinks (vl);
 23.2501 +	}
 23.2502 +}
 23.2503 +
 23.2504 +void Main::editOpenMultipleVymLinks()
 23.2505 +{
 23.2506 +	QString currentVymLink;
 23.2507 +	if (currentMapEditor())
 23.2508 +	{
 23.2509 +		QStringList vl=currentMapEditor()->getVymLinks();
 23.2510 +		openVymLinks (vl);
 23.2511 +	}
 23.2512 +}
 23.2513 +
 23.2514  void Main::editVymLink()
 23.2515  {
 23.2516  	if (currentMapEditor())
 23.2517 @@ -2390,15 +2836,10 @@
 23.2518  	}	
 23.2519  }
 23.2520  
 23.2521 -void Main::editHeading()
 23.2522 -{
 23.2523 -	if (currentMapEditor())
 23.2524 -		currentMapEditor()->editHeading();
 23.2525 -}
 23.2526 -
 23.2527  void Main::editNewBranch()
 23.2528  {
 23.2529 -	if (currentMapEditor())
 23.2530 +
 23.2531 +	if (!lineedit->isVisible() && currentMapEditor())
 23.2532  		currentMapEditor()->addNewBranch(0);
 23.2533  }
 23.2534  
 23.2535 @@ -2495,22 +2936,23 @@
 23.2536  		currentMapEditor()->loadFloatImage();
 23.2537  }
 23.2538  
 23.2539 -void Main::editSaveImage(int item)
 23.2540 +void Main::editSaveImage()
 23.2541  {
 23.2542  	if (currentMapEditor())
 23.2543 -		currentMapEditor()->saveFloatImage(item);
 23.2544 +		currentMapEditor()->saveFloatImage();
 23.2545  }
 23.2546  
 23.2547 -void Main::editFollowXLink(int item)
 23.2548 +void Main::editFollowXLink(QAction *a)
 23.2549 +{
 23.2550 +
 23.2551 +	if (currentMapEditor())
 23.2552 +		currentMapEditor()->followXLink(branchXLinksContextMenuFollow->actions().indexOf(a));
 23.2553 +}
 23.2554 +
 23.2555 +void Main::editEditXLink(QAction *a)
 23.2556  {
 23.2557  	if (currentMapEditor())
 23.2558 -		currentMapEditor()->followXLink(branchLinksContextMenu->indexOf(item));
 23.2559 -}
 23.2560 -
 23.2561 -void Main::editEditXLink(int item)
 23.2562 -{
 23.2563 -	if (currentMapEditor())
 23.2564 -		currentMapEditor()->editXLink(branchLinksContextMenuDup->indexOf(item));
 23.2565 +		currentMapEditor()->editXLink(branchXLinksContextMenuEdit->actions().indexOf(a));
 23.2566  }
 23.2567  
 23.2568  void Main::formatSelectColor()
 23.2569 @@ -2624,7 +3066,7 @@
 23.2570  {
 23.2571  	if (currentMapEditor())
 23.2572  	{
 23.2573 -		QWMatrix m;
 23.2574 +		QMatrix m;
 23.2575  		m.reset();
 23.2576  		currentMapEditor()->setWorldMatrix( m );
 23.2577  		currentMapEditor()->setViewCenter();
 23.2578 @@ -2636,7 +3078,7 @@
 23.2579  {
 23.2580  	if (currentMapEditor())
 23.2581  	{
 23.2582 -		QWMatrix m = currentMapEditor()->worldMatrix();
 23.2583 +		QMatrix m = currentMapEditor()->worldMatrix();
 23.2584  		m.scale( 1.25, 1.25 );
 23.2585  		currentMapEditor()->setWorldMatrix( m );
 23.2586  		currentMapEditor()->setViewCenter();
 23.2587 @@ -2648,7 +3090,7 @@
 23.2588  {
 23.2589  	if (currentMapEditor())
 23.2590  	{
 23.2591 -		QWMatrix m = currentMapEditor()->worldMatrix();
 23.2592 +		QMatrix m = currentMapEditor()->worldMatrix();
 23.2593  		m.scale( 0.8, 0.8 );
 23.2594  		currentMapEditor()->setWorldMatrix( m );
 23.2595  		currentMapEditor()->setViewCenter();
 23.2596 @@ -2670,9 +3112,9 @@
 23.2597  	bool ok;
 23.2598  	QString text = QInputDialog::getText(
 23.2599  		"VYM", tr("Set application to open PDF files")+":", QLineEdit::Normal,
 23.2600 -		settings.readEntry("/vym/mainwindow/readerPDF"), &ok, this );
 23.2601 +		settings.value("/mainwindow/readerPDF").toString(), &ok, this );
 23.2602  	if (ok)
 23.2603 -		settings.writeEntry ("/vym/mainwindow/readerPDF",text);
 23.2604 +		settings.setValue ("/mainwindow/readerPDF",text);
 23.2605  	return ok;
 23.2606  }
 23.2607  
 23.2608 @@ -2683,10 +3125,10 @@
 23.2609  	bool ok;
 23.2610  	QString text = QInputDialog::getText(
 23.2611  		"VYM", tr("Set application to open an URL")+":", QLineEdit::Normal,
 23.2612 -		settings.readEntry("/vym/mainwindow/readerURL")
 23.2613 +		settings.value("/mainwindow/readerURL").toString()
 23.2614  		, &ok, this );
 23.2615  	if (ok)
 23.2616 -		settings.writeEntry ("/vym/mainwindow/readerURL",text);
 23.2617 +		settings.setValue ("/mainwindow/readerURL",text);
 23.2618  	return ok;
 23.2619  }
 23.2620  
 23.2621 @@ -2694,7 +3136,7 @@
 23.2622  {
 23.2623  	if (actionSettingsUseDelKey->isOn())
 23.2624  	{
 23.2625 -		actionEditDelete->setAccel (QKeySequence (Key_Delete));
 23.2626 +		actionEditDelete->setAccel (QKeySequence (Qt::Key_Delete));
 23.2627  	} else
 23.2628  	{
 23.2629  		actionEditDelete->setAccel (QKeySequence (""));
 23.2630 @@ -2793,7 +3235,7 @@
 23.2631  	
 23.2632  	Process *pdfProc = new Process();
 23.2633  	pdfProc->clearArguments();
 23.2634 -	pdfProc->addArgument( settings.readEntry("/vym/mainwindow/readerPDF"));
 23.2635 +	pdfProc->addArgument( settings.value("/mainwindow/readerPDF").toString());
 23.2636  	pdfProc->addArgument( docpath);
 23.2637  
 23.2638  	if ( !pdfProc->start() ) 
    24.1 --- a/mainwindow.h	Tue Sep 05 09:47:13 2006 +0000
    24.2 +++ b/mainwindow.h	Tue Sep 05 09:47:14 2006 +0000
    24.3 @@ -1,16 +1,16 @@
    24.4  #ifndef MAINWINDOW_H 
    24.5  #define MAINWINDOW_H
    24.6  
    24.7 -#include <qpopupmenu.h>
    24.8 -#include <qmainwindow.h>
    24.9 -#include <qtextedit.h>
   24.10 -#include <qintdict.h>
   24.11 -#include <qcanvas.h>
   24.12 -#include <qlineedit.h>
   24.13 -#include <qaction.h>
   24.14 -#include <qcursor.h>
   24.15 -#include <qtabwidget.h>
   24.16 -#include <qmap.h>
   24.17 +#include <QAction>
   24.18 +#include <QCursor>
   24.19 +#include <QMainWindow>
   24.20 +#include <QProcess>
   24.21 +#include <QToolBar>
   24.22 +#include <QTabWidget>
   24.23 +//Added by qt3to4:
   24.24 +#include <QCloseEvent>
   24.25 +#include <QShowEvent>
   24.26 +#include <QHideEvent>
   24.27  
   24.28  #include "file.h"
   24.29  #include "findwindow.h"
   24.30 @@ -23,7 +23,7 @@
   24.31      Q_OBJECT
   24.32  
   24.33  public:
   24.34 -    Main(QWidget* parent=0, const char* name=0, WFlags f=0);
   24.35 +    Main(QWidget* parent=0, const char* name=0, Qt::WFlags f=0);
   24.36      ~Main();
   24.37  	void loadCmdLine();
   24.38  	void statusMessage (const QString &);
   24.39 @@ -60,7 +60,7 @@
   24.40      ErrorCode fileLoad(QString ,const LoadMode &);
   24.41      void fileLoad(const LoadMode &);
   24.42      void fileLoad();
   24.43 -	void fileLoadLast(int);
   24.44 +	void fileLoadLast(QAction *);
   24.45      void fileSave(const SaveMode & );
   24.46      void fileSave();
   24.47      void fileSaveAs(const SaveMode &);
   24.48 @@ -71,7 +71,7 @@
   24.49      void fileImportDir();
   24.50      void fileExportXML();
   24.51      void fileExportXHTML();
   24.52 -    void fileExportImage(int);
   24.53 +    void fileExportImage();
   24.54      void fileExportASCII();
   24.55      void fileExportLaTeX();
   24.56      void fileExportKDEBookmarks();
   24.57 @@ -89,16 +89,22 @@
   24.58      void editOpenFindWindow();
   24.59  	void editFind(QString);
   24.60  	void editFindChanged();
   24.61 +private:
   24.62 +	void openTabs(QStringList);
   24.63  public slots:
   24.64  	void editOpenURL();
   24.65  	void editOpenURLTab();
   24.66  private slots:
   24.67 +	void editOpenMultipleURLTabs();
   24.68  	void editURL();
   24.69  	void editHeading2URL();
   24.70  	void editBugzilla2URL();
   24.71  	void editFATE2URL();
   24.72 +	void openVymLinks(const QStringList &);
   24.73  	void editVymLink();
   24.74 +	void editOpenMultipleVymLinks();
   24.75  public slots:
   24.76 +    void editHeading();
   24.77  	void editOpenVymLink();
   24.78  private slots:
   24.79  	void editDeleteVymLink();
   24.80 @@ -108,7 +114,6 @@
   24.81      void editMoveDown();	
   24.82      void editToggleScroll();
   24.83      void editUnScrollAll();
   24.84 -    void editHeading();
   24.85      void editNewBranch();
   24.86      void editNewBranchHere();
   24.87      void editNewBranchAbove();
   24.88 @@ -126,9 +131,9 @@
   24.89      void editFirstBranch();
   24.90      void editLastBranch();
   24.91      void editLoadImage();
   24.92 -    void editSaveImage(int);
   24.93 -    void editFollowXLink (int);
   24.94 -    void editEditXLink (int);
   24.95 +    void editSaveImage();
   24.96 +    void editFollowXLink (QAction *);
   24.97 +    void editEditXLink (QAction *);
   24.98  
   24.99      void formatSelectColor();
  24.100      void formatPickColor();
  24.101 @@ -179,13 +184,17 @@
  24.102      void helpAboutQT();
  24.103  
  24.104  private:
  24.105 -// not needed?    QCanvas* canvas;
  24.106  	QTabWidget *tabWidget;
  24.107  	FindWindow *findWindow;
  24.108  	QStringList lastMaps;
  24.109  	int maxLastMaps;
  24.110 -	QString lastFileDir;
  24.111  	QProcess *procBrowser;
  24.112 +
  24.113 +	QStringList imageTypes;
  24.114 +
  24.115 +	QLineEdit *lineedit;	// to enter headings of branches
  24.116 +	QString editSel;
  24.117 +	
  24.118  };
  24.119  
  24.120  
    25.1 --- a/mapeditor.cpp	Tue Sep 05 09:47:13 2006 +0000
    25.2 +++ b/mapeditor.cpp	Tue Sep 05 09:47:14 2006 +0000
    25.3 @@ -1,24 +1,34 @@
    25.4  #include "mapeditor.h"
    25.5  
    25.6  #include <qstatusbar.h>
    25.7 -#include <qmessagebox.h>
    25.8 +#include <QMessageBox>
    25.9  #include <qapplication.h>
   25.10  #include <qpainter.h>
   25.11 -#include <qpopupmenu.h>
   25.12 +#include <q3popupmenu.h>
   25.13  #include <qprinter.h>
   25.14 -#include <qpaintdevicemetrics.h>
   25.15 -#include <qfile.h>
   25.16 -#include <qfiledialog.h>
   25.17 -#include <qdir.h>
   25.18 -#include <qcolor.h>
   25.19 -#include <qcolordialog.h>
   25.20 -#include <qbitmap.h>
   25.21 -#include <qprocess.h>
   25.22 +#include <q3paintdevicemetrics.h>
   25.23 +#include <QFile>
   25.24 +#include <q3filedialog.h>
   25.25 +#include <QDir>
   25.26 +#include <QColor>
   25.27 +#include <QColorDialog>
   25.28 +#include <QBitmap>
   25.29  #include <qinputdialog.h>
   25.30 -#include <qdragobject.h>
   25.31 -#include <qurloperator.h>
   25.32 -#include <qnetworkprotocol.h>
   25.33 -#include <qregexp.h>
   25.34 +#include <q3dragobject.h>
   25.35 +#include <q3urloperator.h>
   25.36 +#include <q3networkprotocol.h>
   25.37 +#include <QRegExp>
   25.38 +//Added by qt3to4:
   25.39 +#include <QResizeEvent>
   25.40 +#include <QContextMenuEvent>
   25.41 +#include <Q3StrList>
   25.42 +#include <QPixmap>
   25.43 +#include <QMouseEvent>
   25.44 +#include <QDragEnterEvent>
   25.45 +#include <QTextStream>
   25.46 +#include <QDropEvent>
   25.47 +#include <QActionGroup>
   25.48 +#include <Q3PtrList>
   25.49  
   25.50  #include <iostream>
   25.51  #include <cstdlib>
   25.52 @@ -34,7 +44,6 @@
   25.53  #include "linkablemapobj.h"
   25.54  #include "mainwindow.h"
   25.55  #include "misc.h"
   25.56 -#include "settings.h"
   25.57  #include "texteditor.h"
   25.58  #include "warningdialog.h"
   25.59  #include "xml.h"
   25.60 @@ -49,10 +58,11 @@
   25.61  extern FlagRowObj *systemFlagsDefault;
   25.62  extern FlagRowObj *standardFlagsDefault;
   25.63  
   25.64 -extern QPtrList <QAction> actionListBranches;
   25.65 +extern Q3PtrList <QAction> actionListBranches;
   25.66  
   25.67  extern QAction *actionFileSave;
   25.68  extern QAction *actionEditUndo;
   25.69 +extern QAction *actionEditRedo;
   25.70  extern QAction *actionEditCopy;
   25.71  extern QAction *actionEditCut;
   25.72  extern QAction *actionEditPaste;
   25.73 @@ -113,44 +123,51 @@
   25.74  extern QAction *actionSettingsAutoedit;
   25.75  extern QAction *actionSettingsAutoselectHeading;
   25.76  extern QAction *actionSettingsAutoselectText;
   25.77 -extern QAction *actionSettingsPasteNewHeading;
   25.78  extern QAction *actionSettingsUseFlagGroups;
   25.79  
   25.80 -extern QPopupMenu *branchContextMenu;
   25.81 -extern QPopupMenu *branchLinksContextMenu;
   25.82 -extern QPopupMenu *branchLinksContextMenuDup;
   25.83 -extern QPopupMenu *floatimageContextMenu;
   25.84 -extern QPopupMenu *saveImageFormatMenu;
   25.85 -extern QPopupMenu *exportImageFormatMenu;
   25.86 -extern QPopupMenu *canvasContextMenu;
   25.87 +extern QMenu* branchContextMenu;
   25.88 +extern QMenu* branchAddContextMenu;
   25.89 +extern QMenu* branchRemoveContextMenu;
   25.90 +extern QMenu* branchLinksContextMenu;
   25.91 +extern QMenu* branchXLinksContextMenuEdit;
   25.92 +extern QMenu* branchXLinksContextMenuFollow;
   25.93 +extern QMenu* floatimageContextMenu;
   25.94 +extern QMenu* saveImageFormatMenu;
   25.95 +extern QMenu* canvasContextMenu;
   25.96 +extern QMenu* lastMapsMenu;
   25.97 +extern QMenu* importMenu;
   25.98 +extern QMenu* exportMenu;
   25.99 +
  25.100  
  25.101  extern Settings settings;
  25.102 +extern ImageIO imageIO;
  25.103  
  25.104  extern QString iconPath;
  25.105  extern QDir vymBaseDir;
  25.106 +extern QDir lastImageDir;
  25.107  
  25.108  int MapEditor::mapNum=0;	// make instance
  25.109  
  25.110  ///////////////////////////////////////////////////////////////////////
  25.111  ///////////////////////////////////////////////////////////////////////
  25.112  MapEditor::MapEditor(
  25.113 -	QWidget* parent, bool interactive, const char* name, WFlags f) :
  25.114 -  QCanvasView(parent,name,f), urlOperator(0), imageBuffer(0)
  25.115 +	QWidget* parent, bool interactive, const char* name, Qt::WFlags f) :
  25.116 +  Q3CanvasView(parent,name,f), urlOperator(0), imageBuffer(0)
  25.117  {
  25.118  	//cout << "Constructor ME "<<this<<endl;
  25.119  	mapNum++;
  25.120  
  25.121      viewport()->setAcceptDrops(true);
  25.122  
  25.123 -    mapCanvas = new QCanvas(1000,800);
  25.124 +    mapCanvas = new Q3Canvas(width(),height());
  25.125  	mapCanvas->setAdvancePeriod(30);
  25.126 -	mapCanvas->setBackgroundColor (white);
  25.127 +	mapCanvas->setBackgroundColor (Qt::white);
  25.128  
  25.129      setCanvas (mapCanvas);
  25.130  	
  25.131  	// Always show scroll bars (automatic would flicker sometimes)
  25.132 -	setVScrollBarMode ( QScrollView::AlwaysOn );
  25.133 -	setHScrollBarMode ( QScrollView::AlwaysOn );
  25.134 +	setVScrollBarMode ( Q3ScrollView::AlwaysOn );
  25.135 +	setHScrollBarMode ( Q3ScrollView::AlwaysOn );
  25.136  
  25.137      mapCenter = new MapCenterObj(mapCanvas);
  25.138      mapCenter->setVisibility (true);
  25.139 @@ -160,24 +177,18 @@
  25.140  
  25.141      printer=NULL;
  25.142  
  25.143 -    lineedit = new QLineEdit(this, "lineedit"  );
  25.144 -    connect( lineedit, SIGNAL( returnPressed() ), SLOT( finishedLineEdit() ) );
  25.145 -    lineedit->hide();
  25.146 -
  25.147 -    actColor=black; setColor (actColor);
  25.148 +    actColor=Qt::black; setColor (actColor);
  25.149  	defLinkColor=QColor (0,0,255);
  25.150  	defXLinkColor=QColor (180,180,180);
  25.151  	linkcolorhint=DefaultColor;
  25.152  	linkstyle=StylePolyParabel;
  25.153  
  25.154 -	// Create bitmap cursors, patform dependant
  25.155 +	// Create bitmap cursors, platform dependant
  25.156  	#if defined(Q_OS_MACX)
  25.157 -		handOpenCursor=QCursor ( QPixmap(iconPath+"cursorhandopen16.png") );		
  25.158 -		// set hot spot to tip of picker			
  25.159 +		handOpenCursor=QCursor ( QPixmap(iconPath+"cursorhandopen16.png"),1,1 );		
  25.160  		pickColorCursor=QCursor ( QPixmap (iconPath+"cursorcolorpicker16.png"), 1,15 ); 
  25.161  	#else
  25.162 -		handOpenCursor=QCursor (QPixmap(iconPath+"cursorhandopen16.png"));		
  25.163 -		// set hot spot to tip of picker			
  25.164 +		handOpenCursor=QCursor (QPixmap(iconPath+"cursorhandopen.png"),1,1);		
  25.165  		pickColorCursor=QCursor ( QPixmap(iconPath+"cursorcolorpicker.png"), 5,27 ); 
  25.166  	#endif
  25.167  
  25.168 @@ -190,6 +201,8 @@
  25.169      selectionLast=NULL;
  25.170      movingObj=NULL;
  25.171  
  25.172 +	xelection.setMapCenter (mapCenter);
  25.173 +
  25.174  	defXLinkWidth=1;
  25.175  	defXLinkColor=QColor (230,230,230);
  25.176  
  25.177 @@ -202,9 +215,7 @@
  25.178  	fileName=tr("unnamed");
  25.179  	mapName="";
  25.180  
  25.181 -	undosTotal=settings.readNumEntry("/vym/mapeditor/undoLevels",50);
  25.182 -	undosAvail=0;	
  25.183 -	undoNum=0;
  25.184 +	undosTotal=settings.readNumEntry("/mapeditor/undoLevels",50);
  25.185  	
  25.186  	// Initialize find routine
  25.187  	itFind=NULL;				
  25.188 @@ -231,6 +242,8 @@
  25.189  	historyWindow->setCaption (fileName);
  25.190  
  25.191  	mapCenter->reposition();	//	for positioning heading
  25.192 +
  25.193 +
  25.194  }
  25.195  
  25.196  MapEditor::~MapEditor()
  25.197 @@ -244,7 +257,7 @@
  25.198  	//cout <<"Destructor MapEditor\n";
  25.199  
  25.200  	// Save Settings
  25.201 -	//settings.writeEntry( "/vym/mapeditor/editmode/autoselect",  );
  25.202 +	//settings.writeEntry( "/mapeditor/editmode/autoselect",  );
  25.203  
  25.204  }
  25.205  
  25.206 @@ -263,7 +276,7 @@
  25.207      return mapCenter;
  25.208  }
  25.209  
  25.210 -QCanvas* MapEditor::getCanvas()
  25.211 +Q3Canvas* MapEditor::getCanvas()
  25.212  {
  25.213      return mapCanvas;
  25.214  }
  25.215 @@ -355,12 +368,13 @@
  25.216  void MapEditor::makeTmpDirs()
  25.217  {
  25.218  	// Create unique temporary directories
  25.219 -	tmpMapDir=tmpVymDir+QString("/mapeditor-%1").arg(mapNum);
  25.220 +	tmpMapDir=QDir::convertSeparators (tmpVymDir+QString("/mapeditor-%1").arg(mapNum));
  25.221 +	histPath=QDir::convertSeparators (tmpMapDir+"/history");
  25.222  	QDir d;
  25.223  	d.mkdir (tmpMapDir,true);
  25.224  }
  25.225  
  25.226 -QString MapEditor::saveToDir(const QString &tmpdir, const QString &prefix, bool writeflags, const QPoint &offset, LinkableMapObj *saveSelection)
  25.227 +QString MapEditor::saveToDir(const QString &tmpdir, const QString &prefix, bool writeflags, const QPoint &offset, LinkableMapObj *saveSel)
  25.228  {
  25.229  	// tmpdir		temporary directory to which data will be written
  25.230  	// prefix		mapname, which will be appended to images etc.
  25.231 @@ -392,7 +406,7 @@
  25.232  		colhint=attribut("linkColorHint","HeadingColor");
  25.233  
  25.234  	QString mapAttr=attribut("version",__VYM_VERSION);
  25.235 -	if (!saveSelection)
  25.236 +	if (!saveSel)
  25.237  		mapAttr+= attribut("author",mapCenter->getAuthor()) +
  25.238  				  attribut("comment",mapCenter->getComment()) +
  25.239  			      attribut("date",mapCenter->getDate()) +
  25.240 @@ -412,25 +426,28 @@
  25.241  	FloatImageObj (mapCanvas).resetSaveCounter();
  25.242  
  25.243  	// Build xml recursivly
  25.244 -	if (!saveSelection)
  25.245 +	if (!saveSel)
  25.246 +		// Save complete map, if saveSel not set
  25.247  		s+=mapCenter->saveToDir(tmpdir,prefix,writeflags,offset);
  25.248  	else
  25.249  	{
  25.250 -		if ( typeid(*saveSelection) == typeid(BranchObj) )
  25.251 -			s+=((BranchObj*)(saveSelection))->saveToDir(tmpdir,prefix,offset);
  25.252 -		else if ( typeid(*saveSelection) == typeid(FloatImageObj) )
  25.253 -			s+=((FloatImageObj*)(saveSelection))->saveToDir(tmpdir,prefix,offset);
  25.254 +		if ( typeid(*saveSel) == typeid(BranchObj) )
  25.255 +			// Save Subtree
  25.256 +			s+=((BranchObj*)(saveSel))->saveToDir(tmpdir,prefix,offset);
  25.257 +		else if ( typeid(*saveSel) == typeid(FloatImageObj) )
  25.258 +			// Save image
  25.259 +			s+=((FloatImageObj*)(saveSel))->saveToDir(tmpdir,prefix,offset);
  25.260  			
  25.261  		else if (selection && typeid(*selection)==typeid(BranchObj))
  25.262 -				// This is used if selected branch is saved from mainwindow
  25.263 -				s+=((BranchObj*)selection)->saveToDir(tmpdir,prefix,offset);
  25.264 +			// Save selected branch is saved from mainwindow		//FIXME maybe use "subtree" above?
  25.265 +			s+=((BranchObj*)selection)->saveToDir(tmpdir,prefix,offset);
  25.266  	}
  25.267  
  25.268  	// Save local settings
  25.269  	s+=settings.getXMLData (destPath);
  25.270  
  25.271  	// Save selection
  25.272 -	if (selection && !saveSelection ) 
  25.273 +	if (selection && !saveSel ) 
  25.274  		s+=valueElement("select",selection->getSelectString());
  25.275  
  25.276  	decIndent();
  25.277 @@ -441,60 +458,112 @@
  25.278  	return s;
  25.279  }
  25.280  
  25.281 -void MapEditor::saveState(const QString &comment)
  25.282 +void MapEditor::saveStateComplete(const QString &comment)
  25.283  {
  25.284 -	// Save complete map
  25.285 -	saveState (CompleteMap,"",NULL,"",NULL, comment);
  25.286 +	// Save complete map, Undo will replace whole map
  25.287 +	saveState (CompleteMap,
  25.288 +		"", "",
  25.289 +		"", "", 
  25.290 +		comment, 
  25.291 +		mapCenter);
  25.292  }
  25.293  
  25.294 -void MapEditor::saveState(LinkableMapObj *undoSel, const QString &comment)
  25.295 +void MapEditor::saveStatePart(LinkableMapObj *undoSel, const QString &comment)
  25.296  {
  25.297 -	// save the given part of the map 
  25.298 -	saveState (PartOfMap,"",undoSel,"",NULL, comment);
  25.299 +	// save the selected part of the map, Undo will replace part of map 
  25.300 +	QString undoSelection="";
  25.301 +	if (undoSel) undoSelection=undoSel->getSelectString();
  25.302 +
  25.303 +	saveState (PartOfMap,
  25.304 +		undoSelection, "",
  25.305 +		"", "", 
  25.306 +		comment, 
  25.307 +		undoSel);
  25.308  }
  25.309  
  25.310 -void MapEditor::saveState(const QString &uc, const QString &rc, const QString &comment)
  25.311 +void MapEditor::saveStateConstSelection(const QString &uc, const QString &rc, const QString &comment)
  25.312  {
  25.313  	// selection does not change during action,
  25.314  	// so just save commands for undo and redo
  25.315 -	LinkableMapObj *unsel;
  25.316 -	if (selection)
  25.317 -		unsel=selection;
  25.318 -	else
  25.319 -		unsel=NULL;
  25.320 -	saveState (UndoCommand,uc,unsel,rc,unsel, comment);
  25.321 +	// and use current selection
  25.322 +
  25.323 +	QString sel;
  25.324 +	if (selection) sel=selection->getSelectString();
  25.325 +
  25.326 +	saveState (UndoCommand,
  25.327 +		sel, uc,
  25.328 +		sel, rc, 
  25.329 +		comment, 
  25.330 +		NULL);
  25.331  }
  25.332  
  25.333 -void MapEditor::saveState(const QString & uncom, LinkableMapObj *unsel, const QString &comment) 
  25.334 +void MapEditor::saveStateComData(LinkableMapObj *undoSel, const QString &uc, LinkableMapObj *redoSel, const QString &rc, const QString &comment, LinkableMapObj *saveSel) 
  25.335  {
  25.336 -	saveState (UndoCommand,uncom,unsel,"FIXME-redoCom",NULL, comment);
  25.337 +	QString redoSelection="";
  25.338 +	if (redoSel) redoSelection=redoSel->getSelectString();
  25.339 +	QString undoSelection="";
  25.340 +	if (undoSel) undoSelection=undoSel->getSelectString();
  25.341 +
  25.342 +	saveState (UndoCommand,
  25.343 +		undoSelection, uc,
  25.344 +		redoSelection, "FIXME-redoCom",	//FIXME
  25.345 +		comment, 
  25.346 +		saveSel);
  25.347  }
  25.348  
  25.349 -void MapEditor::saveState(const SaveMode &savemode, const QString &undoCom, LinkableMapObj *undoSel, const QString &redoCom, LinkableMapObj *redoSel, const QString &comment)
  25.350 +void MapEditor::saveState(LinkableMapObj *undoSel, const QString &uc, LinkableMapObj *redoSel, const QString &rc, const QString &comment) 
  25.351 +{
  25.352 +	// "Normal" savestate: save commands, selections and comment
  25.353 +	// so just save commands for undo and redo
  25.354 +	// and use current selection
  25.355 +
  25.356 +	QString redoSelection="";
  25.357 +	if (redoSel) redoSelection=redoSel->getSelectString();
  25.358 +	QString undoSelection="";
  25.359 +	if (undoSel) undoSelection=undoSel->getSelectString();
  25.360 +
  25.361 +	saveState (UndoCommand,
  25.362 +		undoSelection, uc,
  25.363 +		redoSelection, rc, 
  25.364 +		comment, 
  25.365 +		NULL);
  25.366 +}
  25.367 +
  25.368 +void MapEditor::saveState(const QString &undoSel, const QString &uc, const QString &redoSel, const QString &rc, const QString &comment) 
  25.369 +{
  25.370 +	// "Normal" savestate: save commands, selections and comment
  25.371 +	// so just save commands for undo and redo
  25.372 +	// and use current selection
  25.373 +	saveState (UndoCommand,
  25.374 +		undoSel, uc,
  25.375 +		redoSel, rc, 
  25.376 +		comment, 
  25.377 +		NULL);
  25.378 +}
  25.379 +
  25.380 +		
  25.381 +void MapEditor::saveState(const SaveMode &savemode, const QString &undoSelection, const QString &undoCom, const QString &redoSelection, const QString &redoCom, const QString &comment, LinkableMapObj *saveSel)
  25.382  {
  25.383  	// Main saveState
  25.384  
  25.385  	if (blockSaveState) return;
  25.386  
  25.387  	/* TODO remove after testing
  25.388 -	cout << "ME::saveState()  begin\n"<<endl;
  25.389 -	cout << "    undosTotal="<<undosTotal<<endl;
  25.390 -	cout << "    undosAvail="<<undosAvail<<endl;
  25.391 -	cout << "       undoNum="<<undoNum<<endl;
  25.392 -	cout << "    ---------------------------"<<endl;
  25.393  	*/
  25.394 -
  25.395 +	cout << "ME::saveState()  begin"<<endl;
  25.396  	historyWindow->append (comment);
  25.397  	
  25.398  	setChanged();
  25.399  
  25.400 +	int undosAvail=undoSet.readNumEntry ("/history/undosAvail",0);
  25.401 +	int curStep=undoSet.readNumEntry ("/history/curStep",0);
  25.402  	// Find out current undo directory
  25.403  	if (undosAvail<undosTotal) undosAvail++;
  25.404 -	undoNum++;
  25.405 -	if (undoNum>undosTotal) undoNum=1;
  25.406 +	curStep++;
  25.407 +	if (curStep>undosTotal) curStep=1;
  25.408  	
  25.409  	QString backupXML;
  25.410 -	QString bakMapDir=QDir::convertSeparators (QString(tmpMapDir+"/undo-%1").arg(undoNum));
  25.411 +	QString bakMapDir=QDir::convertSeparators (QString(tmpMapDir+"/undo-%1").arg(curStep));
  25.412  	QString bakMapPath=QDir::convertSeparators(bakMapDir+"/map.xml");
  25.413  
  25.414  	// Create bakMapDir if not available
  25.415 @@ -502,59 +571,50 @@
  25.416  	if (!d.exists()) 
  25.417  		makeSubDirs (bakMapDir);
  25.418  
  25.419 -	// Save current selection 
  25.420 -	QString redoSelection="";
  25.421 -	if (redoSel)
  25.422 -		redoSelection=redoSel->getSelectString();
  25.423 -
  25.424 -	// Save the object, which should be undone
  25.425 -	QString undoSelection="";
  25.426 -	if (undoSel)
  25.427 -		undoSelection=undoSel->getSelectString();
  25.428 +	// Save depending on how much needs to be saved	
  25.429 +	if (!saveSel)
  25.430 +		backupXML="";
  25.431 +	else 
  25.432 +		backupXML=saveToDir (bakMapDir,mapName+"-",false, QPoint (),saveSel);
  25.433  		
  25.434 -	// Save depending on how much needs to be saved	
  25.435  	QString undoCommand="";
  25.436  	if (savemode==UndoCommand)
  25.437  	{
  25.438  		undoCommand=undoCom;
  25.439 -		backupXML="";
  25.440  	}	
  25.441 -	else if (savemode==PartOfMap && undoSel)
  25.442 +	else if (savemode==PartOfMap )
  25.443  	{
  25.444  		undoCommand="undoPart (\""+ undoSelection+"\",\""+bakMapPath+"\")";
  25.445 -		backupXML=saveToDir (bakMapDir,mapName+"-",false, QPoint (),undoSel);
  25.446  	} else
  25.447  	{
  25.448  		undoCommand="undoMap (\""+bakMapPath+"\")";
  25.449 -		backupXML=saveToDir (bakMapDir,mapName+"-",false, QPoint (),NULL);
  25.450 -		undoSelection="";
  25.451  	}
  25.452  	if (!backupXML.isEmpty())
  25.453  		// Write XML Data to disk
  25.454  		saveStringToDisk (QString(bakMapPath),backupXML);
  25.455  
  25.456 -	SimpleSettings set;
  25.457 -	set.setEntry (QString("undoCommand"),undoCommand);
  25.458 -	set.setEntry (QString("undoSelection"),undoSelection);
  25.459 -	set.setEntry (QString("redoCommand"),redoCom);
  25.460 -	set.setEntry (QString("redoSelection"),redoSelection);
  25.461 -	set.setEntry (QString("comment"),comment);
  25.462 -	set.writeSettings(QString(bakMapDir+"/commands"));
  25.463 +	undoSet.setEntry ("/history/undosAvail",QString::number(undosAvail));
  25.464 +	undoSet.setEntry ("/history/curStep",QString::number(curStep));
  25.465 +	undoSet.setEntry (QString("/history/step-%1/undoCommand").arg(curStep),undoCommand);
  25.466 +	undoSet.setEntry (QString("/history/step-%1/undoSelection").arg(curStep),undoSelection);
  25.467 +	undoSet.setEntry (QString("/history/step-%1/redoCommand").arg(curStep),redoCom);
  25.468 +	undoSet.setEntry (QString("/history/step-%1/redoSelection").arg(curStep),redoSelection);
  25.469 +	undoSet.setEntry (QString("/history/step-%1/comment").arg(curStep),comment);
  25.470 +	undoSet.writeSettings(histPath);
  25.471  
  25.472  	/* TODO remove after testing
  25.473 -	cout << "          into="<< bakMapDir<<endl;
  25.474 -	cout << "    undosAvail="<<undosAvail<<endl;
  25.475 -	cout << "       undoNum="<<undoNum<<endl;
  25.476 +	*/
  25.477 +	//cout << "          into="<< histPath.toStdString()<<endl;
  25.478 +	cout << "    undosTotal="<<undosTotal<<
  25.479 +	", undosAvail="<<undosAvail<<
  25.480 +	", curStep="<<curStep<<endl;
  25.481  	cout << "    ---------------------------"<<endl;
  25.482 -	cout << "    comment="<<comment<<endl;
  25.483 +	cout << "    comment="<<comment.toStdString()<<endl;
  25.484 +	cout << "    undoCom="<<undoCommand.toStdString()<<endl;
  25.485 +	cout << "    undoSel="<<undoSelection.toStdString()<<endl;
  25.486 +	cout << "    redoCom="<<redoCom.toStdString()<<endl;
  25.487 +	cout << "    redoSel="<<redoSelection.toStdString()<<endl;
  25.488  	cout << "    ---------------------------"<<endl;
  25.489 -	cout << "    undoCom="<<undoCommand<<endl;
  25.490 -	cout << "    undoSel="<<undoSelection<<endl;
  25.491 -	cout << "    ---------------------------"<<endl;
  25.492 -	cout << "    redoCom="<<redoCom<<endl;
  25.493 -	cout << "    redoSel="<<redoSelection<<endl;
  25.494 -	cout << "    ---------------------------"<<endl<<endl;
  25.495 -	*/
  25.496  }
  25.497  
  25.498  void MapEditor::parseAtom(const QString &atom)
  25.499 @@ -585,12 +645,43 @@
  25.500  			}
  25.501  		}	
  25.502  	}
  25.503 +	else if (com=="moveRel")
  25.504 +	{
  25.505 +		if (api.checkParamCount(2) && selection )
  25.506 +		{	
  25.507 +			x=api.parInt (ok,0);
  25.508 +			if (ok)
  25.509 +			{
  25.510 +				y=api.parInt (ok,1);
  25.511 +				if (ok) moveRel (x,y);
  25.512 +			}
  25.513 +		}	
  25.514 +	}
  25.515 +	else if (com=="delete")
  25.516 +	{
  25.517 +		if (api.checkParamCount(1) && selection )
  25.518 +		{	
  25.519 +			s=api.parString(ok,0);
  25.520 +			if (ok &&select (s)) deleteSelection();
  25.521 +		}	
  25.522 +	}	
  25.523 +	else if (com=="addBranch")
  25.524 +	{
  25.525 +		if (api.checkParamCount(1) && selection )
  25.526 +		{	
  25.527 +			y=api.parInt (ok,0);
  25.528 +			if (ok ) addNewBranchInt (y);
  25.529 +		}	
  25.530 +	}	
  25.531  	else if (com=="linkBranchToPos")
  25.532  	{
  25.533  		if (selection && typeid(*selection) == typeid(BranchObj) ) 
  25.534  		{
  25.535  			if (api.checkParamCount(4))
  25.536  			{
  25.537 +				// 0	selectstring of parent
  25.538 +				// 1	num in parent (for branches)
  25.539 +				// 2,3	x,y of mainbranch or mapcenter
  25.540  				s=api.parString(ok,0);
  25.541  				LinkableMapObj *dst=mapCenter->findObjBySelect (s);
  25.542  				if (dst)
  25.543 @@ -620,23 +711,56 @@
  25.544  		if (api.checkParamCount(1))
  25.545  		{
  25.546  			s=api.parString (ok,0);
  25.547 -			if (ok) setHeading (s);
  25.548 +			if (ok) 
  25.549 +				setHeading (s);
  25.550  		}	
  25.551  	} else if (com=="setURL")
  25.552  	{
  25.553  		if (api.checkParamCount(1))
  25.554  		{
  25.555  			s=api.parString (ok,0);
  25.556 -			if (ok) setURL(s);
  25.557 +			if (ok) setURLInt(s);
  25.558  		}	
  25.559  	} else if (com=="setVymLink")
  25.560  	{
  25.561  		if (api.checkParamCount(1))
  25.562  		{
  25.563  			s=api.parString (ok,0);
  25.564 -			if (ok) setVymLink(s);
  25.565 +			if (ok) setVymLinkInt(s);
  25.566  		}	
  25.567  	}
  25.568 +	else if (com=="setFlag")
  25.569 +	{
  25.570 +		if (selection && typeid(*selection) == typeid(BranchObj) ) 
  25.571 +		{
  25.572 +			if (api.checkParamCount(1) )
  25.573 +			{	
  25.574 +				s=api.parString(ok,0);
  25.575 +				if (ok) 
  25.576 +				{
  25.577 +					BranchObj* bo=(BranchObj*)selection;
  25.578 +					bo->activateStandardFlag(s);
  25.579 +					bo->updateFlagsToolbar();
  25.580 +				}	
  25.581 +			}	
  25.582 +		}
  25.583 +	}	
  25.584 +	else if (com=="unsetFlag")
  25.585 +	{
  25.586 +		if (selection && typeid(*selection) == typeid(BranchObj) ) 
  25.587 +		{
  25.588 +			if (api.checkParamCount(1) )
  25.589 +			{	
  25.590 +				s=api.parString(ok,0);
  25.591 +				if (ok) 
  25.592 +				{
  25.593 +					BranchObj* bo=(BranchObj*)selection;
  25.594 +					bo->deactivateStandardFlag(s);
  25.595 +					bo->updateFlagsToolbar();
  25.596 +				}	
  25.597 +			}	
  25.598 +		}
  25.599 +	}	
  25.600  	// Internal commands, used for undo etc.	
  25.601  	else if (com==QString("undoMap"))
  25.602  	{
  25.603 @@ -646,55 +770,32 @@
  25.604  	{
  25.605  		if (api.checkParamCount(2))
  25.606  		{
  25.607 -			s=api.parString (ok,0);
  25.608 -			t=api.parString (ok,1);
  25.609 +			s=api.parString (ok,0);	// undo selection
  25.610 +			t=api.parString (ok,1);	// backup dir
  25.611  			undoXML(s,t);	
  25.612  		}
  25.613  	} else if (com=="select")
  25.614 +	{
  25.615  		if (api.checkParamCount(1))
  25.616  		{
  25.617  			s=api.parString(ok,0);
  25.618  			if (ok) select (s);
  25.619  		}	
  25.620 +	}	
  25.621  	else
  25.622  	{
  25.623  		api.setError ("Unknown command in: "+atom);
  25.624 -		cout << "ME::parse   api should have error now...\n";
  25.625  	}
  25.626  
  25.627  	// Any errors?
  25.628  	if (api.error())
  25.629  	{
  25.630 -		cout << "MapEditor::parseAtom: Error!\n";
  25.631 -		cout << "  "<<api.errorDesc()<<endl;
  25.632 +		// TODO Error handling
  25.633 +		qWarning("MapEditor::parseAtom: Error!");
  25.634 +		qWarning(api.errorDesc());
  25.635  	}	
  25.636  }
  25.637  
  25.638 -
  25.639 -void MapEditor::finishedLineEdit()
  25.640 -{
  25.641 -	// This is called by finishedLineEdit or any MapEditor method,
  25.642 -	// which wants to assure, that lineedits finish, before e.g. a branch is 
  25.643 -	// deleted
  25.644 -    
  25.645 -	// After calling LineEdit and using the clipboard, the 
  25.646 -    // focus is not any longer on the main widget, we
  25.647 -    // have to restore it using parentWidget()->setFocus()
  25.648 -
  25.649 -    if (editingBO!=NULL) 
  25.650 -	{
  25.651 -		saveState("setHeading (\""+editingBO->getHeading()+"\")",editingBO, QString("Set heading of %1 to \"%2\"").arg(getName(editingBO)).arg(lineedit->text()) );
  25.652 -		editingBO->setHeading(lineedit->text() );
  25.653 -		editingBO=NULL;
  25.654 -		lineedit->releaseKeyboard();
  25.655 -		lineedit->hide();
  25.656 -		parentWidget()->setFocus();
  25.657 -		mapCenter->reposition();
  25.658 -		adjustCanvasSize();
  25.659 -		ensureSelectionVisible();
  25.660 -    }		
  25.661 -}
  25.662 -
  25.663  void MapEditor::toggleHistoryWindow()
  25.664  {
  25.665  	if (historyWindow->isVisible())
  25.666 @@ -731,9 +832,6 @@
  25.667  
  25.668  void MapEditor::closeMap()
  25.669  {
  25.670 -	// Finish open lineEdits
  25.671 -	if (lineedit) finishedLineEdit();
  25.672 -
  25.673  	// Unselect before disabling the toolbar actions
  25.674  	if (selection) selection->unselect();
  25.675  	selection=NULL;
  25.676 @@ -799,9 +897,6 @@
  25.677  
  25.678  ErrorCode MapEditor::load (QString fname, LoadMode lmode)
  25.679  {
  25.680 -	// Finish open lineEdits
  25.681 -	if (lineedit) finishedLineEdit();
  25.682 -
  25.683  	ErrorCode err=success;
  25.684  
  25.685  	if (lmode==NewMap)
  25.686 @@ -813,7 +908,7 @@
  25.687  		// (map state is set later at end of load...)
  25.688  	} else
  25.689  	{
  25.690 -		saveState(selection,"Load map");
  25.691 +		saveStatePart(selection,"Load map");
  25.692  	}	
  25.693  	
  25.694      
  25.695 @@ -868,9 +963,6 @@
  25.696  
  25.697  int MapEditor::save (const SaveMode &savemode)
  25.698  {
  25.699 -	// Finish open lineEdits
  25.700 -	if (lineedit) finishedLineEdit();
  25.701 -
  25.702  	int returnCode=0;
  25.703  
  25.704  	// The SaveMode UndoCommand is not supported here
  25.705 @@ -918,14 +1010,11 @@
  25.706  
  25.707  void MapEditor::print()
  25.708  {
  25.709 -	// Finish open lineEdits
  25.710 -	if (lineedit) finishedLineEdit();
  25.711 -
  25.712  	if ( !printer ) 
  25.713  	{
  25.714  		printer = new QPrinter;
  25.715  		printer->setColorMode (QPrinter::Color);
  25.716 -		printer->setPrinterName (settings.readEntry("/vym/mainwindow/printerName",printer->printerName()));
  25.717 +		printer->setPrinterName (settings.value("/mainwindow/printerName",printer->printerName()).toString());
  25.718  	}
  25.719  
  25.720  	QRect totalBBox=mapCenter->getTotalBBox();
  25.721 @@ -962,15 +1051,15 @@
  25.722  		// e.g. (0,50,700,700) is upper part on A4
  25.723  		// see also /usr/lib/qt3/doc/html/coordsys.html
  25.724  
  25.725 -		QPaintDeviceMetrics metrics (printer);
  25.726 +		Q3PaintDeviceMetrics metrics (printer);
  25.727  
  25.728  		double paperAspect = (double)metrics.width()   / (double)metrics.height();
  25.729  		double   mapAspect = (double)totalBBox.width() / (double)totalBBox.height();
  25.730  
  25.731  		QRect mapRect=totalBBox;
  25.732 -		QCanvasRectangle *frame=NULL;
  25.733 -		QCanvasText *footerFN=NULL;
  25.734 -		QCanvasText *footerDate=NULL;
  25.735 +		Q3CanvasRectangle *frame=NULL;
  25.736 +		Q3CanvasText *footerFN=NULL;
  25.737 +		Q3CanvasText *footerDate=NULL;
  25.738  		if (printFrame || printFooter)
  25.739  		{
  25.740  			
  25.741 @@ -979,9 +1068,9 @@
  25.742  				// Print frame around map
  25.743  				mapRect.setRect (totalBBox.x()-10, totalBBox.y()-10, 
  25.744  					totalBBox.width()+20, totalBBox.height()+20);
  25.745 -				frame=new QCanvasRectangle (mapRect,mapCanvas);
  25.746 -				frame->setBrush (QColor(white));
  25.747 -				frame->setPen (QColor(black));
  25.748 +				frame=new Q3CanvasRectangle (mapRect,mapCanvas);
  25.749 +				frame->setBrush (QColor(Qt::white));
  25.750 +				frame->setPen (QColor(Qt::black));
  25.751  				frame->setZ(0);
  25.752  				frame->show();    
  25.753  			}		
  25.754 @@ -998,13 +1087,13 @@
  25.755  				// Print footer below map
  25.756  				QFont font;		
  25.757  				font.setPointSize(10);
  25.758 -				footerFN=new QCanvasText (mapCanvas);
  25.759 +				footerFN=new Q3CanvasText (mapCanvas);
  25.760  				footerFN->setText ("VYM - " + fileName);
  25.761  				footerFN->setFont(font);
  25.762  				footerFN->move (mapRect.x(), mapRect.y() + mapRect.height() );
  25.763  				footerFN->setZ(Z_TEXT);
  25.764  				footerFN->show();    
  25.765 -				footerDate=new QCanvasText (mapCanvas);
  25.766 +				footerDate=new Q3CanvasText (mapCanvas);
  25.767  				footerDate->setText (QDate::currentDate().toString(Qt::TextDate));
  25.768  				footerDate->setFont(font);
  25.769  				footerDate->move (mapRect.x()+mapRect.width()-footerDate->boundingRect().width(), mapRect.y() + mapRect.height() );
  25.770 @@ -1045,7 +1134,7 @@
  25.771  		}	
  25.772  
  25.773  		// Save settings in vymrc
  25.774 -		settings.writeEntry("/vym/mainwindow/printerName",printer->printerName());
  25.775 +		settings.writeEntry("/mainwindow/printerName",printer->printerName());
  25.776  	}
  25.777  }
  25.778  
  25.779 @@ -1094,9 +1183,6 @@
  25.780  
  25.781  void MapEditor::exportImage(QString fn)
  25.782  {
  25.783 -	// Finish open lineEdits
  25.784 -	if (lineedit) finishedLineEdit();
  25.785 -
  25.786  	setExportMode (true);
  25.787  	QPixmap pix (getPixmap());
  25.788  	pix.save(fn, "PNG");
  25.789 @@ -1107,20 +1193,17 @@
  25.790  {
  25.791  	// should be called before and after exports
  25.792  	// depending on the settings
  25.793 -	if (b && settings.readEntry("/vym/export/useHideExport","yes"))
  25.794 +	if (b && settings.value("/export/useHideExport","yes")=="yes")
  25.795  		setHideTmpMode (HideExport);
  25.796  	else	
  25.797  		setHideTmpMode (HideNone);
  25.798  }
  25.799  
  25.800 -void MapEditor::exportImage(QString fn, int item)
  25.801 +void MapEditor::exportImage(QString fn, QString format)
  25.802  {
  25.803 -	// Finish open lineEdits
  25.804 -	if (lineedit) finishedLineEdit();
  25.805 -
  25.806  	setExportMode (true);
  25.807  	QPixmap pix (getPixmap());
  25.808 -	pix.save(fn, exportImageFormatMenu->text(item) );
  25.809 +	pix.save(fn, format);
  25.810  	setExportMode (false);
  25.811  }
  25.812  
  25.813 @@ -1152,7 +1235,7 @@
  25.814  	QFile file;
  25.815  
  25.816  	file.setName ( dir + "/"+mapName+".xml");
  25.817 -	if ( !file.open( IO_WriteOnly ) )
  25.818 +	if ( !file.open( QIODevice::WriteOnly ) )
  25.819  	{
  25.820  		// This should neverever happen
  25.821  		QMessageBox::critical (0,tr("Critical Export Error"),tr("MapEditor::exportXML couldn't open %1").arg(file.name()));
  25.822 @@ -1184,9 +1267,6 @@
  25.823  
  25.824  void MapEditor::copy()
  25.825  {
  25.826 -	// Finish open lineEdits
  25.827 -	if (lineedit) finishedLineEdit();
  25.828 -
  25.829  	if (selection) 
  25.830  	{
  25.831  		// write to directory
  25.832 @@ -1195,7 +1275,7 @@
  25.833  		QFile file;
  25.834  
  25.835  		file.setName ( clipboardDir + "/"+clipfile+".xml");
  25.836 -		if ( !file.open( IO_WriteOnly ) )
  25.837 +		if ( !file.open( QIODevice::WriteOnly ) )
  25.838  		{
  25.839  			// This should neverever happen
  25.840  			QMessageBox::critical (0,tr("Critical Export Error"),tr("MapEditor::exportXML couldn't open %1").arg(file.name()));
  25.841 @@ -1215,124 +1295,126 @@
  25.842  
  25.843  void MapEditor::redo()
  25.844  {
  25.845 -	// Finish open lineEdits
  25.846 -	if (lineedit) finishedLineEdit();
  25.847 -
  25.848  	blockSaveState=true;
  25.849  	
  25.850 +	// Restore variables
  25.851 +	int curStep=undoSet.readNumEntry (QString("/history/curStep"));
  25.852 +	int undosAvail=undoSet.readNumEntry (QString("/history/undosAvail"));
  25.853 +	int redosAvail=undoSet.readNumEntry (QString("/history/redosAvail"));
  25.854 +	if (redosAvail>0) redosAvail--;
  25.855 +	if (undosAvail<undosTotal) undosAvail++;
  25.856 +	curStep++;
  25.857 +	if (curStep>undosTotal) curStep=1;
  25.858 +	QString undoCommand=  undoSet.readEntry (QString("/history/step-%1/undoCommand").arg(curStep));
  25.859 +	QString undoSelection=undoSet.readEntry (QString("/history/step-%1/undoSelection").arg(curStep));
  25.860 +	QString redoCommand=  undoSet.readEntry (QString("/history/step-%1/redoCommand").arg(curStep));
  25.861 +	QString redoSelection=undoSet.readEntry (QString("/history/step-%1/redoSelection").arg(curStep));
  25.862 +	QString comment=undoSet.readEntry (QString("/history/step-%1/comment").arg(curStep));
  25.863 +
  25.864  	// Find out current undo directory
  25.865 -	QString bakMapDir=QDir::convertSeparators (QString(tmpMapDir+"/undo-%1").arg(undoNum));
  25.866 -
  25.867 -	// Restore variables
  25.868 -	QString undoCommand;
  25.869 -	QString undoSelection;
  25.870 -	QString redoCommand;
  25.871 -	QString redoSelection;
  25.872 -	SimpleSettings set;
  25.873 -	set.readSettings(QString(bakMapDir+"/commands"));
  25.874 -	undoCommand=set.readEntry ("undoCommand");
  25.875 -	undoSelection=set.readEntry ("undoSelection");
  25.876 -	redoCommand=set.readEntry ("redoCommand");
  25.877 -	redoSelection=set.readEntry ("redoSelection");
  25.878 +	QString bakMapDir=QDir::convertSeparators (QString(tmpMapDir+"/undo-%1").arg(curStep));
  25.879 +
  25.880 +/* TODO remove testing
  25.881 +*/
  25.882 +	cout << "ME::redo() begin\n";
  25.883 +	cout << "    undosAvail="<<undosAvail<<endl;
  25.884 +	cout << "    redosAvail="<<redosAvail<<endl;
  25.885 +	cout << "       curStep="<<curStep<<endl;
  25.886 +	cout << "    ---------------------------"<<endl;
  25.887 +	cout << "    comment="<<comment.toStdString()<<endl;
  25.888 +	cout << "    undoCom="<<undoCommand.toStdString()<<endl;
  25.889 +	cout << "    undoSel="<<undoSelection.toStdString()<<endl;
  25.890 +	cout << "    redoCom="<<redoCommand.toStdString()<<endl;
  25.891 +	cout << "    redoSel="<<redoSelection.toStdString()<<endl;
  25.892 +	cout << "    ---------------------------"<<endl<<endl;
  25.893  
  25.894  	// select  object before redo
  25.895 +	// FIXME better give up if no selection there...
  25.896  	if (!redoSelection.isEmpty())
  25.897  		select (redoSelection);
  25.898  
  25.899 -/* TODO remove testing
  25.900 -	cout << "ME::redo() begin\n";
  25.901 -	cout << "    undosTotal="<<undosTotal<<endl;
  25.902 -	cout << "    undosAvail="<<undosAvail<<endl;
  25.903 -	cout << "       undoNum="<<undoNum<<endl;
  25.904 -	cout << "    ---------------------------"<<endl;
  25.905 -	cout << "    undoCom="<<undoCommand<<endl;
  25.906 -	cout << "    undoSel="<<undoSelection<<endl;
  25.907 -	cout << "    ---------------------------"<<endl;
  25.908 -	cout << "    redoCom="<<redoCommand<<endl;
  25.909 -	cout << "    redoSel="<<redoSelection<<endl;
  25.910 -	cout << "    ---------------------------"<<endl;
  25.911 +
  25.912 +	parseAtom (redoCommand);
  25.913 +	mapCenter->reposition();
  25.914 +
  25.915 +	blockSaveState=false;
  25.916 +
  25.917 +	undoSet.setEntry ("/history/undosAvail",QString::number(undosAvail));
  25.918 +	undoSet.setEntry ("/history/redosAvail",QString::number(redosAvail));
  25.919 +	undoSet.setEntry ("/history/curStep",QString::number(curStep));
  25.920 +	undoSet.writeSettings(histPath);
  25.921 +
  25.922 +	updateActions();
  25.923 +
  25.924 +	/* TODO remove testing
  25.925  */
  25.926 -	parseAtom (undoCommand);
  25.927 -	mapCenter->reposition();
  25.928 -
  25.929 -	//if (!redoSelection.isEmpty())
  25.930 -	//	select (redoSelection);
  25.931 -
  25.932 -	undosAvail--;
  25.933 -	if (undosAvail<1)
  25.934 -		// Undo not longer available now
  25.935 -		actionEditUndo->setEnabled (false);
  25.936 -	else	
  25.937 -		undoNum--; if (undoNum<1) undoNum=undosTotal;
  25.938 -
  25.939 -	blockSaveState=false;
  25.940 -/* TODO remove testing
  25.941  	cout << "ME::redo() end\n";
  25.942  	cout << "    undosAvail="<<undosAvail<<endl;
  25.943 -	cout << "       undoNum="<<undoNum<<endl;
  25.944 +	cout << "    redosAvail="<<redosAvail<<endl;
  25.945 +	cout << "       curStep="<<curStep<<endl;
  25.946  	cout << "    ---------------------------"<<endl<<endl;
  25.947 -*/	
  25.948 +
  25.949 +
  25.950  }
  25.951  
  25.952  void MapEditor::undo()
  25.953  {
  25.954 -	// Finish open lineEdits
  25.955 -	if (lineedit) finishedLineEdit();
  25.956 -
  25.957  	blockSaveState=true;
  25.958  	
  25.959 +	// Restore variables
  25.960 +	int curStep=undoSet.readNumEntry (QString("/history/curStep"));
  25.961 +	int undosAvail=undoSet.readNumEntry (QString("/history/undosAvail"));
  25.962 +	int redosAvail=undoSet.readNumEntry (QString("/history/redosAvail"));
  25.963 +	QString undoCommand=  undoSet.readEntry (QString("/history/step-%1/undoCommand").arg(curStep));
  25.964 +	QString undoSelection=undoSet.readEntry (QString("/history/step-%1/undoSelection").arg(curStep));
  25.965 +	QString redoCommand=  undoSet.readEntry (QString("/history/step-%1/redoCommand").arg(curStep));
  25.966 +	QString redoSelection=undoSet.readEntry (QString("/history/step-%1/redoSelection").arg(curStep));
  25.967 +	QString comment=undoSet.readEntry (QString("/history/step-%1/comment").arg(curStep));
  25.968 +
  25.969  	// Find out current undo directory
  25.970 -	QString bakMapDir=QDir::convertSeparators (QString(tmpMapDir+"/undo-%1").arg(undoNum));
  25.971 -
  25.972 -	// Restore variables
  25.973 -	QString undoCommand;
  25.974 -	QString undoSelection;
  25.975 -	QString redoCommand;
  25.976 -	QString redoSelection;
  25.977 -	SimpleSettings set;
  25.978 -	set.readSettings(QString(bakMapDir+"/commands"));
  25.979 -	undoCommand=  set.readEntry ("undoCommand");
  25.980 -	undoSelection=set.readEntry ("undoSelection");
  25.981 -	redoCommand=  set.readEntry ("redoCommand");
  25.982 -	redoSelection=set.readEntry ("redoSelection");
  25.983 +	QString bakMapDir=QDir::convertSeparators (QString(tmpMapDir+"/undo-%1").arg(curStep));
  25.984  
  25.985  	// select  object before undo
  25.986  	if (!undoSelection.isEmpty())
  25.987  		select (undoSelection);
  25.988  
  25.989  /* TODO testing
  25.990 +*/	
  25.991  	cout << "ME::undo() begin\n";
  25.992 -	cout << "    undosTotal="<<undosTotal<<endl;
  25.993  	cout << "    undosAvail="<<undosAvail<<endl;
  25.994 -	cout << "       undoNum="<<undoNum<<endl;
  25.995 +	cout << "    redosAvail="<<redosAvail<<endl;
  25.996 +	cout << "       curStep="<<curStep<<endl;
  25.997  	cout << "    ---------------------------"<<endl;
  25.998 -	cout << "    undoCom="<<undoCommand<<endl;
  25.999 -	cout << "    undoSel="<<undoSelection<<endl;
 25.1000 -	cout << "    ---------------------------"<<endl;
 25.1001 -	cout << "    redoCom="<<redoCommand<<endl;
 25.1002 -	cout << "    redoSel="<<redoSelection<<endl;
 25.1003 -	cout << "    ---------------------------"<<endl;
 25.1004 -*/	
 25.1005 +	cout << "    comment="<<comment.toStdString()<<endl;
 25.1006 +	cout << "    undoCom="<<undoCommand.toStdString()<<endl;
 25.1007 +	cout << "    undoSel="<<undoSelection.toStdString()<<endl;
 25.1008 +	cout << "    redoCom="<<redoCommand.toStdString()<<endl;
 25.1009 +	cout << "    redoSel="<<redoSelection.toStdString()<<endl;
 25.1010 +	cout << "    ---------------------------"<<endl<<endl;
 25.1011  	parseAtom (undoCommand);
 25.1012  	mapCenter->reposition();
 25.1013  
 25.1014 -	//if (!redoSelection.isEmpty())
 25.1015 -	//	select (redoSelection);
 25.1016 -
 25.1017  	undosAvail--;
 25.1018 -	if (undosAvail<1)
 25.1019 -		// Undo not longer available now
 25.1020 -		actionEditUndo->setEnabled (false);
 25.1021 -	else	
 25.1022 -		undoNum--; if (undoNum<1) undoNum=undosTotal;
 25.1023 +	curStep--; 
 25.1024 +	if (curStep<1) curStep=undosTotal;
 25.1025 +
 25.1026 +	redosAvail++;
 25.1027  
 25.1028  	blockSaveState=false;
 25.1029  /* TODO remove testing
 25.1030 +*/
 25.1031  	cout << "ME::undo() end\n";
 25.1032  	cout << "    undosAvail="<<undosAvail<<endl;
 25.1033 -	cout << "       undoNum="<<undoNum<<endl;
 25.1034 +	cout << "    redosAvail="<<redosAvail<<endl;
 25.1035 +	cout << "       curStep="<<curStep<<endl;
 25.1036  	cout << "    ---------------------------"<<endl<<endl;
 25.1037 -*/
 25.1038 +
 25.1039 +	undoSet.setEntry ("/history/undosAvail",QString::number(undosAvail));
 25.1040 +	undoSet.setEntry ("/history/redosAvail",QString::number(redosAvail));
 25.1041 +	undoSet.setEntry ("/history/curStep",QString::number(curStep));
 25.1042 +	undoSet.writeSettings(histPath);
 25.1043 +
 25.1044 +	updateActions();
 25.1045  }
 25.1046  
 25.1047  void MapEditor::undoXML(const QString &undoSel, const QString &bakMapPath)
 25.1048 @@ -1383,9 +1465,6 @@
 25.1049  
 25.1050  void MapEditor::pasteNoSave()
 25.1051  {
 25.1052 -	// Finish open lineEdits
 25.1053 -	if (lineedit) finishedLineEdit();
 25.1054 -
 25.1055  	load (clipboardDir+"/part.xml",ImportAdd);
 25.1056  }
 25.1057  
 25.1058 @@ -1400,7 +1479,7 @@
 25.1059  	if (selection && (typeid(*selection) == typeid(BranchObj) ||
 25.1060  				      typeid(*selection) == typeid(MapCenterObj))) 
 25.1061  	{
 25.1062 -		saveState(selection,QString("Paste to %1").arg( getName(selection)));
 25.1063 +		saveStatePart(selection,QString("Paste to %1").arg( getName(selection)));
 25.1064  		pasteNoSave();
 25.1065  		mapCenter->reposition();
 25.1066  		adjustCanvasSize();
 25.1067 @@ -1409,7 +1488,7 @@
 25.1068  
 25.1069  void MapEditor::cut()
 25.1070  {
 25.1071 -	saveState(selection->getParObj(),QString("Cut %1").arg(getName(selection)));
 25.1072 +	saveStatePart(selection->getParObj(),QString("Cut %1").arg(getName(selection)));
 25.1073  	copy();
 25.1074  	cutNoSave();
 25.1075  	mapCenter->reposition();
 25.1076 @@ -1418,17 +1497,39 @@
 25.1077  
 25.1078  void MapEditor::move(const int &x, const int &y)
 25.1079  {
 25.1080 -	// TODO no saveState, because this is only internal at undo so far
 25.1081 -	if (selection) selection->move(x,y);
 25.1082 -	if (typeid(*selection) == typeid(FloatImageObj))
 25.1083 -		((FloatImageObj*)selection)->setRelPos();
 25.1084 +	if (selection)
 25.1085 +	{
 25.1086 +		QString ps=qpointToString (selection->getAbsPos());
 25.1087 +		QString s=selection->getSelectString();
 25.1088 +		saveState(
 25.1089 +			s, "move "+ps, 
 25.1090 +			s, "move "+qpointToString (QPoint (x,y)), 
 25.1091 +			QString("Move %1 to  %2").arg(getName(selection)).arg(ps));
 25.1092 +		selection->move(x,y);
 25.1093 +		mapCenter->reposition();
 25.1094 +		adjustCanvasSize();
 25.1095 +	}
 25.1096 +
 25.1097 +}
 25.1098 +
 25.1099 +void MapEditor::moveRel (const int &x, const int &y)
 25.1100 +{
 25.1101 +	if (selection)
 25.1102 +	{
 25.1103 +		QString ps=qpointToString (selection->getRelPos());
 25.1104 +		QString s=selection->getSelectString();
 25.1105 +		saveState(
 25.1106 +			s, "moveRel "+ps, 
 25.1107 +			s, "moveRel "+qpointToString (QPoint (x,y)), 
 25.1108 +			QString("Move %1 to relativ position %2").arg(getName(selection)).arg(ps));
 25.1109 +		selection->setRelPos (QPoint(x,y));
 25.1110 +		mapCenter->reposition();
 25.1111 +		adjustCanvasSize();
 25.1112 +	}
 25.1113  }
 25.1114  
 25.1115  void MapEditor::moveBranchUp()
 25.1116  {
 25.1117 -	// Finish open lineEdits
 25.1118 -	if (lineedit) finishedLineEdit();
 25.1119 -
 25.1120  	BranchObj* bo;
 25.1121  	BranchObj* par;
 25.1122  	if (typeid(*selection) == typeid(BranchObj)  ) 
 25.1123 @@ -1437,9 +1538,9 @@
 25.1124  		if (!bo->canMoveBranchUp()) return;
 25.1125  		par=(BranchObj*)(bo->getParObj());
 25.1126  		selection->unselect();
 25.1127 -		selection=par->moveBranchUp (bo);
 25.1128 +		bo=par->moveBranchUp (bo);	// bo will be the one below selection
 25.1129  		selection->select();
 25.1130 -		saveState("moveBranchDown ()",bo,QString("Move up %1").arg(getName(bo)));
 25.1131 +		saveState (selection,"moveBranchDown ()",bo,"moveBranchUp ()",QString("Move up %1").arg(getName(bo)));
 25.1132  		mapCenter->reposition();
 25.1133  		ensureSelectionVisible();
 25.1134  	}
 25.1135 @@ -1447,9 +1548,6 @@
 25.1136  
 25.1137  void MapEditor::moveBranchDown()
 25.1138  {
 25.1139 -	// Finish open lineEdits
 25.1140 -	if (lineedit) finishedLineEdit();
 25.1141 -
 25.1142  	BranchObj* bo;
 25.1143  	BranchObj* par;
 25.1144  	if (typeid(*selection) == typeid(BranchObj)  ) 
 25.1145 @@ -1458,54 +1556,51 @@
 25.1146  		if (!bo->canMoveBranchDown()) return;
 25.1147  		par=(BranchObj*)(bo->getParObj());
 25.1148  		selection->unselect(); 
 25.1149 -		selection=par->moveBranchDown(bo);
 25.1150 +		bo=par->moveBranchDown(bo);	// bo will be the one above selection
 25.1151  		selection->select();
 25.1152 -		saveState("moveBranchUp ()",bo,QString("Move down %1").arg(getName(bo)));
 25.1153 +		saveState(selection,"moveBranchUp ()",bo,"moveBranchDown ()",QString("Move down %1").arg(getName(bo)));
 25.1154  		mapCenter->reposition();
 25.1155  		ensureSelectionVisible();
 25.1156  	}	
 25.1157  }
 25.1158  
 25.1159 -void MapEditor::editHeading()
 25.1160 +QString MapEditor::getHeading(bool &ok, QPoint &p)
 25.1161  {
 25.1162 -	// Finish open lineEdits
 25.1163 -	if (lineedit) finishedLineEdit();
 25.1164 -
 25.1165 +	if (selection  &&  
 25.1166 +		 (typeid(*selection) == typeid(BranchObj) || 
 25.1167 +		  typeid(*selection) == typeid(MapCenterObj) ) ) 
 25.1168 +	{
 25.1169 +		ok=true;
 25.1170 +		ensureSelectionVisible();
 25.1171 +		p = ((BranchObj*)selection)->getAbsPos();
 25.1172 +		p.setX (p.x() - contentsX());
 25.1173 +		p.setY (p.y() - contentsY() + ((BranchObj*)selection)->height()/2);
 25.1174 +		return ((BranchObj*)selection)->getHeading();
 25.1175 +	}
 25.1176 +	ok=false;
 25.1177 +	return QString();
 25.1178 +}
 25.1179 +
 25.1180 +void MapEditor::setHeading(const QString &s)
 25.1181 +{
 25.1182  	if (selection  &&  
 25.1183  		 (typeid(*selection) == typeid(BranchObj) || 
 25.1184  		  typeid(*selection) == typeid(MapCenterObj) ) ) 
 25.1185  	{
 25.1186  		editingBO=(BranchObj*)selection;
 25.1187 -
 25.1188 -		ensureSelectionVisible();
 25.1189 -		QPoint p = worldMatrix().map(QPoint (editingBO->x(),editingBO->y()));
 25.1190 -		lineedit->setGeometry(p.x()-contentsX(),p.y()-contentsY(),200,25);
 25.1191 -		QString s=editingBO->getHeading();
 25.1192 -		lineedit->setText(s);
 25.1193 -		lineedit->setCursorPosition(1);
 25.1194 -		if (actionSettingsAutoselectText->isOn() && !s.isEmpty() && actionSettingsPasteNewHeading->isOn() )
 25.1195 -			lineedit->selectAll();
 25.1196 -		lineedit->show();
 25.1197 -		lineedit->grabKeyboard();
 25.1198 -		lineedit->setFocus();
 25.1199 -	}				
 25.1200 -}
 25.1201 -
 25.1202 -void MapEditor::setHeading(const QString &s)
 25.1203 -{
 25.1204 -	// Internal function, no saveState needed
 25.1205 -	if (selection  &&  
 25.1206 -		 (typeid(*selection) == typeid(BranchObj) || 
 25.1207 -		  typeid(*selection) == typeid(MapCenterObj) ) ) 
 25.1208 -	{
 25.1209 -		((BranchObj*)selection)->setHeading(s);
 25.1210 +		saveStateConstSelection(
 25.1211 +			"setHeading (\""+editingBO->getHeading()+"\")", 
 25.1212 +			"setHeading (\""+s+"\")", 
 25.1213 +			QString("Set heading of %1 to \"%2\"").arg(getName(editingBO)).arg(s) );
 25.1214 +		editingBO->setHeading(s );
 25.1215 +		editingBO=NULL;
 25.1216  		mapCenter->reposition();
 25.1217  		adjustCanvasSize();
 25.1218  		ensureSelectionVisible();
 25.1219  	}
 25.1220  }
 25.1221  
 25.1222 -void MapEditor::setURL (const QString &s)
 25.1223 +void MapEditor::setURLInt (const QString &s)
 25.1224  {
 25.1225  	// Internal function, no saveState needed
 25.1226  	if (selection  &&  
 25.1227 @@ -1519,7 +1614,20 @@
 25.1228  	}
 25.1229  }
 25.1230  
 25.1231 -void MapEditor::setVymLink (const QString &s)
 25.1232 +void MapEditor::setHeadingInt(const QString &s)
 25.1233 +{
 25.1234 +	if (selection  &&  
 25.1235 +		 (typeid(*selection) == typeid(BranchObj) || 
 25.1236 +		  typeid(*selection) == typeid(MapCenterObj) ) ) 
 25.1237 +	{
 25.1238 +		((BranchObj*)selection)->setHeading(s);
 25.1239 +		mapCenter->reposition();
 25.1240 +		adjustCanvasSize();
 25.1241 +		ensureSelectionVisible();
 25.1242 +	}
 25.1243 +}
 25.1244 +
 25.1245 +void MapEditor::setVymLinkInt (const QString &s)
 25.1246  {
 25.1247  	// Internal function, no saveState needed
 25.1248  	if (selection  &&  
 25.1249 @@ -1533,44 +1641,107 @@
 25.1250  	}
 25.1251  }
 25.1252  
 25.1253 -void MapEditor::addNewBranch(int pos)
 25.1254 +BranchObj* MapEditor::addNewBranchInt(int num)
 25.1255  {
 25.1256 -	// Finish open lineEdits
 25.1257 -	if (lineedit) finishedLineEdit();
 25.1258 -
 25.1259 +	// Depending on pos:
 25.1260 +	// -3		insert in childs of parent  above selection 
 25.1261 +	// -2		add branch to selection 
 25.1262 +	// -1		insert in childs of parent below selection 
 25.1263 +	// 0..n		insert in childs of parent at pos
 25.1264 +	BranchObj *newbo=NULL;
 25.1265  	if (selection  &&  
 25.1266  		 (typeid(*selection) == typeid(BranchObj) || 
 25.1267  		  typeid(*selection) == typeid(MapCenterObj) ) ) 
 25.1268  	{
 25.1269 -		BranchObj* bo1 = (BranchObj*) selection;
 25.1270 -		saveState(selection, QString("Add new branch to %1").arg(getName(bo1)));	//TODO undoCommand
 25.1271 -
 25.1272 -		bool wasScrolled=false;
 25.1273 -		BranchObj *newbo=NULL;
 25.1274 -		if (pos==0)
 25.1275 +		BranchObj* bo = (BranchObj*) selection;
 25.1276 +		if (num==-2)
 25.1277  		{
 25.1278  			// save scroll state. If scrolled, automatically select
 25.1279  			// new branch in order to tmp unscroll parent...
 25.1280 -			wasScrolled=bo1->isScrolled();
 25.1281 -			newbo=bo1->addBranch();
 25.1282 -		}	else 
 25.1283 +			return bo->addBranch();
 25.1284 +			
 25.1285 +		}else if (num==-1)
 25.1286  		{
 25.1287 -			BranchObj *parbo=(BranchObj*)(selection->getParObj());
 25.1288 -			if (parbo)
 25.1289 +			num=bo->getNum()+1;
 25.1290 +			bo=(BranchObj*)bo->getParObj();
 25.1291 +		}else if (num==-3)
 25.1292 +		{
 25.1293 +			num=bo->getNum();
 25.1294 +			bo=(BranchObj*)bo->getParObj();
 25.1295 +		}
 25.1296 +		if (!bo) return bo;
 25.1297 +		newbo=bo->insertBranch(num);
 25.1298 +	}	
 25.1299 +	return newbo;
 25.1300 +}	
 25.1301 +
 25.1302 +void MapEditor::addNewBranch(int pos)
 25.1303 +{
 25.1304 +	// Different meaning than num in addNewBranchInt!
 25.1305 +	// -1	add above
 25.1306 +	//  0	add as child
 25.1307 +	// +1	add below
 25.1308 +	if (selection  &&  
 25.1309 +		 (typeid(*selection) == typeid(BranchObj) || 
 25.1310 +		  typeid(*selection) == typeid(MapCenterObj) ) ) 
 25.1311 +	{
 25.1312 +		BranchObj *bo = (BranchObj*) selection;
 25.1313 +		BranchObj *newbo;
 25.1314 +		newbo=addNewBranchInt (pos-2);
 25.1315 +
 25.1316 +		if (newbo)
 25.1317 +		{
 25.1318 +			saveStateConstSelection (
 25.1319 +				QString ("delete (\"%1\")").arg(newbo->getSelectString()),
 25.1320 +				QString ("addBranch (%1)").arg(pos-2),
 25.1321 +				QString ("Add new branch to %1").arg(getName(bo)));	//TODO undoCommand
 25.1322 +
 25.1323 +			LinkableMapObj *oldselection=selection;
 25.1324 +
 25.1325 +			mapCenter->reposition();
 25.1326 +			adjustCanvasSize();
 25.1327 +
 25.1328 +
 25.1329 +			if (actionSettingsAutoedit->isOn() ||
 25.1330 +				actionSettingsAutoselectHeading->isOn() )
 25.1331  			{
 25.1332 -				if (pos<0)
 25.1333 -					// add above selection
 25.1334 -					newbo=parbo->insertBranch(bo1->getNum());
 25.1335 -				else
 25.1336 -					// add below selection
 25.1337 -					newbo=parbo->insertBranch(bo1->getNum()+1);
 25.1338 -			} else
 25.1339 -				// This should not happen...
 25.1340 -				return;
 25.1341 -			
 25.1342 -		}	
 25.1343 +				selection->unselect();
 25.1344 +				selection=newbo;
 25.1345 +				selection->select();
 25.1346 +				if (actionSettingsAutoedit->isOn() )
 25.1347 +					mainWindow->editHeading();
 25.1348 +				if (!actionSettingsAutoselectHeading->isOn()
 25.1349 +					)//&& !wasScrolled)  //FIXME wasScrolled was moved to addNewBranchInt
 25.1350 +				{
 25.1351 +					selection->unselect();
 25.1352 +					selection=oldselection;
 25.1353 +					selection->select();
 25.1354 +				}
 25.1355 +			}	
 25.1356 +		}
 25.1357 +	}	
 25.1358 +}
 25.1359 +
 25.1360 +
 25.1361 +void MapEditor::addNewBranchHere()
 25.1362 +{
 25.1363 +	if (selection  &&  
 25.1364 +		 (typeid(*selection) == typeid(BranchObj) ) )
 25.1365 +	{
 25.1366 +		BranchObj* bo1 = (BranchObj*) selection;
 25.1367 +		saveStatePart(selection, QString("Add new branch here").arg(getName(bo1)));
 25.1368 +
 25.1369 +		bool wasScrolled=false;
 25.1370 +		BranchObj *newbo=NULL;
 25.1371 +		BranchObj *parbo=(BranchObj*)(selection->getParObj());
 25.1372 +		if (parbo)
 25.1373 +		{
 25.1374 +			// add below selection
 25.1375 +			newbo=parbo->insertBranch(bo1->getNum()+1);
 25.1376 +		} 
 25.1377  
 25.1378  		LinkableMapObj *oldselection=selection;
 25.1379 +		((BranchObj*)selection)->moveBranchTo (newbo,-1);
 25.1380  
 25.1381  		mapCenter->reposition();
 25.1382  		adjustCanvasSize();
 25.1383 @@ -1580,13 +1751,8 @@
 25.1384  			selection->unselect();
 25.1385  			selection=newbo;
 25.1386  			selection->select();
 25.1387 -			if (actionSettingsPasteNewHeading->isOn() )
 25.1388 -			{
 25.1389 -				BranchObj *bo2= (BranchObj*)selection;
 25.1390 -				bo2->setHeading("");
 25.1391 -			}	
 25.1392  			if (actionSettingsAutoedit->isOn() )
 25.1393 -				editHeading();
 25.1394 +				mainWindow->editHeading();
 25.1395  			if (!actionSettingsAutoselectHeading->isOn()
 25.1396  				&& !wasScrolled)
 25.1397  			{
 25.1398 @@ -1598,74 +1764,22 @@
 25.1399  	}	
 25.1400  }
 25.1401  
 25.1402 -
 25.1403 -void MapEditor::addNewBranchHere()
 25.1404 -{
 25.1405 -	// Finish open lineEdits
 25.1406 -	if (lineedit) finishedLineEdit();
 25.1407 -
 25.1408 -	if (selection  &&  
 25.1409 -		 (typeid(*selection) == typeid(BranchObj) ) )
 25.1410 -	{
 25.1411 -		BranchObj* bo1 = (BranchObj*) selection;
 25.1412 -		saveState(selection, QString("Add new branch here").arg(getName(bo1)));
 25.1413 -
 25.1414 -		bool wasScrolled=false;
 25.1415 -		BranchObj *newbo=NULL;
 25.1416 -		BranchObj *parbo=(BranchObj*)(selection->getParObj());
 25.1417 -		if (parbo)
 25.1418 -		{
 25.1419 -			// add below selection
 25.1420 -			newbo=parbo->insertBranch(bo1->getNum()+1);
 25.1421 -		} 
 25.1422 -
 25.1423 -		LinkableMapObj *oldselection=selection;
 25.1424 -		((BranchObj*)selection)->moveBranchTo (newbo,-1);
 25.1425 -
 25.1426 -		mapCenter->reposition();
 25.1427 -		adjustCanvasSize();
 25.1428 -		if (actionSettingsAutoedit->isOn() ||
 25.1429 -			actionSettingsAutoselectHeading->isOn() )
 25.1430 -		{
 25.1431 -			selection->unselect();
 25.1432 -			selection=newbo;
 25.1433 -			selection->select();
 25.1434 -			if (actionSettingsPasteNewHeading->isOn() )
 25.1435 -			{
 25.1436 -				BranchObj *bo2= (BranchObj*)selection;
 25.1437 -				bo2->setHeading("");
 25.1438 -			}	
 25.1439 -			if (actionSettingsAutoedit->isOn() )
 25.1440 -				editHeading();
 25.1441 -			if (!actionSettingsAutoselectHeading->isOn()
 25.1442 -				&& !wasScrolled)
 25.1443 -			{
 25.1444 -				selection->unselect();
 25.1445 -				selection=oldselection;
 25.1446 -				selection->select();
 25.1447 -			}
 25.1448 -		}	
 25.1449 -	}	
 25.1450 -}
 25.1451 -
 25.1452  void MapEditor::deleteSelection()
 25.1453  {
 25.1454 -	// Finish open lineEdits
 25.1455 -	if (lineedit) finishedLineEdit();
 25.1456 -
 25.1457  	if (selection  && typeid(*selection) ==typeid(BranchObj) ) 
 25.1458  	{
 25.1459 -		BranchObj* bo=dynamic_cast <BranchObj*> (selection);
 25.1460 +		BranchObj* bo=(BranchObj*)selection;
 25.1461  		BranchObj* par=(BranchObj*)(bo->getParObj());
 25.1462  		bo->unselect();
 25.1463  		if (selection->getDepth()>1)
 25.1464  			// Normal branch, save parent with childs
 25.1465 -			saveState(par,QString("Delete %1").arg(getName(bo)));
 25.1466 +			saveStatePart(par,QString("Delete %1").arg(getName(bo)));
 25.1467 +		//	naveState (UndoCom, par, QString("insertBranchAt (%1)", bo, "", QString ("Delete %1").arg(getName(bo))));
 25.1468  		else
 25.1469  			// Mainbranch, save whole map
 25.1470  			// TODO Better would be to insert mainbranch again at pos
 25.1471  			// But undoCommand is missing right now
 25.1472 -			saveState(QString("Delete %1").arg(getName(bo)));
 25.1473 +			saveStateComplete(QString("Delete %1").arg(getName(bo)));
 25.1474  		selection=NULL;
 25.1475  		par->removeBranch(bo);
 25.1476  		selection=par;
 25.1477 @@ -1676,9 +1790,9 @@
 25.1478  	}
 25.1479  	if (selection  && typeid(*selection) ==typeid(FloatImageObj) ) 
 25.1480  	{
 25.1481 -		FloatImageObj* fio=dynamic_cast <FloatImageObj*> (selection);
 25.1482 +		FloatImageObj* fio=(FloatImageObj*)selection;
 25.1483  		BranchObj* par=(BranchObj*)(fio->getParObj());
 25.1484 -		saveState(par, QString("Delete %1").arg(getName(fio)));
 25.1485 +		saveStatePart(par, QString("Delete %1").arg(getName(fio)));
 25.1486  		fio->unselect();
 25.1487  		selection=NULL;
 25.1488  		par->removeFloatImage(fio);
 25.1489 @@ -1732,7 +1846,13 @@
 25.1490  	return false;
 25.1491  }
 25.1492  
 25.1493 -void MapEditor::select (LinkableMapObj *lmo)
 25.1494 +QString MapEditor::getSelectString()
 25.1495 +{
 25.1496 +	if (selection) return selection->getSelectString();
 25.1497 +	return QString();
 25.1498 +}
 25.1499 +
 25.1500 +void MapEditor::selectInt (LinkableMapObj *lmo)
 25.1501  {
 25.1502  	if (lmo && selection != lmo)
 25.1503  	{
 25.1504 @@ -1743,10 +1863,9 @@
 25.1505  			
 25.1506  		adjustCanvasSize();
 25.1507  	}
 25.1508 -
 25.1509  }
 25.1510  
 25.1511 -void MapEditor::selectNextBranch()
 25.1512 +void MapEditor::selectNextBranchInt()
 25.1513  {
 25.1514  	// Increase number of branch
 25.1515  	if (selection)
 25.1516 @@ -1826,7 +1945,7 @@
 25.1517  	}	
 25.1518  }
 25.1519  
 25.1520 -void MapEditor::selectPrevBranch()
 25.1521 +void MapEditor::selectPrevBranchInt()
 25.1522  {
 25.1523  	// Decrease number of branch
 25.1524  	if (selection)
 25.1525 @@ -1907,40 +2026,34 @@
 25.1526  
 25.1527  void MapEditor::selectUpperBranch()
 25.1528  {
 25.1529 -	// Finish open lineEdits
 25.1530 -	if (lineedit) finishedLineEdit();
 25.1531 -
 25.1532  	if (selection) 
 25.1533  	{
 25.1534  		if (typeid(*selection) == typeid(BranchObj))
 25.1535  		{
 25.1536  			if (selection->getOrientation()==OrientRightOfCenter)
 25.1537 -				selectPrevBranch();
 25.1538 +				selectPrevBranchInt();
 25.1539  			else
 25.1540  				if (selection->getDepth()==1)
 25.1541 -					selectNextBranch();
 25.1542 +					selectNextBranchInt();
 25.1543  				else
 25.1544 -					selectPrevBranch();
 25.1545 +					selectPrevBranchInt();
 25.1546  		}		
 25.1547  	}
 25.1548  }
 25.1549  
 25.1550  void MapEditor::selectLowerBranch()
 25.1551  {
 25.1552 -	// Finish open lineEdits
 25.1553 -	if (lineedit) finishedLineEdit();
 25.1554 -
 25.1555  	if (selection) 
 25.1556  	{
 25.1557  		if (typeid(*selection) == typeid(BranchObj))
 25.1558  		{
 25.1559  			if (selection->getOrientation()==OrientRightOfCenter)
 25.1560 -				selectNextBranch();
 25.1561 +				selectNextBranchInt();
 25.1562  			else
 25.1563  				if (selection->getDepth()==1)
 25.1564 -					selectPrevBranch();
 25.1565 +					selectPrevBranchInt();
 25.1566  				else
 25.1567 -					selectNextBranch();
 25.1568 +					selectNextBranchInt();
 25.1569  		}		
 25.1570  	}
 25.1571  }
 25.1572 @@ -1948,9 +2061,6 @@
 25.1573  
 25.1574  void MapEditor::selectLeftBranch()
 25.1575  {
 25.1576 -	// Finish open lineEdits
 25.1577 -	if (lineedit) finishedLineEdit();
 25.1578 -
 25.1579  	BranchObj* bo;
 25.1580  	BranchObj* par;
 25.1581  	if (selection) 
 25.1582 @@ -2010,9 +2120,6 @@
 25.1583  
 25.1584  void MapEditor::selectRightBranch()
 25.1585  {
 25.1586 -	// Finish open lineEdits
 25.1587 -	if (lineedit) finishedLineEdit();
 25.1588 -
 25.1589  	BranchObj* bo;
 25.1590  	BranchObj* par;
 25.1591  
 25.1592 @@ -2024,7 +2131,7 @@
 25.1593  			bo=par->getLastSelectedBranch();
 25.1594  			if (bo)
 25.1595  			{
 25.1596 -				// Workaround for relecting on left and right side
 25.1597 +				// Workaround for reselecting on left and right side
 25.1598  				if (bo->getOrientation()==OrientLeftOfCenter)
 25.1599  					bo=par->getFirstBranch();
 25.1600  				if (bo)
 25.1601 @@ -2070,9 +2177,6 @@
 25.1602  
 25.1603  void MapEditor::selectFirstBranch()
 25.1604  {
 25.1605 -	// Finish open lineEdits
 25.1606 -	if (lineedit) finishedLineEdit();
 25.1607 -
 25.1608  	BranchObj *bo1;
 25.1609  	BranchObj *bo2;
 25.1610  	BranchObj* par;
 25.1611 @@ -2095,9 +2199,6 @@
 25.1612  
 25.1613  void MapEditor::selectLastBranch()
 25.1614  {
 25.1615 -	// Finish open lineEdits
 25.1616 -	if (lineedit) finishedLineEdit();
 25.1617 -
 25.1618  	BranchObj *bo1;
 25.1619  	BranchObj *bo2;
 25.1620  	BranchObj* par;
 25.1621 @@ -2125,13 +2226,11 @@
 25.1622  
 25.1623  void MapEditor::selectBackgroundColor()
 25.1624  {
 25.1625 -	// Finish open lineEdits
 25.1626 -	if (lineedit) finishedLineEdit();
 25.1627 -
 25.1628  	QColor col = QColorDialog::getColor( mapCanvas->backgroundColor(), this );
 25.1629  	if ( !col.isValid() ) return;
 25.1630  	setBackgroundColor( col );
 25.1631 -	saveState(QString("Set background color of map to %1").arg(col.name()));
 25.1632 +	//TODO undocomm
 25.1633 +	saveStateComplete(QString("Set background color of map to %1").arg(col.name()));
 25.1634  }
 25.1635  
 25.1636  void MapEditor::setBackgroundColor(QColor c)
 25.1637 @@ -2161,7 +2260,7 @@
 25.1638  			typeid(*selection) == typeid(MapCenterObj))
 25.1639  		{
 25.1640  			BranchObj *bo=(BranchObj*)selection;
 25.1641 -			saveState(selection, QString("Set color of %1 to %2").arg(getName(bo)).arg(actColor.name()));	//TODO undoCommand
 25.1642 +			saveStatePart(selection, QString("Set color of %1 to %2").arg(getName(bo)).arg(actColor.name()));	//TODO undoCommand
 25.1643  			bo->setColor(actColor); // color branch
 25.1644  		}    
 25.1645  	}
 25.1646 @@ -2175,7 +2274,7 @@
 25.1647  			typeid(*selection) == typeid(MapCenterObj))
 25.1648  		{
 25.1649  			BranchObj *bo=(BranchObj*)selection;
 25.1650 -			saveState(selection, QString ("Set color of %1 and childs to %2").arg(getName(bo)).arg(actColor.name()));	//TODO undoCommand
 25.1651 +			saveStatePart(selection, QString ("Set color of %1 and childs to %2").arg(getName(bo)).arg(actColor.name()));	//TODO undoCommand
 25.1652  			bo->setColorChilds(actColor); // color links, color childs
 25.1653  		}    
 25.1654  	}
 25.1655 @@ -2186,15 +2285,27 @@
 25.1656  {
 25.1657  	if (selection)
 25.1658  	{
 25.1659 -		BranchObj *bo=(BranchObj*)selection;
 25.1660 -		QString s;
 25.1661 -		if (bo->isSetStandardFlag(f))
 25.1662 -			s="Unset";
 25.1663 -		else
 25.1664 -			s="Set";
 25.1665 -		saveState(selection, QString("%1 standard flag \"%2\" of %3").arg(s).arg(f).arg(getName(bo)));// TODO undoCommand	
 25.1666 -		bo->toggleStandardFlag (f,actionSettingsUseFlagGroups->isOn());
 25.1667 -		adjustCanvasSize();
 25.1668 +		if (typeid(*selection) == typeid(BranchObj) ||
 25.1669 +			typeid(*selection) == typeid(MapCenterObj))
 25.1670 +		{
 25.1671 +			BranchObj *bo=(BranchObj*)selection;
 25.1672 +			QString u,r;
 25.1673 +			if (bo->isSetStandardFlag(f))
 25.1674 +			{
 25.1675 +				r="unsetFlag";
 25.1676 +				u="setFlag";
 25.1677 +			}	
 25.1678 +			else
 25.1679 +			{
 25.1680 +				u="unsetFlag";
 25.1681 +				r="setFlag";
 25.1682 +			}	
 25.1683 +			saveStateConstSelection(QString("%1 (\"%2\")").arg(u).arg(f), 
 25.1684 +				QString("%1 (\"%2\")").arg(r).arg(f),
 25.1685 +				QString("Toggling standard flag \"%1\" of %2").arg(f).arg(getName(bo)));
 25.1686 +			bo->toggleStandardFlag (f,actionSettingsUseFlagGroups->isOn());
 25.1687 +			adjustCanvasSize();
 25.1688 +		}
 25.1689  	}	
 25.1690  }
 25.1691  
 25.1692 @@ -2208,6 +2319,9 @@
 25.1693  
 25.1694  BranchObj* MapEditor::findText (QString s, bool cs)
 25.1695  {
 25.1696 +	QTextDocument::FindFlags flags=0;
 25.1697 +	if (cs) flags=QTextDocument::FindCaseSensitively;
 25.1698 +
 25.1699  	if (!itFind) 
 25.1700  	{	// Nothing found or new find process
 25.1701  		if (EOFind)
 25.1702 @@ -2232,7 +2346,7 @@
 25.1703  					adjustCanvasSize();
 25.1704  					ensureSelectionVisible();
 25.1705  				}
 25.1706 -				if (textEditor->findText(s,cs)) 
 25.1707 +				if (textEditor->findText(s,flags)) 
 25.1708  				{
 25.1709  					searching=false;
 25.1710  					foundNote=true;
 25.1711 @@ -2282,7 +2396,7 @@
 25.1712  		if ( ok) 
 25.1713  		{
 25.1714  			// user entered something and pressed OK
 25.1715 -			saveState("setURL (\""+bo->getURL()+"\")","setURL (\""+text+"\")", QString("Set URL of %1 to %21").arg(getName(bo)).arg(text));	
 25.1716 +			saveStateConstSelection("setURL (\""+bo->getURL()+"\")","setURL (\""+text+"\")", QString("Set URL of %1 to %21").arg(getName(bo)).arg(text));	
 25.1717  			bo->setURL (text);
 25.1718  			updateActions();
 25.1719  		}	
 25.1720 @@ -2298,13 +2412,31 @@
 25.1721  		return "";
 25.1722  }
 25.1723  
 25.1724 +QStringList MapEditor::getURLs()
 25.1725 +{
 25.1726 +	QStringList urls;
 25.1727 +	if (selection && (typeid(*selection) == typeid(BranchObj) ||
 25.1728 +			typeid(*selection) == typeid(MapCenterObj)) )
 25.1729 +	{		
 25.1730 +		BranchObj *bo=(BranchObj*)selection;
 25.1731 +		bo=bo->first();	
 25.1732 +		while (bo) 
 25.1733 +		{
 25.1734 +			if (!bo->getURL().isEmpty()) urls.append( bo->getURL());
 25.1735 +			bo=bo->next();
 25.1736 +		}	
 25.1737 +	}	
 25.1738 +	return urls;
 25.1739 +}
 25.1740 +
 25.1741 +
 25.1742  void MapEditor::editHeading2URL()
 25.1743  {
 25.1744  	if (selection && (typeid(*selection) == typeid(BranchObj) ||
 25.1745  			typeid(*selection) == typeid(MapCenterObj)) )
 25.1746  	{		
 25.1747  		BranchObj *bo=(BranchObj*)selection;
 25.1748 -		saveState("setURL (\""+bo->getURL()+"\")","setURL (\""+bo->getHeading()+"\")",QString("Copy heading of %1 to URL").arg(getName(bo)));	
 25.1749 +		saveStateConstSelection("setURL (\""+bo->getURL()+"\")","setURL (\""+bo->getHeading()+"\")",QString("Copy heading of %1 to URL").arg(getName(bo)));	
 25.1750  		bo->setURL (bo->getHeading());
 25.1751  		updateActions();
 25.1752  	}
 25.1753 @@ -2317,7 +2449,7 @@
 25.1754  	{		
 25.1755  		BranchObj *bo=(BranchObj*)selection;
 25.1756  		QString url= "https://bugzilla.novell.com/show_bug.cgi?id="+bo->getHeading();
 25.1757 -		saveState("setURL (\""+bo->getURL()+"\")","setURL (\""+url+"\")",QString("Use heading of %1 as link to Novell Bugzilla").arg(getName(bo)));	
 25.1758 +		saveStateConstSelection("setURL (\""+bo->getURL()+"\")","setURL (\""+url+"\")",QString("Use heading of %1 as link to Novell Bugzilla").arg(getName(bo)));	
 25.1759  		bo->setURL (url);
 25.1760  		updateActions();
 25.1761  	}
 25.1762 @@ -2330,7 +2462,7 @@
 25.1763  	{		
 25.1764  		BranchObj *bo=(BranchObj*)selection;
 25.1765  		QString url= "http://keeper.suse.de:8080/webfate/match/id?value=ID"+bo->getHeading();
 25.1766 -		saveState("setURL (\""+bo->getURL()+"\")","setURL (\""+url+"\")",QString("Use heading of %1 as link to FATE").arg(getName(bo)));	
 25.1767 +		saveStateConstSelection("setURL (\""+bo->getURL()+"\")","setURL (\""+url+"\")",QString("Use heading of %1 as link to FATE").arg(getName(bo)));	
 25.1768  		bo->setURL (url);
 25.1769  		updateActions();
 25.1770  	}
 25.1771 @@ -2342,7 +2474,7 @@
 25.1772  			typeid(*selection) == typeid(MapCenterObj)) )
 25.1773  	{		
 25.1774  		BranchObj *bo=(BranchObj*)selection;
 25.1775 -		QFileDialog *fd=new QFileDialog( this,__VYM " - " +tr("Link to another map"));
 25.1776 +		Q3FileDialog *fd=new Q3FileDialog( this,__VYM " - " +tr("Link to another map"));
 25.1777  		fd->addFilter (QString (tr("vym map") + " (*.vym)"));
 25.1778  		fd->setCaption(__VYM " - " +tr("Link to another map"));
 25.1779  		if (! bo->getVymLink().isEmpty() )
 25.1780 @@ -2352,7 +2484,7 @@
 25.1781  		QString fn;
 25.1782  		if ( fd->exec() == QDialog::Accepted )
 25.1783  		{
 25.1784 -			saveState("setVymLink (\""+bo->getVymLink()+"\")","setVymLink (\""+fd->selectedFile()+"\")",QString("Set vymlink of %1 to %2").arg(getName(bo)).arg(fd->selectedFile()));	
 25.1785 +			saveStateConstSelection("setVymLink (\""+bo->getVymLink()+"\")","setVymLink (\""+fd->selectedFile()+"\")",QString("Set vymlink of %1 to %2").arg(getName(bo)).arg(fd->selectedFile()));	
 25.1786  			bo->setVymLink (fd->selectedFile() );
 25.1787  			updateActions();
 25.1788  			mapCenter->reposition();
 25.1789 @@ -2368,7 +2500,7 @@
 25.1790  			typeid(*selection) == typeid(MapCenterObj)) )
 25.1791  	{		
 25.1792  		BranchObj *bo=(BranchObj*)selection;
 25.1793 -		saveState("setVymLink (\""+bo->getVymLink()+"\")","setVymLink (\"\")",QString("Unset vymlink of %1").arg(getName(bo)));	
 25.1794 +		saveStateConstSelection("setVymLink (\""+bo->getVymLink()+"\")","setVymLink (\"\")",QString("Unset vymlink of %1").arg(getName(bo)));	
 25.1795  		bo->setVymLink ("" );
 25.1796  		updateActions();
 25.1797  		mapCenter->reposition();
 25.1798 @@ -2396,7 +2528,7 @@
 25.1799  			oo->setHideInExport(true);
 25.1800  			s="Set";
 25.1801  		}	
 25.1802 -		saveState(QString ("%1 hide export flag of %2").arg(s).arg(getName(selection)));	//TODO undoCommand
 25.1803 +		saveStateComplete(QString ("%1 hide export flag of %2").arg(s).arg(getName(selection)));	//TODO undoCommand
 25.1804  		actionEditToggleHideExport->setOn (oo->hideInExport());	
 25.1805  		updateActions();
 25.1806  		mapCenter->reposition();
 25.1807 @@ -2416,6 +2548,24 @@
 25.1808  	
 25.1809  }
 25.1810  
 25.1811 +QStringList MapEditor::getVymLinks()
 25.1812 +{
 25.1813 +	QStringList links;
 25.1814 +	if (selection && (typeid(*selection) == typeid(BranchObj) ||
 25.1815 +			typeid(*selection) == typeid(MapCenterObj)) )
 25.1816 +	{		
 25.1817 +		BranchObj *bo=(BranchObj*)selection;
 25.1818 +		bo=bo->first();	
 25.1819 +		while (bo) 
 25.1820 +		{
 25.1821 +			if (!bo->getVymLink().isEmpty()) links.append( bo->getVymLink());
 25.1822 +			bo=bo->next();
 25.1823 +		}	
 25.1824 +	}	
 25.1825 +	return links;
 25.1826 +}
 25.1827 +
 25.1828 +
 25.1829  void MapEditor::removeBranchKeepChilds()
 25.1830  {
 25.1831  	if (selection && (typeid(*selection) == typeid(BranchObj) ))
 25.1832 @@ -2424,9 +2574,9 @@
 25.1833  		BranchObj* par=(BranchObj*)(bo->getParObj());
 25.1834  		QString s=QString("Remove %1 and keep its childs").arg(getName(bo));
 25.1835  		if (bo->getDepth()==1)
 25.1836 -			saveState(s);
 25.1837 +			saveStateComplete(s);
 25.1838  		else	
 25.1839 -			saveState(selection->getParObj(),s);	// TODO undoCommand
 25.1840 +			saveStatePart(selection->getParObj(),s);	// TODO undoCommand
 25.1841  		QString sel=selection->getSelectString();
 25.1842  		unselect();
 25.1843  		par->removeBranchHere(bo);
 25.1844 @@ -2439,7 +2589,7 @@
 25.1845  {
 25.1846  	if (selection && (typeid(*selection) == typeid(BranchObj) ))
 25.1847  	{		
 25.1848 -		saveState(selection->getParObj(), QString("Remove childs of branch %1").arg(getName(selection)));
 25.1849 +		saveStatePart(selection->getParObj(), QString("Remove childs of branch %1").arg(getName(selection)));
 25.1850  		((BranchObj*)selection)->removeChilds();
 25.1851  		mapCenter->reposition();
 25.1852  	}	
 25.1853 @@ -2455,8 +2605,8 @@
 25.1854  	// Calc some stats
 25.1855  	QString stats;
 25.1856      int i=0;
 25.1857 -    QCanvasItemList l=canvas()->allItems();
 25.1858 -    for (QCanvasItemList::Iterator it=l.begin(); it!=l.end(); ++it) 
 25.1859 +    Q3CanvasItemList l=canvas()->allItems();
 25.1860 +    for (Q3CanvasItemList::Iterator it=l.begin(); it!=l.end(); ++it) 
 25.1861          i++;
 25.1862      stats+=QString ("%1 items on canvas\n").arg (i,6);
 25.1863  
 25.1864 @@ -2483,7 +2633,7 @@
 25.1865  	// Finally show dialog
 25.1866  	if (dia.exec() == QDialog::Accepted)
 25.1867  	{
 25.1868 -		saveState("Edit info about map");	//TODO undoCommand
 25.1869 +		saveStateComplete("Edit info about map");	//TODO undoCommand
 25.1870  		mapCenter->setAuthor (dia.getAuthor() );
 25.1871  		mapCenter->setComment (dia.getComment() );
 25.1872  	}
 25.1873 @@ -2521,8 +2671,16 @@
 25.1874      pix.fill( defLinkColor );
 25.1875      actionFormatLinkColor->setIconSet( pix );
 25.1876  
 25.1877 -	actionEditUndo->setEnabled( mapChanged );
 25.1878  	actionFileSave->setEnabled( mapUnsaved );
 25.1879 +	if (undoSet.readNumEntry("/history/undosAvail",0)>0)
 25.1880 +		actionEditUndo->setEnabled( true);
 25.1881 +	else	
 25.1882 +		actionEditUndo->setEnabled( false);
 25.1883 +
 25.1884 +	if (undoSet.readNumEntry("/history/redosAvail",0)>0)
 25.1885 +		actionEditRedo->setEnabled( true);
 25.1886 +	else	
 25.1887 +		actionEditRedo->setEnabled( false);
 25.1888  
 25.1889  	if (selection)
 25.1890  	{
 25.1891 @@ -2533,17 +2691,14 @@
 25.1892  			// Take care of links
 25.1893  			if (bo->countXLinks()==0)
 25.1894  			{
 25.1895 -				branchLinksContextMenu->clear();
 25.1896 -				branchLinksContextMenu->insertItem ("No xLink available");
 25.1897 -				branchLinksContextMenuDup->clear();
 25.1898 -				branchLinksContextMenuDup->insertItem ("No xLink available");
 25.1899 -				
 25.1900 +				branchXLinksContextMenuEdit->clear();
 25.1901 +				branchXLinksContextMenuFollow->clear();
 25.1902  			} else
 25.1903  			{
 25.1904  				BranchObj *bot;
 25.1905  				QString s;
 25.1906 -				branchLinksContextMenu->clear();
 25.1907 -				branchLinksContextMenuDup->clear();
 25.1908 +				branchXLinksContextMenuEdit->clear();
 25.1909 +				branchXLinksContextMenuFollow->clear();
 25.1910  				for (int i=0; i<=bo->countXLinks();i++)
 25.1911  				{
 25.1912  					bot=bo->XLinkTargetAt(i);
 25.1913 @@ -2552,8 +2707,8 @@
 25.1914  						s=bot->getHeading();
 25.1915  						if (s.length()>25)
 25.1916  							s=s.left(25)+"...";
 25.1917 -						branchLinksContextMenu->insertItem (s);
 25.1918 -						branchLinksContextMenuDup->insertItem (s);
 25.1919 +						branchXLinksContextMenuFollow->addAction (s);
 25.1920 +						branchXLinksContextMenuEdit->addAction (s);
 25.1921  					}	
 25.1922  				}
 25.1923  			}
 25.1924 @@ -2629,7 +2784,7 @@
 25.1925  		if ( (typeid(*selection) == typeid(FloatImageObj)) )
 25.1926  		{
 25.1927  			FloatObj *fo=(FloatImageObj*)selection;
 25.1928 -			standardFlagsDefault->setEnabled (false);
 25.1929 +//FIXME do this in mainwindow					standardFlagsDefault->setEnabled (false);
 25.1930  
 25.1931  			actionEditOpenURL->setEnabled (false);
 25.1932  			actionEditOpenVymLink->setEnabled (false);
 25.1933 @@ -2652,7 +2807,7 @@
 25.1934  
 25.1935  	} else
 25.1936  	{
 25.1937 -		standardFlagsDefault->setEnabled (false);
 25.1938 +//FIXME do this in mainwindow				standardFlagsDefault->setEnabled (false);
 25.1939  
 25.1940  		actionEditCopy->setEnabled (false);	
 25.1941  		actionEditCut->setEnabled (false);	
 25.1942 @@ -2684,7 +2839,7 @@
 25.1943  {
 25.1944  	linkstyle=ls;
 25.1945  
 25.1946 -	saveState("Set link style");	// TODO undoCommand
 25.1947 +	saveStateComplete("Set link style");	// TODO undoCommand
 25.1948  	BranchObj *bo;
 25.1949  	bo=mapCenter->first();
 25.1950  	bo=bo->next();
 25.1951 @@ -2772,13 +2927,10 @@
 25.1952  
 25.1953  void MapEditor::selectLinkColor()
 25.1954  {
 25.1955 -	// Finish open lineEdits
 25.1956 -	if (lineedit) finishedLineEdit();
 25.1957 -
 25.1958  	QColor col = QColorDialog::getColor( defLinkColor, this );
 25.1959  	if ( !col.isValid() ) return;
 25.1960  	setLinkColor( col );
 25.1961 -	saveState(QString("Set link color to %1").arg(col.name()));	//TODO undoCommand
 25.1962 +	saveStateComplete(QString("Set link color to %1").arg(col.name()));	//TODO undoCommand
 25.1963  
 25.1964  }
 25.1965  
 25.1966 @@ -2794,7 +2946,7 @@
 25.1967  			s="Unscroll";
 25.1968  		else	
 25.1969  			s="Scroll";
 25.1970 -		saveState(selection, QString ("%1 %2").arg(s).arg(getName(bo)));
 25.1971 +		saveStatePart(selection, QString ("%1 %2").arg(s).arg(getName(bo)));
 25.1972  		bo->toggleScroll();
 25.1973  		adjustCanvasSize();
 25.1974  		canvas()->update();
 25.1975 @@ -2820,13 +2972,13 @@
 25.1976  	{
 25.1977  		BranchObj *bo=((BranchObj*)selection);
 25.1978  
 25.1979 -		QFileDialog *fd=new QFileDialog( this);
 25.1980 -		fd->setMode (QFileDialog::ExistingFiles);
 25.1981 +		Q3FileDialog *fd=new Q3FileDialog( this);
 25.1982 +		fd->setMode (Q3FileDialog::ExistingFiles);
 25.1983  		fd->addFilter (QString (tr("Images") + " (*.png *.bmp *.xbm *.jpg *.png *.xpm *.gif *.pnm)"));
 25.1984  		ImagePreview *p =new ImagePreview (fd);
 25.1985  		fd->setContentsPreviewEnabled( TRUE );
 25.1986  		fd->setContentsPreview( p, p );
 25.1987 -		fd->setPreviewMode( QFileDialog::Contents );
 25.1988 +		fd->setPreviewMode( Q3FileDialog::Contents );
 25.1989  		fd->setCaption(__VYM " - " +tr("Load image"));
 25.1990  		fd->setDir (lastImageDir);
 25.1991  		fd->show();
 25.1992 @@ -2834,8 +2986,9 @@
 25.1993  		QString fn;
 25.1994  		if ( fd->exec() == QDialog::Accepted )
 25.1995  		{
 25.1996 -			saveState(selection, QString("Add floatimage to %1").arg(getName(selection)));
 25.1997 -			lastImageDir=fn.left(fn.findRev ("/"));
 25.1998 +			saveStatePart(selection, QString("Add floatimage to %1").arg(getName(selection)));
 25.1999 +			// FIXME in QT4 use:	lastImageDir=fd->directory();
 25.2000 +			lastImageDir=QDir (fd->dirPath());
 25.2001  			QStringList flist = fd->selectedFiles();
 25.2002  			QStringList::Iterator it = flist.begin();
 25.2003  			while( it != flist.end() ) 
 25.2004 @@ -2857,26 +3010,18 @@
 25.2005  	}
 25.2006  }
 25.2007  
 25.2008 -void MapEditor::saveFloatImage (int item)
 25.2009 +void MapEditor::saveFloatImage ()
 25.2010  {
 25.2011  	if (selection && 
 25.2012  		(typeid(*selection) == typeid(FloatImageObj)) )
 25.2013  	{
 25.2014  		FloatImageObj *fio=((FloatImageObj*)selection);
 25.2015 -		const char* fmt = saveImageFormatMenu->text(item);
 25.2016 -
 25.2017 -		QFileDialog *fd=new QFileDialog( this, tr("vym - save image as") + fmt);
 25.2018 -		fd->addFilter ("PNG (*.png)");
 25.2019 -		fd->addFilter ("BMP (*.bmp)");
 25.2020 -		fd->addFilter ("XBM (*.xbm)");
 25.2021 -		fd->addFilter ("JPG (*.jpg)");
 25.2022 -		fd->addFilter ("XPM (*.xpm)");
 25.2023 -		fd->addFilter ("GIF (*.gif)");
 25.2024 -		fd->addFilter ("PNM (*.pnm)");
 25.2025 -		fd->addFilter (QString (tr("Images") + " (*.png *.bmp *.xbm *.jpg *.png *.xpm *.gif *.pnm)"));
 25.2026 -		fd->setCaption(__VYM " - " +tr("Save image as %1").arg(fmt));
 25.2027 -		fd->setMode( QFileDialog::AnyFile );
 25.2028 -		fd->setSelection (fio->getOriginalFilename());
 25.2029 +		QFileDialog *fd=new QFileDialog( this);
 25.2030 +		fd->setFilters (imageIO.getFilters());
 25.2031 +		fd->setCaption(__VYM " - " +tr("Save image"));
 25.2032 +		fd->setFileMode( QFileDialog::AnyFile );
 25.2033 +		fd->setDirectory (lastImageDir);
 25.2034 +//		fd->setSelection (fio->getOriginalFilename());
 25.2035  		fd->show();
 25.2036  
 25.2037  		QString fn;
 25.2038 @@ -2905,7 +3050,7 @@
 25.2039  						break;
 25.2040  				}
 25.2041  			}
 25.2042 -			fio->save (fd->selectedFile(),fmt);
 25.2043 +			fio->save (fd->selectedFile(),imageIO.getType (fd->selectedFilter() ) );
 25.2044  		}
 25.2045  	}
 25.2046  }
 25.2047 @@ -2949,7 +3094,7 @@
 25.2048  		selection->setHideLinkUnselected(b);
 25.2049  }
 25.2050  
 25.2051 -void MapEditor::importDir(BranchObj *dst, QDir d)
 25.2052 +void MapEditor::importDirInt(BranchObj *dst, QDir d)
 25.2053  {
 25.2054  	if (selection && 
 25.2055  		(typeid(*selection) == typeid(BranchObj)) || 
 25.2056 @@ -2959,45 +3104,42 @@
 25.2057  		
 25.2058  		// Traverse directories
 25.2059  		d.setFilter( QDir::Dirs| QDir::Hidden | QDir::NoSymLinks );
 25.2060 -		const QFileInfoList *dirlist = d.entryInfoList();
 25.2061 -		QFileInfoListIterator itdir( *dirlist );
 25.2062 -		QFileInfo *fi;
 25.2063 -
 25.2064 -		while ( (fi = itdir.current()) != 0 ) 
 25.2065 +		QFileInfoList list = d.entryInfoList();
 25.2066 +		QFileInfo fi;
 25.2067 +
 25.2068 +		for (int i = 0; i < list.size(); ++i) 
 25.2069  		{
 25.2070 -			if (fi->fileName() != "." && fi->fileName() != ".." )
 25.2071 +			fi=list.at(i);
 25.2072 +			if (fi.fileName() != "." && fi.fileName() != ".." )
 25.2073  			{
 25.2074  				dst->addBranch();
 25.2075  				bo=dst->getLastBranch();
 25.2076 -				bo->setHeading (fi->fileName() );
 25.2077 +				bo->setHeading (fi.fileName() );
 25.2078  				bo->setColor (QColor("blue"));
 25.2079  				bo->toggleScroll();
 25.2080 -				if ( !d.cd(fi->fileName()) ) 
 25.2081 -					QMessageBox::critical (0,tr("Critical Import Error"),tr("Cannot find the directory %1").arg(fi->fileName()));
 25.2082 +				if ( !d.cd(fi.fileName()) ) 
 25.2083 +					QMessageBox::critical (0,tr("Critical Import Error"),tr("Cannot find the directory %1").arg(fi.fileName()));
 25.2084  				else 
 25.2085  				{
 25.2086  					// Recursively add subdirs
 25.2087 -					importDir (bo,d);
 25.2088 +					importDirInt (bo,d);
 25.2089  					d.cdUp();
 25.2090  				}
 25.2091  			}	
 25.2092 -			++itdir;
 25.2093  		}		
 25.2094  		// Traverse files
 25.2095  		d.setFilter( QDir::Files| QDir::Hidden | QDir::NoSymLinks );
 25.2096 -		const QFileInfoList *filelist = d.entryInfoList();
 25.2097 -		QFileInfoListIterator itfile( *filelist );
 25.2098 -
 25.2099 -		while ( (fi = itfile.current()) != 0 ) 
 25.2100 +		list = d.entryInfoList();
 25.2101 +
 25.2102 +		for (int i = 0; i < list.size(); ++i) 
 25.2103  		{
 25.2104 +			fi=list.at(i);
 25.2105  			dst->addBranch();
 25.2106  			bo=dst->getLastBranch();
 25.2107 -			bo->setHeading (fi->fileName() );
 25.2108 +			bo->setHeading (fi.fileName() );
 25.2109  			bo->setColor (QColor("black"));
 25.2110 -			if (fi->fileName().right(4) == ".vym" )
 25.2111 -				bo->setVymLink (fi->filePath());
 25.2112 -
 25.2113 -			++itfile;
 25.2114 +			if (fi.fileName().right(4) == ".vym" )
 25.2115 +				bo->setVymLink (fi.filePath());
 25.2116  		}	
 25.2117  	}		
 25.2118  }
 25.2119 @@ -3008,8 +3150,8 @@
 25.2120  		(typeid(*selection) == typeid(BranchObj)) || 
 25.2121  		(typeid(*selection) == typeid(MapCenterObj))  )
 25.2122  	{
 25.2123 -		QFileDialog *fd=new QFileDialog( this,__VYM " - " +tr("Choose directory structure to import"));
 25.2124 -		fd->setMode (QFileDialog::DirectoryOnly);
 25.2125 +		Q3FileDialog *fd=new Q3FileDialog( this,__VYM " - " +tr("Choose directory structure to import"));
 25.2126 +		fd->setMode (Q3FileDialog::DirectoryOnly);
 25.2127  		fd->addFilter (QString (tr("vym map") + " (*.vym)"));
 25.2128  		fd->setCaption(__VYM " - " +tr("Choose directory structure to import"));
 25.2129  		fd->show();
 25.2130 @@ -3018,7 +3160,7 @@
 25.2131  		if ( fd->exec() == QDialog::Accepted )
 25.2132  		{
 25.2133  			BranchObj *bo=((BranchObj*)selection);
 25.2134 -			importDir (bo,QDir(fd->selectedFile()) );
 25.2135 +			importDirInt (bo,QDir(fd->selectedFile()) );
 25.2136  			mapCenter->reposition();
 25.2137  			adjustCanvasSize();
 25.2138  			canvas()->update();
 25.2139 @@ -3045,6 +3187,7 @@
 25.2140  
 25.2141  void MapEditor::editXLink(int i)
 25.2142  {
 25.2143 +	qDebug ("ko.");  //FIXME Huh?
 25.2144  	if (selection && 
 25.2145  		(typeid(*selection) == typeid(BranchObj)) || 
 25.2146  		(typeid(*selection) == typeid(MapCenterObj))  )
 25.2147 @@ -3064,7 +3207,7 @@
 25.2148  				}
 25.2149  				if (dia.deleteXLink())
 25.2150  					((BranchObj*)selection)->deleteXLinkAt(i);
 25.2151 -				saveState("Edit xLink");	//TODO undoCommand
 25.2152 +				saveStateComplete("Edit xLink");	//TODO undoCommand
 25.2153  			}
 25.2154  		}	
 25.2155  	}
 25.2156 @@ -3074,33 +3217,44 @@
 25.2157  {
 25.2158  	cout << "MapEditor::testFunction() called\n";
 25.2159  
 25.2160 -	mapCenter->positionBBox();
 25.2161 +/*
 25.2162 +	bool ok;
 25.2163 +	QString text = QInputDialog::getText(
 25.2164 +		this, 
 25.2165 +		tr("QInputDialog::getText()"),
 25.2166 +		 tr("User name:"), QLineEdit::Normal,
 25.2167 +		 QDir::home().dirName(), &ok, Qt::FramelessWindowHint);
 25.2168 +*/
 25.2169 +
 25.2170 +	QDialog *d =new QDialog(NULL);
 25.2171 +	QLineEdit *le=new QLineEdit (d);
 25.2172 +//	d->setModal (true);
 25.2173 +	d->setWindowFlags (Qt::FramelessWindowHint);
 25.2174 +	le->setFocus();
 25.2175 +	le->setText ("Foo");
 25.2176 +	le->selectAll();
 25.2177 +	connect (le, SIGNAL (returnPressed()), d, SLOT (accept()));
 25.2178 +	d->exec();
 25.2179 +	qWarning( le->text());
 25.2180  	return;
 25.2181 -
 25.2182 +	
 25.2183 +
 25.2184 +
 25.2185 +/*
 25.2186  	WarningDialog dia;
 25.2187  	dia.setCancelButton (true);
 25.2188  	dia.setText("This is a longer \nWarning");
 25.2189  	dia.setCaption("Warning: Flux problem");
 25.2190 -	dia.setShowAgainName("/vym/warnings/mapeditor");
 25.2191 +	dia.setShowAgainName("/warnings/mapeditor");
 25.2192 +	dia.setWindowFlags (Qt::FramelessWindowHint);
 25.2193  	if (dia.exec()==QDialog::Accepted)
 25.2194  		cout << "accepted!\n";
 25.2195  	else	
 25.2196  		cout << "canceled!\n";
 25.2197  	return;
 25.2198 -
 25.2199 -	QString ub=vymBaseDir.path()+"/scripts/update-bookmarks";
 25.2200 -	QProcess *proc = new QProcess( this );
 25.2201 -	proc->addArgument(ub);
 25.2202 -
 25.2203 -	if ( !proc->start() ) 
 25.2204 -	{
 25.2205 -		QMessageBox::warning(0, 
 25.2206 -			tr("Warning"),
 25.2207 -			tr("Couldn't find script %1\nto notifiy Browsers of changed bookmarks.").arg(ub));
 25.2208 -	}	
 25.2209 -
 25.2210 -	
 25.2211 -/*
 25.2212 +*/
 25.2213 +
 25.2214 +/* Hide hidden stuff temporary, maybe add this as regular function somewhere
 25.2215  	if (hidemode==HideNone)
 25.2216  	{
 25.2217  		setHideTmpMode (HideExport);
 25.2218 @@ -3199,15 +3353,12 @@
 25.2219  void MapEditor::contentsMousePressEvent(QMouseEvent* e)
 25.2220  {
 25.2221  	// Ignore right clicks, these will go to context menus
 25.2222 -	if (e->button() == QMouseEvent::RightButton )
 25.2223 +	if (e->button() == Qt::RightButton )
 25.2224  	{
 25.2225  		e->ignore();
 25.2226  		return;
 25.2227  	}
 25.2228  
 25.2229 -	// Finish open lineEdits
 25.2230 -	if (lineedit) finishedLineEdit();
 25.2231 -	
 25.2232      QPoint p = inverseWorldMatrix().map(e->pos());
 25.2233      LinkableMapObj* lmo=mapCenter->findMapObj(p, NULL);
 25.2234  	
 25.2235 @@ -3222,10 +3373,10 @@
 25.2236  		if (!foname.isEmpty())
 25.2237  		{
 25.2238  			// systemFlag clicked
 25.2239 -			select (lmo);
 25.2240 +			selectInt (lmo);
 25.2241  			if (foname=="url") 
 25.2242  			{
 25.2243 -				if (e->state() & QMouseEvent::ControlButton)
 25.2244 +				if (e->state() & Qt::ControlModifier)
 25.2245  					mainWindow->editOpenURLTab();
 25.2246  				else	
 25.2247  					mainWindow->editOpenURL();
 25.2248 @@ -3245,7 +3396,7 @@
 25.2249  	// No system flag clicked, take care of modmodes
 25.2250  
 25.2251  	// Special case: CTRL is pressed
 25.2252 -	if (e->state() & QMouseEvent::ControlButton)
 25.2253 +	if (e->state() & Qt::ControlModifier)
 25.2254  	{
 25.2255  		if (actionModModeColor->isOn())
 25.2256  		{
 25.2257 @@ -3280,19 +3431,20 @@
 25.2258  	}
 25.2259      if (lmo) 
 25.2260  	{	
 25.2261 -		select (lmo);
 25.2262 +		selectInt (lmo);
 25.2263  		// Left Button	    Move Branches
 25.2264 -		if (e->button() == QMouseEvent::LeftButton )
 25.2265 +		if (e->button() == Qt::LeftButton )
 25.2266  		{
 25.2267  			movingObj_start.setX( p.x() - selection->x() );	
 25.2268  			movingObj_start.setY( p.y() - selection->y() );	
 25.2269  			movingObj_orgPos.setX (lmo->x() );
 25.2270  			movingObj_orgPos.setY (lmo->y() );
 25.2271 +			movingObj_orgRelPos=lmo->getRelPos();
 25.2272  
 25.2273  			// If modMode==copy, then we want to "move" the _new_ object around
 25.2274  			// then we need the offset from p to the _old_ selection, because of tmp
 25.2275  			if (actionModModeCopy->isOn() &&
 25.2276 -				e->state() & QMouseEvent::ControlButton)
 25.2277 +				e->state() & Qt::ControlModifier)
 25.2278  			{
 25.2279  				if (typeid(*selection)==typeid(BranchObj) )
 25.2280  				{
 25.2281 @@ -3309,13 +3461,13 @@
 25.2282  			// Middle Button    Toggle Scroll
 25.2283  			// (On Mac OS X this won't work, but we still have 
 25.2284  			// a button in the toolbar)
 25.2285 -			if (e->button() == QMouseEvent::MidButton )
 25.2286 +			if (e->button() == Qt::MidButton )
 25.2287  				toggleScroll();
 25.2288  		updateActions();
 25.2289  	} else 
 25.2290  	{ // No MapObj found, we are on the Canvas itself
 25.2291  		// Left Button	    move Pos of CanvasView
 25.2292 -		if (e->button() == QMouseEvent::LeftButton )
 25.2293 +		if (e->button() == Qt::LeftButton )
 25.2294  		{
 25.2295  			movingObj=NULL;	// move Content not Obj
 25.2296  			movingObj_start=e->globalPos();
 25.2297 @@ -3353,16 +3505,13 @@
 25.2298  		if (typeid(*selection) == typeid(FloatImageObj))
 25.2299  		{
 25.2300  			FloatObj *fo=(FloatObj*)selection;
 25.2301 -			saveState(
 25.2302 -				"move "+qpointToString(movingObj_orgPos),fo->getSelectString() ,
 25.2303 -				QString("Move %1").arg(getName(selection)));
 25.2304  			fo->move   (p.x() -movingObj_start.x(), p.y()-movingObj_start.y() );		
 25.2305  			fo->setRelPos();
 25.2306  			fo->reposition();
 25.2307  
 25.2308  			// Relink float to new mapcenter or branch, if shift is pressed	
 25.2309  			// Only relink, if selection really has a new parent
 25.2310 -			if ( (e->state() & QMouseEvent::ShiftButton) && lmo &&
 25.2311 +			if ( (e->state() & Qt::ShiftModifier) && lmo &&
 25.2312  				( (typeid(*lmo)==typeid(BranchObj)) ||
 25.2313  				  (typeid(*lmo)==typeid(MapCenterObj)) ) &&
 25.2314  				( lmo != fo->getParObj())  
 25.2315 @@ -3370,7 +3519,8 @@
 25.2316  			{
 25.2317  				if (typeid(*fo) == typeid(FloatImageObj)) 
 25.2318  				{
 25.2319 -					saveState(QString("Relink %1 to %2").arg(getName(fo)).arg(getName(lmo) ) );
 25.2320 +					//TODO undocom
 25.2321 +					saveStateComplete(QString("Relink %1 to %2").arg(getName(fo)).arg(getName(lmo) ) );
 25.2322  					FloatImageObj *fio=(FloatImageObj*)(fo);
 25.2323  					((BranchObj*)(lmo))->addFloatImage (fio);
 25.2324  					fio->unselect();
 25.2325 @@ -3387,7 +3537,7 @@
 25.2326  		{
 25.2327  			if (lmosel->getDepth()==0)
 25.2328  			{
 25.2329 -				if (e->state() == (LeftButton | !ShiftButton)) 
 25.2330 +				if (e->state() == Qt::LeftButton && e->modifiers()==Qt::ShiftModifier) 
 25.2331  					// If mapCenter is moved, move all the rest by default, too.
 25.2332  					mapCenter->moveAll(p.x() -movingObj_start.x(), p.y()-movingObj_start.y() );		
 25.2333  				else	
 25.2334 @@ -3417,12 +3567,12 @@
 25.2335  					(typeid(*lmo) == typeid(MapCenterObj) )
 25.2336  					) )
 25.2337  				{
 25.2338 -					if (e->state() & QMouseEvent::ControlButton)
 25.2339 +					if (e->state() & Qt::ControlModifier)
 25.2340  					{
 25.2341  						// Special case: CTRL to link below lmo
 25.2342  						lmosel->setParObjTmp (lmo,p,+1);
 25.2343  					}
 25.2344 -					else if (e->state() & QMouseEvent::ShiftButton)
 25.2345 +					else if (e->state() & Qt::ShiftModifier)
 25.2346  						lmosel->setParObjTmp (lmo,p,-1);
 25.2347  					else
 25.2348  						lmosel->setParObjTmp (lmo,p,0);
 25.2349 @@ -3466,12 +3616,12 @@
 25.2350  	if (pickingColor)
 25.2351  	{
 25.2352  		pickingColor=false;
 25.2353 -		setCursor (ArrowCursor);
 25.2354 +		setCursor (Qt::ArrowCursor);
 25.2355  		// Check if we are over another branch
 25.2356  		dst=mapCenter->findMapObj(inverseWorldMatrix().map(e->pos() ), NULL);
 25.2357  		if (dst && selection) 
 25.2358  		{	
 25.2359 -			if (e->state() & QMouseEvent::ShiftButton)
 25.2360 +			if (e->state() & Qt::ShiftModifier)
 25.2361  			{
 25.2362  				((BranchObj*)selection)->setColor (((BranchObj*)(dst))->getColor());
 25.2363  				((BranchObj*)selection)->setLinkColor ();
 25.2364 @@ -3496,7 +3646,7 @@
 25.2365  			tmpXLink->setEnd ( ((BranchObj*)(dst)) );
 25.2366  			tmpXLink->updateXLink();
 25.2367  			tmpXLink->activate();
 25.2368 -			saveState(QString("Activate xLink from %1 to %2").arg(getName(tmpXLink->getBegin())).arg(getName(tmpXLink->getEnd())) );	//TODO undoCommand
 25.2369 +			saveStateComplete(QString("Activate xLink from %1 to %2").arg(getName(tmpXLink->getBegin())).arg(getName(tmpXLink->getEnd())) );	//TODO undoCommand
 25.2370  		} else
 25.2371  		{
 25.2372  			delete(tmpXLink);
 25.2373 @@ -3511,6 +3661,14 @@
 25.2374  		// Moved FloatObj? Maybe we need to reposition
 25.2375  		if(typeid(*selection)==typeid (FloatImageObj))
 25.2376  		{
 25.2377 +			FloatImageObj *fo=(FloatImageObj*)selection;
 25.2378 +		    QString pold=qpointToString(movingObj_orgRelPos);
 25.2379 +		    QString pnow=qpointToString(fo->getRelPos());
 25.2380 +			saveStateConstSelection(
 25.2381 +				"moveRel "+pold,
 25.2382 +				"moveRel "+pnow,
 25.2383 +				QString("Move %1 to relativ position %2").arg(getName(selection)).arg(pnow));
 25.2384 +
 25.2385  			selection->getParObj()->requestReposition();
 25.2386  			mapCenter->reposition();
 25.2387  		}	
 25.2388 @@ -3532,41 +3690,64 @@
 25.2389  			// Reset the temporary drawn link to the original one
 25.2390  			((LinkableMapObj*)selection)->unsetParObjTmp();
 25.2391  
 25.2392 +			// For Redo we may need to save original selection
 25.2393 +			QString preSelStr=selection->getSelectString();
 25.2394  
 25.2395  			copyingObj=false;	
 25.2396  			if (dst ) 
 25.2397  			{
 25.2398 -				BranchObj* bs=((BranchObj*)selection);
 25.2399 +				BranchObj* bsel=(BranchObj*)selection;
 25.2400 +				BranchObj* bdst=(BranchObj*)dst;
 25.2401 +
 25.2402 +				QString preParStr=(bsel->getParObj())->getSelectString();
 25.2403 +				QString preNum=QString::number (bsel->getNum(),10);
 25.2404 +				QString preDstParStr;
 25.2405 +
 25.2406 +				if (e->state() & Qt::ShiftModifier && dst->getParObj())
 25.2407 +				{	// Link above dst
 25.2408 +					preDstParStr=dst->getParObj()->getSelectString();
 25.2409 +					bsel->moveBranchTo ( (BranchObj*)(bdst->getParObj()), bdst->getNum());
 25.2410 +				} else 
 25.2411 +				if (e->state() & Qt::ControlModifier && dst->getParObj())
 25.2412 +				{
 25.2413 +					// Link below dst
 25.2414 +					preDstParStr=dst->getParObj()->getSelectString();
 25.2415 +					bsel->moveBranchTo ( (BranchObj*)(bdst->getParObj()), bdst->getNum()+1);
 25.2416 +				} else	
 25.2417 +				{	// Append to dst
 25.2418 +					preDstParStr=dst->getSelectString();
 25.2419 +					bsel->moveBranchTo (bdst,-1);
 25.2420 +					if (dst->getDepth()==0) bsel->move (savePos);
 25.2421 +				} 
 25.2422 +				QString postSelStr=selection->getSelectString();
 25.2423 +				QString postNum=QString::number (bsel->getNum(),10);
 25.2424 +
 25.2425  				QString undoCom="linkBranchToPos (\""+ 
 25.2426 -					(bs->getParObj())->getSelectString()+
 25.2427 -					"\","+
 25.2428 -					QString("%1").arg(bs->getNum())+
 25.2429 -					","+
 25.2430 -					QString ("%1,%2").arg(movingObj_orgPos.x()).arg(movingObj_orgPos.y())+
 25.2431 -					")";
 25.2432 -				// TODO we also could check, if dest and src are on same branch,
 25.2433 -				// then it would be sufficient to saveState of this branch
 25.2434 -
 25.2435 -				// Modifiers allow to insert above/below dst
 25.2436 -				if (e->state() & QMouseEvent::ShiftButton)
 25.2437 -				{
 25.2438 -					bs->moveBranchTo ( (BranchObj*)(dst->getParObj()), ((BranchObj*)(dst))->getNum());
 25.2439 -				} else 
 25.2440 -				if (e->state() & QMouseEvent::ControlButton)
 25.2441 -			{
 25.2442 -					bs->moveBranchTo ( (BranchObj*)(dst->getParObj()), ((BranchObj*)(dst))->getNum()+1);
 25.2443 -				} else	
 25.2444 -				{
 25.2445 -					bs->moveBranchTo ((BranchObj*)(dst),-1);
 25.2446 -					if (dst->getDepth()==0) 
 25.2447 -						bs->move (savePos);
 25.2448 -				} 
 25.2449 -				saveState (undoCom,bs->getSelectString(),QString("Relink %1 to %2").arg(getName(bs)).arg(getName(dst)) );
 25.2450 +					preParStr+ "\"," + preNum  +"," + 
 25.2451 +					QString ("%1,%2").arg(movingObj_orgPos.x()).arg(movingObj_orgPos.y())+ ")";
 25.2452 +
 25.2453 +				QString redoCom="linkBranchToPos (\""+ 
 25.2454 +					preDstParStr + "\"," + postNum + "," +
 25.2455 +					QString ("%1,%2").arg(savePos.x()).arg(savePos.y())+ ")";
 25.2456 +
 25.2457 +				saveState (
 25.2458 +					postSelStr,undoCom,
 25.2459 +					preSelStr, redoCom,
 25.2460 +					QString("Relink %1 to %2").arg(getName(bsel)).arg(getName(dst)) );
 25.2461  			} else
 25.2462  				if (selection->getDepth()==1)
 25.2463 -					// If we have moved mainbranch only save endposition
 25.2464 -					saveState("move "+qpointToString(movingObj_orgPos), selection->getSelectString(), QString("Move %1 to %2").arg(getName(selection)).arg(qpointToString(movingObj_orgPos)));
 25.2465 +				{
 25.2466 +					// The select string might be different _after_ moving around.
 25.2467 +					// Therefor reposition and then use string of old selection, too
 25.2468 +					mapCenter->reposition();
 25.2469 +
 25.2470 +					QString ps=qpointToString ( ((BranchObj*)selection)->getRelPos() );
 25.2471 +					saveState(
 25.2472 +						selection->getSelectString(), "moveRel "+qpointToString(movingObj_orgRelPos), 
 25.2473 +						preSelStr, "moveRel "+ps, 
 25.2474 +						QString("Move %1 to relative position %2").arg(getName(selection)).arg(ps));
 25.2475  			
 25.2476 +				}
 25.2477  			// Draw the original link, before selection was moved around
 25.2478  			mapCenter->reposition();
 25.2479  		}
 25.2480 @@ -3574,18 +3755,18 @@
 25.2481  		adjustCanvasSize();
 25.2482  		canvas()->update();
 25.2483  		movingObj=NULL;		
 25.2484 +
 25.2485 +		// Just make sure, that actions are still ok,e.g. the move branch up/down buttons...
 25.2486 +		updateActions();
 25.2487  	} else 
 25.2488  		// maybe we moved View: set old cursor
 25.2489 -		setCursor (ArrowCursor);
 25.2490 +		setCursor (Qt::ArrowCursor);
 25.2491      
 25.2492  }
 25.2493  
 25.2494  void MapEditor::contentsMouseDoubleClickEvent(QMouseEvent* e)
 25.2495  {
 25.2496 -	// Finish open lineEdits
 25.2497 -	if (lineedit) finishedLineEdit();
 25.2498 -	
 25.2499 -	if (e->button() == QMouseEvent::LeftButton )
 25.2500 +	if (e->button() == Qt::LeftButton )
 25.2501  	{
 25.2502  		QPoint p = inverseWorldMatrix().map(e->pos());
 25.2503  		LinkableMapObj *lmo=mapCenter->findMapObj(p, NULL);
 25.2504 @@ -3594,14 +3775,14 @@
 25.2505  			if (selection) selection->unselect();
 25.2506  			selection=lmo;
 25.2507  			selection->select();
 25.2508 -			editHeading();
 25.2509 +			mainWindow->editHeading();
 25.2510  		}
 25.2511  	}
 25.2512  }
 25.2513  
 25.2514  void MapEditor::resizeEvent (QResizeEvent* e)
 25.2515  {
 25.2516 -	QCanvasView::resizeEvent( e );
 25.2517 +	Q3CanvasView::resizeEvent( e );
 25.2518  	adjustCanvasSize();
 25.2519  }
 25.2520  
 25.2521 @@ -3616,7 +3797,7 @@
 25.2522        (typeid(*selection) == typeid(MapCenterObj))) {
 25.2523      
 25.2524      // If QImageDrag can decode mime type 
 25.2525 -    if (QImageDrag::canDecode(event)) {
 25.2526 +    if (Q3ImageDrag::canDecode(event)) {
 25.2527        event->accept();
 25.2528        return;
 25.2529      }
 25.2530 @@ -3629,7 +3810,7 @@
 25.2531      }
 25.2532  
 25.2533      // If QUriDrag can decode mime type 
 25.2534 -    if (QUriDrag::canDecode(event)) {
 25.2535 +    if (Q3UriDrag::canDecode(event)) {
 25.2536        event->accept();
 25.2537        return;
 25.2538      }
 25.2539 @@ -3641,7 +3822,7 @@
 25.2540      }
 25.2541  
 25.2542      // If QTextDrag can decode mime type
 25.2543 -    if (QTextDrag::canDecode(event)) {
 25.2544 +    if (Q3TextDrag::canDecode(event)) {
 25.2545        event->accept();
 25.2546        return;
 25.2547      }
 25.2548 @@ -3667,12 +3848,12 @@
 25.2549        (typeid(*selection) == typeid(MapCenterObj))) 
 25.2550  	{
 25.2551  		bool update=false;
 25.2552 -		QStrList uris;
 25.2553 +		Q3StrList uris;
 25.2554  		QString heading;
 25.2555  		if (event->provides("image/png")) 
 25.2556  		{
 25.2557  			QPixmap pix;
 25.2558 -			if (QImageDrag::decode(event, pix)) 
 25.2559 +			if (Q3ImageDrag::decode(event, pix)) 
 25.2560  			{
 25.2561  				addFloatImage(pix);
 25.2562  				event->accept();
 25.2563 @@ -3691,7 +3872,7 @@
 25.2564  			update=true;
 25.2565  		} else if (event->provides ("text/uri-list"))
 25.2566  		{	// Uris provided e.g. by konqueror
 25.2567 -			QUriDrag::decode (event,uris);
 25.2568 +			Q3UriDrag::decode (event,uris);
 25.2569  		} else if (event->provides ("_NETSCAPE_URL"))
 25.2570  		{	// Uris provided by Mozilla
 25.2571  		  QStringList l = QStringList::split("\n", event->encodedData("_NETSCAPE_URL"));
 25.2572 @@ -3737,8 +3918,9 @@
 25.2573  				bo=((BranchObj*)selection)->addBranch();
 25.2574  				if (bo)
 25.2575  				{
 25.2576 -					s=QUriDrag::uriToLocalFile(u);
 25.2577 -					if (s) {
 25.2578 +					s=Q3UriDrag::uriToLocalFile(u);
 25.2579 +					if (!s.isEmpty()) 
 25.2580 +					{
 25.2581                         QString file = QDir::convertSeparators(s);
 25.2582                         heading = QFileInfo(file).baseName();
 25.2583                         files.append(file);
 25.2584 @@ -3746,12 +3928,13 @@
 25.2585                             bo->setVymLink(file);
 25.2586                         else
 25.2587                             bo->setURL(u);
 25.2588 -                   } else {
 25.2589 +                   } else 
 25.2590 +				   {
 25.2591                         urls.append (u);
 25.2592                         bo->setURL(u);
 25.2593                     }
 25.2594  
 25.2595 -                   if (heading)
 25.2596 +                   if (!heading.isEmpty())
 25.2597                         bo->setHeading(heading);
 25.2598                     else
 25.2599                         bo->setHeading(u);
 25.2600 @@ -3763,7 +3946,7 @@
 25.2601  		if (update) 
 25.2602  		{
 25.2603  			//FIXME saveState has to be called earlier for each of the drops...
 25.2604 -			saveState("Drop Event");	//TODO undo Command
 25.2605 +			saveStateComplete("Drop Event");	//TODO undo Command
 25.2606  			mapCenter->reposition();
 25.2607  			adjustCanvasSize();
 25.2608  			canvas()->update();
 25.2609 @@ -3778,7 +3961,7 @@
 25.2610        (typeid(*selection) == typeid(MapCenterObj))  )
 25.2611    {
 25.2612      BranchObj *bo=((BranchObj*)selection);
 25.2613 -    saveState(selection,QString("Add floatimage to %1").arg(getName(bo)));
 25.2614 +    saveStatePart(selection,QString("Add floatimage to %1").arg(getName(bo)));
 25.2615      //QString fn=fd->selectedFile();
 25.2616      //lastImageDir=fn.left(fn.findRev ("/"));
 25.2617      bo->addFloatImage();
 25.2618 @@ -3792,19 +3975,19 @@
 25.2619  }
 25.2620  
 25.2621  
 25.2622 -void MapEditor::imageDataFetched(const QByteArray &a, QNetworkOperation */*nop*/) 
 25.2623 +void MapEditor::imageDataFetched(const QByteArray &a, Q3NetworkOperation */*nop*/) 
 25.2624  {
 25.2625    if (!imageBuffer) imageBuffer = new QBuffer();
 25.2626    if (!imageBuffer->isOpen()) {
 25.2627 -    imageBuffer->open(IO_WriteOnly | IO_Append);
 25.2628 +    imageBuffer->open(QIODevice::WriteOnly | QIODevice::Append);
 25.2629    }
 25.2630    imageBuffer->at(imageBuffer->at()+imageBuffer->writeBlock(a));
 25.2631  }
 25.2632  
 25.2633  
 25.2634 -void MapEditor::imageDataFinished(QNetworkOperation *nop) 
 25.2635 +void MapEditor::imageDataFinished(Q3NetworkOperation *nop) 
 25.2636  {
 25.2637 -	if (nop->state()==QNetworkProtocol::StDone) {
 25.2638 +	if (nop->state()==Q3NetworkProtocol::StDone) {
 25.2639  		QPixmap img(imageBuffer->buffer());
 25.2640  		addFloatImage(img);
 25.2641  	}
 25.2642 @@ -3827,11 +4010,11 @@
 25.2643      delete urlOperator;
 25.2644    }
 25.2645    
 25.2646 -  urlOperator = new QUrlOperator(url);
 25.2647 -  connect(urlOperator, SIGNAL(finished(QNetworkOperation *)), 
 25.2648 -	  this, SLOT(imageDataFinished(QNetworkOperation*)));
 25.2649 -
 25.2650 -  connect(urlOperator, SIGNAL(data(const QByteArray &, QNetworkOperation *)),
 25.2651 -	  this, SLOT(imageDataFetched(const QByteArray &, QNetworkOperation *)));
 25.2652 +  urlOperator = new Q3UrlOperator(url);
 25.2653 +  connect(urlOperator, SIGNAL(finished(Q3NetworkOperation *)), 
 25.2654 +	  this, SLOT(imageDataFinished(Q3NetworkOperation*)));
 25.2655 +
 25.2656 +  connect(urlOperator, SIGNAL(data(const QByteArray &, Q3NetworkOperation *)),
 25.2657 +	  this, SLOT(imageDataFetched(const QByteArray &, Q3NetworkOperation *)));
 25.2658    urlOperator->get();
 25.2659  }
    26.1 --- a/mapeditor.h	Tue Sep 05 09:47:13 2006 +0000
    26.2 +++ b/mapeditor.h	Tue Sep 05 09:47:14 2006 +0000
    26.3 @@ -1,32 +1,40 @@
    26.4  #ifndef MAPEDITOR_H
    26.5  #define MAPEDITOR_H
    26.6  
    26.7 -#include <qcanvas.h>
    26.8 -#include <qlineedit.h>
    26.9 -#include <qcursor.h>
   26.10 -#include <qfiledialog.h>
   26.11 -#include <qevent.h>
   26.12 -#include <qprocess.h>
   26.13 -#include <qbuffer.h>
   26.14 +#include <q3canvas.h>
   26.15 +//#include <q3filedialog.h>
   26.16 +//#include <q3process.h>
   26.17 +#include <QBuffer>
   26.18 +#include <QContextMenuEvent>
   26.19 +#include <QCursor>
   26.20 +#include <QDragEnterEvent>
   26.21 +#include <QDropEvent>
   26.22 +#include <QEvent>
   26.23 +#include <QLineEdit>
   26.24 +#include <QMouseEvent>
   26.25 +#include <QPixmap>
   26.26 +#include <QResizeEvent>
   26.27  
   26.28  #include "mapcenterobj.h"
   26.29  #include "file.h"
   26.30  #include "misc.h"
   26.31 +#include "selection.h"
   26.32 +#include "settings.h"
   26.33  #include "showtextdialog.h"
   26.34  
   26.35 -class QNetworkOperation;
   26.36 -class QUrlOperator;
   26.37 +class Q3NetworkOperation;
   26.38 +class Q3UrlOperator;
   26.39  
   26.40 -class MapEditor : public QCanvasView , public xmlObj {
   26.41 +class MapEditor : public Q3CanvasView , public xmlObj {
   26.42      Q_OBJECT
   26.43  
   26.44  public:
   26.45 -    MapEditor(QWidget* parent=0, bool interactive=false, const char* name=0, WFlags f=0);
   26.46 +    MapEditor(QWidget* parent=0, bool interactive=false, const char* name=0, Qt::WFlags f=0);
   26.47  	~MapEditor();
   26.48      QColor color();
   26.49      QColor backgroundColor();
   26.50      MapCenterObj* getMapCenter();
   26.51 -	QCanvas* getCanvas();
   26.52 +	Q3Canvas* getCanvas();
   26.53  	void adjustCanvasSize();// adjust canvas size to map and scrollview
   26.54  	bool isRepositionBlocked(); // block while load or undo
   26.55  	
   26.56 @@ -34,20 +42,21 @@
   26.57  	QString getName(LinkableMapObj*);	// Get e.g. heading or filename
   26.58  	void makeTmpDirs();		// create temporary directories
   26.59      QString saveToDir(const QString&,const QString &,bool, const QPoint &,LinkableMapObj*);
   26.60 -    void saveState(const QString &);	// save actual state to backup
   26.61 -    void saveState(LinkableMapObj *, const QString &);
   26.62 -    void saveState(const QString &, const QString &, const QString &);
   26.63 -    void saveState(const QString &, LinkableMapObj *, const QString &);
   26.64 -    void saveState(const SaveMode&, const QString &, LinkableMapObj *, const QString &, LinkableMapObj *, const QString &);
   26.65 +    void saveStateComplete       (const QString &);					
   26.66 +    void saveStatePart           (LinkableMapObj *, const QString &);
   26.67 +    void saveStateConstSelection (const QString &, const QString &, const QString &);
   26.68 +    void saveStateComData		 (LinkableMapObj *, const QString &, LinkableMapObj *, const QString &, const QString &, LinkableMapObj *);
   26.69 +    void saveState(LinkableMapObj *, const QString &, LinkableMapObj *, const QString &, const QString &);
   26.70 +    void saveState(const QString &, const QString &, const QString &, const QString &, const QString &);
   26.71 +    void saveState(const SaveMode&, const QString &, const QString &, const QString &, const QString &, const QString &, LinkableMapObj *);
   26.72      void parseAtom(const QString &);	
   26.73  
   26.74      void addFloatImage(const QPixmap &img);
   26.75  
   26.76    private slots:
   26.77 -    void finishedLineEdit();
   26.78      void fetchImage(const QString &img);
   26.79 -    void imageDataFetched(const QByteArray &, QNetworkOperation *);
   26.80 -    void imageDataFinished(QNetworkOperation *);
   26.81 +    void imageDataFetched(const QByteArray &, Q3NetworkOperation *);
   26.82 +    void imageDataFinished(Q3NetworkOperation *);
   26.83  
   26.84  public:
   26.85  	void toggleHistoryWindow();
   26.86 @@ -74,8 +83,8 @@
   26.87  	HideTmpMode getHideTmpMode();		// temporary hide stuff
   26.88  public:
   26.89  	void setExportMode (bool);			// temporary hide stuff during export
   26.90 -    void exportImage (QString fn);		// export as PNG	
   26.91 -    void exportImage (QString fn, int);	// export in given format
   26.92 +    void exportImage (QString fn);			// export as PNG	
   26.93 +    void exportImage (QString fn, QString);	// export in given format
   26.94      void exportOOPresentation(const QString &,const QString &);
   26.95      void exportXML(const QString&);		// export to directory
   26.96      void clear();		// clear map
   26.97 @@ -89,14 +98,17 @@
   26.98  public:	
   26.99      void paste();		// paste clipboard to branch and backup
  26.100      void cut();			// cut to clipboard and backup
  26.101 -    void move(const int &,const int&);
  26.102 +    void move    (const int &,const int&);
  26.103 +    void moveRel (const int &,const int&);
  26.104      void moveBranchUp();
  26.105      void moveBranchDown();
  26.106 -    void editHeading();					// Start editing heading 
  26.107 +	QString getHeading (bool &,QPoint &);	// Get heading, ok if selection is branch
  26.108 +	void setHeading(const QString &);
  26.109  private:
  26.110 -	void setHeading(const QString &);	// Just set the heading for selection
  26.111 -	void setURL(const QString &);		// Just set the URL for selection
  26.112 -	void setVymLink(const QString &);	// Set vymLink for selection
  26.113 +	void setHeadingInt(const QString &);
  26.114 +	void setURLInt(const QString &);		// Just set the URL for selection
  26.115 +	void setVymLinkInt(const QString &);	// Set vymLink for selection
  26.116 +    BranchObj* addNewBranchInt(int);		// pos allows to add above/below selection
  26.117  public:	
  26.118      void addNewBranch(int);			// pos allows to add above/below selection
  26.119      void addNewBranchHere();		// insert and make selection its
  26.120 @@ -104,11 +116,12 @@
  26.121  	LinkableMapObj* getSelection();	// returns selection
  26.122  	void unselect();				// before changing current noteedit
  26.123  	void reselect();				// after  changing current noteedit
  26.124 -	bool select(const QString &);	// Select 
  26.125 +	bool select(const QString &);	// Select by string
  26.126 +	QString getSelectString();
  26.127  private:	
  26.128 -	void select(LinkableMapObj*);	
  26.129 -	void selectNextBranch();		// Increment number of branch
  26.130 -	void selectPrevBranch();		// Decrement number of branch
  26.131 +	void selectInt(LinkableMapObj*);	
  26.132 +	void selectNextBranchInt();		// Increment number of branch
  26.133 +	void selectPrevBranchInt();		// Decrement number of branch
  26.134  public:	
  26.135      void selectUpperBranch();
  26.136      void selectLowerBranch();
  26.137 @@ -128,12 +141,14 @@
  26.138      void findReset();						// Reset Find 
  26.139  	void editURL();							// edit the URL
  26.140  	QString getURL();						// returns URL of selection or ""
  26.141 +	QStringList getURLs();					// returns URLs of subtree
  26.142  	void editHeading2URL();					// copy heading to URL
  26.143  	void editBugzilla2URL();				// create URL to Bugzilla
  26.144  	void editFATE2URL();					// create URL to FATE
  26.145  	void editVymLink();						// edit link to another map
  26.146  	void deleteVymLink();					// delete link to another map
  26.147  	QString getVymLink();					// return path to map
  26.148 +	QStringList getVymLinks();				// return paths in subtree
  26.149  	void toggleHideExport();				// toggle the export flag
  26.150  	void removeBranchKeepChilds();			// remove but keep childs
  26.151  	void removeChilds();					// remove childs
  26.152 @@ -156,19 +171,20 @@
  26.153      void toggleScroll();
  26.154      void unScrollAll();
  26.155  	void loadFloatImage ();
  26.156 -	void saveFloatImage (int);
  26.157 +	void saveFloatImage ();
  26.158  	void setFrame(const FrameType &);
  26.159  	void setIncludeImagesVer(bool);
  26.160  	void setIncludeImagesHor(bool);
  26.161  	void setHideLinkUnselected (bool);
  26.162  	bool getHideLinkUnselected ();
  26.163  private:	
  26.164 -    void importDir(BranchObj *,QDir);
  26.165 +    void importDirInt(BranchObj *,QDir);
  26.166  public:	
  26.167      void importDir();
  26.168  	void followXLink (int);
  26.169  	void editXLink (int);
  26.170 -    void testFunction();				// FIXME just testing
  26.171 +    void testFunction();					// just testing new stuff
  26.172 +											// set /mainwindo/showTestMenu=true...
  26.173  
  26.174  protected:
  26.175  	void ensureSelectionVisible();		
  26.176 @@ -182,12 +198,11 @@
  26.177      virtual void contentsDragEnterEvent(QDragEnterEvent *event);
  26.178      virtual void contentsDropEvent(QDropEvent *event);
  26.179  private:
  26.180 -    QCanvas* mapCanvas;
  26.181 +    Q3Canvas* mapCanvas;
  26.182      MapCenterObj* mapCenter;
  26.183  
  26.184  	bool adjustCanvasRequested;	// collect requests until end of user event
  26.185  	BranchObj *editingBO;		// entering Text into BO
  26.186 -    QLineEdit* lineedit;
  26.187  
  26.188      QColor actColor;			// actual color
  26.189  	QColor defLinkColor;		// default color for links
  26.190 @@ -202,12 +217,14 @@
  26.191  	bool drawingLink;			// true while creating a link
  26.192  	bool copyingObj;			// true while creating a link
  26.193  	XLinkObj* tmpXLink;
  26.194 -	
  26.195 +
  26.196 +	Selection xelection;
  26.197      LinkableMapObj* selection;		// select a LinkableMapObj
  26.198      LinkableMapObj* selectionLast;	// last selection 
  26.199      MapObj* movingObj;				// moving a MapObj
  26.200  	MapObj* linkingObj_src;			// part of a link
  26.201      QPoint movingObj_orgPos;		// org. pos of mouse before move
  26.202 +    QPoint movingObj_orgRelPos;		// org. relative pos of mouse before move
  26.203      QPoint movingObj_start;			// rel. pos of mouse to absPos 
  26.204      QPoint movingCont_start;		// inital pos of moving Content or
  26.205      QPoint movingVec;				// how far has Content moved
  26.206 @@ -228,13 +245,12 @@
  26.207  	QString fileDir;			// dir where file is saved
  26.208  	QString destPath;			// path to .vym file (needed for vymlinks)
  26.209  	QString mapName;			// fileName without ".vym"
  26.210 -	QString lastImageDir;		// save dir for adding images
  26.211  
  26.212  	bool isInteractive;			// non interactive don't need tmpdirs
  26.213  	QString tmpMapDir;			// tmp directory with data for undo/redo
  26.214 +	QString histPath;			// Path to history file
  26.215  	int undosTotal;				// total number of undos 
  26.216 -	int undoNum;				// current number of bakMapDir to be used 
  26.217 -	int undosAvail;				// how many actions can currently be undone
  26.218 +	SimpleSettings undoSet;		// undo/redo commands
  26.219  	bool blockReposition;		// block while load or undo
  26.220  	bool blockSaveState;		// block while load or undo
  26.221  
  26.222 @@ -246,7 +262,7 @@
  26.223  	
  26.224      void resizeEvent( QResizeEvent * );
  26.225  
  26.226 -  QUrlOperator *urlOperator;
  26.227 +  Q3UrlOperator *urlOperator;
  26.228    QDataStream *imageData;
  26.229    QBuffer *imageBuffer;
  26.230  
    27.1 --- a/mapobj.cpp	Tue Sep 05 09:47:13 2006 +0000
    27.2 +++ b/mapobj.cpp	Tue Sep 05 09:47:14 2006 +0000
    27.3 @@ -11,7 +11,7 @@
    27.4      init ();
    27.5  }
    27.6  
    27.7 -MapObj::MapObj (QCanvas* c)
    27.8 +MapObj::MapObj (Q3Canvas* c)
    27.9  {
   27.10  //  cout << "Const MapObj\n";
   27.11      canvas=c;
   27.12 @@ -45,7 +45,7 @@
   27.13  	bbox.setSize (QSize(other->bbox.width(), other->bbox.height() ) );
   27.14  }
   27.15  
   27.16 -QCanvas* MapObj::getCanvas()
   27.17 +Q3Canvas* MapObj::getCanvas()
   27.18  {
   27.19  	return canvas;
   27.20  }
    28.1 --- a/mapobj.h	Tue Sep 05 09:47:13 2006 +0000
    28.2 +++ b/mapobj.h	Tue Sep 05 09:47:14 2006 +0000
    28.3 @@ -1,7 +1,7 @@
    28.4  #ifndef MAPOBJ_H
    28.5  #define MAPOBJ_H
    28.6  
    28.7 -#include <qcanvas.h>
    28.8 +#include <q3canvas.h>
    28.9  #include <iostream>
   28.10  
   28.11  #include "misc.h"
   28.12 @@ -20,12 +20,12 @@
   28.13  class MapObj:public xmlObj {
   28.14  public:
   28.15      MapObj ();
   28.16 -    MapObj (QCanvas*);
   28.17 +    MapObj (Q3Canvas*);
   28.18      MapObj (MapObj*);
   28.19      virtual ~MapObj ();
   28.20      virtual void init ();
   28.21      virtual void copy (MapObj*);
   28.22 -	virtual QCanvas* getCanvas();
   28.23 +	virtual Q3Canvas* getCanvas();
   28.24      virtual int x();
   28.25      virtual int y();
   28.26  	virtual int width();
   28.27 @@ -43,7 +43,7 @@
   28.28      virtual void positionBBox()=0;       
   28.29  	virtual void calcBBoxSize()=0;
   28.30  protected:  
   28.31 -    QCanvas* canvas;
   28.32 +    Q3Canvas* canvas;
   28.33      QRect bbox;									// bounding box of MO itself
   28.34  	QRect clickBox;								// area where mouseclicks are found
   28.35      QPoint absPos;							    // Position on canvas
    29.1 --- a/misc.cpp	Tue Sep 05 09:47:13 2006 +0000
    29.2 +++ b/misc.cpp	Tue Sep 05 09:47:14 2006 +0000
    29.3 @@ -13,7 +13,8 @@
    29.4  
    29.5  ostream &operator<< (ostream &stream, QPoint const &p)
    29.6  { 
    29.7 -    return (stream << qpointToString(p) );
    29.8 +	stream << "("<<p.x()<<","<<p.y()<<")";
    29.9 +	return stream;
   29.10  }
   29.11  
   29.12  float getAngle(const QPoint &p)
    30.1 --- a/options.cpp	Tue Sep 05 09:47:13 2006 +0000
    30.2 +++ b/options.cpp	Tue Sep 05 09:47:14 2006 +0000
    30.3 @@ -86,7 +86,7 @@
    30.4  			}
    30.5  			if (isFile)
    30.6  			{
    30.7 -				cout << "Error: Unknown argument "<<*itarg<<endl;
    30.8 +				qWarning("Error: Unknown argument ");
    30.9  				return 1;
   30.10  			}
   30.11  		} else
    31.1 --- a/options.h	Tue Sep 05 09:47:13 2006 +0000
    31.2 +++ b/options.h	Tue Sep 05 09:47:14 2006 +0000
    31.3 @@ -3,6 +3,8 @@
    31.4  
    31.5  #include <qstring.h>
    31.6  #include <qstringlist.h>
    31.7 +//Added by qt3to4:
    31.8 +#include <Q3ValueList>
    31.9  
   31.10  enum OptionType  {SwitchOption,StringOption};
   31.11  
   31.12 @@ -30,7 +32,7 @@
   31.13  
   31.14  
   31.15  
   31.16 -typedef QValueList <Option> OptionList;
   31.17 +typedef Q3ValueList <Option> OptionList;
   31.18  
   31.19  class Options
   31.20  {
    32.1 --- a/ornamentedobj.cpp	Tue Sep 05 09:47:13 2006 +0000
    32.2 +++ b/ornamentedobj.cpp	Tue Sep 05 09:47:14 2006 +0000
    32.3 @@ -18,7 +18,7 @@
    32.4      init ();
    32.5  }
    32.6  
    32.7 -OrnamentedObj::OrnamentedObj(QCanvas* c) :LinkableMapObj(c)
    32.8 +OrnamentedObj::OrnamentedObj(Q3Canvas* c) :LinkableMapObj(c)
    32.9  {
   32.10  //    cout << "Const OrnamentedObj\n";
   32.11      init ();
   32.12 @@ -159,8 +159,7 @@
   32.13  
   32.14  void OrnamentedObj::move2RelPos(double x, double y)
   32.15  {
   32.16 -	if (!parObj) return;
   32.17 -	move (parObj->getChildPos().x()+x, parObj->getChildPos().y()+y);
   32.18 +	setRelPos (QPoint(x,y));
   32.19  }
   32.20  
   32.21  void OrnamentedObj::move2RelPos(QPoint p)
   32.22 @@ -281,6 +280,15 @@
   32.23  	forceReposition();
   32.24  }
   32.25  
   32.26 +void OrnamentedObj::deactivateStandardFlag(QString f)
   32.27 +{
   32.28 +	standardFlags->deactivate(f);
   32.29 +	calcBBoxSize();
   32.30 +	positionBBox();
   32.31 +	move (absPos.x(), absPos.y() );
   32.32 +	forceReposition();
   32.33 +}
   32.34 +
   32.35  bool OrnamentedObj::isSetStandardFlag (QString f)
   32.36  {
   32.37  	return standardFlags->isActive(f);
   32.38 @@ -312,6 +320,11 @@
   32.39  	}	
   32.40  }
   32.41  
   32.42 +void OrnamentedObj::updateFlagsToolbar()
   32.43 +{
   32.44 +	standardFlags->updateToolbar();
   32.45 +}
   32.46 +
   32.47  void OrnamentedObj::setHideInExport(bool b)
   32.48  {
   32.49  	if (parObj)
    33.1 --- a/ornamentedobj.h	Tue Sep 05 09:47:13 2006 +0000
    33.2 +++ b/ornamentedobj.h	Tue Sep 05 09:47:14 2006 +0000
    33.3 @@ -6,7 +6,7 @@
    33.4  class OrnamentedObj:public LinkableMapObj {
    33.5  public:	
    33.6      OrnamentedObj ();
    33.7 -    OrnamentedObj (QCanvas*);
    33.8 +    OrnamentedObj (Q3Canvas*);
    33.9      OrnamentedObj (OrnamentedObj*);
   33.10      ~OrnamentedObj ();
   33.11      virtual void init ();
   33.12 @@ -35,10 +35,12 @@
   33.13  
   33.14  	virtual void toggleStandardFlag(QString, bool);
   33.15  	virtual void activateStandardFlag(QString);
   33.16 +	virtual void deactivateStandardFlag(QString);
   33.17  	virtual bool isSetStandardFlag(QString);
   33.18  	virtual QString getSystemFlagName (const QPoint &p);
   33.19  	virtual bool isActiveFlag(const QString&);	// check if flag is set
   33.20  	virtual void updateNoteFlag();
   33.21 +	virtual void updateFlagsToolbar();
   33.22  	virtual void setHideInExport(bool);		// set export of object (and childs)
   33.23  	virtual bool hideInExport();
   33.24  	virtual bool isHidden ();
    34.1 --- a/process.h	Tue Sep 05 09:47:13 2006 +0000
    34.2 +++ b/process.h	Tue Sep 05 09:47:14 2006 +0000
    34.3 @@ -1,13 +1,13 @@
    34.4  #ifndef PROCESS_H
    34.5  #define PROCESS_H
    34.6  
    34.7 -#include <qprocess.h>
    34.8 +#include <q3process.h>
    34.9  #include <qstring.h>
   34.10  
   34.11  
   34.12  using namespace std;
   34.13  
   34.14 -class Process:public QProcess
   34.15 +class Process:public Q3Process
   34.16  {
   34.17  	Q_OBJECT
   34.18  public:
    35.1 --- a/settings.cpp	Tue Sep 05 09:47:13 2006 +0000
    35.2 +++ b/settings.cpp	Tue Sep 05 09:47:14 2006 +0000
    35.3 @@ -61,6 +61,7 @@
    35.4  		qWarning ("SimpleSettings::writeSettings() Couldn't write "+path);
    35.5  }
    35.6  
    35.7 +/*
    35.8  QString SimpleSettings::readEntry (const QString &key)
    35.9  {
   35.10  	QStringList::Iterator itk=keylist.begin();
   35.11 @@ -77,6 +78,46 @@
   35.12  	qWarning ("SimpleSettings::readEntry()  Couldn't find key "+key);
   35.13  	return "";
   35.14  }
   35.15 +*/
   35.16 +
   35.17 +QString SimpleSettings::readEntry (const QString &key, const QString &def)
   35.18 +{
   35.19 +	QStringList::Iterator itk=keylist.begin();
   35.20 +	QStringList::Iterator itv=valuelist.begin();
   35.21 +
   35.22 +	// First search for value in settings saved in map
   35.23 +	while (itk !=keylist.end() )
   35.24 +	{
   35.25 +		if (*itk == key)
   35.26 +			return *itv;
   35.27 +		itk++;
   35.28 +		itv++;
   35.29 +	}
   35.30 +	return def;
   35.31 +}
   35.32 +
   35.33 +int SimpleSettings::readNumEntry (const QString &key, int def)
   35.34 +{
   35.35 +	QStringList::Iterator itk=keylist.begin();
   35.36 +	QStringList::Iterator itv=valuelist.begin();
   35.37 +
   35.38 +	// First search for value in settings saved in map
   35.39 +	while (itk !=keylist.end() )
   35.40 +	{
   35.41 +		if (*itk == key)
   35.42 +		{
   35.43 +			bool ok;
   35.44 +			int i=(*itv).toInt(&ok,10);
   35.45 +			if (ok)
   35.46 +				return i;
   35.47 +			else
   35.48 +				return def;
   35.49 +		}	
   35.50 +		itk++;
   35.51 +		itv++;
   35.52 +	}
   35.53 +	return def;
   35.54 +}
   35.55  
   35.56  void SimpleSettings::setEntry (const QString &key, const QString &value)
   35.57  {
   35.58 @@ -117,6 +158,11 @@
   35.59  	clear();		 
   35.60  }
   35.61  
   35.62 +Settings::Settings(const QString & organization, const QString & application ):QSettings (organization,application)
   35.63 +{
   35.64 +	clear();		 
   35.65 +}
   35.66 +
   35.67  Settings::~Settings()
   35.68  {
   35.69  }
    36.1 --- a/settings.h	Tue Sep 05 09:47:13 2006 +0000
    36.2 +++ b/settings.h	Tue Sep 05 09:47:14 2006 +0000
    36.3 @@ -18,7 +18,8 @@
    36.4  	void clear();
    36.5  	void readSettings(const QString &);
    36.6  	void writeSettings(const QString &);
    36.7 -	QString readEntry (const QString &);
    36.8 +	QString readEntry (const QString &key, const QString &def=QString());
    36.9 +	int readNumEntry (const QString &, int=0);
   36.10  	void setEntry (const QString &,const QString &);
   36.11  private:	
   36.12  	QStringList keylist;
   36.13 @@ -32,6 +33,7 @@
   36.14  {
   36.15  public:
   36.16      Settings ();
   36.17 +    Settings (const QString & , const QString &);
   36.18  	~Settings ();
   36.19  	void clear();
   36.20  	void clearLocal (const QString &);
    37.1 --- a/texteditor.cpp	Tue Sep 05 09:47:13 2006 +0000
    37.2 +++ b/texteditor.cpp	Tue Sep 05 09:47:14 2006 +0000
    37.3 @@ -1,28 +1,19 @@
    37.4  #include "texteditor.h"
    37.5  
    37.6 -#include <qcanvas.h>
    37.7 -#include <qstatusbar.h>
    37.8 -#include <qmessagebox.h>
    37.9 -#include <qaction.h>
   37.10 -#include <qapplication.h>
   37.11 -#include <qpainter.h>
   37.12 -#include <qprinter.h>
   37.13 -#include <qfile.h>
   37.14 -#include <qfiledialog.h>
   37.15 -#include <qtoolbar.h>
   37.16 -#include <qpopupmenu.h>
   37.17 +#include <QPainter>
   37.18 +#include <QPrinter>
   37.19 +#include <QFile>
   37.20 +#include <QFileDialog>
   37.21  #include <qmenubar.h>
   37.22 -#include <qtextedit.h>
   37.23 -#include <qaccel.h>
   37.24  #include <qtextstream.h>
   37.25 -#include <qpaintdevicemetrics.h>
   37.26 -#include <qsettings.h>
   37.27 -#include <qfontdialog.h>
   37.28 -#include <qmessagebox.h>
   37.29 -#include <qcolordialog.h>
   37.30 -#include <qregexp.h>
   37.31 -#include <qlineedit.h>
   37.32 -#include <qsimplerichtext.h>
   37.33 +#include <QSettings>
   37.34 +#include <QFontDialog>
   37.35 +#include <QMessageBox>
   37.36 +#include <QColorDialog>
   37.37 +#include <QRegExp>
   37.38 +#include <QList>
   37.39 +#include <QPixmap>
   37.40 +#include <QCloseEvent>
   37.41  
   37.42  #include <iostream>
   37.43  #include <cstdlib>
   37.44 @@ -31,7 +22,6 @@
   37.45  #include "noteobj.h"
   37.46  #include "version.h"
   37.47  
   37.48 -extern QCanvas* actCanvas;
   37.49  extern int statusbarTime;
   37.50  extern QSettings settings;
   37.51  
   37.52 @@ -49,15 +39,16 @@
   37.53  TextEditor::TextEditor()
   37.54  {
   37.55      printer = new QPrinter( QPrinter::HighResolution );
   37.56 -	printer->setPrinterName (settings.readEntry("/vym/mainwindow/printerName",printer->printerName()));
   37.57 +	printer->setPrinterName (settings.value("/mainwindow/printerName",printer->printerName()).toString());
   37.58  
   37.59  	// Editor (use MyTextEdit to wrap verticalAlignmentChanged to 
   37.60  	//         int argument. see header file)
   37.61      e = new MyTextEdit( this, "editor" );
   37.62      e->setFocus();
   37.63 -	e->setTextFormat(RichText);		// default
   37.64 +	e->setTextFormat(Qt::RichText);		// default
   37.65  	e->setTabStopWidth (20);		// unit is pixel
   37.66 -	e->setColor (black);
   37.67 +	e->setColor (Qt::black);
   37.68 +	e->setAutoFillBackground (true);
   37.69  	connect (e, SIGNAL( textChanged() ), this, SLOT( editorChanged() ) );
   37.70      setCentralWidget( e );
   37.71      statusBar()->message( "Ready", statusbarTime);
   37.72 @@ -70,31 +61,26 @@
   37.73  	setupSettingsActions();
   37.74  	
   37.75  	// Various states
   37.76 -	emptyPaper   = QBrush(gray);
   37.77 -	filledPaper  = QBrush(white);
   37.78 -	inactivePaper= QBrush(black);
   37.79  	setInactive();
   37.80  
   37.81  	// Load Settings
   37.82 -	resize (settings.readNumEntry( "/vym/noteeditor/geometry/width", 450),
   37.83 -	        settings.readNumEntry( "/vym/noteeditor/geometry/height",600));
   37.84 -	move   (settings.readNumEntry( "/vym/noteeditor/geometry/posX", 150),
   37.85 -	        settings.readNumEntry( "/vym/noteeditor/geometry/posY",  50));
   37.86 +	resize (settings.value ( "/noteeditor/geometry/size", QSize(450,600)).toSize());
   37.87 +	move   (settings.value ( "/noteeditor/geometry/pos", QPoint (250,50)).toPoint());
   37.88  	
   37.89 -	if (settings.readEntry( "/vym/noteeditor/showWithMain","yes") =="yes")
   37.90 +	if (settings.value ( "/noteeditor/showWithMain",true).toBool())
   37.91  		setShowWithMain(true);
   37.92  	else	
   37.93  		setShowWithMain(false);
   37.94  
   37.95 -	varFont.fromString( settings.readEntry 
   37.96 -		("/vym/noteeditor/fonts/varFont",
   37.97 -		"Nimbus Sans l,14,-1,5,48,0,0,0,0,0") 
   37.98 +	varFont.fromString( settings.value
   37.99 +		("/noteeditor/fonts/varFont",
  37.100 +		"Nimbus Sans l,14,-1,5,48,0,0,0,0,0").toString() 
  37.101  	);
  37.102 -	fixedFont.fromString (settings.readEntry (
  37.103 -		"/vym/noteeditor/fonts/fixedFont",
  37.104 -		"Courier,14,-1,5,48,0,0,0,1,0") 
  37.105 +	fixedFont.fromString (settings.value(
  37.106 +		"/noteeditor/fonts/fixedFont",
  37.107 +		"Courier,14,-1,5,48,0,0,0,1,0").toString() 
  37.108  	);
  37.109 -	QString s=settings.readEntry ("/vym/noteeditor/fonts/fonthintDefault","variable");
  37.110 +	QString s=settings.value ("/noteeditor/fonts/fonthintDefault","variable").toString();
  37.111  	if (s == "fixed")
  37.112  	{	
  37.113  		actionSettingsFonthintDefault->setOn (true);
  37.114 @@ -107,7 +93,7 @@
  37.115  	filenameHint="";
  37.116  
  37.117  	// Save settings in vymrc
  37.118 -	settings.writeEntry("/vym/mainwindow/printerName",printer->printerName());
  37.119 +	settings.setValue("/mainwindow/printerName",printer->printerName());
  37.120  }
  37.121  
  37.122  
  37.123 @@ -115,31 +101,24 @@
  37.124  {
  37.125      if (printer) delete printer;
  37.126  	// Save Settings
  37.127 -	settings.writeEntry( "/vym/noteeditor/geometry/width", width() );
  37.128 -	settings.writeEntry( "/vym/noteeditor/geometry/height", height() );
  37.129 -	settings.writeEntry( "/vym/noteeditor/geometry/posX", pos().x() );
  37.130 -	settings.writeEntry( "/vym/noteeditor/geometry/posY", pos().y() );
  37.131 +	settings.setValue( "/noteeditor/geometry/size", size() );
  37.132 +	settings.setValue( "/noteeditor/geometry/pos", pos() );
  37.133  	
  37.134 -	if (showWithMain())
  37.135 -		settings.writeEntry( "/vym/noteeditor/showWithMain","yes");
  37.136 -	else	
  37.137 -		settings.writeEntry( "/vym/noteeditor/showWithMain","no");
  37.138 +	settings.setValue( "/noteeditor/showWithMain",showWithMain());
  37.139  
  37.140  	QString s;
  37.141  	if (actionSettingsFonthintDefault->isOn() )
  37.142  		s="fixed";
  37.143  	else	
  37.144  		s="variable";
  37.145 -	settings.writeEntry( "/vym/noteeditor/fonts/fonthintDefault",s );
  37.146 -	settings.writeEntry ("/vym/noteeditor/fonts/varFont",
  37.147 -		varFont.toString() );
  37.148 -	settings.writeEntry ("/vym/noteeditor/fonts/fixedFont",
  37.149 -		fixedFont.toString() );
  37.150 +	settings.setValue( "/noteeditor/fonts/fonthintDefault",s );
  37.151 +	settings.setValue("/noteeditor/fonts/varFont", varFont.toString() );
  37.152 +	settings.setValue("/noteeditor/fonts/fixedFont", fixedFont.toString() );
  37.153  }
  37.154  
  37.155  bool TextEditor::isEmpty()
  37.156  {
  37.157 -	if (e->text().length())
  37.158 +	if (e->toPlainText().length()>0)
  37.159  		return false;
  37.160  	else
  37.161  		return true;
  37.162 @@ -210,10 +189,9 @@
  37.163  	return filenameHint;
  37.164  }
  37.165  
  37.166 -bool TextEditor::findText(const QString &t, const bool &cs)
  37.167 +bool TextEditor::findText(const QString &t, const QTextDocument::FindFlags &flags)
  37.168  {
  37.169 -	bool wo=false;	// word matches
  37.170 -	if (e->find (t, cs, wo, true, 0, 0 ))
  37.171 +	if (e->find (t,flags))
  37.172  		return true;
  37.173  	else	
  37.174  		return false;
  37.175 @@ -221,229 +199,285 @@
  37.176  
  37.177  void TextEditor::setupFileActions()
  37.178  {
  37.179 -    QToolBar *tb = new QToolBar( this );
  37.180 -    tb->setLabel( "File Actions" );
  37.181 -    QPopupMenu *menu = new QPopupMenu( this );
  37.182 -    menuBar()->insertItem( tr( "&File" ), menu );
  37.183 +    QToolBar *tb = addToolBar ( tr("Note Actions") );
  37.184 +    QMenu *fileMenu = menuBar()->addMenu( tr( "&Note" ));
  37.185  
  37.186      QAction *a;
  37.187 -    a = new QAction( tr( "Import" ), QPixmap( iconPath+"fileopen.png"), tr( "&Import..." ), CTRL + Key_O, this, "fileImport" );
  37.188 +    a = new QAction( QPixmap( iconPath+"fileopen.png"), tr( "&Import..." ),this);
  37.189 +	a->setStatusTip (tr( "Import" ) );
  37.190 +	a->setShortcut( Qt::CTRL + Qt::Key_O );
  37.191      connect( a, SIGNAL( activated() ), this, SLOT( textLoad() ) );
  37.192 -	a->setEnabled(false);
  37.193 -    a->addTo( tb );
  37.194 -    a->addTo( menu );
  37.195 +	tb->addAction (a);
  37.196 +	fileMenu->addAction (a);
  37.197  	actionFileLoad=a;
  37.198  
  37.199 -    menu->insertSeparator();
  37.200 -    a = new QAction( tr( "Export Note (HTML)" ), QPixmap(iconPath+"filesave.png" ), tr( "&Export..." ), CTRL + Key_S, this, "fileSave" );
  37.201 +    fileMenu->addSeparator();
  37.202 +    a = new QAction( QPixmap(iconPath+"filesave.png" ), tr( "&Export..." ),this);
  37.203 +	a->setStatusTip (tr( "Export Note (HTML)" ) );
  37.204 +	a->setShortcut( Qt::CTRL + Qt::Key_S );
  37.205      connect( a, SIGNAL( activated() ), this, SLOT( textSave() ) );
  37.206 -    a->addTo( tb );
  37.207 -    a->addTo( menu );
  37.208 +	tb->addAction (a);
  37.209 +	fileMenu->addAction (a);
  37.210  	actionFileSave=a;
  37.211  	
  37.212 -    a = new QAction( tr( "Export Note As (HTML) " ), QPixmap(), tr( "Export &As... (HTML)" ), 0, this, "exportHTML" );
  37.213 +    a = new QAction(  QPixmap(), tr( "Export &As... (HTML)" ), this);
  37.214 +	a->setStatusTip (tr( "Export Note As (HTML) " ));
  37.215      connect( a, SIGNAL( activated() ), this, SLOT( textSaveAs() ) );
  37.216 -    a->addTo( menu );
  37.217 +	fileMenu->addAction (a);
  37.218  	actionFileSaveAs=a;
  37.219  
  37.220 -    a = new QAction( tr( "Export Note As (ASCII) " ), QPixmap(), tr( "Export &As...(ASCII)" ), ALT + Key_X, this, "exportASCII" );
  37.221 +    a = new QAction(QPixmap(), tr( "Export &As...(ASCII)" ), this);
  37.222 +	a->setStatusTip ( tr( "Export Note As (ASCII) " ) );
  37.223 +	a->setShortcut(Qt::ALT + Qt::Key_X );
  37.224      connect( a, SIGNAL( activated() ), this, SLOT( textExportAsASCII() ) );
  37.225 -    a->addTo( menu );
  37.226 +	fileMenu->addAction (a);
  37.227  	actionFileSaveAs=a;
  37.228  
  37.229 -    menu->insertSeparator();
  37.230 -    a = new QAction( tr( "Print Note" ), QPixmap(iconPath+"fileprint.png" ), tr( "&Print..." ), CTRL + Key_P, this, "filePrint" );
  37.231 +    fileMenu->addSeparator();
  37.232 +    a = new QAction( QPixmap(iconPath+"fileprint.png" ), tr( "&Print..." ),this);
  37.233 +	a->setStatusTip (tr( "Print Note" ) );
  37.234 +	a->setShortcut( Qt::CTRL + Qt::Key_P );
  37.235      connect( a, SIGNAL( activated() ), this, SLOT( textPrint() ) );
  37.236 -    a->addTo( tb );
  37.237 -    a->addTo( menu );
  37.238 +	tb->addAction (a);
  37.239 +	fileMenu->addAction (a);
  37.240  	actionFilePrint=a;
  37.241  }
  37.242  
  37.243  void TextEditor::setupEditActions()
  37.244  {
  37.245 -    QToolBar *tb = new QToolBar( this );
  37.246 -    tb->setLabel( "Edit Actions" );
  37.247 -    QPopupMenu *menu = new QPopupMenu( this );
  37.248 -    menuBar()->insertItem( tr( "&Edit" ), menu );
  37.249 +    QToolBar *tb = addToolBar ( tr( "Edit Actions" ));
  37.250 +    QMenu *editMenu = menuBar()->addMenu ( tr( "&Edit" ));
  37.251  
  37.252      QAction *a;
  37.253 -    a = new QAction( tr( "Undo" ), QPixmap(iconPath+"undo.png"), tr( "&Undo" ), CTRL + Key_Z, this, "undoEvent" );
  37.254 +    a = new QAction(QPixmap(iconPath+"undo.png"), tr( "&Undo" ), this );
  37.255 +	a->setStatusTip ( tr( "Undo" ) );
  37.256 +	a->setShortcut(Qt::CTRL + Qt::Key_Z );
  37.257      connect( a, SIGNAL( activated() ), e, SLOT( undo() ) );
  37.258 -    a->addTo( menu );
  37.259 -    a->addTo( tb);
  37.260 +	editMenu->addAction (a);
  37.261 +	tb->addAction (a);
  37.262  	actionEditUndo=a;
  37.263  	
  37.264 -    a = new QAction( tr( "Redo" ), QPixmap(iconPath+"redo.png" ), tr( "&Redo" ), CTRL + Key_Y, this, "editRedo" ); 
  37.265 +    a = new QAction(QPixmap(iconPath+"redo.png" ), tr( "&Redo" ),this); 
  37.266 +	a->setStatusTip ( tr( "Redo" ) );
  37.267 +	a->setShortcut( Qt::CTRL + Qt::Key_Y );
  37.268      connect( a, SIGNAL( activated() ), e, SLOT( redo() ) );
  37.269 -    a->addTo( tb );
  37.270 -    a->addTo( menu );
  37.271 +	editMenu->addAction (a);
  37.272 +	tb->addAction (a);
  37.273  	actionEditRedo=a;
  37.274  
  37.275 -    menu->insertSeparator();
  37.276 -    a = new QAction( tr( "Select and copy all" ), QPixmap(), tr( "Select and copy &all" ), CTRL + Key_A, this, "editcopyall" ); 
  37.277 +    editMenu->addSeparator();
  37.278 +    a = new QAction(QPixmap(), tr( "Select and copy &all" ),this); 
  37.279 +	a->setStatusTip ( tr( "Select and copy all" ) );
  37.280 +	a->setShortcut( Qt::CTRL + Qt::Key_A );
  37.281      connect( a, SIGNAL( activated() ), this, SLOT( editCopyAll() ) );
  37.282 -    a->addTo( menu );
  37.283 +	editMenu->addAction (a);
  37.284  
  37.285 -    menu->insertSeparator();
  37.286 -    a = new QAction( tr( "Copy" ), QPixmap(iconPath+"editcopy.png" ), tr( "&Copy" ), CTRL + Key_C, this, "editCopy" );
  37.287 +    editMenu->addSeparator();
  37.288 +    a = new QAction(QPixmap(iconPath+"editcopy.png" ), tr( "&Copy" ),this);
  37.289 +	a->setStatusTip ( tr( "Copy" ) );
  37.290 +	a->setShortcut( Qt::CTRL + Qt::Key_C );
  37.291      connect( a, SIGNAL( activated() ), e, SLOT( copy() ) );
  37.292 -    a->addTo( tb );
  37.293 -    a->addTo( menu );
  37.294 +	editMenu->addAction (a);
  37.295 +	tb->addAction (a);
  37.296  	actionEditCopy=a;
  37.297  	
  37.298 -    a = new QAction( tr( "Cut" ), QPixmap(iconPath+"editcut.png" ), tr( "Cu&t" ), CTRL + Key_X, this, "editCut" );
  37.299 +    a = new QAction(QPixmap(iconPath+"editcut.png" ), tr( "Cu&t" ),this);
  37.300 +	a->setStatusTip ( tr( "Cut" ) );
  37.301 +	a->setShortcut( Qt::CTRL + Qt::Key_X );
  37.302      connect( a, SIGNAL( activated() ), e, SLOT( cut() ) );
  37.303 -    a->addTo( tb );
  37.304 -    a->addTo( menu );
  37.305 +	editMenu->addAction (a);
  37.306 +	tb->addAction (a);
  37.307  	actionEditCut=a;
  37.308  
  37.309 -    a = new QAction( tr( "Paste" ), QPixmap(iconPath+"editpaste.png" ), tr( "&Paste" ), CTRL + Key_V, this, "editPaste" );
  37.310 +    a = new QAction(QPixmap(iconPath+"editpaste.png" ), tr( "&Paste" ),this);
  37.311 +	a->setStatusTip ( tr( "Paste" ) );
  37.312 +	a->setShortcut( Qt::CTRL + Qt::Key_V );
  37.313      connect( a, SIGNAL( activated() ), e, SLOT( paste() ) );
  37.314 -    a->addTo( tb );
  37.315 -    a->addTo( menu );
  37.316 +	editMenu->addAction (a);
  37.317 +	tb->addAction (a);
  37.318  	actionEditPaste=a;
  37.319  	
  37.320 -    a = new QAction( tr( "Delete all" ), QPixmap( iconPath+"edittrash.png"), tr( "&Delete All" ), 0, this, "editDeleteAll" );
  37.321 +    a = new QAction( QPixmap( iconPath+"edittrash.png"), tr( "&Delete All" ), this);
  37.322 +	a->setStatusTip (tr( "Delete all" ) );
  37.323      connect( a, SIGNAL( activated() ), e, SLOT( clear() ) );
  37.324 -    a->addTo( tb );
  37.325 -    a->addTo( menu );
  37.326 +	editMenu->addAction (a);
  37.327 +	tb->addAction (a);
  37.328  	actionEditDeleteAll=a;
  37.329  
  37.330 -	a = new QAction( tr( "Convert paragraphs to linebreaks" ), QPixmap(), tr( "&Convert Paragraphs" ), ALT + Key_P, this, "editConvertPar" );
  37.331 +	a = new QAction(QPixmap(), tr( "&Convert Paragraphs" ),this);
  37.332 +	/* TODO not needed any longer? remove also from docu...
  37.333 +	a->setStatusTip(tr( "Convert paragraphs to linebreaks" )); 
  37.334 +	a->setShortcut( Qt::ALT + Qt::Key_P );
  37.335      connect( a, SIGNAL( activated() ), this, SLOT( textConvertPar() ) );
  37.336 -    a->addTo( menu );
  37.337 +	editMenu->addAction (a);
  37.338 +	*/
  37.339  	actionEditConvertPar=a;
  37.340  
  37.341 -	a = new QAction( tr( "Join all lines of a paragraph" ), QPixmap(), tr( "&Join lines" ), ALT + Key_J, this, "editJoinLines" );
  37.342 +	a = new QAction( QPixmap(), tr( "&Join lines" ), this);
  37.343 +	/* TODO not needed any longer? remove also from docu...
  37.344 +	a->setStatusTip(tr( "Join all lines of a paragraph" ) ); 
  37.345 +	a->setShortcut(Qt::ALT + Qt::Key_J );
  37.346      connect( a, SIGNAL( activated() ), this, SLOT( textJoinLines() ) );
  37.347 -    a->addTo( menu );
  37.348 +	editMenu->addAction (a);
  37.349 +	*/
  37.350  	actionEditJoinLines=a;
  37.351  }
  37.352  
  37.353  void TextEditor::setupFormatActions()
  37.354  {
  37.355 -    QToolBar *tb = new QToolBar( this );
  37.356 -    tb->setLabel( "Format Actions" );
  37.357 -    QPopupMenu *menu = new QPopupMenu( this );
  37.358 -    menuBar()->insertItem( tr( "F&ormat" ), menu );
  37.359 +    QToolBar *tb = addToolBar ( tr("Format Actions" ));
  37.360 +    QMenu *formatMenu = menuBar()->addMenu ( tr( "F&ormat" ));
  37.361  
  37.362      QAction *a;
  37.363  
  37.364 -    a = new QAction( tr( "Toggle font hint for the whole text" ), QPixmap(iconPath+"formatfixedfont.png"), tr( "&Font hint" ), ALT + Key_I, this, "fontHint" );
  37.365 +    a = new QAction( QPixmap(iconPath+"formatfixedfont.png"), tr( "&Font hint" ), Qt::ALT + Qt::Key_I, this, "fontHint" );
  37.366 +	a->setStatusTip (tr( "Toggle font hint for the whole text" ) );
  37.367  	a->setToggleAction (true);
  37.368 -	a->setOn (settings.readBoolEntry ("/vym/noteeditor/fonts/useFixedByDefault",false) );
  37.369 +	a->setOn (settings.value("/noteeditor/fonts/useFixedByDefault",false).toBool() );
  37.370      connect( a, SIGNAL( activated() ), this, SLOT( toggleFonthint() ) );
  37.371 -    a->addTo( menu );
  37.372 -    a->addTo( tb );
  37.373 +	formatMenu->addAction (a);
  37.374 +	tb->addAction (a);
  37.375  	actionFormatUseFixedFont=a;
  37.376  
  37.377 -	menu->insertSeparator();
  37.378 -
  37.379 -    comboFont = new QComboBox( true, tb );
  37.380 -    QFontDatabase db;
  37.381 -    comboFont->insertStringList( db.families() );
  37.382 +//    comboFont = new QComboBox( true, tb );
  37.383 +    comboFont = new QComboBox;
  37.384 +	tb->addWidget (comboFont);
  37.385 +    QFontDatabase fontDB;
  37.386 +    comboFont->insertStringList( fontDB.families() );
  37.387      connect( comboFont, SIGNAL( activated( const QString & ) ),
  37.388  	     this, SLOT( textFamily( const QString & ) ) );
  37.389 -    comboFont->lineEdit()->setText( QApplication::font().family() );
  37.390 -
  37.391 -    comboSize = new QComboBox( true, tb );
  37.392 -    QValueList<int> sizes = db.standardSizes();
  37.393 -    QValueList<int>::Iterator it = sizes.begin();
  37.394 -    for ( ; it != sizes.end(); ++it )
  37.395 -	comboSize->insertItem( QString::number( *it ) );
  37.396 +    comboFont->addItem( QApplication::font().family() );
  37.397 +    comboSize = new QComboBox;
  37.398 +	tb->addWidget (comboSize);
  37.399 +	QList<int> sizes=fontDB.standardSizes();
  37.400 +	QList<int>::iterator i = sizes.begin();
  37.401 +	while (i != sizes.end()) 
  37.402 +	{
  37.403 +		++i; // increment i before using it
  37.404 +		comboSize->insertItem ( QString::number(*i));
  37.405 +	}	
  37.406      connect( comboSize, SIGNAL( activated( const QString & ) ),
  37.407  	     this, SLOT( textSize( const QString & ) ) );
  37.408 -    comboSize->lineEdit()->setText( QString::number( QApplication::font().pointSize() ) );
  37.409 +    comboSize->addItem ( QString::number( QApplication::font().pointSize() ) );
  37.410  
  37.411 -    menu->insertSeparator();
  37.412 +    formatMenu->addSeparator();
  37.413  
  37.414      QPixmap pix( 16, 16 );
  37.415      pix.fill( e->color());
  37.416 -    actionTextColor = new QAction( pix, tr( "&Color..." ), 0, this, "textColor" );
  37.417 -    connect( actionTextColor, SIGNAL( activated() ), this, SLOT( textColor() ) );
  37.418 -    actionTextColor->addTo( tb );
  37.419 -    actionTextColor->addTo( menu );
  37.420 +    a = new QAction( pix, tr( "&Color..." ), this);
  37.421 +	formatMenu->addAction (a);
  37.422 +	tb->addAction (a);
  37.423 +    connect( a, SIGNAL( activated() ), this, SLOT( textColor() ) );
  37.424 +    actionTextColor=a;
  37.425  
  37.426 -    actionTextBold = new QAction( QPixmap (iconPath+"text_bold.png"), tr( "&Bold" ), CTRL + Key_B, this, "textBold" );
  37.427 -    connect( actionTextBold, SIGNAL( activated() ), this, SLOT( textBold() ) );
  37.428 -    actionTextBold->addTo( tb );
  37.429 -    actionTextBold->addTo( menu );
  37.430 -    actionTextBold->setToggleAction( true );
  37.431 -    actionTextItalic = new QAction( QPixmap(iconPath+"text_italic.png"), tr( "&Italic" ), CTRL + Key_I, this, "textItalic" );
  37.432 -    connect( actionTextItalic, SIGNAL( activated() ), this, SLOT( textItalic() ) );
  37.433 -    actionTextItalic->addTo( tb );
  37.434 -    actionTextItalic->addTo( menu );
  37.435 -    actionTextItalic->setToggleAction( true );
  37.436 -    actionTextUnderline = new QAction( QPixmap (iconPath+"text_under.png"), tr( "&Underline" ), CTRL + Key_U, this, "textUnderline" );
  37.437 -    connect( actionTextUnderline, SIGNAL( activated() ), this, SLOT( textUnderline() ) );
  37.438 -    actionTextUnderline->addTo( tb );
  37.439 -    actionTextUnderline->addTo( menu );
  37.440 -    actionTextUnderline->setToggleAction( true );
  37.441 -    menu->insertSeparator();
  37.442 +    a = new QAction( QPixmap (iconPath+"text_bold.png"), tr( "&Bold" ), this);
  37.443 +	a->setShortcut(Qt::CTRL + Qt::Key_B );
  37.444 +    connect( a, SIGNAL( activated() ), this, SLOT( textBold() ) );
  37.445 +	tb->addAction (a);
  37.446 +	formatMenu->addAction (a);
  37.447 +    a->setToggleAction( true );
  37.448 +    actionTextBold=a;
  37.449 +	
  37.450 +    a = new QAction( QPixmap(iconPath+"text_italic.png"), tr( "&Italic" ),  this);
  37.451 +	a->setShortcut(Qt::CTRL + Qt::Key_I);
  37.452 +    connect( a, SIGNAL( activated() ), this, SLOT( textItalic() ) );
  37.453 +	tb->addAction (a);
  37.454 +	formatMenu->addAction (a);
  37.455 +    a->setToggleAction( true );
  37.456 +    actionTextItalic=a;
  37.457 +	
  37.458 +    a = new QAction( QPixmap (iconPath+"text_under.png"), tr( "&Underline" ), this);
  37.459 +	a->setShortcut(Qt::CTRL + Qt::Key_U );
  37.460 +    connect( a, SIGNAL( activated() ), this, SLOT( textUnderline() ) );
  37.461 +	tb->addAction (a);
  37.462 +	formatMenu->addAction (a);
  37.463 +    a->setToggleAction( true );
  37.464 +    actionTextUnderline=a;
  37.465 +    formatMenu->addSeparator();
  37.466  
  37.467      QActionGroup *grp = new QActionGroup( this );
  37.468      connect( grp, SIGNAL( selected( QAction* ) ), this, SLOT( textAlign( QAction* ) ) );
  37.469  
  37.470 -    actionAlignLeft = new QAction( QPixmap (iconPath+"text_left.png"), tr( "&Left" ), CTRL + Key_L, grp, "textLeft" );
  37.471 -    actionAlignLeft->setToggleAction( true );
  37.472 -    actionAlignCenter = new QAction( QPixmap (iconPath+"text_center.png"), tr( "C&enter" ), CTRL + Key_E, grp, "textCenter" );
  37.473 -    actionAlignCenter->setToggleAction( true );
  37.474 -    actionAlignRight = new QAction( QPixmap (iconPath+"text_right.png" ), tr( "&Right" ), CTRL + Key_R, grp, "textRight" );
  37.475 -    actionAlignRight->setToggleAction( true );
  37.476 -    actionAlignJustify = new QAction( QPixmap ( iconPath+"text_block.png"), tr( "&Justify" ), CTRL + Key_J, grp, "textjustify" );
  37.477 -    actionAlignJustify->setToggleAction( true );
  37.478 -
  37.479 -    grp->addTo( tb );
  37.480 -    grp->addTo( menu );
  37.481 +    a = new QAction( QPixmap (iconPath+"text_left.png"), tr( "&Left" ),grp );
  37.482 +	a->setShortcut( Qt::CTRL+Qt::Key_L );
  37.483 +    a->setToggleAction( true );
  37.484 +	tb->addAction (a);
  37.485 +	formatMenu->addAction (a);
  37.486 +    actionAlignLeft=a;
  37.487 +    a = new QAction( QPixmap (iconPath+"text_center.png"), tr( "C&enter" ),grp);
  37.488 +    a->setShortcut(  Qt::CTRL + Qt::Key_E);
  37.489 +    a->setToggleAction( true );
  37.490 +	tb->addAction (a);
  37.491 +	formatMenu->addAction (a);
  37.492 +    actionAlignCenter=a;
  37.493 +    a = new QAction( QPixmap (iconPath+"text_right.png" ), tr( "&Right" ), grp);
  37.494 +	a->setShortcut(Qt::CTRL + Qt::Key_R );
  37.495 +    a->setToggleAction( true );
  37.496 +	tb->addAction (a);
  37.497 +	formatMenu->addAction (a);
  37.498 +    actionAlignRight=a;
  37.499 +    a = new QAction( QPixmap ( iconPath+"text_block.png"), tr( "&Justify" ), grp );
  37.500 +	a->setShortcut(Qt::CTRL + Qt::Key_J );
  37.501 +    a->setToggleAction( true );
  37.502 +	tb->addAction (a);
  37.503 +	formatMenu->addAction (a);
  37.504 +    actionAlignJustify=a;
  37.505  
  37.506      QActionGroup *grp2 = new QActionGroup( this );
  37.507 -    grp2->setExclusive(false);
  37.508 -    actionAlignSubScript = new QAction( QPixmap (iconPath+"text_sub.png"), tr( "Subs&cript" ), CTRL + SHIFT + Key_B, grp2, "textSubscript" );
  37.509 +    grp2->setExclusive(true);
  37.510 +    a = new QAction( QPixmap (iconPath+"text_sub.png"), tr( "Subs&cript" ),grp2 );
  37.511 +	a->setShortcut( Qt::CTRL + Qt::SHIFT + Qt::Key_B );
  37.512 +    a->setToggleAction( true );
  37.513 +	tb->addAction (a);
  37.514 +	formatMenu->addAction (a);
  37.515 +    connect(a, SIGNAL(activated()), this, SLOT(textVAlign()));
  37.516 +    actionAlignSubScript=a;
  37.517  
  37.518 -    actionAlignSubScript->setToggleAction( true );
  37.519 -    connect(actionAlignSubScript, SIGNAL(activated()), this, SLOT(textVAlign()));
  37.520 +    a = new QAction( QPixmap (iconPath+"text_super.png"), tr( "Su&perscript" ),grp2  );
  37.521 +	a->setShortcut( Qt::CTRL + Qt::SHIFT + Qt::Key_P );
  37.522 +    a->setToggleAction( true );
  37.523 +	tb->addAction (a);
  37.524 +	formatMenu->addAction (a);
  37.525 +    connect(a, SIGNAL(activated()), this, SLOT(textVAlign()));
  37.526 +    actionAlignSuperScript=a;
  37.527  
  37.528 -    actionAlignSuperScript = new QAction( QPixmap (iconPath+"text_super.png"), tr( "Su&perscript" ), CTRL + SHIFT + Key_P, grp2, "textSuperscript" );
  37.529 -
  37.530 -    actionAlignSuperScript->setToggleAction( true );
  37.531 -    connect(actionAlignSuperScript, SIGNAL(activated()), this, SLOT(textVAlign()));
  37.532 -
  37.533 -    menu->insertSeparator();
  37.534 +    formatMenu->addSeparator();
  37.535      
  37.536 -    grp2->addTo(tb);
  37.537 -    grp2->addTo(menu);
  37.538 -
  37.539      connect( e, SIGNAL( currentFontChanged( const QFont & ) ),
  37.540  	     this, SLOT( fontChanged( const QFont & ) ) );
  37.541      connect( e, SIGNAL( currentColorChanged( const QColor & ) ),
  37.542  	     this, SLOT( colorChanged( const QColor & ) ) );
  37.543 +		 /*
  37.544      connect( e, SIGNAL( currentAlignmentChanged( int ) ),
  37.545  	     this, SLOT( alignmentChanged( int ) ) );
  37.546      connect( e, SIGNAL( currentVerticalAlignmentChanged(int)),
  37.547  	     this, SLOT( verticalAlignmentChanged(int)));
  37.548 +		 */
  37.549  
  37.550  }
  37.551  
  37.552  void TextEditor::setupSettingsActions()
  37.553  {
  37.554 -    QPopupMenu *menu = new QPopupMenu( this );
  37.555 -    menuBar()->insertItem( tr( "&Settings" ), menu );
  37.556 +    QMenu *settingsMenu = menuBar()->addMenu ( tr( "&Settings" ));
  37.557  
  37.558      QAction *a;
  37.559 -    a = new QAction( tr( "Set fixed font" ), QPixmap(), tr( "Set &fixed font" ), 0, this, "setFixedFont" );
  37.560 +    a = new QAction(tr( "Set &fixed font" ), this);
  37.561 +	a->setStatusTip ( tr( "Set fixed font" ));
  37.562      connect( a, SIGNAL( activated() ), this, SLOT( setFixedFont() ) );
  37.563 -    a->addTo( menu );
  37.564 +	settingsMenu->addAction (a);
  37.565  	actionSettingsFixedFont=a;
  37.566  
  37.567 -    a = new QAction( tr( "Set variable font" ), QPixmap(), tr( "Set &variable font" ), 0, this, "setvariableFont" );
  37.568 +    a = new QAction(tr( "Set &variable font" ), this);
  37.569 +	a->setStatusTip ( tr( "Set variable font" ) );
  37.570      connect( a, SIGNAL( activated() ), this, SLOT( setVarFont() ) );
  37.571 -    a->addTo( menu );
  37.572 +	settingsMenu->addAction (a);
  37.573  	actionSettingsVarFont=a;
  37.574  
  37.575 -    a = new QAction( tr( "Used fixed font by default" ), QPixmap(), tr( "&fixed font is default" ), 0, this, "fonthintDefault" );
  37.576 +    a = new QAction(tr( "&fixed font is default" ),  this);
  37.577 +	a->setStatusTip (tr( "Used fixed font by default" ) );
  37.578  	a->setToggleAction (true);
  37.579  	// set state later in constructor...
  37.580 -    a->addTo( menu );
  37.581 +	settingsMenu->addAction (a);
  37.582  	actionSettingsFonthintDefault=a;
  37.583  }
  37.584  
  37.585 @@ -451,7 +485,7 @@
  37.586  {
  37.587  	if (state!=inactiveEditor)
  37.588  	{
  37.589 -		if (e->length()) 
  37.590 +		if (e->text().length()) 
  37.591  		{
  37.592  			QMessageBox mb( __VYM " - " +tr("Note Editor"),
  37.593  				"Loading will overwrite the existing note",
  37.594 @@ -468,8 +502,12 @@
  37.595  		} 
  37.596  		// Load note
  37.597  		QFileDialog *fd=new QFileDialog( this);
  37.598 -		fd->addFilter ("ASCII texts (*.txt)");
  37.599 -		fd->addFilter ("VYM notes (*.html)");
  37.600 +		QStringList types;
  37.601 +		types<< "VYM notes (*.html)" <<
  37.602 +			"ASCII texts (*.txt)" <<
  37.603 +			"All filed (*)";
  37.604 +		fd->setFilters (types);
  37.605 +		fd->setDirectory (QDir().current());
  37.606  		fd->show();
  37.607  		QString fn;
  37.608  		if ( fd->exec() == QDialog::Accepted )
  37.609 @@ -478,7 +516,7 @@
  37.610  		if ( !fn.isEmpty() )
  37.611  		{
  37.612  			QFile f( fn );
  37.613 -			if ( !f.open( IO_ReadOnly ) )
  37.614 +			if ( !f.open( QIODevice::ReadOnly ) )
  37.615  			return;
  37.616  
  37.617  			QTextStream ts( &f );
  37.618 @@ -498,7 +536,10 @@
  37.619  
  37.620  QString TextEditor::getText()
  37.621  {
  37.622 -	return e->text();
  37.623 +	if (e->toPlainText().isEmpty())
  37.624 +		return "";
  37.625 +	else	
  37.626 +		return e->text();
  37.627  }
  37.628  
  37.629  void TextEditor::editorChanged()
  37.630 @@ -509,9 +550,9 @@
  37.631  		state=filledEditor;
  37.632  
  37.633  		if (state==emptyEditor)
  37.634 -			e->setPaper (emptyPaper);
  37.635 +			setState (emptyEditor);
  37.636  		else
  37.637 -			e->setPaper (filledPaper);
  37.638 +			setState (filledEditor);
  37.639  	// SLOT is LinkableMapObj, which will update systemFlag
  37.640  	emit (textHasChanged() );
  37.641  }
  37.642 @@ -519,12 +560,8 @@
  37.643  
  37.644  void TextEditor::setText(QString t)
  37.645  {
  37.646 -	if ( !QStyleSheet::mightBeRichText( t ) )
  37.647 -		t = QStyleSheet::convertFromPlainText( t, QStyleSheetItem::WhiteSpaceNormal );
  37.648  	e->setReadOnly(false);
  37.649  	e->setText(t);
  37.650 -//	editorChanged();	//not called automagically  FIXME or is it?
  37.651 -
  37.652  	enableActions();
  37.653  }
  37.654  
  37.655 @@ -532,7 +569,7 @@
  37.656  {
  37.657  	state=inactiveEditor;
  37.658  	setText("");
  37.659 -	e->setPaper (inactivePaper);
  37.660 +	setState (inactiveEditor);
  37.661  	e->setReadOnly (true);
  37.662  
  37.663  	disableActions();
  37.664 @@ -561,7 +598,7 @@
  37.665  			QMessageBox::Warning,
  37.666  			QMessageBox::Yes | QMessageBox::Default,
  37.667  			QMessageBox::Cancel | QMessageBox::Escape,
  37.668 -			QMessageBox::NoButton );
  37.669 +			Qt::NoButton );
  37.670  			mb.setButtonText( QMessageBox::Yes, tr("Overwrite") );
  37.671  			mb.setButtonText( QMessageBox::No, tr("Cancel"));
  37.672  			switch( mb.exec() ) {
  37.673 @@ -595,7 +632,7 @@
  37.674  
  37.675      QString text = e->text();
  37.676      QFile f( filename );
  37.677 -    if ( !f.open( IO_WriteOnly ) ) 
  37.678 +    if ( !f.open( QIODevice::WriteOnly ) ) 
  37.679  	{
  37.680  		statusBar()->message( QString("Could not write to %1").arg(filename),
  37.681  					  statusbarTime );
  37.682 @@ -616,9 +653,18 @@
  37.683  	// In X11 a copy&paste generates paragraphs, 
  37.684  	// which is not always wanted
  37.685  	// This function replaces paragraphs by linebreaks.
  37.686 +
  37.687 +	QString t;
  37.688 +	t=e->text();
  37.689 +	QRegExp re("<p.*>");
  37.690 +	re.setMinimal(true);
  37.691 +	t.replace (re,"");
  37.692 +	t.replace ("</p>","<br />");
  37.693 +	e->setText(t);
  37.694 +
  37.695 +	/* TODO QT3 use seletion ()
  37.696  	int parFrom, parTo, indFrom, indTo;
  37.697  	e->getSelection (&parFrom,&indFrom,&parTo,&indTo);
  37.698 -	QString t;
  37.699  	if (parFrom>-1)
  37.700  		t=e->selectedText();
  37.701  	else
  37.702 @@ -641,10 +687,12 @@
  37.703  		e->setText (e->text().replace(marker,t));
  37.704  	} else
  37.705  		e->setText(t);
  37.706 +	*/	
  37.707  }
  37.708  
  37.709  void TextEditor::textJoinLines()
  37.710  {
  37.711 +/* TODO  QT3
  37.712  	int parFrom, parTo, indFrom, indTo;
  37.713  	e->getSelection (&parFrom,&indFrom,&parTo,&indTo);
  37.714  	QString t;
  37.715 @@ -675,6 +723,7 @@
  37.716  		e->setText (e->text().replace(marker,t));
  37.717  	} else
  37.718  		e->setText(t);
  37.719 +*/		
  37.720  }
  37.721  
  37.722  void TextEditor::textExportAsASCII()
  37.723 @@ -704,7 +753,7 @@
  37.724  			QMessageBox::Warning,
  37.725  			QMessageBox::Yes | QMessageBox::Default,
  37.726  			QMessageBox::Cancel | QMessageBox::Escape,
  37.727 -			QMessageBox::NoButton );
  37.728 +			Qt::NoButton );
  37.729  			mb.setButtonText( QMessageBox::Yes, tr("Overwrite") );
  37.730  			mb.setButtonText( QMessageBox::No, tr("Cancel"));
  37.731  			ret=mb.exec();
  37.732 @@ -713,7 +762,7 @@
  37.733  			return;
  37.734  			
  37.735  		// save 
  37.736 -		if ( !file.open( IO_WriteOnly ) ) 
  37.737 +		if ( !file.open( QIODevice::WriteOnly ) ) 
  37.738  			statusBar()->message( QString("Could not write to %1").arg(filename),
  37.739  						  statusbarTime );
  37.740  		else
  37.741 @@ -730,41 +779,16 @@
  37.742  
  37.743  void TextEditor::textPrint()
  37.744  {
  37.745 -    printer->setFullPage(TRUE);
  37.746 -    if ( printer->setup( this ) ) 
  37.747 -	{
  37.748 -		QPainter p( printer );
  37.749 -		// Check that there is a valid device to print to.
  37.750 -		if ( !p.device() ) return;
  37.751 -		QPaintDeviceMetrics metrics( p.device() );
  37.752 -		int dpiy = metrics.logicalDpiY();
  37.753 -		int margin = (int) ( (2/2.54)*dpiy ); // 2 cm margins
  37.754 -		QRect body( margin, margin, metrics.width() - 2*margin, metrics.height() - 2*margin );
  37.755 -		QFont font( e->currentFont() );
  37.756 -		font.setPointSize( 10 ); // we define 10pt to be a nice base size for printing
  37.757  
  37.758 -		QSimpleRichText richText( e->text(), font,
  37.759 -					  e->context(),
  37.760 -					  e->styleSheet(),
  37.761 -					  e->mimeSourceFactory(),
  37.762 -					  body.height() );
  37.763 -		richText.setWidth( &p, body.width() );
  37.764 -		QRect view( body );
  37.765 -		int page = 1;
  37.766 -		do 
  37.767 -		{
  37.768 -			richText.draw( &p, body.left(), body.top(), view, colorGroup() );
  37.769 -			view.moveBy( 0, body.height() );
  37.770 -			p.translate( 0 , -body.height() );
  37.771 -			p.setFont( font );
  37.772 -			p.drawText( view.right() - p.fontMetrics().width( QString::number( page ) ),
  37.773 -				view.bottom() + p.fontMetrics().ascent() + 5, QString::number( page ) );
  37.774 -			if ( view.top()  >= richText.height() )
  37.775 -			break;
  37.776 -			printer->newPage();
  37.777 -			page++;
  37.778 -		} while (TRUE);
  37.779 -    }
  37.780 +    QTextDocument *document = e->document();
  37.781 +    QPrinter printer;
  37.782 +
  37.783 +    QPrintDialog *dialog = new QPrintDialog(&printer, this);
  37.784 +    dialog->setWindowTitle(tr("Print Document"));
  37.785 +    if (dialog->exec() != QDialog::Accepted)
  37.786 +        return;
  37.787 +
  37.788 +    document->print(&printer);
  37.789  }
  37.790  
  37.791  void TextEditor::textEditUndo()
  37.792 @@ -774,12 +798,12 @@
  37.793  void TextEditor::toggleFonthint()
  37.794  {
  37.795  	setUpdatesEnabled (false);
  37.796 -	e->selectAll (true);
  37.797 +	e->selectAll ();
  37.798  	if (!actionFormatUseFixedFont->isOn() ) 
  37.799  		e->setCurrentFont (varFont);
  37.800  	else	
  37.801  		e->setCurrentFont (fixedFont);
  37.802 -	e->selectAll (false);
  37.803 +	e->selectAll ();
  37.804  	setUpdatesEnabled (true);
  37.805  	repaint();
  37.806  }
  37.807 @@ -837,24 +861,25 @@
  37.808  	return;
  37.809      e->setColor( col );
  37.810      QPixmap pix( 16, 16 );
  37.811 -    pix.fill( black );
  37.812 +    pix.fill( Qt::black );
  37.813      actionTextColor->setIconSet( pix );
  37.814  }
  37.815  
  37.816  void TextEditor::textAlign( QAction *a )
  37.817  {
  37.818      if ( a == actionAlignLeft )
  37.819 -	e->setAlignment( AlignLeft );
  37.820 +	e->setAlignment( Qt::AlignLeft );
  37.821      else if ( a == actionAlignCenter )
  37.822 -	e->setAlignment( AlignHCenter );
  37.823 +	e->setAlignment( Qt::AlignHCenter );
  37.824      else if ( a == actionAlignRight )
  37.825 -	e->setAlignment( AlignRight );
  37.826 +	e->setAlignment( Qt::AlignRight );
  37.827      else if ( a == actionAlignJustify )
  37.828 -	e->setAlignment( AlignJustify );
  37.829 +	e->setAlignment( Qt::AlignJustify );
  37.830  }
  37.831  
  37.832  void TextEditor::textVAlign()
  37.833  {
  37.834 +/* FIXME QT3 alignment
  37.835      if ( sender() == actionAlignSuperScript && actionAlignSuperScript->isOn()) {
  37.836  	e->setVerticalAlignment( QTextEdit::AlignSuperScript);
  37.837      } else if (sender() == actionAlignSubScript && actionAlignSubScript->isOn()) {
  37.838 @@ -862,13 +887,16 @@
  37.839      } else {
  37.840  	e->setVerticalAlignment( QTextEdit::AlignNormal);
  37.841      }
  37.842 +*/	
  37.843  }
  37.844  
  37.845  
  37.846  void TextEditor::fontChanged( const QFont &f )
  37.847  {
  37.848 +/*
  37.849      comboFont->lineEdit()->setText( f.family() );
  37.850      comboSize->lineEdit()->setText( QString::number( f.pointSize() ) );
  37.851 +*/	
  37.852      actionTextBold->setOn( f.bold() );
  37.853      actionTextItalic->setOn( f.italic() );
  37.854      actionTextUnderline->setOn( f.underline() );
  37.855 @@ -883,18 +911,19 @@
  37.856  
  37.857  void TextEditor::alignmentChanged( int a )
  37.858  {
  37.859 -    if ( ( a == AlignAuto ) || ( a & AlignLeft ))
  37.860 +    if ( ( a == Qt::AlignLeft ) || ( a & Qt::AlignLeft ))
  37.861  	actionAlignLeft->setOn( true );
  37.862 -    else if ( ( a & AlignHCenter ) )
  37.863 +    else if ( ( a & Qt::AlignHCenter ) )
  37.864  	actionAlignCenter->setOn( true );
  37.865 -    else if ( ( a & AlignRight ) )
  37.866 +    else if ( ( a & Qt::AlignRight ) )
  37.867  	actionAlignRight->setOn( true );
  37.868 -    else if ( ( a & AlignJustify ) )
  37.869 +    else if ( ( a & Qt::AlignJustify ) )
  37.870  	actionAlignJustify->setOn( true );
  37.871  }
  37.872  
  37.873  void TextEditor::verticalAlignmentChanged(int a) 
  37.874  {
  37.875 +	/* FIXME QT3 alignment
  37.876      if (a == QTextEdit::AlignSuperScript ) {
  37.877  	actionAlignSuperScript->setOn(true);
  37.878  	actionAlignSubScript->setOn(false);
  37.879 @@ -905,6 +934,7 @@
  37.880  	actionAlignSuperScript->setOn(false);
  37.881  	actionAlignSubScript->setOn(false);
  37.882      }
  37.883 +	*/
  37.884  }
  37.885  
  37.886  
  37.887 @@ -943,4 +973,20 @@
  37.888  	actionFormatUseFixedFont->setEnabled(false);
  37.889  }
  37.890  
  37.891 +void TextEditor::setState (EditorState s)
  37.892 +{
  37.893 +	
  37.894 +	QPalette p=palette();
  37.895 +	QColor c;
  37.896 +	switch (s)
  37.897 +	{
  37.898 +		case emptyEditor:    c=QColor (150,150,150); break;
  37.899 +		case filledEditor:   c=QColor (255,255,255); break;
  37.900 +		case inactiveEditor: c=QColor (0,0,0);
  37.901 +	}
  37.902 +    p.setColor(QPalette::Active, static_cast<QPalette::ColorRole>(9), c);
  37.903 +    p.setColor(QPalette::Inactive, static_cast<QPalette::ColorRole>(9), c);
  37.904 +    e->setPalette(p);
  37.905 +}
  37.906  
  37.907 +
    38.1 --- a/texteditor.h	Tue Sep 05 09:47:13 2006 +0000
    38.2 +++ b/texteditor.h	Tue Sep 05 09:47:14 2006 +0000
    38.3 @@ -1,12 +1,11 @@
    38.4 -/* emacs: -*- Mode: C; c-style: "bsd"; c-basic-offset: 4; c-recognize-knr-p: nil; -*- */
    38.5  #ifndef TEXTEDITOR_H 
    38.6  #define TEXTEDITOR_H
    38.7  
    38.8 -#include <qmainwindow.h>
    38.9 -#include <qtextedit.h>
   38.10 -#include <qaction.h>
   38.11 -#include <qfontdatabase.h>
   38.12 -#include <qcombobox.h>
   38.13 +#include <QtGui>
   38.14 +#include <QTextEdit>
   38.15 +#include <QFontDatabase>
   38.16 +#include <QComboBox>
   38.17 +#include <QCloseEvent>
   38.18  
   38.19  
   38.20  enum EditorState {inactiveEditor,emptyEditor,filledEditor};
   38.21 @@ -29,7 +28,7 @@
   38.22  	QString getFilename ();
   38.23  	void setFilenameHint (const QString&);
   38.24  	QString getFilenameHint ();
   38.25 -	bool findText(const QString &, const bool &); // find Text 
   38.26 +	bool findText(const QString &, const QTextDocument::FindFlags &); // find Text 
   38.27  
   38.28  protected:
   38.29  	void setupFileActions();
   38.30 @@ -79,6 +78,7 @@
   38.31      void verticalAlignmentChanged(int a);
   38.32  	void enableActions();
   38.33  	void disableActions();
   38.34 +	void setState (EditorState);
   38.35  
   38.36  private:
   38.37      QPrinter *printer;
   38.38 @@ -127,7 +127,7 @@
   38.39  	*actionAlignSuperScript;
   38.40  };
   38.41  
   38.42 -/* Wraps currentVerticalAlignmentChanged(VerticalAlignment)
   38.43 +/* FIXME Wraps currentVerticalAlignmentChanged(VerticalAlignment)
   38.44   * to currentVerticalAlignmentChanged(int) 
   38.45   * this way the signal can be used without use of the internal 
   38.46   * VerticalAlignment enum of QTextEdit 
   38.47 @@ -139,22 +139,27 @@
   38.48  {
   38.49      Q_OBJECT;
   38.50   public:
   38.51 -    MyTextEdit(QWidget *parent, const char *name) : QTextEdit(parent, name) {
   38.52 -	connect(this, 
   38.53 -		SIGNAL(currentVerticalAlignmentChanged(VerticalAlignment)),
   38.54 -		this, 
   38.55 -		SLOT(verticalAlignmentChanged(VerticalAlignment)));
   38.56 +    MyTextEdit(QWidget *parent, const char *name) : QTextEdit(parent, name) 
   38.57 +	{
   38.58 +	/*
   38.59 +		connect(
   38.60 +			this, SIGNAL(currentVerticalAlignmentChanged(VerticalAlignment)), 
   38.61 +			this, SLOT(verticalAlignmentChanged(VerticalAlignment)));
   38.62 +	*/		
   38.63      }
   38.64 -    int verticalAlignment() const { return m_verticalAlignment; } 
   38.65 +//    int verticalAlignment() const { return m_verticalAlignment; } 
   38.66   signals:
   38.67 -    void currentVerticalAlignmentChanged(int a);
   38.68 +//    void currentVerticalAlignmentChanged(int a);
   38.69   public slots:
   38.70 -    void verticalAlignmentChanged(VerticalAlignment a) {
   38.71 -     m_verticalAlignment = a;
   38.72 -	emit currentVerticalAlignmentChanged((int)a);
   38.73 + /*
   38.74 +    void verticalAlignmentChanged(VerticalAlignment a) 
   38.75 +	{
   38.76 +		m_verticalAlignment = a;
   38.77 +		emit currentVerticalAlignmentChanged((int)a);
   38.78      }
   38.79 +*/	
   38.80   private: 
   38.81 - int m_verticalAlignment;
   38.82 +//	 int m_verticalAlignment;
   38.83  };
   38.84  
   38.85  #endif
    39.1 --- a/version.h	Tue Sep 05 09:47:13 2006 +0000
    39.2 +++ b/version.h	Tue Sep 05 09:47:14 2006 +0000
    39.3 @@ -2,7 +2,7 @@
    39.4  #define VERSION_H
    39.5  
    39.6  #define __VYM "VYM"
    39.7 -#define __VYM_VERSION "1.8.1"
    39.8 -#define __BUILD_DATE "July 31 2006"
    39.9 +#define __VYM_VERSION "1.8.54"
   39.10 +#define __BUILD_DATE "September 5, 2006"
   39.11  
   39.12  #endif
    40.1 --- a/vym.pro	Tue Sep 05 09:47:13 2006 +0000
    40.2 +++ b/vym.pro	Tue Sep 05 09:47:14 2006 +0000
    40.3 @@ -2,6 +2,7 @@
    40.4  LANGUAGE	= C++
    40.5  
    40.6  CONFIG	+= qt warn_on release
    40.7 +QT += qt3support
    40.8  
    40.9  HEADERS	+= aboutdialog.h \
   40.10  	api.h \
   40.11 @@ -69,12 +70,18 @@
   40.12  	settings.cpp \
   40.13  	options.cpp
   40.14  
   40.15 -FORMS	= exportxhtmldialog.ui \
   40.16 +#The following line was inserted by qt3to4, use "FORMS" later
   40.17 +FORMS3	= exportxhtmldialog.ui \
   40.18  	showtextdialog.ui \
   40.19  	extrainfodialog.ui \
   40.20  	editxlinkdialog.ui \
   40.21  	warningdialog.ui
   40.22  
   40.23 +#The following line was inserted by qt3to4
   40.24 +QT += xml  
   40.25 +#The following line was inserted by qt3to4
   40.26 +CONFIG += uic3
   40.27 +
   40.28  TARGET  = vym
   40.29  TRANSLATIONS += lang/vym_de.ts
   40.30  TRANSLATIONS += lang/vym_en.ts
   40.31 @@ -82,15 +89,15 @@
   40.32  TRANSLATIONS += lang/vym_it.ts
   40.33  
   40.34  count( INSTALLDIR, 0 ) {
   40.35 -	INSTALLDIR = /usr/local/bin
   40.36 +	INSTALLDIR = /usr/local
   40.37  }
   40.38  
   40.39  message( "Installation directory" )
   40.40  message( $$INSTALLDIR )
   40.41  
   40.42  
   40.43 -target.path = $$INSTALLDIR
   40.44 -INSTALLS += target
   40.45 +#target.path = $$INSTALLDIR
   40.46 +#INSTALLS += target
   40.47  
   40.48  
   40.49  target.path = $${INSTALLDIR}/bin
    41.1 --- a/warningdialog.ui.h	Tue Sep 05 09:47:13 2006 +0000
    41.2 +++ b/warningdialog.ui.h	Tue Sep 05 09:47:14 2006 +0000
    41.3 @@ -1,3 +1,5 @@
    41.4 +//Added by qt3to4:
    41.5 +#include <QPixmap>
    41.6  /****************************************************************************
    41.7  ** ui.h extension file, included from the uic-generated form implementation.
    41.8  **
    42.1 --- a/xlinkobj.cpp	Tue Sep 05 09:47:13 2006 +0000
    42.2 +++ b/xlinkobj.cpp	Tue Sep 05 09:47:14 2006 +0000
    42.3 @@ -1,6 +1,8 @@
    42.4  #include "xlinkobj.h"
    42.5  #include "branchobj.h"
    42.6  #include "mapeditor.h"
    42.7 +//Added by qt3to4:
    42.8 +#include <Q3PointArray>
    42.9  
   42.10  
   42.11  /////////////////////////////////////////////////////////////////
   42.12 @@ -15,7 +17,7 @@
   42.13  	init();
   42.14  }
   42.15  
   42.16 -XLinkObj::XLinkObj (QCanvas* c):MapObj(c)
   42.17 +XLinkObj::XLinkObj (Q3Canvas* c):MapObj(c)
   42.18  {
   42.19  	//	cout << "Const XLinkObj (c)  called from MapCenterObj (c)\n";
   42.20  	init();
   42.21 @@ -40,12 +42,12 @@
   42.22  	xLinkState=undefinedXLink;
   42.23  
   42.24  	color=QColor (180,180,180);
   42.25 -	line=new QCanvasLine (canvas);
   42.26 +	line=new Q3CanvasLine (canvas);
   42.27  	width=1;
   42.28  	line->setPen (QPen(color, width));
   42.29  	line->setZ (Z_XLINK);
   42.30  
   42.31 -	poly=new QCanvasPolygon (canvas);
   42.32 +	poly=new Q3CanvasPolygon (canvas);
   42.33  	poly->setBrush( color );
   42.34  	poly->setZ (Z_XLINK);
   42.35  
   42.36 @@ -159,7 +161,7 @@
   42.37  void XLinkObj::updateXLink()
   42.38  {
   42.39  	QPoint a,b;
   42.40 -	QPointArray pa (3);
   42.41 +	Q3PointArray pa (3);
   42.42  	if (visBranch)
   42.43  	{
   42.44  		// Only one of the linked branches is visible
    43.1 --- a/xlinkobj.h	Tue Sep 05 09:47:13 2006 +0000
    43.2 +++ b/xlinkobj.h	Tue Sep 05 09:47:14 2006 +0000
    43.3 @@ -9,7 +9,7 @@
    43.4  class XLinkObj:public MapObj {
    43.5  public:
    43.6      XLinkObj ();
    43.7 -    XLinkObj (QCanvas*);
    43.8 +    XLinkObj (Q3Canvas*);
    43.9      ~XLinkObj ();
   43.10      virtual void init ();
   43.11      virtual void copy (XLinkObj*);
   43.12 @@ -37,8 +37,8 @@
   43.13  	static int arrowSize;
   43.14  	QColor color;
   43.15  	int width;
   43.16 -	QCanvasLine *line;
   43.17 -	QCanvasPolygon *poly;
   43.18 +	Q3CanvasLine *line;
   43.19 +	Q3CanvasPolygon *poly;
   43.20  	BranchObj *beginBranch;
   43.21  	BranchObj *endBranch;
   43.22  	BranchObj *visBranch;	// the "visible" part of a partially scrolled link
    44.1 --- a/xml.cpp	Tue Sep 05 09:47:13 2006 +0000
    44.2 +++ b/xml.cpp	Tue Sep 05 09:47:14 2006 +0000
    44.3 @@ -2,7 +2,9 @@
    44.4  
    44.5  #include <qmessagebox.h>
    44.6  #include <qcolor.h>
    44.7 -#include <qstylesheet.h>
    44.8 +#include <q3stylesheet.h>
    44.9 +//Added by qt3to4:
   44.10 +#include <QTextStream>
   44.11  #include <iostream>
   44.12  
   44.13  #include "misc.h"
   44.14 @@ -503,26 +505,26 @@
   44.15  		QFile file (fn);
   44.16  		QString s;						// Reading a note
   44.17  
   44.18 -		if ( !file.open( IO_ReadOnly) )
   44.19 +		if ( !file.open( QIODevice::ReadOnly) )
   44.20  		{
   44.21  			qWarning ("mapBuilderHandler::readNoteAttr:  Couldn't load "+fn);
   44.22  			return false;
   44.23  		}	
   44.24  		QTextStream stream( &file );
   44.25  		QString lines;
   44.26 -		while ( !stream.eof() ) {
   44.27 +		while ( !stream.atEnd() ) {
   44.28  			lines += stream.readLine()+"\n"; 
   44.29  		}
   44.30  		file.close();
   44.31  		// Convert to richtext
   44.32 -		if ( !QStyleSheet::mightBeRichText( lines ) )
   44.33 +		if ( !Q3StyleSheet::mightBeRichText( lines ) )
   44.34  		{
   44.35  			// Here we are workarounding the QT conversion method:
   44.36  			// convertFromPlainText does not generate valid xml, needed
   44.37  			// for the parser, but just <p> and <br> without closing tags.
   44.38  			// So we have to add those by ourselves
   44.39  			//lines=quotemeta (lines);
   44.40 -			lines = QStyleSheet::convertFromPlainText( lines, QStyleSheetItem::WhiteSpaceNormal );
   44.41 +			lines = Q3StyleSheet::convertFromPlainText( lines, Q3StyleSheetItem::WhiteSpaceNormal );
   44.42  			lines.replace ("<br>","<br />");
   44.43  		}	
   44.44