fixed QgsProjectIo so right-click context menus are connected when loading a saved project

git-svn-id: http://svn.osgeo.org/qgis/trunk@603 c8812cc2-4d05-0410-92ff-de0c093fc19c
This commit is contained in:
gsherman 2004-01-27 03:01:11 +00:00
parent 409d73805f
commit e1794c5f93
3 changed files with 12 additions and 7 deletions

View File

@ -584,7 +584,7 @@ void QgisApp::fileNew(){
}
void QgisApp::fileOpen(){
mapCanvas->freeze(true);
QgsProjectIo *pio = new QgsProjectIo(mapCanvas, QgsProjectIo::OPEN);
QgsProjectIo *pio = new QgsProjectIo(mapCanvas, QgsProjectIo::OPEN, this);
if(pio->read()){
setCaption(tr("Quantum GIS --") +" " + pio->baseName());

View File

@ -12,7 +12,7 @@
* (at your option) any later version. *
* *
***************************************************************************/
/* qgsprojectio.cpp,v 1.18 2004/01/26 17:25:22 mhugent Exp */
/* qgsprojectio.cpp,v 1.19 2004/01/27 03:01:11 gsherman Exp */
#include <iostream>
#include <fstream>
#include <qfiledialog.h>
@ -34,9 +34,10 @@
#include "qgssisydialog.h"
#include "qgsgrasydialog.h"
#include "qgscontcoldialog.h"
#include "qgisapp.h"
QgsProjectIo::QgsProjectIo(QgsMapCanvas *_map, int _action) : map(_map), action(_action)
QgsProjectIo::QgsProjectIo(QgsMapCanvas *_map, int _action, QgisApp *qgis)
: map(_map), action(_action), qgisApp(qgis)
{
}
@ -408,12 +409,13 @@ bool QgsProjectIo::read(){
//dbl->setSymbol(sym);
dbl->setVisible(visible == "1");
qWarning("adde den Layer");
dbl->initContextMenu(qgisApp);
map->addLayer(dbl);
}
else if ( type == "raster" )
{
QgsRasterLayer *myRasterLayer = new QgsRasterLayer(dataSource, layerName);
myRasterLayer->initContextMenu(qgisApp);
map->addLayer(myRasterLayer);
myRasterLayer->setVisible(visible == "1");

View File

@ -12,12 +12,13 @@
* (at your option) any later version. *
* *
***************************************************************************/
/* qgsprojectio.h,v 1.3 2003/11/09 06:15:31 gsherman Exp */
/* qgsprojectio.h,v 1.4 2004/01/27 03:01:11 gsherman Exp */
#ifndef _QGSPROJECTIO_H_
#define _QGSPROJECTIO_H_
class QgsMapCanvas;
class QgisApp;
/*! \class QgsProjectIo
* \brief Class to handle reading and writing a Qgis project file
*/
@ -25,7 +26,7 @@ class QgsProjectIo
{
public:
QgsProjectIo(QgsMapCanvas *map=0, int action=SAVE);
QgsProjectIo(QgsMapCanvas *map=0, int action=SAVE, QgisApp *qgis=0);
~QgsProjectIo();
//! Read the file and create the map
bool read();
@ -51,6 +52,8 @@ public:
QString fullPath;
bool neverSaved;
QgsMapCanvas *map;
//! pointer to the main app for connecting slots
QgisApp *qgisApp;
int action;
};