Esempio n. 1
0
 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();
 }
Esempio n. 2
0
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();
}
Esempio n. 3
0
void JavaScriptInterpreter::commitData(QSessionManager &manager)
{
	if (manager.allowsInteraction()) {
		if (!maybeSave())
			manager.cancel();
	}
	else {
		if (TextEdit_input->document()->isModified())
			save();
	}
}
Esempio n. 4
0
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();
    }
}
Esempio n. 5
0
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();
    }
}
Esempio n. 6
0
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();
    }
}