X-Git-Url: http://shamusworld.gotdns.org/cgi-bin/gitweb.cgi?a=blobdiff_plain;f=src%2Fscmwidget.cpp;fp=src%2Fscmwidget.cpp;h=a04e8947050a424dcc4ba53e844b8ef8187796a3;hb=8eb70a8369511a54803410b9bc5918b3077bfb52;hp=c9a175e34d784aa9ce753fef4164ee6d3e2a63eb;hpb=4560acacef35db75a8bab4854d544d297f6c7cb9;p=schematic diff --git a/src/scmwidget.cpp b/src/scmwidget.cpp index c9a175e..a04e894 100644 --- a/src/scmwidget.cpp +++ b/src/scmwidget.cpp @@ -15,6 +15,7 @@ #include #include "addresswidget.h" #include "contactwidget.h" +#include "notedialog.h" SCMWidget::SCMWidget(QWidget * parent/*= 0*/): QWidget(parent), @@ -217,7 +218,7 @@ SCMWidget::SCMWidget(QWidget * parent/*= 0*/): QWidget(parent), connect(showOpen, SIGNAL(clicked()), this, SLOT(ShowOpenPOs())); connect(showClosed, SIGNAL(clicked()), this, SLOT(ShowClosedPOs())); connect(showAll, SIGNAL(clicked()), this, SLOT(ShowAllPOs())); - connect(addVendor, SIGNAL(clicked()), this, SLOT(AddVendor())); +// connect(addVendor, SIGNAL(clicked()), this, SLOT(AddVendor())); connect(addLocation, SIGNAL(clicked()), this, SLOT(AddLocation())); connect(addContact, SIGNAL(clicked()), this, SLOT(AddContact())); connect(editVendor, SIGNAL(clicked()), this, SLOT(EditVendor())); @@ -249,7 +250,22 @@ void SCMWidget::GetPreviousVendor(void) void SCMWidget::CreateNote(void) { - QMessageBox::warning(this, "Approaching Singularity!", "TODO: Implementation"); + NoteDialog dlg; + + if (dlg.exec() == true) + { + // Add note to DB for this user + QString note = dlg.note->document()->toPlainText(); + + QSqlQuery query; + query.prepare("INSERT INTO Notes VALUES ('', ?, NULL, ?)"); + query.addBindValue(currentUID); +// query.addBindValue(NULL); + query.addBindValue(note.toAscii()); + query.exec(); + + UpdateNotes(); + } } @@ -368,3 +384,27 @@ void SCMWidget::GetVendor(int key) } } + +void SCMWidget::UpdateNotes(void) +{ +// QMessageBox::warning(this, "Approaching Singularity!", "TODO: Implementation"); +//NID (P-key) | UID | POID | Note + + QSqlQuery query; + query.prepare("SELECT note FROM Notes WHERE uid = ?"); +// "c.name, email, c.address, phone1, phone2, fax, description, v.vlid FROM " +// "Vendor AS v LEFT OUTER JOIN Location AS l ON v.vid = l.vid " +// "LEFT OUTER JOIN (Contact AS c JOIN ContactType AS ct ON c.ctid = ct.ctid) " +// "ON v.vid = c.vid WHERE v.vid = ?"); + query.addBindValue(currentUID); + query.exec(); + + notes->clear(); + + while (query.next()) + { + QListWidgetItem * item = new QListWidgetItem(query.value(0).toString()); + notes->addItem(item); + } +} +