* QCitation::findKey() use QRegExp but find still doesn't work

* QCitationDialog::on_applyPB_clicked(): calls form_->apply
* QCitationDialog::on_oKPB_clicked(): calls form_->apply

TBDone: extract the code from controller&co in order to update the view with a new citation inset (or a modified one).


git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@13499 a592a061-630c-0410-9148-cb99ea01b6c8
This commit is contained in:
Abdelrazak Younes 2006-03-26 18:35:15 +00:00
parent 107d32b49f
commit b9ff894f8b
2 changed files with 29 additions and 9 deletions

View File

@ -65,9 +65,27 @@ QCitation::QCitation(Dialog & parent)
void QCitation::apply()
{
InsetCommandParams & params = controller().params();
dialog_->update(params);
dialog_->apply(params);
params.setContents(fromqstr(selected_keys_.stringList().join("'")));
/*
if (dialog().controller().isBufferDependent()) {
if (!dialog().kernel().isBufferAvailable() ||
dialog().kernel().isBufferReadonly())
return;
}
dialog().view().apply();
dialog().controller().dispatchParams();
if (dialog().controller().disconnectOnApply()) {
dialog().kernel().disconnect(name());
dialog().controller().initialiseParams(string());
dialog().view().update();
}
*/
// dialog().ApplyButton();
// dialog().apply();
}
@ -119,10 +137,16 @@ QModelIndex QCitation::findKey(QString const & str, QModelIndex const & index) c
QModelIndex QCitation::findKey(QString const & str) const
{
cout << "Find text " << fromqstr(str) << endl;
QStringList const avail = available_keys_.stringList();
int const pos = avail.indexOf(str);
QRegExp reg_exp(str);
int const pos = avail.indexOf(reg_exp);
if (pos == -1)
return QModelIndex();
cout << "found key " << fromqstr(avail[pos]) << " at pos " << pos << endl;
return available_keys_.index(pos);
}
@ -199,10 +223,5 @@ void QCitation::downKey(QModelIndexList const & indexes)
changed();
}
} // namespace frontend
} // namespace lyx

View File

@ -111,7 +111,7 @@ QCitationDialog::~QCitationDialog()
void QCitationDialog::on_okPB_clicked()
{
apply(form_->controller().params());
form_->apply();
accept();
}
@ -122,7 +122,7 @@ void QCitationDialog::on_cancelPB_clicked()
void QCitationDialog::on_applyPB_clicked()
{
apply(form_->controller().params());
form_->apply();
}
void QCitationDialog::on_restorePB_clicked()
@ -319,6 +319,7 @@ void QCitationDialog::on_findLE_textChanged(const QString & text)
QModelIndex const index = form_->findKey(text);
if (! index.isValid())
return;
// QItemSelection selection(index, index);
availableLV->selectionModel()->select(index, QItemSelectionModel::Select);
changed();