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

tdeio/tdeio

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

tdeio/tdeio

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

tdeio/tdeio

Skip menu "tdeio/tdeio"
  • 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 tdeio/tdeio by doxygen 1.9.4
This website is maintained by Timothy Pearson.