Editable script actions
David Faure
faure at kde.org
Mon Mar 3 13:30:39 GMT 2008
On Thursday 28 February 2008, Paulo Moura Guedes wrote:
> > +void ScriptableMainWindow::slotEditScriptActions()
> > +{
> > + if(!KIO::NetAccess::exists(KUrl(d->userActionsFile),
> > KIO::NetAccess::SourceSide, this)) {
> > + KUrl dir = KUrl(d->userActionsFile).directory();
> > + KIO::NetAccess::mkdir(dir, this);
> >
> > uh? Why create a directory here and where will slotEditScriptActions() be
> > used?
>
> It is used when the user wants to add or edit script actions. The user file,
> located in $KDEHOME/share/apps/{application}/scripts/scripts.rc will override
> the one located at (if it exists at all)
> $KDEDIR/share/apps/application/scripts/scripts.rc.
>
> > + QFile f(d->userActionsFile);
> >
> > not sure there (without looking at the dox), but does;
> >
> > d->userActionsFile =
> > KGlobal::dirs()->locateLocal("appdata", "scripts/scriptactions.rc");
> >
> > really locate the writable configfile?
> Yes.
But locateLocal takes care of creating the parent directories as well, so I don't think you need the call to mkdir.
(and if you really do, you should use KStandardDirs::makeDir instead, since this is local-only)
--
David Faure, faure at kde.org, sponsored by Trolltech to work on KDE,
Konqueror (http://www.konqueror.org), and KOffice (http://www.koffice.org).
More information about the kde-core-devel
mailing list