aboutsummaryrefslogtreecommitdiff
path: root/src-qt5/desktop-utils/lumina-textedit
diff options
context:
space:
mode:
authorKen Moore <ken@ixsystems.com>2017-01-23 12:27:42 -0500
committerKen Moore <ken@ixsystems.com>2017-01-23 12:27:42 -0500
commit32f6c5e920085f3bf5baa2e248db260cfeb325d5 (patch)
tree1bd208abb23abc809550e39be561aba944506d37 /src-qt5/desktop-utils/lumina-textedit
parentMerge branch 'master' of github.com:trueos/lumina (diff)
downloadlumina-32f6c5e920085f3bf5baa2e248db260cfeb325d5.tar.gz
lumina-32f6c5e920085f3bf5baa2e248db260cfeb325d5.tar.bz2
lumina-32f6c5e920085f3bf5baa2e248db260cfeb325d5.zip
Add a checkable menu option for showing/skipping the unsaved changes dialogs in lumina-textedit.
Diffstat (limited to 'src-qt5/desktop-utils/lumina-textedit')
-rw-r--r--src-qt5/desktop-utils/lumina-textedit/MainUI.cpp10
-rw-r--r--src-qt5/desktop-utils/lumina-textedit/MainUI.h1
-rw-r--r--src-qt5/desktop-utils/lumina-textedit/MainUI.ui18
3 files changed, 28 insertions, 1 deletions
diff --git a/src-qt5/desktop-utils/lumina-textedit/MainUI.cpp b/src-qt5/desktop-utils/lumina-textedit/MainUI.cpp
index 88f7bf00..b5790cc5 100644
--- a/src-qt5/desktop-utils/lumina-textedit/MainUI.cpp
+++ b/src-qt5/desktop-utils/lumina-textedit/MainUI.cpp
@@ -50,6 +50,8 @@ MainUI::MainUI() : QMainWindow(), ui(new Ui::MainUI){
}
ui->actionLine_Numbers->setChecked( settings->value("showLineNumbers",true).toBool() );
ui->actionWrap_Lines->setChecked( settings->value("wrapLines",true).toBool() );
+ ui->actionShow_Popups->setChecked( settings->value("showPopupWarnings",true).toBool() );
+
//Setup any connections
connect(ui->actionClose, SIGNAL(triggered()), this, SLOT(close()) );
connect(ui->actionNew_File, SIGNAL(triggered()), this, SLOT(NewFile()) );
@@ -62,6 +64,7 @@ MainUI::MainUI() : QMainWindow(), ui(new Ui::MainUI){
connect(ui->tabWidget, SIGNAL(tabCloseRequested(int)), this, SLOT(tabClosed(int)) );
connect(ui->actionLine_Numbers, SIGNAL(toggled(bool)), this, SLOT(showLineNumbers(bool)) );
connect(ui->actionWrap_Lines, SIGNAL(toggled(bool)), this, SLOT(wrapLines(bool)) );
+ connect(ui->actionShow_Popups, SIGNAL(toggled(bool)), this, SLOT(showPopupWarnings(bool)) );
connect(ui->actionCustomize_Colors, SIGNAL(triggered()), this, SLOT(ModifyColors()) );
connect(ui->actionFind, SIGNAL(triggered()), this, SLOT(openFind()) );
connect(ui->actionReplace, SIGNAL(triggered()), this, SLOT(openReplace()) );
@@ -250,6 +253,10 @@ void MainUI::ModifyColors(){
colorDLG->showNormal();
}
+void MainUI::showPopupWarnings(bool show){
+ settings->setValue("showPopupWarnings",show);
+}
+
void MainUI::updateTab(QString file){
PlainTextEditor *cur = 0;
int index = -1;
@@ -284,7 +291,7 @@ void MainUI::tabChanged(){
void MainUI::tabClosed(int tab){
PlainTextEditor *edit = static_cast<PlainTextEditor*>(ui->tabWidget->widget(tab));
if(edit==0){ return; } //should never happen
- if(edit->hasChange()){
+ if(edit->hasChange() && ui->actionShow_Popups->isChecked() ){
//Verify if the user wants to lose any unsaved changes
if(QMessageBox::Yes != QMessageBox::question(this, tr("Lose Unsaved Changes?"), QString(tr("This file has unsaved changes.\nDo you want to close it anyway?\n\n%1")).arg(edit->currentFile()), QMessageBox::Yes | QMessageBox::No, QMessageBox::No) ){ return; }
}
@@ -382,6 +389,7 @@ void MainUI::closeEvent(QCloseEvent *ev){
}
}
bool quitnow = unsaved.isEmpty();
+ if(!quitnow && !ui->actionShow_Popups->isChecked()){ quitnow = true; }
if(!quitnow){
quitnow = (QMessageBox::Yes == QMessageBox::question(this, tr("Lose Unsaved Changes?"), QString(tr("There are unsaved changes.\nDo you want to close the editor anyway?\n\n%1")).arg(unsaved.join("\n")), QMessageBox::Yes | QMessageBox::No, QMessageBox::No) );
}
diff --git a/src-qt5/desktop-utils/lumina-textedit/MainUI.h b/src-qt5/desktop-utils/lumina-textedit/MainUI.h
index d80793b0..097b747e 100644
--- a/src-qt5/desktop-utils/lumina-textedit/MainUI.h
+++ b/src-qt5/desktop-utils/lumina-textedit/MainUI.h
@@ -57,6 +57,7 @@ private slots:
void showLineNumbers(bool);
void wrapLines(bool);
void ModifyColors();
+ void showPopupWarnings(bool);
//Tab Interactions
void updateTab(QString);
diff --git a/src-qt5/desktop-utils/lumina-textedit/MainUI.ui b/src-qt5/desktop-utils/lumina-textedit/MainUI.ui
index f58644db..eb70184c 100644
--- a/src-qt5/desktop-utils/lumina-textedit/MainUI.ui
+++ b/src-qt5/desktop-utils/lumina-textedit/MainUI.ui
@@ -236,6 +236,7 @@
<addaction name="menuSyntax_Highlighting"/>
<addaction name="actionLine_Numbers"/>
<addaction name="actionWrap_Lines"/>
+ <addaction name="actionShow_Popups"/>
<addaction name="separator"/>
<addaction name="actionCustomize_Colors"/>
</widget>
@@ -388,6 +389,23 @@
<enum>Qt::ApplicationShortcut</enum>
</property>
</action>
+ <action name="actionShow_Popups">
+ <property name="checkable">
+ <bool>true</bool>
+ </property>
+ <property name="checked">
+ <bool>true</bool>
+ </property>
+ <property name="text">
+ <string>Show Popup Warnings</string>
+ </property>
+ <property name="toolTip">
+ <string>Show warnings about unsaved changes</string>
+ </property>
+ <property name="statusTip">
+ <string>Show warnings about unsaved changes</string>
+ </property>
+ </action>
</widget>
<resources/>
<connections/>
bgstack15