]> cloud.milkyroute.net Git - dolphin.git/blobdiff - src/startupsettingspage.cpp
Konq popupmenu fix: we don't show the "Create new" submenu over subdirs in an iconvie...
[dolphin.git] / src / startupsettingspage.cpp
index a7c62254e55b8f02c11b718c55d7ea5580aa6a0a..35fc47a57cfa83fc806f866a5845c5d3b5b6cdd5 100644 (file)
 #include <kdialog.h>
 #include <kfiledialog.h>
 #include <klocale.h>
+#include <klineedit.h>
 #include <kmessagebox.h>
 #include <kvbox.h>
 
 #include <QCheckBox>
 #include <QGroupBox>
 #include <QLabel>
-#include <QLineEdit>
 #include <QPushButton>
 #include <QRadioButton>
 
@@ -45,6 +45,7 @@ StartupSettingsPage::StartupSettingsPage(DolphinMainWindow* mainWin, QWidget* pa
     m_homeUrl(0),
     m_splitView(0),
     m_editableUrl(0),
+    m_showFullPath(0),
     m_filterBar(0)
 {
     const int spacing = KDialog::spacingHint();
@@ -60,7 +61,8 @@ StartupSettingsPage::StartupSettingsPage(DolphinMainWindow* mainWin, QWidget* pa
     homeUrlBox->setSpacing(spacing);
 
     new QLabel(i18nc("@label:textbox", "Location:"), homeUrlBox);
-    m_homeUrl = new QLineEdit(homeUrlBox);
+    m_homeUrl = new KLineEdit(homeUrlBox);
+    m_homeUrl->setClearButtonShown(true);
 
     QPushButton* selectHomeUrlButton = new QPushButton(KIcon("folder-open"), QString(), homeUrlBox);
     connect(selectHomeUrlButton, SIGNAL(clicked()),
@@ -83,7 +85,12 @@ StartupSettingsPage::StartupSettingsPage(DolphinMainWindow* mainWin, QWidget* pa
     // create 'Split view', 'Editable location' and 'Filter bar' checkboxes
     m_splitView = new QCheckBox(i18nc("@option:check Startup Settings", "Split view mode"), vBox);
     m_editableUrl = new QCheckBox(i18nc("@option:check Startup Settings", "Editable location bar"), vBox);
+    m_showFullPath = new QCheckBox(i18nc("@option:check Startup Settings", "Show full path inside location bar"), vBox);
     m_filterBar = new QCheckBox(i18nc("@option:check Startup Settings", "Show filter bar"), vBox);
+    connect(m_splitView,    SIGNAL(toggled(bool)), this, SIGNAL(changed()));
+    connect(m_editableUrl,  SIGNAL(toggled(bool)), this, SIGNAL(changed()));
+    connect(m_showFullPath, SIGNAL(toggled(bool)), this, SIGNAL(changed()));
+    connect(m_filterBar,    SIGNAL(toggled(bool)), this, SIGNAL(changed()));
 
     // Add a dummy widget with no restriction regarding
     // a vertical resizing. This assures that the dialog layout
@@ -93,6 +100,10 @@ StartupSettingsPage::StartupSettingsPage(DolphinMainWindow* mainWin, QWidget* pa
     topLayout->addWidget(vBox);
 
     loadSettings();
+
+    // it's important connecting 'textChanged' after loadSettings(), as loadSettings()
+    // invokes m_homeUrl->setText()
+    connect(m_homeUrl, SIGNAL(textChanged(const QString&)), this, SIGNAL(changed()));
 }
 
 StartupSettingsPage::~StartupSettingsPage()
@@ -108,11 +119,12 @@ void StartupSettingsPage::applySettings()
     if (url.isValid() && fileItem.isDir()) {
         settings->setHomeUrl(url.prettyUrl());
     } else {
-        KMessageBox::error(this, i18n("The location for the home folder is invalid and will not get applied."));
+        KMessageBox::error(this, i18nc("@info", "The location for the home folder is invalid and will not be applied."));
     }
 
     settings->setSplitView(m_splitView->isChecked());
     settings->setEditableUrl(m_editableUrl->isChecked());
+    settings->setShowFullPath(m_showFullPath->isChecked());
     settings->setFilterBar(m_filterBar->isChecked());
 }
 
@@ -126,9 +138,10 @@ void StartupSettingsPage::restoreDefaults()
 void StartupSettingsPage::selectHomeUrl()
 {
     const QString homeUrl = m_homeUrl->text();
-    KUrl url = KFileDialog::getExistingDirectoryUrl(homeUrl);
+    KUrl url = KFileDialog::getExistingDirectoryUrl(homeUrl, this);
     if (!url.isEmpty()) {
         m_homeUrl->setText(url.prettyUrl());
+        emit changed();
     }
 }
 
@@ -140,7 +153,7 @@ void StartupSettingsPage::useCurrentLocation()
 
 void StartupSettingsPage::useDefaultLocation()
 {
-    m_homeUrl->setText("file://" + QDir::homePath());
+    m_homeUrl->setText(QDir::homePath());
 }
 
 void StartupSettingsPage::loadSettings()
@@ -149,6 +162,7 @@ void StartupSettingsPage::loadSettings()
     m_homeUrl->setText(settings->homeUrl());
     m_splitView->setChecked(settings->splitView());
     m_editableUrl->setChecked(settings->editableUrl());
+    m_showFullPath->setChecked(settings->showFullPath());
     m_filterBar->setChecked(settings->filterBar());
 }