• Skip to content
  • Skip to link menu
Trinity API Reference
  • Trinity API Reference
  • kio/kio
 

kio/kio

  • kio
  • kio
kservicegroup.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 <tqdir.h>
20 
21 #include <kiconloader.h>
22 #include <kglobal.h>
23 #include <kstandarddirs.h>
24 #include <klocale.h>
25 #include <kdebug.h>
26 #include <ksortablevaluelist.h>
27 
28 #include "kservicefactory.h"
29 #include "kservicegroupfactory.h"
30 #include "kservicegroup.h"
31 #include "kservice.h"
32 #include "ksycoca.h"
33 
34 class KServiceGroup::Private
35 {
36 public:
37  Private() { m_bNoDisplay = false; m_bShowEmptyMenu = false;m_bShowInlineHeader=false;m_bInlineAlias=false; m_bAllowInline = false; m_inlineValue = 4; m_bShortMenu = false; m_bGeneralDescription = false;}
38  bool m_bNoDisplay;
39  bool m_bShortMenu;
40  bool m_bGeneralDescription;
41  bool m_bShowEmptyMenu;
42  bool m_bShowInlineHeader;
43  bool m_bInlineAlias;
44  bool m_bAllowInline;
45  int m_inlineValue;
46  TQStringList suppressGenericNames;
47  TQString directoryEntryPath;
48  TQStringList sortOrder;
49 };
50 
51 KServiceGroup::KServiceGroup( const TQString & name )
52  : KSycocaEntry(name), m_childCount(-1)
53 {
54  d = new KServiceGroup::Private;
55  m_bDeleted = false;
56  m_bDeep = false;
57 }
58 
59 KServiceGroup::KServiceGroup( const TQString &configFile, const TQString & _relpath )
60  : KSycocaEntry(_relpath), m_childCount(-1)
61 {
62  d = new KServiceGroup::Private;
63  m_bDeleted = false;
64  m_bDeep = false;
65 
66  TQString cfg = configFile;
67  if (cfg.isEmpty())
68  cfg = _relpath+".directory";
69 
70  d->directoryEntryPath = cfg;
71 
72  KDesktopFile config( cfg, true, "apps" );
73 
74  m_strCaption = config.readName();
75  m_strIcon = config.readIcon();
76  m_strComment = config.readComment();
77  m_bDeleted = config.readBoolEntry( "Hidden", false );
78  d->m_bNoDisplay = config.readBoolEntry( "NoDisplay", false );
79  if (d->directoryEntryPath.startsWith(TQDir::homeDirPath()))
80  d->m_bShortMenu = false;
81  else
82  d->m_bShortMenu = config.readBoolEntry( "X-SuSE-AutoShortMenu", false );
83  d->m_bGeneralDescription = config.readBoolEntry( "X-SuSE-GeneralDescription", false );
84  TQStringList tmpList;
85  if (config.hasKey("OnlyShowIn"))
86  {
87  if ((!config.readListEntry("OnlyShowIn", ';').contains("TDE")) && (!config.readListEntry("OnlyShowIn", ';').contains("KDE")))
88  d->m_bNoDisplay = true;
89  }
90  if (config.hasKey("NotShowIn"))
91  {
92  if ((config.readListEntry("NotShowIn", ';').contains("TDE")) || (config.readListEntry("NotShowIn", ';').contains("KDE")))
93  d->m_bNoDisplay = true;
94  }
95 
96  m_strBaseGroupName = config.readEntry( "X-KDE-BaseGroup" );
97  d->suppressGenericNames = config.readListEntry( "X-KDE-SuppressGenericNames" );
98  d->sortOrder = config.readListEntry("SortOrder");
99 
100  // Fill in defaults.
101  if (m_strCaption.isEmpty())
102  {
103  m_strCaption = _relpath;
104  if (m_strCaption.right(1) == "/")
105  m_strCaption = m_strCaption.left(m_strCaption.length()-1);
106  int i = m_strCaption.findRev('/');
107  if (i > 0)
108  m_strCaption = m_strCaption.mid(i+1);
109  }
110  if (m_strIcon.isEmpty())
111  m_strIcon = "folder";
112 }
113 
114 KServiceGroup::KServiceGroup( TQDataStream& _str, int offset, bool deep ) :
115  KSycocaEntry( _str, offset )
116 {
117  d = new KServiceGroup::Private;
118  m_bDeep = deep;
119  load( _str );
120 }
121 
122 KServiceGroup::~KServiceGroup()
123 {
124  delete d;
125 }
126 
127 int KServiceGroup::childCount()
128 {
129  if (m_childCount == -1)
130  {
131  KConfig global("kdeglobals");
132  global.setGroup("KDE");
133  bool showUnimportant = global.readBoolEntry("showUnimportant", true);
134 
135  m_childCount = 0;
136 
137  for( List::ConstIterator it = m_serviceList.begin();
138  it != m_serviceList.end(); it++)
139  {
140  KSycocaEntry *p = (*it);
141  if (p->isType(KST_KService))
142  {
143  KService *service = static_cast<KService *>(p);
144  if (!service->noDisplay())
145  if ( showUnimportant || !service->SuSEunimportant() )
146  m_childCount++;
147  }
148  else if (p->isType(KST_KServiceGroup))
149  {
150  KServiceGroup *serviceGroup = static_cast<KServiceGroup *>(p);
151  m_childCount += serviceGroup->childCount();
152  }
153  }
154  }
155  return m_childCount;
156 }
157 
158 
159 bool KServiceGroup::showInlineHeader() const
160 {
161  return d->m_bShowInlineHeader;
162 }
163 
164 bool KServiceGroup::showEmptyMenu() const
165 {
166  return d->m_bShowEmptyMenu;
167 }
168 
169 bool KServiceGroup::inlineAlias() const
170 {
171  return d->m_bInlineAlias;
172 }
173 
174 void KServiceGroup::setInlineAlias(bool _b)
175 {
176  d->m_bInlineAlias = _b;
177 }
178 
179 void KServiceGroup::setShowEmptyMenu(bool _b)
180 {
181  d->m_bShowEmptyMenu=_b;
182 }
183 
184 void KServiceGroup::setShowInlineHeader(bool _b)
185 {
186  d->m_bShowInlineHeader=_b;
187 }
188 
189 int KServiceGroup::inlineValue() const
190 {
191  return d->m_inlineValue;
192 }
193 
194 void KServiceGroup::setInlineValue(int _val)
195 {
196  d->m_inlineValue = _val;
197 }
198 
199 bool KServiceGroup::allowInline() const
200 {
201  return d->m_bAllowInline;
202 }
203 
204 void KServiceGroup::setAllowInline(bool _b)
205 {
206  d->m_bAllowInline = _b;
207 }
208 
209 bool KServiceGroup::noDisplay() const
210 {
211  return d->m_bNoDisplay || m_strCaption.startsWith(".");
212 }
213 
214 TQStringList KServiceGroup::suppressGenericNames() const
215 {
216  return d->suppressGenericNames;
217 }
218 
219 bool KServiceGroup::SuSEgeneralDescription() const
220 {
221  return d->m_bGeneralDescription;
222 }
223 
224 bool KServiceGroup::SuSEshortMenu() const
225 {
226  return d->m_bShortMenu;
227 }
228 
229 void KServiceGroup::load( TQDataStream& s )
230 {
231  TQStringList groupList;
232  TQ_INT8 noDisplay;
233  TQ_INT8 _showEmptyMenu;
234  TQ_INT8 inlineHeader;
235  TQ_INT8 _inlineAlias;
236  TQ_INT8 _allowInline;
237  s >> m_strCaption >> m_strIcon >>
238  m_strComment >> groupList >> m_strBaseGroupName >> m_childCount >>
239  noDisplay >> d->suppressGenericNames >> d->directoryEntryPath >>
240  d->sortOrder >> _showEmptyMenu >> inlineHeader >> _inlineAlias >>
241  _allowInline >> d->m_bShortMenu >> d->m_bGeneralDescription;
242 
243  d->m_bNoDisplay = (noDisplay != 0);
244  d->m_bShowEmptyMenu = ( _showEmptyMenu != 0 );
245  d->m_bShowInlineHeader = ( inlineHeader != 0 );
246  d->m_bInlineAlias = ( _inlineAlias != 0 );
247  d->m_bAllowInline = ( _allowInline != 0 );
248 
249  if (m_bDeep)
250  {
251  for(TQStringList::ConstIterator it = groupList.begin();
252  it != groupList.end(); it++)
253  {
254  TQString path = *it;
255  if (path[path.length()-1] == '/')
256  {
257  KServiceGroup *serviceGroup;
258  serviceGroup = KServiceGroupFactory::self()->findGroupByDesktopPath(path, false);
259  if (serviceGroup)
260  m_serviceList.append( SPtr(serviceGroup) );
261  }
262  else
263  {
264  KService *service;
265  service = KServiceFactory::self()->findServiceByDesktopPath(path);
266  if (service)
267  m_serviceList.append( SPtr(service) );
268  }
269  }
270  }
271 }
272 
273 void KServiceGroup::addEntry( KSycocaEntry *entry)
274 {
275  m_serviceList.append(entry);
276 }
277 
278 void KServiceGroup::save( TQDataStream& s )
279 {
280  KSycocaEntry::save( s );
281 
282  TQStringList groupList;
283  for( List::ConstIterator it = m_serviceList.begin();
284  it != m_serviceList.end(); it++)
285  {
286  KSycocaEntry *p = (*it);
287  if (p->isType(KST_KService))
288  {
289  KService *service = static_cast<KService *>(p);
290  groupList.append( service->desktopEntryPath());
291  }
292  else if (p->isType(KST_KServiceGroup))
293  {
294  KServiceGroup *serviceGroup = static_cast<KServiceGroup *>(p);
295  groupList.append( serviceGroup->relPath());
296  }
297  else
298  {
299  //fprintf(stderr, "KServiceGroup: Unexpected object in list!\n");
300  }
301  }
302 
303  (void) childCount();
304 
305  TQ_INT8 noDisplay = d->m_bNoDisplay ? 1 : 0;
306  TQ_INT8 _showEmptyMenu = d->m_bShowEmptyMenu ? 1 : 0;
307  TQ_INT8 inlineHeader = d->m_bShowInlineHeader ? 1 : 0;
308  TQ_INT8 _inlineAlias = d->m_bInlineAlias ? 1 : 0;
309  TQ_INT8 _allowInline = d->m_bAllowInline ? 1 : 0;
310  s << m_strCaption << m_strIcon <<
311  m_strComment << groupList << m_strBaseGroupName << m_childCount <<
312  noDisplay << d->suppressGenericNames << d->directoryEntryPath <<
313  d->sortOrder <<_showEmptyMenu <<inlineHeader<<_inlineAlias<<_allowInline <<
314  d->m_bShortMenu << d->m_bGeneralDescription;
315 }
316 
317 KServiceGroup::List
318 KServiceGroup::entries(bool sort)
319 {
320  return entries(sort, true);
321 }
322 
323 KServiceGroup::List
324 KServiceGroup::entries(bool sort, bool excludeNoDisplay)
325 {
326  return entries(sort, excludeNoDisplay, false);
327 }
328 
329 static void addItem(KServiceGroup::List &sorted, const KSycocaEntry::Ptr &p, bool &addSeparator)
330 {
331  if (addSeparator && !sorted.isEmpty())
332  sorted.append(new KServiceSeparator());
333  sorted.append(p);
334  addSeparator = false;
335 }
336 
337 KServiceGroup::List
338 KServiceGroup::entries(bool sort, bool excludeNoDisplay, bool allowSeparators, bool sortByGenericName)
339 {
340  return SuSEentries(sort, excludeNoDisplay, allowSeparators, sortByGenericName);
341 }
342 
343 KServiceGroup::List
344 KServiceGroup::SuSEentries(bool sort, bool excludeNoDisplay, bool allowSeparators, bool sortByGenericName, bool excludeSuSEunimportant)
345 {
346  KServiceGroup *group = this;
347 
348  // If the entries haven't been loaded yet, we have to reload ourselves
349  // together with the entries. We can't only load the entries afterwards
350  // since the offsets could have been changed if the database has changed.
351 
352  if (!m_bDeep) {
353 
354  group =
355  KServiceGroupFactory::self()->findGroupByDesktopPath(relPath(), true);
356 
357  if (0 == group) // No guarantee that we still exist!
358  return List();
359  }
360 
361  if (!sort)
362  return group->m_serviceList;
363 
364  // Sort the list alphabetically, according to locale.
365  // Groups come first, then services.
366 
367  KSortableValueList<SPtr,TQCString> slist;
368  KSortableValueList<SPtr,TQCString> glist;
369  for (List::ConstIterator it(group->m_serviceList.begin()); it != group->m_serviceList.end(); ++it)
370  {
371  KSycocaEntry *p = (*it);
372 // if( !p->isType(KST_KServiceGroup) && !p->isType(KST_KService))
373 // continue;
374  bool noDisplay = p->isType(KST_KServiceGroup) ?
375  static_cast<KServiceGroup *>(p)->noDisplay() :
376  static_cast<KService *>(p)->noDisplay();
377  if (excludeNoDisplay && noDisplay)
378  continue;
379  bool SuSEunimportant = p->isType(KST_KService) &&
380  static_cast<KService *>(p)->SuSEunimportant();
381  if (excludeSuSEunimportant && SuSEunimportant)
382  continue;
383 
384  // Choose the right list
385  KSortableValueList<SPtr,TQCString> & list = p->isType(KST_KServiceGroup) ? glist : slist;
386  TQString name;
387  if (p->isType(KST_KServiceGroup))
388  name = static_cast<KServiceGroup *>(p)->caption();
389  else if (sortByGenericName)
390  name = static_cast<KService *>(p)->genericName() + " " + p->name();
391  else
392  name = p->name() + " " + static_cast<KService *>(p)->genericName();
393 
394  TQCString key( name.length() * 4 + 1 );
395  // strxfrm() crashes on Solaris
396 #ifndef USE_SOLARIS
397  // maybe it'd be better to use wcsxfrm() where available
398  size_t ln = strxfrm( key.data(), name.local8Bit().data(), key.size());
399  if( ln != size_t( -1 ))
400  {
401  if( ln >= key.size())
402  { // didn't fit?
403  key.resize( ln + 1 );
404  if( strxfrm( key.data(), name.local8Bit().data(), key.size()) == size_t( -1 ))
405  key = name.local8Bit();
406  }
407  }
408  else
409 #endif
410  {
411  key = name.local8Bit();
412  }
413  list.insert(key,SPtr(*it));
414  }
415 
416  return group->SuSEsortEntries( slist, glist, excludeNoDisplay, allowSeparators );
417 }
418 
419 KServiceGroup::List
420 KServiceGroup::SuSEsortEntries( KSortableValueList<SPtr,TQCString> slist, KSortableValueList<SPtr,TQCString> glist, bool excludeNoDisplay, bool allowSeparators )
421 {
422  KServiceGroup *group = this;
423 
424  // Now sort
425  slist.sort();
426  glist.sort();
427 
428  if (d->sortOrder.isEmpty())
429  {
430  d->sortOrder << ":M";
431  d->sortOrder << ":F";
432  d->sortOrder << ":OIH IL[4]"; //just inline header
433  }
434 
435  TQString rp = relPath();
436  if(rp == "/") rp = TQString::null;
437 
438  // Iterate through the sort spec list.
439  // If an entry gets mentioned explicitly, we remove it from the sorted list
440  for (TQStringList::ConstIterator it(d->sortOrder.begin()); it != d->sortOrder.end(); ++it)
441  {
442  const TQString &item = *it;
443  if (item.isEmpty()) continue;
444  if (item[0] == '/')
445  {
446  TQString groupPath = rp + item.mid(1) + "/";
447  // Remove entry from sorted list of services.
448  for(KSortableValueList<SPtr,TQCString>::Iterator it2 = glist.begin(); it2 != glist.end(); ++it2)
449  {
450  KServiceGroup *group = (KServiceGroup *)((KSycocaEntry *)((*it2).value()));
451  if (group->relPath() == groupPath)
452  {
453  glist.remove(it2);
454  break;
455  }
456  }
457  }
458  else if (item[0] != ':')
459  {
460  // Remove entry from sorted list of services.
461  // TODO: Remove item from sortOrder-list if not found
462  // TODO: This prevents duplicates
463  for(KSortableValueList<SPtr,TQCString>::Iterator it2 = slist.begin(); it2 != slist.end(); ++it2)
464  {
465  if (!(*it2).value()->isType(KST_KService))
466  continue;
467  KService *service = (KService *)((KSycocaEntry *)((*it2).value()));
468  if (service->menuId() == item)
469  {
470  slist.remove(it2);
471  break;
472  }
473  }
474  }
475  }
476 
477  List sorted;
478 
479  bool needSeparator = false;
480  // Iterate through the sort spec list.
481  // Add the entries to the list according to the sort spec.
482  for (TQStringList::ConstIterator it(d->sortOrder.begin()); it != d->sortOrder.end(); ++it)
483  {
484  const TQString &item = *it;
485  if (item.isEmpty()) continue;
486  if (item[0] == ':')
487  {
488  // Special condition...
489  if (item == ":S")
490  {
491  if (allowSeparators)
492  needSeparator = true;
493  }
494  else if ( item.contains( ":O" ) )
495  {
496  //todo parse attribute:
497  TQString tmp( item );
498  tmp = tmp.remove(":O");
499  TQStringList optionAttribute = TQStringList::split(" ",tmp);
500  if( optionAttribute.count()==0)
501  optionAttribute.append(tmp);
502  bool showEmptyMenu = false;
503  bool showInline = false;
504  bool showInlineHeader = false;
505  bool showInlineAlias = false;
506  int inlineValue = -1;
507 
508  for ( TQStringList::Iterator it3 = optionAttribute.begin(); it3 != optionAttribute.end(); ++it3 )
509  {
510  parseAttribute( *it3, showEmptyMenu, showInline, showInlineHeader, showInlineAlias, inlineValue );
511  }
512  for(KSortableValueList<SPtr,TQCString>::Iterator it2 = glist.begin(); it2 != glist.end(); ++it2)
513  {
514  KServiceGroup *group = (KServiceGroup *)((KSycocaEntry *)(*it2).value());
515  group->setShowEmptyMenu( showEmptyMenu );
516  group->setAllowInline( showInline );
517  group->setShowInlineHeader( showInlineHeader );
518  group->setInlineAlias( showInlineAlias );
519  group->setInlineValue( inlineValue );
520  }
521 
522  }
523  else if (item == ":M")
524  {
525  // Add sorted list of sub-menus
526  for(KSortableValueList<SPtr,TQCString>::Iterator it2 = glist.begin(); it2 != glist.end(); ++it2)
527  {
528  addItem(sorted, (*it2).value(), needSeparator);
529  }
530  }
531  else if (item == ":F")
532  {
533  // Add sorted list of services
534  for(KSortableValueList<SPtr,TQCString>::Iterator it2 = slist.begin(); it2 != slist.end(); ++it2)
535  {
536  addItem(sorted, (*it2).value(), needSeparator);
537  }
538  }
539  else if (item == ":A")
540  {
541  // Add sorted lists of services and submenus
542  KSortableValueList<SPtr,TQCString>::Iterator it_s = slist.begin();
543  KSortableValueList<SPtr,TQCString>::Iterator it_g = glist.begin();
544 
545  while(true)
546  {
547  if (it_s == slist.end())
548  {
549  if (it_g == glist.end())
550  break; // Done
551 
552  // Insert remaining sub-menu
553  addItem(sorted, (*it_g).value(), needSeparator);
554  it_g++;
555  }
556  else if (it_g == glist.end())
557  {
558  // Insert remaining service
559  addItem(sorted, (*it_s).value(), needSeparator);
560  it_s++;
561  }
562  else if ((*it_g).index() < (*it_s).index())
563  {
564  // Insert sub-menu first
565  addItem(sorted, (*it_g).value(), needSeparator);
566  it_g++;
567  }
568  else
569  {
570  // Insert service first
571  addItem(sorted, (*it_s).value(), needSeparator);
572  it_s++;
573  }
574  }
575  }
576  }
577  else if (item[0] == '/')
578  {
579  TQString groupPath = rp + item.mid(1) + "/";
580 
581  for (List::ConstIterator it2(group->m_serviceList.begin()); it2 != group->m_serviceList.end(); ++it2)
582  {
583  if (!(*it2)->isType(KST_KServiceGroup))
584  continue;
585  KServiceGroup *group = (KServiceGroup *)((KSycocaEntry *)(*it2));
586  if (group->relPath() == groupPath)
587  {
588  if (!excludeNoDisplay || !group->noDisplay())
589  {
590  const TQString &nextItem = *( ++it );
591  if ( nextItem.startsWith( ":O" ) )
592  {
593  TQString tmp( nextItem );
594  tmp = tmp.remove(":O");
595  TQStringList optionAttribute = TQStringList::split(" ",tmp);
596  if( optionAttribute.count()==0)
597  optionAttribute.append(tmp);
598  bool bShowEmptyMenu = false;
599  bool bShowInline = false;
600  bool bShowInlineHeader = false;
601  bool bShowInlineAlias = false;
602  int inlineValue = -1;
603  for ( TQStringList::Iterator it3 = optionAttribute.begin(); it3 != optionAttribute.end(); ++it3 )
604  {
605  parseAttribute( *it3 , bShowEmptyMenu, bShowInline, bShowInlineHeader, bShowInlineAlias , inlineValue );
606  group->setShowEmptyMenu( bShowEmptyMenu );
607  group->setAllowInline( bShowInline );
608  group->setShowInlineHeader( bShowInlineHeader );
609  group->setInlineAlias( bShowInlineAlias );
610  group->setInlineValue( inlineValue );
611  }
612  }
613  else
614  it--;
615 
616  addItem(sorted, (group), needSeparator);
617  }
618  break;
619  }
620  }
621  }
622  else
623  {
624  for (List::ConstIterator it2(group->m_serviceList.begin()); it2 != group->m_serviceList.end(); ++it2)
625  {
626  if (!(*it2)->isType(KST_KService))
627  continue;
628  KService *service = (KService *)((KSycocaEntry *)(*it2));
629  if (service->menuId() == item)
630  {
631  if (!excludeNoDisplay || !service->noDisplay())
632  addItem(sorted, (*it2), needSeparator);
633  break;
634  }
635  }
636  }
637  }
638 
639  return sorted;
640 }
641 
642 void KServiceGroup::parseAttribute( const TQString &item , bool &showEmptyMenu, bool &showInline, bool &showInlineHeader, bool & showInlineAlias , int &inlineValue )
643 {
644  if( item == "ME") //menu empty
645  showEmptyMenu=true;
646  else if ( item == "NME") //not menu empty
647  showEmptyMenu=false;
648  else if( item == "I") //inline menu !
649  showInline = true;
650  else if ( item == "NI") //not inline menu!
651  showInline = false;
652  else if( item == "IH") //inline header!
653  showInlineHeader= true;
654  else if ( item == "NIH") //not inline header!
655  showInlineHeader = false;
656  else if( item == "IA") //inline alias!
657  showInlineAlias = true;
658  else if ( item == "NIA") //not inline alias!
659  showInlineAlias = false;
660  else if( ( item ).contains( "IL" )) //inline limite!
661  {
662  TQString tmp( item );
663  tmp = tmp.remove( "IL[" );
664  tmp = tmp.remove( "]" );
665  bool ok;
666  int _inlineValue = tmp.toInt(&ok);
667  if ( !ok ) //error
668  _inlineValue = -1;
669  inlineValue = _inlineValue;
670  }
671  else
672  kdDebug()<<" This attribute is not supported :"<<item<<endl;
673 }
674 
675 void KServiceGroup::setLayoutInfo(const TQStringList &layout)
676 {
677  d->sortOrder = layout;
678 }
679 
680 TQStringList KServiceGroup::layoutInfo() const
681 {
682  return d->sortOrder;
683 }
684 
685 KServiceGroup::Ptr
686 KServiceGroup::baseGroup( const TQString & _baseGroupName )
687 {
688  return KServiceGroupFactory::self()->findBaseGroup(_baseGroupName, true);
689 }
690 
691 KServiceGroup::Ptr
692 KServiceGroup::root()
693 {
694  return KServiceGroupFactory::self()->findGroupByDesktopPath("/", true);
695 }
696 
697 KServiceGroup::Ptr
698 KServiceGroup::group(const TQString &relPath)
699 {
700  if (relPath.isEmpty()) return root();
701  return KServiceGroupFactory::self()->findGroupByDesktopPath(relPath, true);
702 }
703 
704 KServiceGroup::Ptr
705 KServiceGroup::childGroup(const TQString &parent)
706 {
707  return KServiceGroupFactory::self()->findGroupByDesktopPath("#parent#"+parent, true);
708 }
709 
710 TQString
711 KServiceGroup::directoryEntryPath() const
712 {
713  return d->directoryEntryPath;
714 }
715 
716 
717 void KServiceGroup::virtual_hook( int id, void* data )
718 { KSycocaEntry::virtual_hook( id, data ); }
719 
720 
721 KServiceSeparator::KServiceSeparator( )
722  : KSycocaEntry("separator")
723 {
724 }
KServiceGroup
KServiceGroup represents a group of service, for example screensavers.
Definition: kservicegroup.h:69
KServiceGroup::root
static Ptr root()
Returns the root service group.
Definition: kservicegroup.cpp:692
KServiceGroup::parseAttribute
void parseAttribute(const TQString &item, bool &showEmptyMenu, bool &showInline, bool &showInlineHeader, bool &showInlineAlias, int &inlineValue)
This function parse attributes into menu.
Definition: kservicegroup.cpp:642
KServiceGroup::caption
TQString caption() const
Returns the caption of this group.
Definition: kservicegroup.h:122
KServiceGroup::entries
List entries(bool sorted, bool excludeNoDisplay, bool allowSeparators, bool sortByGenericName=false)
List of all Services and ServiceGroups within this ServiceGroup.
Definition: kservicegroup.cpp:338
KServiceGroup::name
virtual TQString name() const
Name used for indexing.
Definition: kservicegroup.h:110
KServiceGroup::KServiceGroup
KServiceGroup(const TQString &name)
Construct a dummy servicegroup indexed with name.
Definition: kservicegroup.cpp:51
KServiceGroup::inlineAlias
bool inlineAlias() const
Definition: kservicegroup.cpp:169
KServiceGroup::noDisplay
bool noDisplay() const
Returns true if the NoDisplay flag was set, i.e.
Definition: kservicegroup.cpp:209
KServiceGroup::SuSEshortMenu
bool SuSEshortMenu() const
Original API and feature kindly provided by SuSE.
Definition: kservicegroup.cpp:224
KServiceGroup::suppressGenericNames
TQStringList suppressGenericNames() const
Returns a list of untranslated generic names that should be be supressed when showing this group.
Definition: kservicegroup.cpp:214
KServiceGroup::showInlineHeader
bool showInlineHeader() const
Definition: kservicegroup.cpp:159
KServiceGroup::showEmptyMenu
bool showEmptyMenu() const
Return true if we want to display empty menu entry.
Definition: kservicegroup.cpp:164
KServiceGroup::childGroup
static Ptr childGroup(const TQString &parent)
Returns the group of services that have X-KDE-ParentApp equal to parent (siblings).
Definition: kservicegroup.cpp:705
KServiceGroup::allowInline
bool allowInline() const
Definition: kservicegroup.cpp:199
KServiceGroup::childCount
int childCount()
Returns the total number of displayable services in this group and any of its subgroups.
Definition: kservicegroup.cpp:127
KServiceGroup::group
static Ptr group(const TQString &relPath)
Returns the group with the given relative path.
Definition: kservicegroup.cpp:698
KServiceGroup::relPath
virtual TQString relPath() const
Returns the relative path of the service group.
Definition: kservicegroup.h:116
KServiceGroup::inlineValue
int inlineValue() const
Definition: kservicegroup.cpp:189
KServiceGroup::directoryEntryPath
TQString directoryEntryPath() const
Returns a path to the .directory file describing this service group.
Definition: kservicegroup.cpp:711
KServiceGroup::baseGroup
static Ptr baseGroup(const TQString &baseGroupName)
Returns the group for the given baseGroupName.
Definition: kservicegroup.cpp:686
KService
Represent a service, i.e.
Definition: kservice.h:49
KService::desktopEntryPath
TQString desktopEntryPath() const
Returns the path to the location where the service desktop entry is stored.
Definition: kservice.h:174
KService::noDisplay
bool noDisplay() const
Whether the entry should be suppressed in menus.
Definition: kservice.cpp:741
KService::menuId
TQString menuId() const
Returns the menu ID of the service desktop entry.
Definition: kservice.cpp:817
KService::name
virtual TQString name() const
Returns the name of the service.
Definition: kservice.h:98
KService::SuSEunimportant
bool SuSEunimportant() const
check if the application entry is important
Definition: kservice.cpp:779

kio/kio

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

kio/kio

Skip menu "kio/kio"
  • arts
  • dcop
  • dnssd
  • interfaces
  •     interface
  •     library
  •   kspeech
  •   ktexteditor
  • kabc
  • kate
  • kcmshell
  • kdecore
  • kded
  • kdefx
  • kdeprint
  • kdesu
  • kdeui
  • kdoctools
  • khtml
  • kimgio
  • kinit
  • kio
  •   bookmarks
  •   httpfilter
  •   kfile
  •   kio
  •   kioexec
  •   kpasswdserver
  •   kssl
  • kioslave
  •   http
  • kjs
  • kmdi
  •   kmdi
  • knewstuff
  • kparts
  • krandr
  • kresources
  • kspell2
  • kunittest
  • kutils
  • kwallet
  • libkmid
  • libkscreensaver
Generated for kio/kio by doxygen 1.9.1
This website is maintained by Timothy Pearson.
KDE® and the K Desktop Environment® logo are registered trademarks of KDE e.V. |