Several fixes, see tex/vym.changelog for details
authorinsilmaril
Fri, 13 Nov 2009 08:32:03 +0000
changeset 80414f2b1b15242
parent 803 338ebdc9b947
child 805 fc7a93ff97c3
Several fixes, see tex/vym.changelog for details
adaptormodel.cpp
adaptormodel.h
branchitem.cpp
branchobj.cpp
branchpropwindow.cpp
exports.cpp
highlighter.cpp
main.cpp
mainwindow.cpp
mainwindow.h
mapeditor.cpp
mysortfilterproxymodel.cpp
mysortfilterproxymodel.h
tex/vc
tex/vym.changelog
texteditor.cpp
texteditor.h
treeeditor.cpp
treeeditor.h
treeitem.cpp
treemodel.cpp
treemodel.h
version.h
vym.pro
vymmodel.cpp
vymmodel.h
vymview.cpp
vymview.h
     1.1 --- a/adaptormodel.cpp	Fri Oct 02 14:31:03 2009 +0000
     1.2 +++ b/adaptormodel.cpp	Fri Nov 13 08:32:03 2009 +0000
     1.3 @@ -55,3 +55,8 @@
     1.4  }
     1.5  
     1.6  
     1.7 +void AdaptorModel::setHeading (const QString &s)
     1.8 +{
     1.9 +	model->setHeading(s);
    1.10 +}
    1.11 +
     2.1 --- a/adaptormodel.h	Fri Oct 02 14:31:03 2009 +0000
     2.2 +++ b/adaptormodel.h	Fri Nov 13 08:32:03 2009 +0000
     2.3 @@ -11,7 +11,9 @@
     2.4  {
     2.5      Q_OBJECT
     2.6      Q_CLASSINFO("D-Bus Interface", "org.insilmaril.Adaptor")
     2.7 -	Q_PROPERTY(QString caption READ caption WRITE setCaption)
     2.8 +//    Q_CLASSINFO("D-Bus Interface", "org.insilmaril.Adaptor.test")
     2.9 +//	Q_PROPERTY(QString caption READ caption WRITE setCaption)
    2.10 +//	Q_PROPERTY(QString heading READ getHeading WRITE setHeading)
    2.11  private:
    2.12  	VymModel *model;
    2.13  
    2.14 @@ -27,6 +29,7 @@
    2.15  public slots: // METHODS
    2.16     QDBusVariant query(const QString &query);
    2.17     QDBusVariant getHeading();
    2.18 +   void setHeading (const QString &s);
    2.19  
    2.20  Q_SIGNALS: // SIGNALS
    2.21      void crashed();
     3.1 --- a/branchitem.cpp	Fri Oct 02 14:31:03 2009 +0000
     3.2 +++ b/branchitem.cpp	Fri Nov 13 08:32:03 2009 +0000
     3.3 @@ -368,7 +368,10 @@
     3.4  
     3.5  BranchItem* BranchItem::getLastSelectedBranch()
     3.6  {
     3.7 -	return getBranchNum (lastSelectedBranchNum);
     3.8 +	if (lastSelectedBranchNum>=branchCounter)
     3.9 +		return getBranchNum (branchCounter-1);
    3.10 +	else	
    3.11 +		return getBranchNum (lastSelectedBranchNum);
    3.12  }
    3.13  
    3.14  BranchItem* BranchItem::getLastSelectedBranchAlt()
     4.1 --- a/branchobj.cpp	Fri Oct 02 14:31:03 2009 +0000
     4.2 +++ b/branchobj.cpp	Fri Nov 13 08:32:03 2009 +0000
     4.3 @@ -115,7 +115,7 @@
     4.4  		return false;
     4.5  }
     4.6  
     4.7 -void BranchObj::setParObjTmp(LinkableMapObj* dst, QPointF m, int off)	//FIXME-1 after moving a mainbranch to a branch and away again mainbranch is no longer connected to mapcenter...
     4.8 +void BranchObj::setParObjTmp(LinkableMapObj* dst, QPointF m, int off)	//FIXME-1 when moving a mainbranch to a branch it still has relPos, not moved as child
     4.9  {
    4.10  	// Temporary link to dst
    4.11  	// m is position of mouse pointer 
    4.12 @@ -125,7 +125,7 @@
    4.13  
    4.14  	BranchItem *pi=(BranchItem*)(dsti->parent());
    4.15  	int pi_depth=pi->depth();
    4.16 -	BranchObj* bo=(BranchObj*)(dst);
    4.17 +	BranchObj* bo=(BranchObj*)dst;
    4.18  
    4.19  	if (!tmpParent) 
    4.20  	{
    4.21 @@ -490,6 +490,10 @@
    4.22  			setFrameType (FrameObj::Rectangle);
    4.23  			break;
    4.24  		case 1: 
    4.25 +			fontsize=14; 
    4.26 +			setFrameType (FrameObj::NoFrame);
    4.27 +			break;
    4.28 +		case 2: 
    4.29  			fontsize=12; 
    4.30  			setFrameType (FrameObj::NoFrame);
    4.31  			break;
     5.1 --- a/branchpropwindow.cpp	Fri Oct 02 14:31:03 2009 +0000
     5.2 +++ b/branchpropwindow.cpp	Fri Nov 13 08:32:03 2009 +0000
     5.3 @@ -169,7 +169,6 @@
     5.4  
     5.5  void BranchPropertyWindow::setModel (VymModel *m)
     5.6  {
     5.7 -return;
     5.8  	model=m;
     5.9  	if (model) 
    5.10  		setItem (model->getSelectedItem() );
     6.1 --- a/exports.cpp	Fri Oct 02 14:31:03 2009 +0000
     6.2 +++ b/exports.cpp	Fri Nov 13 08:32:03 2009 +0000
     6.3 @@ -148,7 +148,7 @@
     6.4  	BranchItem *cur=NULL;
     6.5  	BranchItem *prev=NULL;
     6.6  
     6.7 -	cur=model->next (cur,prev);
     6.8 +	cur=model->nextBranch (cur,prev);
     6.9  	while (cur) 
    6.10  	{
    6.11  		if (cur->getType()==TreeItem::Branch || cur->getType()==TreeItem::MapCenter)
    6.12 @@ -195,7 +195,7 @@
    6.13  				}
    6.14  			}
    6.15  		}
    6.16 -		cur=model->next(cur,prev);
    6.17 +		cur=model->nextBranch(cur,prev);
    6.18  	}
    6.19  	file.close();
    6.20  }
    6.21 @@ -229,7 +229,7 @@
    6.22  	BranchObj *bo;  //FIXME-3 still needed?
    6.23  	BranchItem *cur=NULL;
    6.24  	BranchItem *prev=NULL;
    6.25 -	cur=model->next (cur,prev);
    6.26 +	cur=model->nextBranch (cur,prev);
    6.27  	while (cur) 
    6.28  	{
    6.29  		bo=(BranchObj*)(cur->getLMO());
    6.30 @@ -252,7 +252,7 @@
    6.31  			ts << curIndent << "\"" << cur->getHeading()<<"\""<<endl;
    6.32  		}
    6.33  		
    6.34 -		cur=model->next(cur,prev);
    6.35 +		cur=model->nextBranch(cur,prev);
    6.36  		curIndent="";
    6.37  	}
    6.38  	file.close();
    6.39 @@ -388,7 +388,7 @@
    6.40    BranchObj *bo;
    6.41    BranchItem *cur=NULL;
    6.42    BranchItem *prev=NULL;
    6.43 -  model->next(cur,prev);
    6.44 +  model->nextBranch(cur,prev);
    6.45    while (cur) 
    6.46    {
    6.47  	bo=(BranchObj*)(cur->getLMO());
    6.48 @@ -420,7 +420,7 @@
    6.49  		  ts << ("\n");
    6.50  		}
    6.51  	}
    6.52 -    cur=model->next(cur,prev);
    6.53 +    cur=model->nextBranch(cur,prev);
    6.54     }
    6.55    file.close();
    6.56  }
    6.57 @@ -443,7 +443,7 @@
    6.58  	BranchItem *bi=current->getFirstBranch();
    6.59  	if (bi)
    6.60      {
    6.61 -		if (true) //if (!bo->hasHiddenExportParent() )	// FIXME-2 use BranchItem...
    6.62 +		if (!bi->hasHiddenExportParent() )	// FIXME-3 use BranchItem...
    6.63  		{
    6.64  			// Start list
    6.65  			r+="<text:list text:style-name=\"vym-list\">\n";
    6.66 @@ -471,51 +471,73 @@
    6.67  {
    6.68  	QString allPages;
    6.69  
    6.70 -/* FIXME-2 not adapted to multiple mapCenters yet, see patch already done in 1.12.2...
    6.71 +	BranchItem *firstMCO=(BranchItem*)(model->getRootItem()->getFirstBranch());
    6.72 +	if (!firstMCO) 
    6.73 +	{
    6.74 +		QMessageBox::critical (0,QObject::tr("Critical Export Error"),QObject::tr("No objects in map!"));
    6.75 +		return;
    6.76 +	}
    6.77 +
    6.78  	// Insert new content
    6.79 -	content.replace ("<!-- INSERT TITLE -->",quotemeta(mapCenter->getHeading()));
    6.80 -	content.replace ("<!-- INSERT AUTHOR -->",quotemeta(mapCenter->getAuthor()));
    6.81 +	// FIXME add extra title in mapinfo for vym 1.13.x
    6.82 +	content.replace ("<!-- INSERT TITLE -->",quotemeta(firstMCO->getHeading()));
    6.83 +	content.replace ("<!-- INSERT AUTHOR -->",quotemeta(model->getAuthor()));
    6.84  
    6.85  	QString	onePage;
    6.86  	QString list;
    6.87  	
    6.88 -	BranchObj *sectionBO=mapCenter->getFirstBranch();
    6.89 +	BranchItem *sectionBI;	
    6.90      int i=0;
    6.91 -	BranchObj *pagesBO;
    6.92 +	BranchItem *pagesBI;
    6.93      int j=0;
    6.94  
    6.95 +	int mapcenters=model->getRootItem()->branchCount();
    6.96 +
    6.97 +	// useSections already has been set in setConfigFile 
    6.98 +	if (mapcenters>1)	
    6.99 +		sectionBI=firstMCO;
   6.100 +	else
   6.101 +		sectionBI=firstMCO->getFirstBranch();
   6.102 +
   6.103  	// Walk sections
   6.104 -	while (sectionBO && !sectionBO->hasHiddenExportParent() )
   6.105 +	while (sectionBI && !sectionBI->hasHiddenExportParent() )
   6.106  	{
   6.107  		if (useSections)
   6.108  		{
   6.109  			// Add page with section title
   6.110  			onePage=sectionTemplate;
   6.111 -			onePage.replace ("<!-- INSERT PAGE HEADING -->", quotemeta(sectionBO->getHeading() ) );
   6.112 +			onePage.replace ("<!-- INSERT PAGE HEADING -->", quotemeta(sectionBI->getHeading() ) );
   6.113  			allPages+=onePage;
   6.114 +			pagesBI=sectionBI->getFirstBranch();
   6.115  		} else
   6.116  		{
   6.117 -			i=-2;	// only use inner loop to 
   6.118 +			//i=-2;	// only use inner loop to 
   6.119  			        // turn mainbranches into pages
   6.120 -			sectionBO=mapCenter;
   6.121 +			//sectionBI=firstMCO;
   6.122 +			pagesBI=sectionBI;
   6.123  		}
   6.124  
   6.125 -		// Walk mainpages
   6.126 -		pagesBO=sectionBO->getFirstBranch();
   6.127  		j=0;
   6.128 -		while (pagesBO && !pagesBO->hasHiddenExportParent() )
   6.129 +		while (pagesBI && !pagesBI->hasHiddenExportParent() )
   6.130  		{
   6.131  			// Add page with list of items
   6.132  			onePage=pageTemplate;
   6.133 -			onePage.replace ("<!-- INSERT PAGE HEADING -->", quotemeta (pagesBO->getHeading() ) );
   6.134 -			list=buildList (pagesBO->getTreeItem() );  
   6.135 +			onePage.replace ("<!-- INSERT PAGE HEADING -->", quotemeta (pagesBI->getHeading() ) );
   6.136 +			list=buildList (pagesBI);
   6.137  			onePage.replace ("<!-- INSERT LIST -->", list);
   6.138  			allPages+=onePage;
   6.139 -			j++;
   6.140 -			pagesBO=sectionBO->getBranchNum(j);
   6.141 +			if (pagesBI!=sectionBI)
   6.142 +			{
   6.143 +				j++;
   6.144 +				pagesBI=((BranchItem*)pagesBI->parent())->getBranchNum(j);
   6.145 +			} else
   6.146 +				pagesBI=NULL;	// We are already iterating over the sectionBIs
   6.147  		}
   6.148  		i++;
   6.149 -		sectionBO=mapCenter->getBranchNum(i);
   6.150 +		if (mapcenters>1 )
   6.151 +			sectionBI=model->getRootItem()->getBranchNum (i);
   6.152 +		else
   6.153 +			sectionBI=firstMCO->getBranchNum (i);
   6.154  	}
   6.155  	
   6.156  	content.replace ("<!-- INSERT PAGES -->",allPages);
   6.157 @@ -535,7 +557,6 @@
   6.158  
   6.159  	// zip tmpdir to destination
   6.160  	zipDir (tmpDir,outputFile);	
   6.161 -*/
   6.162  }
   6.163  
   6.164  bool ExportOO::setConfigFile (const QString &cf)
     7.1 --- a/highlighter.cpp	Fri Oct 02 14:31:03 2009 +0000
     7.2 +++ b/highlighter.cpp	Fri Nov 13 08:32:03 2009 +0000
     7.3 @@ -79,6 +79,7 @@
     7.4  					<< "\\bsetMapBackgroundColor\\b" 
     7.5  					<< "\\bsetMapDefLinkColor\\b" 
     7.6  					<< "\\bsetMapDefLinkStyle\\b" 
     7.7 +					<< "\\bsetNote\\b" 
     7.8  					<< "\\bsetHeading\\b" 
     7.9  					<< "\\bsetHideExport\\b" 
    7.10  					<< "\\bsetIncludeImagesHorizontally\\b" 
     8.1 --- a/main.cpp	Fri Oct 02 14:31:03 2009 +0000
     8.2 +++ b/main.cpp	Fri Nov 13 08:32:03 2009 +0000
     8.3 @@ -16,6 +16,9 @@
     8.4  #include <windows.h>
     8.5  #endif
     8.6  
     8.7 +#include <sys/types.h>			// To retrieve PID for use in DBUS
     8.8 +#include <unistd.h>
     8.9 +
    8.10  // Global variables
    8.11  TextEditor *textEditor;			// used in Constr. of LinkableMapObj
    8.12  								// initialized in mainwindow
    8.13 @@ -25,8 +28,10 @@
    8.14  QString vymCodeName;
    8.15  
    8.16  Main *mainWindow;				// used in BranchObj::select()								
    8.17 +
    8.18  QDBusConnection dbusConnection= QDBusConnection::sessionBus();
    8.19  
    8.20 +
    8.21  QString tmpVymDir;				// All temp files go there, created in mainwindow
    8.22  QString clipboardDir;			// Clipboard used in all mapEditors
    8.23  QString clipboardFile;			// Clipboard used in all mapEditors
    8.24 @@ -61,7 +66,6 @@
    8.25  	vymBuildDate=__VYM_BUILD_DATE;
    8.26  	vymCodeName=__VYM_CODENAME;
    8.27  
    8.28 -
    8.29  	// Reading and initializing options commandline options
    8.30  	options.add ("debug", Option::Switch, "d", "debug");
    8.31  	options.add ("version", Option::Switch, "v","version");
    8.32 @@ -87,7 +91,7 @@
    8.33  
    8.34  	if (options.isOn ("version"))
    8.35  	{
    8.36 -		cout << "VYM - View Your Mind (c) 2004-2007 Uwe Drechsel "  << endl
    8.37 +		cout << "VYM - View Your Mind (c) 2004-2009 Uwe Drechsel "  << endl
    8.38  			<<"   Version: "<<__VYM_VERSION <<endl
    8.39  			<<"Build date: "<<__VYM_BUILD_DATE << endl
    8.40  			<<"  "<<__VYM_CODENAME<<endl;
    8.41 @@ -95,6 +99,10 @@
    8.42  		return 0;	
    8.43  	}		
    8.44  	
    8.45 +	// Register for DBUS
    8.46 +	if (debug) cout << "PID="<<getpid()<<endl;
    8.47 +	dbusConnection.registerService (QString ("org.insilmaril.vym-%1").arg(getpid()));
    8.48 +
    8.49  	// Use /usr/share/vym or /usr/local/share/vym or . ?
    8.50  	// First try options
    8.51  	if (options.isOn ("local"))
    8.52 @@ -186,14 +194,6 @@
    8.53  	// Paint Mainwindow first time
    8.54  	qApp->processEvents();
    8.55  
    8.56 -	// FIXME-3 playing around with dbus
    8.57 -	/*
    8.58 -	new Adaptor (&app);
    8.59 -	dbusConnection.registerService("org.insilmaril.MainWindow");
    8.60 -	QDBusConnection::sessionBus().registerObject("/MainApplication", &app);
    8.61 -	*/
    8.62 -
    8.63 -
    8.64  	m.loadCmdLine();
    8.65  
    8.66  	// Run script
     9.1 --- a/mainwindow.cpp	Fri Oct 02 14:31:03 2009 +0000
     9.2 +++ b/mainwindow.cpp	Fri Nov 13 08:32:03 2009 +0000
     9.3 @@ -19,11 +19,12 @@
     9.4  #include "options.h"
     9.5  #include "process.h"
     9.6  #include "settings.h"
     9.7 +#include "shortcuts.h"
     9.8  #include "texteditor.h"
     9.9  #include "warningdialog.h"
    9.10  #include "xlinkitem.h"
    9.11  
    9.12 -//#include <modeltest.h>	// FIXME-3
    9.13 +#include <modeltest.h>	// FIXME-3
    9.14  
    9.15  #if defined(Q_OS_WIN32)
    9.16  // Define only this structure as opposed to
    9.17 @@ -123,7 +124,8 @@
    9.18  	makeSubDirs (clipboardDir);
    9.19  	clipboardEmpty=true;
    9.20  
    9.21 -	procBrowser=NULL;
    9.22 +	browserPID=new qint64;
    9.23 +	*browserPID=0;
    9.24  
    9.25  	// Satellite windows //////////////////////////////////////////
    9.26  	// history window
    9.27 @@ -705,6 +707,29 @@
    9.28  	addAction (a);
    9.29  	actionListBranches.append(actionExpandAll);
    9.30  
    9.31 +	a = new QAction( QPixmap(), tr( "Expand one level","Edit menu" ), this);
    9.32 +	a->setShortcut ( Qt::Key_Greater );		// Expand one level in tree editor
    9.33 +	a->setStatusTip (tr( "Expand one level in tree editor" )); 
    9.34 +    connect( a, SIGNAL( triggered() ), this, SLOT( editExpandOneLevel() ) );
    9.35 +	a->setEnabled (false);
    9.36 +	a->setToggleAction(false);
    9.37 +	actionExpandOneLevel=a;
    9.38 +    //tb->addAction (a);
    9.39 +    editMenu->addAction ( a);
    9.40 +	addAction (a);
    9.41 +	actionListBranches.append(a);
    9.42 +
    9.43 +	a = new QAction( QPixmap(), tr( "Collapse one level","Edit menu" ), this);
    9.44 +	a->setShortcut ( Qt::Key_Less);			// Collapse one level in tree editor
    9.45 +	a->setStatusTip (tr( "Collapse one level in tree editor" )); 
    9.46 +    connect( a, SIGNAL( triggered() ), this, SLOT( editCollapseOneLevel() ) );
    9.47 +	a->setEnabled (false);
    9.48 +	a->setToggleAction(false);
    9.49 +	actionCollapseOneLevel=a;
    9.50 +    //tb->addAction (a);
    9.51 +    editMenu->addAction ( a);
    9.52 +	addAction (a);
    9.53 +	actionListBranches.append(a);
    9.54  
    9.55      a = new QAction( tr( "Unscroll children","Edit menu" ), this);
    9.56  	a->setStatusTip (tr( "Unscroll all scrolled branches in selected subtree" ));
    9.57 @@ -722,7 +747,7 @@
    9.58  	editMenu->addSeparator();
    9.59  
    9.60  	a = new QAction( QPixmap(flagsPath+"flag-url.png"), tr( "Open URL","Edit menu" ), this);
    9.61 -	a->setShortcut (Qt::CTRL + Qt::Key_U );
    9.62 +	a->setShortcut (Qt::SHIFT + Qt::Key_U );
    9.63  	a->setShortcut (tr( "Open URL" ));
    9.64      tb->addAction (a);
    9.65  	addAction(a);
    9.66 @@ -738,6 +763,7 @@
    9.67  
    9.68  	a = new QAction( tr( "Open all URLs in subtree","Edit menu" ), this);
    9.69  	a->setStatusTip (tr( "Open all URLs in subtree" ));
    9.70 +	a->setShortcut ( Qt::CTRL + Qt::Key_U );
    9.71  	addAction(a);
    9.72  	actionListBranches.append(a);
    9.73      connect( a, SIGNAL( triggered() ), this, SLOT( editOpenMultipleURLTabs() ) );
    9.74 @@ -754,7 +780,7 @@
    9.75  	
    9.76  	a = new QAction(QPixmap(), tr( "Edit local URL...","Edit menu"), this);
    9.77  	a->setStatusTip ( tr( "Edit local URL" ) );
    9.78 -	a->setShortcut (Qt::SHIFT +  Qt::Key_U );
    9.79 +	//a->setShortcut (Qt::SHIFT +  Qt::Key_U );
    9.80  	a->setShortcutContext (Qt::WindowShortcut);
    9.81  	actionListBranches.append(a);
    9.82  	addAction(a);
    9.83 @@ -775,7 +801,6 @@
    9.84  	a->setShortcut ( Qt::Key_B );
    9.85  	a->setShortcutContext (Qt::WindowShortcut);
    9.86  	addAction(a);
    9.87 -
    9.88      connect( a, SIGNAL( triggered() ), this, SLOT( editBugzilla2URL() ) );
    9.89  	actionBugzilla2URL=a;
    9.90      
    9.91 @@ -823,6 +848,16 @@
    9.92      connect( a, SIGNAL( triggered() ), this, SLOT( editToggleHideExport() ) );
    9.93  	actionToggleHideExport=a;
    9.94  
    9.95 +	a = new QAction(tr( "Add timestamp","Edit menu" ), this);
    9.96 +	a->setStatusTip ( tr( "Add timestamp" ));
    9.97 +	a->setEnabled (false);
    9.98 +	actionListBranches.append(a);
    9.99 +	a->setShortcut ( Qt::Key_T );	// Add timestamp
   9.100 +	a->setShortcutContext (Qt::WindowShortcut);
   9.101 +	addAction(a);
   9.102 +    connect( a, SIGNAL( triggered() ), this, SLOT( editAddTimestamp() ) );
   9.103 +	actionAddTimestamp=a;
   9.104 +    
   9.105      a = new QAction(tr( "Edit Map Info...","Edit menu" ),this);
   9.106  	a->setStatusTip ( tr( "Edit Map Info" ));
   9.107  	a->setEnabled (true);
   9.108 @@ -925,7 +960,7 @@
   9.109  
   9.110      a= new QAction(QPixmap(iconPath+"formatcolorsubtree.png"), tr( "Color sub&tree","Edit menu" ), this);
   9.111  	a->setStatusTip ( tr( "Color Subtree" ));
   9.112 -	a->setShortcut (Qt::CTRL + Qt::Key_T);
   9.113 +	//FIXME-2 switch back to that a->setShortcut (Qt::CTRL + Qt::Key_T);	// Color subtree
   9.114      connect( a, SIGNAL( triggered() ), this, SLOT( formatColorSubtree() ) );
   9.115  	a->setEnabled (false);
   9.116  	formatMenu->addAction (a);
   9.117 @@ -1010,31 +1045,34 @@
   9.118  	tb->setObjectName ("viewTB");
   9.119      QMenu *viewMenu = menuBar()->addMenu ( tr( "&View" ));
   9.120  
   9.121 +	Switchboard switchboard;	//FIXME-1 testing...
   9.122 +
   9.123      QAction *a;
   9.124      a = new QAction(QPixmap(iconPath+"viewmag-reset.png"), tr( "reset Zoom","View action" ), this);
   9.125  	a->setStatusTip ( tr( "Zoom reset" ) );
   9.126 -	a->setShortcut (Qt::CTRL + Qt::Key_0 );
   9.127 +	a->setShortcut (Qt::CTRL + Qt::Key_0);	// Reset zoom
   9.128 +	switchboard.addConnection(a,"CTRL+0");
   9.129      a->addTo( tb );
   9.130  	viewMenu->addAction (a);
   9.131      connect( a, SIGNAL( triggered() ), this, SLOT(viewZoomReset() ) );
   9.132  	
   9.133      a = new QAction( QPixmap(iconPath+"viewmag+.png"), tr( "Zoom in","View action" ), this);
   9.134  	a->setStatusTip (tr( "Zoom in" ));
   9.135 -	a->setShortcut (Qt::CTRL + Qt::Key_Plus);
   9.136 +	switchboard.addConnection(a,"CTRL++");
   9.137      a->addTo( tb );
   9.138  	viewMenu->addAction (a);
   9.139      connect( a, SIGNAL( triggered() ), this, SLOT(viewZoomIn() ) );
   9.140  	
   9.141      a = new QAction( QPixmap(iconPath+"viewmag-.png"), tr( "Zoom out","View action" ), this);
   9.142  	a->setStatusTip (tr( "Zoom out" ));
   9.143 -	a->setShortcut (Qt::CTRL + Qt::Key_Minus );
   9.144 +	switchboard.addConnection(a,"CTRL+-");
   9.145      a->addTo( tb );
   9.146  	viewMenu->addAction (a);
   9.147      connect( a, SIGNAL( triggered() ), this, SLOT( viewZoomOut() ) );
   9.148  
   9.149      a = new QAction( QPixmap(iconPath+"viewshowsel.png"), tr( "Show selection","View action" ), this);
   9.150  	a->setStatusTip (tr( "Show selection" ));
   9.151 -	a->setShortcut (Qt::Key_Period);
   9.152 +	switchboard.addConnection(a,".");
   9.153      a->addTo( tb );
   9.154  	viewMenu->addAction (a);
   9.155      connect( a, SIGNAL( triggered() ), this, SLOT( viewCenter() ) );
   9.156 @@ -1043,7 +1081,7 @@
   9.157  
   9.158      a = new QAction(QPixmap(flagsPath+"flag-note.png"), tr( "Show Note Editor","View action" ),this);
   9.159  	a->setStatusTip ( tr( "Show Note Editor" ));
   9.160 -	a->setShortcut ( Qt::CTRL + Qt::Key_E );
   9.161 +	a->setShortcut ( Qt::CTRL + Qt::Key_E );	// Toggle Note Editor
   9.162  	a->setToggleAction(true);
   9.163      a->addTo( tb );
   9.164  	viewMenu->addAction (a);
   9.165 @@ -1052,7 +1090,7 @@
   9.166  
   9.167      a = new QAction(QPixmap(iconPath+"history.png"),  tr( "History Window","View action" ),this );
   9.168  	a->setStatusTip ( tr( "Show History Window" ));
   9.169 -	a->setShortcut ( Qt::CTRL + Qt::Key_H  );
   9.170 +	a->setShortcut ( Qt::CTRL + Qt::Key_H  );	// Toggle history window
   9.171  	a->setToggleAction(true);
   9.172      a->addTo( tb );
   9.173  	viewMenu->addAction (a);
   9.174 @@ -1090,6 +1128,8 @@
   9.175  	a->setShortcut (Qt::ALT + Qt::Key_P );
   9.176  	viewMenu->addAction (a);
   9.177      connect( a, SIGNAL( triggered() ), this, SLOT(windowPreviousEditor() ) );
   9.178 +
   9.179 +	switchboard.print();
   9.180  }
   9.181  
   9.182  // Mode Actions
   9.183 @@ -1356,13 +1396,13 @@
   9.184  
   9.185      a = new QAction(  "Start TCPserver for MapEditor",this);
   9.186      //a->setStatusTip ( "Set application to open pdf files"));
   9.187 -	a->setShortcut ( Qt::Key_T );		//New TCP server
   9.188 +	//a->setShortcut ( Qt::ALT + Qt::Key_T );		//New TCP server
   9.189      connect( a, SIGNAL( triggered() ), this, SLOT( networkStartServer() ) );
   9.190  	netMenu->addAction (a);
   9.191  
   9.192      a = new QAction(  "Connect MapEditor to server",this);
   9.193      //a->setStatusTip ( "Set application to open pdf files"));
   9.194 -	a->setShortcut ( Qt::Key_C );		// Connect to server
   9.195 +	a->setShortcut ( Qt::ALT + Qt::Key_C );		// Connect to server
   9.196      connect( a, SIGNAL( triggered() ), this, SLOT( networkConnect() ) );
   9.197  	netMenu->addAction (a);
   9.198  }
   9.199 @@ -1480,12 +1520,13 @@
   9.200      QAction *a;
   9.201      a = new QAction( "Test function 1" , this);
   9.202      a->setStatusTip( "Call test function 1" );
   9.203 +	a->setShortcut (Qt::CTRL + Qt::Key_T);	// Test function 1  //FIXME-2 originally: color subtree
   9.204  	testMenu->addAction (a);
   9.205      connect( a, SIGNAL( triggered() ), this, SLOT( testFunction1() ) );
   9.206  
   9.207      a = new QAction( "Test function 2" , this);
   9.208      a->setStatusTip( "Call test function 2" );
   9.209 -	a->setShortcut (Qt::SHIFT + Qt::Key_T);
   9.210 +	a->setShortcut (Qt::SHIFT + Qt::Key_T);		// Test function 2
   9.211  	testMenu->addAction (a);
   9.212      connect( a, SIGNAL( triggered() ), this, SLOT( testFunction2() ) );
   9.213  
   9.214 @@ -1704,7 +1745,7 @@
   9.215  	VymModel *m;
   9.216  	for (int i=0;i<=tabWidget->count() -1;i++)
   9.217  	{
   9.218 -		m= vymViews.at(tabWidget->currentIndex())->getModel();
   9.219 +		m= vymViews.at(i)->getModel();
   9.220  		if (m) m->unselect();
   9.221  	}
   9.222  	m=currentModel();
   9.223 @@ -1718,7 +1759,7 @@
   9.224  {
   9.225  	VymModel *vm=new VymModel;
   9.226  
   9.227 -//new ModelTest(vm, this);	//FIXME-3
   9.228 +new ModelTest(vm, this);	//FIXME-3
   9.229  
   9.230  
   9.231  	VymView *vv=new VymView (vm);
   9.232 @@ -1728,7 +1769,8 @@
   9.233  	vv->initFocus();
   9.234  
   9.235  	// Create MapCenter for empty map
   9.236 -	//vm->createMapCenter();
   9.237 +	vm->addMapCenter();
   9.238 +	vm->makeDefault();
   9.239  
   9.240  	// For the very first map we do not have flagrows yet...
   9.241  	vm->select("mc:");
   9.242 @@ -2336,7 +2378,7 @@
   9.243  			}
   9.244  		} 
   9.245  		// And here comes the segfault, because removeTab triggers 
   9.246 -		// currentChanged->Main::editorChanged -> updateActions and VM is not NULL yet...
   9.247 +		// FIXME-3 currentChanged->Main::editorChanged -> updateActions and VM is not NULL yet...
   9.248  		vymViews.removeAt (tabWidget->currentIndex() );
   9.249  		tabWidget->removeTab (tabWidget->currentIndex() );
   9.250  
   9.251 @@ -2469,14 +2511,12 @@
   9.252  		bool success=true;
   9.253  		QStringList args;
   9.254  		QString browser=settings.value("/mainwindow/readerURL" ).toString();
   9.255 -		QProcess *p;
   9.256 -		if (!procBrowser ||  procBrowser->state()!=QProcess::Running)
   9.257 +		if (*browserPID==0)	//FIXME-2 need to check if browser is really still there instead of this
   9.258  		{
   9.259  			QString u=urls.takeFirst();
   9.260 -			procBrowser = new QProcess( this );
   9.261  			args<<u;
   9.262 -			procBrowser->start(browser,args);
   9.263 -			if ( !procBrowser->waitForStarted())
   9.264 +			QString workDir=QDir::currentDirPath();
   9.265 +			if (!QProcess::startDetached(browser,args,workDir,browserPID))
   9.266  			{
   9.267  				// try to set path to browser
   9.268  				QMessageBox::warning(0, 
   9.269 @@ -2485,37 +2525,37 @@
   9.270  					tr("Please use Settings->")+tr("Set application to open an URL"));
   9.271  				return;
   9.272  			}
   9.273 +			if (debug) cout << "Main::openTabs  Started konqueror-"<<*browserPID<<endl;
   9.274  #if defined(Q_OS_WIN32)
   9.275              // There's no sleep in VCEE, replace it with Qt's QThread::wait().
   9.276              this->thread()->wait(3000);
   9.277  #else
   9.278 -			sleep (3);
   9.279 +			sleep (3);	//FIXME-3 needed?
   9.280  #endif
   9.281  		}
   9.282 +
   9.283  		if (browser.contains("konqueror"))
   9.284  		{
   9.285  			for (int i=0; i<urls.size(); i++)
   9.286  			{
   9.287  				// Open new browser
   9.288  				// Try to open new tab in existing konqueror started previously by vym
   9.289 -				p=new QProcess (this);
   9.290  				args.clear();
   9.291 -#if defined(Q_OS_WIN32)
   9.292 -                // In Win32, pid is not a longlong, but a pointer to a _PROCESS_INFORMATION structure.
   9.293 -                // Redundant change in Win32, as there's no konqueror, but I wanted to follow the original logic.
   9.294 -				args<< QString("konqueror-%1").arg(procBrowser->pid()->dwProcessId)<<
   9.295 -					"konqueror-mainwindow#1"<<
   9.296 -					"newTab" <<
   9.297 -					urls.at(i);
   9.298 -#else
   9.299 +
   9.300 +/*	On KDE3 use DCOP
   9.301  				args<< QString("konqueror-%1").arg(procBrowser->pid())<<
   9.302  					"konqueror-mainwindow#1"<<
   9.303  					"newTab" <<
   9.304  					urls.at(i);
   9.305 -#endif
   9.306 -				p->start ("dcop",args);
   9.307 -				if (debug) cout << "MainWindo::openURLs  args="<<args.join(" ").toStdString()<<endl;
   9.308 -				if ( !p->waitForStarted() ) success=false;
   9.309 +*/					
   9.310 +				args<< QString("org.kde.konqueror-%1").arg(*browserPID)<<
   9.311 +					"/konqueror/MainWindow_1"<<
   9.312 +					"newTab" <<
   9.313 +					urls.at(i)<<
   9.314 +					"false";
   9.315 +				if (debug) cout << "MainWindow::openURLs  args="<<args.join(" ").toStdString()<<endl;
   9.316 +				if (!QProcess::startDetached ("qdbus",args))
   9.317 +					success=false;
   9.318  			}
   9.319  			if (!success)
   9.320  				QMessageBox::warning(0, 
   9.321 @@ -2527,10 +2567,9 @@
   9.322  			for (int i=0; i<urls.size(); i++)
   9.323  			{
   9.324  				// Try to open new tab in firefox
   9.325 -				p=new QProcess (this);
   9.326  				args<< "-remote"<< QString("openurl(%1,new-tab)").arg(urls.at(i));
   9.327 -				p->start (browser,args);
   9.328 -				if ( !p->waitForStarted() ) success=false;
   9.329 +				if (!QProcess::startDetached (browser,args))
   9.330 +					success=false;
   9.331  			}			
   9.332  			if (!success)
   9.333  				QMessageBox::warning(0, 
   9.334 @@ -2554,10 +2593,9 @@
   9.335  		QStringList args;
   9.336  		if (url=="") return;
   9.337  		QString browser=settings.value("/mainwindow/readerURL" ).toString();
   9.338 -		procBrowser = new QProcess( this );
   9.339  		args<<url;
   9.340 -		procBrowser->start(browser,args);
   9.341 -		if ( !procBrowser->waitForStarted())
   9.342 +		QString workDir=QDir::currentDirPath();
   9.343 +		if (!procBrowser->startDetached(browser,args))
   9.344  		{
   9.345  			// try to set path to browser
   9.346  			QMessageBox::warning(0, 
   9.347 @@ -2704,6 +2742,12 @@
   9.348  	if (m) m->toggleHideExport();	
   9.349  }
   9.350  
   9.351 +void Main::editAddTimestamp()
   9.352 +{
   9.353 +	VymModel *m=currentModel();
   9.354 +	if (m) m->addTimestamp();	
   9.355 +}
   9.356 +
   9.357  void Main::editMapInfo()
   9.358  {
   9.359  	VymModel *m=currentModel();
   9.360 @@ -2724,14 +2768,14 @@
   9.361  	uint xl=0;
   9.362  	BranchItem *cur=NULL;
   9.363  	BranchItem *prev=NULL;
   9.364 -	m->next(cur,prev);
   9.365 +	m->nextBranch(cur,prev);
   9.366  	while (cur) 
   9.367  	{
   9.368  		if (!cur->getNote().isEmpty() ) n++;
   9.369  		f+= cur->imageCount();
   9.370  		b++;
   9.371  		xl+=cur->xlinkCount();
   9.372 -		m->next(cur,prev);
   9.373 +		m->nextBranch(cur,prev);
   9.374  	}
   9.375  
   9.376      stats+=QString ("%1 xLinks \n").arg (xl,6);
   9.377 @@ -2784,6 +2828,18 @@
   9.378  	if (m) m->emitExpandAll();
   9.379  }
   9.380  
   9.381 +void Main::editExpandOneLevel()
   9.382 +{
   9.383 +	VymModel *m=currentModel();
   9.384 +	if (m) m->emitExpandOneLevel();
   9.385 +}
   9.386 +
   9.387 +void Main::editCollapseOneLevel()
   9.388 +{
   9.389 +	VymModel *m=currentModel();
   9.390 +	if (m) m->emitCollapseOneLevel();
   9.391 +}
   9.392 +
   9.393  void Main::editUnscrollChildren()
   9.394  {
   9.395  	VymModel *m=currentModel();
   9.396 @@ -2847,7 +2903,7 @@
   9.397  	}	
   9.398  }
   9.399  
   9.400 -void Main::editNewBranchAbove()
   9.401 +void Main::editNewBranchAbove()	// FIXME-1 can crash
   9.402  {
   9.403  	VymModel *m=currentModel();
   9.404  	if ( m)
   9.405 @@ -3368,10 +3424,20 @@
   9.406  		// History window
   9.407  		historyWindow->setCaption (vymName + " - " +tr("History for %1","Window Caption").arg(m->getFileName()));
   9.408  
   9.409 +
   9.410 +		// Expanding/collapsing
   9.411 +		actionExpandAll->setEnabled (true);
   9.412 +		actionExpandOneLevel->setEnabled (true);
   9.413 +		actionCollapseOneLevel->setEnabled (true);
   9.414  	} else
   9.415  	{
   9.416  		// Printing
   9.417  		actionFilePrint->setEnabled (false);
   9.418 +
   9.419 +		// Expanding/collapsing
   9.420 +		actionExpandAll->setEnabled (false);
   9.421 +		actionExpandOneLevel->setEnabled (false);
   9.422 +		actionCollapseOneLevel->setEnabled (false);
   9.423  	}
   9.424  
   9.425  	if (m && m->getMapLinkColorHint()==LinkableMapObj::HeadingColor) 
   9.426 @@ -3603,10 +3669,11 @@
   9.427  
   9.428  void Main::testFunction1()
   9.429  {
   9.430 +/*
   9.431  	if (!currentMapEditor()) return;
   9.432  	//currentMapEditor()->testFunction1();
   9.433 -	/*
   9.434 -	*/
   9.435 +*/
   9.436 +
   9.437  	VymModel *m=currentModel();
   9.438  	if (!m) return;
   9.439  
   9.440 @@ -3689,8 +3756,7 @@
   9.441  	Process *pdfProc = new Process();
   9.442      args << QDir::toNativeSeparators(docfile.fileName());
   9.443  
   9.444 -	pdfProc->start( settings.value("/mainwindow/readerPDF").toString(),args);
   9.445 -	if ( !pdfProc->waitForStarted() ) 
   9.446 +	if (!pdfProc->startDetached( settings.value("/mainwindow/readerPDF").toString(),args) )
   9.447  	{
   9.448  		// error handling
   9.449  		QMessageBox::warning(0, 
    10.1 --- a/mainwindow.h	Fri Oct 02 14:31:03 2009 +0000
    10.2 +++ b/mainwindow.h	Fri Nov 13 08:32:03 2009 +0000
    10.3 @@ -141,6 +141,7 @@
    10.4  private slots:
    10.5  	void editDeleteVymLink();
    10.6  	void editToggleHideExport();
    10.7 +	void editAddTimestamp();
    10.8  	void editMapInfo();
    10.9      void editMoveUp();	
   10.10      void editMoveDown();	
   10.11 @@ -148,6 +149,8 @@
   10.12  	void editSortChildren();
   10.13      void editToggleScroll();
   10.14      void editExpandAll();
   10.15 +    void editExpandOneLevel();
   10.16 +    void editCollapseOneLevel();
   10.17      void editUnscrollChildren();
   10.18      void editAddAttribute();
   10.19      void editAddMapCenter();
   10.20 @@ -182,6 +185,7 @@
   10.21      void formatToggleLinkColorHint();
   10.22  	void formatHideLinkUnselected();
   10.23  
   10.24 +public slots:
   10.25      void viewZoomReset();
   10.26      void viewZoomIn();
   10.27      void viewZoomOut();
   10.28 @@ -244,7 +248,8 @@
   10.29  private:
   10.30  	QTabWidget *tabWidget;
   10.31  	FindWindow *findWindow;
   10.32 -	QProcess *procBrowser;
   10.33 +	QProcess *procBrowser;		//FIXME-2 remove this...
   10.34 +	qint64 *browserPID;
   10.35  
   10.36  	QStringList imageTypes;
   10.37  
   10.38 @@ -283,6 +288,8 @@
   10.39  	QAction *actionSortChildren;
   10.40  	QAction *actionToggleScroll;
   10.41  	QAction *actionExpandAll;
   10.42 +	QAction *actionExpandOneLevel;
   10.43 +	QAction *actionCollapseOneLevel;
   10.44  	QAction* actionOpenURL;
   10.45  	QAction* actionOpenURLTab;
   10.46  	QAction* actionOpenMultipleURLTabs;
   10.47 @@ -295,6 +302,7 @@
   10.48  	QAction *actionOpenMultipleVymLinks;
   10.49  	QAction *actionVymLink;
   10.50  	QAction *actionDeleteVymLink;
   10.51 +	QAction *actionAddTimestamp;
   10.52  	QAction *actionToggleHideExport;
   10.53  	QAction *actionMapInfo;
   10.54  	QAction *actionHeading;
    11.1 --- a/mapeditor.cpp	Fri Oct 02 14:31:03 2009 +0000
    11.2 +++ b/mapeditor.cpp	Fri Nov 13 08:32:03 2009 +0000
    11.3 @@ -1,4 +1,4 @@
    11.4 -#include "mapeditor.h"
    11.5 +														  #include "mapeditor.h"
    11.6  
    11.7  #include <iostream>
    11.8  #include <cstdlib>
    11.9 @@ -196,7 +196,6 @@
   11.10  		if (lmo) 
   11.11  		{
   11.12  			QRectF r=lmo->getBBox();
   11.13 -			if (debug) cout << "ME::scrollTo "<<ti->getHeadingStd()<<" bbox="<<r<<endl;
   11.14  			setScrollBarPosTarget (r);
   11.15  		}	
   11.16  	}
   11.17 @@ -909,7 +908,8 @@
   11.18  		lineEdit->setText (bi->getHeading());
   11.19  		QPoint p = mapTo (this,bo->getAbsPos().toPoint() );
   11.20  		lineEdit->setGeometry(p.x(),p.y(),230,25);
   11.21 -		lineEdit->selectAll();
   11.22 +		//lineEdit->selectAll();
   11.23 +		//lineEdit->setCursorPosition (1);
   11.24  		lineEdit->show();
   11.25  		lineEdit->setFocus();
   11.26  		lineEdit->grabKeyboard();
   11.27 @@ -1002,9 +1002,11 @@
   11.28  
   11.29  void MapEditor::mousePressEvent(QMouseEvent* e)
   11.30  {
   11.31 +cout << "ME::mousePressed\n";
   11.32  	// Ignore right clicks, these will go to context menus
   11.33  	if (e->button() == Qt::RightButton )
   11.34  	{
   11.35 +		cout << "  ME::ignoring right mouse event...\n";
   11.36  		e->ignore();
   11.37  		return;
   11.38  	}
   11.39 @@ -1012,6 +1014,7 @@
   11.40  	//Ignore clicks while editing heading
   11.41  	if (model->isSelectionBlocked() ) 
   11.42  	{
   11.43 +		cout << "  ME::ignoring other mouse event...\n";
   11.44  		e->ignore();
   11.45  		return;
   11.46  	}
   11.47 @@ -1707,7 +1710,6 @@
   11.48  		selboxList.append (sb);
   11.49  	}
   11.50  
   11.51 -
   11.52  	// Reposition rectangles
   11.53  	QRectF bbox;
   11.54  	QModelIndex index;
   11.55 @@ -1726,7 +1728,7 @@
   11.56  		i++;
   11.57  	}
   11.58  
   11.59 -	scene()->update();
   11.60 +	scene()->update();  
   11.61  }
   11.62  
   11.63  void MapEditor::updateData (const QModelIndex &sel)
    12.1 --- a/mysortfilterproxymodel.cpp	Fri Oct 02 14:31:03 2009 +0000
    12.2 +++ b/mysortfilterproxymodel.cpp	Fri Nov 13 08:32:03 2009 +0000
    12.3 @@ -1,55 +1,14 @@
    12.4 -/****************************************************************************
    12.5 -**
    12.6 -** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies).
    12.7 -** Contact: Nokia Corporation (qt-info@nokia.com)
    12.8 -**
    12.9 -** This file is part of the examples of the Qt Toolkit.
   12.10 -**
   12.11 -** $QT_BEGIN_LICENSE:LGPL$
   12.12 -** Commercial Usage
   12.13 -** Licensees holding valid Qt Commercial licenses may use this file in
   12.14 -** accordance with the Qt Commercial License Agreement provided with the
   12.15 -** Software or, alternatively, in accordance with the terms contained in
   12.16 -** a written agreement between you and Nokia.
   12.17 -**
   12.18 -** GNU Lesser General Public License Usage
   12.19 -** Alternatively, this file may be used under the terms of the GNU Lesser
   12.20 -** General Public License version 2.1 as published by the Free Software
   12.21 -** Foundation and appearing in the file LICENSE.LGPL included in the
   12.22 -** packaging of this file.  Please review the following information to
   12.23 -** ensure the GNU Lesser General Public License version 2.1 requirements
   12.24 -** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
   12.25 -**
   12.26 -** In addition, as a special exception, Nokia gives you certain
   12.27 -** additional rights. These rights are described in the Nokia Qt LGPL
   12.28 -** Exception version 1.0, included in the file LGPL_EXCEPTION.txt in this
   12.29 -** package.
   12.30 -**
   12.31 -** GNU General Public License Usage
   12.32 -** Alternatively, this file may be used under the terms of the GNU
   12.33 -** General Public License version 3.0 as published by the Free Software
   12.34 -** Foundation and appearing in the file LICENSE.GPL included in the
   12.35 -** packaging of this file.  Please review the following information to
   12.36 -** ensure the GNU General Public License version 3.0 requirements will be
   12.37 -** met: http://www.gnu.org/copyleft/gpl.html.
   12.38 -**
   12.39 -** If you are unsure which license is appropriate for your use, please
   12.40 -** contact the sales department at http://www.qtsoftware.com/contact.
   12.41 -** $QT_END_LICENSE$
   12.42 -**
   12.43 -****************************************************************************/
   12.44 -
   12.45 -#include <QtGui>
   12.46 +//#include <QtGui>
   12.47  
   12.48  #include "mysortfilterproxymodel.h"
   12.49  
   12.50 -//! [0]
   12.51  MySortFilterProxyModel::MySortFilterProxyModel(QObject *parent)
   12.52      : QSortFilterProxyModel(parent)
   12.53  {
   12.54  }
   12.55  //! [0]
   12.56  
   12.57 +/*
   12.58  //! [1]
   12.59  void MySortFilterProxyModel::setFilterMinimumDate(const QDate &date)
   12.60  {
   12.61 @@ -64,10 +23,9 @@
   12.62      maxDate = date;
   12.63      invalidateFilter();
   12.64  }
   12.65 -//! [2]
   12.66 +*/
   12.67  
   12.68 -//! [3]
   12.69 -bool MySortFilterProxyModel::filterAcceptsRow(int sourceRow,
   12.70 +bool MySortFilterProxyModel::filterAcceptsRow(int sourceRow,	// FIXME-1 find a way to show _all_ rows which match, independent of parent
   12.71          const QModelIndex &sourceParent) const
   12.72  {
   12.73      QModelIndex index0 = sourceModel()->index(sourceRow, 0, sourceParent);
   12.74 @@ -75,12 +33,11 @@
   12.75      QModelIndex index2 = sourceModel()->index(sourceRow, 2, sourceParent);
   12.76  
   12.77      return (sourceModel()->data(index0).toString().contains(filterRegExp())
   12.78 -            || sourceModel()->data(index1).toString().contains(filterRegExp()))
   12.79 -           && dateInRange(sourceModel()->data(index2).toDate());
   12.80 +            || sourceModel()->data(index1).toString().contains(filterRegExp()));
   12.81 +//           && dateInRange(sourceModel()->data(index2).toDate());
   12.82  }
   12.83 -//! [3]
   12.84  
   12.85 -//! [4] //! [5]
   12.86 +/*
   12.87  bool MySortFilterProxyModel::lessThan(const QModelIndex &left,
   12.88                                        const QModelIndex &right) const
   12.89  {
   12.90 @@ -114,3 +71,4 @@
   12.91             && (!maxDate.isValid() || date < maxDate);
   12.92  }
   12.93  //! [7]
   12.94 +*/
    13.1 --- a/mysortfilterproxymodel.h	Fri Oct 02 14:31:03 2009 +0000
    13.2 +++ b/mysortfilterproxymodel.h	Fri Nov 13 08:32:03 2009 +0000
    13.3 @@ -1,48 +1,7 @@
    13.4 -/****************************************************************************
    13.5 -**
    13.6 -** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies).
    13.7 -** Contact: Nokia Corporation (qt-info@nokia.com)
    13.8 -**
    13.9 -** This file is part of the examples of the Qt Toolkit.
   13.10 -**
   13.11 -** $QT_BEGIN_LICENSE:LGPL$
   13.12 -** Commercial Usage
   13.13 -** Licensees holding valid Qt Commercial licenses may use this file in
   13.14 -** accordance with the Qt Commercial License Agreement provided with the
   13.15 -** Software or, alternatively, in accordance with the terms contained in
   13.16 -** a written agreement between you and Nokia.
   13.17 -**
   13.18 -** GNU Lesser General Public License Usage
   13.19 -** Alternatively, this file may be used under the terms of the GNU Lesser
   13.20 -** General Public License version 2.1 as published by the Free Software
   13.21 -** Foundation and appearing in the file LICENSE.LGPL included in the
   13.22 -** packaging of this file.  Please review the following information to
   13.23 -** ensure the GNU Lesser General Public License version 2.1 requirements
   13.24 -** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
   13.25 -**
   13.26 -** In addition, as a special exception, Nokia gives you certain
   13.27 -** additional rights. These rights are described in the Nokia Qt LGPL
   13.28 -** Exception version 1.0, included in the file LGPL_EXCEPTION.txt in this
   13.29 -** package.
   13.30 -**
   13.31 -** GNU General Public License Usage
   13.32 -** Alternatively, this file may be used under the terms of the GNU
   13.33 -** General Public License version 3.0 as published by the Free Software
   13.34 -** Foundation and appearing in the file LICENSE.GPL included in the
   13.35 -** packaging of this file.  Please review the following information to
   13.36 -** ensure the GNU General Public License version 3.0 requirements will be
   13.37 -** met: http://www.gnu.org/copyleft/gpl.html.
   13.38 -**
   13.39 -** If you are unsure which license is appropriate for your use, please
   13.40 -** contact the sales department at http://www.qtsoftware.com/contact.
   13.41 -** $QT_END_LICENSE$
   13.42 -**
   13.43 -****************************************************************************/
   13.44 -
   13.45  #ifndef MYSORTFILTERPROXYMODEL_H
   13.46  #define MYSORTFILTERPROXYMODEL_H
   13.47  
   13.48 -#include <QDate>
   13.49 +//#include <QDate>
   13.50  #include <QSortFilterProxyModel>
   13.51  
   13.52  //! [0]
   13.53 @@ -52,15 +11,17 @@
   13.54  
   13.55  public:
   13.56      MySortFilterProxyModel(QObject *parent = 0);
   13.57 +/*
   13.58  
   13.59      QDate filterMinimumDate() const { return minDate; }
   13.60      void setFilterMinimumDate(const QDate &date);
   13.61  
   13.62      QDate filterMaximumDate() const { return maxDate; }
   13.63      void setFilterMaximumDate(const QDate &date);
   13.64 -
   13.65  protected:
   13.66 +*/
   13.67      bool filterAcceptsRow(int sourceRow, const QModelIndex &sourceParent) const;
   13.68 +	/*
   13.69      bool lessThan(const QModelIndex &left, const QModelIndex &right) const;
   13.70  
   13.71  private:
   13.72 @@ -68,7 +29,7 @@
   13.73  
   13.74      QDate minDate;
   13.75      QDate maxDate;
   13.76 +*/
   13.77  };
   13.78 -//! [0]
   13.79  
   13.80  #endif
    14.1 --- a/tex/vc	Fri Oct 02 14:31:03 2009 +0000
    14.2 +++ b/tex/vc	Fri Nov 13 08:32:03 2009 +0000
    14.3 @@ -1,6 +1,8 @@
    14.4  #! /bin/bash
    14.5  #
    14.6  
    14.7 +user=vym@insilmaril.de
    14.8 +
    14.9  set -e  # abort on errors
   14.10  shopt -s nullglob  # file globs that don't match expand
   14.11  		   # to nothing
   14.12 @@ -69,10 +71,10 @@
   14.13  #
   14.14  # Add domain to username (if it's me ;-)
   14.15  #
   14.16 -user=`whoami`
   14.17 -if [ $user = "uwedr" ]; then
   14.18 -	user="$user@suse.de"
   14.19 -fi
   14.20 +#user=`whoami`
   14.21 +#if [ $user = "uwedr" ]; then
   14.22 +#	user="$user@suse.de"
   14.23 +#fi
   14.24  
   14.25  COMMENT_FILE=$2
   14.26  
    15.1 --- a/tex/vym.changelog	Fri Oct 02 14:31:03 2009 +0000
    15.2 +++ b/tex/vym.changelog	Fri Nov 13 08:32:03 2009 +0000
    15.3 @@ -1,3 +1,36 @@
    15.4 +-------------------------------------------------------------------
    15.5 +Wed Nov 11 10:32:29 CET 2009 - vym@insilmaril.de
    15.6 +
    15.7 +- Bugfix: New map has mapcenter again
    15.8 +
    15.9 +-------------------------------------------------------------------
   15.10 +Tue Nov 10 13:53:37 CET 2009 - vym@insilmaril.de
   15.11 +
   15.12 +- Bugfix: Autodetection of textformat (ASCII vs. HTML)
   15.13 +- Bugfix: nextBranch failed with xLinks
   15.14 +
   15.15 +-------------------------------------------------------------------
   15.16 +Fri Oct 30 18:58:22 CET 2009 - uwedr@suse.de
   15.17 +
   15.18 +- Bugfix: Selection doesn't get lost when switching maps
   15.19 +
   15.20 +-------------------------------------------------------------------
   15.21 +Wed Oct 28 08:43:34 CET 2009 - uwedr@suse.de
   15.22 +
   15.23 +- Feature: Adding timestamp to branch
   15.24 +
   15.25 +-------------------------------------------------------------------
   15.26 +Wed Oct 21 17:23:13 CEST 2009 - uwedr@suse.de
   15.27 +
   15.28 +- Feature: expand/collapse by one level in TreeEditor 
   15.29 +- Bugfix: Process like webbrowser started by vym survive vym now
   15.30 +
   15.31 +-------------------------------------------------------------------
   15.32 +Tue Oct  6 16:29:07 CEST 2009 - uwedr@suse.de
   15.33 +
   15.34 +- Bugfix: Export to OpenOffice.org
   15.35 +- Bugfix: BranchProp window
   15.36 +
   15.37  -------------------------------------------------------------------
   15.38  Sat Aug  8 23:54:38 CEST 2009 - uwedr@suse.de
   15.39  
    16.1 --- a/texteditor.cpp	Fri Oct 02 14:31:03 2009 +0000
    16.2 +++ b/texteditor.cpp	Fri Nov 13 08:32:03 2009 +0000
    16.3 @@ -15,6 +15,8 @@
    16.4  extern QString iconPath;
    16.5  extern QString vymName;
    16.6  
    16.7 +extern bool debug;
    16.8 +
    16.9  using namespace std;
   16.10  
   16.11  
   16.12 @@ -110,6 +112,30 @@
   16.13  
   16.14  }
   16.15  
   16.16 +void TextEditor::reset()
   16.17 +{
   16.18 +	e->clear();
   16.19 +	actionFormatUseFixedFont->setOn (false);
   16.20 +    actionTextBold->setOn (false);
   16.21 +	e->setBold (false);
   16.22 +
   16.23 +	actionTextUnderline->setOn (false);
   16.24 +	e->setUnderline (false);
   16.25 +
   16.26 +	actionTextItalic->setOn (false);
   16.27 +	e->setItalic (false);
   16.28 +
   16.29 +    QPixmap pix( 16, 16 );
   16.30 +    pix.fill( Qt::black );
   16.31 +    actionTextColor->setIconSet( pix );
   16.32 +	e->setColor (Qt::black);
   16.33 +
   16.34 +	actionAlignSubScript->setOn (false);
   16.35 +	actionAlignSuperScript->setOn (false);
   16.36 +	actionAlignLeft->setOn (true);
   16.37 +	e->setAlignment( Qt::AlignLeft );
   16.38 +}
   16.39 +
   16.40  bool TextEditor::isEmpty()
   16.41  {
   16.42  	if (e->toPlainText().length()>0)
   16.43 @@ -547,7 +573,14 @@
   16.44  {
   16.45  	blockChangedSignal=true;
   16.46  	e->setReadOnly(false);
   16.47 -	e->setText(t);
   16.48 +	reset();
   16.49 +	if (Qt::mightBeRichText (t))
   16.50 +		e->setHtml(t);
   16.51 +	else
   16.52 +	{
   16.53 +		actionFormatUseFixedFont->setChecked (true);
   16.54 +		e->setPlainText(t);
   16.55 +	}	
   16.56  	enableActions();
   16.57  	blockChangedSignal=false;
   16.58  }
    17.1 --- a/texteditor.h	Fri Oct 02 14:31:03 2009 +0000
    17.2 +++ b/texteditor.h	Fri Nov 13 08:32:03 2009 +0000
    17.3 @@ -5,7 +5,6 @@
    17.4  
    17.5  enum EditorState {inactiveEditor,emptyEditor,filledEditor};
    17.6  
    17.7 -class MyTextEdit;
    17.8  class NoteObj;
    17.9  
   17.10  class TextEditor : public QMainWindow {
   17.11 @@ -14,6 +13,7 @@
   17.12      TextEditor();
   17.13      ~TextEditor();
   17.14  
   17.15 +	void reset();
   17.16  	bool isEmpty();
   17.17  	void setShowWithMain (bool);
   17.18  	bool showWithMain ();
    18.1 --- a/treeeditor.cpp	Fri Oct 02 14:31:03 2009 +0000
    18.2 +++ b/treeeditor.cpp	Fri Nov 13 08:32:03 2009 +0000
    18.3 @@ -8,19 +8,17 @@
    18.4  
    18.5  #include "vymmodel.h"
    18.6  
    18.7 -#include "mysortfilterproxymodel.h"
    18.8 -
    18.9  ///////////////////////////////////////////////////////////////////////
   18.10  ///////////////////////////////////////////////////////////////////////
   18.11  TreeEditor::TreeEditor(VymModel *m)
   18.12  {
   18.13  	model=m;
   18.14  
   18.15 -//	MySortFilterProxyModel *proxyModel = new MySortFilterProxyModel(this);	// FIXME-1 trying to use proxy...
   18.16 -	proxyModel = new QSortFilterProxyModel (this);
   18.17 -
   18.18 -	setModel(proxyModel);
   18.19 -	proxyModel->setSourceModel(model);
   18.20 +	// FIXME-2 use proxmodel
   18.21 +	//proxyModel = new MySortFilterProxyModel(this);	
   18.22 +	//setModel(proxyModel);
   18.23 +	setModel(m);
   18.24 +	//proxyModel->setSourceModel(model);
   18.25  
   18.26  	QAction *a;
   18.27  	// Shortcuts for navigating with cursor:
   18.28 @@ -44,14 +42,23 @@
   18.29  	//cout <<"Destructor TreeEditor for "<<model->getMapName().toStdString()<<endl;
   18.30  }
   18.31  
   18.32 -QSortFilterProxyModel* TreeEditor::getProxyModel()
   18.33 +MySortFilterProxyModel* TreeEditor::getProxyModel()
   18.34  {
   18.35  	return proxyModel;
   18.36  }
   18.37  
   18.38 +QModelIndex TreeEditor::getSelectedIndex()
   18.39 +{
   18.40 +	QModelIndexList list=selectionModel()->selectedIndexes();
   18.41 +	if (list.isEmpty() )
   18.42 +		return QModelIndex();
   18.43 +	else
   18.44 +		return list.first();
   18.45 +}
   18.46 +
   18.47 +
   18.48  void TreeEditor::setSortFilter(QString s)
   18.49  {
   18.50 -	cout << "TE::setting sortFilter to "<<s.toStdString()<<endl;
   18.51  	proxyModel->setFilterRegExp(QRegExp(s, Qt::CaseInsensitive));
   18.52  	proxyModel->setFilterKeyColumn(0);
   18.53  	proxyModel->setDynamicSortFilter (true);
   18.54 @@ -59,11 +66,19 @@
   18.55  
   18.56  void TreeEditor::cursorUp()
   18.57  {
   18.58 -	model->select (indexAbove (model->getSelectedIndex() ));
   18.59 +	QModelIndex ix=getSelectedIndex();
   18.60 +	// FIXME-2 useproxymodel ix=proxyModel->mapToSource (indexAbove(ix));
   18.61 +	ix=indexAbove (ix);
   18.62 +	if (ix.isValid())
   18.63 +		model->select (ix );
   18.64  }
   18.65  
   18.66  void TreeEditor::cursorDown()
   18.67  {
   18.68 -	model->select (indexBelow (model->getSelectedIndex() ));
   18.69 +	QModelIndex ix=getSelectedIndex();
   18.70 +	//FIXME-2 useProxymodel ix=proxyModel->mapToSource (indexBelow(ix));
   18.71 +	ix=indexBelow (ix);
   18.72 +	if (ix.isValid())
   18.73 +		model->select (ix );
   18.74  }
   18.75  
    19.1 --- a/treeeditor.h	Fri Oct 02 14:31:03 2009 +0000
    19.2 +++ b/treeeditor.h	Fri Nov 13 08:32:03 2009 +0000
    19.3 @@ -2,7 +2,7 @@
    19.4  #define TREEEDITOR_H
    19.5  
    19.6  #include <QTreeView>
    19.7 -#include <QSortFilterProxyModel>
    19.8 +#include "mysortfilterproxymodel.h"
    19.9  
   19.10  class VymModel;
   19.11  
   19.12 @@ -16,7 +16,8 @@
   19.13  public:
   19.14      TreeEditor(VymModel *m);
   19.15  	~TreeEditor();
   19.16 -	QSortFilterProxyModel *getProxyModel();
   19.17 +	MySortFilterProxyModel *getProxyModel();
   19.18 +	QModelIndex getSelectedIndex();
   19.19  
   19.20  public slots:
   19.21  	void setSortFilter (QString f);
   19.22 @@ -27,7 +28,7 @@
   19.23  
   19.24  private:
   19.25  	VymModel *model;
   19.26 -	QSortFilterProxyModel *proxyModel;
   19.27 +	MySortFilterProxyModel *proxyModel;
   19.28  };
   19.29  
   19.30  #endif
    20.1 --- a/treeitem.cpp	Fri Oct 02 14:31:03 2009 +0000
    20.2 +++ b/treeitem.cpp	Fri Nov 13 08:32:03 2009 +0000
    20.3 @@ -532,7 +532,7 @@
    20.4  BranchItem* TreeItem::getFirstBranch()
    20.5  {
    20.6  	if (branchCounter>0)
    20.7 -		return getBranchNum (branchOffset);
    20.8 +		return getBranchNum (0);
    20.9  	else
   20.10  		return NULL;
   20.11  }
   20.12 @@ -540,7 +540,7 @@
   20.13  BranchItem* TreeItem::getLastBranch()
   20.14  {
   20.15  	if (branchCounter>0)
   20.16 -		return getBranchNum (branchOffset + branchCounter-1);
   20.17 +		return getBranchNum (branchCounter-1);
   20.18  	else
   20.19  		return NULL;
   20.20  }
   20.21 @@ -707,7 +707,7 @@
   20.22  	return hidden;
   20.23  }	
   20.24  
   20.25 -QString TreeItem::getGeneralAttr()
   20.26 +QString TreeItem::getGeneralAttr()	
   20.27  {
   20.28  	QString s;
   20.29  	if (hideExport)
   20.30 @@ -715,7 +715,7 @@
   20.31  	if (!url.isEmpty())
   20.32  		s+=attribut ("url",url);
   20.33  	if (!vymLink.isEmpty())
   20.34 -		s+=attribut ("vymLink",vymLink);
   20.35 +		s+=attribut ("vymLink",convertToRel (model->getDestPath(),vymLink));
   20.36  	return s;	
   20.37  }
   20.38  
    21.1 --- a/treemodel.cpp	Fri Oct 02 14:31:03 2009 +0000
    21.2 +++ b/treemodel.cpp	Fri Nov 13 08:32:03 2009 +0000
    21.3 @@ -146,14 +146,8 @@
    21.4  	return c;
    21.5  }
    21.6  
    21.7 -BranchItem* TreeModel::next(BranchItem* &current, BranchItem* &previous, BranchItem* start)	// FIXME-3 change this to nextBranch and use "next" for all TIs
    21.8 +BranchItem* TreeModel::nextBranch (BranchItem* &current, BranchItem* &previous, bool deepLevelsFirst, BranchItem *start)	
    21.9  {
   21.10 -/*FIXME-3	cout << "TM::next \n"; 
   21.11 -	std::string ch="()"; if (current) ch=current->getHeadingStd();
   21.12 -	std::string ph="()"; if (previous) ph=previous->getHeadingStd();
   21.13 -	cout << "  cur="<<ch << " prev="<<ph<<endl;
   21.14 -*/
   21.15 -
   21.16  	// Walk through map beginning at current with previous==0
   21.17  	// Start at root, if current==NULL
   21.18  	if (!current) current=(BranchItem*)rootItem;
   21.19 @@ -166,63 +160,98 @@
   21.20  		current=current->getFirstBranch();
   21.21  		return current;
   21.22  	}
   21.23 +	if (deepLevelsFirst)
   21.24 +	{
   21.25 +		// Going up or down (deeper)?
   21.26 +		if (current->depth() > previous->depth() )
   21.27 +		{	
   21.28 +			// Coming from above
   21.29 +			// Trying  to go down deeper
   21.30 +			if (current->branchCount() >0 )
   21.31 +			{
   21.32 +				previous=current;
   21.33 +				current=current->getFirstBranch();
   21.34 +				return current;
   21.35 +			}	
   21.36 +			// turn around and go up again
   21.37 +			BranchItem *bi=current;
   21.38 +			current=previous;
   21.39 +			previous=bi;
   21.40 +		}	
   21.41  
   21.42 -	// Going up or down (deeper)?
   21.43 -	if (current->depth() > previous->depth() )
   21.44 -	{	
   21.45 -		// Coming from above
   21.46 -		// Trying  to go down deeper
   21.47 -//		cout << "  trying to go deeper\n";
   21.48 -		if (current->branchCount() >0 )
   21.49 -		{
   21.50 -//			cout << "  yes, going deeper\n";
   21.51 +		// Coming from below
   21.52 +		// Trying to go down again to siblings
   21.53 +
   21.54 +		BranchItem *sibling=current->getBranchNum (previous->num()+1);
   21.55 +
   21.56 +		if (sibling)
   21.57 +		{	
   21.58 +			// Found sibling of previous, go there
   21.59  			previous=current;
   21.60 -			current=current->getFirstBranch();
   21.61 +			current=sibling;
   21.62  			return current;
   21.63 -		}	
   21.64 -		// turn around and go up again
   21.65 -//		cout << "  sorry, turn around\n";
   21.66 -		BranchItem *bi=current;
   21.67 -		current=previous;
   21.68 -		previous=bi;
   21.69 -	}	
   21.70 +		} 
   21.71  
   21.72 -/*
   21.73 -	cout << "  coming from below\n";
   21.74 -	ch="()"; if (current) ch=current->getHeadingStd();
   21.75 -	ph="()"; if (previous) ph=previous->getHeadingStd();
   21.76 -	cout << "  cur="<<ch << " prev="<<ph<<endl;
   21.77 -*/	
   21.78 -	// Coming from below
   21.79 -	// Trying to go down again to siblings
   21.80 +		// If we only needed to go through subtree, we are done now
   21.81 +		if (start==current) return NULL;
   21.82  
   21.83 -	BranchItem *sibling=current->getBranchNum (previous->num()+1);
   21.84 -//	cout <<"    prev->num()="<<previous->num()<<endl;
   21.85 +		// Go up and try to find siblings of current
   21.86 +		previous=current;
   21.87 +		current=(BranchItem*)current->parent();
   21.88  
   21.89 -	if (sibling)
   21.90 -	{	
   21.91 -		// Found sibling of previous, go there
   21.92 -//		cout << "  sib=cur="<<sibling->getHeadingStd()<<endl;
   21.93 -		previous=current;
   21.94 -		current=sibling;
   21.95 +		// Check if we still can go somewhere
   21.96 +		if (!current) return current;
   21.97 +		
   21.98 +		while (current && current->depth() < previous->depth() )
   21.99 +			current=nextBranch (current,previous,true,start);
  21.100 +			
  21.101  		return current;
  21.102 -	} 
  21.103  
  21.104 -	// If we only needed to go through subtree, we are done now
  21.105 -	if (start==current) return NULL;
  21.106 +	} else
  21.107 +	{
  21.108 +/*FIXME-3
  21.109 +		cout << "TM::nextBranch shallow\n"; 
  21.110 +		std::string ch="()"; if (current) ch=current->getHeadingStd();
  21.111 +		std::string ph="()"; if (previous) ph=previous->getHeadingStd();
  21.112 +		cout << "  cur="<<ch << " prev="<<ph<<endl;
  21.113 +*/
  21.114  
  21.115 -	// Go up and try to find siblings of current
  21.116 -//	cout <<"  going up again...\n";
  21.117 -	previous=current;
  21.118 -	current=(BranchItem*)current->parent();
  21.119 +		// Try to find sibling with same depth
  21.120 +		BranchItem *sibling=current->parent()->getBranchNum (current->num()+1);
  21.121 +		if (sibling)
  21.122 +		{	
  21.123 +			// Found sibling of previous, go there
  21.124 +			previous=current;
  21.125 +			current=sibling;
  21.126 +			return current;
  21.127 +		}  else
  21.128 +		{	
  21.129 +			// Try to find next branch with same depth or greater
  21.130 +			
  21.131  
  21.132 -	// Check if we still can go somewhere
  21.133 -	if (!current) return current;
  21.134 -	
  21.135 -	while (current && current->depth() < previous->depth() )
  21.136 -		current=next (current,previous,start);
  21.137 -		
  21.138 -	return current;
  21.139 +			current=NULL;
  21.140 +			return current;
  21.141 +		}
  21.142 +
  21.143 +
  21.144 +		/*
  21.145 +	while (ix.isValid())
  21.146 +	{
  21.147 +		TreeItem *ti=model->getItem (ix);
  21.148 +		cout << "  level="<<level<<"  ix=";
  21.149 +		if (ti) cout << ti->getHeadingStd();
  21.150 +		row=ix.row();
  21.151 +		col=ix.column();
  21.152 +		if (! treeEditor->isExpanded(ix))
  21.153 +			cout <<"  expand!";
  21.154 +		else	
  21.155 +			cout <<"  is expanded.";
  21.156 +		cout <<endl;
  21.157 +		ix=ix.sibling(row+1,col);
  21.158 +	}
  21.159 +	*/
  21.160 +
  21.161 +	}
  21.162  }
  21.163  
  21.164  bool TreeModel::removeRows ( int row, int count, const QModelIndex & parent)
    22.1 --- a/treemodel.h	Fri Oct 02 14:31:03 2009 +0000
    22.2 +++ b/treemodel.h	Fri Nov 13 08:32:03 2009 +0000
    22.3 @@ -29,7 +29,7 @@
    22.4      int rowCount(const QModelIndex &parent = QModelIndex()) const;
    22.5      int columnCount(const QModelIndex &parent = QModelIndex()) const;
    22.6  
    22.7 -	BranchItem* next(BranchItem* &current, BranchItem* &previous, BranchItem* start=NULL);
    22.8 +	BranchItem* nextBranch (BranchItem* &current, BranchItem* &previous, bool deepLevelsFirst=true, BranchItem* start=NULL);
    22.9  
   22.10  	bool removeRows ( int row, int count, 
   22.11  				const QModelIndex & parent = QModelIndex() ); 
    23.1 --- a/version.h	Fri Oct 02 14:31:03 2009 +0000
    23.2 +++ b/version.h	Fri Nov 13 08:32:03 2009 +0000
    23.3 @@ -7,7 +7,7 @@
    23.4  #define __VYM_VERSION "1.13.0"
    23.5  //#define __VYM_CODENAME "Codename: RC-1"
    23.6  #define __VYM_CODENAME "Codename: development version, not for production!"
    23.7 -#define __VYM_BUILD_DATE "2009-10-02"
    23.8 +#define __VYM_BUILD_DATE "2009-11-12"
    23.9  
   23.10  
   23.11  bool checkVersion(const QString &);
    24.1 --- a/vym.pro	Fri Oct 02 14:31:03 2009 +0000
    24.2 +++ b/vym.pro	Fri Nov 13 08:32:03 2009 +0000
    24.3 @@ -75,6 +75,7 @@
    24.4  	ornamentedobj.h \
    24.5  	parser.h \
    24.6  	process.h \
    24.7 +	shortcuts.h\
    24.8  	showtextdialog.h\
    24.9  	simplescripteditor.h\
   24.10  	texteditor.h \
   24.11 @@ -140,6 +141,7 @@
   24.12  	ornamentedobj.cpp \
   24.13  	parser.cpp \
   24.14  	process.cpp \
   24.15 +	shortcuts.cpp\
   24.16  	showtextdialog.cpp \
   24.17  	simplescripteditor.cpp \
   24.18  	texteditor.cpp \
    25.1 --- a/vymmodel.cpp	Fri Oct 02 14:31:03 2009 +0000
    25.2 +++ b/vymmodel.cpp	Fri Nov 13 08:32:03 2009 +0000
    25.3 @@ -70,9 +70,8 @@
    25.4  void VymModel::clear() 
    25.5  {
    25.6  	selModel->clearSelection();
    25.7 -
    25.8 -	//QModelIndex ri=index(rootItem);
    25.9 -	//removeRows (0, rowCount(ri),ri);		// FIXME-3 here should be at least a beginRemoveRows...
   25.10 +	while (rootItem->childCount() >0)
   25.11 +		deleteItem (rootItem->getChildNum(0) );
   25.12  }
   25.13  
   25.14  void VymModel::init () 
   25.15 @@ -149,12 +148,10 @@
   25.16  	// Create MapCenter
   25.17  	//  addMapCenter();  FIXME-2 VM create this in MapEditor until BO and MCO are independent of scene
   25.18  
   25.19 -	//Initialize DBUS
   25.20 +	//Initialize DBUS object
   25.21  	adaptorModel=new AdaptorModel(this);	// Created and not deleted as documented in Qt
   25.22 -	//adaptor->setModel (this);
   25.23 -    //connection.registerObject("/Car", car);
   25.24 -    dbusConnection.registerService("org.insilmaril.VymModel");
   25.25 -    dbusConnection.sessionBus().registerObject ("/Object1",this);
   25.26 +    if (!dbusConnection.registerObject (QString("/vymmodel_%1").arg(mapNum),this))
   25.27 +		qWarning ("VymModel: Couldn't register DBUS object!");
   25.28  }
   25.29  
   25.30  void VymModel::makeTmpDirectories()
   25.31 @@ -1076,7 +1073,9 @@
   25.32  		select (redoSelection);
   25.33  
   25.34  
   25.35 -	parseAtom (redoCommand);
   25.36 +	bool noErr;
   25.37 +	QString errMsg;
   25.38 +	parseAtom (redoCommand,noErr,errMsg);
   25.39  
   25.40  	blockSaveState=blockSaveStateOrg;
   25.41  
   25.42 @@ -1154,7 +1153,10 @@
   25.43  		cout << "    redoSel="<<redoSelection.toStdString()<<endl;
   25.44  		cout << "    ---------------------------"<<endl<<endl;
   25.45  	}	
   25.46 -	parseAtom (undoCommand);
   25.47 +
   25.48 +	bool noErr;
   25.49 +	QString errMsg;
   25.50 +	parseAtom (redoCommand,noErr,errMsg);
   25.51  
   25.52  	undosAvail--;
   25.53  	curStep--; 
   25.54 @@ -1441,11 +1443,11 @@
   25.55  {
   25.56  	BranchItem *cur=NULL;
   25.57  	BranchItem *prev=NULL;
   25.58 -	next(cur,prev);
   25.59 +	nextBranch(cur,prev);
   25.60  	while (cur) 
   25.61  	{
   25.62  		if (s==cur->getID() ) return cur;
   25.63 -		next(cur,prev);
   25.64 +		nextBranch(cur,prev);
   25.65  	}
   25.66  	return NULL;
   25.67  }
   25.68 @@ -1498,11 +1500,11 @@
   25.69  	int c=0;
   25.70  	BranchItem *cur=NULL;
   25.71  	BranchItem *prev=NULL;
   25.72 -	next(cur,prev);
   25.73 +	nextBranch(cur,prev);
   25.74  	while (cur) 
   25.75  	{
   25.76  		c++;
   25.77 -		next(cur,prev);
   25.78 +		nextBranch(cur,prev);
   25.79  	}
   25.80  	return c;
   25.81  }
   25.82 @@ -1545,6 +1547,25 @@
   25.83  		return QString();
   25.84  }
   25.85  
   25.86 +void VymModel::setNote(const QString &s)	//FIXME-2 savestate missing	// FIXME-2 call to VM::updateNoteFlag missing (fix signal handling here)
   25.87 +{
   25.88 +	TreeItem *selti=getSelectedItem();
   25.89 +	if (selti) 
   25.90 +	{
   25.91 +		selti->setNote(s);
   25.92 +		emitNoteHasChanged(selti);
   25.93 +	}
   25.94 +}
   25.95 +
   25.96 +QString VymModel::getNote()
   25.97 +{
   25.98 +	TreeItem *selti=getSelectedItem();
   25.99 +	if (selti)
  25.100 +		return selti->getNote();
  25.101 +	else	
  25.102 +		return QString();
  25.103 +}
  25.104 +
  25.105  BranchItem* VymModel::findText (QString s, bool cs)   
  25.106  {
  25.107  	QTextDocument::FindFlags flags=0;
  25.108 @@ -1557,7 +1578,7 @@
  25.109  			EOFind=false;
  25.110  		findCurrent=NULL;	
  25.111  		findPrevious=NULL;	
  25.112 -		next (findCurrent,findPrevious);
  25.113 +		nextBranch (findCurrent,findPrevious);
  25.114  	}	
  25.115  	bool searching=true;
  25.116  	bool foundNote=false;
  25.117 @@ -1591,7 +1612,7 @@
  25.118  		}	
  25.119  		if (!foundNote)
  25.120  		{
  25.121 -			if (!next(findCurrent,findPrevious) )
  25.122 +			if (!nextBranch(findCurrent,findPrevious) )
  25.123  				EOFind=true;
  25.124  		}
  25.125  	//cout <<"still searching...  "<<qPrintable( itFind->getHeading())<<endl;
  25.126 @@ -1652,7 +1673,7 @@
  25.127  	while (cur) 
  25.128  	{
  25.129  		if (!cur->getURL().isEmpty()) urls.append( cur->getURL());
  25.130 -		cur=next (cur,prev,selbi);
  25.131 +		cur=nextBranch (cur,prev,true,selbi);
  25.132  	}	
  25.133  	return urls;
  25.134  }
  25.135 @@ -1852,6 +1873,23 @@
  25.136  		setHideExport ( !selti->hideInExport() );
  25.137  }
  25.138  
  25.139 +void VymModel::addTimestamp()	//FIXME-3 new function, localize
  25.140 +{
  25.141 +	BranchItem *selbi=addNewBranch();
  25.142 +	if (selbi)
  25.143 +	{
  25.144 +		QDate today=QDate::currentDate();
  25.145 +		QChar c='0';
  25.146 +		selbi->setHeading (QString ("%1-%2-%3")
  25.147 +			.arg(today.year(),4,10,c)
  25.148 +			.arg(today.month(),2,10,c)
  25.149 +			.arg(today.day(),2,10,c));
  25.150 +		emitDataHasChanged ( selbi);	//FIXME-3 maybe emit signal from TreeItem? 
  25.151 +		reposition();
  25.152 +		select (selbi);
  25.153 +	}
  25.154 +}
  25.155 +
  25.156  
  25.157  void VymModel::copy()	
  25.158  {
  25.159 @@ -2283,6 +2321,8 @@
  25.160  {
  25.161  	if (branch && dst)
  25.162  	{
  25.163 +		unselect();
  25.164 +
  25.165  		emit (layoutAboutToBeChanged() );
  25.166  		BranchItem *branchpi=(BranchItem*)branch->parent();
  25.167  		// Remove at current position
  25.168 @@ -2365,7 +2405,7 @@
  25.169  	BranchItem *selbi=getSelectedBranch();
  25.170  
  25.171  	if (selbi)
  25.172 -	{
  25.173 +	{	// Delete branch
  25.174  		unselect();
  25.175  		saveStateRemovingPart (selbi, QString ("Delete %1").arg(getObjectName(selbi)));
  25.176  
  25.177 @@ -2379,7 +2419,7 @@
  25.178  	}
  25.179  	TreeItem *ti=getSelectedItem();
  25.180  	if (ti)
  25.181 -	{
  25.182 +	{	// Delete other item
  25.183  		TreeItem *pi=ti->parent();
  25.184  		if (!pi) return;
  25.185  		if (ti->getType()==TreeItem::Image || ti->getType()==TreeItem::Attribute)
  25.186 @@ -2614,18 +2654,28 @@
  25.187  				cur->toggleScroll(); 
  25.188  				emitDataHasChanged (cur);
  25.189  		}
  25.190 -			cur=next (cur,prev,selbi);
  25.191 +			cur=nextBranch (cur,prev,true,selbi);
  25.192  		}	
  25.193  		updateActions();
  25.194  		reposition();
  25.195  	}	
  25.196  }
  25.197  
  25.198 -void VymModel::emitExpandAll()
  25.199 +void VymModel::emitExpandAll()	
  25.200  {
  25.201  	emit (expandAll() );
  25.202  }
  25.203  
  25.204 +void VymModel::emitExpandOneLevel()	
  25.205 +{
  25.206 +	emit (expandOneLevel () );
  25.207 +}
  25.208 +
  25.209 +void VymModel::emitCollapseOneLevel()	
  25.210 +{
  25.211 +	emit (collapseOneLevel () );
  25.212 +}
  25.213 +
  25.214  void VymModel::toggleStandardFlag (const QString &name, FlagRow *master)
  25.215  {
  25.216  	BranchItem *bi=getSelectedBranch();
  25.217 @@ -2673,7 +2723,6 @@
  25.218  
  25.219  void VymModel::colorBranch (QColor c)	
  25.220  {
  25.221 -cout << "VM::colBranch\n";
  25.222  	BranchItem *selbi=getSelectedBranch();
  25.223  	if (selbi)
  25.224  	{
  25.225 @@ -2705,7 +2754,7 @@
  25.226  		while (cur) 
  25.227  		{
  25.228  			cur->setHeadingColor(c); // color links, color children
  25.229 -			cur=next (cur,prev,selbi);
  25.230 +			cur=nextBranch (cur,prev,true,selbi);
  25.231  		}	
  25.232  	mapScene->update();
  25.233  	}
  25.234 @@ -2883,7 +2932,7 @@
  25.235  	while (cur) 
  25.236  	{
  25.237  		if (!cur->getVymLink().isEmpty()) links.append( cur->getVymLink());
  25.238 -		cur=next (cur,prev,selbi);
  25.239 +		cur=nextBranch (cur,prev,true,selbi);
  25.240  	}	
  25.241  	return links;
  25.242  }
  25.243 @@ -2933,7 +2982,7 @@
  25.244  // Scripting
  25.245  //////////////////////////////////////////////
  25.246  
  25.247 -void VymModel::parseAtom(const QString &atom)
  25.248 +QVariant VymModel::parseAtom(const QString &atom, bool &noErr, QString &errorMsg)
  25.249  {
  25.250  	TreeItem* selti=getSelectedItem();
  25.251  	BranchItem *selbi=getSelectedBranch();
  25.252 @@ -2941,6 +2990,7 @@
  25.253  	double x,y;
  25.254  	int n;
  25.255  	bool b,ok;
  25.256 +	QVariant returnValue;
  25.257  
  25.258  	// Split string s into command and parameters
  25.259  	parser.parseAtom (atom);
  25.260 @@ -3248,6 +3298,14 @@
  25.261  			exportXML (fname,false);
  25.262  		}
  25.263  	/////////////////////////////////////////////////////////////////////
  25.264 +	} else if (com=="getHeading")
  25.265 +	{ 
  25.266 +		if (!selti)
  25.267 +		{
  25.268 +			parser.setError (Aborted,"Nothing selected");
  25.269 +		} else if (parser.checkParCount(0))
  25.270 +			returnValue=selti->getHeading();
  25.271 +	/////////////////////////////////////////////////////////////////////
  25.272  	} else if (com=="importDir")
  25.273  	{
  25.274  		if (!selti)
  25.275 @@ -3567,6 +3625,21 @@
  25.276  				parser.setError (Aborted,"Could not select latest added object ");
  25.277  		}	
  25.278  	/////////////////////////////////////////////////////////////////////
  25.279 +	} else if (com=="setFlag")
  25.280 +	{
  25.281 +		if (!selti )
  25.282 +		{
  25.283 +			parser.setError (Aborted,"Nothing selected");
  25.284 +		} else if (! selbi )
  25.285 +		{				  
  25.286 +			parser.setError (Aborted,"Type of selection is not a branch");
  25.287 +		} else if (parser.checkParCount(1))
  25.288 +		{
  25.289 +			s=parser.parString(ok,0);
  25.290 +			if (ok) 
  25.291 +				selbi->activateStandardFlag(s);
  25.292 +		}
  25.293 +	/////////////////////////////////////////////////////////////////////
  25.294  	} else if (com=="setFrameType")
  25.295  	{
  25.296  		if ( selectionType()!=TreeItem::Branch && selectionType()!= TreeItem::MapCenter && selectionType()!=TreeItem::Image)
  25.297 @@ -3627,57 +3700,22 @@
  25.298  			if (ok) setFrameBorderWidth (n);
  25.299  		}	
  25.300  	/////////////////////////////////////////////////////////////////////
  25.301 -	} else if (com=="setMapAuthor")
  25.302 -	{
  25.303 -		if (parser.checkParCount(1))
  25.304 -		{
  25.305 -			s=parser.parString(ok,0);
  25.306 -			if (ok) setAuthor (s);
  25.307 -		}	
  25.308 -	/////////////////////////////////////////////////////////////////////
  25.309 -	} else if (com=="setMapComment")
  25.310 -	{
  25.311 -		if (parser.checkParCount(1))
  25.312 -		{
  25.313 -			s=parser.parString(ok,0);
  25.314 -			if (ok) setComment(s);
  25.315 -		}	
  25.316 -	/////////////////////////////////////////////////////////////////////
  25.317 -	} else if (com=="setMapBackgroundColor")
  25.318 +	/* FIXME-2  else if (com=="setFrameType")
  25.319  	{
  25.320  		if (!selti )
  25.321  		{
  25.322  			parser.setError (Aborted,"Nothing selected");
  25.323 -		} else if (! selbi )
  25.324 +		} else if (! selb )
  25.325  		{				  
  25.326  			parser.setError (Aborted,"Type of selection is not a branch");
  25.327  		} else if (parser.checkParCount(1))
  25.328  		{
  25.329 -			QColor c=parser.parColor (ok,0);
  25.330 -			if (ok) setMapBackgroundColor (c);
  25.331 -		}	
  25.332 +			s=parser.parString(ok,0);
  25.333 +			if (ok) 
  25.334 +				setFrameType (s);
  25.335 +		}
  25.336  	/////////////////////////////////////////////////////////////////////
  25.337 -	} else if (com=="setMapDefLinkColor")
  25.338 -	{
  25.339 -		if (!selti )
  25.340 -		{
  25.341 -			parser.setError (Aborted,"Nothing selected");
  25.342 -		} else if (! selbi )
  25.343 -		{				  
  25.344 -			parser.setError (Aborted,"Type of selection is not a branch");
  25.345 -		} else if (parser.checkParCount(1))
  25.346 -		{
  25.347 -			QColor c=parser.parColor (ok,0);
  25.348 -			if (ok) setMapDefLinkColor (c);
  25.349 -		}	
  25.350 -	/////////////////////////////////////////////////////////////////////
  25.351 -	} else if (com=="setMapLinkStyle")
  25.352 -	{
  25.353 -		if (parser.checkParCount(1))
  25.354 -		{
  25.355 -			s=parser.parString (ok,0);
  25.356 -			if (ok) setMapLinkStyle(s);
  25.357 -		}	
  25.358 +	} else*/ 
  25.359  	/////////////////////////////////////////////////////////////////////
  25.360  	} else if (com=="setHeading")
  25.361  	{
  25.362 @@ -3750,6 +3788,73 @@
  25.363  			if (ok) setHideLinkUnselected(b);
  25.364  		}
  25.365  	/////////////////////////////////////////////////////////////////////
  25.366 +	} else if (com=="setMapAuthor")
  25.367 +	{
  25.368 +		if (parser.checkParCount(1))
  25.369 +		{
  25.370 +			s=parser.parString(ok,0);
  25.371 +			if (ok) setAuthor (s);
  25.372 +		}	
  25.373 +	/////////////////////////////////////////////////////////////////////
  25.374 +	} else if (com=="setMapComment")
  25.375 +	{
  25.376 +		if (parser.checkParCount(1))
  25.377 +		{
  25.378 +			s=parser.parString(ok,0);
  25.379 +			if (ok) setComment(s);
  25.380 +		}	
  25.381 +	/////////////////////////////////////////////////////////////////////
  25.382 +	} else if (com=="setMapBackgroundColor")
  25.383 +	{
  25.384 +		if (!selti )
  25.385 +		{
  25.386 +			parser.setError (Aborted,"Nothing selected");
  25.387 +		} else if (! selbi )
  25.388 +		{				  
  25.389 +			parser.setError (Aborted,"Type of selection is not a branch");
  25.390 +		} else if (parser.checkParCount(1))
  25.391 +		{
  25.392 +			QColor c=parser.parColor (ok,0);
  25.393 +			if (ok) setMapBackgroundColor (c);
  25.394 +		}	
  25.395 +	/////////////////////////////////////////////////////////////////////
  25.396 +	} else if (com=="setMapDefLinkColor")
  25.397 +	{
  25.398 +		if (!selti )
  25.399 +		{
  25.400 +			parser.setError (Aborted,"Nothing selected");
  25.401 +		} else if (! selbi )
  25.402 +		{				  
  25.403 +			parser.setError (Aborted,"Type of selection is not a branch");
  25.404 +		} else if (parser.checkParCount(1))
  25.405 +		{
  25.406 +			QColor c=parser.parColor (ok,0);
  25.407 +			if (ok) setMapDefLinkColor (c);
  25.408 +		}	
  25.409 +	/////////////////////////////////////////////////////////////////////
  25.410 +	} else if (com=="setMapLinkStyle")
  25.411 +	{
  25.412 +		if (parser.checkParCount(1))
  25.413 +		{
  25.414 +			s=parser.parString (ok,0);
  25.415 +			if (ok) setMapLinkStyle(s);
  25.416 +		}	
  25.417 +	/////////////////////////////////////////////////////////////////////
  25.418 +	} else if (com=="setNote")
  25.419 +	{
  25.420 +		if (!selti )
  25.421 +		{
  25.422 +			parser.setError (Aborted,"Nothing selected");
  25.423 +		} else if (! selbi )
  25.424 +		{				  
  25.425 +			parser.setError (Aborted,"Type of selection is not a branch");
  25.426 +		} else if (parser.checkParCount(1))
  25.427 +		{
  25.428 +			s=parser.parString (ok,0);
  25.429 +			if (ok) 
  25.430 +				setNote (s);
  25.431 +		}	
  25.432 +	/////////////////////////////////////////////////////////////////////
  25.433  	} else if (com=="setSelectionColor")
  25.434  	{
  25.435  		if (parser.checkParCount(1))
  25.436 @@ -3785,39 +3890,7 @@
  25.437  			s=parser.parString (ok,0);
  25.438  			if (ok) setVymLink(s);
  25.439  		}	
  25.440 -	}
  25.441 -	/////////////////////////////////////////////////////////////////////
  25.442 -	else if (com=="setFlag")
  25.443 -	{
  25.444 -		if (!selti )
  25.445 -		{
  25.446 -			parser.setError (Aborted,"Nothing selected");
  25.447 -		} else if (! selbi )
  25.448 -		{				  
  25.449 -			parser.setError (Aborted,"Type of selection is not a branch");
  25.450 -		} else if (parser.checkParCount(1))
  25.451 -		{
  25.452 -			s=parser.parString(ok,0);
  25.453 -			if (ok) 
  25.454 -				selbi->activateStandardFlag(s);
  25.455 -		}
  25.456 -	/////////////////////////////////////////////////////////////////////
  25.457 -	} else /* FIXME-2 if (com=="setFrameType")
  25.458 -	{
  25.459 -		if (!selti )
  25.460 -		{
  25.461 -			parser.setError (Aborted,"Nothing selected");
  25.462 -		} else if (! selb )
  25.463 -		{				  
  25.464 -			parser.setError (Aborted,"Type of selection is not a branch");
  25.465 -		} else if (parser.checkParCount(1))
  25.466 -		{
  25.467 -			s=parser.parString(ok,0);
  25.468 -			if (ok) 
  25.469 -				setFrameType (s);
  25.470 -		}
  25.471 -	/////////////////////////////////////////////////////////////////////
  25.472 -	} else*/ if (com=="sortChildren")
  25.473 +	} else if (com=="sortChildren")
  25.474  	{
  25.475  		if (!selti )
  25.476  		{
  25.477 @@ -3894,21 +3967,34 @@
  25.478  	{
  25.479  		// setChanged();  FIXME-2 should not be called e.g. for export?!
  25.480  		reposition();
  25.481 +		errorMsg.clear();
  25.482 +		noErr=true;
  25.483  	}	
  25.484  	else	
  25.485  	{
  25.486  		// TODO Error handling
  25.487  		qWarning("VymModel::parseAtom: Error!");
  25.488 +
  25.489  		qWarning(parser.errorMessage());
  25.490 +		noErr=false;
  25.491 +		errorMsg=parser.errorMessage();
  25.492  	} 
  25.493 +	return returnValue;
  25.494  }
  25.495  
  25.496  void VymModel::runScript (QString script)
  25.497  {
  25.498  	parser.setScript (script);
  25.499  	parser.runScript();
  25.500 -	while (parser.next() ) 
  25.501 -		parseAtom(parser.getAtom());
  25.502 +	QVariant r;
  25.503 +	bool noErr=true;
  25.504 +	QString errMsg;
  25.505 +	while (parser.next() && noErr) 
  25.506 +	{
  25.507 +		r=parseAtom(parser.getAtom(),noErr,errMsg);
  25.508 +		if (!noErr)	//FIXME-3 need dialog box here
  25.509 +			cout << "VM::runScript aborted:\n"<<errMsg.toStdString()<<endl;
  25.510 +	}	
  25.511  }
  25.512  
  25.513  void VymModel::setExportMode (bool b)
  25.514 @@ -4166,12 +4252,12 @@
  25.515  	BranchItem *cur=NULL;
  25.516  	BranchItem *prev=NULL;
  25.517  	BranchObj *bo;
  25.518 -	next (cur,prev);
  25.519 +	nextBranch (cur,prev);
  25.520  	while (cur) 
  25.521  	{
  25.522  		bo=(BranchObj*)(cur->getLMO() );
  25.523  		bo->setLinkStyle(bo->getDefLinkStyle(cur->parent() ));	//FIXME-3 better emit dataCHanged and leave the changes to View
  25.524 -		cur=next(cur,prev);
  25.525 +		cur=nextBranch(cur,prev);
  25.526  	}
  25.527  	reposition();
  25.528  }
  25.529 @@ -4194,12 +4280,12 @@
  25.530  	BranchItem *cur=NULL;
  25.531  	BranchItem *prev=NULL;
  25.532  	BranchObj *bo;
  25.533 -	cur=next(cur,prev);
  25.534 +	cur=nextBranch(cur,prev);
  25.535  	while (cur) 
  25.536  	{
  25.537  		bo=(BranchObj*)(cur->getLMO() );
  25.538  		bo->setLinkColor();
  25.539 -		next(cur,prev);
  25.540 +		nextBranch(cur,prev);
  25.541  	}
  25.542  	updateActions();
  25.543  }
  25.544 @@ -4210,12 +4296,12 @@
  25.545  	BranchItem *cur=NULL;
  25.546  	BranchItem *prev=NULL;
  25.547  	BranchObj *bo;
  25.548 -	cur=next(cur,prev);
  25.549 +	cur=nextBranch(cur,prev);
  25.550  	while (cur) 
  25.551  	{
  25.552  		bo=(BranchObj*)(cur->getLMO() );
  25.553  		bo->setLinkColor();
  25.554 -		cur=next(cur,prev);
  25.555 +		cur=nextBranch(cur,prev);
  25.556  	}
  25.557  }
  25.558  
  25.559 @@ -4234,12 +4320,12 @@
  25.560  	BranchItem *cur=NULL;
  25.561  	BranchItem *prev=NULL;
  25.562  	BranchObj *bo;
  25.563 -	cur=next(cur,prev);
  25.564 +	cur=nextBranch(cur,prev);
  25.565  	while (cur) 
  25.566  	{
  25.567  		bo=(BranchObj*)(cur->getLMO() );
  25.568  		bo->setLinkColor();
  25.569 -		next(cur,prev);
  25.570 +		nextBranch(cur,prev);
  25.571  	}
  25.572  }
  25.573  
  25.574 @@ -4544,8 +4630,11 @@
  25.575  		QString t;
  25.576  		in >>t;
  25.577  		if (debug)
  25.578 -			cout << "  t="<<qPrintable (t)<<endl;
  25.579 -		parseAtom (t);
  25.580 +			cout << "VymModel::readData  command="<<qPrintable (t)<<endl;
  25.581 +		bool noErr;
  25.582 +		QString errMsg;
  25.583 +		parseAtom (t,noErr,errMsg);
  25.584 +
  25.585  	}
  25.586  	return;
  25.587  }
  25.588 @@ -4717,8 +4806,11 @@
  25.589  
  25.590  void VymModel::unselect()
  25.591  {
  25.592 -	lastSelectString=getSelectString();
  25.593 -	selModel->clearSelection();
  25.594 +	if (!selModel->selectedIndexes().isEmpty())
  25.595 +	{
  25.596 +		lastSelectString=getSelectString();
  25.597 +		selModel->clearSelection();
  25.598 +	}
  25.599  }	
  25.600  
  25.601  bool VymModel::reselect()
    26.1 --- a/vymmodel.h	Fri Oct 02 14:31:03 2009 +0000
    26.2 +++ b/vymmodel.h	Fri Nov 13 08:32:03 2009 +0000
    26.3 @@ -254,11 +254,14 @@
    26.4  public:
    26.5  	void setHeading(const QString &);		//!< Set heading of item	
    26.6  	QString getHeading ();					//!< Get heading of item
    26.7 +	void setNote(const QString &s);			//!< Set note text
    26.8 +	QString getNote();						//!< Get note text
    26.9  
   26.10  private:
   26.11  	BranchItem* findCurrent;				// next object in find process
   26.12  	BranchItem* findPrevious;				// next object in find process
   26.13  	bool EOFind;							// true, if search failed
   26.14 +
   26.15  public:
   26.16      BranchItem* findText(QString,bool);		// Find object
   26.17      void findReset();						// Reset Search
   26.18 @@ -284,6 +287,8 @@
   26.19  	/*! Should object be hidden in exports (clouded)? */
   26.20  	void toggleHideExport();		
   26.21  
   26.22 +	void addTimestamp();		
   26.23 +
   26.24      void copy();						//!< Copy to clipboard
   26.25  private:	
   26.26      void pasteNoSave(const int &n);		//!< paste clipboard to branch
   26.27 @@ -358,8 +363,12 @@
   26.28      void toggleScroll();
   26.29      void unscrollChildren();
   26.30  	void emitExpandAll();
   26.31 +	void emitExpandOneLevel();
   26.32 +	void emitCollapseOneLevel();
   26.33  signals:	
   26.34  	void expandAll();
   26.35 +	void expandOneLevel();
   26.36 +	void collapseOneLevel();
   26.37  
   26.38  public:	
   26.39  	void toggleStandardFlag (const QString &name, FlagRow *master=NULL);
   26.40 @@ -392,7 +401,7 @@
   26.41  public:	
   26.42  
   26.43  	/* \brief Process one command and its parameters */
   26.44 -    void parseAtom (const QString &atom);	
   26.45 +    QVariant parseAtom (const QString &atom, bool &noError, QString &errorMsg);	
   26.46  
   26.47  	/* \brief Runs the script */
   26.48  	void runScript (QString script);
    27.1 --- a/vymview.cpp	Fri Oct 02 14:31:03 2009 +0000
    27.2 +++ b/vymview.cpp	Fri Nov 13 08:32:03 2009 +0000
    27.3 @@ -3,6 +3,7 @@
    27.4  #include <iostream>
    27.5  using namespace std;
    27.6  
    27.7 +#include "branchitem.h"
    27.8  #include "mainwindow.h"
    27.9  #include "mapeditor.h"
   27.10  #include "treeeditor.h"
   27.11 @@ -22,11 +23,12 @@
   27.12  	treeEditor->setColumnWidth (0,150);
   27.13  	treeEditor->setAnimated (true);
   27.14  
   27.15 -	proxySelModel=treeEditor->selectionModel();
   27.16 +	// FIXME-2 use proxySelModel=treeEditor->selectionModel();
   27.17  	selModel=new QItemSelectionModel (model);
   27.18  
   27.19  	//model->setSelectionModel (proxySelModel);
   27.20  	model->setSelectionModel (selModel);
   27.21 +	treeEditor->setSelectionModel (selModel);
   27.22  
   27.23  	// Create good old MapEditor
   27.24  	mapEditor=model->getMapEditor();
   27.25 @@ -35,23 +37,27 @@
   27.26  	// Connect selections
   27.27  
   27.28  		// Proxymodel changed
   27.29 +		/*
   27.30  		connect (
   27.31  			proxySelModel, SIGNAL (selectionChanged(const QItemSelection &, const QItemSelection &)), 
   27.32  			this,SLOT (changeProxySelection(const QItemSelection &,const QItemSelection &)));
   27.33 +*/
   27.34  
   27.35 -		// Model changed	
   27.36 +		// Selection in Model changed	
   27.37  		connect (
   27.38  			selModel, SIGNAL (selectionChanged(const QItemSelection &, const QItemSelection &)), 
   27.39  			this,SLOT (changeSelection(const QItemSelection &,const QItemSelection &)));
   27.40  
   27.41 -		connect (
   27.42 -			model, SIGNAL (selectionChanged(const QItemSelection &, const QItemSelection &)),
   27.43 -			mapEditor,SLOT (updateSelection(const QItemSelection &,const QItemSelection &)));
   27.44 -			//FIXME-3 above and below necessary???
   27.45 +		// Tell MapEditor to update selection
   27.46  		connect (
   27.47  			selModel, SIGNAL (selectionChanged(const QItemSelection &, const QItemSelection &)), 
   27.48  			mapEditor,SLOT (updateSelection(const QItemSelection &,const QItemSelection &)));
   27.49  
   27.50 +		// FIXME-2 testing, if that reenables updating selbox during animation
   27.51 +		connect (
   27.52 +			model, SIGNAL (selectionChanged(const QItemSelection &, const QItemSelection &)), 
   27.53 +			mapEditor,SLOT (updateSelection(const QItemSelection &,const QItemSelection &)));
   27.54 +
   27.55  	// Connect data changed signals	
   27.56  	connect (
   27.57  		model, SIGNAL (dataChanged(const QModelIndex &, const QModelIndex &)), 
   27.58 @@ -70,6 +76,14 @@
   27.59  		this, SLOT (expandAll () ) );
   27.60  		
   27.61  	connect (
   27.62 +		model, SIGNAL (expandOneLevel() ),
   27.63 +		this, SLOT (expandOneLevel() ) );
   27.64 +		
   27.65 +	connect (
   27.66 +		model, SIGNAL (collapseOneLevel() ),
   27.67 +		this, SLOT (collapseOneLevel() ) );
   27.68 +		
   27.69 +	connect (
   27.70  		model, SIGNAL (showSelection() ),
   27.71  		this, SLOT (showSelection() ) );
   27.72  		
   27.73 @@ -112,10 +126,22 @@
   27.74  	// Notify mainwindow to update satellites like NoteEditor, if needed (model==currenModel...)
   27.75  	mainWindow->changeSelection (model,newsel,oldsel);	// FIXME-5 maybe connect VymModel <-> MainWindow directly?
   27.76  	// would require to also get current model in mainWindow
   27.77 -	proxySelModel->select (
   27.78 -		treeEditor->getProxyModel()->mapSelectionFromSource (newsel),
   27.79 -		QItemSelectionModel::ClearAndSelect );
   27.80 -	showSelection();
   27.81 +
   27.82 +	cout << "VV::changeSelection   newsel.count="<<newsel.indexes().count()<<endl;
   27.83 +
   27.84 +	if (newsel.indexes().count()>0)
   27.85 +	{
   27.86 +
   27.87 +	/* FIXME-2 use proxymodel
   27.88 +		proxySelModel->select (
   27.89 +			treeEditor->getProxyModel()->mapSelectionFromSource (newsel),
   27.90 +			QItemSelectionModel::ClearAndSelect );
   27.91 +		*/
   27.92 +		QModelIndex ix=newsel.indexes().first();
   27.93 +		selModel->setCurrentIndex (ix,QItemSelectionModel::ClearAndSelect  );
   27.94 +		treeEditor->setCurrentIndex (ix);
   27.95 +		showSelection();
   27.96 +	}
   27.97  }
   27.98  
   27.99  void VymView::changeProxySelection (const QItemSelection &newsel, const QItemSelection &oldsel)
  27.100 @@ -123,9 +149,22 @@
  27.101  	// Notify mainwindow to update satellites, but map selection to 
  27.102  	// original model first
  27.103  
  27.104 +	cout << "VV::changeProxySelection   newsel.count="<<newsel.indexes().count()<<endl;
  27.105 +	if (!newsel.indexes().isEmpty())
  27.106 +	{
  27.107 +	/* FIXME-2 need to set current, too
  27.108 +	*/
  27.109 +		proxySelModel->setCurrentIndex (
  27.110 +			newsel.indexes().first(),
  27.111 +			QItemSelectionModel::ClearAndSelect );
  27.112 +	treeEditor->setCurrentIndex (newsel.indexes().first() );
  27.113 +	}
  27.114 +
  27.115  	// Re-emit but map selection first
  27.116 -	selModel->select (treeEditor->getProxyModel()->mapSelectionToSource (newsel),
  27.117 +	selModel->select (
  27.118 +		treeEditor->getProxyModel()->mapSelectionToSource (newsel),
  27.119  		QItemSelectionModel::ClearAndSelect );
  27.120 +
  27.121  	showSelection();
  27.122  }
  27.123  
  27.124 @@ -134,6 +173,85 @@
  27.125  	treeEditor->expandAll();
  27.126  }
  27.127  
  27.128 +void VymView::expandOneLevel()
  27.129 +{
  27.130 +	int level=999999;
  27.131 +	int d;
  27.132 +	BranchItem *cur=NULL;
  27.133 +	BranchItem *prev=NULL;
  27.134 +	QModelIndex pix;
  27.135 +
  27.136 +	// Find level to expand
  27.137 +	model->nextBranch(cur,prev);
  27.138 +	while (cur) 
  27.139 +	{
  27.140 +		// FIXME-2 use proxy pix=treeEditor->getProxyModel()->mapFromSource (model->index (cur));
  27.141 +		pix=model->index (cur);
  27.142 +		d=cur->depth();
  27.143 +		if (!treeEditor->isExpanded(pix) && d < level)
  27.144 +			level=d;
  27.145 +		model->nextBranch(cur,prev);	
  27.146 +	}
  27.147 +
  27.148 +	// Expand all to level
  27.149 +	cur=NULL;
  27.150 +	prev=NULL;
  27.151 +	model->nextBranch(cur,prev);
  27.152 +	while (cur) 
  27.153 +	{
  27.154 +		// FIXME-2 use proxy pix=treeEditor->getProxyModel()->mapFromSource (model->index (cur));
  27.155 +		pix=model->index (cur);
  27.156 +		d=cur->depth();
  27.157 +		if (!treeEditor->isExpanded(pix) && d <= level && cur->branchCount()>0)
  27.158 +			treeEditor->setExpanded(pix,true);
  27.159 +		model->nextBranch(cur,prev);	
  27.160 +	}
  27.161 +	/* FIXME-3 optimize expanding by using flat version of next
  27.162 +	model->nextBranch(cur,prev,false);
  27.163 +	while (cur) 
  27.164 +	{
  27.165 +		cout << "ok: "<<cur->getHeadingStd()<<endl./re/videochristinaprison1_wmvl.wmv
  27.166 +;
  27.167 +		model->nextBranch(cur,prev,false);	
  27.168 +	}
  27.169 +	*/
  27.170 +}
  27.171 +
  27.172 +void VymView::collapseOneLevel()
  27.173 +{
  27.174 +	int level=-1;
  27.175 +	int d;
  27.176 +	BranchItem *cur=NULL;
  27.177 +	BranchItem *prev=NULL;
  27.178 +	QModelIndex pix;
  27.179 +
  27.180 +	// Find level to collapse
  27.181 +	model->nextBranch(cur,prev);
  27.182 +	while (cur) 
  27.183 +	{
  27.184 +		// FIXME-2 use proxy pix=treeEditor->getProxyModel()->mapFromSource (model->index (cur));
  27.185 +		pix=model->index (cur);
  27.186 +		d=cur->depth();
  27.187 +		if (treeEditor->isExpanded(pix) && d > level)
  27.188 +			level=d;
  27.189 +		model->nextBranch(cur,prev);	
  27.190 +	}
  27.191 +
  27.192 +	// collapse all to level
  27.193 +	cur=NULL;
  27.194 +	prev=NULL;
  27.195 +	model->nextBranch(cur,prev);
  27.196 +	while (cur) 
  27.197 +	{
  27.198 +		// FIXME-2 use proxy pix=treeEditor->getProxyModel()->mapFromSource (model->index (cur));
  27.199 +		pix=model->index (cur);
  27.200 +		d=cur->depth();
  27.201 +		if (treeEditor->isExpanded(pix) && d >= level)
  27.202 +			treeEditor->setExpanded(pix,false);
  27.203 +		model->nextBranch(cur,prev);	
  27.204 +	}
  27.205 +}
  27.206 +
  27.207  void VymView::showSelection()
  27.208  {
  27.209  	QModelIndex ix=model->getSelectedIndex();
    28.1 --- a/vymview.h	Fri Oct 02 14:31:03 2009 +0000
    28.2 +++ b/vymview.h	Fri Nov 13 08:32:03 2009 +0000
    28.3 @@ -25,6 +25,8 @@
    28.4  	void changeSelection (const QItemSelection &newSel, const QItemSelection &delSel);
    28.5  	void changeProxySelection (const QItemSelection &newSel, const QItemSelection &delSel);
    28.6  	void expandAll ();
    28.7 +	void expandOneLevel ();
    28.8 +	void collapseOneLevel ();
    28.9  	void showSelection ();
   28.10  
   28.11  private: