fix(ui): improve message when storage does not exist (#1152)

This commit is contained in:
Gianluca Recchia 2019-11-11 05:46:47 +01:00 committed by Oleg Shparber
parent e07015a225
commit 5b809d87fe
2 changed files with 8 additions and 7 deletions

View File

@ -83,7 +83,9 @@ DocsetsDialog::DocsetsDialog(Core::Application *app, QWidget *parent)
qt_ntfs_permission_lookup++;
#endif
m_isStorageReadOnly = !QFileInfo(m_application->settings()->docsetPath).isWritable();
const QFileInfo fi(m_application->settings()->docsetPath);
m_isStorageReadOnly = !fi.isWritable();
#ifdef Q_OS_WIN32
qt_ntfs_permission_lookup--;
@ -95,7 +97,10 @@ DocsetsDialog::DocsetsDialog(Core::Application *app, QWidget *parent)
#endif
ui->statusLabel->clear(); // Clear text shown in the designer mode.
ui->readOnlyLabel->setVisible(m_isStorageReadOnly);
ui->storageStatusLabel->setVisible(m_isStorageReadOnly);
ui->storageStatusLabel->setText(fi.exists() ?
QStringLiteral("<b>Docset storage is read only.</b>") :
QStringLiteral("<b>Docset storage does not exist.</b>"));
connect(m_application, &Core::Application::extractionCompleted,
this, &DocsetsDialog::extractionCompleted);

View File

@ -218,11 +218,7 @@
</spacer>
</item>
<item>
<widget class="QLabel" name="readOnlyLabel">
<property name="text">
<string>&lt;b&gt;Docset storage is read only.&lt;/b&gt;</string>
</property>
</widget>
<widget class="QLabel" name="storageStatusLabel"/>
</item>
<item>
<widget class="QDialogButtonBox" name="buttonBox">