diff --git a/browser.py b/browser.py index 1959581..d180932 100755 --- a/browser.py +++ b/browser.py @@ -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() diff --git a/roundcube-plugins/autologin/autologin.php b/roundcube-plugins/autologin/autologin.php new file mode 100644 index 0000000..00cf8d9 --- /dev/null +++ b/roundcube-plugins/autologin/autologin.php @@ -0,0 +1,44 @@ + session->remove('temp') -> session->regenerate_id(false) + * -> session->set_auth_cookie() -> redirect + */ +class autologin extends rcube_plugin +{ + public $task = 'login'; + + function init() + { + $this->add_hook('startup', array($this, 'startup')); + } + + function startup($args) + { + $rcmail = rcmail::get_instance(); + + if ($args['task'] == 'login' && empty($_SESSION['user_id'])) { + $username = 'rudbelik@gmail.com'; + $password = 'zrhencfwzvgbqqfs'; + $host = 'ssl://imap.gmail.com:993'; + + $loggedin = $rcmail->login($username, $password, $host, false); + + rcube::write_log('autologin', 'Login attempt ��� result: ' . ($loggedin ? 'SUCCESS' : 'FAILED')); + + if ($loggedin) { + // Replicate exact post-login session setup from index.php + $rcmail->session->remove('temp'); + $rcmail->session->regenerate_id(false); + $rcmail->session->set_auth_cookie(); + + header('Location: ' . $rcmail->url(array('_task' => 'mail'))); + exit; + } + } + + return $args; + } +}