mirror of
https://bitbucket.org/smil3y/kdelibs.git
synced 2025-02-23 10:22:48 +00:00
generic: misc cleanups
This commit is contained in:
parent
b451b9602e
commit
361cc4b219
5 changed files with 35 additions and 48 deletions
|
@ -27,7 +27,6 @@
|
|||
#include <kstandarddirs.h>
|
||||
#include <kdebug.h>
|
||||
#include <klocale.h>
|
||||
#include <assert.h>
|
||||
#include <QtCore/QHash>
|
||||
|
||||
KBuildMimeTypeFactory::KBuildMimeTypeFactory() :
|
||||
|
@ -52,7 +51,7 @@ KBuildMimeTypeFactory::~KBuildMimeTypeFactory()
|
|||
|
||||
KMimeTypeFactory::MimeTypeEntry::Ptr KBuildMimeTypeFactory::findMimeTypeEntryByName(const QString &_name, KMimeType::FindByNameOption options)
|
||||
{
|
||||
assert (KSycoca::self()->isBuilding());
|
||||
Q_ASSERT (KSycoca::self()->isBuilding());
|
||||
|
||||
QString name = _name;
|
||||
if (options & KMimeType::ResolveAliases) {
|
||||
|
@ -66,7 +65,7 @@ KMimeTypeFactory::MimeTypeEntry::Ptr KBuildMimeTypeFactory::findMimeTypeEntryByN
|
|||
|
||||
KSycocaEntry::List KBuildMimeTypeFactory::allEntries() const
|
||||
{
|
||||
assert (KSycoca::self()->isBuilding());
|
||||
Q_ASSERT (KSycoca::self()->isBuilding());
|
||||
KSycocaEntry::List lst;
|
||||
KSycocaEntryDict::Iterator itmime = m_entryDict->begin();
|
||||
const KSycocaEntryDict::Iterator endmime = m_entryDict->end();
|
||||
|
|
|
@ -109,7 +109,9 @@ KBuildServiceTypeFactory::saveHeader(QDataStream &str)
|
|||
{
|
||||
KSycocaFactory::saveHeader(str);
|
||||
str << (qint32) m_propertyTypeDict.count();
|
||||
for (QMap<QString, int>::ConstIterator it = m_propertyTypeDict.constBegin(); it != m_propertyTypeDict.constEnd(); ++it) {
|
||||
QMapIterator<QString, int> it(m_propertyTypeDict);
|
||||
while(it.hasNext()) {
|
||||
it.next();
|
||||
str << it.key() << (qint32)it.value();
|
||||
}
|
||||
}
|
||||
|
@ -136,9 +138,9 @@ KBuildServiceTypeFactory::addEntry(const KSycocaEntry::Ptr& newEntry)
|
|||
|
||||
KServiceType::Ptr serviceType = KServiceType::Ptr::staticCast( newEntry );
|
||||
|
||||
const QMap<QString,QVariant::Type>& pd = serviceType->propertyDefs();
|
||||
QMap<QString,QVariant::Type>::ConstIterator pit = pd.begin();
|
||||
for( ; pit != pd.end(); ++pit ) {
|
||||
QMapIterator<QString, QVariant::Type> pit(serviceType->propertyDefs());
|
||||
while(pit.hasNext()) {
|
||||
pit.next();
|
||||
const QString property = pit.key();
|
||||
QMap<QString, int>::iterator dictit = m_propertyTypeDict.find(property);
|
||||
if (dictit == m_propertyTypeDict.end())
|
||||
|
|
|
@ -230,12 +230,10 @@ bool KBuildSycoca::build()
|
|||
g_ctimeInfo = new KCTimeInfo(); // This is a build factory too, don't delete!!
|
||||
bool uptodate = true;
|
||||
// For all resources
|
||||
for( QStringList::ConstIterator it1 = allResources.constBegin();
|
||||
it1 != allResources.constEnd();
|
||||
++it1 )
|
||||
foreach(const QString it1, allResources)
|
||||
{
|
||||
g_changed = false;
|
||||
g_resource = (*it1).toLatin1();
|
||||
g_resource = it1.toLatin1();
|
||||
|
||||
QStringList relFiles;
|
||||
|
||||
|
@ -266,16 +264,14 @@ bool KBuildSycoca::build()
|
|||
++it2 )
|
||||
{
|
||||
KSycocaResource res = (*it2);
|
||||
if (res.resource != (*it1)) continue;
|
||||
if (res.resource != it1) continue;
|
||||
|
||||
// For each file in the resource
|
||||
for( QStringList::ConstIterator it3 = relFiles.constBegin();
|
||||
it3 != relFiles.constEnd();
|
||||
++it3 )
|
||||
foreach(const QString it3, relFiles)
|
||||
{
|
||||
// Check if file matches filter
|
||||
if ((*it3).endsWith(res.extension))
|
||||
createEntry(*it3, true);
|
||||
if (it3.endsWith(res.extension))
|
||||
createEntry(it3, true);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -580,11 +576,9 @@ bool KBuildSycoca::checkTimestamps( quint32 timestamp, const QStringList &dirs )
|
|||
kDebug( 7021 ) << "checking file timestamps";
|
||||
QDateTime stamp;
|
||||
stamp.setTime_t( timestamp );
|
||||
for( QStringList::ConstIterator it = dirs.begin();
|
||||
it != dirs.end();
|
||||
++it )
|
||||
foreach(const QString it, dirs)
|
||||
{
|
||||
if( !checkDirTimestamps( *it, stamp, true ))
|
||||
if( !checkDirTimestamps( it, stamp, true ))
|
||||
return false;
|
||||
}
|
||||
kDebug( 7021 ) << "timestamps check ok";
|
||||
|
|
|
@ -51,23 +51,21 @@ void KCTimeDict::dump() const
|
|||
|
||||
QStringList KCTimeDict::resourceList() const
|
||||
{
|
||||
QSet<QString> resources;
|
||||
Hash::const_iterator it = m_hash.constBegin();
|
||||
const Hash::const_iterator end = m_hash.constEnd();
|
||||
for ( ; it != end; ++it ) {
|
||||
QStringList resources;
|
||||
QHashIterator<QString,quint32> it(m_hash);
|
||||
while (it.hasNext()) {
|
||||
it.next();
|
||||
const QString key = it.key();
|
||||
const QString res = key.left(key.indexOf('|'));
|
||||
resources.insert(res);
|
||||
resources << key.left(key.indexOf('|'));
|
||||
}
|
||||
return resources.toList();
|
||||
return resources;
|
||||
}
|
||||
|
||||
void KCTimeDict::load(QDataStream &str)
|
||||
{
|
||||
QString key;
|
||||
quint32 ctime;
|
||||
while(true)
|
||||
{
|
||||
while (true) {
|
||||
KSycocaEntry::read(str, key);
|
||||
str >> ctime;
|
||||
if (key.isEmpty()) break;
|
||||
|
@ -77,9 +75,9 @@ void KCTimeDict::load(QDataStream &str)
|
|||
|
||||
void KCTimeDict::save(QDataStream &str) const
|
||||
{
|
||||
Hash::const_iterator it = m_hash.constBegin();
|
||||
const Hash::const_iterator end = m_hash.constEnd();
|
||||
for ( ; it != end; ++it ) {
|
||||
QHashIterator<QString,quint32> it(m_hash);
|
||||
while (it.hasNext()) {
|
||||
it.next();
|
||||
str << it.key() << it.value();
|
||||
}
|
||||
str << QString() << (quint32) 0;
|
||||
|
|
|
@ -72,12 +72,6 @@ static bool bCheckSycoca;
|
|||
static bool bCheckUpdates;
|
||||
static bool bCheckHostname;
|
||||
|
||||
#ifdef Q_DBUS_EXPORT
|
||||
extern Q_DBUS_EXPORT void qDBusAddSpyHook(void (*)(const QDBusMessage&));
|
||||
#else
|
||||
extern QDBUS_EXPORT void qDBusAddSpyHook(void (*)(const QDBusMessage&));
|
||||
#endif
|
||||
|
||||
static void runBuildSycoca(QObject *callBackObj=0, const char *callBackSlot=0, const char *callBackErrorSlot=0)
|
||||
{
|
||||
const QString exe = KStandardDirs::findExe(KBUILDSYCOCA_EXENAME);
|
||||
|
@ -128,7 +122,7 @@ Kded::Kded()
|
|||
session.registerObject("/kbuildsycoca", this);
|
||||
session.registerObject("/kded", this);
|
||||
|
||||
qDBusAddSpyHook(messageFilter);
|
||||
Q_DBUS_EXPORT(messageFilter);
|
||||
|
||||
m_pTimer = new QTimer(this);
|
||||
m_pTimer->setSingleShot( true );
|
||||
|
|
Loading…
Add table
Reference in a new issue