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())); | ||
109 | // Also call the cancel function when the dialog is closed via the escape key | ||||
110 | // or titlebar close button to make sure we always save the view config | ||||
111 | connect(this, &KDEPlatformFileDialog::rejected, | ||||
112 | m_fileWidget, &KFileWidget::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())); | 113 | connect(m_fileWidget->okButton(), SIGNAL(clicked(bool)), m_fileWidget, SLOT(slotOk())); | ||
110 | connect(m_fileWidget, SIGNAL(accepted()), m_fileWidget, SLOT(accept())); | 114 | connect(m_fileWidget, SIGNAL(accepted()), m_fileWidget, SLOT(accept())); | ||
111 | connect(m_fileWidget, SIGNAL(accepted()), SLOT(accept())); | 115 | connect(m_fileWidget, SIGNAL(accepted()), SLOT(accept())); | ||
112 | connect(m_fileWidget->cancelButton(), SIGNAL(clicked(bool)), SLOT(reject())); | 116 | connect(m_fileWidget->cancelButton(), SIGNAL(clicked(bool)), SLOT(reject())); | ||
113 | layout()->addWidget(m_buttons); | 117 | layout()->addWidget(m_buttons); | ||
114 | } | 118 | } | ||
115 | 119 | | |||
116 | QUrl KDEPlatformFileDialog::directory() | 120 | QUrl KDEPlatformFileDialog::directory() | ||
▲ Show 20 Lines • Show All 115 Lines • ▼ Show 20 Line(s) | 220 | if (!directory.isLocalFile()) { | |||
232 | } | 236 | } | ||
233 | } | 237 | } | ||
234 | else { | 238 | else { | ||
235 | m_fileWidget->setUrl(directory); | 239 | m_fileWidget->setUrl(directory); | ||
236 | } | 240 | } | ||
237 | } | 241 | } | ||
238 | 242 | | |||
239 | bool KDEPlatformFileDialogHelper::isSupportedUrl(const QUrl& url) const | 243 | bool KDEPlatformFileDialogHelper::isSupportedUrl(const QUrl& url) const | ||
240 | { | 244 | { | ||
elvisangelaccio: typo: pressed | |||||
241 | return KProtocolInfo::protocols().contains(url.scheme()); | 245 | return KProtocolInfo::protocols().contains(url.scheme()); | ||
242 | } | 246 | } | ||
243 | 247 | | |||
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 | //////////////////////////////////////////////// | 248 | //////////////////////////////////////////////// | ||
245 | 249 | | |||
246 | KDEPlatformFileDialogHelper::KDEPlatformFileDialogHelper() | 250 | KDEPlatformFileDialogHelper::KDEPlatformFileDialogHelper() | ||
247 | : QPlatformFileDialogHelper() | 251 | : QPlatformFileDialogHelper() | ||
248 | , m_dialog(new KDEPlatformFileDialog) | 252 | , m_dialog(new KDEPlatformFileDialog) | ||
249 | { | 253 | { | ||
250 | connect(m_dialog, SIGNAL(closed()), SLOT(saveSize())); | 254 | connect(m_dialog, SIGNAL(closed()), SLOT(saveSize())); | ||
251 | connect(m_dialog, SIGNAL(finished(int)), SLOT(saveSize())); | 255 | connect(m_dialog, SIGNAL(finished(int)), SLOT(saveSize())); | ||
▲ Show 20 Lines • Show All 182 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.