2 // alertdialog.cpp: Dialog for creating & editing alerts
4 // Part of the SCheMatic Project
5 // (C) 2012 Underground Software
7 // JLH = James Hammons <jlhamm@acm.org>
10 // --- ---------- ------------------------------------------------------------
11 // JLH 12/13/2012 Created this file
14 #include "alertdialog.h"
18 AlertDialog::AlertDialog(int uidToUse, QWidget * parent/*= 0*/): QDialog(parent), uid(uidToUse)
21 buttonBox = new QDialogButtonBox(QDialogButtonBox::Ok | QDialogButtonBox::Cancel);
23 connect(buttonBox, SIGNAL(accepted()), this, SLOT(accept()));
24 connect(buttonBox, SIGNAL(rejected()), this, SLOT(reject()));
26 QVBoxLayout * mainLayout = new QVBoxLayout;
27 mainLayout->addWidget(note);
28 mainLayout->addWidget(buttonBox);
29 setLayout(mainLayout);
31 setWindowTitle(tr("Alert"));
35 AlertDialog::~AlertDialog()
40 void AlertDialog::accept(void)
42 // Call base class version, so things work right
46 // Add note to DB for this user
47 QString noteText = note->document()->toPlainText();
49 if (noteText.isEmpty())
53 query.prepare("INSERT INTO Notes VALUES ('', ?, NULL, ?)");
54 query.addBindValue(uid);
55 // query.addBindValue(NULL);
56 query.addBindValue(noteText.toAscii());