Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
Ask for template name if missing
  • Loading branch information
m-kuhn committed May 15, 2019
1 parent 8a24d14 commit 81771dd
Showing 1 changed file with 16 additions and 1 deletion.
17 changes: 16 additions & 1 deletion src/app/qgisapp.cpp
Expand Up @@ -14445,7 +14445,22 @@ void QgisApp::populateProjectStorageMenu( QMenu *menu, bool saving )
QgsApplication::qgisSettingsDirPath() + "project_templates" ).toString();

const QString originalFilename = QgsProject::instance()->fileName();
const QString templateName = QFileInfo( originalFilename ).baseName();
QString templateName = QFileInfo( originalFilename ).baseName();

if ( templateName.isEmpty() )
{
bool ok;
templateName = QInputDialog::getText( this, tr( "Template Name" ),
tr( "Name for the template" ), QLineEdit::Normal,
QString(), &ok );

if ( !ok )
return;
if ( templateName.isEmpty() )
{
messageBar()->pushInfo( tr( "Template not saved" ), tr( "The template can not have an empty name." ) );
}
}
const QString filePath = templateDirName + QDir::separator() + templateName + QStringLiteral( ".qgz" );
if ( QFileInfo( filePath ).exists() )
{
Expand Down

0 comments on commit 81771dd

Please sign in to comment.