@@ -2363,8 +2363,7 @@ QgsGrassModuleInput::QgsGrassModuleInput( QgsGrassModule *module,
2363
2363
2364
2364
QHBoxLayout *l = new QHBoxLayout ( this );
2365
2365
mLayerComboBox = new QComboBox ();
2366
- mLayerComboBox ->setSizePolicy ( QSizePolicy::Expanding,
2367
- QSizePolicy:: Preferred );
2366
+ mLayerComboBox ->setSizePolicy ( QSizePolicy::Expanding, QSizePolicy:: Preferred );
2368
2367
l->addWidget ( mLayerComboBox );
2369
2368
2370
2369
QString region = qdesc.attribute ( " region" );
@@ -2917,12 +2916,23 @@ QgsGrassModuleGdalInput::QgsGrassModuleGdalInput(
2917
2916
}
2918
2917
}
2919
2918
2920
- QHBoxLayout *l = new QHBoxLayout ( this );
2919
+ QVBoxLayout *l = new QVBoxLayout ( this );
2921
2920
mLayerComboBox = new QComboBox ();
2922
- mLayerComboBox ->setSizePolicy ( QSizePolicy::Expanding,
2923
- QSizePolicy:: Preferred );
2921
+ mLayerComboBox ->setSizePolicy ( QSizePolicy::Expanding, QSizePolicy:: Preferred );
2924
2922
l->addWidget ( mLayerComboBox );
2925
2923
2924
+ QLabel *lbl = new QLabel ( tr ( " Password" ) );
2925
+ l->addWidget ( lbl );
2926
+
2927
+ mLayerPassword = new QLineEdit ();
2928
+ mLayerPassword ->setEchoMode ( QLineEdit::Password );
2929
+ mLayerPassword ->setEnabled ( false );
2930
+ l->addWidget ( mLayerPassword );
2931
+
2932
+ lbl->setBuddy ( mLayerPassword );
2933
+
2934
+ connect ( mLayerComboBox , SIGNAL ( activated ( int ) ), this , SLOT ( changed ( int ) ) );
2935
+
2926
2936
// Of course, activated(int) is not enough, but there is no signal
2927
2937
// BEFORE the cobo is opened
2928
2938
// connect ( mLayerComboBox, SIGNAL( activated(int) ), this, SLOT(updateQgisLayers()) );
@@ -3069,8 +3079,16 @@ QStringList QgsGrassModuleGdalInput::options()
3069
3079
3070
3080
if ( current >= 0 && current < mUri .size () )
3071
3081
{
3072
- opt.append ( mUri [current] );
3082
+ QString uri = mUri [current];
3083
+
3084
+ if ( uri.startsWith ( " PG:" ) && uri.contains ( " password=" ) && !mLayerPassword ->text ().isEmpty () )
3085
+ {
3086
+ uri += " password=" + mLayerPassword ->text ();
3087
+ }
3088
+
3089
+ opt.append ( uri );
3073
3090
}
3091
+
3074
3092
list.push_back ( opt );
3075
3093
3076
3094
if ( !mOgrLayerOption .isEmpty () && mOgrLayers [current].size () > 0 )
@@ -3124,6 +3142,11 @@ QString QgsGrassModuleGdalInput::ready()
3124
3142
return error;
3125
3143
}
3126
3144
3145
+ void QgsGrassModuleGdalInput::changed ( int i )
3146
+ {
3147
+ mLayerPassword ->setEnabled ( i < mUri .size () && mUri [i].startsWith ( " PG:" ) && !mUri [i].contains ( " password=" ) );
3148
+ }
3149
+
3127
3150
QgsGrassModuleGdalInput::~QgsGrassModuleGdalInput ()
3128
3151
{
3129
3152
}
0 commit comments