display custom folders in start menu root
Modified:
branches/lean-explorer/reactos/subsys/system/explorer/taskbar/startmenu.
cpp
Modified:
branches/lean-explorer/reactos/subsys/system/explorer/taskbar/startmenu.
h
_____
Modified:
branches/lean-explorer/reactos/subsys/system/explorer/taskbar/startmenu.
cpp
---
branches/lean-explorer/reactos/subsys/system/explorer/taskbar/startmenu.
cpp 2005-05-03 08:00:23 UTC (rev 14952)
+++
branches/lean-explorer/reactos/subsys/system/explorer/taskbar/startmenu.
cpp 2005-05-03 08:01:18 UTC (rev 14953)
@@ -217,15 +217,42 @@
#endif
}
- AddShellEntries(dir, -1, smd._subfolders);
+ AddShellEntries(dir, -1, smd._ignore);
}
}
-void StartMenu::AddShellEntries(const ShellDirectory& dir, int max,
bool subfolders)
+static LPTSTR trim_path_slash(LPTSTR path)
{
+ LPTSTR p = path;
+
+ while(*p)
+ ++p;
+
+ if (p>path && (p[-1]=='\\' || p[-1]=='/'))
+ *--p = '\0';
+
+ return path;
+}
+
+void StartMenu::AddShellEntries(const ShellDirectory& dir, int max,
const String& ignore)
+{
+ TCHAR ignore_path[MAX_PATH], ignore_dir[MAX_PATH],
ignore_name[_MAX_FNAME], ignore_ext[_MAX_EXT];
+ TCHAR dir_path[MAX_PATH];
+
+ if (!ignore.empty()) {
+ _tsplitpath(ignore, ignore_path, ignore_dir,
ignore_name, ignore_ext);
+
+ _tcscat(ignore_path, ignore_dir);
+ _tcscat(ignore_name, ignore_ext);
+
+ dir.get_path(dir_path);
+
+ if (_tcsicmp(trim_path_slash(dir_path),
trim_path_slash(ignore_path)))
+ *ignore_name = '\0';
+ }
+
int cnt = 0;
-
for(Entry*entry=dir._down; entry; entry=entry->_next) {
// hide files like "desktop.ini"
if (entry->_shell_attribs & SFGAO_HIDDEN)
@@ -233,8 +260,8 @@
continue;
// hide subfolders if requested
- if (!subfolders)
- if (entry->_data.dwFileAttributes &
FILE_ATTRIBUTE_DIRECTORY)
+ if (!ignore.empty())
+ if (*ignore_name &&
!_tcsicmp(entry->_data.cFileName, ignore_name))
continue;
// only 'max' entries shall be added.
@@ -1467,7 +1494,7 @@
try {
// insert directory "All Users\Start Menu"
ShellDirectory cmn_startmenu(GetDesktopFolder(),
SpecialFolderPath(CSIDL_COMMON_STARTMENU, _hwnd), _hwnd);
-
_dirs.push_back(StartMenuDirectory(cmn_startmenu, false)); // don't
add subfolders
+
_dirs.push_back(StartMenuDirectory(cmn_startmenu,
(LPCTSTR)SpecialFolderFSPath(CSIDL_COMMON_PROGRAMS, _hwnd)));
} catch(COMException&) {
// ignore exception and don't show additional
shortcuts
}
@@ -1476,7 +1503,7 @@
// insert directory "<user name>\Start Menu"
ShellDirectory usr_startmenu(GetDesktopFolder(),
SpecialFolderPath(CSIDL_STARTMENU, _hwnd), _hwnd);
- _dirs.push_back(StartMenuDirectory(usr_startmenu,
false)); // don't add subfolders
+ _dirs.push_back(StartMenuDirectory(usr_startmenu,
(LPCTSTR)SpecialFolderFSPath(CSIDL_PROGRAMS, _hwnd)));
} catch(COMException&) {
// ignore exception and don't show additional shortcuts
}
@@ -1998,6 +2025,6 @@
}
dir.sort_directory(SORT_DATE);
- AddShellEntries(dir, RECENT_DOCS_COUNT,
smd._subfolders); ///@todo read max. count of entries from
registry
+ AddShellEntries(dir, RECENT_DOCS_COUNT, smd._ignore);
///@todo read max. count of entries from registry
}
}
_____
Modified:
branches/lean-explorer/reactos/subsys/system/explorer/taskbar/startmenu.
h
---
branches/lean-explorer/reactos/subsys/system/explorer/taskbar/startmenu.
h 2005-05-03 08:00:23 UTC (rev 14952)
+++
branches/lean-explorer/reactos/subsys/system/explorer/taskbar/startmenu.
h 2005-05-03 08:01:18 UTC (rev 14953)
@@ -56,8 +56,8 @@
/// StartMenuDirectory is used to store the base directory of start
menus.
struct StartMenuDirectory
{
- StartMenuDirectory(const ShellDirectory& dir, bool
subfolders=true)
- : _dir(dir), _subfolders(subfolders)
+ StartMenuDirectory(const ShellDirectory& dir, const String&
ignore="")
+ : _dir(dir), _ignore(ignore)
{
}
@@ -67,7 +67,7 @@
}
ShellDirectory _dir;
- bool _subfolders;
+ String _ignore;
};
typedef list<StartMenuDirectory> StartMenuShellDirs;
@@ -278,7 +278,7 @@
StartMenuEntry& AddEntry(const ShellFolder folder, ShellEntry*
entry);
StartMenuEntry& AddEntry(const ShellFolder folder, Entry*
entry);
- void AddShellEntries(const ShellDirectory& dir, int max=-1,
bool subfolders=true);
+ void AddShellEntries(const ShellDirectory& dir, int max=-1,
const String& ignore="");
void AddButton(LPCTSTR title, ICON_ID icon_id=ICID_NONE, bool
hasSubmenu=false, int id=-1, bool enabled=true);
void AddSeparator();