kdecore: drop internal helper protocol info

the check refers to services only, there are no helper protocols now

Signed-off-by: Ivailo Monev <xakepa10@gmail.com>
This commit is contained in:
Ivailo Monev 2024-03-21 06:02:30 +02:00
parent b9deac7325
commit 5498e78c34
5 changed files with 35 additions and 55 deletions

View file

@ -310,7 +310,7 @@ void KServicePrivate::load(QDataStream& s)
qint8 def, term;
qint8 initpref;
// NOTE: make sure to update the version number in ksycoca.cpp
// NOTE: make sure to update the version number in ksycoca_p.h
s >> m_strType >> m_strName >> m_strExec >> m_strIcon
>> term >> m_strTerminalOptions
>> m_strPath >> m_strComment >> def >> m_mapProps
@ -333,7 +333,7 @@ void KServicePrivate::save(QDataStream& s)
qint8 def = m_bAllowAsDefault, initpref = m_initialPreference;
qint8 term = m_bTerminal;
// NOTE: make sure to update the version number in ksycoca.cpp
// NOTE: make sure to update the version number in ksycoca_p.h
s << m_strType << m_strName << m_strExec << m_strIcon
<< term << m_strTerminalOptions
<< m_strPath << m_strComment << def << m_mapProps

View file

@ -110,10 +110,10 @@ KServiceTypePrivate::load( QDataStream& _str )
void
KServiceTypePrivate::save( QDataStream& _str )
{
KSycocaEntryPrivate::save( _str );
// NOTE: make sure to update the version number in ksycoca.cpp
_str << m_strName << m_strComment << m_mapProps << m_mapPropDefs
<< m_serviceOffersOffset;
KSycocaEntryPrivate::save( _str );
// NOTE: make sure to update the version number in ksycoca_p.h
_str << m_strName << m_strComment << m_mapProps << m_mapPropDefs
<< m_serviceOffersOffset;
}
KServiceType::~KServiceType()

View file

@ -41,7 +41,6 @@ KProtocolInfo::KProtocolInfo(const QString &path)
m_name = config.readEntry("protocol");
m_exec = config.readPathEntry("exec", QString());
m_isSourceProtocol = config.readEntry("source", true);
m_isHelperProtocol = config.readEntry("helper", false);
m_supportsListing = config.readEntry("listing", false);
m_supportsReading = config.readEntry("reading", false);
m_supportsWriting = config.readEntry("writing", false);
@ -90,25 +89,24 @@ KProtocolInfo::~KProtocolInfo()
void KProtocolInfo::load(QDataStream &str)
{
Q_D(KProtocolInfo);
// NOTE: make sure to update the version number in ksycoca.cpp
qint8 i_isSourceProtocol, i_isHelperProtocol,
i_supportsListing, i_supportsReading,
i_supportsWriting, i_supportsMakeDir,
i_supportsDeleting, i_supportsLinking,
i_supportsMoving, i_determineMimetypeFromExtension,
i_canCopyFromFile, i_canCopyToFile, i_showPreviews,
// NOTE: make sure to update the version number in ksycoca_p.h
qint8 i_isSourceProtocol, i_supportsListing,
i_supportsReading, i_supportsWriting,
i_supportsMakeDir, i_supportsDeleting,
i_supportsLinking, i_supportsMoving,
i_determineMimetypeFromExtension, i_canCopyFromFile,
i_canCopyToFile, i_showPreviews,
i_canRenameFromFile, i_canRenameToFile,
i_canDeleteRecursive, i_fileNameUsedForCopying;
str >> m_name >> m_exec >> m_defaultMimetype
>> i_determineMimetypeFromExtension
>> m_icon
>> i_isSourceProtocol >> i_isHelperProtocol
>> i_supportsListing >> i_supportsReading
>> i_supportsWriting >> i_supportsMakeDir
>> i_supportsDeleting >> i_supportsLinking
>> i_supportsMoving >> i_canCopyFromFile
>> i_canCopyToFile
>> i_isSourceProtocol >> i_supportsListing
>> i_supportsReading >> i_supportsWriting
>> i_supportsMakeDir >> i_supportsDeleting
>> i_supportsLinking >> i_supportsMoving
>> i_canCopyFromFile >> i_canCopyToFile
>> m_config >> m_maxSlaves >> d->docPath >> d->protClass
>> i_showPreviews
>> d->proxyProtocol
@ -117,7 +115,6 @@ void KProtocolInfo::load(QDataStream &str)
>> d->maxSlavesPerHost;
m_isSourceProtocol = (i_isSourceProtocol != 0);
m_isHelperProtocol = (i_isHelperProtocol != 0);
m_supportsListing = (i_supportsListing != 0);
m_supportsReading = (i_supportsReading != 0);
m_supportsWriting = (i_supportsWriting != 0);
@ -140,18 +137,17 @@ KProtocolInfoPrivate::save(QDataStream &str)
{
KSycocaEntryPrivate::save(str);
// NOTE: make sure to update the version number in ksycoca.cpp
qint8 i_isSourceProtocol, i_isHelperProtocol,
i_supportsListing, i_supportsReading,
i_supportsWriting, i_supportsMakeDir,
i_supportsDeleting, i_supportsLinking,
i_supportsMoving, i_determineMimetypeFromExtension,
i_canCopyFromFile, i_canCopyToFile, i_showPreviews,
// NOTE: make sure to update the version number in ksycoca_p.h
qint8 i_isSourceProtocol, i_supportsListing,
i_supportsReading, i_supportsWriting,
i_supportsMakeDir, i_supportsDeleting,
i_supportsLinking, i_supportsMoving,
i_determineMimetypeFromExtension, i_canCopyFromFile,
i_canCopyToFile, i_showPreviews,
i_canRenameFromFile, i_canRenameToFile,
i_canDeleteRecursive, i_fileNameUsedForCopying;
i_isSourceProtocol = q->m_isSourceProtocol ? 1 : 0;
i_isHelperProtocol = q->m_isHelperProtocol ? 1 : 0;
i_supportsListing = q->m_supportsListing ? 1 : 0;
i_supportsReading = q->m_supportsReading ? 1 : 0;
i_supportsWriting = q->m_supportsWriting ? 1 : 0;
@ -171,12 +167,11 @@ KProtocolInfoPrivate::save(QDataStream &str)
str << q->m_name << q->m_exec << q->m_defaultMimetype
<< i_determineMimetypeFromExtension
<< q->m_icon
<< i_isSourceProtocol << i_isHelperProtocol
<< i_supportsListing << i_supportsReading
<< i_supportsWriting << i_supportsMakeDir
<< i_supportsDeleting << i_supportsLinking
<< i_supportsMoving << i_canCopyFromFile
<< i_canCopyToFile
<< i_isSourceProtocol << i_supportsListing
<< i_supportsReading << i_supportsWriting
<< i_supportsMakeDir << i_supportsDeleting
<< i_supportsLinking << i_supportsMoving
<< i_canCopyFromFile << i_canCopyToFile
<< q->m_config << q->m_maxSlaves << docPath << protClass
<< i_showPreviews
<< proxyProtocol
@ -206,18 +201,12 @@ void KProtocolInfo::selectServiceOrHelper(const QString &protocol, KProtocolInfo
// to a webbrowser, but mimetype-determination-in-calling-application by default is done here
const KProtocolInfo::Ptr prot = KProtocolInfoFactory::self()->findProtocol(protocol);
const KService::Ptr service = KMimeTypeTrader::self()->preferredService(QString::fromLatin1("x-scheme-handler/") + protocol);
if (service && prot && prot->m_isHelperProtocol) {
// for helper protocols, the handler app has priority over the hardcoded one (see A above)
returnService = service;
return;
}
if (prot) {
returnProtocol = prot;
} else {
// no protocol file, use handler app if any
returnService = service;
return;
}
// no protocol file, use handler app if any
returnService = KMimeTypeTrader::self()->preferredService(QString::fromLatin1("x-scheme-handler/") + protocol);
}
QString KProtocolInfo::icon(const QString &protocol)
@ -360,11 +349,6 @@ bool KProtocolInfo::isHelperProtocol(const KUrl &url)
bool KProtocolInfo::isHelperProtocol(const QString &protocol)
{
// call the findProtocol directly (not via KProtocolManager) to bypass any proxy settings.
KProtocolInfo::Ptr prot = KProtocolInfoFactory::self()->findProtocol(protocol);
if (prot) {
return prot->m_isHelperProtocol;
}
const KService::Ptr service = KMimeTypeTrader::self()->preferredService(QString::fromLatin1("x-scheme-handler/") + protocol);
return !service.isNull();
}

View file

@ -95,11 +95,8 @@ public:
* A helper protocol invokes an external application and does not return
* a file or stream.
*
* This corresponds to the "helper=" field in the protocol description file.
* Valid values for this field are "true" or "false" (default).
*
* @param url the url to check
* @return true if the protocol is a helper protocol (e.g. vnc), false
* @return true if the protocol is a helper protocol (e.g. mailto), false
* if not (e.g. http)
*/
static bool isHelperProtocol(const KUrl &url);
@ -243,7 +240,6 @@ protected:
QString m_name;
QString m_exec;
bool m_isSourceProtocol;
bool m_isHelperProtocol;
bool m_supportsListing;
bool m_supportsReading;
bool m_supportsWriting;

View file

@ -31,7 +31,7 @@
* If the existing file is outdated, it will not get read
* but instead we'll ask kded to regenerate a new one...
*/
#define KSYCOCA_VERSION 245
#define KSYCOCA_VERSION 246
/**
* Sycoca file name, used internally (by kbuildsycoca)