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

Disabled create new documents while offline - #45

Open
renatofilho wants to merge 1 commit into
KDAB:masterfrom
renatofilho:disable-create-doc-while-offline
Open

renatofilho wants to merge 1 commit into
KDAB:masterfrom
renatofilho:disable-create-doc-while-offline

Conversation

@renatofilho

Copy link
Copy Markdown
Contributor

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

@dfaure-kdab dfaure-kdab left a comment

Copy link
Copy Markdown
Member

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

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

Copy link
Copy Markdown
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());

@dfaure-kdab dfaure-kdab left a comment

Copy link
Copy Markdown
Member

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.

2 participants