• Skip to content
  • Skip to link menu
KDE API Reference
  • KDE API Reference
  • kdelibs API Reference
  • KDE Home
  • Contact Us
 

KDECore

  • sources
  • kde-4.14
  • kdelibs
  • kdecore
  • sycoca
ksycoca.cpp
Go to the documentation of this file.
1 /* This file is part of the KDE libraries
2  * Copyright (C) 1999-2000 Waldo Bastian <bastian@kde.org>
3  * Copyright (C) 2005-2009 David Faure <faure@kde.org>
4  * Copyright (C) 2008 Hamish Rodda <rodda@kde.org>
5  *
6  * This library is free software; you can redistribute it and/or
7  * modify it under the terms of the GNU Library General Public
8  * License version 2 as published by the Free Software Foundation;
9  *
10  * This library is distributed in the hope that it will be useful,
11  * but WITHOUT ANY WARRANTY; without even the implied warranty of
12  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
13  * Library General Public License for more details.
14  *
15  * You should have received a copy of the GNU Library General Public License
16  * along with this library; see the file COPYING.LIB. If not, write to
17  * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
18  * Boston, MA 02110-1301, USA.
19  **/
20 
21 #include "ksycoca.h"
22 #include "ksycoca_p.h"
23 #include "ksycocatype.h"
24 #include "ksycocafactory.h"
25 #include "ktoolinvocation.h"
26 #include "kglobal.h"
27 #include "kmemfile.h"
28 #include "kde_file.h"
29 #include "kconfiggroup.h"
30 #include "ksharedconfig.h"
31 
32 #include "kdebug.h"
33 #include "kstandarddirs.h"
34 
35 #include <QtCore/QDataStream>
36 #include <QtCore/QCoreApplication>
37 #include <QtCore/QFile>
38 #include <QtCore/QBuffer>
39 #include <QProcess>
40 #include <QtDBus/QtDBus>
41 
42 #include <config.h>
43 
44 #include <stdlib.h>
45 #include <fcntl.h>
46 
47 #include "ksycocadevices_p.h"
48 
49 // TODO: remove mmap() from kdewin32 and use QFile::mmap() when needed
50 #ifdef Q_WS_WIN
51 #undef HAVE_MMAP
52 #endif
53 
58 #define KSYCOCA_VERSION 243
59 
63 #define KSYCOCA_FILENAME "ksycoca4"
64 
65 #if HAVE_MADVISE
66 #include <sys/mman.h> // This #include was checked when looking for posix_madvise
67 #endif
68 
69 #ifndef MAP_FAILED
70 #define MAP_FAILED ((void *) -1)
71 #endif
72 
73 static bool s_autoRebuild = true;
74 
75 // The following limitations are in place:
76 // Maximum length of a single string: 8192 bytes
77 // Maximum length of a string list: 1024 strings
78 // Maximum number of entries: 8192
79 //
80 // The purpose of these limitations is to limit the impact
81 // of database corruption.
82 
83 
84 Q_DECLARE_OPERATORS_FOR_FLAGS(KSycocaPrivate::BehaviorsIfNotFound)
85 
86 KSycocaPrivate::KSycocaPrivate()
87  : databaseStatus( DatabaseNotOpen ),
88  readError( false ),
89  timeStamp( 0 ),
90  m_databasePath(),
91  updateSig( 0 ),
92  sycoca_size(0),
93  sycoca_mmap(0),
94  m_mmapFile(0),
95  m_device(0)
96 {
97 #ifdef Q_OS_WIN
98  /*
99  on windows we use KMemFile (QSharedMemory) to avoid problems
100  with mmap (can't delete a mmap'd file)
101  */
102  m_sycocaStrategy = StrategyMemFile;
103 #else
104  m_sycocaStrategy = StrategyMmap;
105 #endif
106  KConfigGroup config(KGlobal::config(), "KSycoca");
107  setStrategyFromString(config.readEntry("strategy"));
108 }
109 
110 void KSycocaPrivate::setStrategyFromString(const QString& strategy) {
111  if (strategy == QLatin1String("mmap"))
112  m_sycocaStrategy = StrategyMmap;
113  else if (strategy == QLatin1String("file"))
114  m_sycocaStrategy = StrategyFile;
115  else if (strategy == QLatin1String("sharedmem"))
116  m_sycocaStrategy = StrategyMemFile;
117  else if (!strategy.isEmpty())
118  kWarning(7011) << "Unknown sycoca strategy:" << strategy;
119 }
120 
121 bool KSycocaPrivate::tryMmap()
122 {
123 #ifdef HAVE_MMAP
124  Q_ASSERT(!m_databasePath.isEmpty());
125  m_mmapFile = new QFile(m_databasePath);
126  const bool canRead = m_mmapFile->open(QIODevice::ReadOnly);
127  Q_ASSERT(canRead);
128  Q_UNUSED(canRead); // no compiler warning in release builds.
129  fcntl(m_mmapFile->handle(), F_SETFD, FD_CLOEXEC);
130  sycoca_size = m_mmapFile->size();
131  sycoca_mmap = (const char *) mmap(0, sycoca_size,
132  PROT_READ, MAP_SHARED,
133  m_mmapFile->handle(), 0);
134  /* POSIX mandates only MAP_FAILED, but we are paranoid so check for
135  null pointer too. */
136  if (sycoca_mmap == (const char*) MAP_FAILED || sycoca_mmap == 0) {
137  kDebug(7011) << "mmap failed. (length = " << sycoca_size << ")";
138  sycoca_mmap = 0;
139  return false;
140  } else {
141 #ifdef HAVE_MADVISE
142  (void) posix_madvise((void*)sycoca_mmap, sycoca_size, POSIX_MADV_WILLNEED);
143 #endif // HAVE_MADVISE
144  return true;
145  }
146 #endif // HAVE_MMAP
147  return false;
148 }
149 
150 int KSycoca::version()
151 {
152  return KSYCOCA_VERSION;
153 }
154 
155 class KSycocaSingleton
156 {
157 public:
158  KSycocaSingleton() { }
159  ~KSycocaSingleton() { }
160 
161  bool hasSycoca() const {
162  return m_threadSycocas.hasLocalData();
163  }
164  KSycoca* sycoca() {
165  if (!m_threadSycocas.hasLocalData())
166  m_threadSycocas.setLocalData(new KSycoca);
167  return m_threadSycocas.localData();
168  }
169  void setSycoca(KSycoca* s) {
170  m_threadSycocas.setLocalData(s);
171  }
172 
173 private:
174  QThreadStorage<KSycoca*> m_threadSycocas;
175 };
176 
177 K_GLOBAL_STATIC(KSycocaSingleton, ksycocaInstance)
178 
179 // Read-only constructor
180 KSycoca::KSycoca()
181  : d(new KSycocaPrivate)
182 {
183  QDBusConnection::sessionBus().connect(QString(), QString(),
184  QString::fromLatin1("org.kde.KSycoca"),
185  QString::fromLatin1("notifyDatabaseChanged"),
186  this, SLOT(notifyDatabaseChanged(QStringList)));
187 }
188 
189 bool KSycocaPrivate::openDatabase(bool openDummyIfNotFound)
190 {
191  Q_ASSERT(databaseStatus == DatabaseNotOpen);
192 
193  delete m_device; m_device = 0;
194  QString path = KSycoca::absoluteFilePath();
195 
196  bool canRead = KDE::access(path, R_OK) == 0;
197  kDebug(7011) << "Trying to open ksycoca from" << path;
198  if (!canRead) {
199  path = KSycoca::absoluteFilePath(KSycoca::GlobalDatabase);
200  if (!path.isEmpty()) {
201  kDebug(7011) << "Trying to open global ksycoca from " << path;
202  canRead = KDE::access(path, R_OK) == 0;
203  }
204  }
205 
206  bool result = true;
207  if (canRead) {
208  m_databasePath = path;
209  checkVersion();
210  } else { // No database file
211  kDebug(7011) << "Could not open ksycoca";
212  m_databasePath.clear();
213  databaseStatus = NoDatabase;
214  if (openDummyIfNotFound) {
215  // We open a dummy database instead.
216  //kDebug(7011) << "No database, opening a dummy one.";
217 
218  m_sycocaStrategy = StrategyDummyBuffer;
219  QDataStream* str = stream();
220  *str << qint32(KSYCOCA_VERSION);
221  *str << qint32(0);
222  } else {
223  result = false;
224  }
225  }
226  return result;
227 }
228 
229 KSycocaAbstractDevice* KSycocaPrivate::device()
230 {
231  if (m_device)
232  return m_device;
233 
234  Q_ASSERT(!m_databasePath.isEmpty());
235 
236  KSycocaAbstractDevice* device = m_device;
237  if (m_sycocaStrategy == StrategyDummyBuffer) {
238  device = new KSycocaBufferDevice;
239  device->device()->open(QIODevice::ReadOnly); // can't fail
240  } else {
241 #ifdef HAVE_MMAP
242  if (m_sycocaStrategy == StrategyMmap && tryMmap()) {
243  device = new KSycocaMmapDevice(sycoca_mmap,
244  sycoca_size);
245  if (!device->device()->open(QIODevice::ReadOnly)) {
246  delete device; device = 0;
247  }
248  }
249 #endif
250 #ifndef QT_NO_SHAREDMEMORY
251  if (!device && m_sycocaStrategy == StrategyMemFile) {
252  device = new KSycocaMemFileDevice(m_databasePath);
253  if (!device->device()->open(QIODevice::ReadOnly)) {
254  delete device; device = 0;
255  }
256  }
257 #endif
258  if (!device) {
259  device = new KSycocaFileDevice(m_databasePath);
260  if (!device->device()->open(QIODevice::ReadOnly)) {
261  kError(7011) << "Couldn't open" << m_databasePath << "even though it is readable? Impossible.";
262  //delete device; device = 0; // this would crash in the return statement...
263  }
264  }
265  }
266  if (device) {
267  m_device = device;
268  }
269  return m_device;
270 }
271 
272 QDataStream*& KSycocaPrivate::stream()
273 {
274  if (!m_device) {
275  if (databaseStatus == DatabaseNotOpen) {
276  checkDatabase(KSycocaPrivate::IfNotFoundRecreate | KSycocaPrivate::IfNotFoundOpenDummy);
277  }
278 
279  device(); // create m_device
280  }
281 
282  return m_device->stream();
283 }
284 
285 // Read-write constructor - only for KBuildSycoca
286 KSycoca::KSycoca( bool /* dummy */ )
287  : d(new KSycocaPrivate)
288 {
289  // This instance was not created by the singleton, but by a direct call to new!
290  ksycocaInstance->setSycoca(this);
291 }
292 
293 KSycoca * KSycoca::self()
294 {
295  KSycoca* s = ksycocaInstance->sycoca();
296  Q_ASSERT(s);
297  return s;
298 }
299 
300 KSycoca::~KSycoca()
301 {
302  d->closeDatabase();
303  delete d;
304  //if (ksycocaInstance.exists()
305  // && ksycocaInstance->self == this)
306  // ksycocaInstance->self = 0;
307 }
308 
309 bool KSycoca::isAvailable()
310 {
311  return self()->d->checkDatabase(KSycocaPrivate::IfNotFoundDoNothing/* don't open dummy db if not found */);
312 }
313 
314 void KSycocaPrivate::closeDatabase()
315 {
316  delete m_device;
317  m_device = 0;
318 
319  // It is very important to delete all factories here
320  // since they cache information about the database file
321  // But other threads might be using them, so this class is
322  // refcounted, and deleted when the last thread is done with them
323  qDeleteAll(m_factories);
324  m_factories.clear();
325 #ifdef HAVE_MMAP
326  if (sycoca_mmap) {
327  //QBuffer *buf = static_cast<QBuffer*>(device);
328  //buf->buffer().clear();
329  // Solaris has munmap(char*, size_t) and everything else should
330  // be happy with a char* for munmap(void*, size_t)
331  munmap(const_cast<char*>(sycoca_mmap), sycoca_size);
332  sycoca_mmap = 0;
333  }
334  delete m_mmapFile; m_mmapFile = 0;
335 #endif
336 
337  databaseStatus = DatabaseNotOpen;
338  timeStamp = 0;
339 }
340 
341 void KSycoca::addFactory( KSycocaFactory *factory )
342 {
343  d->addFactory(factory);
344 }
345 
346 #ifndef KDE_NO_DEPRECATED
347 bool KSycoca::isChanged(const char *type)
348 {
349  return self()->d->changeList.contains(QString::fromLatin1(type));
350 }
351 #endif
352 
353 void KSycoca::notifyDatabaseChanged(const QStringList &changeList)
354 {
355  d->changeList = changeList;
356  //kDebug(7011) << QThread::currentThread() << "got a notifyDatabaseChanged signal" << changeList;
357  // kbuildsycoca tells us the database file changed
358  // Close the database and forget all about what we knew
359  // The next call to any public method will recreate
360  // everything that's needed.
361  d->closeDatabase();
362 
363  // Now notify applications
364 #ifndef KDE_NO_DEPRECATED
365  emit databaseChanged();
366 #endif
367  emit databaseChanged(changeList);
368 }
369 
370 QDataStream * KSycoca::findEntry(int offset, KSycocaType &type)
371 {
372  QDataStream* str = stream();
373  Q_ASSERT(str);
374  //kDebug(7011) << QString("KSycoca::_findEntry(offset=%1)").arg(offset,8,16);
375  str->device()->seek(offset);
376  qint32 aType;
377  *str >> aType;
378  type = KSycocaType(aType);
379  //kDebug(7011) << QString("KSycoca::found type %1").arg(aType);
380  return str;
381 }
382 
383 KSycocaFactoryList* KSycoca::factories()
384 {
385  return d->factories();
386 }
387 
388 // Warning, checkVersion rewinds to the beginning of stream().
389 bool KSycocaPrivate::checkVersion()
390 {
391  QDataStream *m_str = device()->stream();
392  Q_ASSERT(m_str);
393  m_str->device()->seek(0);
394  qint32 aVersion;
395  *m_str >> aVersion;
396  if ( aVersion < KSYCOCA_VERSION ) {
397  kWarning(7011) << "Found version" << aVersion << ", expecting version" << KSYCOCA_VERSION << "or higher.";
398  databaseStatus = BadVersion;
399  return false;
400  } else {
401  databaseStatus = DatabaseOK;
402  return true;
403  }
404 }
405 
406 // If it returns true, we have a valid database and the stream has rewinded to the beginning
407 // and past the version number.
408 bool KSycocaPrivate::checkDatabase(BehaviorsIfNotFound ifNotFound)
409 {
410  if (databaseStatus == DatabaseOK) {
411  if (checkVersion()) // we know the version is ok, but we must rewind the stream anyway
412  return true;
413  }
414 
415  closeDatabase(); // close the dummy one
416 
417  // We can only use the installed ksycoca file if kdeinit+klauncher+kded are running,
418  // since kded is what keeps the file uptodate.
419  const bool kdeinitRunning = QDBusConnection::sessionBus().interface()->isServiceRegistered(QString::fromLatin1("org.kde.klauncher"));
420 
421  // Check if new database already available
422  if (kdeinitRunning && openDatabase(ifNotFound & IfNotFoundOpenDummy)) {
423  if (checkVersion()) {
424  // Database exists, and version is ok.
425  return true;
426  }
427  }
428 
429  if (ifNotFound & IfNotFoundRecreate) {
430  // Well, if kdeinit is not running we need to launch it,
431  // but otherwise we simply need to run kbuildsycoca to recreate the sycoca file.
432  if (!kdeinitRunning) {
433  kDebug(7011) << "We have no database.... launching kdeinit";
434  KToolInvocation::klauncher(); // this calls startKdeinit, and blocks until it returns
435  // and since kdeinit4 only returns after kbuildsycoca4 is done, we can proceed.
436  } else {
437  kDebug(7011) << QThread::currentThread() << "We have no database.... launching" << KBUILDSYCOCA_EXENAME;
438  if (QProcess::execute(KStandardDirs::findExe(QString::fromLatin1(KBUILDSYCOCA_EXENAME))) != 0)
439  qWarning("ERROR: Running KSycoca failed.");
440  }
441 
442  closeDatabase(); // close the dummy one
443 
444  // Ok, the new database should be here now, open it.
445  if (!openDatabase(ifNotFound & IfNotFoundOpenDummy)) {
446  kDebug(7011) << "Still no database...";
447  return false; // Still no database - uh oh
448  }
449  if (!checkVersion()) {
450  kDebug(7011) << "Still outdated...";
451  return false; // Still outdated - uh oh
452  }
453  return true;
454  }
455 
456  return false;
457 }
458 
459 QDataStream * KSycoca::findFactory(KSycocaFactoryId id)
460 {
461  // Ensure we have a valid database (right version, and rewinded to beginning)
462  if (!d->checkDatabase(KSycocaPrivate::IfNotFoundRecreate)) {
463  return 0;
464  }
465 
466  QDataStream* str = stream();
467  Q_ASSERT(str);
468 
469  qint32 aId;
470  qint32 aOffset;
471  while(true) {
472  *str >> aId;
473  if (aId == 0) {
474  kError(7011) << "Error, KSycocaFactory (id =" << int(id) << ") not found!";
475  break;
476  }
477  *str >> aOffset;
478  if (aId == id) {
479  //kDebug(7011) << "KSycoca::findFactory(" << id << ") offset " << aOffset;
480  str->device()->seek(aOffset);
481  return str;
482  }
483  }
484  return 0;
485 }
486 
487 QString KSycoca::kfsstnd_prefixes()
488 {
489  // do not try to launch kbuildsycoca from here; this code is also called by kbuildsycoca.
490  if (!d->checkDatabase(KSycocaPrivate::IfNotFoundDoNothing))
491  return QString();
492  QDataStream* str = stream();
493  Q_ASSERT(str);
494  qint32 aId;
495  qint32 aOffset;
496  // skip factories offsets
497  while(true)
498  {
499  *str >> aId;
500  if ( aId )
501  *str >> aOffset;
502  else
503  break; // just read 0
504  }
505  // We now point to the header
506  QString prefixes;
507  KSycocaEntry::read(*str, prefixes);
508  *str >> d->timeStamp;
509  KSycocaEntry::read(*str, d->language);
510  *str >> d->updateSig;
511  KSycocaEntry::read(*str, d->allResourceDirs);
512  return prefixes;
513 }
514 
515 quint32 KSycoca::timeStamp()
516 {
517  if (!d->timeStamp)
518  (void) kfsstnd_prefixes();
519  return d->timeStamp;
520 }
521 
522 quint32 KSycoca::updateSignature()
523 {
524  if (!d->timeStamp)
525  (void) kfsstnd_prefixes();
526  return d->updateSig;
527 }
528 
529 QString KSycoca::absoluteFilePath(DatabaseType type)
530 {
531  if (type == GlobalDatabase) {
532  QString path = KGlobal::dirs()->findResource("services", QString::fromLatin1(KSYCOCA_FILENAME));
533  if (path.isEmpty())
534  return KGlobal::dirs()->saveLocation("services") + QString::fromLatin1(KSYCOCA_FILENAME);
535  return path;
536  }
537 
538  const QByteArray ksycoca_env = qgetenv("KDESYCOCA");
539  if (ksycoca_env.isEmpty())
540  return KGlobal::dirs()->saveLocation("cache") + QString::fromLatin1(KSYCOCA_FILENAME);
541  else
542  return QFile::decodeName(ksycoca_env);
543 }
544 
545 QString KSycoca::language()
546 {
547  if (d->language.isEmpty())
548  (void) kfsstnd_prefixes();
549  return d->language;
550 }
551 
552 QStringList KSycoca::allResourceDirs()
553 {
554  if (!d->timeStamp)
555  (void) kfsstnd_prefixes();
556  return d->allResourceDirs;
557 }
558 
559 void KSycoca::flagError()
560 {
561  kWarning(7011) << "ERROR: KSycoca database corruption!";
562  KSycocaPrivate* d = ksycocaInstance->sycoca()->d;
563  if (d->readError)
564  return;
565  d->readError = true;
566  if (s_autoRebuild) {
567  // Rebuild the damned thing.
568  if (QProcess::execute(KStandardDirs::findExe(QString::fromLatin1(KBUILDSYCOCA_EXENAME))) != 0)
569  qWarning("ERROR: Running %s failed", KBUILDSYCOCA_EXENAME);
570  // Old comment, maybe not true anymore:
571  // Do not wait until the DBUS signal from kbuildsycoca here.
572  // It deletes m_str which is a problem when flagError is called during the KSycocaFactory ctor...
573  }
574 }
575 
576 #ifndef KDE_NO_DEPRECATED
577 bool KSycoca::readError() // KDE5: remove
578 {
579  return false;
580 }
581 #endif
582 
583 bool KSycoca::isBuilding()
584 {
585  return false;
586 }
587 
588 void KSycoca::disableAutoRebuild()
589 {
590  s_autoRebuild = false;
591 }
592 
593 QDataStream*& KSycoca::stream()
594 {
595  return d->stream();
596 }
597 
598 void KSycoca::clearCaches()
599 {
600  if (ksycocaInstance.exists() && ksycocaInstance->hasSycoca())
601  ksycocaInstance->sycoca()->d->closeDatabase();
602 }
603 
604 #include "ksycoca.moc"
QProcess::execute
int execute(const QString &program, const QStringList &arguments)
KStandardDirs::saveLocation
QString saveLocation(const char *type, const QString &suffix=QString(), bool create=true) const
Finds a location to save files into for the given type in the user's home directory.
Definition: kstandarddirs.cpp:1478
KSycocaFactoryList
This, instead of a typedef, allows to declare "class ..." in header files.
Definition: ksycocafactory.h:148
QList::clear
void clear()
KSycoca::factories
KSycocaFactoryList * factories()
Definition: ksycoca.cpp:383
KSycocaPrivate::m_databasePath
QString m_databasePath
Definition: ksycoca_p.h:59
kdebug.h
KSycocaFileDevice
Definition: ksycocadevices_p.h:69
QIODevice::seek
virtual bool seek(qint64 pos)
QByteArray
KSycoca
Definition: ksycoca.h:43
QDataStream
QDBusConnection::interface
QDBusConnectionInterface * interface() const
K_GLOBAL_STATIC
#define K_GLOBAL_STATIC(TYPE, NAME)
This macro makes it easy to use non-POD types as global statics.
Definition: kglobal.h:221
KSycocaPrivate::checkVersion
bool checkVersion()
Definition: ksycoca.cpp:389
KSycocaPrivate::IfNotFoundOpenDummy
Definition: ksycoca_p.h:38
KGlobal::dirs
KStandardDirs * dirs()
Returns the application standard dirs object.
QStringList::contains
bool contains(const QString &str, Qt::CaseSensitivity cs) const
QByteArray::isEmpty
bool isEmpty() const
kError
static QDebug kError(bool cond, int area=KDE_DEFAULT_DEBUG_AREA)
Definition: kdebug.h:187
KSycocaPrivate::closeDatabase
void closeDatabase()
Definition: ksycoca.cpp:314
QDBusConnection::sessionBus
QDBusConnection sessionBus()
KSycocaPrivate::StrategyMemFile
Definition: ksycoca_p.h:58
KSycoca::disableAutoRebuild
static void disableAutoRebuild()
Definition: ksycoca.cpp:588
quint32
KSycocaPrivate::language
QString language
Definition: ksycoca_p.h:61
QIODevice::open
virtual bool open(QFlags< QIODevice::OpenModeFlag > mode)
KSycocaFactory
Definition: ksycocafactory.h:36
KSycoca::isChanged
static bool isChanged(const char *type)
When you receive a "databaseChanged" signal, you can query here if a change has occurred in a specifi...
Definition: ksycoca.cpp:347
QDBusConnectionInterface::isServiceRegistered
QDBusReply< bool > isServiceRegistered(const QString &serviceName) const
ktoolinvocation.h
KSycocaPrivate::stream
QDataStream *& stream()
Definition: ksycoca.cpp:272
QFile
KSycoca::language
QString language()
Definition: ksycoca.cpp:545
KGlobal::config
KSharedConfigPtr config()
Returns the general config object.
Definition: kglobal.cpp:139
KSycoca::isAvailable
static bool isAvailable()
Definition: ksycoca.cpp:309
KSycocaPrivate::changeList
QStringList changeList
Definition: ksycoca_p.h:60
KSycocaBufferDevice
Definition: ksycocadevices_p.h:108
QString::clear
void clear()
KSYCOCA_FILENAME
#define KSYCOCA_FILENAME
Sycoca file name, used internally (by kbuildsycoca)
Definition: ksycoca.cpp:63
KSycoca::isBuilding
virtual bool isBuilding()
Definition: ksycoca.cpp:583
ksycocatype.h
KSycoca::~KSycoca
virtual ~KSycoca()
Definition: ksycoca.cpp:300
KSycoca::GlobalDatabase
Definition: ksycoca.h:60
KSycocaPrivate::StrategyFile
Definition: ksycoca_p.h:58
kglobal.h
KSycocaEntry::KSycocaType
KSycocaType
Definition: ksycocatype.h:31
KSycoca::version
static int version()
Definition: ksycoca.cpp:150
KSycoca::findEntry
QDataStream * findEntry(int offset, KSycocaType &type)
Definition: ksycoca.cpp:370
MAP_FAILED
#define MAP_FAILED
Definition: ksycoca.cpp:70
KSycocaBufferDevice::device
virtual QIODevice * device()
Definition: ksycocadevices_p.h:117
KSycocaPrivate::updateSig
quint32 updateSig
Definition: ksycoca_p.h:62
KSycoca::findFactory
QDataStream * findFactory(KSycocaFactoryId id)
Definition: ksycoca.cpp:459
KSycocaPrivate::IfNotFoundDoNothing
Definition: ksycoca_p.h:37
KSycocaFactory::KSycocaFactoryId
KSycocaFactoryId
Definition: ksycocatype.h:44
KSycocaPrivate::setStrategyFromString
void setStrategyFromString(const QString &strategy)
Definition: ksycoca.cpp:110
KSycoca::kfsstnd_prefixes
QString kfsstnd_prefixes()
Definition: ksycoca.cpp:487
KSycocaPrivate::StrategyMmap
Definition: ksycoca_p.h:58
kmemfile.h
QString::isEmpty
bool isEmpty() const
KSycocaAbstractDevice::stream
QDataStream *& stream()
Definition: ksycocadevices_p.h:36
KSycocaPrivate::databaseStatus
enum KSycocaPrivate::@7 databaseStatus
KSycocaPrivate::device
KSycocaAbstractDevice * device()
Definition: ksycoca.cpp:229
KSycocaPrivate::readError
bool readError
Definition: ksycoca_p.h:55
ksharedconfig.h
KSycoca::updateSignature
quint32 updateSignature()
Definition: ksycoca.cpp:522
QString
KSycocaPrivate::IfNotFoundRecreate
Definition: ksycoca_p.h:39
KSycoca::flagError
static void flagError()
A read error occurs.
Definition: ksycoca.cpp:559
KSycocaMemFileDevice
Definition: ksycocadevices_p.h:90
KSycocaPrivate::DatabaseNotOpen
Definition: ksycoca_p.h:51
KSycoca::readError
static bool readError()
Definition: ksycoca.cpp:577
KSycocaPrivate::NoDatabase
Definition: ksycoca_p.h:52
QStringList
KSycocaPrivate::StrategyDummyBuffer
Definition: ksycoca_p.h:58
KSycocaPrivate::openDatabase
bool openDatabase(bool openDummyIfNotFound=true)
Definition: ksycoca.cpp:189
KSycocaPrivate::m_sycocaStrategy
enum KSycocaPrivate::@8 m_sycocaStrategy
KSycoca::timeStamp
quint32 timeStamp()
Definition: ksycoca.cpp:515
KSycocaEntry::read
static void read(QDataStream &s, QString &str)
Default constructor.
Definition: ksycocaentry.cpp:46
QThreadStorage< KSycoca * >
kWarning
#define kWarning
Definition: kdebug.h:322
KSycoca::addFactory
void addFactory(KSycocaFactory *)
Definition: ksycoca.cpp:341
ksycoca.h
KConfigGroup
A class for one specific group in a KConfig object.
Definition: kconfiggroup.h:53
ksycocafactory.h
KSycocaPrivate::DatabaseOK
Definition: ksycoca_p.h:54
KSycoca::databaseChanged
QT_MOC_COMPAT void databaseChanged()
Connect to this to get notified when the database changes.
KSycocaPrivate
Definition: ksycoca_p.h:30
KSycocaPrivate::checkDatabase
bool checkDatabase(BehaviorsIfNotFound ifNotFound)
Definition: ksycoca.cpp:408
QLatin1String
KSycoca::stream
QDataStream *& stream()
Definition: ksycoca.cpp:593
QThread::currentThread
QThread * currentThread()
KDE::access
int access(const QString &path, int mode)
Definition: kde_file_win.cpp:123
kstandarddirs.h
KStandardDirs::findExe
static QString findExe(const QString &appname, const QString &pathstr=QString(), SearchOptions options=NoSearchOptions)
Finds the executable in the system path.
Definition: kstandarddirs.cpp:1328
KSycoca::DatabaseType
DatabaseType
type of database
Definition: ksycoca.h:60
KSYCOCA_VERSION
#define KSYCOCA_VERSION
Sycoca file version number.
Definition: ksycoca.cpp:58
KStandardDirs::findResource
QString findResource(const char *type, const QString &filename) const
Tries to find a resource in the following order:
Definition: kstandarddirs.cpp:458
KSycocaAbstractDevice
Definition: ksycocadevices_p.h:25
qint32
QString::fromLatin1
QString fromLatin1(const char *str, int size)
kDebug
#define kDebug
Definition: kdebug.h:316
KSycocaPrivate::timeStamp
quint32 timeStamp
Definition: ksycoca_p.h:57
KSycocaPrivate::allResourceDirs
QStringList allResourceDirs
Definition: ksycoca_p.h:63
KSycocaPrivate::tryMmap
bool tryMmap()
Definition: ksycoca.cpp:121
QDataStream::device
QIODevice * device() const
QDBusConnection::connect
bool connect(const QString &service, const QString &path, const QString &interface, const QString &name, QObject *receiver, const char *slot)
ksycoca_p.h
KSycoca::KSycoca
KSycoca()
Read-only database.
Definition: ksycoca.cpp:180
KSycocaPrivate::factories
KSycocaFactoryList * factories()
Definition: ksycoca_p.h:68
KBUILDSYCOCA_EXENAME
#define KBUILDSYCOCA_EXENAME
Executable name of the kbuildsycoca program.
Definition: ksycoca.h:37
KSycocaPrivate::addFactory
void addFactory(KSycocaFactory *factory)
Definition: ksycoca_p.h:65
ksycocadevices_p.h
KConfigGroup::readEntry
T readEntry(const QString &key, const T &aDefault) const
Reads the value of an entry specified by pKey in the current group.
Definition: kconfiggroup.h:248
KSycoca::self
static KSycoca * self()
Get or create the only instance of KSycoca (read-only)
Definition: ksycoca.cpp:293
KSycoca::allResourceDirs
QStringList allResourceDirs()
Definition: ksycoca.cpp:552
KSycocaPrivate::BadVersion
Definition: ksycoca_p.h:53
KSycoca::absoluteFilePath
static QString absoluteFilePath(DatabaseType type=LocalDatabase)
Definition: ksycoca.cpp:529
QFile::decodeName
QString decodeName(const QByteArray &localFileName)
kconfiggroup.h
s_autoRebuild
static bool s_autoRebuild
Definition: ksycoca.cpp:73
KToolInvocation::klauncher
static OrgKdeKLauncherInterface * klauncher()
Returns the D-Bus interface of the service launcher.
This file is part of the KDE documentation.
Documentation copyright © 1996-2020 The KDE developers.
Generated on Mon Jun 22 2020 13:22:11 by doxygen 1.8.7 written by Dimitri van Heesch, © 1997-2006

KDE's Doxygen guidelines are available online.

KDECore

Skip menu "KDECore"
  • Main Page
  • Namespace List
  • Namespace Members
  • Alphabetical List
  • Class List
  • Class Hierarchy
  • Class Members
  • File List
  • File Members
  • Modules
  • Related Pages

kdelibs API Reference

Skip menu "kdelibs API Reference"
  • DNSSD
  • Interfaces
  •   KHexEdit
  •   KMediaPlayer
  •   KSpeech
  •   KTextEditor
  • kconf_update
  • KDE3Support
  •   KUnitTest
  • KDECore
  • KDED
  • KDEsu
  • KDEUI
  • KDEWebKit
  • KDocTools
  • KFile
  • KHTML
  • KImgIO
  • KInit
  • kio
  • KIOSlave
  • KJS
  •   KJS-API
  •   WTF
  • kjsembed
  • KNewStuff
  • KParts
  • KPty
  • Kross
  • KUnitConversion
  • KUtils
  • Nepomuk
  • Plasma
  • Solid
  • Sonnet
  • ThreadWeaver

Search



Report problems with this website to our bug tracking system.
Contact the specific authors with questions and comments about the page contents.

KDE® and the K Desktop Environment® logo are registered trademarks of KDE e.V. | Legal