Skip to content

Commit

Permalink
Warn if loading a project file from an older version of qgis (prompted
Browse files Browse the repository at this point in the history
by ticket #314)


git-svn-id: http://svn.osgeo.org/qgis/trunk@6028 c8812cc2-4d05-0410-92ff-de0c093fc19c
  • Loading branch information
g_j_m committed Oct 28, 2006
1 parent b3d8dd6 commit 0a710fe
Showing 1 changed file with 25 additions and 1 deletion.
26 changes: 25 additions & 1 deletion src/gui/qgsproject.cpp
Expand Up @@ -31,6 +31,7 @@ using namespace std;
#include "qgsexception.h"
#include "qgsprojectproperty.h"
#include "qgsmapcanvas.h"
#include "qgslogger.h"

#include <QApplication>
#include <QFileInfo>
Expand Down Expand Up @@ -1084,7 +1085,30 @@ bool QgsProject::read()
QgsDebug( QString("project file has version " + fileVersion).ascii() );
}

// XXX some day insert version checking
QStringList fileVersionParts = fileVersion.split(".");
QStringList qgisVersionParts = QString(QGis::qgisVersion).split(".");

bool older = false;

if (fileVersionParts.size() != 3 || qgisVersionParts.size() != 3)
older = false; // probably an older version
else
{
if (fileVersionParts.at(0) < qgisVersionParts.at(0))
older = true;
else if (fileVersionParts.at(1) < qgisVersionParts.at(1))
older = true;
else if (fileVersionParts.at(2) < qgisVersionParts.at(2))
older = true;
}

if (older)
{
QgsLogger::warning("Loading a file that was saved with an older "
"version of qgis (saved in " + fileVersion +
", loaded in " + QGis::qgisVersion +
"). Problems may occur.");
}

#ifdef QGISDEBUG
qDebug(("Project title: " + imp_->title).toLocal8Bit().data());
Expand Down

0 comments on commit 0a710fe

Please sign in to comment.