various fixes i've come across while working on services stuff today

svn path=/trunk/KDE/kdebase/workspace/libs/plasma/; revision=856868
This commit is contained in:
Aaron J. Seigo 2008-09-03 23:33:57 +00:00
parent d89e799c96
commit 124dd4bd63
5 changed files with 28 additions and 14 deletions

View File

@ -308,18 +308,18 @@ bool ConfigXmlHandler::endElement(const QString &namespaceURI, const QString &lo
resetState(); resetState();
} else if (tag == "label") { } else if (tag == "label") {
if (m_inChoice) { if (m_inChoice) {
m_choice.label = m_cdata; m_choice.label = m_cdata.trimmed();
} else { } else {
m_label = m_cdata; m_label = m_cdata.trimmed();
} }
} else if (tag == "whatsthis") { } else if (tag == "whatsthis") {
if (m_inChoice) { if (m_inChoice) {
m_choice.whatsThis = m_cdata; m_choice.whatsThis = m_cdata.trimmed();
} else { } else {
m_whatsThis = m_cdata; m_whatsThis = m_cdata.trimmed();
} }
} else if (tag == "default") { } else if (tag == "default") {
m_default = m_cdata; m_default = m_cdata.trimmed();
} else if (tag == "min") { } else if (tag == "min") {
m_min = m_cdata.toInt(&m_haveMin); m_min = m_cdata.toInt(&m_haveMin);
} else if (tag == "max") { } else if (tag == "max") {
@ -361,16 +361,17 @@ void ConfigXmlHandler::addItem()
} else if (m_type == "font") { } else if (m_type == "font") {
item = m_config->addItemFont(m_name, *d->newFont(), QFont(m_default), m_key); item = m_config->addItemFont(m_name, *d->newFont(), QFont(m_default), m_key);
} else if (m_type == "int") { } else if (m_type == "int") {
KConfigSkeleton::ItemInt* intItem = m_config->addItemInt(m_name, KConfigSkeleton::ItemInt* intItem = m_config->addItemInt(m_name, *d->newInt(),
*d->newInt(), m_default.toInt(), m_key);
m_default.toInt(),
m_key);
if (m_haveMin) { if (m_haveMin) {
intItem->setMinValue(m_min); intItem->setMinValue(m_min);
} }
if (m_haveMax) { if (m_haveMax) {
intItem->setMaxValue(m_max); intItem->setMaxValue(m_max);
} }
item = intItem; item = intItem;
} else if (m_type == "password") { } else if (m_type == "password") {
item = m_config->addItemPassword(m_name, *d->newString(), m_default, m_key); item = m_config->addItemPassword(m_name, *d->newString(), m_default, m_key);
@ -504,11 +505,7 @@ ConfigXml::ConfigXml(const QString &configFile, QIODevice *xml, QObject *parent)
: KConfigSkeleton(configFile, parent), : KConfigSkeleton(configFile, parent),
d(new ConfigXmlPrivate) d(new ConfigXmlPrivate)
{ {
QXmlInputSource source(xml); d->parse(this, xml);
QXmlSimpleReader reader;
ConfigXmlHandler handler(this, d);
reader.setContentHandler(&handler);
reader.parse(&source, false);
} }
ConfigXml::ConfigXml(KSharedConfigPtr config, QIODevice *xml, QObject *parent) ConfigXml::ConfigXml(KSharedConfigPtr config, QIODevice *xml, QObject *parent)

View File

@ -108,6 +108,13 @@ public:
ConfigXml(const KConfigGroup *config, QIODevice *xml, QObject *parent = 0); ConfigXml(const KConfigGroup *config, QIODevice *xml, QObject *parent = 0);
~ConfigXml(); ~ConfigXml();
/**
* Finds the item for the given group and key.
*
* @arg group the group in the config file to look in
* @arg key the configuration key to find
* @return the associated KConfigSkeletonItem, or 0 if none
*/
KConfigSkeletonItem* findItem(const QString &group, const QString &key); KConfigSkeletonItem* findItem(const QString &group, const QString &key);
/** /**
@ -122,6 +129,7 @@ public:
* @return the list of groups defined by the XML * @return the list of groups defined by the XML
*/ */
QStringList groupList() const; QStringList groupList() const;
private: private:
ConfigXmlPrivate * const d; ConfigXmlPrivate * const d;
}; };

View File

@ -125,6 +125,7 @@ KConfigGroup Service::operationDescription(const QString &operationName)
return KConfigGroup(); return KConfigGroup();
} }
d->config->writeConfig();
KConfigGroup params(d->config->config(), operationName); KConfigGroup params(d->config->config(), operationName);
return params; return params;
} }

View File

@ -35,6 +35,12 @@ public:
parameters(params) parameters(params)
{ {
} }
void slotStart()
{
q->start();
}
ServiceJob* q; ServiceJob* q;
QString destination; QString destination;
QString operation; QString operation;

View File

@ -110,6 +110,8 @@ protected:
void setResult(const QVariant &result); void setResult(const QVariant &result);
private: private:
Q_PRIVATE_SLOT(d, void slotStart())
ServiceJobPrivate * const d; ServiceJobPrivate * const d;
}; };