X-Git-Url: http://shamusworld.gotdns.org/cgi-bin/gitweb.cgi?a=blobdiff_plain;f=src%2Fnotedialog.cpp;h=0b2fbf9ba1b81153f2a75c12aae4471c2a7c62e3;hb=83b9c871148f01ee15671b08dc807bd8901c8b22;hp=c91b5bf571cd24c2cdc8eb8f1b7cca54db5b1b27;hpb=c5836ee59baed29944b224faa61904b005affe60;p=schematic diff --git a/src/notedialog.cpp b/src/notedialog.cpp index c91b5bf..0b2fbf9 100644 --- a/src/notedialog.cpp +++ b/src/notedialog.cpp @@ -12,17 +12,12 @@ // #include "notedialog.h" +#include -NoteDialog::NoteDialog(QWidget * parent/*= 0*/): QDialog(parent) +NoteDialog::NoteDialog(int uidToUse, QWidget * parent/*= 0*/): QDialog(parent), uid(uidToUse) { -// tabWidget = new QTabWidget; -// generalTab = new GeneralTab(this); -// tabWidget->addTab(generalTab, tr("General")); -// tabWidget->addTab(new PermissionsTab(fileInfo), tr("Permissions")); -// tabWidget->addTab(new ApplicationsTab(fileInfo), tr("Applications")); note = new QTextEdit; - buttonBox = new QDialogButtonBox(QDialogButtonBox::Ok | QDialogButtonBox::Cancel); connect(buttonBox, SIGNAL(accepted()), this, SLOT(accept())); @@ -36,7 +31,28 @@ NoteDialog::NoteDialog(QWidget * parent/*= 0*/): QDialog(parent) setWindowTitle(tr("Note")); } + NoteDialog::~NoteDialog() { } + +void NoteDialog::accept(void) +{ + // Call base class version, so things work right + QDialog::accept(); + + // 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(); +} +