Skip to content

Commit

Permalink
reload browser if mapset changed
Browse files Browse the repository at this point in the history
git-svn-id: http://svn.osgeo.org/qgis/trunk@5199 c8812cc2-4d05-0410-92ff-de0c093fc19c
  • Loading branch information
rblazek committed Apr 6, 2006
1 parent 3271d3c commit ec14441
Show file tree
Hide file tree
Showing 6 changed files with 20 additions and 7 deletions.
4 changes: 4 additions & 0 deletions src/plugins/grass/qgsgrassbrowser.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -537,3 +537,7 @@ void QgsGrassBrowser::currentChanged(const QModelIndex & current, const QModelIn
#endif
}

void QgsGrassBrowser::setLocation( const QString &gisbase, const QString &location )
{
mModel->setLocation(gisbase, location);
}
3 changes: 3 additions & 0 deletions src/plugins/grass/qgsgrassbrowser.h
Original file line number Diff line number Diff line change
Expand Up @@ -62,6 +62,9 @@ public slots:
// Write region
void writeRegion ( struct Cell_head *window );

// Set Location
void setLocation ( const QString &gisbase, const QString &location );

// Refresh model
void refresh();

Expand Down
4 changes: 4 additions & 0 deletions src/plugins/grass/qgsgrassmodel.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -913,8 +913,12 @@ QString QgsGrassModel::uri ( const QModelIndex &index ) const

void QgsGrassModel::setLocation( const QString &gisbase, const QString &location )
{
removeItems(mRoot, QStringList());
mGisbase = gisbase;
mLocation = location;
mRoot->mGisbase = gisbase;
mRoot->mLocation = location;
refreshItem(mRoot);
}

QVariant QgsGrassModel::headerData(int section,
Expand Down
3 changes: 0 additions & 3 deletions src/plugins/grass/qgsgrassplugin.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -239,8 +239,6 @@ void QgsGrassPlugin::initGui()

void QgsGrassPlugin::mapsetChanged ()
{
if ( mTools ) mTools->closeTools();

if ( !QgsGrass::activeMode() ) {
mOpenToolsAction->setEnabled(false);
mRegionAction->setEnabled(false);
Expand Down Expand Up @@ -274,7 +272,6 @@ void QgsGrassPlugin::mapsetChanged ()
mTools->mapsetChanged();
}
}

}

void QgsGrassPlugin::saveMapset()
Expand Down
9 changes: 5 additions & 4 deletions src/plugins/grass/qgsgrasstools.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -159,10 +159,10 @@ QgsGrassTools::QgsGrassTools ( QgisApp *qgisApp, QgisIface *iface,
// Add map browser
// Warning: if browser is on the first page modules are
// displayed over the browser
QgsGrassBrowser *browser = new QgsGrassBrowser ( mIface, this );
mTabWidget->addTab( browser, "Browser" );
mBrowser = new QgsGrassBrowser ( mIface, this );
mTabWidget->addTab( mBrowser, "Browser" );

connect( browser, SIGNAL(regionChanged()),
connect( mBrowser, SIGNAL(regionChanged()),
this, SLOT(emitRegionChanged()) );
}

Expand Down Expand Up @@ -385,7 +385,8 @@ void QgsGrassTools::mapsetChanged()
+ "/" + QgsGrass::getDefaultMapset();
setCaption(title);

// TODO: Close opened tools (tabs) ?
closeTools();
mBrowser->setLocation( QgsGrass::getDefaultGisdbase(), QgsGrass::getDefaultLocation() );
}

QgsGrassTools::~QgsGrassTools()
Expand Down
4 changes: 4 additions & 0 deletions src/plugins/grass/qgsgrasstools.h
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@ class QDomElement;
#include "qgisiface.h"

class QgsGrassProvider;
class QgsGrassBrowser;
#include <QDialog>
#include <QTabBar>
class QSize;
Expand Down Expand Up @@ -115,6 +116,9 @@ public slots:
//! QGIS directory
QString mAppDir;

//! Browser
QgsGrassBrowser *mBrowser;

QgsGrassToolsTabWidget *mTabWidget;
Q3ListView *mModulesListView;
};
Expand Down

0 comments on commit ec14441

Please sign in to comment.