Changeset 172 for trunk/src/gui


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/gui
Files:
5 edited

Legend:

Unmodified
Added
Removed
  • 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 defined(Q_OS_WIN) || defined(Q_OS_OS2)
     785                //On Windows and OS/2 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 defined(Q_OS_WIN) || defined(Q_OS_OS2)
    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 defined(Q_OS_WIN) || defined(Q_OS_OS2)
    31863186    QStringList parts = pathCopy.split(re, QString::SkipEmptyParts);
    31873187    if (!doubleSlash.isEmpty() && !parts.isEmpty())
     
    31953195#endif
    31963196
    3197 #ifdef Q_OS_WIN
     3197#if defined(Q_OS_WIN) || defined(Q_OS_OS2)
    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 defined(Q_OS_WIN) || defined(Q_OS_OS2)
    103103        setCaseSensitivity(Qt::CaseInsensitive);
    104104#endif
     
    196196        return MAX_PATH;
    197197#endif //Q_OS_WINCE
     198#elif defined(Q_OS_OS2)
     199        Q_UNUSED(path);
     200        return CCHMAXPATH;
    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 (defined(Q_OS_WIN) && !defined(Q_OS_WINCE)) || defined(Q_OS_OS2)
    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_OS2) && (!defined(Q_OS_WIN) || defined(Q_OS_WINCE))
    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 (defined(Q_OS_WIN) && !defined(Q_OS_WINCE)) || defined(Q_OS_OS2)
    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 defined(Q_OS_WIN) || defined(Q_OS_OS2)
     404        // On Windows and OS/2, "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_OS2) && (!defined(Q_OS_WIN) || defined(Q_OS_WINCE))
    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_OS2) && (!defined(Q_OS_WIN) || defined(Q_OS_WINCE))
    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 (defined(Q_OS_WIN) && !defined(Q_OS_WINCE)) || defined(Q_OS_OS2)
    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_OS2) && (!defined(Q_OS_WIN) || defined(Q_OS_WINCE))
    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 (defined(Q_OS_WIN) && !defined(Q_OS_WINCE)) || defined(Q_OS_OS2)
    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 (defined(Q_OS_WIN) && !defined(Q_OS_WINCE)) || defined(Q_OS_OS2)
    16711671    if (!doubleSlash.isEmpty())
    16721672        parts[0].prepend(doubleSlash);
Note: See TracChangeset for help on using the changeset viewer.