@@ -428,10 +428,14 @@ void QgsStyleManagerDialog::copyItemsToDefault()
428
428
if ( !items.empty () )
429
429
{
430
430
auto cursorOverride = qgis::make_unique< QgsTemporaryCursorOverride >( Qt::WaitCursor );
431
- copyItems ( items, mStyle , QgsStyle::defaultStyle (), this , cursorOverride, true , QStringList (), false , false );
431
+ const int count = copyItems ( items, mStyle , QgsStyle::defaultStyle (), this , cursorOverride, true , QStringList (), false , false );
432
432
cursorOverride.reset ();
433
- QMessageBox::information ( this , tr ( " Import Symbols" ),
434
- tr ( " Symbols successfully imported." ) );
433
+ if ( count > 0 )
434
+ {
435
+ QMessageBox::information ( this , tr ( " Import Symbols" ),
436
+ count > 1 ? tr ( " Successfully imported %1 items." ).arg ( count )
437
+ : tr ( " Successfully imported item." ) );
438
+ }
435
439
}
436
440
}
437
441
@@ -473,11 +477,12 @@ QList< QgsStyleManagerDialog::ItemDetails > QgsStyleManagerDialog::selectedItems
473
477
return res;
474
478
}
475
479
476
- void QgsStyleManagerDialog::copyItems ( const QList<QgsStyleManagerDialog::ItemDetails> &items, QgsStyle *src, QgsStyle *dst, QWidget *parentWidget,
477
- std::unique_ptr< QgsTemporaryCursorOverride > &cursorOverride, bool isImport, const QStringList &importTags, bool addToFavorites, bool ignoreSourceTags )
480
+ int QgsStyleManagerDialog::copyItems ( const QList<QgsStyleManagerDialog::ItemDetails> &items, QgsStyle *src, QgsStyle *dst, QWidget *parentWidget,
481
+ std::unique_ptr< QgsTemporaryCursorOverride > &cursorOverride, bool isImport, const QStringList &importTags, bool addToFavorites, bool ignoreSourceTags )
478
482
{
479
483
bool prompt = true ;
480
484
bool overwriteAll = true ;
485
+ int count = 0 ;
481
486
482
487
const QStringList favoriteSymbols = src->symbolsOfFavorite ( QgsStyle::SymbolEntity );
483
488
const QStringList favoriteColorramps = src->symbolsOfFavorite ( QgsStyle::ColorrampEntity );
@@ -521,7 +526,7 @@ void QgsStyleManagerDialog::copyItems( const QList<QgsStyleManagerDialog::ItemDe
521
526
switch ( res )
522
527
{
523
528
case QMessageBox::Cancel:
524
- return ;
529
+ return count ;
525
530
526
531
case QMessageBox::No:
527
532
continue ;
@@ -547,6 +552,7 @@ void QgsStyleManagerDialog::copyItems( const QList<QgsStyleManagerDialog::ItemDe
547
552
QgsSymbol *newSymbol = symbol.get ();
548
553
dst->addSymbol ( details.name , symbol.release () );
549
554
dst->saveSymbol ( details.name , newSymbol, addItemToFavorites, symbolTags );
555
+ count++;
550
556
}
551
557
break ;
552
558
}
@@ -573,7 +579,7 @@ void QgsStyleManagerDialog::copyItems( const QList<QgsStyleManagerDialog::ItemDe
573
579
switch ( res )
574
580
{
575
581
case QMessageBox::Cancel:
576
- return ;
582
+ return count ;
577
583
578
584
case QMessageBox::No:
579
585
continue ;
@@ -599,6 +605,7 @@ void QgsStyleManagerDialog::copyItems( const QList<QgsStyleManagerDialog::ItemDe
599
605
QgsColorRamp *newRamp = ramp.get ();
600
606
dst->addColorRamp ( details.name , ramp.release () );
601
607
dst->saveColorRamp ( details.name , newRamp, addItemToFavorites, symbolTags );
608
+ count++;
602
609
}
603
610
break ;
604
611
}
@@ -609,6 +616,7 @@ void QgsStyleManagerDialog::copyItems( const QList<QgsStyleManagerDialog::ItemDe
609
616
610
617
}
611
618
}
619
+ return count;
612
620
}
613
621
614
622
void QgsStyleManagerDialog::populateList ()
0 commit comments