diff options
Diffstat (limited to 'notebookmodel.cc')
-rw-r--r-- | notebookmodel.cc | 19 |
1 files changed, 17 insertions, 2 deletions
diff --git a/notebookmodel.cc b/notebookmodel.cc index 3898df7..5709b8b 100644 --- a/notebookmodel.cc +++ b/notebookmodel.cc @@ -72,6 +72,21 @@ QString NotebookModel::penDirectory(const QString &name) const return _dataDir.filePath(name); } +NotebookModel::PenTime NotebookModel::penUserTime(const QString &name) const +{ + QDir penDir = penDirectory(name); + QFile userTimeFile(penDir.filePath(PEN_USER_TIME_FILE)); + if (userTimeFile.open(QIODevice::ReadOnly | QIODevice::Text)) { + QString data = QString::fromUtf8(userTimeFile.readLine(32)); + userTimeFile.close(); + return data.toULongLong(); + } + + qWarning() << "Could not read last user time for pen" << name << "; shown dates are likely to be off"; + + return 0; +} + QString NotebookModel::notebookDirectory(const QString &penName, const QString &nbName) const { return _dataDir.filePath(penName + "/" + nbName); @@ -423,7 +438,7 @@ bool NotebookModel::isPenArchive(const QString &pen) const bool NotebookModel::isPenLocked(const QString &pen) const { QDir dir = penDir(pen); - if (dir.exists(".sync.lck")) { + if (dir.exists(PEN_SYNC_LOCK_FILE)) { return true; // TODO check if stale } else { return false; @@ -433,7 +448,7 @@ bool NotebookModel::isPenLocked(const QString &pen) const bool NotebookModel::isNotebookLocked(const QString &pen, const QString ¬ebook) const { QDir dir = notebookDir(pen, notebook); - if (dir.exists(".sync.lck")) { + if (dir.exists(PEN_SYNC_LOCK_FILE)) { return true; } else { return false; |