dont_overwrite_symbol.diff

Proposed patch - Alexander Bruy, 2011-01-13 09:18 AM

Download (2.07 KB)

View differences:

src/gui/symbology-ng/qgsstylev2managerdialog.cpp (working copy)
13 13

  
14 14
#include <QFile>
15 15
#include <QInputDialog>
16
#include <QMessageBox>
16 17
#include <QStandardItemModel>
17 18

  
18 19
#include "qgsapplication.h"
......
231 232
    return false;
232 233
  }
233 234

  
235
  // check if there is no symbol with same name
236
  if ( mStyle->symbolNames().contains( name ) )
237
  {
238
    int res = QMessageBox::warning( this, tr( "Save symbol" ),
239
                                    tr( "Symbol with name '%1' already exists. Overwrite?" )
240
                                    .arg( name ),
241
                                    QMessageBox::Yes | QMessageBox::No );
242
    if ( res != QMessageBox::Yes )
243
    {
244
      delete symbol;
245
      return false;
246
    }
247
  }
248

  
234 249
  // add new symbol to style and re-populate the list
235 250
  mStyle->addSymbol( name, symbol );
236 251
  mModified = true;
src/gui/symbology-ng/qgssymbolv2selectordialog.cpp (working copy)
14 14
#include <QPainter>
15 15
#include <QStandardItemModel>
16 16
#include <QInputDialog>
17
#include <QMessageBox>
17 18
#include <QKeyEvent>
18 19
#include <QMenu>
19 20

  
......
222 223
  if ( !ok || name.isEmpty() )
223 224
    return;
224 225

  
226
  // check if there is no symbol with same name
227
  if ( mStyle->symbolNames().contains( name ) )
228
  {
229
    int res = QMessageBox::warning( this, tr( "Save symbol" ),
230
                                    tr( "Symbol with name '%1' already exists. Overwrite?" )
231
                                    .arg( name ),
232
                                    QMessageBox::Yes | QMessageBox::No );
233
    if ( res != QMessageBox::Yes )
234
    {
235
      return;
236
    }
237
  }
238

  
225 239
  // add new symbol to style and re-populate the list
226 240
  mStyle->addSymbol( name, mSymbol->clone() );
227 241