[prev in list] [next in list] [prev in thread] [next in thread]
List: kde-commits
Subject: branches/work/kst/portto4/kst/src/datasources/ascii
From: Nicolas Brisset <nicolas.brisset () eurocopter ! com>
Date: 2010-04-22 6:14:59
Message-ID: 20100422061459.080EDAC8A0 () svn ! kde ! org
[Download RAW message or body]
SVN commit 1117430 by brisset:
When reading a file with the ASCII datasource, always load ASCII defaults before \
attempting to load file-specific settings (asciisourceconfig.cpp). Also avoid \
overriding those defaults with hard-coded values when no key exists for the given \
file (namedparameter.h). That issue is actually more a problem that the test in \
asciisourceconfig.cpp / AsciiSourceConfig::readGroup is not specific enough: \
fileName.isEmpty() triggers too easily => if the file has no settings stored, we \
still try to read its settings and since we find nothing we revert to hard-coded \
default values. With this patch, the constructor sets hard-coded defaults, then we \
override them with the ASCII source's general defaults, then with file-specific \
values, but only if there are some in QSettings. If you think this patch is wrong, we \
have to find a way to test for the existence of settings for the given file instead \
of just testing whether the filename is empty.
BUG: 234396
M +2 -3 asciisourceconfig.cpp
M +1 -3 namedparameter.h
--- branches/work/kst/portto4/kst/src/datasources/ascii/asciisourceconfig.cpp \
#1117429:1117430 @@ -115,9 +115,8 @@
void AsciiSourceConfig::readGroup(QSettings& cfg, const QString& fileName) {
cfg.beginGroup(AsciiSource::asciiTypeKey());
- if (fileName.isEmpty()) {
- read(cfg);
- } else {
+ read(cfg);
+ if (!fileName.isEmpty()) {
cfg.beginGroup(fileName);
read(cfg);
cfg.endGroup();
--- branches/work/kst/portto4/kst/src/datasources/ascii/namedparameter.h \
#1117429:1117430 @@ -40,9 +40,7 @@
void operator<<(QSettings& settings) {
const QVariant var = settings.value(Key);
- if (var.isNull())
- setValue(_default_value);
- else
+ if (!var.isNull())
setValue(var.value<T>());
}
[prev in list] [next in list] [prev in thread] [next in thread]
Configure |
About |
News |
Add a list |
Sponsored by KoreLogic