Skip to content

Commit 85f8ba3

Browse files
committedNov 8, 2018
Move apply button next to browse and disable keep when apply is triggered
1 parent 0bd9021 commit 85f8ba3

File tree

3 files changed

+7
-4
lines changed

3 files changed

+7
-4
lines changed
 

‎src/app/qgshandlebadlayers.cpp

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,6 @@ void QgsHandleBadLayersHandler::handleBadLayers( const QList<QDomNode> &layers )
4444

4545
dialog->buttonBox->button( QDialogButtonBox::Ignore )->setToolTip( tr( "Import all unavailable layers unmodified (you can fix them later)." ) );
4646
dialog->buttonBox->button( QDialogButtonBox::Ignore )->setText( tr( "Keep unavailable layers" ) );
47-
dialog->buttonBox->button( QDialogButtonBox::Apply )->setToolTip( tr( "Apply fixes to unavailable layers (remaining unavailable layers will be removed from the project)." ) );
4847
dialog->buttonBox->button( QDialogButtonBox::Discard )->setToolTip( tr( "Remove all unavailable layers from the project" ) );
4948
dialog->buttonBox->button( QDialogButtonBox::Discard )->setText( tr( "Remove unavailable layers" ) );
5049
dialog->buttonBox->button( QDialogButtonBox::Discard )->setIcon( QgsApplication::getThemeIcon( "/mActionDeleteSelected.svg" ) );
@@ -77,10 +76,13 @@ QgsHandleBadLayers::QgsHandleBadLayers( const QList<QDomNode> &layers )
7776
mBrowseButton = new QPushButton( tr( "Browse" ) );
7877
buttonBox->addButton( mBrowseButton, QDialogButtonBox::ActionRole );
7978
mBrowseButton->setDisabled( true );
79+
mApplyButton = new QPushButton( tr( "Apply changes" ) );
80+
mApplyButton->setToolTip( tr( "Apply fixes to unavailable layers (remaining unavailable layers will be removed from the project)." ) );
81+
buttonBox->addButton( mApplyButton, QDialogButtonBox::ActionRole );
8082

8183
connect( mLayerList, &QTableWidget::itemSelectionChanged, this, &QgsHandleBadLayers::selectionChanged );
8284
connect( mBrowseButton, &QAbstractButton::clicked, this, &QgsHandleBadLayers::browseClicked );
83-
connect( buttonBox->button( QDialogButtonBox::Apply ), &QAbstractButton::clicked, this, &QgsHandleBadLayers::apply );
85+
connect( mApplyButton, &QAbstractButton::clicked, this, &QgsHandleBadLayers::apply );
8486
connect( buttonBox->button( QDialogButtonBox::Ignore ), &QPushButton::clicked, this, &QgsHandleBadLayers::reject );
8587
connect( buttonBox->button( QDialogButtonBox::Discard ), &QPushButton::clicked, this, &QgsHandleBadLayers::accept );
8688

@@ -352,7 +354,7 @@ void QgsHandleBadLayers::editAuthCfg()
352354
void QgsHandleBadLayers::apply()
353355
{
354356
QgsProject::instance()->layerTreeRegistryBridge()->setEnabled( true );
355-
357+
buttonBox->button( QDialogButtonBox::Ignore )->setEnabled( false );
356358
QList<QgsMapLayer *> toRemove;
357359
for ( const auto &l : QgsProject::instance()->mapLayers( ) )
358360
{

‎src/app/qgshandlebadlayers.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -57,6 +57,7 @@ class APP_EXPORT QgsHandleBadLayers
5757

5858
private:
5959
QPushButton *mBrowseButton = nullptr;
60+
QPushButton *mApplyButton = nullptr;
6061
const QList<QDomNode> &mLayers;
6162
QList<int> mRows;
6263
QString mVectorFileFilter;

‎src/ui/qgshandlebadlayersbase.ui

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@
2727
<enum>Qt::Horizontal</enum>
2828
</property>
2929
<property name="standardButtons">
30-
<set>QDialogButtonBox::Apply|QDialogButtonBox::Discard|QDialogButtonBox::Ignore</set>
30+
<set>QDialogButtonBox::Discard|QDialogButtonBox::Ignore</set>
3131
</property>
3232
</widget>
3333
</item>

0 commit comments

Comments
 (0)
Please sign in to comment.