]> Shamusworld >> Repos - schematic/blobdiff - src/scmwidget.cpp
Move DB access to NoteDialog class, new AlertDialog class.
[schematic] / src / scmwidget.cpp
index c9a175e34d784aa9ce753fef4164ee6d3e2a63eb..4c531ad756c58e80967cad14d155021d0fbae1c0 100644 (file)
@@ -14,7 +14,9 @@
 #include "scmwidget.h"
 #include <QtSql>
 #include "addresswidget.h"
+#include "alertdialog.h"
 #include "contactwidget.h"
+#include "notedialog.h"
 
 
 SCMWidget::SCMWidget(QWidget * parent/*= 0*/): QWidget(parent),
@@ -217,7 +219,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,13 +251,24 @@ void SCMWidget::GetPreviousVendor(void)
 
 void SCMWidget::CreateNote(void)
 {
-       QMessageBox::warning(this, "Approaching Singularity!", "TODO: Implementation");
+       NoteDialog dlg(currentUID);
+
+       if (dlg.exec() == false)
+               return;
+
+       UpdateNotes();
 }
 
 
 void SCMWidget::CreateAlert(void)
 {
+       AlertDialog dlg(currentUID);
+
+       if (dlg.exec() == false)
+               return;
+
        QMessageBox::warning(this, "Approaching Singularity!", "TODO: Implementation");
+//     UpdateAlerts();
 }
 
 
@@ -368,3 +381,29 @@ 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 = ?");
+       query.addBindValue(currentUID);
+       query.exec();
+
+       notes->clear();
+
+       while (query.next())
+       {
+               QListWidgetItem * item = new QListWidgetItem(query.value(0).toString());
+               notes->addItem(item);
+       }
+}
+
+
+void SCMWidget::UpdateAlerts(void)
+{
+       // TODO: Implementation
+}
+