-rw-r--r-- | noncore/apps/keyz-cfg/cfgfile.cpp | 9 |
1 files changed, 7 insertions, 2 deletions
diff --git a/noncore/apps/keyz-cfg/cfgfile.cpp b/noncore/apps/keyz-cfg/cfgfile.cpp index 81d1ee1..be7150e 100644 --- a/noncore/apps/keyz-cfg/cfgfile.cpp +++ b/noncore/apps/keyz-cfg/cfgfile.cpp @@ -133,8 +133,12 @@ bool CfgParser::load(QString file, CfgFile& cfg) { } bool CfgParser::save(QString file, CfgFile& cfg) { FILE* f = fopen((const char*) file.local8Bit(), "w"); + if (!f) { + oerr << "Could not write config file!" << oendl; + return false; + } fprintf(f, "<keymap autorepeat-delay=\"%d\" autorepeat-period=\"%d\" " "author=\"keyzcfg\">\n", cfg.getAutorepeatDelay(), cfg.getAutorepeatPeriod()); @@ -144,13 +148,14 @@ bool CfgParser::save(QString file, CfgFile& cfg) { for(n=0; n < (int) entries.count(); n++) { CfgEntry* entry = entries.at(n); QString l = entry->getLabel(); - if (!l.isEmpty()) { + if (l.isEmpty()) { + l = entry->getFile(); + } fprintf(f, "\t<label name=\"%s\" state=\"km%d:*\"/>\n", (const char*) l.utf8(), n); } - } for(n=0; n < (int) entries.count(); n++) { CfgEntry* entry = entries.at(n); fprintf(f, "\t<include file=\"%s\" prefix=\"km%d\"/>\n", |