Skip to content
Permalink
Browse files

[GRASS] fixed saving mapset to project

  • Loading branch information
blazek committed Aug 24, 2015
1 parent 3c0fe13 commit 42953e618ab414a32580d596350b12d0a3955ccf
@@ -93,6 +93,7 @@ QgsGrassPlugin::~QgsGrassPlugin()
{
mEdit->closeEdit();
}
disconnect( QgsGrass::instance(), SIGNAL( mapsetChanged() ), this, SLOT( mapsetChanged() ) );
QgsGrass::instance()->closeMapsetWarn();
}

@@ -181,7 +182,7 @@ void QgsGrassPlugin::initGui()
connect( mRegionAction, SIGNAL( toggled( bool ) ), this, SLOT( switchRegion( bool ) ) );
connect( mOpenMapsetAction, SIGNAL( triggered() ), this, SLOT( openMapset() ) );
connect( mNewMapsetAction, SIGNAL( triggered() ), this, SLOT( newMapset() ) );
connect( mCloseMapsetAction, SIGNAL( triggered() ), QgsGrass::instance(), SLOT( closeMapsetWarn() ) );
connect( mCloseMapsetAction, SIGNAL( triggered() ), SLOT( closeMapset() ) );

// Add actions to a GRASS plugin menu
qGisInterface->addPluginToMenu( tr( "&GRASS" ), mOpenMapsetAction );
@@ -527,6 +528,13 @@ void QgsGrassPlugin::openMapset()
QMessageBox::warning( 0, tr( "Warning" ), tr( "Cannot open the mapset. %1" ).arg( err ) );
return;
}
QgsGrass::saveMapset();
}

void QgsGrassPlugin::closeMapset()
{
QgsGrass::instance()->closeMapsetWarn();
QgsGrass::saveMapset();
}

void QgsGrassPlugin::newMapset()
@@ -577,6 +585,7 @@ void QgsGrassPlugin::projectRead()
QgsGrass::instance()->closeMapsetWarn();

QString err = QgsGrass::openMapset( gisdbase, location, mapset );
QgsGrass::saveMapset();

if ( !err.isNull() )
{
@@ -97,8 +97,10 @@ class QgsGrassPlugin : public QObject, public QgisPlugin
void openTools( void );
//! Create new mapset
void newMapset();
//! Open existing mapset
//! Open existing mapset and save it to project
void openMapset();
//! Close mapset and save it to project
void closeMapset();
//! Current mapset changed (opened/closed)
void mapsetChanged();
//! Create new vector
@@ -153,7 +153,7 @@ QgsGrassTools::QgsGrassTools( QgisInterface *iface, QWidget * parent, const char
setupUi( this );
QPushButton * closeMapsetButton = new QPushButton( QgsApplication::getThemeIcon( "mActionFileExit.png" ), tr( "Close mapset" ), this );
mTabWidget->setCornerWidget( closeMapsetButton );
connect( closeMapsetButton, SIGNAL( clicked() ), QgsGrass::instance(), SLOT( closeMapsetWarn() ) );
connect( closeMapsetButton, SIGNAL( clicked() ), SLOT( closeMapset() ) );

qRegisterMetaType<QgsDetailedItemData>();

@@ -537,6 +537,12 @@ void QgsGrassTools::removeEmptyItems( QStandardItem *item )
}
}

void QgsGrassTools::closeMapset()
{
QgsGrass::instance()->closeMapsetWarn();
QgsGrass::saveMapset();
}

void QgsGrassTools::mapsetChanged()
{
QgsDebugMsg( "entered." );
@@ -77,6 +77,9 @@ class QgsGrassTools: public QDockWidget, private Ui::QgsGrassToolsBase
//! Save window position
void saveWindowLocation();

//! Close mapset and save it to project
void closeMapset();

//! Current mapset changed
void mapsetChanged();

@@ -856,7 +856,6 @@ QString QgsGrass::openMapset( const QString& gisdbase,

mMapsetLock = lock;

saveMapset();
emit QgsGrass::instance()->mapsetChanged();
return QString::null;
}
@@ -919,7 +918,6 @@ QString QgsGrass::closeMapset()
}
}

saveMapset();
emit QgsGrass::instance()->mapsetChanged();
return QString::null;
}
@@ -626,7 +626,9 @@ void QgsGrassMapsetItem::openMapset()
if ( !error.isEmpty() )
{
QgsGrass::warning( error );
return;
}
QgsGrass::saveMapset();
}

//----------------------- QgsGrassObjectItemBase ------------------------------

0 comments on commit 42953e6

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