Commit e30185cb authored by Benjamin Port's avatar Benjamin Port
Browse files

Add button to activate defaults highlighting

parent 43770644
......@@ -64,6 +64,7 @@ public:
QPushButton* mHelp = nullptr;
bool pageChangeSupressed = false;
bool mSaveStatistics = true;
bool mDefaultsIndicatorsVisible = false;
};
ModuleView::ModuleView( QWidget * parent )
......@@ -369,6 +370,7 @@ void ModuleView::activeModuleChanged(KPageWidgetItem * current, KPageWidgetItem
style()->pixelMetric(QStyle::PM_LayoutRightMargin),
style()->pixelMetric(QStyle::PM_LayoutBottomMargin));
}
moduleShowDefaultsIndicators(d->mDefaultsIndicatorsVisible);
}
}
......@@ -476,3 +478,11 @@ bool ModuleView::isResetVisible() const
return d->mReset->isVisible();
}
void ModuleView::moduleShowDefaultsIndicators(bool show)
{
d->mDefaultsIndicatorsVisible = show;
KCModuleProxy * activeModule = d->mPages.value( d->mPageWidget->currentPage() );
if( activeModule ) {
activeModule->setDefaultsIndicatorsVisible(show);
}
}
......@@ -137,6 +137,11 @@ public:
*/
bool isResetVisible() const;
/**
* Show or hide defaults indicators (field level)
*/
void moduleShowDefaultsIndicators(bool show);
public Q_SLOTS:
/**
* Loads the module specified by menuItem.\n
......@@ -193,6 +198,11 @@ Q_SIGNALS:
*/
void closeRequest();
/**
* Emmitted when showDefaultsIndicators state changed
*/
void showDefaultsIndicatorsChanged(bool show);
private:
class Private;
Private *const d;
......
......@@ -262,6 +262,7 @@ public:
emit sidebarMode->actionMenuVisibleChanged();
}
bool m_introPageVisible = true;
bool m_defaultsIndicatorsVisible = false;
};
SidebarMode::SidebarMode( QObject *parent, const QVariantList &args )
......@@ -606,6 +607,13 @@ void SidebarMode::setIntroPageVisible(const bool &introPageVisible)
emit introPageVisibleChanged();
}
void SidebarMode::toggleDefaultsIndicatorsVisibility()
{
d->m_defaultsIndicatorsVisible = !d->m_defaultsIndicatorsVisible;
d->moduleView->moduleShowDefaultsIndicators(d->m_defaultsIndicatorsVisible);
emit defaultsIndicatorsVisibleChanged();
}
int SidebarMode::width() const
{
return d->mainWidget->width();
......@@ -626,6 +634,11 @@ bool SidebarMode::introPageVisible() const
return (d->m_introPageVisible);
}
bool SidebarMode::defaultsIndicatorsVisible() const
{
return d->m_defaultsIndicatorsVisible;
}
void SidebarMode::initWidget()
{
// Create the widgets
......
......@@ -76,6 +76,7 @@ class SidebarMode : public BaseMode
Q_PROPERTY(int width READ width NOTIFY widthChanged)
Q_PROPERTY(bool actionMenuVisible READ actionMenuVisible NOTIFY actionMenuVisibleChanged)
Q_PROPERTY(bool introPageVisible READ introPageVisible WRITE setIntroPageVisible NOTIFY introPageVisibleChanged)
Q_PROPERTY(bool defaultsIndicatorsVisible READ defaultsIndicatorsVisible NOTIFY defaultsIndicatorsVisibleChanged)
public:
SidebarMode(QObject * parent, const QVariantList &args );
......@@ -103,6 +104,9 @@ public:
bool introPageVisible() const;
void setIntroPageVisible(const bool &introPageVisible);
bool defaultsIndicatorsVisible() const;
Q_INVOKABLE void toggleDefaultsIndicatorsVisibility();
Q_INVOKABLE QAction *action(const QString &name) const;
// QML doesn't understand QIcon, otherwise we could get it from the QAction itself
Q_INVOKABLE QString actionIconName(const QString &name) const;
......@@ -129,6 +133,7 @@ Q_SIGNALS:
void widthChanged();
void actionMenuVisibleChanged();
void introPageVisibleChanged();
void defaultsIndicatorsVisibleChanged();
private:
class Private;
......
......@@ -113,6 +113,7 @@ Kirigami.ScrollablePage {
? systemsettings.activeSearchRow
: systemsettings.activeCategoryRow
}
ListView {
id: categoryView
anchors.fill: parent
......@@ -196,4 +197,23 @@ Kirigami.ScrollablePage {
}
}
}
footer: Rectangle{
Kirigami.Theme.colorSet: Kirigami.Theme.Window
Kirigami.Theme.inherit: false
color: Kirigami.Theme.backgroundColor
width: mainColumn.width
height: Math.round(Kirigami.Units.gridUnit * 2)
QQC2.ToolButton {
anchors {
fill: parent
margins: Kirigami.Units.smallSpacing
}
text: i18nc("Action to show indicators for settings with custom data", "Highlight changed settings")
icon.name: "tools"
onClicked: systemsettings.toggleDefaultsIndicatorsVisibility()
checkable: true
checked: systemsettings.defaultsIndicatorsVisible
}
}
}
......@@ -179,4 +179,23 @@ Kirigami.ScrollablePage {
Keys.onReturnPressed: clicked();
}
}
footer: Rectangle{
Kirigami.Theme.colorSet: Kirigami.Theme.Window
Kirigami.Theme.inherit: false
color: Kirigami.Theme.backgroundColor
width: mainColumn.width
height: Math.round(Kirigami.Units.gridUnit * 2)
visible: !applicationWindow().wideScreen
QQC2.ToolButton {
anchors {
fill: parent
margins: Kirigami.Units.smallSpacing
}
text: i18nc("Action to show indicators for settings with custom data", "Highlight changed settings")
icon.name: "tools"
onClicked: systemsettings.toggleDefaultsIndicatorsVisibility()
checkable: true
checked: systemsettings.defaultsIndicatorsVisible
}
}
}
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment