[Kst] branches/work/kst/kst1kde4/kst/src/libkstapp
Zongyi Zhang
freebody.kst at gmail.com
Wed Apr 14 19:26:13 CEST 2010
SVN commit 1114827 by zhang:
replace kconfig with qsettings
M +14 -14 kst.cpp
M +0 -3 kstlegenddefaults.cpp
M +0 -1 kstpluginmanager.cpp
--- branches/work/kst/kst1kde4/kst/src/libkstapp/kst.cpp #1114826:1114827
@@ -119,7 +119,7 @@
}
-static KConfig *kConfigObject = 0L;
+static QSettings *qSettingsObject = 0L;
KstApp::KstApp(QWidget *parent, const char *name)
: QMdiArea(parent, name) {
@@ -130,7 +130,7 @@
_plotHolderWhileOpeningDocument = new Kst2DPlotMap;
KGlobal::dirs()->addResourceType("kst", KStandardDirs::kde_default("data") + "kst");
- _dataSourceConfig = kConfigObject;
+ _dataSourceConfig = qSettingsObject;
clearWFlags(WDestructiveClose);
@@ -222,8 +222,8 @@
_dataSourceConfig->sync();
_dataSourceConfig = 0L;
}
- delete kConfigObject; // must be after cleanupForExit
- kConfigObject = 0L;
+ delete qSettingsObject; // must be after cleanupForExit
+ qSettingsObject = 0L;
}
@@ -241,8 +241,8 @@
void KstApp::initialize() {
KstSettings::checkUpdates();
- kConfigObject = new KConfig("kstdatarc", false, false);
- KstDataSource::setupOnStartup(kConfigObject);
+ qSettingsObject = new QSettings("kstdatarc", QSettings::NativeFormat, this);
+ KstDataSource::setupOnStartup(qSettingsObject);
// NOTE: This is leaked in commandline mode if we never create a KstApp.
// Not too much of a problem right now, and less messy than hooking in
// cleanups in main.
@@ -1143,11 +1143,11 @@
}
-void KstApp::saveProperties(KConfig *config) {
+void KstApp::saveProperties(QSettings *config) {
QString name = doc->absFilePath();
if (!name.isEmpty() && doc->title() != "Untitled") {
- config->writePathEntry("Document", name);
- config->writeEntry("NamedDocument", true);
+ config->setValue("Document", name);
+ config->setValue("NamedDocument", true);
} else {
QString sl = KGlobal::dirs()->saveLocation("kst", "kst/");
int i = 0;
@@ -1155,20 +1155,20 @@
name = sl + QString("unsaved%1.kst").arg(i);
} while(QFile::exists(name));
doc->saveDocument(name, false, false);
- config->writePathEntry("Document", name);
- config->writeEntry("NamedDocument", false);
+ config->setValue("Document", name);
+ config->setValue("NamedDocument", false);
}
}
-void KstApp::readProperties(KConfig* config) {
- QString name = config->readPathEntry("Document");
+void KstApp::readProperties(QSettings* config) {
+ QString name = config->value("Document").toString();
if (name.isEmpty()) {
return;
}
- if (config->readBoolEntry("NamedDocument", false)) {
+ if (config->value("NamedDocument", false).toBool()) {
doc->openDocument(name);
} else {
doc->openDocument(name);
--- branches/work/kst/kst1kde4/kst/src/libkstapp/kstlegenddefaults.cpp #1114826:1114827
@@ -20,9 +20,6 @@
#include "kstsettings.h"
#include "stdinsource.h"
-// xxx #include <kconfig.h>
-// xxx #include <kconfiggroup.h>
-
KstLegendDefaults KST::legendDefaults;
KstLegendDefaults::KstLegendDefaults() {
--- branches/work/kst/kst1kde4/kst/src/libkstapp/kstpluginmanager.cpp #1114826:1114827
@@ -24,7 +24,6 @@
#include <QRadioButton>
#include <QRegExp>
-// xxx #include <kconfig.h>
#include <kfiledialog.h>
#include <kimageio.h>
#include <kio/netaccess.h>
More information about the Kst
mailing list