Changeset View
Changeset View
Standalone View
Standalone View
src/filewidgets/kfilewidget.cpp
Show First 20 Lines • Show All 1147 Lines • ▼ Show 20 Line(s) | 1135 | if (!(ops->mode() & KFile::Files)) { | |||
---|---|---|---|---|---|
1148 | 1148 | | |||
1149 | emit q->fileHighlighted(url); | 1149 | emit q->fileHighlighted(url); | ||
1150 | } else { | 1150 | } else { | ||
1151 | multiSelectionChanged(); | 1151 | multiSelectionChanged(); | ||
1152 | emit q->selectionChanged(); | 1152 | emit q->selectionChanged(); | ||
1153 | } | 1153 | } | ||
1154 | 1154 | | |||
1155 | locationEdit->lineEdit()->setModified(false); | 1155 | locationEdit->lineEdit()->setModified(false); | ||
1156 | locationEdit->lineEdit()->selectAll(); | | |||
1157 | } | 1156 | } | ||
1158 | 1157 | | |||
1159 | void KFileWidgetPrivate::_k_fileSelected(const KFileItem &i) | 1158 | void KFileWidgetPrivate::_k_fileSelected(const KFileItem &i) | ||
1160 | { | 1159 | { | ||
1161 | if (!i.isNull() && i.isDir()) { | 1160 | if (!i.isNull() && i.isDir()) { | ||
1162 | return; | 1161 | return; | ||
1163 | } | 1162 | } | ||
1164 | 1163 | | |||
▲ Show 20 Lines • Show All 117 Lines • ▼ Show 20 Line(s) | 1277 | if (!url.isRelative()) { | |||
1282 | } else { | 1281 | } else { | ||
1283 | q->setUrl(url, false); | 1282 | q->setUrl(url, false); | ||
1284 | } | 1283 | } | ||
1285 | } | 1284 | } | ||
1286 | setDummyHistoryEntry(url.fileName(), mimeTypeIcon); | 1285 | setDummyHistoryEntry(url.fileName(), mimeTypeIcon); | ||
1287 | } else { | 1286 | } else { | ||
1288 | removeDummyHistoryEntry(); | 1287 | removeDummyHistoryEntry(); | ||
1289 | } | 1288 | } | ||
1290 | 1289 | | |||
1291 | // don't change selection when user has clicked on an item | 1290 | if (operationMode == KFileWidget::Saving) { | ||
elvisangelaccio: This comment makes little sense to me. Since it was part of the same commit spotted by @rkflx… | |||||
1292 | if (operationMode == KFileWidget::Saving && !locationEdit->isVisible()) { | | |||
1293 | setNonExtSelection(); | 1291 | setNonExtSelection(); | ||
1294 | } | 1292 | } | ||
1295 | } | 1293 | } | ||
1296 | 1294 | | |||
1297 | static QString relativePathOrUrl(const QUrl &baseUrl, const QUrl &url) | 1295 | static QString relativePathOrUrl(const QUrl &baseUrl, const QUrl &url) | ||
1298 | { | 1296 | { | ||
1299 | if (baseUrl.isParentOf(url)) { | 1297 | if (baseUrl.isParentOf(url)) { | ||
1300 | const QString basePath(QDir::cleanPath(baseUrl.path())); | 1298 | const QString basePath(QDir::cleanPath(baseUrl.path())); | ||
Show All 21 Lines | 1314 | if (urlList.count() > 1) { | |||
1322 | 1320 | | |||
1323 | setDummyHistoryEntry(urls, QPixmap(), false); | 1321 | setDummyHistoryEntry(urls, QPixmap(), false); | ||
1324 | } else if (urlList.count() == 1) { | 1322 | } else if (urlList.count() == 1) { | ||
1325 | const QPixmap mimeTypeIcon = KIconLoader::global()->loadMimeTypeIcon(KIO::iconNameForUrl(urlList[0]), KIconLoader::Small); | 1323 | const QPixmap mimeTypeIcon = KIconLoader::global()->loadMimeTypeIcon(KIO::iconNameForUrl(urlList[0]), KIconLoader::Small); | ||
1326 | setDummyHistoryEntry(relativePathOrUrl(currUrl, urlList[0]), mimeTypeIcon); | 1324 | setDummyHistoryEntry(relativePathOrUrl(currUrl, urlList[0]), mimeTypeIcon); | ||
1327 | } else { | 1325 | } else { | ||
1328 | removeDummyHistoryEntry(); | 1326 | removeDummyHistoryEntry(); | ||
1329 | } | 1327 | } | ||
1330 | 1328 | | |||
1331 | // don't change selection when user has clicked on an item | 1329 | if (operationMode == KFileWidget::Saving) { | ||
elvisangelaccio: Same for this comment. | |||||
1332 | if (operationMode == KFileWidget::Saving && !locationEdit->isVisible()) { | | |||
1333 | setNonExtSelection(); | 1330 | setNonExtSelection(); | ||
1334 | } | 1331 | } | ||
1335 | } | 1332 | } | ||
1336 | 1333 | | |||
1337 | void KFileWidgetPrivate::updateLocationWhatsThis() | 1334 | void KFileWidgetPrivate::updateLocationWhatsThis() | ||
1338 | { | 1335 | { | ||
1339 | QString whatsThisText; | 1336 | QString whatsThisText; | ||
1340 | if (operationMode == KFileWidget::Saving) { | 1337 | if (operationMode == KFileWidget::Saving) { | ||
▲ Show 20 Lines • Show All 1393 Lines • ▼ Show 20 Line(s) | 2727 | { | |||
2734 | QString extension = db.suffixForFileName(filename); | 2731 | QString extension = db.suffixForFileName(filename); | ||
2735 | 2732 | | |||
2736 | if (!extension.isEmpty()) { | 2733 | if (!extension.isEmpty()) { | ||
2737 | locationEdit->lineEdit()->setSelection(0, filename.length() - extension.length() - 1); | 2734 | locationEdit->lineEdit()->setSelection(0, filename.length() - extension.length() - 1); | ||
2738 | } else { | 2735 | } else { | ||
2739 | int lastDot = filename.lastIndexOf('.'); | 2736 | int lastDot = filename.lastIndexOf('.'); | ||
2740 | if (lastDot > 0) { | 2737 | if (lastDot > 0) { | ||
2741 | locationEdit->lineEdit()->setSelection(0, lastDot); | 2738 | locationEdit->lineEdit()->setSelection(0, lastDot); | ||
2739 | } else { | ||||
2740 | locationEdit->lineEdit()->selectAll(); | ||||
2742 | } | 2741 | } | ||
2743 | } | 2742 | } | ||
2744 | } | 2743 | } | ||
2745 | 2744 | | |||
2746 | KToolBar *KFileWidget::toolBar() const | 2745 | KToolBar *KFileWidget::toolBar() const | ||
2747 | { | 2746 | { | ||
2748 | return d->toolbar; | 2747 | return d->toolbar; | ||
2749 | } | 2748 | } | ||
▲ Show 20 Lines • Show All 119 Lines • Show Last 20 Lines |
This comment makes little sense to me. Since it was part of the same commit spotted by @rkflx (0134fb3a5e50), I'd just remove it.