Document->Settings: add currently embedded files

git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@21284 a592a061-630c-0410-9148-cb99ea01b6c8
This commit is contained in:
Bo Peng 2007-10-30 02:59:24 +00:00
parent e7768ff98e
commit eabe6081c9

View File

@ -18,6 +18,7 @@
#include "Buffer.h" #include "Buffer.h"
#include "BufferParams.h" #include "BufferParams.h"
#include "BufferView.h" #include "BufferView.h"
#include "EmbeddedFiles.h"
#include "Encoding.h" #include "Encoding.h"
#include "FloatPlacement.h" #include "FloatPlacement.h"
#include "frontend_helpers.h" #include "frontend_helpers.h"
@ -628,6 +629,28 @@ GuiDocument::GuiDocument(LyXView & lv)
connect(embeddedFilesModule, SIGNAL(changed()), connect(embeddedFilesModule, SIGNAL(changed()),
this, SLOT(change_adaptor())); 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()),