Bug 173723 - KFileDialog does not auto add extension when requested
Summary: KFileDialog does not auto add extension when requested
Status: RESOLVED FIXED
Alias: None
Product: kfile
Classification: Applications
Component: general (show other bugs)
Version: unspecified
Platform: Compiled Sources Linux
: NOR normal
Target Milestone: ---
Assignee: kdelibs bugs
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2008-10-28 00:41 UTC by Jean-Baptiste Mardelle
Modified: 2008-10-28 17:31 UTC (History)
1 user (show)

See Also:
Latest Commit:
Version Fixed In:


Attachments
Re-add extension updating (552 bytes, patch)
2008-10-28 01:01 UTC, Jean-Baptiste Mardelle
Details

Note You need to log in before you can comment on or make changes to this bug.
Description Jean-Baptiste Mardelle 2008-10-28 00:41:49 UTC
Version:            (using Devel)
OS:                Linux
Installed from:    Compiled sources

Using KFileDialog::getSaveFileName(), there is a checkbox allowing to auto add extension to your filename when saving.

But KFileDialog does not add the extension even when the checkbox is clicked. This is a regression caused by commit 861225:
"Merge branch 'kfilewidget'"

http://websvn.kde.org/trunk/KDE/kdelibs/kfile/kfilewidget.cpp?r1=860118&r2=861225

which removed the call to appendExtension. The patch below fixes the issue, but not sure it's the best way of doing it...

regards

______________________________________________________________
Index: kfilewidget.cpp
===================================================================
--- kfilewidget.cpp     (revision 876754)
+++ kfilewidget.cpp     (working copy)
@@ -866,6 +866,11 @@
     bool filesInList = false;
     while (it != locationEditCurrentTextList.constEnd()) {
         KUrl url(*it);
+
+       if (d->operationMode == Saving && !directoryMode) {
+           d->appendExtension(url);
+       }
+
         d->url = url;
         KIO::StatJob *statJob = KIO::stat(url, KIO::HideProgressInfo);
         bool res = KIO::NetAccess::synchronousRun(statJob, 0);
Comment 1 Rafael Fernández López 2008-10-28 00:59:56 UTC
Thanks for the report and the patch. No time right now, will revisit this issue tomorrow.
Comment 2 Jean-Baptiste Mardelle 2008-10-28 01:01:20 UTC
Created attachment 28194 [details]
Re-add extension updating
Comment 3 Rafael Fernández López 2008-10-28 17:31:20 UTC
Forgot to add the BUG keyword to the commit message. Closing this bug, thanks Jean-Baptiste for the patch, it looked fine and I have committed it on revision 877060.

Fast link: http://websvn.kde.org/?view=rev&revision=877060