View Issue Details
| ID | Project | Category | View Status | Date Submitted | Last Update |
|---|---|---|---|---|---|
| 0008115 | Scribus | Import / Export | public | 2009-06-02 09:21 | 2019-12-08 21:24 |
| Reporter | hellocatfood | Assigned To | ale | ||
| Priority | normal | Severity | minor | Reproducibility | always |
| Status | closed | Resolution | fixed | ||
| Platform | All | OS | All | ||
| Product Version | 1.3.3.13 | ||||
| Fixed in Version | 1.5.6.svn | ||||
| Summary | 0008115: Import multiple master pages | ||||
| Description | Could there be an option for adding in multiple master pages in one operation. As an example, I have a file with five master pages that I want to import into another document. Each time I have to import the file again. Could there not be check boxes to decide which master pages to import? | ||||
| Steps To Reproduce | Edit > Master Pages > Import . Importing many pages uses too many steps | ||||
| Tags | masterpage | ||||
| Attached Files | |||||
| Patch | Yes | ||||
| has duplicate | 0008150 | closed | christoph_s | Import multiple Masterpages |
| has duplicate | 0014396 | closed | jghali | Import multiple master pages at once |
| related to | 0012588 | closed | ale | Master Page import Improvements |
| related to | 0010272 | closed | ale | More versatile "masterpage import" |
| child of | 0003837 | acknowledged | Metabug: Master pages/Page templates |
|
|
i have a patch. it works with one page but fails with multiple pages: @mrb : can you please have a look at https://gitlab.com/scribus/scribus/merge_requests/14 ? here are the lines of the current code that i do not understand: https://gitlab.com/scribus/scribus/blob/master/scribus/ui/pagepalette_masterpages.cpp#L400 |
|
|
fixed... and voilĂ the patch p.s.: this patch depends on 0015940 and 0015941 masterpages-multiple-import.diff (4,861 bytes)
diff --git a/scribus/ui/mergedoc.cpp b/scribus/ui/mergedoc.cpp
index 76ab6197b..3da750105 100644
--- a/scribus/ui/mergedoc.cpp
+++ b/scribus/ui/mergedoc.cpp
@@ -24,6 +24,7 @@ for which a new license (GPL+exception) is in place.
#include <QHBoxLayout>
#include <QLabel>
#include <QLineEdit>
+#include <QListWidget>
#include <QPixmap>
#include <QPushButton>
#include <QSpacerItem>
@@ -65,8 +66,9 @@ MergeDoc::MergeDoc(QWidget* parent, bool importMasterPages, int targetDocPageCou
if (masterPages)
{
importPageLabel->setText( tr("&Import Master Page") );
- masterPageNameData = new QComboBox(this);
+ masterPageNameData = new QListWidget(this);
masterPageNameData->setEnabled(false);
+ masterPageNameData->setSelectionMode(QAbstractItemView::ExtendedSelection);
importPageLabel->setBuddy( masterPageNameData );
fromInfoLayout->addWidget( masterPageNameData, 1, 1, 1, 2);
}
@@ -226,14 +228,20 @@ const QString MergeDoc::getFromDoc()
return QDir::fromNativeSeparators(fromDocData->text());
}
-const int MergeDoc::getMasterPageNameItem()
+const QStringList MergeDoc::getMasterPageNames() const
{
- return masterPageNameData->currentIndex();
+ QStringList result;
+ for (const auto item : masterPageNameData->selectedItems())
+ result << item->text();
+ return result;
}
-const QString MergeDoc::getMasterPageNameText()
+QList<int> MergeDoc::getMasterPageIndexes() const
{
- return masterPageNameData->currentText();
+ QList<int> result;
+ for (const auto& row: masterPageNameData->selectionModel()->selectedRows())
+ result << row.row();
+ return result;
}
const int MergeDoc::getImportWhere()
diff --git a/scribus/ui/mergedoc.h b/scribus/ui/mergedoc.h
index a6f32a747..457f3aed3 100644
--- a/scribus/ui/mergedoc.h
+++ b/scribus/ui/mergedoc.h
@@ -4,6 +4,9 @@ to the COPYING file provided with the program. Following this notice may exist
a copyright and/or license notice that predates the release of Scribus 1.3.2
for which a new license (GPL+exception) is in place.
*/
+/**
+ * "page > import" and, "import master pages" from the "master pages" window.
+ */
#ifndef MERGEDOC_H
#define MERGEDOC_H
@@ -14,6 +17,8 @@ class QCheckBox;
class QComboBox;
class QLabel;
class QLineEdit;
+class QList;
+class QListWidget;
class QPushButton;
class QSpinBox;
class QString;
@@ -31,8 +36,8 @@ public:
~MergeDoc();
const QString getFromDoc();
- const int getMasterPageNameItem();
- const QString getMasterPageNameText();
+ const QStringList getMasterPageNames() const;
+ QList<int> getMasterPageIndexes() const;
const int getImportWhere();
const int getImportWherePage();
const bool getCreatePageChecked();
@@ -49,7 +54,7 @@ private:
QPushButton* cancelButton;
QPushButton* changeButton;
QCheckBox* createPageData;
- QComboBox* masterPageNameData;
+ QListWidget* masterPageNameData;
QComboBox* importWhereData;
QSpinBox* importWherePageData;
QVBoxLayout* dialogLayout;
diff --git a/scribus/ui/pagepalette_masterpages.cpp b/scribus/ui/pagepalette_masterpages.cpp
index 1ff60ec58..8490292a4 100644
--- a/scribus/ui/pagepalette_masterpages.cpp
+++ b/scribus/ui/pagepalette_masterpages.cpp
@@ -352,26 +352,31 @@ void PagePalette_MasterPages::importPage()
if (m_doc->appMode == modeEditClip)
m_view->requestMode(submodeEndNodeEdit);
+
qApp->setOverrideCursor(QCursor(Qt::WaitCursor));
int nr = m_doc->Pages->count();
- QString masterPageName(dia->getMasterPageNameText());
- QString masterPageName2(masterPageName);
- int copyC = 1;
- while (m_doc->MasterNames.contains(masterPageName2))
+ auto indexes = dia->getMasterPageIndexes();
+ QString lastName;
+ for (auto name: dia->getMasterPageNames())
{
- masterPageName2 = tr("Copy #%1 of ").arg(copyC)+masterPageName;
- copyC++;
+ name = getUniqueName(name, m_doc->MasterNames);
+ m_doc->setCurrentPage(m_doc->addMasterPage(nr, name));
+
+ nr++;
+ qApp->processEvents();
+
+ //CB TODO: If we are loading to a new name, we rely on doc->onpage in
+ //FileLoader::PasteItem as this call doesn't pass in the new destination page
+ m_doc->scMW()->loadPage(dia->getFromDoc(), indexes.first(), true, name);
+ qApp->processEvents();
+
+ indexes.removeFirst();
+ lastName = name;
}
- m_doc->setCurrentPage(m_doc->addMasterPage(nr, masterPageName2));
- qApp->processEvents();
- //CB TODO: If we are loading to a new name, we rely on doc->onpage in
- //FileLoader::PasteItem as this call doesn't pass in the new destination page
- m_doc->scMW()->loadPage(dia->getFromDoc(), dia->getMasterPageNameItem(), true, masterPageName2);
- qApp->processEvents();
-
- updateMasterPageList(masterPageName2);
- m_view->showMasterPage(m_doc->MasterNames[masterPageName2]);
+
+ updateMasterPageList(lastName);
+ m_view->showMasterPage(m_doc->MasterNames[lastName]);
qApp->restoreOverrideCursor();
}
|
|
|
ooops... i should have compiled... the forward declaration of QList in ui/mergedoc.h does not work.. just remove it from the patch. |
| Date Modified | Username | Field | Change |
|---|---|---|---|
| 2009-06-02 09:21 | hellocatfood | New Issue | |
| 2009-06-02 16:36 | christoph_s | Status | new => acknowledged |
| 2009-06-02 16:36 | christoph_s | Target Version | => 1.5.0 |
| 2009-06-13 23:23 | christoph_s | Relationship added | has duplicate 0008150 |
| 2014-07-03 19:43 | Kunda | Target Version | 1.5.0 => 1.5.1 |
| 2015-11-29 14:06 | Kunda | Target Version | 1.5.1 => 1.5.2 |
| 2016-01-23 17:15 | cbradney | Target Version | 1.5.2 => 1.5.4.svn |
| 2016-12-01 11:36 | caigner | Issue cloned: 0014396 | |
| 2016-12-01 11:57 | jghali | Relationship added | has duplicate 0014396 |
| 2016-12-01 11:58 | Kunda | Tag Attached: masterpage | |
| 2016-12-01 11:59 | Kunda | Relationship added | child of 0003837 |
| 2018-04-30 12:47 | jghali | Target Version | 1.5.4.svn => |
| 2018-04-30 12:47 | jghali | Patch | => No |
| 2019-11-13 07:44 | ale | Assigned To | => ale |
| 2019-11-13 07:44 | ale | Status | acknowledged => assigned |
| 2019-11-13 08:04 | ale | Relationship added | related to 0012588 |
| 2019-11-13 08:41 | ale | Relationship added | related to 0010272 |
| 2019-11-13 14:24 | ale | Note Added: 0047066 | |
| 2019-11-13 21:19 | ale | File Added: masterpages-multiple-import.diff | |
| 2019-11-13 21:19 | ale | Note Added: 0047067 | |
| 2019-11-13 21:20 | ale | Note Edited: 0047067 | |
| 2019-11-13 21:20 | ale | Note Edited: 0047067 | |
| 2019-11-13 21:22 | ale | Patch | No => Yes |
| 2019-11-13 21:31 | ale | Note Added: 0047068 | |
| 2019-11-13 22:24 | cbradney | Status | assigned => resolved |
| 2019-11-13 22:24 | cbradney | Fixed in Version | => 1.5.6.svn |
| 2019-11-13 22:24 | cbradney | Resolution | open => fixed |
| 2019-12-08 21:24 | cbradney | Status | resolved => closed |