mirror of
https://bitbucket.org/smil3y/kdelibs.git
synced 2025-02-23 18:32:49 +00:00
generic: adjust to Katie changes
Signed-off-by: Ivailo Monev <xakepa10@gmail.com>
This commit is contained in:
parent
ef262ab3bd
commit
6d0274d417
6 changed files with 45 additions and 45 deletions
|
@ -27,8 +27,6 @@
|
|||
#include <QMetaProperty>
|
||||
#include <QWidget>
|
||||
|
||||
static const QSettings::Format defaultformat = QSettings::IniFormat;
|
||||
|
||||
static QString getSettingsPath(const QString &filename)
|
||||
{
|
||||
const QFileInfo info(filename);
|
||||
|
@ -39,7 +37,7 @@ static QString getSettingsPath(const QString &filename)
|
|||
}
|
||||
|
||||
KSettings::KSettings(const QString& file, const OpenFlags mode)
|
||||
: QSettings(getSettingsPath(file), defaultformat)
|
||||
: QSettings(getSettingsPath(file))
|
||||
{
|
||||
if ((mode & IncludeGlobals) != mode) {
|
||||
addSource(KStandardDirs::locateLocal("config", QLatin1String("kdeglobals")));
|
||||
|
@ -48,10 +46,10 @@ KSettings::KSettings(const QString& file, const OpenFlags mode)
|
|||
|
||||
void KSettings::addSource(const QString &source)
|
||||
{
|
||||
QSettings settings(source, defaultformat);
|
||||
QSettings settings(source);
|
||||
foreach (const QString &key, settings.keys()) {
|
||||
if (!QSettings::contains(key)) {
|
||||
QSettings::setValue(key, settings.value(key));
|
||||
QSettings::setString(key, settings.string(key));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -82,11 +80,13 @@ bool KSettings::save(const QObject *object)
|
|||
continue;
|
||||
}
|
||||
const QVariant propertyvalue = property.read(widget);
|
||||
if (propertyvalue.isValid()) {
|
||||
kDebug() << "saving property" << propertyname << "with value" << propertyvalue << "of" << objectname;
|
||||
QSettings::setValue(objectname + QLatin1Char('/') + propertyname, propertyvalue);
|
||||
} else {
|
||||
if (!propertyvalue.canConvert<QString>()) {
|
||||
kWarning() << "property value not QString-convertable" << propertyname << propertyvalue;
|
||||
} else if (!propertyvalue.isValid()) {
|
||||
kWarning() << "invalid property value" << propertyname << propertyvalue;
|
||||
} else {
|
||||
kDebug() << "saving property" << propertyname << "with value" << propertyvalue << "of" << objectname;
|
||||
QSettings::setString(objectname + QLatin1Char('/') + propertyname, propertyvalue.toString());
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -119,7 +119,7 @@ bool KSettings::restore(QObject *object)
|
|||
kDebug() << "skipping non-writable property" << propertyname << "of" << objectname;
|
||||
continue;
|
||||
}
|
||||
const QVariant propertyvalue = QSettings::value(objectname + QLatin1Char('/') + propertyname, property.read(widget));
|
||||
const QVariant propertyvalue = QSettings::string(objectname + QLatin1Char('/') + propertyname, property.read(widget).toString());
|
||||
if (propertyvalue.isValid()) {
|
||||
kDebug() << "restoring property" << propertyname << "with value" << propertyvalue << "of" << objectname;
|
||||
bool success = false;
|
||||
|
|
|
@ -111,34 +111,34 @@ public:
|
|||
CfgConfig( const QString &codegenFilename )
|
||||
{
|
||||
// Configure the compiler with some settings
|
||||
QSettings codegenConfig(codegenFilename, QSettings::IniFormat);
|
||||
QSettings codegenConfig(codegenFilename);
|
||||
|
||||
nameSpace = codegenConfig.value("NameSpace").toString();
|
||||
className = codegenConfig.value("ClassName").toString();
|
||||
nameSpace = codegenConfig.string("NameSpace");
|
||||
className = codegenConfig.string("ClassName");
|
||||
if ( className.isEmpty() ) {
|
||||
cerr << "Class name missing" << endl;
|
||||
exit(1);
|
||||
}
|
||||
inherits = codegenConfig.value("Inherits").toString();
|
||||
inherits = codegenConfig.string("Inherits");
|
||||
if ( inherits.isEmpty() ) inherits = "KConfigSkeleton";
|
||||
visibility = codegenConfig.value("Visibility").toString();
|
||||
visibility = codegenConfig.string("Visibility");
|
||||
if ( !visibility.isEmpty() ) visibility += ' ';
|
||||
forceStringFilename = codegenConfig.value("ForceStringFilename", false).toBool();
|
||||
singleton = codegenConfig.value("Singleton", false).toBool();
|
||||
forceStringFilename = codegenConfig.boolean("ForceStringFilename", false);
|
||||
singleton = codegenConfig.boolean("Singleton", false);
|
||||
staticAccessors = singleton;
|
||||
customAddons = codegenConfig.value("CustomAdditions", false).toBool();
|
||||
memberVariables = codegenConfig.value("MemberVariables").toString();
|
||||
customAddons = codegenConfig.boolean("CustomAdditions", false);
|
||||
memberVariables = codegenConfig.string("MemberVariables");
|
||||
dpointer = (memberVariables == "dpointer");
|
||||
headerIncludes = codegenConfig.value("IncludeFiles", QStringList()).toStringList();
|
||||
sourceIncludes = codegenConfig.value("SourceIncludeFiles", QStringList()).toStringList();
|
||||
mutators = codegenConfig.value("Mutators", QStringList()).toStringList();
|
||||
headerIncludes = codegenConfig.stringList("IncludeFiles", QStringList());
|
||||
sourceIncludes = codegenConfig.stringList("SourceIncludeFiles", QStringList());
|
||||
mutators = codegenConfig.stringList("Mutators", QStringList());
|
||||
allMutators = ((mutators.count() == 1) && (mutators.at(0).toLower() == "true"));
|
||||
itemAccessors = codegenConfig.value("ItemAccessors", false).toBool();
|
||||
setUserTexts = codegenConfig.value("SetUserTexts", false).toBool();
|
||||
defaultGetters = codegenConfig.value("DefaultValueGetters", QStringList()).toStringList();
|
||||
itemAccessors = codegenConfig.boolean("ItemAccessors", false);
|
||||
setUserTexts = codegenConfig.boolean("SetUserTexts", false);
|
||||
defaultGetters = codegenConfig.stringList("DefaultValueGetters", QStringList());
|
||||
allDefaultGetters = (defaultGetters.count() == 1) && (defaultGetters.at(0).toLower() == "true");
|
||||
globalEnums = codegenConfig.value("GlobalEnums", false).toBool();
|
||||
useEnumTypes = codegenConfig.value("UseEnumTypes", false).toBool();
|
||||
globalEnums = codegenConfig.boolean("GlobalEnums", false);
|
||||
useEnumTypes = codegenConfig.boolean("UseEnumTypes", false);
|
||||
}
|
||||
|
||||
public:
|
||||
|
|
|
@ -46,7 +46,7 @@ KFilePlacesItem::KFilePlacesItem(const KBookmark &bookmark,
|
|||
} else if (udi.isEmpty() && m_bookmark.url() == KUrl("trash:/")) {
|
||||
KDirWatch::self()->addFile(KStandardDirs::locateLocal("config", "trashrc"));
|
||||
KSettings trashConfig("trashrc", KSettings::SimpleConfig);
|
||||
m_trashIsEmpty = trashConfig.value("Status/Empty", true).toBool();
|
||||
m_trashIsEmpty = trashConfig.boolean("Status/Empty", true);
|
||||
connect(KDirWatch::self(), SIGNAL(dirty(QString)),
|
||||
this, SLOT(trashConfigChanged(QString)));
|
||||
} else if (!udi.isEmpty() && m_device.isValid()) {
|
||||
|
@ -298,7 +298,7 @@ void KFilePlacesItem::trashConfigChanged(const QString &config)
|
|||
{
|
||||
Q_UNUSED(config);
|
||||
KSettings trashConfig("trashrc", KSettings::SimpleConfig);
|
||||
m_trashIsEmpty = trashConfig.value("Status/Empty", true).toBool();
|
||||
m_trashIsEmpty = trashConfig.boolean("Status/Empty", true);
|
||||
emit itemChanged(id());
|
||||
}
|
||||
|
||||
|
|
|
@ -578,7 +578,7 @@ void KFilePlacesView::contextMenuEvent(QContextMenuEvent *event)
|
|||
if (placesModel->url(index) == KUrl("trash:/")) {
|
||||
emptyTrash = menu.addAction(KIcon("trash-empty"), i18nc("@action:inmenu", "Empty Trash"));
|
||||
KSettings trashConfig("trashrc", KSettings::SimpleConfig);
|
||||
emptyTrash->setEnabled(!trashConfig.value("Status/Empty", true).toBool());
|
||||
emptyTrash->setEnabled(!trashConfig.boolean("Status/Empty", true));
|
||||
menu.addSeparator();
|
||||
}
|
||||
add = menu.addAction(KIcon("document-new"), i18n("Add Entry..."));
|
||||
|
|
|
@ -37,18 +37,18 @@
|
|||
*/
|
||||
#define COMMON_STATE_LOAD \
|
||||
d->m_settings->sync(); \
|
||||
const QString globalaudio = d->m_settings->value("global/audiooutput", "auto").toString(); \
|
||||
const int globalvolume = d->m_settings->value("global/volume", 90).toInt(); \
|
||||
const bool globalmute = d->m_settings->value("global/mute", false).toBool(); \
|
||||
setAudioOutput(d->m_settings->value(d->m_playerid + "/audiooutput", globalaudio).toString()); \
|
||||
setVolume(d->m_settings->value(d->m_playerid + "/volume", globalvolume).toInt()); \
|
||||
setMute(d->m_settings->value(d->m_playerid + "/mute", globalmute).toBool());
|
||||
const QString globalaudio = d->m_settings->string("global/audiooutput", "auto"); \
|
||||
const int globalvolume = d->m_settings->integer("global/volume", 90); \
|
||||
const bool globalmute = d->m_settings->boolean("global/mute", false); \
|
||||
setAudioOutput(d->m_settings->string(d->m_playerid + "/audiooutput", globalaudio)); \
|
||||
setVolume(int(d->m_settings->integer(d->m_playerid + "/volume", globalvolume))); \
|
||||
setMute(d->m_settings->boolean(d->m_playerid + "/mute", globalmute));
|
||||
|
||||
#define COMMON_STATE_SAVE \
|
||||
if (d->m_handle && d->m_settings && d->m_settings->isWritable()) { \
|
||||
d->m_settings->setValue(d->m_playerid + "/audiooutput", audiooutput()); \
|
||||
d->m_settings->setValue(d->m_playerid + "/volume", int(volume())); \
|
||||
d->m_settings->setValue(d->m_playerid + "/mute", mute()); \
|
||||
d->m_settings->setString(d->m_playerid + "/audiooutput", audiooutput()); \
|
||||
d->m_settings->setInteger(d->m_playerid + "/volume", int(volume())); \
|
||||
d->m_settings->setBoolean(d->m_playerid + "/mute", mute()); \
|
||||
d->m_settings->sync(); \
|
||||
} else { \
|
||||
kWarning() << "Could not save state"; \
|
||||
|
|
|
@ -79,8 +79,8 @@ KPasswdStoreImpl::KPasswdStoreImpl(const QString &id)
|
|||
#endif
|
||||
|
||||
KSettings ksettings("kpasswdstorerc", KSettings::SimpleConfig);
|
||||
m_retries = ksettings.value("KPasswdStore/Retries", kpasswdstore_passretries).toUInt();
|
||||
m_timeout = (ksettings.value("KPasswdStore/Timeout", kpasswdstore_passtimeout).toUInt() * 60000);
|
||||
m_retries = ksettings.integer("KPasswdStore/Retries", kpasswdstore_passretries);
|
||||
m_timeout = (ksettings.integer("KPasswdStore/Timeout", kpasswdstore_passtimeout) * 60000);
|
||||
}
|
||||
|
||||
KPasswdStoreImpl::~KPasswdStoreImpl()
|
||||
|
@ -146,7 +146,7 @@ QString KPasswdStoreImpl::getPasswd(const QByteArray &key, const qlonglong windo
|
|||
QString storekey = m_storeid;
|
||||
storekey.append(QLatin1Char('/'));
|
||||
storekey.append(QString::fromLatin1(key.constData(), key.size()));
|
||||
const QString passwd = ksettings.value(storekey).toString();
|
||||
const QString passwd = ksettings.string(storekey);
|
||||
if (passwd.isEmpty()) {
|
||||
return QString();
|
||||
}
|
||||
|
@ -173,7 +173,7 @@ bool KPasswdStoreImpl::storePasswd(const QByteArray &key, const QString &passwd,
|
|||
QString storekey = m_storeid;
|
||||
storekey.append(QLatin1Char('/'));
|
||||
storekey.append(QString::fromLatin1(key.constData(), key.size()));
|
||||
ksettings.setValue(storekey, encryptPasswd(passwd, &ok));
|
||||
ksettings.setString(storekey, encryptPasswd(passwd, &ok));
|
||||
return ok;
|
||||
}
|
||||
|
||||
|
@ -195,7 +195,7 @@ bool KPasswdStoreImpl::ensurePasswd(const qlonglong windowid, const bool showerr
|
|||
KSettings ksettings(m_passwdstore, KSettings::SimpleConfig);
|
||||
QString storekey = QString::fromLatin1("KPasswdStore/");
|
||||
storekey.append(m_storeid);
|
||||
const QString storepasswdhash = ksettings.value(storekey).toString();
|
||||
const QString storepasswdhash = ksettings.string(storekey);
|
||||
if (storepasswdhash.isEmpty()) {
|
||||
KNewPasswordDialog knewpasswddialog(widgetForWindowID(windowid));
|
||||
knewpasswddialog.setPrompt(i18n("Enter a password for <b>%1</b> password storage", m_storeid));
|
||||
|
@ -243,7 +243,7 @@ bool KPasswdStoreImpl::ensurePasswd(const qlonglong windowid, const bool showerr
|
|||
}
|
||||
|
||||
if (storepasswdhash.isEmpty()) {
|
||||
ksettings.setValue(storekey, passhash);
|
||||
ksettings.setString(storekey, passhash);
|
||||
return true;
|
||||
}
|
||||
if (passhash != storepasswdhash) {
|
||||
|
|
Loading…
Add table
Reference in a new issue