ProgressBar during load and more fixes
authorinsilmaril
Thu Mar 19 11:45:28 2009 +0000 (2009-03-19)
changeset 74254d44ecd6097
parent 741 1b4d1ea6ea8c
child 743 5b635536ca7d
ProgressBar during load and more fixes
aboutdialog.cpp
branchobj.cpp
demos/math.vym
demos/vym-projectplan.vym
exports.cpp
exports.h
flagrowobj.cpp
imports.cpp
imports.h
main.cpp
mainwindow.cpp
mainwindow.h
mapeditor.cpp
version.h
vym.pro
vymmodel.cpp
vymmodel.h
vymview.cpp
vymview.h
xml-vym.cpp
xml-vym.h
     1.1 --- a/aboutdialog.cpp	Fri Mar 06 15:02:58 2009 +0000
     1.2 +++ b/aboutdialog.cpp	Thu Mar 19 11:45:28 2009 +0000
     1.3 @@ -59,6 +59,7 @@
     1.4  	"    <li>Brasilian: Amadeu Júnior</li>"
     1.5  	"    <li>Russion: Anton Olenev</li>"
     1.6  	"    <li>Simplified Chinese: Moligaloo</li>"
     1.7 +	"    <li>Traditional Chinese: Wei-Lun Chao </li>"
     1.8  	"  </ul>"
     1.9  	"</li>"
    1.10  	"<li> Patches"
     2.1 --- a/branchobj.cpp	Fri Mar 06 15:02:58 2009 +0000
     2.2 +++ b/branchobj.cpp	Thu Mar 19 11:45:28 2009 +0000
     2.3 @@ -1537,7 +1537,8 @@
     2.4  
     2.5  void BranchObj::select()	// FIXME try to get rid of this in BO completely
     2.6  {
     2.7 -	// update NoteEditor
     2.8 +	cout << "BO::select()\n";
     2.9 +	// update NoteEditor   FIXME do this via VymView::changeSelection
    2.10  	textEditor->setText(note.getNote() );
    2.11  	QString fnh=note.getFilenameHint();
    2.12  	if (fnh!="")
    2.13 @@ -1550,11 +1551,12 @@
    2.14  	// set selected and visible
    2.15      LinkableMapObj::select();
    2.16  
    2.17 -    //if (po)	po->setLastSelectedBranch(this);
    2.18 +    //if (po)	po->setLastSelectedBranch(this);  FIXME needed?
    2.19  		
    2.20  	// temporary unscroll, if we have scrolled parents somewhere
    2.21  	if (parObj) ((BranchObj*)(parObj))->tmpUnscroll();
    2.22  
    2.23 +	/* FIXME moved to vymmodel or vymview...
    2.24  	// Show URL and link in statusbar
    2.25  	QString status;
    2.26  	if (!url.isEmpty()) status+="URL: "+url+"  ";
    2.27 @@ -1566,6 +1568,7 @@
    2.28  
    2.29  	// Update actions
    2.30  	model->updateActions();
    2.31 +	*/
    2.32  }
    2.33  
    2.34  void BranchObj::unselect()
     3.1 Binary file demos/math.vym has changed
     4.1 Binary file demos/vym-projectplan.vym has changed
     5.1 --- a/exports.cpp	Fri Mar 06 15:02:58 2009 +0000
     5.2 +++ b/exports.cpp	Thu Mar 19 11:45:28 2009 +0000
     5.3 @@ -262,11 +262,41 @@
     5.4  }
     5.5  
     5.6  ////////////////////////////////////////////////////////////////////////
     5.7 -void ExportKDEBookmarks::doExport() 
     5.8 +void ExportKDE3Bookmarks::doExport() 
     5.9  {
    5.10  	WarningDialog dia;
    5.11  	dia.showCancelButton (true);
    5.12  	dia.setText(QObject::tr("Exporting the %1 bookmarks will overwrite\nyour existing bookmarks file.").arg("KDE"));
    5.13 +	dia.setCaption(QObject::tr("Warning: Overwriting %1 bookmarks").arg("KDE 3"));
    5.14 +	dia.setShowAgainName("/exports/KDE/overwriteKDEBookmarks");
    5.15 +	if (dia.exec()==QDialog::Accepted)
    5.16 +	{
    5.17 +		model->exportXML(tmpDir.path(),false);
    5.18 +
    5.19 +		XSLTProc p;
    5.20 +		p.setInputFile (tmpDir.path()+"/"+model->getMapName()+".xml");
    5.21 +		p.setOutputFile (tmpDir.home().path()+"/.kde/share/apps/konqueror/bookmarks.xml");
    5.22 +		p.setXSLFile (vymBaseDir.path()+"/styles/vym2kdebookmarks.xsl");
    5.23 +		p.process();
    5.24 +
    5.25 +		QString ub=vymBaseDir.path()+"/scripts/update-bookmarks";
    5.26 +		QProcess *proc= new QProcess ;
    5.27 +		proc->start( ub);
    5.28 +		if (!proc->waitForStarted())
    5.29 +		{
    5.30 +			QMessageBox::warning(0, 
    5.31 +				QObject::tr("Warning"),
    5.32 +				QObject::tr("Couldn't find script %1\nto notifiy Browsers of changed bookmarks.").arg(ub));
    5.33 +		}	
    5.34 +	}
    5.35 +}
    5.36 +
    5.37 +////////////////////////////////////////////////////////////////////////
    5.38 +void ExportKDE4Bookmarks::doExport() 
    5.39 +{
    5.40 +	WarningDialog dia;
    5.41 +	dia.showCancelButton (true);
    5.42 +	dia.setText(QObject::tr("Exporting the %1 bookmarks will overwrite\nyour existing bookmarks file.").arg("KDE 4"));
    5.43  	dia.setCaption(QObject::tr("Warning: Overwriting %1 bookmarks").arg("KDE"));
    5.44  	dia.setShowAgainName("/exports/KDE/overwriteKDEBookmarks");
    5.45  	if (dia.exec()==QDialog::Accepted)
    5.46 @@ -275,7 +305,7 @@
    5.47  
    5.48  		XSLTProc p;
    5.49  		p.setInputFile (tmpDir.path()+"/"+model->getMapName()+".xml");
    5.50 -		p.setOutputFile (tmpDir.home().path()+"/.kde/share/apps/konqueror/bookmarks.xml");
    5.51 +		p.setOutputFile (tmpDir.home().path()+"/.kde4/share/apps/konqueror/bookmarks.xml");
    5.52  		p.setXSLFile (vymBaseDir.path()+"/styles/vym2kdebookmarks.xsl");
    5.53  		p.process();
    5.54  
     6.1 --- a/exports.h	Fri Mar 06 15:02:58 2009 +0000
     6.2 +++ b/exports.h	Thu Mar 19 11:45:28 2009 +0000
     6.3 @@ -63,7 +63,14 @@
     6.4  };
     6.5  
     6.6  ///////////////////////////////////////////////////////////////////////
     6.7 -class ExportKDEBookmarks:public ExportXMLBase
     6.8 +class ExportKDE3Bookmarks:public ExportXMLBase
     6.9 +{
    6.10 +public:
    6.11 +	virtual void doExport();
    6.12 +};	
    6.13 +
    6.14 +///////////////////////////////////////////////////////////////////////
    6.15 +class ExportKDE4Bookmarks:public ExportXMLBase
    6.16  {
    6.17  public:
    6.18  	virtual void doExport();
     7.1 --- a/flagrowobj.cpp	Fri Mar 06 15:02:58 2009 +0000
     7.2 +++ b/flagrowobj.cpp	Thu Mar 19 11:45:28 2009 +0000
     7.3 @@ -295,7 +295,7 @@
     7.4  	name=n;
     7.5  }
     7.6  
     7.7 -void  FlagRowObj::updateToolbar()
     7.8 +void  FlagRowObj::updateToolbar()	//FIXME this needs to be changed with VM
     7.9  {
    7.10  	if (parentRow)
    7.11  	{
     8.1 --- a/imports.cpp	Fri Mar 06 15:02:58 2009 +0000
     8.2 +++ b/imports.cpp	Thu Mar 19 11:45:28 2009 +0000
     8.3 @@ -50,7 +50,7 @@
     8.4  }
     8.5  
     8.6  /////////////////////////////////////////////////
     8.7 -bool ImportKDEBookmarks::transform()
     8.8 +bool ImportKDE3Bookmarks::transform()
     8.9  {
    8.10  	transformedFile=tmpDir.path()+"/bookmarks.xml";
    8.11  
    8.12 @@ -63,6 +63,21 @@
    8.13  	return true;
    8.14  }
    8.15  
    8.16 +/////////////////////////////////////////////////
    8.17 +bool ImportKDE4Bookmarks::transform()
    8.18 +{
    8.19 +	transformedFile=tmpDir.path()+"/bookmarks.xml";
    8.20 +
    8.21 +	XSLTProc p;
    8.22 +	p.setInputFile (tmpDir.home().path()+"/.kde4/share/apps/konqueror/bookmarks.xml");
    8.23 +	p.setOutputFile (transformedFile);
    8.24 +	p.setXSLFile (vymBaseDir.path()+"/styles/kdebookmarks2vym.xsl");
    8.25 +	p.process();
    8.26 +
    8.27 +	return true;
    8.28 +}
    8.29 +
    8.30 +
    8.31  
    8.32  /////////////////////////////////////////////////
    8.33  bool ImportFirefoxBookmarks::transform()
     9.1 --- a/imports.h	Fri Mar 06 15:02:58 2009 +0000
     9.2 +++ b/imports.h	Thu Mar 19 11:45:28 2009 +0000
     9.3 @@ -31,7 +31,13 @@
     9.4  };
     9.5  
     9.6  ///////////////////////////////////////////////////////////////////////
     9.7 -class ImportKDEBookmarks:public ImportBase
     9.8 +class ImportKDE3Bookmarks:public ImportBase
     9.9 +{
    9.10 +public:
    9.11 +	bool transform();
    9.12 +};	
    9.13 +
    9.14 +class ImportKDE4Bookmarks:public ImportBase
    9.15  {
    9.16  public:
    9.17  	bool transform();
    10.1 --- a/main.cpp	Fri Mar 06 15:02:58 2009 +0000
    10.2 +++ b/main.cpp	Thu Mar 19 11:45:28 2009 +0000
    10.3 @@ -179,6 +179,11 @@
    10.4  	m.setIcon (QPixmap (iconPath+"vym-48x48.png"));
    10.5  	m.show();
    10.6  	m.fileNew();
    10.7 +
    10.8 +
    10.9 +	// Paint Mainwindow first time
   10.10 +	qApp->processEvents();
   10.11 +
   10.12  	m.loadCmdLine();
   10.13  
   10.14  	// Run script
    11.1 --- a/mainwindow.cpp	Fri Mar 06 15:02:58 2009 +0000
    11.2 +++ b/mainwindow.cpp	Thu Mar 19 11:45:28 2009 +0000
    11.3 @@ -217,7 +217,12 @@
    11.4      if (settings.value( "/mainwindow/showTestMenu",false).toBool()) setupTestActions();
    11.5      setupHelpActions();
    11.6      
    11.7 +	// Status bar and progress bar there
    11.8      statusBar();
    11.9 +	progressMax=0;
   11.10 +	progressBar=new QProgressBar; 
   11.11 +	progressBar->hide();
   11.12 +	statusBar()->addPermanentWidget(progressBar);
   11.13  
   11.14  	restoreState (settings.value("/mainwindow/state",0).toByteArray());
   11.15  
   11.16 @@ -239,7 +244,7 @@
   11.17  	settings.setValue( "/version/version", vymVersion );
   11.18  	settings.setValue( "/version/builddate", vymBuildDate );
   11.19  
   11.20 -	settings.setValue( "/mapeditor/autosave/use",actionSettingsAutosaveToggle->isOn() );
   11.21 +	settings.setValue( "/mainwindow/autosave/use",actionSettingsAutosaveToggle->isOn() );
   11.22  	settings.setValue( "/mapeditor/editmode/autoSelectNewBranch",actionSettingsAutoSelectNewBranch->isOn() );
   11.23  	settings.setValue( "/mainwindow/writeBackupFile",actionSettingsWriteBackupFile->isOn() );
   11.24  	settings.setValue( "/mapeditor/editmode/autoSelectText",actionSettingsAutoSelectText->isOn() );
   11.25 @@ -254,6 +259,7 @@
   11.26  	delete textEditor;
   11.27  	delete historyWindow;
   11.28  	delete branchPropertyWindow;
   11.29 +	delete progressBar;
   11.30  
   11.31  	// Remove temporary directory
   11.32  	removeDir (QDir(tmpVymDir));
   11.33 @@ -280,7 +286,39 @@
   11.34  
   11.35  void Main::statusMessage(const QString &s)
   11.36  {
   11.37 -	statusBar()->message( s);
   11.38 +	// Surpress messages while progressbar during 
   11.39 +	// load is active
   11.40 +	if (progressMin==progressMax)
   11.41 +		statusBar()->message( s);
   11.42 +}
   11.43 +
   11.44 +void Main::setProgressMinimum (int min)
   11.45 +{
   11.46 +	progressBar->setMinimum(min);
   11.47 +	progressMin=min;
   11.48 +}
   11.49 +
   11.50 +void Main::setProgressMaximum (int max)
   11.51 +{
   11.52 +	progressBar->setMaximum(max);
   11.53 +	progressMax=max;
   11.54 +	if (max>0)
   11.55 +	{
   11.56 +		statusBar()->addPermanentWidget(progressBar);
   11.57 +		progressBar->show();
   11.58 +	}
   11.59 +}
   11.60 +
   11.61 +void Main::setProgressValue (int v)
   11.62 +{
   11.63 +	progressBar->setValue (v);
   11.64 +}
   11.65 +
   11.66 +void Main::removeProgressBar()
   11.67 +{
   11.68 +	if (progressMax>0)
   11.69 +		statusBar()->removeWidget(progressBar);
   11.70 +	progressMax=progressMin=0;
   11.71  }
   11.72  
   11.73  void Main::closeEvent (QCloseEvent* )
   11.74 @@ -337,10 +375,15 @@
   11.75  
   11.76  	fileImportMenu = fileMenu->addMenu (tr("Import","File menu"));
   11.77  
   11.78 -	a = new QAction(tr("KDE Bookmarks"), this);
   11.79 -	a->setStatusTip ( tr( "Import %1","Status tip file menu" ).arg(tr("KDE bookmarks")));
   11.80 +	a = new QAction(tr("KDE 3 Bookmarks"), this);
   11.81 +	a->setStatusTip ( tr( "Import %1","Status tip file menu" ).arg(tr("KDE 3 bookmarks")));
   11.82  	a->addTo (fileImportMenu);
   11.83 -	connect( a, SIGNAL( triggered() ), this, SLOT( fileImportKDEBookmarks() ) );
   11.84 +	connect( a, SIGNAL( triggered() ), this, SLOT( fileImportKDE3Bookmarks() ) );
   11.85 +
   11.86 +	a = new QAction(tr("KDE 4 Bookmarks"), this);
   11.87 +	a->setStatusTip ( tr( "Import %1","Status tip file menu" ).arg(tr("KDE 4 bookmarks")));
   11.88 +	a->addTo (fileImportMenu);
   11.89 +	connect( a, SIGNAL( triggered() ), this, SLOT( fileImportKDE4Bookmarks() ) );
   11.90  
   11.91      if (settings.value( "/mainwindow/showTestMenu",false).toBool()) 
   11.92  	{
   11.93 @@ -393,9 +436,14 @@
   11.94      connect( a, SIGNAL( triggered() ), this, SLOT( fileExportCSV() ) );
   11.95  	fileExportMenu->addAction (a);
   11.96  
   11.97 -	a = new QAction( tr("KDE Bookmarks","File menu"), this);
   11.98 -	a->setStatusTip( tr( "Export as %1").arg(tr("KDE Bookmarks" )));
   11.99 -	connect( a, SIGNAL( triggered() ), this, SLOT( fileExportKDEBookmarks() ) );
  11.100 +	a = new QAction( tr("KDE 3 Bookmarks","File menu"), this);
  11.101 +	a->setStatusTip( tr( "Export as %1").arg(tr("KDE 3 Bookmarks" )));
  11.102 +	connect( a, SIGNAL( triggered() ), this, SLOT( fileExportKDE3Bookmarks() ) );
  11.103 +	fileExportMenu->addAction (a);
  11.104 +
  11.105 +	a = new QAction( tr("KDE 4 Bookmarks","File menu"), this);
  11.106 +	a->setStatusTip( tr( "Export as %1").arg(tr("KDE 4 Bookmarks" )));
  11.107 +	connect( a, SIGNAL( triggered() ), this, SLOT( fileExportKDE4Bookmarks() ) );
  11.108  	fileExportMenu->addAction (a);
  11.109  
  11.110      a = new QAction( "Taskjuggler...", this );
  11.111 @@ -1403,7 +1451,7 @@
  11.112      a = new QAction( tr( "Autosave","Settings action"), this);
  11.113      a->setStatusTip( tr( "Autosave"));
  11.114  	a->setToggleAction(true);
  11.115 -	a->setOn ( settings.value ("/mapeditor/autosave/use",false).toBool());
  11.116 +	a->setOn ( settings.value ("/mainwindow/autosave/use",false).toBool());
  11.117      connect( a, SIGNAL( triggered() ), this, SLOT( settingsAutosaveToggle() ) );
  11.118  	settingsMenu->addAction (a);
  11.119  	actionSettingsAutosaveToggle=a;
  11.120 @@ -2065,11 +2113,19 @@
  11.121  	fileSaveAs (CompleteMap);
  11.122  }
  11.123  
  11.124 -void Main::fileImportKDEBookmarks()
  11.125 +void Main::fileImportKDE3Bookmarks()
  11.126  {
  11.127 -	ImportKDEBookmarks im;
  11.128 +	ImportKDE3Bookmarks im;
  11.129  	im.transform();
  11.130 -	if (success==fileLoad (im.getTransformedFile(),NewMap) && currentMapEditor() )
  11.131 +	if (aborted!=fileLoad (im.getTransformedFile(),NewMap) && currentMapEditor() )
  11.132 +		currentMapEditor()->getModel()->setFilePath ("");
  11.133 +}
  11.134 +
  11.135 +void Main::fileImportKDE4Bookmarks()
  11.136 +{
  11.137 +	ImportKDE4Bookmarks im;
  11.138 +	im.transform();
  11.139 +	if (aborted!=fileLoad (im.getTransformedFile(),NewMap) && currentMapEditor() )
  11.140  		currentMapEditor()->getModel()->setFilePath ("");
  11.141  }
  11.142  
  11.143 @@ -2091,7 +2147,7 @@
  11.144  		{
  11.145  			im.setFile (*it);
  11.146  			if (im.transform() && 
  11.147 -				success==fileLoad (im.getTransformedFile(),NewMap,FreemindMap) && 
  11.148 +				aborted!=fileLoad (im.getTransformedFile(),NewMap,FreemindMap) && 
  11.149  				currentMapEditor() )
  11.150  				currentMapEditor()->getModel()->setFilePath ("");
  11.151  			++it;
  11.152 @@ -2229,9 +2285,20 @@
  11.153  	}
  11.154  }
  11.155  
  11.156 -void Main::fileExportKDEBookmarks()	//FIXME not scriptable yet
  11.157 +void Main::fileExportKDE3Bookmarks()	//FIXME not scriptable yet
  11.158  {
  11.159 -	ExportKDEBookmarks ex;
  11.160 +	ExportKDE3Bookmarks ex;
  11.161 +	VymModel *m=currentModel();
  11.162 +	if (m)
  11.163 +	{
  11.164 +		ex.setModel (m);
  11.165 +		ex.doExport();
  11.166 +	}	
  11.167 +}
  11.168 +
  11.169 +void Main::fileExportKDE4Bookmarks()	//FIXME not scriptable yet
  11.170 +{
  11.171 +	ExportKDE4Bookmarks ex;
  11.172  	VymModel *m=currentModel();
  11.173  	if (m)
  11.174  	{
  11.175 @@ -2321,10 +2388,16 @@
  11.176  				return;
  11.177  			}
  11.178  		} 
  11.179 -		me->close();
  11.180  		tabModel.removeAt (tabWidget->currentIndex() );
  11.181  		tabWidget->removeTab (tabWidget->currentIndex() );
  11.182 -        delete me;	// FIXME if event was triggered _in_ ME this causes warning message
  11.183 +
  11.184 +		// Remove mapEditor;
  11.185 +		// Better would be delete (me), but then we could have a Qt error:
  11.186 +		// "QObject: Do not delete object, 'MapEditor', during its event handler!"
  11.187 +		// So we only remove data now and call deconstructor when vym closes later
  11.188 +		// FIXME  this needs to be moved to vymview...   me->clear();
  11.189 +		// some model->clear is needed to free up memory ...
  11.190 +
  11.191  		updateActions();
  11.192  	}
  11.193  }
  11.194 @@ -2792,9 +2865,9 @@
  11.195  	dia.setAuthor (m->getAuthor() );
  11.196  	dia.setComment(m->getComment() );
  11.197  
  11.198 -/* FIXME no stats at the moment (view dependent...)
  11.199  	// Calc some stats
  11.200  	QString stats;
  11.201 +/* FIXME no stats at the moment (view dependent...)
  11.202      stats+=tr("%1 items on map\n","Info about map").arg (mapScene->items().size(),6);
  11.203  
  11.204  	uint b=0;
  11.205 @@ -2811,13 +2884,13 @@
  11.206  		xl+=bo->countXLinks();
  11.207  		bo=m->next(bo);
  11.208  	}
  11.209 -    stats+=QString ("%1 branches\n").arg (b-1,6);
  11.210      stats+=QString ("%1 xLinks \n").arg (xl,6);
  11.211      stats+=QString ("%1 notes\n").arg (n,6);
  11.212      stats+=QString ("%1 images\n").arg (f,6);
  11.213 +*/
  11.214 +    stats+=QString ("%1 branches\n").arg (m->countBranches(),6);
  11.215  	dia.setStats (stats);
  11.216  
  11.217 -*/
  11.218  	// Finally show dialog
  11.219  	if (dia.exec() == QDialog::Accepted)
  11.220  	{
  11.221 @@ -3282,7 +3355,7 @@
  11.222  
  11.223  void Main::settingsAutosaveToggle()
  11.224  {
  11.225 -	settings.setValue ("/mapeditor/autosave/use",actionSettingsAutosaveToggle->isOn() );
  11.226 +	settings.setValue ("/mainwindow/autosave/use",actionSettingsAutosaveToggle->isOn() );
  11.227  }
  11.228  
  11.229  void Main::settingsAutosaveTime()
  11.230 @@ -3291,14 +3364,14 @@
  11.231  	int i = QInputDialog::getInteger(
  11.232  		this, 
  11.233  		tr("QInputDialog::getInteger()"),
  11.234 -	    tr("Number of seconds before autosave:"), settings.value("/mapeditor/autosave/ms").toInt() / 1000, 10, 10000, 1, &ok);
  11.235 +	    tr("Number of seconds before autosave:"), settings.value("/mainwindow/autosave/ms").toInt() / 1000, 10, 10000, 1, &ok);
  11.236  	if (ok)
  11.237 -		settings.setValue ("/mapeditor/autosave/ms",i * 1000);
  11.238 +		settings.setValue ("/mainwindow/autosave/ms",i * 1000);
  11.239  }
  11.240  
  11.241  void Main::settingsWriteBackupFileToggle()
  11.242  {
  11.243 -	settings.setValue ("/mapeditor/writeBackupFile",actionSettingsWriteBackupFile->isOn() );
  11.244 +	settings.setValue ("/mainwindow/writeBackupFile",actionSettingsWriteBackupFile->isOn() );
  11.245  }
  11.246  
  11.247  void Main::settingsToggleAnimation()
    12.1 --- a/mainwindow.h	Fri Mar 06 15:02:58 2009 +0000
    12.2 +++ b/mainwindow.h	Thu Mar 19 11:45:28 2009 +0000
    12.3 @@ -29,7 +29,17 @@
    12.4      Main(QWidget* parent=0, const char* name=0, Qt::WFlags f=0);
    12.5      ~Main();
    12.6  	void loadCmdLine();
    12.7 +
    12.8 +private:
    12.9 +	QProgressBar *progressBar;
   12.10 +	int progressMax;
   12.11 +	int progressMin;
   12.12 +public:	
   12.13  	void statusMessage (const QString &);
   12.14 +	void setProgressMinimum (int min);
   12.15 +	void setProgressMaximum (int max);
   12.16 +	void setProgressValue (int v);
   12.17 +	void removeProgressBar();
   12.18  
   12.19  private:
   12.20  	VymView* createView (VymModel*);
   12.21 @@ -77,7 +87,8 @@
   12.22  private slots:	
   12.23      void fileSaveAs(const SaveMode &);
   12.24      void fileSaveAs();
   12.25 -    void fileImportKDEBookmarks();
   12.26 +    void fileImportKDE3Bookmarks();
   12.27 +    void fileImportKDE4Bookmarks();
   12.28      void fileImportFirefoxBookmarks();
   12.29      void fileImportFreemind();
   12.30      void fileImportMM();
   12.31 @@ -88,7 +99,8 @@
   12.32      void fileExportASCII();
   12.33      void fileExportCSV();
   12.34      void fileExportLaTeX();
   12.35 -    void fileExportKDEBookmarks();
   12.36 +    void fileExportKDE3Bookmarks();
   12.37 +    void fileExportKDE4Bookmarks();
   12.38      void fileExportTaskjuggler();
   12.39      void fileExportOOPresentation();
   12.40      void fileCloseMap();
    13.1 --- a/mapeditor.cpp	Fri Mar 06 15:02:58 2009 +0000
    13.2 +++ b/mapeditor.cpp	Thu Mar 19 11:45:28 2009 +0000
    13.3 @@ -128,10 +128,11 @@
    13.4  
    13.5  MapEditor::~MapEditor()
    13.6  {
    13.7 -	//cout <<"Destructor MapEditor\n";
    13.8 -	// tmpMapDir is in tmpVymDir, so it gets removed automagically when vym closes
    13.9 +	cout <<"Destructor MapEditor for "<<model->getMapName().toStdString()<<endl;
   13.10 +	// No need to remove tmp files:
   13.11 +	// tmpMapDir is in tmpVymDir, 
   13.12 +	// so it gets removed automagically when vym closes
   13.13  	
   13.14 -	//removeDir(QDir(tmpMapDir));	// FIXME check?!?
   13.15  	model->unregisterEditor(this);
   13.16  }
   13.17  
   13.18 @@ -413,21 +414,21 @@
   13.19  		if (model->getSelectedBranch() ) 
   13.20  		{
   13.21  			// Context Menu on branch or mapcenter
   13.22 -			model->updateActions();
   13.23 +			//FIXME model->updateActions(); needed?
   13.24  			branchContextMenu->popup(e->globalPos() );
   13.25  		} else
   13.26  		{
   13.27  			if (model->getSelectedFloatImage() )
   13.28  			{
   13.29  				// Context Menu on floatimage
   13.30 -				model->updateActions();
   13.31 +				// model->updateActions(); FIXME needed?
   13.32  				floatimageContextMenu->popup(e->globalPos() );
   13.33  			}	
   13.34  		}	
   13.35  	} else 
   13.36  	{ // No MapObj found, we are on the Canvas itself
   13.37  		// Context Menu on scene
   13.38 -		model->updateActions();
   13.39 +		// model->updateActions(); FIXME needed?
   13.40  		
   13.41  		// Open context menu synchronously to position new mapcenter
   13.42  		model->setContextPos (p);
   13.43 @@ -602,7 +603,7 @@
   13.44  			// a button in the toolbar)
   13.45  			if (e->button() == Qt::MidButton )
   13.46  				model->toggleScroll();
   13.47 -		model->updateActions();
   13.48 +		// model->updateActions(); FIXME needed?
   13.49  		// FIXME needed? xelection.update();
   13.50  	} else 
   13.51  	{ // No MapObj found, we are on the scene itself
   13.52 @@ -946,13 +947,13 @@
   13.53  					model->reposition();
   13.54  			}
   13.55  		}
   13.56 -		 model->updateSelection();
   13.57 +		model->updateSelection();  //FIXME needed? at least not after pos of selection has changed...
   13.58  		// Finally resize scene, if needed
   13.59  		scene()->update();
   13.60  		movingObj=NULL;		
   13.61  
   13.62  		// Just make sure, that actions are still ok,e.g. the move branch up/down buttons...
   13.63 -		model->updateActions();
   13.64 +		// model->updateActions(); FIXME neeeded? 
   13.65  	} else 
   13.66  		// maybe we moved View: set old cursor
   13.67  		setCursor (Qt::ArrowCursor);
    14.1 --- a/version.h	Fri Mar 06 15:02:58 2009 +0000
    14.2 +++ b/version.h	Thu Mar 19 11:45:28 2009 +0000
    14.3 @@ -7,7 +7,7 @@
    14.4  #define __VYM_VERSION "1.13.0"
    14.5  //#define __VYM_CODENAME "Codename: RC-1"
    14.6  #define __VYM_CODENAME "Codename: development version"
    14.7 -#define __VYM_BUILD_DATE "2009-03-06"
    14.8 +#define __VYM_BUILD_DATE "2009-03-19"
    14.9  
   14.10  
   14.11  bool checkVersion(const QString &);
    15.1 --- a/vym.pro	Fri Mar 06 15:02:58 2009 +0000
    15.2 +++ b/vym.pro	Thu Mar 19 11:45:28 2009 +0000
    15.3 @@ -11,6 +11,7 @@
    15.4  TRANSLATIONS += lang/vym_fr.ts
    15.5  TRANSLATIONS += lang/vym_zh_CN.ts
    15.6  TRANSLATIONS += lang/vym_pt_BR.ts
    15.7 +TRANSLATIONS += lang/vym_zh_TW.ts
    15.8  
    15.9  # Manifest embedding was suggested by Qt docs somewhere...
   15.10  win32: CONFIG += embed_manifest_exe
    16.1 --- a/vymmodel.cpp	Fri Mar 06 15:02:58 2009 +0000
    16.2 +++ b/vymmodel.cpp	Thu Mar 19 11:45:28 2009 +0000
    16.3 @@ -66,7 +66,6 @@
    16.4  
    16.5  void VymModel::clear() 
    16.6  {
    16.7 -	cout << "VymModel::clear   rows="<<rowCount(index(rootItem))<<endl;	
    16.8  	selModel->clearSelection();
    16.9  
   16.10  	// Remove stuff    
   16.11 @@ -147,8 +146,6 @@
   16.12  
   16.13  	hidemode=HideNone;
   16.14  
   16.15 -
   16.16 -
   16.17  	// Network
   16.18  	netstate=Offline;
   16.19  
   16.20 @@ -179,6 +176,7 @@
   16.21  
   16.22  void VymModel::updateActions()	// FIXME  maybe don't update if blockReposition is set
   16.23  {
   16.24 +	cout << "VymModel::updateActions \n";
   16.25  	// Tell mainwindow to update states of actions
   16.26  	mainWindow->updateActions();
   16.27  }
   16.28 @@ -224,6 +222,7 @@
   16.29  		mapAttr+= xml.attribut("author",author) +
   16.30  				  xml.attribut("comment",comment) +
   16.31  			      xml.attribut("date",getDate()) +
   16.32 +				  xml.attribut("countBranches", QString().number(countBranches())) +
   16.33  		          xml.attribut("backgroundColor", mapScene->backgroundBrush().color().name() ) +
   16.34  		          xml.attribut("selectionColor", mapEditor->getSelectionColor().name() ) +
   16.35  		          xml.attribut("linkStyle", ls ) +
   16.36 @@ -889,6 +888,12 @@
   16.37  
   16.38  void VymModel::autosave()
   16.39  {
   16.40 +	if (filePath=="") 
   16.41 +	{
   16.42 +		if (debug)
   16.43 +			cout << "VymModel::autosave rejected due to missing filePath\n";
   16.44 +	}
   16.45 +
   16.46  	QDateTime now=QDateTime().currentDateTime();
   16.47  
   16.48  	// Disable autosave, while we have gone back in history
   16.49 @@ -899,7 +904,7 @@
   16.50  	if (filePath.isEmpty()) return;
   16.51  
   16.52  
   16.53 -	if (mapUnsaved &&mapChanged && settings.value ("/autosave/use",true).toBool() )
   16.54 +	if (mapUnsaved &&mapChanged && settings.value ("/mainwindow/autosave/use",true).toBool() )
   16.55  	{
   16.56  		if (QFileInfo(filePath).lastModified()<=fileChangedTime) 
   16.57  			mainWindow->fileSave (this);
   16.58 @@ -959,8 +964,12 @@
   16.59  
   16.60  void VymModel::setChanged()
   16.61  {
   16.62 +	cout << "VM::setChanged()\n";
   16.63  	if (!mapChanged)
   16.64 -		autosaveTimer->start(settings.value("/autosave/ms/",300000).toInt());
   16.65 +	{
   16.66 +		autosaveTimer->start(settings.value("/mainwindow/autosave/ms/",300000).toInt());
   16.67 +		cout <<"   timer started with "<<settings.value("/mainwindow/autosave/ms/",300000).toInt()<<endl;
   16.68 +	}	
   16.69  	mapChanged=true;
   16.70  	mapDefault=false;
   16.71  	mapUnsaved=true;
   16.72 @@ -1454,6 +1463,22 @@
   16.73  	return QDate::currentDate().toString ("yyyy-MM-dd");
   16.74  }
   16.75  
   16.76 +int VymModel::countBranches()	// FIXME Optimize this: use internal counter instead of going through whole map each time...
   16.77 +{
   16.78 +	int c=0;
   16.79 +	TreeItem *cur=NULL;
   16.80 +	TreeItem *prev=NULL;
   16.81 +	int d;
   16.82 +	next(cur,prev,d);
   16.83 +	while (cur) 
   16.84 +	{
   16.85 +		c++;
   16.86 +		next(cur,prev,d);
   16.87 +	}
   16.88 +	return c;
   16.89 +
   16.90 +}
   16.91 +
   16.92  void VymModel::setHeading(const QString &s)
   16.93  {
   16.94  	BranchObj *sel=getSelectedBranch();
   16.95 @@ -4341,19 +4366,9 @@
   16.96  	updateSelection (newsel);
   16.97  }
   16.98  
   16.99 -void VymModel::updateSelection(const QItemSelection &)
  16.100 +void VymModel::updateSelection(const QItemSelection &newsel)
  16.101  {
  16.102 -	QItemSelection newsel=selModel->selection();
  16.103 -	/*
  16.104 -	cout << "VM::updateSelection   new=";
  16.105 -	if (!newsel.indexes().isEmpty() )
  16.106 -		cout << newsel.indexes().first().row()<<"," << newsel.indexes().first().column();
  16.107 -	cout << "  old=";
  16.108 -	if (!oldsel.indexes().isEmpty() )
  16.109 -		cout << oldsel.indexes().first().row()<<"," << oldsel.indexes().first().column();
  16.110 -	cout <<endl;
  16.111 -	*/
  16.112 -	//emit (selectionChanged(newsel,oldsel));	// FIXME needed?
  16.113 +	emit (selectionChanged(newsel,newsel));	// needed e.g. to update geometry in editor
  16.114  	ensureSelectionVisible();
  16.115  	sendSelection();
  16.116  }
  16.117 @@ -4596,9 +4611,6 @@
  16.118  		num=QString ("%1").arg(n);
  16.119  		s=s+num;
  16.120  		
  16.121 -		cout <<"SP::  s0="<<s.toStdString()<<endl;
  16.122 -
  16.123 -
  16.124  		// Try to select this one
  16.125  		if (n>=0 && select (s)) return;
  16.126  
  16.127 @@ -4634,7 +4646,6 @@
  16.128  				s=typ+num;
  16.129  			}	
  16.130  
  16.131 -		cout <<"SP::  si="<<s.toStdString()<<endl;
  16.132  			if (select(s))
  16.133  				// pad to oldDepth, select the last branch for each depth
  16.134  				for (i=d;i<oldDepth;i++)
    17.1 --- a/vymmodel.h	Fri Mar 06 15:02:58 2009 +0000
    17.2 +++ b/vymmodel.h	Thu Mar 19 11:45:28 2009 +0000
    17.3 @@ -229,6 +229,7 @@
    17.4  	void setComment (const QString &);
    17.5  	QString getComment ();
    17.6  	QString getDate();
    17.7 +	int countBranches();
    17.8  
    17.9  public:	
   17.10  	void setHeading(const QString &);		//!< Set heading of branch	
    18.1 --- a/vymview.cpp	Fri Mar 06 15:02:58 2009 +0000
    18.2 +++ b/vymview.cpp	Thu Mar 19 11:45:28 2009 +0000
    18.3 @@ -1,6 +1,7 @@
    18.4  #include "vymview.h"
    18.5  
    18.6  #include <iostream>
    18.7 +using namespace std;
    18.8  
    18.9  #include "mainwindow.h"
   18.10  #include "mapeditor.h"
   18.11 @@ -8,8 +9,10 @@
   18.12  extern Main *mainWindow;
   18.13  
   18.14  
   18.15 -VymView::VymView(VymModel *model)
   18.16 +VymView::VymView(VymModel *m)
   18.17  {
   18.18 +	model=m;
   18.19 +
   18.20  	// Create TreeView
   18.21  	treeview=new QTreeView;
   18.22  	treeview->setModel ((QAbstractItemModel*)model);
   18.23 @@ -61,11 +64,28 @@
   18.24  }
   18.25  
   18.26  
   18.27 -void VymView::changeSelection (const QItemSelection &newSel, const QItemSelection &delSel)
   18.28 +void VymView::changeSelection (const QItemSelection &, const QItemSelection &)
   18.29  {
   18.30 -	// FIXME Currently this works only from treeview->ME
   18.31 -	treeview->expandAll();	//FIXME only for testing
   18.32 +	cout << "VymView::changeSelection (newsel,delsel)\n";
   18.33 +	//treeview->expandAll();	//FIXME only for testing
   18.34  
   18.35  	//((VymModel*)treeview->model())->select ();
   18.36 +
   18.37 +	// Show URL and link in statusbar
   18.38 +	QString status;
   18.39 +	QString s=model->getURL();
   18.40 +	if (!s.isEmpty() ) status+="URL: "+s+"  ";
   18.41 +	s=model->getVymLink();
   18.42 +	if (!s.isEmpty() ) status+="Link: "+s;
   18.43 +	if (!status.isEmpty() ) mainWindow->statusMessage (status);
   18.44 +
   18.45 +/* FIXME, was so far in BranchObj
   18.46 +	// Update Toolbar
   18.47 +	//updateFlagsToolbar();
   18.48 +
   18.49 +*/
   18.50 +
   18.51 +	// Update actions
   18.52 +	mainWindow->updateActions();
   18.53  }
   18.54  
    19.1 --- a/vymview.h	Fri Mar 06 15:02:58 2009 +0000
    19.2 +++ b/vymview.h	Thu Mar 19 11:45:28 2009 +0000
    19.3 @@ -19,6 +19,7 @@
    19.4  	void changeSelection (const QItemSelection &newSel, const QItemSelection &delSel);
    19.5  
    19.6  private:
    19.7 +	VymModel *model;
    19.8  	QTreeView *treeview;
    19.9  	QItemSelectionModel *selModel;
   19.10  };
    20.1 --- a/xml-vym.cpp	Fri Mar 06 15:02:58 2009 +0000
    20.2 +++ b/xml-vym.cpp	Thu Mar 19 11:45:28 2009 +0000
    20.3 @@ -9,12 +9,14 @@
    20.4  #include "misc.h"
    20.5  #include "settings.h"
    20.6  #include "linkablemapobj.h"
    20.7 +#include "mainwindow.h"
    20.8  #include "version.h"
    20.9  
   20.10  static BranchObj *lastBranch;
   20.11  static FloatObj *lastFloat;
   20.12  static OrnamentedObj *lastOO;
   20.13  
   20.14 +extern Main *mainWindow;
   20.15  extern Settings settings;
   20.16  extern QString vymVersion;
   20.17  
   20.18 @@ -46,6 +48,7 @@
   20.19      if ( state == StateInit && (eName == "vymmap")  ) 
   20.20  	{
   20.21          state = StateMap;
   20.22 +		branchesTotal=branchesCurrent=0;
   20.23  
   20.24  		if (loadMode==NewMap )
   20.25  		{
   20.26 @@ -57,6 +60,23 @@
   20.27  				model->setAuthor(atts.value( "author" ) );
   20.28  			if (!atts.value( "comment").isEmpty() )
   20.29  				model->setComment (atts.value( "comment" ) );
   20.30 +			if (!atts.value( "countBranches").isEmpty() )
   20.31 +			{
   20.32 +				branchesTotal=atts.value("countBranches").toInt();
   20.33 +				if (branchesTotal>10)
   20.34 +				{
   20.35 +					mainWindow->setProgressMinimum (0);
   20.36 +					mainWindow->setProgressMaximum (branchesTotal);
   20.37 +					mainWindow->setProgressValue(0);
   20.38 +				}
   20.39 +			} else
   20.40 +			{
   20.41 +				mainWindow->setProgressMinimum (0);
   20.42 +				mainWindow->setProgressMaximum (0);
   20.43 +				mainWindow->setProgressValue(0);
   20.44 +			}
   20.45 +
   20.46 +				
   20.47  			if (!atts.value( "backgroundColor").isEmpty() )
   20.48  			{
   20.49  				col.setNamedColor(atts.value("backgroundColor"));
   20.50 @@ -264,6 +284,9 @@
   20.51  	*/
   20.52      switch ( state ) 
   20.53  	{
   20.54 +		case StateMap:
   20.55 +			mainWindow->removeProgressBar();
   20.56 +			break;
   20.57          case StateBranch: 
   20.58  			model->selectParent();
   20.59  			lastBranch=model->getSelectedBranch();
   20.60 @@ -330,6 +353,8 @@
   20.61  
   20.62  bool parseVYMHandler::readBranchAttr (const QXmlAttributes& a)
   20.63  {
   20.64 +	branchesCurrent++;
   20.65 +	mainWindow->setProgressValue (branchesCurrent);
   20.66  	lastOO=lastBranch;
   20.67  	if (!readOOAttr(a)) return false;
   20.68  
    21.1 --- a/xml-vym.h	Fri Mar 06 15:02:58 2009 +0000
    21.2 +++ b/xml-vym.h	Thu Mar 19 11:45:28 2009 +0000
    21.3 @@ -3,7 +3,6 @@
    21.4  
    21.5  #include "xml-base.h"
    21.6  
    21.7 -
    21.8  /*! \brief Parsing VYM maps from XML documents */
    21.9  
   21.10  class parseVYMHandler  : public parseBaseHandler
   21.11 @@ -42,8 +41,9 @@
   21.12  		StateFloatImage,
   21.13  		StateHeading
   21.14  	 };
   21.15 -				 
   21.16  
   21.17 +	 int branchesCurrent;
   21.18 +	 int branchesTotal;
   21.19  
   21.20  	State state;			 
   21.21  	State laststate;