View Issue Details
| ID | Project | Category | View Status | Date Submitted | Last Update |
|---|---|---|---|---|---|
| 0013161 | Scribus | User Interface | public | 2015-06-22 21:30 | 2026-08-28 15:55 |
| Reporter | JLuc | Assigned To | |||
| Priority | normal | Severity | minor | Reproducibility | have not tried |
| Status | confirmed | Resolution | open | ||
| Platform | Linux | OS | Ubuntu | OS Version | 14.04 |
| Product Version | 1.5.1svn | ||||
| Summary | 0013161: 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 Information | As 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 | ||||
| Patch | No | ||||
|
|
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. |
|
|
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
|
| 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 |