Add option to reset all config values to their default
Closes network/neochat#504
This commit is contained in:
@@ -414,4 +414,11 @@ bool Controller::csSupported() const
|
|||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void Controller::revertToDefaultConfig()
|
||||||
|
{
|
||||||
|
const auto config = NeoChatConfig::self();
|
||||||
|
config->setDefaults();
|
||||||
|
config->save();
|
||||||
|
}
|
||||||
|
|
||||||
#include "moc_controller.cpp"
|
#include "moc_controller.cpp"
|
||||||
|
|||||||
@@ -108,6 +108,14 @@ public:
|
|||||||
|
|
||||||
bool csSupported() const;
|
bool csSupported() const;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief Revert all configuration values to their default.
|
||||||
|
*
|
||||||
|
* The parameters along with their defaults are specified in the config file
|
||||||
|
* neochatconfig.kcfg.
|
||||||
|
*/
|
||||||
|
Q_INVOKABLE void revertToDefaultConfig();
|
||||||
|
|
||||||
private:
|
private:
|
||||||
explicit Controller(QObject *parent = nullptr);
|
explicit Controller(QObject *parent = nullptr);
|
||||||
|
|
||||||
|
|||||||
@@ -246,4 +246,13 @@ FormCard.FormCardPage {
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
FormCard.FormHeader {
|
||||||
|
title: i18nc("@title", "Default Settings")
|
||||||
|
}
|
||||||
|
FormCard.FormCard {
|
||||||
|
FormCard.FormButtonDelegate {
|
||||||
|
text: i18nc("@action:button", "Reset all configuration values to their default")
|
||||||
|
onClicked: Controller.revertToDefaultConfig()
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user