X-Git-Url: https://cloud.milkyroute.net/gitweb/dolphin.git/blobdiff_plain/d1b06ab94f6936eee7f32f113f44f17b7477ac22..0464ea82a6850f58805bc4d6fc1df5369d83c3df:/src/settings/interface/folderstabssettingspage.cpp diff --git a/src/settings/interface/folderstabssettingspage.cpp b/src/settings/interface/folderstabssettingspage.cpp index 286295e64..0e6c1aaab 100644 --- a/src/settings/interface/folderstabssettingspage.cpp +++ b/src/settings/interface/folderstabssettingspage.cpp @@ -13,12 +13,16 @@ #include #include +#ifndef IS_KCM +#include +#endif #include #include #include #include #include #include +#include #include #include #include @@ -42,22 +46,19 @@ FoldersTabsSettingsPage::FoldersTabsSettingsPage(QWidget *parent) QFormLayout *topLayout = new QFormLayout(this); // Show on startup - m_rememberOpenedTabsRadioButton = new QRadioButton(i18nc("@option:radio Show on startup", "Folders, tabs, and window state from last time")); - m_homeUrlRadioButton = new QRadioButton(); - // HACK: otherwise the radio button has too much spacing in a grid layout - m_homeUrlRadioButton->setMaximumWidth(24); - - QButtonGroup *initialViewGroup = new QButtonGroup(this); - initialViewGroup->addButton(m_rememberOpenedTabsRadioButton); - initialViewGroup->addButton(m_homeUrlRadioButton); + m_rememberOpenedTabsRadioButton = new QRadioButton(i18nc("@option:radio Show on startup", "Folders, tabs, and window state from last time"), this); // create 'Home URL' editor m_homeUrlBoxLayoutContainer = new QWidget(this); + m_homeUrlRadioButton = new QRadioButton(m_homeUrlBoxLayoutContainer); + m_homeUrlRadioButton->setAccessibleName(i18nc("@option:radio", "Show home location on startup")); QHBoxLayout *homeUrlBoxLayout = new QHBoxLayout(m_homeUrlBoxLayoutContainer); homeUrlBoxLayout->setContentsMargins(0, 0, 0, 0); m_homeUrl = new QLineEdit(); m_homeUrl->setClearButtonEnabled(true); + // i18n: For entering the absolute path to a user-specified home folder. Default: /home/userName/ + m_homeUrl->setPlaceholderText(i18nc("@info:placeholder", "Enter home location path")); homeUrlBoxLayout->addWidget(m_homeUrl); QPushButton *selectHomeUrlButton = new QPushButton(QIcon::fromTheme(QStringLiteral("folder-open")), QString()); @@ -73,13 +74,21 @@ FoldersTabsSettingsPage::FoldersTabsSettingsPage(QWidget *parent) QHBoxLayout *buttonBoxLayout = new QHBoxLayout(m_buttonBoxLayoutContainer); buttonBoxLayout->setContentsMargins(0, 0, 0, 0); +#ifndef IS_KCM QPushButton *useCurrentButton = new QPushButton(i18nc("@action:button", "Use Current Location")); buttonBoxLayout->addWidget(useCurrentButton); connect(useCurrentButton, &QPushButton::clicked, this, &FoldersTabsSettingsPage::useCurrentLocation); +#endif QPushButton *useDefaultButton = new QPushButton(i18nc("@action:button", "Use Default Location")); buttonBoxLayout->addWidget(useDefaultButton); connect(useDefaultButton, &QPushButton::clicked, this, &FoldersTabsSettingsPage::useDefaultLocation); + QButtonGroup *initialViewGroup = new QButtonGroup(this); + initialViewGroup->addButton(m_rememberOpenedTabsRadioButton); + initialViewGroup->addButton(m_homeUrlRadioButton); + + topLayout->addRow(i18nc("@label:textbox", "Show on startup:"), m_rememberOpenedTabsRadioButton); + QGridLayout *startInLocationLayout = new QGridLayout(); startInLocationLayout->setHorizontalSpacing(0); startInLocationLayout->setContentsMargins(0, 0, 0, 0); @@ -87,16 +96,19 @@ FoldersTabsSettingsPage::FoldersTabsSettingsPage(QWidget *parent) startInLocationLayout->addWidget(m_homeUrlBoxLayoutContainer, 0, 1); startInLocationLayout->addWidget(m_buttonBoxLayoutContainer, 1, 1); - topLayout->addRow(i18nc("@label:textbox", "Show on startup:"), m_rememberOpenedTabsRadioButton); topLayout->addRow(QString(), startInLocationLayout); topLayout->addItem(new QSpacerItem(0, Dolphin::VERTICAL_SPACER_HEIGHT, QSizePolicy::Fixed, QSizePolicy::Fixed)); // Opening Folders + auto *openingFoldersLabel = new QLabel{i18nc("@label:checkbox", "Opening Folders:")}; m_openExternallyCalledFolderInNewTab = new QCheckBox(i18nc("@option:check Opening Folders", "Keep a single Dolphin window, opening new folders in tabs")); - topLayout->addRow(i18nc("@label:checkbox", "Opening Folders:"), m_openExternallyCalledFolderInNewTab); + openingFoldersLabel->setAccessibleName(m_openExternallyCalledFolderInNewTab->text()); + topLayout->addRow(openingFoldersLabel, m_openExternallyCalledFolderInNewTab); // Window + auto *windowLabel = new QLabel{i18nc("@label:checkbox", "Window:")}; m_showFullPathInTitlebar = new QCheckBox(i18nc("@option:check Startup Settings", "Show full path in title bar")); - topLayout->addRow(i18nc("@label:checkbox", "Window:"), m_showFullPathInTitlebar); + windowLabel->setAccessibleName(m_showFullPathInTitlebar->text()); + topLayout->addRow(windowLabel, m_showFullPathInTitlebar); m_filterBar = new QCheckBox(i18nc("@option:check Window Startup Settings", "Show filter bar")); topLayout->addRow(QString(), m_filterBar); @@ -115,8 +127,10 @@ FoldersTabsSettingsPage::FoldersTabsSettingsPage(QWidget *parent) topLayout->addItem(new QSpacerItem(0, Dolphin::VERTICAL_SPACER_HEIGHT, QSizePolicy::Fixed, QSizePolicy::Fixed)); // 'Switch between panes of split views with tab key' + auto *splitViewLabel = new QLabel{i18nc("@title:group", "Split view: ")}; m_useTabForSplitViewSwitch = new QCheckBox(i18nc("option:check split view panes", "Switch between views with Tab key")); - topLayout->addRow(i18nc("@title:group", "Split view: "), m_useTabForSplitViewSwitch); + splitViewLabel->setAccessibleName(m_useTabForSplitViewSwitch->text()); + topLayout->addRow(splitViewLabel, m_useTabForSplitViewSwitch); // 'Close active pane when turning off split view' m_closeActiveSplitView = new QCheckBox(i18nc("option:check", "Turning off split view closes the view in focus")); @@ -125,8 +139,10 @@ FoldersTabsSettingsPage::FoldersTabsSettingsPage(QWidget *parent) i18n("When unchecked, the opposite view will be closed. The Close icon always illustrates which view (left or right) will be closed.")); // 'Begin in split view mode' + auto *newWindowsLabel = new QLabel{i18n("New windows:")}; m_splitView = new QCheckBox(i18nc("@option:check Startup Settings", "Begin in split view mode")); - topLayout->addRow(i18n("New windows:"), m_splitView); + newWindowsLabel->setAccessibleName(m_splitView->text()); + topLayout->addRow(newWindowsLabel, m_splitView); loadSettings(); @@ -230,6 +246,20 @@ void FoldersTabsSettingsPage::selectHomeUrl() void FoldersTabsSettingsPage::useCurrentLocation() { +#ifndef IS_KCM + DolphinMainWindow *mainWindow = nullptr; + const auto topLevelsWidgets = QApplication::topLevelWidgets(); + for (const auto widget : topLevelsWidgets) { + mainWindow = qobject_cast(widget); + if (mainWindow) { + break; + } + } + + if (mainWindow) { + m_url = mainWindow->activeViewContainer()->url(); + } +#endif m_homeUrl->setText(m_url.toDisplayString(QUrl::PreferLocalFile)); }