diff --git a/src/config.cc b/src/config.cc
index 22bfb205..12440ea9 100644
--- a/src/config.cc
+++ b/src/config.cc
@@ -150,6 +150,7 @@ Preferences::Preferences():
doubleClickTranslates( true ),
selectWordBySingleClick( false ),
autoScrollToTargetArticle( true ),
+ targetArticleAtFirst( false ),
escKeyHidesMainWindow( false ),
alwaysOnTop( false ),
searchInDock( false ),
@@ -878,6 +879,11 @@ Class load()
( preferences.namedItem( "autoScrollToTargetArticle" ).toElement().text() == "1" );
}
+ if ( !preferences.namedItem( "targetArticleAtFirst" ).isNull() ) {
+ c.preferences.targetArticleAtFirst =
+ ( preferences.namedItem( "targetArticleAtFirst" ).toElement().text() == "1" );
+ }
+
if ( !preferences.namedItem( "escKeyHidesMainWindow" ).isNull() ) {
c.preferences.escKeyHidesMainWindow =
( preferences.namedItem( "escKeyHidesMainWindow" ).toElement().text() == "1" );
@@ -1815,6 +1821,10 @@ void save( Class const & c )
opt.appendChild( dd.createTextNode( c.preferences.autoScrollToTargetArticle ? "1" : "0" ) );
preferences.appendChild( opt );
+ opt = dd.createElement( "targetArticleAtFirst" );
+ opt.appendChild( dd.createTextNode( c.preferences.targetArticleAtFirst ? "1" : "0" ) );
+ preferences.appendChild( opt );
+
opt = dd.createElement( "escKeyHidesMainWindow" );
opt.appendChild( dd.createTextNode( c.preferences.escKeyHidesMainWindow ? "1" : "0" ) );
preferences.appendChild( opt );
diff --git a/src/config.hh b/src/config.hh
index cc9d4b75..9af058f8 100644
--- a/src/config.hh
+++ b/src/config.hh
@@ -297,6 +297,7 @@ struct Preferences
bool doubleClickTranslates;
bool selectWordBySingleClick;
bool autoScrollToTargetArticle;
+ bool targetArticleAtFirst;
bool escKeyHidesMainWindow;
bool alwaysOnTop;
diff --git a/src/ui/preferences.cc b/src/ui/preferences.cc
index becbe5b2..b8389364 100644
--- a/src/ui/preferences.cc
+++ b/src/ui/preferences.cc
@@ -185,6 +185,7 @@ Preferences::Preferences( QWidget * parent, Config::Class & cfg_ ):
ui.doubleClickTranslates->setChecked( p.doubleClickTranslates );
ui.selectBySingleClick->setChecked( p.selectWordBySingleClick );
ui.autoScrollToTargetArticle->setChecked( p.autoScrollToTargetArticle );
+ ui.targetArticleAtFirst->setChecked( p.targetArticleAtFirst );
ui.escKeyHidesMainWindow->setChecked( p.escKeyHidesMainWindow );
ui.darkMode->addItem( tr( "On" ), QVariant::fromValue( Config::Dark::On ) );
@@ -441,6 +442,7 @@ Config::Preferences Preferences::getPreferences()
p.doubleClickTranslates = ui.doubleClickTranslates->isChecked();
p.selectWordBySingleClick = ui.selectBySingleClick->isChecked();
p.autoScrollToTargetArticle = ui.autoScrollToTargetArticle->isChecked();
+ p.targetArticleAtFirst = ui.targetArticleAtFirst->isChecked();
p.escKeyHidesMainWindow = ui.escKeyHidesMainWindow->isChecked();
p.darkMode = ui.darkMode->currentData().value< Config::Dark >();
diff --git a/src/ui/preferences.ui b/src/ui/preferences.ui
index 6c2bba01..3f623607 100644
--- a/src/ui/preferences.ui
+++ b/src/ui/preferences.ui
@@ -169,6 +169,16 @@ however, the article from the topmost dictionary is shown.
+ -
+
+
+ Place the target article at the first place.
+
+
+ true
+
+
+
-