2005-11-19 23:35:22 +00:00
|
|
|
#include <q3listbox.h>
|
2004-11-28 05:46:10 +00:00
|
|
|
#include <qpixmap.h>
|
2005-11-19 23:35:22 +00:00
|
|
|
#include <q3listview.h>
|
|
|
|
#include <q3textedit.h>
|
2004-11-28 05:46:10 +00:00
|
|
|
#include "../../src/qgspgutil.h"
|
|
|
|
#include "spit_icons.h"
|
|
|
|
|
|
|
|
#include "qgseditreservedwordsdialog.h"
|
|
|
|
QgsEditReservedWordsDialog::QgsEditReservedWordsDialog(QWidget *parent, const char *name)
|
|
|
|
: QgsEditReservedWordsBase(parent, name)
|
|
|
|
{
|
|
|
|
// set focus indicator to span all columns
|
|
|
|
lvColumns->setAllColumnsShowFocus(true);
|
|
|
|
}
|
|
|
|
|
|
|
|
QgsEditReservedWordsDialog::~QgsEditReservedWordsDialog()
|
|
|
|
{
|
|
|
|
}
|
|
|
|
void QgsEditReservedWordsDialog::setReservedWords(const QStringList &words)
|
|
|
|
{
|
|
|
|
lstReservedWords->insertStringList(words);
|
|
|
|
}
|
2005-11-19 23:35:22 +00:00
|
|
|
void QgsEditReservedWordsDialog::checkWord(Q3ListViewItem *lvi, int col, const QString &word)
|
2004-11-28 05:46:10 +00:00
|
|
|
{
|
|
|
|
QgsPgUtil *pgu = QgsPgUtil::instance();
|
|
|
|
if(pgu->isReserved(word))
|
|
|
|
{
|
|
|
|
lvi->setPixmap(0, QPixmap(icon_reserved));
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
lvi->setPixmap(0, QPixmap(icon_ok));
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|
void QgsEditReservedWordsDialog::addColumn(QString column, bool isReserved, int index)
|
|
|
|
{
|
|
|
|
QString indexNumber;
|
|
|
|
indexNumber = indexNumber.setNum(index);
|
2005-11-19 23:35:22 +00:00
|
|
|
Q3ListViewItem *lvi = new Q3ListViewItem(lvColumns,"",column, indexNumber);
|
2004-11-28 05:46:10 +00:00
|
|
|
// lvi-setText(1, column);
|
|
|
|
lvi->setRenameEnabled(1, true);
|
|
|
|
if(isReserved)
|
|
|
|
{
|
|
|
|
lvi->setPixmap(0, QPixmap(icon_reserved));
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
lvi->setPixmap(0, QPixmap(icon_ok));
|
|
|
|
}
|
|
|
|
}
|
2005-11-19 23:35:22 +00:00
|
|
|
void QgsEditReservedWordsDialog::editWord(Q3ListViewItem *lvi)
|
2004-11-28 05:46:10 +00:00
|
|
|
{
|
|
|
|
if(lvi)
|
|
|
|
{
|
|
|
|
lvi->startRename(1);
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|
QStringList QgsEditReservedWordsDialog::columnNames()
|
|
|
|
{
|
|
|
|
QStringList cols;
|
|
|
|
lvColumns->setSorting(2);
|
|
|
|
lvColumns->sort();
|
2005-11-19 23:35:22 +00:00
|
|
|
Q3ListViewItem *lvi = lvColumns->firstChild();
|
2004-11-28 05:46:10 +00:00
|
|
|
while(lvi)
|
|
|
|
{
|
|
|
|
cols << lvi->text(1);
|
|
|
|
lvi = lvi->nextSibling();
|
|
|
|
}
|
|
|
|
return QStringList(cols);
|
|
|
|
}
|
2005-01-21 05:56:28 +00:00
|
|
|
void QgsEditReservedWordsDialog::setDescription(const QString &description)
|
|
|
|
{
|
|
|
|
txtExplanation->setText(description);
|
|
|
|
}
|
|
|
|
|