1
/***************************************************************************
2
* Copyright (C) 2003 by Roberto Raggi *
3
* roberto@kdevelop.org *
5
* This program is free software; you can redistribute it and/or modify *
6
* it under the terms of the GNU General Public License as published by *
7
* the Free Software Foundation; either version 2 of the License, or *
8
* (at your option) any later version. *
10
***************************************************************************/
12
#include "settingsdialog.h"
14
#include <kcombobox.h>
20
#if QT_VERSION < 0x030100
21
/* original source from qt-3.2.1/src/widgets/qlistbox.cpp
22
QListBoxItem* QListBox::selectedItem() const
24
if ( d->selectionMode != Single )
26
if ( isSelected( currentItem() ) )
31
QListBoxItem* QListBox_selectedItem( QListBox* cpQListBox )
33
if ( cpQListBox->selectionMode() != QListBox::Single )
35
if ( cpQListBox->isSelected( cpQListBox->currentItem() ) )
36
return cpQListBox->item( cpQListBox->currentItem() );
41
SettingsDialog::SettingsDialog( QWidget* parent, const char* name, WFlags fl )
42
: SettingsDialogBase( parent, name, fl )
45
qtdirs.push_back( ::getenv( "QTDIR" ) );
46
qtdirs.push_back( "/usr/lib/qt3" );
47
qtdirs.push_back( "/usr/lib/qt" );
48
qtdirs.push_back( "/usr/share/qt3" );
50
for ( QStringList::Iterator it = qtdirs.begin(); it != qtdirs.end(); ++it )
53
if ( !qtdir.isEmpty() && isValidQtDir( qtdir ) )
54
if ( !qtListBox->findItem( qtdir, ExactMatch ) )
55
qtListBox->insertItem( qtdir );
59
SettingsDialog::~SettingsDialog()
63
void SettingsDialog::slotSelectionChanged( QListBoxItem* // item
66
#if QT_VERSION < 0x030100
67
if ( !QListBox_selectedItem( qtListBox ) )
70
if ( !qtListBox->selectedItem() )
73
emit enabled( false );
77
QDir dir( qtDir() + "/include" );
78
QStringList qconfigFileList = dir.entryList( "qconfig-*.h" );
79
qtConfiguration->clear();
80
QRegExp rx( "qconfig-(\\w+)\\.h" );
81
for ( QStringList::Iterator it = qconfigFileList.begin(); it != qconfigFileList.end(); ++it )
83
( void ) rx.exactMatch( *it );
84
qtConfiguration->insertItem( rx.cap( 1 ) );
90
bool SettingsDialog::isValidQtDir( const QString & path ) const
92
return QFile::exists( path + "/include/qt.h" );
95
QString SettingsDialog::qtDir( ) const
97
return qtListBox->currentText();
100
QString SettingsDialog::configuration( ) const
102
return qtConfiguration->currentText();
105
#include "settingsdialog.moc"
106
//kate: indent-mode csands; tab-width 4; space-indent off;