Changeset 8 for trunk/src/tools


Ignore:
Timestamp:
Nov 16, 2005, 8:36:46 PM (20 years ago)
Author:
dmik
Message:

Transferred Qt for OS/2 version 3.3.1-rc5 sources from the CVS

Location:
trunk/src/tools
Files:
8 added
18 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/tools/qconfig.cpp

    r7 r8  
    22
    33/* Install paths from configure */
    4 static const char QT_INSTALL_PREFIX [267] = "qt_nstpath=E:\\develop\\Qt\\win-3.3.1";
    5 static const char QT_INSTALL_BINS   [267] = "qt_binpath=E:\\develop\\Qt\\win-3.3.1\\bin";
    6 static const char QT_INSTALL_DOCS   [267] = "qt_docpath=E:\\develop\\Qt\\win-3.3.1\\doc";
    7 static const char QT_INSTALL_HEADERS[267] = "qt_hdrpath=E:\\develop\\Qt\\win-3.3.1\\include";
    8 static const char QT_INSTALL_LIBS   [267] = "qt_libpath=E:\\develop\\Qt\\win-3.3.1\\lib";
    9 static const char QT_INSTALL_PLUGINS[267] = "qt_plgpath=E:\\develop\\Qt\\win-3.3.1\\plugins";
    10 static const char QT_INSTALL_DATA   [267] = "qt_datpath=E:\\develop\\Qt\\win-3.3.1";
    11 static const char QT_INSTALL_TRANSLATIONS [267] = "qt_trnpath=E:\\develop\\Qt\\win-3.3.1\\translations";
     4static const char QT_INSTALL_PREFIX [267] = "qt_nstpath=C:\\Qt\\3.3.1";
     5static const char QT_INSTALL_BINS   [267] = "qt_binpath=C:\\Qt\\3.3.1\\bin";
     6static const char QT_INSTALL_DOCS   [267] = "qt_docpath=C:\\Qt\\3.3.1\\doc";
     7static const char QT_INSTALL_HEADERS[267] = "qt_hdrpath=C:\\Qt\\3.3.1\\include";
     8static const char QT_INSTALL_LIBS   [267] = "qt_libpath=C:\\Qt\\3.3.1\\lib";
     9static const char QT_INSTALL_PLUGINS[267] = "qt_plgpath=C:\\Qt\\3.3.1\\plugins";
     10static const char QT_INSTALL_DATA   [267] = "qt_datpath=C:\\Qt\\3.3.1";
     11static const char QT_INSTALL_TRANSLATIONS [267] = "qt_trnpath=C:\\Qt\\3.3.1\\translations";
    1212
    1313/* strlen( "qt_xxxpath=" ) == 11 */
  • trunk/src/tools/qcriticalsection_p.cpp

    r7 r8  
    3636#if defined(QT_THREAD_SUPPORT)
    3737
    38 #include "qt_windows.h"
    39 
    4038#include <private/qcriticalsection_p.h>
    4139
     40#if defined(Q_WS_WIN)
     41#   include "qt_windows.h"
     42#elif defined(Q_OS_OS2)
     43#   include "qt_os2.h"
     44#endif
     45
     46#if defined(Q_WS_WIN)
    4247class QCriticalSectionPrivate
    4348{
     
    4752    CRITICAL_SECTION section;
    4853};
    49 
     54#endif
    5055
    5156QCriticalSection::QCriticalSection()
    5257{
     58#if defined(Q_WS_WIN)
    5359    d = new QCriticalSectionPrivate;
    5460    InitializeCriticalSection( &d->section );
     61#endif
    5562}
    5663
    5764QCriticalSection::~QCriticalSection()
    5865{
     66#if defined(Q_WS_WIN)
    5967    DeleteCriticalSection( &d->section );
    6068    delete d;
     69#endif
    6170}
    6271
    6372void QCriticalSection::enter()
    6473{
     74#if defined(Q_WS_WIN)
    6575    EnterCriticalSection( &d->section );
     76#elif defined(Q_OS_OS2)
     77    DosEnterCritSec();
     78#endif
    6679}
    6780
    6881void QCriticalSection::leave()
    6982{
     83#if defined(Q_WS_WIN)
    7084    LeaveCriticalSection( &d->section );
     85#elif defined(Q_OS_OS2)
     86    DosExitCritSec();
     87#endif
    7188}
    7289
  • trunk/src/tools/qcriticalsection_p.h

    r7 r8  
    3838
    3939#ifndef QT_H
     40#include "qglobal.h"
    4041#endif // QT_H
    4142
     
    5455#if defined(QT_THREAD_SUPPORT)
    5556
    56 #if defined(Q_WS_WIN)
     57#if defined(Q_WS_WIN) || defined(Q_OS_OS2)
    5758
    5859/*
     
    6061*/
    6162
     63#if defined(Q_WS_WIN)
    6264class QCriticalSectionPrivate;
     65#endif
    6366
    6467class QCriticalSection
     
    7073    void leave();
    7174
     75#if defined(Q_WS_WIN)
    7276private:
    7377    QCriticalSectionPrivate *d;
     78#endif   
    7479};
    7580
  • trunk/src/tools/qdatetime.cpp

    r7 r8  
    5151#endif
    5252
     53#if defined(Q_OS_OS2)
     54#include <unidef.h>
     55#include <sys/timeb.h>
     56#endif
     57
    5358static const uint FIRST_DAY     = 2361222;      // Julian day for 1752-09-14
    5459static const int  FIRST_YEAR    = 1752;         // ### wrong for many countries
     
    515520    }
    516521#endif
    517 #ifndef Q_WS_WIN
     522#if defined(Q_OS_OS2)
     523    UniChar buffer[256];
     524    tm tt;
     525    memset( &tt, 0, sizeof( tm ) );
     526    tt.tm_mon = month - 1;
     527    LocaleObject lo = qt_os2DefLocaleObj();
     528    if (lo)
     529        if ( UniStrftime( lo, buffer, sizeof( buffer ) / sizeof( UniChar ),
     530                (UniChar *)L"%b", &tt )
     531        )
     532            return QString::fromUcs2( buffer );
     533#elif !defined(Q_WS_WIN)
    518534    char buffer[255];
    519535    tm tt;
     
    561577    }
    562578#endif
    563 #ifndef Q_WS_WIN
     579#if defined(Q_OS_OS2)
     580    UniChar buffer[256];
     581    tm tt;
     582    memset( &tt, 0, sizeof( tm ) );
     583    tt.tm_mon = month - 1;
     584    LocaleObject lo = qt_os2DefLocaleObj();
     585    if (lo)
     586        if ( UniStrftime( lo, buffer, sizeof( buffer ) / sizeof( UniChar ),
     587                (UniChar *)L"%B", &tt )
     588        )
     589            return QString::fromUcs2( buffer );
     590#elif !defined(Q_WS_WIN)
    564591    char buffer[255];
    565592    tm tt;
     
    615642    }
    616643#endif
    617 #ifndef Q_WS_WIN
     644#if defined(Q_OS_OS2)
     645    UniChar buffer[256];
     646    tm tt;
     647    memset( &tt, 0, sizeof( tm ) );
     648    tt.tm_wday = ( weekday == 7 ) ? 0 : weekday;
     649    LocaleObject lo = qt_os2DefLocaleObj();
     650    if (lo)
     651        if ( UniStrftime( lo, buffer, sizeof( buffer ) / sizeof( UniChar ),
     652                (UniChar *)L"%a", &tt )
     653        )
     654            return QString::fromUcs2( buffer );
     655#elif !defined(Q_WS_WIN)
    618656    char buffer[255];
    619657    tm tt;
     
    663701    }
    664702#endif
    665 #ifndef Q_WS_WIN
     703#if defined(Q_OS_OS2)
     704    UniChar buffer[256];
     705    tm tt;
     706    memset( &tt, 0, sizeof( tm ) );
     707    tt.tm_wday = ( weekday == 7 ) ? 0 : weekday;
     708    LocaleObject lo = qt_os2DefLocaleObj();
     709    if (lo)
     710        if ( UniStrftime( lo, buffer, sizeof( buffer ) / sizeof( UniChar ),
     711                (UniChar *)L"%A", &tt )
     712        )
     713            return QString::fromUcs2( buffer );
     714#elif !defined(Q_WS_WIN)
    666715    char buffer[255];
    667716    tm tt;
     
    729778    case Qt::LocalDate:
    730779        {
    731 #ifndef Q_WS_WIN
     780#if defined(Q_OS_OS2)
     781            tm tt;
     782            memset( &tt, 0, sizeof( tm ) );
     783            UniChar buf[256];
     784            tt.tm_mday = day();
     785            tt.tm_mon = month() - 1;
     786            tt.tm_year = year() - 1900;
     787
     788            LocaleObject lo = qt_os2DefLocaleObj();
     789            if (lo)
     790                if ( UniStrftime( lo, buf, sizeof( buf ) / sizeof( UniChar ),
     791                        (UniChar *)L"%x", &tt )
     792                )
     793                    return QString::fromUcs2( buf );
     794#elif !defined(Q_WS_WIN)
    732795            tm tt;
    733796            memset( &tt, 0, sizeof( tm ) );
     
    13951458    case Qt::LocalDate:
    13961459        {
    1397 #ifndef Q_WS_WIN
     1460#if defined(Q_OS_OS2)
     1461            tm tt;
     1462            memset( &tt, 0, sizeof( tm ) );
     1463            UniChar buf[256];
     1464            tt.tm_sec = second();
     1465            tt.tm_min = minute();
     1466            tt.tm_hour = hour();
     1467
     1468            LocaleObject lo = qt_os2DefLocaleObj();
     1469            if (lo)
     1470                if ( UniStrftime( lo, buf, sizeof( buf ) / sizeof( UniChar ),
     1471                        (UniChar *)L"%X", &tt )
     1472                )
     1473                    return QString::fromUcs2( buf );
     1474#elif !defined(Q_WS_WIN)
    13981475            tm tt;
    13991476            memset( &tt, 0, sizeof( tm ) );
     
    17431820    ct->ds = (uint)( MSECS_PER_HOUR * t->tm_hour + MSECS_PER_MIN * t->tm_min +
    17441821                     1000 * t->tm_sec + tv.tv_usec / 1000 );
     1822#elif defined(Q_OS_OS2)
     1823    timeb ltime;
     1824    ::ftime( &ltime );
     1825    tm *t;
     1826    if ( ts == Qt::LocalTime )
     1827        t = localtime( &ltime.time );
     1828    else
     1829        t = gmtime( &ltime.time );
     1830    ct->ds = (uint) ( MSECS_PER_HOUR * t->tm_hour + MSECS_PER_MIN * t->tm_min +
     1831                      1000 * t->tm_sec + ltime.millitm );
    17451832#else
    17461833    time_t ltime; // no millisecond resolution
     
    17481835    tm *t;
    17491836    if ( ts == Qt::LocalTime )
    1750         localtime( &ltime );
     1837        t = localtime( &ltime );
    17511838    else
    1752         gmtime( &ltime );
     1839        t = gmtime( &ltime );
    17531840    ct->ds = (uint) ( MSECS_PER_HOUR * t->tm_hour + MSECS_PER_MIN * t->tm_min +
    17541841                      1000 * t->tm_sec );
  • trunk/src/tools/qdir.cpp

    r7 r8  
    6868    A QDir can point to a file using either a relative or an absolute
    6969    path. Absolute paths begin with the directory separator "/"
    70     (optionally preceded by a drive specification under Windows). If
     70    (optionally preceded by a drive specification under Windows and OS/2). If
    7171    you always use "/" as a directory separator, Qt will translate
    7272    your paths to conform to the underlying operating system. Relative
     
    116116    The list of root directories is provided by drives(); on Unix
    117117    systems this returns a list containing one root directory, "/"; on
    118     Windows the list will usually contain "C:/", and possibly "D:/",
     118    Windows or OS/2 the list will usually contain "C:/", and possibly "D:/",
    119119    etc.
    120120
     
    281281    The path can be either absolute or relative. Absolute paths begin
    282282    with the directory separator "/" (optionally preceded by a drive
    283     specification under Windows). Relative file names begin with a
     283    specification under Windows and OS/2). Relative file names begin with a
    284284    directory name or a file name and specify a path relative to the
    285285    current directory. An example of an absolute path is the string
     
    403403
    404404    QString tmp = absPath();
    405 #ifdef Q_OS_WIN32
     405#if defined(Q_OS_WIN32) || defined(Q_OS_OS2)
    406406    if ( fileName[0].isLetter() && fileName[1] == ':' ) {
     407#if defined(Q_OS_OS2)
     408#if defined(Q_CC_GNU)
     409        char drv = fileName.upper()[0].latin1();
     410        if ( _getdrive() != drv ) {
     411            char buf[PATH_MAX];
     412            _getcwd1( buf, drv );
     413#else
     414        int drv = fileName.upper()[0].latin1() - 'A' + 1;
     415        if ( _getdrive() != drv ) {
     416            char buf[PATH_MAX];
     417            _getdcwd( drv, buf, PATH_MAX );
     418#endif
     419            tmp = buf;
     420#else
    407421        int drv = fileName.upper()[0].latin1() - 'A' + 1;
    408422        if ( _getdrive() != drv ) {
     
    416430                tmp = buf;
    417431            } );
     432#endif
    418433            if ( !tmp.endsWith("\\") )
    419434                tmp += "\\";
     
    445460    "c:\winnt\system32".
    446461
     462    On OS/2, convertSeparators("c:/os2/system") returns
     463    "c:\os2\system".
     464   
    447465    The returned string may be the same as the argument on some
    448466    operating systems, for example on Unix.
     
    10831101/*!
    10841102    Returns the native directory separator; "/" under UNIX (including
    1085     Mac OS X) and "\" under Windows.
     1103    Mac OS X) and "\" under Windows and OS/2.
    10861104
    10871105    You do not need to use this function to build file paths. If you
     
    11261144    environment variable). If none of these exist "C:\" is used.
    11271145
     1146    Under OS/2 the \c HOME environment variable is also used. If it
     1147    does not exist the path is formed by concatenating the \c
     1148    HOMEDRIVE and \c HOMEPATH environment variables. If they don't
     1149    exist the rootDirPath() is used (which always returns "x:/" where \c x
     1150    is the system boot drive letter).
     1151   
    11281152    Under non-Windows operating systems the \c HOME environment
    11291153    variable is used if it exists, otherwise rootDirPath() is used.
  • trunk/src/tools/qfile.cpp

    r7 r8  
    139139
    140140    Qt uses Unicode file names. If you want to do your own I/O on Unix
    141     systems you may want to use encodeName() (and decodeName()) to
     141    and OS/2 systems you may want to use encodeName() (and decodeName()) to
    142142    convert the file name into the local encoding.
    143143
     
    565565/*!
    566566    When you use QFile, QFileInfo, and QDir to access the file system
    567     with Qt, you can use Unicode file names. On Unix, these file names
    568     are converted to an 8-bit encoding. If you want to do your own
    569     file I/O on Unix, you should convert the file name using this
     567    with Qt, you can use Unicode file names. On Unix and OS/2, these file
     568    names are converted to an 8-bit encoding. If you want to do your own
     569    file I/O on Unix or OS/2, you should convert the file name using this
    570570    function. On Windows NT/2000, Unicode file names are supported
    571571    directly in the file system and this function should be avoided.
  • trunk/src/tools/qfiledefs_p.h

    r7 r8  
    5454struct QFileInfoCache
    5555{
    56 #if defined(Q_WS_WIN)
     56#if defined(Q_WS_WIN) || defined(Q_OS_OS2)
    5757    QT_STATBUF st;
    5858#else
  • trunk/src/tools/qfileinfo.cpp

    r7 r8  
    6464    A QFileInfo can point to a file with either a relative or an
    6565    absolute file path. Absolute file paths begin with the directory
    66     separator "/" (or with a drive specification on Windows). Relative
     66    separator "/" (or with a drive specification on Windows and OS/2). Relative
    6767    file names begin with a directory name or a file name and specify
    6868    a path relative to the current working directory. An example of an
     
    130130    rights of the current user, you should use isReadable(), isWritable() and
    131131    isExecutable().
     132   
     133    @@TODO: describe OS/2 semantics regarding permissions.
    132134*/
    133135
     
    266268    The \a file can also include an absolute or relative file path.
    267269    Absolute paths begin with the directory separator (e.g. "/" under
    268     Unix) or a drive specification (under Windows). Relative file
     270    Unix) or a drive specification (under Windows and OS/2). Relative file
    269271    names begin with a directory name or a file name and specify a
    270272    path relative to the current directory.
     
    529531}
    530532
    531 #ifndef Q_WS_WIN
     533#if !defined(Q_WS_WIN) && !defined(Q_OS_OS2)
    532534bool QFileInfo::isHidden() const
    533535{
     
    654656    The absolute path name consists of the full path and the file
    655657    name. On Unix this will always begin with the root, '/',
    656     directory. On Windows this will always begin 'D:/' where D is a
     658    directory. On Windows and OS/2 this will always begin 'D:/' where D is a
    657659    drive letter, except for network shares that are not mapped to a
    658660    drive letter, in which case the path will begin '//sharename/'.
     
    672674    QString tmp;
    673675    if ( QDir::isRelativePath(fn)
    674 #if defined(Q_OS_WIN32)
     676#if defined(Q_OS_WIN32) || defined(Q_OS_OS2)
    675677         && fn[1] != ':'
    676678#endif
  • trunk/src/tools/qglobal.cpp

    r7 r8  
    4747#if defined(Q_CC_MSVC) && !defined(Q_CC_MSVC_NET) && !defined(Q_OS_TEMP)
    4848#include <crtdbg.h>
     49#endif
     50
     51#if defined(Q_OS_OS2)
     52#include "qt_os2.h"
    4953#endif
    5054
     
    359363    \endcode
    360364
    361     Under X11, the text is printed to stderr. Under Windows, the text
     365    Under X11 or OS/2, the text is printed to stderr. Under Windows, the text
    362366    is sent to the debugger.
    363367
     
    392396    \endcode
    393397
    394     Under X11, the text is printed to stderr. Under Windows, the text
     398    Under X11 or OS/2, the text is printed to stderr. Under Windows, the text
    395399    is sent to the debugger.
    396400
     
    426430    \endcode
    427431
    428     Under X11, the text is printed to stderr. Under Windows, the text
     432    Under X11 or OS/2, the text is printed to stderr. Under Windows, the text
    429433    is sent to the debugger.
    430434
     
    652656  error code will be used if possible. Use this method to handle
    653657  failures in platform specific API calls.
     658 
     659  Under OS/2, the value -1 for \a code should only be used after Presentation
     660  Manager calls.
    654661
    655662  This function does nothing when Qt is built with \c QT_NO_DEBUG
     
    689696    } );
    690697    LocalFree( (HLOCAL)string );
     698#elif defined(Q_OS_OS2)
     699    if ( code != -1 ) {
     700        CHAR buf [256] = {0};
     701        ULONG len = 0;
     702        APIRET rc = DosGetMessage( NULL, 0, buf, sizeof(buf) - 1, code, "OSO001.MSG", &len );
     703        if ( !rc ) {
     704            buf[len] = '\0';
     705            qWarning( "%s\n\tError %s", msg, buf );
     706        } else {
     707            if ( rc == ERROR_MR_MSG_TOO_LONG )
     708                qWarning(
     709                    "%s\n\tError code SYS%04d, "
     710                    "type help %d in the command prompt to get more information",
     711                    msg, code, code );
     712            else
     713                qWarning( "%s\n\tError code %d (system error)", msg, code );
     714        }
     715    } else {
     716        code = (int) WinGetLastError( 0 );
     717        if ( code )
     718            qWarning( "%s\n\tError code %08X (PM error)", msg, code );
     719        else
     720            qWarning( msg );
     721    }
    691722#else
    692723    if ( code != -1 )
     
    858889
    859890    The default message handler prints the message to the standard
    860     output under X11 or to the debugger under Windows. If it is a
     891    output under X11 and OS/2 or to the debugger under Windows. If it is a
    861892    fatal message, the application aborts immediately.
    862893
  • trunk/src/tools/qgpluginmanager.cpp

    r7 r8  
    315315        return;
    316316
    317 #if defined(Q_OS_WIN32)
     317#if defined(Q_OS_WIN32) || defined(Q_OS_OS2)
    318318    QString filter = "*.dll";
    319319#elif defined(Q_OS_MACX)
  • trunk/src/tools/qlibrary.cpp

    r7 r8  
    1 //depot/qt/3/src/tools/qlibrary.cpp#9 - edit change 123005 (text)
    21/****************************************************************************
    32** $Id$
     
    123122    QLibrary lib( "mylib.dll" );
    124123    \endcode
    125     on Windows, and
     124    on Windows and OS/2, and
    126125    \code
    127126    QLibrary lib( "libmylib.so" );
     
    178177    with a C++ compiler. On Windows you also have to explicitly export
    179178    the function from the DLL using the \c {__declspec(dllexport)}
    180     compiler directive.
     179    compiler directive. 
    181180
    182181    \code
     
    197196    \endcode
    198197
     198    On OS/2 you should create a .DEF file that describes what functions are
     199    exported and use it when linking your DLL (@@TODO: add more info and an
     200    example).
     201   
    199202    On Darwin and Mac OS X this function uses code from dlcompat, part of the
    200203    OpenDarwin project.
     
    385388    QString str = lib.library();
    386389    \endcode
    387     will set \e str to "mylib.dll" on Windows, and "libmylib.so" on Linux.
     390    will set \e str to "mylib.dll" on Windows and OS/2, and "libmylib.so" on Linux.
    388391*/
    389392QString QLibrary::library() const
     
    394397    QString filename = libfile;
    395398
    396 #if defined(Q_WS_WIN)
     399#if defined(Q_WS_WIN) || defined(Q_OS_OS2)
    397400    if ( filename.findRev( '.' ) <= filename.findRev( '/' ) )
    398401        filename += ".dll";
  • trunk/src/tools/qlibrary_p.h

    r7 r8  
    6464    QLibraryPrivate( QLibrary *lib );
    6565
    66 #ifdef Q_WS_WIN
     66#if defined(Q_WS_WIN)
    6767    HINSTANCE pHnd;
     68#elif defined(Q_OS_OS2)
     69    HMODULE pHnd;
    6870#else
    6971    void *pHnd;
  • trunk/src/tools/qlocale.cpp

    r7 r8  
    5353#      define isnan(d) _isnan(d)
    5454#   endif
    55 #endif
     55#elif defined(Q_OS_OS2) && defined(Q_CC_GNU)
     56#   undef NAN
     57#   undef INFINITY
     58#endif
     59
    5660
    5761#if !defined( QWS ) && defined( Q_OS_MAC )
  • trunk/src/tools/qsettings.cpp

    r7 r8  
    7474
    7575    On Unix systems, QSettings uses text files to store settings. On Windows
    76     systems, QSettings uses the system registry.  On Mac OS X, QSettings uses
    77     the Carbon preferences API.
     76    and OS/2 systems, QSettings uses the system registry.  On Mac OS X,
     77    QSettings uses the Carbon preferences API.
    7878
    7979    Each setting comprises an identifying key and the data associated with
     
    160160    \endcode
    161161
    162     Since settings for Windows are stored in the registry there are
     162    Since settings for Windows and OS/2 are stored in the registry there are
    163163    some size limitations as follows:
    164164    \list
     
    225225
    226226    For cross-platform applications you should ensure that the
    227     \link #sizelimit Windows size limitations \endlink are not exceeded.
     227    \link #sizelimit Windows and OS/2 size limitations \endlink are not exceeded.
    228228*/
    229229
     
    233233    \value Mac Macintosh execution environments
    234234    \value Unix Mac OS X, Unix, Linux and Unix-like execution environments
    235     \value Windows Windows execution environments
     235    \value Windows Windows and OS/2 execution environments
    236236*/
    237237
     
    333333        return;
    334334
    335 #ifndef Q_WS_WIN
     335#if !defined(Q_WS_WIN) && !defined(Q_WS_PM)
    336336    HANDLE lockfd = openlock( filename, Q_LOCKREAD );
    337337#endif
     
    356356    file.close();
    357357
    358 #ifndef Q_WS_WIN
     358#if !defined(Q_WS_WIN) && !defined(Q_WS_PM)
    359359    closelock( lockfd );
    360360#endif
     
    456456    : groupDirty( TRUE ), modified(FALSE), globalScope(TRUE)
    457457{
    458 #if !defined(QWS) && (defined(Q_WS_WIN) || defined(Q_OS_MAC))
     458#if !defined(QWS) && (defined(Q_WS_WIN) || defined(Q_WS_PM) || defined(Q_OS_MAC))
    459459    if ( format != QSettings::Ini )
    460460        return;
     
    697697
    698698  When \a s is \e Windows and the execution environment is \e not
    699   Windows the function does nothing. Similarly when \a s is \e Unix and
     699  Windows or OS/2 the function does nothing. Similarly when \a s is \e Unix and
    700700  the execution environment is \e not Unix the function does nothing.
    701701
    702   When \a s is \e Windows, and the execution environment is Windows, the
     702  When \a s is \e Windows, and the execution environment is Windows or OS/2, the
    703703  search path list will be used as the first subfolder of the "Software"
    704704  folder in the registry.
     
    781781void QSettings::insertSearchPath( System s, const QString &path)
    782782{
    783 #if !defined(QWS) && (defined(Q_WS_WIN) || defined(Q_OS_MAC))
     783#if !defined(QWS) && (defined(Q_WS_WIN) || defined(Q_WS_PM) || defined(Q_OS_MAC))
    784784    if ( d->sysd ) {
    785785        d->sysInsertSearchPath( s, path );
     
    788788#endif
    789789
    790 #if !defined(Q_WS_WIN)
     790#if !defined(Q_WS_WIN) && !defined(Q_WS_PM)
    791791    if ( s == Windows )
    792792        return;
    793793#endif
    794 #if !defined(Q_WS_WIN)
     794#if !defined(Q_WS_WIN) && !defined(Q_WS_PM)
    795795    if ( s == Mac )
    796796        return;
     
    804804    }
    805805
    806 #if !defined(QWS) && (defined(Q_WS_WIN) || defined(Q_OS_MAC))
     806#if !defined(QWS) && (defined(Q_WS_WIN) || defined(Q_WS_PM) || defined(Q_OS_MAC))
    807807    if ( d->sysd && s != Unix ) {
    808808#else
     
    816816
    817817    QString realPath = path;
    818 #if defined(Q_WS_WIN)
     818#if defined(Q_WS_WIN) || defined(Q_WS_PM)
    819819    QString defPath = d->globalScope ? d->searchPaths.first() : d->searchPaths.last();
    820820    realPath = defPath + path;
     
    844844    }
    845845
    846 #ifdef Q_WS_WIN
     846#if defined(Q_WS_WIN) || defined (Q_WS_PM)
    847847    if ( d->sysd ) {
    848848        d->sysRemoveSearchPath( s, path );
     
    850850    }
    851851#endif
    852 #if !defined(QWS) && (defined(Q_WS_WIN) || defined(Q_OS_MAC))
     852#if !defined(QWS) && (defined(Q_WS_WIN) || defined(Q_WS_PM) || defined(Q_OS_MAC))
    853853    if ( d->sysd && s != Unix ) {
    854854#else
     
    876876    Q_CHECK_PTR(d);
    877877
    878 #if !defined(QWS) && (defined(Q_WS_WIN) || defined(Q_OS_MAC))
     878#if !defined(QWS) && (defined(Q_WS_WIN) || defined(Q_WS_PM) || defined(Q_OS_MAC))
    879879    d->sysd = 0;
    880880    d->sysInit();
     
    893893    Q_CHECK_PTR(d);
    894894
    895 #if !defined(QWS) && (defined(Q_WS_WIN) || defined(Q_OS_MAC))
     895#if !defined(QWS) && (defined(Q_WS_WIN) || defined(Q_WS_PM) || defined(Q_OS_MAC))
    896896    d->sysd = 0;
    897897    if ( format == Native )
     
    911911    sync();
    912912
    913 #if !defined(QWS) && (defined(Q_WS_WIN) || defined(Q_OS_MAC))
     913#if !defined(QWS) && (defined(Q_WS_WIN) || defined(Q_WS_PM) || defined(Q_OS_MAC))
    914914    if ( d->sysd )
    915915        d->sysClear();
     
    926926bool QSettings::sync()
    927927{
    928 #if !defined(QWS) && (defined(Q_WS_WIN) || defined(Q_OS_MAC))
     928#if !defined(QWS) && (defined(Q_WS_WIN) || defined(Q_WS_PM) || defined(Q_OS_MAC))
    929929    if ( d->sysd )
    930930        return d->sysSync();
     
    981981        }
    982982
    983 #ifndef Q_WS_WIN
     983#if !defined(Q_WS_WIN) && !defined(Q_WS_PM)
    984984        HANDLE lockfd = openlock( filename, Q_LOCKWRITE );
    985985#endif
     
    10551055        file.remove();
    10561056
    1057 #ifndef Q_WS_WIN
     1057#if !defined(Q_WS_WIN) && !defined(Q_WS_PM)
    10581058        closelock( lockfd );
    10591059#endif
     
    10931093    }
    10941094
    1095 #if !defined(QWS) && (defined(Q_WS_WIN) || defined(Q_OS_MAC))
     1095#if !defined(QWS) && (defined(Q_WS_WIN) || defined(Q_WS_PM) || defined(Q_OS_MAC))
    10961096    if ( d->sysd )
    10971097        return d->sysReadBoolEntry( grp_key, def, ok );
     
    11451145    }
    11461146
    1147 #if !defined(QWS) && (defined(Q_WS_WIN) || defined(Q_OS_MAC))
     1147#if !defined(QWS) && (defined(Q_WS_WIN) || defined(Q_WS_PM) || defined(Q_OS_MAC))
    11481148    if ( d->sysd )
    11491149        return d->sysReadDoubleEntry( grp_key, def, ok );
     
    11901190    }
    11911191
    1192 #if !defined(QWS) && (defined(Q_WS_WIN) || defined(Q_OS_MAC))
     1192#if !defined(QWS) && (defined(Q_WS_WIN) || defined(Q_WS_PM) || defined(Q_OS_MAC))
    11931193    if ( d->sysd )
    11941194        return d->sysReadNumEntry( grp_key, def, ok );
     
    12361236    }
    12371237
    1238 #if !defined(QWS) && (defined(Q_WS_WIN) || defined(Q_OS_MAC))
     1238#if !defined(QWS) && (defined(Q_WS_WIN) || defined(Q_WS_PM) || defined(Q_OS_MAC))
    12391239    if ( d->sysd )
    12401240        return d->sysReadEntry( grp_key, def, ok );
     
    13111311    }
    13121312
    1313 #if !defined(QWS) && (defined(Q_WS_WIN) || defined(Q_OS_MAC))
     1313#if !defined(QWS) && (defined(Q_WS_WIN) || defined(Q_WS_PM) || defined(Q_OS_MAC))
    13141314    if ( d->sysd )
    13151315        return d->sysWriteEntry( grp_key, value );
     
    13421342    }
    13431343
    1344 #if !defined(QWS) && (defined(Q_WS_WIN) || defined(Q_OS_MAC))
     1344#if !defined(QWS) && (defined(Q_WS_WIN) || defined(Q_WS_PM) || defined(Q_OS_MAC))
    13451345    if ( d->sysd )
    13461346        return d->sysWriteEntry( grp_key, value );
     
    13721372    }
    13731373
    1374 #if !defined(QWS) && (defined(Q_WS_WIN) || defined(Q_OS_MAC))
     1374#if !defined(QWS) && (defined(Q_WS_WIN) || defined(Q_WS_PM) || defined(Q_OS_MAC))
    13751375    if ( d->sysd )
    13761376        return d->sysWriteEntry( grp_key, value );
     
    14251425    }
    14261426
    1427 #if !defined(QWS) && (defined(Q_WS_WIN) || defined(Q_OS_MAC))
     1427#if !defined(QWS) && (defined(Q_WS_WIN) || defined(Q_WS_PM) || defined(Q_OS_MAC))
    14281428    if ( d->sysd )
    14291429        return d->sysWriteEntry( grp_key, value );
     
    14861486    }
    14871487
    1488 #if !defined(QWS) && (defined(Q_WS_WIN) || defined(Q_OS_MAC))
     1488#if !defined(QWS) && (defined(Q_WS_WIN) || defined(Q_WS_PM) || defined(Q_OS_MAC))
    14891489    if ( d->sysd )
    14901490        return d->sysRemoveEntry( grp_key );
     
    15641564    }
    15651565
    1566 #if !defined(QWS) && (defined(Q_WS_WIN) || defined(Q_OS_MAC))
     1566#if !defined(QWS) && (defined(Q_WS_WIN) || defined(Q_WS_PM) || defined(Q_OS_MAC))
    15671567    if ( d->sysd )
    15681568        return d->sysEntryList( grp_key );
     
    16601660    }
    16611661
    1662 #if !defined(QWS) && (defined(Q_WS_WIN) || defined(Q_OS_MAC))
     1662#if !defined(QWS) && (defined(Q_WS_WIN) || defined(Q_WS_PM) || defined(Q_OS_MAC))
    16631663    if ( d->sysd )
    16641664        return d->sysSubkeyList( grp_key );
     
    17531753    }
    17541754
    1755 #if !defined(QWS) && (defined(Q_WS_WIN) || defined(Q_OS_MAC))
     1755#if !defined(QWS) && (defined(Q_WS_WIN) || defined(Q_WS_PM) || defined(Q_OS_MAC))
    17561756    if ( d->sysd )
    17571757        return QDateTime();
     
    19611961void QSettings::setPath( const QString &domain, const QString &product, Scope scope )
    19621962{
    1963 //    On Windows, any trailing ".com(\..*)" is stripped from the domain. The
     1963//    On Windows and OS/2, any trailing ".com(\..*)" is stripped from the domain. The
    19641964//    Global scope corresponds to HKEY_LOCAL_MACHINE, and User corresponds to
    19651965//    HKEY_CURRENT_USER. Note that on some installations, not all users can
     
    19821982    int lastDot = domain.findRev( '.' );
    19831983
    1984 #if defined(Q_WS_WIN)
     1984#if defined(Q_WS_WIN) || defined(Q_WS_PM)
    19851985    actualSearchPath = "/" + domain.mid( 0, lastDot ) + "/" + product;
    19861986    insertSearchPath( Windows, actualSearchPath );
  • trunk/src/tools/qsettings_p.h

    r7 r8  
    106106    bool globalScope :1;
    107107
    108 #if !defined(QWS) && (defined(Q_WS_WIN) || defined(Q_OS_MAC))
     108#if !defined(QWS) && (defined(Q_WS_WIN) || defined(Q_WS_PM) || defined(Q_OS_MAC))
    109109    // system dependent implementations to use the
    110110    // system specific setting database (ie. registry on Windows)
  • trunk/src/tools/qstring.cpp

    r7 r8  
    6262#if defined(Q_WS_WIN)
    6363#include "qt_windows.h"
     64#endif
     65#if defined(Q_OS_OS2)
     66#include <unidef.h>
     67#include <uconv.h>
    6468#endif
    6569#if !defined( QT_NO_COMPONENT ) && !defined( QT_LITE_COMPONENT )
     
    57015705/*!
    57025706    Returns the string encoded in a locale-specific format. On X11,
    5703     this is the QTextCodec::codecForLocale(). On Windows, it is a
     5707    this is the QTextCodec::codecForLocale(). On Windows and OS/2, it is a
    57045708    system-defined encoding. On Mac OS X, this always uses UTF-8 as
    57055709    the encoding.
     
    57315735    return isNull() ? QCString("") : qt_winQString2MB( *this );
    57325736#endif
     5737#if defined(Q_OS_OS2)
     5738    return isNull() ? QCString("") : qt_os2QString2MB( *this );
     5739#endif
    57335740#ifdef Q_WS_QWS
    57345741    return utf8(); // ### if there is any 8 bit format supported?
     
    57805787    return qt_winMB2QString( local8Bit );
    57815788#endif
     5789#if defined(Q_OS_OS2)
     5790    return qt_os2MB2QString( local8Bit, len );
     5791#endif
    57825792#ifdef Q_WS_QWS
    57835793    return fromUtf8(local8Bit,len);
     
    61936203        return 0;
    61946204    }
     6205#elif defined(Q_OS_OS2)
     6206    LocaleObject lo = qt_os2DefLocaleObj();
     6207    if (lo)
     6208        return UniStrcoll( lo, (UniChar*) ucs2(), (UniChar *) s.ucs2() );
     6209    else
     6210        return ucstrcmp( *this, s );
    61956211#elif defined(Q_WS_MACX)
    61966212    int delta = 0;
     
    69286944
    69296945#endif // Q_OS_WIN32
     6946
     6947#if defined (Q_OS_OS2)
     6948
     6949static LocaleObject qt_os2DefLocaleObj_var = NULL;
     6950static UconvObject qt_os2DefUconvObj_var = NULL;
     6951
     6952const LocaleObject qt_os2DefLocaleObj()
     6953{
     6954    if ( !qt_os2DefLocaleObj_var )
     6955        UniCreateLocaleObject( UNI_UCS_STRING_POINTER, (UniChar *)L"",
     6956                &qt_os2DefLocaleObj_var );
     6957    return qt_os2DefLocaleObj_var;
     6958}
     6959
     6960const UconvObject qt_os2DefUconvObj()
     6961{
     6962    if ( !qt_os2DefUconvObj_var )
     6963        UniCreateUconvObject( (UniChar *)L"", &qt_os2DefUconvObj_var );
     6964    return qt_os2DefUconvObj_var;
     6965}
     6966
     6967QCString qt_os2QString2MB( const QString& s, int uclen )
     6968{
     6969    if ( uclen < 0 || (uint) uclen > s.length() )
     6970        uclen = s.length();
     6971    if ( s.isNull() )
     6972        return QCString();
     6973    if ( uclen == 0 )
     6974        return QCString("");
     6975
     6976    UniChar *ucPtr = (UniChar *) s.unicode();
     6977    size_t ucLeft = uclen;
     6978   
     6979    size_t mblen = uclen;
     6980    QCString mbBuf( mblen + 1 );
     6981    char *mbPtr = mbBuf.data();
     6982    size_t mbLeft = mblen;
     6983   
     6984    size_t nonIdent = 0;
     6985    UconvObject uo = qt_os2DefUconvObj();
     6986    int rc;
     6987   
     6988    while ( ucLeft ) {
     6989        rc = UniUconvFromUcs ( uo, &ucPtr, &ucLeft, (void**)&mbPtr, &mbLeft, &nonIdent );
     6990        if ( rc == ULS_BUFFERFULL ) {
     6991            size_t mbDone = mblen - mbLeft;
     6992            size_t ucDone = uclen - ucLeft;
     6993            // assume that ucLeft/mbLeft is an approximation of ucDone/mbDone
     6994            mblen = mbDone + (ucLeft * mbDone) / ucDone;
     6995            mbBuf.resize( mblen + 1 );
     6996            mbPtr = mbBuf.data() + mbDone;
     6997        } else if ( rc != ULS_SUCCESS ) {
     6998#ifndef QT_NO_DEBUG
     6999            // Fail.
     7000            qWarning("UniUconvFromUcs cannot convert multibyte text (error %d): %s (UTF8)",
     7001                rc, s.utf8().data());
     7002#endif
     7003            break;
     7004        }
     7005    }
     7006    mbBuf[ mblen - mbLeft ] = '\0';
     7007    return mbBuf;
     7008}
     7009
     7010// WATCH OUT: mblen must NOT include the NUL (in contrast with qt_winMB2QString)
     7011QString qt_os2MB2QString( const char* mb, int mblen )
     7012{
     7013    if ( !mb )
     7014        return QString::null;
     7015    if ( mblen < 0 ) {
     7016        mblen = strlen( mb );
     7017    } else {
     7018        char *end = (char *) memchr (mb, '\0', mblen);
     7019        if ( end )
     7020            mblen = end - mb;
     7021    }
     7022    if ( !mblen )
     7023        return QString::null;
     7024   
     7025    const char *mbPtr = mb;
     7026    size_t mbLeft = mblen;
     7027
     7028    size_t uclen = mblen;
     7029    QMemArray<UniChar> ucBuf( uclen );
     7030    UniChar *ucPtr = ucBuf.data();
     7031    size_t ucLeft = uclen;
     7032
     7033    size_t nonIdent = 0;
     7034    UconvObject uo = qt_os2DefUconvObj();
     7035    int rc;
     7036   
     7037    while ( mbLeft ) {
     7038        rc = UniUconvToUcs ( uo, (void**)&mbPtr, &mbLeft, &ucPtr, &ucLeft, &nonIdent );
     7039        if ( rc == ULS_BUFFERFULL ) {
     7040            size_t ucDone = uclen - ucLeft;
     7041            size_t mbDone = mblen - mbLeft;
     7042            // assume that mbLeft/ucLeft is an approximation of mbDone/ucDone
     7043            uclen = ucDone + (mbLeft * ucDone) / mbDone;
     7044            ucBuf.resize( uclen );
     7045            ucPtr = ucBuf.data() + ucDone;
     7046        } else if ( rc != ULS_SUCCESS ) {
     7047#ifndef QT_NO_DEBUG
     7048            // Fail.
     7049            qWarning("UniUconvFromUcs cannot convert multibyte text (error %d)", rc);
     7050#endif
     7051            break;
     7052        }
     7053    }
     7054    uclen -= ucLeft;
     7055    if ( uclen == 0 )
     7056        return QString::null;
     7057    QString s( (QChar*)ucBuf.data(), uclen );
     7058    return s;
     7059}
     7060
     7061#endif // Q_OS_OS2
  • trunk/src/tools/qt_tools.pri

    r7 r8  
    9191        }
    9292
     93        os2:SOURCES += $$TOOLS_CPP/qdir_pm.cpp \
     94                  $$TOOLS_CPP/qfile_pm.cpp \
     95                  $$TOOLS_CPP/qfileinfo_pm.cpp \
     96                  $$TOOLS_CPP/qlibrary_pm.cpp \
     97                  $$TOOLS_CPP/qsettings_pm.cpp \
     98                  $$TOOLS_CPP/qmutex_pm.cpp \
     99                  $$TOOLS_CPP/qwaitcondition_pm.cpp \
     100                  $$TOOLS_CPP/qthreadstorage_pm.cpp \
     101                  $$TOOLS_CPP/qcriticalsection_p.cpp
     102
    93103        offmac:SOURCES += $$TOOLS_CPP/qdir_mac.cpp \
    94104                  $$TOOLS_CPP/qfile_mac.cpp \
     
    102112
    103113        mac:!x11:!embedded:SOURCES += $$TOOLS_CPP/qsettings_mac.cpp
    104         mac { 
     114        mac {
    105115                SOURCES+=3rdparty/dlcompat/dlfcn.c
    106116                INCLUDEPATH+=3rdparty/dlcompat
     
    149159        }
    150160}
    151 
  • trunk/src/tools/qthreadinstance_p.h

    r7 r8  
    8888    static void finish( QThreadInstance * );
    8989#endif // Q_OS_WIN32
     90
     91#ifdef Q_OS_OS2
     92    TID thread_id;
     93    int waiters;
     94
     95    static void _System start( void * );
     96    static void finish( QThreadInstance * );
     97#endif // Q_OS_OS2
    9098};
    9199
Note: See TracChangeset for help on using the changeset viewer.