Commit 77b558e9 authored by Laurent Montel's avatar Laurent Montel
Browse files

Fix dialog size

parent f72df796
Pipeline #237326 passed with stage
in 7 minutes and 48 seconds
......@@ -13,10 +13,12 @@
#include <KSharedConfig>
#include <KConfigGroup>
#include <KWindowConfig>
#include <QDialogButtonBox>
#include <QLabel>
#include <QPushButton>
#include <QVBoxLayout>
#include <QWindow>
#include "dbusproperties.h" // DBUS-generated
#include "notifications_interface.h" // DBUS-generated
......@@ -107,18 +109,18 @@ void FollowUpReminderNoAnswerDialog::setInfo(const QList<FollowUpReminder::Follo
void FollowUpReminderNoAnswerDialog::readConfig()
{
create(); // ensure a window is created
windowHandle()->resize(QSize(800, 600));
KConfigGroup group(KSharedConfig::openStateConfig(), DialogGroup);
const QSize sizeDialog = group.readEntry("Size", QSize(800, 600));
if (sizeDialog.isValid()) {
resize(sizeDialog);
}
KWindowConfig::restoreWindowSize(windowHandle(), group);
resize(windowHandle()->size()); // workaround for QTBUG-40584
mWidget->restoreTreeWidgetHeader(group.readEntry("HeaderState", QByteArray()));
}
void FollowUpReminderNoAnswerDialog::writeConfig()
{
KConfigGroup group(KSharedConfig::openStateConfig(), DialogGroup);
group.writeEntry("Size", size());
KWindowConfig::saveWindowSize(windowHandle(), group);
mWidget->saveTreeWidgetHeader(group);
}
......
......@@ -13,10 +13,12 @@
#include <KHelpMenu>
#include <KLocalizedString>
#include <KSharedConfig>
#include <KWindowConfig>
#include <QApplication>
#include <QDialogButtonBox>
#include <QIcon>
#include <QMenu>
#include <QWindow>
namespace
{
static const char myConfigureSendLaterConfigureDialogGroupName[] = "SendLaterConfigureDialog";
......@@ -85,17 +87,18 @@ void SendLaterConfigureDialog::slotNeedToReloadConfig()
void SendLaterConfigureDialog::readConfig()
{
create(); // ensure a window is created
windowHandle()->resize(QSize(800, 600));
KConfigGroup group(KSharedConfig::openStateConfig(), myConfigureSendLaterConfigureDialogGroupName);
const QSize sizeDialog = group.readEntry("Size", QSize(800, 600));
if (sizeDialog.isValid()) {
resize(sizeDialog);
}
KWindowConfig::restoreWindowSize(windowHandle(), group);
resize(windowHandle()->size()); // workaround for QTBUG-40584
mWidget->restoreTreeWidgetHeader(group.readEntry("HeaderState", QByteArray()));
}
void SendLaterConfigureDialog::writeConfig()
{
KConfigGroup group(KSharedConfig::openStateConfig(), myConfigureSendLaterConfigureDialogGroupName);
group.writeEntry("Size", size());
KWindowConfig::saveWindowSize(windowHandle(), group);
mWidget->saveTreeWidgetHeader(group);
}
......@@ -20,7 +20,9 @@
#include <KConfigGroup>
#include <KLocalizedString>
#include <KMessageBox>
#include <KWindowConfig>
#include <QMenu>
#include <QWindow>
#include <memory>
......@@ -154,17 +156,17 @@ SettingsDialog::~SettingsDialog()
void SettingsDialog::readConfig()
{
auto dlgGroup = mConfig->group(DialogGroup);
const QSize size = dlgGroup.readEntry("Size", QSize(500, 500));
if (size.isValid()) {
resize(size);
}
create(); // ensure a window is created
windowHandle()->resize(QSize(500, 500));
KConfigGroup group(KSharedConfig::openStateConfig(), DialogGroup);
KWindowConfig::restoreWindowSize(windowHandle(), group);
resize(windowHandle()->size()); // workaround for QTBUG-40584
}
void SettingsDialog::writeConfig()
{
auto dlgGroup = mConfig->group(DialogGroup);
dlgGroup.writeEntry("Size", size());
KWindowConfig::saveWindowSize(windowHandle(), dlgGroup);
dlgGroup.sync();
}
......
......@@ -20,8 +20,10 @@
#include <KIconDialog>
#include <KLocalizedString>
#include <KWindowConfig>
#include <MailCommon/FolderTreeView>
#include <MailCommon/FolderTreeWidget>
#include <QWindow>
namespace
{
......@@ -164,17 +166,17 @@ UnifiedMailboxEditor::~UnifiedMailboxEditor()
void UnifiedMailboxEditor::readConfig()
{
auto editorGrp = mConfig->group(EditorGroup);
const QSize size = editorGrp.readEntry("Size", QSize(600, 700));
if (size.isValid()) {
resize(size);
}
create(); // ensure a window is created
windowHandle()->resize(QSize(600, 700));
KConfigGroup group(KSharedConfig::openStateConfig(), EditorGroup);
KWindowConfig::restoreWindowSize(windowHandle(), group);
resize(windowHandle()->size()); // workaround for QTBUG-40584
}
void UnifiedMailboxEditor::writeConfig()
{
auto editorGrp = mConfig->group(EditorGroup);
editorGrp.writeEntry("Size", size());
KWindowConfig::saveWindowSize(windowHandle(), editorGrp);
editorGrp.sync();
}
......
......@@ -25,6 +25,7 @@
#include <KConfigGroup>
#include <KSharedConfig>
#include <KWindowConfig>
#include <QBuffer>
#include <QDataStream>
#include <QDialogButtonBox>
......@@ -34,6 +35,7 @@
#include <QPushButton>
#include <QTreeWidget>
#include <QVBoxLayout>
#include <QWindow>
namespace
{
......@@ -71,17 +73,17 @@ AttachPropertyDialog::~AttachPropertyDialog()
void AttachPropertyDialog::readConfig()
{
create(); // ensure a window is created
windowHandle()->resize(QSize(600, 700));
KConfigGroup group(KSharedConfig::openStateConfig(), myAttachPropertyDialogGroupName);
const QSize size = group.readEntry("Size", QSize(500, 400));
if (size.isValid()) {
resize(size);
}
KWindowConfig::restoreWindowSize(windowHandle(), group);
resize(windowHandle()->size()); // workaround for QTBUG-40584
}
void AttachPropertyDialog::writeConfig()
{
KConfigGroup group(KSharedConfig::openStateConfig(), myAttachPropertyDialogGroupName);
group.writeEntry("Size", size());
KWindowConfig::saveWindowSize(windowHandle(), group);
group.sync();
}
......
......@@ -22,10 +22,12 @@
#include <KConfigGroup>
#include <KGuiItem>
#include <KSharedConfig>
#include <KWindowConfig>
#include <QDialogButtonBox>
#include <QHeaderView>
#include <QPushButton>
#include <QTreeWidget>
#include <QWindow>
namespace
{
static const char myMessagePropertyDialogGroupName[] = "MessagePropertyDialog";
......@@ -74,11 +76,11 @@ void MessagePropertyDialog::slotSaveProperty()
void MessagePropertyDialog::readConfig()
{
create(); // ensure a window is created
windowHandle()->resize(QSize(600, 400));
KConfigGroup group(KSharedConfig::openStateConfig(), myMessagePropertyDialogGroupName);
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
const QByteArray headerState = group.readEntry("HeaderState", QByteArray());
if (!headerState.isEmpty()) {
mListView->header()->restoreState(headerState);
......@@ -88,7 +90,7 @@ void MessagePropertyDialog::readConfig()
void MessagePropertyDialog::writeConfig()
{
KConfigGroup group(KSharedConfig::openStateConfig(), myMessagePropertyDialogGroupName);
group.writeEntry("Size", size());
KWindowConfig::saveWindowSize(windowHandle(), group);
group.writeEntry("HeaderState", mListView->header()->saveState());
group.sync();
}
......@@ -19,10 +19,12 @@
#include <KLocalizedString>
#include <KConfigGroup>
#include <KWindowConfig>
#include <QDialogButtonBox>
#include <QPushButton>
#include <QTreeView>
#include <QVBoxLayout>
#include <QWindow>
namespace
{
static const char myAddEmailToExistingContactDialogGroupName[] = "AddEmailToExistingContactDialog";
......@@ -89,17 +91,17 @@ void AddEmailToExistingContactDialog::slotSelectionChanged()
void AddEmailToExistingContactDialog::readConfig()
{
KConfigGroup group(KMKernel::self()->config(), myAddEmailToExistingContactDialogGroupName);
const QSize size = group.readEntry("Size", QSize(600, 400));
if (size.isValid()) {
resize(size);
}
create(); // ensure a window is created
windowHandle()->resize(QSize(600, 400));
KConfigGroup group(KSharedConfig::openStateConfig(), myAddEmailToExistingContactDialogGroupName);
KWindowConfig::restoreWindowSize(windowHandle(), group);
resize(windowHandle()->size()); // workaround for QTBUG-40584
}
void AddEmailToExistingContactDialog::writeConfig()
{
KConfigGroup group(KMKernel::self()->config(), myAddEmailToExistingContactDialogGroupName);
group.writeEntry("Size", size());
KWindowConfig::saveWindowSize(windowHandle(), group);
group.sync();
}
......
......@@ -12,11 +12,13 @@
#include <KLocalizedString>
#include <KNotifyConfigWidget>
#include <KSeparator>
#include <KWindowConfig>
#include <QComboBox>
#include <QDialogButtonBox>
#include <QPushButton>
#include <QStandardPaths>
#include <QVBoxLayout>
#include <QWindow>
using namespace KMail;
......@@ -121,16 +123,16 @@ void KMKnotify::slotOk()
void KMKnotify::readConfig()
{
KConfigGroup notifyDialog(KMKernel::self()->config(), "KMKnotifyDialog");
const QSize size = notifyDialog.readEntry("Size", QSize(600, 400));
if (size.isValid()) {
resize(size);
}
create(); // ensure a window is created
windowHandle()->resize(QSize(600, 400));
KConfigGroup group(KSharedConfig::openStateConfig(), "KMKnotifyDialog");
KWindowConfig::restoreWindowSize(windowHandle(), group);
resize(windowHandle()->size()); // workaround for QTBUG-40584
}
void KMKnotify::writeConfig()
{
KConfigGroup notifyDialog(KMKernel::self()->config(), "KMKnotifyDialog");
notifyDialog.writeEntry("Size", size());
KWindowConfig::saveWindowSize(windowHandle(), notifyDialog);
notifyDialog.sync();
}
......@@ -13,6 +13,8 @@
#include <Sonnet/DictionaryComboBox>
#include <KConfigGroup>
#include <KWindowConfig>
#include <QWindow>
SpellCheckerConfigDialog::SpellCheckerConfigDialog(QWidget *parent)
: Sonnet::ConfigDialog(parent)
......@@ -47,16 +49,16 @@ SpellCheckerConfigDialog::~SpellCheckerConfigDialog()
void SpellCheckerConfigDialog::readConfig()
{
KConfigGroup notifyDialog(KMKernel::self()->config(), "KMKnotifyDialog");
const QSize size = notifyDialog.readEntry("Size", QSize(600, 400));
if (size.isValid()) {
resize(size);
}
create(); // ensure a window is created
windowHandle()->resize(QSize(600, 400));
KConfigGroup group(KSharedConfig::openStateConfig(), "SpellCheckerConfigDialog");
KWindowConfig::restoreWindowSize(windowHandle(), group);
resize(windowHandle()->size()); // workaround for QTBUG-40584
}
void SpellCheckerConfigDialog::writeConfig()
{
KConfigGroup notifyDialog(KMKernel::self()->config(), "KMKnotifyDialog");
notifyDialog.writeEntry("Size", size());
KConfigGroup notifyDialog(KMKernel::self()->config(), "SpellCheckerConfigDialog");
KWindowConfig::saveWindowSize(windowHandle(), notifyDialog);
notifyDialog.sync();
}
......@@ -10,9 +10,11 @@
#include <KConfigGroup>
#include <KLocalizedString>
#include <KSharedConfig>
#include <KWindowConfig>
#include <QDialogButtonBox>
#include <QPushButton>
#include <QVBoxLayout>
#include <QWindow>
namespace
{
......@@ -53,17 +55,17 @@ void PotentialPhishingDetailDialog::fillList(const QStringList &lst)
void PotentialPhishingDetailDialog::readConfig()
{
create(); // ensure a window is created
windowHandle()->resize(QSize(800, 600));
KConfigGroup group(KSharedConfig::openStateConfig(), myPotentialPhishingDetailDialogGroupName);
const QSize sizeDialog = group.readEntry("Size", QSize(800, 600));
if (sizeDialog.isValid()) {
resize(sizeDialog);
}
KWindowConfig::restoreWindowSize(windowHandle(), group);
resize(windowHandle()->size()); // workaround for QTBUG-40584
}
void PotentialPhishingDetailDialog::writeConfig()
{
KConfigGroup group(KSharedConfig::openStateConfig(), myPotentialPhishingDetailDialogGroupName);
group.writeEntry("Size", size());
KWindowConfig::saveWindowSize(windowHandle(), group);
}
void PotentialPhishingDetailDialog::slotSave()
......
......@@ -22,11 +22,13 @@
#include <KConfigGroup>
#include <KSharedConfig>
#include <KWindowConfig>
#include <QDBusInterface>
#include <QDBusMetaType>
#include <QDialogButtonBox>
#include <QHBoxLayout>
#include <QTimer>
#include <QWindow>
#include <chrono>
using namespace std::chrono_literals;
......@@ -145,17 +147,17 @@ IncompleteIndexDialog::~IncompleteIndexDialog()
void IncompleteIndexDialog::readConfig()
{
create(); // ensure a window is created
windowHandle()->resize(QSize(500, 400));
KConfigGroup group(KSharedConfig::openStateConfig(), myIncompleteIndexDialogGroupName);
const QSize size = group.readEntry("Size", QSize(500, 400));
if (size.isValid()) {
resize(size);
}
KWindowConfig::restoreWindowSize(windowHandle(), group);
resize(windowHandle()->size()); // workaround for QTBUG-40584
}
void IncompleteIndexDialog::writeConfig()
{
KConfigGroup group(KSharedConfig::openStateConfig(), myIncompleteIndexDialogGroupName);
group.writeEntry("Size", size());
KWindowConfig::saveWindowSize(windowHandle(), group);
group.sync();
}
......
......@@ -7,7 +7,6 @@
#include "tagselectdialog.h"
#include "kmail_debug.h"
#include "kmkernel.h"
#include "util.h"
#include <MailCommon/AddTagDialog>
......@@ -20,10 +19,13 @@
#include <Akonadi/TagFetchJob>
#include <Akonadi/TagFetchScope>
#include <KConfigGroup>
#include <KWindowConfig>
#include <QDialogButtonBox>
#include <QListWidget>
#include <QPointer>
#include <QPushButton>
#include <QVBoxLayout>
#include <QWindow>
using namespace KMail;
namespace
......@@ -81,17 +83,17 @@ TagSelectDialog::~TagSelectDialog()
void TagSelectDialog::readConfig()
{
create(); // ensure a window is created
windowHandle()->resize(QSize(500, 300));
KConfigGroup group(KSharedConfig::openStateConfig(), myTagSelectDialogGroupName);
const QSize size = group.readEntry("Size", QSize(500, 300));
if (size.isValid()) {
resize(size);
}
KWindowConfig::restoreWindowSize(windowHandle(), group);
resize(windowHandle()->size()); // workaround for QTBUG-40584
}
void TagSelectDialog::writeConfig()
{
KConfigGroup group(KSharedConfig::openStateConfig(), myTagSelectDialogGroupName);
group.writeEntry("Size", size());
KWindowConfig::saveWindowSize(windowHandle(), group);
}
void TagSelectDialog::slotAddNewTag()
......
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