Commit 8f99e4b7 authored by Alexander Semke's avatar Alexander Semke
Browse files

Properly reset to the default worksheet theme in the settings dialog.

parent 871aa103
......@@ -42,6 +42,9 @@ SettingsWorksheetPage::SettingsWorksheetPage(QWidget* parent) : SettingsPage(par
m_cbThemes = new ThemesComboBox();
ui.gridLayout->addWidget(m_cbThemes, 1, 4, 1, 1);
QString info = i18n("Default theme for newly created worksheets and worksheet objects");
ui.lTheme->setToolTip(info);
m_cbThemes->setToolTip(info);
const int size = ui.cbTexEngine->height();
ui.lLatexWarning->setPixmap( QIcon::fromTheme(QLatin1String("state-warning")).pixmap(size, size) );
......@@ -70,14 +73,17 @@ SettingsWorksheetPage::SettingsWorksheetPage(QWidget* parent) : SettingsPage(par
void SettingsWorksheetPage::applySettings() {
KConfigGroup group = KSharedConfig::openConfig()->group(QLatin1String("Settings_Worksheet"));
group.writeEntry(QLatin1String("Theme"), m_cbThemes->currentText());
if (m_cbThemes->currentText() == i18n("Default"))
group.writeEntry(QLatin1String("Theme"), QString());
else
group.writeEntry(QLatin1String("Theme"), m_cbThemes->currentText());
group.writeEntry(QLatin1String("PresenterModeInteractive"), ui.chkPresenterModeInteractive->isChecked());
group.writeEntry(QLatin1String("DoubleBuffering"), ui.chkDoubleBuffering->isChecked());
group.writeEntry(QLatin1String("LaTeXEngine"), ui.cbTexEngine->itemData(ui.cbTexEngine->currentIndex()));
}
void SettingsWorksheetPage::restoreDefaults() {
m_cbThemes->setCurrentIndex(0);
m_cbThemes->setItemText(0, i18n("Default")); //default theme
ui.chkPresenterModeInteractive->setChecked(false);
ui.chkDoubleBuffering->setChecked(true);
......
......@@ -33,6 +33,8 @@
#include <QGroupBox>
#include <QVBoxLayout>
#include <KLocalizedString>
/*!
\class ThemesComboBox
\brief Preview of all themes in a QComboBox.
......@@ -84,7 +86,10 @@ bool ThemesComboBox::eventFilter(QObject* object, QEvent* event) {
void ThemesComboBox::handleThemeChanged(const QString& theme) {
if (theme != currentText()) {
setItemText(0, theme);
if (theme.isEmpty())
setItemText(0, i18n("Default")); //default theme
else
setItemText(0, theme);
emit currentThemeChanged(theme);
}
......
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