Bug 271777

Summary: folderview does not save custom location
Product: [Plasma] plasma4 Reporter: Jonathan Marten <jjm>
Component: widget-folderviewAssignee: Plasma Bugs List <plasma-bugs>
Severity: normal CC: fredrik, hf.farhad
Priority: NOR    
Version: unspecified   
Target Milestone: ---   
Platform: Compiled Sources   
OS: Linux   
Latest Commit: Version Fixed In:

Description Jonathan Marten 2011-04-26 16:19:24 UTC
Version:           unspecified (using Devel) 
OS:                Linux

If a custom folder view location is set in the "Location" configuration page, it is not saved over logout/login.  The location reverts to $HOME/Desktop (for a folder view as the main desktop containment) every time.

The problem can also be reproduced with plasmoidviewer (see below).

Reproducible: Always

Steps to Reproduce:
Start with a blank configuration (remove the files $HOME/.kde/share/config/plasmoidviewer-appletsrc and $HOME/.kde/share/config/plasmoidviewerrc), then run 'plasmoidviewer folderview'. It will show the contents of $HOME.

In "Folder View Settings - Location", set the location to "/tmp" and OK.  The folder view will show the contents of that location as expected.

Close the plasmoidviewer and run it again.  It will revert back to showing $HOME.

Expected Results:  
Would expect the configured location to be saved and used next time.

The specified location is not saved (with key "url") in either configuration file.

The problem seems to be the code in kde-baseapps/plasma/applets/folderview/folderview.cpp, function FolderView::configAccepted():

    cg.writeEntry("configTitleText", m_configTitleText);

    if (m_url != url || m_filterFiles != uiFilter.filterFilesPattern->text() ||
        m_filterFilesMimeList != selectedItems || m_filterType != filterType)
        cg.writeEntry("url", m_url);

At the start of this, 'url' is the new URL as entered by the user.  The setUrl() unconditionally sets m_url to this, which means that the first term of the comparison below is always false and, if nothing else has changed, the cg.writeEntry("url", m_url) is not executed.  Hence the changed URL is not written to the configuration file (unless something else has also changed).

Removing the setUrl() on the second line of the code above appears to solve the problem.  This was added as part of revision 40f36dd3cdd7f6604c0b6f2179c42dc053190fbe, review 100750.
Comment 1 Farhad Hedayati 2011-06-02 09:28:46 UTC
Git commit fc5cd12616238a7eac532401bc0d176470aa274c by Farhad Hedayati Fard.
Committed on 02/06/2011 at 09:24.
Pushed by hedayatifard into branch 'master'.

Fix folderview behaivior on saving custom locations and
default widget title in init() function.

CCBUG: 271777

M  +36   -30   plasma/applets/folderview/folderview.cpp     
M  +1    -0    plasma/applets/folderview/folderview.h