# HG changeset patch
# User insilmaril
# Date 1264075017 0
# Node ID 4a84d7e444d89c999961efac768fa1349338e571
# Parent  735c7ea1d2a956ab9449e91359c158ae55384cbf
Various fixes, including combined progress bar for loading maps

diff -r 735c7ea1d2a9 -r 4a84d7e444d8 mainwindow.cpp
--- a/mainwindow.cpp	Tue Jan 05 11:23:12 2010 +0000
+++ b/mainwindow.cpp	Thu Jan 21 11:56:57 2010 +0000
@@ -211,9 +211,14 @@
 	// Status bar and progress bar there
 	statusBar();
 	progressMax=0;
-	progressBar=new QProgressBar; 
-	progressBar->hide();
-	statusBar()->addPermanentWidget(progressBar);
+	progressCounter=0;
+	progressCounterTotal=0;
+
+	progressDialog.setLabelText (tr("Loading maps","Mainwindow"));
+	progressDialog.setAutoReset(false);
+	progressDialog.setAutoClose(false);
+	//progressDialog.setWindowModality (Qt::WindowModal);	// That forces mainwindo to update and slows down
+	//progressDialog.setCancelButton (NULL);
 
 	restoreState (settings.value("/mainwindow/state",0).toByteArray());
 
@@ -250,7 +255,6 @@
 	delete textEditor;
 	delete historyWindow;
 	delete branchPropertyWindow;
-	delete progressBar;
 
 	// Remove temporary directory
 	removeDir (QDir(tmpVymDir));
@@ -267,6 +271,8 @@
 	QStringList flist=options.getFileList();
 	QStringList::Iterator it=flist.begin();
 
+	progressCounter=flist.count();
+	progressCounterTotal=flist.count();
 	while (it !=flist.end() )
 	{
 		fileLoad (*it, NewMap);
@@ -277,39 +283,46 @@
 
 void Main::statusMessage(const QString &s)
 {
-	// Surpress messages while progressbar during 
+	// Surpress messages while progressdialog during 
 	// load is active
-	if (progressMin==progressMax)
+	if (progressMax==0)
 		statusBar()->message( s);
 }
 
-void Main::setProgressMinimum (int min)
+void Main::setProgressMaximum (int max)	
 {
-	progressBar->setMinimum(min);
-	progressMin=min;
+	if (progressCounterTotal!=0)
+	
+		progressDialog.setRange (0,progressCounterTotal*1000);
+	else
+		progressDialog.setRange (0,max+10);
+
+	progressDialog.setValue (0);
+	progressMax=max*1000;
+	//cout << "Main  max="<<max<<"  v="<<progressDialog.value()<<endl;
+	progressDialog.show();
 }
 
-void Main::setProgressMaximum (int max)
+void Main::addProgressValue (float v)
 {
-	progressBar->setMaximum(max);
-	progressMax=max;
-	if (max>0)
-	{
-		statusBar()->addPermanentWidget(progressBar);
-		progressBar->show();
-	}
+	//cout << "addVal v="<<v*1000<<"/"<<progressMax<<"  cur="<<progressDialog.value()<<"  counter="<<v+progressCounter<<"/"<<progressCounterTotal<<endl;
+	if (progressCounterTotal!=0)
+		progressDialog.setValue ( (v+progressCounterTotal-progressCounter)*1000 );
+	else	
+		progressDialog.setValue (v+progressDialog.value());
 }
 
-void Main::setProgressValue (int v)
+void Main::removeProgressValue(int v)
 {
-	progressBar->setValue (v);
-}
-
-void Main::removeProgressBar()
-{
-	if (progressMax>0)
-		statusBar()->removeWidget(progressBar);
-	progressMax=progressMin=0;
+	progressMax=0;
+	progressCounter--;
+	if (progressCounter<=0)
+	{ 
+		// Hide dialog again
+		progressCounterTotal=0;
+		progressDialog.reset();
+		progressDialog.hide();
+	}	
 }
 
 void Main::closeEvent (QCloseEvent* )
@@ -745,6 +758,13 @@
 	editMenu->addAction (a);
 	connect( a, SIGNAL( triggered() ), this, SLOT( editOpenFindWidget() ) );
 
+	a = new QAction( tr( "Find duplicate URLs","Edit menu"), this);
+	//a->setStatusTip (tr( "Find" ) );
+	a->setShortcut (Qt::SHIFT + Qt::Key_F);				//Find duplicate URLs
+	if (settings.value( "/mainwindow/showTestMenu",false).toBool() ) 
+		editMenu->addAction (a);
+	connect( a, SIGNAL( triggered() ), this, SLOT( editFindDuplicateURLs() ) );
+
 	editMenu->addSeparator();
 
 	a = new QAction( QPixmap(flagsPath+"flag-url.png"), tr( "Open URL","Edit menu" ), this);
@@ -762,9 +782,16 @@
 	connect( a, SIGNAL( triggered() ), this, SLOT( editOpenURLTab() ) );
 	actionOpenURLTab=a;
 
+	a = new QAction( tr( "Open all URLs in subtree (including scrolled branches)","Edit menu" ), this);
+	a->setStatusTip (tr( "Open all URLs in subtree (including scrolled branches)" ));
+	a->setShortcut ( Qt::CTRL + Qt::Key_U );
+	addAction(a);
+	actionListBranches.append(a);
+	connect( a, SIGNAL( triggered() ), this, SLOT( editOpenMultipleVisURLTabs() ) );
+	actionOpenMultipleVisURLTabs=a;
+
 	a = new QAction( tr( "Open all URLs in subtree","Edit menu" ), this);
 	a->setStatusTip (tr( "Open all URLs in subtree" ));
-	a->setShortcut ( Qt::CTRL + Qt::Key_U );
 	addAction(a);
 	actionListBranches.append(a);
 	connect( a, SIGNAL( triggered() ), this, SLOT( editOpenMultipleURLTabs() ) );
@@ -805,7 +832,7 @@
 	connect( a, SIGNAL( triggered() ), this, SLOT( editBugzilla2URL() ) );
 	actionBugzilla2URL=a;
 
-	a = new QAction(tr( "Create URL to Novell Bugzilla","Edit menu" ), this);
+	a = new QAction(tr( "Get data from Novell Bugzilla","Edit menu" ), this);
 	a->setStatusTip ( tr( "Get data from Novell Bugzilla" ));
 	a->setEnabled (false);
 	actionListBranches.append(a);
@@ -1624,6 +1651,7 @@
 		branchLinksContextMenu=branchContextMenu->addMenu(tr("References (URLs, vymLinks, ...)","Context menu name"));	
 		branchLinksContextMenu->addAction ( actionOpenURL );
 		branchLinksContextMenu->addAction ( actionOpenURLTab );
+		branchLinksContextMenu->addAction ( actionOpenMultipleVisURLTabs );
 		branchLinksContextMenu->addAction ( actionOpenMultipleURLTabs );
 		branchLinksContextMenu->addAction ( actionURL );
 		branchLinksContextMenu->addAction ( actionLocalURL );
@@ -1979,6 +2007,9 @@
 		lastFileDir=fd->directory().path();
 	    QStringList flist = fd->selectedFiles();
 		QStringList::Iterator it = flist.begin();
+		
+		progressCounter=flist.count();
+		progressCounterTotal=flist.count();
 		while( it != flist.end() ) 
 		{
 			fn = *it;
@@ -2511,6 +2542,12 @@
 	if (m) m->emitShowFindWidget();
 }
 
+void Main::editFindDuplicateURLs()
+{
+	VymModel *m=currentModel();
+	if (m) m->findDuplicateURLs();
+}
+
 void Main::openTabs(QStringList urls)
 {
 	if (!urls.isEmpty())
@@ -2518,8 +2555,15 @@
 		bool success=true;
 		QStringList args;
 		QString browser=settings.value("/mainwindow/readerURL" ).toString();
-		if (*browserPID==0)	//FIXME-2 need to check if browser is really still there instead of this
+		//qDebug ()<<"Services: "<<QDBusConnection::sessionBus().interface()->registeredServiceNames().value();
+		if (*browserPID==0 ||
+			(browser.contains("konqueror") &&
+			 !QDBusConnection::sessionBus().interface()->registeredServiceNames().value().contains (QString("org.kde.konqueror-%1").arg(*browserPID)))
+		   )	 
 		{
+			// Start a new browser, if there is not one running already or
+			// if a previously started konqueror is gone.
+			if (debug) cout <<"Main::openTabs no konqueror-"<<*browserPID<<" found\n";
 			QString u=urls.takeFirst();
 			args<<u;
 			QString workDir=QDir::currentDirPath();
@@ -2623,17 +2667,23 @@
 		openTabs (urls);
 	}	
 }
-void Main::editOpenMultipleURLTabs()
+
+void Main::editOpenMultipleVisURLTabs(bool ignoreScrolled)
 {
 	VymModel *m=currentModel();
 	if (m)
 	{	
 	    QStringList urls;
-		urls=m->getURLs();
+		urls=m->getURLs(ignoreScrolled);
 		openTabs (urls);
 	}	
 }
 
+void Main::editOpenMultipleURLTabs()
+{
+	editOpenMultipleVisURLTabs (false);
+}
+
 
 void Main::editURL()
 {
@@ -2662,6 +2712,23 @@
 void Main::getBugzillaData()
 {
 	VymModel *m=currentModel();
+	/*
+	QProgressDialog progress ("Doing stuff","cancl",0,10,this);
+	progress.setWindowModality(Qt::WindowModal);
+	//progress.setCancelButton (NULL);
+	progress.show();
+	progress.setMinimumDuration (0);
+	progress.setValue (1);
+	progress.setValue (5);
+	progress.update();
+	*/
+	/*
+	QProgressBar *pb=new QProgressBar;
+	pb->setMinimum (0);
+	pb->setMaximum (0);
+	pb->show();
+	pb->repaint();
+	*/
 	if (m) m->getBugzillaData();
 }
 
@@ -3334,19 +3401,17 @@
 void Main::updateNoteFlag()	
 {
 	// this slot is connected to TextEditor::textHasChanged()
-
 	VymModel *m=currentModel();
 	if (m) m->updateNoteFlag();
 }
 
 void Main::updateNoteEditor(QModelIndex index )
 {
-	cout << QObject::sender();
-	QObject *obj=QObject::sender();
-	TreeItem *ti=((TreeModel*)obj)->getItem (index);
-	//TreeItem *ti=((VymModel*) QObject::sender())->getItem(index);
-	//cout << "Main::updateNoteEditor model="<<sender();
-	//cout << "  item="<<ti->headingStd()<<" ("<<ti<<")"<<endl;
+	TreeItem *ti=((VymModel*) QObject::sender())->getItem(index);
+	/*
+	cout << "Main::updateNoteEditor model="<<sender();
+	cout << "  item="<<ti->getHeadingStd()<<" ("<<ti<<")"<<endl;
+	*/
 	textEditor->setNote (ti->getNoteObj() );
 }
 
@@ -3676,6 +3741,34 @@
 
 void Main::testFunction1()
 {
+	int max=100000;
+	QProgressDialog p ("testprogress","cancel",0,max,this);
+	p.setWindowModality (Qt::WindowModal);
+	p.setAutoReset (false);
+	p.setAutoClose (false);
+	p.show();
+	for (int i=0;i<max;i++)
+	{
+		p.setValue(i);
+		if (p.wasCanceled()) break;
+	}
+
+	cout << "Doing it again...\n";
+	p.reset();
+	p.hide();
+	max=max+10;
+	p.setRange(0,max);
+	p.setValue (0);
+	p.show();
+	for (int i=0;i<max;i++)
+	{
+		p.setValue (i);
+		if (p.wasCanceled()) break;
+	}
+	p.setValue (max);
+	cout << "Done.\n";
+	return;
+
 	if (!currentMapEditor()) return;
 	currentMapEditor()->testFunction1();
 /*
diff -r 735c7ea1d2a9 -r 4a84d7e444d8 mainwindow.h
--- a/mainwindow.h	Tue Jan 05 11:23:12 2010 +0000
+++ b/mainwindow.h	Thu Jan 21 11:56:57 2010 +0000
@@ -34,15 +34,17 @@
 	void loadCmdLine();
 
 private:
-	QProgressBar *progressBar;
+	QProgressDialog progressDialog;
 	int progressMax;
 	int progressMin;
+	int progressCounter;
+	int progressCounterTotal;
 public:	
 	void statusMessage (const QString &);
-	void setProgressMinimum (int min);
 	void setProgressMaximum (int max);
-	void setProgressValue (int v);
-	void removeProgressBar();
+	void addProgressValue (float v);
+	void setProgressCounter (int v);
+	void removeProgressValue (int v);
 
 public slots:
     void fileNew();
@@ -118,12 +120,14 @@
     void editPaste();	
     void editCut();	
     void editOpenFindWidget();
+    void editFindDuplicateURLs();
 private:
 	void openTabs(QStringList);
 public slots:
 	void editOpenURL();
 	void editOpenURLTab();
 private slots:
+	void editOpenMultipleVisURLTabs(bool ignoreScrolled=true);
 	void editOpenMultipleURLTabs();
 	void editURL();
 	void editLocalURL();
@@ -290,6 +294,7 @@
 	QAction *actionCollapseOneLevel;
 	QAction* actionOpenURL;
 	QAction* actionOpenURLTab;
+	QAction* actionOpenMultipleVisURLTabs;
 	QAction* actionOpenMultipleURLTabs;
 	QAction* actionURL;
 	QAction* actionLocalURL;
diff -r 735c7ea1d2a9 -r 4a84d7e444d8 mapeditor.cpp
--- a/mapeditor.cpp	Tue Jan 05 11:23:12 2010 +0000
+++ b/mapeditor.cpp	Thu Jan 21 11:56:57 2010 +0000
@@ -1422,7 +1422,6 @@
 					"moveRel "+pnow,
 					QString("Move %1 to relative position %2").arg(model->getObjectName(seli)).arg(pnow));
 
-				cout << "ME::release mouse\n";
 				fio->getParObj()->requestReposition();
 				model->reposition();
 			}	
@@ -1663,8 +1662,7 @@
 					if (bi)
 					{
 						model->select(bi);
-						   /* FIXME-2 
-							 */  
+						QString u=uris.at(i).toString();
 						s=uris.at(i).toLocalFile();
 						if (!s.isEmpty()) 
 						{
@@ -1674,16 +1672,23 @@
 						   if (file.endsWith(".vym", false))
 							   model->setVymLink(file);
 						   else
-							   model->setURL(uris.at(i).toString());
+							   model->setURL(u);
 					   } else 
 					   {
-						   model->setURL(uris.at(i).toString());
+							model->setURL(u);
+
+/*
+							// Automatically try to fetch data from Bugzilla
+							if (settings.value( "/mainwindow/showTestMenu",false).toBool() 
+								&& u.contains ("https://bugzilla.novell.com"))
+								model->getBugzillaData();
+*/								
 					   }
 
 					   if (!heading.isEmpty())
 						   model->setHeading(heading);
 					   else
-						   model->setHeading(uris.at(i).toString());
+						   model->setHeading(u);
 						   
 						model->select (bi->parent());	   
 					}
diff -r 735c7ea1d2a9 -r 4a84d7e444d8 tex/vym.changelog
--- a/tex/vym.changelog	Tue Jan 05 11:23:12 2010 +0000
+++ b/tex/vym.changelog	Thu Jan 21 11:56:57 2010 +0000
@@ -1,3 +1,30 @@
+-------------------------------------------------------------------
+Thu Jan 21 09:22:08 CET 2010 - vym@insilmaril.de
+
+- Bugfix: Changes in NoteEditor update the Save flag visually
+
+-------------------------------------------------------------------
+Wed Jan 20 14:28:20 CET 2010 - vym@insilmaril.de
+
+- Bugfix: New Progressbar while loading maps: One bar to count them,
+          one bar to into colors grind them 
+
+-------------------------------------------------------------------
+Thu Jan 14 12:03:43 CET 2010 - vym@insilmaril.de
+
+- Feature: Very basic support to find duplicate URLs
+
+-------------------------------------------------------------------
+Wed Jan 13 08:28:18 CET 2010 - vym@insilmaril.de
+
+- Feature: Added action to open all URLs in subtree, default
+           is now to only open those, which don't have scrolled parent
+
+-------------------------------------------------------------------
+Tue Jan 12 09:14:49 CET 2010 - vym@insilmaril.de
+
+- Bugfix: Restart a konqueror ofr opening of URLs, if needed 
+
 -------------------------------------------------------------------
 Tue Jan  5 12:22:27 CET 2010 - vym@insilmaril.de
 
diff -r 735c7ea1d2a9 -r 4a84d7e444d8 version.h
--- a/version.h	Tue Jan 05 11:23:12 2010 +0000
+++ b/version.h	Thu Jan 21 11:56:57 2010 +0000
@@ -7,7 +7,7 @@
 #define __VYM_VERSION "1.13.0"
 //#define __VYM_CODENAME "Codename: RC-1"
 #define __VYM_CODENAME "Codename: development version, not for production!"
-#define __VYM_BUILD_DATE "2010-01-05"
+#define __VYM_BUILD_DATE "2010-01-21"
 
 
 bool checkVersion(const QString &);
diff -r 735c7ea1d2a9 -r 4a84d7e444d8 vymmodel.cpp
--- a/vymmodel.cpp	Tue Jan 05 11:23:12 2010 +0000
+++ b/vymmodel.cpp	Thu Jan 21 11:56:57 2010 +0000
@@ -14,6 +14,7 @@
 #include "mainwindow.h"
 #include "misc.h"
 #include "parser.h"
+#include "process.h"
 
 #include "warningdialog.h"
 #include "xlinkitem.h"
@@ -1550,14 +1551,21 @@
 		return QString();
 }
 
-void VymModel::setNote(const QString &s)	//FIXME-2 savestate missing	// FIXME-2 call to VM::updateNoteFlag missing (fix signal handling here)
-{
+void VymModel::setNote(const QString &s)
+{
+	cout << "VM::setNote\n";
 	TreeItem *selti=getSelectedItem();
 	if (selti) 
 	{
+		emitNoteHasChanged(selti);
+		saveState(
+			selti,
+			"setNote (\""+selti->getNote()+"\")", 
+			selti,
+			"setNote (\""+s+"\")", 
+			QString("Set note of %1 ").arg(getObjectName(selti)) );
+	}
 		selti->setNote(s);
-		emitNoteHasChanged(selti);
-	}
 }
 
 QString VymModel::getNote()
@@ -1569,6 +1577,42 @@
 		return QString();
 }
 
+void VymModel::findDuplicateURLs()	// FIXME-3 needs GUI
+{
+	// Generate map containing _all_ URLs and branches
+	QString u;
+	QMap <QString,BranchItem*> map;
+	BranchItem *cur=NULL;
+	BranchItem *prev=NULL;
+	nextBranch(cur,prev);
+	while (cur) 
+	{
+		u=cur->getURL();
+		if (!u.isEmpty() )
+			map.insertMulti (u,cur);
+		nextBranch(cur,prev);
+	}
+
+	// Extract duplicate URLs
+	QMap <QString, BranchItem*>::const_iterator i=map.constBegin();
+	QMap <QString, BranchItem*>::const_iterator firstdup=map.constEnd();	//invalid
+	while (i != map.constEnd())
+	{
+		if (i!=map.constBegin() && i.key()==firstdup.key())
+		{
+			if (  i-1==firstdup )
+			{
+				cout << firstdup.key().toStdString() << endl;
+				cout << " - "<< firstdup.value() <<" - "<<firstdup.value()->getHeadingStd()<<endl;
+			}	
+			cout << " - "<< i.value() <<" - "<<i.value()->getHeadingStd()<<endl;
+		} else
+			firstdup=i;
+
+		++i;
+	}
+}
+
 BranchItem* VymModel::findText (QString s, bool cs)   
 {
 	if (!s.isEmpty() && s!=findString)
@@ -1679,7 +1723,7 @@
 		return QString();
 }
 
-QStringList VymModel::getURLs()	
+QStringList VymModel::getURLs(bool ignoreScrolled)	
 {
 	QStringList urls;
 	BranchItem *selbi=getSelectedBranch();
@@ -1687,7 +1731,8 @@
 	BranchItem *prev=NULL;
 	while (cur) 
 	{
-		if (!cur->getURL().isEmpty()) urls.append( cur->getURL());
+		if (!cur->getURL().isEmpty()  && !(ignoreScrolled && cur->hasScrolledParent(cur) )) 
+			urls.append( cur->getURL());
 		cur=nextBranch (cur,prev,true,selbi);
 	}	
 	return urls;
@@ -2888,7 +2933,77 @@
 		{
 			QRegExp rx("(\\d+)");
 			if (rx.indexIn(url) !=-1)
-				cout << "VM::getBugzillaData bug="<<rx.cap(1).toStdString()<<endl;
+			{
+				QString bugID=rx.cap(1);
+				cout << "VM::getBugzillaData bug="<<bugID.toStdString()<<endl;
+
+				QString script="test/vym-bug.pl";
+				/*
+				QProgressDialog progress2("Copying files...", "Abort Copy", 0, 40, mainWindow);
+				progress2.setWindowModality(Qt::WindowModal);
+				progress2.setValue (3);
+				progress2.update();
+				QProgressDialog progress ("Contacting Bugzilla...","empty",0,0);
+				progress.setCancelButton (NULL);
+				progress.setWindowModality(Qt::WindowModal);
+				progress.show();
+				progress.update();
+*/
+				Process p;
+				p.start (script,QStringList()<<bugID);
+				if (!p.waitForStarted())
+				{
+					cout <<"VM::getBugzillaData couldn't start "<<script.toStdString()<<endl;
+					return;
+				}	
+				if (!p.waitForFinished())
+				{
+					cout <<"VM::getBugzillaData couldn't finish "<<script.toStdString()<<endl;
+					//progress.hide();
+					return;
+				}
+				//progress.hide();
+				//QByteArray result=p.readAll();
+				QString result=p.getStdout();
+				while (result.endsWith("\n")) result.chop(1); 
+				//cout << QString(result).toStdString()<<endl;
+				QString err=p.getErrout();
+				if (!err.isEmpty())
+				{
+					cout << "VM::getBugzillaData Error:\n";
+					cout <<err.toStdString()<<endl;
+				}
+				else if (!result.isEmpty())
+				{
+					QString heading,cdate,mdate,state,whiteboard;
+					QRegExp re("short_desc:(.*)\n");
+					re.setMinimal(true);
+					if (re.indexIn (result) !=-1) heading=re.cap(1);
+
+					re.setPattern ("creation_ts:(.*)\\s");
+					if (re.indexIn (result) !=-1) cdate=re.cap(1);
+
+					re.setPattern ("delta_ts:(.*)\\s");
+					if (re.indexIn (result) !=-1) mdate=re.cap(1);
+
+					re.setPattern ("bug_status:(.*)\n");
+					if (re.indexIn (result) !=-1) state=re.cap(1);
+
+					re.setPattern ("status_whiteboard:(.*)\n");
+					if (re.indexIn (result) !=-1) whiteboard=re.cap(1);
+
+					setHeading (bugID + " - " + heading);
+					cout << "VM: heading="<<heading.toStdString()<<endl;
+					cout << "VM:   cdate="<<cdate.toStdString()<<endl;
+					cout << "VM:   mdate="<<mdate.toStdString()<<endl;
+					cout << "VM:   state="<<state.toStdString()<<endl;
+					cout << "VM:  wboard="<<whiteboard.toStdString()<<endl;
+					
+					//cout <<"VM::getBugzillaData  "<<script.toStdString()<<" returned:\n";
+					//cout <<QString(result).toStdString()<<endl;
+				} else	
+					cout << "VM::getBugzillaData "<<script.toStdString()<<"  returned nothing\n";
+			}	
 		}
 	}
 }	
@@ -4342,17 +4457,20 @@
 
 void VymModel::updateNoteFlag()
 {
-	setChanged();
 	TreeItem *selti=getSelectedItem();
 	if (selti)
 	{
+		if (!mapChanged)
+		{
+			setChanged();
+			updateActions();
+		}
+
 		if (textEditor->isEmpty()) 
 			selti->clearNote();
 		else
 			selti->setNote (textEditor->getText());
 		emitDataHasChanged(selti);		
-		emitSelectionChanged();
-
 	}
 }
 
diff -r 735c7ea1d2a9 -r 4a84d7e444d8 vymmodel.h
--- a/vymmodel.h	Tue Jan 05 11:23:12 2010 +0000
+++ b/vymmodel.h	Thu Jan 21 11:56:57 2010 +0000
@@ -264,6 +264,7 @@
 	bool EOFind;							// true, if search failed
 
 public:
+	void findDuplicateURLs();				// find duplicate URLs, testing only so far
     BranchItem* findText(QString,bool);		// Find object
     void findReset();						// Reset Search
 	void emitShowFindWidget();				// Tell views to show FindWidget
@@ -275,7 +276,7 @@
 public:
 	void setURL(const QString &url);
 	QString getURL();						// returns URL of selection or ""
-	QStringList getURLs();					// returns URLs of subtree
+	QStringList getURLs(bool ignoreScrolled=true);	// returns URLs of subtree
 
 
 	void setFrameType(const FrameObj::FrameType &);
diff -r 735c7ea1d2a9 -r 4a84d7e444d8 xml-vym.cpp
--- a/xml-vym.cpp	Tue Jan 05 11:23:12 2010 +0000
+++ b/xml-vym.cpp	Thu Jan 21 11:56:57 2010 +0000
@@ -28,6 +28,7 @@
 	stateStack.append(StateInit);
 	htmldata="";
 	isVymPart=false;
+	useProgress=false;
     return true;
 }
 
@@ -47,7 +48,8 @@
     if ( state == StateInit && (eName == "vymmap")  ) 
 	{
         state = StateMap;
-		branchesTotal=branchesCurrent=0;
+		branchesTotal=0;			//FIXME-3 what if we load a .vyp ?
+		branchesCounter=0;
 
 		if (loadMode==NewMap )
 		{
@@ -64,17 +66,10 @@
 				branchesTotal=atts.value("branchCount").toInt();
 				if (branchesTotal>10)
 				{
-					mainWindow->setProgressMinimum (0);
+					useProgress=true;
 					mainWindow->setProgressMaximum (branchesTotal);
-					mainWindow->setProgressValue(0);
 				}
-			} else
-			{
-				mainWindow->setProgressMinimum (0);
-				mainWindow->setProgressMaximum (0);
-				mainWindow->setProgressValue(0);
-			}
-
+			} 
 				
 			if (!atts.value( "backgroundColor").isEmpty() )
 			{
@@ -277,7 +272,7 @@
     switch ( state ) 
 	{
 		case StateMap:
-			mainWindow->removeProgressBar();
+			mainWindow->removeProgressValue (branchesTotal); //FIXME-2 let mainWindow handle this 
 			break;
         case StateMapCenter: 
 			model->emitDataHasChanged (lastBranch);
@@ -356,7 +351,9 @@
 
 bool parseVYMHandler::readBranchAttr (const QXmlAttributes& a)	
 {
-	//mainWindow->setProgressValue (branchesCurrent++);	// FIXME-2 Makes load incredibily slow
+	branchesCounter++;
+	if (useProgress) 
+		mainWindow->addProgressValue ((float)branchesCounter/branchesTotal);	
 
 	lastMI=lastBranch;
 
diff -r 735c7ea1d2a9 -r 4a84d7e444d8 xml-vym.h
--- a/xml-vym.h	Tue Jan 05 11:23:12 2010 +0000
+++ b/xml-vym.h	Thu Jan 21 11:56:57 2010 +0000
@@ -44,7 +44,7 @@
 		StateHeading
 	 };
 
-	 int branchesCurrent;
+	 int branchesCounter;
 	 int branchesTotal;
 
 	State state;			 
@@ -56,5 +56,7 @@
 	BranchItem* lastBranch;
 	ImageItem* lastImage;
 	MapItem* lastMI;
+
+	bool useProgress;
 }; 
 #endif