~ubuntu-branches/ubuntu/wily/apparmor/wily

« back to all changes in this revision

Viewing changes to deprecated/management/profile-editor/src/ProfileDirectoryTraverser.h

  • Committer: Bazaar Package Importer
  • Author(s): Kees Cook
  • Date: 2011-08-10 18:12:34 UTC
  • mto: This revision was merged to the branch mainline in revision 9.
  • Revision ID: james.westby@ubuntu.com-20110810181234-b6obckg60cp99crg
Tags: upstream-2.7.0~beta1+bzr1774
ImportĀ upstreamĀ versionĀ 2.7.0~beta1+bzr1774

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
 
#ifndef PROFILE_DIRECTORY_TRAVERSER
2
 
#define PROFILE_DIRECTORY_TRAVERSER
3
 
 
4
 
/**
5
 
 * The wxDirTraverser that searches through the profile directory
6
 
 */
7
 
class ProfileDirectoryTraverser : public wxDirTraverser
8
 
{
9
 
        public:
10
 
                ProfileDirectoryTraverser(wxTreeCtrl* profileTree,
11
 
                                                const wxTreeItemId& startNode,
12
 
                                                const wxString& profileDirectory) 
13
 
                                                        : mpProfileTree(profileTree),
14
 
                                                          mCurNode(startNode),
15
 
                                                          mOriginalNode(startNode),
16
 
                                                          mProfileDirectory(profileDirectory) {}
17
 
 
18
 
                virtual wxDirTraverseResult OnFile(const wxString& filename)
19
 
                {
20
 
                        ProfileTreeData* data = new ProfileTreeData(filename);
21
 
                        // OnDir isn't called when the traverser starts
22
 
                        // going through the files in the top level directory,
23
 
                        // so we do this to keep the profiles in the right place
24
 
                        if (wxFileName(filename).GetPath() == mProfileDirectory)
25
 
                                mCurNode = mOriginalNode;
26
 
                        mpProfileTree->AppendItem(mCurNode, wxFileName(filename).GetFullName(), -1, -1, data);
27
 
                        return wxDIR_CONTINUE;
28
 
                }
29
 
 
30
 
                 virtual wxDirTraverseResult OnDir(const wxString& dirname)
31
 
                {
32
 
                        mCurNode = mpProfileTree->AppendItem(mOriginalNode, wxFileName(dirname).GetName());
33
 
                        return wxDIR_CONTINUE;
34
 
                }
35
 
        private:
36
 
                wxTreeCtrl*     mpProfileTree;
37
 
                wxTreeItemId    mCurNode, mOriginalNode;
38
 
                wxString        mProfileDirectory;
39
 
};
40
 
 
41
 
 
42
 
#endif
43