@@ -61,6 +61,7 @@ extern "C" {
61
61
#include " ../../src/providers/grass/qgsgrassprovider.h"
62
62
63
63
// the gui subclass
64
+ #include " qgsgrassutils.h"
64
65
#include " qgsgrassattributes.h"
65
66
#include " qgsgrassselect.h"
66
67
#include " qgsgrassedit.h"
@@ -459,47 +460,11 @@ void QgsGrassPlugin::newVector()
459
460
bool ok;
460
461
QString name;
461
462
462
- while (1 )
463
- {
464
- name = QInputDialog::getText ( " New GRASS vector" ,
465
- " Enter new GRASS vector name:" , QLineEdit::Normal,
466
- name, &ok);
467
-
468
- if ( !ok ) return ;
469
-
470
- // Check if the name is valid
471
- name = name.stripWhiteSpace ();
472
-
473
- if ( name.isEmpty () ) {
474
- QMessageBox::warning ( 0 , " Warning" , " Enter vector name" );
475
- continue ;
476
- }
463
+ QgsGrassElementDialog dialog;
464
+ name = dialog.getItem ( " vector" , " New vector name" ,
465
+ " New vector name" , " " , " " , &ok );
477
466
478
- if ( Vect_legal_filename ( (char *) name.ascii () ) != 1 )
479
- {
480
- QMessageBox::warning ( 0 , " Warning" , " The name is not valid. "
481
- " A vector name can contain letters, digits and underscores "
482
- " and it must start with letter." );
483
- continue ;
484
- }
485
-
486
- // Check if exists
487
- QString head = QgsGrass::getDefaultGisdbase () + " /"
488
- + QgsGrass::getDefaultLocation () + " /"
489
- + QgsGrass::getDefaultMapset () + " /vector/"
490
- + name + " /head" ;
491
-
492
- QFile file (head);
493
- if ( file.exists () )
494
- {
495
- int ret = QMessageBox::question ( 0 , " Warning" , " The vector exists. "
496
- " Overwrite? " , QMessageBox::Yes, QMessageBox::No );
497
-
498
- if ( ret == QMessageBox::No ) continue ;
499
- }
500
-
501
- break ;
502
- }
467
+ if ( !ok ) return ;
503
468
504
469
// Create new map
505
470
QgsGrass::setMapset ( QgsGrass::getDefaultGisdbase (),
0 commit comments