Commit fd6d1689 authored by Laurent Montel's avatar Laurent Montel
Browse files

Fix dialog size

parent 3c7fab23
......@@ -42,11 +42,13 @@
#include <KMessageBox>
#include <KSharedConfig>
#include <KWindowConfig>
#include <QCloseEvent>
#include <QDir>
#include <QIcon>
#include <QStandardPaths>
#include <QTimeZone>
#include <QWindow>
using namespace IncidenceEditorNG;
......@@ -703,18 +705,16 @@ IncidenceDialog::~IncidenceDialog()
void IncidenceDialog::writeConfig()
{
KConfigGroup group(KSharedConfig::openStateConfig(), "IncidenceDialog");
group.writeEntry("Size", size());
KWindowConfig::saveWindowSize(windowHandle(), group);
}
void IncidenceDialog::readConfig()
{
create(); // ensure a window is created
windowHandle()->resize(QSize(500, 500));
KConfigGroup group(KSharedConfig::openStateConfig(), "IncidenceDialog");
const QSize size = group.readEntry("Size", QSize());
if (size.isValid()) {
resize(size);
} else {
resize(QSize(500, 500).expandedTo(minimumSizeHint()));
}
KWindowConfig::restoreWindowSize(windowHandle(), group);
resize(windowHandle()->size()); // workaround for QTBUG-40584
}
void IncidenceDialog::load(const Akonadi::Item &item, const QDate &activeDate)
......
......@@ -22,11 +22,13 @@
#include <KLocalizedString>
#include <KSharedConfig>
#include <KWindowConfig>
#include <QColor>
#include <QDialogButtonBox>
#include <QLabel>
#include <QPushButton>
#include <QStringList>
#include <QWindow>
using namespace IncidenceEditorNG;
......@@ -148,17 +150,17 @@ ResourceManagement::~ResourceManagement()
void ResourceManagement::readConfig()
{
create(); // ensure a window is created
windowHandle()->resize(QSize(600, 400));
KConfigGroup group(KSharedConfig::openStateConfig(), "ResourceManagement");
const QSize size = group.readEntry("Size", QSize(600, 400));
if (size.isValid()) {
resize(size);
}
KWindowConfig::restoreWindowSize(windowHandle(), group);
resize(windowHandle()->size()); // workaround for QTBUG-40584
}
void ResourceManagement::writeConfig()
{
KConfigGroup group(KSharedConfig::openStateConfig(), "ResourceManagement");
group.writeEntry("Size", size());
KWindowConfig::saveWindowSize(windowHandle(), group);
group.sync();
}
......
Supports Markdown
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