Changeset View
Standalone View
src/filewidgets/kfilewidget.cpp
Show First 20 Lines • Show All 191 Lines • ▼ Show 20 Line(s) | 82 | public: | |||
---|---|---|---|---|---|
192 | void _k_toggleBookmarks(bool); | 192 | void _k_toggleBookmarks(bool); | ||
193 | void _k_slotAutoSelectExtClicked(); | 193 | void _k_slotAutoSelectExtClicked(); | ||
194 | void _k_placesViewSplitterMoved(int, int); | 194 | void _k_placesViewSplitterMoved(int, int); | ||
195 | void _k_activateUrlNavigator(); | 195 | void _k_activateUrlNavigator(); | ||
196 | void _k_zoomOutIconsSize(); | 196 | void _k_zoomOutIconsSize(); | ||
197 | void _k_zoomInIconsSize(); | 197 | void _k_zoomInIconsSize(); | ||
198 | void _k_slotIconSizeSliderMoved(int); | 198 | void _k_slotIconSizeSliderMoved(int); | ||
199 | void _k_slotIconSizeChanged(int); | 199 | void _k_slotIconSizeChanged(int); | ||
200 | void _k_slotViewDoubleClicked(const QModelIndex&); | ||||
200 | 201 | | |||
201 | void addToRecentDocuments(); | 202 | void addToRecentDocuments(); | ||
202 | 203 | | |||
203 | QString locationEditCurrentText() const; | 204 | QString locationEditCurrentText() const; | ||
204 | 205 | | |||
205 | /** | 206 | /** | ||
206 | * KIO::NetAccess::mostLocalUrl local replacement. | 207 | * KIO::NetAccess::mostLocalUrl local replacement. | ||
207 | * This method won't show any progress dialogs for stating, since | 208 | * This method won't show any progress dialogs for stating, since | ||
▲ Show 20 Lines • Show All 963 Lines • ▼ Show 20 Line(s) | 1170 | if (i.isNull()) { | |||
1171 | return; | 1172 | return; | ||
1172 | } | 1173 | } | ||
1173 | setLocationText(i.url()); | 1174 | setLocationText(i.url()); | ||
1174 | } else { | 1175 | } else { | ||
1175 | multiSelectionChanged(); | 1176 | multiSelectionChanged(); | ||
1176 | emit q->selectionChanged(); | 1177 | emit q->selectionChanged(); | ||
1177 | } | 1178 | } | ||
1178 | 1179 | | |||
1179 | // if we are saving, let another chance to the user before accepting the dialog (or trying to | 1180 | // If we are saving, let another chance to the user before accepting the dialog (or trying to | ||
1180 | // accept). This way the user can choose a file and add a "_2" for instance to the filename | 1181 | // accept). This way the user can choose a file and add a "_2" for instance to the filename. | ||
rkflx: Do you mean "override" instead of "trigger" here? | |||||
1182 | // Double clicking however will override this, regardless of single/double click mouse setting, | ||||
1183 | // see: _k_slotViewDoubleClicked | ||||
1181 | if (operationMode == KFileWidget::Saving) { | 1184 | if (operationMode == KFileWidget::Saving) { | ||
1182 | locationEdit->setFocus(); | 1185 | locationEdit->setFocus(); | ||
1183 | } else { | 1186 | } else { | ||
1184 | q->slotOk(); | 1187 | q->slotOk(); | ||
1185 | } | 1188 | } | ||
1186 | } | 1189 | } | ||
ngraham: Unnecessary unrelated whitespace change | |||||
1187 | 1190 | | |||
1188 | // I know it's slow to always iterate thru the whole filelist | 1191 | // I know it's slow to always iterate thru the whole filelist | ||
1189 | // (d->ops->selectedItems()), but what can we do? | 1192 | // (d->ops->selectedItems()), but what can we do? | ||
1190 | void KFileWidgetPrivate::multiSelectionChanged() | 1193 | void KFileWidgetPrivate::multiSelectionChanged() | ||
1191 | { | 1194 | { | ||
1192 | if (locationEdit->hasFocus() && !locationEdit->currentText().isEmpty()) { // don't disturb | 1195 | if (locationEdit->hasFocus() && !locationEdit->currentText().isEmpty()) { // don't disturb | ||
1193 | return; | 1196 | return; | ||
1194 | } | 1197 | } | ||
▲ Show 20 Lines • Show All 658 Lines • ▼ Show 20 Line(s) | |||||
1853 | void KFileWidget::showEvent(QShowEvent *event) | 1856 | void KFileWidget::showEvent(QShowEvent *event) | ||
1854 | { | 1857 | { | ||
1855 | if (!d->hasView) { // delayed view-creation | 1858 | if (!d->hasView) { // delayed view-creation | ||
1856 | Q_ASSERT(d); | 1859 | Q_ASSERT(d); | ||
1857 | Q_ASSERT(d->ops); | 1860 | Q_ASSERT(d->ops); | ||
1858 | d->ops->setView(KFile::Default); | 1861 | d->ops->setView(KFile::Default); | ||
1859 | d->ops->view()->setSizePolicy(QSizePolicy(QSizePolicy::Maximum, QSizePolicy::Maximum)); | 1862 | d->ops->view()->setSizePolicy(QSizePolicy(QSizePolicy::Maximum, QSizePolicy::Maximum)); | ||
1860 | d->hasView = true; | 1863 | d->hasView = true; | ||
1864 | | ||||
1865 | connect(d->ops->view(), SIGNAL(doubleClicked(QModelIndex)), this, SLOT(_k_slotViewDoubleClicked(QModelIndex))); | ||||
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… | |||||
1861 | } | 1866 | } | ||
1862 | d->ops->clearHistory(); | 1867 | d->ops->clearHistory(); | ||
1863 | 1868 | | |||
1864 | QWidget::showEvent(event); | 1869 | QWidget::showEvent(event); | ||
1865 | } | 1870 | } | ||
1866 | 1871 | | |||
1867 | bool KFileWidget::eventFilter(QObject *watched, QEvent *event) | 1872 | bool KFileWidget::eventFilter(QObject *watched, QEvent *event) | ||
1868 | { | 1873 | { | ||
▲ Show 20 Lines • Show All 285 Lines • ▼ Show 20 Line(s) | 2158 | case KIconLoader::SizeEnormous: | |||
2154 | iconSizeSlider->setToolTip(i18n("Icon size: %1 pixels (standard size)", value)); | 2159 | iconSizeSlider->setToolTip(i18n("Icon size: %1 pixels (standard size)", value)); | ||
2155 | break; | 2160 | break; | ||
2156 | default: | 2161 | default: | ||
2157 | iconSizeSlider->setToolTip(i18n("Icon size: %1 pixels", value)); | 2162 | iconSizeSlider->setToolTip(i18n("Icon size: %1 pixels", value)); | ||
2158 | break; | 2163 | break; | ||
2159 | } | 2164 | } | ||
2160 | } | 2165 | } | ||
2161 | 2166 | | |||
2162 | void KFileWidgetPrivate::_k_slotIconSizeSliderMoved(int _value) | 2167 | void KFileWidgetPrivate::_k_slotIconSizeSliderMoved(int _value) | ||
2163 | { | 2168 | { | ||
2164 | // Force this to be called in case this slot is called first on the | 2169 | // Force this to be called in case this slot is called first on the | ||
2165 | // slider move. | 2170 | // slider move. | ||
2166 | _k_slotIconSizeChanged(_value); | 2171 | _k_slotIconSizeChanged(_value); | ||
2167 | 2172 | | |||
2168 | QPoint global(iconSizeSlider->rect().topLeft()); | 2173 | 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… | |||||
2169 | global.ry() += iconSizeSlider->height() / 2; | 2174 | global.ry() += iconSizeSlider->height() / 2; | ||
2170 | QHelpEvent toolTipEvent(QEvent::ToolTip, QPoint(0, 0), iconSizeSlider->mapToGlobal(global)); | 2175 | QHelpEvent toolTipEvent(QEvent::ToolTip, QPoint(0, 0), iconSizeSlider->mapToGlobal(global)); | ||
2171 | QApplication::sendEvent(iconSizeSlider, &toolTipEvent); | 2176 | QApplication::sendEvent(iconSizeSlider, &toolTipEvent); | ||
2172 | } | 2177 | } | ||
2173 | 2178 | | |||
2179 | void KFileWidgetPrivate::_k_slotViewDoubleClicked(const QModelIndex &index) | ||||
2180 | { | ||||
2181 | // double clicking to save should only work on files | ||||
2182 | if (operationMode == KFileWidget::Saving && index.isValid() && ops->selectedItems().first().isFile()) { | ||||
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… | |||||
2183 | q->slotOk(); | ||||
2184 | } | ||||
2185 | } | ||||
2186 | | ||||
2174 | static QString getExtensionFromPatternList(const QStringList &patternList) | 2187 | static QString getExtensionFromPatternList(const QStringList &patternList) | ||
2175 | { | 2188 | { | ||
2176 | // qDebug(); | 2189 | // qDebug(); | ||
2177 | 2190 | | |||
2178 | QString ret; | 2191 | QString ret; | ||
2179 | // qDebug() << "\tgetExtension " << patternList; | 2192 | // qDebug() << "\tgetExtension " << patternList; | ||
2180 | 2193 | | |||
2181 | QStringList::ConstIterator patternListEnd = patternList.end(); | 2194 | QStringList::ConstIterator patternListEnd = patternList.end(); | ||
▲ Show 20 Lines • Show All 700 Lines • Show Last 20 Lines |
Do you mean "override" instead of "trigger" here?