Document->settings: update embedded file list properly

git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@21289 a592a061-630c-0410-9148-cb99ea01b6c8
This commit is contained in:
Bo Peng 2007-10-30 15:20:59 +00:00
parent 8c908a56f1
commit a9519bda94
2 changed files with 29 additions and 25 deletions

View File

@ -626,31 +626,6 @@ GuiDocument::GuiDocument(LyXView & lv)
// embedded files // embedded files
embeddedFilesModule = new UiWidget<Ui::EmbeddedFilesUi>; embeddedFilesModule = new UiWidget<Ui::EmbeddedFilesUi>;
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)), connect(embeddedFilesModule->bundleCB, SIGNAL(toggled(bool)),
this, SLOT(change_adaptor())); this, SLOT(change_adaptor()));
connect(embeddedFilesModule->addPB, SIGNAL(clicked()), 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() void GuiDocument::updateNumbering()
{ {
TextClass const & tclass = bp_.getTextClass(); TextClass const & tclass = bp_.getTextClass();
@ -1603,6 +1603,9 @@ void GuiDocument::updateParams(BufferParams const & params)
pdfSupportModule->optionsLE->setText( pdfSupportModule->optionsLE->setText(
toqstr(pdf.quoted_options)); toqstr(pdf.quoted_options));
// embedded files
updateEmbeddedFileList();
} }

View File

@ -108,6 +108,7 @@ private Q_SLOTS:
void portraitChanged(); void portraitChanged();
void classChanged(); void classChanged();
void updateModuleInfo(); void updateModuleInfo();
void updateEmbeddedFileList();
private: private:
void closeEvent(QCloseEvent * e); void closeEvent(QCloseEvent * e);