Changeset View
Changeset View
Standalone View
Standalone View
src/core/kfileitem.cpp
Show First 20 Lines • Show All 523 Lines • ▼ Show 20 Line(s) | |||||
524 | } | 524 | } | ||
525 | 525 | | |||
526 | KFileItem::KFileItem(const KIO::UDSEntry &entry, const QUrl &itemOrDirUrl, | 526 | KFileItem::KFileItem(const KIO::UDSEntry &entry, const QUrl &itemOrDirUrl, | ||
527 | bool delayedMimeTypes, bool urlIsDirectory) | 527 | bool delayedMimeTypes, bool urlIsDirectory) | ||
528 | : d(new KFileItemPrivate(entry, KFileItem::Unknown, KFileItem::Unknown, itemOrDirUrl, urlIsDirectory, delayedMimeTypes, KFileItem::NormalMimeTypeDetermination)) | 528 | : d(new KFileItemPrivate(entry, KFileItem::Unknown, KFileItem::Unknown, itemOrDirUrl, urlIsDirectory, delayedMimeTypes, KFileItem::NormalMimeTypeDetermination)) | ||
529 | { | 529 | { | ||
530 | } | 530 | } | ||
531 | 531 | | |||
532 | #if KIOCORE_BUILD_DEPRECATED_SINCE(5, 0) | ||||
532 | KFileItem::KFileItem(mode_t mode, mode_t permissions, const QUrl &url, bool delayedMimeTypes) | 533 | KFileItem::KFileItem(mode_t mode, mode_t permissions, const QUrl &url, bool delayedMimeTypes) | ||
533 | : d(new KFileItemPrivate(KIO::UDSEntry(), mode, permissions, | 534 | : d(new KFileItemPrivate(KIO::UDSEntry(), mode, permissions, | ||
534 | url, false, delayedMimeTypes, KFileItem::NormalMimeTypeDetermination)) | 535 | url, false, delayedMimeTypes, KFileItem::NormalMimeTypeDetermination)) | ||
535 | { | 536 | { | ||
536 | } | 537 | } | ||
538 | #endif | ||||
537 | 539 | | |||
538 | KFileItem::KFileItem(const QUrl &url, const QString &mimeType, mode_t mode) | 540 | KFileItem::KFileItem(const QUrl &url, const QString &mimeType, mode_t mode) | ||
539 | : d(new KFileItemPrivate(KIO::UDSEntry(), mode, KFileItem::Unknown, | 541 | : d(new KFileItemPrivate(KIO::UDSEntry(), mode, KFileItem::Unknown, | ||
540 | url, false, false, KFileItem::NormalMimeTypeDetermination)) | 542 | url, false, false, KFileItem::NormalMimeTypeDetermination)) | ||
541 | { | 543 | { | ||
542 | d->m_bMimeTypeKnown = !mimeType.isEmpty(); | 544 | d->m_bMimeTypeKnown = !mimeType.isEmpty(); | ||
543 | if (d->m_bMimeTypeKnown) { | 545 | if (d->m_bMimeTypeKnown) { | ||
544 | QMimeDatabase db; | 546 | QMimeDatabase db; | ||
▲ Show 20 Lines • Show All 714 Lines • ▼ Show 20 Line(s) | |||||
1259 | { | 1261 | { | ||
1260 | if (!d) { | 1262 | if (!d) { | ||
1261 | return false; | 1263 | return false; | ||
1262 | } | 1264 | } | ||
1263 | 1265 | | |||
1264 | return !isDir(); | 1266 | return !isDir(); | ||
1265 | } | 1267 | } | ||
1266 | 1268 | | |||
1269 | #if KIOCORE_BUILD_DEPRECATED_SINCE(4, 0) | ||||
1267 | bool KFileItem::acceptsDrops() const | 1270 | bool KFileItem::acceptsDrops() const | ||
1268 | { | 1271 | { | ||
1269 | // A directory ? | 1272 | // A directory ? | ||
1270 | if (isDir()) { | 1273 | if (isDir()) { | ||
1271 | return isWritable(); | 1274 | return isWritable(); | ||
1272 | } | 1275 | } | ||
1273 | 1276 | | |||
1274 | // But only local .desktop files and executables | 1277 | // But only local .desktop files and executables | ||
1275 | if (!d->m_bIsLocalUrl) { | 1278 | if (!d->m_bIsLocalUrl) { | ||
1276 | return false; | 1279 | return false; | ||
1277 | } | 1280 | } | ||
1278 | 1281 | | |||
1279 | if (mimetype() == QLatin1String("application/x-desktop")) { | 1282 | if (mimetype() == QLatin1String("application/x-desktop")) { | ||
1280 | return true; | 1283 | return true; | ||
1281 | } | 1284 | } | ||
1282 | 1285 | | |||
1283 | // Executable, shell script ... ? | 1286 | // Executable, shell script ... ? | ||
1284 | if (QFileInfo(d->m_url.toLocalFile()).isExecutable()) { | 1287 | if (QFileInfo(d->m_url.toLocalFile()).isExecutable()) { | ||
1285 | return true; | 1288 | return true; | ||
1286 | } | 1289 | } | ||
1287 | 1290 | | |||
1288 | return false; | 1291 | return false; | ||
1289 | } | 1292 | } | ||
1293 | #endif | ||||
1290 | 1294 | | |||
1291 | QString KFileItem::getStatusBarInfo() const | 1295 | QString KFileItem::getStatusBarInfo() const | ||
1292 | { | 1296 | { | ||
1293 | if (!d) { | 1297 | if (!d) { | ||
1294 | return QString(); | 1298 | return QString(); | ||
1295 | } | 1299 | } | ||
1296 | 1300 | | |||
1297 | QString text = d->m_strText; | 1301 | QString text = d->m_strText; | ||
▲ Show 20 Lines • Show All 91 Lines • ▼ Show 20 Line(s) | |||||
1389 | { | 1393 | { | ||
1390 | if (!d) { | 1394 | if (!d) { | ||
1391 | return QString(); | 1395 | return QString(); | ||
1392 | } | 1396 | } | ||
1393 | 1397 | | |||
1394 | return d->time(which).toString(); | 1398 | return d->time(which).toString(); | ||
1395 | } | 1399 | } | ||
1396 | 1400 | | |||
1401 | #if KIOCORE_BUILD_DEPRECATED_SINCE(4, 0) | ||||
1397 | QString KFileItem::timeString(unsigned int which) const | 1402 | QString KFileItem::timeString(unsigned int which) const | ||
1398 | { | 1403 | { | ||
1399 | if (!d) { | 1404 | if (!d) { | ||
1400 | return QString(); | 1405 | return QString(); | ||
1401 | } | 1406 | } | ||
1402 | 1407 | | |||
1403 | switch (which) { | 1408 | switch (which) { | ||
1404 | case KIO::UDSEntry::UDS_ACCESS_TIME: | 1409 | case KIO::UDSEntry::UDS_ACCESS_TIME: | ||
1405 | return timeString(AccessTime); | 1410 | return timeString(AccessTime); | ||
1406 | case KIO::UDSEntry::UDS_CREATION_TIME: | 1411 | case KIO::UDSEntry::UDS_CREATION_TIME: | ||
1407 | return timeString(CreationTime); | 1412 | return timeString(CreationTime); | ||
1408 | case KIO::UDSEntry::UDS_MODIFICATION_TIME: | 1413 | case KIO::UDSEntry::UDS_MODIFICATION_TIME: | ||
1409 | default: | 1414 | default: | ||
1410 | return timeString(ModificationTime); | 1415 | return timeString(ModificationTime); | ||
1411 | } | 1416 | } | ||
1412 | } | 1417 | } | ||
1418 | #endif | ||||
1413 | 1419 | | |||
1420 | #if KIOCORE_BUILD_DEPRECATED_SINCE(4, 0) | ||||
1414 | void KFileItem::assign(const KFileItem &item) | 1421 | void KFileItem::assign(const KFileItem &item) | ||
1415 | { | 1422 | { | ||
1416 | *this = item; | 1423 | *this = item; | ||
1417 | } | 1424 | } | ||
1425 | #endif | ||||
1418 | 1426 | | |||
1419 | QUrl KFileItem::mostLocalUrl(bool *local) const | 1427 | QUrl KFileItem::mostLocalUrl(bool *local) const | ||
1420 | { | 1428 | { | ||
1421 | if (!d) { | 1429 | if (!d) { | ||
1422 | return QUrl(); | 1430 | return QUrl(); | ||
1423 | } | 1431 | } | ||
1424 | 1432 | | |||
1425 | const QString local_path = localPath(); | 1433 | const QString local_path = localPath(); | ||
▲ Show 20 Lines • Show All 291 Lines • Show Last 20 Lines |