}
+int QToc::getType()
+{
+ return type_;
+}
+
+
void QToc::update()
{
- toc_models_.clear();
+ updateType();
+ updateToc();
+}
- QStringList type_list;
- type_ = 0;
+void QToc::updateType()
+{
+
+ QStringList type_list;
vector<string> const & types = getTypes();
if (types.empty()) {
return;
}
- string const & selected_type = params().getCmdName();
- lyxerr[Debug::GUI] << "selected_type " << selected_type << endl;
+ string selected_type ;
+ if(params()["type"].empty()) //Then plain toc...
+ selected_type = params().getCmdName();
+ else
+ selected_type = to_ascii(params()["type"]);
QString gui_names_;
for (size_t i = 0; i != types.size(); ++i) {
<< "\ttoc_models_.size() " << toc_models_.size()
<< endl;
- toc_models_.push_back(new TocModel(getContents(types[i])));
}
type_model_.setStringList(type_list);
}
-void QToc::updateToc(int type)
+void QToc::updateToc()
{
- toc_models_[type] = new TocModel(getContents(getTypes()[type]));
+ toc_models_.clear();
+ vector<string> const & types = getTypes();
+
+ for (size_t i = 0; i != types.size(); ++i) {
+
+ toc_models_.push_back(new TocModel(getContents(types[i])));
+ }
+
}
void QTocDialog::on_updatePB_clicked()
{
- update();
+ form_->update();
}
{
form_->setTocModel(value);
tocTV->setModel(form_->tocModel());
+ reconnectSelectionModel();
enableButtons();
}
void QTocDialog::update()
{
- form_->update();
+ form_->updateToc();
updateGui();
}
}
typeCO->setModel(type_model);
+ typeCO->setCurrentIndex(form_->getType());
if (form_->tocModel())
tocTV->setModel(form_->tocModel());
tocTV->header()->setVisible(false);
enableButtons();
- connect(tocTV->selectionModel(),
- SIGNAL(currentChanged(const QModelIndex &,
- const QModelIndex &)),
- this, SLOT(selectionChanged(const QModelIndex &,
- const QModelIndex &)));
-
+ reconnectSelectionModel();
select(form_->getCurrentIndex());
lyxerr[Debug::GUI]
}
+void QTocDialog::reconnectSelectionModel()
+{
+ connect(tocTV->selectionModel(),
+ SIGNAL(currentChanged(const QModelIndex &,
+ const QModelIndex &)),
+ this, SLOT(selectionChanged(const QModelIndex &,
+ const QModelIndex &)));
+}
+
+
void QTocDialog::apply()
{
// Nothing to do here... for now.
void QTocDialog::show()
{
- update();
+ form_->update();
QDialog::show();
}