mirror of
https://github.com/xiaoyifang/goldendict-ng.git
synced 2024-11-27 15:24:05 +00:00
Add option for turn on/off confirmation for favorites items deletion
This commit is contained in:
parent
b86f680d7d
commit
caf39bfdb5
|
@ -130,6 +130,7 @@ Preferences::Preferences():
|
|||
alwaysExpandOptionalParts( false )
|
||||
, historyStoreInterval( 0 )
|
||||
, favoritesStoreInterval( 0 )
|
||||
, confirmFavoritesDeletion( true )
|
||||
, collapseBigArticles( false )
|
||||
, articleSizeLimit( 2000 )
|
||||
, maxDictionaryRefsInContextMenu ( 20 )
|
||||
|
@ -825,6 +826,9 @@ Class load() throw( exError )
|
|||
if ( !preferences.namedItem( "favoritesStoreInterval" ).isNull() )
|
||||
c.preferences.favoritesStoreInterval = preferences.namedItem( "favoritesStoreInterval" ).toElement().text().toUInt() ;
|
||||
|
||||
if ( !preferences.namedItem( "confirmFavoritesDeletion" ).isNull() )
|
||||
c.preferences.confirmFavoritesDeletion = ( preferences.namedItem( "confirmFavoritesDeletion" ).toElement().text() == "1" );
|
||||
|
||||
if ( !preferences.namedItem( "collapseBigArticles" ).isNull() )
|
||||
c.preferences.collapseBigArticles = ( preferences.namedItem( "collapseBigArticles" ).toElement().text() == "1" );
|
||||
|
||||
|
@ -1666,6 +1670,10 @@ void save( Class const & c ) throw( exError )
|
|||
opt.appendChild( dd.createTextNode( QString::number( c.preferences.favoritesStoreInterval ) ) );
|
||||
preferences.appendChild( opt );
|
||||
|
||||
opt = dd.createElement( "confirmFavoritesDeletion" );
|
||||
opt.appendChild( dd.createTextNode( c.preferences.confirmFavoritesDeletion ? "1" : "0" ) );
|
||||
preferences.appendChild( opt );
|
||||
|
||||
{
|
||||
QDomElement proxy = dd.createElement( "proxyserver" );
|
||||
preferences.appendChild( proxy );
|
||||
|
|
|
@ -239,6 +239,8 @@ struct Preferences
|
|||
unsigned historyStoreInterval;
|
||||
unsigned favoritesStoreInterval;
|
||||
|
||||
bool confirmFavoritesDeletion;
|
||||
|
||||
bool collapseBigArticles;
|
||||
int articleSizeLimit;
|
||||
|
||||
|
|
|
@ -161,12 +161,15 @@ void FavoritesPaneWidget::deleteSelectedItems()
|
|||
return;
|
||||
}
|
||||
|
||||
QMessageBox mb( QMessageBox::Warning, "GoldenDict",
|
||||
tr( "All selected items will be deleted. Continue?" ),
|
||||
QMessageBox::Yes | QMessageBox::No );
|
||||
mb.exec();
|
||||
if( mb.result() != QMessageBox::Yes )
|
||||
return;
|
||||
if( m_cfg->preferences.confirmFavoritesDeletion )
|
||||
{
|
||||
QMessageBox mb( QMessageBox::Warning, "GoldenDict",
|
||||
tr( "All selected items will be deleted. Continue?" ),
|
||||
QMessageBox::Yes | QMessageBox::No );
|
||||
mb.exec();
|
||||
if( mb.result() != QMessageBox::Yes )
|
||||
return;
|
||||
}
|
||||
|
||||
m_favoritesModel->removeItemsForIndexes( selectedIdxs );
|
||||
}
|
||||
|
|
|
@ -195,6 +195,7 @@ Preferences::Preferences( QWidget * parent, Config::Class & cfg_ ):
|
|||
ui.alwaysExpandOptionalParts->setChecked( p.alwaysExpandOptionalParts );
|
||||
|
||||
ui.favoritesSaveIntervalField->setValue( p.favoritesStoreInterval );
|
||||
ui.confirmFavoritesDeletion->setChecked( p.confirmFavoritesDeletion );
|
||||
|
||||
ui.collapseBigArticles->setChecked( p.collapseBigArticles );
|
||||
ui.articleSizeLimit->setValue( p.articleSizeLimit );
|
||||
|
@ -375,6 +376,7 @@ Config::Preferences Preferences::getPreferences()
|
|||
p.alwaysExpandOptionalParts = ui.alwaysExpandOptionalParts->isChecked();
|
||||
|
||||
p.favoritesStoreInterval = ui.favoritesSaveIntervalField->text().toUInt();
|
||||
p.confirmFavoritesDeletion = ui.confirmFavoritesDeletion->isChecked();
|
||||
|
||||
p.collapseBigArticles = ui.collapseBigArticles->isChecked();
|
||||
p.articleSizeLimit = ui.articleSizeLimit->text().toInt();
|
||||
|
|
|
@ -1547,6 +1547,16 @@ It is not needed to select this option if you don't use such programs.</string>
|
|||
</item>
|
||||
</layout>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QCheckBox" name="confirmFavoritesDeletion">
|
||||
<property name="toolTip">
|
||||
<string>Turn this option on to confirm every operation of items deletion</string>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>Confirmation for items deletion</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<spacer name="verticalSpacer_15">
|
||||
<property name="orientation">
|
||||
|
|
Loading…
Reference in a new issue