From a9519bda94dd800c1d386360f2f09cd45e4ebdcc Mon Sep 17 00:00:00 2001 From: Bo Peng Date: Tue, 30 Oct 2007 15:20:59 +0000 Subject: [PATCH] Document->settings: update embedded file list properly git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@21289 a592a061-630c-0410-9148-cb99ea01b6c8 --- src/frontends/qt4/GuiDocument.cpp | 53 ++++++++++++++++--------------- src/frontends/qt4/GuiDocument.h | 1 + 2 files changed, 29 insertions(+), 25 deletions(-) diff --git a/src/frontends/qt4/GuiDocument.cpp b/src/frontends/qt4/GuiDocument.cpp index fc46e8ab72..b4972b541a 100644 --- a/src/frontends/qt4/GuiDocument.cpp +++ b/src/frontends/qt4/GuiDocument.cpp @@ -626,31 +626,6 @@ GuiDocument::GuiDocument(LyXView & lv) // embedded files embeddedFilesModule = new UiWidget; - connect(embeddedFilesModule, SIGNAL(changed()), - this, SLOT(change_adaptor())); - - // add current embedded files - EmbeddedFiles & files = buffer().embeddedFiles(); - files.update(); - EmbeddedFiles::EmbeddedFileList::iterator fit = files.begin(); - EmbeddedFiles::EmbeddedFileList::iterator fit_end = files.end(); - for (; fit != fit_end; ++fit) { - QString label = toqstr(fit->relFilename(buffer().filePath())); - if (fit->refCount() > 1) - label += " (" + QString::number(fit->refCount()) + ")"; - QListWidgetItem * item = new QListWidgetItem(label); - Qt::ItemFlags flag = Qt::ItemIsSelectable; - if (!buffer().isReadonly()) - flag |= Qt::ItemIsUserCheckable; - item->setFlags(flag); - if(fit->embedded()) - item->setCheckState(Qt::Checked); - else - item->setCheckState(Qt::Unchecked); - // index of the currently used ParConstIterator - embeddedFilesModule->filesLW->addItem(item); - } - connect(embeddedFilesModule->bundleCB, SIGNAL(toggled(bool)), this, SLOT(change_adaptor())); connect(embeddedFilesModule->addPB, SIGNAL(clicked()), @@ -997,6 +972,31 @@ void GuiDocument::updateModuleInfo() } +void GuiDocument::updateEmbeddedFileList() +{ + embeddedFilesModule->filesLW->clear(); + // add current embedded files + EmbeddedFiles & files = buffer().embeddedFiles(); + files.update(); + EmbeddedFiles::EmbeddedFileList::iterator fit = files.begin(); + EmbeddedFiles::EmbeddedFileList::iterator fit_end = files.end(); + for (; fit != fit_end; ++fit) { + QString label = toqstr(fit->relFilename(buffer().filePath())); + if (fit->refCount() > 1) + label += " (" + QString::number(fit->refCount()) + ")"; + QListWidgetItem * item = new QListWidgetItem(label); + item->setFlags(item->flags() | Qt::ItemIsSelectable + | Qt::ItemIsUserCheckable); + if(fit->embedded()) + item->setCheckState(Qt::Checked); + else + item->setCheckState(Qt::Unchecked); + // index of the currently used ParConstIterator + embeddedFilesModule->filesLW->addItem(item); + } +} + + void GuiDocument::updateNumbering() { TextClass const & tclass = bp_.getTextClass(); @@ -1603,6 +1603,9 @@ void GuiDocument::updateParams(BufferParams const & params) pdfSupportModule->optionsLE->setText( toqstr(pdf.quoted_options)); + + // embedded files + updateEmbeddedFileList(); } diff --git a/src/frontends/qt4/GuiDocument.h b/src/frontends/qt4/GuiDocument.h index 424fc33e4f..fcab1802f1 100644 --- a/src/frontends/qt4/GuiDocument.h +++ b/src/frontends/qt4/GuiDocument.h @@ -108,6 +108,7 @@ private Q_SLOTS: void portraitChanged(); void classChanged(); void updateModuleInfo(); + void updateEmbeddedFileList(); private: void closeEvent(QCloseEvent * e);