Skip to content
Permalink
Browse files

Move apply button next to browse and disable keep when apply is trigg…

…ered
  • Loading branch information
elpaso committed Nov 8, 2018
1 parent 0bd9021 commit 85f8ba359fc42f0ef2eec88c15eae05b8eecc05c
Showing with 7 additions and 4 deletions.
  1. +5 −3 src/app/qgshandlebadlayers.cpp
  2. +1 −0 src/app/qgshandlebadlayers.h
  3. +1 −1 src/ui/qgshandlebadlayersbase.ui
@@ -44,7 +44,6 @@ void QgsHandleBadLayersHandler::handleBadLayers( const QList<QDomNode> &layers )

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

connect( mLayerList, &QTableWidget::itemSelectionChanged, this, &QgsHandleBadLayers::selectionChanged );
connect( mBrowseButton, &QAbstractButton::clicked, this, &QgsHandleBadLayers::browseClicked );
connect( buttonBox->button( QDialogButtonBox::Apply ), &QAbstractButton::clicked, this, &QgsHandleBadLayers::apply );
connect( mApplyButton, &QAbstractButton::clicked, this, &QgsHandleBadLayers::apply );
connect( buttonBox->button( QDialogButtonBox::Ignore ), &QPushButton::clicked, this, &QgsHandleBadLayers::reject );
connect( buttonBox->button( QDialogButtonBox::Discard ), &QPushButton::clicked, this, &QgsHandleBadLayers::accept );

@@ -352,7 +354,7 @@ void QgsHandleBadLayers::editAuthCfg()
void QgsHandleBadLayers::apply()
{
QgsProject::instance()->layerTreeRegistryBridge()->setEnabled( true );

buttonBox->button( QDialogButtonBox::Ignore )->setEnabled( false );
QList<QgsMapLayer *> toRemove;
for ( const auto &l : QgsProject::instance()->mapLayers( ) )
{
@@ -57,6 +57,7 @@ class APP_EXPORT QgsHandleBadLayers

private:
QPushButton *mBrowseButton = nullptr;
QPushButton *mApplyButton = nullptr;
const QList<QDomNode> &mLayers;
QList<int> mRows;
QString mVectorFileFilter;
@@ -27,7 +27,7 @@
<enum>Qt::Horizontal</enum>
</property>
<property name="standardButtons">
<set>QDialogButtonBox::Apply|QDialogButtonBox::Discard|QDialogButtonBox::Ignore</set>
<set>QDialogButtonBox::Discard|QDialogButtonBox::Ignore</set>
</property>
</widget>
</item>

0 comments on commit 85f8ba3

Please sign in to comment.
You can’t perform that action at this time.