summaryrefslogtreecommitdiffstats
path: root/src/deadlinetype.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/deadlinetype.cpp')
-rw-r--r--src/deadlinetype.cpp25
1 files changed, 7 insertions, 18 deletions
diff --git a/src/deadlinetype.cpp b/src/deadlinetype.cpp
index e539d65..b14a572 100644
--- a/src/deadlinetype.cpp
+++ b/src/deadlinetype.cpp
@@ -1,9 +1,8 @@
#include "deadlinetype.h"
#include "config.h"
-#include <QFile>
#include <QSettings>
-#include <QTextStream>
+#include <QDebug>
static const QString FILE_SHUTDOWN("shutdown");
static const QString FILE_IDLE_KILL("idle-kill");
@@ -20,8 +19,6 @@ const DeadlineType *DeadlineType::Shutdown = new DeadlineType(FILE_SHUTDOWN);
const DeadlineType *DeadlineType::IdleKill = new DeadlineType(FILE_IDLE_KILL);
const DeadlineType *DeadlineType::NoTimeout = new DeadlineType(FILE_NO_TIMEOUT);
-static QString loadFileToString(const QString &fileName);
-
DeadlineType::DeadlineType(const QString &name)
{
if (name.isEmpty())
@@ -29,7 +26,7 @@ DeadlineType::DeadlineType(const QString &name)
MESSAGES.setIniCodec("UTF-8");
QString nameLocked = name + CONFIG_LOCKED_SUFFIX;
_headerLine[0] = MESSAGES.value(name).toString();
- _bodyText[0] = loadFileToString(CONFIG_DIR + "/text-" + name);
+ _bodyText[0] = Config::loadFileToString(CONFIG_DIR + "/text-" + name);
if (_headerLine[0].isEmpty()) {
_headerLine[0] = CONFIG_MESSAGES_PATH + " missing key " + name;
}
@@ -37,23 +34,15 @@ DeadlineType::DeadlineType(const QString &name)
_bodyText[0] = CONFIG_DIR + "/text-" + name + " missing";
}
_headerLine[1] = MESSAGES.value(nameLocked).toString();
- _bodyText[1] = loadFileToString(CONFIG_DIR + "/text-" + nameLocked);
+ qDebug() << "From" << nameLocked << "got:" << _headerLine[1];
+ _bodyText[1] = Config::loadFileToString(CONFIG_DIR + "/text-" + nameLocked);
if (_headerLine[1].isEmpty()) {
_headerLine[1] = _headerLine[0];
}
if (_bodyText[1].isEmpty()) {
_bodyText[1] = _bodyText[0];
}
-}
-
-static QString loadFileToString(const QString &fileName)
-{
- QFile f(fileName);
- QString str;
- if (f.open(QFile::ReadOnly | QFile::Text)) {
- QTextStream s(&f);
- s.setCodec("UTF-8");
- str = s.readAll();
- }
- return str;
+ qDebug() << name;
+ qDebug() << " locked headline:" << headerLine(true);
+ qDebug() << "unlocked headline:" << headerLine(false);
}