ooo-build r12868 - in trunk: . patches/dev300
- From: jholesovsky svn gnome org
- To: svn-commits-list gnome org
- Subject: ooo-build r12868 - in trunk: . patches/dev300
- Date: Thu, 12 Jun 2008 09:36:19 +0000 (UTC)
Author: jholesovsky
Date: Thu Jun 12 09:36:19 2008
New Revision: 12868
URL: http://svn.gnome.org/viewvc/ooo-build?rev=12868&view=rev
Log:
2008-06-12 Jan Holesovsky <kendy suse cz>
* patches/dev300/kde4-configure.diff,
patches/dev300/kde4-kab.diff,
patches/dev300/kde4-kdebe.diff,
patches/dev300/kde4-kdedata.cxx.diff,
patches/dev300/kde4-kde_headers.diff,
patches/dev300/kde4-salnativewidgets-kde.diff,
patches/dev300/apply: Experimental KDE4 support by Eric Bischoff.
Added:
trunk/patches/dev300/kde4-configure.diff
trunk/patches/dev300/kde4-kab.diff
trunk/patches/dev300/kde4-kde_headers.diff
trunk/patches/dev300/kde4-kdebe.diff
trunk/patches/dev300/kde4-kdedata.cxx.diff
trunk/patches/dev300/kde4-salnativewidgets-kde.diff
Modified:
trunk/ChangeLog
trunk/patches/dev300/apply
Modified: trunk/patches/dev300/apply
==============================================================================
--- trunk/patches/dev300/apply (original)
+++ trunk/patches/dev300/apply Thu Jun 12 09:36:19 2008
@@ -30,7 +30,7 @@
VBAUntested, ArkOnlyExperimental, SharedWorksheets, \
UnUsedButNotYetRemovedFromSVN, \
PostgreSQL, SELinux, VOSremoval, Glib2, \
- UnitBootstrap, RadioButtons, UnstableLibwpd, WWInProgress
+ UnitBootstrap, RadioButtons, UnstableLibwpd, WWInProgress, KDE4
# Optional sections
Optional : DejaVuFonts
# Binfilter patches: a special distro; applied only when building with binfilter
@@ -1877,7 +1877,8 @@
[ UnitTesting ]
SectionOwner => jholesov
-# FIXME: file when ready
+SectionIssue => i#87469
+# FIXME: file more issuses when ready
# teach build.pl what to do with prj/tests.lst's
unittesting-build-pl.diff
@@ -2258,3 +2259,16 @@
[ Fixes ]
cppcanvas-fix-roundcorners.diff, rodo
+
+[ KDE4 ]
+SectionOwner => jholesov
+SectionIssue => i#90618
+
+# Initial KDE4 support by Eric Bischoff
+kde4-configure.diff
+kde4-kab.diff
+kde4-kdebe.diff
+kde4-kdedata.cxx.diff
+kde4-kde_headers.diff
+kde4-salnativewidgets-kde.diff
+
Added: trunk/patches/dev300/kde4-configure.diff
==============================================================================
--- (empty file)
+++ trunk/patches/dev300/kde4-configure.diff Thu Jun 12 09:36:19 2008
@@ -0,0 +1,60 @@
+--- config_office/configure.in 2008-03-20 22:47:28.000000000 +0100
++++ config_office/configure.in 2008-03-20 23:46:34.000000000 +0100
+@@ -5640,11 +5640,11 @@
+ MOC="moc"
+ if test "$test_kde" = "yes" -a "$ENABLE_KDE" = "TRUE" ; then
+ if test "$build_cpu" != "x86_64" ; then
+- qt_incdirs="$QTINC /usr/local/qt/include /usr/include/qt /usr/include /usr/X11R6/include/X11/qt /usr/X11R6/include/qt /usr/lib/qt3/include /usr/lib/qt/include /usr/share/qt3/include $x_includes"
+- qt_libdirs="$QTLIB /usr/local/qt/lib /usr/lib/qt /usr/lib /usr/X11R6/lib/X11/qt /usr/X11R6/lib/qt /usr/lib/qt3/lib /usr/lib/qt/lib /usr/share/qt3/lib $x_libraries"
++ qt_incdirs="$QTINC /usr/local/qt/include /usr/include/qt /usr/include /usr/X11R6/include/X11/qt /usr/X11R6/include/qt /usr/lib/qt4/include /usr/lib/qt/include /usr/share/qt4/include $x_includes"
++ qt_libdirs="$QTLIB /usr/local/qt/lib /usr/lib/qt /usr/lib /usr/X11R6/lib/X11/qt /usr/X11R6/lib/qt /usr/lib/qt4/lib /usr/lib/qt/lib /usr/share/qt4/lib $x_libraries"
+ else
+- qt_incdirs="$QTINC /usr/local/qt/include /usr/include/qt /usr/include /usr/X11R6/include/X11/qt /usr/X11R6/include/qt /usr/lib64/qt3/include /usr/lib64/qt/include /usr/share/qt3/include /usr/lib/qt3/include /usr/lib/qt/include $x_includes"
+- qt_libdirs="$QTLIB /usr/local/qt/lib64 /usr/lib64/qt /usr/lib64 /usr/X11R6/lib64/X11/qt /usr/X11R6/lib64/qt /usr/lib64/qt3/lib64 /usr/lib64/qt/lib64 /usr/share/qt3/lib64 /usr/local/qt/lib /usr/lib/qt /usr/lib /usr/X11R6/lib/X11/qt /usr/X11R6/lib/qt /usr/lib/qt3/lib /usr/lib/qt/lib /usr/share/qt3/lib $x_libraries"
++ qt_incdirs="$QTINC /usr/local/qt/include /usr/include/qt /usr/include /usr/X11R6/include/X11/qt /usr/X11R6/include/qt /usr/lib64/qt4/include /usr/lib64/qt/include /usr/share/qt4/include /usr/lib/qt4/include /usr/lib/qt/include $x_includes"
++ qt_libdirs="$QTLIB /usr/local/qt/lib64 /usr/lib64/qt /usr/lib64 /usr/X11R6/lib64/X11/qt /usr/X11R6/lib64/qt /usr/lib64/qt4/lib64 /usr/lib64/qt/lib64 /usr/share/qt4/lib64 /usr/local/qt/lib /usr/lib/qt /usr/lib /usr/X11R6/lib/X11/qt /usr/X11R6/lib/qt /usr/lib/qt4/lib /usr/lib/qt/lib /usr/share/qt4/lib $x_libraries"
+ fi
+ if test -n "$QTDIR" ; then
+ qt_incdirs="$QTDIR/include $qt_incdirs"
+@@ -5656,11 +5656,11 @@
+ fi
+ fi
+ if test "$build_cpu" != "x86_64" ; then
+- kde_incdirs="/usr/lib/kde/include /usr/local/kde/include /usr/local/include /usr/kde/include /usr/include/kde /usr/include /opt/kde3/include /opt/kde/include $x_includes"
+- kde_libdirs="/usr/lib/kde/lib /usr/local/kde/lib /usr/kde/lib /usr/lib/kde /usr/lib/kde3 /usr/lib /usr/X11R6/lib /usr/local/lib /opt/kde3/lib /opt/kde/lib /usr/X11R6/kde/lib $x_libraries"
++ kde_incdirs="/usr/lib/kde/include /usr/lib/kde4/include /usr/local/kde/include /usr/local/include /usr/kde/include /usr/include/kde /usr/include /opt/kde4/include /opt/kde/include $x_includes"
++ kde_libdirs="/usr/lib/kde/lib /usr/local/kde/lib /usr/kde/lib /usr/lib/kde /usr/lib/kde4 /usr/lib/kde4/lib /usr/lib /usr/X11R6/lib /usr/local/lib /opt/kde4/lib /opt/kde/lib /usr/X11R6/kde/lib $x_libraries"
+ else
+- kde_incdirs="/usr/lib64/kde/include /usr/lib/kde/include /usr/local/kde/include /usr/local/include /usr/kde/include /usr/include/kde /usr/include /opt/kde3/include /opt/kde/include $x_includes"
+- kde_libdirs="/usr/lib64/kde/lib64 /usr/local/kde/lib64 /usr/kde/lib64 /usr/lib64/kde /usr/lib64/kde3 /usr/lib64 /usr/X11R6/lib64 /usr/local/lib64 /opt/kde3/lib64 /opt/kde/lib64 /usr/X11R6/kde/lib64 /usr/lib/kde/lib /usr/local/kde/lib /usr/kde/lib /usr/lib/kde /usr/lib/kde3 /usr/lib /usr/X11R6/lib /usr/local/lib /opt/kde3/lib /opt/kde/lib /usr/X11R6/kde/lib $x_libraries"
++ kde_incdirs="/usr/lib64/kde/include /usr/lib/kde/include /usr/lib/kde4/include /usr/local/kde/include /usr/local/include /usr/kde/include /usr/include/kde /usr/include /opt/kde4/include /opt/kde/include $x_includes"
++ kde_libdirs="/usr/lib64/kde/lib64 /usr/local/kde/lib64 /usr/kde/lib64 /usr/lib64/kde /usr/lib64/kde4 /usr/lib64/kde4/lib /usr/lib64 /usr/X11R6/lib64 /usr/local/lib64 /opt/kde4/lib64 /opt/kde/lib64 /usr/X11R6/kde/lib64 /usr/lib/kde/lib /usr/local/kde/lib /usr/kde/lib /usr/lib/kde /usr/lib/kde4 /usr/lib /usr/X11R6/lib /usr/local/lib /opt/kde4/lib /opt/kde/lib /usr/X11R6/kde/lib $x_libraries"
+ fi
+ if test -n "$KDEDIR" ; then
+ kde_incdirs="$KDEDIR/include $kde_incdirs"
+@@ -5672,8 +5672,8 @@
+ fi
+
+ dnl What to test
+- qt_test_include="qstyle.h"
+- qt_test_library="libqt-mt.so"
++ qt_test_include="Qt/qstyle.h"
++ qt_test_library="libQtCore.so"
+ kde_test_include="ksharedptr.h"
+ kde_test_library="libkdeui.so"
+
+@@ -5789,12 +5789,13 @@
+ AC_LANG_PUSH([C++])
+ save_CXXFLAGS=$CXXFLAGS
+ CXXFLAGS="$CXXFLAGS $KDE_CFLAGS"
+- AC_MSG_CHECKING([whether KDE is between 3.2 and 3.6])
++ AC_MSG_CHECKING([whether KDE is between 3.2 and 4.1])
+ AC_TRY_RUN([
+ #include <kdeversion.h>
+
+ int main(int argc, char **argv) {
+ if (KDE_VERSION_MAJOR == 3 && 2 <= KDE_VERSION_MINOR && KDE_VERSION_MINOR <= 6) return 0;
++ else if (KDE_VERSION_MAJOR == 4 && 0 <= KDE_VERSION_MINOR && KDE_VERSION_MINOR <= 1) return 0;
+ else return 1;
+ }
+ ], [AC_MSG_RESULT([yes])], [AC_MSG_ERROR([KDE version too old or too recent, please use another version of KDE or disable KDE address book support])])
Added: trunk/patches/dev300/kde4-kab.diff
==============================================================================
--- (empty file)
+++ trunk/patches/dev300/kde4-kab.diff Thu Jun 12 09:36:19 2008
@@ -0,0 +1,216 @@
+--- connectivity/source/drivers/kab/kcondition.cxx.old 2008-03-26 01:18:00.000000000 +0100
++++ connectivity/source/drivers/kab/kcondition.cxx 2008-03-26 01:20:59.000000000 +0100
+@@ -141,7 +141,7 @@
+
+ if (aQtName.isNull()) return sal_False;
+
+- ::rtl::OUString sValue((const sal_Unicode *) aQtName.ucs2());
++ ::rtl::OUString sValue((const sal_Unicode *) aQtName.utf16());
+ return sValue == m_sMatchString;
+ }
+ // -----------------------------------------------------------------------------
+@@ -156,7 +156,7 @@
+
+ if (aQtName.isNull()) return sal_False;
+
+- ::rtl::OUString sValue((const sal_Unicode *) aQtName.ucs2());
++ ::rtl::OUString sValue((const sal_Unicode *) aQtName.utf16());
+ return sValue != m_sMatchString;
+ }
+ // -----------------------------------------------------------------------------
+@@ -171,7 +171,7 @@
+
+ if (aQtName.isNull()) return sal_False;
+
+- ::rtl::OUString sValue((const sal_Unicode *) aQtName.ucs2());
++ ::rtl::OUString sValue((const sal_Unicode *) aQtName.utf16());
+ return match(m_sMatchString, sValue, '\0');
+ }
+ // -----------------------------------------------------------------------------
+--- connectivity/source/drivers/kab/KDatabaseMetaData.cxx.old 2008-03-26 01:09:32.000000000 +0100
++++ connectivity/source/drivers/kab/KDatabaseMetaData.cxx 2008-03-26 01:14:08.000000000 +0100
+@@ -90,7 +90,7 @@
+ const ::rtl::OUString & KabDatabaseMetaData::getAddressBookTableName()
+ {
+ static const ::rtl::OUString aAddressBookTableName
+- (::rtl::OUString::createFromAscii( i18n("Address Book") ));
++ (::rtl::OUString::createFromAscii( i18n("Address Book").toAscii() ));
+
+ return aAddressBookTableName;
+ }
+@@ -921,7 +921,7 @@
+ ::rtl::OUString sName;
+
+ aQtName = ::KABC::Addressee::revisionLabel();
+- sName = (const sal_Unicode *) aQtName.ucs2();
++ sName = (const sal_Unicode *) aQtName.utf16();
+ if (match(columnNamePattern, sName, '\0'))
+ {
+ aRow[4] = new ORowSetValueDecorator(sName);
+@@ -939,7 +939,7 @@
+ ++aField, ++nPosition)
+ {
+ aQtName = (*aField)->label();
+- sName = (const sal_Unicode *) aQtName.ucs2();
++ sName = (const sal_Unicode *) aQtName.utf16();
+ if (match(columnNamePattern, sName, '\0'))
+ {
+ aRow[4] = new ORowSetValueDecorator(sName);
+@@ -1034,7 +1034,7 @@
+ {
+ ODatabaseMetaDataResultSet::ORow aRow( 9 );
+ QString aQtName = ::KABC::Addressee::revisionLabel();
+- ::rtl::OUString sName = (const sal_Unicode *) aQtName.ucs2();
++ ::rtl::OUString sName = (const sal_Unicode *) aQtName.utf16();
+
+ aRow[0] = ODatabaseMetaDataResultSet::getEmptyValue();
+ aRow[1] = ODatabaseMetaDataResultSet::getEmptyValue();
+--- connectivity/source/drivers/kab/KDEInit.cxx.old 2008-03-26 01:24:44.000000000 +0100
++++ connectivity/source/drivers/kab/KDEInit.cxx 2008-03-26 03:36:47.000000000 +0100
+@@ -47,7 +47,7 @@
+ private:
+ /// KDE application if we own it
+ static KApplication* s_pKApplication;
+- static bool s_bDidInsertCatalogue;
++ static bool s_bDidInsertCatalog;
+
+ public:
+ static void Init();
+@@ -56,7 +56,7 @@
+
+ // ---------------------------------------------------------------
+ KApplication* KDEInit::s_pKApplication = NULL;
+- bool KDEInit::s_bDidInsertCatalogue = false;
++ bool KDEInit::s_bDidInsertCatalog = false;
+
+ // ---------------------------------------------------------------
+ void KDEInit::Init()
+@@ -68,10 +68,10 @@
+ {
+ OSL_ENSURE(s_pKApplication == NULL, "KDEInit::Init: inconsistency in the application pointers!");
+
+- char *kabargs[1] = {(char*)"libkab1"};
+- KCmdLineArgs::init(1, kabargs, "KAddressBook", *kabargs, "Address Book driver", KAB_DRIVER_VERSION);
++ char *kabargs[1] = {(char *) "libkab1"};
++ KCmdLineArgs::init(1, kabargs, "KAddressBook", *kabargs, ki18n("Address Book driver"), KAB_DRIVER_VERSION);
+
+- s_pKApplication = new KApplication(false, false);
++ s_pKApplication = new KApplication(false);
+ }
+
+ // set language
+@@ -97,20 +97,21 @@
+ QString aLanguage(
+ (const QChar *) pProcessLocale->Language->buffer,
+ (int) pProcessLocale->Language->length);
+- KGlobal::locale()->setLanguage(aLanguage);
++ KConfig *pConfig = KApplication::kApplication()->sessionConfig();
++ KGlobal::locale()->setLanguage(aLanguage, pConfig);
+
+ // load KDE address book's localized messages
+- KGlobal::locale()->insertCatalogue("kaddressbook");
+- s_bDidInsertCatalogue = true;
++ KGlobal::locale()->insertCatalog("kaddressbook");
++ s_bDidInsertCatalog = true;
+ }
+
+ // ---------------------------------------------------------------
+ void KDEInit::Shutdown()
+ {
+- if ( s_bDidInsertCatalogue )
+- // this guard is necessary, since KDE 3.3 seems to crash if we remove a catalogue
++ if ( s_bDidInsertCatalog )
++ // this guard is necessary, since KDE 3.3 seems to crash if we remove a catalog
+ // which we did not previously insert
+- KGlobal::locale()->removeCatalogue("kaddressbook");
++ KGlobal::locale()->removeCatalog("kaddressbook");
+
+ if ( s_pKApplication != NULL )
+ {
+--- connectivity/source/drivers/kab/KDEInit.h.old 2008-03-27 14:38:48.000000000 +0100
++++ connectivity/source/drivers/kab/KDEInit.h 2008-03-27 14:50:39.000000000 +0100
+@@ -37,16 +37,17 @@
+ #define CONNECTIVITY_KAB_KDEINIT_H
+
+ // the address book driver's version
+-#define KAB_DRIVER_VERSION "0.2"
+-#define KAB_DRIVER_VERSION_MAJOR 0
+-#define KAB_DRIVER_VERSION_MINOR 2
++#define KAB_DRIVER_VERSION "1.0"
++#define KAB_DRIVER_VERSION_MAJOR 1
++#define KAB_DRIVER_VERSION_MINOR 0
+
+ // the minimum KDE version which is required at runtime
+-#define MIN_KDE_VERSION_MAJOR 3
+-#define MIN_KDE_VERSION_MINOR 2
++#define MIN_KDE_VERSION_MAJOR 4
++#define MIN_KDE_VERSION_MINOR 0
+
+-#define MAX_KDE_VERSION_MAJOR 3
+-#define MAX_KDE_VERSION_MINOR 6
++// the maximum KDE version which is enforced at runtime
++#define MAX_KDE_VERSION_MAJOR 4
++#define MAX_KDE_VERSION_MINOR 2
+
+
+ #endif // CONNECTIVITY_KAB_KDEINIT_H
+--- connectivity/source/drivers/kab/kfields.cxx.old 2008-03-26 01:21:37.000000000 +0100
++++ connectivity/source/drivers/kab/kfields.cxx 2008-03-26 01:23:56.000000000 +0100
+@@ -66,7 +66,7 @@
+ ::rtl::OUString aName;
+
+ aQtName = KABC::Addressee::revisionLabel();
+- aName = ::rtl::OUString((const sal_Unicode *) aQtName.ucs2());
++ aName = ::rtl::OUString((const sal_Unicode *) aQtName.utf16());
+ if (columnName == aName)
+ return KAB_FIELD_REVISION;
+
+@@ -79,7 +79,7 @@
+ ++aField, ++nResult)
+ {
+ aQtName = (*aField)->label();
+- aName = ::rtl::OUString((const sal_Unicode *) aQtName.ucs2());
++ aName = ::rtl::OUString((const sal_Unicode *) aQtName.utf16());
+
+ if (columnName == aName)
+ return nResult;
+--- connectivity/source/drivers/kab/KResultSet.cxx.old 2008-03-26 01:04:03.000000000 +0100
++++ connectivity/source/drivers/kab/KResultSet.cxx 2008-03-26 01:08:15.000000000 +0100
+@@ -234,7 +234,7 @@
+ if (!aQtName.isNull())
+ {
+ m_bWasNull = false;
+- aRet = ::rtl::OUString((const sal_Unicode *) aQtName.ucs2());
++ aRet = ::rtl::OUString((const sal_Unicode *) aQtName.utf16());
+ return aRet;
+ }
+ }
+@@ -834,7 +834,7 @@
+ if (m_nRowPos != -1 && m_nRowPos != nAddressees)
+ {
+ QString aQtName = m_aKabAddressees[m_nRowPos].uid();
+- ::rtl::OUString sUniqueIdentifier = ::rtl::OUString((const sal_Unicode *) aQtName.ucs2());
++ ::rtl::OUString sUniqueIdentifier = ::rtl::OUString((const sal_Unicode *) aQtName.utf16());
+ return makeAny(sUniqueIdentifier);
+ }
+ return Any();
+@@ -851,7 +851,7 @@
+ for (sal_Int32 nRow = 0; nRow < nAddressees; nRow++)
+ {
+ QString aQtName = m_aKabAddressees[nRow].uid();
+- ::rtl::OUString sUniqueIdentifier = ::rtl::OUString((const sal_Unicode *) aQtName.ucs2());
++ ::rtl::OUString sUniqueIdentifier = ::rtl::OUString((const sal_Unicode *) aQtName.utf16());
+
+ if (sUniqueIdentifier == sBookmark)
+ {
+--- connectivity/source/drivers/kab/KResultSetMetaData.cxx.old 2008-03-26 01:15:43.000000000 +0100
++++ connectivity/source/drivers/kab/KResultSetMetaData.cxx 2008-03-26 01:16:16.000000000 +0100
+@@ -119,7 +119,7 @@
+ default:
+ aQtName = aFields[nFieldNumber - KAB_DATA_FIELDS]->label();
+ }
+- ::rtl::OUString aName((const sal_Unicode *) aQtName.ucs2());
++ ::rtl::OUString aName((const sal_Unicode *) aQtName.utf16());
+
+ return aName;
+ }
Added: trunk/patches/dev300/kde4-kde_headers.diff
==============================================================================
--- (empty file)
+++ trunk/patches/dev300/kde4-kde_headers.diff Thu Jun 12 09:36:19 2008
@@ -0,0 +1,70 @@
+--- vcl/unx/inc/kde_headers.h.old 2008-03-22 06:13:11.000000000 +0100
++++ vcl/unx/inc/kde_headers.h 2008-03-25 21:29:51.000000000 +0100
+@@ -51,27 +51,30 @@
+
+
+ /* ********* Qt headers */
+-#include <qaccessible.h>
+-#include <qcheckbox.h>
+-#include <qcombobox.h>
+-#include <qfont.h>
+-#include <qframe.h>
+-#include <qlineedit.h>
+-#include <qlistview.h>
+-#include <qmainwindow.h>
+-#include <qmenudata.h>
+-#include <qpaintdevice.h>
+-#include <qpainter.h>
+-#include <qpushbutton.h>
+-#include <qradiobutton.h>
+-#include <qrangecontrol.h>
+-#include <qstring.h>
+-#include <qtabbar.h>
+-#include <qtabwidget.h>
+-#include <qtoolbar.h>
+-#include <qtoolbutton.h>
+-#include <qwidget.h>
+-#include <qprogressbar.h>
++#include <QtCore/qstring.h>
++
++#include <QtGui/qaccessible.h>
++#include <QtGui/qcheckbox.h>
++#include <QtGui/qcombobox.h>
++#include <QtGui/qfont.h>
++#include <QtGui/qframe.h>
++#include <QtGui/qlineedit.h>
++#include <QtGui/qlistview.h>
++#include <QtGui/qmainwindow.h>
++#include <QtGui/qmenudata.h>
++#include <QtGui/qpaintdevice.h>
++#include <QtGui/qpainter.h>
++#include <QtGui/qpushbutton.h>
++#include <QtGui/qradiobutton.h>
++#include <QtGui/qscrollbar.h>
++#include <QtGui/qspinbox.h>
++#include <QtGui/qtabbar.h>
++#include <QtGui/qtabwidget.h>
++#include <QtGui/qtoolbar.h>
++#include <QtGui/qtoolbutton.h>
++#include <QtGui/qwidget.h>
++#include <QtGui/qprogressbar.h>
++
+
+ /* ********* See hack on top of this file */
+ #undef Region
+@@ -82,6 +85,7 @@
+ #include <kapplication.h>
+ #include <kcmdlineargs.h>
+ #include <kconfig.h>
++#include <kconfiggroup.h>
+ #include <kdeversion.h>
+ #include <kemailsettings.h>
+ #include <kglobal.h>
+@@ -92,6 +96,7 @@
+ #include <kprotocolmanager.h>
+ #include <kstartupinfo.h>
+ #include <kstyle.h>
++#include <ktoolbar.h>
+
+
+ /* ********* KDE address book connectivity headers */
Added: trunk/patches/dev300/kde4-kdebe.diff
==============================================================================
--- (empty file)
+++ trunk/patches/dev300/kde4-kdebe.diff Thu Jun 12 09:36:19 2008
@@ -0,0 +1,143 @@
+--- shell/source/backends/kdebe/kdecommonlayer.cxx.old 2008-03-26 02:12:01.000000000 +0100
++++ shell/source/backends/kdebe/kdecommonlayer.cxx 2008-03-26 02:12:37.000000000 +0100
+@@ -104,7 +104,7 @@
+ aClientProgram = "kmail";
+ else
+ aClientProgram = aClientProgram.section(SPACE, 0, 0);
+- sClientProgram = (const sal_Unicode *) aClientProgram.ucs2();
++ sClientProgram = (const sal_Unicode *) aClientProgram.utf16();
+
+ aPropInfoList[nProperties].Name = rtl::OUString(
+ RTL_CONSTASCII_USTRINGPARAM( "org.openoffice.Office.Common/ExternalMailer/Program") );
+@@ -121,7 +121,7 @@
+
+ aFixedFont = KGlobalSettings::fixedFont();
+ aFontName = aFixedFont.family();
+- sFontName = (const sal_Unicode *) aFontName.ucs2();
++ sFontName = (const sal_Unicode *) aFontName.utf16();
+ nFontHeight = aFixedFont.pointSize();
+
+ aPropInfoList[nProperties].Name = rtl::OUString(
+@@ -162,9 +162,9 @@
+ ::rtl::OUString sTimeStamp,
+ sep( RTL_CONSTASCII_USTRINGPARAM( "$" ) );
+
+- sTimeStamp = (const sal_Unicode *) aClientProgram.ucs2();
++ sTimeStamp = (const sal_Unicode *) aClientProgram.utf16();
+ sTimeStamp += sep;
+- sTimeStamp += (const sal_Unicode *) aFixedFont.ucs2();
++ sTimeStamp += (const sal_Unicode *) aFixedFont.utf16();
+
+ return sTimeStamp;
+ }
+--- shell/source/backends/kdebe/kdeinetlayer.cxx.old 2008-03-26 02:13:08.000000000 +0100
++++ shell/source/backends/kdebe/kdeinetlayer.cxx 2008-03-26 02:19:27.000000000 +0100
+@@ -108,9 +108,9 @@
+ // The best we can do here is to ask the current value for a given address.
+ setProxy(aPropInfoList, nProperties, 1,
+ KProtocolManager::noProxyFor(),
+- KProtocolManager::proxyForURL( "http://www.openoffice.org" ),
+- KProtocolManager::proxyForURL( "ftp://ftp.openoffice.org" ),
+- KProtocolManager::proxyForURL( "https://www.openoffice.org" ));
++ KProtocolManager::proxyForUrl( KUrl("http://www.openoffice.org") ),
++ KProtocolManager::proxyForUrl( KUrl("ftp://ftp.openoffice.org") ),
++ KProtocolManager::proxyForUrl( KUrl("https://www.openoffice.org") ));
+ break;
+ default: // No proxy is used
+ setProxy(aPropInfoList, nProperties, 0);
+@@ -147,9 +147,9 @@
+ case KProtocolManager::EnvVarProxy:
+ aProxyType = '1';
+ aNoProxyFor = KProtocolManager::noProxyFor();
+- aHTTPProxy = KProtocolManager::proxyForURL( "http://www.openoffice.org" );
+- aHTTPSProxy = KProtocolManager::proxyForURL( "https://www.openoffice.org" );
+- aFTPProxy = KProtocolManager::proxyForURL( "ftp://ftp.openoffice.org" );
++ aHTTPProxy = KProtocolManager::proxyForUrl( KUrl("http://www.openoffice.org") );
++ aHTTPSProxy = KProtocolManager::proxyForUrl( KUrl("https://www.openoffice.org") );
++ aFTPProxy = KProtocolManager::proxyForUrl( KUrl("ftp://ftp.openoffice.org") );
+ break;
+ default:
+ aProxyType = '0';
+@@ -158,15 +158,15 @@
+ ::rtl::OUString sTimeStamp,
+ sep( RTL_CONSTASCII_USTRINGPARAM( "$" ) );
+
+- sTimeStamp = (const sal_Unicode *) aProxyType.ucs2();
++ sTimeStamp = (const sal_Unicode *) aProxyType.utf16();
+ sTimeStamp += sep;
+- sTimeStamp += (const sal_Unicode *) aNoProxyFor.ucs2();
++ sTimeStamp += (const sal_Unicode *) aNoProxyFor.utf16();
+ sTimeStamp += sep;
+- sTimeStamp += (const sal_Unicode *) aHTTPProxy.ucs2();
++ sTimeStamp += (const sal_Unicode *) aHTTPProxy.utf16();
+ sTimeStamp += sep;
+- sTimeStamp += (const sal_Unicode *) aHTTPSProxy.ucs2();
++ sTimeStamp += (const sal_Unicode *) aHTTPSProxy.utf16();
+ sTimeStamp += sep;
+- sTimeStamp += (const sal_Unicode *) aFTPProxy.ucs2();
++ sTimeStamp += (const sal_Unicode *) aFTPProxy.utf16();
+
+ return sTimeStamp;
+ }
+@@ -192,7 +192,7 @@
+ ::rtl::OUString sNoProxyFor;
+
+ aNoProxyFor = aNoProxyFor.replace( COMMA, SEMI_COLON );
+- sNoProxyFor = (const sal_Unicode *) aNoProxyFor.ucs2();
++ sNoProxyFor = (const sal_Unicode *) aNoProxyFor.utf16();
+
+ aPropInfoList[nProperties].Name = rtl::OUString(
+ RTL_CONSTASCII_USTRINGPARAM( "org.openoffice.Inet/Settings/ooInetNoProxy") );
+@@ -204,8 +204,8 @@
+
+ if ( !aHTTPProxy.isEmpty() )
+ {
+- KURL aProxy(aHTTPProxy);
+- ::rtl::OUString sProxy = (const sal_Unicode *) aProxy.host().ucs2();
++ KUrl aProxy(aHTTPProxy);
++ ::rtl::OUString sProxy = (const sal_Unicode *) aProxy.host().utf16();
+ sal_Int32 nPort = aProxy.port();
+
+ aPropInfoList[nProperties].Name = rtl::OUString(
+@@ -225,8 +225,8 @@
+
+ if ( !aHTTPSProxy.isEmpty() )
+ {
+- KURL aProxy(aHTTPSProxy);
+- ::rtl::OUString sProxy = (const sal_Unicode *) aProxy.host().ucs2();
++ KUrl aProxy(aHTTPSProxy);
++ ::rtl::OUString sProxy = (const sal_Unicode *) aProxy.host().utf16();
+ sal_Int32 nPort = aProxy.port();
+
+ aPropInfoList[nProperties].Name = rtl::OUString(
+@@ -246,8 +246,8 @@
+
+ if ( !aFTPProxy.isEmpty() )
+ {
+- KURL aProxy(aFTPProxy);
+- ::rtl::OUString sProxy = (const sal_Unicode *) aProxy.host().ucs2();
++ KUrl aProxy(aFTPProxy);
++ ::rtl::OUString sProxy = (const sal_Unicode *) aProxy.host().utf16();
+ sal_Int32 nPort = aProxy.port();
+
+ aPropInfoList[nProperties].Name = rtl::OUString(
+--- shell/source/backends/kdebe/kdepathslayer.cxx.old 2008-03-26 02:19:55.000000000 +0100
++++ shell/source/backends/kdebe/kdepathslayer.cxx 2008-03-26 02:27:24.000000000 +0100
+@@ -107,7 +107,7 @@
+ aDocumentsDir += KGlobalSettings::documentPath();
+ if ( aDocumentsDir.endsWith(QChar('/')) )
+ aDocumentsDir.truncate ( aDocumentsDir.length() - 1 );
+- sDocumentsDir = (const sal_Unicode *) aDocumentsDir.ucs2();
++ sDocumentsDir = (const sal_Unicode *) aDocumentsDir.utf16();
+
+ aPropInfoList[nProperties].Name = rtl::OUString(
+ RTL_CONSTASCII_USTRINGPARAM( "org.openoffice.Office.Paths/Variables/Work") );
+@@ -137,7 +137,7 @@
+ QString aDocumentsDir;
+ aDocumentsDir = KGlobalSettings::documentPath();
+
+- sTimeStamp += (const sal_Unicode *) aDocumentsDir.ucs2();
++ sTimeStamp += (const sal_Unicode *) aDocumentsDir.utf16();
+
+ return sTimeStamp;
+ }
Added: trunk/patches/dev300/kde4-kdedata.cxx.diff
==============================================================================
--- (empty file)
+++ trunk/patches/dev300/kde4-kdedata.cxx.diff Thu Jun 12 09:36:19 2008
@@ -0,0 +1,47 @@
+--- vcl/unx/kde/kdedata.cxx.old 2008-03-22 05:08:32.000000000 +0100
++++ vcl/unx/kde/kdedata.cxx 2008-03-22 05:57:03.000000000 +0100
+@@ -140,18 +140,22 @@
+ XrmInitialize();
+
+ KAboutData *kAboutData = new KAboutData( "OpenOffice.org",
+- I18N_NOOP( "OpenOffice.org" ),
+- "1.1.0",
+- I18N_NOOP( "OpenOffice.org with KDE Native Widget Support." ),
++ "OpenOffice.org",
++ ki18n( "OpenOffice.org" ),
++ "3.0.0",
++ ki18n( "OpenOffice.org with KDE Native Widget Support." ),
+ KAboutData::License_LGPL,
+- "(c) 2003, 2004 Novell, Inc",
+- I18N_NOOP( "OpenOffice.org is an office suite.\n" ),
++ ki18n( "Copyright (c) 2003, 2004, 2005, 2006, 2007, 2008 Novell, Inc"),
++ ki18n( "OpenOffice.org is an office suite.\n" ),
+ "http://kde.openoffice.org/index.html",
+- "dev kde openoffice org");
+- kAboutData->addAuthor( "Jan Holesovsky",
+- I18N_NOOP( "Original author and maintainer of the KDE NWF." ),
++ "dev kde openoffice org" );
++ kAboutData->addAuthor( ki18n( "Jan Holesovsky" ),
++ ki18n( "Original author and maintainer of the KDE NWF." ),
+ "kendy artax karlin mff cuni cz",
+ "http://artax.karlin.mff.cuni.cz/~kendy" );
++ kAboutData->addAuthor( ki18n("Eric Bischoff"),
++ ki18n( "Accessibility fixes, porting to KDE 4." ),
++ "bischoff kde org" );
+
+ m_nFakeCmdLineArgs = 1;
+ USHORT nIdx;
+@@ -191,11 +195,10 @@
+
+ KCmdLineArgs::init( m_nFakeCmdLineArgs, m_pAppCmdLineArgs, kAboutData );
+
+- KApplication::disableAutoDcopRegistration();
+ m_pApplication = new VCLKDEApplication();
+- kapp->disableSessionManagement();
++ kapp->disableSessionManagement();
+
+- Display* pDisp = QPaintDevice::x11AppDisplay();
++ Display* pDisp = QX11Info::display();
+
+ SalDisplay *pSalDisplay = new SalKDEDisplay( pDisp );
+
Added: trunk/patches/dev300/kde4-salnativewidgets-kde.diff
==============================================================================
--- (empty file)
+++ trunk/patches/dev300/kde4-salnativewidgets-kde.diff Thu Jun 12 09:36:19 2008
@@ -0,0 +1,2168 @@
+--- vcl/unx/kde/salnativewidgets-kde.cxx.old 2008-03-23 22:48:32.000000000 +0100
++++ vcl/unx/kde/salnativewidgets-kde.cxx 2008-03-25 22:16:15.000000000 +0100
+@@ -109,15 +109,6 @@
+ */
+ QComboBox *m_pComboBox;
+
+- /** Cached editable combo box.
+-
+- Needed, because some styles do not like dynamic changes
+- (QComboBox::setEditable()).
+-
+- @see m_pPushButton
+- */
+- QComboBox *m_pEditableComboBox;
+-
+ /** Cached line edit box.
+
+ @see m_pPushButton
+@@ -128,27 +119,21 @@
+
+ @see m_pPushButton
+ */
+- QSpinWidget *m_pSpinWidget;
+-
+- /** Cached spin box'es line edit.
++ QSpinBox *m_pSpinBox;
+
+- @see m_pPushButton
+- */
+- QLineEdit *m_pSpinEdit;
+-
+- /** Cached tab.
++ /** Identifiers of tabs.
+
+ Left, middle, right tab and a tab which is alone.
+
+ @see m_pPushButton
+ */
+- QTab *m_pTabLeft, *m_pTabMiddle, *m_pTabRight, *m_pTabAlone;
++ int m_nTabLeft, m_nTabMiddle, m_nTabRight, m_nTabAlone;
+
+ /** Cached tab bar's parent widget.
+
+ Needed, because the Qt windows style checks for the availability
+ of tab bar's parent. We cannot use m_pTabWidget, because
+- TabWidget::setTabBar() and TabWidget::tabBar() methods are
++ QTabWidget::setTabBar() and QTabWidget::tabBar() methods are
+ protected.
+
+ @see m_pPushButton, m_pTabWidget
+@@ -207,19 +192,23 @@
+ */
+ QMenuBar *m_pMenuBar;
+
+- /** Identifiers of menu bar items.
++ /** Cached menu bar items.
++
++ @see m_pPushButton
+ */
+- int m_nMenuBarEnabledItem, m_nMenuBarDisabledItem;
++ QAction *m_pMenuBarEnabledItem, *m_pMenuBarDisabledItem;
+
+ /** Cached popup menu.
+
+ @see m_pPushButton
+ */
+- QPopupMenu *m_pPopupMenu;
++ QMenu *m_pPopupMenu;
++
++ /** Cached popup menu items.
+
+- /** Identifiers of popup menu items.
++ @see m_pPushButton
+ */
+- int m_nPopupMenuEnabledItem, m_nPopupMenuDisabledItem;
++ QAction *m_pPopupMenuEnabledItem, *m_pPopupMenuDisabledItem;
+
+ /** cached progress bar
+ */
+@@ -248,12 +237,12 @@
+ /** Paints the specified widget to the X window.
+
+ Use X calls to bitblt (bit block transfer) the widget qWidget to
+- the window specified by drawable with the style defined by nStyle.
++ the window specified by drawable with the style defined by nState.
+
+ @param qWidget
+ A pointer to the cached widget.
+
+- @param nState
++ @param nControlState
+ The state of the control (focused, on/off, ...)
+
+ @param aValue
+@@ -269,7 +258,7 @@
+ The graphics context.
+ */
+ BOOL drawStyledWidget( QWidget *pWidget,
+- ControlState nState, const ImplControlValue& aValue,
++ ControlState nControlState, const ImplControlValue& aValue,
+ Display *dpy, XLIB_Window drawable, int nScreen, int nDepth, GC gc,
+ ControlPart nPart = PART_ENTIRE_CONTROL );
+
+@@ -297,10 +286,7 @@
+
+ /** 'Get' method for combo box.
+
+- It returns m_pComboBox or m_pEditableComboBox according to
+- bEditable.
+-
+- @see pushButton(), m_pEditableComboBox
++ @see pushButton()
+ */
+ QComboBox *comboBox( const Region& rControlRegion, BOOL bEditable );
+
+@@ -314,7 +300,7 @@
+
+ @see pushButton()
+ */
+- QSpinWidget *spinWidget( const Region& rControlRegion );
++ QSpinBox *spinBox( const Region& rControlRegion );
+
+ /** 'Get' method for tab bar.
+
+@@ -363,7 +349,7 @@
+
+ @see pushButton()
+ */
+- QPopupMenu *popupMenu( const Region& rControlRegion );
++ QMenu *popupMenu( const Region& rControlRegion );
+
+ /** 'Get' method for progress bar
+
+@@ -379,14 +365,14 @@
+ Conversion function between VCL ControlState together with
+ ImplControlValue and Qt state flags.
+
+- @param nState
++ @param nControlState
+ State of the widget (default, focused, ...) as defined in Native
+ Widget Framework.
+
+ @param aValue
+ Value held by the widget (on, off, ...)
+ */
+- QStyle::SFlags vclStateValue2SFlags( ControlState nState, const ImplControlValue& aValue );
++ QStyle::State vclStateValue2StateFlag( ControlState nControlState, const ImplControlValue& aValue );
+
+ public:
+ /** Convert VCL Region to QRect.
+@@ -405,14 +391,12 @@
+ m_pRadioButton( NULL ),
+ m_pCheckBox( NULL ),
+ m_pComboBox( NULL ),
+- m_pEditableComboBox( NULL ),
+ m_pLineEdit( NULL ),
+- m_pSpinWidget( NULL ),
+- m_pSpinEdit( NULL ),
+- m_pTabLeft( NULL ),
+- m_pTabMiddle( NULL ),
+- m_pTabRight( NULL ),
+- m_pTabAlone( NULL ),
++ m_pSpinBox( NULL ),
++ m_nTabLeft( -1 ),
++ m_nTabMiddle( -1 ),
++ m_nTabRight( -1 ),
++ m_nTabAlone( -1 ),
+ m_pTabBarParent( NULL ),
+ m_pTabBar( NULL ),
+ m_pTabWidget( NULL ),
+@@ -423,7 +407,11 @@
+ m_pToolBarVert( NULL ),
+ m_pToolButton( NULL ),
+ m_pMenuBar( NULL ),
++ m_pMenuBarEnabledItem( NULL ),
++ m_pMenuBarDisabledItem( NULL ),
+ m_pPopupMenu( NULL ),
++ m_pPopupMenuEnabledItem( NULL ),
++ m_pPopupMenuDisabledItem( NULL ),
+ m_pProgressBar( NULL )
+ {
+ }
+@@ -434,16 +422,10 @@
+ delete m_pRadioButton, m_pRadioButton = NULL;
+ delete m_pCheckBox, m_pCheckBox = NULL;
+ delete m_pComboBox, m_pComboBox = NULL;
+- delete m_pEditableComboBox, m_pEditableComboBox = NULL;
+ delete m_pLineEdit, m_pLineEdit = NULL;
+- delete m_pSpinWidget, m_pSpinWidget = NULL;
+- m_pSpinEdit = NULL; // Deleted in m_pSpinWidget's destructor
+- delete m_pTabAlone, m_pTabAlone = NULL;
++ delete m_pSpinBox, m_pSpinBox = NULL;
+ delete m_pTabBarParent, m_pTabBarParent = NULL;
+ m_pTabBar = NULL; // Deleted in m_pTabBarParent's destructor
+- m_pTabLeft = NULL;
+- m_pTabMiddle = NULL;
+- m_pTabRight = NULL;
+ delete m_pTabWidget, m_pTabWidget = NULL;
+ delete m_pListView, m_pListView = NULL;
+ delete m_pScrollBar, m_pScrollBar = NULL;
+@@ -452,24 +434,28 @@
+ delete m_pMainWindow, m_pMainWindow = NULL;
+ delete m_pToolButton, m_pToolButton = NULL;
+ delete m_pMenuBar, m_pMenuBar = NULL;
++ m_pMenuBarEnabledItem = NULL; // Already deleted by the menu bar ???
++ m_pMenuBarDisabledItem = NULL; // Already deleted by the menu bar ???
+ delete m_pPopupMenu, m_pPopupMenu = NULL;
++ m_pPopupMenuEnabledItem = NULL; // Already deleted by the popup menu ???
++ m_pPopupMenuDisabledItem = NULL; // Already deleted by the popup menu ???
+ delete m_pProgressBar, m_pProgressBar = NULL;
+ }
+
+ BOOL WidgetPainter::drawStyledWidget( QWidget *pWidget,
+- ControlState nState, const ImplControlValue& aValue,
++ ControlState nControlState, const ImplControlValue& aValue,
+ Display *dpy, XLIB_Window drawable, int nScreen, int nDepth, GC gc,
+ ControlPart nPart )
+ {
+ if ( !pWidget )
+- return FALSE;
++ return FALSE;
+
+ // Normalize the widget
+ QPoint qWidgetPos( pWidget->pos() );
+ pWidget->move( 0, 0 );
+
+ // Enable/disable the widget
+- pWidget->setEnabled( nState & CTRL_STATE_ENABLED );
++ pWidget->setEnabled( nControlState & CTRL_STATE_ENABLED );
+
+ // Create pixmap to paint to
+ QPixmap qPixmap( pWidget->width(), pWidget->height() );
+@@ -480,340 +466,386 @@
+ qPixmap.fill( pWidget, QPoint(0, 0) );
+
+ // Convert the flags
+- QStyle::SFlags nStyle = vclStateValue2SFlags( nState, aValue );
++ QStyle::State nState = vclStateValue2StateFlag( nControlState, aValue );
+
+ // Store the widget class
+- const char *pClassName = pWidget->className();
++ const char *pClassName = pWidget->metaObject()->className();
+
+ // Draw the widget to the pixmap
+ if ( strcmp( "QPushButton", pClassName ) == 0 )
+ {
+- // Workaround for the Platinum style.
+- // Platinum takes the state directly from the widget, not from SFlags.
+- QPushButton *pPushButton = static_cast<QPushButton *>( pWidget->qt_cast( "QPushButton" ) );
+- if ( pPushButton )
+- {
+- pPushButton->setDown ( nStyle & QStyle::Style_Down );
+- pPushButton->setOn ( nStyle & QStyle::Style_On );
+- pPushButton->setEnabled( nStyle & QStyle::Style_Enabled );
+- }
+-
+- kapp->style().drawControl( QStyle::CE_PushButton,
+- &qPainter, pWidget, qRect,
+- pWidget->colorGroup(), nStyle );
++ // Workaround for the Platinum style.
++ // Platinum takes the state directly from the widget, not from StateFlag.
++ QPushButton *pPushButton = qobject_cast<QPushButton *>( pWidget );
++ if ( pPushButton )
++ {
++ pPushButton->setDown ( nState & QStyle::State_Sunken );
++ pPushButton->setChecked( nState & QStyle::State_On );
++ pPushButton->setEnabled( nState & QStyle::State_Enabled );
++ }
++
++ QStyleOptionButton aStyleOption;
++ aStyleOption.rect = qRect;
++ aStyleOption.palette = pWidget->palette();
++ aStyleOption.state = nState;
++ kapp->style()->drawControl( QStyle::CE_PushButton,
++ &aStyleOption, &qPainter, pWidget);
+ }
+ else if ( strcmp( "QRadioButton", pClassName ) == 0 )
+ {
+- // Bitblt from the screen, because the radio buttons are usually not
+- // rectangular, and there could be a bitmap under them
+- GC aTmpGC = XCreateGC( dpy, qPixmap.handle(), 0, NULL );
+- X11SalGraphics::CopyScreenArea( dpy,
++ // Bitblt from the screen, because the radio buttons are usually not
++ // rectangular, and there could be a bitmap under them
++ GC aTmpGC = XCreateGC( dpy, qPixmap.handle(), 0, NULL );
++ X11SalGraphics::CopyScreenArea( dpy,
+ drawable, nScreen, nDepth,
+- qPixmap.handle(), qPixmap.x11Screen(), qPixmap.x11Depth(),
++ qPixmap.handle(), qPixmap.x11Info().screen(), qPixmap.x11Info().depth(),
+ aTmpGC,
+ qWidgetPos.x(), qWidgetPos.y(), qRect.width(), qRect.height(),
+ 0, 0 );
+- XFreeGC( dpy, aTmpGC );
++ XFreeGC( dpy, aTmpGC );
++
++ QStyleOptionButton aStyleOption;
++ aStyleOption.rect = qRect;
++ aStyleOption.palette = pWidget->palette();
++ aStyleOption.state = nState;
+
+- kapp->style().drawControl( QStyle::CE_RadioButton,
+- &qPainter, pWidget, qRect,
+- pWidget->colorGroup(), nStyle );
++ kapp->style()->drawControl( QStyle::CE_RadioButton,
++ &aStyleOption, &qPainter, pWidget);
+ }
+ else if ( strcmp( "QCheckBox", pClassName ) == 0 )
+ {
+- kapp->style().drawControl( QStyle::CE_CheckBox,
+- &qPainter, pWidget, qRect,
+- pWidget->colorGroup(), nStyle );
++ QStyleOption aStyleOption;
++ aStyleOption.rect = qRect;
++ aStyleOption.palette = pWidget->palette();
++ aStyleOption.state = nState;
++
++ kapp->style()->drawControl( QStyle::CE_CheckBox,
++ &aStyleOption, &qPainter, pWidget);
+ }
+ else if ( strcmp( "QComboBox", pClassName ) == 0 )
+ {
+- kapp->style().drawComplexControl( QStyle::CC_ComboBox,
+- &qPainter, pWidget, qRect,
+- pWidget->colorGroup(), nStyle );
++ QStyleOptionComboBox aStyleOption;
++ aStyleOption.rect = qRect;
++ aStyleOption.palette = pWidget->palette();
++ aStyleOption.state = nState;
++
++ kapp->style()->drawComplexControl( QStyle::CC_ComboBox,
++ &aStyleOption, &qPainter, pWidget);
+
+- // Editable combo box uses the background of the associated edit box
+- QComboBox *pComboBox = static_cast<QComboBox *>( pWidget->qt_cast( "QComboBox" ) );
+- if ( pComboBox && pComboBox->editable() && pComboBox->lineEdit() )
+- {
+- QColorGroup::ColorRole eColorRole = ( pComboBox->isEnabled() )?
+- QColorGroup::Base: QColorGroup::Background;
+- qPainter.fillRect(
+- kapp->style().querySubControlMetrics( QStyle::CC_ComboBox,
+- pComboBox, QStyle::SC_ComboBoxEditField ),
+- pComboBox->lineEdit()->colorGroup().brush( eColorRole ) );
+- }
++ // Editable combo box uses the background of the associated edit box
++ QComboBox *pComboBox = qobject_cast<QComboBox *>( pWidget );
++ if ( pComboBox && pComboBox->isEditable() && pComboBox->lineEdit() )
++ {
++ QPalette::ColorRole eColorRole = ( pComboBox->isEnabled() )?
++ QPalette::Base: QPalette::Background;
++ qPainter.fillRect(
++ kapp->style()->subControlRect( QStyle::CC_ComboBox, &aStyleOption, QStyle::SC_ComboBoxEditField ),
++ pComboBox->lineEdit()->palette().brush( eColorRole ) );
++ }
+ }
+ else if ( strcmp( "QLineEdit", pClassName ) == 0 )
+ {
+- kapp->style().drawPrimitive( QStyle::PE_PanelLineEdit,
+- &qPainter, qRect,
+- pWidget->colorGroup(), nStyle | QStyle::Style_Sunken );
++ QStyleOption aStyleOption;
++ aStyleOption.rect = qRect;
++ aStyleOption.palette = pWidget->palette();
++ aStyleOption.state = (QStyle::State) (nState | QStyle::State_Sunken);
++
++ kapp->style()->drawPrimitive( QStyle::PE_PanelLineEdit,
++ &aStyleOption, &qPainter);
++
+ }
+- else if ( strcmp( "QSpinWidget", pClassName ) == 0 )
++ else if ( strcmp( "QSpinBox", pClassName ) == 0 )
+ {
+- SpinbuttonValue *pValue = static_cast<SpinbuttonValue *> ( aValue.getOptionalVal() );
++ SpinbuttonValue *pValue = static_cast<SpinbuttonValue *> ( aValue.getOptionalVal() );
+
+- // Is any of the buttons pressed?
+- QStyle::SCFlags eActive = QStyle::SC_None;
+- if ( pValue )
+- {
+- if ( pValue->mnUpperState & CTRL_STATE_PRESSED )
+- eActive = QStyle::SC_SpinWidgetUp;
+- else if ( pValue->mnLowerState & CTRL_STATE_PRESSED )
+- eActive = QStyle::SC_SpinWidgetDown;
+-
+- // Update the enable/disable state of the widget
+- if ( ( nState & CTRL_STATE_ENABLED ) ||
+- ( pValue->mnUpperState & CTRL_STATE_ENABLED ) ||
+- ( pValue->mnLowerState & CTRL_STATE_ENABLED ) )
+- {
+- pWidget->setEnabled( true );
+- nStyle |= QStyle::Style_Enabled;
+- }
+- else
+- pWidget->setEnabled( false );
++ // Is any of the buttons pressed?
++ QStyle::SubControl eActive = QStyle::SC_None;
++ if ( pValue )
++ {
++ if ( pValue->mnUpperState & CTRL_STATE_PRESSED )
++ eActive = QStyle::SC_SpinBoxUp;
++ else if ( pValue->mnLowerState & CTRL_STATE_PRESSED )
++ eActive = QStyle::SC_SpinBoxDown;
++
++ // Update the enable/disable state of the widget
++ if ( ( nControlState & CTRL_STATE_ENABLED ) ||
++ ( pValue->mnUpperState & CTRL_STATE_ENABLED ) ||
++ ( pValue->mnLowerState & CTRL_STATE_ENABLED ) )
++ {
++ pWidget->setEnabled( true );
++ nState |= QStyle::State_Enabled;
++ }
++ else
++ pWidget->setEnabled( false );
++
++ // Mouse-over effect
++ if ( (pValue->mnUpperState & CTRL_STATE_ROLLOVER) ||
++ (pValue->mnLowerState & CTRL_STATE_ROLLOVER) )
++ nState |= QStyle::State_MouseOver;
++ }
+
+- // Mouse-over effect
+- if ( (pValue->mnUpperState & CTRL_STATE_ROLLOVER) ||
+- (pValue->mnLowerState & CTRL_STATE_ROLLOVER) )
+- nStyle |= QStyle::Style_MouseOver;
+- }
+-
+- // Spin widget uses the background of the associated edit box
+- QSpinWidget *pSpinWidget = static_cast<QSpinWidget *>( pWidget->qt_cast( "QSpinWidget" ) );
+- if ( pSpinWidget && pSpinWidget->editWidget() )
+- {
+- QColorGroup::ColorRole eColorRole = ( pSpinWidget->isEnabled() )?
+- QColorGroup::Base: QColorGroup::Background;
+- qPainter.fillRect(
+- kapp->style().querySubControlMetrics( QStyle::CC_SpinWidget,
+- pSpinWidget, QStyle::SC_SpinWidgetEditField ),
+- pSpinWidget->editWidget()->colorGroup().brush( eColorRole ) );
+- }
+-
+- // Adjust the frame (needed for Motif Plus style)
+- QRect qFrameRect = kapp->style().querySubControlMetrics( QStyle::CC_SpinWidget,
+- pWidget, QStyle::SC_SpinWidgetFrame );
+-
+- kapp->style().drawComplexControl( QStyle::CC_SpinWidget,
+- &qPainter, pWidget, qFrameRect,
+- pWidget->colorGroup(), nStyle,
+- QStyle::SC_All, eActive );
++ // Spin widget uses the background of the associated edit box
++ QSpinBox *pSpinBox = qobject_cast<QSpinBox *>( pWidget );
++ QStyleOptionSpinBox aStyleOption;
++
++ if ( pSpinBox )
++ {
++ QPalette::ColorRole eColorRole = ( pSpinBox->isEnabled() )?
++ QPalette::Base: QPalette::Background;
++ qPainter.fillRect(
++ kapp->style()->subControlRect( QStyle::CC_SpinBox, &aStyleOption, QStyle::SC_SpinBoxEditField ),
++ pSpinBox->palette().brush( eColorRole ) );
++ }
++
++ // Adjust the frame (needed for Motif Plus style)
++ aStyleOption.rect = kapp->style()->subControlRect( QStyle::CC_SpinBox, &aStyleOption, QStyle::SC_SpinBoxFrame );
++ aStyleOption.palette = pWidget->palette();
++ aStyleOption.state = nState;
++ aStyleOption.subControls = QStyle::SC_All;
++ aStyleOption.activeSubControls = eActive;
++
++ kapp->style()->drawComplexControl( QStyle::CC_SpinBox,
++ &aStyleOption, &qPainter, pWidget);
+ }
+ else if ( strcmp( "QTabBar", pClassName ) == 0 )
+ {
+- TabitemValue *pValue = static_cast<TabitemValue *> ( aValue.getOptionalVal() );
+-
+- QTab *pTab = NULL;
+- if ( pValue )
+- {
+- if ( ( pValue->isFirst() || pValue->isLeftAligned() ) && ( pValue->isLast() || pValue->isRightAligned() ) )
+- pTab = m_pTabAlone;
+- else if ( pValue->isFirst() || pValue->isLeftAligned() )
+- pTab = m_pTabLeft;
+- else if ( pValue->isLast() || pValue->isRightAligned() )
+- pTab = m_pTabRight;
+- else
+- pTab = m_pTabMiddle;
+- }
+- if ( !pTab )
+- return FALSE;
++ TabitemValue *pValue = static_cast<TabitemValue *> ( aValue.getOptionalVal() );
+
+- pTab->setRect( qRect );
++ int nTab = -1;
++ if ( pValue )
++ {
++ if ( ( pValue->isFirst() || pValue->isLeftAligned() ) && ( pValue->isLast() || pValue->isRightAligned() ) )
++ nTab = m_nTabAlone;
++ else if ( pValue->isFirst() || pValue->isLeftAligned() )
++ nTab = m_nTabLeft;
++ else if ( pValue->isLast() || pValue->isRightAligned() )
++ nTab = m_nTabRight;
++ else
++ nTab = m_nTabMiddle;
++ }
++ if ( nTab == -1 )
++ return FALSE;
+
+- kapp->style().drawControl( QStyle::CE_TabBarTab,
+- &qPainter, pWidget, qRect,
+- pWidget->colorGroup(), nStyle,
+- QStyleOption( pTab ) );
++ QStyleOptionTabBarBase aStyleOption;
++ aStyleOption.rect = qRect;
++ aStyleOption.state = nState;
++ aStyleOption.palette = pWidget->palette();
++
++ kapp->style()->drawControl( QStyle::CE_TabBarTab,
++ &aStyleOption, &qPainter, pWidget);
+ }
+ else if ( strcmp( "QTabWidget", pClassName ) == 0 )
+ {
+- kapp->style().drawPrimitive( QStyle::PE_PanelTabWidget,
+- &qPainter, qRect,
+- pWidget->colorGroup(), nStyle );
++ QStyleOptionTab aStyleOption;
++ aStyleOption.rect = qRect;
++ aStyleOption.palette = pWidget->palette();
++ aStyleOption.state = nState;
++
++ kapp->style()->drawPrimitive( QStyle::PE_FrameTabWidget,
++ &aStyleOption, &qPainter);
+ }
+ else if ( strcmp( "QListView", pClassName ) == 0 )
+ {
+- kapp->style().drawPrimitive( QStyle::PE_Panel,
+- &qPainter, qRect,
+- pWidget->colorGroup(), nStyle | QStyle::Style_Sunken );
++ QStyleOption aStyleOption;
++ aStyleOption.rect = qRect;
++ aStyleOption.palette = pWidget->palette();
++ aStyleOption.state = nState | QStyle::State_Sunken;
++
++ kapp->style()->drawPrimitive( QStyle::PE_Frame,
++ &aStyleOption, &qPainter);
+ }
+ else if ( strcmp( "QScrollBar", pClassName ) == 0 )
+ {
+- ScrollbarValue *pValue = static_cast<ScrollbarValue *> ( aValue.getOptionalVal() );
+-
+- QStyle::SCFlags eActive = QStyle::SC_None;
+- if ( pValue )
+- {
+- // Workaround for Style_MouseOver-aware themes.
+- // Quite ugly, but I do not know about a better solution.
+- const char *pStyleName = kapp->style().className();
+- if ( strcmp( "QMotifPlusStyle", pStyleName ) == 0 )
+- {
+- nStyle |= QStyle::Style_MouseOver;
+- if ( pValue->mnThumbState & CTRL_STATE_ROLLOVER )
+- eActive = QStyle::SC_ScrollBarSlider;
+- }
+- else if ( strcmp( "QSGIStyle", pStyleName ) == 0 )
+- {
+- nStyle |= QStyle::Style_MouseOver;
+- if ( pValue->mnButton1State & CTRL_STATE_ROLLOVER )
+- eActive = QStyle::SC_ScrollBarSubLine;
+- else if ( pValue->mnButton2State & CTRL_STATE_ROLLOVER )
+- eActive = QStyle::SC_ScrollBarAddLine;
+- else if ( pValue->mnThumbState & CTRL_STATE_ROLLOVER )
+- eActive = QStyle::SC_ScrollBarSlider;
+- }
++ ScrollbarValue *pValue = static_cast<ScrollbarValue *> ( aValue.getOptionalVal() );
+
+- if ( pValue->mnButton1State & CTRL_STATE_PRESSED )
+- eActive = QStyle::SC_ScrollBarSubLine;
+- else if ( pValue->mnButton2State & CTRL_STATE_PRESSED )
+- eActive = QStyle::SC_ScrollBarAddLine;
+- else if ( pValue->mnThumbState & CTRL_STATE_PRESSED )
+- eActive = QStyle::SC_ScrollBarSlider;
+- else if ( pValue->mnPage1State & CTRL_STATE_PRESSED )
+- eActive = QStyle::SC_ScrollBarSubPage;
+- else if ( pValue->mnPage2State & CTRL_STATE_PRESSED )
+- eActive = QStyle::SC_ScrollBarAddPage;
+-
+- // Update the enable/disable state of the widget
+- if ( ( nState & CTRL_STATE_ENABLED ) ||
+- ( pValue->mnButton1State & CTRL_STATE_ENABLED ) ||
+- ( pValue->mnButton2State & CTRL_STATE_ENABLED ) ||
+- ( pValue->mnThumbState & CTRL_STATE_ENABLED ) ||
+- ( pValue->mnPage1State & CTRL_STATE_ENABLED ) ||
+- ( pValue->mnPage2State & CTRL_STATE_ENABLED ) )
+- {
+- pWidget->setEnabled( true );
+- nStyle |= QStyle::Style_Enabled;
+- }
+- else
+- pWidget->setEnabled( false );
+- }
++ QStyle::SubControl eActive = QStyle::SC_None;
++ if ( pValue )
++ {
++ // Workaround for State_MouseOver-aware themes.
++ // Quite ugly, but I do not know about a better solution.
++ const char *pStyleName = kapp->style()->metaObject()->className();
++ if ( strcmp( "QMotifPlusStyle", pStyleName ) == 0 )
++ {
++ nState |= QStyle::State_MouseOver;
++ if ( pValue->mnThumbState & CTRL_STATE_ROLLOVER )
++ eActive = QStyle::SC_ScrollBarSlider;
++ }
++ else if ( strcmp( "QSGIStyle", pStyleName ) == 0 )
++ {
++ nState |= QStyle::State_MouseOver;
++ if ( pValue->mnButton1State & CTRL_STATE_ROLLOVER )
++ eActive = QStyle::SC_ScrollBarSubLine;
++ else if ( pValue->mnButton2State & CTRL_STATE_ROLLOVER )
++ eActive = QStyle::SC_ScrollBarAddLine;
++ else if ( pValue->mnThumbState & CTRL_STATE_ROLLOVER )
++ eActive = QStyle::SC_ScrollBarSlider;
++ }
++
++ if ( pValue->mnButton1State & CTRL_STATE_PRESSED )
++ eActive = QStyle::SC_ScrollBarSubLine;
++ else if ( pValue->mnButton2State & CTRL_STATE_PRESSED )
++ eActive = QStyle::SC_ScrollBarAddLine;
++ else if ( pValue->mnThumbState & CTRL_STATE_PRESSED )
++ eActive = QStyle::SC_ScrollBarSlider;
++ else if ( pValue->mnPage1State & CTRL_STATE_PRESSED )
++ eActive = QStyle::SC_ScrollBarSubPage;
++ else if ( pValue->mnPage2State & CTRL_STATE_PRESSED )
++ eActive = QStyle::SC_ScrollBarAddPage;
++
++ // Update the enable/disable state of the widget
++ if ( ( nControlState & CTRL_STATE_ENABLED ) ||
++ ( pValue->mnButton1State & CTRL_STATE_ENABLED ) ||
++ ( pValue->mnButton2State & CTRL_STATE_ENABLED ) ||
++ ( pValue->mnThumbState & CTRL_STATE_ENABLED ) ||
++ ( pValue->mnPage1State & CTRL_STATE_ENABLED ) ||
++ ( pValue->mnPage2State & CTRL_STATE_ENABLED ) )
++ {
++ pWidget->setEnabled( true );
++ nState |= QStyle::State_Enabled;
++ }
++ else
++ pWidget->setEnabled( false );
++ }
+
+- // Is it a horizontal scroll bar?
+- QScrollBar *pScrollBar = static_cast<QScrollBar *> ( pWidget->qt_cast( "QScrollBar" ) );
+- QStyle::StyleFlags eHoriz = QStyle::Style_Default;
+- if ( pScrollBar && pScrollBar->orientation() == Qt::Horizontal )
+- eHoriz = QStyle::Style_Horizontal;
+-
+- kapp->style().drawComplexControl( QStyle::CC_ScrollBar,
+- &qPainter, pWidget, qRect,
+- pWidget->colorGroup(), nStyle | eHoriz,
+- QStyle::SC_All, eActive );
++ // Is it a horizontal scroll bar?
++ QScrollBar *pScrollBar = qobject_cast<QScrollBar *>( pWidget );
++ QStyle::State eHoriz = QStyle::State_None;
++ if ( pScrollBar && pScrollBar->orientation() == Qt::Horizontal )
++ eHoriz = QStyle::State_Horizontal;
++
++ QStyleOptionComplex aStyleOption;
++ aStyleOption.rect = qRect;
++ aStyleOption.palette = pWidget->palette();
++ aStyleOption.state = nState | eHoriz;
++ aStyleOption.subControls = QStyle::SC_All;
++ aStyleOption.activeSubControls = eActive;
++
++ kapp->style()->drawComplexControl( QStyle::CC_ScrollBar,
++ &aStyleOption, &qPainter, pWidget);
+ }
+ else if ( strcmp( "QToolBar", pClassName ) == 0 )
+ {
+- QToolBar *pToolBar = static_cast< QToolBar * >( pWidget->qt_cast( "QToolBar" ) );
++ QToolBar *pToolBar = qobject_cast< QToolBar * >( pWidget );
+ bool bIsHorizontal = false;
+ if ( pToolBar && pToolBar->orientation() == Qt::Horizontal )
+ {
+- nStyle |= QStyle::Style_Horizontal;
++ nState |= QStyle::State_Horizontal;
+ bIsHorizontal = true;
+ }
+
+- kapp->style().drawControl( QStyle::CE_DockWindowEmptyArea,
+- &qPainter, pWidget, qRect,
+- pWidget->colorGroup(), nStyle );
++ QStyleOptionToolBar aStyleOption;
++ aStyleOption.rect = qRect;
++ aStyleOption.state = nState;
++ aStyleOption.palette = pWidget->palette();
++
++ kapp->style()->drawControl( QStyle::CE_HeaderEmptyArea,
++ &aStyleOption, &qPainter, pWidget);
++
++ kapp->style()->drawPrimitive( QStyle::PE_FrameDockWidget,
++ &aStyleOption, &qPainter);
+
+- kapp->style().drawPrimitive( QStyle::PE_PanelDockWindow,
+- &qPainter, qRect, pWidget->colorGroup(), nStyle );
+-
+ if ( nPart == PART_THUMB_HORZ || nPart == PART_THUMB_VERT )
+ {
+ ToolbarValue *pValue = static_cast< ToolbarValue * >( aValue.getOptionalVal() );
+
+ QRect qThumbRect = region2QRect( pValue->maGripRect );
+- qThumbRect.moveBy( -qWidgetPos.x(), -qWidgetPos.y() );
++ qThumbRect.translate( -qWidgetPos.x(), -qWidgetPos.y() );
+ if ( bIsHorizontal )
+- qThumbRect.addCoords( 0, 2, 0, -3 ); // make the thumb a bit nicer
++ qThumbRect.adjust( 0, 2, 0, -3 ); // make the thumb a bit nicer
+ else
+- qThumbRect.addCoords( 2, 0, -3, 0 ); // make the thumb a bit nicer
++ qThumbRect.adjust( 2, 0, -3, 0 ); // make the thumb a bit nicer
+
+- if ( kapp->style().inherits( "HighColorStyle" ) ||
+- kapp->style().inherits( "HighContrastStyle" ) ||
+- kapp->style().inherits( "KeramikStyle" ) ||
+- kapp->style().inherits( "KThemeStyle" ) ||
+- kapp->style().inherits( "ThinKeramikStyle" ) )
+- {
+- // Workaround for the workaround in KStyle::drawPrimitive()
+- KStyle *pStyle = static_cast< KStyle * >( &kapp->style() );
+- pStyle->drawKStylePrimitive( KStyle::KPE_ToolBarHandle,
+- &qPainter, pToolBar, qThumbRect,
+- pWidget->colorGroup(), nStyle );
+- }
+- else
+- kapp->style().drawPrimitive( QStyle::PE_DockWindowHandle,
+- &qPainter, qThumbRect, pWidget->colorGroup(), nStyle );
++ aStyleOption.rect = qThumbRect;
++ kapp->style()->drawPrimitive( QStyle::PE_IndicatorToolBarHandle,
++ &aStyleOption, &qPainter);
+ }
+ }
+ else if ( strcmp( "QToolButton", pClassName ) == 0 )
+ {
+- if( (nStyle & QStyle::Style_MouseOver) )
+- nStyle &= ~QStyle::Style_Off;
+- kapp->style().drawComplexControl( QStyle::CC_ToolButton,
+- &qPainter, pWidget, qRect,
+- pWidget->colorGroup(), nStyle,
+- QStyle::SC_ToolButton );
++ if ( nState & QStyle::State_MouseOver )
++ nState &= ~QStyle::State_Off;
++
++ QStyleOptionToolButton aStyleOption;
++ aStyleOption.rect = qRect;
++ aStyleOption.state = nState;
++ aStyleOption.palette = pWidget->palette();
++ aStyleOption.subControls = QStyle::SC_ToolButton;
++
++ kapp->style()->drawComplexControl( QStyle::CC_ToolButton,
++ &aStyleOption, &qPainter, pWidget);
+ }
+ else if ( strcmp( "QMenuBar", pClassName ) == 0 )
+ {
+ if ( nPart == PART_ENTIRE_CONTROL )
+ {
+- kapp->style().drawControl( QStyle::CE_MenuBarEmptyArea,
+- &qPainter, pWidget, qRect,
+- pWidget->colorGroup(), nStyle );
++ QStyleOption aStyleOption;
++ aStyleOption.rect = qRect;
++ aStyleOption.state = nState;
++ aStyleOption.palette = pWidget->palette();
++
++ kapp->style()->drawControl( QStyle::CE_MenuBarEmptyArea,
++ &aStyleOption, &qPainter, pWidget);
+ }
+ else if ( nPart == PART_MENU_ITEM )
+ {
+- int nMenuItem = ( nStyle & QStyle::Style_Enabled )? m_nMenuBarEnabledItem: m_nMenuBarDisabledItem;
+- QMenuItem *pMenuItem = static_cast<QMenuBar*>( pWidget )->findItem( nMenuItem );
++// QAction *pMenuItem = ( nState & QStyle::State_Enabled )? m_pMenuBarEnabledItem: m_pMenuBarDisabledItem;
+
+- if ( nStyle & QStyle::Style_Selected )
+- nStyle |= QStyle::Style_Active | QStyle::Style_Down | QStyle::Style_HasFocus;
++ if ( nState & QStyle::State_Selected )
++ nState |= QStyle::State_Active | QStyle::State_Sunken | QStyle::State_HasFocus;
+
+- kapp->style().drawControl( QStyle::CE_MenuBarItem,
+- &qPainter, pWidget, qRect,
+- pWidget->colorGroup(), nStyle,
+- QStyleOption( pMenuItem ) );
++ QStyleOptionMenuItem aStyleOption;
++// aStyleOption.initFrom( pMenuItem ); does not work, actions are not widgets
++ aStyleOption.rect = qRect;
++ aStyleOption.state = nState;
++ aStyleOption.palette = pWidget->palette();
++
++ kapp->style()->drawControl( QStyle::CE_MenuBarItem,
++ &aStyleOption, &qPainter, pWidget);
+ }
+ }
+- else if ( strcmp( "QPopupMenu", pClassName ) == 0 )
++ else if ( strcmp( "QMenu", pClassName ) == 0 )
+ {
+- int nMenuItem = ( nStyle & QStyle::Style_Enabled )? m_nPopupMenuEnabledItem: m_nPopupMenuDisabledItem;
+- QMenuItem *pMenuItem = static_cast<QPopupMenu*>( pWidget )->findItem( nMenuItem );
++// QAction *pMenuItem = ( nState & QStyle::State_Enabled )? m_pPopupMenuEnabledItem: m_pPopupMenuDisabledItem;
++
++ if ( nState & QStyle::State_Selected )
++ nState |= QStyle::State_Active;
+
+- if ( nStyle & QStyle::Style_Selected )
+- nStyle |= QStyle::Style_Active;
++ QStyleOption aStyleOption;
++// aStyleOption.initFrom( pMenuItem ); does not work, actions are not widgets
++ aStyleOption.rect = qRect;
++ aStyleOption.state = nState;
++ aStyleOption.palette = pWidget->palette();
+
+- kapp->style().drawControl( QStyle::CE_PopupMenuItem,
+- &qPainter, pWidget, qRect,
+- pWidget->colorGroup(), nStyle,
+- QStyleOption( pMenuItem, 0, 0 ) );
++ kapp->style()->drawControl( QStyle::CE_MenuItem,
++ &aStyleOption, &qPainter, pWidget);
+ }
+ else if ( strcmp( "QProgressBar", pClassName ) == 0 )
+ {
+ long nProgressWidth = aValue.getNumericVal();
+- QProgressBar* pProgress = static_cast<QProgressBar*>(pWidget);
+- pProgress->setProgress( nProgressWidth, qRect.width() );
+-
+- kapp->style().drawControl( QStyle::CE_ProgressBarGroove,
+- &qPainter, pWidget, qRect,
+- pWidget->colorGroup(), nStyle );
+- kapp->style().drawControl( QStyle::CE_ProgressBarContents,
+- &qPainter, pWidget, qRect,
+- pWidget->colorGroup(), nStyle );
++ QProgressBar* pProgress = static_cast<QProgressBar*>( pWidget );
++ pProgress->setRange( 0, qRect.width() );
++ pProgress->setValue( nProgressWidth );
++
++ QStyleOptionProgressBar aStyleOption;
++ aStyleOption.rect = qRect;
++ aStyleOption.state = nState;
++ aStyleOption.palette = pWidget->palette();
++
++ kapp->style()->drawControl( QStyle::CE_ProgressBarGroove,
++ &aStyleOption, &qPainter, pWidget);
++ kapp->style()->drawControl( QStyle::CE_ProgressBarContents,
++ &aStyleOption, &qPainter, pWidget);
+ }
+ else
+- return FALSE;
++ return FALSE;
+
+ // Bitblt it to the screen
+ X11SalGraphics::CopyScreenArea( dpy,
+- qPixmap.handle(), qPixmap.x11Screen(), qPixmap.x11Depth(),
+- drawable, nScreen, nDepth,
+- gc,
+- 0, 0, qRect.width(), qRect.height(),
+- qWidgetPos.x(), qWidgetPos.y() );
++ qPixmap.handle(), qPixmap.x11Info().screen(), qPixmap.x11Info().depth(),
++ drawable, nScreen, nDepth,
++ gc,
++ 0, 0, qRect.width(), qRect.height(),
++ qWidgetPos.x(), qWidgetPos.y() );
+
+ // Restore widget's position
+ pWidget->move( qWidgetPos );
+@@ -825,7 +857,7 @@
+ BOOL bDefault )
+ {
+ if ( !m_pPushButton )
+- m_pPushButton = new QPushButton( NULL, "push_button" );
++ m_pPushButton = new QPushButton( NULL );
+
+ QRect qRect = region2QRect( rControlRegion );
+
+@@ -835,20 +867,23 @@
+ // FIXME Fix Keramik style to be consistant with Qt built-in styles. Aargh!
+ if ( bDefault )
+ {
+- QSize qContentsSize( 50, 50 );
+- m_pPushButton->setDefault( false );
+- QSize qNormalSize = kapp->style().sizeFromContents( QStyle::CT_PushButton,
+- m_pPushButton, qContentsSize );
+- m_pPushButton->setDefault( true );
+- QSize qDefSize = kapp->style().sizeFromContents( QStyle::CT_PushButton,
+- m_pPushButton, qContentsSize );
++ QSize qContentsSize( 50, 50 );
++ QStyleOptionButton aStyleOption;
++
++ m_pPushButton->setDefault( false );
++ QSize qNormalSize = kapp->style()->sizeFromContents( QStyle::CT_PushButton,
++ &aStyleOption, qContentsSize, m_pPushButton );
++ m_pPushButton->setDefault( true );
++ QSize qDefSize = kapp->style()->sizeFromContents( QStyle::CT_PushButton,
++ &aStyleOption, qContentsSize, m_pPushButton );
+
+- int nIndicatorSize = kapp->style().pixelMetric(
+- QStyle::PM_ButtonDefaultIndicator, m_pPushButton );
+- if ( qNormalSize.width() == qDefSize.width() )
+- qRect.addCoords( nIndicatorSize, 0, -nIndicatorSize, 0 );
+- if ( qNormalSize.height() == qDefSize.height() )
+- qRect.addCoords( 0, nIndicatorSize, 0, -nIndicatorSize );
++ int nIndicatorSize = kapp->style()->pixelMetric( QStyle::PM_ButtonDefaultIndicator,
++ &aStyleOption, m_pPushButton );
++
++ if ( qNormalSize.width() == qDefSize.width() )
++ qRect.adjust( nIndicatorSize, 0, -nIndicatorSize, 0 );
++ if ( qNormalSize.height() == qDefSize.height() )
++ qRect.adjust( 0, nIndicatorSize, 0, -nIndicatorSize );
+ }
+
+ m_pPushButton->move( qRect.topLeft() );
+@@ -861,24 +896,25 @@
+ QRadioButton *WidgetPainter::radioButton( const Region& rControlRegion )
+ {
+ if ( !m_pRadioButton )
+- m_pRadioButton = new QRadioButton( NULL, "radio_button" );
++ m_pRadioButton = new QRadioButton( NULL );
+
+ QRect qRect = region2QRect( rControlRegion );
++ QStyleOptionButton aStyleOption;
+
+ // Workaround for broken themes which do not honor the given size.
+ // Quite ugly, but I do not know about a better solution.
+- const char *pStyleName = kapp->style().className();
++ const char *pStyleName = kapp->style()->metaObject()->className();
+ if ( strcmp( "KThemeStyle", pStyleName ) == 0 )
+ {
+- QRect qOldRect( qRect );
++ QRect qOldRect( qRect );
+
+- qRect.setWidth( kapp->style().pixelMetric(
+- QStyle::PM_ExclusiveIndicatorWidth, m_pRadioButton ) );
+- qRect.setHeight( kapp->style().pixelMetric(
+- QStyle::PM_ExclusiveIndicatorHeight, m_pRadioButton ) );
+-
+- qRect.moveBy( ( qOldRect.width() - qRect.width() ) / 2,
+- ( qOldRect.height() - qRect.height() ) / 2 );
++ qRect.setWidth( kapp->style()->pixelMetric( QStyle::PM_ExclusiveIndicatorWidth,
++ &aStyleOption, m_pRadioButton ) );
++ qRect.setHeight( kapp->style()->pixelMetric( QStyle::PM_ExclusiveIndicatorHeight,
++ &aStyleOption, m_pRadioButton ) );
++
++ qRect.translate( ( qOldRect.width() - qRect.width() ) / 2,
++ ( qOldRect.height() - qRect.height() ) / 2 );
+ }
+
+ m_pRadioButton->move( qRect.topLeft() );
+@@ -890,24 +926,25 @@
+ QCheckBox *WidgetPainter::checkBox( const Region& rControlRegion )
+ {
+ if ( !m_pCheckBox )
+- m_pCheckBox = new QCheckBox( NULL, "check_box" );
++ m_pCheckBox = new QCheckBox( NULL );
+
+ QRect qRect = region2QRect( rControlRegion );
++ QStyleOption aStyleOption;
+
+ // Workaround for broken themes which do not honor the given size.
+ // Quite ugly, but I do not know about a better solution.
+- const char *pStyleName = kapp->style().className();
++ const char *pStyleName = kapp->style()->metaObject()->className();
+ if ( strcmp( "KThemeStyle", pStyleName ) == 0 )
+ {
+- QRect qOldRect( qRect );
++ QRect qOldRect( qRect );
+
+- qRect.setWidth( kapp->style().pixelMetric(
+- QStyle::PM_IndicatorWidth, m_pCheckBox ) );
+- qRect.setHeight( kapp->style().pixelMetric(
+- QStyle::PM_IndicatorHeight, m_pCheckBox ) );
++ qRect.setWidth( kapp->style()->pixelMetric( QStyle::PM_IndicatorWidth,
++ &aStyleOption, m_pCheckBox ) );
++ qRect.setHeight( kapp->style()->pixelMetric( QStyle::PM_IndicatorHeight,
++ &aStyleOption, m_pCheckBox ) );
+
+- qRect.moveBy( ( qOldRect.width() - qRect.width() ) / 2,
+- ( qOldRect.height() - qRect.height() ) / 2 );
++ qRect.translate( ( qOldRect.width() - qRect.width() ) / 2,
++ ( qOldRect.height() - qRect.height() ) / 2 );
+ }
+
+ m_pCheckBox->move( qRect.topLeft() );
+@@ -919,32 +956,23 @@
+ QComboBox *WidgetPainter::comboBox( const Region& rControlRegion,
+ BOOL bEditable )
+ {
+- QComboBox *pComboBox = NULL;
+- if ( bEditable )
+- {
+- if ( !m_pEditableComboBox )
+- m_pEditableComboBox = new QComboBox( true, NULL, "combo_box_edit" );
+- pComboBox = m_pEditableComboBox;
+- }
+- else
+- {
+- if ( !m_pComboBox )
+- m_pComboBox = new QComboBox( false, NULL, "combo_box" );
+- pComboBox = m_pComboBox;
+- }
++ if ( !m_pComboBox )
++ m_pComboBox = new QComboBox( NULL );
++
++ m_pComboBox->setEditable( bEditable );
+
+ QRect qRect = region2QRect( rControlRegion );
+
+- pComboBox->move( qRect.topLeft() );
+- pComboBox->resize( qRect.size() );
++ m_pComboBox->move( qRect.topLeft() );
++ m_pComboBox->resize( qRect.size() );
+
+- return pComboBox;
++ return m_pComboBox;
+ }
+
+ QLineEdit *WidgetPainter::lineEdit( const Region& rControlRegion )
+ {
+ if ( !m_pLineEdit )
+- m_pLineEdit = new QLineEdit( NULL, "line_edit" );
++ m_pLineEdit = new QLineEdit( NULL );
+
+ QRect qRect = region2QRect( rControlRegion );
+
+@@ -954,42 +982,31 @@
+ return m_pLineEdit;
+ }
+
+-QSpinWidget *WidgetPainter::spinWidget( const Region& rControlRegion )
++QSpinBox *WidgetPainter::spinBox( const Region& rControlRegion )
+ {
+- if ( !m_pSpinWidget )
+- {
+- m_pSpinWidget = new QSpinWidget( NULL, "spin_widget" );
+-
+- m_pSpinEdit = new QLineEdit( NULL, "line_edit_spin" );
+- m_pSpinWidget->setEditWidget( m_pSpinEdit );
+- }
++ if ( !m_pSpinBox )
++ m_pSpinBox = new QSpinBox( NULL );
+
+ QRect qRect = region2QRect( rControlRegion );
+
+- m_pSpinWidget->move( qRect.topLeft() );
+- m_pSpinWidget->resize( qRect.size() );
+- m_pSpinWidget->arrange();
++ m_pSpinBox->move( qRect.topLeft() );
++ m_pSpinBox->resize( qRect.size() );
+
+- return m_pSpinWidget;
++ return m_pSpinBox;
+ }
+
+ QTabBar *WidgetPainter::tabBar( const Region& rControlRegion )
+ {
+ if ( !m_pTabBar )
+ {
+- if ( !m_pTabBarParent )
+- m_pTabBarParent = new QWidget( NULL, "tab_bar_parent" );
++ if ( !m_pTabBarParent )
++ m_pTabBarParent = new QWidget( NULL );
+
+- m_pTabBar = new QTabBar( m_pTabBarParent, "tab_bar" );
++ m_pTabBar = new QTabBar( m_pTabBarParent );
+
+- m_pTabLeft = new QTab();
+- m_pTabMiddle = new QTab();
+- m_pTabRight = new QTab();
+- m_pTabAlone = new QTab();
+-
+- m_pTabBar->addTab( m_pTabLeft );
+- m_pTabBar->addTab( m_pTabMiddle );
+- m_pTabBar->addTab( m_pTabRight );
++ m_nTabLeft = m_pTabBar->addTab( "" );
++ m_nTabMiddle = m_pTabBar->addTab( "" );
++ m_nTabRight = m_pTabBar->addTab( "" );
+ }
+
+ QRect qRect = region2QRect( rControlRegion );
+@@ -997,7 +1014,7 @@
+ m_pTabBar->move( qRect.topLeft() );
+ m_pTabBar->resize( qRect.size() );
+
+- m_pTabBar->setShape( QTabBar::RoundedAbove );
++ m_pTabBar->setShape( QTabBar::RoundedNorth );
+
+ return m_pTabBar;
+ }
+@@ -1005,10 +1022,10 @@
+ QTabWidget *WidgetPainter::tabWidget( const Region& rControlRegion )
+ {
+ if ( !m_pTabWidget )
+- m_pTabWidget = new QTabWidget( NULL, "tab_widget" );
++ m_pTabWidget = new QTabWidget( NULL );
+
+ QRect qRect = region2QRect( rControlRegion );
+- --qRect.rTop();
++ qRect.setTop( qRect.top() - 1 );
+
+ m_pTabWidget->move( qRect.topLeft() );
+ m_pTabWidget->resize( qRect.size() );
+@@ -1019,7 +1036,7 @@
+ QListView *WidgetPainter::listView( const Region& rControlRegion )
+ {
+ if ( !m_pListView )
+- m_pListView = new QListView( NULL, "list_view" );
++ m_pListView = new QListView( NULL );
+
+ QRect qRect = region2QRect( rControlRegion );
+
+@@ -1034,9 +1051,9 @@
+ {
+ if ( !m_pScrollBar )
+ {
+- m_pScrollBar = new QScrollBar( NULL, "scroll_bar" );
+- m_pScrollBar->setTracking( false );
+- m_pScrollBar->setLineStep( 1 );
++ m_pScrollBar = new QScrollBar( NULL );
++ m_pScrollBar->setTracking( false );
++ m_pScrollBar->setSingleStep( 1 );
+ }
+
+ QRect qRect = region2QRect( rControlRegion );
+@@ -1048,10 +1065,10 @@
+ ScrollbarValue *pValue = static_cast<ScrollbarValue *> ( aValue.getOptionalVal() );
+ if ( pValue )
+ {
+- m_pScrollBar->setMinValue( pValue->mnMin );
+- m_pScrollBar->setMaxValue( pValue->mnMax - pValue->mnVisibleSize );
+- m_pScrollBar->setValue( pValue->mnCur );
+- m_pScrollBar->setPageStep( pValue->mnVisibleSize );
++ m_pScrollBar->setMinimum( pValue->mnMin );
++ m_pScrollBar->setMaximum( pValue->mnMax - pValue->mnVisibleSize );
++ m_pScrollBar->setValue( pValue->mnCur );
++ m_pScrollBar->setPageStep( pValue->mnVisibleSize );
+ }
+
+ return m_pScrollBar;
+@@ -1060,15 +1077,15 @@
+ QToolBar *WidgetPainter::toolBar( const Region& rControlRegion, BOOL bHorizontal )
+ {
+ if ( !m_pMainWindow )
+- m_pMainWindow = new QMainWindow( NULL, "main_window" );
++ m_pMainWindow = new QMainWindow( NULL, Qt::Window );
+
+ QToolBar *pToolBar;
+ if ( bHorizontal )
+ {
+ if ( !m_pToolBarHoriz )
+ {
+- m_pToolBarHoriz = new QToolBar( m_pMainWindow, "tool_bar_horiz" );
+- m_pMainWindow->moveDockWindow( m_pToolBarHoriz, Qt::DockTop );
++ m_pToolBarHoriz = new QToolBar( m_pMainWindow );
++ m_pToolBarHoriz->setAllowedAreas( Qt::TopToolBarArea );
+ }
+ pToolBar = m_pToolBarHoriz;
+ }
+@@ -1076,8 +1093,8 @@
+ {
+ if ( !m_pToolBarVert )
+ {
+- m_pToolBarVert = new QToolBar( m_pMainWindow, "tool_bar_horiz" );
+- m_pMainWindow->moveDockWindow( m_pToolBarVert, Qt::DockLeft );
++ m_pToolBarVert = new QToolBar( m_pMainWindow );
++ m_pToolBarHoriz->setAllowedAreas( Qt::LeftToolBarArea );
+ }
+ pToolBar = m_pToolBarVert;
+ }
+@@ -1093,7 +1110,7 @@
+ QToolButton *WidgetPainter::toolButton( const Region& rControlRegion)
+ {
+ if ( !m_pToolButton )
+- m_pToolButton = new QToolButton( NULL, "tool_button" );
++ m_pToolButton = new QToolButton( NULL );
+
+ QRect qRect = region2QRect( rControlRegion );
+
+@@ -1107,13 +1124,15 @@
+ {
+ if ( !m_pMenuBar )
+ {
+- m_pMenuBar = new QMenuBar( NULL, "menu_bar" );
++ m_pMenuBar = new QMenuBar( NULL );
+
+- m_nMenuBarEnabledItem = m_pMenuBar->insertItem( "" );
+- m_nMenuBarDisabledItem = m_pMenuBar->insertItem( "" );
++ if ( !m_pMenuBarEnabledItem )
++ m_pMenuBarEnabledItem = m_pMenuBar->addAction( "" );
++ if ( !m_pMenuBarDisabledItem )
++ m_pMenuBarDisabledItem = m_pMenuBar->addAction( "" );
+
+- m_pMenuBar->setItemEnabled( m_nMenuBarEnabledItem, true );
+- m_pMenuBar->setItemEnabled( m_nMenuBarDisabledItem, false );
++ m_pMenuBarEnabledItem->setEnabled( true );
++ m_pMenuBarDisabledItem->setEnabled( false );
+ }
+
+ QRect qRect = region2QRect( rControlRegion );
+@@ -1124,17 +1143,19 @@
+ return m_pMenuBar;
+ }
+
+-QPopupMenu *WidgetPainter::popupMenu( const Region& rControlRegion)
++QMenu *WidgetPainter::popupMenu( const Region& rControlRegion)
+ {
+ if ( !m_pPopupMenu )
+ {
+- m_pPopupMenu = new QPopupMenu( NULL, "popup_menu" );
++ m_pPopupMenu = new QMenu( NULL );
+
+- m_nPopupMenuEnabledItem = m_pPopupMenu->insertItem( "" );
+- m_nPopupMenuDisabledItem = m_pPopupMenu->insertItem( "" );
++ if ( !m_pPopupMenuEnabledItem )
++ m_pPopupMenuEnabledItem = m_pPopupMenu->addAction( "" );
++ if ( !m_pPopupMenuDisabledItem )
++ m_pPopupMenuDisabledItem = m_pPopupMenu->addAction( "" );
+
+- m_pPopupMenu->setItemEnabled( m_nPopupMenuEnabledItem, true );
+- m_pPopupMenu->setItemEnabled( m_nPopupMenuDisabledItem, false );
++ m_pPopupMenuEnabledItem->setEnabled( true );
++ m_pPopupMenuDisabledItem->setEnabled( false );
+ }
+
+ QRect qRect = region2QRect( rControlRegion );
+@@ -1148,7 +1169,7 @@
+ QProgressBar *WidgetPainter::progressBar( const Region& rControlRegion )
+ {
+ if ( !m_pProgressBar )
+- m_pProgressBar = new QProgressBar( NULL, "progress_bar" );
++ m_pProgressBar = new QProgressBar( NULL );
+
+ QRect qRect = region2QRect( rControlRegion );
+
+@@ -1158,27 +1179,27 @@
+ return m_pProgressBar;
+ }
+
+-QStyle::SFlags WidgetPainter::vclStateValue2SFlags( ControlState nState,
++QStyle::State WidgetPainter::vclStateValue2StateFlag( ControlState nControlState,
+ const ImplControlValue& aValue )
+ {
+- QStyle::SFlags nStyle =
+- ( (nState & CTRL_STATE_DEFAULT)? QStyle::Style_ButtonDefault: QStyle::Style_Default ) |
+- ( (nState & CTRL_STATE_ENABLED)? QStyle::Style_Enabled: QStyle::Style_Default ) |
+- ( (nState & CTRL_STATE_FOCUSED)? QStyle::Style_HasFocus: QStyle::Style_Default ) |
+- ( (nState & CTRL_STATE_PRESSED)? QStyle::Style_Down: QStyle::Style_Raised ) |
+- ( (nState & CTRL_STATE_SELECTED)? QStyle::Style_Selected : QStyle::Style_Default ) |
+- ( (nState & CTRL_STATE_ROLLOVER)? QStyle::Style_MouseOver: QStyle::Style_Default );
+- //TODO ( (nState & CTRL_STATE_HIDDEN)? QStyle::Style_: QStyle::Style_Default ) |
++ QStyle::State nState =
++ ( (nControlState & CTRL_STATE_DEFAULT)? QStyle::State_None: QStyle::State_None ) |
++ ( (nControlState & CTRL_STATE_ENABLED)? QStyle::State_Enabled: QStyle::State_None ) |
++ ( (nControlState & CTRL_STATE_FOCUSED)? QStyle::State_HasFocus: QStyle::State_None ) |
++ ( (nControlState & CTRL_STATE_PRESSED)? QStyle::State_Sunken: QStyle::State_None ) |
++ ( (nControlState & CTRL_STATE_SELECTED)? QStyle::State_Selected : QStyle::State_None ) |
++ ( (nControlState & CTRL_STATE_ROLLOVER)? QStyle::State_MouseOver: QStyle::State_None );
++ //TODO ( (nControlState & CTRL_STATE_HIDDEN)? QStyle::State_: QStyle::State_None ) |
+
+ switch ( aValue.getTristateVal() )
+ {
+- case BUTTONVALUE_ON: nStyle |= QStyle::Style_On; break;
+- case BUTTONVALUE_OFF: nStyle |= QStyle::Style_Off; break;
+- case BUTTONVALUE_MIXED: nStyle |= QStyle::Style_NoChange; break;
++ case BUTTONVALUE_ON: nState |= QStyle::State_On; break;
++ case BUTTONVALUE_OFF: nState |= QStyle::State_Off; break;
++ case BUTTONVALUE_MIXED: nState |= QStyle::State_NoChange; break;
+ default: break;
+ }
+
+- return nStyle;
++ return nState;
+ }
+
+ QRect WidgetPainter::region2QRect( const Region& rControlRegion )
+@@ -1205,15 +1226,15 @@
+ const Region& rControlRegion, const Point& aPos,
+ SalControlHandle& rControlHandle, BOOL& rIsInside );
+ virtual BOOL drawNativeControl( ControlType nType, ControlPart nPart,
+- const Region& rControlRegion, ControlState nState,
++ const Region& rControlRegion, ControlState nControlState,
+ const ImplControlValue& aValue, SalControlHandle& rControlHandle,
+ const OUString& aCaption );
+ virtual BOOL drawNativeControlText( ControlType nType, ControlPart nPart,
+- const Region& rControlRegion, ControlState nState,
++ const Region& rControlRegion, ControlState nControlState,
+ const ImplControlValue& aValue, SalControlHandle& rControlHandle,
+ const OUString& aCaption );
+ virtual BOOL getNativeControlRegion( ControlType nType, ControlPart nPart,
+- const Region& rControlRegion, ControlState nState,
++ const Region& rControlRegion, ControlState nControlState,
+ const ImplControlValue& aValue, SalControlHandle& rControlHandle,
+ const OUString& aCaption,
+ Region &rNativeBoundingRegion, Region &rNativeContentRegion );
+@@ -1272,97 +1293,104 @@
+ {
+ if ( nType == CTRL_SCROLLBAR )
+ {
+- // make position relative to rControlRegion
+- Point aPos = rPos - rControlRegion.GetBoundRect().TopLeft();
+- rIsInside = FALSE;
++ // make position relative to rControlRegion
++ Point aPos = rPos - rControlRegion.GetBoundRect().TopLeft();
++ rIsInside = FALSE;
+
+- BOOL bHorizontal = ( nPart == PART_BUTTON_LEFT || nPart == PART_BUTTON_RIGHT );
++ BOOL bHorizontal = ( nPart == PART_BUTTON_LEFT || nPart == PART_BUTTON_RIGHT );
+
+- QScrollBar *pScrollBar = pWidgetPainter->scrollBar( rControlRegion,
+- bHorizontal, ImplControlValue() );
+- QRect qRectSubLine = kapp->style().querySubControlMetrics(
+- QStyle::CC_ScrollBar, pScrollBar, QStyle::SC_ScrollBarSubLine );
+- QRect qRectAddLine = kapp->style().querySubControlMetrics(
+- QStyle::CC_ScrollBar, pScrollBar, QStyle::SC_ScrollBarAddLine );
+-
+- // There are 2 buttons on the right/bottom side of the scrollbar
+- BOOL bTwoSubButtons = FALSE;
+-
+- // It is a Platinum style scroll bar
+- BOOL bPlatinumStyle = FALSE;
+-
+- // Workaround for Platinum and 3 button style scroll bars.
+- // It makes the right/down button bigger.
+- if ( bHorizontal )
+- {
+- qRectAddLine.setLeft( kapp->style().querySubControlMetrics(
+- QStyle::CC_ScrollBar, pScrollBar,
+- QStyle::SC_ScrollBarAddPage ).right() + 1 );
+- if ( qRectAddLine.width() > qRectSubLine.width() )
+- bTwoSubButtons = TRUE;
+- if ( qRectSubLine.left() > kapp->style().querySubControlMetrics( QStyle::CC_ScrollBar, pScrollBar, QStyle::SC_ScrollBarSubPage ).left() )
+- bPlatinumStyle = TRUE;
+- }
+- else
+- {
+- qRectAddLine.setTop( kapp->style().querySubControlMetrics(
+- QStyle::CC_ScrollBar, pScrollBar,
+- QStyle::SC_ScrollBarAddPage ).bottom() + 1 );
+- if ( qRectAddLine.height() > qRectSubLine.height() )
+- bTwoSubButtons = TRUE;
+- if ( qRectSubLine.top() > kapp->style().querySubControlMetrics( QStyle::CC_ScrollBar, pScrollBar, QStyle::SC_ScrollBarSubPage ).top() )
+- bPlatinumStyle = TRUE;
+- }
+-
+- switch ( nPart )
+- {
+- case PART_BUTTON_LEFT:
+- if ( !bPlatinumStyle && qRectSubLine.contains( aPos.getX(), aPos.getY() ) )
+- rIsInside = TRUE;
+- else if ( bTwoSubButtons )
++ QScrollBar *pScrollBar = pWidgetPainter->scrollBar( rControlRegion,
++ bHorizontal, ImplControlValue() );
++ QStyleOptionComplex aStyleOption;
++ aStyleOption.initFrom( pScrollBar );
++
++ QRect qRectSubLine = kapp->style()->subControlRect(
++ QStyle::CC_ScrollBar, &aStyleOption, QStyle::SC_ScrollBarSubLine );
++ QRect qRectAddLine = kapp->style()->subControlRect(
++ QStyle::CC_ScrollBar, &aStyleOption, QStyle::SC_ScrollBarAddLine );
++
++ // There are 2 buttons on the right/bottom side of the scrollbar
++ BOOL bTwoSubButtons = FALSE;
++
++ // It is a Platinum style scroll bar
++ BOOL bPlatinumStyle = FALSE;
++
++ // Workaround for Platinum and 3 button style scroll bars.
++ // It makes the right/down button bigger.
++ if ( bHorizontal )
+ {
+- qRectAddLine.setWidth( qRectAddLine.width() / 2 );
+- rIsInside = qRectAddLine.contains( aPos.getX(), aPos.getY() );
++ qRectAddLine.setLeft( kapp->style()->subControlRect(
++ QStyle::CC_ScrollBar, &aStyleOption,
++ QStyle::SC_ScrollBarAddPage ).right() + 1 );
++ if ( qRectAddLine.width() > qRectSubLine.width() )
++ bTwoSubButtons = TRUE;
++ if ( qRectSubLine.left() > kapp->style()->subControlRect(
++ QStyle::CC_ScrollBar, &aStyleOption,
++ QStyle::SC_ScrollBarSubPage ).left() )
++ bPlatinumStyle = TRUE;
+ }
+- break;
+-
+- case PART_BUTTON_UP:
+- if ( !bPlatinumStyle && qRectSubLine.contains( aPos.getX(), aPos.getY() ) )
+- rIsInside = TRUE;
+- else if ( bTwoSubButtons )
++ else
+ {
+- qRectAddLine.setHeight( qRectAddLine.height() / 2 );
+- rIsInside = qRectAddLine.contains( aPos.getX(), aPos.getY() );
++ qRectAddLine.setTop( kapp->style()->subControlRect(
++ QStyle::CC_ScrollBar, &aStyleOption,
++ QStyle::SC_ScrollBarAddPage ).bottom() + 1 );
++ if ( qRectAddLine.height() > qRectSubLine.height() )
++ bTwoSubButtons = TRUE;
++ if ( qRectSubLine.top() > kapp->style()->subControlRect(
++ QStyle::CC_ScrollBar, &aStyleOption,
++ QStyle::SC_ScrollBarSubPage ).top() )
++ bPlatinumStyle = TRUE;
+ }
+- break;
++
++ switch ( nPart )
++ {
++ case PART_BUTTON_LEFT:
++ if ( !bPlatinumStyle && qRectSubLine.contains( aPos.getX(), aPos.getY() ) )
++ rIsInside = TRUE;
++ else if ( bTwoSubButtons )
++ {
++ qRectAddLine.setWidth( qRectAddLine.width() / 2 );
++ rIsInside = qRectAddLine.contains( aPos.getX(), aPos.getY() );
++ }
++ break;
++
++ case PART_BUTTON_UP:
++ if ( !bPlatinumStyle && qRectSubLine.contains( aPos.getX(), aPos.getY() ) )
++ rIsInside = TRUE;
++ else if ( bTwoSubButtons )
++ {
++ qRectAddLine.setHeight( qRectAddLine.height() / 2 );
++ rIsInside = qRectAddLine.contains( aPos.getX(), aPos.getY() );
++ }
++ break;
+
+ case PART_BUTTON_RIGHT:
+- if ( bTwoSubButtons )
+- qRectAddLine.setLeft( qRectAddLine.left() + qRectAddLine.width() / 2 );
++ if ( bTwoSubButtons )
++ qRectAddLine.setLeft( qRectAddLine.left() + qRectAddLine.width() / 2 );
+
+- rIsInside = qRectAddLine.contains( aPos.getX(), aPos.getY() );
+- break;
++ rIsInside = qRectAddLine.contains( aPos.getX(), aPos.getY() );
++ break;
+
+ case PART_BUTTON_DOWN:
+- if ( bTwoSubButtons )
+- qRectAddLine.setTop( qRectAddLine.top() + qRectAddLine.height() / 2 );
++ if ( bTwoSubButtons )
++ qRectAddLine.setTop( qRectAddLine.top() + qRectAddLine.height() / 2 );
+
+- rIsInside = qRectAddLine.contains( aPos.getX(), aPos.getY() );
+- break;
++ rIsInside = qRectAddLine.contains( aPos.getX(), aPos.getY() );
++ break;
+
+ // cases PART_TRACK_HORZ_AREA and PART_TRACK_VERT_AREA
+ default:
+- return FALSE;
+- }
++ return FALSE;
++ }
+
+- return TRUE;
++ return TRUE;
+ }
+
+ return FALSE;
+ }
+
+
+-/** Draw the requested control described by nPart/nState.
++/** Draw the requested control described by nPart/nControlState.
+
+ @param rControlRegion
+ The bounding region of the complete control in VCL frame coordinates.
+@@ -1377,7 +1405,7 @@
+ A caption or title string (like button text etc.)
+ */
+ BOOL KDESalGraphics::drawNativeControl( ControlType nType, ControlPart nPart,
+- const Region& rControlRegion, ControlState nState,
++ const Region& rControlRegion, ControlState nControlState,
+ const ImplControlValue& aValue, SalControlHandle&,
+ const OUString& )
+ {
+@@ -1389,115 +1417,115 @@
+
+ if ( (nType == CTRL_PUSHBUTTON) && (nPart == PART_ENTIRE_CONTROL) )
+ {
+- bReturn = pWidgetPainter->drawStyledWidget(
+- pWidgetPainter->pushButton( rControlRegion, (nState & CTRL_STATE_DEFAULT) ),
+- nState, aValue,
+- dpy, drawable, GetScreenNumber(), GetVisual().GetDepth(), gc );
++ bReturn = pWidgetPainter->drawStyledWidget(
++ pWidgetPainter->pushButton( rControlRegion, (nControlState & CTRL_STATE_DEFAULT) ),
++ nControlState, aValue,
++ dpy, drawable, GetScreenNumber(), GetVisual().GetDepth(), gc );
+ }
+ else if ( (nType == CTRL_RADIOBUTTON) && (nPart == PART_ENTIRE_CONTROL) )
+ {
+- bReturn = pWidgetPainter->drawStyledWidget(
+- pWidgetPainter->radioButton( rControlRegion ),
+- nState, aValue,
+- dpy, drawable, GetScreenNumber(), GetVisual().GetDepth(), gc );
++ bReturn = pWidgetPainter->drawStyledWidget(
++ pWidgetPainter->radioButton( rControlRegion ),
++ nControlState, aValue,
++ dpy, drawable, GetScreenNumber(), GetVisual().GetDepth(), gc );
+ }
+ else if ( (nType == CTRL_CHECKBOX) && (nPart == PART_ENTIRE_CONTROL) )
+ {
+- bReturn = pWidgetPainter->drawStyledWidget(
+- pWidgetPainter->checkBox( rControlRegion ),
+- nState, aValue,
+- dpy, drawable, GetScreenNumber(), GetVisual().GetDepth(), gc );
++ bReturn = pWidgetPainter->drawStyledWidget(
++ pWidgetPainter->checkBox( rControlRegion ),
++ nControlState, aValue,
++ dpy, drawable, GetScreenNumber(), GetVisual().GetDepth(), gc );
+ }
+ else if ( (nType == CTRL_COMBOBOX) && (nPart == PART_ENTIRE_CONTROL) )
+ {
+- bReturn = pWidgetPainter->drawStyledWidget(
+- pWidgetPainter->comboBox( rControlRegion, TRUE ),
+- nState, aValue,
+- dpy, drawable, GetScreenNumber(), GetVisual().GetDepth(), gc );
++ bReturn = pWidgetPainter->drawStyledWidget(
++ pWidgetPainter->comboBox( rControlRegion, TRUE ),
++ nControlState, aValue,
++ dpy, drawable, GetScreenNumber(), GetVisual().GetDepth(), gc );
+ }
+ else if ( (nType == CTRL_EDITBOX) && (nPart == PART_ENTIRE_CONTROL) )
+ {
+- bReturn = pWidgetPainter->drawStyledWidget(
+- pWidgetPainter->lineEdit( rControlRegion ),
+- nState, aValue,
+- dpy, drawable, GetScreenNumber(), GetVisual().GetDepth(), gc );
++ bReturn = pWidgetPainter->drawStyledWidget(
++ pWidgetPainter->lineEdit( rControlRegion ),
++ nControlState, aValue,
++ dpy, drawable, GetScreenNumber(), GetVisual().GetDepth(), gc );
+ }
+ else if ( (nType == CTRL_LISTBOX) && (nPart == PART_ENTIRE_CONTROL) )
+ {
+- bReturn = pWidgetPainter->drawStyledWidget(
+- pWidgetPainter->comboBox( rControlRegion, FALSE ),
+- nState, aValue,
+- dpy, drawable, GetScreenNumber(), GetVisual().GetDepth(), gc );
++ bReturn = pWidgetPainter->drawStyledWidget(
++ pWidgetPainter->comboBox( rControlRegion, FALSE ),
++ nControlState, aValue,
++ dpy, drawable, GetScreenNumber(), GetVisual().GetDepth(), gc );
+ }
+ else if ( (nType == CTRL_LISTBOX) && (nPart == PART_WINDOW) )
+ {
+- bReturn = pWidgetPainter->drawStyledWidget(
+- pWidgetPainter->listView( rControlRegion ),
+- nState, aValue,
+- dpy, drawable, GetScreenNumber(), GetVisual().GetDepth(), gc );
++ bReturn = pWidgetPainter->drawStyledWidget(
++ pWidgetPainter->listView( rControlRegion ),
++ nControlState, aValue,
++ dpy, drawable, GetScreenNumber(), GetVisual().GetDepth(), gc );
+ }
+ else if ( (nType == CTRL_SPINBOX) && (nPart == PART_ENTIRE_CONTROL) )
+ {
+- bReturn = pWidgetPainter->drawStyledWidget(
+- pWidgetPainter->spinWidget( rControlRegion ),
+- nState, aValue,
+- dpy, drawable, GetScreenNumber(), GetVisual().GetDepth(), gc );
++ bReturn = pWidgetPainter->drawStyledWidget(
++ pWidgetPainter->spinBox( rControlRegion ),
++ nControlState, aValue,
++ dpy, drawable, GetScreenNumber(), GetVisual().GetDepth(), gc );
+ }
+ else if ( (nType==CTRL_TAB_ITEM) && (nPart == PART_ENTIRE_CONTROL) )
+ {
+- bReturn = pWidgetPainter->drawStyledWidget(
+- pWidgetPainter->tabBar( rControlRegion ),
+- nState, aValue,
+- dpy, drawable, GetScreenNumber(), GetVisual().GetDepth(), gc );
++ bReturn = pWidgetPainter->drawStyledWidget(
++ pWidgetPainter->tabBar( rControlRegion ),
++ nControlState, aValue,
++ dpy, drawable, GetScreenNumber(), GetVisual().GetDepth(), gc );
+ }
+ else if ( (nType==CTRL_TAB_PANE) && (nPart == PART_ENTIRE_CONTROL) )
+ {
+- bReturn = pWidgetPainter->drawStyledWidget(
+- pWidgetPainter->tabWidget( rControlRegion ),
+- nState, aValue,
+- dpy, drawable, GetScreenNumber(), GetVisual().GetDepth(), gc );
++ bReturn = pWidgetPainter->drawStyledWidget(
++ pWidgetPainter->tabWidget( rControlRegion ),
++ nControlState, aValue,
++ dpy, drawable, GetScreenNumber(), GetVisual().GetDepth(), gc );
+ }
+ else if ( (nType == CTRL_SCROLLBAR) && (nPart == PART_DRAW_BACKGROUND_HORZ || nPart == PART_DRAW_BACKGROUND_VERT) )
+ {
+- bReturn = pWidgetPainter->drawStyledWidget(
+- pWidgetPainter->scrollBar( rControlRegion, nPart == PART_DRAW_BACKGROUND_HORZ, aValue ),
+- nState, aValue,
+- dpy, drawable, GetScreenNumber(), GetVisual().GetDepth(), gc );
++ bReturn = pWidgetPainter->drawStyledWidget(
++ pWidgetPainter->scrollBar( rControlRegion, nPart == PART_DRAW_BACKGROUND_HORZ, aValue ),
++ nControlState, aValue,
++ dpy, drawable, GetScreenNumber(), GetVisual().GetDepth(), gc );
+ }
+ else if ( (nType == CTRL_TOOLBAR) && (nPart == PART_DRAW_BACKGROUND_HORZ || nPart == PART_DRAW_BACKGROUND_VERT || nPart == PART_THUMB_HORZ || nPart == PART_THUMB_VERT) )
+ {
+ bReturn = pWidgetPainter->drawStyledWidget(
+- pWidgetPainter->toolBar( rControlRegion, nPart == PART_DRAW_BACKGROUND_HORZ || nPart == PART_THUMB_VERT ),
+- nState, aValue,
+- dpy, drawable, GetScreenNumber(), GetVisual().GetDepth(), gc, nPart );
++ pWidgetPainter->toolBar( rControlRegion, nPart == PART_DRAW_BACKGROUND_HORZ || nPart == PART_THUMB_VERT ),
++ nControlState, aValue,
++ dpy, drawable, GetScreenNumber(), GetVisual().GetDepth(), gc, nPart );
+ }
+ else if ( (nType == CTRL_TOOLBAR) && (nPart == PART_BUTTON) )
+ {
+ bReturn = pWidgetPainter->drawStyledWidget(
+- pWidgetPainter->toolButton( rControlRegion ),
+- nState, aValue,
+- dpy, drawable, GetScreenNumber(), GetVisual().GetDepth(), gc, nPart );
++ pWidgetPainter->toolButton( rControlRegion ),
++ nControlState, aValue,
++ dpy, drawable, GetScreenNumber(), GetVisual().GetDepth(), gc, nPart );
+ }
+ else if ( (nType == CTRL_MENUBAR) && (nPart == PART_ENTIRE_CONTROL || nPart == PART_MENU_ITEM) )
+ {
+ bReturn = pWidgetPainter->drawStyledWidget(
+- pWidgetPainter->menuBar( rControlRegion ),
+- nState, aValue,
+- dpy, drawable, GetScreenNumber(), GetVisual().GetDepth(), gc, nPart );
++ pWidgetPainter->menuBar( rControlRegion ),
++ nControlState, aValue,
++ dpy, drawable, GetScreenNumber(), GetVisual().GetDepth(), gc, nPart );
+ }
+ else if ( (nType == CTRL_MENU_POPUP) && (nPart == PART_ENTIRE_CONTROL || nPart == PART_MENU_ITEM) )
+ {
+ bReturn = pWidgetPainter->drawStyledWidget(
+- pWidgetPainter->popupMenu( rControlRegion ),
+- nState, aValue,
+- dpy, drawable, GetScreenNumber(), GetVisual().GetDepth(), gc );
++ pWidgetPainter->popupMenu( rControlRegion ),
++ nControlState, aValue,
++ dpy, drawable, GetScreenNumber(), GetVisual().GetDepth(), gc );
+ }
+ else if ( (nType == CTRL_PROGRESS) && (nPart == PART_ENTIRE_CONTROL) )
+ {
+ bReturn = pWidgetPainter->drawStyledWidget(
+- pWidgetPainter->progressBar( rControlRegion ),
+- nState, aValue,
+- dpy, drawable, GetScreenNumber(), GetVisual().GetDepth(), gc );
++ pWidgetPainter->progressBar( rControlRegion ),
++ nControlState, aValue,
++ dpy, drawable, GetScreenNumber(), GetVisual().GetDepth(), gc );
+ }
+
+ return bReturn;
+@@ -1506,7 +1534,7 @@
+
+ /** Draw text on the widget.
+
+- OPTIONAL. Draws the requested text for the control described by nPart/nState.
++ OPTIONAL. Draws the requested text for the control described by nPart/nControlState.
+ Used if text is not drawn by DrawNativeControl().
+
+ @param rControlRegion
+@@ -1550,7 +1578,7 @@
+ A caption or title string (like button text etc.)
+ */
+ BOOL KDESalGraphics::getNativeControlRegion( ControlType nType, ControlPart nPart,
+- const Region& rControlRegion, ControlState nState,
++ const Region& rControlRegion, ControlState nControlState,
+ const ImplControlValue&, SalControlHandle&,
+ const OUString&,
+ Region &rNativeBoundingRegion, Region &rNativeContentRegion )
+@@ -1558,77 +1586,86 @@
+ BOOL bReturn = FALSE;
+ QRect qBoundingRect = WidgetPainter::region2QRect( rControlRegion );
+ QRect qRect;
+-
++ QStyleOptionComplex aStyleOption;
++
+ QWidget *pWidget = NULL;
+ switch ( nType )
+ {
+ // Metrics of the push button
+ case CTRL_PUSHBUTTON:
+- pWidget = pWidgetPainter->pushButton( rControlRegion, ( nState & CTRL_STATE_DEFAULT ) );
++ pWidget = pWidgetPainter->pushButton( rControlRegion, ( nControlState & CTRL_STATE_DEFAULT ) );
+
+ switch ( nPart )
+ {
+ case PART_ENTIRE_CONTROL:
+ qRect = qBoundingRect;
+
+- if ( nState & CTRL_STATE_DEFAULT )
++ if ( nControlState & CTRL_STATE_DEFAULT )
+ {
+- int nIndicatorSize = kapp->style().pixelMetric(
+- QStyle::PM_ButtonDefaultIndicator, pWidget );
+- qBoundingRect.addCoords( -nIndicatorSize, -nIndicatorSize,
+- nIndicatorSize, nIndicatorSize );
+- bReturn = TRUE;
++ int nIndicatorSize = kapp->style()->pixelMetric(
++ QStyle::PM_ButtonDefaultIndicator, &aStyleOption, pWidget );
++ qBoundingRect.adjust( -nIndicatorSize, -nIndicatorSize,
++ nIndicatorSize, nIndicatorSize );
++ bReturn = TRUE;
+ }
+ break;
+ }
+ break;
+
+- // Metrics of the radio button
+- case CTRL_RADIOBUTTON:
+- pWidget = pWidgetPainter->radioButton( rControlRegion );
++ // Metrics of the radio button
++ case CTRL_RADIOBUTTON:
++ pWidget = pWidgetPainter->radioButton( rControlRegion );
++ aStyleOption.initFrom( pWidget );
+
+- if ( nPart == PART_ENTIRE_CONTROL )
+- {
+- qRect.setWidth( kapp->style().pixelMetric( QStyle::PM_ExclusiveIndicatorWidth, pWidget ) );
+- qRect.setHeight( kapp->style().pixelMetric( QStyle::PM_ExclusiveIndicatorHeight, pWidget ) );
++ if ( nPart == PART_ENTIRE_CONTROL )
++ {
++ qRect.setWidth( kapp->style()->pixelMetric(
++ QStyle::PM_ExclusiveIndicatorWidth, &aStyleOption, pWidget ) );
++ qRect.setHeight( kapp->style()->pixelMetric(
++ QStyle::PM_ExclusiveIndicatorHeight, &aStyleOption, pWidget ) );
+
+- bReturn = TRUE;
+- }
+- break;
++ bReturn = TRUE;
++ }
++ break;
+
+- // Metrics of the check box
+- case CTRL_CHECKBOX:
+- pWidget = pWidgetPainter->checkBox( rControlRegion );
++ // Metrics of the check box
++ case CTRL_CHECKBOX:
++ pWidget = pWidgetPainter->checkBox( rControlRegion );
++ aStyleOption.initFrom( pWidget );
+
+- if ( nPart == PART_ENTIRE_CONTROL )
+- {
+- qRect.setWidth( kapp->style().pixelMetric( QStyle::PM_IndicatorWidth, pWidget ) );
+- qRect.setHeight( kapp->style().pixelMetric( QStyle::PM_IndicatorHeight, pWidget ) );
++ if ( nPart == PART_ENTIRE_CONTROL )
++ {
++ qRect.setWidth( kapp->style()->pixelMetric(
++ QStyle::PM_IndicatorWidth, &aStyleOption, pWidget ) );
++ qRect.setHeight( kapp->style()->pixelMetric(
++ QStyle::PM_IndicatorHeight, &aStyleOption, pWidget ) );
+
+- bReturn = TRUE;
+- }
+- break;
++ bReturn = TRUE;
++ }
++ break;
+
+ // Metrics of the combo box
+ case CTRL_COMBOBOX:
+ case CTRL_LISTBOX:
+ pWidget = pWidgetPainter->comboBox( rControlRegion, ( nType == CTRL_COMBOBOX ) );
++ aStyleOption.initFrom( pWidget );
++
+ switch ( nPart )
+ {
+ case PART_BUTTON_DOWN:
+- qRect = kapp->style().querySubControlMetrics(
+- QStyle::CC_ComboBox, pWidget, QStyle::SC_ComboBoxArrow );
+- qRect.setLeft( kapp->style().querySubControlMetrics(
+- QStyle::CC_ComboBox, pWidget,
++ qRect = kapp->style()->subControlRect(
++ QStyle::CC_ComboBox, &aStyleOption, QStyle::SC_ComboBoxArrow );
++ qRect.setLeft( kapp->style()->subControlRect(
++ QStyle::CC_ComboBox, &aStyleOption,
+ QStyle::SC_ComboBoxEditField ).right() + 1 );
+- qRect.moveBy( qBoundingRect.left(), qBoundingRect.top() );
++ qRect.translate( qBoundingRect.left(), qBoundingRect.top() );
+ bReturn = TRUE;
+ break;
+
+ case PART_SUB_EDIT:
+- qRect = kapp->style().querySubControlMetrics(
+- QStyle::CC_ComboBox, pWidget, QStyle::SC_ComboBoxEditField );
+- qRect.moveBy( qBoundingRect.left(), qBoundingRect.top() );
++ qRect = kapp->style()->subControlRect(
++ QStyle::CC_ComboBox, &aStyleOption, QStyle::SC_ComboBoxEditField );
++ qRect.translate( qBoundingRect.left(), qBoundingRect.top() );
+ bReturn = TRUE;
+ break;
+ }
+@@ -1636,28 +1673,30 @@
+
+ // Metrics of the spin box
+ case CTRL_SPINBOX:
+- pWidget = pWidgetPainter->spinWidget( rControlRegion );
++ pWidget = pWidgetPainter->spinBox( rControlRegion );
++ aStyleOption.initFrom( pWidget );
++
+ switch ( nPart )
+ {
+ case PART_BUTTON_UP:
+- qRect = kapp->style().querySubControlMetrics(
+- QStyle::CC_SpinWidget, pWidget, QStyle::SC_SpinWidgetUp );
++ qRect = kapp->style()->subControlRect(
++ QStyle::CC_SpinBox, &aStyleOption, QStyle::SC_SpinBoxUp );
+ bReturn = TRUE;
+- qRect.moveBy( qBoundingRect.left(), qBoundingRect.top() );
++ qRect.translate( qBoundingRect.left(), qBoundingRect.top() );
+ break;
+
+ case PART_BUTTON_DOWN:
+- qRect = kapp->style().querySubControlMetrics(
+- QStyle::CC_SpinWidget, pWidget, QStyle::SC_SpinWidgetDown );
++ qRect = kapp->style()->subControlRect(
++ QStyle::CC_SpinBox, &aStyleOption, QStyle::SC_SpinBoxDown );
+ bReturn = TRUE;
+- qRect.moveBy( qBoundingRect.left(), qBoundingRect.top() );
++ qRect.translate( qBoundingRect.left(), qBoundingRect.top() );
+ break;
+
+ case PART_SUB_EDIT:
+- qRect = kapp->style().querySubControlMetrics(
+- QStyle::CC_SpinWidget, pWidget, QStyle::SC_SpinWidgetEditField );
+- qRect.moveBy( qBoundingRect.left(), qBoundingRect.top() );
++ qRect = kapp->style()->subControlRect(
++ QStyle::CC_SpinBox, &aStyleOption, QStyle::SC_SpinBoxEditField );
+ bReturn = TRUE;
++ qRect.translate( qBoundingRect.left(), qBoundingRect.top() );
+ break;
+ }
+ break;
+@@ -1667,63 +1706,65 @@
+ pWidget = pWidgetPainter->scrollBar( rControlRegion,
+ ( nPart == PART_BUTTON_LEFT || nPart == PART_BUTTON_RIGHT ),
+ ImplControlValue() );
++ aStyleOption.initFrom( pWidget );
++
+ switch ( nPart )
+ {
+ case PART_BUTTON_LEFT:
+ case PART_BUTTON_UP:
+- qRect = kapp->style().querySubControlMetrics(
+- QStyle::CC_ScrollBar, pWidget, QStyle::SC_ScrollBarSubLine );
++ qRect = kapp->style()->subControlRect(
++ QStyle::CC_ScrollBar, &aStyleOption, QStyle::SC_ScrollBarSubLine );
+
+ // Workaround for Platinum style scroll bars. It makes the
+ // left/up button invisible.
+ if ( nPart == PART_BUTTON_LEFT )
+ {
+- if ( qRect.left() > kapp->style().querySubControlMetrics(
+- QStyle::CC_ScrollBar, pWidget,
++ if ( qRect.left() > kapp->style()->subControlRect(
++ QStyle::CC_ScrollBar, &aStyleOption,
+ QStyle::SC_ScrollBarSubPage ).left() )
+- {
+- qRect.setLeft( 0 );
+- qRect.setRight( 0 );
+- }
++ {
++ qRect.setLeft( 0 );
++ qRect.setRight( 0 );
++ }
+ }
+ else
+ {
+- if ( qRect.top() > kapp->style().querySubControlMetrics(
+- QStyle::CC_ScrollBar, pWidget,
++ if ( qRect.top() > kapp->style()->subControlRect(
++ QStyle::CC_ScrollBar, &aStyleOption,
+ QStyle::SC_ScrollBarSubPage ).top() )
+- {
+- qRect.setTop( 0 );
+- qRect.setBottom( 0 );
+- }
++ {
++ qRect.setTop( 0 );
++ qRect.setBottom( 0 );
++ }
+ }
+-
+- qRect.moveBy( qBoundingRect.left(), qBoundingRect.top() );
++
++ qRect.translate( qBoundingRect.left(), qBoundingRect.top() );
+
+ bReturn = TRUE;
+ break;
+
+ case PART_BUTTON_RIGHT:
+ case PART_BUTTON_DOWN:
+- qRect = kapp->style().querySubControlMetrics(
+- QStyle::CC_ScrollBar, pWidget, QStyle::SC_ScrollBarAddLine );
++ qRect = kapp->style()->subControlRect(
++ QStyle::CC_ScrollBar, &aStyleOption, QStyle::SC_ScrollBarAddLine );
+
+ // Workaround for Platinum and 3 button style scroll bars.
+ // It makes the right/down button bigger.
+ if ( nPart == PART_BUTTON_RIGHT )
+- qRect.setLeft( kapp->style().querySubControlMetrics(
+- QStyle::CC_ScrollBar, pWidget,
++ qRect.setLeft( kapp->style()->subControlRect(
++ QStyle::CC_ScrollBar, &aStyleOption,
+ QStyle::SC_ScrollBarAddPage ).right() + 1 );
+ else
+- qRect.setTop( kapp->style().querySubControlMetrics(
+- QStyle::CC_ScrollBar, pWidget,
++ qRect.setTop( kapp->style()->subControlRect(
++ QStyle::CC_ScrollBar, &aStyleOption,
+ QStyle::SC_ScrollBarAddPage ).bottom() + 1 );
+
+- qRect.moveBy( qBoundingRect.left(), qBoundingRect.top() );
++ qRect.translate( qBoundingRect.left(), qBoundingRect.top() );
+
+ bReturn = TRUE;
+ break;
+ }
+- break;
++ break;
+ }
+
+ // Fill rNativeBoundingRegion and rNativeContentRegion
+@@ -1747,8 +1788,8 @@
+ // KDESalFrame implementation
+ // -----------------------------------------------------------------------
+
+-KDESalFrame::KDESalFrame( SalFrame* pParent, ULONG nStyle ) :
+- X11SalFrame( pParent, nStyle )
++KDESalFrame::KDESalFrame( SalFrame* pParent, ULONG nState ) :
++ X11SalFrame( pParent, nState )
+ {
+ }
+
+@@ -1771,16 +1812,16 @@
+
+ /** Helper function to read untranslated text entry from KConfig configuration repository.
+ */
+-static OUString readEntryUntranslated( KConfig *pConfig, const char *pKey )
++static OUString readEntryUntranslated( KConfigGroup *pGroup, const char *pKey )
+ {
+- return OUString::createFromAscii( pConfig->readEntryUntranslated( pKey ).ascii() );
++ return OUString::createFromAscii( (const char *) pGroup->readEntryUntranslated( pKey ).toAscii() );
+ }
+
+ /** Helper function to read color from KConfig configuration repository.
+ */
+-static Color readColor( KConfig *pConfig, const char *pKey )
++static Color readColor( KConfigGroup *pGroup, const char *pKey )
+ {
+- return toColor( pConfig->readColorEntry( pKey ) );
++ return toColor( pGroup->readEntry( pKey, QColor(Qt::white) ) );
+ }
+
+ /** Helper function to add information to Font from QFont.
+@@ -1793,7 +1834,7 @@
+ QFontInfo qFontInfo( rQFont );
+
+ // set family name
+- aInfo.m_aFamilyName = String( rQFont.family().utf8(), RTL_TEXTENCODING_UTF8 );
++ aInfo.m_aFamilyName = String( (const char *) rQFont.family().toUtf8(), RTL_TEXTENCODING_UTF8 );
+
+ // set italic
+ aInfo.m_eItalic = ( qFontInfo.italic()? psp::italic::Italic: psp::italic::Upright );
+@@ -1883,59 +1924,62 @@
+ bool bSetTitleFont = false;
+
+ // WM settings
+- KConfig *pConfig = KGlobal::config();
++ KConfig *pConfig = KGlobal::config().data();
+ if ( pConfig )
+ {
+- pConfig->setGroup( "WM" );
++ KConfigGroup aGroup = pConfig->group( "WM" );
+ const char *pKey;
+
+ pKey = "activeBackground";
+- if ( pConfig->hasKey( pKey ) )
+- aStyleSettings.SetActiveColor( readColor( pConfig, pKey ) );
++ if ( aGroup.hasKey( pKey ) )
++ aStyleSettings.SetActiveColor( readColor( &aGroup, pKey ) );
+
+ pKey = "activeBlend";
+- if ( pConfig->hasKey( pKey ) )
+- aStyleSettings.SetActiveColor2( readColor( pConfig, pKey ) );
++ if ( aGroup.hasKey( pKey ) )
++ aStyleSettings.SetActiveColor2( readColor( &aGroup, pKey ) );
+
+ pKey = "inactiveBackground";
+- if ( pConfig->hasKey( pKey ) )
+- aStyleSettings.SetDeactiveColor( readColor( pConfig, pKey ) );
++ if ( aGroup.hasKey( pKey ) )
++ aStyleSettings.SetDeactiveColor( readColor( &aGroup, pKey ) );
+
+ pKey = "inactiveBlend";
+- if ( pConfig->hasKey( pKey ) )
+- aStyleSettings.SetDeactiveColor2( readColor( pConfig, pKey ) );
++ if ( aGroup.hasKey( pKey ) )
++ aStyleSettings.SetDeactiveColor2( readColor( &aGroup, pKey ) );
+
+ pKey = "inactiveForeground";
+- if ( pConfig->hasKey( pKey ) )
+- aStyleSettings.SetDeactiveTextColor( readColor( pConfig, pKey ) );
++ if ( aGroup.hasKey( pKey ) )
++ aStyleSettings.SetDeactiveTextColor( readColor( &aGroup, pKey ) );
+
+ pKey = "activeForeground";
+- if ( pConfig->hasKey( pKey ) )
+- aStyleSettings.SetActiveTextColor( readColor( pConfig, pKey ) );
++ if ( aGroup.hasKey( pKey ) )
++ aStyleSettings.SetActiveTextColor( readColor( &aGroup, pKey ) );
+
+ pKey = "titleFont";
+- if ( pConfig->hasKey( pKey ) )
++ if ( aGroup.hasKey( pKey ) )
+ {
+- Font aFont = toFont( pConfig->readFontEntry( pKey ), rSettings.GetUILocale() );
++ Font aFont = toFont( aGroup.readEntry( pKey, QFont() ), rSettings.GetUILocale() );
+ aStyleSettings.SetTitleFont( aFont );
+ bSetTitleFont = true;
+ }
+
+- pConfig->setGroup( "Icons" );
++ aGroup = pConfig->group( "Icons" );
+
+ pKey = "Theme";
+- if ( pConfig->hasKey( pKey ) )
+- aStyleSettings.SetPreferredSymbolsStyleName( readEntryUntranslated( pConfig, pKey ) );
++ if ( aGroup.hasKey( pKey ) )
++ aStyleSettings.SetPreferredSymbolsStyleName( readEntryUntranslated( &aGroup, pKey ) );
+ }
+
+ // General settings
+- QColorGroup qColorGroup = kapp->palette().active();
++ QPalette qPalette = kapp->palette();
++
++ Color aFore = toColor( qPalette.color( QPalette::Active, QPalette::WindowText ) );
++ Color aBack = toColor( qPalette.color( QPalette::Active, QPalette::Window ) );
++ Color aText = toColor( qPalette.color( QPalette::Active, QPalette::Text ) );
++ Color aBase = toColor( qPalette.color( QPalette::Active, QPalette::Base ) );
++ Color aButn = toColor( qPalette.color( QPalette::Active, QPalette::ButtonText ) );
++ Color aMid = toColor( qPalette.color( QPalette::Active, QPalette::Mid ) );
++ Color aHigh = toColor( qPalette.color( QPalette::Active, QPalette::Highlight ) );
+
+- Color aFore = toColor( qColorGroup.foreground() );
+- Color aBack = toColor( qColorGroup.background() );
+- Color aText = toColor( qColorGroup.text() );
+- Color aBase = toColor( qColorGroup.base() );
+-
+ // Foreground
+ aStyleSettings.SetRadioCheckTextColor( aFore );
+ aStyleSettings.SetLabelTextColor( aFore );
+@@ -1955,14 +1999,14 @@
+ aStyleSettings.SetWindowColor( aBase );
+
+ // Buttons
+- aStyleSettings.SetButtonTextColor( toColor( qColorGroup.buttonText() ) );
+- aStyleSettings.SetButtonRolloverTextColor( toColor( qColorGroup.buttonText() ) );
++ aStyleSettings.SetButtonTextColor( aButn );
++ aStyleSettings.SetButtonRolloverTextColor( aButn );
+
+ // Disable color
+- aStyleSettings.SetDisableColor( toColor( qColorGroup.mid() ) );
++ aStyleSettings.SetDisableColor( aMid );
+
+ // Workspace
+- aStyleSettings.SetWorkspaceColor( toColor( qColorGroup.mid() ) );
++ aStyleSettings.SetWorkspaceColor( aMid );
+
+ // Background
+ aStyleSettings.Set3DColors( aBack );
+@@ -1981,8 +2025,8 @@
+ }
+
+ // Selection
+- aStyleSettings.SetHighlightColor( toColor( qColorGroup.highlight() ) );
+- aStyleSettings.SetHighlightTextColor( toColor( qColorGroup.highlightedText() ) );
++ aStyleSettings.SetHighlightColor( aHigh );
++ aStyleSettings.SetHighlightTextColor( aHigh );
+
+ // Font
+ Font aFont = toFont( kapp->font(), rSettings.GetUILocale() );
+@@ -2005,7 +2049,6 @@
+ aStyleSettings.SetCursorBlinkTime( flash_time != 0 ? flash_time/2 : STYLE_CURSOR_NOBLINKTIME );
+
+ KMainWindow qMainWindow;
+- qMainWindow.createGUI( "/dev/null" ); // hack
+
+ // Menu
+ aStyleSettings.SetSkipDisabledInMenus( TRUE );
+@@ -2013,41 +2056,41 @@
+ if ( pMenuBar )
+ {
+ // Color
+- QColorGroup qMenuCG = pMenuBar->colorGroup();
++ QPalette qMenuCG = pMenuBar->palette();
+
+ // Menu text and background color, theme specific
+- Color aMenuFore = toColor( qMenuCG.foreground() );
+- Color aMenuBack = toColor( qMenuCG.background() );
+- if ( kapp->style().inherits( "LightStyleV2" ) ||
+- kapp->style().inherits( "LightStyleV3" ) ||
+- ( kapp->style().inherits( "QMotifStyle" ) && !kapp->style().inherits( "QSGIStyle" ) ) ||
+- kapp->style().inherits( "QWindowsStyle" ) )
++ Color aMenuFore = toColor( qMenuCG.color( QPalette::WindowText ) );
++ Color aMenuBack = toColor( qMenuCG.color( QPalette::Window ) );
++ if ( kapp->style()->inherits( "LightStyleV2" ) ||
++ kapp->style()->inherits( "LightStyleV3" ) ||
++ ( kapp->style()->inherits( "QMotifStyle" ) && !kapp->style()->inherits( "QSGIStyle" ) ) ||
++ kapp->style()->inherits( "QWindowsStyle" ) )
+ {
+- aMenuFore = toColor( qMenuCG.buttonText() );
+- aMenuBack = toColor( qMenuCG.button() );
++ aMenuFore = toColor( qMenuCG.color( QPalette::ButtonText ) );
++ aMenuBack = toColor( qMenuCG.color( QPalette::Button ) );
+ }
+
+ aStyleSettings.SetMenuTextColor( aMenuFore );
+ aStyleSettings.SetMenuColor( aMenuBack );
+ aStyleSettings.SetMenuBarColor( aMenuBack );
+
+- aStyleSettings.SetMenuHighlightColor( toColor ( qMenuCG.highlight() ) );
++ aStyleSettings.SetMenuHighlightColor( toColor ( qMenuCG.color( QPalette::Highlight ) ) );
+
+ // Menu items higlight text color, theme specific
+- if ( kapp->style().inherits( "HighContrastStyle" ) ||
+- kapp->style().inherits( "KeramikStyle" ) ||
+- kapp->style().inherits( "QWindowsStyle" ) ||
+- kapp->style().inherits( "ThinKeramikStyle" ) ||
+- kapp->style().inherits( "PlastikStyle" ) )
++ if ( kapp->style()->inherits( "HighContrastStyle" ) ||
++ kapp->style()->inherits( "KeramikStyle" ) ||
++ kapp->style()->inherits( "QWindowsStyle" ) ||
++ kapp->style()->inherits( "ThinKeramikStyle" ) ||
++ kapp->style()->inherits( "PlastikStyle" ) )
+ {
+- aStyleSettings.SetMenuHighlightTextColor( toColor ( qMenuCG.highlightedText() ) );
++ aStyleSettings.SetMenuHighlightTextColor( toColor ( qMenuCG.color( QPalette::HighlightedText ) ) );
+ }
+ else
+ aStyleSettings.SetMenuHighlightTextColor( aMenuFore );
+
+ // set special menubar higlight text color
+- if ( kapp->style().inherits( "HighContrastStyle" ) )
+- ImplGetSVData()->maNWFData.maMenuBarHighlightTextColor = toColor( qMenuCG.highlightedText() );
++ if ( kapp->style()->inherits( "HighContrastStyle" ) )
++ ImplGetSVData()->maNWFData.maMenuBarHighlightTextColor = toColor( qMenuCG.color( QPalette::HighlightedText ) );
+ else
+ ImplGetSVData()->maNWFData.maMenuBarHighlightTextColor = aMenuFore;
+
+@@ -2065,7 +2108,7 @@
+ }
+
+ // Scroll bar size
+- aStyleSettings.SetScrollBarSize( kapp->style().pixelMetric( QStyle::PM_ScrollBarExtent ) );
++ aStyleSettings.SetScrollBarSize( kapp->style()->pixelMetric( QStyle::PM_ScrollBarExtent ) );
+
+ // #i59364# high contrast mode
+ bool bHC = ( aStyleSettings.GetFaceColor().IsDark() ||
+@@ -2132,9 +2175,9 @@
+ // -----------------------------------------------------------------------
+
+ SalFrame *
+-KDESalInstance::CreateFrame( SalFrame *pParent, ULONG nStyle )
++KDESalInstance::CreateFrame( SalFrame *pParent, ULONG nState )
+ {
+- return new KDESalFrame( pParent, nStyle );
++ return new KDESalFrame( pParent, nState );
+ }
+
+ // -----------------------------------------------------------------------
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]