Skip to content

Commit dcd99ad

Browse files
committedMay 29, 2017
avoid slashes in connection names (followup 30900e9; fixes #16624)
(cherry picked from commit 8c873b1)
1 parent dae921c commit dcd99ad

File tree

5 files changed

+14
-10
lines changed

5 files changed

+14
-10
lines changed
 

‎src/app/ogr/qgsnewogrconnection.cpp

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@
1616
***************************************************************************/
1717
#include <QSettings>
1818
#include <QMessageBox>
19+
#include <QRegExpValidator>
1920

2021
#include "qgsnewogrconnection.h"
2122
#include "qgscontexthelp.h"
@@ -66,6 +67,7 @@ QgsNewOgrConnection::QgsNewOgrConnection( QWidget *parent, const QString& connTy
6667
}
6768
cmbDatabaseTypes->setCurrentIndex( cmbDatabaseTypes->findText( connType ) );
6869
txtName->setText( connName );
70+
txtName->setValidator( new QRegExpValidator( QRegExp( "[^\\/]+" ), txtName ) );
6971
txtName->setEnabled( false );
7072
cmbDatabaseTypes->setEnabled( false );
7173
}

‎src/providers/db2/qgsdb2newconnection.cpp

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -19,12 +19,9 @@
1919
#include <QSettings>
2020
#include <QInputDialog>
2121
#include <QMessageBox>
22-
#include <QLabel>
23-
#include <qgslogger.h>
24-
#include <qlistwidget.h>
25-
26-
#include <QtSql/QSqlDatabase>
27-
#include <QtSql/QSqlError>
22+
#include <QSqlDatabase>
23+
#include <QSqlError>
24+
#include <QRegExpValidator>
2825

2926
#include "qgsdb2newconnection.h"
3027
#include "qgsdb2dataitems.h"
@@ -76,6 +73,7 @@ QgsDb2NewConnection::QgsDb2NewConnection( QWidget *parent, const QString& connNa
7673
}
7774

7875
txtName->setText( connName );
76+
txtName->setValidator( new QRegExpValidator( QRegExp( "[^\\/]+" ), txtName ) );
7977
}
8078
}
8179

‎src/providers/mssql/qgsmssqlnewconnection.cpp

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -18,9 +18,9 @@
1818
#include <QSettings>
1919
#include <QInputDialog>
2020
#include <QMessageBox>
21-
22-
#include <QtSql/QSqlDatabase>
23-
#include <QtSql/QSqlError>
21+
#include <QSqlDatabase>
22+
#include <QSqlError>
23+
#include <QRegExpValidator>
2424

2525
#include "qgsmssqlnewconnection.h"
2626
#include "qgsmssqlprovider.h"
@@ -63,6 +63,7 @@ QgsMssqlNewConnection::QgsMssqlNewConnection( QWidget *parent, const QString& co
6363
}
6464

6565
txtName->setText( connName );
66+
txtName->setValidator( new QRegExpValidator( QRegExp( "[^\\/]+" ), txtName ) );
6667
}
6768
on_cb_trustedConnection_clicked();
6869
}

‎src/providers/oracle/qgsoraclenewconnection.cpp

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@
1818
#include <QSettings>
1919
#include <QMessageBox>
2020
#include <QInputDialog>
21+
#include <QRegExpValidator>
2122

2223
#include "qgsoraclenewconnection.h"
2324
#include "qgscontexthelp.h"
@@ -79,6 +80,7 @@ QgsOracleNewConnection::QgsOracleNewConnection( QWidget *parent, const QString&
7980
}
8081

8182
txtName->setText( connName );
83+
txtName->setValidator( new QRegExpValidator( QRegExp( "[^\\/]+" ), txtName ) );
8284
}
8385
}
8486
/** Autoconnected SLOTS **/

‎src/providers/postgres/qgspgnewconnection.cpp

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@
1818
#include <QSettings>
1919
#include <QMessageBox>
2020
#include <QInputDialog>
21+
#include <QRegExpValidator>
2122

2223
#include "qgspgnewconnection.h"
2324
#include "qgsauthmanager.h"
@@ -100,8 +101,8 @@ QgsPgNewConnection::QgsPgNewConnection( QWidget *parent, const QString& connName
100101
tabAuthentication->setCurrentIndex( tabAuthentication->indexOf( mAuthConfigSelect ) );
101102
}
102103

103-
104104
txtName->setText( connName );
105+
txtName->setValidator( new QRegExpValidator( QRegExp( "[^\\/]+" ), txtName ) );
105106
}
106107
}
107108
/** Autoconnected SLOTS **/

0 commit comments

Comments
 (0)
Please sign in to comment.