Skip to content

Commit

Permalink
Indentation
Browse files Browse the repository at this point in the history
  • Loading branch information
nyalldawson committed Jun 1, 2016
1 parent 9fb1d4f commit 3a005cd
Show file tree
Hide file tree
Showing 6 changed files with 73 additions and 73 deletions.
4 changes: 2 additions & 2 deletions python/gui/attributetable/qgsorganizetablecolumnsdialog.sip
Expand Up @@ -23,7 +23,7 @@ class QgsOrganizeTableColumnsDialog : QDialog
* Get the updated configuration * Get the updated configuration
*/ */
QgsAttributeTableConfig config() const; QgsAttributeTableConfig config() const;

public slots: public slots:
/** /**
* showAll checks all the fields to show them all in the attribute table * showAll checks all the fields to show them all in the attribute table
Expand All @@ -33,5 +33,5 @@ class QgsOrganizeTableColumnsDialog : QDialog
/** /**
* hideAll unchecks all the fields to hide them all in the attribute table * hideAll unchecks all the fields to hide them all in the attribute table
*/ */
void hideAll(); void hideAll();
}; };
2 changes: 1 addition & 1 deletion python/plugins/processing/algs/qgis/ImportIntoPostGIS.py
Expand Up @@ -117,7 +117,7 @@ def processAlgorithm(self, progress):


try: try:
db = postgis.GeoDB(host=host, port=port, dbname=database, db = postgis.GeoDB(host=host, port=port, dbname=database,
user=username, passwd=password) user=username, passwd=password)
except postgis.DbError as e: except postgis.DbError as e:
raise GeoAlgorithmExecutionException( raise GeoAlgorithmExecutionException(
self.tr("Couldn't connect to database:\n%s") % unicode(e)) self.tr("Couldn't connect to database:\n%s") % unicode(e))
Expand Down
2 changes: 1 addition & 1 deletion python/plugins/processing/algs/qgis/PostGISExecuteSQL.py
Expand Up @@ -59,7 +59,7 @@ def processAlgorithm(self, progress):
self.tr('Wrong database connection name: %s' % connection)) self.tr('Wrong database connection name: %s' % connection))
try: try:
self.db = postgis.GeoDB(host=host, port=port, self.db = postgis.GeoDB(host=host, port=port,
dbname=database, user=username, passwd=password) dbname=database, user=username, passwd=password)
except postgis.DbError as e: except postgis.DbError as e:
raise GeoAlgorithmExecutionException( raise GeoAlgorithmExecutionException(
self.tr("Couldn't connect to database:\n%s") % unicode(e)) self.tr("Couldn't connect to database:\n%s") % unicode(e))
Expand Down
2 changes: 1 addition & 1 deletion python/plugins/processing/tools/dataobjects.py
Expand Up @@ -29,7 +29,7 @@
import os import os
import re import re
from qgis.core import QGis, QgsProject, QgsVectorFileWriter, QgsMapLayer, QgsRasterLayer, \ from qgis.core import QGis, QgsProject, QgsVectorFileWriter, QgsMapLayer, QgsRasterLayer, \
QgsVectorLayer, QgsMapLayerRegistry, QgsCoordinateReferenceSystem QgsVectorLayer, QgsMapLayerRegistry, QgsCoordinateReferenceSystem
from qgis.gui import QgsSublayersDialog from qgis.gui import QgsSublayersDialog
from qgis.PyQt.QtCore import QSettings from qgis.PyQt.QtCore import QSettings
from qgis.utils import iface from qgis.utils import iface
Expand Down
2 changes: 1 addition & 1 deletion python/plugins/processing/tools/vector.py
Expand Up @@ -580,7 +580,7 @@ def __init__(self, destination, encoding, fields, geometryType,
print uri.uri() print uri.uri()
try: try:
db = postgis.GeoDB(host=uri.host(), port=int(uri.port()), db = postgis.GeoDB(host=uri.host(), port=int(uri.port()),
dbname=uri.database(), user=user, passwd=passwd) dbname=uri.database(), user=user, passwd=passwd)
except postgis.DbError as e: except postgis.DbError as e:
raise GeoAlgorithmExecutionException( raise GeoAlgorithmExecutionException(
"Couldn't connect to database:\n%s" % e.message) "Couldn't connect to database:\n%s" % e.message)
Expand Down
134 changes: 67 additions & 67 deletions src/providers/mssql/qgsmssqlprovider.cpp
Expand Up @@ -1985,22 +1985,22 @@ QGISEXTERN bool saveStyle( const QString& uri, const QString& qmlStyle, const QS
} }
if ( query.isActive() && query.next() && query.value( 0 ).toInt() == 0 ) if ( query.isActive() && query.next() && query.value( 0 ).toInt() == 0 )
{ {
QgsDebugMsg( "Need to create styles table" ); QgsDebugMsg( "Need to create styles table" );
bool execOk = query.exec( QString( "CREATE TABLE [dbo].[layer_styles](" bool execOk = query.exec( QString( "CREATE TABLE [dbo].[layer_styles]("
"[id] int IDENTITY(1,1) PRIMARY KEY," "[id] int IDENTITY(1,1) PRIMARY KEY,"
"[f_table_catalog] [varchar](1024) NULL," "[f_table_catalog] [varchar](1024) NULL,"
"[f_table_schema] [varchar](1024) NULL," "[f_table_schema] [varchar](1024) NULL,"
"[f_table_name] [varchar](1024) NULL," "[f_table_name] [varchar](1024) NULL,"
"[f_geometry_column] [varchar](1024) NULL," "[f_geometry_column] [varchar](1024) NULL,"
"[styleName] [varchar](1024) NULL," "[styleName] [varchar](1024) NULL,"
"[styleQML] [text] NULL," "[styleQML] [text] NULL,"
"[styleSLD] [text] NULL," "[styleSLD] [text] NULL,"
"[useAsDefault] [int] NULL," "[useAsDefault] [int] NULL,"
"[description] [text] NULL," "[description] [text] NULL,"
"[owner] [varchar](1024) NULL," "[owner] [varchar](1024) NULL,"
"[ui] [text] NULL," "[ui] [text] NULL,"
"[update_time] [datetime] NULL" "[update_time] [datetime] NULL"
") ON [PRIMARY] TEXTIMAGE_ON [PRIMARY]" )); ") ON [PRIMARY] TEXTIMAGE_ON [PRIMARY]" ) );
if ( !execOk ) if ( !execOk )
{ {
errCause = QObject::tr( "Unable to save layer style. It's not possible to create the destination table on the database. Maybe this is due to table permissions. Please contact your database admin" ); errCause = QObject::tr( "Unable to save layer style. It's not possible to create the destination table on the database. Maybe this is due to table permissions. Please contact your database admin" );
Expand Down Expand Up @@ -2036,8 +2036,8 @@ QGISEXTERN bool saveStyle( const QString& uri, const QString& qmlStyle, const QS
.arg( QgsMssqlProvider::quotedValue( qmlStyle ) ) .arg( QgsMssqlProvider::quotedValue( qmlStyle ) )
.arg( QgsMssqlProvider::quotedValue( sldStyle ) ) .arg( QgsMssqlProvider::quotedValue( sldStyle ) )
.arg( useAsDefault ? "1" : "0" ) .arg( useAsDefault ? "1" : "0" )
.arg( QgsMssqlProvider::quotedValue( styleDescription.isEmpty() ? QDateTime::currentDateTime().toString() : styleDescription ) ) .arg( QgsMssqlProvider::quotedValue( styleDescription.isEmpty() ? QDateTime::currentDateTime().toString() : styleDescription ) )
.arg( QgsMssqlProvider::quotedValue( dsUri.username() ) ) .arg( QgsMssqlProvider::quotedValue( dsUri.username() ) )
.arg( uiFileColumn ) .arg( uiFileColumn )
.arg( uiFileValue ); .arg( uiFileValue );


Expand All @@ -2048,31 +2048,31 @@ QGISEXTERN bool saveStyle( const QString& uri, const QString& qmlStyle, const QS
" AND f_table_name=%3" " AND f_table_name=%3"
" AND f_geometry_column=%4" " AND f_geometry_column=%4"
" AND styleName=%5" ) " AND styleName=%5" )
.arg( QgsMssqlProvider::quotedValue(dsUri.database() ) ) .arg( QgsMssqlProvider::quotedValue( dsUri.database() ) )
.arg( QgsMssqlProvider::quotedValue(dsUri.schema() ) ) .arg( QgsMssqlProvider::quotedValue( dsUri.schema() ) )
.arg( QgsMssqlProvider::quotedValue(dsUri.table() ) ) .arg( QgsMssqlProvider::quotedValue( dsUri.table() ) )
.arg( QgsMssqlProvider::quotedValue(dsUri.geometryColumn() ) ) .arg( QgsMssqlProvider::quotedValue( dsUri.geometryColumn() ) )
.arg( QgsMssqlProvider::quotedValue(styleName.isEmpty() ? dsUri.table() : styleName ) ); .arg( QgsMssqlProvider::quotedValue( styleName.isEmpty() ? dsUri.table() : styleName ) );


if ( !query.exec( checkQuery ) ) if ( !query.exec( checkQuery ) )
{ {
QgsDebugMsg( query.lastError().text() ); QgsDebugMsg( query.lastError().text() );
QgsDebugMsg("Check Query failed"); QgsDebugMsg( "Check Query failed" );
return false; return false;
} }
if ( query.isActive() && query.next() && query.value( 0 ).toString() == styleName ) if ( query.isActive() && query.next() && query.value( 0 ).toString() == styleName )
{ {
if ( QMessageBox::question( nullptr, QObject::tr( "Save style in database" ), if ( QMessageBox::question( nullptr, QObject::tr( "Save style in database" ),
QObject::tr( "A style named \"%1\" already exists in the database for this layer. Do you want to overwrite it?" ) QObject::tr( "A style named \"%1\" already exists in the database for this layer. Do you want to overwrite it?" )
.arg( styleName.isEmpty() ? dsUri.table() : styleName ), .arg( styleName.isEmpty() ? dsUri.table() : styleName ),
QMessageBox::Yes | QMessageBox::No ) == QMessageBox::No ) QMessageBox::Yes | QMessageBox::No ) == QMessageBox::No )
{ {
errCause = QObject::tr( "Operation aborted. No changes were made in the database" ); errCause = QObject::tr( "Operation aborted. No changes were made in the database" );
QgsDebugMsg("User selected not to overwrite styles"); QgsDebugMsg( "User selected not to overwrite styles" );
return false; return false;
} }


QgsDebugMsg("Updating styles"); QgsDebugMsg( "Updating styles" );
sql = QString( "UPDATE layer_styles " sql = QString( "UPDATE layer_styles "
" SET useAsDefault=%1" " SET useAsDefault=%1"
",styleQML=%2" ",styleQML=%2"
Expand Down Expand Up @@ -2110,8 +2110,8 @@ QGISEXTERN bool saveStyle( const QString& uri, const QString& qmlStyle, const QS
sql = QString( "%1; %2;" ).arg( removeDefaultSql, sql ); sql = QString( "%1; %2;" ).arg( removeDefaultSql, sql );
} }


QgsDebugMsg("Inserting styles"); QgsDebugMsg( "Inserting styles" );
QgsDebugMsg(sql); QgsDebugMsg( sql );
bool execOk = query.exec( sql ); bool execOk = query.exec( sql );


if ( !execOk ) if ( !execOk )
Expand Down Expand Up @@ -2151,20 +2151,20 @@ QGISEXTERN QString loadStyle( const QString& uri, QString& errCause )
.arg( QgsMssqlProvider::quotedValue( dsUri.table() ) ) .arg( QgsMssqlProvider::quotedValue( dsUri.table() ) )
.arg( QgsMssqlProvider::quotedValue( dsUri.geometryColumn() ) ); .arg( QgsMssqlProvider::quotedValue( dsUri.geometryColumn() ) );


if ( !query.exec( selectQmlQuery ) ) if ( !query.exec( selectQmlQuery ) )
{ {
QgsDebugMsg("Load of style failed"); QgsDebugMsg( "Load of style failed" );
QString msg = query.lastError().text(); QString msg = query.lastError().text();
errCause = msg; errCause = msg;
QgsDebugMsg( msg ); QgsDebugMsg( msg );
return QString(); return QString();
} }
if ( query.isActive() && query.next()) if ( query.isActive() && query.next() )
{ {
QString style = query.value( 0 ).toString(); QString style = query.value( 0 ).toString();
return style; return style;
} }
return QString(); return QString();
} }


QGISEXTERN int listStyles( const QString &uri, QStringList &ids, QStringList &names, QGISEXTERN int listStyles( const QString &uri, QStringList &ids, QStringList &names,
Expand Down Expand Up @@ -2208,19 +2208,19 @@ QGISEXTERN int listStyles( const QString &uri, QStringList &ids, QStringList &na
.arg( QgsMssqlProvider::quotedValue( dsUri.schema() ) ) .arg( QgsMssqlProvider::quotedValue( dsUri.schema() ) )
.arg( QgsMssqlProvider::quotedValue( dsUri.table() ) ) .arg( QgsMssqlProvider::quotedValue( dsUri.table() ) )
.arg( QgsMssqlProvider::quotedValue( dsUri.geometryColumn() ) ); .arg( QgsMssqlProvider::quotedValue( dsUri.geometryColumn() ) );
bool queryOk = query.exec(selectRelatedQuery); bool queryOk = query.exec( selectRelatedQuery );
if(!queryOk) if ( !queryOk )
{ {
QgsDebugMsg( query.lastError().text() ); QgsDebugMsg( query.lastError().text() );
return -1; return -1;
} }
int numberOfRelatedStyles = 0; int numberOfRelatedStyles = 0;
while( query.isActive() && query.next()) while ( query.isActive() && query.next() )
{ {
QgsDebugMsg(query.value(1).toString()); QgsDebugMsg( query.value( 1 ).toString() );
ids.append( query.value(0).toString() ); ids.append( query.value( 0 ).toString() );
names.append( query.value(1).toString() ); names.append( query.value( 1 ).toString() );
descriptions.append( query.value(2).toString() ); descriptions.append( query.value( 2 ).toString() );
numberOfRelatedStyles = numberOfRelatedStyles + 1; numberOfRelatedStyles = numberOfRelatedStyles + 1;
} }
QString selectOthersQuery = QString( "SELECT id,styleName,description" QString selectOthersQuery = QString( "SELECT id,styleName,description"
Expand All @@ -2231,20 +2231,20 @@ QGISEXTERN int listStyles( const QString &uri, QStringList &ids, QStringList &na
.arg( QgsMssqlProvider::quotedValue( dsUri.schema() ) ) .arg( QgsMssqlProvider::quotedValue( dsUri.schema() ) )
.arg( QgsMssqlProvider::quotedValue( dsUri.table() ) ) .arg( QgsMssqlProvider::quotedValue( dsUri.table() ) )
.arg( QgsMssqlProvider::quotedValue( dsUri.geometryColumn() ) ); .arg( QgsMssqlProvider::quotedValue( dsUri.geometryColumn() ) );
QgsDebugMsg(selectOthersQuery); QgsDebugMsg( selectOthersQuery );
queryOk = query.exec(selectOthersQuery); queryOk = query.exec( selectOthersQuery );
if(!queryOk) if ( !queryOk )
{ {
QString msg = query.lastError().text(); QString msg = query.lastError().text();
QgsDebugMsg( msg ); QgsDebugMsg( msg );
return -1; return -1;
} }
QgsDebugMsg(query.isActive() && query.size()); QgsDebugMsg( query.isActive() && query.size() );
while(query.next()) while ( query.next() )
{ {
ids.append( query.value(0).toString() ); ids.append( query.value( 0 ).toString() );
names.append( query.value(1).toString() ); names.append( query.value( 1 ).toString() );
descriptions.append( query.value(2).toString() ); descriptions.append( query.value( 2 ).toString() );
} }
return numberOfRelatedStyles; return numberOfRelatedStyles;
} }
Expand All @@ -2266,17 +2266,17 @@ QGISEXTERN QString getStyleById( const QString& uri, QString styleId, QString& e


QString style = ""; QString style = "";
QString selectQmlQuery = QString( "SELECT styleQml FROM layer_styles WHERE id=%1" ).arg( QgsMssqlProvider::quotedValue( styleId ) ); QString selectQmlQuery = QString( "SELECT styleQml FROM layer_styles WHERE id=%1" ).arg( QgsMssqlProvider::quotedValue( styleId ) );
bool queryOk = query.exec(selectQmlQuery); bool queryOk = query.exec( selectQmlQuery );
if(!queryOk) if ( !queryOk )
{ {
QString msg = query.lastError().text(); QString msg = query.lastError().text();
QgsDebugMsg( msg ); QgsDebugMsg( msg );
errCause = query.lastError().text(); errCause = query.lastError().text();
return QString( ); return QString( );
} }
while(query.next()) while ( query.next() )
{ {
style = query.value(0).toString(); style = query.value( 0 ).toString();
} }
return style; return style;
} }

0 comments on commit 3a005cd

Please sign in to comment.