View Issue Details

IDProjectCategoryView StatusLast Update
0013161ScribusUser Interfacepublic2026-08-28 15:55
ReporterJLuc Assigned To 
PrioritynormalSeverityminorReproducibilityhave not tried
Status confirmedResolutionopen 
PlatformLinuxOSUbuntuOS Version14.04
Product Version1.5.1svn 
Summary0013161: Delete page selector
Description"Delete page" page selectors sometimes bugs : end page n° selector changes also changes start page n° selector and also the reciprocal, without the user to request this change.

It should not behave so, all the more since page deleting is a critical action for the pages of the document...

Steps To Reproduce- Create 12 pages document
- Page > Delete
- specify "start : 2" then "end : 12", dont click enter
- click "down" on the side of the "start" selector
- SEE : "end" has changed to 11 (and "start" is now 1)
- click "up" on the side of the "end" selector
- SEE : "start" page has changed to 2
Additional InformationAs a side effect, it protects against deleting ALL pages of the document. That's a good effect, but a correct protection should prevent the user from doing some page inputs, not change input values without the user deciding it.
Tags#please_test
PatchNo

Activities

PeterBenedek

2016-09-25 11:53

developer   ~0042049

Last edited: 2016-09-25 12:16

Tested Linux Mint 18; r21456; 1.5.3svn

I can reproduce this, but...

...after deleting you need to stay one page!
Scribus maybe that's why behave this way? I think yes.

qirat

2026-08-28 15:55

reporter   ~0054357

I can reproduce this. Here is the patch that fixed it for me.

* Issue: user-entered values could change without an explicit action, which is especially undesirable in a destructive dialog.
* Cause: `DelPages::fromChanged()` / `toChanged()` kept the range valid by silently rewriting the opposite page selector.
* Fix: remove reciprocal selector rewriting.
* Range handling: dynamically constrain the selectors so invalid full-range deletion cannot be selected.
* Crossed ranges: if `From > To`, keep both values unchanged and disable OK until corrected.
* Safety: revalidate the range on acceptance.
* Scope: confined to `DelPages`; no changes to page deletion, document model, or undo logic.
delete-pages-selector-validation-v1.0.patch (2,737 bytes)   
Index: scribus/ui/delpages.cpp
===================================================================
--- scribus/ui/delpages.cpp	(revision 27785)
+++ scribus/ui/delpages.cpp	(working copy)
@@ -53,26 +53,36 @@
 	// signals and slots connections
 	connect(buttonBox, &QDialogButtonBox::accepted, this, &DelPages::accept);
 	connect(buttonBox, &QDialogButtonBox::rejected, this, &DelPages::reject);
-	connect( fromPageData, SIGNAL( valueChanged(double) ), this, SLOT( fromChanged() ) );
-	connect( toPageData, SIGNAL( valueChanged(double) ), this, SLOT( toChanged() ) );
+	connect( fromPageData, SIGNAL( valueChanged(double) ), this, SLOT( updatePageRange() ) );
+	connect( toPageData, SIGNAL( valueChanged(double) ), this, SLOT( updatePageRange() ) );
+
+	updatePageRange();
 }
 
-void DelPages::fromChanged()
+void DelPages::accept()
 {
-	int pageNumber = static_cast<int>(fromPageData->value());
-	if (pageNumber > toPageData->value())
-		toPageData->setValue(pageNumber);
-	if ((pageNumber == 1) && (toPageData->value() == toPageData->maximum()))
-		toPageData->setValue(toPageData->maximum() - 1);
+	const int lastPage = static_cast<int>(fromPageData->maximum());
+	const int fromPage = getFromPage();
+	const int toPage = getToPage();
+	if ((lastPage <= 1) || (fromPage > toPage) || ((fromPage == 1) && (toPage == lastPage)))
+		return;
+
+	QDialog::accept();
 }
 
-void DelPages::toChanged()
+void DelPages::updatePageRange()
 {
-	int pageNumber = toPageData->value();
-	if (pageNumber < fromPageData->value())
-		fromPageData->setValue(pageNumber);
-	if ((fromPageData->value() == 1) && (pageNumber == toPageData->maximum()))
-		fromPageData->setValue(2);
+	const int lastPage = static_cast<int>(fromPageData->maximum());
+	if (lastPage > 1)
+	{
+		toPageData->setMaximum(fromPageData->value() == 1 ? lastPage - 1 : lastPage);
+		fromPageData->setMinimum(toPageData->value() == lastPage ? 2 : 1);
+	}
+
+	const int fromPage = getFromPage();
+	const int toPage = getToPage();
+	const bool validRange = (lastPage > 1) && (fromPage <= toPage) && !((fromPage == 1) && (toPage == lastPage));
+	buttonBox->button(QDialogButtonBox::Ok)->setEnabled(validRange);
 }
 
 int DelPages::getFromPage() const
Index: scribus/ui/delpages.h
===================================================================
--- scribus/ui/delpages.h	(revision 27785)
+++ scribus/ui/delpages.h	(working copy)
@@ -28,6 +28,9 @@
 	int getFromPage() const;
 	int getToPage() const;
 
+public slots:
+	void accept() override;
+
 private:
 	QVBoxLayout* dialogLayout;
 	QHBoxLayout* fromToLayout;
@@ -38,8 +41,7 @@
 	ScrSpinBox* fromPageData;
 
 private slots:
-	virtual void fromChanged();
-	virtual void toChanged();
+	void updatePageRange();
 };
 
 #endif // DELPAGES_H

Issue History

Date Modified Username Field Change
2015-06-22 21:30 JLuc New Issue
2015-06-22 21:34 JLuc Additional Information Updated
2015-06-22 21:55 JLuc Description Updated
2016-09-25 11:53 PeterBenedek Note Added: 0042049
2016-09-25 12:07 PeterBenedek File Added: 0013161.gif
2016-09-25 12:08 PeterBenedek File Deleted: 0013161.gif
2016-09-25 12:16 PeterBenedek Note Edited: 0042049
2016-09-25 15:14 JLuc Status new => confirmed
2026-08-28 15:55 qirat Note Added: 0054357
2026-08-28 15:55 qirat File Added: delete-pages-selector-validation-v1.0.patch
2026-08-28 15:55 qirat Tag Attached: #please_test