2006-03-05 17:24:44 +00:00
|
|
|
|
/**
|
|
|
|
|
* \file QCitationDialog.C
|
|
|
|
|
* This file is part of LyX, the document processor.
|
|
|
|
|
* Licence details can be found in the file COPYING.
|
|
|
|
|
*
|
|
|
|
|
* \author Kalle Dalheimer
|
|
|
|
|
* \author John Levon
|
|
|
|
|
* \author J<EFBFBD>rgen Spitzm<EFBFBD>ller
|
2007-03-25 01:32:12 +00:00
|
|
|
|
* \author Abdelrazak Younes
|
2006-03-05 17:24:44 +00:00
|
|
|
|
*
|
|
|
|
|
* Full author contact details are available in file CREDITS.
|
|
|
|
|
*/
|
|
|
|
|
|
|
|
|
|
#include <config.h>
|
|
|
|
|
|
|
|
|
|
#include "QCitationDialog.h"
|
|
|
|
|
|
2007-03-25 01:32:12 +00:00
|
|
|
|
#include "QCitation.h"
|
2006-03-25 21:26:09 +00:00
|
|
|
|
|
2007-03-25 01:32:12 +00:00
|
|
|
|
#include "frontends/controllers/biblio.h"
|
|
|
|
|
#include "frontends/controllers/ControlCitation.h"
|
2006-03-05 17:24:44 +00:00
|
|
|
|
|
2007-03-25 01:32:12 +00:00
|
|
|
|
#include "debug.h"
|
|
|
|
|
#include "gettext.h"
|
2006-03-05 17:24:44 +00:00
|
|
|
|
|
2006-06-28 08:28:16 +00:00
|
|
|
|
#include <vector>
|
|
|
|
|
#include <string>
|
2006-03-05 17:24:44 +00:00
|
|
|
|
|
2007-01-07 09:44:57 +00:00
|
|
|
|
#include <QCloseEvent>
|
2007-01-08 06:52:20 +00:00
|
|
|
|
#include <QKeyEvent>
|
2007-01-07 09:44:57 +00:00
|
|
|
|
|
2006-03-25 21:26:09 +00:00
|
|
|
|
using std::vector;
|
2006-06-28 08:28:16 +00:00
|
|
|
|
using std::string;
|
2006-03-05 17:24:44 +00:00
|
|
|
|
|
|
|
|
|
namespace lyx {
|
|
|
|
|
namespace frontend {
|
|
|
|
|
|
2006-03-25 21:26:09 +00:00
|
|
|
|
|
2006-04-11 08:26:43 +00:00
|
|
|
|
QCitationDialog::QCitationDialog(Dialog & dialog, QCitation * form)
|
2006-10-09 10:35:14 +00:00
|
|
|
|
: Dialog::View(dialog, _("Citation")), form_(form)
|
2006-03-05 17:24:44 +00:00
|
|
|
|
{
|
|
|
|
|
setupUi(this);
|
2006-04-05 23:56:29 +00:00
|
|
|
|
|
2006-08-17 08:52:45 +00:00
|
|
|
|
setWindowTitle(toqstr("LyX: " + getTitle()));
|
2006-04-11 08:26:43 +00:00
|
|
|
|
|
2007-01-08 06:52:20 +00:00
|
|
|
|
selectedLV->setModel(form_->selected());
|
2006-03-25 21:26:09 +00:00
|
|
|
|
availableLV->setModel(form_->available());
|
|
|
|
|
|
2007-01-07 09:44:57 +00:00
|
|
|
|
connect(citationStyleCO, SIGNAL(activated(int)),
|
2006-06-28 08:28:16 +00:00
|
|
|
|
this, SLOT(changed()));
|
2007-01-07 09:44:57 +00:00
|
|
|
|
connect(fulllistCB, SIGNAL(clicked()),
|
2006-06-28 08:28:16 +00:00
|
|
|
|
this, SLOT(changed()));
|
2007-01-07 09:44:57 +00:00
|
|
|
|
connect(forceuppercaseCB, SIGNAL(clicked()),
|
2006-06-28 08:28:16 +00:00
|
|
|
|
this, SLOT(changed()));
|
2007-01-07 09:44:57 +00:00
|
|
|
|
connect(textBeforeED, SIGNAL(textChanged(const QString&)),
|
2006-06-28 08:28:16 +00:00
|
|
|
|
this, SLOT(changed()));
|
2007-01-07 09:44:57 +00:00
|
|
|
|
connect(textAfterED, SIGNAL(textChanged(const QString&)),
|
2006-06-28 08:28:16 +00:00
|
|
|
|
this, SLOT(changed()));
|
2007-01-07 09:44:57 +00:00
|
|
|
|
connect(clearPB, SIGNAL(clicked()),
|
2006-12-15 09:58:44 +00:00
|
|
|
|
findLE, SLOT(clear()));
|
|
|
|
|
connect(availableLV->selectionModel(),
|
|
|
|
|
SIGNAL(currentChanged(const QModelIndex &, const QModelIndex &)),
|
|
|
|
|
this, SLOT(availableChanged(const QModelIndex &, const QModelIndex &)));
|
|
|
|
|
connect(selectedLV->selectionModel(),
|
|
|
|
|
SIGNAL(currentChanged(const QModelIndex &, const QModelIndex &)),
|
|
|
|
|
this, SLOT(selectedChanged(const QModelIndex &, const QModelIndex &)));
|
2006-03-25 21:26:09 +00:00
|
|
|
|
}
|
2006-03-05 17:24:44 +00:00
|
|
|
|
|
2006-06-28 08:28:16 +00:00
|
|
|
|
|
2006-03-25 21:26:09 +00:00
|
|
|
|
QCitationDialog::~QCitationDialog()
|
|
|
|
|
{
|
2006-03-05 17:24:44 +00:00
|
|
|
|
}
|
|
|
|
|
|
2006-06-28 08:28:16 +00:00
|
|
|
|
|
2007-01-08 06:52:20 +00:00
|
|
|
|
void QCitationDialog::keyPressEvent(QKeyEvent * event)
|
|
|
|
|
{
|
|
|
|
|
if (event->key() == Qt::Key_Escape) {
|
|
|
|
|
form_->clearSelection();
|
|
|
|
|
form_->clearParams();
|
|
|
|
|
event->accept();
|
|
|
|
|
close();
|
|
|
|
|
} else
|
|
|
|
|
event->ignore();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
2007-01-07 09:44:57 +00:00
|
|
|
|
void QCitationDialog::closeEvent(QCloseEvent * e)
|
|
|
|
|
{
|
|
|
|
|
form_->clearSelection();
|
|
|
|
|
form_->clearParams();
|
|
|
|
|
e->accept();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
2006-04-11 08:26:43 +00:00
|
|
|
|
void QCitationDialog::apply()
|
|
|
|
|
{
|
2006-08-17 08:52:45 +00:00
|
|
|
|
int const choice = std::max(0, citationStyleCO->currentIndex());
|
2006-06-28 08:28:16 +00:00
|
|
|
|
style_ = choice;
|
2006-04-11 08:26:43 +00:00
|
|
|
|
bool const full = fulllistCB->isChecked();
|
|
|
|
|
bool const force = forceuppercaseCB->isChecked();
|
|
|
|
|
|
|
|
|
|
QString const before = textBeforeED->text();
|
|
|
|
|
QString const after = textAfterED->text();
|
|
|
|
|
|
|
|
|
|
form_->apply(choice, full, force, before, after);
|
|
|
|
|
}
|
|
|
|
|
|
2006-03-05 17:24:44 +00:00
|
|
|
|
|
2006-04-11 08:26:43 +00:00
|
|
|
|
void QCitationDialog::hide()
|
2006-03-05 17:24:44 +00:00
|
|
|
|
{
|
2007-01-07 09:44:57 +00:00
|
|
|
|
form_->clearParams();
|
2006-03-25 21:26:09 +00:00
|
|
|
|
accept();
|
2006-03-05 17:24:44 +00:00
|
|
|
|
}
|
|
|
|
|
|
2006-04-11 08:26:43 +00:00
|
|
|
|
|
|
|
|
|
void QCitationDialog::show()
|
2006-03-25 21:26:09 +00:00
|
|
|
|
{
|
2007-03-25 01:32:12 +00:00
|
|
|
|
findLE->clear();
|
|
|
|
|
availableLV->setFocus();
|
2006-04-11 08:26:43 +00:00
|
|
|
|
QDialog::show();
|
2006-03-25 21:26:09 +00:00
|
|
|
|
}
|
2006-03-05 17:24:44 +00:00
|
|
|
|
|
2006-04-11 08:26:43 +00:00
|
|
|
|
|
|
|
|
|
bool QCitationDialog::isVisible() const
|
2006-03-05 17:24:44 +00:00
|
|
|
|
{
|
2006-04-11 08:26:43 +00:00
|
|
|
|
return QDialog::isVisible();
|
2006-03-25 21:26:09 +00:00
|
|
|
|
}
|
2006-04-11 08:26:43 +00:00
|
|
|
|
|
2006-03-25 21:26:09 +00:00
|
|
|
|
|
2006-04-11 08:26:43 +00:00
|
|
|
|
void QCitationDialog::on_okPB_clicked()
|
2006-03-25 21:26:09 +00:00
|
|
|
|
{
|
2006-04-11 08:26:43 +00:00
|
|
|
|
apply();
|
2006-12-15 09:58:44 +00:00
|
|
|
|
form_->clearSelection();
|
2007-01-07 09:44:57 +00:00
|
|
|
|
hide();
|
2006-03-25 21:26:09 +00:00
|
|
|
|
}
|
2006-03-05 17:24:44 +00:00
|
|
|
|
|
2006-06-28 08:28:16 +00:00
|
|
|
|
|
2006-04-11 08:26:43 +00:00
|
|
|
|
void QCitationDialog::on_cancelPB_clicked()
|
2006-03-25 21:26:09 +00:00
|
|
|
|
{
|
2006-12-15 09:58:44 +00:00
|
|
|
|
form_->clearSelection();
|
2007-01-07 09:44:57 +00:00
|
|
|
|
hide();
|
2006-04-11 08:26:43 +00:00
|
|
|
|
}
|
2006-03-25 21:26:09 +00:00
|
|
|
|
|
2006-06-28 08:28:16 +00:00
|
|
|
|
|
2006-04-11 08:26:43 +00:00
|
|
|
|
void QCitationDialog::on_applyPB_clicked()
|
|
|
|
|
{
|
|
|
|
|
apply();
|
2006-03-05 17:24:44 +00:00
|
|
|
|
}
|
|
|
|
|
|
2006-06-28 08:28:16 +00:00
|
|
|
|
|
2006-04-11 08:26:43 +00:00
|
|
|
|
void QCitationDialog::on_restorePB_clicked()
|
|
|
|
|
{
|
2007-03-25 01:32:12 +00:00
|
|
|
|
form_->init();
|
2006-04-11 08:26:43 +00:00
|
|
|
|
update();
|
|
|
|
|
}
|
2006-03-05 17:24:44 +00:00
|
|
|
|
|
2006-06-28 08:28:16 +00:00
|
|
|
|
|
2006-04-11 08:26:43 +00:00
|
|
|
|
void QCitationDialog::update()
|
2006-03-05 17:24:44 +00:00
|
|
|
|
{
|
2007-03-25 01:32:12 +00:00
|
|
|
|
if (selectedLV->selectionModel()->selectedIndexes().isEmpty()) {
|
|
|
|
|
if (availableLV->selectionModel()->selectedIndexes().isEmpty()
|
|
|
|
|
&& availableLV->model()->rowCount() > 0)
|
|
|
|
|
availableLV->setCurrentIndex(availableLV->model()->index(0,0));
|
2006-06-28 08:28:16 +00:00
|
|
|
|
updateInfo(availableLV->currentIndex());
|
2007-03-25 01:32:12 +00:00
|
|
|
|
} else
|
|
|
|
|
updateInfo(selectedLV->currentIndex());
|
2006-06-28 08:28:16 +00:00
|
|
|
|
|
2006-03-25 21:26:09 +00:00
|
|
|
|
setButtons();
|
|
|
|
|
|
2006-04-11 08:26:43 +00:00
|
|
|
|
textBeforeED->setText(form_->textBefore());
|
|
|
|
|
textAfterED->setText(form_->textAfter());
|
2006-03-05 17:24:44 +00:00
|
|
|
|
|
2006-03-25 21:26:09 +00:00
|
|
|
|
fillStyles();
|
|
|
|
|
updateStyle();
|
|
|
|
|
}
|
|
|
|
|
|
2006-06-28 08:28:16 +00:00
|
|
|
|
|
2006-03-25 21:26:09 +00:00
|
|
|
|
void QCitationDialog::updateStyle()
|
|
|
|
|
{
|
2006-04-11 08:26:43 +00:00
|
|
|
|
biblio::CiteEngine const engine = form_->getEngine();
|
2006-03-25 21:26:09 +00:00
|
|
|
|
bool const natbib_engine =
|
|
|
|
|
engine == biblio::ENGINE_NATBIB_AUTHORYEAR ||
|
|
|
|
|
engine == biblio::ENGINE_NATBIB_NUMERICAL;
|
|
|
|
|
bool const basic_engine = engine == biblio::ENGINE_BASIC;
|
|
|
|
|
|
|
|
|
|
fulllistCB->setEnabled(natbib_engine);
|
|
|
|
|
forceuppercaseCB->setEnabled(natbib_engine);
|
|
|
|
|
textBeforeED->setEnabled(!basic_engine);
|
2006-12-15 09:58:44 +00:00
|
|
|
|
textBeforeLA->setEnabled(!basic_engine);
|
2006-03-25 21:26:09 +00:00
|
|
|
|
|
2006-04-11 08:26:43 +00:00
|
|
|
|
string const & command = form_->params().getCmdName();
|
2006-03-25 21:26:09 +00:00
|
|
|
|
|
|
|
|
|
// Find the style of the citekeys
|
|
|
|
|
vector<biblio::CiteStyle> const & styles =
|
|
|
|
|
ControlCitation::getCiteStyles();
|
|
|
|
|
biblio::CitationStyle const cs(command);
|
|
|
|
|
|
|
|
|
|
vector<biblio::CiteStyle>::const_iterator cit =
|
|
|
|
|
std::find(styles.begin(), styles.end(), cs.style);
|
|
|
|
|
|
|
|
|
|
// restore the latest natbib style
|
|
|
|
|
if (style_ >= 0 && style_ < citationStyleCO->count())
|
2006-08-17 08:52:45 +00:00
|
|
|
|
citationStyleCO->setCurrentIndex(style_);
|
2006-03-25 21:26:09 +00:00
|
|
|
|
else
|
2006-08-17 08:52:45 +00:00
|
|
|
|
citationStyleCO->setCurrentIndex(0);
|
2006-04-11 08:26:43 +00:00
|
|
|
|
|
2006-03-25 21:26:09 +00:00
|
|
|
|
fulllistCB->setChecked(false);
|
|
|
|
|
forceuppercaseCB->setChecked(false);
|
|
|
|
|
|
|
|
|
|
if (cit != styles.end()) {
|
|
|
|
|
int const i = int(cit - styles.begin());
|
2006-08-17 08:52:45 +00:00
|
|
|
|
citationStyleCO->setCurrentIndex(i);
|
2006-03-25 21:26:09 +00:00
|
|
|
|
fulllistCB->setChecked(cs.full);
|
|
|
|
|
forceuppercaseCB->setChecked(cs.forceUCase);
|
2006-03-05 17:24:44 +00:00
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
2006-03-25 21:26:09 +00:00
|
|
|
|
void QCitationDialog::fillStyles()
|
2006-03-05 17:24:44 +00:00
|
|
|
|
{
|
2006-08-17 08:52:45 +00:00
|
|
|
|
int const orig = citationStyleCO->currentIndex();
|
2006-03-25 21:26:09 +00:00
|
|
|
|
|
|
|
|
|
citationStyleCO->clear();
|
|
|
|
|
|
|
|
|
|
QStringList selected_keys = form_->selected()->stringList();
|
2006-04-11 08:26:43 +00:00
|
|
|
|
if (selected_keys.empty()) {
|
|
|
|
|
citationStyleCO->setEnabled(false);
|
|
|
|
|
citationStyleLA->setEnabled(false);
|
2006-03-05 17:24:44 +00:00
|
|
|
|
return;
|
2006-04-11 08:26:43 +00:00
|
|
|
|
}
|
2006-03-25 21:26:09 +00:00
|
|
|
|
|
2006-12-15 09:58:44 +00:00
|
|
|
|
int curr = selectedLV->model()->rowCount() - 1;
|
|
|
|
|
if (curr < 0)
|
2006-03-25 21:26:09 +00:00
|
|
|
|
return;
|
2006-12-15 09:58:44 +00:00
|
|
|
|
|
|
|
|
|
if (!selectedLV->selectionModel()->selectedIndexes().empty())
|
|
|
|
|
curr = selectedLV->selectionModel()->selectedIndexes()[0].row();
|
2006-03-25 21:26:09 +00:00
|
|
|
|
|
2006-04-11 08:26:43 +00:00
|
|
|
|
QStringList sty = form_->citationStyles(curr);
|
2006-03-25 21:26:09 +00:00
|
|
|
|
|
2006-04-11 08:26:43 +00:00
|
|
|
|
bool const basic_engine =
|
|
|
|
|
(form_->getEngine() == biblio::ENGINE_BASIC);
|
2006-03-25 21:26:09 +00:00
|
|
|
|
|
2006-04-11 08:26:43 +00:00
|
|
|
|
citationStyleCO->setEnabled(!sty.isEmpty() && !basic_engine);
|
|
|
|
|
citationStyleLA->setEnabled(!sty.isEmpty() && !basic_engine);
|
2006-03-25 21:26:09 +00:00
|
|
|
|
|
2006-12-15 09:58:44 +00:00
|
|
|
|
if (sty.isEmpty() || basic_engine)
|
|
|
|
|
return;
|
|
|
|
|
|
2006-04-11 08:26:43 +00:00
|
|
|
|
citationStyleCO->insertItems(0, sty);
|
2006-03-05 17:24:44 +00:00
|
|
|
|
|
2006-03-25 21:26:09 +00:00
|
|
|
|
if (orig != -1 && orig < citationStyleCO->count())
|
2006-08-17 08:52:45 +00:00
|
|
|
|
citationStyleCO->setCurrentIndex(orig);
|
2006-03-05 17:24:44 +00:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
2006-06-28 08:28:16 +00:00
|
|
|
|
bool QCitationDialog::isSelected(const QModelIndex & idx)
|
2006-03-05 17:24:44 +00:00
|
|
|
|
{
|
2006-06-28 08:28:16 +00:00
|
|
|
|
QString const str = idx.data().toString();
|
|
|
|
|
return !form_->selected()->stringList().filter(str).isEmpty();
|
|
|
|
|
}
|
2006-03-05 17:24:44 +00:00
|
|
|
|
|
|
|
|
|
|
2006-06-28 08:28:16 +00:00
|
|
|
|
void QCitationDialog::setButtons()
|
|
|
|
|
{
|
|
|
|
|
int const arows = availableLV->model()->rowCount();
|
|
|
|
|
addPB->setEnabled(arows>0 && !isSelected(availableLV->currentIndex()));
|
2006-03-05 17:24:44 +00:00
|
|
|
|
|
2006-06-28 08:28:16 +00:00
|
|
|
|
int const srows = selectedLV->model()->rowCount();
|
|
|
|
|
int const sel_nr = selectedLV->currentIndex().row();
|
2006-03-25 21:26:09 +00:00
|
|
|
|
deletePB->setEnabled(sel_nr >= 0);
|
|
|
|
|
upPB->setEnabled(sel_nr > 0);
|
2006-06-28 08:28:16 +00:00
|
|
|
|
downPB->setEnabled(sel_nr >= 0 && sel_nr < srows - 1);
|
|
|
|
|
applyPB->setEnabled(srows>0);
|
|
|
|
|
okPB->setEnabled(srows>0);
|
2006-03-25 21:26:09 +00:00
|
|
|
|
}
|
2006-03-05 17:24:44 +00:00
|
|
|
|
|
2006-03-25 21:26:09 +00:00
|
|
|
|
|
2006-06-28 08:28:16 +00:00
|
|
|
|
void QCitationDialog::updateInfo(const QModelIndex & idx)
|
2006-03-05 17:24:44 +00:00
|
|
|
|
{
|
2006-06-28 08:28:16 +00:00
|
|
|
|
if (idx.isValid()) {
|
|
|
|
|
QString const keytxt = form_->getKeyInfo(idx.data().toString());
|
|
|
|
|
infoML->document()->setPlainText(keytxt);
|
|
|
|
|
} else
|
|
|
|
|
infoML->document()->clear();
|
2006-03-25 21:26:09 +00:00
|
|
|
|
}
|
2006-03-05 17:24:44 +00:00
|
|
|
|
|
|
|
|
|
|
2006-06-28 08:28:16 +00:00
|
|
|
|
void QCitationDialog::on_selectedLV_clicked(const QModelIndex & idx)
|
2006-03-25 21:26:09 +00:00
|
|
|
|
{
|
2007-03-25 01:32:12 +00:00
|
|
|
|
availableLV->selectionModel()->reset();
|
|
|
|
|
update();
|
2006-12-15 09:58:44 +00:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
void QCitationDialog::selectedChanged(const QModelIndex & idx, const QModelIndex &)
|
|
|
|
|
{
|
|
|
|
|
if (!idx.isValid())
|
|
|
|
|
return;
|
|
|
|
|
|
2007-03-25 01:32:12 +00:00
|
|
|
|
availableLV->selectionModel()->reset();
|
|
|
|
|
update();
|
2006-03-25 21:26:09 +00:00
|
|
|
|
}
|
|
|
|
|
|
2006-12-15 09:58:44 +00:00
|
|
|
|
|
2006-06-28 08:28:16 +00:00
|
|
|
|
void QCitationDialog::on_availableLV_clicked(const QModelIndex & idx)
|
2006-03-25 21:26:09 +00:00
|
|
|
|
{
|
2007-03-25 01:32:12 +00:00
|
|
|
|
selectedLV->selectionModel()->reset();
|
|
|
|
|
update();
|
2006-12-15 09:58:44 +00:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
void QCitationDialog::availableChanged(const QModelIndex & idx, const QModelIndex &)
|
|
|
|
|
{
|
|
|
|
|
if (!idx.isValid())
|
|
|
|
|
return;
|
|
|
|
|
|
2007-03-25 01:32:12 +00:00
|
|
|
|
selectedLV->selectionModel()->reset();
|
|
|
|
|
update();
|
2006-03-05 17:24:44 +00:00
|
|
|
|
}
|
|
|
|
|
|
2006-06-28 08:28:16 +00:00
|
|
|
|
|
|
|
|
|
void QCitationDialog::on_availableLV_activated(const QModelIndex & idx)
|
2006-03-25 21:26:09 +00:00
|
|
|
|
{
|
2006-06-28 08:28:16 +00:00
|
|
|
|
if (isSelected(idx))
|
2006-03-25 21:26:09 +00:00
|
|
|
|
return;
|
2006-03-26 18:35:15 +00:00
|
|
|
|
|
2007-03-25 01:32:12 +00:00
|
|
|
|
selectedLV->selectionModel()->reset();
|
|
|
|
|
on_addPB_clicked();
|
|
|
|
|
if (selectedLV->model()->rowCount() == 1)
|
|
|
|
|
on_okPB_clicked();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
void QCitationDialog::on_availableLV_entered(const QModelIndex & idx)
|
|
|
|
|
{
|
2006-03-25 21:26:09 +00:00
|
|
|
|
}
|
2006-03-05 17:24:44 +00:00
|
|
|
|
|
2006-06-28 08:28:16 +00:00
|
|
|
|
|
|
|
|
|
void QCitationDialog::on_addPB_clicked()
|
2006-03-05 17:24:44 +00:00
|
|
|
|
{
|
2006-06-28 08:28:16 +00:00
|
|
|
|
QModelIndex idx = selectedLV->currentIndex();
|
|
|
|
|
form_->addKey(availableLV->currentIndex());
|
|
|
|
|
if (idx.isValid())
|
|
|
|
|
selectedLV->setCurrentIndex(idx);
|
2007-03-25 01:32:12 +00:00
|
|
|
|
selectedLV->selectionModel()->reset();
|
|
|
|
|
update();
|
2006-03-25 21:26:09 +00:00
|
|
|
|
}
|
2006-03-05 17:24:44 +00:00
|
|
|
|
|
|
|
|
|
|
2006-06-28 08:28:16 +00:00
|
|
|
|
void QCitationDialog::on_deletePB_clicked()
|
2006-03-25 21:26:09 +00:00
|
|
|
|
{
|
2006-06-28 08:28:16 +00:00
|
|
|
|
QModelIndex idx = selectedLV->currentIndex();
|
|
|
|
|
int nrows = selectedLV->model()->rowCount();
|
|
|
|
|
|
|
|
|
|
form_->deleteKey(idx);
|
2006-03-05 17:24:44 +00:00
|
|
|
|
|
2006-06-28 08:28:16 +00:00
|
|
|
|
if (idx.row() == nrows - 1)
|
|
|
|
|
idx = idx.sibling(idx.row() - 1, idx.column());
|
2006-03-05 17:24:44 +00:00
|
|
|
|
|
2006-06-28 08:28:16 +00:00
|
|
|
|
if (nrows>1)
|
|
|
|
|
selectedLV->setCurrentIndex(idx);
|
2006-04-11 08:26:43 +00:00
|
|
|
|
|
2007-03-25 01:32:12 +00:00
|
|
|
|
availableLV->selectionModel()->reset();
|
|
|
|
|
update();
|
2006-03-25 21:26:09 +00:00
|
|
|
|
}
|
2006-03-05 17:24:44 +00:00
|
|
|
|
|
|
|
|
|
|
2006-06-28 08:28:16 +00:00
|
|
|
|
void QCitationDialog::on_upPB_clicked()
|
2006-03-25 21:26:09 +00:00
|
|
|
|
{
|
2006-06-28 08:28:16 +00:00
|
|
|
|
QModelIndex idx = selectedLV->currentIndex();
|
|
|
|
|
form_->upKey(idx);
|
|
|
|
|
selectedLV->setCurrentIndex(idx.sibling(idx.row() - 1, idx.column()));
|
2007-03-25 01:32:12 +00:00
|
|
|
|
availableLV->selectionModel()->reset();
|
|
|
|
|
update();
|
2006-03-05 17:24:44 +00:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
2006-06-28 08:28:16 +00:00
|
|
|
|
void QCitationDialog::on_downPB_clicked()
|
2006-03-25 21:26:09 +00:00
|
|
|
|
{
|
2006-06-28 08:28:16 +00:00
|
|
|
|
QModelIndex idx = selectedLV->currentIndex();
|
|
|
|
|
form_->downKey(idx);
|
|
|
|
|
selectedLV->setCurrentIndex(idx.sibling(idx.row() + 1, idx.column()));
|
2007-03-25 01:32:12 +00:00
|
|
|
|
availableLV->selectionModel()->reset();
|
|
|
|
|
update();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
void QCitationDialog::findText(QString const & text)
|
|
|
|
|
{
|
|
|
|
|
bool const case_sentitive = caseCB->checkState();
|
|
|
|
|
bool const reg_exp = regexCB->checkState();
|
|
|
|
|
form_->findKey(text, false, case_sentitive, reg_exp);
|
|
|
|
|
selectedLV->selectionModel()->reset();
|
|
|
|
|
update();
|
2006-03-05 17:24:44 +00:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
2006-06-28 08:28:16 +00:00
|
|
|
|
void QCitationDialog::on_findLE_textChanged(const QString & text)
|
2006-03-05 17:24:44 +00:00
|
|
|
|
{
|
2006-12-15 09:58:44 +00:00
|
|
|
|
clearPB->setDisabled(text.isEmpty());
|
|
|
|
|
if (text.isEmpty())
|
|
|
|
|
findLE->setFocus();
|
2007-03-25 01:32:12 +00:00
|
|
|
|
findText(text);
|
|
|
|
|
}
|
2006-12-15 09:58:44 +00:00
|
|
|
|
|
2007-03-25 01:32:12 +00:00
|
|
|
|
|
|
|
|
|
void QCitationDialog::on_caseCB_stateChanged(int)
|
|
|
|
|
{
|
|
|
|
|
findText(findLE->text());
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
void QCitationDialog::on_regexCB_stateChanged(int)
|
|
|
|
|
{
|
|
|
|
|
findText(findLE->text());
|
2006-03-05 17:24:44 +00:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
2006-06-28 08:28:16 +00:00
|
|
|
|
void QCitationDialog::changed()
|
2006-03-05 17:24:44 +00:00
|
|
|
|
{
|
2006-06-28 08:28:16 +00:00
|
|
|
|
fillStyles();
|
|
|
|
|
setButtons();
|
2006-03-05 17:24:44 +00:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
} // namespace frontend
|
|
|
|
|
} // namespace lyx
|
2006-05-18 08:51:12 +00:00
|
|
|
|
|
|
|
|
|
#include "QCitationDialog_moc.cpp"
|