• Skip to content
  • Skip to link menu
Trinity API Reference
  • Trinity API Reference
  • kded
 

kded

  • kded
kbuildimageiofactory.cpp
1 /* This file is part of the KDE libraries
2  * Copyright (C) 2000 Waldo Bastian <bastian@kde.org>
3  *
4  * This library is free software; you can redistribute it and/or
5  * modify it under the terms of the GNU Library General Public
6  * License version 2 as published by the Free Software Foundation.
7  *
8  * This library is distributed in the hope that it will be useful,
9  * but WITHOUT ANY WARRANTY; without even the implied warranty of
10  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
11  * Library General Public License for more details.
12  *
13  * You should have received a copy of the GNU Library General Public License
14  * along with this library; see the file COPYING.LIB. If not, write to
15  * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
16  * Boston, MA 02110-1301, USA.
17  **/
18 
19 #include "tdesycoca.h"
20 #include "tdesycocadict.h"
21 #include "kresourcelist.h"
22 
23 #include <tdeglobal.h>
24 #include <kstandarddirs.h>
25 #include <kdebug.h>
26 #include <tdelocale.h>
27 #include <assert.h>
28 
29 #include <kimageiofactory.h>
30 #include <kbuildimageiofactory.h>
31 
32 KBuildImageIOFactory::KBuildImageIOFactory() :
33  KImageIOFactory()
34 {
35  m_resourceList = new KSycocaResourceList();
36  m_resourceList->add( "services", "*.kimgio" );
37 }
38 
39 // return all service types for this factory
40 // i.e. first arguments to m_resourceList->add() above
41 TQStringList KBuildImageIOFactory::resourceTypes()
42 {
43  return TQStringList() << "services";
44 }
45 
46 KBuildImageIOFactory::~KBuildImageIOFactory()
47 {
48  delete m_resourceList;
49 }
50 
51 KSycocaEntry *
52 KBuildImageIOFactory::createEntry( const TQString& file, const char *resource )
53 {
54  TQString fullPath = locate( resource, file);
55 
56  KImageIOFormat *format = new KImageIOFormat(fullPath);
57  return format;
58 }
59 
60 void
61 KBuildImageIOFactory::addEntry(KSycocaEntry *newEntry, const char *resource)
62 {
63  KSycocaFactory::addEntry(newEntry, resource);
64 
65  KImageIOFormat *format = (KImageIOFormat *) newEntry;
66  rPath += format->rPaths;
67 
68  // Since Qt doesn't allow us to unregister image formats
69  // we have to make sure not to add them a second time.
70  // This typically happens when the sycoca database is updated
71  // incremenatally
72  for( KImageIOFormatList::ConstIterator it = formatList->begin();
73  it != formatList->end();
74  ++it )
75  {
76  KImageIOFormat *_format = (*it);
77  if (format->mType == _format->mType)
78  {
79  // Already in list
80  format = 0;
81  break;
82  }
83  }
84  if (format)
85  formatList->append( format );
86 }
87 
88 
89 void
90 KBuildImageIOFactory::saveHeader(TQDataStream &str)
91 {
92  KSycocaFactory::saveHeader(str);
93 
94  str << mReadPattern << mWritePattern << rPath;
95 }
96 
97 void
98 KBuildImageIOFactory::save(TQDataStream &str)
99 {
100  rPath.sort();
101  // Remove duplicates from rPath:
102  TQString last;
103  for(TQStringList::Iterator it = rPath.begin();
104  it != rPath.end(); )
105  {
106  TQStringList::Iterator it2 = it++;
107  if (*it2 == last)
108  {
109  // remove duplicate
110  rPath.remove(it2);
111  }
112  else
113  {
114  last = *it2;
115  }
116  }
117  mReadPattern = createPattern( KImageIO::Reading );
118  mWritePattern = createPattern( KImageIO::Writing );
119 
120  KSycocaFactory::save(str);
121 }
122 
KBuildImageIOFactory::KBuildImageIOFactory
KBuildImageIOFactory()
Create factory.
Definition: kbuildimageiofactory.cpp:32
KBuildImageIOFactory::save
virtual void save(TQDataStream &str)
Write out service type specific index files.
Definition: kbuildimageiofactory.cpp:98
KBuildImageIOFactory::resourceTypes
static TQStringList resourceTypes()
Returns all resource types for this service factory.
Definition: kbuildimageiofactory.cpp:41
KBuildImageIOFactory::createEntry
virtual KSycocaEntry * createEntry(const TQString &, const char *)
Create new entry.
Definition: kbuildimageiofactory.cpp:52
KBuildImageIOFactory::saveHeader
virtual void saveHeader(TQDataStream &)
Save header info to database.
Definition: kbuildimageiofactory.cpp:90

kded

Skip menu "kded"
  • Main Page
  • Alphabetical List
  • Class List
  • File List
  • Class Members
  • Related Pages

kded

Skip menu "kded"
  • arts
  • dcop
  • dnssd
  • interfaces
  •   kspeech
  •     interface
  •     library
  •   tdetexteditor
  • kate
  • kded
  • kdoctools
  • kimgio
  • kjs
  • libtdemid
  • libtdescreensaver
  • tdeabc
  • tdecmshell
  • tdecore
  • tdefx
  • tdehtml
  • tdeinit
  • tdeio
  •   bookmarks
  •   httpfilter
  •   kpasswdserver
  •   kssl
  •   tdefile
  •   tdeio
  •   tdeioexec
  • tdeioslave
  •   http
  • tdemdi
  •   tdemdi
  • tdenewstuff
  • tdeparts
  • tdeprint
  • tderandr
  • tderesources
  • tdespell2
  • tdesu
  • tdeui
  • tdeunittest
  • tdeutils
  • tdewallet
Generated for kded by doxygen 1.9.1
This website is maintained by Timothy Pearson.