1
0
mirror of https://github.com/KDE/latte-dock.git synced 2025-01-11 13:18:13 +03:00

settings:store Details dialog size

This commit is contained in:
Michail Vourlakos 2021-03-31 12:04:13 +03:00
parent 089b24dbe5
commit e04dd29d89
2 changed files with 25 additions and 1 deletions

View File

@ -33,8 +33,11 @@ DetailsDialog::DetailsDialog(SettingsDialog *parent, Controller::Layouts *contro
: GenericDialog(parent),
m_parentDlg(parent),
m_ui(new Ui::DetailsDialog),
m_layoutsController(controller)
m_layoutsController(controller),
m_storage(KConfigGroup(KSharedConfig::openConfig(),"LatteSettingsDialog").group("DetailsDialog"))
{
loadConfig();
//! first we need to setup the ui
m_ui->setupUi(this);
//! we must create handlers after creating/adjusting the ui
@ -52,11 +55,13 @@ DetailsDialog::DetailsDialog(SettingsDialog *parent, Controller::Layouts *contro
connect(m_ui->buttonBox->button(QDialogButtonBox::Reset), &QPushButton::clicked,
this, &DetailsDialog::onReset);
resize(m_windowSize);
updateApplyButtonsState();
}
DetailsDialog::~DetailsDialog()
{
saveConfig();
}
Controller::Layouts *DetailsDialog::layoutsController() const
@ -109,6 +114,16 @@ void DetailsDialog::onReset()
m_handler->reset();
}
void DetailsDialog::loadConfig()
{
m_windowSize = m_storage.readEntry("windowSize", QSize(560, 615));
}
void DetailsDialog::saveConfig()
{
m_storage.writeEntry("windowSize", size());
}
}
}
}

View File

@ -65,6 +65,9 @@ protected:
void accept() override;
private slots:
void loadConfig();
void saveConfig();
void onOk();
void onCancel();
void onReset();
@ -77,6 +80,12 @@ private:
Controller::Layouts *m_layoutsController{nullptr};
Handler::DetailsHandler *m_handler;
//! properties
QSize m_windowSize;
//! storage
KConfigGroup m_storage;
};
}