X-Git-Url: https://git.lyx.org/gitweb/?a=blobdiff_plain;f=src%2Ffiledlg.C;h=43167d9d6823eacb5591bc80a346ef5bbea1243a;hb=4148a9244547e7184c1dcc8234e9e62d3143a42c;hp=043e17ca97faca83c7bcaca700789375f17caa69;hpb=0088121bd8c3fc7f2109e8dc9b22b73ca193f20e;p=lyx.git diff --git a/src/filedlg.C b/src/filedlg.C index 043e17ca97..43167d9d68 100644 --- a/src/filedlg.C +++ b/src/filedlg.C @@ -18,6 +18,7 @@ #include #include #include + using std::map; using std::sort; @@ -59,7 +60,6 @@ using std::sort; #ifdef BROKEN_HEADERS extern "C" int gettimeofday(struct timeval *, struct timezone *); -#define remove(a) unlink(a) #endif #ifdef __GNUG__ @@ -88,26 +88,29 @@ public: } private: /// - void add(uid_t ID) const { - string pszNewName; - struct passwd * pEntry; - - // gets user name - if ((pEntry = getpwuid(ID))) - pszNewName = pEntry->pw_name; - else { - pszNewName = tostr(ID); - } - - // adds new node - users[ID] = pszNewName; - } + void add(uid_t ID) const; /// typedef map Users; /// mutable Users users; }; +void UserCache::add(uid_t ID) const +{ + string pszNewName; + struct passwd * pEntry; + + // gets user name + if ((pEntry = getpwuid(ID))) + pszNewName = pEntry->pw_name; + else { + pszNewName = tostr(ID); + } + + // adds new node + users[ID] = pszNewName; +} + /// Group cache class definition class GroupCache { @@ -123,24 +126,27 @@ public: } private: /// - void add(gid_t ID) const { - string pszNewName; - struct group * pEntry; - - // gets user name - if ((pEntry = getgrgid(ID))) pszNewName = pEntry->gr_name; - else { - pszNewName = tostr(ID); - } - // adds new node - groups[ID] = pszNewName; - } + void add(gid_t ID) const; /// typedef map Groups; /// mutable Groups groups; }; +void GroupCache::add(gid_t ID) const +{ + string pszNewName; + struct group * pEntry; + + // gets user name + if ((pEntry = getgrgid(ID))) pszNewName = pEntry->gr_name; + else { + pszNewName = tostr(ID); + } + // adds new node + groups[ID] = pszNewName; +} + // static instances static UserCache lyxUserCache; static GroupCache lyxGroupCache; @@ -176,12 +182,12 @@ LyXFileDlg * LyXFileDlg::pCurrentDlg = 0; void LyXFileDlg::Reread() { // Opens directory - DIR * pDirectory = opendir(pszDirectory.c_str()); + DIR * pDirectory = ::opendir(pszDirectory.c_str()); if (!pDirectory) { WriteFSAlert(_("Warning! Couldn't open directory."), pszDirectory); pszDirectory = GetCWD(); - pDirectory = opendir(pszDirectory.c_str()); + pDirectory = ::opendir(pszDirectory.c_str()); } // Clear the present namelist @@ -415,13 +421,13 @@ void LyXFileDlg::SetButton(int iIndex, string const & pszName, *pTemp = pszPath; } else { fl_hide_object(pObject); - (*pTemp).clear(); + (*pTemp).erase(); } } // GetDirectory: gets last dialog directory -string LyXFileDlg::GetDirectory() const +string const LyXFileDlg::GetDirectory() const { if (!pszDirectory.empty()) return pszDirectory; @@ -507,6 +513,7 @@ void LyXFileDlg::FileDlgCB(FL_OBJECT *, long lArgument) } } + extern "C" void C_LyXFileDlg_FileDlgCB(FL_OBJECT * ob, long data) { LyXFileDlg::FileDlgCB(ob, data); @@ -573,7 +580,7 @@ bool LyXFileDlg::HandleDoubleClick() Temp += pszTemp; } else { // Directory higher up - Temp.clear(); + Temp.erase(); for (int i = 0; i < iSelect; ++i) { string piece = fl_get_browser_line(pFileDlgForm->List, i+1); // The '+2' is here to count the '@b' (JMarc) @@ -659,7 +666,7 @@ void LyXFileDlg::Force(bool cancel) // Select: launches dialog and returns selected file -string LyXFileDlg::Select(string const & title, string const & path, +string const LyXFileDlg::Select(string const & title, string const & path, string const & mask, string const & suggested) { // handles new mask and path