Changeset 172 for trunk


Ignore:
Timestamp:
Sep 9, 2009, 1:54:31 AM (16 years ago)
Author:
Dmitry A. Kuminov
Message:

corelib/io, gui/dialogs: Handle DOS-like filesystem details (drives, slashes) on OS/2 similarly to Win32.

Location:
trunk/src
Files:
12 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/corelib/io/qdir.cpp

    r2 r172  
    6262static QString driveSpec(const QString &path)
    6363{
    64 #ifdef Q_OS_WIN
     64#if
    6565    if (path.size() < 2)
    6666        return QString();
     
    147147        if ((path.endsWith(QLatin1Char('/')) || path.endsWith(QLatin1Char('\\')))
    148148                && path.length() > 1) {
    149 #ifdef Q_OS_WIN
     149#if
    150150            if (!(path.length() == 3 && path.at(1) == QLatin1Char(':')))
    151151#endif
     
    780780    }
    781781
    782 #ifdef Q_OS_WIN
     782#if
    783783    if (fileDrive.toLower() != dirDrive.toLower()
    784784        || (file.startsWith(QLatin1String("//"))
     
    799799    int i = 0;
    800800    while (i < dirElts.size() && i < fileElts.size() &&
    801 #ifdef Q_OS_WIN
     801#if
    802802           dirElts.at(i).toLower() == fileElts.at(i).toLower())
    803803#else
     
    20752075        if(p[i] == QLatin1Char('/')) {
    20762076            while(i < len-1 && p[i+1] == QLatin1Char('/')) {
    2077 #if defined(Q_OS_WIN) && !defined(Q_OS_WINCE) //allow unc paths
     2077#if ) //allow unc paths
    20782078                if(!i)
    20792079                    break;
     
    21352135                }
    21362136            } else if(last != -1 && iwrite - last == 1) {
    2137 #ifdef Q_OS_WIN
     2137#if
    21382138                eaten = (iwrite > 2);
    21392139#else
     
    22332233    \snippet doc/src/snippets/code/src_corelib_io_qdir.cpp 13
    22342234
    2235     If the file name contains characters that cannot be part of a valid C++ function name 
     2235    If the file name contains characters that cannot be part of a valid C++ function name
    22362236    (such as '-'), they have to be replaced by the underscore character ('_').
    22372237
  • trunk/src/corelib/io/qfile.cpp

    r2 r172  
    15241524    int writeBufferSize = writeBuffer.size();
    15251525    if ((openMode & QIODevice::Unbuffered) || writeBufferSize + 1 >= QFILE_WRITEBUFFER_SIZE
    1526 #ifdef Q_OS_WIN
     1526#if
    15271527        || ((openMode & QIODevice::Text) && c == '\n' && writeBufferSize + 2 >= QFILE_WRITEBUFFER_SIZE)
    15281528#endif
     
    15471547
    15481548    int len = 1;
    1549 #ifdef Q_OS_WIN
     1549#if
    15501550    if ((openMode & QIODevice::Text) && c == '\n') {
    15511551        ++len;
  • trunk/src/corelib/io/qfileinfo.cpp

    r2 r172  
    171171        break;
    172172    };
    173 #ifdef Q_OS_UNIX
     173#if
    174174    return QT_ACCESS(QFile::encodeName(data->fileName).data(), mode) == 0;
    175175#endif
  • trunk/src/corelib/io/qfsfileengine.cpp

    r2 r172  
    146146    known.insert(path);
    147147    do {
    148 #ifdef Q_OS_WIN
     148#if
    149149        // UNC, skip past the first two elements
    150150        if (separatorPos == 0 && tmpPath.startsWith(QLatin1String("//")))
  • trunk/src/corelib/io/qiodevice.cpp

    r2 r172  
    12131213        return qint64(-1);
    12141214
    1215 #ifdef Q_OS_WIN
     1215#if
    12161216    if (d->openMode & Text) {
    12171217        const char *endOfData = data + maxSize;
  • trunk/src/corelib/io/qtextstream.cpp

    r2 r172  
    652652        return true;
    653653
    654 #if defined (Q_OS_WIN)
     654#if defined)
    655655    // handle text translation and bypass the Text flag in the device.
    656656    bool textModeEnabled = device->isTextModeEnabled();
     
    685685        return false;
    686686
    687 #if defined (Q_OS_WIN)
     687#if defined)
    688688    // replace the text flag
    689689    if (textModeEnabled)
  • trunk/src/corelib/io/qurl.cpp

    r2 r172  
    59265926    if (fileInfo.isAbsolute()) {
    59275927        QString absPath = fileInfo.absolutePath();
    5928 #ifdef Q_OS_WIN
     5928#if
    59295929        if (absPath.size() > 1 && absPath.at(1) == QLatin1Char(':'))
    59305930            absPath = absPath.mid(2);
  • trunk/src/gui/dialogs/qfiledialog.cpp

    r2 r172  
    782782            text.remove(current);
    783783            if (text.at(0) == QDir::separator()
    784 #ifdef Q_OS_WIN
    785                 //On Windows both cases can happen
     784#if
     785                //On Windows both cases can happen
    786786                || text.at(0) == QLatin1Char('/')
    787787#endif
     
    31713171    QString pathCopy = QDir::toNativeSeparators(path);
    31723172    QString sep = QDir::separator();
    3173 #ifdef Q_OS_WIN
     3173#if
    31743174    if (pathCopy == QLatin1String("\\") || pathCopy == QLatin1String("\\\\"))
    31753175        return QStringList(pathCopy);
     
    31833183    QRegExp re(QLatin1String("[") + QRegExp::escape(sep) + QLatin1String("]"));
    31843184
    3185 #ifdef Q_OS_WIN
     3185#if
    31863186    QStringList parts = pathCopy.split(re, QString::SkipEmptyParts);
    31873187    if (!doubleSlash.isEmpty() && !parts.isEmpty())
     
    31953195#endif
    31963196
    3197 #ifdef Q_OS_WIN
     3197#if
    31983198    bool startsFromRoot = !parts.isEmpty() && parts[0].endsWith(QLatin1Char(':'));
    31993199#else
  • trunk/src/gui/dialogs/qfiledialog_p.h

    r2 r172  
    100100    QFSCompletor(QAbstractItemModel *model, QObject *parent = 0) : QCompleter(model, parent), proxyModel(0), sourceModel(0)
    101101    {
    102 #ifdef Q_OS_WIN
     102#if
    103103        setCaseSensitivity(Qt::CaseInsensitive);
    104104#endif
     
    196196        return MAX_PATH;
    197197#endif //Q_OS_WINCE
     198
     199
     200
    198201#else
    199202        Q_UNUSED(path);
     
    296299    bool fileNameLabelExplicitlySat;
    297300    QStringList nameFilters;
    298    
     301
    299302    // Members for using native dialogs:
    300303    bool nativeDialogInUse;
  • trunk/src/gui/dialogs/qfileinfogatherer.cpp

    r2 r172  
    285285{
    286286    QString driveName = drive.absoluteFilePath();
    287 #if defined(Q_OS_WIN) && !defined(Q_OS_WINCE)
     287#if )
    288288    if (driveName.startsWith(QLatin1Char('/'))) // UNC host
    289289        return drive.fileName();
  • trunk/src/gui/dialogs/qfilesystemmodel.cpp

    r2 r172  
    356356    QStringList pathElements = absolutePath.split(QLatin1Char('/'), QString::SkipEmptyParts);
    357357    if ((pathElements.isEmpty())
    358 #if !defined(Q_OS_WIN) || defined(Q_OS_WINCE)
     358#if !defined(Q_OS_)
    359359        && QDir::fromNativeSeparators(longPath) != QLatin1String("/")
    360360#endif
     
    362362        return const_cast<QFileSystemModelPrivate::QFileSystemNode*>(&root);
    363363    QModelIndex index = QModelIndex(); // start with "My Computer"
    364 #if defined(Q_OS_WIN) && !defined(Q_OS_WINCE)
     364#if )
    365365    if (absolutePath.startsWith(QLatin1String("//"))) { // UNC path
    366366        QString host = QLatin1String("\\\\") + pathElements.first();
     
    401401    for (int i = 0; i < pathElements.count(); ++i) {
    402402        QString element = pathElements.at(i);
    403 #ifdef Q_OS_WIN
    404         // On Windows, "filename......." and "filename" are equivalent Task #133928
     403#if
     404        // On Windows, "filename......." and "filename" are equivalent Task #133928
    405405        while (element.endsWith(QLatin1Char('.')))
    406406            element.chop(1);
     
    12661266    }
    12671267    QString fullPath = QDir::fromNativeSeparators(path.join(QDir::separator()));
    1268 #if !defined(Q_OS_WIN) || defined(Q_OS_WINCE)
     1268#if !defined(Q_OS_)
    12691269    if ((fullPath.length() > 2) && fullPath[0] == QLatin1Char('/') && fullPath[1] == QLatin1Char('/'))
    12701270        fullPath = fullPath.mid(1);
  • trunk/src/gui/util/qcompleter.cpp

    r2 r172  
    135135    To provide completions, QCompleter needs to know the path from an index.
    136136    This is provided by pathFromIndex(). The default implementation of
    137     pathFromIndex(), returns the data for the \l{Qt::EditRole}{edit role} 
     137    pathFromIndex(), returns the data for the \l{Qt::EditRole}{edit role}
    138138    for list models and the absolute file path if the mode is a QDirModel.
    139139
     
    483483        QString str = source->index(i, c->column).data().toString();
    484484        if (str.startsWith(c->prefix, c->cs)
    485 #if !defined(Q_OS_WIN) || defined(Q_OS_WINCE)
     485#if !defined(Q_OS_)
    486486            && (!dirModel || QDir::toNativeSeparators(str) != QDir::separator())
    487487#endif
     
    988988#ifndef QT_NO_DIRMODEL
    989989    if (qobject_cast<QDirModel *>(model)) {
    990 #if defined(Q_OS_WIN) && !defined(Q_OS_WINCE)
     990#if )
    991991        setCaseSensitivity(Qt::CaseInsensitive);
    992992#else
     
    16211621    } while (idx.isValid());
    16221622
    1623 #if !defined(Q_OS_WIN) || defined(Q_OS_WINCE)
     1623#if !defined(Q_OS_)
    16241624    if (list.count() == 1) // only the separator or some other text
    16251625        return list[0];
     
    16551655    QString pathCopy = QDir::toNativeSeparators(path);
    16561656    QString sep = QDir::separator();
    1657 #if defined(Q_OS_WIN) && !defined(Q_OS_WINCE)
     1657#if )
    16581658    if (pathCopy == QLatin1String("\\") || pathCopy == QLatin1String("\\\\"))
    16591659        return QStringList(pathCopy);
     
    16681668    QStringList parts = pathCopy.split(re);
    16691669
    1670 #if defined(Q_OS_WIN) && !defined(Q_OS_WINCE)
     1670#if )
    16711671    if (!doubleSlash.isEmpty())
    16721672        parts[0].prepend(doubleSlash);
Note: See TracChangeset for help on using the changeset viewer.