aboutsummaryrefslogtreecommitdiffstats
path: root/src/modules
diff options
context:
space:
mode:
authorGravatar Fabio Bas2010-08-31 14:17:02 +0000
committerGravatar Fabio Bas2010-08-31 14:17:02 +0000
commitb33f78cdb3d84ec1514732175844f180ec489a31 (patch)
tree13ddd08a8ed819995603102cf43f9a3b10756f0f /src/modules
parentadded missing documentation for the m flag of the binding operator (diff)
downloadKVIrc-b33f78cdb3d84ec1514732175844f180ec489a31.tar.gz
KVIrc-b33f78cdb3d84ec1514732175844f180ec489a31.tar.bz2
KVIrc-b33f78cdb3d84ec1514732175844f180ec489a31.zip
$config.flush and $config.close: check wheter config save is successfull and report to the user if it's not
git-svn-id: https://svn.kvirc.de/svn/trunk/kvirc@4956 17fca916-40b9-46aa-a4ea-0a15b648b75c
Diffstat (limited to 'src/modules')
-rw-r--r--src/modules/config/libkviconfig.cpp17
1 files changed, 13 insertions, 4 deletions
diff --git a/src/modules/config/libkviconfig.cpp b/src/modules/config/libkviconfig.cpp
index 87174f2ba..6df03d33e 100644
--- a/src/modules/config/libkviconfig.cpp
+++ b/src/modules/config/libkviconfig.cpp
@@ -531,10 +531,18 @@ static bool config_kvs_cmd_close(KviKvsModuleCommandCall * c)
if(cfg)
{
- if(cfg->dirty() && cfg->readOnly())
+ if(cfg->readOnly())
{
- if(!c->hasSwitch('q',"quiet"))
- c->warning(__tr2qs("The config file '%Q' has been changed but is opened as read-only: changes will be lost"),&cfg->fileName());
+ if(cfg->dirty())
+ {
+ if(!c->hasSwitch('q',"quiet"))
+ c->warning(__tr2qs("The config file '%Q' has been changed but is opened as read-only: changes will be lost"),&cfg->fileName());
+ }
+ } else {
+ // we force a save here
+ if(!cfg->sync())
+ if(!c->hasSwitch('q',"quiet"))
+ c->warning(__tr2qs("An error has occured while trying to save the config file with id '%Q'"),&szId);
}
g_pConfigDict->remove(szId);
} else {
@@ -581,7 +589,8 @@ static bool config_kvs_cmd_flush(KviKvsModuleCommandCall * c)
if(cfg->readOnly())
c->warning(__tr2qs("The config file with id '%Q' is read only"),&szId);
else
- cfg->sync();
+ if(!cfg->sync())
+ c->warning(__tr2qs("An error has occured while trying to save the config file with id '%Q'"),&szId);
} else {
c->warning(__tr2qs("The config file with id '%Q' is not open"),&szId);
}