mirror of
https://invent.kde.org/system/dolphin
synced 2024-10-28 03:21:56 +00:00
Allow home directories with non-local file paths.
Paths like file:/home/me work now instead of showing an error message. BUG: 352743 BUG: 353550 FIXED-IN: 15.08.3 REVIEW: 125586
This commit is contained in:
parent
4d6cd761d8
commit
5dd5eaf08d
|
@ -21,6 +21,7 @@
|
||||||
|
|
||||||
#include "dolphinmainwindow.h"
|
#include "dolphinmainwindow.h"
|
||||||
|
|
||||||
|
#include "global.h"
|
||||||
#include "dolphindockwidget.h"
|
#include "dolphindockwidget.h"
|
||||||
#include "dolphincontextmenu.h"
|
#include "dolphincontextmenu.h"
|
||||||
#include "dolphinnewfilemenu.h"
|
#include "dolphinnewfilemenu.h"
|
||||||
|
@ -639,7 +640,7 @@ void DolphinMainWindow::goHome(Qt::MouseButtons buttons)
|
||||||
{
|
{
|
||||||
// The default case (left button pressed) is handled in goHome().
|
// The default case (left button pressed) is handled in goHome().
|
||||||
if (buttons == Qt::MiddleButton) {
|
if (buttons == Qt::MiddleButton) {
|
||||||
openNewTab(GeneralSettings::self()->homeUrl());
|
openNewTab(Dolphin::homeUrl());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -39,6 +39,7 @@
|
||||||
#ifdef KActivities_FOUND
|
#ifdef KActivities_FOUND
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
#include "global.h"
|
||||||
#include "dolphin_generalsettings.h"
|
#include "dolphin_generalsettings.h"
|
||||||
#include "filterbar/filterbar.h"
|
#include "filterbar/filterbar.h"
|
||||||
#include "search/dolphinsearchbox.h"
|
#include "search/dolphinsearchbox.h"
|
||||||
|
@ -77,7 +78,7 @@ DolphinViewContainer::DolphinViewContainer(const QUrl& url, QWidget* parent) :
|
||||||
const GeneralSettings* settings = GeneralSettings::self();
|
const GeneralSettings* settings = GeneralSettings::self();
|
||||||
m_urlNavigator->setUrlEditable(settings->editableUrl());
|
m_urlNavigator->setUrlEditable(settings->editableUrl());
|
||||||
m_urlNavigator->setShowFullPath(settings->showFullPath());
|
m_urlNavigator->setShowFullPath(settings->showFullPath());
|
||||||
m_urlNavigator->setHomeUrl(QUrl::fromLocalFile(settings->homeUrl()));
|
m_urlNavigator->setHomeUrl(Dolphin::homeUrl());
|
||||||
KUrlComboBox* editor = m_urlNavigator->editor();
|
KUrlComboBox* editor = m_urlNavigator->editor();
|
||||||
editor->setCompletionMode(KCompletion::CompletionMode(settings->urlCompletionMode()));
|
editor->setCompletionMode(KCompletion::CompletionMode(settings->urlCompletionMode()));
|
||||||
|
|
||||||
|
@ -304,7 +305,7 @@ void DolphinViewContainer::readSettings()
|
||||||
// settings of the URL navigator and the filterbar.
|
// settings of the URL navigator and the filterbar.
|
||||||
m_urlNavigator->setUrlEditable(GeneralSettings::editableUrl());
|
m_urlNavigator->setUrlEditable(GeneralSettings::editableUrl());
|
||||||
m_urlNavigator->setShowFullPath(GeneralSettings::showFullPath());
|
m_urlNavigator->setShowFullPath(GeneralSettings::showFullPath());
|
||||||
m_urlNavigator->setHomeUrl(QUrl::fromLocalFile(GeneralSettings::homeUrl()));
|
m_urlNavigator->setHomeUrl(Dolphin::homeUrl());
|
||||||
setFilterBarVisible(GeneralSettings::filterBar());
|
setFilterBarVisible(GeneralSettings::filterBar());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -340,7 +341,7 @@ void DolphinViewContainer::setSearchModeEnabled(bool enabled)
|
||||||
// started with a search-URL, the home URL is used as fallback.
|
// started with a search-URL, the home URL is used as fallback.
|
||||||
QUrl url = m_searchBox->searchPath();
|
QUrl url = m_searchBox->searchPath();
|
||||||
if (url.isEmpty() || !url.isValid() || isSearchUrl(url)) {
|
if (url.isEmpty() || !url.isValid() || isSearchUrl(url)) {
|
||||||
url = QUrl::fromLocalFile(GeneralSettings::self()->homeUrl());
|
url = Dolphin::homeUrl();
|
||||||
}
|
}
|
||||||
m_urlNavigator->setLocationUrl(url);
|
m_urlNavigator->setLocationUrl(url);
|
||||||
}
|
}
|
||||||
|
|
|
@ -20,6 +20,8 @@
|
||||||
#include "global.h"
|
#include "global.h"
|
||||||
#include "dolphindebug.h"
|
#include "dolphindebug.h"
|
||||||
|
|
||||||
|
#include "dolphin_generalsettings.h"
|
||||||
|
|
||||||
QList<QUrl> Dolphin::validateUris(const QStringList& uriList)
|
QList<QUrl> Dolphin::validateUris(const QStringList& uriList)
|
||||||
{
|
{
|
||||||
QList<QUrl> urls;
|
QList<QUrl> urls;
|
||||||
|
@ -33,3 +35,8 @@ QList<QUrl> Dolphin::validateUris(const QStringList& uriList)
|
||||||
}
|
}
|
||||||
return urls;
|
return urls;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
QUrl Dolphin::homeUrl()
|
||||||
|
{
|
||||||
|
return QUrl::fromUserInput(GeneralSettings::homeUrl(), QString(), QUrl::AssumeLocalFile);
|
||||||
|
}
|
||||||
|
|
|
@ -25,6 +25,11 @@
|
||||||
|
|
||||||
namespace Dolphin {
|
namespace Dolphin {
|
||||||
QList<QUrl> validateUris(const QStringList& uriList);
|
QList<QUrl> validateUris(const QStringList& uriList);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Returns the home url which is defined in General Settings
|
||||||
|
*/
|
||||||
|
QUrl homeUrl();
|
||||||
}
|
}
|
||||||
|
|
||||||
#endif //GLOBAL_H
|
#endif //GLOBAL_H
|
||||||
|
|
|
@ -113,8 +113,7 @@ extern "C" Q_DECL_EXPORT int kdemain(int argc, char **argv)
|
||||||
|
|
||||||
if (urls.isEmpty()) {
|
if (urls.isEmpty()) {
|
||||||
// We need at least one URL to open Dolphin
|
// We need at least one URL to open Dolphin
|
||||||
const QUrl homeUrl(QUrl::fromLocalFile(GeneralSettings::homeUrl()));
|
urls.append(Dolphin::homeUrl());
|
||||||
urls.append(homeUrl);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
const bool splitView = parser.isSet("split") || GeneralSettings::splitView();
|
const bool splitView = parser.isSet("split") || GeneralSettings::splitView();
|
||||||
|
|
|
@ -19,6 +19,7 @@
|
||||||
|
|
||||||
#include "startupsettingspage.h"
|
#include "startupsettingspage.h"
|
||||||
|
|
||||||
|
#include "global.h"
|
||||||
#include "dolphinmainwindow.h"
|
#include "dolphinmainwindow.h"
|
||||||
#include "dolphinviewcontainer.h"
|
#include "dolphinviewcontainer.h"
|
||||||
|
|
||||||
|
@ -128,7 +129,7 @@ void StartupSettingsPage::applySettings()
|
||||||
{
|
{
|
||||||
GeneralSettings* settings = GeneralSettings::self();
|
GeneralSettings* settings = GeneralSettings::self();
|
||||||
|
|
||||||
const QUrl url(QUrl::fromLocalFile(m_homeUrl->text()));
|
const QUrl url(QUrl::fromUserInput(m_homeUrl->text(), QString(), QUrl::AssumeLocalFile));
|
||||||
KFileItem fileItem(url);
|
KFileItem fileItem(url);
|
||||||
if ((url.isValid() && fileItem.isDir()) || (url.scheme() == QLatin1String("timeline"))) {
|
if ((url.isValid() && fileItem.isDir()) || (url.scheme() == QLatin1String("timeline"))) {
|
||||||
settings->setHomeUrl(url.toDisplayString(QUrl::PreferLocalFile));
|
settings->setHomeUrl(url.toDisplayString(QUrl::PreferLocalFile));
|
||||||
|
@ -163,8 +164,8 @@ void StartupSettingsPage::slotSettingsChanged()
|
||||||
|
|
||||||
void StartupSettingsPage::selectHomeUrl()
|
void StartupSettingsPage::selectHomeUrl()
|
||||||
{
|
{
|
||||||
const QString homeUrl = m_homeUrl->text();
|
const QUrl homeUrl(QUrl::fromUserInput(m_homeUrl->text(), QString(), QUrl::AssumeLocalFile));
|
||||||
QUrl url = QFileDialog::getExistingDirectoryUrl(this, QString(), QUrl::fromLocalFile(homeUrl));
|
QUrl url = QFileDialog::getExistingDirectoryUrl(this, QString(), homeUrl);
|
||||||
if (!url.isEmpty()) {
|
if (!url.isEmpty()) {
|
||||||
m_homeUrl->setText(url.toDisplayString(QUrl::PreferLocalFile));
|
m_homeUrl->setText(url.toDisplayString(QUrl::PreferLocalFile));
|
||||||
slotSettingsChanged();
|
slotSettingsChanged();
|
||||||
|
@ -183,7 +184,7 @@ void StartupSettingsPage::useDefaultLocation()
|
||||||
|
|
||||||
void StartupSettingsPage::loadSettings()
|
void StartupSettingsPage::loadSettings()
|
||||||
{
|
{
|
||||||
const QUrl url(QUrl::fromLocalFile(GeneralSettings::homeUrl()));
|
const QUrl url(Dolphin::homeUrl());
|
||||||
m_homeUrl->setText(url.toDisplayString(QUrl::PreferLocalFile));
|
m_homeUrl->setText(url.toDisplayString(QUrl::PreferLocalFile));
|
||||||
m_splitView->setChecked(GeneralSettings::splitView());
|
m_splitView->setChecked(GeneralSettings::splitView());
|
||||||
m_editableUrl->setChecked(GeneralSettings::editableUrl());
|
m_editableUrl->setChecked(GeneralSettings::editableUrl());
|
||||||
|
|
Loading…
Reference in a new issue