Moved the qt4-port branch to HEAD
authorinsilmaril
Tue, 05 Sep 2006 09:47:13 +0000
changeset 3651cc73bd7ee1f
parent 364 7b74fa3772bf
child 366 e95081c21da2
Moved the qt4-port branch to HEAD
exportoofiledialog.cpp
     1.1 --- a/exportoofiledialog.cpp	Tue Sep 05 09:47:13 2006 +0000
     1.2 +++ b/exportoofiledialog.cpp	Tue Sep 05 09:47:13 2006 +0000
     1.3 @@ -7,7 +7,7 @@
     1.4  	init();
     1.5  }
     1.6  
     1.7 -ExportOOFileDialog::ExportOOFileDialog (QWidget * parent, const char* name, bool modal):QFileDialog(parent, name,modal)
     1.8 +ExportOOFileDialog::ExportOOFileDialog (QWidget * parent, const QString &caption ):QFileDialog(parent, caption)
     1.9  {
    1.10  	init();
    1.11  }
    1.12 @@ -17,13 +17,14 @@
    1.13  	return !filters.isEmpty();
    1.14  }
    1.15  
    1.16 +
    1.17  QString ExportOOFileDialog::selectedConfig()
    1.18  {
    1.19  	QStringList::Iterator itpath=configPaths.begin();
    1.20  	QStringList::Iterator itf=filters.begin();
    1.21  	while (itf != filters.end()) 
    1.22  	{
    1.23 -		if (*itf==lastFilter) return *itpath;
    1.24 +		if (*itf==selectedFilter()) return *itpath;
    1.25  		itpath++;	
    1.26  		itf++;
    1.27      }
    1.28 @@ -42,11 +43,10 @@
    1.29  }
    1.30  
    1.31  
    1.32 -void ExportOOFileDialog::addFilter(const QString &f)
    1.33 +void ExportOOFileDialog::show()
    1.34  {
    1.35 -	lastFilter=f;
    1.36 -	filters.append (f);
    1.37 -	QFileDialog::addFilter (f);
    1.38 +	setFilters (filters);
    1.39 +	QFileDialog::show();
    1.40  }
    1.41  
    1.42  void ExportOOFileDialog::init()
    1.43 @@ -57,7 +57,7 @@
    1.44  	scanExportConfigs(d);
    1.45  	d.setPath (d.homeDirPath()+"/.vym/exports");
    1.46  	scanExportConfigs(d);
    1.47 -	d.setPath ("exports");
    1.48 +	d.setPath (d.currentPath()+"/exports");
    1.49  	scanExportConfigs(d);
    1.50  
    1.51  	connect (
    1.52 @@ -65,29 +65,33 @@
    1.53  		this, SLOT( newConfigPath(const QString &)));
    1.54  }
    1.55  
    1.56 -void ExportOOFileDialog::scanExportConfigs(QDir d)
    1.57 +void ExportOOFileDialog::addFilter(const QString &f)
    1.58 +{
    1.59 +	lastFilter=f;
    1.60 +	filters.append (f);
    1.61 +}
    1.62 +
    1.63 +void ExportOOFileDialog::scanExportConfigs(QDir dir)
    1.64  {
    1.65  	// Scan existing export configurations
    1.66  	SimpleSettings set;
    1.67  	QFile f;
    1.68 -	if (d.exists())
    1.69 +	if (dir.exists())
    1.70  	{
    1.71  		// Traverse files
    1.72 -		d.setFilter( QDir::Files| QDir::Hidden | QDir::NoSymLinks );
    1.73 -		const QFileInfoList *filelist = d.entryInfoList();
    1.74 -		QFileInfoListIterator itfile( *filelist );
    1.75 -		QFileInfo *fi;
    1.76 +        dir.setFilter(QDir::Files | QDir::Hidden | QDir::NoSymLinks);
    1.77  
    1.78 -		while ( (fi = itfile.current()) != 0 ) 
    1.79 -		{
    1.80 -			if (fi->fileName().endsWith(".conf") )
    1.81 +        QFileInfoList list = dir.entryInfoList();
    1.82 +        for (int i = 0; i < list.size(); ++i) {
    1.83 +            QFileInfo fi = list.at(i);
    1.84 +
    1.85 +			if (fi.fileName().endsWith(".conf") )
    1.86  			{
    1.87 -				configPaths.append (fi->absFilePath());
    1.88 +				configPaths.append (fi.absFilePath());
    1.89  				set.clear();
    1.90 -				set.readSettings (fi->absFilePath());
    1.91 -				addFilter (set.readEntry("Name") + " (*.odp)");
    1.92 +				set.readSettings (fi.absFilePath());
    1.93 +				addFilter (set.readEntry(QString("Name")) + " (*.odp)");
    1.94  			}		
    1.95 -			++itfile;
    1.96 -		}	
    1.97 +        }
    1.98  	}		
    1.99  }