File: editfieldform.ui.h

package info (click to toggle)
sqlitebrowser 1.3-2.3
  • links: PTS
  • area: main
  • in suites: squeeze
  • size: 2,632 kB
  • ctags: 2,178
  • sloc: ansic: 2,645; cpp: 73; makefile: 58
file content (56 lines) | stat: -rw-r--r-- 1,874 bytes parent folder | download | duplicates (2)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
/****************************************************************************
** ui.h extension file, included from the uic-generated form implementation.
**
** If you wish to add, delete or rename functions or slots use
** Qt Designer which will update this file, preserving your code. Create an
** init() function in place of a constructor, and a destroy() function in
** place of a destructor.
*****************************************************************************/
void editFieldForm::setInitialValues(QString name, QString type)
{
    nameLineEdit->setText(name);
    typeBox->clear();
    typeBox->insertItem(type);
    QString tString = "";
    if (type.compare(tString)!=0) typeBox->insertItem(tString);
    tString = "TEXT";
    if (type.compare(tString)!=0) typeBox->insertItem(tString);
    tString = "NUMERIC";
    if (type.compare(tString)!=0) typeBox->insertItem(tString);
    tString = "BLOB";
    if (type.compare(tString)!=0) typeBox->insertItem(tString);
    tString = "INTEGER PRIMARY KEY";
    if (type.compare(tString)!=0) typeBox->insertItem(tString);
}

void editFieldForm::confirmEdit()
{
    QString fieldname = nameLineEdit->text();
    if (fieldname.isEmpty()) {
 QMessageBox::information( this, applicationName, "Field name can not be empty" );
	return;
    }
    if (fieldname.contains(" ")>0) {
	QMessageBox::warning( this, applicationName, "Spaces are not allowed in the field name" );
	return;
    }
    name = fieldname;
    type = typeBox->currentText();
    accept();
}

void editFieldForm::enableSave()
{
    saveButton->setEnabled(true);
}

void editFieldForm::getCustomType()
{
    addFieldTypeForm * addForm = new addFieldTypeForm( this, "addfieldtype", TRUE );
    if (addForm->exec())
   {
	QString nospaces = addForm->typeNameEdit->text().remove(" ");
	setInitialValues(nameLineEdit->text(),nospaces );
	enableSave();
   }
}