Skip to content
Permalink
Browse files

Fix lots of bad default base folders. Now point to user home

  • Loading branch information
NathanW2 committed Dec 3, 2015
1 parent 0610878 commit aeafe3c88473f09b0daa434b66ba16f34c449a3e
@@ -1655,7 +1655,7 @@ void QgsComposer::exportCompositionAsPDF( QgsComposer::OutputMode mode )
}

QSettings myQSettings;
QString lastUsedDir = myQSettings.value( "/UI/lastSaveAtlasAsPdfDir", "." ).toString();
QString lastUsedDir = myQSettings.value( "/UI/lastSaveAtlasAsPdfDir", QDir::homePath() ).toString();
outputDir = QFileDialog::getExistingDirectory( this,
tr( "Export atlas to directory" ),
lastUsedDir,
@@ -1995,7 +1995,7 @@ void QgsComposer::exportCompositionAsImage( QgsComposer::OutputMode mode )

if ( atlasMap->enabled() && mComposition->atlasMode() == QgsComposition::PreviewAtlas )
{
QString lastUsedDir = settings.value( "/UI/lastSaveAsImageDir", "." ).toString();
QString lastUsedDir = settings.value( "/UI/lastSaveAsImageDir", QDir::homePath() ).toString();
outputFileName = QDir( lastUsedDir ).filePath( atlasMap->currentFilename() );
}

@@ -2141,7 +2141,7 @@ void QgsComposer::exportCompositionAsImage( QgsComposer::OutputMode mode )
}

QSettings myQSettings;
QString lastUsedDir = myQSettings.value( "/UI/lastSaveAtlasAsImagesDir", "." ).toString();
QString lastUsedDir = myQSettings.value( "/UI/lastSaveAtlasAsImagesDir", QDir::homePath() ).toString();
QString lastUsedFormat = myQSettings.value( "/UI/lastSaveAtlasAsImagesFormat", "jpg" ).toString();

QFileDialog dlg( this, tr( "Export atlas to directory" ) );
@@ -2498,7 +2498,7 @@ void QgsComposer::exportCompositionAsSVG( QgsComposer::OutputMode mode )
}

QSettings myQSettings;
QString lastUsedDir = myQSettings.value( "/UI/lastSaveAtlasAsSvgDir", "." ).toString();
QString lastUsedDir = myQSettings.value( "/UI/lastSaveAtlasAsSvgDir", QDir::homePath() ).toString();

// open file dialog
outputDir = QFileDialog::getExistingDirectory( this,
@@ -261,7 +261,7 @@ void QgsComposerArrowWidget::on_mStartMarkerToolButton_clicked()

if ( openDir.isEmpty() )
{
openDir = s.value( "/UI/lastComposerMarkerDir", "" ).toString();
openDir = s.value( "/UI/lastComposerMarkerDir", QDir::homePath() ).toString();
}

QString svgFileName = QFileDialog::getOpenFileName( this, tr( "Start marker svg file" ), openDir );
@@ -288,7 +288,7 @@ void QgsComposerArrowWidget::on_mEndMarkerToolButton_clicked()

if ( openDir.isEmpty() )
{
openDir = s.value( "/UI/lastComposerMarkerDir", "" ).toString();
openDir = s.value( "/UI/lastComposerMarkerDir", QDir::homePath() ).toString();
}

QString svgFileName = QFileDialog::getOpenFileName( this, tr( "End marker svg file" ), openDir );
@@ -133,7 +133,7 @@ void QgsComposerHtmlWidget::on_mUrlLineEdit_editingFinished()
void QgsComposerHtmlWidget::on_mFileToolButton_clicked()
{
QSettings s;
QString lastDir = s.value( "/UI/lastHtmlDir", "" ).toString();
QString lastDir = s.value( "/UI/lastHtmlDir", QDir::homePath() ).toString();
QString file = QFileDialog::getOpenFileName( this, tr( "Select HTML document" ), lastDir, "HTML (*.html *.htm);;All files (*.*)" );
if ( !file.isEmpty() )
{
@@ -324,7 +324,7 @@ void QgsComposerManager::on_mTemplate_currentIndexChanged( int indx )
void QgsComposerManager::on_mTemplatePathBtn_pressed()
{
QSettings settings;
QString lastTmplDir = settings.value( "/UI/lastComposerTemplateDir", "." ).toString();
QString lastTmplDir = settings.value( "/UI/lastComposerTemplateDir", QDir::homePath() ).toString();
QString tmplPath = QFileDialog::getOpenFileName( this,
tr( "Choose template" ),
lastTmplDir,
@@ -86,7 +86,7 @@ void QgsComposerPictureWidget::on_mPictureBrowseButton_clicked()

if ( openDir.isEmpty() )
{
openDir = s.value( "/UI/lastComposerPictureDir", "" ).toString();
openDir = s.value( "/UI/lastComposerPictureDir", QDir::homePath() ).toString();
}

//show file dialog
@@ -115,7 +115,7 @@ QString QgsOpenVectorLayerDialog::openDirectory()
QSettings settings;

bool haveLastUsedDir = settings.contains( "/UI/LastUsedDirectory" );
QString lastUsedDir = settings.value( "/UI/LastUsedDirectory", QVariant() ).toString();
QString lastUsedDir = settings.value( "/UI/LastUsedDirectory", QDir::homePath() ).toString();
if ( !haveLastUsedDir )
lastUsedDir = "";

@@ -291,7 +291,7 @@ void QgsVectorLayerSaveAsDialog::on_leFilename_textChanged( const QString& text
void QgsVectorLayerSaveAsDialog::on_browseFilename_clicked()
{
QSettings settings;
QString dirName = leFilename->text().isEmpty() ? settings.value( "/UI/lastVectorFileFilterDir", "." ).toString() : leFilename->text();
QString dirName = leFilename->text().isEmpty() ? settings.value( "/UI/lastVectorFileFilterDir", QDir::homePath() ).toString() : leFilename->text();
QString filterString = QgsVectorFileWriter::filterForDriver( format() );
QString outputFile = QFileDialog::getSaveFileName( 0, tr( "Save layer as..." ), dirName, filterString );
if ( !outputFile.isNull() )
@@ -436,7 +436,7 @@ void QgsAlignRasterLayerConfigDialog::setItem( const QString& inputFilename, con
void QgsAlignRasterLayerConfigDialog::browseOutputFilename()
{
QSettings settings;
QString dirName = editOutput->text().isEmpty() ? settings.value( "/UI/lastRasterFileDir", "." ).toString() : editOutput->text();
QString dirName = editOutput->text().isEmpty() ? settings.value( "/UI/lastRasterFileDir", QDir::homePath() ).toString() : editOutput->text();

QString fileName = QFileDialog::getSaveFileName( this, tr( "Select output file" ), dirName, tr( "GeoTIFF" ) + " (*.tif *.tiff *.TIF *.TIFF)" );

@@ -968,7 +968,7 @@ void QgsOptions::on_mProjectOnLaunchPushBtn_pressed()
{
// Retrieve last used project dir from persistent settings
QSettings settings;
QString lastUsedDir = settings.value( "/UI/lastProjectDir", "." ).toString();
QString lastUsedDir = settings.value( "/UI/lastProjectDir", QDir::homePath() ).toString();
QString projPath = QFileDialog::getOpenFileName( this,
tr( "Choose project file to open at launch" ),
lastUsedDir,
@@ -2078,7 +2078,7 @@ void QgsOptions::on_mButtonAddColor_clicked()
void QgsOptions::on_mButtonImportColors_clicked()
{
QSettings s;
QString lastDir = s.value( "/UI/lastGplPaletteDir", "" ).toString();
QString lastDir = s.value( "/UI/lastGplPaletteDir", QDir::homePath() ).toString();
QString filePath = QFileDialog::getOpenFileName( this, tr( "Select palette file" ), lastDir, "GPL (*.gpl);;All files (*.*)" );
activateWindow();
if ( filePath.isEmpty() )
@@ -2107,7 +2107,7 @@ void QgsOptions::on_mButtonImportColors_clicked()
void QgsOptions::on_mButtonExportColors_clicked()
{
QSettings s;
QString lastDir = s.value( "/UI/lastGplPaletteDir", "" ).toString();
QString lastDir = s.value( "/UI/lastGplPaletteDir", QDir::homePath() ).toString();
QString fileName = QFileDialog::getSaveFileName( this, tr( "Palette file" ), lastDir, "GPL (*.gpl)" );
activateWindow();
if ( fileName.isEmpty() )
@@ -1769,7 +1769,7 @@ void QgsProjectProperties::on_mButtonAddColor_clicked()
void QgsProjectProperties::on_mButtonImportColors_clicked()
{
QSettings s;
QString lastDir = s.value( "/UI/lastGplPaletteDir", "" ).toString();
QString lastDir = s.value( "/UI/lastGplPaletteDir", QDir::homePath() ).toString();
QString filePath = QFileDialog::getOpenFileName( this, tr( "Select palette file" ), lastDir, "GPL (*.gpl);;All files (*.*)" );
activateWindow();
if ( filePath.isEmpty() )
@@ -1798,7 +1798,7 @@ void QgsProjectProperties::on_mButtonImportColors_clicked()
void QgsProjectProperties::on_mButtonExportColors_clicked()
{
QSettings s;
QString lastDir = s.value( "/UI/lastGplPaletteDir", "" ).toString();
QString lastDir = s.value( "/UI/lastGplPaletteDir", QDir::homePath() ).toString();
QString fileName = QFileDialog::getSaveFileName( this, tr( "Palette file" ), lastDir, "GPL (*.gpl)" );
activateWindow();
if ( fileName.isEmpty() )
@@ -105,7 +105,7 @@ namespace QgisGui
#endif

QSettings settings; // where we keep last used filter in persistent state
QString lastUsedDir = settings.value( "/UI/lastSaveAsImageDir", "." ).toString();
QString lastUsedDir = settings.value( "/UI/lastSaveAsImageDir", QDir::homePath() ).toString();

// Prefer "png" format unless the user previously chose a different format
QString pngExtension = "png";
@@ -379,7 +379,7 @@ void QgsColorDialogV2::on_mButtonBox_clicked( QAbstractButton * button )
void QgsColorDialogV2::importColors()
{
QSettings s;
QString lastDir = s.value( "/UI/lastGplPaletteDir", "" ).toString();
QString lastDir = s.value( "/UI/lastGplPaletteDir", QDir::homePath() ).toString();
QString filePath = QFileDialog::getOpenFileName( this, tr( "Select palette file" ), lastDir, "GPL (*.gpl);;All files (*.*)" );
activateWindow();
if ( filePath.isEmpty() )
@@ -421,7 +421,7 @@ void QgsColorDialogV2::refreshSchemeComboBox()
void QgsColorDialogV2::importPalette()
{
QSettings s;
QString lastDir = s.value( "/UI/lastGplPaletteDir", "" ).toString();
QString lastDir = s.value( "/UI/lastGplPaletteDir", QDir::homePath() ).toString();
QString filePath = QFileDialog::getOpenFileName( this, tr( "Select palette file" ), lastDir, "GPL (*.gpl);;All files (*.*)" );
activateWindow();
if ( filePath.isEmpty() )
@@ -563,7 +563,7 @@ QString QgsColorDialogV2::gplFilePath()
void QgsColorDialogV2::exportColors()
{
QSettings s;
QString lastDir = s.value( "/UI/lastGplPaletteDir", "" ).toString();
QString lastDir = s.value( "/UI/lastGplPaletteDir", QDir::homePath() ).toString();
QString fileName = QFileDialog::getSaveFileName( this, tr( "Palette file" ), lastDir, "GPL (*.gpl)" );
activateWindow();
if ( fileName.isEmpty() )
@@ -244,7 +244,7 @@ QString QgsNewVectorLayerDialog::runAndCreateLayer( QWidget* parent, QString* pE
geomDialog.attributes( attributes );

QSettings settings;
QString lastUsedDir = settings.value( "/UI/lastVectorFileFilterDir", "." ).toString();
QString lastUsedDir = settings.value( "/UI/lastVectorFileFilterDir", QDir::homePath() ).toString();
QString filterString = QgsVectorFileWriter::filterForDriver( fileformat );
QString fileName = QFileDialog::getSaveFileName( 0, tr( "Save layer as..." ), lastUsedDir, filterString );
if ( fileName.isNull() )
@@ -157,7 +157,7 @@ void QgsRasterLayerSaveAsDialog::on_mBrowseButton_clicked()
QString fileName;

QSettings settings;
QString dirName = mSaveAsLineEdit->text().isEmpty() ? settings.value( "/UI/lastRasterFileDir", "." ).toString() : mSaveAsLineEdit->text();
QString dirName = mSaveAsLineEdit->text().isEmpty() ? settings.value( "/UI/lastRasterFileDir", QDir::homePath() ).toString() : mSaveAsLineEdit->text();

if ( mTileModeCheckBox->isChecked() )
{
@@ -365,7 +365,7 @@ void QgsSearchQueryBuilder::on_btnILike_clicked()
void QgsSearchQueryBuilder::saveQuery()
{
QSettings s;
QString lastQueryFileDir = s.value( "/UI/lastQueryFileDir", "" ).toString();
QString lastQueryFileDir = s.value( "/UI/lastQueryFileDir", QDir::homePath() ).toString();
//save as qqt (QGIS query file)
QString saveFileName = QFileDialog::getSaveFileName( 0, tr( "Save query to file" ), lastQueryFileDir, "*.qqf" );
if ( saveFileName.isNull() )
@@ -401,7 +401,7 @@ void QgsSearchQueryBuilder::saveQuery()
void QgsSearchQueryBuilder::loadQuery()
{
QSettings s;
QString lastQueryFileDir = s.value( "/UI/lastQueryFileDir", "" ).toString();
QString lastQueryFileDir = s.value( "/UI/lastQueryFileDir", QDir::homePath() ).toString();

QString queryFileName = QFileDialog::getOpenFileName( 0, tr( "Load query from file" ), lastQueryFileDir, tr( "Query files" ) + " (*.qqf);;" + tr( "All files" ) + " (*)" );
if ( queryFileName.isNull() )
@@ -255,7 +255,7 @@ void QgsSvgSelectorWidget::populateIcons( const QModelIndex& idx )
void QgsSvgSelectorWidget::on_mFilePushButton_clicked()
{
QSettings settings;
QString openDir = settings.value( "/UI/lastSVGMarkerDir", "." ).toString();
QString openDir = settings.value( "/UI/lastSVGMarkerDir", QDir::homePath() ).toString();

QString lineEditText = mFileLineEdit->text();
if ( !lineEditText.isEmpty() )
@@ -2895,7 +2895,7 @@ void QgsRasterFillSymbolLayerWidget::on_mBrowseToolButton_clicked()

if ( openDir.isEmpty() )
{
openDir = s.value( "/UI/lastRasterFillImageDir", "" ).toString();
openDir = s.value( "/UI/lastRasterFillImageDir", QDir::homePath() ).toString();
}

//show file dialog
@@ -158,7 +158,7 @@ void dxf2shpConverterGui::getOutputDir()
QSettings settings;
QString s = QFileDialog::getSaveFileName( this,
tr( "Choose a file name to save to" ),
settings.value( "/UI/lastShapefileDir", "./" ).toString(),
settings.value( "/UI/lastShapefileDir", QDir::homePath() ).toString(),
tr( "Shapefile" ) + " (*.shp)" );

if ( !s.isEmpty() )
@@ -317,7 +317,7 @@ QGISEXTERN bool createDb( const QString& dbPath, QString& errCause );
void QgsSLRootItem::createDatabase()
{
QSettings settings;
QString lastUsedDir = settings.value( "/UI/lastSpatiaLiteDir", "." ).toString();
QString lastUsedDir = settings.value( "/UI/lastSpatiaLiteDir", QDir::homePath() ).toString();

QString filename = QFileDialog::getSaveFileName( 0, tr( "New SpatiaLite Database File" ),
lastUsedDir,
@@ -269,7 +269,7 @@ bool QgsSpatiaLiteSourceSelect::newConnection( QWidget* parent )
{
// Retrieve last used project dir from persistent settings
QSettings settings;
QString lastUsedDir = settings.value( "/UI/lastSpatiaLiteDir", "." ).toString();
QString lastUsedDir = settings.value( "/UI/lastSpatiaLiteDir", QDir::homePath() ).toString();

QString myFile = QFileDialog::getOpenFileName( parent,
tr( "Choose a SpatiaLite/SQLite DB to open" ),

1 comment on commit aeafe3c

@nyalldawson

This comment has been minimized.

Copy link
Contributor

@nyalldawson nyalldawson commented on aeafe3c Dec 3, 2015

wheeeee! nice!

Please sign in to comment.
You can’t perform that action at this time.