reload browser if mapset changed

git-svn-id: http://svn.osgeo.org/qgis/trunk@5199 c8812cc2-4d05-0410-92ff-de0c093fc19c
This commit is contained in:
rblazek 2006-04-06 14:42:56 +00:00
parent 3271d3c3be
commit ec144418c8
6 changed files with 20 additions and 7 deletions

View File

@ -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);
}

View File

@ -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();

View File

@ -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,

View File

@ -239,8 +239,6 @@ void QgsGrassPlugin::initGui()
void QgsGrassPlugin::mapsetChanged ()
{
if ( mTools ) mTools->closeTools();
if ( !QgsGrass::activeMode() ) {
mOpenToolsAction->setEnabled(false);
mRegionAction->setEnabled(false);
@ -274,7 +272,6 @@ void QgsGrassPlugin::mapsetChanged ()
mTools->mapsetChanged();
}
}
}
void QgsGrassPlugin::saveMapset()

View File

@ -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()) );
}
@ -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()

View File

@ -30,6 +30,7 @@ class QDomElement;
#include "qgisiface.h"
class QgsGrassProvider;
class QgsGrassBrowser;
#include <QDialog>
#include <QTabBar>
class QSize;
@ -115,6 +116,9 @@ private:
//! QGIS directory
QString mAppDir;
//! Browser
QgsGrassBrowser *mBrowser;
QgsGrassToolsTabWidget *mTabWidget;
Q3ListView *mModulesListView;
};