Compare commits
3 Commits
87eb4cdadd
...
bb6cd82f6d
Author | SHA1 | Date |
---|---|---|
Andrius Štikonas | bb6cd82f6d | |
Tomaz Canabrava | 4f0ff7b63a | |
Tomaz Canabrava | 90f6cb74d2 |
|
@ -116,6 +116,31 @@ void MainWindow::setupObjectNames()
|
|||
m_ScanProgressDialog->setObjectName(QStringLiteral("m_ScanProgressDialog"));
|
||||
}
|
||||
|
||||
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 select
|
||||
// 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();
|
||||
|
|
|
@ -50,6 +50,20 @@ public:
|
|||
|
||||
void setCurrentPartitionByName(const QString& partitionNumber);
|
||||
|
||||
// forbids the user to select another device.
|
||||
// this is used in conjunction with --device
|
||||
// rationale is that if the user specifies a device,
|
||||
// we can't allow him to select another one by mistake while
|
||||
// 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();
|
||||
|
|
|
@ -131,6 +131,9 @@ int Q_DECL_IMPORT main(int argc, char* argv[])
|
|||
if (partitionNr.length()) {
|
||||
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