From 7a49d1c3c01e346c9efd56af8f4d418c9d519744 Mon Sep 17 00:00:00 2001 From: Francois Andriot Date: Sun, 21 Oct 2012 19:08:07 +0200 Subject: openSUSE: add QT3 for TDE 3.5.13.1 --- opensuse/core/components.txt | 1 + opensuse/core/genrpm.sh | 1 + opensuse/core/qt3/add_qexport_visibility.patch | 63 ++++ opensuse/core/qt3/qcstring-format-warnings.diff | 15 + opensuse/core/qt3/qt3-3.5.13.1.spec | 366 ++++++++++++++++++++++++ opensuse/core/qt3/qt3-warnings.diff | 13 + opensuse/core/qt3/qt3.spec | 1 + opensuse/core/qt3/qtkdeintegration_x11.cpp | 242 ++++++++++++++++ opensuse/core/qt3/qtkdeintegration_x11_p.h | 59 ++++ 9 files changed, 761 insertions(+) create mode 120000 opensuse/core/components.txt create mode 120000 opensuse/core/genrpm.sh create mode 100644 opensuse/core/qt3/add_qexport_visibility.patch create mode 100644 opensuse/core/qt3/qcstring-format-warnings.diff create mode 100644 opensuse/core/qt3/qt3-3.5.13.1.spec create mode 100644 opensuse/core/qt3/qt3-warnings.diff create mode 100644 opensuse/core/qt3/qtkdeintegration_x11.cpp create mode 100644 opensuse/core/qt3/qtkdeintegration_x11_p.h diff --git a/opensuse/core/components.txt b/opensuse/core/components.txt new file mode 120000 index 000000000..381bc5feb --- /dev/null +++ b/opensuse/core/components.txt @@ -0,0 +1 @@ +../../redhat/components.txt \ No newline at end of file diff --git a/opensuse/core/genrpm.sh b/opensuse/core/genrpm.sh new file mode 120000 index 000000000..b500dc307 --- /dev/null +++ b/opensuse/core/genrpm.sh @@ -0,0 +1 @@ +../../redhat/genrpm.sh \ No newline at end of file diff --git a/opensuse/core/qt3/add_qexport_visibility.patch b/opensuse/core/qt3/add_qexport_visibility.patch new file mode 100644 index 000000000..da256192c --- /dev/null +++ b/opensuse/core/qt3/add_qexport_visibility.patch @@ -0,0 +1,63 @@ +Index: src/kernel/qgplugin.h +================================================================================ +--- src/kernel/qgplugin.h ++++ src/kernel/qgplugin.h +@@ -90,35 +90,19 @@ + return i->iface(); \ + } + +-# ifdef Q_WS_WIN +-# ifdef Q_CC_BOR +-# define Q_EXPORT_PLUGIN(PLUGIN) \ +- Q_PLUGIN_VERIFICATION_DATA \ +- Q_EXTERN_C __declspec(dllexport) \ +- const char * __stdcall qt_ucm_query_verification_data() \ +- { return qt_ucm_verification_data; } \ +- Q_EXTERN_C __declspec(dllexport) QUnknownInterface* \ +- __stdcall ucm_instantiate() \ +- Q_PLUGIN_INSTANTIATE( PLUGIN ) +-# else +-# define Q_EXPORT_PLUGIN(PLUGIN) \ +- Q_PLUGIN_VERIFICATION_DATA \ +- Q_EXTERN_C __declspec(dllexport) \ +- const char *qt_ucm_query_verification_data() \ +- { return qt_ucm_verification_data; } \ +- Q_EXTERN_C __declspec(dllexport) QUnknownInterface* ucm_instantiate() \ +- Q_PLUGIN_INSTANTIATE( PLUGIN ) +-# endif +-# else +-# define Q_EXPORT_PLUGIN(PLUGIN) \ ++#if defined(Q_WS_WIN) && defined(Q_CC_BOR) ++# define Q_STDCALL __stdcall ++#else ++# define Q_STDCALL ++#endif ++ ++#define Q_EXPORT_PLUGIN(PLUGIN) \ + Q_PLUGIN_VERIFICATION_DATA \ +- Q_EXTERN_C \ +- const char *qt_ucm_query_verification_data() \ ++ Q_EXTERN_C Q_EXPORT \ ++ const char * Q_STDCALL qt_ucm_query_verification_data() \ + { return qt_ucm_verification_data; } \ +- Q_EXTERN_C QUnknownInterface* ucm_instantiate() \ ++ Q_EXTERN_C Q_EXPORT QUnknownInterface* Q_STDCALL ucm_instantiate() \ + Q_PLUGIN_INSTANTIATE( PLUGIN ) +-# endif +- + #endif + + struct QUnknownInterface; +--- src/tools/qglobal.h ++++ src/tools/qglobal.h +@@ -882,6 +882,10 @@ + # define Q_TEMPLATE_EXTERN + # undef Q_DISABLE_COPY /* avoid unresolved externals */ + # endif ++#elif defined(Q_CC_GNU) && __GNUC__ - 0 >= 4 ++# define Q_EXPORT __attribute__((visibility("default"))) ++# undef QT_MAKEDLL /* ignore these for other platforms */ ++# undef QT_DLL + #else + # undef QT_MAKEDLL /* ignore these for other platforms */ + # undef QT_DLL diff --git a/opensuse/core/qt3/qcstring-format-warnings.diff b/opensuse/core/qt3/qcstring-format-warnings.diff new file mode 100644 index 000000000..a597dc578 --- /dev/null +++ b/opensuse/core/qt3/qcstring-format-warnings.diff @@ -0,0 +1,15 @@ +--- src/tools/qcstring.h (revision 658213) ++++ src/tools/qcstring.h (working copy) +@@ -161,7 +161,11 @@ public: + + QCString copy() const; + +- QCString &sprintf( const char *format, ... ); ++ QCString &sprintf( const char *format, ... ) ++#if defined(Q_CC_GNU) && !defined(__INSURE__) ++ __attribute__ ((format (printf, 2, 3))) ++#endif ++ ; + + int find( char c, int index=0, bool cs=TRUE ) const; + int find( const char *str, int index=0, bool cs=TRUE ) const; diff --git a/opensuse/core/qt3/qt3-3.5.13.1.spec b/opensuse/core/qt3/qt3-3.5.13.1.spec new file mode 100644 index 000000000..2ee312a65 --- /dev/null +++ b/opensuse/core/qt3/qt3-3.5.13.1.spec @@ -0,0 +1,366 @@ +# +# spec file for package qt3 +# +# Copyright (c) 2012 SUSE LINUX Products GmbH, Nuernberg, Germany. +# +# All modifications and additions to the file contributed by third parties +# remain the property of their copyright owners, unless otherwise agreed +# upon. The license for this file, and modifications and additions to the +# file, is the same license as for the pristine package itself (unless the +# license for the pristine package is not an Open Source License, in which +# case the license is the MIT License). An "Open Source License" is a +# license that conforms to the Open Source Definition (Version 1.9) +# published by the Open Source Initiative. + +# Please submit bugfixes or comments via http://bugs.opensuse.org/ +# + + +Name: qt3 +#Remember also to modify Requires in -devel package +BuildRequires: Mesa-devel +BuildRequires: c++_compiler +BuildRequires: cups-devel +BuildRequires: freetype2-devel +BuildRequires: libjpeg-devel +BuildRequires: libmng-devel +BuildRequires: pkgconfig +BuildRequires: update-desktop-files +BuildRequires: xorg-x11-devel +BuildRequires: tar +Url: http://www.trolltech.com/ +%if %suse_version > 1220 +BuildRequires: libpng15-compat-devel +%else +BuildRequires: libpng14-compat-devel +%endif +# bug437293 +%ifarch ppc64 +Obsoletes: qt3-64bit +%endif +# +Summary: A library for developing applications with graphical user interfaces +License: GPL-2.0 or GPL-3.0 or QPL-1.0 +Group: System/Libraries +Version: 3.3.8d +Release: 1 +Provides: qt_library_%version +Recommends: kdelibs3-default-style +PreReq: /bin/grep +# COMMON-BEGIN +%define x11_free -x11-free- +%define rversion 3.3.8b +Source0: qt3-3.5.13.1.tar.gz +Source1: build_script.sh +Source2: qtconfig3.desktop +Source3: qtrc +Source4: assistant3.png +Source6: assistant3.desktop +Source7: designer.desktop +Source8: designer.png +Source9: linguist.desktop +Source5: linguist.png +Source10: qt3.sh +Source11: qt3.csh +# Translations did not change at 3.3.8c +Source12: qt3-3.3.8b-translations.tar.bz2 +Source100: qtkdeintegration_x11.cpp +Source101: qtkdeintegration_x11_p.h +Source102: baselibs.conf +Source200: attributes +Source201: update_spec.pl +Patch1: aliasing.diff +Patch2: head.diff +Patch4: qt3-never-strip.diff +Patch5: external-libs.diff +Patch12: qtrc-path.diff +Patch14: lib64-plugin-support.diff +Patch15: pluginmanager-fix.diff +Patch18: no-rpath.dif +Patch19: shut-up.diff +Patch23: fix-accessible.diff +# From http://www.freedesktop.org/wiki/Software_2fImmoduleQtDownload +# Current version from http://freedesktop.org/~daisuke/qt-x11-immodule-unified-qt3.3.5-20060318.diff.bz2 +Patch31: limit-image-size.diff +Patch35: qt-transparency.patch +Patch37: 0055-qtextedit_zoom.patch +Patch39: fix-qtranslator-crash.diff +Patch42: add_qexport_visibility.patch +Patch54: kmenu-search-fix.diff +Patch113: fix-assistant-path.patch +Patch117: qtimer-debug.diff +Patch121: qt3-warnings.diff +Patch125: qcstring-format-warnings.diff +Patch127: mng-reading-fix.patch +Patch134: fix-xinput-clash.diff +Patch135: parseFontName.diff +Patch136: qt3-no-date.diff +Patch139: gcc46.diff + +BuildRoot: %{_tmppath}/%{name}-%{version}-build + +%description +Qt is a program library for developing applications with graphical user +interfaces. It allows you to rapidly develop professional programs. The +Qt library is available not only for Linux but for a great number of +Unices and even for Windows. Thus it is possible to write programs that +may be easily ported to those platforms. + +You need a license for using Qt with a non-GPL application, which can +be acquired from sales@trolltech.com. + +See /usr/share/doc/packages/qt3 for details about the new features of +the current Qt library! + +%define build_sub_dirs src plugins/src tools/designer/uilib/ tools/designer/uic tools/qtconfig tools/assistant/lib tools/assistant tutorial + +%prep +%setup -q -n qt3-3.5.13.1 +%patch1 +%patch2 +%patch4 +%patch5 +%patch12 +if [ "%_lib" = "lib64" ]; then +%patch14 +fi +%patch15 +%patch18 +%patch19 +%patch23 +%patch31 +%patch35 +%patch37 +%patch39 +%patch42 +%patch54 +%patch113 +%patch117 +%patch121 +ln -sf $PWD/src/inputmethod/qinputcontextfactory.h include/ +ln -sf $PWD/src/inputmethod/qinputcontextplugin.h include/ +ln -sf $PWD/src/kernel/qinputcontext.h include/ +ln -sf $PWD/src/kernel/qinputcontextinterface_p.h include/private/ +ln -sf $PWD/src/kernel/qximinputcontext_p.h include/private/ +%patch125 +%patch127 +%patch134 +%patch135 +%patch136 +%patch139 +# copy qt kde integration files +cp %SOURCE100 %SOURCE101 src/kernel/ +cp %SOURCE101 include/private/ +cd translations +tar xvjf %SOURCE12 +cd .. +# COMMON-END + +%package devel +Summary: Include Files and Libraries mandatory for Development +Group: Development/Libraries/X11 +Requires: c++_compiler +Requires: cups-devel +Requires: freetype2-devel +Requires: libjpeg-devel +Requires: libmng-devel +Requires: pkgconfig +Requires: qt3 = %version +Requires: xorg-x11-devel +%if %suse_version > 1120 +Recommends: libpng14-compat-devel +Requires: libpng-devel +%else +Requires: libpng-devel +%endif +%if %suse_version > 1000 +Requires: Mesa-devel +%else +Requires: xorg-x11-Mesa +Requires: xorg-x11-Mesa-devel +%endif +%ifnarch x86_64 s390x sparc64 ppc64 mips64 +Conflicts: devel_libs-32bit +%endif +# bug437293 +%ifarch ppc64 +Obsoletes: qt3-devel-64bit +%endif +# + +%description devel +You need this package if you want to compile programs with Qt 3. It +contains the "Qt Crossplatform Development Kit 2". Under /usr/lib/qt3 +you will find include files. + +You need a license for using Qt with a non-GPL application. A license +can be acquired at sales@trolltech.com. + +%build +export VERSION=%suse_version +source %SOURCE1 %{version} +export WLIB=%_lib +export QTDIR=`pwd` +if [ %_lib == "lib64" ]; then +export RPM_OPT_FLAGS="$RPM_OPT_FLAGS -DUSE_LIB64_PATHES" +fi +export RPM_OPT_FLAGS="$RPM_OPT_FLAGS -fno-strict-aliasing" +# +# call build from build_script.rpmrc for threaded Qt library +# only really needed tools will be builded here, all extra tools will be +# builded in qt3.spec +# +call_configure -v -thread -shared -no-sql-mysql -no-sql-psql -no-sql-odbc -no-sql-sqlite $OPTIONS +for i in %build_sub_dirs ; do + cd $i + make %{?jobs:-j%jobs} + cd - +done + +%install +export VERSION=%suse_version +export WLIB=%_lib +export QTDIR=`pwd` +source %SOURCE1 %{version} +for i in %build_sub_dirs ; do + cd $i + make INSTALL_ROOT=$RPM_BUILD_ROOT install + cd - +done +post_install $RPM_BUILD_ROOT/usr/lib/qt3/ +mkdir -p $RPM_BUILD_ROOT/usr/share/pixmaps/ +sed -i -e 's, on: .*,,' $RPM_BUILD_ROOT/usr/lib/qt3/%_lib/*.la +# +# copy additional files +# +install -m 0755 bin/qmake bin/moc ${RPM_BUILD_ROOT}/usr/lib/qt3/bin/ +install -m 0755 -d ${RPM_BUILD_ROOT}/usr/lib/qt3/translations/ +install -m 0644 translations/*.qm ${RPM_BUILD_ROOT}/usr/lib/qt3/translations/ +if [ %_lib = lib64 ]; then + for i in $RPM_BUILD_ROOT/usr/lib/qt3/plugins/*/*.so; do + mv "$i" "${i%.so}.lib64.so" + done +fi +# +# move pkgconfig files +# +mkdir -p $RPM_BUILD_ROOT/%_libdir/pkgconfig +mv $RPM_BUILD_ROOT/usr/lib/qt3/%_lib/pkgconfig/*.pc \ + $RPM_BUILD_ROOT/%_libdir/pkgconfig +rmdir $RPM_BUILD_ROOT/usr/lib/qt3/%_lib/pkgconfig +# +# move docs in doc dir +# +install -d -m 0755 ${RPM_BUILD_ROOT}/%{_defaultdocdir}/qt3/ +install -d -m 0755 ${RPM_BUILD_ROOT}/usr/lib/qt3/mkspecs/ +install -d -m 0755 ${RPM_BUILD_ROOT}/usr/lib/qt3/mkspecs/ +cp -a mkspecs/* ${RPM_BUILD_ROOT}/usr/lib/qt3/mkspecs/ +if [ %_lib == "lib64" ]; then + ln -sf linux-g++-64 ${RPM_BUILD_ROOT}/usr/lib/qt3/mkspecs/default +else + ln -sf linux-g++ ${RPM_BUILD_ROOT}/usr/lib/qt3/mkspecs/default +fi +find ${RPM_BUILD_ROOT}/usr/lib/qt3/mkspecs -type f -perm /111 -print0 | xargs -0 chmod a-x +# +# create links in ld.so.conf path +# +install -d -m 0755 ${RPM_BUILD_ROOT}/%{_libdir} +ln -sf ../lib/qt3/%{_lib}/libqt-mt.so.3 ${RPM_BUILD_ROOT}/%{_libdir}/libqt-mt.so.3 +ln -sf ../lib/qt3/%{_lib}/libqui.so.1 ${RPM_BUILD_ROOT}/%{_libdir}/libqui.so.1 +[ "lib" != "%{_lib}" ] && \ + ln -sf ../lib/qt3 ${RPM_BUILD_ROOT}/%{_libdir}/qt3 +mkdir -p ${RPM_BUILD_ROOT}/etc/profile.d +install -m 644 %SOURCE10 %SOURCE11 ${RPM_BUILD_ROOT}/etc/profile.d +# +# default qt settings +# +mkdir -p ${RPM_BUILD_ROOT}/etc/X11 +mkdir -p ${RPM_BUILD_ROOT}/usr/lib/qt3/etc/ +ln -sf /etc/X11/ ${RPM_BUILD_ROOT}/usr/lib/qt3/etc/settings +install -m 0644 %SOURCE3 ${RPM_BUILD_ROOT}/etc/X11/qtrc +# +# clean broken links +# +if [ %_lib == "lib64" ]; then + rm ${RPM_BUILD_ROOT}/usr/lib/qt3/mkspecs/linux-g++-64/linux-g++-64 +else + rm ${RPM_BUILD_ROOT}/usr/lib/qt3/mkspecs/linux-g++/linux-g++ +fi +rm -rf ${RPM_BUILD_ROOT}/usr/lib/qt3/doc/html + +%pre +if test -L usr/lib/qt3; then + rm usr/lib/qt3 +fi + +%post +/sbin/ldconfig +if ! grep -q '^\[3.3\]' etc/X11/qtrc ; then +echo "" >> etc/X11/qtrc +echo "[3.3]" >> etc/X11/qtrc +echo "libraryPath=/opt/kde3/lib64/kde3/plugins/:/opt/kde3/lib/kde3/plugins/" >> etc/X11/qtrc +fi + +%postun -p /sbin/ldconfig + +%files +%defattr(-,root,root,755) +# FIXME provide new changelog if kb9vqf will give one +%doc changes-3.3.8b README* LICENSE* MANIFEST FAQ +%dir /usr/lib/qt3/translations +%dir /usr/lib/qt3 +%dir /usr/lib/qt3/bin +%dir /usr/lib/qt3/%{_lib} +%{_libdir}/libqt-mt.so.* +%{_libdir}/libqui.so.* +/usr/lib/qt3/bin/qtconfig +/usr/lib/qt3/%{_lib}/libqt-mt.so.* +/usr/lib/qt3/%{_lib}/libqui.so.* +%dir /usr/lib/qt3/etc +/usr/lib/qt3/etc/settings +/usr/lib/qt3/plugins +/usr/lib/qt3/bin/assistant +%lang(de) /usr/lib/qt3/translations/assistant_de.qm +%lang(ar) /usr/lib/qt3/translations/qt_ar.qm +%lang(ca) /usr/lib/qt3/translations/qt_ca.qm +%lang(cs) /usr/lib/qt3/translations/qt_cs.qm +%lang(de) /usr/lib/qt3/translations/qt_de.qm +%lang(es) /usr/lib/qt3/translations/qt_es.qm +%lang(fr) /usr/lib/qt3/translations/qt_fr.qm +%lang(he) /usr/lib/qt3/translations/qt_he.qm +%lang(ru) /usr/lib/qt3/translations/qt_ru.qm +%lang(sk) /usr/lib/qt3/translations/qt_sk.qm +%lang(it) /usr/lib/qt3/translations/qt_it.qm +%lang(ja) /usr/lib/qt3/translations/qt_ja.qm +%lang(nb) /usr/lib/qt3/translations/qt_nb.qm +%lang(pl) /usr/lib/qt3/translations/qt_pl.qm +%lang(pt) /usr/lib/qt3/translations/qt_pt-br.qm +%lang(pt) /usr/lib/qt3/translations/qt_pt.qm +%lang(zh) /usr/lib/qt3/translations/qt_zh-cn.qm +%lang(zh) /usr/lib/qt3/translations/qt_zh-tw.qm +%config(noreplace) /etc/X11/qtrc +%ifarch s390x sparc64 x86_64 ppc64 mips64 +%dir %{_libdir}/qt3 +%endif + +%files devel +%defattr(-,root,root,755) +# FIXME provide new changelog if kb9vqf will give one +%doc changes-3.3.8b +/usr/lib/qt3/bin/moc +/usr/lib/qt3/bin/qmake +/usr/lib/qt3/bin/uic +/usr/lib/qt3/include +/usr/lib/qt3/%{_lib}/libqt-mt.la +/usr/lib/qt3/%{_lib}/libqt-mt.so +/usr/lib/qt3/%{_lib}/libqt-mt.prl +/usr/lib/qt3/%{_lib}/libqui.so +/usr/lib/qt3/%{_lib}/libqui.prl +/usr/lib/qt3/mkspecs +/%_libdir/pkgconfig/qt-mt.pc +/usr/lib/qt3/%_lib/libqassistantclient.* +%config /etc/profile.d/qt3.* + +%changelog +* Sat Sep 29 2012 Francois Andriot - 3.3.8.d-1 +- Initial build for TDE 3.5.13.1 diff --git a/opensuse/core/qt3/qt3-warnings.diff b/opensuse/core/qt3/qt3-warnings.diff new file mode 100644 index 000000000..870017ded --- /dev/null +++ b/opensuse/core/qt3/qt3-warnings.diff @@ -0,0 +1,13 @@ +Index: src/kernel/qimage.h +=================================================================== +--- src/kernel/qimage.h (revision 594273) ++++ src/kernel/qimage.h (working copy) +@@ -55,7 +55,7 @@ public: + QCString lang; + + bool operator< (const QImageTextKeyLang& other) const +- { return key < other.key || key==other.key && lang < other.lang; } ++ { return key < other.key || (key==other.key && lang < other.lang); } + bool operator== (const QImageTextKeyLang& other) const + { return key==other.key && lang==other.lang; } + }; diff --git a/opensuse/core/qt3/qt3.spec b/opensuse/core/qt3/qt3.spec index 20fd10140..51a0d1acc 100644 --- a/opensuse/core/qt3/qt3.spec +++ b/opensuse/core/qt3/qt3.spec @@ -169,6 +169,7 @@ you will find include files. You need a license for using Qt with a non-GPL application. A license can be acquired at sales@trolltech.com. + %build export VERSION=%suse_version source %SOURCE1 %{version} diff --git a/opensuse/core/qt3/qtkdeintegration_x11.cpp b/opensuse/core/qt3/qtkdeintegration_x11.cpp new file mode 100644 index 000000000..8f837b412 --- /dev/null +++ b/opensuse/core/qt3/qtkdeintegration_x11.cpp @@ -0,0 +1,242 @@ +#define QT_CLEAN_NAMESPACE +#include "qtkdeintegration_x11_p.h" + +#include +#include +#include +#include +#include +#include +#include + +bool QKDEIntegration::inited = false; +bool QKDEIntegration::enable = false; + +bool QKDEIntegration::enabled() + { + if( !inited ) + initLibrary(); + return enable; + } + +static QCString findLibrary() + { + if( getenv( "QT_NO_KDE_INTEGRATION" ) == NULL + || getenv( "QT_NO_KDE_INTEGRATION" )[ 0 ] == '0' ) + { +#ifdef USE_LIB64_PATHES + return "/opt/kde3/lib64/kde3/plugins/integration/libqtkde"; +#else + return "/opt/kde3/lib/kde3/plugins/integration/libqtkde"; +#endif + } + return ""; + } + +inline static long widgetToWinId( const QWidget* w ) + { + return w != NULL ? w->winId() : 0; + } + +inline static QFont fontPtrToFontRef( const QFont* f ) + { + return f != NULL ? *f : QFont(); + } + +// --- +static bool (*qtkde_initializeIntegration)( ); +static QStringList (*qtkde_getOpenFileNames)( const QString& filter, QString* workingDirectory, + long parent, const QCString& name, const QString& caption, QString* selectedFilter, + bool multiple ); +static QString (*qtkde_getSaveFileName)( const QString& initialSelection, const QString& filter, + QString* workingDirectory, long parent, const QCString& name, const QString& caption, + QString* selectedFilter ); +static QString (*qtkde_getExistingDirectory)( const QString& initialDirectory, long parent, + const QCString& name, const QString& caption ); +static QColor (*qtkde_getColor)( const QColor& color, long parent, const QCString& name ); +static QFont (*qtkde_getFont)( bool* ok, const QFont& def, long parent, const QCString& name ); +static int (*qtkde_messageBox1)( int type, long parent, const QString& caption, const QString& text, + int button0, int button1, int button2 ); +static int (*qtkde_messageBox2)( int type, long parent, const QString& caption, const QString& text, + const QString& button0Text, const QString& button1Text, const QString& button2Text, + int defaultButton, int escapeButton ); + +void QKDEIntegration::initLibrary() + { + if( !inited ) + { + enable = false; + inited = true; + QString libpath = findLibrary(); + if( libpath.isEmpty()) + return; + QLibrary lib( libpath ); + lib.setAutoUnload( false ); + qtkde_initializeIntegration = ( + bool (*)( ) + ) + lib.resolve("initializeIntegration"); + if( qtkde_initializeIntegration == NULL ) + return; + qtkde_getOpenFileNames = ( + QStringList (*)( const QString& filter, QString* workingDirectory, long parent, + const QCString& name, const QString& caption, QString* selectedFilter, + bool multiple ) + ) + lib.resolve("getOpenFileNames"); + if( qtkde_getOpenFileNames == NULL ) + return; + qtkde_getSaveFileName = ( + QString (*)( const QString& initialSelection, const QString& filter, QString* workingDirectory, + long parent, const QCString& name, const QString& caption, QString* selectedFilter ) + ) + lib.resolve("getSaveFileName"); + if( qtkde_getSaveFileName == NULL ) + return; + qtkde_getExistingDirectory = ( + QString (*)( const QString& initialDirectory, long parent, const QCString& name, + const QString& caption ) + ) + lib.resolve("getExistingDirectory"); + if( qtkde_getExistingDirectory == NULL ) + return; + qtkde_getColor = ( + QColor (*)( const QColor& color, long parent, const QCString& name ) + ) + lib.resolve("getColor"); + if( qtkde_getColor == NULL ) + return; + qtkde_getFont = ( + QFont (*)( bool* ok, const QFont& def, long parent, const QCString& name ) + ) + lib.resolve("getFont"); + if( qtkde_getFont == NULL ) + return; + qtkde_messageBox1 = ( + int (*)( int type, long parent, const QString& caption, const QString& text, + int button0, int button1, int button2 ) + ) + lib.resolve("messageBox1"); + if( qtkde_messageBox1 == NULL ) + return; + qtkde_messageBox2 = ( + int (*)( int type, long parent, const QString& caption, const QString& text, + const QString& button0Text, const QString& button1Text, const QString& button2Text, + int defaultButton, int escapeButton ) + ) + lib.resolve("messageBox2"); + if( qtkde_messageBox2 == NULL ) + return; + enable = qtkde_initializeIntegration(); + } + } + +bool QKDEIntegration::initializeIntegration( ) + { + return qtkde_initializeIntegration( + ); + } +QStringList QKDEIntegration::getOpenFileNames( const QString& filter, QString* workingDirectory, + QWidget* parent, const char* name, const QString& caption, QString* selectedFilter, + bool multiple ) + { + return qtkde_getOpenFileNames( + filter, workingDirectory, widgetToWinId( parent ), name, caption, selectedFilter, multiple ); + } +QString QKDEIntegration::getSaveFileName( const QString& initialSelection, const QString& filter, + QString* workingDirectory, QWidget* parent, const char* name, const QString& caption, + QString* selectedFilter ) + { + return qtkde_getSaveFileName( + initialSelection, filter, workingDirectory, widgetToWinId( parent ), name, caption, selectedFilter ); + } +QString QKDEIntegration::getExistingDirectory( const QString& initialDirectory, QWidget* parent, + const char* name, const QString& caption ) + { + return qtkde_getExistingDirectory( + initialDirectory, widgetToWinId( parent ), name, caption ); + } +QColor QKDEIntegration::getColor( const QColor& color, QWidget* parent, const char* name ) + { + return qtkde_getColor( + color, widgetToWinId( parent ), name ); + } +QFont QKDEIntegration::getFont( bool* ok, const QFont* def, QWidget* parent, const char* name ) + { + return qtkde_getFont( + ok, fontPtrToFontRef( def ), widgetToWinId( parent ), name ); + } +int QKDEIntegration::messageBox1( int type, QWidget* parent, const QString& caption, + const QString& text, int button0, int button1, int button2 ) + { + return qtkde_messageBox1( + type, widgetToWinId( parent ), caption, text, button0, button1, button2 ); + } +int QKDEIntegration::messageBox2( int type, QWidget* parent, const QString& caption, + const QString& text, const QString& button0Text, const QString& button1Text, const QString& button2Text, + int defaultButton, int escapeButton ) + { + return qtkde_messageBox2( + type, widgetToWinId( parent ), caption, text, button0Text, button1Text, button2Text, defaultButton, escapeButton ); + } +// --- + +int QKDEIntegration::information( QWidget* parent, const QString& caption, + const QString& text, int button0, int button1, int button2 ) + { + return qtkde_messageBox1( + QMessageBox::Information, widgetToWinId( parent ), caption, text, button0, button1, button2 ); + } + +int QKDEIntegration::question( QWidget* parent, const QString& caption, + const QString& text, int button0, int button1, int button2 ) + { + return qtkde_messageBox1( + QMessageBox::Question, widgetToWinId( parent ), caption, text, button0, button1, button2 ); + } + +int QKDEIntegration::warning( QWidget* parent, const QString& caption, + const QString& text, int button0, int button1, int button2 ) + { + return qtkde_messageBox1( + QMessageBox::Warning, widgetToWinId( parent ), caption, text, button0, button1, button2 ); + } + +int QKDEIntegration::critical( QWidget* parent, const QString& caption, + const QString& text, int button0, int button1, int button2 ) + { + return qtkde_messageBox1( + QMessageBox::Critical, widgetToWinId( parent ), caption, text, button0, button1, button2 ); + } + +int QKDEIntegration::information( QWidget* parent, const QString& caption, + const QString& text, const QString& button0Text, const QString& button1Text, const QString& button2Text, + int defaultButton, int escapeButton ) + { + return qtkde_messageBox2( + QMessageBox::Information, widgetToWinId( parent ), caption, text, button0Text, button1Text, button2Text, defaultButton, escapeButton ); + } + +int QKDEIntegration::question( QWidget* parent, const QString& caption, + const QString& text, const QString& button0Text, const QString& button1Text, const QString& button2Text, + int defaultButton, int escapeButton ) + { + return qtkde_messageBox2( + QMessageBox::Question, widgetToWinId( parent ), caption, text, button0Text, button1Text, button2Text, defaultButton, escapeButton ); + } + +int QKDEIntegration::warning( QWidget* parent, const QString& caption, + const QString& text, const QString& button0Text, const QString& button1Text, const QString& button2Text, + int defaultButton, int escapeButton ) + { + return qtkde_messageBox2( + QMessageBox::Warning, widgetToWinId( parent ), caption, text, button0Text, button1Text, button2Text, defaultButton, escapeButton ); + } + +int QKDEIntegration::critical( QWidget* parent, const QString& caption, + const QString& text, const QString& button0Text, const QString& button1Text, const QString& button2Text, + int defaultButton, int escapeButton ) + { + return qtkde_messageBox2( + QMessageBox::Critical, widgetToWinId( parent ), caption, text, button0Text, button1Text, button2Text, defaultButton, escapeButton ); + } diff --git a/opensuse/core/qt3/qtkdeintegration_x11_p.h b/opensuse/core/qt3/qtkdeintegration_x11_p.h new file mode 100644 index 000000000..9c1676ddb --- /dev/null +++ b/opensuse/core/qt3/qtkdeintegration_x11_p.h @@ -0,0 +1,59 @@ +#ifndef QKDEINTEGRATION_H +#define QKDEINTEGRATION_H + +#include + +class QLibrary; +class QWidget; +class QColor; +class QFont; + +class QKDEIntegration + { + public: + static bool enabled(); +// --- + static bool initializeIntegration( ); + static QStringList getOpenFileNames( const QString& filter, QString* workingDirectory, + QWidget* parent, const char* name, const QString& caption, QString* selectedFilter, + bool multiple ); + static QString getSaveFileName( const QString& initialSelection, const QString& filter, + QString* workingDirectory, QWidget* parent, const char* name, const QString& caption, + QString* selectedFilter ); + static QString getExistingDirectory( const QString& initialDirectory, QWidget* parent, + const char* name, const QString& caption ); + static QColor getColor( const QColor& color, QWidget* parent, const char* name ); + static QFont getFont( bool* ok, const QFont* def, QWidget* parent, const char* name ); + static int messageBox1( int type, QWidget* parent, const QString& caption, + const QString& text, int button0, int button1, int button2 ); + static int information( QWidget* parent, const QString& caption, const QString& text, + int button0, int button1, int button2 ); + static int question( QWidget* parent, const QString& caption, const QString& text, + int button0, int button1, int button2 ); + static int warning( QWidget* parent, const QString& caption, const QString& text, + int button0, int button1, int button2 ); + static int critical( QWidget* parent, const QString& caption, const QString& text, + int button0, int button1, int button2 ); + static int messageBox2( int type, QWidget* parent, const QString& caption, + const QString& text, const QString& button0Text, const QString& button1Text, + const QString& button2Text, int defaultButton, int escapeButton ); + static int information( QWidget* parent, const QString& caption, const QString& text, + const QString& button0Text, const QString& button1Text, const QString& button2Text, + int defaultButton, int escapeButton ); + static int question( QWidget* parent, const QString& caption, const QString& text, + const QString& button0Text, const QString& button1Text, const QString& button2Text, + int defaultButton, int escapeButton ); + static int warning( QWidget* parent, const QString& caption, const QString& text, + const QString& button0Text, const QString& button1Text, const QString& button2Text, + int defaultButton, int escapeButton ); + static int critical( QWidget* parent, const QString& caption, const QString& text, + const QString& button0Text, const QString& button1Text, const QString& button2Text, + int defaultButton, int escapeButton ); +// --- + private: + static void initLibrary(); + static bool inited; + static bool enable; + }; + +#endif -- cgit v1.2.1