Show devices dock panel when not passing --devices
This commit is contained in:
parent
90f6cb74d2
commit
4f0ff7b63a
|
@ -118,13 +118,29 @@ void MainWindow::setupObjectNames()
|
|||
|
||||
void MainWindow::setDisallowOtherDevices()
|
||||
{
|
||||
// We need to store that we are hiding this for this session only
|
||||
// but only if it's currently visible (ie, the user didn't selected
|
||||
// that it should be hidden on purpose.
|
||||
if (m_DockDevices->isVisible() == true) {
|
||||
Config::self()->setHideDeviceDockWidgetByCmdArgs(true);
|
||||
}
|
||||
|
||||
// because of how Qt works, the user still can enable the
|
||||
// dock widget via a mouse click, so we need to also set it to disabled.
|
||||
// so that the user doesn't select it by mistake.
|
||||
|
||||
m_DockDevices->setVisible(false);
|
||||
m_DockDevices->setEnabled(false);
|
||||
}
|
||||
|
||||
void MainWindow::showDevicePanelIfPreviouslyHiddenByDisallowOtherDevices()
|
||||
{
|
||||
if (Config::self()->hideDeviceDockWidgetByCmdArgs()) {
|
||||
m_DockDevices->setVisible(true);
|
||||
Config::self()->setHideDeviceDockWidgetByCmdArgs(false);
|
||||
}
|
||||
}
|
||||
|
||||
void MainWindow::init()
|
||||
{
|
||||
treeLog().init();
|
||||
|
|
|
@ -57,6 +57,13 @@ public:
|
|||
// clicking in the UI.
|
||||
void setDisallowOtherDevices();
|
||||
|
||||
// disallowOtherDevices hides the DockWidget, but unfortunately
|
||||
// this is saved by the Window State when restored, even if we
|
||||
// are not disallowing it this time. At the same time the user
|
||||
// could have hidden it, so we need to restore only if hidden
|
||||
// just by the call to disallowOtherDevices().
|
||||
void showDevicePanelIfPreviouslyHiddenByDisallowOtherDevices();
|
||||
|
||||
Q_SIGNALS:
|
||||
void settingsChanged();
|
||||
void scanFinished();
|
||||
|
|
|
@ -132,6 +132,8 @@ int Q_DECL_IMPORT main(int argc, char* argv[])
|
|||
mainWindow->setCurrentPartitionByName(selectedDevice);
|
||||
}
|
||||
mainWindow->setDisallowOtherDevices();
|
||||
} else {
|
||||
mainWindow->showDevicePanelIfPreviouslyHiddenByDisallowOtherDevices();
|
||||
}
|
||||
});
|
||||
|
||||
|
|
|
@ -167,5 +167,8 @@ SPDX-License-Identifier: GPL-3.0-or-later
|
|||
</choices>
|
||||
<default>random</default>
|
||||
</entry>
|
||||
<entry key="hideDeviceDockWidgetByCmdArgs" type="Bool">
|
||||
<default>false</default>
|
||||
</entry>
|
||||
</group>
|
||||
</kcfg>
|
||||
|
|
Loading…
Reference in New Issue