[pim/pim-sieve-editor] src: We need to use KXmlGuiWindow::closeEvent which managed a lot of feature as size/session managment etc.
Laurent Montel <[email protected]>
| Newsgroups | gmane.comp.kde.cvs |
|---|---|
| Message-ID | <[email protected]> |
Git commit e3911765f89bc74acf66aa46eef93b5462b7f7b8 by Laurent Montel.
Committed on 14/08/2026 at 05:09.
Pushed by mlaurent into branch 'master'.
We need to use KXmlGuiWindow::closeEvent which managed a lot of feature as size/session managment etc.
M +3 -23 src/sieveeditormainwindow.cpp
M +0 -2 src/sieveeditormainwindow.h
https://invent.kde.org/pim/pim-sieve-editor/-/commit/e3911765f89bc74acf66aa46eef93b5462b7f7b8
diff --git a/src/sieveeditormainwindow.cpp b/src/sieveeditormainwindow.cpp
index cd9b3489..51a02fc8 100644
--- a/src/sieveeditormainwindow.cpp
+++ b/src/sieveeditormainwindow.cpp
@@ -139,7 +139,6 @@ SieveEditorMainWindow::SieveEditorMainWindow(const QList<KAboutRelease> &release
setCentralWidget(mainWidget);
setupActions();
setupGUI();
- readConfig();
initStatusBar();
connect(PimCommon::NetworkManager::self(),
&PimCommon::NetworkManager::networkStatusChanged,
@@ -160,10 +159,7 @@ SieveEditorMainWindow::SieveEditorMainWindow(const QList<KAboutRelease> &release
#endif
}
-SieveEditorMainWindow::~SieveEditorMainWindow()
-{
- writeConfig();
-}
+SieveEditorMainWindow::~SieveEditorMainWindow() = default;
void SieveEditorMainWindow::slotWhatsNew()
{
@@ -172,22 +168,6 @@ void SieveEditorMainWindow::slotWhatsNew()
dlg.exec();
}
-void SieveEditorMainWindow::readConfig()
-{
- create(); // ensure a window is created
- windowHandle()->resize(QSize(800, 600));
- const KConfigGroup group(KSharedConfig::openStateConfig(), QLatin1StringView(mySieveEditorMainWindowConfigGroupName));
- KWindowConfig::restoreWindowSize(windowHandle(), group);
- resize(windowHandle()->size()); // workaround for QTBUG-40584
-}
-
-void SieveEditorMainWindow::writeConfig()
-{
- KConfigGroup group(KSharedConfig::openStateConfig(), QLatin1StringView(mySieveEditorMainWindowConfigGroupName));
- KWindowConfig::saveWindowSize(windowHandle(), group);
- group.sync();
-}
-
void SieveEditorMainWindow::initStatusBar()
{
mStatusBarInfo = new QLabel;
@@ -514,9 +494,9 @@ void SieveEditorMainWindow::closeEvent(QCloseEvent *e)
{
if (mMainWidget->sieveEditorMainWidget()->needToSaveScript()) {
e->ignore();
- } else {
- e->accept();
+ return;
}
+ KXmlGuiWindow::closeEvent(e);
}
void SieveEditorMainWindow::slotConfigure()
diff --git a/src/sieveeditormainwindow.h b/src/sieveeditormainwindow.h
index 94fbe503..764615b8 100644
--- a/src/sieveeditormainwindow.h
+++ b/src/sieveeditormainwindow.h
@@ -62,11 +62,9 @@ private:
LIBSIEVEEDITOR_NO_EXPORT void slotOpenBookmarkUrl(const QUrl &url);
LIBSIEVEEDITOR_NO_EXPORT void slotImportImapSettings();
LIBSIEVEEDITOR_NO_EXPORT void initStatusBar();
- LIBSIEVEEDITOR_NO_EXPORT void readConfig();
LIBSIEVEEDITOR_NO_EXPORT void setupActions();
[[nodiscard]] LIBSIEVEEDITOR_NO_EXPORT QString currentText() const;
LIBSIEVEEDITOR_NO_EXPORT void slotFullScreen(bool t);
- LIBSIEVEEDITOR_NO_EXPORT void writeConfig();
LIBSIEVEEDITOR_NO_EXPORT void slotToggleMenubar(bool dontShowWarning);
LIBSIEVEEDITOR_NO_EXPORT void updateHamburgerMenu();
LIBSIEVEEDITOR_NO_EXPORT void slotWhatsNew();