Fix TDE VCL interface

Change-Id: Ifd28ab758ba8be89a57c152d3fb9d361715bb33f
This commit is contained in:
Timothy Pearson 2012-08-20 12:40:33 +01:00 committed by Caolán McNamara
parent 5eac894184
commit af4ca5a8c6
5 changed files with 101 additions and 33 deletions

View file

@ -189,10 +189,7 @@ static SalInstance* autodetect_plugin()
else if ( desktop == DESKTOP_GNOME )
pList = pStandardFallbackList;
else if( desktop == DESKTOP_TDE )
{
pList = pTDEFallbackList;
nListEntry = 1;
}
else if( desktop == DESKTOP_KDE )
{
pList = pKDEFallbackList;

View file

@ -81,7 +81,11 @@ namespace
uno::Sequence<rtl::OUString> aRet(3);
aRet[0] = rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("com.sun.star.ui.dialogs.FilePicker"));
aRet[1] = rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("com.sun.star.ui.dialogs.SystemFilePicker"));
#ifdef ENABLE_TDE
aRet[2] = rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("com.sun.star.ui.dialogs.TDEFilePicker"));
#else // ENABLE_TDE
aRet[2] = rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("com.sun.star.ui.dialogs.KDEFilePicker"));
#endif // ENABLE_TDE
return aRet;
}
}
@ -717,7 +721,11 @@ void UnxFilePicker::initFilePicker()
#endif
// The executable name
#ifdef ENABLE_TDE
rtl::OUString helperurl( RTL_CONSTASCII_USTRINGPARAM("${ORIGIN}/tdefilepicker"));
#else // ENABLE_TDE
rtl::OUString helperurl( RTL_CONSTASCII_USTRINGPARAM("${ORIGIN}/kdefilepicker"));
#endif // ENABLE_TDE
rtl::Bootstrap::expandMacros( helperurl );
rtl::OUString helperpath;
osl::FileBase::getSystemPathFromFileURL( helperurl, helperpath );

View file

@ -85,6 +85,14 @@
#endif // ENABLE_TDE
#ifdef ENABLE_TDE
#define QCheckBox_String "TQCheckBox"
#define QComboBox_String "TQComboBox"
#else // ENABLE_TDE
#define QCheckBox_String "QCheckBox"
#define QComboBox_String "QComboBox"
#endif // ENABLE_TDE
#include <algorithm>
#include <iostream>
@ -104,8 +112,13 @@ KDEFileDialog::KDEFileDialog( const QString &startDir, const QString &filter,
m_bIsExecuting( false ),
m_bCanNotifySelection( true )
{
#ifdef ENABLE_TDE
connect( this, SIGNAL( fileHighlighted( const TQString & ) ),
this, SLOT( fileHighlightedCommand( const TQString & ) ) );
#else // ENABLE_TDE
connect( this, SIGNAL( fileHighlighted( const QString & ) ),
this, SLOT( fileHighlightedCommand( const QString & ) ) );
#endif // ENABLE_TDE
connect( this, SIGNAL( selectionChanged() ),
this, SLOT( selectionChangedCommand() ) );
@ -434,7 +447,7 @@ void KDEFileDialog::getValue( const QString &rId, const QString &rAction )
if ( pWidget )
{
QCString qClassName = pWidget->className();
if ( qClassName == "QCheckBox" )
if ( qClassName == QCheckBox_String )
{
QCheckBox *pCheckBox = static_cast< QCheckBox* >( pWidget );
@ -443,7 +456,7 @@ void KDEFileDialog::getValue( const QString &rId, const QString &rAction )
else
qString.append( " bool false" );
}
else if ( qClassName == "QComboBox" )
else if ( qClassName == QComboBox_String )
{
QComboBox *pComboBox = static_cast< QComboBox* >( pWidget );
if ( rAction == "getItems" )
@ -480,14 +493,14 @@ void KDEFileDialog::setValue( const QString &rId, const QString &rAction, const
if ( pWidget )
{
QCString qClassName = pWidget->className();
if ( qClassName == "QCheckBox" )
if ( qClassName == QCheckBox_String )
{
QCheckBox *pCheckBox = static_cast< QCheckBox* >( pWidget );
bool bValue = ( !rValue.isEmpty() ) && ( rValue.front().lower() == "true" );
pCheckBox->setChecked( bValue );
}
else if ( qClassName == "QComboBox" )
else if ( qClassName == QComboBox_String )
{
QComboBox *pComboBox = static_cast< QComboBox* >( pWidget );
if ( rAction == "addItem" )
@ -562,7 +575,7 @@ QString KDEFileDialog::addExtension( const QString &rFileName ) const
QString qExtension;
QWidget *pExtensionWidget = findControl( "100" ); // CHECKBOX_AUTOEXTENSION
QCheckBox *pExtensionCB = pExtensionWidget? static_cast< QCheckBox* >( pExtensionWidget->qt_cast( "QCheckBox" ) ): NULL;
QCheckBox *pExtensionCB = pExtensionWidget? static_cast< QCheckBox* >( pExtensionWidget->qt_cast( QCheckBox_String ) ): NULL;
if ( pExtensionCB && pExtensionCB->isChecked() )
{
// FIXME: qFilter can be a MIME; we ignore it now...
@ -660,7 +673,11 @@ QString KDEFileDialog::localCopy( const QString &rFileName ) const
return qDestURL.url();
}
#ifdef ENABLE_TDE
void KDEFileDialog::fileHighlightedCommand( const TQString & )
#else // ENABLE_TDE
void KDEFileDialog::fileHighlightedCommand( const QString & )
#endif // ENABLE_TDE
{
if ( canNotifySelection() )
{

View file

@ -114,7 +114,11 @@ protected:
bool canNotifySelection( void ) const { return m_bCanNotifySelection; }
protected slots:
#ifdef ENABLE_TDE
void fileHighlightedCommand( const TQString & );
#else // ENABLE_TDE
void fileHighlightedCommand( const QString & );
#endif // ENABLE_TDE
void selectionChangedCommand();
protected:

View file

@ -41,6 +41,48 @@
#include <vcl/vclenum.hxx>
#include <rtl/ustrbuf.hxx>
#ifdef ENABLE_TDE
#define QPushButton_String "TQPushButton"
#define QRadioButton_String "TQRadioButton"
#define QCheckBox_String "TQCheckBox"
#define QComboBox_String "TQComboBox"
#define QLineEdit_String "TQLineEdit"
#define QSpinWidget_String "TQSpinWidget"
#define QTabBar_String "TQTabBar"
#define QTabWidget_String "TQTabWidget"
#define QListView_String "TQListView"
#define QScrollBar_String "TQScrollBar"
#define QMotifPlusStyle_String "TQMotifPlusStyle"
#define QSGIStyle_String "TQSGIStyle"
#define QToolBar_String "TQToolBar"
#define QToolButton_String "TQToolButton"
#define QMenuBar_String "TQMenuBar"
#define QPopupMenu_String "TQPopupMenu"
#define QProgressBar_String "TQProgressBar"
#define QMotifStyle_String "TQMotifStyle"
#define QWindowsStyle_String "TQWindowsStyle"
#else // ENABLE_TDE
#define QPushButton_String "QPushButton"
#define QRadioButton_String "QRadioButton"
#define QCheckBox_String "QCheckBox"
#define QComboBox_String "QComboBox"
#define QLineEdit_String "QLineEdit"
#define QSpinWidget_String "QSpinWidget"
#define QTabBar_String "QTabBar"
#define QTabWidget_String "QTabWidget"
#define QListView_String "QListView"
#define QScrollBar_String "QScrollBar"
#define QMotifPlusStyle_String "QMotifPlusStyle"
#define QSGIStyle_String "QSGIStyle"
#define QToolBar_String "QToolBar"
#define QToolButton_String "QToolButton"
#define QMenuBar_String "QMenuBar"
#define QPopupMenu_String "QPopupMenu"
#define QProgressBar_String "QProgressBar"
#define QMotifStyle_String "QMotifStyle"
#define QWindowsStyle_String "QWindowsStyle"
#endif // ENABLE_TDE
using namespace ::com::sun::star;
using namespace ::rtl;
@ -458,11 +500,11 @@ sal_Bool WidgetPainter::drawStyledWidget( QWidget *pWidget,
const char *pClassName = pWidget->className();
// Draw the widget to the pixmap
if ( strcmp( "QPushButton", pClassName ) == 0 )
if ( strcmp( QPushButton_String, 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" ) );
QPushButton *pPushButton = static_cast<QPushButton *>( pWidget->qt_cast( QPushButton_String ) );
if ( pPushButton )
{
pPushButton->setDown ( nStyle & QStyle::Style_Down );
@ -474,7 +516,7 @@ sal_Bool WidgetPainter::drawStyledWidget( QWidget *pWidget,
&qPainter, pWidget, qRect,
pWidget->colorGroup(), nStyle );
}
else if ( strcmp( "QRadioButton", pClassName ) == 0 )
else if ( strcmp( QRadioButton_String, pClassName ) == 0 )
{
// Bitblt from the screen, because the radio buttons are usually not
// rectangular, and there could be a bitmap under them
@ -492,20 +534,20 @@ sal_Bool WidgetPainter::drawStyledWidget( QWidget *pWidget,
&qPainter, pWidget, qRect,
pWidget->colorGroup(), nStyle );
}
else if ( strcmp( "QCheckBox", pClassName ) == 0 )
else if ( strcmp( QCheckBox_String, pClassName ) == 0 )
{
kapp->style().drawControl( QStyle::CE_CheckBox,
&qPainter, pWidget, qRect,
pWidget->colorGroup(), nStyle );
}
else if ( strcmp( "QComboBox", pClassName ) == 0 )
else if ( strcmp( QComboBox_String, pClassName ) == 0 )
{
kapp->style().drawComplexControl( QStyle::CC_ComboBox,
&qPainter, pWidget, qRect,
pWidget->colorGroup(), nStyle );
// Editable combo box uses the background of the associated edit box
QComboBox *pComboBox = static_cast<QComboBox *>( pWidget->qt_cast( "QComboBox" ) );
QComboBox *pComboBox = static_cast<QComboBox *>( pWidget->qt_cast( QComboBox_String ) );
if ( pComboBox && pComboBox->editable() && pComboBox->lineEdit() )
{
QColorGroup::ColorRole eColorRole = ( pComboBox->isEnabled() )?
@ -516,13 +558,13 @@ sal_Bool WidgetPainter::drawStyledWidget( QWidget *pWidget,
pComboBox->lineEdit()->colorGroup().brush( eColorRole ) );
}
}
else if ( strcmp( "QLineEdit", pClassName ) == 0 )
else if ( strcmp( QLineEdit_String, pClassName ) == 0 )
{
kapp->style().drawPrimitive( QStyle::PE_PanelLineEdit,
&qPainter, qRect,
pWidget->colorGroup(), nStyle | QStyle::Style_Sunken );
}
else if ( strcmp( "QSpinWidget", pClassName ) == 0 )
else if ( strcmp( QSpinWidget_String, pClassName ) == 0 )
{
const SpinbuttonValue *pValue = static_cast<const SpinbuttonValue *> ( &aValue );
@ -553,7 +595,7 @@ sal_Bool WidgetPainter::drawStyledWidget( QWidget *pWidget,
}
// Spin widget uses the background of the associated edit box
QSpinWidget *pSpinWidget = static_cast<QSpinWidget *>( pWidget->qt_cast( "QSpinWidget" ) );
QSpinWidget *pSpinWidget = static_cast<QSpinWidget *>( pWidget->qt_cast( QSpinWidget_String ) );
if ( pSpinWidget && pSpinWidget->editWidget() )
{
QColorGroup::ColorRole eColorRole = ( pSpinWidget->isEnabled() )?
@ -573,7 +615,7 @@ sal_Bool WidgetPainter::drawStyledWidget( QWidget *pWidget,
pWidget->colorGroup(), nStyle,
QStyle::SC_All, eActive );
}
else if ( strcmp( "QTabBar", pClassName ) == 0 )
else if ( strcmp( QTabBar_String, pClassName ) == 0 )
{
const TabitemValue *pValue = static_cast<const TabitemValue *> ( &aValue );
@ -599,19 +641,19 @@ sal_Bool WidgetPainter::drawStyledWidget( QWidget *pWidget,
pWidget->colorGroup(), nStyle,
QStyleOption( pTab ) );
}
else if ( strcmp( "QTabWidget", pClassName ) == 0 )
else if ( strcmp( QTabWidget_String, pClassName ) == 0 )
{
kapp->style().drawPrimitive( QStyle::PE_PanelTabWidget,
&qPainter, qRect,
pWidget->colorGroup(), nStyle );
}
else if ( strcmp( "QListView", pClassName ) == 0 )
else if ( strcmp( QListView_String, pClassName ) == 0 )
{
kapp->style().drawPrimitive( QStyle::PE_Panel,
&qPainter, qRect,
pWidget->colorGroup(), nStyle | QStyle::Style_Sunken );
}
else if ( strcmp( "QScrollBar", pClassName ) == 0 )
else if ( strcmp( QScrollBar_String, pClassName ) == 0 )
{
const ScrollbarValue *pValue = static_cast<const ScrollbarValue *> ( &aValue );
@ -621,13 +663,13 @@ sal_Bool WidgetPainter::drawStyledWidget( QWidget *pWidget,
// 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 )
if ( strcmp( QMotifPlusStyle_String, pStyleName ) == 0 )
{
nStyle |= QStyle::Style_MouseOver;
if ( pValue->mnThumbState & CTRL_STATE_ROLLOVER )
eActive = QStyle::SC_ScrollBarSlider;
}
else if ( strcmp( "QSGIStyle", pStyleName ) == 0 )
else if ( strcmp( QSGIStyle_String, pStyleName ) == 0 )
{
nStyle |= QStyle::Style_MouseOver;
if ( pValue->mnButton1State & CTRL_STATE_ROLLOVER )
@ -665,7 +707,7 @@ sal_Bool WidgetPainter::drawStyledWidget( QWidget *pWidget,
}
// Is it a horizontal scroll bar?
QScrollBar *pScrollBar = static_cast<QScrollBar *> ( pWidget->qt_cast( "QScrollBar" ) );
QScrollBar *pScrollBar = static_cast<QScrollBar *> ( pWidget->qt_cast( QScrollBar_String ) );
QStyle::StyleFlags eHoriz = QStyle::Style_Default;
if ( pScrollBar && pScrollBar->orientation() == Qt::Horizontal )
eHoriz = QStyle::Style_Horizontal;
@ -675,9 +717,9 @@ sal_Bool WidgetPainter::drawStyledWidget( QWidget *pWidget,
pWidget->colorGroup(), nStyle | eHoriz,
QStyle::SC_All, eActive );
}
else if ( strcmp( "QToolBar", pClassName ) == 0 )
else if ( strcmp( QToolBar_String, pClassName ) == 0 )
{
QToolBar *pToolBar = static_cast< QToolBar * >( pWidget->qt_cast( "QToolBar" ) );
QToolBar *pToolBar = static_cast< QToolBar * >( pWidget->qt_cast( QToolBar_String ) );
bool bIsHorizontal = false;
if ( pToolBar && pToolBar->orientation() == Qt::Horizontal )
{
@ -720,7 +762,7 @@ sal_Bool WidgetPainter::drawStyledWidget( QWidget *pWidget,
&qPainter, qThumbRect, pWidget->colorGroup(), nStyle );
}
}
else if ( strcmp( "QToolButton", pClassName ) == 0 )
else if ( strcmp( QToolButton_String, pClassName ) == 0 )
{
if( (nStyle & QStyle::Style_MouseOver) )
nStyle &= ~QStyle::Style_Off;
@ -729,7 +771,7 @@ sal_Bool WidgetPainter::drawStyledWidget( QWidget *pWidget,
pWidget->colorGroup(), nStyle,
QStyle::SC_ToolButton );
}
else if ( strcmp( "QMenuBar", pClassName ) == 0 )
else if ( strcmp( QMenuBar_String, pClassName ) == 0 )
{
if ( nPart == PART_ENTIRE_CONTROL )
{
@ -751,7 +793,7 @@ sal_Bool WidgetPainter::drawStyledWidget( QWidget *pWidget,
QStyleOption( pMenuItem ) );
}
}
else if ( strcmp( "QPopupMenu", pClassName ) == 0 )
else if ( strcmp( QPopupMenu_String, pClassName ) == 0 )
{
int nMenuItem = ( nStyle & QStyle::Style_Enabled )? m_nPopupMenuEnabledItem: m_nPopupMenuDisabledItem;
QMenuItem *pMenuItem = static_cast<QPopupMenu*>( pWidget )->findItem( nMenuItem );
@ -764,7 +806,7 @@ sal_Bool WidgetPainter::drawStyledWidget( QWidget *pWidget,
pWidget->colorGroup(), nStyle,
QStyleOption( pMenuItem, 0, 0 ) );
}
else if ( strcmp( "QProgressBar", pClassName ) == 0 )
else if ( strcmp( QProgressBar_String, pClassName ) == 0 )
{
long nProgressWidth = aValue.getNumericVal();
QProgressBar* pProgress = static_cast<QProgressBar*>(pWidget);
@ -1940,8 +1982,8 @@ void KDESalFrame::UpdateSettings( AllSettings& rSettings )
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" ) )
( kapp->style().inherits( QMotifStyle_String ) && !kapp->style().inherits( QSGIStyle_String ) ) ||
kapp->style().inherits( QWindowsStyle_String ) )
{
aMenuFore = toColor( qMenuCG.buttonText() );
aMenuBack = toColor( qMenuCG.button() );
@ -1957,7 +1999,7 @@ void KDESalFrame::UpdateSettings( AllSettings& rSettings )
// Menu items higlight text color, theme specific
if ( kapp->style().inherits( "HighContrastStyle" ) ||
kapp->style().inherits( "KeramikStyle" ) ||
kapp->style().inherits( "QWindowsStyle" ) ||
kapp->style().inherits( QWindowsStyle_String ) ||
kapp->style().inherits( "ThinKeramikStyle" ) ||
kapp->style().inherits( "PlastikStyle" ) )
{