]> cloud.milkyroute.net Git - dolphin.git/blobdiff - src/settings/startup/startupsettingspage.cpp
Load KFileItemAction plugins with json metadata
[dolphin.git] / src / settings / startup / startupsettingspage.cpp
index 11adb869b20a7f88a6892763f97d09cb6dc8bce1..6554493d8066ab6a67c2ed633655e7ff6aed1d89 100644 (file)
 
 #include "startupsettingspage.h"
 
+#include "global.h"
 #include "dolphinmainwindow.h"
 #include "dolphinviewcontainer.h"
 
 #include "dolphin_generalsettings.h"
 
-#include <KDialog>
-#include <KFileDialog>
 #include <KLocalizedString>
 #include <QLineEdit>
 #include <KMessageBox>
@@ -36,7 +35,7 @@
 #include <QLabel>
 #include <QPushButton>
 #include <QHBoxLayout>
-#include <QVBoxLayout>
+#include <QFileDialog>
 
 #include "views/dolphinview.h"
 
@@ -49,13 +48,10 @@ StartupSettingsPage::StartupSettingsPage(const QUrl& url, QWidget* parent) :
     m_showFullPath(0),
     m_filterBar(0)
 {
-    const int spacing = KDialog::spacingHint();
-
     QVBoxLayout* topLayout = new QVBoxLayout(this);
     QWidget* vBox = new QWidget(this);
     QVBoxLayout *vBoxLayout = new QVBoxLayout(vBox);
     vBoxLayout->setMargin(0);
-    vBoxLayout->setSpacing(spacing);
     vBoxLayout->setAlignment(Qt::AlignTop);
 
     // create 'Home URL' editor
@@ -65,7 +61,6 @@ StartupSettingsPage::StartupSettingsPage(const QUrl& url, QWidget* parent) :
     QWidget* homeUrlBox = new QWidget(homeBox);
     QHBoxLayout *homeUrlBoxLayout = new QHBoxLayout(homeUrlBox);
     homeUrlBoxLayout->setMargin(0);
-    homeUrlBoxLayout->setSpacing(spacing);
 
     QLabel* homeUrlLabel = new QLabel(i18nc("@label:textbox", "Location:"), homeUrlBox);
     homeUrlBoxLayout->addWidget(homeUrlLabel);
@@ -73,7 +68,7 @@ StartupSettingsPage::StartupSettingsPage(const QUrl& url, QWidget* parent) :
     homeUrlBoxLayout->addWidget(m_homeUrl);
     m_homeUrl->setClearButtonEnabled(true);
 
-    QPushButton* selectHomeUrlButton = new QPushButton(QIcon::fromTheme("folder-open"), QString(), homeUrlBox);
+    QPushButton* selectHomeUrlButton = new QPushButton(QIcon::fromTheme(QStringLiteral("folder-open")), QString(), homeUrlBox);
     homeUrlBoxLayout->addWidget(selectHomeUrlButton);
 
 #ifndef QT_NO_ACCESSIBILITY
@@ -86,7 +81,6 @@ StartupSettingsPage::StartupSettingsPage(const QUrl& url, QWidget* parent) :
     QWidget* buttonBox = new QWidget(homeBox);
     QHBoxLayout *buttonBoxLayout = new QHBoxLayout(buttonBox);
     buttonBoxLayout->setMargin(0);
-    buttonBoxLayout->setSpacing(spacing);
 
     QPushButton* useCurrentButton = new QPushButton(i18nc("@action:button", "Use Current Location"), buttonBox);
     buttonBoxLayout->addWidget(useCurrentButton);
@@ -135,7 +129,7 @@ void StartupSettingsPage::applySettings()
 {
     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);
     if ((url.isValid() && fileItem.isDir()) || (url.scheme() == QLatin1String("timeline"))) {
         settings->setHomeUrl(url.toDisplayString(QUrl::PreferLocalFile));
@@ -170,8 +164,8 @@ void StartupSettingsPage::slotSettingsChanged()
 
 void StartupSettingsPage::selectHomeUrl()
 {
-    const QString homeUrl = m_homeUrl->text();
-    QUrl url = KFileDialog::getExistingDirectoryUrl(QUrl::fromLocalFile(homeUrl), this);
+    const QUrl homeUrl(QUrl::fromUserInput(m_homeUrl->text(), QString(), QUrl::AssumeLocalFile));
+    QUrl url = QFileDialog::getExistingDirectoryUrl(this, QString(), homeUrl);
     if (!url.isEmpty()) {
         m_homeUrl->setText(url.toDisplayString(QUrl::PreferLocalFile));
         slotSettingsChanged();
@@ -190,7 +184,7 @@ void StartupSettingsPage::useDefaultLocation()
 
 void StartupSettingsPage::loadSettings()
 {
-    const QUrl url(QUrl::fromLocalFile(GeneralSettings::homeUrl()));
+    const QUrl url(Dolphin::homeUrl());
     m_homeUrl->setText(url.toDisplayString(QUrl::PreferLocalFile));
     m_splitView->setChecked(GeneralSettings::splitView());
     m_editableUrl->setChecked(GeneralSettings::editableUrl());