Changeset 8 for trunk/src


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
Files:
29 added
69 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/3rdparty/zlib/zlib.h

    r7 r8  
    4040#define ZLIB_VERSION "1.1.4"
    4141
     42#ifdef Q_OS_WIN
    4243#ifdef QT_MAKEDLL
    4344#define Q_ZEXPORT __declspec(dllexport)
     
    4849#define Q_ZEXPORT ZEXPORT
    4950#endif
     51#endif
     52#else
     53#define Q_ZEXPORT ZEXPORT
    5054#endif
    5155#ifdef Q_OS_TEMP
  • trunk/src/codecs/qtextcodec.cpp

    r7 r8  
    562562
    563563
    564 #ifdef Q_OS_WIN32
     564#if defined(Q_OS_WIN32)
    565565class QWindowsLocalCodec: public QTextCodec
    566566{
     
    621621
    622622int QWindowsLocalCodec::heuristicContentMatch(const char* chars, int len) const
     623{
     624    // ### Not a bad default implementation?
     625    QString t = toUnicode(chars,len);
     626    int l = t.length();
     627    QCString mb = fromUnicode(t,l);
     628    int i=0;
     629    while ( i < len ) {
     630        if ( chars[i] == mb[i] )
     631            i++;
     632       else
     633           break;
     634    }
     635    return i;
     636}
     637
     638#elif defined(Q_OS_OS2)
     639
     640class QOS2LocalCodec: public QTextCodec
     641{
     642public:
     643    QOS2LocalCodec();
     644    ~QOS2LocalCodec();
     645
     646    QString toUnicode(const char* chars, int len) const;
     647    QCString fromUnicode(const QString& uc, int& lenInOut ) const;
     648
     649    const char* name() const;
     650    int mibEnum() const;
     651
     652    int heuristicContentMatch(const char* chars, int len) const;
     653};
     654
     655QOS2LocalCodec::QOS2LocalCodec()
     656{
     657}
     658
     659QOS2LocalCodec::~QOS2LocalCodec()
     660{
     661}
     662
     663
     664QString QOS2LocalCodec::toUnicode(const char* chars, int len) const
     665{
     666    return qt_os2MB2QString( chars, len );
     667}
     668
     669QCString QOS2LocalCodec::fromUnicode(const QString& uc, int& lenInOut ) const
     670{
     671    QCString r = qt_os2QString2MB( uc, lenInOut );
     672    lenInOut = r.length();
     673    return r;
     674}
     675
     676
     677const char* QOS2LocalCodec::name() const
     678{
     679    return "System";
     680}
     681
     682int QOS2LocalCodec::mibEnum() const
     683{
     684    return 0;
     685}
     686
     687
     688int QOS2LocalCodec::heuristicContentMatch(const char* chars, int len) const
    623689{
    624690    // ### Not a bad default implementation?
     
    26922758static void setupLocaleMapper()
    26932759{
    2694 #ifdef Q_OS_WIN32
     2760#if defined(Q_OS_WIN32) || defined(Q_OS_OS2)
    26952761    localeMapper = QTextCodec::codecForName( "System" );
    26962762#else
     
    28552921#endif // Q_OS_WIN32
    28562922
     2923#ifdef Q_OS_OS2
     2924    (void) new QOS2LocalCodec;
     2925#endif // Q_OS_OS2
     2926
    28572927    if ( !localeMapper )
    28582928        setupLocaleMapper();
  • trunk/src/dialogs/qfiledialog.cpp

    r7 r8  
    991991                return 1;
    992992
    993 #if defined(Q_OS_WIN32)
     993#if defined(Q_OS_WIN32) || defined(Q_OS_OS2)
    994994            if ( sortFilesBy == QDir::Name ) {
    995995                QString name1 = i1->name().lower();
     
    36933693            if ( !nameEdit->text().contains( "/" ) &&
    36943694                 !nameEdit->text().contains( "\\" )
    3695 #if defined(Q_OS_WIN32)
     3695#if defined(Q_OS_WIN32) || defined(Q_OS_OS2)
    36963696                 && nameEdit->text()[ 1 ] != ':'
    36973697#endif
     
    37003700            else if ( nameEdit->text()[ 0 ] == '/' ||
    37013701                      nameEdit->text()[ 0 ] == '\\'
    3702 #if defined(Q_OS_WIN32)
     3702#if defined(Q_OS_WIN32) || defined(Q_OS_OS2)
    37033703                      || nameEdit->text()[ 1 ] == ':'
    37043704#endif
     
    45974597void QFileDialog::done( int i )
    45984598{
     4599    // stop any pending operations
     4600    d->url.stop();
     4601   
    45994602    if ( i == QDialog::Accepted && (d->mode == ExistingFile || d->mode == ExistingFiles) ) {
    46004603        QStringList selection = selectedFiles();
     
    53395342        if ( ( nameEdit->cursorPosition() == (int)nameEdit->text().length() || nameEdit->hasSelectedText() ) &&
    53405343             isprint(((QKeyEvent *)e)->ascii()) ) {
    5341 #if defined(Q_WS_WIN)
     5344#if defined(Q_WS_WIN) || defined(Q_OS_OS2)
    53425345            QString nt( nameEdit->text().lower() );
    53435346#else
     
    53475350            nt += (char)(((QKeyEvent *)e)->ascii());
    53485351            QListViewItem * i = files->firstChild();
    5349 #if defined(Q_WS_WIN)
     5352#if defined(Q_WS_WIN) || defined(Q_OS_OS2)
    53505353            while( i && i->text( 0 ).left(nt.length()).lower() != nt )
    53515354#else
     
    56435646    if ( u.path() == "/" )
    56445647        return TRUE;
    5645 #elif defined(Q_OS_WIN32)
     5648#elif defined(Q_OS_WIN32) || defined(Q_OS_OS2)
    56465649    QString p = u.path();
    56475650    if ( p.length() == 3 &&
     
    57025705        bool found = FALSE;
    57035706        for ( int i = 0; i < d->paths->count(); ++i ) {
    5704 #if defined(Q_WS_WIN)
     5707#if defined(Q_WS_WIN) || defined(Q_OS_OS2)
    57055708            if ( d->paths->text( i ).lower() == s.lower() ) {
    57065709#else
     
    57695772        if ( !d->hadDotDot && !isRoot( d->url ) ) {
    57705773            bool ok = TRUE;
    5771 #if defined(Q_WS_WIN)
     5774#if defined(Q_WS_WIN) || defined(Q_OS_OS2)
    57725775            if ( d->url.path().left( 2 ) == "//" )
    57735776                ok = FALSE;
     
    58575860            if ( isRoot( d->url ) )
    58585861                continue;
    5859 #if defined(Q_WS_WIN)
     5862#if defined(Q_WS_WIN) || defined(Q_OS_OS2)
    58605863            if ( d->url.path().left( 2 ) == "//" )
    58615864                continue;
     
    58855888            }
    58865889        }
     5890#elif defined(Q_OS_OS2)
     5891        if ( !bShowHiddenFiles ) {
     5892            if ( d->url.isLocalFile() ) {
     5893                QString file = d->url.path();
     5894                if ( !file.endsWith( "/" ) )
     5895                    file.append( "/" );
     5896                file += inf.name();
     5897                if ( QFileInfo( file ).isHidden() )
     5898                    continue;
     5899            } else {
     5900                if ( inf.name() != ".." && inf.name()[0] == QChar('.') )
     5901                    continue;
     5902            }
     5903        }
    58875904#else
    58885905        if ( !bShowHiddenFiles && inf.name() != ".." ) {
  • trunk/src/dialogs/qmessagebox.cpp

    r7 r8  
    5353#include "qnc_win.h"
    5454#endif
    55 
     55#if defined(Q_WS_PM)
     56//@@TODO (dmik): this is necessary for WinAlarm() which will be
     57//  probably removed from here later.
     58#include "qt_os2.h"
     59#endif
    5660
    5761// Internal class - don't touch
     
    592596            "<p>Qt provides single-source "
    593597            "portability across MS&nbsp;Windows, Mac&nbsp;OS&nbsp;X, "
     598            "IBM&nbsp;OS/2&nbsp;Warp and eComStation, "
    594599            "Linux, and all major commercial Unix variants."
    595600            "<br>Qt is also available for embedded devices.</p>"
     
    10341039#if defined(QT_ACCESSIBILITY_SUPPORT)
    10351040    QAccessible::updateAccessibility( this, 0, QAccessible::Alert );
     1041#else
     1042#if defined(Q_WS_PM)
     1043//@@TODO (dmik): currently, the accessibility support is not implemented
     1044//  on OS/2, but we still need to play a sound when QMessageBox is opened.
     1045    ULONG alarmStyle;
     1046    bool playAlarm = TRUE;
     1047    switch ( icon() ) {
     1048        case Warning:
     1049            alarmStyle = WA_WARNING;
     1050            break;
     1051        case Critical:
     1052            alarmStyle = WA_ERROR;
     1053            break;
     1054        case Information:
     1055            alarmStyle = WA_NOTE;
     1056            break;
     1057        default:
     1058            playAlarm = FALSE;
     1059            break;
     1060    }
     1061    if ( playAlarm )
     1062        WinAlarm( HWND_DESKTOP, alarmStyle );
     1063#endif
    10361064#endif
    10371065    QDialog::showEvent( e );
  • trunk/src/kernel/qapplication.cpp

    r7 r8  
    739739  If \a GUIenabled is FALSE, the application does not connect to the
    740740  X-server.
    741   On Windows and Macintosh, currently the window system is always
     741  On Windows, OS/2 and Macintosh, currently the window system is always
    742742  initialized, regardless of the value of GUIenabled. This may change in
    743743  future versions of Qt.
     
    12321232            else
    12331233                style = "Windows";              // default styles for Windows
     1234#elif defined(Q_WS_PM)
     1235            /// @todo (dmik) temporary, until the native style is done
     1236            style = "Windows";          // default style for OS/2
    12341237#elif defined(Q_WS_X11) && defined(Q_OS_SOLARIS)
    12351238            style = "CDE";                      // default style for X11 on Solaris
     
    15411544}
    15421545
    1543 #ifdef Q_WS_WIN
     1546#if defined(Q_WS_WIN) || defined(Q_WS_PM)
    15441547extern const char *qAppFileName();
    15451548#endif
    15461549
    15471550#ifndef QT_NO_DIR
    1548 #ifndef Q_WS_WIN
     1551#if !defined(Q_WS_WIN) && !(defined Q_WS_PM)
    15491552static QString resolveSymlinks( const QString& path, int depth = 0 )
    15501553{
     
    15901593    }
    15911594}
    1592 #endif // Q_WS_WIN
     1595#endif // !Q_WS_WIN && !Q_WS_PM
    15931596
    15941597/*!
     
    16271630QString QApplication::applicationFilePath()
    16281631{
    1629 #ifdef Q_WS_WIN
     1632#if defined(Q_WS_WIN) || defined(Q_WS_PM)
    16301633    return QDir::cleanDirPath( QFile::decodeName( qAppFileName() ) );
    16311634#else
     
    17061709        QString installPathPlugins = QString::fromLocal8Bit(qInstallPathPlugins());
    17071710        if ( QFile::exists(installPathPlugins) ) {
    1708 #ifdef Q_WS_WIN
     1711#if defined(Q_WS_WIN) || defined(Q_WS_PM)
    17091712            installPathPlugins.replace('\\', '/');
    17101713#endif
     
    17151718        if (qApp)
    17161719            app_location = qApp->applicationFilePath();
    1717 #ifdef Q_WS_WIN
     1720#if defined(Q_WS_WIN) || defined(Q_WS_PM)
    17181721        else {
    17191722            app_location = QString(qAppFileName());
  • trunk/src/kernel/qclipboard.cpp

    r7 r8  
    155155}
    156156
    157 #ifndef Q_WS_WIN32
     157#if !defined(Q_WS_WIN32) && !defined(Q_WS_PM)
    158158/*!
    159159    \internal
     
    173173
    174174    This signal is emitted when the clipboard data is changed.
     175   
     176    \note On OS/2, this signal is guaranteed to be emitted only if no other
     177    non-Qt applications (for example, the standard Clipboard Viewer shipped
     178    with OS/2) register themselves as clipboard viewers -- this is the
     179    limitation of the Presentation Manager, not Qt. Reconnecting this signal
     180    to a slot will restore its functionality (until another non-Qt application
     181    will again register itself as the clipboard viewer).
    175182*/
    176183
  • trunk/src/kernel/qcolor.cpp

    r7 r8  
    162162#define COLOR0_PIX 0x00ffffff
    163163#define COLOR1_PIX 0
     164#elif defined(Q_WS_PM)
     165#define COLOR0_PIX (uint)CLR_FALSE
     166#define COLOR1_PIX (uint)CLR_TRUE
    164167#else
    165168#define COLOR0_PIX 0
     
    871874        return ((QColor*)this)->alloc();
    872875    else if ( colormodel == d8 )
    873 #ifdef Q_WS_WIN
     876#if defined(Q_WS_WIN)
    874877        // since d.d8.pix is uchar we have to use the PALETTEINDEX
    875878        // macro to get the respective palette entry index.
    876879        return (0x01000000 | (int)(short)(d.d8.pix));
     880#elif defined(Q_WS_PM)
     881        // the code below allows us to use negative color values (such as
     882        // CLR_WHITE) in range from -1 to -128 as direct pixel colors (i.e.
     883        // set using setPixel()) keeping their special meening.
     884        if ( d.d8.direct )
     885            return (int) ((char) d.d8.pix);
     886        else
     887            return d.d8.pix;
    877888#else
    878889        return d.d8.pix;
  • trunk/src/kernel/qdragobject.cpp

    r7 r8  
    838838            return r;
    839839        QString text( d->txt );
    840 #if defined(Q_WS_WIN)
     840#if defined(Q_WS_WIN) || defined(Q_WS_PM)
    841841        int index = text.find( QString::fromLatin1("\r\n"), 0 );
    842842        while ( index != -1 ) {
     
    14931493        return QCString();
    14941494
    1495 #ifdef Q_WS_WIN
     1495#if defined(Q_WS_WIN) || defined(Q_WS_PM)
    14961496
    14971497
     
    16031603                file.insert(0,'/');
    16041604        }
    1605 #ifdef Q_WS_WIN
     1605#if defined(Q_WS_WIN) || defined(Q_WS_PM)
    16061606        if ( file.length() > 2 && file[0] == '/' && file[2] == '|' ) {
    16071607            file[2] = ':';
     
    16131613#endif
    16141614    }
    1615 #ifdef Q_WS_WIN
     1615#if defined(Q_WS_WIN) || defined(Q_WS_PM)
    16161616    else {
    16171617        file = uriToUnicodeUri(uri);
  • trunk/src/kernel/qeventloop_p.h

    r7 r8  
    6060#endif
    6161
    62 #if defined(Q_OS_UNIX) || defined (Q_WS_WIN)
     62#if defined(Q_OS_UNIX) || defined(Q_WS_WIN) || defined(Q_WS_PM)
    6363#include "qptrlist.h"
    64 #endif // Q_OS_UNIX || Q_WS_WIN
     64#endif // Q_OS_UNIX || Q_WS_WIN || Q_WS_PM
    6565
    66 #if defined(Q_OS_UNIX)
     66#if defined(Q_OS_UNIX) || defined(Q_WS_PM)
    6767struct QSockNot
    6868{
     
    8686#endif // Q_OS_UNIX
    8787
    88 #if defined(Q_WS_WIN)
     88#if defined(Q_WS_WIN) 
    8989struct QSockNot {
    9090    QSocketNotifier *obj;
     
    124124#endif // Q_WS_X11
    125125
    126 #if defined(Q_OS_UNIX)
     126#if defined(Q_OS_UNIX) 
    127127    int thread_pipe[2];
    128 
     128#endif
     129#if defined(Q_OS_UNIX) || defined(Q_WS_PM)
    129130    // pending socket notifiers list
    130131    QPtrList<QSockNot> sn_pending_list;
     
    135136#endif
    136137
    137 #ifdef Q_WS_WIN
     138#if defined(Q_WS_WIN)
    138139    // pending socket notifiers list
    139140    QPtrList<QSockNot> sn_pending_list;
    140141#endif // Q_WS_WIN
    141142
     143#if defined(Q_WS_PM)
     144    HAB hab;
     145    HMQ hmq;
     146#endif
     147
    142148};
    143149
  • trunk/src/kernel/qfont.cpp

    r7 r8  
    13941394        "courier",      "Courier New",
    13951395        "helvetica",    "Arial",
     1396#elif defined(Q_WS_PM)
     1397        "times",        "Times New Roman",
    13961398#endif
    1397 
    13981399        0,              0
    13991400    };
     
    31003101}
    31013102
    3102 #if defined(Q_WS_WIN ) || defined (Q_WS_QWS)
     3103#if defined(Q_WS_WIN) || defined(Q_WS_PM) || defined (Q_WS_QWS)
    31033104void QFontCache::cleanupPrinterFonts()
    31043105{
  • trunk/src/kernel/qfontdata_p.h

    r7 r8  
    101101        if ( family != other.family ) return family < other.family;
    102102
    103 #ifdef Q_WS_X11
     103#if defined(Q_WS_X11)
    104104        if ( addStyle != other.addStyle ) return addStyle < other.addStyle;
    105 #endif // Q_WS_X11
    106 
     105#elif defined(Q_WS_PM)
     106        if ( pointSize != other.pointSize ) return pointSize < other.pointSize;
     107#endif
    107108        return FALSE;
    108109    }
     
    242243    void insertEngine( const Key &key, QFontEngine *engine );
    243244
    244 #if defined(Q_WS_WIN) || defined(Q_WS_QWS)
     245#if defined(Q_WS_WIN) || defined(Q_WS_PM) || defined(Q_WS_QWS)
    245246    void cleanupPrinterFonts();
    246247#endif
  • trunk/src/kernel/qfontdatabase.cpp

    r7 r8  
    7171#endif
    7272
     73#define SMOOTH_SCALABLE 0xffff
     74
    7375static int ucstricmp( const QString &as, const QString &bs )
    7476{
     
    138140    unsigned short pixelSize;
    139141
     142#ifdef Q_WS_PM
     143    unsigned short pointSize;                   // in deca-points
     144    LONG lMatch;
     145#endif
    140146#ifdef Q_WS_X11
    141147    int count;
     
    206212          fakeOblique( FALSE ), count( 0 ), pixelSizes( 0 )
    207213    {
    208 #if defined(Q_WS_X11)
     214#if defined(Q_WS_PM)
     215        szFacename[0] = 0;
     216#elif defined(Q_WS_X11)
    209217        weightName = setwidthName = 0;
    210 #endif // Q_WS_X11
     218#endif
    211219    }
    212220
     
    228236    QtFontSize *pixelSizes;
    229237
     238#ifdef Q_WS_PM
     239    CHAR szFacename [FACESIZE];
     240#endif
    230241#ifdef Q_WS_X11
    231242    const char *weightName;
     
    233244#endif // Q_WS_X11
    234245
     246#ifdef Q_WS_PM
     247    QtFontSize *pixelSize(
     248        unsigned short size, bool = FALSE, unsigned short pointSize = 0 );
     249#else   
    235250    QtFontSize *pixelSize( unsigned short size, bool = FALSE );
     251#endif   
    236252};
    237253
     
    247263}
    248264
     265#ifdef Q_WS_PM
     266QtFontSize *QtFontStyle::pixelSize(
     267    unsigned short size, bool add, unsigned short pointSize )
     268#else
    249269QtFontSize *QtFontStyle::pixelSize( unsigned short size, bool add )
     270#endif
    250271{
    251272    for ( int i = 0; i < count; i++ ) {
     273#ifdef Q_WS_PM
     274        if (
     275            pixelSizes[i].pixelSize == size &&
     276            (
     277                size == SMOOTH_SCALABLE ||
     278                !pointSize ||
     279                pixelSizes[i].pointSize == pointSize
     280            )
     281        )
     282#else       
    252283        if ( pixelSizes[i].pixelSize == size )
     284#endif           
    253285            return pixelSizes + i;
    254286    }
     
    261293                              (((count+8) >> 3 ) << 3) * sizeof(QtFontSize) );
    262294    pixelSizes[count].pixelSize = size;
     295#ifdef Q_WS_PM
     296    pixelSizes[count].pointSize = pointSize;
     297    pixelSizes[count].lMatch = 0;
     298#endif
    263299#ifdef Q_WS_X11
    264300    pixelSizes[count].count = 0;
     
    336372          name( n ), count( 0 ), foundries( 0 ) {
    337373        memset( scripts, 0, sizeof( scripts ) );
     374#ifdef Q_WS_PM
     375//@@TODO (dmik): temporary solution to let QFontDialog work:
     376//  at least UnknownScript is supported.
     377        scripts[QFont::UnknownScript] = Supported;
     378#endif       
    338379    }
    339380    ~QtFontFamily() {
     
    357398    bool fullyLoaded : 1;
    358399    QString name;
     400#ifndef Q_WS_X11
    359401    QString rawName;
     402#endif   
    360403#ifdef Q_WS_X11
    361404    QCString fontFilename;
     
    393436class QFontDatabasePrivate {
    394437public:
    395     QFontDatabasePrivate() : count( 0 ), families( 0 ) { }
     438    QFontDatabasePrivate() :
     439        count( 0 ), families( 0 ) { }
    396440    ~QFontDatabasePrivate() {
     441#ifdef Q_WS_PM
     442        cleanup();
     443#else
    397444        while ( count-- )
    398445            delete families[count];
    399446        free( families );
     447#endif
    400448    }
    401449    QtFontFamily *family( const QString &f, bool = FALSE );
     
    403451    int count;
    404452    QtFontFamily **families;
     453
     454#ifdef Q_WS_PM
     455    static QFontDatabasePrivate* instance();
     456private:   
     457    void cleanup() {
     458        while ( count )
     459            delete families[--count];
     460        free( families );
     461        families = 0;
     462    }
     463    void reload();
     464#endif
    405465};
    406466
     
    627687
    628688static QSingleCleanupHandler<QFontDatabasePrivate> qfontdatabase_cleanup;
     689#ifdef Q_WS_PM
     690QFontDatabasePrivate* QFontDatabasePrivate::instance()
     691{
     692    static QFontDatabasePrivate *db = 0;
     693    if ( !db ) {
     694        db = new QFontDatabasePrivate;
     695        qfontdatabase_cleanup.set(&db);
     696        db->reload();
     697    }
     698    return db;
     699}
     700#else
    629701static QFontDatabasePrivate *db=0;
    630 #define SMOOTH_SCALABLE 0xffff
     702#endif
    631703
    632704#if defined( Q_WS_X11 )
     
    636708#elif defined( Q_WS_WIN )
    637709#  include "qfontdatabase_win.cpp"
     710#elif defined( Q_WS_PM )
     711#  include "qfontdatabase_pm.cpp"
    638712#elif defined( Q_WS_QWS )
    639713#  include "qfontdatabase_qws.cpp"
     
    643717
    644718
    645 #if defined(Q_WS_X11) || defined(Q_WS_WIN)
     719#if defined(Q_WS_X11) || defined(Q_WS_WIN) || defined(Q_WS_PM)
    646720static
    647721unsigned int bestFoundry( QFont::Script script, unsigned int score, int styleStrategy,
     
    650724                          QtFontFoundry **best_foundry, QtFontStyle **best_style,
    651725                          QtFontSize **best_size
    652 #ifdef Q_WS_X11
     726#if defined(Q_WS_X11)
    653727                          , QtFontEncoding **best_encoding, int force_encoding_id
     728#elif defined(Q_WS_PM)
     729                          , int pointSize
    654730#endif
    655731                          )
     
    711787        // 1. see if we have an exact matching size
    712788        if (! (styleStrategy & QFont::ForceOutline)) {
     789#if defined(Q_WS_PM)
     790            size = style->pixelSize(pixelSize, FALSE, pointSize);
     791#else           
    713792            size = style->pixelSize(pixelSize);
     793#endif           
    714794            if (size) px = size->pixelSize;
    715795        }
     
    843923#endif
    844924
     925#ifdef Q_WS_PM
     926    QFontDatabasePrivate *db = QFontDatabasePrivate::instance();
     927#else   
    845928    if ( !db )
    846929        initializeDb();
     930#endif
    847931
    848932    QFontEngine *fe = 0;
    849933    if ( fp ) {
     934#ifndef Q_WS_PM
    850935        if ( fp->rawMode ) {
    851936            fe = loadEngine( script, fp, request, 0, 0, 0
     
    859944            return fe;
    860945        }
     946#endif // !Q_WS_PM
    861947
    862948        QFontCache::Key key( request, script,
    863 #ifdef Q_WS_WIN
     949#if defined(Q_WS_WIN) || defined(Q_WS_PM)
    864950                             (int)fp->paintdevice
    865951#else
     
    880966    parseFontName( request.family, foundry_name, family_name );
    881967
     968#ifdef Q_WS_PM
     969    // the "System VIO" PM font is broken in such way that its real pixel
     970    // sizes do not correspond to their nominal point sizes specified in the
     971    // font header (i.e. pixelSize is not equal to (pointSize * dpi) / 720).
     972    // therefore we use the special table to convert pointSize to pixelSize
     973    // in order to let bestFoundry() select the proper font with its nominal
     974    // point size corresponding to the requested one.
     975    // NOTE: this will produce incorrect results if "System VIO" is NOT
     976    // an OS/2 standatd supplied bitmap font.
     977    if( !ucstricmp( family_name, "System VIO") ) {
     978        // possible sizes of the "System VIO" font ("pixel, point" pairs),
     979        // sorted by point size
     980        static const short SystemVIO_sz[] = {
     981            12, 20,         16, 30,
     982            8,  40,         13, 50,
     983            15, 60,         24, 70,
     984            8,  80,         10, 90,
     985            12, 100,        14, 110,
     986            16, 120,        18, 130,
     987            16, 140,        12, 150,
     988            20, 160,        21, 170,
     989            29, 180,
     990        };
     991        const int SystemVIO_sz_len = sizeof(SystemVIO_sz) / sizeof(SystemVIO_sz[0]);
     992        int pt = request.pointSize;
     993        pt = QMAX( pt, SystemVIO_sz [1] );                      // min limit
     994        pt = QMIN( pt, SystemVIO_sz [SystemVIO_sz_len - 1] );   // max limit
     995        int i = 1;
     996        while ( SystemVIO_sz[i] < pt ) i += 2;
     997        if ( SystemVIO_sz[i] > pt ) {
     998            int prev = SystemVIO_sz[i-2];
     999            int mid = prev + (SystemVIO_sz[i] - prev + 1) / 2;
     1000            if ( pt < mid ) i -= 2;
     1001        }
     1002        ((QFontDef&)request).pixelSize = SystemVIO_sz[i-1];
     1003        ((QFontDef&)request).pointSize = SystemVIO_sz[i];
     1004    }
     1005#endif
     1006   
    8821007#ifdef Q_WS_X11
    8831008    if (family_name.isEmpty() && script == QFont::Han) {
     
    9051030              "    stretch: %d\n"
    9061031              "    pixelSize: %d\n"
     1032              "    pointSize: %d\n"
    9071033              "    pitch: %c",
    9081034              family_name.isEmpty() ? "-- first in script --" : family_name.latin1(),
    9091035              foundry_name.isEmpty() ? "-- any --" : foundry_name.latin1(),
    9101036              script, scriptName( script ).latin1(),
    911               request.weight, request.italic, request.stretch, request.pixelSize, pitch );
     1037              request.weight, request.italic, request.stretch,
     1038              request.pixelSize, request.pointSize,
     1039              pitch );
    9121040
    9131041#ifdef QT_XFT2
     
    9441072            uint score_adjust = 0;
    9451073            QFont::Script override_script = script;
     1074#ifndef Q_WS_PM
    9461075            if ( ! ( try_family->scripts[script] & QtFontFamily::Supported )
    9471076                 && script != QFont::Unicode) {
     
    9781107                }
    9791108            }
     1109#endif // !Q_WS_PM
    9801110
    9811111            QtFontFoundry *try_foundry = 0;
     
    9921122                             try_family, foundry_name, styleKey, request.pixelSize, pitch,
    9931123                             &try_foundry, &try_style, &try_size
    994 #ifdef Q_WS_X11
     1124#if defined(Q_WS_X11)
    9951125                             , &try_encoding, force_encoding_id
     1126#elif defined(Q_WS_PM)
     1127                             , request.pointSize
    9961128#endif
    9971129                    );
     
    10021134                                        QString::null, styleKey, request.pixelSize,
    10031135                                        pitch, &try_foundry, &try_style, &try_size
    1004 #ifdef Q_WS_X11
     1136#if defined(Q_WS_X11)
    10051137                                        , &try_encoding, force_encoding_id
     1138#elif defined(Q_WS_PM)
     1139                                        , request.pointSize
    10061140#endif
    10071141                    );
     
    10471181
    10481182            fe = loadEngine( script, fp, request, best_family, best_foundry, best_style
    1049 #ifdef Q_WS_X11
     1183#if defined(Q_WS_PM)
     1184                             , best_size
     1185#elif defined(Q_WS_X11)
    10501186                             , best_size, best_encoding, ( force_encoding_id >= 0 )
    10511187#endif
     
    10601196            }
    10611197
     1198#ifdef Q_WS_PM
     1199            // On OS/2, fontDef.pixelSize and fontDef.pointSize are filled
     1200            // by QFontEnginePM constructor
     1201#else             
    10621202            if ( best_style->smoothScalable )
    10631203                fe->fontDef.pixelSize = request.pixelSize;
     
    10821222                fe->fontDef.pointSize = request.pointSize;
    10831223            }
     1224#endif           
    10841225            fe->fontDef.styleHint     = request.styleHint;
    10851226            fe->fontDef.styleStrategy = request.styleStrategy;
     
    10941235
    10951236    if ( fe ) {
     1237#ifdef Q_WS_PM
     1238///@@TODO (dmik): should do something here?
     1239#else
    10961240        if ( script != QFont::Unicode && !canRender( fe, script ) ) {
    10971241            FM_DEBUG( "  WARN: font loaded cannot render sample 0x%04x",
     
    11171261            return fe;
    11181262        }
     1263#endif // !Q_WS_PM
    11191264
    11201265        if ( fp ) {
    11211266            QFontCache::Key key( request, script,
    1122 #ifdef Q_WS_WIN
     1267#if defined(Q_WS_WIN) || defined(Q_WS_PM)
    11231268                                 (int)fp->paintdevice
    11241269#else
     
    11281273            QFontCache::instance->insertEngine( key, fe );
    11291274
     1275#ifndef Q_WS_PM
    11301276            for ( int i = 0; i < QFont::NScripts; ++i ) {
    11311277                if ( i == script ) continue;
     
    11371283                QFontCache::instance->insertEngine( key, fe );
    11381284            }
     1285#endif // !Q_WS_PM
    11391286        }
    11401287    } else {
    11411288        if ( request.family.isEmpty() ) {
     1289#ifdef Q_WS_PM
     1290//@@TODO (dmik): what to return in such case?
     1291            qFatal( "QFontDatabase::findFont: request.family is empty and nothing is found, should it ever happen?" );
     1292#else
    11421293            FM_DEBUG( "returning box engine" );
    11431294
     
    11461297            if ( fp ) {
    11471298                QFontCache::Key key( request, script,
    1148 #ifdef Q_WS_WIN
     1299#if defined(Q_WS_WIN) || defined(Q_WS_PM)
    11491300                                     (int)fp->paintdevice
    11501301#else
     
    11541305                QFontCache::instance->insertEngine( key, fe );
    11551306            }
     1307#endif // Q_WS_PM
    11561308        }
    11571309    }
     
    11591311    return fe;
    11601312}
    1161 #endif // Q_WS_X11 || Q_WS_WIN
     1313#endif // Q_WS_X11 || Q_WS_WIN || Q_WS_PM
    11621314
    11631315
     
    13551507QFontDatabase::QFontDatabase()
    13561508{
     1509#ifdef Q_WS_PM
     1510    d = QFontDatabasePrivate::instance();   
     1511#else   
    13571512    createDatabase();
    13581513
    13591514    d = db;
     1515#endif
    13601516}
    13611517
     
    16351791
    16361792                if (size->pixelSize != 0 && size->pixelSize != USHRT_MAX) {
    1637 #ifdef Q_WS_X11
     1793#if defined(Q_WS_X11)
    16381794                    const uint pointSize = qRound(qt_pointSize(size->pixelSize, 0, -1));
     1795#elif defined(Q_WS_PM)
     1796//@@TODO (dmik): some bitmap fonts (i.e. System VIO) have point sizes
     1797//  that do not really correlate with their actual pixel sizes (i.e.
     1798//  their pointsize != pixelsizde * DPI / 72), What to return in that case? 
     1799                    const uint pointSize = size->pointSize / 10;
    16391800#else
    16401801                    const uint pointSize = size->pixelSize; // embedded uses 72dpi
     
    17401901
    17411902                if ( size->pixelSize != 0 && size->pixelSize != USHRT_MAX ) {
    1742 #ifdef Q_WS_X11
     1903#if defined(Q_WS_X11)
    17431904                    const uint pointSize = qRound(qt_pointSize(size->pixelSize, 0, -1));
     1905#elif defined(Q_WS_PM)
     1906//@@TODO (dmik): some bitmap fonts (i.e. System VIO) have point sizes
     1907//  that do not really correlate with their actual pixel sizes (i.e.
     1908//  their pointsize != pixelsizde * DPI / 72), What to return in that case? 
     1909                    const uint pointSize = size->pointSize / 10;
    17441910#else
    17451911                    const uint pointSize = size->pixelSize; // embedded uses 72dpi
  • trunk/src/kernel/qfontengine_p.h

    r7 r8  
    4040#endif
    4141
     42#ifdef Q_WS_PM
     43#include "qt_os2.h"
     44#endif
     45
    4246#include "qtextengine_p.h"
    4347
    4448class QPaintDevice;
    4549
    46 struct glyph_metrics_t;
    47 class QChar;
    48 typedef unsigned short glyph_t;
    49 struct qoffset_t;
    50 typedef int advance_t;
    51 class QOpenType;
     50//@@TODO (dmik): these all are defined in the included "qtextengine_p.h",
     51//  what do we need it here for?
     52//struct glyph_metrics_t;
     53//class QChar;
     54//typedef unsigned short glyph_t;
     55//struct qoffset_t;
     56//typedef int advance_t;
     57//class QOpenType;
    5258struct TransformedFont;
    5359
    54 #if defined( Q_WS_X11 ) || defined( Q_WS_WIN) || defined( Q_WS_MAC )
     60#if defined( Q_WS_X11 ) || defined( Q_WS_WIN) || defined( Q_WS_PM) || defined( Q_WS_MAC )
    5561class QFontEngine : public QShared
    5662{
     
    7177        Win,
    7278        Uniscribe,
     79
     80        // OS/2 types
     81        PM,
    7382
    7483        // Apple MacOS types
     
    151160    short rbearing;
    152161#endif // Q_WS_WIN
     162#ifdef Q_WS_PM
     163    HPS ps() const;
     164    void selectTo( HPS ps ) const;
     165   
     166    HPS hps;
     167    FATTRS fa;
     168    PFONTMETRICS pfm;
     169#endif
    153170#ifdef Q_WS_X11
    154171    TransformedFont *transformed_fonts;
     
    605622#endif
    606623
    607 #endif // Q_WS_WIN
    608 
    609 #endif
     624#elif defined( Q_WS_PM )
     625
     626class QFontEnginePM : public QFontEngine
     627{
     628public:
     629    QFontEnginePM( HPS ps, PFATTRS pfa, int pixelSize, int pointSize );
     630    virtual ~QFontEnginePM() { delete[] widthCache; }
     631
     632    Error stringToCMap( const QChar *str, int len, glyph_t *glyphs, advance_t *advances, int *nglyphs, bool mirrored ) const;
     633
     634    void draw( QPainter *p, int x, int y, const QTextEngine *engine, const QScriptItem *si, int textFlags );
     635
     636    glyph_metrics_t boundingBox( const glyph_t *glyphs,
     637                               const advance_t *advances, const qoffset_t *offsets, int numGlyphs );
     638    glyph_metrics_t boundingBox( glyph_t glyph );
     639
     640    int ascent() const;
     641    int descent() const;
     642    int leading() const;
     643    int maxCharWidth() const;
     644    int minLeftBearing() const;
     645    int minRightBearing() const;
     646
     647//@@TODO (dmik): need other implementation?   
     648    const char *name() const { return 0; }
     649
     650    bool canRender( const QChar *string,  int len );
     651
     652    Type type() const;
     653
     654//@@TODO (dmik): the current implementation of font-related code does not
     655//  support true unicode (chars and strings are converted using
     656//  QString::local8bit), so 256 is enough. It will be changed later (when,
     657//  for example, ft2lib will be used). See also stringToCMap() implementation.       
     658    enum { widthCacheSize = 256 };
     659    unsigned char *widthCache;
     660};
     661
     662#endif
     663
     664#endif
  • trunk/src/kernel/qiconset.cpp

    r7 r8  
    827827    pixmap->fill( dis.background() );
    828828
     829    if ( !normalMask.mask() )
     830        normalMask.setMask( normalMask );
     831   
    829832    QPainter painter;
    830833    painter.begin( pixmap );
    831     painter.setPen( dis.base() );
     834    painter.setPen( dis.light() );
    832835    painter.drawPixmap( 1, 1, normalMask );
    833     painter.setPen( dis.foreground() );
     836    painter.setPen( dis.dark() );
    834837    painter.drawPixmap( 0, 0, normalMask );
    835838    painter.end();
    836 
    837     if ( !normalMask.mask() )
    838         normalMask.setMask( normalMask );
    839839
    840840    QBitmap mask( pixmap->size() );
  • trunk/src/kernel/qlocalfs.cpp

    r7 r8  
    155155                           fi->size(), fi->lastModified(), fi->lastRead(), fi->isDir(), fi->isFile(),
    156156                           fi->isSymLink(), fi->isWritable(), fi->isReadable(), fi->isExecutable() );
     157        // ### Block signals to initiate a hack in QNetworkOperation that will
     158        // prevent the op from being deleted during the qApp->processEvents() call
     159        op->blockSignals( TRUE );
     160        qApp->processEvents();
     161        op->blockSignals( FALSE );
     162        if ( op->state() == StStopped ) {
     163            op->free();
     164            return;
     165        }
    157166    }
    158167    emit newChildren( infos, op );
  • trunk/src/kernel/qmime.cpp

    r7 r8  
    356356    QStringList::Iterator it;
    357357    if ( abs_name[0] == '/'
    358 #ifdef Q_WS_WIN
     358#if defined(Q_WS_WIN) || defined(Q_WS_PM)
    359359            || ( abs_name[0] && abs_name[1] == ':' ) || abs_name.startsWith("\\\\")
    360360#endif
     
    456456    if ( context.isNull() ||
    457457         !(context[0] == '/'
    458 #ifdef Q_WS_WIN
     458#if defined(Q_WS_WIN) || defined(Q_WS_PM)
    459459         || ( context[0] && context[1] == ':')
    460460#endif
  • trunk/src/kernel/qnetworkprotocol.cpp

    r7 r8  
    8484            oldOps.removeFirst();
    8585        }
    86         delete opStartTimer;
    8786    }
    8887
     
    430429QNetworkProtocol::~QNetworkProtocol()
    431430{
     431    QNetworkOperation *op = d->opInProgress;
     432    if ( op ) {
     433        op->setState( StStopped );
     434        op->setProtocolDetail( tr( "Operation stopped by the user" ) );
     435        emit finished( op );
     436        // op->free() will be called by QNetworkOperationPrivate dtor below
     437    }
    432438    delete d;
    433439}
     
    12571263void QNetworkOperation::deleteMe()
    12581264{
    1259     delete this;
     1265    // ### A hackish workaround to prevent this op from being deleted during
     1266    // the qApp->processEvents() call in QLocalFs::operationListChildren().
     1267    // The proper way is to add something like QNetworkOperation::cancelFree()
     1268    // to stop deleteTimer and make it a documented method.
     1269    if ( !signalsBlocked() )
     1270        delete this;
    12601271}
    12611272
  • trunk/src/kernel/qobject.cpp

    r7 r8  
    214214
    215215
    216 // Event functions, implemented in qapplication_xxx.cpp
     216// Event functions, implemented in qeventloop_xxx.cpp
    217217
    218218int   qStartTimer( int interval, QObject *obj );
  • trunk/src/kernel/qpainter.cpp

    r7 r8  
    16351635        } else {
    16361636            txop = TxScale;
    1637 #if defined(Q_WS_WIN)
     1637#if defined(Q_WS_WIN) || defined(Q_WS_PM)
    16381638            setf(DirtyFont);
    16391639#endif
     
    16411641    } else {
    16421642        txop = TxRotShear;
    1643 #if defined(Q_WS_WIN)
     1643#if defined(Q_WS_WIN) || defined(Q_WS_PM)
    16441644        setf(DirtyFont);
    16451645#endif
     
    23452345        if ( !pdev->cmd( QPaintDevice::PdcDrawPixmap, this, param ) || !hdc )
    23462346            return;
     2347#elif defined(Q_WS_PM)
     2348        if ( !pdev->cmd( QPaintDevice::PdcDrawPixmap, this, param ) || !hps )
     2349            return;
    23472350#elif defined(Q_WS_QWS)
    23482351        pdev->cmd( QPaintDevice::PdcDrawPixmap, this, param );
     
    24932496        if ( !pdev->cmd( QPaintDevice::PdcDrawImage, this, param ) || !hdc )
    24942497            return;
     2498#elif defined(Q_WS_PM)
     2499        if ( !pdev->cmd( QPaintDevice::PdcDrawImage, this, param ) || !hps )
     2500            return;
    24952501#elif defined (Q_WS_QWS)
    24962502        pdev->cmd( QPaintDevice::PdcDrawImage, this, param );
     
    25512557#if defined(Q_WS_WIN)
    25522558        if ( !pdev->cmd( QPaintDevice::PdcDrawImage, this, param ) || !hdc )
     2559            return;
     2560#elif defined(Q_WS_PM)
     2561        if ( !pdev->cmd( QPaintDevice::PdcDrawImage, this, param ) || !hps )
    25532562            return;
    25542563#elif defined(Q_WS_QWS)
     
    27932802                     !hdc )
    27942803                    return;                     // QPrinter wants PdcDrawText2
     2804#elif defined(Q_WS_PM)
     2805                if ( !pdev->cmd( QPaintDevice::PdcDrawText2Formatted,
     2806                                 this, param) ||
     2807                     !hps )
     2808                    return;
    27952809#elif defined(Q_WS_QWS)
    27962810                pdev->cmd( QPaintDevice::PdcDrawText2Formatted, this, param);
  • trunk/src/kernel/qpixmap.cpp

    r7 r8  
    367367#if defined(Q_WS_WIN)
    368368        hdc = pixmap.hdc;                       // copy Windows device context
     369#elif defined(Q_WS_PM)
     370        hps = pixmap.hps;                       // copy OS/2 PM presentation space
    369371#elif defined(Q_WS_X11)
    370372        hd = pixmap.hd;                         // copy X11 drawable
     
    475477#if defined(Q_WS_WIN)
    476478        hdc = pixmap.hdc;
     479#elif defined(Q_WS_PM)
     480        hps = pixmap.hps;
    477481#elif defined(Q_WS_X11)
    478482        hd = pixmap.hd;                         // copy QPaintDevice drawable
     
    735739            delete data->mask;
    736740            data->mask = 0;
     741#if defined (Q_WS_PM)
     742            if ( data->maskedHbm ) {
     743                GpiDeleteBitmap( data->maskedHbm );
     744                data->maskedHbm = 0;
     745            }
     746#endif
    737747        }
    738748        return;
     
    754764    data->alphapm = 0;
    755765#endif // Q_WS_X11 && !QT_NO_XFTFREETYPE
     766
     767#if defined (Q_WS_PM)
     768    if ( data->maskedHbm ) {
     769        GpiDeleteBitmap( data->maskedHbm );
     770        data->maskedHbm = 0;
     771    }
     772#endif
    756773
    757774    delete data->mask;
  • trunk/src/kernel/qrichtext.cpp

    r7 r8  
    7676#endif
    7777
     78#ifdef Q_WS_PM
     79#include "qt_os2.h"
     80#endif
     81
    7882#define QChar_linesep QChar(0x2028U)
    7983
     
    98102            value = value * metrics.logicalDpiY() / gdc;
    99103        ReleaseDC( 0, hdc );
     104#elif defined (Q_WS_PM)
     105        LONG dpi;
     106        DevQueryCaps( GpiQueryDevice( qt_display_ps() ),
     107            CAPS_VERTICAL_FONT_RES, 1, &dpi );
     108        value = value * metrics.logicalDpiY() / dpi;
    100109#elif defined (Q_WS_MAC)
    101110        value = value * metrics.logicalDpiY() / 75; // ##### FIXME
     
    517526    bool justInsert = TRUE;
    518527    QString s( str );
    519 #if defined(Q_WS_WIN)
     528#if defined(Q_WS_WIN) || defined(Q_WS_PM)
    520529    if ( checkNewLine ) {
    521530        int i = 0;
  • trunk/src/kernel/qscriptengine.cpp

    r7 r8  
    10411041#elif defined( Q_WS_WIN )
    10421042# include "qscriptengine_win.cpp"
     1043#elif defined( Q_WS_PM )
     1044# include "qscriptengine_pm.cpp"
    10431045#elif defined( Q_WS_MAC )
    10441046# include "qscriptengine_mac.cpp"
  • trunk/src/kernel/qsizegrip.cpp

    r7 r8  
    5050#include "qobjectlist.h"
    5151#include "qt_windows.h"
     52#elif defined (Q_WS_PM)
     53#include "qobjectlist.h"
     54#include "qt_os2.h"
    5255#elif defined(Q_WS_MAC)
    5356bool qt_mac_update_sizer(QWidget *, int); //qwidget_mac.cpp
     
    236239        tlw->resize( w, h );
    237240    }
    238 #ifdef Q_WS_WIN
     241#if defined (Q_WS_WIN)
    239242    MSG msg;
    240243    while( PeekMessage( &msg, winId(), WM_MOUSEMOVE, WM_MOUSEMOVE, PM_REMOVE ) )
     244      ;
     245#elif defined (Q_WS_PM)
     246//@@TODO (dmik): is the code below really necessary?
     247    QMSG qmsg;
     248    while( WinPeekMsg( 0, &qmsg, winId(), WM_MOUSEMOVE, WM_MOUSEMOVE, PM_REMOVE ) )
    241249      ;
    242250#endif
  • trunk/src/kernel/qt_gfx.pri

    r7 r8  
    77        system-mng {
    88            win32:LIBS += libmng.lib
     9            os2:LIBS += libmng.lib
    910            unix:LIBS  += -lmng
    1011        } else {
     
    4647           unix:LIBS += -ljpeg
    4748           win32:LIBS += libjpeg.lib
     49           os2:LIBS += libjpeg.lib
    4850        } else {
    4951            INCLUDEPATH += 3rdparty/libjpeg
     
    105107            unix:LIBS  += -lpng
    106108            win32:LIBS += libpng.lib
     109            os2:LIBS += png.lib
    107110        } else {
    108111            INCLUDEPATH  += 3rdparty/libpng
     
    147150   unix:LIBS += -lz
    148151   win32:LIBS += libz.lib
     152   os2:LIBS += z.lib
    149153}
    150154
  • trunk/src/kernel/qt_kernel.pri

    r7 r8  
    122122                  $$KERNEL_CPP/qfontengine_win.cpp
    123123
     124        os2:SOURCES += \
     125          $$KERNEL_CPP/qapplication_pm.cpp \
     126                  $$KERNEL_CPP/qclipboard_pm.cpp \
     127                  $$KERNEL_CPP/qcolor_pm.cpp \
     128          $$KERNEL_CPP/qcursor_pm.cpp \
     129                  $$KERNEL_CPP/qdesktopwidget_pm.cpp \
     130                  $$KERNEL_CPP/qeventloop_pm.cpp \
     131                  $$KERNEL_CPP/qfont_pm.cpp \
     132                  $$KERNEL_CPP/qmime_pm.cpp \
     133                  $$KERNEL_CPP/qpixmap_pm.cpp \
     134                  $$KERNEL_CPP/qpaintdevice_pm.cpp \
     135                  $$KERNEL_CPP/qpainter_pm.cpp \
     136                  $$KERNEL_CPP/qregion_pm.cpp \
     137          $$KERNEL_CPP/qthread_pm.cpp \
     138                  $$KERNEL_CPP/qwidget_pm.cpp \
     139                  $$KERNEL_CPP/qfontengine_pm.cpp
     140
    124141        unix:x11 {
    125142              SOURCES += $$KERNEL_CPP/qapplication_x11.cpp \
     
    260277        }
    261278}
     279
     280#@@TODO(dmik): headers and sources below are substracted until implemented
     281os2 {
     282        HEADERS -= \
     283                $$KERNEL_P/qinputcontext_p.h \
     284                $$KERNEL_H/qpolygonscanner.h \
     285                $$KERNEL_H/qprinter.h \
     286                $$KERNEL_H/qprocess.h \
     287                $$KERNEL_H/qsessionmanager.h \
     288                $$KERNEL_H/qsound.h
     289
     290        SOURCES -= \
     291                $$KERNEL_CPP/qpolygonscanner.cpp \
     292                $$KERNEL_CPP/qprinter.cpp \
     293                $$KERNEL_CPP/qprocess.cpp \
     294                $$KERNEL_CPP/qsound.cpp
     295}
  • trunk/src/kernel/qtextengine.cpp

    r7 r8  
    826826#elif defined( Q_WS_WIN )
    827827# include "qtextengine_win.cpp"
     828#elif defined( Q_WS_PM )
     829# include "qtextengine_pm.cpp"
    828830#elif defined( Q_WS_MAC )
    829831# include "qtextengine_mac.cpp"
  • trunk/src/kernel/qtextengine_p.h

    r7 r8  
    167167    unsigned short reserved          :1;
    168168    unsigned short engineReserved    :2;
     169};
     170
     171inline bool operator == ( const QScriptAnalysis &sa1, const QScriptAnalysis &sa2 )
     172{
     173    return
     174        sa1.script == sa2.script &&
     175        sa1.bidiLevel == sa2.bidiLevel;
     176        // ###
     177//          && override == other.override;
     178}
     179
     180#elif defined( Q_WS_PM )
     181
     182//@@TODO (dmik): the definitions below is almost unchecked (no true unicode
     183//  support yet)
     184
     185//@@TODO (dmik): curretnly glyphs are just 8 bit chars (see
     186//  QFontEnginePM::stringToCMap()), so glyph_t is temporarily defined as
     187//  unsigned char. it should be changed later.
     188typedef unsigned char glyph_t;
     189//typedef unsigned short glyph_t;
     190
     191struct qoffset_t {
     192    int x;
     193    int y;
     194};
     195
     196typedef int advance_t;
     197
     198//@@TODO (dmik): it's a dummy version...
     199struct QScriptAnalysis {
     200    unsigned short script         :10;
     201    unsigned short bidiLevel         :5;
     202    unsigned short override          :1;
     203    unsigned short reserved          :1;
    169204};
    170205
  • trunk/src/kernel/qthread.cpp

    r7 r8  
    4141#include <private/qthreadinstance_p.h>
    4242
     43#ifndef QT_NO_COMPAT
    4344#ifndef QT_H
    4445#  include "qapplication.h"
    4546#endif // QT_H
     47#endif // QT_NO_COMPAT
    4648
    4749#if QT_VERSION >= 0x040000
  • trunk/src/kernel/qtranslator.cpp

    r7 r8  
    406406
    407407    if ( filename[0] == '/'
    408 #ifdef Q_WS_WIN
     408#if defined(Q_WS_WIN) || defined(Q_WS_PM)
    409409         || (filename[0] && filename[1] == ':') || filename[0] == '\\'
    410410#endif
  • trunk/src/kernel/qurl.cpp

    r7 r8  
    834834        d->host.remove( (uint)0, 1 );
    835835
    836 #if defined(Q_OS_WIN32)
     836#if defined(Q_OS_WIN32) || defined(Q_OS_OS2)
    837837    // hack for windows file://machine/path syntax
    838838    if ( d->protocol == "file" ) {
     
    10281028            d->cleanPath = d->path;
    10291029        } else if ( isLocalFile() ) {
    1030 #if defined(Q_OS_WIN32)
     1030#if defined(Q_OS_WIN32) || defined(Q_OS_OS2)
    10311031            // hack for stuff like \\machine\path and //machine/path on windows
    10321032            if ( ( d->path.left( 1 ) == "/" || d->path.left( 1 ) == "\\" ) &&
     
    11011101{
    11021102    if ( d->path.isEmpty() || d->path.endsWith( "/" )
    1103 #ifdef Q_WS_WIN
     1103#if defined(Q_WS_WIN) || defined(Q_OS_OS2)
    11041104        || d->path.endsWith( "\\" )
    11051105#endif
  • trunk/src/kernel/qwidget.cpp

    r7 r8  
    6161#include "qinputcontext_p.h"
    6262#endif
     63#if defined(Q_WS_PM)
     64#include "qt_os2.h"
     65#endif
    6366#if defined(Q_WS_QWS)
    6467#include "qwsmanager_qws.h"
     
    513516  QWidget utility functions
    514517 *****************************************************************************/
    515 
    516518static QFont qt_naturalWidgetFont( QWidget* w ) {
    517519    QFont naturalfont = QApplication::font( w );
     
    32593261#if defined(Q_WS_WIN)
    32603262        && GetFocus() == winId()
     3263#elif defined(Q_WS_PM)
     3264//@@TODO (dmik): currently we don't use WinSetFocus(). what for? Qt seems
     3265//  to completely handle focus traversal itself.
     3266//      && WinQueryFocus( HWND_DESKTOP ) == winId()
    32613267#endif
    32623268        )
     
    32943300            SetFocus( winId() );
    32953301        else {
     3302#elif defined(Q_WS_PM)
     3303//@@TODO (dmik): currently we don't use WinSetFocus(). what for? Qt seems
     3304//  to completely handle focus traversal itself.
     3305//      if ( !topLevelWidget()->isPopup() )
     3306//          WinSetFocus( HWND_DESKTOP, winId() );
     3307//      else {
    32963308#endif
    32973309#if defined(QT_ACCESSIBILITY_SUPPORT)
    32983310            QAccessible::updateAccessibility( this, 0, QAccessible::Focus );
    32993311#endif
    3300 #if defined(Q_WS_WIN)
     3312#if defined(Q_WS_WIN) // || defined(Q_WS_PM)
    33013313        }
    33023314#endif
     
    33453357            SetFocus( 0 );
    33463358        else {
     3359#elif defined(Q_WS_PM)
     3360//@@TODO (dmik): currently we don't use WinSetFocus(). what for? Qt seems
     3361//  to completely handle focus traversal itself.
     3362//      if ( !isPopup() && WinQueryFocus( HWND_DESKTOP ) == winId() )
     3363//          WinSetFocus( HWND_DESKTOP, topLevelWidget()->winId() );
     3364//      else {
    33473365#endif
    33483366#if defined(QT_ACCESSIBILITY_SUPPORT)
    33493367            QAccessible::updateAccessibility( this, 0, QAccessible::Focus );
    33503368#endif
    3351 #if defined(Q_WS_WIN)
     3369#if defined(Q_WS_WIN) // || defined(Q_WS_PM)
    33523370        }
    33533371#endif
     
    35673585    }
    35683586#endif
     3587//@@TODO (dmik): I think we don't need the same as above in OS/2,
     3588//  because if the window is active (in Qt terminology)
     3589//  qApp->activeWindow() will be equal to toplevelWidget() which is
     3590//  checked at the beginnig.
    35693591
    35703592    return FALSE;
     
    39854007    // On Windows, show the popup now so that our own focus handling
    39864008    // stores the correct old focus widget even if it's stolen in the showevent
     4009//@@TODO (dmik): need the same in OS/2? guess not.       
    39874010#if defined(Q_WS_WIN)
    39884011    if ( testWFlags(WType_Popup) )
     
    40064029        showWindow();
    40074030
    4008 #if !defined(Q_WS_WIN)
     4031//@@TODO (dmik): need the same in OS/2? guess not.       
     4032#if !defined(Q_WS_WIN)
    40094033    if ( testWFlags(WType_Popup) )
    40104034        qApp->openPopup( this );
     
    40484072        qt_leave_modal( this );
    40494073
    4050 #if defined(Q_WS_WIN)
     4074//@@TODO (dmik): is it correct for OS/2?   
     4075#if defined(Q_WS_WIN) || defined(Q_WS_PM)
    40514076    if ( isTopLevel() && !isPopup() && parentWidget() && isActiveWindow() )
    40524077        parentWidget()->setActiveWindow();      // Activate parent
     
    49274952        }
    49284953
     4954#ifndef Q_WS_PM
     4955    // We disable this on OS/2 since we send these events from qt_sendBlocked()
     4956    // which does it more accurately compared to the code below -- only those
     4957    // widgets that have actually been blocked/unblocked (not less and not
     4958    // more) will receive these events.         
    49294959    case QEvent::WindowBlocked:
    49304960    case QEvent::WindowUnblocked:
     
    49384968        }
    49394969        break;
     4970#endif       
    49404971
    49414972    default:
     
    55275558*/
    55285559bool QWidget::winEvent( MSG * )
     5560{
     5561    return FALSE;
     5562}
     5563
     5564#endif
     5565#if defined(Q_WS_PM)
     5566
     5567/*!
     5568    This special event handler can be reimplemented in a subclass to
     5569    receive native OS/2 PM events.
     5570
     5571    In your reimplementation of this function, if you want to stop the
     5572    event being handled by Qt, return TRUE. If you return FALSE, this
     5573    native event is passed back to Qt, which translates the event into
     5574    a Qt event and sends it to the widget.
     5575
     5576    \warning This function is not portable.
     5577
     5578    \sa QApplication::pmEventFilter()
     5579*/
     5580bool QWidget::pmEvent( QMSG * )
    55295581{
    55305582    return FALSE;
  • trunk/src/moc/moc.pro

    r7 r8  
    66                  QT_NO_STL QT_NO_COMPRESS
    77win32:DEFINES  += QT_NODLL
     8os2:DEFINES  += QT_NODLL
    89DESTDIR         = ../../bin
    910
     
    4849unix:SOURCES    += ../tools/qfile_unix.cpp ../tools/qdir_unix.cpp ../tools/qfileinfo_unix.cpp
    4950win32:SOURCES   += ../tools/qfile_win.cpp ../tools/qdir_win.cpp ../tools/qfileinfo_win.cpp
     51os2:SOURCES     += ../tools/qfile_pm.cpp ../tools/qdir_pm.cpp ../tools/qfileinfo_pm.cpp
    5052macx:LIBS       += -framework Carbon
    5153
  • trunk/src/network/qdns.cpp

    r7 r8  
    7979#include <dlfcn.h>
    8080#endif
     81#if defined(Q_OS_OS2)
     82//@@TODO (dmik): currently these headers are not used
     83//  (see comments to QDns::doSynchronousLookup())
     84//#include <netinet/in.h>
     85//#include <resolv.h>
     86#endif
    8187
    8288//#define QDNS_DEBUG
     
    105111static bool ipv6support = FALSE;
    106112
     113#if defined(Q_OS_OS2)
     114//@@TODO (dmik): currently qdns_res_init() is not used
     115//  (see comments to QDns::doSynchronousLookup())
     116#else
    107117static int qdns_res_init()
    108118{
     
    116126    else
    117127        return -1;
    118 #elif defined(Q_OS_UNIX)
     128#elif defined(Q_OS_UNIX) || defined(Q_OS_OS2)
    119129    return res_init();
    120130#else
     
    122132#endif
    123133}
     134#endif
    124135
    125136
     
    129140    {
    130141#if defined(Q_DNS_SYNCHRONOUS)
    131 #if defined(Q_OS_UNIX)
     142#if defined(Q_OS_UNIX) || defined(Q_OS_OS2)
    132143        noEventLoop = qApp==0 || qApp->loopLevel()==0;
    133144#else
     
    881892{
    882893    if ( !globalManager ) {
     894        new QDnsManager();
    883895        qAddPostRoutine(cleanupDns);
    884         new QDnsManager();
    885896    }
    886897    return globalManager;
     
    24432454}
    24442455
    2445 #elif defined(Q_OS_UNIX)
     2456#elif defined(Q_OS_UNIX) || defined(Q_OS_OS2)
    24462457
    24472458#if defined(Q_DNS_SYNCHRONOUS)
    24482459void QDns::doSynchronousLookup()
    24492460{
     2461#if defined(Q_OS_OS2)
     2462    //@@TODO (dmik): we can use the code below on OS/2 also but this will
     2463    //  require linking against the additional library containing res_*
     2464    //  functions and global data, which is normally not used anywhere else
     2465    //  (because QDns implementation does lookups diretcly to achieve
     2466    //  asynchronous behavior) and will just waste some system resources.
     2467    //  Anyhow, is synchronous behavior really necessary? Do nothing for now.
     2468#else
    24502469    if ( t!=None && !l.isEmpty() ) {
    24512470        QValueListIterator<QString> it = n.begin();
     
    24992518        emit resultsReady();
    25002519    }
     2520#endif
    25012521}
    25022522#endif
     
    25172537
    25182538    // read resolv.conf manually.
     2539#if defined(Q_OS_OS2)
     2540    char *etc = getenv( "ETC" );
     2541    if ( !etc ) {
     2542        etc = "x:\\MPTN\\ETC";
     2543        ULONG boot = 0;
     2544        DosQuerySysInfo( QSV_BOOT_DRIVE, QSV_BOOT_DRIVE, (PVOID)boot, sizeof(boot) );
     2545        *etc = (char)(boot + 'A' - 1);
     2546    }
     2547    // currently, resolv takes precedence over resolv2 assuming that resolv
     2548    // is created for PPP connections and therefore should override resolv2
     2549    // which is created for permanent LAN connections.
     2550    QFile resolvConf( QString( etc ) + "\\resolv" );
     2551    if ( !resolvConf.exists() )
     2552        resolvConf.setName( QString( etc ) + "\\resolv2" );
     2553#else
    25192554    QFile resolvConf("/etc/resolv.conf");
     2555#endif   
    25202556    if (resolvConf.open(IO_ReadOnly)) {
    25212557        QTextStream stream( &resolvConf );
     
    25292565            if ( type == "nameserver" ) {
    25302566                QHostAddress *address = new QHostAddress();
    2531                 if ( address->setAddress( QString(line[1]) ) ) {
     2567                if ( address->setAddress( list[1] ) ) {
    25322568                    // only add ipv6 addresses from resolv.conf if
    25332569                    // this host supports ipv6.
     
    25482584    }
    25492585
     2586#if defined(Q_OS_OS2)
     2587//@@TODO (dmik): currently the code below is not used
     2588//  (see comments to QDns::doSynchronousLookup())
     2589#else
    25502590    if (ns->isEmpty()) {
    25512591#if defined(Q_MODERN_RES_API)
     
    25942634        }
    25952635    }
    2596 
     2636#endif   
     2637
     2638#if defined(Q_OS_OS2)
     2639    QFile hosts( QString( etc ) + "\\hosts" );
     2640#else
    25972641    QFile hosts( QString::fromLatin1( "/etc/hosts" ) );
     2642#endif   
    25982643    if ( hosts.open( IO_ReadOnly ) ) {
    25992644        // read the /etc/hosts file, creating long-life A and PTR RRs
  • trunk/src/network/qt_network.pri

    r7 r8  
    2020        unix:NETWORK_SOURCES += $$NETWORK_CPP/qsocketdevice_unix.cpp
    2121        win32:NETWORK_SOURCES += $$NETWORK_CPP/qsocketdevice_win.cpp
     22        os2:NETWORK_SOURCES += $$NETWORK_CPP/qsocketdevice_pm.cpp
    2223        SOURCES    += $$NETWORK_SOURCES
    2324}
  • trunk/src/qt.pro

    r7 r8  
    1111
    1212win32:!shared:CONFIG += staticlib
     13os2:!shared:CONFIG += staticlib
    1314
    1415win32-borland {
     
    8687win32-borland:INCLUDEPATH += kernel
    8788
     89os2 {
     90        OS2_ALL_H = ../include
     91        SQL_H       = $$OS2_ALL_H
     92        KERNEL_H    = $$OS2_ALL_H
     93        WIDGETS_H   = $$OS2_ALL_H
     94        TABLE_H     = $$OS2_ALL_H
     95        DIALOGS_H   = $$OS2_ALL_H
     96        ICONVIEW_H  = $$OS2_ALL_H
     97        NETWORK_H   = $$OS2_ALL_H
     98        OPENGL_H    = $$OS2_ALL_H
     99        TOOLS_H     = $$OS2_ALL_H
     100        CODECS_H    = $$OS2_ALL_H
     101        WORKSPACE_H = $$OS2_ALL_H
     102        XML_H       = $$OS2_ALL_H
     103        CANVAS_H    = $$OS2_ALL_H
     104        STYLES_H    = $$OS2_ALL_H
     105        CONFIG      -= incremental
     106
     107        CONFIG  += zlib
     108        INCLUDEPATH += tmp
     109        !staticlib {
     110                DEFINES += QT_MAKEDLL
     111                exists(qt.rc):RC_FILE = qt.rc
     112                exists(qt.def.tpl.$$QMAKESPEC):DEF_FILE_TEMPLATE = qt.def.tpl.$$QMAKESPEC
     113                exists(qt.def.map.$$QMAKESPEC):DEF_FILE_MAP = qt.def.map.$$QMAKESPEC
     114        }
     115}
     116
    88117unix {
    89118        CANVAS_H        = $$CANVAS_CPP
     
    143172
    144173#modules
    145 include($$KERNEL_CPP/qt_kernel.pri)
    146 include($$WIDGETS_CPP/qt_widgets.pri)
    147 include($$DIALOGS_CPP/qt_dialogs.pri)
    148 include($$ICONVIEW_CPP/qt_iconview.pri)
    149 include($$WORKSPACE_CPP/qt_workspace.pri)
    150 include($$NETWORK_CPP/qt_network.pri)
    151 include($$CANVAS_CPP/qt_canvas.pri)
    152 include($$TABLE_CPP/qt_table.pri)
    153 include($$XML_CPP/qt_xml.pri)
    154 include($$OPENGL_CPP/qt_opengl.pri)
    155 include($$SQL_CPP/qt_sql.pri)
    156 include($$KERNEL_CPP/qt_gfx.pri)
    157 include($$TOOLS_CPP/qt_tools.pri)
    158 include($$CODECS_CPP/qt_codecs.pri)
    159 include($$STYLES_CPP/qt_styles.pri)
     174os2 {
     175        # this section should be removed one day
     176    # when an OS/2 version of every module is ready
     177        include($$KERNEL_CPP/qt_kernel.pri)
     178        include($$WIDGETS_CPP/qt_widgets.pri)
     179        include($$DIALOGS_CPP/qt_dialogs.pri)
     180        include($$WORKSPACE_CPP/qt_workspace.pri)
     181        include($$NETWORK_CPP/qt_network.pri)
     182        include($$XML_CPP/qt_xml.pri)
     183        include($$KERNEL_CPP/qt_gfx.pri)
     184        include($$TOOLS_CPP/qt_tools.pri)
     185        include($$CODECS_CPP/qt_codecs.pri)
     186        include($$STYLES_CPP/qt_styles.pri)
     187} else {
     188        include($$KERNEL_CPP/qt_kernel.pri)
     189        include($$WIDGETS_CPP/qt_widgets.pri)
     190        include($$DIALOGS_CPP/qt_dialogs.pri)
     191        include($$ICONVIEW_CPP/qt_iconview.pri)
     192        include($$WORKSPACE_CPP/qt_workspace.pri)
     193        include($$NETWORK_CPP/qt_network.pri)
     194        include($$CANVAS_CPP/qt_canvas.pri)
     195        include($$TABLE_CPP/qt_table.pri)
     196        include($$XML_CPP/qt_xml.pri)
     197        include($$OPENGL_CPP/qt_opengl.pri)
     198        include($$SQL_CPP/qt_sql.pri)
     199        include($$KERNEL_CPP/qt_gfx.pri)
     200        include($$TOOLS_CPP/qt_tools.pri)
     201        include($$CODECS_CPP/qt_codecs.pri)
     202        include($$STYLES_CPP/qt_styles.pri)
     203}
    160204embedded:include($$EMBEDDED_CPP/qt_embedded.pri)
    161205
     
    166210
    167211#install directives
    168 include(qt_install.pri)
     212#@@todo(dmik): need this on OS/2?
     213!os2:include(qt_install.pri)
    169214!staticlib:PRL_EXPORT_DEFINES += QT_SHARED
    170215
     
    190235                   $$STYLES_CPP/qstyleplugin.cpp \
    191236                   $$CODECS_CPP/qtextcodecplugin.cpp \
    192                    $$WIDGETS_CPP/qwidgetplugin.cpp
    193 }
     237                   $$WIDGETS_CPP/qwidgetplugin.cpp
     238}
     239
     240os2 {
     241        # targets and commands to sync private headers
     242        private_headers.target = ..\.private_headers
     243        private_headers.depends = do_private_headers
     244        do_private_headers.target = do_private_headers
     245        do_private_headers.commands = cd .. && $(MAKE) private_headers
     246        QMAKE_EXTRA_TARGETS += do_private_headers private_headers
     247        PRE_TARGETDEPS += $$do_private_headers.target
     248        QMAKE_INTERNAL_INCLUDED_FILES += $$private_headers.target
     249}
  • trunk/src/styles/qcommonstyle.cpp

    r7 r8  
    146146#ifndef QT_NO_LISTVIEW
    147147    case PE_CheckListController: {
    148         p->drawPixmap(r, QPixmap((const char **)check_list_controller_xpm));
     148        QRect pr( r );
     149        QPixmap px( (const char **)check_list_controller_xpm );
     150        // center pixmap if smaller, otherwise it will be scaled to fit
     151        int d = pr.width() - px.width();
     152        if ( d > 0 ) {
     153            pr.setX( pr.x() + d / 2 );
     154            pr.setWidth( px.width() );
     155        }
     156        d = pr.height() - px.height();
     157        if ( d > 0 ) {
     158            pr.setY( pr.y() + d / 2 );
     159            pr.setHeight( px.height() );
     160        }
     161        p->drawPixmap( pr, px );
    149162        break; }
    150163    case PE_CheckListExclusiveIndicator: {
  • trunk/src/styles/qcompactstyle.cpp

    r7 r8  
    152152            const QPopupMenu *popupmenu = (const QPopupMenu *) widget;
    153153            QMenuItem *mi = opt.menuItem();
     154           
     155            // QPopupMenu has WResizeNoErase and WRepaintNoErase flags, so we
     156            // must erase areas not covered by menu items (this is requested by
     157            // QPopupMenu using 0 as the menu item argument).
     158            // [Win32 version feels ok without this, because it doesn't actually
     159            // fully obey WResizeNoErase and WRepaintNoErase: WM_ERASEBKGND always
     160            // erases the background before WM_PAINT and after every resize].
     161#if !defined (Q_WS_PM)
    154162            if ( !mi )
    155163                break;
     164#endif
    156165
    157166            int tab = opt.tabWidth();
  • trunk/src/styles/qmotifplusstyle.cpp

    r7 r8  
    757757            QPopupMenu *popupmenu = (QPopupMenu *) widget;
    758758            QMenuItem *mi = opt.menuItem();
     759           
     760            // QPopupMenu has WResizeNoErase and WRepaintNoErase flags, so we
     761            // must erase areas not covered by menu items (this is requested by
     762            // QPopupMenu using 0 as the menu item argument).
     763            // [Win32 version feels ok without this, because it doesn't actually
     764            // fully obey WResizeNoErase and WRepaintNoErase: WM_ERASEBKGND always
     765            // erases the background before WM_PAINT and after every resize].
     766#if !defined (Q_WS_PM)
    759767            if ( !mi )
    760768                break;
     769#endif
    761770
    762771            int tab = opt.tabWidth();
  • trunk/src/styles/qmotifstyle.cpp

    r7 r8  
    10041004            const QPopupMenu *popupmenu = (const QPopupMenu *) widget;
    10051005            QMenuItem *mi = opt.menuItem();
     1006           
     1007            // QPopupMenu has WResizeNoErase and WRepaintNoErase flags, so we
     1008            // must erase areas not covered by menu items (this is requested by
     1009            // QPopupMenu using 0 as the menu item argument).
     1010            // [Win32 version feels ok without this, because it doesn't actually
     1011            // fully obey WResizeNoErase and WRepaintNoErase: WM_ERASEBKGND always
     1012            // erases the background before WM_PAINT and after every resize].
     1013#if !defined (Q_WS_PM)
    10061014            if ( !mi )
    10071015                break;
     1016#endif
    10081017
    10091018            int tab = opt.tabWidth();
  • trunk/src/styles/qsgistyle.cpp

    r7 r8  
    946946                break;
    947947            QMenuItem *mi = opt.menuItem();
     948           
     949            // QPopupMenu has WResizeNoErase and WRepaintNoErase flags, so we
     950            // must erase areas not covered by menu items (this is requested by
     951            // QPopupMenu using 0 as the menu item argument).
     952            // [Win32 version feels ok without this, because it doesn't actually
     953            // fully obey WResizeNoErase and WRepaintNoErase: WM_ERASEBKGND always
     954            // erases the background before WM_PAINT and after every resize].
     955#if !defined (Q_WS_PM)
    948956            if ( !mi )
    949957                break;
     958#endif
    950959            const QPopupMenu *popupmenu = (const QPopupMenu *) widget;
    951960            int tab = opt.tabWidth();
  • trunk/src/styles/qwindowsstyle.cpp

    r7 r8  
    8585enum QSliderDirection { SlUp, SlDown, SlLeft, SlRight };
    8686
     87#ifndef QT_NO_MENUDATA
    8788// A friendly class providing access to QMenuData's protected member.
    8889class FriendlyMenuData : public QMenuData
     
    9091    friend class QWindowsStyle;
    9192};
     93#endif
    9294
    9395// Private class
     
    158160        break;
    159161    case QEvent::KeyRelease:
     162#ifndef QT_NO_MENUDATA
    160163        if (((QKeyEvent*)e)->key() == Key_Alt) {
    161164            widget = widget->topLevelWidget();
     
    172175            }
    173176        }
     177#endif
    174178        break;
    175179    case QEvent::FocusIn:
    176180    case QEvent::FocusOut:
     181#ifndef QT_NO_MENUBAR
    177182        {
    178183            // Menubars toggle based on focus
     
    181186                menuBarTimer = menuBar->startTimer(0);
    182187        }
     188#endif
    183189        break;
    184190    case QEvent::Close:
     
    188194        break;
    189195    case QEvent::Timer:
     196#ifndef QT_NO_MENUBAR
    190197        {
    191198            QMenuBar *menuBar = ::qt_cast<QMenuBar*>(o);
     
    198205            }
    199206        }
     207#endif
    200208        break;
    201209    default:
     
    841849            const QPopupMenu *popupmenu = (const QPopupMenu *) widget;
    842850            QMenuItem *mi = opt.menuItem();
     851           
     852            // QPopupMenu has WResizeNoErase and WRepaintNoErase flags, so we
     853            // must erase areas not covered by menu items (this is requested by
     854            // QPopupMenu using 0 as the menu item argument).
     855            // [Win32 version feels ok without this, because it doesn't actually
     856            // fully obey WResizeNoErase and WRepaintNoErase: WM_ERASEBKGND always
     857            // erases the background before WM_PAINT and after every resize].
     858#if !defined (Q_WS_PM)
    843859            if ( !mi )
    844860                break;
    845 
     861#endif
     862           
    846863            int tab = opt.tabWidth();
    847864            int maxpmw = opt.maxIconWidth();
  • 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
  • trunk/src/widgets/qdockwindow.cpp

    r7 r8  
    391391    timer = new QTimer( this );
    392392    connect( timer, SIGNAL( timeout() ), this, SLOT( minimize() ) );
    393 #ifdef Q_WS_WIN
     393#if defined(Q_WS_WIN) || defined(Q_WS_PM)
    394394    setCursor( SizeAllCursor );
    395395#endif
  • trunk/src/widgets/qlabel.cpp

    r7 r8  
    280280      ( ( textformat == AutoText ) && QStyleSheet::mightBeRichText(ltext) ) );
    281281#else
    282     bool useRichText = TRUE;
     282    bool useRichText = FALSE;
    283283#endif
    284284#ifndef QT_NO_ACCEL
     
    711711
    712712        if ( x + w < cr.right() )
    713             reg = reg.unite( QRect( x + w, cr.y(),  cr.right() - x - w, cr.height() ) );
     713            reg = reg.unite( QRect( x + w, cr.y(),  cr.right() - x - w + 1, cr.height() ) );
    714714        if ( y + h < cr.bottom() )
    715             reg = reg.unite( QRect( cr.x(), y +  h, cr.width(), cr.bottom() - y - h ) );
     715            reg = reg.unite( QRect( cr.x(), y +  h, cr.width(), cr.bottom() - y - h + 1 ) );
    716716
    717717        erase( reg );
  • trunk/src/widgets/qlineedit.cpp

    r7 r8  
    13791379            case Key_Left:
    13801380            case Key_Right:
    1381 #if defined (Q_WS_WIN)
     1381#if defined (Q_WS_WIN) || (defined (Q_WS_PM) && !defined (QT_NO_CLIPBOARD))
    13821382            case Key_Insert:
    13831383            case Key_Delete:
     
    16361636            }
    16371637            break;
    1638 #if defined (Q_WS_WIN)
     1638#if defined (Q_WS_WIN) || defined (Q_WS_PM)
    16391639        case Key_Insert:
    16401640            copy();
     
    17131713        case Key_Delete:
    17141714            if ( !d->readOnly ) {
    1715 #if defined (Q_WS_WIN)
     1715#if defined (Q_WS_WIN) || (defined (Q_WS_PM) && !defined (QT_NO_CLIPBOARD))
    17161716                if ( e->state() & ShiftButton ) {
    17171717                    cut();
     
    17221722            }
    17231723            break;
    1724 #if defined (Q_WS_WIN)
     1724#if defined (Q_WS_WIN) || (defined (Q_WS_PM) && !defined (QT_NO_CLIPBOARD))
    17251725        case Key_Insert:
    17261726            if ( !d->readOnly && e->state() & ShiftButton )
  • trunk/src/widgets/qpopupmenu.cpp

    r7 r8  
    15091509        itemh = sz.height();
    15101510
    1511         if ( ncols > 1 && y + itemh > contentsRect().bottom() ) {
    1512             if ( y < contentsRect().bottom() ) {
    1513                 QRect rect(x, y, itemw, contentsRect().bottom() - y);
     1511        if ( ncols > 1 && y + itemh - 1 > contentsRect().bottom() ) {
     1512            if ( y <= contentsRect().bottom() ) {
     1513                QRect rect(x, y, itemw, contentsRect().bottom() - y + 1);
    15141514                if(!p->hasClipping() || p->clipRegion().contains(rect)) {
    15151515                    flags = QStyle::Style_Default;
     
    15281528        ++row;
    15291529    }
    1530     if ( y < contentsRect().bottom() ) {
    1531         QRect rect(x, y, itemw, contentsRect().bottom() - y);
     1530    if ( y <= contentsRect().bottom() ) {
     1531        QRect rect(x, y, itemw, contentsRect().bottom() - y + 1);
    15321532        if(!p->hasClipping() || p->clipRegion().contains(rect)) {
    15331533            flags = QStyle::Style_Default;
     
    16761676                actSig( mi->id(), b);
    16771677            }
     1678#endif
     1679#if defined(Q_WS_PM)
     1680#ifndef QT_NO_WHATSTHIS
     1681            else
     1682#endif
     1683//@@TODO (dmik): we need to play a sound when a disabled item is activated
     1684//  to conform to the OS/2 CUA. Btw, should'n it be supported by QAccessibility
     1685//  globally in Qt?
     1686                WinAlarm( HWND_DESKTOP, WA_ERROR );
    16781687#endif
    16791688        } else  if ( popup ) {
     
    19191928#endif
    19201929            mi = mitems->at( actItem );
    1921             if ( !mi->isEnabled() && !b )
     1930            if ( !mi->isEnabled() && !b ) {
     1931#if defined(Q_WS_PM)
     1932//@@TODO (dmik): we need to play a sound when a disabled item is activated
     1933//  to conform to the OS/2 CUA. Btw, should'n it be supported by QAccessibility
     1934//  globally in Qt?
     1935                WinAlarm( HWND_DESKTOP, WA_ERROR );
     1936#endif
    19221937                break;
     1938            }
    19231939            popup = mi->popup();
    19241940            if ( popup ) {
     
    20092025                popup->setFirstItemActive();
    20102026            } else {
     2027#if !defined(Q_WS_PM) // do it later, only in case of item activation
    20112028                byeMenuBar();
     2029#endif
    20122030#ifndef QT_NO_WHATSTHIS
    20132031                bool b = QWhatsThis::inWhatsThisMode();
     
    20162034#endif
    20172035                if ( mi->isEnabledAndVisible() || b ) {
     2036#if defined(Q_WS_PM)
     2037                    byeMenuBar();
     2038#endif
    20182039                    active_popup_menu = this;
    20192040                    QGuardedPtr<QSignal> signal = mi->signal();
     
    20232044                    active_popup_menu = 0;
    20242045                }
     2046#if defined(Q_WS_PM)
     2047//@@TODO (dmik): we need to play a sound when the disabled item is activated
     2048//  to conform to the OS/2 CUA. Btw, should'n it be supported by QAccessibility
     2049//  globally in Qt?
     2050                else
     2051                    WinAlarm( HWND_DESKTOP, WA_ERROR );
     2052#endif
    20252053            }
    20262054        } else if ( clashCount > 1 ) { // Clashes, highlight next...
  • trunk/src/widgets/qscrollview.cpp

    r7 r8  
    579579
    580580QScrollView::QScrollView( QWidget *parent, const char *name, WFlags f ) :
    581     QFrame( parent, name, f & (~WStaticContents) & (~WResizeNoErase) )
    582 {
    583     WFlags flags = WResizeNoErase | (f&WPaintClever) | (f&WRepaintNoErase) | (f&WStaticContents);
     581    QFrame( parent, name, f & (~WStaticContents) & (~WResizeNoErase) & (~WRepaintNoErase) )
     582{
     583    WFlags flags = (f&WResizeNoErase) | (f&WPaintClever) | (f&WRepaintNoErase) | (f&WStaticContents);
    584584    d = new QScrollViewData( this, flags );
    585585
  • trunk/src/widgets/qsplitter.cpp

    r7 r8  
    507507{
    508508    QPainter paint( this );
    509     paint.setPen( gray );
     509    paint.setPen( NoPen );
    510510    paint.setBrush( gray );
    511511    paint.setRasterOp( XorROP );
     
    513513    const int rBord = 3; // customizable?
    514514    int hw = handleWidth();
     515
     516    int p1, p2, op1, op2, tmp;
     517    if ( p >= 0 ) {
     518        p1 = p + hw / 2 - rBord;
     519        p2 = p1 + 2 * rBord - 1;
     520    }
     521    if ( opaqueOldPos >= 0 ) {
     522        op1 = opaqueOldPos + hw / 2 - rBord;
     523        op2 = op1 + 2 * rBord - 1;
     524        // exclude overlapping area to avoid flicker
     525        if ( p >= 0 ) {
     526            if ( p2 >= op1 && p2 <= op2 ) {
     527                tmp = op1;
     528                op1 = p2 + 1;
     529                p2 = tmp - 1;
     530            } else if ( p1 >= op1 && p1 <= op2 ) {
     531                tmp = op2;
     532                op2 = p1 - 1;
     533                p1 = tmp + 1;
     534            }
     535        }
     536    }
    515537    if ( orient == Horizontal ) {
    516538        if ( opaqueOldPos >= 0 )
    517             paint.drawRect( opaqueOldPos + hw / 2 - rBord, r.y(),
    518                             2 * rBord, r.height() );
     539            paint.drawRect( op1, r.y(), op2 - op1 + 1, r.height() );
    519540        if ( p >= 0 )
    520             paint.drawRect( p + hw / 2 - rBord, r.y(), 2 * rBord, r.height() );
     541            paint.drawRect( p1, r.y(), p2 - p1 + 1, r.height() );
    521542    } else {
    522543        if ( opaqueOldPos >= 0 )
    523             paint.drawRect( r.x(), opaqueOldPos + hw / 2 - rBord,
    524                             r.width(), 2 * rBord );
     544            paint.drawRect( r.x(), op1, r.width(), op2 - op1 + 1 );
    525545        if ( p >= 0 )
    526             paint.drawRect( r.x(), p + hw / 2 - rBord, r.width(), 2 * rBord );
     546            paint.drawRect( r.x(), p1, r.width(), p2 - p1 + 1 );
    527547    }
    528548    opaqueOldPos = p;
  • trunk/src/widgets/qtextedit.cpp

    r7 r8  
    11621162            case Key_Home:
    11631163            case Key_End:
    1164 #if defined (Q_WS_WIN)
     1164#if defined (Q_WS_WIN) || defined (Q_WS_PM)
    11651165            case Key_Insert:
    11661166            case Key_Delete:
     
    11721172        } else {
    11731173            switch ( ke->key() ) {
    1174 #if defined (Q_WS_WIN)
     1174#if defined (Q_WS_WIN) || defined (Q_WS_PM)
    11751175            case Key_Insert:
    11761176                ke->accept();
     
    12761276        break;
    12771277    case Key_Delete:
    1278 #if defined (Q_WS_WIN)
     1278#if defined (Q_WS_WIN) || defined (Q_WS_PM)
    12791279        if ( e->state() & ShiftButton ) {
    12801280            cut();
     
    12941294        if ( e->state() & ShiftButton )
    12951295            paste();
    1296 #if defined (Q_WS_WIN)
     1296#if defined (Q_WS_WIN) || defined (Q_WS_PM)
    12971297        else if ( e->state() & ControlButton )
    12981298            copy();
     
    13021302        break;
    13031303    case Key_Backspace:
    1304 #if defined (Q_WS_WIN)
     1304#if defined (Q_WS_WIN) || defined (Q_WS_PM)
    13051305        if ( e->state() & AltButton ) {
    13061306            if (e->state() & ControlButton ) {
     
    15171517                    doKeyboardAction( ActionKill );
    15181518                    break;
    1519 #if defined(Q_WS_WIN)
     1519#if defined(Q_WS_WIN) || defined (Q_WS_PM)
    15201520                case Key_Insert:
    15211521                    copy();
     
    24082408            emitLinkClicked( u.toString( FALSE, FALSE ) );
    24092409        }
     2410#ifndef QT_NO_TEXTBROWSER
    24102411        if (::qt_cast<QTextBrowser*>(this)) { // change for 4.0
    24112412            QConnectionList *clist = receivers(
     
    24182419            }
    24192420        }
     2421#endif       
    24202422
    24212423        // emitting linkClicked() may result in that the cursor winds
     
    47244726            }
    47254727            if (!doc->focusIndicator.name.isEmpty()) {
     4728#ifndef QT_NO_TEXTBROWSER
    47264729                if (::qt_cast<QTextBrowser*>(this)) { // change for 4.0
    47274730                    QConnectionList *clist = receivers(
     
    47364739                    }
    47374740                }
     4741#endif               
    47384742            }
    47394743#ifndef QT_NO_CURSOR
     
    47494753                copy();
    47504754                break;
    4751 #ifdef Q_WS_WIN
     4755#if defined (Q_WS_WIN) || defined (Q_WS_PM)
    47524756            case Key_Insert:
    47534757                copy();
     
    50105014        }
    50115015    } else {
    5012 #if defined(Q_OS_WIN32)
     5016#if defined(Q_OS_WIN32) || defined (Q_OS_OS2)
    50135017        // Need to convert CRLF to LF
    50145018        t.replace( "\r\n", "\n" );
     
    66926696    int endLine = startLine + nLines;
    66936697
    6694     if ( startLine >= d->od->numLines )
    6695         return;
     6698    if ( startLine >= d->od->numLines ) {
     6699#if defined (Q_WS_PM)
     6700        // see below for more info
     6701        p->eraseRect( clipx, clipy, clipw, cliph );
     6702#endif
     6703        return;
     6704    }
     6705   
    66966706    if ( (startLine + nLines) > d->od->numLines )
    66976707        nLines = d->od->numLines - startLine;
     
    68426852    td->draw( p, r.x(), r.y(), r.width(), r.height(), colorGroup() );
    68436853    p->translate( 0, -(clipy - offset) );
     6854   
     6855#if defined (Q_WS_PM)
     6856    // QTextEdit has WResizeNoErase and WRepaintNoErase flags (actually applied
     6857    // to the viewport()), so we must erase areas not covered by the text doc.
     6858    // [Win32 version feels ok without this, because it doesn't actually
     6859    // fully obey WResizeNoErase and WRepaintNoErase: WM_ERASEBKGND always
     6860    // erases the background before WM_PAINT and after every resize].
     6861   
     6862    int tw = td->width();
     6863    // calculate the height the text doc will occupy starting with clipy
     6864    int th = td->height() - offset; 
     6865    if ( clipx + clipw > td->width() ) {
     6866        // erase background to the left of every line
     6867        p->eraseRect( tw, clipy, clipx + clipw - tw, th );
     6868    }
     6869    if ( cliph > th ) {
     6870        // erase background under the text doc
     6871        p->eraseRect( clipx, clipy + th, clipw, cliph - th );
     6872    }
     6873#endif
     6874   
    68446875    delete td;
    68456876}
  • trunk/src/widgets/qtitlebar.cpp

    r7 r8  
    5858#if defined(Q_WS_WIN)
    5959#include "qt_windows.h"
     60#elif defined(Q_WS_PM)
     61#include "qt_os2.h"
    6062#endif
    6163
     
    189191}
    190192
    191 #ifdef Q_WS_WIN
     193#if defined (Q_WS_WIN)
    192194extern QRgb qt_colorref2qrgb(COLORREF col);
     195#elif defined (Q_WS_PM)
     196extern QRgb qt_sysclr2qrgb( LONG sysClr );
    193197#endif
    194198
     
    196200{
    197201    QPalette pal = palette();
     202
     203#if defined (Q_WS_PM)
     204    // we always use PM system colors for titlebars (regardless of
     205    // QApplication::desktopSettingsAware()), because the simulation will
     206    // most likely produce the same color both for an active and inactive title.
     207    pal.setColor( QPalette::Active, QColorGroup::Highlight,
     208        QColor( qt_sysclr2qrgb( SYSCLR_ACTIVETITLE ) ) );
     209    pal.setColor( QPalette::Active, QColorGroup::Base,
     210        pal.active().highlight() );
     211    pal.setColor( QPalette::Active, QColorGroup::HighlightedText,
     212        QColor( qt_sysclr2qrgb( SYSCLR_ACTIVETITLETEXT ) ) );
     213    pal.setColor( QPalette::Inactive, QColorGroup::Highlight,
     214        QColor( qt_sysclr2qrgb( SYSCLR_INACTIVETITLE ) ) );
     215    pal.setColor( QPalette::Inactive, QColorGroup::Base,
     216        pal.inactive().highlight() );
     217    pal.setColor( QPalette::Inactive, QColorGroup::HighlightedText,
     218        QColor( qt_sysclr2qrgb( SYSCLR_INACTIVETITLETEXT ) ) );
     219#else
    198220
    199221    bool colorsInitialized = FALSE;
     
    239261        pal.setColor( QPalette::Inactive, QColorGroup::HighlightedText, palette().inactive().background() );
    240262    }
     263#endif // Q_WS_PM
    241264
    242265    setPalette( pal );
  • trunk/src/widgets/qtooltip.cpp

    r7 r8  
    126126    int wakeUpDelay;
    127127    QTimer  fallAsleep;
     128#ifdef Q_WS_PM
     129    QTimer  doAllowAnimation;
     130#endif   
    128131
    129132    QPtrDict<Tip> *tips;
     
    164167    connect( &wakeUp, SIGNAL(timeout()), SLOT(showTip()) );
    165168    connect( &fallAsleep, SIGNAL(timeout()), SLOT(hideTip()) );
     169#ifdef Q_WS_PM   
     170    connect( &doAllowAnimation, SIGNAL(timeout()), SLOT(allowAnimation()) );
     171#endif   
    166172    removeTimer = new QTimer( this );
    167173}
     
    589595void QTipManager::hideTip()
    590596{
     597#ifdef Q_WS_PM
     598    // OS/2 PM has a very low limit on the number of simultaneous PM timers,
     599    // so we reuse the same timer instead of creating a new one every time this
     600    // function is invoked (it can happen more frequently than once per 250 ms).
     601    doAllowAnimation.start( 250, TRUE );
     602#else
    591603    QTimer::singleShot( 250, this, SLOT(allowAnimation()) );
     604#endif   
    592605    preventAnimation = TRUE;
    593606
  • trunk/src/widgets/qwidgetresizehandler.cpp

    r7 r8  
    4545#if defined(Q_WS_WIN)
    4646#include "qt_windows.h"
     47#elif defined(Q_WS_PM)
     48#include "qt_os2.h"
    4749#endif
    4850
     
    306308            ;
    307309    } );
     310#elif defined(Q_WS_PM)
     311    QMSG qmsg;
     312    while( WinPeekMsg( 0, &qmsg, widget->winId(), WM_MOUSEMOVE, WM_MOUSEMOVE, PM_REMOVE ) )
     313        ;
    308314#endif
    309315
Note: See TracChangeset for help on using the changeset viewer.