r23952 by jghali - #16158: Deleting masterpage requires 2 confirms

scribus-commit scribus-commit at lists.scribus.net
Tue Jul 28 03:15:51 UTC 2020


Author: jghali
Date: Tue Jul 28 03:15:51 2020
New Revision: 23952

URL: http://scribus.net/websvn/listing.php?repname=Scribus&sc=1&rev=23952
Log:
#16158: Deleting masterpage requires 2 confirms

Modified:
    trunk/Scribus/scribus/ui/pagepalette_pages.cpp
    trunk/Scribus/scribus/ui/pagepalette_pages.h
    trunk/Scribus/scribus/ui/pagepalette_widgets.cpp
    trunk/Scribus/scribus/ui/pagepalette_widgets.h

Modified: trunk/Scribus/scribus/ui/pagepalette_pages.cpp
URL: http://scribus.net/websvn/diff.php?repname=Scribus&rev=23952&path=/trunk/Scribus/scribus/ui/pagepalette_pages.cpp
==============================================================================
--- trunk/Scribus/scribus/ui/pagepalette_pages.cpp	(original)
+++ trunk/Scribus/scribus/ui/pagepalette_pages.cpp	Tue Jul 28 03:15:51 2020
@@ -71,17 +71,17 @@
 
 	connect(masterPageList, SIGNAL(itemDoubleClicked(QListWidgetItem*)), this, SLOT(selMasterPage()));
 	connect(masterPageList, SIGNAL(thumbnailChanged()), this, SLOT(rebuildMasters()));
-	connect(masterPageList, SIGNAL(DelMaster(QString)), this, SLOT(deleteMasterPage(QString)));
+	connect(masterPageList, SIGNAL(delMasterRequest(QString)), this, SLOT(deleteMasterPage(QString)));
 
 	connect(pageLayout, SIGNAL(selectedLayout(int))   , this, SLOT(handlePageLayout(int)));
 	connect(pageLayout, SIGNAL(selectedFirstPage(int)), this, SLOT(handleFirstPage(int)));
 	connect(pageView  , SIGNAL(Click(int,int,int))    , this, SLOT(pageView_gotoPage(int,int,int)));
 	connect(pageView  , SIGNAL(movePage(int,int))     , this, SLOT(pageView_movePage(int,int)));
-	connect(pageView  , SIGNAL(DelPage(int))          , m_scMW, SLOT(deletePage2(int)));
+	connect(pageView  , SIGNAL(delPageRequest(int))   , this, SLOT(pageView_deletePage(int)));
 	connect(pageView  , SIGNAL(UseTemp(QString,int))  , this, SLOT(pageView_applyMasterPage(QString,int)));
 	connect(pageView  , SIGNAL(NewPage(int,QString))  , m_scMW, SLOT(slotNewPageP(int,QString)));
-	connect(trash     , SIGNAL(DelPage(int))          , m_scMW, SLOT(deletePage2(int)));
-	connect(trash     , SIGNAL(DelMaster(QString))    , this, SLOT(deleteMasterPage(QString)));
+	connect(trash     , SIGNAL(delPageRequest(int))   , m_scMW, SLOT(deletePage2(int)));
+	connect(trash     , SIGNAL(delMasterRequest(QString))    , this, SLOT(deleteMasterPage(QString)));
 	
 	connect(this, SIGNAL(gotoPage(int))          , m_scMW, SLOT(selectPagesFromOutlines(int)));
 }
@@ -158,6 +158,16 @@
 		p = pageView->getPage(r, c, &dummy);
 		emit gotoPage(p);
 	}
+}
+
+void PagePalette_Pages::pageView_deletePage(int pageIndex)
+{
+	int exit = ScMessageBox::question(this, tr("Delete Page?"),
+			                          "<qt>" + tr("Are you sure you want to delete this page?") + "</qt>",
+			                          QMessageBox::Yes | QMessageBox::No, QMessageBox::Yes);
+	if (exit != QMessageBox::Yes)
+		return;
+	m_scMW->deletePage2(pageIndex);
 }
 
 void PagePalette_Pages::enablePalette(const bool enabled)

Modified: trunk/Scribus/scribus/ui/pagepalette_pages.h
URL: http://scribus.net/websvn/diff.php?repname=Scribus&rev=23952&path=/trunk/Scribus/scribus/ui/pagepalette_pages.h
==============================================================================
--- trunk/Scribus/scribus/ui/pagepalette_pages.h	(original)
+++ trunk/Scribus/scribus/ui/pagepalette_pages.h	Tue Jul 28 03:15:51 2020
@@ -56,6 +56,7 @@
 	void pageView_applyMasterPage(const QString& masterpageName, int pageIndex);
 	void pageView_movePage(int r, int c);
 	void pageView_gotoPage(int r, int c, int b);
+	void pageView_deletePage(int pageIndex);
 
 signals:
 	void gotoMasterPage(QString);

Modified: trunk/Scribus/scribus/ui/pagepalette_widgets.cpp
URL: http://scribus.net/websvn/diff.php?repname=Scribus&rev=23952&path=/trunk/Scribus/scribus/ui/pagepalette_widgets.cpp
==============================================================================
--- trunk/Scribus/scribus/ui/pagepalette_widgets.cpp	(original)
+++ trunk/Scribus/scribus/ui/pagepalette_widgets.cpp	Tue Jul 28 03:15:51 2020
@@ -109,24 +109,18 @@
 
 void SeList::keyPressEvent(QKeyEvent * e)
 {
-	bool accepted = false;
 	int k = e->key();
 	if (k == Qt::Key_Delete)
 	{
 		if (currentItem())
 		{
 			e->accept();
-			if (ScMessageBox::question(this, tr("Delete Master Page?"),
-				"<qt>" + tr("Are you sure you want to delete this master page?") + "</qt>",
-				QMessageBox::Yes | QMessageBox::No, QMessageBox::Yes) == QMessageBox::Yes)
-			{
-				emit DelMaster(currentItem()->text());
-			}
-			accepted = true;
-		}
-	}
-	if (!accepted)
-		QListWidget::keyPressEvent(e);
+			emit delMasterRequest(currentItem()->text());
+			return;
+		}
+	}
+	
+	QListWidget::keyPressEvent(e);
 }
 
 
@@ -350,23 +344,17 @@
 
 void SeView::keyPressEvent(QKeyEvent * e)
 {
-	bool accepted = false;
 	int k = e->key();
 	if (k == Qt::Key_Delete)
 	{
 		e->accept();
-		if (ScMessageBox::question(this, tr("Delete Page?"),
-			 "<qt>" + tr("Are you sure you want to delete this page?") + "</qt>",
-			QMessageBox::Yes | QMessageBox::No, QMessageBox::Yes) == QMessageBox::Yes)
-		{
-			bool dummy;
-			int pageToDelete = getPage(currentRow(), currentColumn(), &dummy);
-			emit DelPage(pageToDelete);
-		}
-		accepted = true;
-	}
-	if (!accepted)
-		QTableWidget::keyPressEvent(e);
+		bool dummy;
+		int pageToDelete = getPage(currentRow(), currentColumn(), &dummy);
+		emit delPageRequest(pageToDelete);
+		return;
+	}
+
+	QTableWidget::keyPressEvent(e);
 }
 
 void SeView::clearPix()
@@ -504,12 +492,12 @@
 		{
 			int st = str.indexOf(" ");
 			int en = str.indexOf(" ", st+1);
-			emit DelPage(str.midRef(st, en-st).toInt());
+			emit delPageRequest(str.midRef(st, en - st).toInt());
 		}
 		if (str.startsWith("1"))
 		{
 			tmp = str.remove(0,1);
-			emit DelMaster(tmp);
+			emit delMasterRequest(tmp);
 		}
 	}
 }

Modified: trunk/Scribus/scribus/ui/pagepalette_widgets.h
URL: http://scribus.net/websvn/diff.php?repname=Scribus&rev=23952&path=/trunk/Scribus/scribus/ui/pagepalette_widgets.h
==============================================================================
--- trunk/Scribus/scribus/ui/pagepalette_widgets.h	(original)
+++ trunk/Scribus/scribus/ui/pagepalette_widgets.h	Tue Jul 28 03:15:51 2020
@@ -71,7 +71,7 @@
 signals:
 	//! Emitted when user requests/disables the thumbnais for master pages.
 	void thumbnailChanged();
-	void DelMaster(QString);
+	void delMasterRequest(QString);
 
 protected:
 	void mouseReleaseEvent(QMouseEvent *m);
@@ -106,7 +106,7 @@
 	void NewPage(int, QString);
 	void movePage(int, int);
 	void Click(int, int, int);
-	void DelPage(int);
+	void delPageRequest(int);
 
 protected:
 	virtual void dropEvent(QDropEvent * e);
@@ -149,8 +149,8 @@
 	void iconSetChange();
 	
 signals:
-	void DelPage(int);
-	void DelMaster(QString);
+	void delPageRequest(int);
+	void delMasterRequest(QString);
 };
 
 #endif




More information about the scribus-commit mailing list