diff options
| author | Evan Nguyen <evan.nguyen@nokia.com> | 2010-09-01 15:11:35 +1000 |
|---|---|---|
| committer | Evan Nguyen <evan.nguyen@nokia.com> | 2010-09-01 15:11:35 +1000 |
| commit | 04bf6bc00eafbc8a718033a6523ee82cab418512 (patch) | |
| tree | 22297b9a29ed7f3758be78d348a59059d7b87708 /examples/notesmanagerplugin/notesmanager.cpp | |
| parent | acf19979c1f1accecf0d7a5d5bc8553c539b07ae (diff) | |
Fixed some usability bugs for sfw-notes
Diffstat (limited to 'examples/notesmanagerplugin/notesmanager.cpp')
| -rw-r--r-- | examples/notesmanagerplugin/notesmanager.cpp | 29 |
1 files changed, 19 insertions, 10 deletions
diff --git a/examples/notesmanagerplugin/notesmanager.cpp b/examples/notesmanagerplugin/notesmanager.cpp index ea99157915..0a6e1f2b3e 100644 --- a/examples/notesmanagerplugin/notesmanager.cpp +++ b/examples/notesmanagerplugin/notesmanager.cpp @@ -44,22 +44,31 @@ #include "notesmanager.h" NotesManager::NotesManager(QObject *parent) - : QObject(parent) + : QObject(parent), m_search(QString()) { - m_search = ""; +} +bool NotesManager::init() +{ QSqlDatabase db = QSqlDatabase::addDatabase("QSQLITE"); - db.setDatabaseName("todoDB"); - db.open(); + db.setDatabaseName("notesmanager.db"); + if (!db.open()) + db.setDatabaseName(QDir::homePath() + "/notesmanager.db"); - QSqlQuery create; - create.exec("CREATE TABLE todolist(id INTEGER PRIMARY KEY, notes VARCHAR(255), date VARCHAR(255))"); + if (db.open()) { + QSqlQuery create; + create.exec("CREATE TABLE todolist(id INTEGER PRIMARY KEY, notes VARCHAR(255), date VARCHAR(255))"); - nextAlarm(); + nextAlarm(); + + QTimer *timer = new QTimer(this); + QObject::connect(timer, SIGNAL(timeout()), this, SLOT(checkAlarm())); + timer->start(1000); + } else { + return false; + } - QTimer *timer = new QTimer(this); - QObject::connect(timer, SIGNAL(timeout()), this, SLOT(checkAlarm())); - timer->start(1000); + return true; } void NotesManager::nextAlarm() |
