Changeset View
Changeset View
Standalone View
Standalone View
src/platformtheme/kdeplatformfiledialoghelper.cpp
Show First 20 Lines • Show All 99 Lines • ▼ Show 20 Line(s) | |||||
100 | { | 100 | { | ||
101 | setLayout(new QVBoxLayout); | 101 | setLayout(new QVBoxLayout); | ||
102 | connect(m_fileWidget, SIGNAL(filterChanged(QString)), SIGNAL(filterSelected(QString))); | 102 | connect(m_fileWidget, SIGNAL(filterChanged(QString)), SIGNAL(filterSelected(QString))); | ||
103 | layout()->addWidget(m_fileWidget); | 103 | layout()->addWidget(m_fileWidget); | ||
104 | 104 | | |||
105 | m_buttons = new QDialogButtonBox(this); | 105 | m_buttons = new QDialogButtonBox(this); | ||
106 | m_buttons->addButton(m_fileWidget->okButton(), QDialogButtonBox::AcceptRole); | 106 | m_buttons->addButton(m_fileWidget->okButton(), QDialogButtonBox::AcceptRole); | ||
107 | m_buttons->addButton(m_fileWidget->cancelButton(), QDialogButtonBox::RejectRole); | 107 | m_buttons->addButton(m_fileWidget->cancelButton(), QDialogButtonBox::RejectRole); | ||
108 | connect(m_buttons, SIGNAL(rejected()), m_fileWidget, SLOT(slotCancel())); | 108 | connect(m_buttons, SIGNAL(rejected()), m_fileWidget, SLOT(slotCancel())); | ||
anthonyfieroni: Even better to me should be
```
connect(this, &KDEPlatformFileDialog::rejected, m_fileWidget… | |||||
ngraham: Sounds good, I will do that after this! | |||||
109 | connect(m_fileWidget->okButton(), SIGNAL(clicked(bool)), m_fileWidget, SLOT(slotOk())); | 109 | connect(m_fileWidget->okButton(), SIGNAL(clicked(bool)), m_fileWidget, SLOT(slotOk())); | ||
110 | connect(m_fileWidget, SIGNAL(accepted()), m_fileWidget, SLOT(accept())); | 110 | connect(m_fileWidget, SIGNAL(accepted()), m_fileWidget, SLOT(accept())); | ||
111 | connect(m_fileWidget, SIGNAL(accepted()), SLOT(accept())); | 111 | connect(m_fileWidget, SIGNAL(accepted()), SLOT(accept())); | ||
112 | connect(m_fileWidget->cancelButton(), SIGNAL(clicked(bool)), SLOT(reject())); | 112 | connect(m_fileWidget->cancelButton(), SIGNAL(clicked(bool)), SLOT(reject())); | ||
113 | layout()->addWidget(m_buttons); | 113 | layout()->addWidget(m_buttons); | ||
114 | } | 114 | } | ||
115 | 115 | | |||
116 | QUrl KDEPlatformFileDialog::directory() | 116 | QUrl KDEPlatformFileDialog::directory() | ||
▲ Show 20 Lines • Show All 114 Lines • ▼ Show 20 Line(s) | 222 | if (job->exec()) { | |||
231 | } | 231 | } | ||
232 | } | 232 | } | ||
233 | } | 233 | } | ||
234 | else { | 234 | else { | ||
235 | m_fileWidget->setUrl(directory); | 235 | m_fileWidget->setUrl(directory); | ||
236 | } | 236 | } | ||
237 | } | 237 | } | ||
238 | 238 | | |||
239 | // Save the view settings before closing the dialog when the Escape key | ||||
240 | // is pressed or the close button in the titlebar is clicked | ||||
elvisangelaccio: typo: pressed | |||||
241 | void KDEPlatformFileDialog::reject() | ||||
242 | { | ||||
243 | m_fileWidget->writeViewConfig(); | ||||
You can see at line 108 on reject is called slotCancel, so for convenience just call it m_fileWidget->slotCancel(); Then you can discard D12239 anthonyfieroni: You can see at line 108 on reject is called slotCancel, so for convenience just call it
```… | |||||
244 | QDialog::reject(); | ||||
245 | } | ||||
246 | | ||||
239 | bool KDEPlatformFileDialogHelper::isSupportedUrl(const QUrl& url) const | 247 | bool KDEPlatformFileDialogHelper::isSupportedUrl(const QUrl& url) const | ||
240 | { | 248 | { | ||
241 | return KProtocolInfo::protocols().contains(url.scheme()); | 249 | return KProtocolInfo::protocols().contains(url.scheme()); | ||
242 | } | 250 | } | ||
243 | 251 | | |||
244 | //////////////////////////////////////////////// | 252 | //////////////////////////////////////////////// | ||
245 | 253 | | |||
246 | KDEPlatformFileDialogHelper::KDEPlatformFileDialogHelper() | 254 | KDEPlatformFileDialogHelper::KDEPlatformFileDialogHelper() | ||
▲ Show 20 Lines • Show All 187 Lines • Show Last 20 Lines |
Even better to me should be
PS: You can make a different review to change old syntax (SIGNAL/SLOT) to new function pointers.