mirror of
https://github.com/KDE/konsole.git
synced 2026-05-19 12:09:25 -04:00
accidently closing a window with one session in it, no big deal. maybe annoying, but that's all.
closing a window with 10 active sesssions in it and it just disappearing ... no good. that's why every (ewll behaved) tabbed app asks for confirmation in these cases. konsole in kde3 did it too. now, to set up those tabs again ... *sigh* svn path=/trunk/KDE/kdebase/apps/konsole/; revision=733577
This commit is contained in:
@@ -27,15 +27,18 @@
|
||||
#include <KAction>
|
||||
#include <KActionCollection>
|
||||
#include <KActionMenu>
|
||||
#include <KApplication>
|
||||
#include <KShortcutsDialog>
|
||||
#include <KLocale>
|
||||
#include <KMenu>
|
||||
#include <KMenuBar>
|
||||
#include <KMessageBox>
|
||||
#include <KService>
|
||||
#include <KToggleAction>
|
||||
#include <KToggleFullScreenAction>
|
||||
#include <KToolInvocation>
|
||||
#include <kstandardaction.h>
|
||||
#include <KStandardAction>
|
||||
#include <KStandardGuiItem>
|
||||
#include <KXMLGUIFactory>
|
||||
#include <KNotifyConfigWidget>
|
||||
|
||||
@@ -46,6 +49,7 @@
|
||||
#include "SessionController.h"
|
||||
#include "ProfileList.h"
|
||||
#include "ManageProfilesDialog.h"
|
||||
#include "Session.h"
|
||||
#include "ViewManager.h"
|
||||
#include "ViewSplitter.h"
|
||||
|
||||
@@ -279,6 +283,38 @@ void MainWindow::newWindow()
|
||||
emit newWindowRequest( _defaultProfile , activeSessionDir() );
|
||||
}
|
||||
|
||||
bool MainWindow::queryClose()
|
||||
{
|
||||
if (kapp->sessionSaving() ||
|
||||
_viewManager->viewProperties().count() < 2)
|
||||
return true;
|
||||
|
||||
int res = KMessageBox::warningYesNoCancel(this,
|
||||
i18n("You have multiple terminal sessions open in this window, are you sure you want to quit?"),
|
||||
i18n("Really Quit?"),
|
||||
KStandardGuiItem::quit(),
|
||||
KGuiItem(i18n("Close current sesion"), "tab-close"),
|
||||
KStandardGuiItem::cancel(),
|
||||
"CloseAllSessions");
|
||||
|
||||
switch (res) {
|
||||
case KMessageBox::Yes:
|
||||
return true;
|
||||
break;
|
||||
case KMessageBox::No:
|
||||
if (_pluggedController && _pluggedController->session()) {
|
||||
_pluggedController->session()->close();
|
||||
}
|
||||
return false;
|
||||
break;
|
||||
case KMessageBox::Cancel:
|
||||
return false;
|
||||
break;
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
void MainWindow::showShortcutsDialog()
|
||||
{
|
||||
KShortcutsDialog::configure( actionCollection() ,
|
||||
|
||||
Reference in New Issue
Block a user