aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorsaturneric <[email protected]>2026-09-24 21:40:32 +0200
committersaturneric <[email protected]>2026-09-24 21:40:32 +0200
commit7c4565824a996cf58b0f86bbe0a214ff45522aec (patch)
treecf6454f3bf214eeec3e1e2c1864e2cf87ceb4ce9 /src
parentstyle(README): align permissions table and command signature (diff)
downloadmodules-7c4565824a996cf58b0f86bbe0a214ff45522aec.tar.gz
modules-7c4565824a996cf58b0f86bbe0a214ff45522aec.zip
fix(email): persist IMAP state on close
- remember the current account during controller destruction - support host-frame dismissal without relying on done() - move IMAP sizing to the module registration declaration - remove the controller's standalone window resize - clean up the dialog header declaration and include order
Diffstat (limited to 'src')
-rw-r--r--src/m_email/EMailImapController.cpp28
-rw-r--r--src/m_email/EMailImapController.h5
-rw-r--r--src/m_email/EMailModule.cpp2
3 files changed, 13 insertions, 22 deletions
diff --git a/src/m_email/EMailImapController.cpp b/src/m_email/EMailImapController.cpp
index e21617a..2874ef3 100644
--- a/src/m_email/EMailImapController.cpp
+++ b/src/m_email/EMailImapController.cpp
@@ -148,8 +148,10 @@ class MessageRowDelegate : public QStyledItemDelegate {
} // namespace
EMailImapController::EMailImapController(QWidget* parent) : QDialog(parent) {
+ // No size of its own: it is a child of the Host's dialog frame, which
+ // opens at the size this module declares for it and then at whatever the
+ // user leaves it at.
setWindowTitle(tr("IMAP Controller"));
- resize(960, 600);
build_ui();
accounts_ = EMailAccountStore::ImapAccounts();
@@ -292,7 +294,14 @@ void EMailImapController::disable_account(const QString& account_id,
refresh_account_availability();
}
-EMailImapController::~EMailImapController() { stop_worker(); }
+EMailImapController::~EMailImapController() {
+ // Here rather than in done() or closeEvent(): mounted in the Host's frame,
+ // this widget is not a window, and the frame's own close button closes it
+ // without ever asking. Destruction is the one step every way of leaving the
+ // window shares.
+ remember_current_account();
+ stop_worker();
+}
auto EMailImapController::HasUsableAccount() -> bool {
return !EMailAccountStore::ImapAccounts().isEmpty();
@@ -694,21 +703,6 @@ void EMailImapController::closeEvent(QCloseEvent* event) {
QDialog::closeEvent(event);
}
-void EMailImapController::done(int result) {
- // Here rather than in closeEvent(), which is the whole reason the cache
- // appeared not to work: the Close button and Escape both go through
- // reject(), and reject() does NOT deliver a close event -- only the window's
- // own X button does. done() is the one path every dismissal takes.
- //
- // Leaving the picker is the ordinary way to finish with it, so it is the
- // case the cache exists to survive; remembering only on an account switch
- // meant the cache was written by the one path a user with a single account
- // never takes.
- remember_current_account();
-
- QDialog::done(result);
-}
-
void EMailImapController::connect_to_selected_account() {
const auto index = account_combo_->currentIndex();
if (index < 0 || index >= accounts_.size()) {
diff --git a/src/m_email/EMailImapController.h b/src/m_email/EMailImapController.h
index 6985355..14e75a3 100644
--- a/src/m_email/EMailImapController.h
+++ b/src/m_email/EMailImapController.h
@@ -28,9 +28,9 @@
#pragma once
-#include <QDateTime>
#include <GFModule.h>
+#include <QDateTime>
#include <QDialog>
#include <QHash>
#include <QList>
@@ -86,9 +86,6 @@ class EMailImapController : public QDialog, public gf::ui::DialogWidget {
protected:
void closeEvent(QCloseEvent* event) override;
- /// Every dismissal -- Close, Escape, accept -- passes through here, which
- /// closeEvent() does not: reject() never delivers one.
- void done(int result) override;
void changeEvent(QEvent* event) override;
/// Watches the Message-ID label so its elision follows the pane's width.
auto eventFilter(QObject* watched, QEvent* event) -> bool override;
diff --git a/src/m_email/EMailModule.cpp b/src/m_email/EMailModule.cpp
index 8032063..ce36887 100644
--- a/src/m_email/EMailModule.cpp
+++ b/src/m_email/EMailModule.cpp
@@ -446,7 +446,7 @@ auto OnActivate() -> GFResult {
"", "", 0, 0},
[](const QCborMap& /*args*/) { return new EMailAccountSettingsPage(); });
const bool imap = gf::ui::RegisterNativeWidget<EMailImapController>(
- "imap", {GC_TR("IMAP Controller"), "", "", "", "", 0, 0},
+ "imap", {GC_TR("IMAP Controller"), "", "", "", "", 1100, 720},
[](const QCborMap& /*args*/) {
auto* controller = new EMailImapController();
// The narrow boundary: raw bytes in, a document out. The controller