Various fixes, including combined progress bar for loading maps
authorinsilmaril
Thu Jan 21 11:56:57 2010 +0000 (2010-01-21)
changeset 8214a84d7e444d8
parent 820 735c7ea1d2a9
child 822 c2ce9944148c
Various fixes, including combined progress bar for loading maps
mainwindow.cpp
mainwindow.h
mapeditor.cpp
tex/vym.changelog
version.h
vymmodel.cpp
vymmodel.h
xml-vym.cpp
xml-vym.h
     1.1 --- a/mainwindow.cpp	Tue Jan 05 11:23:12 2010 +0000
     1.2 +++ b/mainwindow.cpp	Thu Jan 21 11:56:57 2010 +0000
     1.3 @@ -211,9 +211,14 @@
     1.4  	// Status bar and progress bar there
     1.5  	statusBar();
     1.6  	progressMax=0;
     1.7 -	progressBar=new QProgressBar; 
     1.8 -	progressBar->hide();
     1.9 -	statusBar()->addPermanentWidget(progressBar);
    1.10 +	progressCounter=0;
    1.11 +	progressCounterTotal=0;
    1.12 +
    1.13 +	progressDialog.setLabelText (tr("Loading maps","Mainwindow"));
    1.14 +	progressDialog.setAutoReset(false);
    1.15 +	progressDialog.setAutoClose(false);
    1.16 +	//progressDialog.setWindowModality (Qt::WindowModal);	// That forces mainwindo to update and slows down
    1.17 +	//progressDialog.setCancelButton (NULL);
    1.18  
    1.19  	restoreState (settings.value("/mainwindow/state",0).toByteArray());
    1.20  
    1.21 @@ -250,7 +255,6 @@
    1.22  	delete textEditor;
    1.23  	delete historyWindow;
    1.24  	delete branchPropertyWindow;
    1.25 -	delete progressBar;
    1.26  
    1.27  	// Remove temporary directory
    1.28  	removeDir (QDir(tmpVymDir));
    1.29 @@ -267,6 +271,8 @@
    1.30  	QStringList flist=options.getFileList();
    1.31  	QStringList::Iterator it=flist.begin();
    1.32  
    1.33 +	progressCounter=flist.count();
    1.34 +	progressCounterTotal=flist.count();
    1.35  	while (it !=flist.end() )
    1.36  	{
    1.37  		fileLoad (*it, NewMap);
    1.38 @@ -277,39 +283,46 @@
    1.39  
    1.40  void Main::statusMessage(const QString &s)
    1.41  {
    1.42 -	// Surpress messages while progressbar during 
    1.43 +	// Surpress messages while progressdialog during 
    1.44  	// load is active
    1.45 -	if (progressMin==progressMax)
    1.46 +	if (progressMax==0)
    1.47  		statusBar()->message( s);
    1.48  }
    1.49  
    1.50 -void Main::setProgressMinimum (int min)
    1.51 +void Main::setProgressMaximum (int max)	
    1.52  {
    1.53 -	progressBar->setMinimum(min);
    1.54 -	progressMin=min;
    1.55 +	if (progressCounterTotal!=0)
    1.56 +	
    1.57 +		progressDialog.setRange (0,progressCounterTotal*1000);
    1.58 +	else
    1.59 +		progressDialog.setRange (0,max+10);
    1.60 +
    1.61 +	progressDialog.setValue (0);
    1.62 +	progressMax=max*1000;
    1.63 +	//cout << "Main  max="<<max<<"  v="<<progressDialog.value()<<endl;
    1.64 +	progressDialog.show();
    1.65  }
    1.66  
    1.67 -void Main::setProgressMaximum (int max)
    1.68 +void Main::addProgressValue (float v)
    1.69  {
    1.70 -	progressBar->setMaximum(max);
    1.71 -	progressMax=max;
    1.72 -	if (max>0)
    1.73 -	{
    1.74 -		statusBar()->addPermanentWidget(progressBar);
    1.75 -		progressBar->show();
    1.76 -	}
    1.77 +	//cout << "addVal v="<<v*1000<<"/"<<progressMax<<"  cur="<<progressDialog.value()<<"  counter="<<v+progressCounter<<"/"<<progressCounterTotal<<endl;
    1.78 +	if (progressCounterTotal!=0)
    1.79 +		progressDialog.setValue ( (v+progressCounterTotal-progressCounter)*1000 );
    1.80 +	else	
    1.81 +		progressDialog.setValue (v+progressDialog.value());
    1.82  }
    1.83  
    1.84 -void Main::setProgressValue (int v)
    1.85 +void Main::removeProgressValue(int v)
    1.86  {
    1.87 -	progressBar->setValue (v);
    1.88 -}
    1.89 -
    1.90 -void Main::removeProgressBar()
    1.91 -{
    1.92 -	if (progressMax>0)
    1.93 -		statusBar()->removeWidget(progressBar);
    1.94 -	progressMax=progressMin=0;
    1.95 +	progressMax=0;
    1.96 +	progressCounter--;
    1.97 +	if (progressCounter<=0)
    1.98 +	{ 
    1.99 +		// Hide dialog again
   1.100 +		progressCounterTotal=0;
   1.101 +		progressDialog.reset();
   1.102 +		progressDialog.hide();
   1.103 +	}	
   1.104  }
   1.105  
   1.106  void Main::closeEvent (QCloseEvent* )
   1.107 @@ -745,6 +758,13 @@
   1.108  	editMenu->addAction (a);
   1.109  	connect( a, SIGNAL( triggered() ), this, SLOT( editOpenFindWidget() ) );
   1.110  
   1.111 +	a = new QAction( tr( "Find duplicate URLs","Edit menu"), this);
   1.112 +	//a->setStatusTip (tr( "Find" ) );
   1.113 +	a->setShortcut (Qt::SHIFT + Qt::Key_F);				//Find duplicate URLs
   1.114 +	if (settings.value( "/mainwindow/showTestMenu",false).toBool() ) 
   1.115 +		editMenu->addAction (a);
   1.116 +	connect( a, SIGNAL( triggered() ), this, SLOT( editFindDuplicateURLs() ) );
   1.117 +
   1.118  	editMenu->addSeparator();
   1.119  
   1.120  	a = new QAction( QPixmap(flagsPath+"flag-url.png"), tr( "Open URL","Edit menu" ), this);
   1.121 @@ -762,9 +782,16 @@
   1.122  	connect( a, SIGNAL( triggered() ), this, SLOT( editOpenURLTab() ) );
   1.123  	actionOpenURLTab=a;
   1.124  
   1.125 +	a = new QAction( tr( "Open all URLs in subtree (including scrolled branches)","Edit menu" ), this);
   1.126 +	a->setStatusTip (tr( "Open all URLs in subtree (including scrolled branches)" ));
   1.127 +	a->setShortcut ( Qt::CTRL + Qt::Key_U );
   1.128 +	addAction(a);
   1.129 +	actionListBranches.append(a);
   1.130 +	connect( a, SIGNAL( triggered() ), this, SLOT( editOpenMultipleVisURLTabs() ) );
   1.131 +	actionOpenMultipleVisURLTabs=a;
   1.132 +
   1.133  	a = new QAction( tr( "Open all URLs in subtree","Edit menu" ), this);
   1.134  	a->setStatusTip (tr( "Open all URLs in subtree" ));
   1.135 -	a->setShortcut ( Qt::CTRL + Qt::Key_U );
   1.136  	addAction(a);
   1.137  	actionListBranches.append(a);
   1.138  	connect( a, SIGNAL( triggered() ), this, SLOT( editOpenMultipleURLTabs() ) );
   1.139 @@ -805,7 +832,7 @@
   1.140  	connect( a, SIGNAL( triggered() ), this, SLOT( editBugzilla2URL() ) );
   1.141  	actionBugzilla2URL=a;
   1.142  
   1.143 -	a = new QAction(tr( "Create URL to Novell Bugzilla","Edit menu" ), this);
   1.144 +	a = new QAction(tr( "Get data from Novell Bugzilla","Edit menu" ), this);
   1.145  	a->setStatusTip ( tr( "Get data from Novell Bugzilla" ));
   1.146  	a->setEnabled (false);
   1.147  	actionListBranches.append(a);
   1.148 @@ -1624,6 +1651,7 @@
   1.149  		branchLinksContextMenu=branchContextMenu->addMenu(tr("References (URLs, vymLinks, ...)","Context menu name"));	
   1.150  		branchLinksContextMenu->addAction ( actionOpenURL );
   1.151  		branchLinksContextMenu->addAction ( actionOpenURLTab );
   1.152 +		branchLinksContextMenu->addAction ( actionOpenMultipleVisURLTabs );
   1.153  		branchLinksContextMenu->addAction ( actionOpenMultipleURLTabs );
   1.154  		branchLinksContextMenu->addAction ( actionURL );
   1.155  		branchLinksContextMenu->addAction ( actionLocalURL );
   1.156 @@ -1979,6 +2007,9 @@
   1.157  		lastFileDir=fd->directory().path();
   1.158  	    QStringList flist = fd->selectedFiles();
   1.159  		QStringList::Iterator it = flist.begin();
   1.160 +		
   1.161 +		progressCounter=flist.count();
   1.162 +		progressCounterTotal=flist.count();
   1.163  		while( it != flist.end() ) 
   1.164  		{
   1.165  			fn = *it;
   1.166 @@ -2511,6 +2542,12 @@
   1.167  	if (m) m->emitShowFindWidget();
   1.168  }
   1.169  
   1.170 +void Main::editFindDuplicateURLs()
   1.171 +{
   1.172 +	VymModel *m=currentModel();
   1.173 +	if (m) m->findDuplicateURLs();
   1.174 +}
   1.175 +
   1.176  void Main::openTabs(QStringList urls)
   1.177  {
   1.178  	if (!urls.isEmpty())
   1.179 @@ -2518,8 +2555,15 @@
   1.180  		bool success=true;
   1.181  		QStringList args;
   1.182  		QString browser=settings.value("/mainwindow/readerURL" ).toString();
   1.183 -		if (*browserPID==0)	//FIXME-2 need to check if browser is really still there instead of this
   1.184 +		//qDebug ()<<"Services: "<<QDBusConnection::sessionBus().interface()->registeredServiceNames().value();
   1.185 +		if (*browserPID==0 ||
   1.186 +			(browser.contains("konqueror") &&
   1.187 +			 !QDBusConnection::sessionBus().interface()->registeredServiceNames().value().contains (QString("org.kde.konqueror-%1").arg(*browserPID)))
   1.188 +		   )	 
   1.189  		{
   1.190 +			// Start a new browser, if there is not one running already or
   1.191 +			// if a previously started konqueror is gone.
   1.192 +			if (debug) cout <<"Main::openTabs no konqueror-"<<*browserPID<<" found\n";
   1.193  			QString u=urls.takeFirst();
   1.194  			args<<u;
   1.195  			QString workDir=QDir::currentDirPath();
   1.196 @@ -2623,17 +2667,23 @@
   1.197  		openTabs (urls);
   1.198  	}	
   1.199  }
   1.200 -void Main::editOpenMultipleURLTabs()
   1.201 +
   1.202 +void Main::editOpenMultipleVisURLTabs(bool ignoreScrolled)
   1.203  {
   1.204  	VymModel *m=currentModel();
   1.205  	if (m)
   1.206  	{	
   1.207  	    QStringList urls;
   1.208 -		urls=m->getURLs();
   1.209 +		urls=m->getURLs(ignoreScrolled);
   1.210  		openTabs (urls);
   1.211  	}	
   1.212  }
   1.213  
   1.214 +void Main::editOpenMultipleURLTabs()
   1.215 +{
   1.216 +	editOpenMultipleVisURLTabs (false);
   1.217 +}
   1.218 +
   1.219  
   1.220  void Main::editURL()
   1.221  {
   1.222 @@ -2662,6 +2712,23 @@
   1.223  void Main::getBugzillaData()
   1.224  {
   1.225  	VymModel *m=currentModel();
   1.226 +	/*
   1.227 +	QProgressDialog progress ("Doing stuff","cancl",0,10,this);
   1.228 +	progress.setWindowModality(Qt::WindowModal);
   1.229 +	//progress.setCancelButton (NULL);
   1.230 +	progress.show();
   1.231 +	progress.setMinimumDuration (0);
   1.232 +	progress.setValue (1);
   1.233 +	progress.setValue (5);
   1.234 +	progress.update();
   1.235 +	*/
   1.236 +	/*
   1.237 +	QProgressBar *pb=new QProgressBar;
   1.238 +	pb->setMinimum (0);
   1.239 +	pb->setMaximum (0);
   1.240 +	pb->show();
   1.241 +	pb->repaint();
   1.242 +	*/
   1.243  	if (m) m->getBugzillaData();
   1.244  }
   1.245  
   1.246 @@ -3334,19 +3401,17 @@
   1.247  void Main::updateNoteFlag()	
   1.248  {
   1.249  	// this slot is connected to TextEditor::textHasChanged()
   1.250 -
   1.251  	VymModel *m=currentModel();
   1.252  	if (m) m->updateNoteFlag();
   1.253  }
   1.254  
   1.255  void Main::updateNoteEditor(QModelIndex index )
   1.256  {
   1.257 -	cout << QObject::sender();
   1.258 -	QObject *obj=QObject::sender();
   1.259 -	TreeItem *ti=((TreeModel*)obj)->getItem (index);
   1.260 -	//TreeItem *ti=((VymModel*) QObject::sender())->getItem(index);
   1.261 -	//cout << "Main::updateNoteEditor model="<<sender();
   1.262 -	//cout << "  item="<<ti->headingStd()<<" ("<<ti<<")"<<endl;
   1.263 +	TreeItem *ti=((VymModel*) QObject::sender())->getItem(index);
   1.264 +	/*
   1.265 +	cout << "Main::updateNoteEditor model="<<sender();
   1.266 +	cout << "  item="<<ti->getHeadingStd()<<" ("<<ti<<")"<<endl;
   1.267 +	*/
   1.268  	textEditor->setNote (ti->getNoteObj() );
   1.269  }
   1.270  
   1.271 @@ -3676,6 +3741,34 @@
   1.272  
   1.273  void Main::testFunction1()
   1.274  {
   1.275 +	int max=100000;
   1.276 +	QProgressDialog p ("testprogress","cancel",0,max,this);
   1.277 +	p.setWindowModality (Qt::WindowModal);
   1.278 +	p.setAutoReset (false);
   1.279 +	p.setAutoClose (false);
   1.280 +	p.show();
   1.281 +	for (int i=0;i<max;i++)
   1.282 +	{
   1.283 +		p.setValue(i);
   1.284 +		if (p.wasCanceled()) break;
   1.285 +	}
   1.286 +
   1.287 +	cout << "Doing it again...\n";
   1.288 +	p.reset();
   1.289 +	p.hide();
   1.290 +	max=max+10;
   1.291 +	p.setRange(0,max);
   1.292 +	p.setValue (0);
   1.293 +	p.show();
   1.294 +	for (int i=0;i<max;i++)
   1.295 +	{
   1.296 +		p.setValue (i);
   1.297 +		if (p.wasCanceled()) break;
   1.298 +	}
   1.299 +	p.setValue (max);
   1.300 +	cout << "Done.\n";
   1.301 +	return;
   1.302 +
   1.303  	if (!currentMapEditor()) return;
   1.304  	currentMapEditor()->testFunction1();
   1.305  /*
     2.1 --- a/mainwindow.h	Tue Jan 05 11:23:12 2010 +0000
     2.2 +++ b/mainwindow.h	Thu Jan 21 11:56:57 2010 +0000
     2.3 @@ -34,15 +34,17 @@
     2.4  	void loadCmdLine();
     2.5  
     2.6  private:
     2.7 -	QProgressBar *progressBar;
     2.8 +	QProgressDialog progressDialog;
     2.9  	int progressMax;
    2.10  	int progressMin;
    2.11 +	int progressCounter;
    2.12 +	int progressCounterTotal;
    2.13  public:	
    2.14  	void statusMessage (const QString &);
    2.15 -	void setProgressMinimum (int min);
    2.16  	void setProgressMaximum (int max);
    2.17 -	void setProgressValue (int v);
    2.18 -	void removeProgressBar();
    2.19 +	void addProgressValue (float v);
    2.20 +	void setProgressCounter (int v);
    2.21 +	void removeProgressValue (int v);
    2.22  
    2.23  public slots:
    2.24      void fileNew();
    2.25 @@ -118,12 +120,14 @@
    2.26      void editPaste();	
    2.27      void editCut();	
    2.28      void editOpenFindWidget();
    2.29 +    void editFindDuplicateURLs();
    2.30  private:
    2.31  	void openTabs(QStringList);
    2.32  public slots:
    2.33  	void editOpenURL();
    2.34  	void editOpenURLTab();
    2.35  private slots:
    2.36 +	void editOpenMultipleVisURLTabs(bool ignoreScrolled=true);
    2.37  	void editOpenMultipleURLTabs();
    2.38  	void editURL();
    2.39  	void editLocalURL();
    2.40 @@ -290,6 +294,7 @@
    2.41  	QAction *actionCollapseOneLevel;
    2.42  	QAction* actionOpenURL;
    2.43  	QAction* actionOpenURLTab;
    2.44 +	QAction* actionOpenMultipleVisURLTabs;
    2.45  	QAction* actionOpenMultipleURLTabs;
    2.46  	QAction* actionURL;
    2.47  	QAction* actionLocalURL;
     3.1 --- a/mapeditor.cpp	Tue Jan 05 11:23:12 2010 +0000
     3.2 +++ b/mapeditor.cpp	Thu Jan 21 11:56:57 2010 +0000
     3.3 @@ -1422,7 +1422,6 @@
     3.4  					"moveRel "+pnow,
     3.5  					QString("Move %1 to relative position %2").arg(model->getObjectName(seli)).arg(pnow));
     3.6  
     3.7 -				cout << "ME::release mouse\n";
     3.8  				fio->getParObj()->requestReposition();
     3.9  				model->reposition();
    3.10  			}	
    3.11 @@ -1663,8 +1662,7 @@
    3.12  					if (bi)
    3.13  					{
    3.14  						model->select(bi);
    3.15 -						   /* FIXME-2 
    3.16 -							 */  
    3.17 +						QString u=uris.at(i).toString();
    3.18  						s=uris.at(i).toLocalFile();
    3.19  						if (!s.isEmpty()) 
    3.20  						{
    3.21 @@ -1674,16 +1672,23 @@
    3.22  						   if (file.endsWith(".vym", false))
    3.23  							   model->setVymLink(file);
    3.24  						   else
    3.25 -							   model->setURL(uris.at(i).toString());
    3.26 +							   model->setURL(u);
    3.27  					   } else 
    3.28  					   {
    3.29 -						   model->setURL(uris.at(i).toString());
    3.30 +							model->setURL(u);
    3.31 +
    3.32 +/*
    3.33 +							// Automatically try to fetch data from Bugzilla
    3.34 +							if (settings.value( "/mainwindow/showTestMenu",false).toBool() 
    3.35 +								&& u.contains ("https://bugzilla.novell.com"))
    3.36 +								model->getBugzillaData();
    3.37 +*/								
    3.38  					   }
    3.39  
    3.40  					   if (!heading.isEmpty())
    3.41  						   model->setHeading(heading);
    3.42  					   else
    3.43 -						   model->setHeading(uris.at(i).toString());
    3.44 +						   model->setHeading(u);
    3.45  						   
    3.46  						model->select (bi->parent());	   
    3.47  					}
     4.1 --- a/tex/vym.changelog	Tue Jan 05 11:23:12 2010 +0000
     4.2 +++ b/tex/vym.changelog	Thu Jan 21 11:56:57 2010 +0000
     4.3 @@ -1,3 +1,30 @@
     4.4 +-------------------------------------------------------------------
     4.5 +Thu Jan 21 09:22:08 CET 2010 - vym@insilmaril.de
     4.6 +
     4.7 +- Bugfix: Changes in NoteEditor update the Save flag visually
     4.8 +
     4.9 +-------------------------------------------------------------------
    4.10 +Wed Jan 20 14:28:20 CET 2010 - vym@insilmaril.de
    4.11 +
    4.12 +- Bugfix: New Progressbar while loading maps: One bar to count them,
    4.13 +          one bar to into colors grind them 
    4.14 +
    4.15 +-------------------------------------------------------------------
    4.16 +Thu Jan 14 12:03:43 CET 2010 - vym@insilmaril.de
    4.17 +
    4.18 +- Feature: Very basic support to find duplicate URLs
    4.19 +
    4.20 +-------------------------------------------------------------------
    4.21 +Wed Jan 13 08:28:18 CET 2010 - vym@insilmaril.de
    4.22 +
    4.23 +- Feature: Added action to open all URLs in subtree, default
    4.24 +           is now to only open those, which don't have scrolled parent
    4.25 +
    4.26 +-------------------------------------------------------------------
    4.27 +Tue Jan 12 09:14:49 CET 2010 - vym@insilmaril.de
    4.28 +
    4.29 +- Bugfix: Restart a konqueror ofr opening of URLs, if needed 
    4.30 +
    4.31  -------------------------------------------------------------------
    4.32  Tue Jan  5 12:22:27 CET 2010 - vym@insilmaril.de
    4.33  
     5.1 --- a/version.h	Tue Jan 05 11:23:12 2010 +0000
     5.2 +++ b/version.h	Thu Jan 21 11:56:57 2010 +0000
     5.3 @@ -7,7 +7,7 @@
     5.4  #define __VYM_VERSION "1.13.0"
     5.5  //#define __VYM_CODENAME "Codename: RC-1"
     5.6  #define __VYM_CODENAME "Codename: development version, not for production!"
     5.7 -#define __VYM_BUILD_DATE "2010-01-05"
     5.8 +#define __VYM_BUILD_DATE "2010-01-21"
     5.9  
    5.10  
    5.11  bool checkVersion(const QString &);
     6.1 --- a/vymmodel.cpp	Tue Jan 05 11:23:12 2010 +0000
     6.2 +++ b/vymmodel.cpp	Thu Jan 21 11:56:57 2010 +0000
     6.3 @@ -14,6 +14,7 @@
     6.4  #include "mainwindow.h"
     6.5  #include "misc.h"
     6.6  #include "parser.h"
     6.7 +#include "process.h"
     6.8  
     6.9  #include "warningdialog.h"
    6.10  #include "xlinkitem.h"
    6.11 @@ -1550,14 +1551,21 @@
    6.12  		return QString();
    6.13  }
    6.14  
    6.15 -void VymModel::setNote(const QString &s)	//FIXME-2 savestate missing	// FIXME-2 call to VM::updateNoteFlag missing (fix signal handling here)
    6.16 -{
    6.17 +void VymModel::setNote(const QString &s)
    6.18 +{
    6.19 +	cout << "VM::setNote\n";
    6.20  	TreeItem *selti=getSelectedItem();
    6.21  	if (selti) 
    6.22  	{
    6.23 +		emitNoteHasChanged(selti);
    6.24 +		saveState(
    6.25 +			selti,
    6.26 +			"setNote (\""+selti->getNote()+"\")", 
    6.27 +			selti,
    6.28 +			"setNote (\""+s+"\")", 
    6.29 +			QString("Set note of %1 ").arg(getObjectName(selti)) );
    6.30 +	}
    6.31  		selti->setNote(s);
    6.32 -		emitNoteHasChanged(selti);
    6.33 -	}
    6.34  }
    6.35  
    6.36  QString VymModel::getNote()
    6.37 @@ -1569,6 +1577,42 @@
    6.38  		return QString();
    6.39  }
    6.40  
    6.41 +void VymModel::findDuplicateURLs()	// FIXME-3 needs GUI
    6.42 +{
    6.43 +	// Generate map containing _all_ URLs and branches
    6.44 +	QString u;
    6.45 +	QMap <QString,BranchItem*> map;
    6.46 +	BranchItem *cur=NULL;
    6.47 +	BranchItem *prev=NULL;
    6.48 +	nextBranch(cur,prev);
    6.49 +	while (cur) 
    6.50 +	{
    6.51 +		u=cur->getURL();
    6.52 +		if (!u.isEmpty() )
    6.53 +			map.insertMulti (u,cur);
    6.54 +		nextBranch(cur,prev);
    6.55 +	}
    6.56 +
    6.57 +	// Extract duplicate URLs
    6.58 +	QMap <QString, BranchItem*>::const_iterator i=map.constBegin();
    6.59 +	QMap <QString, BranchItem*>::const_iterator firstdup=map.constEnd();	//invalid
    6.60 +	while (i != map.constEnd())
    6.61 +	{
    6.62 +		if (i!=map.constBegin() && i.key()==firstdup.key())
    6.63 +		{
    6.64 +			if (  i-1==firstdup )
    6.65 +			{
    6.66 +				cout << firstdup.key().toStdString() << endl;
    6.67 +				cout << " - "<< firstdup.value() <<" - "<<firstdup.value()->getHeadingStd()<<endl;
    6.68 +			}	
    6.69 +			cout << " - "<< i.value() <<" - "<<i.value()->getHeadingStd()<<endl;
    6.70 +		} else
    6.71 +			firstdup=i;
    6.72 +
    6.73 +		++i;
    6.74 +	}
    6.75 +}
    6.76 +
    6.77  BranchItem* VymModel::findText (QString s, bool cs)   
    6.78  {
    6.79  	if (!s.isEmpty() && s!=findString)
    6.80 @@ -1679,7 +1723,7 @@
    6.81  		return QString();
    6.82  }
    6.83  
    6.84 -QStringList VymModel::getURLs()	
    6.85 +QStringList VymModel::getURLs(bool ignoreScrolled)	
    6.86  {
    6.87  	QStringList urls;
    6.88  	BranchItem *selbi=getSelectedBranch();
    6.89 @@ -1687,7 +1731,8 @@
    6.90  	BranchItem *prev=NULL;
    6.91  	while (cur) 
    6.92  	{
    6.93 -		if (!cur->getURL().isEmpty()) urls.append( cur->getURL());
    6.94 +		if (!cur->getURL().isEmpty()  && !(ignoreScrolled && cur->hasScrolledParent(cur) )) 
    6.95 +			urls.append( cur->getURL());
    6.96  		cur=nextBranch (cur,prev,true,selbi);
    6.97  	}	
    6.98  	return urls;
    6.99 @@ -2888,7 +2933,77 @@
   6.100  		{
   6.101  			QRegExp rx("(\\d+)");
   6.102  			if (rx.indexIn(url) !=-1)
   6.103 -				cout << "VM::getBugzillaData bug="<<rx.cap(1).toStdString()<<endl;
   6.104 +			{
   6.105 +				QString bugID=rx.cap(1);
   6.106 +				cout << "VM::getBugzillaData bug="<<bugID.toStdString()<<endl;
   6.107 +
   6.108 +				QString script="test/vym-bug.pl";
   6.109 +				/*
   6.110 +				QProgressDialog progress2("Copying files...", "Abort Copy", 0, 40, mainWindow);
   6.111 +				progress2.setWindowModality(Qt::WindowModal);
   6.112 +				progress2.setValue (3);
   6.113 +				progress2.update();
   6.114 +				QProgressDialog progress ("Contacting Bugzilla...","empty",0,0);
   6.115 +				progress.setCancelButton (NULL);
   6.116 +				progress.setWindowModality(Qt::WindowModal);
   6.117 +				progress.show();
   6.118 +				progress.update();
   6.119 +*/
   6.120 +				Process p;
   6.121 +				p.start (script,QStringList()<<bugID);
   6.122 +				if (!p.waitForStarted())
   6.123 +				{
   6.124 +					cout <<"VM::getBugzillaData couldn't start "<<script.toStdString()<<endl;
   6.125 +					return;
   6.126 +				}	
   6.127 +				if (!p.waitForFinished())
   6.128 +				{
   6.129 +					cout <<"VM::getBugzillaData couldn't finish "<<script.toStdString()<<endl;
   6.130 +					//progress.hide();
   6.131 +					return;
   6.132 +				}
   6.133 +				//progress.hide();
   6.134 +				//QByteArray result=p.readAll();
   6.135 +				QString result=p.getStdout();
   6.136 +				while (result.endsWith("\n")) result.chop(1); 
   6.137 +				//cout << QString(result).toStdString()<<endl;
   6.138 +				QString err=p.getErrout();
   6.139 +				if (!err.isEmpty())
   6.140 +				{
   6.141 +					cout << "VM::getBugzillaData Error:\n";
   6.142 +					cout <<err.toStdString()<<endl;
   6.143 +				}
   6.144 +				else if (!result.isEmpty())
   6.145 +				{
   6.146 +					QString heading,cdate,mdate,state,whiteboard;
   6.147 +					QRegExp re("short_desc:(.*)\n");
   6.148 +					re.setMinimal(true);
   6.149 +					if (re.indexIn (result) !=-1) heading=re.cap(1);
   6.150 +
   6.151 +					re.setPattern ("creation_ts:(.*)\\s");
   6.152 +					if (re.indexIn (result) !=-1) cdate=re.cap(1);
   6.153 +
   6.154 +					re.setPattern ("delta_ts:(.*)\\s");
   6.155 +					if (re.indexIn (result) !=-1) mdate=re.cap(1);
   6.156 +
   6.157 +					re.setPattern ("bug_status:(.*)\n");
   6.158 +					if (re.indexIn (result) !=-1) state=re.cap(1);
   6.159 +
   6.160 +					re.setPattern ("status_whiteboard:(.*)\n");
   6.161 +					if (re.indexIn (result) !=-1) whiteboard=re.cap(1);
   6.162 +
   6.163 +					setHeading (bugID + " - " + heading);
   6.164 +					cout << "VM: heading="<<heading.toStdString()<<endl;
   6.165 +					cout << "VM:   cdate="<<cdate.toStdString()<<endl;
   6.166 +					cout << "VM:   mdate="<<mdate.toStdString()<<endl;
   6.167 +					cout << "VM:   state="<<state.toStdString()<<endl;
   6.168 +					cout << "VM:  wboard="<<whiteboard.toStdString()<<endl;
   6.169 +					
   6.170 +					//cout <<"VM::getBugzillaData  "<<script.toStdString()<<" returned:\n";
   6.171 +					//cout <<QString(result).toStdString()<<endl;
   6.172 +				} else	
   6.173 +					cout << "VM::getBugzillaData "<<script.toStdString()<<"  returned nothing\n";
   6.174 +			}	
   6.175  		}
   6.176  	}
   6.177  }	
   6.178 @@ -4342,17 +4457,20 @@
   6.179  
   6.180  void VymModel::updateNoteFlag()
   6.181  {
   6.182 -	setChanged();
   6.183  	TreeItem *selti=getSelectedItem();
   6.184  	if (selti)
   6.185  	{
   6.186 +		if (!mapChanged)
   6.187 +		{
   6.188 +			setChanged();
   6.189 +			updateActions();
   6.190 +		}
   6.191 +
   6.192  		if (textEditor->isEmpty()) 
   6.193  			selti->clearNote();
   6.194  		else
   6.195  			selti->setNote (textEditor->getText());
   6.196  		emitDataHasChanged(selti);		
   6.197 -		emitSelectionChanged();
   6.198 -
   6.199  	}
   6.200  }
   6.201  
     7.1 --- a/vymmodel.h	Tue Jan 05 11:23:12 2010 +0000
     7.2 +++ b/vymmodel.h	Thu Jan 21 11:56:57 2010 +0000
     7.3 @@ -264,6 +264,7 @@
     7.4  	bool EOFind;							// true, if search failed
     7.5  
     7.6  public:
     7.7 +	void findDuplicateURLs();				// find duplicate URLs, testing only so far
     7.8      BranchItem* findText(QString,bool);		// Find object
     7.9      void findReset();						// Reset Search
    7.10  	void emitShowFindWidget();				// Tell views to show FindWidget
    7.11 @@ -275,7 +276,7 @@
    7.12  public:
    7.13  	void setURL(const QString &url);
    7.14  	QString getURL();						// returns URL of selection or ""
    7.15 -	QStringList getURLs();					// returns URLs of subtree
    7.16 +	QStringList getURLs(bool ignoreScrolled=true);	// returns URLs of subtree
    7.17  
    7.18  
    7.19  	void setFrameType(const FrameObj::FrameType &);
     8.1 --- a/xml-vym.cpp	Tue Jan 05 11:23:12 2010 +0000
     8.2 +++ b/xml-vym.cpp	Thu Jan 21 11:56:57 2010 +0000
     8.3 @@ -28,6 +28,7 @@
     8.4  	stateStack.append(StateInit);
     8.5  	htmldata="";
     8.6  	isVymPart=false;
     8.7 +	useProgress=false;
     8.8      return true;
     8.9  }
    8.10  
    8.11 @@ -47,7 +48,8 @@
    8.12      if ( state == StateInit && (eName == "vymmap")  ) 
    8.13  	{
    8.14          state = StateMap;
    8.15 -		branchesTotal=branchesCurrent=0;
    8.16 +		branchesTotal=0;			//FIXME-3 what if we load a .vyp ?
    8.17 +		branchesCounter=0;
    8.18  
    8.19  		if (loadMode==NewMap )
    8.20  		{
    8.21 @@ -64,17 +66,10 @@
    8.22  				branchesTotal=atts.value("branchCount").toInt();
    8.23  				if (branchesTotal>10)
    8.24  				{
    8.25 -					mainWindow->setProgressMinimum (0);
    8.26 +					useProgress=true;
    8.27  					mainWindow->setProgressMaximum (branchesTotal);
    8.28 -					mainWindow->setProgressValue(0);
    8.29  				}
    8.30 -			} else
    8.31 -			{
    8.32 -				mainWindow->setProgressMinimum (0);
    8.33 -				mainWindow->setProgressMaximum (0);
    8.34 -				mainWindow->setProgressValue(0);
    8.35 -			}
    8.36 -
    8.37 +			} 
    8.38  				
    8.39  			if (!atts.value( "backgroundColor").isEmpty() )
    8.40  			{
    8.41 @@ -277,7 +272,7 @@
    8.42      switch ( state ) 
    8.43  	{
    8.44  		case StateMap:
    8.45 -			mainWindow->removeProgressBar();
    8.46 +			mainWindow->removeProgressValue (branchesTotal); //FIXME-2 let mainWindow handle this 
    8.47  			break;
    8.48          case StateMapCenter: 
    8.49  			model->emitDataHasChanged (lastBranch);
    8.50 @@ -356,7 +351,9 @@
    8.51  
    8.52  bool parseVYMHandler::readBranchAttr (const QXmlAttributes& a)	
    8.53  {
    8.54 -	//mainWindow->setProgressValue (branchesCurrent++);	// FIXME-2 Makes load incredibily slow
    8.55 +	branchesCounter++;
    8.56 +	if (useProgress) 
    8.57 +		mainWindow->addProgressValue ((float)branchesCounter/branchesTotal);	
    8.58  
    8.59  	lastMI=lastBranch;
    8.60  
     9.1 --- a/xml-vym.h	Tue Jan 05 11:23:12 2010 +0000
     9.2 +++ b/xml-vym.h	Thu Jan 21 11:56:57 2010 +0000
     9.3 @@ -44,7 +44,7 @@
     9.4  		StateHeading
     9.5  	 };
     9.6  
     9.7 -	 int branchesCurrent;
     9.8 +	 int branchesCounter;
     9.9  	 int branchesTotal;
    9.10  
    9.11  	State state;			 
    9.12 @@ -56,5 +56,7 @@
    9.13  	BranchItem* lastBranch;
    9.14  	ImageItem* lastImage;
    9.15  	MapItem* lastMI;
    9.16 +
    9.17 +	bool useProgress;
    9.18  }; 
    9.19  #endif