better handling of 'Close All'/'Close All Others'
This commit is contained in:
parent
cca490c3a5
commit
bdc1eec594
@ -643,11 +643,17 @@ void PTextEdit::fileCloseAll()
|
|||||||
if ( !currentEditor() )
|
if ( !currentEditor() )
|
||||||
return;
|
return;
|
||||||
|
|
||||||
int result = QMessageBox::warning(this, "**WARNING**",
|
// check if there are any unsaved tabs
|
||||||
"Do you really want to close all files.\nChanges of unsaved files will be lost",
|
for (int i=0; i<fTabWidget->count(); i++) {
|
||||||
"Close", "Cancel");
|
if (fTabWidget->label(i).find("*") > 0) {
|
||||||
if (result == 1) // Cancel
|
int result = QMessageBox::warning(this, "**WARNING**",
|
||||||
return;
|
"Do you really want to close all files.\nChanges of unsaved files will be lost",
|
||||||
|
"Close", "Cancel");
|
||||||
|
if (result == 1) // Cancel
|
||||||
|
return;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
// close all editor tabs
|
// close all editor tabs
|
||||||
do {
|
do {
|
||||||
@ -667,11 +673,17 @@ void PTextEdit::fileCloseAllOthers()
|
|||||||
if ( !currentEditor() )
|
if ( !currentEditor() )
|
||||||
return;
|
return;
|
||||||
|
|
||||||
int result = QMessageBox::warning(this, "**WARNING**",
|
// check if there are any unsaved tabs
|
||||||
"Do you really want to close all files.\nChanges of unsaved files will be lost",
|
for (int i=0; i<fTabWidget->count(); i++) {
|
||||||
"Close", "Cancel");
|
if (fTabWidget->label(i).find("*") > 0) {
|
||||||
if (result == 1) // Cancel
|
int result = QMessageBox::warning(this, "**WARNING**",
|
||||||
return;
|
"Do you really want to close all files.\nChanges of unsaved files will be lost",
|
||||||
|
"Close", "Cancel");
|
||||||
|
if (result == 1) // Cancel
|
||||||
|
return;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
// keep label of the current editor
|
// keep label of the current editor
|
||||||
QString label = fTabWidget->label(fTabWidget->currentPageIndex());
|
QString label = fTabWidget->label(fTabWidget->currentPageIndex());
|
||||||
|
Loading…
x
Reference in New Issue
Block a user