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

kded

  • kded
vfolder_menu.h
1 /*
2  This file is part of the KDE libraries
3  Copyright (c) 2003 Waldo Bastian <bastian@kde.org>
4 
5  This library is free software; you can redistribute it and/or
6  modify it under the terms of the GNU Library General Public
7  License version 2 as published by the Free Software Foundation.
8 
9  This library is distributed in the hope that it will be useful,
10  but WITHOUT ANY WARRANTY; without even the implied warranty of
11  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
12  Library General Public License for more details.
13 
14  You should have received a copy of the GNU Library General Public License
15  along with this library; see the file COPYING.LIB. If not, write to
16  the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
17  Boston, MA 02110-1301, USA.
18 */
19 
20 #ifndef _VFOLDER_MENU_H_
21 #define _VFOLDER_MENU_H_
22 
23 #include <tqobject.h>
24 #include <tqdom.h>
25 #include <tqstringlist.h>
26 #include <tqptrdict.h>
27 #include <tqptrlist.h>
28 #include <tqvaluestack.h>
29 
30 #include <kservice.h>
31 
32 class VFolderMenu : public TQObject
33 {
34  TQ_OBJECT
35 public:
36  class appsInfo;
37  class SubMenu {
38  public:
39  SubMenu() : items(43),isDeleted(false),apps_info(0) { }
40  ~SubMenu() { subMenus.setAutoDelete(true); }
41 
42  public:
43  TQString name;
44  TQString directoryFile;
45  TQPtrList<SubMenu> subMenus;
46  TQDict<KService> items;
47  TQDict<KService> excludeItems; // Needed when merging due to Move.
48  TQDomElement defaultLayoutNode;
49  TQDomElement layoutNode;
50  bool isDeleted;
51  TQStringList layoutList;
52  appsInfo *apps_info;
53  };
54 
55  VFolderMenu();
56  ~VFolderMenu();
57 
67  SubMenu *parseMenu(const TQString &file, bool forceLegacyLoad=false);
68 
76  TQStringList allDirectories();
77 
82  void setTrackId(const TQString &id);
83 
84 signals:
85  void newService(const TQString &path, KService **entry);
86 
87 public:
88  struct MenuItem
89  {
90  enum Type { MI_Service, MI_SubMenu, MI_Separator };
91  Type type;
92  union {
93  KService *service;
94  SubMenu *submenu;
95  } data;
96  };
97 
98 public:
99  TQStringList m_allDirectories; // A list of all the directories that we touch
100 
101  TQStringList m_defaultDataDirs;
102  TQStringList m_defaultAppDirs;
103  TQStringList m_defaultDirectoryDirs;
104  TQStringList m_defaultMergeDirs;
105  TQStringList m_defaultLegacyDirs;
106 
107  TQStringList m_directoryDirs; // Current set of applicable <DirectoryDir> dirs
108  TQDict<SubMenu> m_legacyNodes; // Dictionary that stores Menu nodes
109  // associated with legacy tree.
110 
111  class docInfo {
112  public:
113  TQString baseDir; // Relative base dir of current menu file
114  TQString baseName; // Filename of current menu file without ".menu"
115  TQString path; // Full path of current menu file including ".menu"
116  };
117 
118 
119  docInfo m_docInfo; // docInfo for current doc
120  TQValueStack<VFolderMenu::docInfo> m_docInfoStack;
121 
122  class appsInfo {
123  public:
124  appsInfo() : dictCategories(53), applications(997), appRelPaths(997)
125  {
126  dictCategories.setAutoDelete(true);
127  }
128 
129  TQDict<KService::List> dictCategories; // category -> apps
130  TQDict<KService> applications; // rel path -> service
131  TQPtrDict<TQString> appRelPaths; // service -> rel path
132  };
133 
134  appsInfo *m_appsInfo; // appsInfo for current menu
135  TQPtrList<appsInfo> m_appsInfoStack; // All applicable appsInfo for current menu
136  TQPtrList<appsInfo> m_appsInfoList; // List of all appsInfo objects.
137  TQDict<KService> m_usedAppsDict; // all applications that have been allocated
138 
139  TQDomDocument m_doc;
140  SubMenu *m_rootMenu;
141  SubMenu *m_currentMenu;
142  bool m_forcedLegacyLoad;
143  bool m_legacyLoaded;
144  bool m_track;
145  TQString m_trackId;
146 
147 private:
151  KService *findApplication(const TQString &relPath);
152 
156  TQPtrList<KService::List> findCategory(const TQString &category);
157 
161  void addApplication(const TQString &id, KService *service);
162 
166  void buildApplicationIndex(bool unusedOnly);
167 
171  void createAppsInfo();
172 
176  void loadAppsInfo();
177 
181  void unloadAppsInfo();
182 
183  TQDomDocument loadDoc();
184  void mergeMenus(TQDomElement &docElem, TQString &name);
185  void mergeFile(TQDomElement &docElem, const TQDomNode &mergeHere);
186  void loadMenu(const TQString &filename);
187 
191  void includeItems(TQDict<KService> *items1, TQDict<KService> *items2);
192 
196  void matchItems(TQDict<KService> *items1, TQDict<KService> *items2);
197 
201  void excludeItems(TQDict<KService> *items1, TQDict<KService> *items2);
202 
210  SubMenu* takeSubMenu(SubMenu *parentMenu, const TQString &menuName);
211 
221  void insertSubMenu(VFolderMenu::SubMenu *parentMenu, const TQString &menuName, VFolderMenu::SubMenu *newMenu, bool reversePriority=false);
222 
228  void mergeMenu(SubMenu *menu1, SubMenu *menu2, bool reversePriority=false);
229 
234  void insertService(SubMenu *parentMenu, const TQString &name, KService *newService);
235 
240  void registerFile(const TQString &file);
241 
245  void markUsedApplications(TQDict<KService> *items);
246 
251  void registerDirectory(const TQString &directory);
252 
253  void processKDELegacyDirs();
254  void processLegacyDir(const TQString &dir, const TQString &relDir, const TQString &prefix);
255  void processMenu(TQDomElement &docElem, int pass);
256  void layoutMenu(VFolderMenu::SubMenu *menu, TQStringList defaultLayout);
257  void processCondition(TQDomElement &docElem, TQDict<KService> *items);
258 
259  void initDirs();
260 
261  void pushDocInfo(const TQString &fileName, const TQString &baseDir = TQString::null);
262  void pushDocInfoParent(const TQString &basePath, const TQString &baseDir);
263  void popDocInfo();
264 
265  TQString absoluteDir(const TQString &_dir, const TQString &baseDir, bool keepRelativeToCfg=false);
266  TQString locateMenuFile(const TQString &fileName);
267  TQString locateDirectoryFile(const TQString &fileName);
268  void loadApplications(const TQString&, const TQString&);
269 };
270 
271 #endif

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.