From 114a878c64ce6f8223cfd22d76a20eb16d177e5e Mon Sep 17 00:00:00 2001 From: toma Date: Wed, 25 Nov 2009 17:56:58 +0000 Subject: Copy the KDE 3.5 branch to branches/trinity for new KDE 3.5 features. BUG:215923 git-svn-id: svn://anonsvn.kde.org/home/kde/branches/trinity/kdevelop@1054174 283d02a7-25f6-0310-bc7c-ecb5cbfe19da --- .../pcsimporter/customimporter/settingsdialog.cpp | 107 +++++++++++++++++++++ 1 file changed, 107 insertions(+) create mode 100644 languages/cpp/pcsimporter/customimporter/settingsdialog.cpp (limited to 'languages/cpp/pcsimporter/customimporter/settingsdialog.cpp') diff --git a/languages/cpp/pcsimporter/customimporter/settingsdialog.cpp b/languages/cpp/pcsimporter/customimporter/settingsdialog.cpp new file mode 100644 index 00000000..f6df0902 --- /dev/null +++ b/languages/cpp/pcsimporter/customimporter/settingsdialog.cpp @@ -0,0 +1,107 @@ +/*************************************************************************** +* Copyright (C) 2003 by Roberto Raggi * +* roberto@kdevelop.org * +* * +* Copyright (C) 2006 by Jens Dagerbo * +* jens.dagerbo@swipnet.se * +* * +* This program is free software; you can redistribute it and/or modify * +* it under the terms of the GNU General Public License as published by * +* the Free Software Foundation; either version 2 of the License, or * +* (at your option) any later version. * +* * +***************************************************************************/ + +#include + +#include +#include +#include +#include +#include +#include +#include + +#include + +// should be included after possible KEditListBox redefinition +#include "settingsdialog.h" + +#include +#include +#include +#include + +#include + +SettingsDialog::SettingsDialog( QWidget* parent, const char* name, WFlags fl ) + : SettingsDialogBase( parent, name, fl ) +{ + KURLRequester * req = new KURLRequester( this ); + req->setMode( KFile::Directory ); + KEditListBox::CustomEditor pCustomEditor; + pCustomEditor = req->customEditor(); + elb = new KEditListBox( i18n( "Directories to Parse" ), pCustomEditor, this ); + + grid->addMultiCellWidget( elb, 3, 3, 0, grid->numCols() ); + + // connect( dbName_edit, SIGNAL( textChanged( const QString& ) ), this, SLOT( validate() ) ); + connect( elb->addButton(), SIGNAL( clicked() ), this, SLOT( validate() ) ); + connect( elb->removeButton(), SIGNAL( clicked() ), this, SLOT( validate() ) ); + connect( elb, SIGNAL( added( const QString& ) ), this, SLOT( validateDirectory( const QString& ) ) ); +} + +SettingsDialog::~SettingsDialog() +{} + +QString SettingsDialog::dbName( ) const +{ + return QString(); +// return dbName_edit->text(); +} + +QStringList SettingsDialog::dirs( ) const +{ + return elb->items(); +} + +QString SettingsDialog::filePattern( ) const +{ + return pattern_edit->text(); +} + +bool SettingsDialog::recursive( ) const +{ + return recursive_box->isChecked(); +} + +void SettingsDialog::validate() +{ +// emit enabled( !dbName_edit->text().isEmpty() && elb->listBox() ->count() > 0 ); + emit enabled( elb->listBox()->count() > 0 ); +} + +void SettingsDialog::validateDirectory( const QString & dir ) +{ + QDir d( dir, QString::null, QDir::DefaultSort, QDir::Dirs ); + if ( !d.exists() ) + { + elb->lineEdit() ->setText( dir ); + + if ( QListBoxItem * item = elb->listBox() ->findItem( dir, Qt::ExactMatch ) ) + { + elb->listBox() ->removeItem( elb->listBox() ->index( item ) ); + } + + QString errormsg = QString( "%1 is not a directory" ).arg( dir ); + KMessageBox::error( 0, errormsg, "Couldn't find directory" ); + } + emit enabled( elb->listBox()->count() > 0 ); +} + +#include "settingsdialog.moc" +//kate: indent-mode csands; tab-width 4; space-indent off; + + + + -- cgit v1.2.3