~oif-team/ubuntu/natty/qt4-x11/xi2.1

« back to all changes in this revision

Viewing changes to src/qt3support/widgets/q3datetimeedit.cpp

  • Committer: Bazaar Package Importer
  • Author(s): Alessandro Ghersi
  • Date: 2009-11-02 18:30:08 UTC
  • mfrom: (1.2.2 upstream)
  • mto: (15.2.5 experimental)
  • mto: This revision was merged to the branch mainline in revision 88.
  • Revision ID: james.westby@ubuntu.com-20091102183008-b6a4gcs128mvfb3m
Tags: upstream-4.6.0~beta1
ImportĀ upstreamĀ versionĀ 4.6.0~beta1

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
1
/****************************************************************************
2
2
**
3
3
** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies).
 
4
** All rights reserved.
4
5
** Contact: Nokia Corporation (qt-info@nokia.com)
5
6
**
6
7
** This file is part of the Qt3Support module of the Qt Toolkit.
7
8
**
8
9
** $QT_BEGIN_LICENSE:LGPL$
9
 
** Commercial Usage
10
 
** Licensees holding valid Qt Commercial licenses may use this file in
11
 
** accordance with the Qt Commercial License Agreement provided with the
12
 
** Software or, alternatively, in accordance with the terms contained in
13
 
** a written agreement between you and Nokia.
 
10
** No Commercial Usage
 
11
** This file contains pre-release code and may not be distributed.
 
12
** You may use this file in accordance with the terms and conditions
 
13
** contained in the Technology Preview License Agreement accompanying
 
14
** this package.
14
15
**
15
16
** GNU Lesser General Public License Usage
16
17
** Alternatively, this file may be used under the terms of the GNU Lesser
20
21
** ensure the GNU Lesser General Public License version 2.1 requirements
21
22
** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
22
23
**
23
 
** In addition, as a special exception, Nokia gives you certain
24
 
** additional rights. These rights are described in the Nokia Qt LGPL
25
 
** Exception version 1.0, included in the file LGPL_EXCEPTION.txt in this
26
 
** package.
27
 
**
28
 
** GNU General Public License Usage
29
 
** Alternatively, this file may be used under the terms of the GNU
30
 
** General Public License version 3.0 as published by the Free Software
31
 
** Foundation and appearing in the file LICENSE.GPL included in the
32
 
** packaging of this file.  Please review the following information to
33
 
** ensure the GNU General Public License version 3.0 requirements will be
34
 
** met: http://www.gnu.org/copyleft/gpl.html.
35
 
**
36
 
** If you are unsure which license is appropriate for your use, please
37
 
** contact the sales department at http://www.qtsoftware.com/contact.
 
24
** In addition, as a special exception, Nokia gives you certain additional
 
25
** rights.  These rights are described in the Nokia Qt LGPL Exception
 
26
** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
 
27
**
 
28
** If you have questions regarding the use of this file, please contact
 
29
** Nokia at qt-info@nokia.com.
 
30
**
 
31
**
 
32
**
 
33
**
 
34
**
 
35
**
 
36
**
 
37
**
38
38
** $QT_END_LICENSE$
39
39
**
40
40
****************************************************************************/
114
114
    lTimeSep = new QString();
115
115
 
116
116
#if defined(Q_WS_WIN)
117
 
    QT_WA({
118
 
        TCHAR data[10];
119
 
        GetLocaleInfo(LOCALE_USER_DEFAULT, LOCALE_SDATE, data, 10);
120
 
        *lDateSep = QString::fromUtf16((ushort*)data);
121
 
        GetLocaleInfo(LOCALE_USER_DEFAULT, LOCALE_STIME, data, 10);
122
 
        *lTimeSep = QString::fromUtf16((ushort*)data);
123
 
        GetLocaleInfo(LOCALE_USER_DEFAULT, LOCALE_ITIME, data, 10);
124
 
        lAMPM = QString::fromUtf16((ushort*)data).toInt()==0;
125
 
        GetLocaleInfo(LOCALE_USER_DEFAULT, LOCALE_S1159, data, 10);
126
 
        QString am = QString::fromUtf16((ushort*)data);
127
 
        if (!am.isEmpty())
128
 
            lAM = new QString(am);
129
 
        GetLocaleInfo(LOCALE_USER_DEFAULT, LOCALE_S2359, data, 10);
130
 
        QString pm = QString::fromUtf16((ushort*)data);
131
 
        if (!pm.isEmpty() )
132
 
            lPM = new QString(pm);
133
 
    } , {
134
 
        char data[10];
135
 
        GetLocaleInfoA(LOCALE_USER_DEFAULT, LOCALE_SDATE, (char*)&data, 10);
136
 
        *lDateSep = QString::fromLocal8Bit(data);
137
 
        GetLocaleInfoA(LOCALE_USER_DEFAULT, LOCALE_STIME, (char*)&data, 10);
138
 
        *lTimeSep = QString::fromLocal8Bit(data);
139
 
        GetLocaleInfoA(LOCALE_USER_DEFAULT, LOCALE_ITIME, (char*)&data, 10);
140
 
        lAMPM = QString::fromLocal8Bit(data).toInt()==0;
141
 
        GetLocaleInfoA(LOCALE_USER_DEFAULT, LOCALE_S1159, (char*)&data, 10);
142
 
        QString am = QString::fromLocal8Bit(data);
143
 
        if (!am.isEmpty())
144
 
            lAM = new QString(am);
145
 
        GetLocaleInfoA(LOCALE_USER_DEFAULT, LOCALE_S2359, (char*)&data, 10);
146
 
        QString pm = QString::fromLocal8Bit(data);
147
 
        if (!pm.isEmpty())
148
 
            lPM = new QString(pm);
149
 
    });
 
117
    wchar_t data[10];
 
118
    GetLocaleInfo(LOCALE_USER_DEFAULT, LOCALE_SDATE, data, 10);
 
119
    *lDateSep = QString::fromWCharArray(data);
 
120
    GetLocaleInfo(LOCALE_USER_DEFAULT, LOCALE_STIME, data, 10);
 
121
    *lTimeSep = QString::fromWCharArray(data);
 
122
    GetLocaleInfo(LOCALE_USER_DEFAULT, LOCALE_ITIME, data, 10);
 
123
    lAMPM = QString::fromWCharArray(data).toInt() == 0;
 
124
    GetLocaleInfo(LOCALE_USER_DEFAULT, LOCALE_S1159, data, 10);
 
125
    QString am = QString::fromWCharArray(data);
 
126
    if (!am.isEmpty())
 
127
        lAM = new QString(am);
 
128
    GetLocaleInfo(LOCALE_USER_DEFAULT, LOCALE_S2359, data, 10);
 
129
    QString pm = QString::fromWCharArray(data);
 
130
    if (!pm.isEmpty() )
 
131
        lPM = new QString(pm);
150
132
#else
151
133
    *lDateSep = QLatin1Char('-');
152
134
    *lTimeSep = QLatin1Char(':');
1262
1244
}
1263
1245
 
1264
1246
 
1265
 
/*! \reimp
 
1247
/*! \internal
1266
1248
 
1267
1249
*/
1268
1250
void Q3DateEdit::stepUp()
1294
1276
 
1295
1277
 
1296
1278
 
1297
 
/*! \reimp
 
1279
/*! \internal
1298
1280
 
1299
1281
*/
1300
1282
 
1458
1440
    return false; /* assume ok */
1459
1441
}
1460
1442
 
1461
 
/*!  \reimp
 
1443
/*!  \internal
1462
1444
 
1463
1445
*/
1464
1446
 
1552
1534
}
1553
1535
 
1554
1536
 
1555
 
/*! \reimp
 
1537
/*! \internal
1556
1538
 
1557
1539
*/
1558
1540
 
1699
1681
    d->ed->repaint(d->ed->rect());
1700
1682
}
1701
1683
 
1702
 
/*! \reimp
 
1684
/*! \internal
1703
1685
 
1704
1686
*/
1705
1687
 
2077
2059
}
2078
2060
 
2079
2061
 
2080
 
/*! \reimp
 
2062
/*! \internal
2081
2063
 
2082
2064
*/
2083
2065
 
2123
2105
}
2124
2106
 
2125
2107
 
2126
 
/*! \reimp
 
2108
/*! \internal
2127
2109
 
2128
2110
*/
2129
2111
 
2191
2173
}
2192
2174
 
2193
2175
 
2194
 
/*! \reimp
 
2176
/*! \internal
2195
2177
 
2196
2178
*/
2197
2179
 
2326
2308
    return true;
2327
2309
}
2328
2310
 
2329
 
/*! \reimp
 
2311
/*! \internal
2330
2312
 
2331
2313
*/
2332
2314
 
2495
2477
    d->ed->repaint(d->ed->rect());
2496
2478
}
2497
2479
 
2498
 
/*! \reimp
 
2480
/*! \internal
2499
2481
 
2500
2482
*/
2501
2483
void Q3TimeEdit::removeLastNumber(int sec)
2666
2648
}
2667
2649
 
2668
2650
 
2669
 
/*!
 
2651
/*! \fn void Q3DateTimeEdit::resizeEvent(QResizeEvent *event)
2670
2652
    \reimp
2671
2653
 
2672
 
    Intercepts and handles resize events which have special meaning
2673
 
    for the Q3DateTimeEdit.
 
2654
    Intercepts and handles the resize \a event, which hase a
 
2655
    special meaning for the Q3DateTimeEdit.
2674
2656
*/
2675
 
 
2676
2657
void Q3DateTimeEdit::resizeEvent(QResizeEvent *)
2677
2658
{
2678
2659
    int dw = de->sizeHint().width();