Skip to content

Commit

Permalink
apply changes to layer before saving qml
Browse files Browse the repository at this point in the history
git-svn-id: http://svn.osgeo.org/qgis/trunk/qgis@8589 c8812cc2-4d05-0410-92ff-de0c093fc19c
  • Loading branch information
jef committed Jun 4, 2008
1 parent 0c272e2 commit 1f1bb58
Showing 1 changed file with 8 additions and 4 deletions.
12 changes: 8 additions & 4 deletions src/app/qgsvectorlayerproperties.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -154,7 +154,7 @@ void QgsVectorLayerProperties::setDisplayField(QString name)
displayFieldComboBox->setCurrentText(name);
}

//! @note in raster props, this metho d is called sync()
//! @note in raster props, this method is called sync()
void QgsVectorLayerProperties::reset( void )
{
// populate the general information
Expand Down Expand Up @@ -639,6 +639,8 @@ void QgsVectorLayerProperties::on_pbnLoadDefaultStyle_clicked()

void QgsVectorLayerProperties::on_pbnSaveDefaultStyle_clicked()
{
apply(); // make sure the qml to save is uptodate

// a flag passed by reference
bool defaultSavedFlag = false;
// after calling this the above flag will be set true for success
Expand Down Expand Up @@ -685,7 +687,7 @@ void QgsVectorLayerProperties::on_pbnLoadStyle_clicked()
if ( myFileDialog->selectedFilter() == tr ( "QGIS Layer Style File (*.qml)" ) )
{
//ensure the user never ommitted the extension from the filename
if ( !myFileName.toUpper().endsWith ( ".QML" ) )
if ( !myFileName.endsWith( ".qml", Qt::CaseInsensitive ) )
{
myFileName += ".qml";
}
Expand Down Expand Up @@ -714,7 +716,6 @@ void QgsVectorLayerProperties::on_pbnLoadStyle_clicked()

void QgsVectorLayerProperties::on_pbnSaveStyleAs_clicked()
{

QSettings myQSettings; // where we keep last used filter in persistant state
QString myLastUsedDir = myQSettings.value ( "style/lastStyleDir", "." ).toString();

Expand Down Expand Up @@ -746,11 +747,14 @@ void QgsVectorLayerProperties::on_pbnSaveStyleAs_clicked()
{
if ( myFileDialog->selectedFilter() == tr ( "QGIS Layer Style File (*.qml)" ) )
{
apply(); // make sure the qml to save is uptodate

//ensure the user never ommitted the extension from the filename
if ( !myOutputFileName.toUpper().endsWith ( ".QML" ) )
if ( !myOutputFileName.endsWith ( ".qml", Qt::CaseInsensitive ) )
{
myOutputFileName += ".qml";
}

bool defaultLoadedFlag = false;
QString myMessage = layer->saveNamedStyle( myOutputFileName, defaultLoadedFlag );
//reset if the default style was loaded ok only
Expand Down

0 comments on commit 1f1bb58

Please sign in to comment.