Changeset View
Changeset View
Standalone View
Standalone View
src/settings/startup/startupsettingspage.cpp
Show First 20 Lines • Show All 42 Lines • ▼ Show 20 Line(s) | 38 | StartupSettingsPage::StartupSettingsPage(const QUrl& url, QWidget* parent) : | |||
---|---|---|---|---|---|
43 | m_editableUrl(nullptr), | 43 | m_editableUrl(nullptr), | ||
44 | m_showFullPath(nullptr), | 44 | m_showFullPath(nullptr), | ||
45 | m_filterBar(nullptr), | 45 | m_filterBar(nullptr), | ||
46 | m_showFullPathInTitlebar(nullptr), | 46 | m_showFullPathInTitlebar(nullptr), | ||
47 | m_openExternallyCalledFolderInNewTab(nullptr) | 47 | m_openExternallyCalledFolderInNewTab(nullptr) | ||
48 | { | 48 | { | ||
49 | QFormLayout* topLayout = new QFormLayout(this); | 49 | QFormLayout* topLayout = new QFormLayout(this); | ||
50 | 50 | | |||
51 | 51 | | |||
meven: "Folders and tabs that were open before" => "Folders and tabs as they were opened before" Since… | |||||
52 | // create 'Home URL' editor | 52 | // create 'Home URL' editor | ||
53 | QHBoxLayout* homeUrlBoxLayout = new QHBoxLayout(); | 53 | QHBoxLayout* homeUrlBoxLayout = new QHBoxLayout(); | ||
feverfew: Does this compile? Shouldn't `QWidget` actually be `QWidget()`? | |||||
54 | homeUrlBoxLayout->setContentsMargins(0, 0, 0, 0); | 54 | homeUrlBoxLayout->setContentsMargins(0, 0, 0, 0); | ||
55 | 55 | | |||
56 | m_homeUrl = new QLineEdit(); | 56 | m_homeUrl = new QLineEdit(); | ||
57 | m_homeUrl->setClearButtonEnabled(true); | 57 | m_homeUrl->setClearButtonEnabled(true); | ||
58 | homeUrlBoxLayout->addWidget(m_homeUrl); | 58 | homeUrlBoxLayout->addWidget(m_homeUrl); | ||
59 | 59 | | |||
60 | QPushButton* selectHomeUrlButton = new QPushButton(QIcon::fromTheme(QStringLiteral("folder-open")), QString()); | 60 | QPushButton* selectHomeUrlButton = new QPushButton(QIcon::fromTheme(QStringLiteral("folder-open")), QString()); | ||
61 | homeUrlBoxLayout->addWidget(selectHomeUrlButton); | 61 | homeUrlBoxLayout->addWidget(selectHomeUrlButton); | ||
62 | 62 | | |||
63 | #ifndef QT_NO_ACCESSIBILITY | 63 | #ifndef QT_NO_ACCESSIBILITY | ||
64 | selectHomeUrlButton->setAccessibleName(i18nc("@action:button", "Select Home Location")); | 64 | selectHomeUrlButton->setAccessibleName(i18nc("@action:button", "Select Home Location")); | ||
65 | #endif | 65 | #endif | ||
66 | 66 | | |||
67 | connect(selectHomeUrlButton, &QPushButton::clicked, | 67 | connect(selectHomeUrlButton, &QPushButton::clicked, | ||
68 | this, &StartupSettingsPage::selectHomeUrl); | 68 | this, &StartupSettingsPage::selectHomeUrl); | ||
69 | 69 | | |||
70 | QHBoxLayout* buttonBoxLayout = new QHBoxLayout(); | 70 | QHBoxLayout* buttonBoxLayout = new QHBoxLayout(); | ||
feverfew: Same question here | |||||
71 | buttonBoxLayout->setContentsMargins(0, 0, 0, 0); | 71 | buttonBoxLayout->setContentsMargins(0, 0, 0, 0); | ||
72 | 72 | | |||
73 | QPushButton* useCurrentButton = new QPushButton(i18nc("@action:button", "Use Current Location")); | 73 | QPushButton* useCurrentButton = new QPushButton(i18nc("@action:button", "Use Current Location")); | ||
74 | buttonBoxLayout->addWidget(useCurrentButton); | 74 | buttonBoxLayout->addWidget(useCurrentButton); | ||
75 | connect(useCurrentButton, &QPushButton::clicked, | 75 | connect(useCurrentButton, &QPushButton::clicked, | ||
76 | this, &StartupSettingsPage::useCurrentLocation); | 76 | this, &StartupSettingsPage::useCurrentLocation); | ||
77 | QPushButton* useDefaultButton = new QPushButton(i18nc("@action:button", "Use Default Location")); | 77 | QPushButton* useDefaultButton = new QPushButton(i18nc("@action:button", "Use Default Location")); | ||
78 | buttonBoxLayout->addWidget(useDefaultButton); | 78 | buttonBoxLayout->addWidget(useDefaultButton); | ||
79 | connect(useDefaultButton, &QPushButton::clicked, | 79 | connect(useDefaultButton, &QPushButton::clicked, | ||
80 | this, &StartupSettingsPage::useDefaultLocation); | 80 | this, &StartupSettingsPage::useDefaultLocation); | ||
81 | 81 | | |||
82 | QVBoxLayout* homeBoxLayout = new QVBoxLayout(); | 82 | QVBoxLayout* homeBoxLayout = new QVBoxLayout(); | ||
83 | homeBoxLayout->setContentsMargins(0, 0, 0, 0); | 83 | homeBoxLayout->setContentsMargins(0, 0, 0, 0); | ||
84 | homeBoxLayout->addLayout(homeUrlBoxLayout); | 84 | homeBoxLayout->addLayout(homeUrlBoxLayout); | ||
85 | homeBoxLayout->addLayout(buttonBoxLayout); | 85 | homeBoxLayout->addLayout(buttonBoxLayout); | ||
86 | 86 | | |||
87 | topLayout->addRow(i18nc("@label:textbox", "Start in:"), homeBoxLayout); | 87 | topLayout->addRow(i18nc("@label:textbox", "For new windows, show:"), homeBoxLayout); | ||
88 | | ||||
89 | m_splitView = new QCheckBox(i18nc("@option:check Startup Settings", "Split view mode")); | ||||
90 | topLayout->addRow(QString(), m_splitView); | ||||
91 | m_editableUrl = new QCheckBox(i18nc("@option:check Startup Settings", "Editable location bar")); | ||||
92 | topLayout->addRow(QString(), m_editableUrl); | ||||
93 | m_filterBar = new QCheckBox(i18nc("@option:check Startup Settings", "Filter bar")); | ||||
94 | topLayout->addRow(QString(), m_filterBar); | ||||
88 | 95 | | |||
89 | 96 | | |||
90 | topLayout->addItem(new QSpacerItem(0, Dolphin::VERTICAL_SPACER_HEIGHT, QSizePolicy::Fixed, QSizePolicy::Fixed)); | 97 | topLayout->addItem(new QSpacerItem(0, Dolphin::VERTICAL_SPACER_HEIGHT, QSizePolicy::Fixed, QSizePolicy::Fixed)); | ||
91 | 98 | | |||
92 | 99 | | |||
93 | // create 'Split view', 'Show full path', 'Editable location' and 'Filter bar' checkboxes | 100 | m_rememberOpenedTabs = new QCheckBox(i18nc("@option:check Startup Settings", "Remember open folders and tabs")); | ||
broulik: This wording could be improved (can't think of one right now) | |||||
94 | m_splitView = new QCheckBox(i18nc("@option:check Startup Settings", "Split view mode")); | 101 | topLayout->addRow(i18nc("@label:checkbox", "General settings:"), m_rememberOpenedTabs); | ||
95 | topLayout->addRow(i18nc("@label:checkbox", "Window options:"), m_splitView); | 102 | m_openExternallyCalledFolderInNewTab = new QCheckBox(i18nc("@option:check Startup Settings", "Open new folders in tabs")); | ||
96 | m_editableUrl = new QCheckBox(i18nc("@option:check Startup Settings", "Editable location bar")); | 103 | topLayout->addRow(QString(), m_openExternallyCalledFolderInNewTab); | ||
97 | topLayout->addRow(QString(), m_editableUrl); | | |||
98 | m_showFullPath = new QCheckBox(i18nc("@option:check Startup Settings", "Show full path inside location bar")); | 104 | m_showFullPath = new QCheckBox(i18nc("@option:check Startup Settings", "Show full path inside location bar")); | ||
99 | topLayout->addRow(QString(), m_showFullPath); | 105 | topLayout->addRow(QString(), m_showFullPath); | ||
100 | m_filterBar = new QCheckBox(i18nc("@option:check Startup Settings", "Show filter bar")); | | |||
101 | topLayout->addRow(QString(), m_filterBar); | | |||
102 | m_showFullPathInTitlebar = new QCheckBox(i18nc("@option:check Startup Settings", "Show full path in title bar")); | 106 | m_showFullPathInTitlebar = new QCheckBox(i18nc("@option:check Startup Settings", "Show full path in title bar")); | ||
103 | topLayout->addRow(QString(), m_showFullPathInTitlebar); | 107 | topLayout->addRow(QString(), m_showFullPathInTitlebar); | ||
104 | m_openExternallyCalledFolderInNewTab = new QCheckBox(i18nc("@option:check Startup Settings", "Open new folders in tabs")); | | |||
105 | topLayout->addRow(QString(), m_openExternallyCalledFolderInNewTab); | | |||
106 | | ||||
107 | 108 | | |||
108 | loadSettings(); | 109 | loadSettings(); | ||
109 | 110 | | |||
110 | connect(m_homeUrl, &QLineEdit::textChanged, this, &StartupSettingsPage::slotSettingsChanged); | 111 | connect(m_homeUrl, &QLineEdit::textChanged, this, &StartupSettingsPage::slotSettingsChanged); | ||
111 | connect(m_splitView, &QCheckBox::toggled, this, &StartupSettingsPage::slotSettingsChanged); | 112 | connect(m_splitView, &QCheckBox::toggled, this, &StartupSettingsPage::slotSettingsChanged); | ||
112 | connect(m_editableUrl, &QCheckBox::toggled, this, &StartupSettingsPage::slotSettingsChanged); | 113 | connect(m_editableUrl, &QCheckBox::toggled, this, &StartupSettingsPage::slotSettingsChanged); | ||
113 | connect(m_showFullPath, &QCheckBox::toggled, this, &StartupSettingsPage::slotSettingsChanged); | | |||
114 | connect(m_filterBar, &QCheckBox::toggled, this, &StartupSettingsPage::slotSettingsChanged); | 114 | connect(m_filterBar, &QCheckBox::toggled, this, &StartupSettingsPage::slotSettingsChanged); | ||
elvisangelaccio: Please use a single line. | |||||
115 | connect(m_showFullPathInTitlebar, &QCheckBox::toggled, this, &StartupSettingsPage::slotSettingsChanged); | 115 | connect(m_rememberOpenedTabs, &QCheckBox::toggled, this, &StartupSettingsPage::slotSettingsChanged); | ||
116 | connect(m_openExternallyCalledFolderInNewTab, &QCheckBox::toggled, this, &StartupSettingsPage::slotSettingsChanged); | 116 | connect(m_openExternallyCalledFolderInNewTab, &QCheckBox::toggled, this, &StartupSettingsPage::slotSettingsChanged); | ||
117 | connect(m_showFullPath, &QCheckBox::toggled, this, &StartupSettingsPage::slotSettingsChanged); | ||||
118 | connect(m_showFullPathInTitlebar, &QCheckBox::toggled, this, &StartupSettingsPage::slotSettingsChanged); | ||||
117 | } | 119 | } | ||
118 | 120 | | |||
119 | StartupSettingsPage::~StartupSettingsPage() | 121 | StartupSettingsPage::~StartupSettingsPage() | ||
120 | { | 122 | { | ||
121 | } | 123 | } | ||
122 | 124 | | |||
123 | void StartupSettingsPage::applySettings() | 125 | void StartupSettingsPage::applySettings() | ||
124 | { | 126 | { | ||
125 | GeneralSettings* settings = GeneralSettings::self(); | 127 | GeneralSettings* settings = GeneralSettings::self(); | ||
126 | 128 | | |||
127 | const QUrl url(QUrl::fromUserInput(m_homeUrl->text(), QString(), QUrl::AssumeLocalFile)); | 129 | const QUrl url(QUrl::fromUserInput(m_homeUrl->text(), QString(), QUrl::AssumeLocalFile)); | ||
128 | KFileItem fileItem(url); | 130 | KFileItem fileItem(url); | ||
129 | if ((url.isValid() && fileItem.isDir()) || (url.scheme() == QLatin1String("timeline"))) { | 131 | if ((url.isValid() && fileItem.isDir()) || (url.scheme() == QLatin1String("timeline"))) { | ||
130 | settings->setHomeUrl(url.toDisplayString(QUrl::PreferLocalFile)); | 132 | settings->setHomeUrl(url.toDisplayString(QUrl::PreferLocalFile)); | ||
131 | } else { | 133 | } else { | ||
132 | KMessageBox::error(this, i18nc("@info", "The location for the home folder is invalid or does not exist, it will not be applied.")); | 134 | KMessageBox::error(this, i18nc("@info", "The location for the home folder is invalid or does not exist, it will not be applied.")); | ||
133 | } | 135 | } | ||
134 | 136 | | |||
137 | settings->setRememberOpenedTabs(m_rememberOpenedTabs->isChecked()); | ||||
feverfew: `state state`? | |||||
135 | settings->setSplitView(m_splitView->isChecked()); | 138 | settings->setSplitView(m_splitView->isChecked()); | ||
136 | settings->setEditableUrl(m_editableUrl->isChecked()); | 139 | settings->setEditableUrl(m_editableUrl->isChecked()); | ||
137 | settings->setShowFullPath(m_showFullPath->isChecked()); | 140 | settings->setShowFullPath(m_showFullPath->isChecked()); | ||
138 | settings->setFilterBar(m_filterBar->isChecked()); | 141 | settings->setFilterBar(m_filterBar->isChecked()); | ||
139 | settings->setShowFullPathInTitlebar(m_showFullPathInTitlebar->isChecked()); | 142 | settings->setShowFullPathInTitlebar(m_showFullPathInTitlebar->isChecked()); | ||
140 | settings->setOpenExternallyCalledFolderInNewTab(m_openExternallyCalledFolderInNewTab->isChecked()); | 143 | settings->setOpenExternallyCalledFolderInNewTab(m_openExternallyCalledFolderInNewTab->isChecked()); | ||
141 | settings->save(); | 144 | settings->save(); | ||
142 | } | 145 | } | ||
Show All 34 Lines | |||||
177 | { | 180 | { | ||
178 | m_homeUrl->setText(QDir::homePath()); | 181 | m_homeUrl->setText(QDir::homePath()); | ||
179 | } | 182 | } | ||
180 | 183 | | |||
181 | void StartupSettingsPage::loadSettings() | 184 | void StartupSettingsPage::loadSettings() | ||
182 | { | 185 | { | ||
183 | const QUrl url(Dolphin::homeUrl()); | 186 | const QUrl url(Dolphin::homeUrl()); | ||
184 | m_homeUrl->setText(url.toDisplayString(QUrl::PreferLocalFile)); | 187 | m_homeUrl->setText(url.toDisplayString(QUrl::PreferLocalFile)); | ||
188 | m_rememberOpenedTabs->setChecked(GeneralSettings::rememberOpenedTabs()); | ||||
185 | m_splitView->setChecked(GeneralSettings::splitView()); | 189 | m_splitView->setChecked(GeneralSettings::splitView()); | ||
186 | m_editableUrl->setChecked(GeneralSettings::editableUrl()); | 190 | m_editableUrl->setChecked(GeneralSettings::editableUrl()); | ||
187 | m_showFullPath->setChecked(GeneralSettings::showFullPath()); | 191 | m_showFullPath->setChecked(GeneralSettings::showFullPath()); | ||
188 | m_filterBar->setChecked(GeneralSettings::filterBar()); | 192 | m_filterBar->setChecked(GeneralSettings::filterBar()); | ||
189 | m_showFullPathInTitlebar->setChecked(GeneralSettings::showFullPathInTitlebar()); | 193 | m_showFullPathInTitlebar->setChecked(GeneralSettings::showFullPathInTitlebar()); | ||
190 | m_openExternallyCalledFolderInNewTab->setChecked(GeneralSettings::openExternallyCalledFolderInNewTab()); | 194 | m_openExternallyCalledFolderInNewTab->setChecked(GeneralSettings::openExternallyCalledFolderInNewTab()); | ||
191 | } | 195 | } |
"Folders and tabs that were open before" => "Folders and tabs as they were opened before" Since we also restore split view and such. ?