summaryrefslogtreecommitdiffstats
path: root/src/kernel
diff options
context:
space:
mode:
authorTimothy Pearson <kb9vqf@pearsoncomputing.net>2011-10-06 13:29:55 -0500
committerTimothy Pearson <kb9vqf@pearsoncomputing.net>2011-10-06 13:29:55 -0500
commitd71a83ef0d306b8e23b2be5baa3e347116ba8253 (patch)
tree7e97f8f0eaf491f1700e537a9c87b03863e2a8fa /src/kernel
parentb1444fa097ab72348e6b86526d2d7d7ab673529e (diff)
downloadqt3-d71a83ef0d306b8e23b2be5baa3e347116ba8253.tar.gz
qt3-d71a83ef0d306b8e23b2be5baa3e347116ba8253.zip
Apply qtkdeintegration patches to Qt3v3.5.13
This partially resolves Bug #528
Diffstat (limited to 'src/kernel')
-rw-r--r--src/kernel/qt.h4
-rw-r--r--src/kernel/qt_x11.pri3
-rw-r--r--src/kernel/qtkdeintegration_x11.cpp245
-rw-r--r--src/kernel/qtkdeintegration_x11_p.h62
4 files changed, 314 insertions, 0 deletions
diff --git a/src/kernel/qt.h b/src/kernel/qt.h
index 5a77207..2145d8c 100644
--- a/src/kernel/qt.h
+++ b/src/kernel/qt.h
@@ -313,6 +313,10 @@
#endif // Private headers
+#ifdef Q_WS_X11
+#include "private/qtkdeintegration_x11_p.h"
+#endif
+
#ifdef Q_WS_MAC
#include <qaquastyle.h>
#include <qmacstyle_mac.h>
diff --git a/src/kernel/qt_x11.pri b/src/kernel/qt_x11.pri
index 9a751e6..06db685 100644
--- a/src/kernel/qt_x11.pri
+++ b/src/kernel/qt_x11.pri
@@ -10,6 +10,9 @@ unix {
SOURCES += $$KERNEL_CPP/qtaddons_x11.cpp
PRECOMPILED_HEADER = kernel/qt_pch.h
+
+ SOURCES += $$KERNEL_CPP/qtkdeintegration_x11.cpp
+ HEADERS += $$KERNEL_H/qtkdeintegration_x11_p.h
}
nas {
diff --git a/src/kernel/qtkdeintegration_x11.cpp b/src/kernel/qtkdeintegration_x11.cpp
new file mode 100644
index 0000000..a562a76
--- /dev/null
+++ b/src/kernel/qtkdeintegration_x11.cpp
@@ -0,0 +1,245 @@
+/* This file is licensed under the terms of the GPL v2 or v3, as it has been publicly released by
+ OpenSUSE as part of their GPLed Qt library disribution */
+
+#define QT_CLEAN_NAMESPACE
+#include "qtkdeintegration_x11_p.h"
+
+#include <qcolordialog.h>
+#include <qfiledialog.h>
+#include <qfontdialog.h>
+#include <qlibrary.h>
+#include <qregexp.h>
+#include <qmessagebox.h>
+#include <stdlib.h>
+
+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/src/kernel/qtkdeintegration_x11_p.h b/src/kernel/qtkdeintegration_x11_p.h
new file mode 100644
index 0000000..180ec7a
--- /dev/null
+++ b/src/kernel/qtkdeintegration_x11_p.h
@@ -0,0 +1,62 @@
+/* This file is licensed under the terms of the GPL v2 or v3, as it has been publicly released by
+ OpenSUSE as part of their GPLed Qt library disribution */
+
+#ifndef QKDEINTEGRATION_H
+#define QKDEINTEGRATION_H
+
+#include <qstringlist.h>
+
+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