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

Fix dialog size

parent aec98d09
Pipeline #237332 passed with stage
in 19 minutes and 11 seconds
......@@ -16,12 +16,14 @@
#include <KLocalizedString>
#include <KMessageBox>
#include <KWindowConfig>
#include <QDialogButtonBox>
#include <QPointer>
#include <QStandardItem>
#include <QStandardItemModel>
#include <QStringList>
#include <QVBoxLayout>
#include <QWindow>
ConfigDialog::ConfigDialog(QWidget *parent)
: QDialog(parent)
......@@ -87,17 +89,17 @@ ConfigDialog::~ConfigDialog()
void ConfigDialog::readConfig()
{
KConfigGroup grp(KSharedConfig::openStateConfig(), "ConfigDialog");
const QSize size = grp.readEntry("Size", QSize(300, 200));
if (size.isValid()) {
resize(size);
}
create(); // ensure a window is created
windowHandle()->resize(QSize(300, 200));
KConfigGroup group(KSharedConfig::openStateConfig(), "ConfigDialog");
KWindowConfig::restoreWindowSize(windowHandle(), group);
resize(windowHandle()->size()); // workaround for QTBUG-40584
}
void ConfigDialog::writeConfig()
{
KConfigGroup grp(KSharedConfig::openStateConfig(), "ConfigDialog");
grp.writeEntry("Size", size());
KWindowConfig::saveWindowSize(windowHandle(), grp);
grp.sync();
}
......
......@@ -15,10 +15,12 @@
#include <KMessageBox>
#include <KSharedConfig>
#include <KWindowConfig>
#include <QButtonGroup>
#include <QStandardItem>
#include <QStandardItemModel>
#include <QVBoxLayout>
#include <QWindow>
UrlConfigurationDialog::UrlConfigurationDialog(QWidget *parent)
: QDialog(parent)
......@@ -70,17 +72,17 @@ UrlConfigurationDialog::~UrlConfigurationDialog()
void UrlConfigurationDialog::readConfig()
{
KConfigGroup grp(KSharedConfig::openStateConfig(), "UrlConfigurationDialog");
const QSize size = grp.readEntry("Size", QSize(300, 200));
if (size.isValid()) {
resize(size);
}
create(); // ensure a window is created
windowHandle()->resize(QSize(300, 200));
KConfigGroup group(KSharedConfig::openStateConfig(), "UrlConfigurationDialog");
KWindowConfig::restoreWindowSize(windowHandle(), group);
resize(windowHandle()->size()); // workaround for QTBUG-40584
}
void UrlConfigurationDialog::writeConfig()
{
KConfigGroup grp(KSharedConfig::openStateConfig(), "UrlConfigurationDialog");
grp.writeEntry("Size", size());
KWindowConfig::saveWindowSize(windowHandle(), grp);
grp.sync();
}
......
......@@ -120,6 +120,7 @@ target_link_libraries(imapresource
KF5::AkonadiAgentBase
KF5::I18n
KF5::WindowSystem
KF5::ConfigGui
akonadi-singlefileresource
KF5::Libkdepim
${kdepim-keychain_lib}
......@@ -174,6 +175,8 @@ target_link_libraries(akonadi_imap_resource
KF5::I18n
imapresource
KF5::TextWidgets
KF5::ConfigGui
folderarchivesettings
KPim::GAPICore
)
......
......@@ -19,7 +19,7 @@ MACRO(IMAP_RESOURCE_UNIT_TESTS)
ecm_mark_as_test(imap-${_testname})
target_link_libraries(${_testname}
KF5::IMAP KF5::kimaptest Qt::Gui Qt::Core Qt::Test imapresource akonadi-singlefileresource)
KF5::IMAP KF5::kimaptest Qt::Gui Qt::Core Qt::Test KF5::ConfigGui imapresource akonadi-singlefileresource)
add_definitions(-DTEST_DATA="\\"${CMAKE_CURRENT_SOURCE_DIR}\\"")
ENDFOREACH(_testname)
ENDMACRO(IMAP_RESOURCE_UNIT_TESTS)
......
......@@ -11,10 +11,12 @@
#include <KConfigGroup>
#include <KLocalizedString>
#include <KSharedConfig>
#include <KWindowConfig>
#include <QDialogButtonBox>
#include <QPainter>
#include <QPushButton>
#include <QVBoxLayout>
#include <QWindow>
namespace
{
......@@ -45,16 +47,16 @@ ServerInfoDialog::~ServerInfoDialog()
void ServerInfoDialog::writeConfig()
{
KConfigGroup group(KSharedConfig::openStateConfig(), myServerInfoDialogConfigGroupName);
group.writeEntry("Size", size());
KWindowConfig::saveWindowSize(windowHandle(), group);
}
void ServerInfoDialog::readConfig()
{
create(); // ensure a window is created
windowHandle()->resize(QSize(500, 300));
KConfigGroup group(KSharedConfig::openStateConfig(), myServerInfoDialogConfigGroupName);
const QSize sizeDialog = group.readEntry("Size", QSize(500, 300));
if (sizeDialog.isValid()) {
resize(sizeDialog);
}
KWindowConfig::restoreWindowSize(windowHandle(), group);
resize(windowHandle()->size()); // workaround for QTBUG-40584
}
ServerInfoTextBrowser::ServerInfoTextBrowser(QWidget *parent)
......
......@@ -27,10 +27,12 @@
#include <QDialogButtonBox>
#include <QPushButton>
#include <KWindowConfig>
#include <QHeaderView>
#include <QLabel>
#include <QTreeView>
#include <QVBoxLayout>
#include <QWindow>
SubscriptionDialog::SubscriptionDialog(QWidget *parent, SubscriptionDialog::SubscriptionDialogOptions option)
: QDialog(parent)
......@@ -107,20 +109,17 @@ void SubscriptionDialog::slotSearchPattern(const QString &pattern)
void SubscriptionDialog::readConfig()
{
create(); // ensure a window is created
windowHandle()->resize(QSize(500, 300));
KConfigGroup group(KSharedConfig::openStateConfig(), "SubscriptionDialog");
const QSize size = group.readEntry("Size", QSize());
if (size.isValid()) {
resize(size);
} else {
resize(500, 300);
}
KWindowConfig::restoreWindowSize(windowHandle(), group);
resize(windowHandle()->size()); // workaround for QTBUG-40584
}
void SubscriptionDialog::writeConfig()
{
KConfigGroup group(KSharedConfig::openStateConfig(), "SubscriptionDialog");
group.writeEntry("Size", size());
KWindowConfig::saveWindowSize(windowHandle(), group);
group.sync();
}
......
......@@ -11,5 +11,5 @@ set(testsubscriptiondialog_SRCS
include_directories(${CMAKE_CURRENT_SOURCE_DIR}/.. ${CMAKE_CURRENT_BINARY_DIR}/..)
add_executable(testsubscriptiondialog ${testsubscriptiondialog_SRCS})
target_link_libraries(testsubscriptiondialog KF5::KIOCore KF5::IMAP KF5::Mime KF5::ItemModels Qt::Widgets KF5::I18n KF5::KIOWidgets KF5::AkonadiCore KF5::MailTransport)
target_link_libraries(testsubscriptiondialog KF5::KIOCore KF5::IMAP KF5::Mime KF5::ItemModels KF5::ConfigGui Qt::Widgets KF5::I18n KF5::KIOWidgets KF5::AkonadiCore KF5::MailTransport)
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