v0.05: fix Roundcube autologin + hamburger menu focus

Roundcube autologin fix:
- Added missing session->regenerate_id(false) and session->set_auth_cookie()
  calls after login, matching Roundcube's normal login flow in index.php.
  Without these, the roundcube_sessauth cookie was never set, causing every
  second request to fail with 'session is invalid or expired'.

Hamburger menu fix:
- Added activateWindow() + raise_() + processEvents() before menu.exec_()
  to ensure the toolbar window is active before the QMenu event loop starts.
  Without this, WA_ShowWithoutActivating prevents focus from being grabbed
  and the menu vanishes immediately.
- Added try/except to surface any silent errors.
This commit is contained in:
2026-05-21 20:29:46 -05:00
parent dfba158f3c
commit 2ca1da4f8e
2 changed files with 67 additions and 13 deletions
+23 -13
View File
@@ -413,19 +413,29 @@ class KioskOverlay(QWidget):
return bar
def _show_bookmarks_menu(self):
menu = self._build_menu(load_bm())
menu.addSeparator()
mgr_act = QAction(" ⚙ Manage Bookmarks…", menu)
mgr_act.triggered.connect(self.open_manager)
menu.addAction(mgr_act)
# Explicitly position menu just below the toolbar, right-aligned.
# sizeHint() gives the menu's preferred width before it is painted;
# fall back to 360px if it hasn't been computed yet.
mw = menu.sizeHint().width()
if mw < 100:
mw = 360
x = max(0, SCREEN_W - mw - 6)
menu.exec_(QPoint(x, TOOLBAR_H))
try:
menu = self._build_menu(load_bm())
menu.addSeparator()
mgr_act = QAction(" ⚙ Manage Bookmarks…", menu)
mgr_act.triggered.connect(self.open_manager)
menu.addAction(mgr_act)
# The toolbar has WA_ShowWithoutActivating, so it never steals
# focus from Chrome. QMenu.exec_() needs the window to be active
# to capture mouse/keyboard events; without this the menu flashes
# and vanishes immediately.
self.activateWindow()
self.raise_()
QApplication.instance().processEvents()
# Position right-aligned just below the toolbar.
mw = menu.sizeHint().width()
if mw < 100:
mw = 360
x = max(0, SCREEN_W - mw - 6)
menu.exec_(QPoint(x, TOOLBAR_H))
except Exception as e:
print(f"Bookmarks menu error: {e}", flush=True)
def _build_menu(self, items):
menu = QMenu()