Skip to content
This repository has been archived by the owner on Sep 24, 2023. It is now read-only.

Disabled create new documents while offline #45

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

renatofilho
Copy link
Contributor

The 'Attach New Document' will be disabled while the app is running on offline mode.

Copy link
Member

@dfaure-kdab dfaure-kdab left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Instead of setting this up in all three Details classes, why not do it directly in Page::createItemEditWidget()?

i.e. instead of Page -> SimpleItemEditWidget -> Details,
just connect directly Page -> Details.
(not that intermediaries are a problem, but rather in this case to factorize code, AFAICS a single connect will be enough)

@renatofilho renatofilho force-pushed the disable-create-doc-while-offline branch from 7a3d4c1 to 54dd570 Compare December 11, 2017 17:57
@@ -186,6 +187,11 @@ void DocumentsWindow::loadDocumentsFor(const QString &id, LinkedItemType itemTyp
}
}

void DocumentsWindow::setCreateNewEnabled(bool enabled)
{
ui->attachButton->setEnabled(enabled);
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I like when disabled widgets give a hint about why they're disabled, so that the user can know what to do to enable it.
In this case this would mean something like this:

    if (!enabled)
        ui->attachButton->setToolTip(i18n("Attaching new documents requires being online"));
   else
        ui->attachButton->setToolTip(QString());

Copy link
Member

@dfaure-kdab dfaure-kdab left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good, just missing a tooltip.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants