]> git.lyx.org Git - lyx.git/blobdiff - src/support/FileName.cpp
add onoff support for "inset-modify changetype xxx" in include inset
[lyx.git] / src / support / FileName.cpp
index 07af66d8734fad4e94b723803f31513653730e88..8a5584564e745b62f5c77e57775b3dfb6d3d97c2 100644 (file)
@@ -13,7 +13,6 @@
 #include "support/FileName.h"
 #include "support/FileNameList.h"
 
-#include "support/convert.h"
 #include "support/debug.h"
 #include "support/filetools.h"
 #include "support/lassert.h"
@@ -105,17 +104,15 @@ struct FileName::Private
 
        Private(string const & abs_filename) : fi(toqstr(abs_filename))
        {
-               name = abs_filename;
+               name = fromqstr(fi.absoluteFilePath());
                fi.setCaching(fi.exists() ? true : false);
        }
        ///
        inline void refresh() 
        {
-// There seems to be a bug in Qt >= 4.2.0, at least, that causes problems with
+// There seems to be a bug in Qt >= 4.2.0 and < 4.5.0, that causes problems with
 // QFileInfo::refresh() on *nix. So we recreate the object in that case.
-// FIXME: When Trolltech fixes the bug, we will have to replace 0x999999 below
-// with the actual working minimum version.
-#if defined(_WIN32) || (QT_VERSION >= 0x999999)
+#if defined(_WIN32) || (QT_VERSION >= 0x040500)
                fi.refresh();
 #else
                fi = QFileInfo(fi.absoluteFilePath());
@@ -212,8 +209,8 @@ string FileName::realPath() const
 
 void FileName::set(string const & name)
 {
-       d->name = name;
        d->fi.setFile(toqstr(name));
+       d->name = fromqstr(d->fi.absoluteFilePath());
        //LYXERR(Debug::FILES, "FileName::set(" << name << ')');
        LASSERT(empty() || isAbsolute(d->name), /**/);
 }
@@ -407,7 +404,9 @@ FileNameList FileName::dirList(string const & ext) const
                return dirlist;
        }
 
-       QDir dir = d->fi.absoluteDir();
+       // If the directory is specified without a trailing '/', absoluteDir()
+       // would return the parent dir, so we must use absoluteFilePath() here.
+       QDir dir = d->fi.absoluteFilePath();
 
        if (!ext.empty()) {
                QString filter;