[Tux4kids-commits] r1428 - in tux4kids-admin/trunk: libtux4kidsadmin tux4kids-admin/src
Michał Świtakowski
swistakers-guest at alioth.debian.org
Thu Aug 13 20:41:45 UTC 2009
Author: swistakers-guest
Date: 2009-08-13 20:41:45 +0000 (Thu, 13 Aug 2009)
New Revision: 1428
Modified:
tux4kids-admin/trunk/libtux4kidsadmin/schoolDatabase.cpp
tux4kids-admin/trunk/libtux4kidsadmin/studentDir.cpp
tux4kids-admin/trunk/tux4kids-admin/src/CMakeLists.txt
tux4kids-admin/trunk/tux4kids-admin/src/errorLog.cpp
tux4kids-admin/trunk/tux4kids-admin/src/manageClassesWidget.cpp
tux4kids-admin/trunk/tux4kids-admin/src/manageTeachersWidget.cpp
Log:
logging database errors
Modified: tux4kids-admin/trunk/libtux4kidsadmin/schoolDatabase.cpp
===================================================================
--- tux4kids-admin/trunk/libtux4kidsadmin/schoolDatabase.cpp 2009-08-13 20:12:32 UTC (rev 1427)
+++ tux4kids-admin/trunk/libtux4kidsadmin/schoolDatabase.cpp 2009-08-13 20:41:45 UTC (rev 1428)
@@ -108,7 +108,6 @@
if (!createTrigger1.isActive()) {
error = true;
lastError = createTrigger1.lastError().text();
- qDebug() << 1 << lastError;
return;
}
@@ -121,7 +120,6 @@
if (!createTrigger2.isActive()) {
error = true;
lastError = createTrigger2.lastError().text();
- qDebug() << 2 << lastError;
return;
}
@@ -133,7 +131,6 @@
if (!createTrigger3.isActive()) {
error = true;
lastError = createTrigger3.lastError().text();
- qDebug() << 3 << lastError;
return;
}
@@ -146,7 +143,6 @@
if (!createTrigger4.isActive()) {
error = true;
lastError = createTrigger4.lastError().text();
- qDebug() << 4 << lastError;
return;
}
@@ -159,7 +155,6 @@
if (!createTrigger5.isActive()) {
error = true;
lastError = createTrigger5.lastError().text();
- qDebug() << 5 << lastError;
return;
}
@@ -171,7 +166,6 @@
if (!createTrigger6.isActive()) {
error = true;
lastError = createTrigger6.lastError().text();
- qDebug() << 6 << lastError;
return;
}
Modified: tux4kids-admin/trunk/libtux4kidsadmin/studentDir.cpp
===================================================================
--- tux4kids-admin/trunk/libtux4kidsadmin/studentDir.cpp 2009-08-13 20:12:32 UTC (rev 1427)
+++ tux4kids-admin/trunk/libtux4kidsadmin/studentDir.cpp 2009-08-13 20:41:45 UTC (rev 1428)
@@ -43,7 +43,6 @@
QString path = mainDir.filePath(dirName);
QString profileType = ProfileDir::profileType(path);
- qDebug() << path << profileType;
profiles.append(ProfileDirFactory::instance().create(profileType, path, 0));
}
}
Modified: tux4kids-admin/trunk/tux4kids-admin/src/CMakeLists.txt
===================================================================
--- tux4kids-admin/trunk/tux4kids-admin/src/CMakeLists.txt 2009-08-13 20:12:32 UTC (rev 1427)
+++ tux4kids-admin/trunk/tux4kids-admin/src/CMakeLists.txt 2009-08-13 20:41:45 UTC (rev 1428)
@@ -7,6 +7,8 @@
main.cpp
mainWindow.cpp
mainController.cpp
+ applicationInfo.cpp
+ errorLog.cpp
pluginManager.cpp
pluginManagerDialog.cpp
manageStudentsWidget.cpp
Modified: tux4kids-admin/trunk/tux4kids-admin/src/errorLog.cpp
===================================================================
--- tux4kids-admin/trunk/tux4kids-admin/src/errorLog.cpp 2009-08-13 20:12:32 UTC (rev 1427)
+++ tux4kids-admin/trunk/tux4kids-admin/src/errorLog.cpp 2009-08-13 20:41:45 UTC (rev 1428)
@@ -45,7 +45,6 @@
{
instance = ErrorLog::Instance();
- //qDebug() << message << " message for user: " << userMessage;
if (!userMessage.isEmpty()) {
QMessageBox *msgBox = new QMessageBox(QMessageBox::Warning, "Tux4kids-admin", userMessage, QMessageBox::Ok);
msgBox->setAttribute(Qt::WA_DeleteOnClose, true);
@@ -56,7 +55,7 @@
qDebug() << QObject::tr("Failed to open log file for writing");
} else {
QDataStream out(instance->logFile);
- out << message;
+ out << message << "\n";
instance->logFile->close();
}
}
Modified: tux4kids-admin/trunk/tux4kids-admin/src/manageClassesWidget.cpp
===================================================================
--- tux4kids-admin/trunk/tux4kids-admin/src/manageClassesWidget.cpp 2009-08-13 20:12:32 UTC (rev 1427)
+++ tux4kids-admin/trunk/tux4kids-admin/src/manageClassesWidget.cpp 2009-08-13 20:41:45 UTC (rev 1428)
@@ -5,6 +5,7 @@
#include "schoolData.h"
#include "schoolDatabase.h"
#include "selectClassWidget.h"
+#include "errorLog.h"
#include <QDebug>
#include <QTableView>
@@ -67,15 +68,17 @@
{
QModelIndex classIndex = m_selectClassWidget->selectedClassIndex();
m_schoolDatabase->deleteClass(m_mainController->classTableModel()->at(classIndex.row()));
+ if (m_schoolDatabase->error()) {
+ ErrorLog::log(m_schoolDatabase->lastError(), tr("Error occured during deleting class. \n %1").arg(m_schoolDatabase->lastError()));
+ }
}
void ManageClassesWidget::addAccepted()
{
- qDebug() << "add accepted";
Class newClass = m_addClassDialog->getClass();
m_schoolDatabase->addClass(newClass);
if (m_schoolDatabase->error()) {
- qDebug() << m_schoolDatabase->lastError();
+ ErrorLog::log(m_schoolDatabase->lastError(), tr("Error occured during adding class. \n %1").arg(m_schoolDatabase->lastError()));
}
}
@@ -86,9 +89,11 @@
void ManageClassesWidget::editAccepted()
{
- qDebug() << "edit accepted";
Class editedClass = m_editClassDialog->getClass();
m_schoolDatabase->updateClass(editedClass);
+ if (m_schoolDatabase->error()) {
+ ErrorLog::log(m_schoolDatabase->lastError(), tr("Error occured during editing class. \n %1").arg(m_schoolDatabase->lastError()));
+ }
}
void ManageClassesWidget::editRejected()
Modified: tux4kids-admin/trunk/tux4kids-admin/src/manageTeachersWidget.cpp
===================================================================
--- tux4kids-admin/trunk/tux4kids-admin/src/manageTeachersWidget.cpp 2009-08-13 20:12:32 UTC (rev 1427)
+++ tux4kids-admin/trunk/tux4kids-admin/src/manageTeachersWidget.cpp 2009-08-13 20:41:45 UTC (rev 1428)
@@ -4,6 +4,7 @@
#include "editTeacherDialog.h"
#include "selectTeacherWidget.h"
#include "schoolData.h"
+#include "errorLog.h"
#include <QDebug>
#include <QTableView>
@@ -66,13 +67,18 @@
{
QModelIndex teacherIndex = m_selectTeacherWidget->selectedTeacherIndex();
m_schoolDatabase->deleteTeacher(m_mainController->teacherTableModel()->at(teacherIndex.row()));
+ if (m_schoolDatabase->error()) {
+ ErrorLog::log(m_schoolDatabase->lastError(), tr("Error occured during deleting teacher. \n %1").arg(m_schoolDatabase->lastError()));
+ }
}
void ManageTeachersWidget::addAccepted()
{
- qDebug() << "add accepted";
Teacher addedTeacher = m_addTeacherDialog->teacher();
m_schoolDatabase->addTeacher(addedTeacher);
+ if (m_schoolDatabase->error()) {
+ ErrorLog::log(m_schoolDatabase->lastError(), tr("Error occured during adding teacher. \n %1").arg(m_schoolDatabase->lastError()));
+ }
}
void ManageTeachersWidget::addRejected()
@@ -82,9 +88,11 @@
void ManageTeachersWidget::editAccepted()
{
- qDebug() << "edit accepted";
Teacher updatedTeacher = m_editTeacherDialog->teacher();
m_schoolDatabase->updateTeacher(updatedTeacher);
+ if (m_schoolDatabase->error()) {
+ ErrorLog::log(m_schoolDatabase->lastError(), tr("Error occured during editing teacher. \n %1").arg(m_schoolDatabase->lastError()));
+ }
}
void ManageTeachersWidget::editRejected()
More information about the Tux4kids-commits
mailing list