Changeset View
Changeset View
Standalone View
Standalone View
src/sycoca/ksycoca.cpp
Show First 20 Lines • Show All 409 Lines • ▼ Show 20 Line(s) | 406 | #endif | |||
---|---|---|---|---|---|
410 | timeStamp = 0; | 410 | timeStamp = 0; | ||
411 | } | 411 | } | ||
412 | 412 | | |||
413 | void KSycoca::addFactory(KSycocaFactory *factory) | 413 | void KSycoca::addFactory(KSycocaFactory *factory) | ||
414 | { | 414 | { | ||
415 | d->addFactory(factory); | 415 | d->addFactory(factory); | ||
416 | } | 416 | } | ||
417 | 417 | | |||
418 | #ifndef KSERVICE_NO_DEPRECATED | 418 | #if KSERVICE_BUILD_DEPRECATED_SINCE(5, 0) | ||
419 | bool KSycoca::isChanged(const char *type) | 419 | bool KSycoca::isChanged(const char *type) | ||
420 | { | 420 | { | ||
421 | return self()->d->changeList.contains(QString::fromLatin1(type)); | 421 | return self()->d->changeList.contains(QString::fromLatin1(type)); | ||
422 | } | 422 | } | ||
423 | #endif | 423 | #endif | ||
424 | 424 | | |||
425 | QDataStream *KSycoca::findEntry(int offset, KSycocaType &type) | 425 | QDataStream *KSycoca::findEntry(int offset, KSycocaType &type) | ||
426 | { | 426 | { | ||
▲ Show 20 Lines • Show All 223 Lines • ▼ Show 20 Line(s) | 638 | { | |||
650 | } | 650 | } | ||
651 | if (!checkVersion()) { | 651 | if (!checkVersion()) { | ||
652 | qCDebug(SYCOCA) << "Still outdated..."; | 652 | qCDebug(SYCOCA) << "Still outdated..."; | ||
653 | return false; // Still outdated - uh oh | 653 | return false; // Still outdated - uh oh | ||
654 | } | 654 | } | ||
655 | return true; | 655 | return true; | ||
656 | } | 656 | } | ||
657 | 657 | | |||
658 | #if KSERVICE_BUILD_DEPRECATED_SINCE(5, 15) | ||||
658 | quint32 KSycoca::timeStamp() | 659 | quint32 KSycoca::timeStamp() | ||
659 | { | 660 | { | ||
660 | if (!d->timeStamp) { | 661 | if (!d->timeStamp) { | ||
661 | (void) d->readSycocaHeader(); | 662 | (void) d->readSycocaHeader(); | ||
662 | } | 663 | } | ||
663 | return d->timeStamp / 1000; // from ms to s | 664 | return d->timeStamp / 1000; // from ms to s | ||
664 | } | 665 | } | ||
666 | #endif | ||||
665 | 667 | | |||
668 | #if KSERVICE_BUILD_DEPRECATED_SINCE(5, 15) | ||||
666 | quint32 KSycoca::updateSignature() | 669 | quint32 KSycoca::updateSignature() | ||
667 | { | 670 | { | ||
668 | if (!d->timeStamp) { | 671 | if (!d->timeStamp) { | ||
669 | (void) d->readSycocaHeader(); | 672 | (void) d->readSycocaHeader(); | ||
670 | } | 673 | } | ||
671 | return d->updateSig; | 674 | return d->updateSig; | ||
672 | } | 675 | } | ||
676 | #endif | ||||
673 | 677 | | |||
674 | QString KSycoca::absoluteFilePath(DatabaseType type) | 678 | QString KSycoca::absoluteFilePath(DatabaseType type) | ||
675 | { | 679 | { | ||
676 | Q_UNUSED(type); // GlobalDatabase concept removed in 5.61 | 680 | Q_UNUSED(type); // GlobalDatabase concept removed in 5.61 | ||
677 | const QStringList paths = QStandardPaths::standardLocations(QStandardPaths::GenericDataLocation); | 681 | const QStringList paths = QStandardPaths::standardLocations(QStandardPaths::GenericDataLocation); | ||
678 | QString suffix = QLatin1Char('_') + QLocale().bcp47Name(); | 682 | QString suffix = QLatin1Char('_') + QLocale().bcp47Name(); | ||
679 | 683 | | |||
680 | const QByteArray ksycoca_env = qgetenv("KDESYCOCA"); | 684 | const QByteArray ksycoca_env = qgetenv("KDESYCOCA"); | ||
681 | if (ksycoca_env.isEmpty()) { | 685 | if (ksycoca_env.isEmpty()) { | ||
682 | const QByteArray pathHash = QCryptographicHash::hash(paths.join(QLatin1Char(':')).toUtf8(), QCryptographicHash::Sha1); | 686 | const QByteArray pathHash = QCryptographicHash::hash(paths.join(QLatin1Char(':')).toUtf8(), QCryptographicHash::Sha1); | ||
683 | suffix += QLatin1Char('_') + QString::fromLatin1(pathHash.toBase64()); | 687 | suffix += QLatin1Char('_') + QString::fromLatin1(pathHash.toBase64()); | ||
684 | suffix.replace(QLatin1Char('/'), QLatin1Char('_')); | 688 | suffix.replace(QLatin1Char('/'), QLatin1Char('_')); | ||
685 | #ifdef Q_OS_WIN | 689 | #ifdef Q_OS_WIN | ||
686 | suffix.replace(QLatin1Char(':'), QLatin1Char('_')); | 690 | suffix.replace(QLatin1Char(':'), QLatin1Char('_')); | ||
687 | #endif | 691 | #endif | ||
688 | const QString fileName = QLatin1String("ksycoca5") + suffix; | 692 | const QString fileName = QLatin1String("ksycoca5") + suffix; | ||
689 | return QStandardPaths::writableLocation(QStandardPaths::GenericCacheLocation) + QLatin1Char('/') + fileName; | 693 | return QStandardPaths::writableLocation(QStandardPaths::GenericCacheLocation) + QLatin1Char('/') + fileName; | ||
690 | } else { | 694 | } else { | ||
691 | return QFile::decodeName(ksycoca_env); | 695 | return QFile::decodeName(ksycoca_env); | ||
692 | } | 696 | } | ||
693 | } | 697 | } | ||
694 | 698 | | |||
699 | #if KSERVICE_BUILD_DEPRECATED_SINCE(5, 15) | ||||
695 | QString KSycoca::language() | 700 | QString KSycoca::language() | ||
696 | { | 701 | { | ||
697 | if (d->language.isEmpty()) { | 702 | if (d->language.isEmpty()) { | ||
698 | (void) d->readSycocaHeader(); | 703 | (void) d->readSycocaHeader(); | ||
699 | } | 704 | } | ||
700 | return d->language; | 705 | return d->language; | ||
701 | } | 706 | } | ||
707 | #endif | ||||
702 | 708 | | |||
703 | QStringList KSycoca::allResourceDirs() | 709 | QStringList KSycoca::allResourceDirs() | ||
704 | { | 710 | { | ||
705 | if (!d->timeStamp) { | 711 | if (!d->timeStamp) { | ||
706 | (void) d->readSycocaHeader(); | 712 | (void) d->readSycocaHeader(); | ||
707 | } | 713 | } | ||
708 | return d->allResourceDirs.keys(); | 714 | return d->allResourceDirs.keys(); | ||
709 | } | 715 | } | ||
Show All 13 Lines | 718 | { | |||
723 | } | 729 | } | ||
724 | } | 730 | } | ||
725 | 731 | | |||
726 | bool KSycoca::isBuilding() | 732 | bool KSycoca::isBuilding() | ||
727 | { | 733 | { | ||
728 | return false; | 734 | return false; | ||
729 | } | 735 | } | ||
730 | 736 | | |||
737 | #if KSERVICE_BUILD_DEPRECATED_SINCE(5, 15) | ||||
731 | void KSycoca::disableAutoRebuild() | 738 | void KSycoca::disableAutoRebuild() | ||
732 | { | 739 | { | ||
733 | qCWarning(SYCOCA) << "KSycoca::disableAutoRebuild() is internal, do not call it."; | 740 | qCWarning(SYCOCA) << "KSycoca::disableAutoRebuild() is internal, do not call it."; | ||
734 | } | 741 | } | ||
742 | #endif | ||||
735 | 743 | | |||
736 | QDataStream *&KSycoca::stream() | 744 | QDataStream *&KSycoca::stream() | ||
737 | { | 745 | { | ||
738 | return d->stream(); | 746 | return d->stream(); | ||
739 | } | 747 | } | ||
740 | 748 | | |||
741 | void KSycoca::connectNotify(const QMetaMethod &signal) | 749 | void KSycoca::connectNotify(const QMetaMethod &signal) | ||
742 | { | 750 | { | ||
▲ Show 20 Lines • Show All 49 Lines • Show Last 20 Lines |