]> Shamusworld >> Repos - schematic/blobdiff - src/scmwidget.cpp
Move DB access to NoteDialog class, new AlertDialog class.
[schematic] / src / scmwidget.cpp
index a04e8947050a424dcc4ba53e844b8ef8187796a3..4c531ad756c58e80967cad14d155021d0fbae1c0 100644 (file)
@@ -14,6 +14,7 @@
 #include "scmwidget.h"
 #include <QtSql>
 #include "addresswidget.h"
+#include "alertdialog.h"
 #include "contactwidget.h"
 #include "notedialog.h"
 
@@ -250,28 +251,24 @@ void SCMWidget::GetPreviousVendor(void)
 
 void SCMWidget::CreateNote(void)
 {
-       NoteDialog dlg;
-       
-       if (dlg.exec() == true)
-       {
-               // Add note to DB for this user
-               QString note = dlg.note->document()->toPlainText();
+       NoteDialog dlg(currentUID);
 
-               QSqlQuery query;
-               query.prepare("INSERT INTO Notes VALUES ('', ?, NULL, ?)");
-               query.addBindValue(currentUID);
-//             query.addBindValue(NULL);
-               query.addBindValue(note.toAscii());
-               query.exec();
+       if (dlg.exec() == false)
+               return;
 
-               UpdateNotes();
-       }
+       UpdateNotes();
 }
 
 
 void SCMWidget::CreateAlert(void)
 {
+       AlertDialog dlg(currentUID);
+
+       if (dlg.exec() == false)
+               return;
+
        QMessageBox::warning(this, "Approaching Singularity!", "TODO: Implementation");
+//     UpdateAlerts();
 }
 
 
@@ -392,10 +389,6 @@ void SCMWidget::UpdateNotes(void)
 
        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();
 
@@ -408,3 +401,9 @@ void SCMWidget::UpdateNotes(void)
        }
 }
 
+
+void SCMWidget::UpdateAlerts(void)
+{
+       // TODO: Implementation
+}
+