-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 @@ -135,4 +135,8 @@ 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\" " @@ -146,9 +150,10 @@ bool CfgParser::save(QString file, CfgFile& cfg) { 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++) { |