@@ -18,6 +18,7 @@ const static QString keyItemAlignment = "Item_Alignment";
1818const static QString keyIndicatorStyle = " Indicator_Style" ;
1919const static QString keyPluginsVisible = " Plugins_Visible" ;
2020const static QString keyShowInPrimary = " Show_In_Primary" ;
21+ const static QString keyLocked = " Locked" ;
2122
2223namespace dock {
2324
@@ -131,6 +132,7 @@ DockSettings::DockSettings(QObject* parent)
131132 , m_dockPosition(dock::Bottom)
132133 , m_alignment(dock::CenterAlignment)
133134 , m_style(dock::Fashion)
135+ , m_locked(false )
134136{
135137 m_writeTimer->setSingleShot (true );
136138 m_writeTimer->setInterval (1000 );
@@ -147,6 +149,7 @@ void DockSettings::init()
147149 m_style = string2IndicatorStyle (m_dockConfig->value (keyIndicatorStyle).toString ());
148150 m_pluginsVisible = m_dockConfig->value (keyPluginsVisible).toMap ();
149151 m_showInPrimary = m_dockConfig->value (keyShowInPrimary).toBool ();
152+ m_locked = m_dockConfig->value (keyLocked).toBool ();
150153
151154 connect (m_dockConfig.data (), &DConfig::valueChanged, this , [this ](const QString& key){
152155 if (keyDockSize == key) {
@@ -182,6 +185,11 @@ void DockSettings::init()
182185 if (showInPrimary == m_showInPrimary) return ;
183186 m_showInPrimary = showInPrimary;
184187 Q_EMIT showInPrimaryChanged (m_showInPrimary);
188+ } else if (keyLocked == key) {
189+ auto locked = m_dockConfig->value (keyLocked).toBool ();
190+ if (locked == m_locked) return ;
191+ m_locked = locked;
192+ Q_EMIT lockedChanged (m_locked);
185193 }
186194 });
187195 } else {
@@ -289,6 +297,21 @@ bool DockSettings::showInPrimary() const
289297 return m_showInPrimary;
290298}
291299
300+ bool DockSettings::locked () const
301+ {
302+ return m_locked;
303+ }
304+
305+ void DockSettings::setLocked (bool newLocked)
306+ {
307+ if (m_locked == newLocked) {
308+ return ;
309+ }
310+ m_locked = newLocked;
311+ m_dockConfig->setValue (keyLocked, m_locked);
312+ Q_EMIT lockedChanged (m_locked);
313+ }
314+
292315void DockSettings::addWriteJob (WriteJob job)
293316{
294317 if (m_writeJob.contains (job)) return ;
@@ -346,5 +369,4 @@ void DockSettings::checkWriteJob()
346369 m_writeTimer->start ();
347370}
348371
349-
350372}
0 commit comments