Skip to content
Permalink
Browse files

Use a more appropriate dialog title for message boxes

and capitalise first letters
  • Loading branch information
DelazJ committed Oct 25, 2017
1 parent 2614ca1 commit f5025cc6680bb70f1c3e2358a2112d5c4d84ac71
@@ -72,11 +72,11 @@ def select_file(self):
label = self.tr('eXtensible Markup Language (*.xml *.XML)')

if self.mode == 0:
slabel = self.tr('Save connections')
slabel = self.tr('Save Connections')
self.filename, filter = QFileDialog.getSaveFileName(self, slabel,
'.', label)
else:
slabel = self.tr('Load connections')
slabel = self.tr('Load Connections')
self.filename, selected_filter = QFileDialog.getOpenFileName(self, slabel,
'.', label)

@@ -59,13 +59,13 @@ def accept(self):
conn_password = self.lePassword.text().strip()

if any([conn_name == '', conn_url == '']):
QMessageBox.warning(self, self.tr('Save connection'),
self.tr('Both Name and URL must be provided'))
QMessageBox.warning(self, self.tr('Save Connection'),
self.tr('Both Name and URL must be provided.'))
return

if '/' in conn_name:
QMessageBox.warning(self, self.tr('Save connection'),
self.tr('Name cannot contain \'/\''))
QMessageBox.warning(self, self.tr('Save Connection'),
self.tr('Name cannot contain \'/\'.'))
return

if conn_name is not None:
@@ -76,7 +76,7 @@ def accept(self):
# warn if entry was renamed to an existing connection
if all([self.conn_name_orig != conn_name,
self.settings.contains(keyurl)]):
res = QMessageBox.warning(self, self.tr('Save connection'),
res = QMessageBox.warning(self, self.tr('Save Connection'),
self.tr('Overwrite {0}?').format(conn_name),
QMessageBox.Ok | QMessageBox.Cancel)
if res == QMessageBox.Cancel:
@@ -167,7 +167,8 @@ def deleteColumn(self):
m = self.viewFields.model()
fld = m.getObject(index)

res = QMessageBox.question(self, self.tr("Are you sure"), self.tr("Really delete column '{0}'?").format(fld.name),
res = QMessageBox.question(self, self.tr("Delete Column"),
self.tr("Are you sure you want to delete column '{0}'?").format(fld.name),
QMessageBox.Yes | QMessageBox.No)
if res != QMessageBox.Yes:
return
@@ -218,8 +219,8 @@ def deleteConstraint(self):
m = self.viewConstraints.model()
constr = m.getObject(index)

res = QMessageBox.question(self, self.tr("Are you sure"),
self.tr("Really delete constraint '{0}'?").format(constr.name),
res = QMessageBox.question(self, self.tr("Delete Constraint"),
self.tr("Are you sure you want to delete constraint '{0}'?").format(constr.name),
QMessageBox.Yes | QMessageBox.No)
if res != QMessageBox.Yes:
return
@@ -274,7 +275,7 @@ def createSpatialIndex(self):
QMessageBox.information(self, self.tr("DB Manager"), self.tr("The selected table has no geometry"))
return

res = QMessageBox.question(self, self.tr("Create?"),
res = QMessageBox.question(self, self.tr("Create Spatial Index"),
self.tr("Create spatial index for field {0}?").format(self.table.geomColumn),
QMessageBox.Yes | QMessageBox.No)
if res != QMessageBox.Yes:
@@ -308,7 +309,8 @@ def deleteIndex(self):
m = self.viewIndexes.model()
idx = m.getObject(index)

res = QMessageBox.question(self, self.tr("Are you sure"), self.tr("Really delete index '{0}'?").format(idx.name),
res = QMessageBox.question(self, self.tr("Delete Index"),
self.tr("Are you sure you want to delete index '{0}'?").format(idx.name),
QMessageBox.Yes | QMessageBox.No)
if res != QMessageBox.Yes:
return
@@ -142,7 +142,7 @@ def initWidgets(self):

def load(self):
filename, selected_filter = QFileDialog.getOpenFileName(self,
self.tr('Open batch'), None,
self.tr('Open Batch'), None,
self.tr('JSON files (*.json)'))
if filename:
with open(filename) as f:
@@ -216,7 +216,7 @@ def save(self):
toSave.append({self.PARAMETERS: algParams, self.OUTPUTS: algOutputs})

filename, __ = QFileDialog.getSaveFileName(self,
self.tr('Save batch'),
self.tr('Save Batch'),
None,
self.tr('JSON files (*.json)'))
if filename:
@@ -194,7 +194,7 @@ void QgsBookmarks::deleteClicked()
return;

// make sure the user really wants to delete these bookmarks
if ( QMessageBox::Cancel == QMessageBox::information( this, tr( "Really Delete?" ),
if ( QMessageBox::Cancel == QMessageBox::information( this, tr( "Delete Bookmarks" ),
tr( "Are you sure you want to delete %n bookmark(s)?", "number of rows", rows.size() ),
QMessageBox::Ok | QMessageBox::Cancel ) )
return;
@@ -236,7 +236,7 @@ void QgsBookmarks::zoomToBookmark()
rect = ct.transform( rect );
if ( rect.isEmpty() )
{
QMessageBox::warning( this, tr( "Empty extent" ), tr( "Reprojected extent is empty." ) );
QMessageBox::warning( this, tr( "Empty Extent" ), tr( "Reprojected extent is empty." ) );
return;
}
}
@@ -326,7 +326,7 @@ void QgsBookmarks::exportToXml()
QgsSettings settings;

QString lastUsedDir = settings.value( QStringLiteral( "Windows/Bookmarks/LastUsedDirectory" ), QDir::homePath() ).toString();
QString fileName = QFileDialog::getSaveFileName( this, tr( "Export bookmarks" ), lastUsedDir,
QString fileName = QFileDialog::getSaveFileName( this, tr( "Export Bookmarks" ), lastUsedDir,
tr( "XML files (*.xml *.XML)" ) );
if ( fileName.isEmpty() )
{
@@ -166,7 +166,7 @@ void QgsLoadStyleFromDBDialog::deleteStyleFromDB()
QString msgError;
QString opInfo = QObject::tr( "Delete style %1 from %2" ).arg( mSelectedStyleName, mLayer->providerType() );

if ( QMessageBox::question( nullptr, QObject::tr( "Delete style" ),
if ( QMessageBox::question( nullptr, QObject::tr( "Delete Style" ),
QObject::tr( "Are you sure you want to delete the style %1?" ).arg( mSelectedStyleName ),
QMessageBox::Yes | QMessageBox::No, QMessageBox::No ) != QMessageBox::Yes )
return;
@@ -133,7 +133,7 @@ void QgsMapThemes::replaceTriggered()
if ( !actionPreset )
return;

int res = QMessageBox::question( mMenu, tr( "Replace theme" ),
int res = QMessageBox::question( mMenu, tr( "Replace Theme" ),
trUtf8( "Are you sure you want to replace the existing theme “%1”?" ).arg( actionPreset->text() ),
QMessageBox::Yes | QMessageBox::No, QMessageBox::No );
if ( res != QMessageBox::Yes )
@@ -1732,7 +1732,7 @@ QStringList QgsOptions::i18nList()
void QgsOptions::restoreDefaultWindowState()
{
// richard
if ( QMessageBox::warning( this, tr( "Restore UI defaults" ), tr( "Are you sure to reset the UI to default (needs restart)?" ), QMessageBox::Ok | QMessageBox::Cancel ) == QMessageBox::Cancel )
if ( QMessageBox::warning( this, tr( "Restore UI Defaults" ), tr( "Are you sure to reset the UI to default (needs restart)?" ), QMessageBox::Ok | QMessageBox::Cancel ) == QMessageBox::Cancel )
return;
mSettings->setValue( QStringLiteral( "/qgis/restoreDefaultWindowState" ), true );
}
@@ -1581,9 +1581,9 @@ void QgsVectorLayerProperties::onAuxiliaryLayerClear()
if ( !alayer )
return;

const QString msg = tr( "Are you sure you want to clear auxiliary data for %1" ).arg( mLayer->name() );
const QString msg = tr( "Are you sure you want to clear auxiliary data for %1?" ).arg( mLayer->name() );
QMessageBox::StandardButton reply;
reply = QMessageBox::question( this, "Clear auxiliary data", msg, QMessageBox::Yes | QMessageBox::No );
reply = QMessageBox::question( this, "Clear Auxiliary Data", msg, QMessageBox::Yes | QMessageBox::No );

if ( reply == QMessageBox::Yes )
{
@@ -1601,9 +1601,9 @@ void QgsVectorLayerProperties::onAuxiliaryLayerDelete()
if ( !alayer )
return;

const QString msg = tr( "Are you sure you want to delete auxiliary storage for %1" ).arg( mLayer->name() );
const QString msg = tr( "Are you sure you want to delete auxiliary storage for %1?" ).arg( mLayer->name() );
QMessageBox::StandardButton reply;
reply = QMessageBox::question( this, "Delete auxiliary storage", msg, QMessageBox::Yes | QMessageBox::No );
reply = QMessageBox::question( this, "Delete Auxiliary Storage", msg, QMessageBox::Yes | QMessageBox::No );

if ( reply == QMessageBox::Yes )
{
@@ -1662,10 +1662,10 @@ void QgsVectorLayerProperties::onAuxiliaryLayerDeleteField()
return;

// should be only 1 field
const QString msg = tr( "Are you sure you want to delete auxiliary field %1 for %2" ).arg( item->text( 1 ), item->text( 0 ) );
const QString msg = tr( "Are you sure you want to delete auxiliary field %1 for %2?" ).arg( item->text( 1 ), item->text( 0 ) );

QMessageBox::StandardButton reply;
reply = QMessageBox::question( this, "Delete auxiliary field", msg, QMessageBox::Yes | QMessageBox::No );
reply = QMessageBox::question( this, "Delete Auxiliary Field", msg, QMessageBox::Yes | QMessageBox::No );

if ( reply == QMessageBox::Yes )
{
@@ -116,7 +116,7 @@ void QgsNewOgrConnection::accept()
if ( ( mOriginalConnName.isNull() || mOriginalConnName != txtName->text() ) &&
settings.contains( baseKey + txtName->text() + "/host" ) &&
QMessageBox::question( this,
tr( "Save connection" ),
tr( "Save Connection" ),
tr( "Should the existing connection %1 be overwritten?" ).arg( txtName->text() ),
QMessageBox::Ok | QMessageBox::Cancel ) == QMessageBox::Cancel )
{

0 comments on commit f5025cc

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