Changeset View
Standalone View
src/filewidgets/kfilewidget.cpp
Show First 20 Lines • Show All 1167 Lines • ▼ Show 20 Line(s) | 1166 | if (i.isNull()) { | |||
---|---|---|---|---|---|
1168 | return; | 1168 | return; | ||
1169 | } | 1169 | } | ||
1170 | setLocationText(i.url()); | 1170 | setLocationText(i.url()); | ||
1171 | } else { | 1171 | } else { | ||
1172 | multiSelectionChanged(); | 1172 | multiSelectionChanged(); | ||
1173 | emit q->selectionChanged(); | 1173 | emit q->selectionChanged(); | ||
1174 | } | 1174 | } | ||
1175 | 1175 | | |||
1176 | // if we are saving, let another chance to the user before accepting the dialog (or trying to | | |||
1177 | // accept). This way the user can choose a file and add a "_2" for instance to the filename | | |||
1178 | if (operationMode == KFileWidget::Saving) { | | |||
1179 | locationEdit->setFocus(); | | |||
1180 | } else { | | |||
1181 | q->slotOk(); | 1176 | q->slotOk(); | ||
rkflx: Do you mean "override" instead of "trigger" here? | |||||
1182 | } | 1177 | } | ||
ngraham: Unnecessary unrelated whitespace change | |||||
1183 | } | | |||
1184 | 1178 | | |||
1185 | // I know it's slow to always iterate thru the whole filelist | 1179 | // I know it's slow to always iterate thru the whole filelist | ||
1186 | // (d->ops->selectedItems()), but what can we do? | 1180 | // (d->ops->selectedItems()), but what can we do? | ||
1187 | void KFileWidgetPrivate::multiSelectionChanged() | 1181 | void KFileWidgetPrivate::multiSelectionChanged() | ||
1188 | { | 1182 | { | ||
1189 | if (locationEdit->hasFocus() && !locationEdit->currentText().isEmpty()) { // don't disturb | 1183 | if (locationEdit->hasFocus() && !locationEdit->currentText().isEmpty()) { // don't disturb | ||
1190 | return; | 1184 | return; | ||
1191 | } | 1185 | } | ||
▲ Show 20 Lines • Show All 649 Lines • ▼ Show 20 Line(s) | |||||
1841 | { | 1835 | { | ||
1842 | if (!d->hasView) { // delayed view-creation | 1836 | if (!d->hasView) { // delayed view-creation | ||
1843 | Q_ASSERT(d); | 1837 | Q_ASSERT(d); | ||
1844 | Q_ASSERT(d->ops); | 1838 | Q_ASSERT(d->ops); | ||
1845 | d->ops->setView(KFile::Default); | 1839 | d->ops->setView(KFile::Default); | ||
1846 | d->ops->view()->setSizePolicy(QSizePolicy(QSizePolicy::Maximum, QSizePolicy::Maximum)); | 1840 | d->ops->view()->setSizePolicy(QSizePolicy(QSizePolicy::Maximum, QSizePolicy::Maximum)); | ||
1847 | d->hasView = true; | 1841 | d->hasView = true; | ||
1848 | } | 1842 | } | ||
1849 | d->ops->clearHistory(); | 1843 | d->ops->clearHistory(); | ||
Let's use new-style signal/slot syntax for new code. See https://wiki.qt.io/New_Signal_Slot_Syntax ngraham: Let's use new-style signal/slot syntax for new code. See https://wiki.qt. | |||||
Is this even possible without a lot of refactoring (which would be out-of-scope for this patch)? rkflx: Is this even possible without a lot of refactoring (which would be out-of-scope for this patch)? | |||||
ngraham: Not for everything, just this one. | |||||
rkflx: Well, how should that line look like then? | |||||
I'm having a lot of trouble finding the correct syntax... anemeth: I'm having a lot of trouble finding the correct syntax...
And the compiler is giving me 100… | |||||
Hmm, you're right, I can't get it to work without a lot of refactoring either. Let's leave this alone for now and do the connect syntax porting later. ngraham: Hmm, you're right, I can't get it to work without a lot of refactoring either. Let's leave this… | |||||
1850 | 1844 | | |||
1851 | QWidget::showEvent(event); | 1845 | QWidget::showEvent(event); | ||
1852 | } | 1846 | } | ||
1853 | 1847 | | |||
1854 | bool KFileWidget::eventFilter(QObject *watched, QEvent *event) | 1848 | bool KFileWidget::eventFilter(QObject *watched, QEvent *event) | ||
1855 | { | 1849 | { | ||
1856 | const bool res = QWidget::eventFilter(watched, event); | 1850 | const bool res = QWidget::eventFilter(watched, event); | ||
1857 | 1851 | | |||
▲ Show 20 Lines • Show All 285 Lines • ▼ Show 20 Line(s) | 2136 | case KIconLoader::SizeEnormous: | |||
2143 | iconSizeSlider->setToolTip(i18n("Icon size: %1 pixels (standard size)", value)); | 2137 | iconSizeSlider->setToolTip(i18n("Icon size: %1 pixels (standard size)", value)); | ||
2144 | break; | 2138 | break; | ||
2145 | default: | 2139 | default: | ||
2146 | iconSizeSlider->setToolTip(i18n("Icon size: %1 pixels", value)); | 2140 | iconSizeSlider->setToolTip(i18n("Icon size: %1 pixels", value)); | ||
2147 | break; | 2141 | break; | ||
2148 | } | 2142 | } | ||
2149 | } | 2143 | } | ||
2150 | 2144 | | |||
2151 | void KFileWidgetPrivate::_k_slotIconSizeSliderMoved(int _value) | 2145 | void KFileWidgetPrivate::_k_slotIconSizeSliderMoved(int _value) | ||
2152 | { | 2146 | { | ||
2153 | // Force this to be called in case this slot is called first on the | 2147 | // Force this to be called in case this slot is called first on the | ||
2154 | // slider move. | 2148 | // slider move. | ||
2155 | _k_slotIconSizeChanged(_value); | 2149 | _k_slotIconSizeChanged(_value); | ||
2156 | 2150 | | |||
2157 | QPoint global(iconSizeSlider->rect().topLeft()); | 2151 | QPoint global(iconSizeSlider->rect().topLeft()); | ||
I'd move that right under :_k_slotIconSizeSliderMoved, to keep ordering at least somewhat consistent with the declaration. rkflx: I'd move that right under `:_k_slotIconSizeSliderMoved`, to keep ordering at least somewhat… | |||||
2158 | global.ry() += iconSizeSlider->height() / 2; | 2152 | global.ry() += iconSizeSlider->height() / 2; | ||
2159 | QHelpEvent toolTipEvent(QEvent::ToolTip, QPoint(0, 0), iconSizeSlider->mapToGlobal(global)); | 2153 | QHelpEvent toolTipEvent(QEvent::ToolTip, QPoint(0, 0), iconSizeSlider->mapToGlobal(global)); | ||
2160 | QApplication::sendEvent(iconSizeSlider, &toolTipEvent); | 2154 | QApplication::sendEvent(iconSizeSlider, &toolTipEvent); | ||
2161 | } | 2155 | } | ||
2162 | 2156 | | |||
2163 | static QString getExtensionFromPatternList(const QStringList &patternList) | 2157 | static QString getExtensionFromPatternList(const QStringList &patternList) | ||
2164 | { | 2158 | { | ||
2165 | // qDebug(); | 2159 | // qDebug(); | ||
2166 | 2160 | | |||
I find inf as a variable name slightly too cryptic. But actually I'd just write this inline and go without QFileInfo and the QUrl conversion altogether, because KFileItem should already provide what is needed: && ops->selectedItems().first().isFile() rkflx: I find `inf` as a variable name slightly too cryptic.
But actually I'd just write this inline… | |||||
2167 | QString ret; | 2161 | QString ret; | ||
2168 | // qDebug() << "\tgetExtension " << patternList; | 2162 | // qDebug() << "\tgetExtension " << patternList; | ||
2169 | 2163 | | |||
2170 | QStringList::ConstIterator patternListEnd = patternList.end(); | 2164 | QStringList::ConstIterator patternListEnd = patternList.end(); | ||
2171 | for (QStringList::ConstIterator it = patternList.begin(); | 2165 | for (QStringList::ConstIterator it = patternList.begin(); | ||
2172 | it != patternListEnd; | 2166 | it != patternListEnd; | ||
2173 | ++it) { | 2167 | ++it) { | ||
2174 | // qDebug() << "\t\ttry: \'" << (*it) << "\'"; | 2168 | // qDebug() << "\t\ttry: \'" << (*it) << "\'"; | ||
▲ Show 20 Lines • Show All 694 Lines • Show Last 20 Lines |
Do you mean "override" instead of "trigger" here?