From 3b42313d34ea4da0a6a4efbc7bf03e207f04ef30 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Volker=20Fr=C3=B6hlich?= Date: Sun, 11 Jul 2010 23:32:19 +0000 Subject: [PATCH] Update to 1.4.0 --- .cvsignore | 2 +- qgis-1.0.2-sip49.patch | 252 --- qgis-1.4.0-QVariant.patch | 11 + qgis-1.4.0-asslibqgis.patch | 41 + qgis-1.4.0-asslibqgisv.patch | 45 + qgis-1.4.0-fieldcalc.patch | 35 + qgis-1.4.0-grass.patch | 11 + qgis-1.4.0-qt47.patch | 149 ++ qgis-1.4.0-savebutton.patch | 1687 +++++++++++++++++ ....2-sip410.patch => qgis-1.4.0-sip410.patch | 9 +- qgis-1.4.0-vectorcrs.patch | 22 + qgis.desktop | 4 +- qgis.spec | 400 ++-- sources | 2 +- 14 files changed, 2224 insertions(+), 446 deletions(-) delete mode 100644 qgis-1.0.2-sip49.patch create mode 100644 qgis-1.4.0-QVariant.patch create mode 100644 qgis-1.4.0-asslibqgis.patch create mode 100644 qgis-1.4.0-asslibqgisv.patch create mode 100644 qgis-1.4.0-fieldcalc.patch create mode 100644 qgis-1.4.0-grass.patch create mode 100644 qgis-1.4.0-qt47.patch create mode 100644 qgis-1.4.0-savebutton.patch rename qgis-1.0.2-sip410.patch => qgis-1.4.0-sip410.patch (67%) create mode 100644 qgis-1.4.0-vectorcrs.patch diff --git a/.cvsignore b/.cvsignore index 173f950..2cd6b09 100644 --- a/.cvsignore +++ b/.cvsignore @@ -1 +1 @@ -qgis_1.0.2.tar.gz +qgis_1.4.0.tar.gz diff --git a/qgis-1.0.2-sip49.patch b/qgis-1.0.2-sip49.patch deleted file mode 100644 index a5e01ad..0000000 --- a/qgis-1.0.2-sip49.patch +++ /dev/null @@ -1,252 +0,0 @@ -diff -Naur qgis-1.0.2-orig/python/core/conversions.sip qgis-1.0.2/python/core/conversions.sip ---- qgis-1.0.2-orig/python/core/conversions.sip 2008-08-20 02:55:54.000000000 -0400 -+++ qgis-1.0.2/python/core/conversions.sip 2009-12-23 10:29:42.819937299 -0500 -@@ -77,17 +77,17 @@ - for (int i = 0; i < PyList_GET_SIZE(sipPy); ++i) - { - int state; -- //TYPE *t = reinterpret_cast(sipConvertToInstance(PyList_GET_ITEM(sipPy, i), sipClass_TYPE, sipTransferObj, SIP_NOT_NONE, &state, sipIsErr)); -+ //TYPE *t = reinterpret_cast(sipConvertToInstance(PyList_GET_ITEM(sipPy, i), (sipWrapperType *) sipTypeAsPyTypeObject (sipType_TYPE), sipTransferObj, SIP_NOT_NONE, &state, sipIsErr)); - QVector * t = reinterpret_cast< QVector * >(sipConvertToMappedType(PyList_GET_ITEM(sipPy, i), qvector_qgspoint, sipTransferObj, SIP_NOT_NONE, &state, sipIsErr)); - - if (*sipIsErr) - { -- sipReleaseInstance(t, sipClass_TYPE, state); -+ sipReleaseInstance(t, (sipWrapperType *) sipTypeAsPyTypeObject (sipType_TYPE), state); - delete ql; - return 0; - } - ql->append(*t); -- sipReleaseInstance(t, sipClass_TYPE, state); -+ sipReleaseInstance(t, (sipWrapperType *) sipTypeAsPyTypeObject (sipType_TYPE), state); - } - - *sipCppPtr = ql; -@@ -153,17 +153,17 @@ - for (int i = 0; i < PyList_GET_SIZE(sipPy); ++i) - { - int state; -- //TYPE *t = reinterpret_cast(sipConvertToInstance(PyList_GET_ITEM(sipPy, i), sipClass_TYPE, sipTransferObj, SIP_NOT_NONE, &state, sipIsErr)); -+ //TYPE *t = reinterpret_cast(sipConvertToInstance(PyList_GET_ITEM(sipPy, i), (sipWrapperType *) sipTypeAsPyTypeObject (sipType_TYPE), sipTransferObj, SIP_NOT_NONE, &state, sipIsErr)); - QVector > * t = reinterpret_cast< QVector< QVector > * >(sipConvertToMappedType(PyList_GET_ITEM(sipPy, i), qvector_qgspoint, sipTransferObj, SIP_NOT_NONE, &state, sipIsErr)); - - if (*sipIsErr) - { -- sipReleaseInstance(t, sipClass_TYPE, state); -+ sipReleaseInstance(t, (sipWrapperType *) sipTypeAsPyTypeObject (sipType_TYPE), state); - delete ql; - return 0; - } - ql->append(*t); -- sipReleaseInstance(t, sipClass_TYPE, state); -+ sipReleaseInstance(t, (sipWrapperType *) sipTypeAsPyTypeObject (sipType_TYPE), state); - } - - *sipCppPtr = ql; -@@ -243,7 +243,7 @@ - TYPE *t = new TYPE(*it); - PyObject *tobj; - -- if ((tobj = sipConvertFromNewInstance(t, sipClass_TYPE, sipTransferObj)) == NULL) -+ if ((tobj = sipConvertFromNewInstance(t, (sipWrapperType *) sipTypeAsPyTypeObject (sipType_TYPE), sipTransferObj)) == NULL) - { - Py_DECREF(l); - delete t; -@@ -263,7 +263,7 @@ - return 0; - - for (int i = 0; i < PyList_GET_SIZE(sipPy); ++i) -- if (!sipCanConvertToInstance(PyList_GET_ITEM(sipPy, i), sipClass_TYPE, SIP_NOT_NONE)) -+ if (!sipCanConvertToInstance(PyList_GET_ITEM(sipPy, i), (sipWrapperType *) sipTypeAsPyTypeObject (sipType_TYPE), SIP_NOT_NONE)) - return 0; - - return 1; -@@ -274,16 +274,16 @@ - for (int i = 0; i < PyList_GET_SIZE(sipPy); ++i) - { - int state; -- TYPE* t = reinterpret_cast(sipConvertToInstance(PyList_GET_ITEM(sipPy, i), sipClass_TYPE, sipTransferObj, SIP_NOT_NONE, &state, sipIsErr)); -+ TYPE* t = reinterpret_cast(sipConvertToInstance(PyList_GET_ITEM(sipPy, i), (sipWrapperType *) sipTypeAsPyTypeObject (sipType_TYPE), sipTransferObj, SIP_NOT_NONE, &state, sipIsErr)); - - if (*sipIsErr) - { -- sipReleaseInstance(t, sipClass_TYPE, state); -+ sipReleaseInstance(t, (sipWrapperType *) sipTypeAsPyTypeObject (sipType_TYPE), state); - delete qset; - return 0; - } - qset->insert(*t); -- sipReleaseInstance(t, sipClass_TYPE, state); -+ sipReleaseInstance(t, (sipWrapperType *) sipTypeAsPyTypeObject (sipType_TYPE), state); - } - - *sipCppPtr = qset; -@@ -364,7 +364,7 @@ - Py_ssize_t j = 0; - while (PyDict_Next(tobj, &j, &kobj2, &tobj2)) - { -- if (!sipCanConvertToInstance(tobj2, sipClass_TYPE, SIP_NOT_NONE)) -+ if (!sipCanConvertToInstance(tobj2, (sipWrapperType *) sipTypeAsPyTypeObject (sipType_TYPE), SIP_NOT_NONE)) - return 0; - } - -@@ -391,17 +391,17 @@ - int k2 = PyInt_AsLong(kobj2); - int state; - -- TYPE* fa = reinterpret_cast(sipConvertToInstance(tobj2, sipClass_TYPE, sipTransferObj,SIP_NOT_NONE,&state,sipIsErr)); -+ TYPE* fa = reinterpret_cast(sipConvertToInstance(tobj2, (sipWrapperType *) sipTypeAsPyTypeObject (sipType_TYPE), sipTransferObj,SIP_NOT_NONE,&state,sipIsErr)); - - if (*sipIsErr) - { -- sipReleaseInstance(tobj2, sipClass_TYPE, state); -+ sipReleaseInstance(tobj2, (sipWrapperType *) sipTypeAsPyTypeObject (sipType_TYPE), state); - delete qm; - return 0; - } - - qm2.insert(k2, *fa); -- sipReleaseInstance(tobj2, sipClass_TYPE, state); -+ sipReleaseInstance(tobj2, (sipWrapperType *) sipTypeAsPyTypeObject (sipType_TYPE), state); - } - qm->insert(k, qm2); - } -@@ -432,7 +432,7 @@ - { - QString *t1 = new QString(i.key()); - -- PyObject *t1obj = sipConvertFromNewInstance(t1, sipClass_QString, sipTransferObj); -+ PyObject *t1obj = sipConvertFromNewInstance(t1, (sipWrapperType *) sipTypeAsPyTypeObject (sipType_QString), sipTransferObj); - PyObject *t2obj = PyInt_FromLong( (long) i.value() ); - - if (t1obj == NULL || t2obj == NULL || PyDict_SetItem(d, t1obj, t2obj) < 0) -@@ -478,7 +478,7 @@ - - while (PyDict_Next(sipPy, &i, &t1obj, &t2obj)) - { -- if (!sipCanConvertToInstance(t1obj, sipClass_QString, SIP_NOT_NONE)) -+ if (!sipCanConvertToInstance(t1obj, (sipWrapperType *) sipTypeAsPyTypeObject (sipType_QString), SIP_NOT_NONE)) - return 0; - } - -@@ -491,19 +491,19 @@ - { - int state; - -- QString *t1 = reinterpret_cast(sipConvertToInstance(t1obj, sipClass_QString, sipTransferObj, SIP_NOT_NONE, &state, sipIsErr)); -+ QString *t1 = reinterpret_cast(sipConvertToInstance(t1obj, (sipWrapperType *) sipTypeAsPyTypeObject (sipType_QString), sipTransferObj, SIP_NOT_NONE, &state, sipIsErr)); - QVariant::Type t2 = (QVariant::Type) PyInt_AsLong(t1obj); - - if (*sipIsErr) - { -- sipReleaseInstance(t1, sipClass_QString, state); -+ sipReleaseInstance(t1, (sipWrapperType *) sipTypeAsPyTypeObject (sipType_QString), state); - delete qm; - return 0; - } - - qm->insert(*t1, t2); - -- sipReleaseInstance(t1, sipClass_QString, state); -+ sipReleaseInstance(t1, (sipWrapperType *) sipTypeAsPyTypeObject (sipType_QString), state); - } - - *sipCppPtr = qm; -@@ -534,8 +534,8 @@ - TYPE1 *t1 = new TYPE1(i.key()); - TYPE2 *t2 = i.value(); - -- PyObject *t1obj = sipConvertFromNewInstance(t1, sipClass_TYPE1, sipTransferObj); -- PyObject *t2obj = sipConvertFromInstance(t2, sipClass_TYPE2, sipTransferObj); -+ PyObject *t1obj = sipConvertFromNewInstance(t1, (sipWrapperType *) sipTypeAsPyTypeObject (sipType_TYPE1), sipTransferObj); -+ PyObject *t2obj = sipConvertFromInstance(t2, (sipWrapperType *) sipTypeAsPyTypeObject (sipType_TYPE2), sipTransferObj); - - if (t1obj == NULL || t2obj == NULL || PyDict_SetItem(d, t1obj, t2obj) < 0) - { -@@ -579,10 +579,10 @@ - - while (PyDict_Next(sipPy, &i, &t1obj, &t2obj)) - { -- if (!sipCanConvertToInstance(t1obj, sipClass_TYPE1, SIP_NOT_NONE)) -+ if (!sipCanConvertToInstance(t1obj, (sipWrapperType *) sipTypeAsPyTypeObject (sipType_TYPE1), SIP_NOT_NONE)) - return 0; - -- if (!sipCanConvertToInstance(t2obj, sipClass_TYPE2, SIP_NOT_NONE)) -+ if (!sipCanConvertToInstance(t2obj, (sipWrapperType *) sipTypeAsPyTypeObject (sipType_TYPE2), SIP_NOT_NONE)) - return 0; - } - -@@ -595,13 +595,13 @@ - { - int state1, state2; - -- TYPE1 *t1 = reinterpret_cast(sipConvertToInstance(t1obj, sipClass_TYPE1, sipTransferObj, SIP_NOT_NONE, &state1, sipIsErr)); -- TYPE2 *t2 = reinterpret_cast(sipConvertToInstance(t2obj, sipClass_TYPE2, sipTransferObj, SIP_NOT_NONE, &state2, sipIsErr)); -+ TYPE1 *t1 = reinterpret_cast(sipConvertToInstance(t1obj, (sipWrapperType *) sipTypeAsPyTypeObject (sipType_TYPE1), sipTransferObj, SIP_NOT_NONE, &state1, sipIsErr)); -+ TYPE2 *t2 = reinterpret_cast(sipConvertToInstance(t2obj, (sipWrapperType *) sipTypeAsPyTypeObject (sipType_TYPE2), sipTransferObj, SIP_NOT_NONE, &state2, sipIsErr)); - - if (*sipIsErr) - { -- sipReleaseInstance(t1, sipClass_TYPE1, state1); -- sipReleaseInstance(t2, sipClass_TYPE2, state2); -+ sipReleaseInstance(t1, (sipWrapperType *) sipTypeAsPyTypeObject (sipType_TYPE1), state1); -+ sipReleaseInstance(t2, (sipWrapperType *) sipTypeAsPyTypeObject (sipType_TYPE2), state2); - - delete qm; - return 0; -@@ -609,8 +609,8 @@ - - qm->insert(*t1, t2); - -- sipReleaseInstance(t1, sipClass_TYPE1, state1); -- sipReleaseInstance(t2, sipClass_TYPE2, state2); -+ sipReleaseInstance(t1, (sipWrapperType *) sipTypeAsPyTypeObject (sipType_TYPE1), state1); -+ sipReleaseInstance(t2, (sipWrapperType *) sipTypeAsPyTypeObject (sipType_TYPE2), state2); - } - - *sipCppPtr = qm; -@@ -642,7 +642,7 @@ - const double t1 = i.key(); - TYPE2 * t2 = &i.value(); - PyObject *t1obj = PyFloat_FromDouble(t1); -- PyObject *t2obj = sipConvertFromInstance(t2, sipClass_TYPE2, sipTransferObj); -+ PyObject *t2obj = sipConvertFromInstance(t2, (sipWrapperType *) sipTypeAsPyTypeObject (sipType_TYPE2), sipTransferObj); - if (PyDict_GetItem(d, t1obj) == NULL) { - PyObject *lst = PyList_New(0); - PyDict_SetItem(d, t1obj, lst); -@@ -695,7 +695,7 @@ - { - for (int i = 0; i < PyList_GET_SIZE(t2obj); ++i) { - if (!sipCanConvertToInstance(PyList_GET_ITEM(t2obj, i), -- sipClass_TYPE2, SIP_NOT_NONE)) -+ (sipWrapperType *) sipTypeAsPyTypeObject (sipType_TYPE2), SIP_NOT_NONE)) - return 0; - } - } -@@ -712,7 +712,7 @@ - TYPE2 *t2 = - reinterpret_cast(sipConvertToInstance(PyList_GET_ITEM(t2obj, - i), -- sipClass_TYPE2, -+ (sipWrapperType *) sipTypeAsPyTypeObject (sipType_TYPE2), - sipTransferObj, - SIP_NOT_NONE, - &state2, -@@ -720,7 +720,7 @@ - - if (*sipIsErr) - { -- sipReleaseInstance(t2, sipClass_TYPE2, state2); -+ sipReleaseInstance(t2, (sipWrapperType *) sipTypeAsPyTypeObject (sipType_TYPE2), state2); - - delete qm; - return 0; -@@ -728,7 +728,7 @@ - - qm->insert(k, *t2); - -- sipReleaseInstance(t2, sipClass_TYPE2, state2); -+ sipReleaseInstance(t2, (sipWrapperType *) sipTypeAsPyTypeObject (sipType_TYPE2), state2); - } - } - diff --git a/qgis-1.4.0-QVariant.patch b/qgis-1.4.0-QVariant.patch new file mode 100644 index 0000000..fe65d9e --- /dev/null +++ b/qgis-1.4.0-QVariant.patch @@ -0,0 +1,11 @@ +--- qgis-1.4.0/src/app/composer/qgscomposer.cpp 2010-07-08 02:11:17.760602369 +0200 ++++ qgis-1.4.0-QVariant/src/app/composer/qgscomposer.cpp 2010-07-09 09:32:38.158621669 +0200 +@@ -1030,7 +1030,7 @@ + QSettings settings; + restoreGeometry( settings.value( "/Composer/geometry" ).toByteArray() ); + QVariant splitterState = settings.value( "/Composer/splitterState" ); +- if ( splitterState != QVariant::QVariant() ) ++ if ( splitterState != QVariant() ) + { + //mSplitter->restoreState(settings.value("/Composer/splitterState").toByteArray()); + } diff --git a/qgis-1.4.0-asslibqgis.patch b/qgis-1.4.0-asslibqgis.patch new file mode 100644 index 0000000..059c9ad --- /dev/null +++ b/qgis-1.4.0-asslibqgis.patch @@ -0,0 +1,41 @@ +Index: /trunk/qgis/src/core/qgscoordinatereferencesystem.cpp +=================================================================== +--- qgis-1.4.0/src/core/qgscoordinatereferencesystem.cpp (revision 13307) ++++ /trunk/qgis/src/core/qgscoordinatereferencesystem.cpp (revision 13508) +@@ -32,5 +32,4 @@ + #include "qgis.h" //const vals declared here + +-#include + #include + +@@ -1146,5 +1145,5 @@ + sqlite3_close( db ); + +- //assert(myProjString.length() > 0); ++ //Q_ASSERT(myProjString.length() > 0); + return myProjString; + } +@@ -1260,10 +1259,8 @@ + if ( myResult != SQLITE_OK ) + { +- QgsDebugMsg( QString( "Can't open database: %1 \n please notify QGIS developers of this error \n %2 (file name) " ) +- .arg( sqlite3_errmsg( myDatabase ) ) +- .arg( QgsApplication::qgisUserDbFilePath() ) ); +- // XXX This will likely never happen since on open, sqlite creates the +- // database if it does not exist. +- assert( myResult == SQLITE_OK ); ++ QgsDebugMsg( QString( "Can't open or create database %1: %2" ) ++ .arg( QgsApplication::qgisUserDbFilePath() ) ++ .arg( sqlite3_errmsg( myDatabase ) ) ); ++ return false; + } + QgsDebugMsg( QString( "Update or insert sql \n%1" ).arg( mySql ) ); +@@ -1286,7 +1283,5 @@ + { + QgsDebugMsg( QString( "Can't open database: %1" ).arg( sqlite3_errmsg( myDatabase ) ) ); +- // XXX This will likely never happen since on open, sqlite creates the +- // database if it does not exist. +- assert( myResult == SQLITE_OK ); ++ return 0; + } + // Set up the query to retrieve the projection information needed to populate the ELLIPSOID list diff --git a/qgis-1.4.0-asslibqgisv.patch b/qgis-1.4.0-asslibqgisv.patch new file mode 100644 index 0000000..f5fae92 --- /dev/null +++ b/qgis-1.4.0-asslibqgisv.patch @@ -0,0 +1,45 @@ +--- /src/core/qgscoordinatereferencesystem.cpp 2010-06-07 21:40:15.448733536 +0200 ++++ qgscoordinatereferencesystem.cpp.patched 2010-06-07 22:05:03.340736906 +0200 +@@ -31,7 +31,6 @@ + #include "qgsmessageoutput.h" + #include "qgis.h" //const vals declared here + +-#include + #include + + //gdal and ogr includes (needed for == operator) +@@ -1127,7 +1126,7 @@ + // close the database + sqlite3_close( db ); + +- //assert(myProjString.length() > 0); ++ //Q_ASSERT(myProjString.length() > 0); + return myProjString; + } + +@@ -1238,10 +1237,10 @@ + myResult = sqlite3_open( QgsApplication::qgisUserDbFilePath().toUtf8().data(), &myDatabase ); + if ( myResult != SQLITE_OK ) + { +- QgsDebugMsg( QString( "Can't open database: %1 \n please notify QGIS developers of this error \n %2 (file name) " ).arg( sqlite3_errmsg( myDatabase ) ).arg( QgsApplication::qgisUserDbFilePath() ) ); +- // XXX This will likely never happen since on open, sqlite creates the +- // database if it does not exist. +- assert( myResult == SQLITE_OK ); ++ QgsDebugMsg( QString( "Can't open or create database %1: %2" ) ++ .arg( QgsApplication::qgisUserDbFilePath() ) ++ .arg( sqlite3_errmsg( myDatabase ) ) ); ++ return false; + } + QgsDebugMsg( QString( "Update or insert sql \n%1" ).arg( mySql ) ); + myResult = sqlite3_prepare( myDatabase, mySql.toUtf8(), mySql.toUtf8().length(), &myPreparedStatement, &myTail ); +@@ -1263,9 +1262,7 @@ + if ( myResult != SQLITE_OK ) + { + QgsDebugMsg( QString( "Can't open database: %1" ).arg( sqlite3_errmsg( myDatabase ) ) ); +- // XXX This will likely never happen since on open, sqlite creates the +- // database if it does not exist. +- assert( myResult == SQLITE_OK ); ++ return 0; + } + // Set up the query to retrieve the projection information needed to populate the ELLIPSOID list + QString mySql = "select count(*) from tbl_srs"; diff --git a/qgis-1.4.0-fieldcalc.patch b/qgis-1.4.0-fieldcalc.patch new file mode 100644 index 0000000..7e513b2 --- /dev/null +++ b/qgis-1.4.0-fieldcalc.patch @@ -0,0 +1,35 @@ +Index: /trunk/qgis/src/app/qgsfieldcalculator.cpp +=================================================================== +--- qgis-1.4.0/src/app/qgsfieldcalculator.cpp (revision 12551) ++++ /trunk/qgis/src/app/qgsfieldcalculator.cpp (revision 13046) +@@ -25,4 +25,9 @@ + setupUi( this ); + ++ if ( !vl ) ++ { ++ return; ++ } ++ + populateFields(); + populateOutputFieldTypes(); +@@ -32,5 +37,5 @@ + mOutputFieldPrecisionSpinBox->setValue( 3 ); + +- mUpdateExistingFieldCheckBox->setCheckState( Qt::Checked ); ++ + + //disable ok button until there is text for output field and expression +@@ -40,7 +45,13 @@ + if ( !( vl->dataProvider()->capabilities() & QgsVectorDataProvider::AddAttributes ) ) + { ++ mUpdateExistingFieldCheckBox->setCheckState( Qt::Checked ); + mUpdateExistingFieldCheckBox->setEnabled( false ); // must stay checked + mNewFieldGroupBox->setEnabled( false ); + mNewFieldGroupBox->setTitle( mNewFieldGroupBox->title() + tr( " (not supported by provider)" ) ); ++ } ++ ++ if ( vl->selectedFeaturesIds().size() > 0 ) ++ { ++ mOnlyUpdateSelectedCheckBox->setChecked( true ); + } + diff --git a/qgis-1.4.0-grass.patch b/qgis-1.4.0-grass.patch new file mode 100644 index 0000000..fdc0c2c --- /dev/null +++ b/qgis-1.4.0-grass.patch @@ -0,0 +1,11 @@ +--- qgis-1.4.0/cmake/FindGRASS.cmake 2009-11-28 17:02:15.000000000 +0100 ++++ qgis-1.4.0-grass/cmake/FindGRASS.cmake 2010-06-09 00:45:47.444614774 +0200 +@@ -12,7 +12,7 @@ + MARK_AS_ADVANCED ( GRASS_LIBRARY_${LIB} ) + + SET(LIB_PATH NOTFOUND) +- FIND_LIBRARY(LIB_PATH NAMES grass_${LIB} PATHS ${G_PREFIX}/lib NO_DEFAULT_PATH) ++ FIND_LIBRARY(LIB_PATH NAMES grass_${LIB} PATHS ${G_PREFIX}/lib) + + IF (LIB_PATH) + SET (GRASS_LIBRARY_${LIB} ${LIB_PATH}) diff --git a/qgis-1.4.0-qt47.patch b/qgis-1.4.0-qt47.patch new file mode 100644 index 0000000..22e9d96 --- /dev/null +++ b/qgis-1.4.0-qt47.patch @@ -0,0 +1,149 @@ +diff -uNr qgis-1.4.0/src/core/qgscoordinatereferencesystem.cpp qgis-1.4.0-qt47/src/core/qgscoordinatereferencesystem.cpp +--- qgis-1.4.0/src/core/qgscoordinatereferencesystem.cpp 2010-07-08 02:11:17.653725525 +0200 ++++ qgis-1.4.0-qt47/src/core/qgscoordinatereferencesystem.cpp 2010-07-08 02:57:33.313600187 +0200 +@@ -47,7 +47,7 @@ + QgsCoordinateReferenceSystem::QgsCoordinateReferenceSystem() + : mMapUnits( QGis::UnknownUnit ), + mIsValidFlag( 0 ), +- mValidationHint( 0 ) ++ mValidationHint() + { + mCRS = OSRNewSpatialReference( NULL ); + } +@@ -55,7 +55,7 @@ + QgsCoordinateReferenceSystem::QgsCoordinateReferenceSystem( QString theWkt ) + : mMapUnits( QGis::UnknownUnit ), + mIsValidFlag( 0 ), +- mValidationHint( 0 ) ++ mValidationHint() + { + mCRS = OSRNewSpatialReference( NULL ); + createFromWkt( theWkt ); +@@ -65,7 +65,7 @@ + QgsCoordinateReferenceSystem::QgsCoordinateReferenceSystem( const long theId, CrsType theType ) + : mMapUnits( QGis::UnknownUnit ), + mIsValidFlag( 0 ), +- mValidationHint( 0 ) ++ mValidationHint() + { + mCRS = OSRNewSpatialReference( NULL ); + createFromId( theId, theType ); +diff -uNr qgis-1.4.0/src/core/qgshttptransaction.cpp qgis-1.4.0-qt47/src/core/qgshttptransaction.cpp +--- qgis-1.4.0/src/core/qgshttptransaction.cpp 2010-07-08 02:11:17.634633912 +0200 ++++ qgis-1.4.0-qt47/src/core/qgshttptransaction.cpp 2010-07-08 02:08:03.768600629 +0200 +@@ -45,10 +45,10 @@ + QNetworkProxy::ProxyType proxyType, + QString userName, + QString password ) +- : httpresponsecontenttype( 0 ), ++ : httpresponsecontenttype(), + httpurl( uri ), + httphost( proxyHost ), +- mError( 0 ) ++ mError() + { + QSettings s; + mNetworkTimeoutMsec = s.value( "/qgis/networkAndProxy/networkTimeout", "20000" ).toInt(); +diff -uNr qgis-1.4.0/src/core/qgsmessageoutput.cpp qgis-1.4.0-qt47/src/core/qgsmessageoutput.cpp +--- qgis-1.4.0/src/core/qgsmessageoutput.cpp 2010-07-08 02:11:17.628600247 +0200 ++++ qgis-1.4.0-qt47/src/core/qgsmessageoutput.cpp 2010-07-08 02:08:40.298600356 +0200 +@@ -44,7 +44,7 @@ + // QgsMessageOutputConsole + + QgsMessageOutputConsole::QgsMessageOutputConsole() +- : mMessage( NULL ) ++ : mMessage() + { + } + +diff -uNr qgis-1.4.0/src/core/qgsvectorlayer.h qgis-1.4.0-qt47/src/core/qgsvectorlayer.h +--- qgis-1.4.0/src/core/qgsvectorlayer.h 2010-07-08 02:11:17.615600358 +0200 ++++ qgis-1.4.0-qt47/src/core/qgsvectorlayer.h 2010-07-08 02:22:35.046600640 +0200 +@@ -91,8 +91,8 @@ + }; + + /** Constructor */ +- QgsVectorLayer( QString path = 0, QString baseName = 0, +- QString providerLib = 0, bool loadDefaultStyleFlag = true ); ++ QgsVectorLayer( QString path = QString(), QString baseName = QString(), ++ QString providerLib = QString(), bool loadDefaultStyleFlag = true ); + + /** Destructor */ + virtual ~QgsVectorLayer(); +@@ -107,7 +107,7 @@ + QString dataComment() const; + + /** Set the primary display field to be used in the identify results dialog */ +- void setDisplayField( QString fldName = 0 ); ++ void setDisplayField( QString fldName = QString() ); + + /** Returns the primary display field name used in the identify results dialog */ + const QString displayField() const; +diff -uNr qgis-1.4.0/src/plugins/grass/qgsgrassmapcalc.h qgis-1.4.0-qt47/src/plugins/grass/qgsgrassmapcalc.h +--- qgis-1.4.0/src/plugins/grass/qgsgrassmapcalc.h 2010-07-08 02:11:18.125600853 +0200 ++++ qgis-1.4.0-qt47/src/plugins/grass/qgsgrassmapcalc.h 2010-07-09 12:34:31.686962175 +0200 +@@ -219,8 +219,8 @@ + + QgsGrassMapcalcFunction() {}; + QgsGrassMapcalcFunction( int type, QString name, int count = 2, +- QString description = 0, QString label = 0, +- QString labels = 0, bool drawLabel = true ); ++ QString description = QString(), QString label = QString(), ++ QString labels = QString(), bool drawLabel = true ); + ~QgsGrassMapcalcFunction() {}; + + QString name() { return mName; } +@@ -331,7 +331,7 @@ + ~QgsGrassMapcalcObject(); + + // Set map name, constant value or function/operator +- void setValue( QString val, QString lab = 0 ); ++ void setValue( QString val, QString lab = QString() ); + + // Set function + void setFunction( QgsGrassMapcalcFunction f ); +diff -uNr qgis-1.4.0/src/plugins/grass/qgsgrassmodule.cpp qgis-1.4.0-qt47/src/plugins/grass/qgsgrassmodule.cpp +--- qgis-1.4.0/src/plugins/grass/qgsgrassmodule.cpp 2010-07-08 02:11:17.914600309 +0200 ++++ qgis-1.4.0-qt47/src/plugins/grass/qgsgrassmodule.cpp 2010-07-09 13:27:12.574961370 +0200 +@@ -1946,7 +1946,7 @@ + QWidget * parent ) + : QgsGrassModuleGroupBoxItem( module, key, qdesc, gdesc, gnode, parent ), + mModuleStandardOptions( options ), +- mGeometryTypeOption( 0 ), mVectorLayerOption( 0 ), ++ mGeometryTypeOption( QString() ), mVectorLayerOption( QString() ), + mRegionButton( 0 ), mUpdate( false ), mRequired( false ) + { + QgsDebugMsg( "called." ); +@@ -2581,7 +2581,7 @@ + QgsGrassModule *module, int type, QString key, QDomElement &qdesc, + QDomElement &gdesc, QDomNode &gnode, QWidget * parent ) + : QgsGrassModuleGroupBoxItem( module, key, qdesc, gdesc, gnode, parent ), +- mType( type ), mOgrLayerOption( 0 ), mOgrWhereOption( 0 ) ++ mType( type ), mOgrLayerOption( QString() ), mOgrWhereOption( QString() ) + { + if ( mTitle.isEmpty() ) + { +diff -uNr qgis-1.4.0/src/providers/wms/qgswmsprovider.cpp qgis-1.4.0-qt47/src/providers/wms/qgswmsprovider.cpp +--- qgis-1.4.0/src/providers/wms/qgswmsprovider.cpp 2010-07-08 02:11:18.200725039 +0200 ++++ qgis-1.4.0-qt47/src/providers/wms/qgswmsprovider.cpp 2010-07-09 02:13:01.258782364 +0200 +@@ -60,7 +60,7 @@ + cachedPixelHeight( 0 ), + mCoordinateTransform( 0 ), + extentDirty( TRUE ), +- mGetFeatureInfoUrlBase( 0 ), ++ mGetFeatureInfoUrlBase(), + mLayerCount( -1 ) + + { +diff -uNr qgis-1.4.0/src/providers/wms/qgswmsprovider.h qgis-1.4.0-qt47/src/providers/wms/qgswmsprovider.h +--- qgis-1.4.0/src/providers/wms/qgswmsprovider.h 2010-07-08 02:11:18.200725039 +0200 ++++ qgis-1.4.0-qt47/src/providers/wms/qgswmsprovider.h 2010-07-08 10:49:46.516564676 +0200 +@@ -341,7 +341,7 @@ + * otherwise we contact the host directly. + * + */ +- QgsWmsProvider( QString const & uri = 0 ); ++ QgsWmsProvider( QString const & uri = QString() ); + + //! Destructor + virtual ~QgsWmsProvider(); diff --git a/qgis-1.4.0-savebutton.patch b/qgis-1.4.0-savebutton.patch new file mode 100644 index 0000000..fa136ea --- /dev/null +++ b/qgis-1.4.0-savebutton.patch @@ -0,0 +1,1687 @@ +Index: /trunk/qgis/python/core/symbology-ng-core.sip +=================================================================== +--- qgis-1.4.0/python/core/symbology-ng-core.sip (revision 13416) ++++ /trunk/qgis/python/core/symbology-ng-core.sip (revision 13501) +@@ -490,6 +490,5 @@ + void setRenderHints( int hints ); + +- // Colour used for selections +- ++ // Color used for selections + static QColor selectionColor(); + +Index: /trunk/qgis/src/app/legend/qgslegendlayer.cpp +=================================================================== +--- qgis-1.4.0/src/app/legend/qgslegendlayer.cpp (revision 13460) ++++ /trunk/qgis/src/app/legend/qgslegendlayer.cpp (revision 13501) +@@ -34,8 +34,4 @@ + #include "qgsvectorlayer.h" + #include "qgsvectordataprovider.h" +-#include "qgsvectorfilewriter.h" +-#include "qgsgenericprojectionselector.h" +-#include "qgsattributetabledialog.h" +-#include "ogr/qgsvectorlayersaveasdialog.h" + + #include "qgsrendererv2.h" +@@ -172,4 +168,6 @@ + rasterLayerSymbology( rlayer ); // get and change symbology + } ++ ++ updateIcon(); + } + +@@ -303,6 +301,4 @@ + + changeSymbologySettings( layer, itemList ); +- +- updateIcon(); + } + +@@ -381,8 +377,8 @@ + } + +-void QgsLegendLayer::addToPopupMenu( QMenu& theMenu, QAction* toggleEditingAction ) +-{ +- +- QgsMapLayer* lyr = layer(); ++void QgsLegendLayer::addToPopupMenu( QMenu& theMenu ) ++{ ++ QgsMapLayer *lyr = layer(); ++ QAction *toggleEditingAction = QgisApp::instance()->actionToggleEditing(); + + // zoom to layer extent +@@ -402,6 +398,5 @@ + + // remove from canvas +- theMenu.addAction( QgisApp::getThemeIcon( "/mActionRemove.png" ), +- tr( "&Remove" ), legend(), SLOT( removeCurrentLayer() ) ); ++ theMenu.addAction( QgisApp::getThemeIcon( "/mActionRemove.png" ), tr( "&Remove" ), QgisApp::instance(), SLOT( removeLayer() ) ); + + theMenu.addSeparator(); +@@ -412,5 +407,6 @@ + + // attribute table +- theMenu.addAction( tr( "&Open attribute table" ), this, SLOT( table() ) ); ++ theMenu.addAction( tr( "&Open attribute table" ), ++ QgisApp::instance(), SLOT( attributeTable() ) ); + + // allow editing +@@ -426,12 +422,14 @@ + + // save as vector file +- theMenu.addAction( tr( "Save as..." ), this, SLOT( saveAsVectorFile() ) ); ++ theMenu.addAction( tr( "Save as..." ), QgisApp::instance(), SLOT( saveAsVectorFile() ) ); + + // save selection as vector file +- QAction* saveSelectionAsAction = theMenu.addAction( tr( "Save selection as..." ), this, SLOT( saveSelectionAsVectorFile() ) ); ++ QAction* saveSelectionAsAction = theMenu.addAction( tr( "Save selection as..." ), QgisApp::instance(), SLOT( saveSelectionAsVectorFile() ) ); + if ( vlayer->selectedFeatureCount() == 0 ) + { + saveSelectionAsAction->setEnabled( false ); + } ++ ++ theMenu.addAction( tr( "&Subset" ), QgisApp::instance(), SLOT( layerSubsetString() ) ); + + theMenu.addSeparator(); +@@ -440,24 +438,5 @@ + // properties goes on bottom of menu for consistency with normal ui standards + // e.g. kde stuff +- theMenu.addAction( tr( "&Properties" ), legend(), SLOT( legendLayerShowProperties() ) ); +- +-} +- +-void QgsLegendLayer::table() +-{ +- QgsVectorLayer * myLayer = qobject_cast( mLyr.layer() ); +- QgsAttributeTableDialog *mDialog = new QgsAttributeTableDialog( myLayer ); +- mDialog->show(); +- // the dialog will be deleted by itself on close +-} +- +-void QgsLegendLayer::saveAsVectorFile() +-{ +- saveAsVectorFileGeneral( false ); +-} +- +-void QgsLegendLayer::saveSelectionAsVectorFile() +-{ +- saveAsVectorFileGeneral( true ); ++ theMenu.addAction( tr( "&Properties" ), QgisApp::instance(), SLOT( layerProperties() ) ); + } + +@@ -492,82 +471,4 @@ + legend()->updateMapCanvasLayerSet(); + legend()->updateOverview(); +-} +- +-void QgsLegendLayer::saveAsVectorFileGeneral( bool saveOnlySelection ) +-{ +- QgsCoordinateReferenceSystem destCRS; +- +- if ( mLyr.layer()->type() != QgsMapLayer::VectorLayer ) +- return; +- +- QgsVectorLayer* vlayer = qobject_cast( mLyr.layer() ); +- +- QgsVectorLayerSaveAsDialog *dialog = new QgsVectorLayerSaveAsDialog( QgisApp::instance() ); +- +- if ( dialog->exec() == QDialog::Accepted ) +- { +- QString encoding = dialog->encoding(); +- QString vectorFilename = dialog->filename(); +- QString format = dialog->format(); +- +- if ( dialog->crs() < 0 ) +- { +- // Find out if we have projections enabled or not +- if ( QgisApp::instance()->mapCanvas()->mapRenderer()->hasCrsTransformEnabled() ) +- { +- destCRS = QgisApp::instance()->mapCanvas()->mapRenderer()->destinationSrs(); +- } +- else +- { +- destCRS = vlayer->srs(); +- } +- } +- else +- { +- destCRS = QgsCoordinateReferenceSystem( dialog->crs(), QgsCoordinateReferenceSystem::InternalCrsId ); +- } +- +- // overwrite the file - user will already have been prompted +- // to verify they want to overwrite by the file dialog above +- // might not even exists in the given case. +- // add the extension if not present +- if ( format == "ESRI Shapefile" ) +- { +- if ( !vectorFilename.endsWith( ".shp", Qt::CaseInsensitive ) ) +- { +- vectorFilename += ".shp"; +- } +- QgsVectorFileWriter::deleteShapeFile( vectorFilename ); +- } +- +- //GE does not open files without extensions. Therefore we append it automatically for kml files +- if ( format == "KML" ) +- { +- if ( !vectorFilename.endsWith( ".kml", Qt::CaseInsensitive ) ) +- { +- vectorFilename += ".kml"; +- } +- } +- +- // ok if the file existed it should be deleted now so we can continue... +- QApplication::setOverrideCursor( Qt::WaitCursor ); +- +- QgsVectorFileWriter::WriterError error; +- QString errorMessage; +- error = QgsVectorFileWriter::writeAsVectorFormat( vlayer, vectorFilename, encoding, &destCRS, format, saveOnlySelection, &errorMessage ); +- +- QApplication::restoreOverrideCursor(); +- +- if ( error == QgsVectorFileWriter::NoError ) +- { +- QMessageBox::information( 0, tr( "Saving done" ), tr( "Export to vector file has been completed" ) ); +- } +- else +- { +- QMessageBox::warning( 0, tr( "Save error" ), tr( "Export to vector file failed.\nError: %1" ).arg( errorMessage ) ); +- } +- } +- +- delete dialog; + } + +@@ -589,5 +490,4 @@ + } + +- + QgsMapCanvasLayer& QgsLegendLayer::canvasLayer() + { +@@ -600,3 +500,2 @@ + setText( 0, name ); + } +- +Index: /trunk/qgis/src/app/legend/qgslegend.cpp +=================================================================== +--- qgis-1.4.0/src/app/legend/qgslegend.cpp (revision 13476) ++++ /trunk/qgis/src/app/legend/qgslegend.cpp (revision 13501) +@@ -33,10 +33,5 @@ + #include "qgsproject.h" + #include "qgsrasterlayer.h" +-#include "qgsrasterlayerproperties.h" +-#include "qgsvectorlayerproperties.h" +- +-#include "qgsattributetabledialog.h" +- +-#include ++#include "qgsvectorlayer.h" + + #include +@@ -58,12 +53,13 @@ + set mItemBeingMoved pointer to 0 to prevent SuSE 9.0 crash + */ +-QgsLegend::QgsLegend( QWidget * parent, const char *name ) ++QgsLegend::QgsLegend( QgsMapCanvas *canvas, QWidget * parent, const char *name ) + : QTreeWidget( parent ), + mMousePressedFlag( false ), + mItemBeingMoved( 0 ), +- mToggleEditingAction( 0 ), +- mMapCanvas( 0 ), ++ mMapCanvas( canvas ), + mMinimumIconSize( 20, 20 ) + { ++ setObjectName( name ); ++ + connect( this, SIGNAL( itemChanged( QTreeWidgetItem*, int ) ), + this, SLOT( handleItemChange( QTreeWidgetItem*, int ) ) ); +@@ -77,4 +73,15 @@ + connect( QgsProject::instance(), SIGNAL( writeProject( QDomDocument & ) ), + this, SLOT( writeProject( QDomDocument & ) ) ); ++ ++ // connect map layer registry signal to legend ++ connect( QgsMapLayerRegistry::instance(), SIGNAL( layerWillBeRemoved( QString ) ), ++ this, SLOT( removeLayer( QString ) ) ); ++ connect( QgsMapLayerRegistry::instance(), SIGNAL( removedAll() ), ++ this, SLOT( removeAll() ) ); ++ connect( QgsMapLayerRegistry::instance(), SIGNAL( layerWasAdded( QgsMapLayer* ) ), ++ this, SLOT( addLayer( QgsMapLayer * ) ) ); ++ ++ connect( mMapCanvas, SIGNAL( layersChanged() ), ++ this, SLOT( refreshCheckStates() ) ); + + // Initialise the line indicator widget. +@@ -175,11 +182,6 @@ + } + +-void QgsLegend::removeLayer( QString layer_key ) +-{ +- if ( !mMapCanvas || mMapCanvas->isDrawing() ) +- { +- return; +- } +- ++void QgsLegend::removeLayer( QString layerId ) ++{ + QgsDebugMsg( "called." ); + +@@ -192,9 +194,8 @@ + QgsLegendLayer* ll = qobject_cast( li ); + +- if ( ll && ll->layer() && ll->layer()->getLayerID() == layer_key ) ++ if ( ll && ll->layer() && ll->layer()->getLayerID() == layerId ) + { + removeItem( ll ); + delete ll; +- + break; + } +@@ -423,9 +424,5 @@ + void QgsLegend::mouseDoubleClickEvent( QMouseEvent* e ) + { +- if ( !mMapCanvas || mMapCanvas->isDrawing() ) +- { +- return; +- } +- legendLayerShowProperties(); ++ QgisApp::instance()->layerProperties(); + } + +@@ -445,5 +442,5 @@ + if ( li->type() == QgsLegendItem::LEGEND_LAYER ) + { +- ( static_cast( li ) )->addToPopupMenu( theMenu, mToggleEditingAction ); ++ qobject_cast( li )->addToPopupMenu( theMenu ); + + if ( li->parent() ) +@@ -566,15 +563,4 @@ + } + +-void QgsLegend::setMapCanvas( QgsMapCanvas * canvas ) +-{ +- if ( mMapCanvas ) +- { +- disconnect( mMapCanvas, SIGNAL( layersChanged() ) ); +- } +- +- mMapCanvas = canvas; +- connect( mMapCanvas, SIGNAL( layersChanged() ), this, SLOT( refreshCheckStates() ) ); +-} +- + QgsLegendLayer* QgsLegend::currentLegendLayer() + { +@@ -647,80 +633,12 @@ + while ( child ) + { +- setCurrentItem( child ); +- removeCurrentLayer(); ++ QgsLegendLayer* ll = dynamic_cast( child ); ++ if ( ll ) ++ QgsMapLayerRegistry::instance()->removeMapLayer( ll->layer()->getLayerID() ); + child = lg->child( 0 ); + } + delete lg; ++ + adjustIconSize(); +-} +- +-void QgsLegend::removeCurrentLayer() +-{ +- if ( !mMapCanvas || mMapCanvas->isDrawing() ) +- { +- return; +- } +- +- //if the current item is a legend layer: remove all layers of the current legendLayer +- QgsLegendLayer* ll = dynamic_cast( currentItem() ); +- if ( !ll ) +- return; +- +- removeLayer( ll->layer(), true ); +- +- adjustIconSize(); +-} +- +-bool QgsLegend::removeLayer( QgsMapLayer* ml, bool askCancelOnEditable ) +-{ +- if ( !ml ) +- { +- return false; +- } +- +- QgsVectorLayer* vl = qobject_cast( ml ); +- if ( vl ) +- { +- //is layer editable and changed? +- if ( vl->isEditable() && vl->isModified() ) +- { +- QMessageBox::StandardButton commit; +- if ( askCancelOnEditable ) +- { +- commit = QMessageBox::information( this, +- tr( "Stop editing" ), +- tr( "Do you want to save the changes to layer %1?" ).arg( vl->name() ), +- QMessageBox::Save | QMessageBox::Discard | QMessageBox::Cancel ); +- if ( commit == QMessageBox::Cancel ) +- { +- return false; +- } +- } +- else +- { +- commit = QMessageBox::information( this, +- tr( "Stop editing" ), +- tr( "Do you want to save the changes to layer %1?" ).arg( vl->name() ), +- QMessageBox::Save | QMessageBox::Discard ); +- } +- +- if ( commit == QMessageBox::Save ) +- { +- if ( !vl->commitChanges() ) +- { +- return false; +- } +- } +- else if ( commit == QMessageBox::Discard ) +- { +- if ( !vl->rollBack() ) +- { +- return false; +- } +- } +- } +- } +- QgsMapLayerRegistry::instance()->removeMapLayer( ml->getLayerID() ); +- return true; + } + +@@ -739,33 +657,4 @@ + + insertItem( layer, group ); +-} +- +-void QgsLegend::legendLayerShowProperties() +-{ +- if ( !mMapCanvas || mMapCanvas->isDrawing() ) +- { +- return; +- } +- +- QgsLegendItem* li = dynamic_cast( currentItem() ); +- +- if ( !li ) +- { +- return; +- } +- +- if ( li->type() != QgsLegendItem::LEGEND_LAYER ) +- return; +- +- QgsLegendLayer* ll = qobject_cast( li ); +- if ( !ll ) +- return; +- +- //QgsDebugMsg("Showing layer properties dialog"); +- +- QgisApp::instance()->showLayerProperties( ll->layer() ); +- +- ll->updateIcon(); +- + } + +@@ -1733,33 +1622,4 @@ + } + +-void QgsLegend::legendLayerAttributeTable() +-{ +- if ( !mMapCanvas || mMapCanvas->isDrawing() ) +- { +- return; +- } +- +- QgsVectorLayer *vlayer = 0; +- +- // try whether it's a legend layer +- QgsLegendLayer* ll = dynamic_cast( currentItem() ); +- if ( !ll ) +- { +- // nothing selected +- QMessageBox::information( this, +- tr( "No Layer Selected" ), +- tr( "To open an attribute table, you must select a vector layer in the legend" ) ); +- return; +- } +- +- vlayer = qobject_cast( ll->layer() ); +- if ( vlayer ) +- { +- QgsAttributeTableDialog *mDialog = new QgsAttributeTableDialog( vlayer ); +- mDialog->show(); +- // the dialog will be deleted by itself on close +- } +-} +- + void QgsLegend::readProject( const QDomDocument & doc ) + { +Index: /trunk/qgis/src/app/legend/qgslegendlayer.h +=================================================================== +--- qgis-1.4.0/src/app/legend/qgslegendlayer.h (revision 13380) ++++ /trunk/qgis/src/app/legend/qgslegendlayer.h (revision 13501) +@@ -62,5 +62,5 @@ + + /** called to add appropriate menu items to legend's popup menu */ +- void addToPopupMenu( QMenu& theMenu, QAction* toggleEditingAction ); ++ void addToPopupMenu( QMenu& theMenu ); + + /** Set layer to be visible in canvas */ +@@ -81,10 +81,4 @@ + /**Toggle show in overview*/ + void showInOverview(); +- +- /**Show layer attribute table*/ +- void table(); +- +- void saveAsVectorFile(); +- void saveSelectionAsVectorFile(); + + /**update the layer's icon to show whether is in editing mode or in overview */ +@@ -109,6 +103,4 @@ + QPixmap getOriginalPixmap(); + +- void saveAsVectorFileGeneral( bool saveOnlySelection ); +- + private: + /** Helper method to make the font bold from all ctors. +Index: /trunk/qgis/src/app/legend/qgslegend.h +=================================================================== +--- qgis-1.4.0/src/app/legend/qgslegend.h (revision 13476) ++++ /trunk/qgis/src/app/legend/qgslegend.h (revision 13501) +@@ -97,5 +97,5 @@ + * @param theName An optional name for the widget + */ +- QgsLegend( QWidget * parent = 0, const char *name = 0 ); ++ QgsLegend( QgsMapCanvas *canvas, QWidget * parent = 0, const char *name = 0 ); + + //! Destructor +@@ -182,7 +182,4 @@ + void removePixmapHeightValue( int height ); + +- /**Sets the toggle editing action. Usually called from QgisApp*/ +- void setToggleEditingAction( QAction* editingAction ) {mToggleEditingAction = editingAction;} +- + /**Returns structure with legend pixmaps*/ + QgsLegendPixmaps& pixmaps() { return mPixmaps; } +@@ -200,6 +197,4 @@ + + void setLayerVisible( QgsMapLayer * layer, bool visible ); +- +- void setMapCanvas( QgsMapCanvas * canvas ); + + /**Updates symbology items for a layer*/ +@@ -244,14 +239,4 @@ + void writeProject( QDomDocument & ); + +- /**Removes the current LegendLayer*/ +- void removeCurrentLayer(); +- +- /**Removes a layer. If the layer is editable, a dialog is shown where user can select 'save', 'discard' and optionally 'cancel'. Cancel +- is useful if a single layer is removed whereas on closing of the whole project or application, the cancel option may not be possible +- @param ml the maplayer to remove +- @param askCancelOnEditable gibe cancel option in the dialog for editable (and changed) layers +- @param return false if canceled or in case of error, true else*/ +- bool removeLayer( QgsMapLayer* ml, bool askCancelOnEditable ); +- + /*! + * Moves a layer to a group. +@@ -272,10 +257,4 @@ + Only works on raster layers*/ + void legendLayerZoomNative(); +- +- /**Show attribute table*/ +- void legendLayerAttributeTable(); +- +- /**Shows the property dialog of the first legend layer file in a legend layer*/ +- void legendLayerShowProperties(); + + /**Updates check states when the map canvas layer set is changed */ +@@ -441,7 +420,4 @@ + std::deque mLayersPriorToMove; + +- /**Action for the legendlayer right click menu*/ +- QAction* mToggleEditingAction; +- + /*! + * A function to determine how far down in the list an item is (starting with one for the first Item). +Index: /trunk/qgis/src/app/qgsattributedialog.cpp +=================================================================== +--- qgis-1.4.0/src/app/qgsattributedialog.cpp (revision 13339) ++++ /trunk/qgis/src/app/qgsattributedialog.cpp (revision 13501) +@@ -206,5 +206,4 @@ + + connect( buttonBox, SIGNAL( rejected() ), mDialog, SLOT( reject() ) ); +- connect( buttonBox, SIGNAL( rejected() ), this, SLOT( reject() ) ); + } + +Index: /trunk/qgis/src/app/qgsmeasuredialog.cpp +=================================================================== +--- qgis-1.4.0/src/app/qgsmeasuredialog.cpp (revision 12178) ++++ /trunk/qgis/src/app/qgsmeasuredialog.cpp (revision 13501) +@@ -77,5 +77,5 @@ + { + addPoint( point ); +- this->show(); ++ show(); + } + raise(); +Index: /trunk/qgis/src/app/qgsattributedialog.h +=================================================================== +--- qgis-1.4.0/src/app/qgsattributedialog.h (revision 12806) ++++ /trunk/qgis/src/app/qgsattributedialog.h (revision 13501) +@@ -52,7 +52,4 @@ + + public slots: +- /** Overloaded accept method which will write the feature field +- * values, then delegate to QDialog::accept() +- */ + void accept(); + +Index: /trunk/qgis/src/app/qgsundowidget.cpp +=================================================================== +--- qgis-1.4.0/src/app/qgsundowidget.cpp (revision 11756) ++++ /trunk/qgis/src/app/qgsundowidget.cpp (revision 13501) +@@ -3,4 +3,5 @@ + #include "qgsmaplayer.h" + #include "qgsmapcanvas.h" ++#include "qgslegend.h" + + #include "qgisapp.h" +@@ -11,9 +12,10 @@ + setupUi( this ); + setWidget( dockWidgetContents ); +- connect( this->undoButton, SIGNAL( clicked() ), +- this, SLOT( undo( ) ) ); + +- connect( this->redoButton, SIGNAL( clicked() ), +- this, SLOT( redo( ) ) ); ++ connect( undoButton, SIGNAL( clicked() ), this, SLOT( undo( ) ) ); ++ connect( redoButton, SIGNAL( clicked() ), this, SLOT( redo( ) ) ); ++ connect( QgisApp::instance()->legend(), SIGNAL( currentLayerChanged( QgsMapLayer* ) ), ++ this, SLOT( layerChanged( QgsMapLayer* ) ) ); ++ + undoButton->setDisabled( true ); + redoButton->setDisabled( true ); +@@ -100,6 +102,6 @@ + gridLayout->addWidget( mUndoView, 0, 0, 1, 2 ); + setWidget( dockWidgetContents ); +- connect( this->mUndoStack, SIGNAL( canUndoChanged( bool ) ), this, SLOT( undoChanged( bool ) ) ); +- connect( this->mUndoStack, SIGNAL( canRedoChanged( bool ) ), this, SLOT( redoChanged( bool ) ) ); ++ connect( mUndoStack, SIGNAL( canUndoChanged( bool ) ), this, SLOT( undoChanged( bool ) ) ); ++ connect( mUndoStack, SIGNAL( canRedoChanged( bool ) ), this, SLOT( redoChanged( bool ) ) ); + + // indexChanged() triggers a refresh. but it gets triggered also when a new action +@@ -107,8 +109,8 @@ + // vector layer: it causes potentially multiple refreshes when moving more commands + // back, but avoids double refresh in common case when adding commands to the stack +- //connect(this->mUndoStack, SIGNAL(indexChanged(int)), this, SLOT(indexChanged(int))); ++ //connect(mUndoStack, SIGNAL(indexChanged(int)), this, SLOT(indexChanged(int))); + +- this->undoButton->setDisabled( !mUndoStack->canUndo() ); +- this->redoButton->setDisabled( !mUndoStack->canRedo() ); ++ undoButton->setDisabled( !mUndoStack->canUndo() ); ++ redoButton->setDisabled( !mUndoStack->canRedo() ); + } + +Index: /trunk/qgis/src/app/qgsmaptoolnodetool.cpp +=================================================================== +--- qgis-1.4.0/src/app/qgsmaptoolnodetool.cpp (revision 13380) ++++ /trunk/qgis/src/app/qgsmaptoolnodetool.cpp (revision 13501) +@@ -27,4 +27,5 @@ + #include "qgslogger.h" + #include "qgisapp.h" ++#include "qgslegend.h" + + #include +@@ -70,4 +71,7 @@ + //signal changing of coordinate renderer changed to repaint markers + connect( canvas->mapRenderer(), SIGNAL( hasCrsTransformEnabled( bool ) ), this, SLOT( coordinatesChanged( ) ) ); ++ //signal changing of current layer ++ connect( QgisApp::instance()->legend(), SIGNAL( currentLayerChanged( QgsMapLayer* ) ), ++ this, SLOT( currentLayerChanged( QgsMapLayer* ) ) ); + } + +Index: /trunk/qgis/src/app/qgisapp.h +=================================================================== +--- qgis-1.4.0/src/app/qgisapp.h (revision 13476) ++++ /trunk/qgis/src/app/qgisapp.h (revision 13501) +@@ -154,8 +154,5 @@ + void saveMapAsImage( QString, QPixmap * ); + /** Get the mapcanvas object from the app */ +- QgsMapCanvas * mapCanvas() { return mMapCanvas; }; +- +- //! returns pointer to map legend +- QgsLegend *legend() { return mMapLegend; } ++ QgsMapCanvas * mapCanvas(); + + //! Set theme (icons) +@@ -275,4 +272,5 @@ + QAction *actionOpenTable() { return mActionOpenTable; } + QAction *actionToggleEditing() { return mActionToggleEditing; } ++ QAction *actionSaveEdits() { return mActionSaveEdits; } + QAction *actionLayerSaveAs() { return mActionLayerSaveAs; } + QAction *actionLayerSelectionSaveAs() { return mActionLayerSelectionSaveAs; } +@@ -283,4 +281,5 @@ + #endif + QAction *actionLayerProperties() { return mActionLayerProperties; } ++ QAction *actionLayerSubsetString() { return mActionLayerSubsetString; } + QAction *actionLayerSeparator2() { return mActionLayerSeparator2; } + QAction *actionAddToOverview() { return mActionAddToOverview; } +@@ -357,4 +356,7 @@ + void showLayerProperties( QgsMapLayer *ml ); + ++ //! returns pointer to map legend ++ QgsLegend *legend(); ++ + public slots: + //! Zoom to full extent +@@ -367,4 +369,7 @@ + void zoomToSelected(); + ++ //! open the properties dialog for the currently selected layer ++ void layerProperties(); ++ + //! mark project dirty + void markDirty(); +@@ -372,4 +377,7 @@ + //! layer was added + void layerWasAdded( QgsMapLayer * ); ++ ++ //! layer will be removed ++ void removingLayer( QString ); + + void updateUndoActions(); +@@ -594,4 +602,10 @@ + void toggleEditing(); + ++ //! save current edits and start new transaction ++ void saveEdits(); ++ ++ //! change layer subset of current vector layer ++ void layerSubsetString(); ++ + //! map tool changed + void mapToolChanged( QgsMapTool *tool ); +@@ -600,4 +614,6 @@ + Is called from the legend when the current legend item has changed*/ + void activateDeactivateLayerRelatedActions( QgsMapLayer* layer ); ++ ++ void selectionChanged( QgsMapLayer *layer ); + + void showProgress( int theProgress, int theTotalSteps ); +@@ -639,12 +655,9 @@ + + //! starts/stops editing mode of a layer +- void toggleEditing( QgsMapLayer *layer ); ++ bool toggleEditing( QgsMapLayer *layer, bool allowCancel = true ); + + //! save current vector layer + void saveAsVectorFile(); + void saveSelectionAsVectorFile(); +- +- //! open the properties dialog for the currently selected layer +- void layerProperties(); + + //! show python console +@@ -757,4 +770,6 @@ + bool loadComposersFromProject( const QString& projectFilePath ); + ++ void saveAsVectorFileGeneral( bool saveOnlySelection ); ++ + /**Returns all annotation items in the canvas*/ + QList annotationItems(); +@@ -777,7 +792,7 @@ + void createStatusBar(); + void setupConnections(); +- void createLegend(); ++ void initLegend(); + void createOverview(); +- void createCanvas(); ++ void createCanvasTools(); + bool createDB(); + void createMapTips(); +@@ -875,4 +890,5 @@ + QAction *mActionOpenTable; + QAction *mActionToggleEditing; ++ QAction *mActionSaveEdits; + QAction *mActionLayerSaveAs; + QAction *mActionLayerSelectionSaveAs; +@@ -883,4 +899,5 @@ + #endif + QAction *mActionLayerProperties; ++ QAction *mActionLayerSubsetString; + QAction *mActionLayerSeparator2; + QAction *mActionAddToOverview; +Index: /trunk/qgis/src/app/qgisapp.cpp +=================================================================== +--- qgis-1.4.0/src/app/qgisapp.cpp (revision 13496) ++++ /trunk/qgis/src/app/qgisapp.cpp (revision 13501) +@@ -153,8 +153,10 @@ + #include "ogr/qgsogrsublayersdialog.h" + #include "ogr/qgsopenvectorlayerdialog.h" ++#include "ogr/qgsvectorlayersaveasdialog.h" + #include "qgsattributetabledialog.h" + #include "qgsvectorfilewriter.h" + #include "qgscredentialdialog.h" + #include "qgstilescalewidget.h" ++#include "qgsquerybuilder.h" + + #ifdef HAVE_QWT +@@ -350,5 +352,4 @@ + QgisApp::instance()->statusBar()->showMessage( QObject::tr( "CRS undefined - defaulting to default CRS" ) ); + } +- + } + +@@ -387,5 +388,4 @@ + createDB(); + +- + mSplash->showMessage( tr( "Reading settings" ), Qt::AlignHCenter | Qt::AlignBottom ); + qApp->processEvents(); +@@ -393,4 +393,19 @@ + mSplash->showMessage( tr( "Setting up the GUI" ), Qt::AlignHCenter | Qt::AlignBottom ); + qApp->processEvents(); ++ ++ // "theMapCanvas" used to find this canonical instance later ++ mMapCanvas = new QgsMapCanvas( this, "theMapCanvas" ); ++ mMapCanvas->setWhatsThis( tr( "Map canvas. This is where raster and vector " ++ "layers are displayed when added to the map" ) ); ++ setCentralWidget( mMapCanvas ); ++ //set the focus to the map canvas ++ mMapCanvas->setFocus(); ++ ++ // "theMapLegend" used to find this canonical instance later ++ mMapLegend = new QgsLegend( mMapCanvas, this, "theMapLegend" ); ++ ++ // create undo widget ++ mUndoWidget = new QgsUndoWidget( NULL, mMapCanvas ); ++ mUndoWidget->setObjectName( "Undo" ); + + createActions(); +@@ -399,7 +414,7 @@ + createToolBars(); + createStatusBar(); +- createCanvas(); ++ createCanvasTools(); + mMapCanvas->freeze(); +- createLegend(); ++ initLegend(); + createOverview(); + createMapTips(); +@@ -407,12 +422,9 @@ + updateRecentProjectPaths(); + ++ addDockWidget( Qt::LeftDockWidgetArea, mUndoWidget ); ++ mUndoWidget->hide(); ++ + mInternalClipboard = new QgsClipboard; // create clipboard + mQgisInterface = new QgisAppInterface( this ); // create the interfce +- +- // create undo widget +- mUndoWidget = new QgsUndoWidget( NULL, mMapCanvas ); +- mUndoWidget->setObjectName( "Undo" ); +- addDockWidget( Qt::LeftDockWidgetArea, mUndoWidget ); +- mUndoWidget->hide(); + + #ifdef Q_WS_MAC +@@ -698,12 +710,12 @@ + shortcuts->registerAction( mActionUndo, tr( "Ctrl+Z" ) ); + mActionUndo->setStatusTip( tr( "Undo the last operation" ) ); ++ connect( mActionUndo, SIGNAL( triggered() ), mUndoWidget, SLOT( undo() ) ); + mActionUndo->setEnabled( false ); +- // action connected to mUndoWidget::undo slot in setupConnections() + + mActionRedo = new QAction( getThemeIcon( "mActionRedo.png" ), tr( "&Redo" ), this ); + shortcuts->registerAction( mActionRedo, tr( "Ctrl+Shift+Z" ) ); + mActionRedo->setStatusTip( tr( "Redo the last operation" ) ); ++ connect( mActionRedo, SIGNAL( triggered() ), mUndoWidget, SLOT( redo() ) ); + mActionRedo->setEnabled( false ); +- // action connected to mUndoWidget::redo slot in setupConnections() + + mActionCutFeatures = new QAction( getThemeIcon( "mActionEditCut.png" ), tr( "Cut Features" ), this ); +@@ -999,4 +1011,10 @@ + connect( mActionToggleEditing, SIGNAL( triggered() ), this, SLOT( toggleEditing() ) ); + mActionToggleEditing->setEnabled( false ); ++ ++ mActionSaveEdits = new QAction( getThemeIcon( "mActionSaveEdits.png" ), tr( "Save edits" ), this ); ++ shortcuts->registerAction( mActionSaveEdits ); ++ mActionSaveEdits->setStatusTip( tr( "Save edits to current layer , but continue editing" ) ); ++ connect( mActionSaveEdits, SIGNAL( triggered() ), this, SLOT( saveEdits() ) ); ++ mActionSaveEdits->setEnabled( false ); + + mActionLayerSaveAs = new QAction( tr( "Save as..." ), this ); +@@ -1037,4 +1055,10 @@ + connect( mActionLayerProperties, SIGNAL( triggered() ), this, SLOT( layerProperties() ) ); + mActionLayerProperties->setEnabled( false ); ++ ++ mActionLayerSubsetString = new QAction( tr( "Subset..." ), this ); ++ shortcuts->registerAction( mActionLayerSubsetString ); ++ mActionLayerProperties->setStatusTip( tr( "Set subset query of the current layer" ) ); ++ connect( mActionLayerSubsetString, SIGNAL( triggered() ), this, SLOT( layerSubsetString() ) ); ++ mActionLayerSubsetString->setEnabled( false ); + + mActionAddToOverview = new QAction( getThemeIcon( "mActionInOverview.png" ), tr( "Add to Overview" ), this ); +@@ -1438,4 +1462,5 @@ + + mLayerMenu->addAction( mActionOpenTable ); ++ mLayerMenu->addAction( mActionSaveEdits ); + mLayerMenu->addAction( mActionToggleEditing ); + mLayerMenu->addAction( mActionLayerSaveAs ); +@@ -1443,4 +1468,5 @@ + mLayerMenu->addAction( mActionRemoveLayer ); + mLayerMenu->addAction( mActionLayerProperties ); ++ mLayerMenu->addAction( mActionLayerSubsetString ); + mActionLayerSeparator2 = mLayerMenu->addSeparator(); + +@@ -1558,4 +1584,5 @@ + mDigitizeToolBar->setObjectName( "Digitizing" ); + mDigitizeToolBar->addAction( mActionToggleEditing ); ++ mDigitizeToolBar->addAction( mActionSaveEdits ); + mDigitizeToolBar->addAction( mActionCapturePoint ); + mDigitizeToolBar->addAction( mActionCaptureLine ); +@@ -1622,16 +1649,16 @@ + mAttributesToolBar->addAction( mActionNewBookmark ); + // Annotation tools +- QToolButton* mAnnotationToolButton = new QToolButton(); +- mAnnotationToolButton->setPopupMode( QToolButton::InstantPopup ); +- mAnnotationToolButton->setAutoRaise( true ); +- mAnnotationToolButton->setToolButtonStyle( Qt::ToolButtonIconOnly ); +- mAnnotationToolButton->setCheckable( true ); +- mAnnotationToolButton->addAction( mActionTextAnnotation ); +- mAnnotationToolButton->addAction( mActionFormAnnotation ); +- mAnnotationToolButton->addAction( mActionAnnotation ); +- mAnnotationToolButton->setDefaultAction( mActionTextAnnotation ); +- QObject::connect( mAnnotationToolButton, SIGNAL( triggered( QAction* ) ), \ +- mAnnotationToolButton, SLOT( setDefaultAction( QAction* ) ) ); +- mAttributesToolBar->addWidget( mAnnotationToolButton ); ++ QToolButton *annotationToolButton = new QToolButton(); ++ annotationToolButton->setPopupMode( QToolButton::InstantPopup ); ++ annotationToolButton->setAutoRaise( true ); ++ annotationToolButton->setToolButtonStyle( Qt::ToolButtonIconOnly ); ++ annotationToolButton->setCheckable( true ); ++ annotationToolButton->addAction( mActionTextAnnotation ); ++ annotationToolButton->addAction( mActionFormAnnotation ); ++ annotationToolButton->addAction( mActionAnnotation ); ++ annotationToolButton->setDefaultAction( mActionTextAnnotation ); ++ connect( annotationToolButton, SIGNAL( triggered( QAction* ) ), ++ annotationToolButton, SLOT( setDefaultAction( QAction* ) ) ); ++ mAttributesToolBar->addWidget( annotationToolButton ); + mToolbarMenu->addAction( mAttributesToolBar->toggleViewAction() ); + // +@@ -1837,4 +1864,5 @@ + mActionDraw->setIcon( getThemeIcon( "/mActionDraw.png" ) ); + mActionToggleEditing->setIcon( getThemeIcon( "/mActionToggleEditing.png" ) ); ++ mActionSaveEdits->setIcon( getThemeIcon( "/mActionSaveEdits.png" ) ); + mActionCutFeatures->setIcon( getThemeIcon( "/mActionEditCut.png" ) ); + mActionCopyFeatures->setIcon( getThemeIcon( "/mActionEditCopy.png" ) ); +@@ -1898,81 +1926,74 @@ + // connect the "cleanup" slot + connect( qApp, SIGNAL( aboutToQuit() ), this, SLOT( saveWindowState() ) ); +- //connect the legend, mapcanvas and overview canvas to the registry +- +- // connect map layer registry signals to legend +- connect( QgsMapLayerRegistry::instance(), SIGNAL( layerWillBeRemoved( QString ) ), +- mMapLegend, SLOT( removeLayer( QString ) ) ); +- connect( QgsMapLayerRegistry::instance(), SIGNAL( removedAll() ), +- mMapLegend, SLOT( removeAll() ) ); +- connect( QgsMapLayerRegistry::instance(), SIGNAL( layerWasAdded( QgsMapLayer* ) ), +- mMapLegend, SLOT( addLayer( QgsMapLayer * ) ) ); +- connect( mMapLegend, SIGNAL( currentLayerChanged( QgsMapLayer* ) ), +- this, SLOT( activateDeactivateLayerRelatedActions( QgsMapLayer* ) ) ); +- connect( mMapLegend, SIGNAL( currentLayerChanged( QgsMapLayer* ) ), +- mUndoWidget, SLOT( layerChanged( QgsMapLayer* ) ) ); +- connect( mMapLegend, SIGNAL( currentLayerChanged( QgsMapLayer* ) ), +- mMapTools.mNodeTool, SLOT( currentLayerChanged( QgsMapLayer* ) ) ); +- +- //signal when mouse moved over window (coords display in status bar) +- connect( mMapCanvas, SIGNAL( xyCoordinates( const QgsPoint & ) ), this, SLOT( showMouseCoordinate( const QgsPoint & ) ) ); +- connect( mMapCanvas->mapRenderer(), SIGNAL( drawingProgress( int, int ) ), this, SLOT( showProgress( int, int ) ) ); +- connect( mMapCanvas->mapRenderer(), SIGNAL( hasCrsTransformEnabled( bool ) ), this, SLOT( hasCrsTransformEnabled( bool ) ) ); +- connect( mMapCanvas->mapRenderer(), SIGNAL( destinationSrsChanged() ), this, SLOT( destinationSrsChanged() ) ); +- connect( mMapCanvas, SIGNAL( extentsChanged() ), this, SLOT( showExtents() ) ); +- connect( mMapCanvas, SIGNAL( scaleChanged( double ) ), this, SLOT( showScale( double ) ) ); +- connect( mMapCanvas, SIGNAL( scaleChanged( double ) ), this, SLOT( updateMouseCoordinatePrecision() ) ); +- connect( mMapCanvas, SIGNAL( mapToolSet( QgsMapTool * ) ), this, SLOT( mapToolChanged( QgsMapTool * ) ) ); ++ ++ // signal when mouse moved over window (coords display in status bar) ++ connect( mMapCanvas, SIGNAL( xyCoordinates( const QgsPoint & ) ), ++ this, SLOT( showMouseCoordinate( const QgsPoint & ) ) ); ++ connect( mMapCanvas, SIGNAL( extentsChanged() ), ++ this, SLOT( showExtents() ) ); ++ connect( mMapCanvas, SIGNAL( scaleChanged( double ) ), ++ this, SLOT( showScale( double ) ) ); ++ connect( mMapCanvas, SIGNAL( scaleChanged( double ) ), ++ this, SLOT( updateMouseCoordinatePrecision() ) ); ++ connect( mMapCanvas, SIGNAL( mapToolSet( QgsMapTool * ) ), ++ this, SLOT( mapToolChanged( QgsMapTool * ) ) ); + connect( mMapCanvas, SIGNAL( selectionChanged( QgsMapLayer * ) ), ++ this, SLOT( selectionChanged( QgsMapLayer * ) ) ); ++ connect( mMapCanvas, SIGNAL( extentsChanged() ), ++ this, SLOT( markDirty() ) ); ++ connect( mMapCanvas, SIGNAL( layersChanged() ), ++ this, SLOT( markDirty() ) ); ++ ++ connect( mMapCanvas, SIGNAL( zoomLastStatusChanged( bool ) ), ++ mActionZoomLast, SLOT( setEnabled( bool ) ) ); ++ connect( mMapCanvas, SIGNAL( zoomNextStatusChanged( bool ) ), ++ mActionZoomNext, SLOT( setEnabled( bool ) ) ); ++ connect( mRenderSuppressionCBox, SIGNAL( toggled( bool ) ), ++ mMapCanvas, SLOT( setRenderFlag( bool ) ) ); ++ ++ // connect renderer ++ connect( mMapCanvas->mapRenderer(), SIGNAL( drawingProgress( int, int ) ), ++ this, SLOT( showProgress( int, int ) ) ); ++ connect( mMapCanvas->mapRenderer(), SIGNAL( hasCrsTransformEnabled( bool ) ), ++ this, SLOT( hasCrsTransformEnabled( bool ) ) ); ++ connect( mMapCanvas->mapRenderer(), SIGNAL( destinationSrsChanged() ), ++ this, SLOT( destinationSrsChanged() ) ); ++ ++ // connect legend signals ++ connect( mMapLegend, SIGNAL( currentLayerChanged( QgsMapLayer * ) ), + this, SLOT( activateDeactivateLayerRelatedActions( QgsMapLayer * ) ) ); +- +- // track of canvas layers and extents and mark project dirty on changes +- connect( mMapCanvas, SIGNAL( extentsChanged() ), this, SLOT( markDirty() ) ); +- connect( mMapCanvas, SIGNAL( layersChanged() ), this, SLOT( markDirty() ) ); +- connect( mMapLegend, SIGNAL( zOrderChanged() ), this, SLOT( markDirty() ) ); +- ++ connect( mMapLegend, SIGNAL( zOrderChanged() ), ++ this, SLOT( markDirty() ) ); ++ ++ // connect map layer registry + connect( QgsMapLayerRegistry::instance(), SIGNAL( layerWasAdded( QgsMapLayer * ) ), + this, SLOT( layerWasAdded( QgsMapLayer * ) ) ); +- +- connect( mRenderSuppressionCBox, SIGNAL( toggled( bool ) ), mMapCanvas, SLOT( setRenderFlag( bool ) ) ); +- // +- // Do we really need this ??? - its already connected to the esc key...TS +- // +- connect( mStopRenderButton, SIGNAL( clicked() ), this, SLOT( stopRendering() ) ); ++ connect( QgsMapLayerRegistry::instance(), SIGNAL( layerWillBeRemoved( QString ) ), ++ this, SLOT( removingLayer( QString ) ) ); + + // Connect warning dialog from project reading + connect( QgsProject::instance(), SIGNAL( oldProjectVersionWarning( QString ) ), + this, SLOT( oldProjectVersionWarning( QString ) ) ); +- +- connect( QgsProject::instance(), SIGNAL( layerLoaded( int, int ) ), this, SLOT( showProgress( int, int ) ) ); +- +- // setup undo/redo actions +- connect( mActionUndo, SIGNAL( triggered() ), mUndoWidget, SLOT( undo() ) ); +- connect( mActionRedo, SIGNAL( triggered() ), mUndoWidget, SLOT( redo() ) ); +- connect( mUndoWidget, SIGNAL( undoStackChanged() ), this, SLOT( updateUndoActions() ) ); +- +- // Connect status from ZoomLast/ZoomNext to corresponding action +- connect( mMapCanvas, SIGNAL( zoomLastStatusChanged( bool ) ), mActionZoomLast, SLOT( setEnabled( bool ) ) ); +- connect( mMapCanvas, SIGNAL( zoomNextStatusChanged( bool ) ), mActionZoomNext, SLOT( setEnabled( bool ) ) ); +- +- // Monitor change of project path ++ connect( QgsProject::instance(), SIGNAL( layerLoaded( int, int ) ), ++ this, SLOT( showProgress( int, int ) ) ); + connect( QgsProject::instance(), SIGNAL( readProject( const QDomDocument & ) ), + this, SLOT( readProject( const QDomDocument & ) ) ); + connect( QgsProject::instance(), SIGNAL( writeProject( QDomDocument & ) ), + this, SLOT( writeProject( QDomDocument & ) ) ); +- +- connect( QgsProject::instance(), SIGNAL( writeProject( QDomDocument& ) ), this, SLOT( writeAnnotationItemsToProject( QDomDocument& ) ) ); +-} +- +-void QgisApp::createCanvas() +-{ +- // "theMapCanvas" used to find this canonical instance later +- mMapCanvas = new QgsMapCanvas( this, "theMapCanvas" ); +- mMapCanvas->setWhatsThis( tr( "Map canvas. This is where raster and vector " +- "layers are displayed when added to the map" ) ); +- +- setCentralWidget( mMapCanvas ); +- // set the focus to the map canvas +- mMapCanvas->setFocus(); +- ++ connect( QgsProject::instance(), SIGNAL( writeProject( QDomDocument& ) ), ++ this, SLOT( writeAnnotationItemsToProject( QDomDocument& ) ) ); ++ ++ // ++ // Do we really need this ??? - its already connected to the esc key...TS ++ // ++ connect( mStopRenderButton, SIGNAL( clicked() ), ++ this, SLOT( stopRendering() ) ); ++ ++ // setup undo/redo actions ++ connect( mUndoWidget, SIGNAL( undoStackChanged() ), this, SLOT( updateUndoActions() ) ); ++} ++ ++void QgisApp::createCanvasTools() ++{ + // create tools + mMapTools.mZoomIn = new QgsMapToolZoom( mMapCanvas, false /* zoomIn */ ); +@@ -2097,14 +2118,18 @@ + } + +-void QgisApp::createLegend() +-{ +- //legend +- mMapLegend = new QgsLegend( NULL, "theMapLegend" ); +- mMapLegend->setObjectName( "theMapLegend" ); +- mMapLegend->setMapCanvas( mMapCanvas ); +- +- //add the toggle editing action also to legend such that right click menu and button show the same state +- mMapLegend->setToggleEditingAction( mActionToggleEditing ); +- ++QgsLegend *QgisApp::legend() ++{ ++ Q_ASSERT( mMapLegend ); ++ return mMapLegend; ++} ++ ++QgsMapCanvas *QgisApp::mapCanvas() ++{ ++ Q_ASSERT( mMapCanvas ); ++ return mMapCanvas; ++} ++ ++void QgisApp::initLegend() ++{ + mMapLegend->setWhatsThis( tr( "Map legend that displays all the layers currently on the map canvas. Click on the check box to turn a layer on or off. Double click on a layer in the legend to customize its appearance and set other properties." ) ); + mLegendDock = new QDockWidget( tr( "Layers" ), this ); +@@ -2853,7 +2878,4 @@ + } + +- +- +- + void QgisApp::fileExit() + { +@@ -3779,5 +3801,5 @@ + } + +- QgsVectorLayer *myLayer = qobject_cast( mMapLegend->currentLayer() ); ++ QgsVectorLayer *myLayer = qobject_cast( activeLayer() ); + if ( !myLayer ) + { +@@ -3792,29 +3814,102 @@ + void QgisApp::saveAsVectorFile() + { +- if ( mMapLegend ) +- { +- QgsLegendLayer* currentLegendLayer = mMapLegend->currentLegendLayer(); +- if ( currentLegendLayer ) +- { +- currentLegendLayer->saveAsVectorFile(); +- } +- } ++ saveAsVectorFileGeneral( false ); + } + + void QgisApp::saveSelectionAsVectorFile() + { +- if ( mMapLegend ) +- { +- QgsLegendLayer* currentLegendLayer = mMapLegend->currentLegendLayer(); +- if ( currentLegendLayer ) +- { +- currentLegendLayer->saveSelectionAsVectorFile(); +- } +- } +-} ++ saveAsVectorFileGeneral( true ); ++} ++ ++void QgisApp::saveAsVectorFileGeneral( bool saveOnlySelection ) ++{ ++ if ( mMapCanvas && mMapCanvas->isDrawing() ) ++ return; ++ ++ if ( !mMapLegend ) ++ return; ++ ++ QgsVectorLayer *vlayer = qobject_cast( activeLayer() ); ++ if ( !vlayer ) ++ return; ++ ++ QgsCoordinateReferenceSystem destCRS; ++ ++ QgsVectorLayerSaveAsDialog *dialog = new QgsVectorLayerSaveAsDialog( this ); ++ ++ if ( dialog->exec() == QDialog::Accepted ) ++ { ++ QString encoding = dialog->encoding(); ++ QString vectorFilename = dialog->filename(); ++ QString format = dialog->format(); ++ ++ if ( dialog->crs() < 0 ) ++ { ++ // Find out if we have projections enabled or not ++ if ( mMapCanvas->mapRenderer()->hasCrsTransformEnabled() ) ++ { ++ destCRS = mMapCanvas->mapRenderer()->destinationSrs(); ++ } ++ else ++ { ++ destCRS = vlayer->srs(); ++ } ++ } ++ else ++ { ++ destCRS = QgsCoordinateReferenceSystem( dialog->crs(), QgsCoordinateReferenceSystem::InternalCrsId ); ++ } ++ ++ // overwrite the file - user will already have been prompted ++ // to verify they want to overwrite by the file dialog above ++ // might not even exists in the given case. ++ // add the extension if not present ++ if ( format == "ESRI Shapefile" ) ++ { ++ if ( !vectorFilename.endsWith( ".shp", Qt::CaseInsensitive ) ) ++ { ++ vectorFilename += ".shp"; ++ } ++ QgsVectorFileWriter::deleteShapeFile( vectorFilename ); ++ } ++ ++ //GE does not open files without extensions. Therefore we append it automatically for kml files ++ if ( format == "KML" ) ++ { ++ if ( !vectorFilename.endsWith( ".kml", Qt::CaseInsensitive ) ) ++ { ++ vectorFilename += ".kml"; ++ } ++ } ++ ++ // ok if the file existed it should be deleted now so we can continue... ++ QApplication::setOverrideCursor( Qt::WaitCursor ); ++ ++ QgsVectorFileWriter::WriterError error; ++ QString errorMessage; ++ error = QgsVectorFileWriter::writeAsVectorFormat( vlayer, vectorFilename, encoding, &destCRS, format, saveOnlySelection, &errorMessage ); ++ ++ QApplication::restoreOverrideCursor(); ++ ++ if ( error == QgsVectorFileWriter::NoError ) ++ { ++ QMessageBox::information( 0, tr( "Saving done" ), tr( "Export to vector file has been completed" ) ); ++ } ++ else ++ { ++ QMessageBox::warning( 0, tr( "Save error" ), tr( "Export to vector file failed.\nError: %1" ).arg( errorMessage ) ); ++ } ++ } ++ ++ delete dialog; ++} ++ + + void QgisApp::layerProperties() + { +- mMapLegend->legendLayerShowProperties(); ++ if ( mMapCanvas && mMapCanvas->isDrawing() ) ++ return; ++ ++ showLayerProperties( activeLayer() ); + } + +@@ -4379,7 +4474,5 @@ + } + +- QgsMapLayer * selectionLayer = ( layerContainingSelection != 0 ) ? +- ( layerContainingSelection ) : +- ( activeLayer() ); ++ QgsMapLayer *selectionLayer = layerContainingSelection ? layerContainingSelection : activeLayer(); + + if ( selectionLayer ) +@@ -4408,7 +4501,5 @@ + } + +- QgsMapLayer * selectionLayer = ( layerContainingSelection != 0 ) ? +- ( layerContainingSelection ) : +- ( activeLayer() ); ++ QgsMapLayer *selectionLayer = layerContainingSelection ? layerContainingSelection : activeLayer(); + + if ( selectionLayer ) +@@ -4434,7 +4525,5 @@ + } + +- QgsMapLayer * pasteLayer = ( destinationLayer != 0 ) ? +- ( destinationLayer ) : +- ( activeLayer() ); ++ QgsMapLayer *pasteLayer = destinationLayer ? destinationLayer : activeLayer(); + + if ( pasteLayer ) +@@ -4494,20 +4583,70 @@ + return; + +- QgsLegendLayer* currentLayer = mMapLegend->currentLegendLayer(); ++ QgsVectorLayer *currentLayer = qobject_cast( activeLayer() ); + if ( currentLayer ) + { +- toggleEditing( mMapLegend->currentLayer() ); ++ toggleEditing( currentLayer, true ); + } + else + { ++ // active although there's no layer active!? + mActionToggleEditing->setChecked( false ); + } + } + +-void QgisApp::toggleEditing( QgsMapLayer *layer ) ++void QgisApp::saveEdits() ++{ ++ if ( mMapCanvas && mMapCanvas->isDrawing() ) ++ return; ++ ++ QgsVectorLayer *vlayer = qobject_cast( activeLayer() ); ++ if ( !vlayer || !vlayer->isEditable() || !vlayer->isModified() ) ++ return; ++ ++ if ( !vlayer->commitChanges() ) ++ { ++ QMessageBox::information( 0, ++ tr( "Error" ), ++ tr( "Could not commit changes to layer %1\n\nErrors: %2\n" ) ++ .arg( vlayer->name() ) ++ .arg( vlayer->commitErrors().join( "\n " ) ) ); ++ } ++ ++ vlayer->startEditing(); ++} ++ ++void QgisApp::layerSubsetString() ++{ ++ if ( mMapCanvas && mMapCanvas->isDrawing() ) ++ return; ++ ++ QgsVectorLayer *vlayer = qobject_cast( activeLayer() ); ++ if ( !vlayer ) ++ return; ++ ++ // launch the query builder ++ QgsQueryBuilder *qb = new QgsQueryBuilder( vlayer, this ); ++ ++ // Set the sql in the query builder to the same in the prop dialog ++ // (in case the user has already changed it) ++ qb->setSql( vlayer->subsetString() ); ++ // Open the query builder ++ if ( qb->exec() ) ++ { ++ // if the sql is changed, update it in the prop subset text box ++ vlayer->setSubsetString( qb->sql() ); ++ mMapCanvas->refresh(); ++ } ++ ++ // delete the query builder object ++ delete qb; ++} ++ ++ ++bool QgisApp::toggleEditing( QgsMapLayer *layer, bool allowCancel ) + { + if ( !layer ) + { +- return; ++ return false; + } + +@@ -4515,5 +4654,5 @@ + if ( !vlayer ) + { +- return; ++ return false; + } + +@@ -4524,40 +4663,47 @@ + { + QMessageBox::information( 0, tr( "Start editing failed" ), tr( "Provider cannot be opened for editing" ) ); ++ return false; + } + } + else if ( vlayer->isModified() ) + { +- // commit or roll back? +- QMessageBox::StandardButton commit = +- QMessageBox::information( 0, +- tr( "Stop editing" ), +- tr( "Do you want to save the changes to layer %1?" ).arg( vlayer->name() ), +- QMessageBox::Save | QMessageBox::Discard | QMessageBox::Cancel ); +- +- if ( commit == QMessageBox::Save ) +- { +- if ( !vlayer->commitChanges() ) +- { +- QMessageBox::information( 0, +- tr( "Error" ), +- tr( "Could not commit changes to layer %1\n\nErrors: %2\n" ) +- .arg( vlayer->name() ) +- .arg( vlayer->commitErrors().join( "\n " ) ) ); +- // Leave the in-memory editing state alone, +- // to give the user a chance to enter different values +- // and try the commit again later +- } +- } +- else if ( commit == QMessageBox::Discard ) +- { +- if ( !vlayer->rollBack() ) +- { +- QMessageBox::information( 0, tr( "Error" ), tr( "Problems during roll back" ) ); +- } +- } +- else //cancel +- { +- mActionToggleEditing->setChecked( vlayer->isEditable() ); +- return; ++ QMessageBox::StandardButtons buttons = QMessageBox::Save | QMessageBox::Discard; ++ if ( allowCancel ) ++ buttons |= QMessageBox::Cancel; ++ ++ switch ( QMessageBox::information( 0, ++ tr( "Stop editing" ), ++ tr( "Do you want to save the changes to layer %1?" ).arg( vlayer->name() ), ++ buttons ) ) ++ { ++ case QMessageBox::Cancel: ++ mActionToggleEditing->setChecked( vlayer->isEditable() ); ++ return false; ++ ++ case QMessageBox::Save: ++ if ( !vlayer->commitChanges() ) ++ { ++ QMessageBox::information( 0, ++ tr( "Error" ), ++ tr( "Could not commit changes to layer %1\n\nErrors: %2\n" ) ++ .arg( vlayer->name() ) ++ .arg( vlayer->commitErrors().join( "\n " ) ) ); ++ // Leave the in-memory editing state alone, ++ // to give the user a chance to enter different values ++ // and try the commit again later ++ return false; ++ } ++ break; ++ ++ case QMessageBox::Discard: ++ if ( !vlayer->rollBack() ) ++ { ++ QMessageBox::information( 0, tr( "Error" ), tr( "Problems during roll back" ) ); ++ return false; ++ } ++ break; ++ ++ default: ++ break; + } + } +@@ -4567,5 +4713,5 @@ + } + +- if ( layer == mMapLegend->currentLayer() ) ++ if ( layer == activeLayer() ) + { + activateDeactivateLayerRelatedActions( layer ); +@@ -4575,4 +4721,5 @@ + mActionToggleEditing->setChecked( vlayer->isEditable() ); + vlayer->triggerRepaint(); ++ return true; + } + +@@ -4686,30 +4833,39 @@ + } + ++void QgisApp::removingLayer( QString layerId ) ++{ ++ QgsVectorLayer *vlayer = qobject_cast( QgsMapLayerRegistry::instance()->mapLayer( layerId ) ); ++ if ( !vlayer || !vlayer->isEditable() ) ++ return; ++ ++ toggleEditing( vlayer, false ); ++} ++ ++void QgisApp::removeAllLayers() ++{ ++ QgsMapLayerRegistry::instance()->removeAllMapLayers(); ++} ++ + void QgisApp::removeLayer() + { +- mMapLegend->removeCurrentLayer(); +-} +- +- +-void QgisApp::removeAllLayers() +-{ +- //iterate through all the layers in order to ask if uncommited changes should be saved +- if ( mMapLegend ) +- { +- QMap layers = QgsMapLayerRegistry::instance()->mapLayers(); +- QMap::iterator layer_it = layers.begin(); +- for ( ; layer_it != layers.end(); ++layer_it ) +- { +- mMapLegend->removeLayer( layer_it.value(), false ); +- } +- mMapLegend->removeAll(); +- } +- else //no legend? Remove all the layers from the registry directly in this case +- { +- QgsMapLayerRegistry::instance()->removeAllMapLayers(); +- } +- ++ if ( mMapCanvas && mMapCanvas->isDrawing() ) ++ { ++ return; ++ } ++ ++ QgsMapLayer *layer = activeLayer(); ++ ++ if ( !layer ) ++ { ++ return; ++ } ++ ++ QgsVectorLayer *vlayer = qobject_cast( layer ); ++ if ( vlayer && vlayer->isEditable() && !toggleEditing( vlayer, true ) ) ++ return; ++ ++ QgsMapLayerRegistry::instance()->removeMapLayer( layer->getLayerID() ); + mMapCanvas->refresh(); +-} //remove all layers ++} + + void QgisApp::showGpsTool() +@@ -5051,5 +5207,5 @@ + QgsMapLayer *QgisApp::activeLayer() + { +- return mMapLegend->currentLayer(); ++ return mMapLegend ? mMapLegend->currentLayer() : 0; + } + +@@ -5057,4 +5213,7 @@ + bool QgisApp::setActiveLayer( QgsMapLayer *layer ) + { ++ if ( !layer ) ++ return false; ++ + return mMapLegend->setCurrentLayer( layer ); + } +@@ -5079,6 +5238,4 @@ + // QApplication::setOverrideCursor(Qt::WaitCursor); + +- // create the layer +- QgsVectorLayer *layer; + /* Eliminate the need to instantiate the layer based on provider type. + The caller is responsible for cobbling together the needed information to +@@ -5089,5 +5246,6 @@ + + " and providerKey of " + providerKey ); + +- layer = new QgsVectorLayer( vectorLayerPath, baseName, providerKey ); ++ // create the layer ++ QgsVectorLayer *layer = new QgsVectorLayer( vectorLayerPath, baseName, providerKey ); + + if ( layer && layer->isValid() ) +@@ -5200,6 +5358,5 @@ + mMapCanvas->freeze( false ); + +- return ( answer != QMessageBox::Cancel ); +- ++ return answer != QMessageBox::Cancel; + } // QgisApp::saveDirty() + +@@ -5594,4 +5751,14 @@ + } + ++void QgisApp::selectionChanged( QgsMapLayer *layer ) ++{ ++ QgsVectorLayer *vlayer = qobject_cast( layer ); ++ if ( vlayer ) ++ { ++ showStatusMessage( tr( "%n feature(s) selected on layer %1.", "number of selected features", vlayer->selectedFeatureCount() ).arg( vlayer->name() ) ); ++ } ++ activateDeactivateLayerRelatedActions( layer ); ++} ++ + void QgisApp::activateDeactivateLayerRelatedActions( QgsMapLayer* layer ) + { +@@ -5603,8 +5770,10 @@ + mActionOpenTable->setEnabled( false ); + mActionToggleEditing->setEnabled( false ); ++ mActionSaveEdits->setEnabled( false ); + mActionLayerSaveAs->setEnabled( false ); + mActionLayerSelectionSaveAs->setEnabled( false ); + mActionRemoveLayer->setEnabled( false ); + mActionLayerProperties->setEnabled( false ); ++ mActionLayerSubsetString->setEnabled( false ); + mActionAddToOverview->setEnabled( false ); + +@@ -5647,5 +5816,5 @@ + QgsVectorLayer* vlayer = qobject_cast( layer ); + const QgsVectorDataProvider* dprovider = vlayer->dataProvider(); +- bool layerHasSelection = ( vlayer->selectedFeatureCount() != 0 ); ++ bool layerHasSelection = vlayer->selectedFeatureCount() != 0; + + mActionSelect->setEnabled( true ); +@@ -5669,8 +5838,10 @@ + mActionToggleEditing->setEnabled( true ); + mActionToggleEditing->setChecked( vlayer->isEditable() ); ++ mActionSaveEdits->setEnabled( vlayer->isEditable() ); + } + else + { + mActionToggleEditing->setEnabled( false ); ++ mActionSaveEdits->setEnabled( false ); + } + +@@ -5864,8 +6035,10 @@ + else if ( layer->type() == QgsMapLayer::RasterLayer ) + { ++ mActionLayerSubsetString->setEnabled( false ); + mActionSelect->setEnabled( false ); + mActionZoomActualSize->setEnabled( true ); + mActionOpenTable->setEnabled( false ); + mActionToggleEditing->setEnabled( false ); ++ mActionSaveEdits->setEnabled( false ); + mActionLayerSaveAs->setEnabled( false ); + mActionLayerSelectionSaveAs->setEnabled( false ); +@@ -5996,10 +6169,10 @@ + + // connect up any request the raster may make to update the app progress +- QObject::connect( theRasterLayer, SIGNAL( drawingProgress( int, int ) ), +- this, SLOT( showProgress( int, int ) ) ); ++ connect( theRasterLayer, SIGNAL( drawingProgress( int, int ) ), ++ this, SLOT( showProgress( int, int ) ) ); + + // connect up any request the raster may make to update the statusbar message +- QObject::connect( theRasterLayer, SIGNAL( statusChanged( QString ) ), +- this, SLOT( showStatusMessage( QString ) ) ); ++ connect( theRasterLayer, SIGNAL( statusChanged( QString ) ), ++ this, SLOT( showStatusMessage( QString ) ) ); + + return true; +@@ -6468,4 +6641,7 @@ + */ + ++ if ( !ml ) ++ return; ++ + if ( ml->type() == QgsMapLayer::RasterLayer ) + { +@@ -6514,5 +6690,4 @@ + QMessageBox::information( this, tr( "Warning" ), tr( "This layer doesn't have a properties dialog." ) ); + } +- + } + } +Index: /trunk/qgis/src/core/qgsvectorlayer.cpp +=================================================================== +--- qgis-1.4.0/src/core/qgsvectorlayer.cpp (revision 13380) ++++ /trunk/qgis/src/core/qgsvectorlayer.cpp (revision 13501) +@@ -2951,5 +2951,5 @@ + + // add label node +- QDomElement label = doc.createElement( "label" ); ++ QDomElement labelElem = doc.createElement( "label" ); + QDomText labelText = doc.createTextNode( "" ); + +@@ -2962,7 +2962,7 @@ + labelText.setData( "0" ); + } +- label.appendChild( labelText ); +- +- node.appendChild( label ); ++ labelElem.appendChild( labelText ); ++ ++ node.appendChild( labelElem ); + + // add attribute actions +@@ -2975,5 +2975,5 @@ + // XXX function. I think. + +- const QgsLabel *myLabel = this->label(); ++ const QgsLabel *myLabel = label(); + + if ( myLabel ) +Index: /trunk/qgis/src/core/qgsapplication.cpp +=================================================================== +--- qgis-1.4.0/src/core/qgsapplication.cpp (revision 13494) ++++ /trunk/qgis/src/core/qgsapplication.cpp (revision 13501) +@@ -72,5 +72,4 @@ + QgsApplication::~QgsApplication() + { +- + } + +Index: /trunk/qgis/src/core/qgsmaplayerregistry.cpp +=================================================================== +--- qgis-1.4.0/src/core/qgsmaplayerregistry.cpp (revision 11961) ++++ /trunk/qgis/src/core/qgsmaplayerregistry.cpp (revision 13501) +@@ -103,5 +103,4 @@ + void QgsMapLayerRegistry::removeAllMapLayers() + { +- + // moved before physically removing the layers + emit removedAll(); // now let all canvas Observers know to clear +Index: /trunk/qgis/src/core/qgsmaplayerregistry.h +=================================================================== +--- qgis-1.4.0/src/core/qgsmaplayerregistry.h (revision 13380) ++++ /trunk/qgis/src/core/qgsmaplayerregistry.h (revision 13501) +@@ -64,5 +64,5 @@ + which won't be used in main map canvas but will be used in a special one + */ +- QgsMapLayer * addMapLayer( QgsMapLayer * theMapLayer, bool theEmitSignal = true ); ++ QgsMapLayer *addMapLayer( QgsMapLayer * theMapLayer, bool theEmitSignal = true ); + + /** Remove a layer from qgis +Index: /trunk/qgis/images/images.qrc +=================================================================== +--- qgis-1.4.0/images/images.qrc (revision 13189) ++++ /trunk/qgis/images/images.qrc (revision 13501) +@@ -375,4 +375,5 @@ + themes/gis/plugins/wfs.png + themes/gis/plugins/coordinate_capture/coordinate_capture.png ++ themes/default/mActionSaveEdits.png + + diff --git a/qgis-1.0.2-sip410.patch b/qgis-1.4.0-sip410.patch similarity index 67% rename from qgis-1.0.2-sip410.patch rename to qgis-1.4.0-sip410.patch index 434b488..4b4b7ce 100644 --- a/qgis-1.0.2-sip410.patch +++ b/qgis-1.4.0-sip410.patch @@ -1,13 +1,12 @@ -diff -ur qgis-1.0.2/cmake/Python.cmake qgis-1.0.2-sip410/cmake/Python.cmake ---- qgis-1.0.2/cmake/Python.cmake 2008-11-11 15:33:01.000000000 +0100 -+++ qgis-1.0.2-sip410/cmake/Python.cmake 2010-02-05 22:35:47.000000000 +0100 -@@ -64,8 +64,8 @@ +--- qgis-1.4.0/cmake/Python.cmake 2009-08-19 21:09:10.000000000 +0200 ++++ ../../qgis-1.4.0-sip410/cmake/Python.cmake 2010-05-12 20:46:28.884661938 +0200 +@@ -148,8 +148,8 @@ IF (HAVE_SIP_MODULE AND SIP_BINARY_PATH AND SIP_INCLUDE_DIR) # check for SIP version # minimal version is 4.7 (to support universal builds) - SET (SIP_MIN_VERSION 040700) - TRY_RUN_PYTHON (RES "import sip\nprint '%x' % sip.SIP_VERSION" SIP_VERSION) -+ SET (SIP_MIN_VERSION 263936) # 0x040700 ++ SET (SIP_MIN_VERSION 263936) # 0x040700 + TRY_RUN_PYTHON (RES "import sip\nprint '%d' % sip.SIP_VERSION" SIP_VERSION) IF (SIP_VERSION EQUAL "${SIP_MIN_VERSION}" OR SIP_VERSION GREATER "${SIP_MIN_VERSION}") SET (SIP_IS_GOOD TRUE) diff --git a/qgis-1.4.0-vectorcrs.patch b/qgis-1.4.0-vectorcrs.patch new file mode 100644 index 0000000..1fb2a36 --- /dev/null +++ b/qgis-1.4.0-vectorcrs.patch @@ -0,0 +1,22 @@ +Index: /trunk/qgis/src/providers/gpx/qgsgpxprovider.cpp +=================================================================== +--- qgis-1.4.0/src/providers/gpx/qgsgpxprovider.cpp (revision 12601) ++++ /trunk/qgis/src/providers/gpx/qgsgpxprovider.cpp (revision 13425) +@@ -851,5 +851,5 @@ + QgsCoordinateReferenceSystem QgsGPXProvider::crs() + { +- return QgsCoordinateReferenceSystem(); // use default CRS - it's WGS84 ++ return QgsCoordinateReferenceSystem( GEOSRID, QgsCoordinateReferenceSystem::PostgisCrsId ); // use WGS84 + } + +Index: /trunk/qgis/src/providers/osm/osmprovider.cpp +=================================================================== +--- qgis-1.4.0/src/providers/osm/osmprovider.cpp (revision 12591) ++++ /trunk/qgis/src/providers/osm/osmprovider.cpp (revision 13425) +@@ -938,5 +938,5 @@ + QgsCoordinateReferenceSystem QgsOSMDataProvider::crs() + { +- return QgsCoordinateReferenceSystem(); // use default CRS - it's WGS84 ++ return QgsCoordinateReferenceSystem( GEOSRID, QgsCoordinateReferenceSystem::PostgisCrsId ); // use WGS84 + } + diff --git a/qgis.desktop b/qgis.desktop index e293243..4e31ae0 100644 --- a/qgis.desktop +++ b/qgis.desktop @@ -4,7 +4,7 @@ Name=Quantum GIS GenericName=Geographic Information System Comment= Exec=qgis -Icon=qgis.png +Icon=qgis Terminal=false Type=Application -Categories=Graphics; +Categories=Geography;Viewer;Graphics; diff --git a/qgis.spec b/qgis.spec index 3d4e2e0..710dc22 100644 --- a/qgis.spec +++ b/qgis.spec @@ -1,171 +1,185 @@ -%{!?python_sitearch: %define python_sitearch %(%{__python} -c "from distutils.sysconfig import get_python_lib; print get_python_lib(1)")} +%if ! (0%{?fedora} > 12 || 0%{?rhel} > 5) +%{!?python_sitearch: %global python_sitearch %(%{__python} -c "from distutils.sysconfig import get_python_lib; print(get_python_lib(1))")} +%endif -Name: qgis -Version: 1.0.2 -Release: 6%{?dist} -Summary: A user friendly Open Source Geographic Information System +Name: qgis +Version: 1.4.0 +Release: 8%{?dist} +Summary: A user friendly Open Source Geographic Information System -Group: Applications/Engineering -License: GPLv2+ -URL: http://qgis.org/ -Source0: http://download.osgeo.org/qgis/src/%{name}_%{version}.tar.gz -Source1: %{name}.desktop -# fix sip version check so it works with sip 4.10 -Patch0: qgis-1.0.2-sip410.patch -BuildRoot: %{_tmppath}/%{name}-%{version}-%{release}-root-%(%{__id_u} -n) +Group: Applications/Engineering +License: GPLv2+ with exceptions +URL: http://www.qgis.org/ +Source0: http://download.osgeo.org/qgis/src/%{name}_%{version}.tar.gz +Source1: %{name}.desktop -## upstream patches -# http://trac.osgeo.org/qgis/ticket/1959 -Patch100: qgis-1.0.2-sip49.patch +# Fix sip version, so it works with sip 4.10 +# Already fixed in upcoming version http://trac.osgeo.org/qgis/ticket/2446 +Patch0: qgis-1.4.0-sip410.patch + +# Fix detection problem for GRASS libraries +Patch1: qgis-1.4.0-grass.patch +Patch2: qgis-1.4.0-qt47.patch + +# Already fixed in upcoming version https://trac.osgeo.org/qgis/ticket/2879 +Patch3: qgis-1.4.0-QVariant.patch + +## Upstream patches +# http://trac.osgeo.org/qgis/ticket/2542 +Patch100: qgis-1.4.0-fieldcalc.patch + +# http://trac.osgeo.org/qgis/ticket/2661 +Patch101: qgis-1.4.0-vectorcrs.patch + +# http://trac.osgeo.org/qgis/ticket/2670 +Patch102: qgis-1.4.0-asslibqgisv.patch + +BuildRequires: cmake +BuildRequires: flex bison + +BuildRequires: expat-devel +BuildRequires: gdal-devel +BuildRequires: geos-devel +BuildRequires: gsl-devel +BuildRequires: postgresql-devel +BuildRequires: proj-devel +BuildRequires: sqlite-devel +BuildRequires: chrpath +BuildRequires: desktop-file-utils +BuildRequires: qt-devel +BuildRequires: sip-devel > 4.7 +BuildRequires: python-devel +BuildRequires: PyQt4-devel +BuildRequires: qt4-webkit-devel -BuildRequires: cmake -BuildRequires: desktop-file-utils -BuildRequires: qt4-devel -BuildRequires: bison, flex -BuildRequires: expat-devel -BuildRequires: gdal-devel -BuildRequires: geos-devel -BuildRequires: gsl-devel -BuildRequires: postgresql-devel -BuildRequires: sqlite-devel # grass package contains definitions needed for configure script -BuildRequires: grass, grass-devel -BuildRequires: chrpath -# fixing missing library calls in atlas -BuildRequires: blas, lapack -Requires: gpsbabel +BuildRequires: grass, grass-devel + +Requires: gpsbabel + +Obsoletes: qgis-theme-classic < 1.1 +Obsoletes: qgis-theme-gis < 1.1 +Obsoletes: qgis-theme-nkids < 1.1 %description Quantum GIS (QGIS) is a user friendly Open Source Geographic Information -System (GIS) that runs on Linux, Unix, Mac OSX, and Windows. QGIS supports -vector, raster, and database formats. QGIS is licensed under the GNU -General Public License. QGIS lets you browse and create map data on your -computer. It supports many common spatial data formats (e.g. ESRI ShapeFile, -geotiff). QGIS supports plugins to do things like display tracks from your GPS. - +System (GIS) that runs on Linux, Unix, Mac OSX, and Windows. +QGIS supports vector, raster, and database formats. QGIS lets you browse +and create map data on your computer. It supports many common spatial data +formats (e.g. ESRI ShapeFile, geotiff). QGIS supports plugins to do things +like display tracks from your GPS. %package devel -Summary: Headers and libraries for building against qgis -Group: Development/Libraries -Requires: %{name} = %{version}-%{release} +Summary: Development Libraries for the Quantum GIS +Group: Development/Libraries +Requires: %{name} = %{version}-%{release} %description devel -Headers and libraries for building against qgis +Development packages for Quantum GIS including the C header files. - -%package grass -Summary: GRASS plugins for qgis -Group: Applications/Engineering -Requires: %{name} = %{version}-%{release} -Requires: grass +%package grass +Summary: GRASS Support Libraries for Quantum GIS +Group: Applications/Engineering +Requires: %{name} = %{version}-%{release} +Requires: grass %description grass -GRASS plugins for qgis +GRASS plugin for Quantum GIS required to interface with the GRASS system. - -%package python -Summary: Python integration and plugins for qgis -Group: Applications/Engineering -Requires: %{name} = %{version}-%{release} -Requires: PyQt4 -%{?_sip_api:Requires: sip-api(%{_sip_api_major}) >= %{_sip_api}} -BuildRequires: sip-devel -BuildRequires: python-devel -BuildRequires: PyQt4-devel +%package python +Summary: Python integration and plugins for Quantum GIS +Group: Applications/Engineering +Requires: %{name} = %{version}-%{release} %description python -Python integration and plugins for qgis - - -%package theme-classic -Summary: Addtional theme for qgis - classic -Group: Applications/Engineering -Requires: %{name} = %{version}-%{release} - -%description theme-classic -Addtional theme for qgis - classic - - -%package theme-gis -Summary: Addtional theme for qgis - gis -Group: Applications/Engineering -Requires: %{name} = %{version}-%{release} - -%description theme-gis -Addtional theme for qgis - gis - - -%package theme-nkids -Summary: Addtional theme for qgis - nkids -Group: Applications/Engineering -Requires: %{name} = %{version}-%{release} - -%description theme-nkids -Addtional theme for qgis - nkids - +Python integration and plugins for QGIS. %prep %setup -q -n %{name}-%{version} -%patch100 -p1 -b .sip49 %patch0 -p1 -b .sip410 +%patch1 -p1 -b .grass +%patch2 -p1 -b .qt47 +%patch3 -p1 -b .QVariant +%patch100 -p1 -b .fieldcalc +%patch101 -p1 -b .vectorcrs +%patch102 -p1 -b .asslibqgis -# fix spurious executable bits -%{__chmod} -x \ - ./src/app/legend/qgslegend.h \ - ./src/app/legend/qgslegend.cpp \ - ./src/gui/qgsdetaileditem*.cpp \ - ./src/gui/qgsdetaileditem*.h +# Encode man-file to utf-8 +iconv -f iso8859-1 -t utf-8 qgis_help.1 > qgis_help.1.conv && mv qgis_help.1.conv qgis_help.1 -# remove duplicate translations -/usr/bin/lupdate-qt4 -no-obsolete -ts i18n/*.ts +# Fix spurious executable bits +# Already fixed in upcoming version +chmod -x \ + ./src/app/legend/qgslegend.h \ + ./src/app/legend/qgslegend.cpp \ + ./src/core/composer/qgscomposershape.h \ + ./src/core/composer/qgscomposershape.cpp +# Remove obsolete translations +#/usr/bin/lupdate-qt4 -noobsolete -ts i18n/qgis_*.ts %build -for dir in %{_libdir}/grass-*/ ; do - GRASS_PREFIX=$dir -done + +# Detection doesn't work on it's own +GRASS_PREFIX=%{_libdir} + %cmake \ - -D QGIS_MANUAL_SUBDIR=share/man \ - -D QGIS_LIB_SUBDIR=%{_lib} \ - -D QGIS_PLUGIN_SUBDIR=%{_lib}/qgis \ - -D BINDINGS_GLOBAL_INSTALL:BOOL=ON \ - -D GRASS_PREFIX=$GRASS_PREFIX \ - -D GDAL_INCLUDE_DIR=%{_includedir}/gdal \ - -D GDAL_LIBRARY=%{_libdir}/libgdal.so \ - . - -make %{?_smp_mflags} + -D QGIS_LIB_SUBDIR=%{_lib} \ + -D QGIS_MANUAL_SUBDIR=/share/man \ + -D QGIS_PLUGIN_SUBDIR=%{_lib}/%{name} \ + -D WITH_BINDINGS:BOOL=TRUE \ + -D BINDINGS_GLOBAL_INSTALL:BOOL=TRUE \ + -D GRASS_PREFIX=$GRASS_PREFIX \ + -D GDAL_INCLUDE_DIR=%{_includedir}/gdal \ + -D GDAL_LIBRARY=%{_libdir}/libgdal.so \ + . +# Parallel make leads to race conditions with PYQT4_WRAP_UI +#make %{?_smp_mflags} +make %install -%{__rm} -rf %{buildroot} +rm -rf %{buildroot} make install DESTDIR=%{buildroot} -# remove rpath from files +# Qt translations shouldn't be shipped +rm -f %{buildroot}/%{_datadir}/%{name}/i18n/qt_*.qm + +%find_lang %{name} --with-qt + +# Remove rpath from files chrpath --delete \ - %{buildroot}%{_bindir}/%{name} \ - %{buildroot}%{python_sitearch}/%{name}/*.so + %{buildroot}%{python_sitearch}/%{name}/*.so -# add executable perms to python libs so they get striped -%{__chmod} +x %{buildroot}%{python_sitearch}/%{name}/*.so +# Add executable perms to python libs so they get stripped +chmod +x %{buildroot}%{python_sitearch}/%{name}/*.so -# remove files packaged by doc -%{__rm} -f %{buildroot}%{_datadir}/doc/AUTHORS \ - %{buildroot}%{_datadir}/doc/SPONSORS +# Remove files packaged by doc or undesired +rm -f %{buildroot}%{_datadir}/%{name}/doc/BUGS \ + %{buildroot}%{_datadir}/%{name}/doc/ChangeLog \ + %{buildroot}%{_datadir}/%{name}/doc/CODING \ + %{buildroot}%{_datadir}/%{name}/doc/COPYING \ + %{buildroot}%{_datadir}/%{name}/doc/INSTALL \ + %{buildroot}%{_datadir}/%{name}/doc/PROVENANCE \ + %{buildroot}%{_datadir}/%{name}/doc/README -# install desktop file -%{__install} -d %{buildroot}%{_datadir}/pixmaps -%{__install} -m0644 \ - %{buildroot}%{_datadir}/%{name}/images/icons/qgis-icon.png \ - %{buildroot}%{_datadir}/pixmaps/%{name}.png +# Install desktop file +install -pd %{buildroot}%{_datadir}/pixmaps +install -pm0644 \ + %{buildroot}%{_datadir}/%{name}/images/icons/%{name}-icon.png \ + %{buildroot}%{_datadir}/pixmaps/%{name}.png desktop-file-install --vendor="fedora" \ - --dir=%{buildroot}%{_datadir}/applications \ - %{SOURCE1} +--dir=%{buildroot}/%{_datadir}/applications \ +%{SOURCE1} +%check +# The tests don't seem to work right +# -D ENABLE_TESTS:BOOL=TRUE \ +#make -d test %clean -%{__rm} -rf %{buildroot} +rm -rf %{buildroot} %post -p /sbin/ldconfig @@ -179,87 +193,103 @@ desktop-file-install --vendor="fedora" \ %postun python -p /sbin/ldconfig - -%files -%defattr(-, root, root, -) -%doc AUTHORS BUGS COPYING ChangeLog README SPONSORS CONTRIBUTORS -%{_bindir}/%{name} -%{_bindir}/%{name}_help +%files -f %{name}.lang +%defattr(-,root,root,-) +%doc BUGS COPYING ChangeLog README CODING PROVENANCE Exception_to_GPL_for_Qt.txt +# Can be viewed in the About-Box: +# CONTRIBUTORS AUTHORS %{_libdir}/lib%{name}_*.so.* -%dir %{_libdir}/%{name} -%{_libdir}/%{name}/libcoordinatecaptureplugin.so -%{_libdir}/%{name}/libcopyrightlabelplugin.so -%{_libdir}/%{name}/libdelimitedtextplugin.so -%{_libdir}/%{name}/libdelimitedtextprovider.so -%{_libdir}/%{name}/libdxf2shpconverterplugin.so -%{_libdir}/%{name}/libgeorefplugin.so -%{_libdir}/%{name}/libgpsimporterplugin.so -%{_libdir}/%{name}/libgpxprovider.so -%{_libdir}/%{name}/libgridmakerplugin.so -%{_libdir}/%{name}/libinterpolationplugin.so -%{_libdir}/%{name}/libmemoryprovider.so -%{_libdir}/%{name}/libnortharrowplugin.so -%{_libdir}/%{name}/libogrconverterplugin.so -%{_libdir}/%{name}/libogrprovider.so -%{_libdir}/%{name}/libpostgresprovider.so -%{_libdir}/%{name}/libquickprintplugin.so -%{_libdir}/%{name}/libscalebarplugin.so -%{_libdir}/%{name}/libspitplugin.so -%{_libdir}/%{name}/libwfsplugin.so -%{_libdir}/%{name}/libwfsprovider.so -%{_libdir}/%{name}/libwmsprovider.so -%{_datadir}/%{name}/doc +%{_libdir}/%{name}/ +%{_bindir}/qgis* +%{_mandir}/man1/%{name}* +%dir %{_datadir}/%{name}/ %{_datadir}/pixmaps/%{name}.png %{_datadir}/applications/fedora-%{name}.desktop -%dir %{_datadir}/%{name} -%{_datadir}/%{name}/i18n +%dir %{_datadir}/%{name}/i18n/ +%{_datadir}/%{name}/doc %{_datadir}/%{name}/images %{_datadir}/%{name}/resources %{_datadir}/%{name}/svg -%dir %{_datadir}/%{name}/themes -%dir %{_datadir}/%{name}/themes/default -%{_datadir}/%{name}/themes/default/*.png -%{_mandir}/man1/* +%{_datadir}/%{name}/themes +%exclude %{_libdir}/libqgisgrass.so.%{version} +%exclude %{_libdir}/%{name}/libgrassprovider.so +%exclude %{_libdir}/%{name}/libgrassplugin.so +%exclude %{_datadir}/%{name}/themes/default/grass +%exclude %{_datadir}/%{name}/themes/gis/grass +%exclude %{_datadir}/%{name}/themes/classic/grass %files devel -%defattr(-, root, root, -) +%defattr(-,root,root,-) %{_includedir}/%{name} %{_libdir}/lib%{name}_*.so -%{_libdir}/libqgisgrass.so +%{_libdir}/lib%{name}python.so +%{_libdir}/lib%{name}grass.so %files grass -%defattr(-, root, root, -) -%{_libdir}/libqgisgrass.so.* -%{_libdir}/%{name}/libgrass*.so +%defattr(-,root,root,-) +%{_libdir}/lib%{name}grass.so.%{version} +%{_libdir}/%{name}/libgrassprovider.so +%{_libdir}/%{name}/libgrassplugin.so %{_datadir}/%{name}/grass %{_datadir}/%{name}/themes/default/grass +%{_datadir}/%{name}/themes/gis/grass +%{_datadir}/%{name}/themes/classic/grass %files python -%defattr(-, root, root, -) -%{_libdir}/libqgispython.so.* -%{_libdir}/libqgispython.so +%defattr(-,root,root,-) +%{_libdir}/lib%{name}python.so.* %{_datadir}/%{name}/python %{python_sitearch}/%{name} -%files theme-classic -%defattr(-, root, root, -) -%{_datadir}/%{name}/themes/classic - -%files theme-gis -%defattr(-, root, root, -) -%{_datadir}/%{name}/themes/gis - -%files theme-nkids -%defattr(-, root, root, -) -%{_datadir}/%{name}/themes/nkids - - %changelog -* Fri Feb 05 2010 Kevin Kofler - 1.0.2-6 +* Fri Jul 09 2010 Volker Fröhlich - 1.4.0-8 +- Further completed qt47 patch + +* Fri Jul 09 2010 Volker Fröhlich - 1.4.0-7 +- Further completed qt47 patch + +* Fri Jul 09 2010 Volker Fröhlich - 1.4.0-6 +- Added patch to remove redundant ::QVariant in function-style cast + +* Fri Jul 09 2010 Volker Fröhlich - 1.4.0-5 +- Removed smp_mflags because of race conditions +- Simplified member initializer syntax in qt47 patch + +* Wed Jul 07 2010 Volker Fröhlich - 1.4.0-4 +- Added preliminary patch for Qt 4.7 -- still won't build for Rawhide because of https://bugzilla.redhat.com/show_bug.cgi?id=587707 +- Put version variable in filelist for GRASS +- Added qt-webkit as build require, removed gettext +- Corrected erroneous dependency on GRASS subpackage + +* Thu Jul 01 2010 Volker Fröhlich - 1.4.0-3 +- Changed license to reflect exception for Qt; packaged exception file +- Added find_lang and excluded qt-translations +- Added ownership for directory in share +- Dropped docdir statement +- Changed description for the subpackages python and grass + +* Wed Jun 24 2010 Volker Fröhlich - 1.4.0-2 +- Grouped corresponding entries for %description and %package +- Corrected swapped summaries for python- and grass-subpackage +- Set theme subpackages as obsolete +- Removed nonsensical build-requires statements from subpackages +- Dropped redundant definition of GRASS_PREFIX +- Removed verbose-option from make +- Removed unnecessary chmod-command +- Removed nonsensical ldconfig for devel-subpackage +- Made the file list more elegant +- Removed unnecessary call for chrpath + +* Thu Jun 17 2010 Volker Fröhlich - 1.4.0-1 +- Updated for 1.4.0 +- Dropped theme packages + +* Wed Feb 10 2010 Kevin Kofler - 1.0.2-6 +- rebuild for sip 4.10 - fix sip version check so it works with sip 4.10 (#553713) -* Thu Jan 07 2010 Rex Dieter - 1.0.2-5 -- rebuild (sip) +* Wed Jan 13 2010 Devrim GÜNDÜZ - 1.0.2-5 +- Rebuild against new GEOS. * Wed Dec 23 2009 Rex Dieter - 1.0.2-4 - qgis rebuild for sip-4.9.x (#538119) diff --git a/sources b/sources index 9c5f785..7a23ffc 100644 --- a/sources +++ b/sources @@ -1 +1 @@ -71faff161c0b893f75d008187b471fc8 qgis_1.0.2.tar.gz +47710e7aa14c2a672c7f28457b0c956f qgis_1.4.0.tar.gz