Commit cfc52e24 authored by Ingomar Wesp's avatar Ingomar Wesp Committed by Sebastian Trueg
Browse files

Make sure that paths selected via the file dialog are properly quoted. Since the

line edit expects shell-style quoting, this patch avoids file-not-found errors
when selecting a path that contains whitespace or special characters.

BUG: 281952
FIXED-IN: 4.8
REVIEW: 103602
parent ba5e137f
......@@ -38,6 +38,7 @@
#include <klineedit.h>
#include <klocale.h>
#include <kmessagebox.h>
#include <kshell.h>
#include <krun.h>
#include <kstandarddirs.h>
#include <kstringhandler.h>
......@@ -458,6 +459,7 @@ public:
// slots
void _k_slotDbClick();
void _k_slotFileSelected();
bool saveNewApps;
bool m_terminaldirty;
......@@ -617,6 +619,7 @@ void KOpenWithDialogPrivate::init(const QString &_text, const QString &_value)
}
QObject::connect(edit, SIGNAL(textChanged(QString)), q, SLOT(slotTextChanged()));
QObject::connect(edit, SIGNAL(urlSelected(KUrl)), q, SLOT(_k_slotFileSelected()));
view = new KApplicationView(mainWidget);
view->setModel(new KApplicationModel(view));
......@@ -743,6 +746,12 @@ void KOpenWithDialogPrivate::_k_slotDbClick()
q->accept();
}
void KOpenWithDialogPrivate::_k_slotFileSelected()
{
// quote the path to avoid unescaped whitespace, backslashes, etc.
edit->setText(KShell::quoteArg(edit->text()));
}
void KOpenWithDialog::setSaveNewApplications(bool b)
{
d->saveNewApps = b;
......
......@@ -134,6 +134,7 @@ private:
Q_DISABLE_COPY(KOpenWithDialog)
Q_PRIVATE_SLOT(d, void _k_slotDbClick())
Q_PRIVATE_SLOT(d, void _k_slotFileSelected())
};
#endif
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment