|
|
|
@ -1,7 +1,7 @@
|
|
|
|
|
/* 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 TQt library disribution */
|
|
|
|
|
|
|
|
|
|
#include "tqtkdeintegration_x11_p.h"
|
|
|
|
|
#include "tqttdeintegration_x11_p.h"
|
|
|
|
|
|
|
|
|
|
#include <ntqcolordialog.h>
|
|
|
|
|
#include <ntqfiledialog.h>
|
|
|
|
@ -11,10 +11,10 @@
|
|
|
|
|
#include <ntqmessagebox.h>
|
|
|
|
|
#include <stdlib.h>
|
|
|
|
|
|
|
|
|
|
bool TQKDEIntegration::inited = false;
|
|
|
|
|
bool TQKDEIntegration::enable = false;
|
|
|
|
|
bool TQTDEIntegration::inited = false;
|
|
|
|
|
bool TQTDEIntegration::enable = false;
|
|
|
|
|
|
|
|
|
|
bool TQKDEIntegration::enabled()
|
|
|
|
|
bool TQTDEIntegration::enabled()
|
|
|
|
|
{
|
|
|
|
|
if( !inited )
|
|
|
|
|
initLibrary();
|
|
|
|
@ -23,10 +23,10 @@ bool TQKDEIntegration::enabled()
|
|
|
|
|
|
|
|
|
|
static TQCString findLibrary()
|
|
|
|
|
{
|
|
|
|
|
if( getenv( "TQT_NO_KDE_INTEGRATION" ) == NULL
|
|
|
|
|
|| getenv( "TQT_NO_KDE_INTEGRATION" )[ 0 ] == '0' )
|
|
|
|
|
if( getenv( "TQT_NO_TDE_INTEGRATION" ) == NULL
|
|
|
|
|
|| getenv( "TQT_NO_TDE_INTEGRATION" )[ 0 ] == '0' )
|
|
|
|
|
{
|
|
|
|
|
return TQCString() + tqInstallPathPlugins() + "/integration/libtqtkde";
|
|
|
|
|
return TQCString() + tqInstallPathPlugins() + "/integration/libtqttde";
|
|
|
|
|
}
|
|
|
|
|
return "";
|
|
|
|
|
}
|
|
|
|
@ -42,24 +42,24 @@ inline static TQFont fontPtrToFontRef( const TQFont* f )
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// ---
|
|
|
|
|
static bool (*tqtkde_initializeIntegration)( );
|
|
|
|
|
static TQStringList (*tqtkde_getOpenFileNames)( const TQString& filter, TQString* workingDirectory,
|
|
|
|
|
static bool (*tqttde_initializeIntegration)( );
|
|
|
|
|
static TQStringList (*tqttde_getOpenFileNames)( const TQString& filter, TQString* workingDirectory,
|
|
|
|
|
long parent, const TQCString& name, const TQString& caption, TQString* selectedFilter,
|
|
|
|
|
bool multiple );
|
|
|
|
|
static TQString (*tqtkde_getSaveFileName)( const TQString& initialSelection, const TQString& filter,
|
|
|
|
|
static TQString (*tqttde_getSaveFileName)( const TQString& initialSelection, const TQString& filter,
|
|
|
|
|
TQString* workingDirectory, long parent, const TQCString& name, const TQString& caption,
|
|
|
|
|
TQString* selectedFilter );
|
|
|
|
|
static TQString (*tqtkde_getExistingDirectory)( const TQString& initialDirectory, long parent,
|
|
|
|
|
static TQString (*tqttde_getExistingDirectory)( const TQString& initialDirectory, long parent,
|
|
|
|
|
const TQCString& name, const TQString& caption );
|
|
|
|
|
static TQColor (*tqtkde_getColor)( const TQColor& color, long parent, const TQCString& name );
|
|
|
|
|
static TQFont (*tqtkde_getFont)( bool* ok, const TQFont& def, long parent, const TQCString& name );
|
|
|
|
|
static int (*tqtkde_messageBox1)( int type, long parent, const TQString& caption, const TQString& text,
|
|
|
|
|
static TQColor (*tqttde_getColor)( const TQColor& color, long parent, const TQCString& name );
|
|
|
|
|
static TQFont (*tqttde_getFont)( bool* ok, const TQFont& def, long parent, const TQCString& name );
|
|
|
|
|
static int (*tqttde_messageBox1)( int type, long parent, const TQString& caption, const TQString& text,
|
|
|
|
|
int button0, int button1, int button2 );
|
|
|
|
|
static int (*tqtkde_messageBox2)( int type, long parent, const TQString& caption, const TQString& text,
|
|
|
|
|
static int (*tqttde_messageBox2)( int type, long parent, const TQString& caption, const TQString& text,
|
|
|
|
|
const TQString& button0Text, const TQString& button1Text, const TQString& button2Text,
|
|
|
|
|
int defaultButton, int escapeButton );
|
|
|
|
|
|
|
|
|
|
void TQKDEIntegration::initLibrary()
|
|
|
|
|
void TQTDEIntegration::initLibrary()
|
|
|
|
|
{
|
|
|
|
|
if( !inited )
|
|
|
|
|
{
|
|
|
|
@ -70,171 +70,171 @@ void TQKDEIntegration::initLibrary()
|
|
|
|
|
return;
|
|
|
|
|
TQLibrary lib( libpath );
|
|
|
|
|
lib.setAutoUnload( false );
|
|
|
|
|
tqtkde_initializeIntegration = (
|
|
|
|
|
tqttde_initializeIntegration = (
|
|
|
|
|
bool (*)( )
|
|
|
|
|
)
|
|
|
|
|
lib.resolve("initializeIntegration");
|
|
|
|
|
if( tqtkde_initializeIntegration == NULL )
|
|
|
|
|
if( tqttde_initializeIntegration == NULL )
|
|
|
|
|
return;
|
|
|
|
|
tqtkde_getOpenFileNames = (
|
|
|
|
|
tqttde_getOpenFileNames = (
|
|
|
|
|
TQStringList (*)( const TQString& filter, TQString* workingDirectory, long parent,
|
|
|
|
|
const TQCString& name, const TQString& caption, TQString* selectedFilter,
|
|
|
|
|
bool multiple )
|
|
|
|
|
)
|
|
|
|
|
lib.resolve("getOpenFileNames");
|
|
|
|
|
if( tqtkde_getOpenFileNames == NULL )
|
|
|
|
|
if( tqttde_getOpenFileNames == NULL )
|
|
|
|
|
return;
|
|
|
|
|
tqtkde_getSaveFileName = (
|
|
|
|
|
tqttde_getSaveFileName = (
|
|
|
|
|
TQString (*)( const TQString& initialSelection, const TQString& filter, TQString* workingDirectory,
|
|
|
|
|
long parent, const TQCString& name, const TQString& caption, TQString* selectedFilter )
|
|
|
|
|
)
|
|
|
|
|
lib.resolve("getSaveFileName");
|
|
|
|
|
if( tqtkde_getSaveFileName == NULL )
|
|
|
|
|
if( tqttde_getSaveFileName == NULL )
|
|
|
|
|
return;
|
|
|
|
|
tqtkde_getExistingDirectory = (
|
|
|
|
|
tqttde_getExistingDirectory = (
|
|
|
|
|
TQString (*)( const TQString& initialDirectory, long parent, const TQCString& name,
|
|
|
|
|
const TQString& caption )
|
|
|
|
|
)
|
|
|
|
|
lib.resolve("getExistingDirectory");
|
|
|
|
|
if( tqtkde_getExistingDirectory == NULL )
|
|
|
|
|
if( tqttde_getExistingDirectory == NULL )
|
|
|
|
|
return;
|
|
|
|
|
tqtkde_getColor = (
|
|
|
|
|
tqttde_getColor = (
|
|
|
|
|
TQColor (*)( const TQColor& color, long parent, const TQCString& name )
|
|
|
|
|
)
|
|
|
|
|
lib.resolve("getColor");
|
|
|
|
|
if( tqtkde_getColor == NULL )
|
|
|
|
|
if( tqttde_getColor == NULL )
|
|
|
|
|
return;
|
|
|
|
|
tqtkde_getFont = (
|
|
|
|
|
tqttde_getFont = (
|
|
|
|
|
TQFont (*)( bool* ok, const TQFont& def, long parent, const TQCString& name )
|
|
|
|
|
)
|
|
|
|
|
lib.resolve("getFont");
|
|
|
|
|
if( tqtkde_getFont == NULL )
|
|
|
|
|
if( tqttde_getFont == NULL )
|
|
|
|
|
return;
|
|
|
|
|
tqtkde_messageBox1 = (
|
|
|
|
|
tqttde_messageBox1 = (
|
|
|
|
|
int (*)( int type, long parent, const TQString& caption, const TQString& text,
|
|
|
|
|
int button0, int button1, int button2 )
|
|
|
|
|
)
|
|
|
|
|
lib.resolve("messageBox1");
|
|
|
|
|
if( tqtkde_messageBox1 == NULL )
|
|
|
|
|
if( tqttde_messageBox1 == NULL )
|
|
|
|
|
return;
|
|
|
|
|
tqtkde_messageBox2 = (
|
|
|
|
|
tqttde_messageBox2 = (
|
|
|
|
|
int (*)( int type, long parent, const TQString& caption, const TQString& text,
|
|
|
|
|
const TQString& button0Text, const TQString& button1Text, const TQString& button2Text,
|
|
|
|
|
int defaultButton, int escapeButton )
|
|
|
|
|
)
|
|
|
|
|
lib.resolve("messageBox2");
|
|
|
|
|
if( tqtkde_messageBox2 == NULL )
|
|
|
|
|
if( tqttde_messageBox2 == NULL )
|
|
|
|
|
return;
|
|
|
|
|
enable = tqtkde_initializeIntegration();
|
|
|
|
|
enable = tqttde_initializeIntegration();
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
bool TQKDEIntegration::initializeIntegration( )
|
|
|
|
|
bool TQTDEIntegration::initializeIntegration( )
|
|
|
|
|
{
|
|
|
|
|
return tqtkde_initializeIntegration(
|
|
|
|
|
return tqttde_initializeIntegration(
|
|
|
|
|
);
|
|
|
|
|
}
|
|
|
|
|
TQStringList TQKDEIntegration::getOpenFileNames( const TQString& filter, TQString* workingDirectory,
|
|
|
|
|
TQStringList TQTDEIntegration::getOpenFileNames( const TQString& filter, TQString* workingDirectory,
|
|
|
|
|
TQWidget* parent, const char* name, const TQString& caption, TQString* selectedFilter,
|
|
|
|
|
bool multiple )
|
|
|
|
|
{
|
|
|
|
|
return tqtkde_getOpenFileNames(
|
|
|
|
|
return tqttde_getOpenFileNames(
|
|
|
|
|
filter, workingDirectory, widgetToWinId( parent ), name, caption, selectedFilter, multiple );
|
|
|
|
|
}
|
|
|
|
|
TQString TQKDEIntegration::getSaveFileName( const TQString& initialSelection, const TQString& filter,
|
|
|
|
|
TQString TQTDEIntegration::getSaveFileName( const TQString& initialSelection, const TQString& filter,
|
|
|
|
|
TQString* workingDirectory, TQWidget* parent, const char* name, const TQString& caption,
|
|
|
|
|
TQString* selectedFilter )
|
|
|
|
|
{
|
|
|
|
|
return tqtkde_getSaveFileName(
|
|
|
|
|
return tqttde_getSaveFileName(
|
|
|
|
|
initialSelection, filter, workingDirectory, widgetToWinId( parent ), name, caption, selectedFilter );
|
|
|
|
|
}
|
|
|
|
|
TQString TQKDEIntegration::getExistingDirectory( const TQString& initialDirectory, TQWidget* parent,
|
|
|
|
|
TQString TQTDEIntegration::getExistingDirectory( const TQString& initialDirectory, TQWidget* parent,
|
|
|
|
|
const char* name, const TQString& caption )
|
|
|
|
|
{
|
|
|
|
|
return tqtkde_getExistingDirectory(
|
|
|
|
|
return tqttde_getExistingDirectory(
|
|
|
|
|
initialDirectory, widgetToWinId( parent ), name, caption );
|
|
|
|
|
}
|
|
|
|
|
TQColor TQKDEIntegration::getColor( const TQColor& color, TQWidget* parent, const char* name )
|
|
|
|
|
TQColor TQTDEIntegration::getColor( const TQColor& color, TQWidget* parent, const char* name )
|
|
|
|
|
{
|
|
|
|
|
return tqtkde_getColor(
|
|
|
|
|
return tqttde_getColor(
|
|
|
|
|
color, widgetToWinId( parent ), name );
|
|
|
|
|
}
|
|
|
|
|
TQFont TQKDEIntegration::getFont( bool* ok, const TQFont* def, TQWidget* parent, const char* name )
|
|
|
|
|
TQFont TQTDEIntegration::getFont( bool* ok, const TQFont* def, TQWidget* parent, const char* name )
|
|
|
|
|
{
|
|
|
|
|
return tqtkde_getFont(
|
|
|
|
|
return tqttde_getFont(
|
|
|
|
|
ok, fontPtrToFontRef( def ), widgetToWinId( parent ), name );
|
|
|
|
|
}
|
|
|
|
|
int TQKDEIntegration::messageBox1( int type, TQWidget* parent, const TQString& caption,
|
|
|
|
|
int TQTDEIntegration::messageBox1( int type, TQWidget* parent, const TQString& caption,
|
|
|
|
|
const TQString& text, int button0, int button1, int button2 )
|
|
|
|
|
{
|
|
|
|
|
return tqtkde_messageBox1(
|
|
|
|
|
return tqttde_messageBox1(
|
|
|
|
|
type, widgetToWinId( parent ), caption, text, button0, button1, button2 );
|
|
|
|
|
}
|
|
|
|
|
int TQKDEIntegration::messageBox2( int type, TQWidget* parent, const TQString& caption,
|
|
|
|
|
int TQTDEIntegration::messageBox2( int type, TQWidget* parent, const TQString& caption,
|
|
|
|
|
const TQString& text, const TQString& button0Text, const TQString& button1Text, const TQString& button2Text,
|
|
|
|
|
int defaultButton, int escapeButton )
|
|
|
|
|
{
|
|
|
|
|
return tqtkde_messageBox2(
|
|
|
|
|
return tqttde_messageBox2(
|
|
|
|
|
type, widgetToWinId( parent ), caption, text, button0Text, button1Text, button2Text, defaultButton, escapeButton );
|
|
|
|
|
}
|
|
|
|
|
// ---
|
|
|
|
|
|
|
|
|
|
int TQKDEIntegration::information( TQWidget* parent, const TQString& caption,
|
|
|
|
|
int TQTDEIntegration::information( TQWidget* parent, const TQString& caption,
|
|
|
|
|
const TQString& text, int button0, int button1, int button2 )
|
|
|
|
|
{
|
|
|
|
|
return tqtkde_messageBox1(
|
|
|
|
|
return tqttde_messageBox1(
|
|
|
|
|
TQMessageBox::Information, widgetToWinId( parent ), caption, text, button0, button1, button2 );
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
int TQKDEIntegration::question( TQWidget* parent, const TQString& caption,
|
|
|
|
|
int TQTDEIntegration::question( TQWidget* parent, const TQString& caption,
|
|
|
|
|
const TQString& text, int button0, int button1, int button2 )
|
|
|
|
|
{
|
|
|
|
|
return tqtkde_messageBox1(
|
|
|
|
|
return tqttde_messageBox1(
|
|
|
|
|
TQMessageBox::Question, widgetToWinId( parent ), caption, text, button0, button1, button2 );
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
int TQKDEIntegration::warning( TQWidget* parent, const TQString& caption,
|
|
|
|
|
int TQTDEIntegration::warning( TQWidget* parent, const TQString& caption,
|
|
|
|
|
const TQString& text, int button0, int button1, int button2 )
|
|
|
|
|
{
|
|
|
|
|
return tqtkde_messageBox1(
|
|
|
|
|
return tqttde_messageBox1(
|
|
|
|
|
TQMessageBox::Warning, widgetToWinId( parent ), caption, text, button0, button1, button2 );
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
int TQKDEIntegration::critical( TQWidget* parent, const TQString& caption,
|
|
|
|
|
int TQTDEIntegration::critical( TQWidget* parent, const TQString& caption,
|
|
|
|
|
const TQString& text, int button0, int button1, int button2 )
|
|
|
|
|
{
|
|
|
|
|
return tqtkde_messageBox1(
|
|
|
|
|
return tqttde_messageBox1(
|
|
|
|
|
TQMessageBox::Critical, widgetToWinId( parent ), caption, text, button0, button1, button2 );
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
int TQKDEIntegration::information( TQWidget* parent, const TQString& caption,
|
|
|
|
|
int TQTDEIntegration::information( TQWidget* parent, const TQString& caption,
|
|
|
|
|
const TQString& text, const TQString& button0Text, const TQString& button1Text, const TQString& button2Text,
|
|
|
|
|
int defaultButton, int escapeButton )
|
|
|
|
|
{
|
|
|
|
|
return tqtkde_messageBox2(
|
|
|
|
|
return tqttde_messageBox2(
|
|
|
|
|
TQMessageBox::Information, widgetToWinId( parent ), caption, text, button0Text, button1Text, button2Text, defaultButton, escapeButton );
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
int TQKDEIntegration::question( TQWidget* parent, const TQString& caption,
|
|
|
|
|
int TQTDEIntegration::question( TQWidget* parent, const TQString& caption,
|
|
|
|
|
const TQString& text, const TQString& button0Text, const TQString& button1Text, const TQString& button2Text,
|
|
|
|
|
int defaultButton, int escapeButton )
|
|
|
|
|
{
|
|
|
|
|
return tqtkde_messageBox2(
|
|
|
|
|
return tqttde_messageBox2(
|
|
|
|
|
TQMessageBox::Question, widgetToWinId( parent ), caption, text, button0Text, button1Text, button2Text, defaultButton, escapeButton );
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
int TQKDEIntegration::warning( TQWidget* parent, const TQString& caption,
|
|
|
|
|
int TQTDEIntegration::warning( TQWidget* parent, const TQString& caption,
|
|
|
|
|
const TQString& text, const TQString& button0Text, const TQString& button1Text, const TQString& button2Text,
|
|
|
|
|
int defaultButton, int escapeButton )
|
|
|
|
|
{
|
|
|
|
|
return tqtkde_messageBox2(
|
|
|
|
|
return tqttde_messageBox2(
|
|
|
|
|
TQMessageBox::Warning, widgetToWinId( parent ), caption, text, button0Text, button1Text, button2Text, defaultButton, escapeButton );
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
int TQKDEIntegration::critical( TQWidget* parent, const TQString& caption,
|
|
|
|
|
int TQTDEIntegration::critical( TQWidget* parent, const TQString& caption,
|
|
|
|
|
const TQString& text, const TQString& button0Text, const TQString& button1Text, const TQString& button2Text,
|
|
|
|
|
int defaultButton, int escapeButton )
|
|
|
|
|
{
|
|
|
|
|
return tqtkde_messageBox2(
|
|
|
|
|
return tqttde_messageBox2(
|
|
|
|
|
TQMessageBox::Critical, widgetToWinId( parent ), caption, text, button0Text, button1Text, button2Text, defaultButton, escapeButton );
|
|
|
|
|
}
|