+//
+// alertdialog.cpp: Dialog for creating & editing alerts
+//
+// Part of the SCheMatic Project
+// (C) 2012 Underground Software
+//
+// JLH = James Hammons <jlhamm@acm.org>
+//
+// WHO WHEN WHAT
+// --- ---------- ------------------------------------------------------------
+// JLH 12/13/2012 Created this file
+//
+
+#include "alertdialog.h"
+#include <QtSql>
+
+
+AlertDialog::AlertDialog(int uidToUse, QWidget * parent/*= 0*/): QDialog(parent), uid(uidToUse)
+{
+ note = new QTextEdit;
+ buttonBox = new QDialogButtonBox(QDialogButtonBox::Ok | QDialogButtonBox::Cancel);
+
+ connect(buttonBox, SIGNAL(accepted()), this, SLOT(accept()));
+ connect(buttonBox, SIGNAL(rejected()), this, SLOT(reject()));
+
+ QVBoxLayout * mainLayout = new QVBoxLayout;
+ mainLayout->addWidget(note);
+ mainLayout->addWidget(buttonBox);
+ setLayout(mainLayout);
+
+ setWindowTitle(tr("Alert"));
+}
+
+
+AlertDialog::~AlertDialog()
+{
+}
+
+
+void AlertDialog::accept(void)
+{
+ // Call base class version, so things work right
+ QDialog::accept();
+
+#if 0
+ // Add note to DB for this user
+ QString noteText = note->document()->toPlainText();
+
+ if (noteText.isEmpty())
+ return;
+
+ QSqlQuery query;
+ query.prepare("INSERT INTO Notes VALUES ('', ?, NULL, ?)");
+ query.addBindValue(uid);
+// query.addBindValue(NULL);
+ query.addBindValue(noteText.toAscii());
+ query.exec();
+#endif
+}
+