View Issue Details
ID | Project | Category | View Status | Date Submitted | Last Update |
---|---|---|---|---|---|
0011791 | Scribus | Graphics / Image Frames | public | 2013-10-15 21:52 | 2019-11-26 19:04 |
Reporter | pygmee | Assigned To | ale | ||
Priority | normal | Severity | feature | Reproducibility | always |
Status | assigned | Resolution | open | ||
Product Version | 1.5.0svn | ||||
Target Version | 1.5.4 | ||||
Summary | 0011791: [PATCH] Choose directory for missing image | ||||
Description | this patch is grabed from cezayece code and display a window to select a directory when a missing image is found on opening file, and allow to relink all image found in the same directory. | ||||
Tags | patch | ||||
Patch | Yes | ||||
|
diff_lost_images_on_open.patch (5,974 bytes)
Index: scribus/scribus.cpp =================================================================== --- scribus/scribus.cpp (révision 18561) +++ scribus/scribus.cpp (copie de travail) @@ -4357,6 +4357,7 @@ Apply_MasterPage(doc->DocPages.at(p)->MPageNam, p, false); } view->reformPages(false); + checkExternals(); /* search images paths */ doc->setLoading(false); // if (fileLoader->fileType() > FORMATID_NATIVEIMPORTEND) // scrActions["fileSave"]->setEnabled(false); @@ -4419,6 +4420,9 @@ return ret; } + + + bool ScribusMainWindow::postLoadDoc() { //FIXME Just return for now, if we arent using the GUI @@ -11346,6 +11350,78 @@ return docWasChanged; } +void ScribusMainWindow::checkExternals() /* search images */ +{ + QString searchPath = QString(); + bool reUsePath = false; + for (int a = 0; a < doc->Items->count(); ++a) + { + PageItem *currItem = doc->Items->at(a); + if (!currItem->Pfile.isEmpty()) + { + QFileInfo fi = QFileInfo(currItem->Pfile); + if (!fi.exists()) + { + if (!searchPath.isEmpty()) + { + QFile f(searchPath + "/" + fi.fileName()); + if (f.exists()) + { + fi.setFile(f); + currItem->Pfile = fi.absoluteFilePath(); + currItem->PictureIsAvailable = true; + continue; + } + else + searchPath.clear(); + } + QString wdir = QDir::fromNativeSeparators( fi.path() ); + QString fname = fi.fileName(); + + CustomFDialog *dia = new CustomFDialog(qApp->activeWindow(), wdir, tr("Find Missing External File: ") + fi.filePath(), QString(), fdShowPreview + fdExistingFiles); + QCheckBox* usePath = new QCheckBox(dia); + usePath->setText( tr("Search other missing files in selected directory")); + usePath->setToolTip( tr("If other missing files were found then first they will searched in that directory and dialog does not appear.")); + usePath->setChecked(reUsePath); + dia->addWidgets(usePath); + QCheckBox* stopSearch = new QCheckBox(dia); + stopSearch->setText( tr("Stop searching of missing files")); + stopSearch->setChecked(false); + dia->addWidgets(stopSearch); + dia->setSelection(fname); + + if (dia->exec() == QDialog::Accepted) + { + fname = dia->selectedFile(); + if (!fname.isEmpty()) + { + fi = QFileInfo(fname); + currItem->loadImage(fi.absoluteFilePath(), false); + if (usePath->isChecked()) + { + searchPath = fi.absolutePath(); + reUsePath = true; + } + else + { + searchPath.clear(); + reUsePath = false; + } + } + } + if (stopSearch->isChecked()) + { + delete dia; + doc->updatePic(); + return; + } + delete dia; + } + } + } + doc->updatePic(); +} + bool ScribusMainWindow::editMarkDlg(Mark *mrk, PageItem_TextFrame* currItem) { MarkInsert* editMDialog = NULL; Index: scribus/canvasmode_normal.cpp =================================================================== --- scribus/canvasmode_normal.cpp (révision 18561) +++ scribus/canvasmode_normal.cpp (copie de travail) @@ -1888,6 +1888,7 @@ m_doc->SnapGuides = savedAlignGuides; m_doc->SnapElement = savedAlignElement; m_doc->setLoading(false); + m_ScMW->checkExternals(); /* search image */ m_doc->view()->DrawNew(); if (m_doc->m_Selection->count() > 0) { Index: scribus/scribus.h =================================================================== --- scribus/scribus.h (révision 18561) +++ scribus/scribus.h (copie de travail) @@ -540,6 +540,8 @@ void slotUpdateMarks(); bool editMarkDlg(Mark *mrk, PageItem_TextFrame* currItem = NULL); void testQTQuick2_1(); + // ! \brief check for missing externals files (images for now) + void checkExternals(); signals: void AppModeChanged(int oldMode, int newMode); @@ -639,7 +641,9 @@ bool insertMarkDialog(PageItem_TextFrame* item, MarkType mT, ScItemsState* &is); int m_marksCount; //remember marks count from last call bool m_WasAutoSave; - bool m_pagePalVisible; + bool m_pagePalVisible; + + }; #endif |
|
Wow!!! Thx Pygmee!!! |
|
Added to http://wiki.scribus.net/canvas/Most_Desired_Features#Most_Desired_Features_candidates |
|
do we really want this or is the recursive search in "manage images" + an error in the preflight verifier renough? personally, i'm fine with the status quo... i've never heard of anybody who would have produced a pdf without noticing that the image links were broken. |
|
the purpose is not when producing the pdf, but when open the sla. Of course, we can think the user will check for missing images before producing PDF. I guess the use case is more when people get file without them being collected. Detecting missing image and say "hey! do you want to manage this now ?" or launch the manager can be helpful. I also know may people not using the verifier because they just don’t understand it. But it is not the most important feature, just that other DTP software have it :-) |
|
ok @pygmee i will see if there is an easy way to do it... |
Date Modified | Username | Field | Change |
---|---|---|---|
2013-10-15 21:52 | pygmee | New Issue | |
2013-10-15 21:52 | pygmee | File Added: diff_lost_images_on_open.patch | |
2013-10-16 18:22 | pygmee | Tag Attached: patch | |
2013-10-16 19:57 | cezaryece | Note Added: 0030734 | |
2013-10-16 20:34 | jghali | Summary | Choose directory for missign image => Choose directory for missing image |
2013-10-16 21:49 | jghali | Target Version | 1.5.0svn => 1.5.0 |
2014-06-13 00:45 | Kunda | Note Added: 0032126 | |
2014-06-13 05:28 | ale | Relationship added | related to 0011776 |
2014-07-13 19:47 | Kunda | Summary | Choose directory for missing image => [PATCH[ Choose directory for missing image |
2014-07-13 19:47 | Kunda | Summary | [PATCH[ Choose directory for missing image => [PATCH] Choose directory for missing image |
2014-07-14 04:59 | Kunda | Target Version | 1.5.0 => 1.5.1 |
2014-09-18 23:12 | Kunda | Relationship added | related to 0007966 |
2014-09-18 23:12 | Kunda | Relationship added | related to 0008914 |
2014-10-24 22:57 | Kunda | Patch | => Yes |
2014-10-30 13:42 | Kunda | Relationship added | related to 0012560 |
2015-09-17 20:10 | Kunda | Category | Graphics / Image Frames => Graphics/Img Frames |
2015-09-17 20:11 | Kunda | Category | Graphics/Img Frames => Graphics / Image Frames |
2016-01-23 17:16 | cbradney | Target Version | 1.5.1 => 1.5.3 |
2016-12-08 22:04 | Kunda | Target Version | 1.5.3 => 1.5.4 |
2019-11-24 10:38 | ale | Note Added: 0047128 | |
2019-11-26 17:55 | pygmee | Note Added: 0047144 | |
2019-11-26 19:04 | ale | Note Added: 0047145 | |
2019-11-26 19:04 | ale | Assigned To | => ale |
2019-11-26 19:04 | ale | Status | new => assigned |