20 #ifndef _VFOLDER_MENU_H_
21 #define _VFOLDER_MENU_H_
25 #include <tqstringlist.h>
26 #include <tqptrdict.h>
27 #include <tqptrlist.h>
28 #include <tqvaluestack.h>
32 class VFolderMenu :
public TQObject
39 SubMenu() : items(43),isDeleted(false),apps_info(0) { }
40 ~SubMenu() { subMenus.setAutoDelete(
true); }
44 TQString directoryFile;
45 TQPtrList<SubMenu> subMenus;
46 TQDict<KService> items;
47 TQDict<KService> excludeItems;
48 TQDomElement defaultLayoutNode;
49 TQDomElement layoutNode;
51 TQStringList layoutList;
67 SubMenu *parseMenu(
const TQString &file,
bool forceLegacyLoad=
false);
76 TQStringList allDirectories();
82 void setTrackId(
const TQString &
id);
85 void newService(
const TQString &path, KService **entry);
90 enum Type { MI_Service, MI_SubMenu, MI_Separator };
99 TQStringList m_allDirectories;
101 TQStringList m_defaultDataDirs;
102 TQStringList m_defaultAppDirs;
103 TQStringList m_defaultDirectoryDirs;
104 TQStringList m_defaultMergeDirs;
105 TQStringList m_defaultLegacyDirs;
107 TQStringList m_directoryDirs;
108 TQDict<SubMenu> m_legacyNodes;
120 TQValueStack<VFolderMenu::docInfo> m_docInfoStack;
124 appsInfo() : dictCategories(53), applications(997), appRelPaths(997)
126 dictCategories.setAutoDelete(
true);
129 TQDict<KService::List> dictCategories;
130 TQDict<KService> applications;
131 TQPtrDict<TQString> appRelPaths;
134 appsInfo *m_appsInfo;
135 TQPtrList<appsInfo> m_appsInfoStack;
136 TQPtrList<appsInfo> m_appsInfoList;
137 TQDict<KService> m_usedAppsDict;
141 SubMenu *m_currentMenu;
142 bool m_forcedLegacyLoad;
151 KService *findApplication(
const TQString &relPath);
156 TQPtrList<KService::List> findCategory(
const TQString &category);
161 void addApplication(
const TQString &
id, KService *service);
166 void buildApplicationIndex(
bool unusedOnly);
171 void createAppsInfo();
181 void unloadAppsInfo();
183 TQDomDocument loadDoc();
184 void mergeMenus(TQDomElement &docElem, TQString &name);
185 void mergeFile(TQDomElement &docElem,
const TQDomNode &mergeHere);
186 void loadMenu(
const TQString &filename);
191 void includeItems(TQDict<KService> *items1, TQDict<KService> *items2);
196 void matchItems(TQDict<KService> *items1, TQDict<KService> *items2);
201 void excludeItems(TQDict<KService> *items1, TQDict<KService> *items2);
210 SubMenu* takeSubMenu(SubMenu *parentMenu,
const TQString &menuName);
221 void insertSubMenu(VFolderMenu::SubMenu *parentMenu,
const TQString &menuName, VFolderMenu::SubMenu *newMenu,
bool reversePriority=
false);
228 void mergeMenu(SubMenu *menu1, SubMenu *menu2,
bool reversePriority=
false);
234 void insertService(SubMenu *parentMenu,
const TQString &name, KService *newService);
240 void registerFile(
const TQString &file);
245 void markUsedApplications(TQDict<KService> *items);
251 void registerDirectory(
const TQString &directory);
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);
261 void pushDocInfo(
const TQString &fileName,
const TQString &baseDir = TQString::null);
262 void pushDocInfoParent(
const TQString &basePath,
const TQString &baseDir);
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&);