bool EventFilter::eventFilter(QObject *obj, QEvent *event)
{
    Q_UNUSED(obj);

    if (event->type() == QEvent::Close) {
        m_mainWindow->close();
        return true;
    } else if (event->type() == QEvent::Show) {
               m_mainWindow->show();
               return true;
    } else if (event->type() == QEvent::Hide) {
               m_mainWindow->hide();
               return true;
    }

    return false;
}
Ejemplo n.º 2
0
void KVerbosApp::slotFileQuit()
{
	slotStatusMsg(i18n("Exiting..."));
	saveOptions();
	// close the first window, the list makes the next one the first again.
	// This ensures that queryClose() is called on each window to ask for closing
	KMainWindow* w;
	// In der Dokumentation konnte ich leider nicht finden, wozu diese memberliste gut ist.
	if(memberList)
	{
		for(w=memberList->first(); w!=0; w=memberList->next())
		{
			// only close the window if the closeEvent is accepted. If the user presses Cancel on the saveModified() dialog,
			// the window and the application stay open.
			if(!w->close())
				break;
		}
	}
	slotStatusMsg(i18n("Ready."));
}
Ejemplo n.º 3
0
void KMouthApp::slotFileQuit()
{
    slotStatusMsg(i18nc("Shutting down the application", "Exiting..."));
    saveOptions();
    // close the first window, the list makes the next one the first again.
    // This ensures that queryClose() is called on each window to ask for closing
    KMainWindow* w;
    if (!memberList().isEmpty()) {
        for (int i = 0; i < memberList().size(); ++i) {
            // only close the window if the closeEvent is accepted. If the user presses Cancel on the saveModified() dialog,
            // the window and the application stay open.
            w = memberList().at(i);
            if (!w->close())
                break;
#ifdef __GNUC__
#warning "kde4: how remove it ?.???"
#endif
            //memberList()->removeRef(w);
        }
    }
}