virtual void commitData(QSessionManager &manager) { if (!m_mainWindow) return; bool mayAskUser = manager.allowsInteraction(); bool success = m_mainWindow->commitData(mayAskUser); manager.release(); if (!success) manager.cancel(); }
void MainWindow::commitData(QSessionManager &manager) { // Play nice with session management and cancel shutdown process when user // requests this if (manager.allowsInteraction()) if (!confirmAllSave()) manager.cancel(); }
void JavaScriptInterpreter::commitData(QSessionManager &manager) { if (manager.allowsInteraction()) { if (!maybeSave()) manager.cancel(); } else { if (TextEdit_input->document()->isModified()) save(); } }
void Application::commitData(QSessionManager &sessionManager) { if (ticTacToe->gameInProgress() && sessionManager.allowsInteraction()) { int ret = QMessageBox::warning(ticTacToe, tr("Tic-Tac-Toe"), tr("The game hasn't finished.\n" "Do you really want to quit?"), QMessageBox::Yes | QMessageBox::Default, QMessageBox::No | QMessageBox::Escape); if (ret == QMessageBox::Yes) sessionManager.release(); else sessionManager.cancel(); } }
void GUIApplication::commitData(QSessionManager &manager) { if (manager.allowsInteraction()) { if (!Gui::getMainWindow()->close()) { // cancel the shutdown manager.release(); manager.cancel(); } } else { // no user interaction allowed, thus close all documents and // the main window App::GetApplication().closeAllDocuments(); Gui::getMainWindow()->close(); } }
void ClipboardServer::onCommitData(QSessionManager &sessionManager) { COPYQ_LOG("Got commit data request from session manager."); const bool cancel = sessionManager.allowsInteraction() && !askToQuit(); sessionManager.release(); if (cancel) { sessionManager.cancel(); startMonitoring(); } else { m_wnd->saveTabs(); // WORKAROUND: This is required to exit application from // installer, otherwise main window is only // minimized after this when tray is disabled. m_wnd->hide(); exit(); } }