Plans for KUrl in KConfig?

Andreas Pakulat apaku at gmx.de
Mon Mar 12 12:41:07 GMT 2007


On 12.03.07 13:07:38, Stephan Kulow wrote:
> Am Montag 12 März 2007 schrieb Andreas Pakulat:
> > Hi,
> >
> > this is more or less a small poll wether it makes sense to add support
> > for KUrl in KConfig. Currently any application that wants to have a
> > KUrlRequester for setting some file or path and uses KConfig needs extra
> > code to store the value from the requester and reload it again. It would
> > be cool if KConfig could handle this automatically.
> >
> > So my question boils down to: Does somebody already have plans for this
> > or is already working on it? Else I'd like to see wether I can come up
> > with a patch for kdelibs to add this support...
> 
> I don't see what's missing. I guess I never had a KUrlRequester.

Well, the following is what is needed when using a KUrlRequester in the
dialog and using KConfig to load/save the settings:


void QMakeBuilderPreferences::load()
{
    KDevelop::ConfigModule::load();
    m_prefsUi->qmakebin->setUrl(QMakeBuilderSettings::qmakebin());
    connect(m_prefsUi->qmakebin, SIGNAL(textChanged(const QString&)), this, SLOT(changed()));
    connect(m_prefsUi->qmakebin, SIGNAL(returnPressed()), this, SLOT(changed()));
    connect(m_prefsUi->qmakebin, SIGNAL(urlSelected(const KUrl&)), this, SLOT(changed()));
}

void QMakeBuilderPreferences::save()
{
    QMakeBuilderSettings::setQmakebin(m_prefsUi->qmakebin->url().url());
    KDevelop::ConfigModule::save();
}

KDevelop::ConfigModule is a subclass of KCModule and doesn't override
load or save methods. Similar code is duplicated whenever somebody wants
to use a KUrlRequester with a KCModule (I guess thats a bit of
information that was missing in my OP :)

Andreas

-- 
Tomorrow, you can be anywhere.




More information about the kde-core-devel mailing list