qgsnewhttpconnection.cpp_add_overwrite_prompt.patch

Patch for WMS connections dialog (add overwrite prompt) - Alexander Bruy, 2009-12-09 10:59 AM

Download (1.16 KB)

View differences:

src/app/qgsnewhttpconnection.cpp (working copy)
17 17
/* $Id$ */
18 18
#include "qgsnewhttpconnection.h"
19 19
#include "qgscontexthelp.h"
20
#include <QMessageBox>
20 21
#include <QSettings>
21 22

  
22 23
QgsNewHttpConnection::QgsNewHttpConnection(
......
51 52
void QgsNewHttpConnection::accept()
52 53
{
53 54
  QSettings settings;
55

  
56
  // check for existing coection with the same name
57
  settings.beginGroup( "/Qgis/connections-wms" );
58
  QStringList keys = settings.childGroups();
59
  if ( keys.contains( txtName->text() ) )
60
  {
61
    int res = QMessageBox::question( this,
62
                                     tr( "Save connection" ),
63
                                     tr( "Conection with name %1 already exists. Overwrite?" ).arg( txtName->text() ),
64
                                     QMessageBox::Yes | QMessageBox::No );
65
    if ( res != QMessageBox::Yes )
66
    {
67
      return;
68
    }
69
  }
70
  settings.endGroup();
71

  
54 72
  QString key = mBaseKey + txtName->text();
55 73
  QString credentialsKey = "/Qgis/WMS/" + txtName->text();
56 74