mainwindow.cpp
changeset 420 b7447adddc9a
parent 417 1cc7bbf75f0b
child 421 5522d1da7e37
     1.1 --- a/mainwindow.cpp	Fri Jan 05 11:17:33 2007 +0000
     1.2 +++ b/mainwindow.cpp	Wed Jan 10 13:26:12 2007 +0000
     1.3 @@ -2767,8 +2767,10 @@
     1.4  
     1.5  void Main::editMoveUp()
     1.6  {
     1.7 +	cout << "Main editMoveUp begin\n";
     1.8  	if (currentMapEditor())
     1.9  	    currentMapEditor()->moveBranchUp();
    1.10 +	cout << "Main editMoveUp end\n";
    1.11  }
    1.12  
    1.13  void Main::editMoveDown()
    1.14 @@ -3476,50 +3478,52 @@
    1.15  		docname="vym_es.pdf";
    1.16  	else	
    1.17  		docname="vym.pdf";
    1.18 +
    1.19 +	QStringList searchList;
    1.20  	QDir docdir;
    1.21  	#if defined(Q_OS_MACX)
    1.22 -		docdir.setPath("./vym.app/Contents");
    1.23 +		searchList << "./vym.app/Contents";
    1.24  	#else
    1.25  		// default path in SUSE LINUX
    1.26 -		docdir.setPath("/usr/share/doc/packages/vym/doc");
    1.27 +		searchList <<"/usr/share/doc/packages/vym/doc";
    1.28  	#endif
    1.29  
    1.30 -	if (!docdir.exists() )
    1.31 +	searchList << "doc";	// relative path for easy testing in tarball
    1.32 +	searchList << "doc/tex";	// Easy testing working on vym.tex
    1.33 +	searchList << "/usr/share/doc/vym";	// Debian
    1.34 +	searchList << "/usr/share/doc/packages";// Knoppix
    1.35 +
    1.36 +	bool found=false;
    1.37 +	QFile docfile;
    1.38 +	for (int i=0; i<searchList.count(); ++i)
    1.39  	{
    1.40 -		// relative path for easy testing in tarball
    1.41 -		docdir.setPath("doc");
    1.42 -		if (!docdir.exists() )
    1.43 +		docfile.setFileName(QDir::convertSeparators(searchList.at(i)+"/"+docname));
    1.44 +		if (docfile.exists() )
    1.45  		{
    1.46 -			// relative path for testing while still writing vym.tex
    1.47 -			docdir.setPath("doc/tex/vym.pdf");
    1.48 -			if (!docdir.exists() )
    1.49 -			{
    1.50 -				// Try yet another one for Knoppix
    1.51 -				docdir.setPath("/usr/share/doc/packages/vym");
    1.52 -				if (!docdir.exists() )
    1.53 -				{
    1.54 -					QMessageBox::critical(0, 
    1.55 -					tr("Critcal error"),
    1.56 -					tr("Couldn't find the documentation\n"
    1.57 -					"vym.pdf in various directories."));
    1.58 -					return;
    1.59 -				}	
    1.60 -			}	
    1.61 -		}
    1.62 +			found=true;
    1.63 +			break;
    1.64 +		}	
    1.65 +
    1.66  	}
    1.67 -	
    1.68 -	QString docpath=docdir.path()+"/"+docname;
    1.69 +	if (!found)
    1.70 +	{
    1.71 +		QMessageBox::critical(0, 
    1.72 +			tr("Critcal error"),
    1.73 +			tr("Couldn't find the documentation %1 in:\n%2").arg(searchList.join("\n")));
    1.74 +		return;
    1.75 +	}	
    1.76 +
    1.77  	QStringList args;
    1.78  	Process *pdfProc = new Process();
    1.79 -	args <<docpath;
    1.80 -
    1.81 -	pdfProc->start( settings.value("/mainwindow/readerPDF").toString());
    1.82 +	args <<docfile.fileName();
    1.83 +
    1.84 +	pdfProc->start( settings.value("/mainwindow/readerPDF").toString(),args);
    1.85  	if ( !pdfProc->waitForStarted() ) 
    1.86  	{
    1.87  		// error handling
    1.88  		QMessageBox::warning(0, 
    1.89  			tr("Warning"),
    1.90 -			tr("Couldn't find a viewer to open %1.\n").arg(docpath)+
    1.91 +			tr("Couldn't find a viewer to open %1.\n").arg(docfile.fileName())+
    1.92  			tr("Please use Settings->")+tr("Set application to open PDF files"));
    1.93  		settingsPDF();	
    1.94  		return;