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();
} else if (tag == "label") {
if (m_inChoice) {
m_choice.label = m_cdata;
m_choice.label = m_cdata.trimmed();
} else {
m_label = m_cdata;
m_label = m_cdata.trimmed();
}
} else if (tag == "whatsthis") {
if (m_inChoice) {
m_choice.whatsThis = m_cdata;
m_choice.whatsThis = m_cdata.trimmed();
} else {
m_whatsThis = m_cdata;
m_whatsThis = m_cdata.trimmed();
}
} else if (tag == "default") {
m_default = m_cdata;
m_default = m_cdata.trimmed();
} else if (tag == "min") {
m_min = m_cdata.toInt(&m_haveMin);
} else if (tag == "max") {
@ -361,16 +361,17 @@ void ConfigXmlHandler::addItem()
} else if (m_type == "font") {
item = m_config->addItemFont(m_name, *d->newFont(), QFont(m_default), m_key);
} else if (m_type == "int") {
KConfigSkeleton::ItemInt* intItem = m_config->addItemInt(m_name,
*d->newInt(),
m_default.toInt(),
m_key);
KConfigSkeleton::ItemInt* intItem = m_config->addItemInt(m_name, *d->newInt(),
m_default.toInt(), m_key);
if (m_haveMin) {
intItem->setMinValue(m_min);
}
if (m_haveMax) {
intItem->setMaxValue(m_max);
}
item = intItem;
} else if (m_type == "password") {
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),
d(new ConfigXmlPrivate)
{
QXmlInputSource source(xml);
QXmlSimpleReader reader;
ConfigXmlHandler handler(this, d);
reader.setContentHandler(&handler);
reader.parse(&source, false);
d->parse(this, xml);
}
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();
/**
* 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);
/**
@ -122,6 +129,7 @@ public:
* @return the list of groups defined by the XML
*/
QStringList groupList() const;
private:
ConfigXmlPrivate * const d;
};

View File

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

View File

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

View File

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