Bug 164305 - Folderview shouldn't accept an empty directory.
Summary: Folderview shouldn't accept an empty directory.
Status: RESOLVED FIXED
Alias: None
Product: plasma4
Classification: Plasma
Component: widget-folderview (show other bugs)
Version: unspecified
Platform: Compiled Sources Linux
: NOR normal
Target Milestone: ---
Assignee: Plasma Bugs List
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2008-06-17 16:11 UTC by FiNeX
Modified: 2008-06-17 23:56 UTC (History)
0 users

See Also:
Latest Commit:
Version Fixed In:


Attachments
patch (652 bytes, patch)
2008-06-17 16:12 UTC, FiNeX
Details

Note You need to log in before you can comment on or make changes to this bug.
Description FiNeX 2008-06-17 16:11:00 UTC
Version:            (using Devel)
Installed from:    Compiled sources
OS:                Linux

1) add a folder view
2) go to the config dialog
3) select "show a custom folder"
4) empty the "custom folder" field
5) press OK button

First bug: You'll prompted with a "Malformed URL" error, and the config dialog will be closed

6) reopen the config dialog
7) press OK

Second bug: You'll not be prompted again.

Quick fix:

if (url.isEmpty()) {
  url = KUrl("desktop:/");
  ui.showDesktopFolder->setChecked(true);
  ui.showCustomFolder->setChecked(false);
  ui.selectLabel->setEnabled(false);
  ui.lineEdit->setEnabled(false);
}
Comment 1 FiNeX 2008-06-17 16:12:04 UTC
Created attachment 25409 [details]
patch

I've tested it and it works perfectly. If you (@devs) agree I can commit it.
Comment 2 Aaron J. Seigo 2008-06-17 16:30:00 UTC
the patch looks good, except: the default url should be KUrl(QDir::homePath()) and it shouldn't default to the desktop directory. that keeps it consistent with the initial state of a new folderview: it views your home directory.

so url = KUrl(QDir::homePath()); and invert all the bools and it's good to commit =)

thanks for the patch!
Comment 3 Aaron J. Seigo 2008-06-17 16:34:16 UTC
(hmm.. i also wonder if url.isValid() would also be a useful check?)
Comment 4 FiNeX 2008-06-17 17:32:56 UTC
I've tried to test isValid(), but it always return TRUE.
KUrlRequester throw an error: "URL cannot be listed", but nothing else happen.

In the meantime I've added the "isempty()" check, later I'll try to understand how to check if the url inserted is a valid one.
Comment 5 FiNeX 2008-06-17 17:34:41 UTC
SVN commit 821481 by finex:

Configuration dialog: check if the url isEmpty().

BUG: 164305



 M  +3 -0      folderview.cpp  


WebSVN link: http://websvn.kde.org/?view=rev&revision=821481
Comment 6 FiNeX 2008-06-17 23:56:07 UTC
SVN commit 821591 by finex:

Configuration dialog: if the url is local check if it exist.

CCBUG: 164305



 M  +1 -1      folderview.cpp  


WebSVN link: http://websvn.kde.org/?view=rev&revision=821591