]> git.lyx.org Git - lyx.git/blobdiff - src/filedlg.C
Various fixes, removed "default" language, inserted new lyxrc tag
[lyx.git] / src / filedlg.C
index 043e17ca97faca83c7bcaca700789375f17caa69..43167d9d6823eacb5591bc80a346ef5bbea1243a 100644 (file)
@@ -18,6 +18,7 @@
 #include <cstring>
 #include <map>
 #include <algorithm>
+
 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<uid_t, string> 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<gid_t, string> 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