KDevelop API Documentation

settingsdialog.cpp

Go to the documentation of this file.
00001 /***************************************************************************
00002  *   Copyright (C) 2003 by Roberto Raggi                                   *
00003  *   roberto@kdevelop.org                                                  *
00004  *                                                                         *
00005  *   This program is free software; you can redistribute it and/or modify  *
00006  *   it under the terms of the GNU General Public License as published by  *
00007  *   the Free Software Foundation; either version 2 of the License, or     *
00008  *   (at your option) any later version.                                   *
00009  *                                                                         *
00010  ***************************************************************************/
00011 
00012 
00013 #include <klistbox.h>
00014 #include <kcombobox.h>
00015 #include <kurlrequester.h>
00016 #include <kdeversion.h>
00017 #include <klocale.h>
00018 
00019 // only for KDE < 3.1
00020 #if KDE_VERSION <= 305
00021 #include "../compat/kdeveditlistbox.h"
00022 //using namespace KDevCompat;
00023 #define KEditListBox KDevCompat::KEditListBox
00024 #else
00025 #include <keditlistbox.h>
00026 #endif
00027 
00028 // should be included after possible KEditListBox redefinition
00029 #include "settingsdialog.h"
00030 
00031 #include <qfile.h>
00032 #include <qdir.h>
00033 #include <qregexp.h>
00034 #include <qlayout.h>
00035 #include <qcheckbox.h>
00036 
00037 #include <cstdlib>
00038 
00039 SettingsDialog::SettingsDialog(QWidget* parent, const char* name, WFlags fl)
00040     : SettingsDialogBase(parent,name,fl)
00041 {
00042     KURLRequester *req = new KURLRequester( this );
00043     req->setMode(KFile::Directory);
00044     KEditListBox::CustomEditor pCustomEditor;
00045 #if KDE_VERSION > 305
00046     pCustomEditor = req->customEditor();
00047 #else
00048     QObjectList* pOL = req->queryList("KLineEdit"); // dirty hack :)
00049     KLineEdit* pEdit = dynamic_cast<KLineEdit*>(pOL->first());
00050     assert(pEdit);
00051     KEditListBox::CustomEditor editor(req, pEdit);
00052     pCustomEditor = editor;
00053 #endif
00054     elb = new KEditListBox( i18n("Directories to Parse"), pCustomEditor, this );
00055 
00056     grid->addMultiCellWidget(elb, 2, 2, 0, grid->numCols());
00057 
00058     connect(dbName_edit, SIGNAL(textChanged(const QString& )), this, SLOT( validate() ));
00059     connect(elb->addButton(), SIGNAL(clicked()), this, SLOT(validate()));
00060     connect(elb->removeButton(), SIGNAL(clicked()), this, SLOT(validate()));
00061 }
00062 
00063 SettingsDialog::~SettingsDialog()
00064 {
00065 }
00066 
00067 QString SettingsDialog::dbName( ) const
00068 {
00069     return dbName_edit->text();
00070 }
00071 
00072 QStringList SettingsDialog::dirs( ) const
00073 {
00074     return elb->items();
00075 }
00076 
00077 bool SettingsDialog::recursive( ) const
00078 {
00079     return recursive_box->isChecked();
00080 }
00081 
00082 void SettingsDialog::validate()
00083 {
00084     emit enabled( !dbName_edit->text().isEmpty() && elb->listBox()->count() > 0 );
00085 }
00086 
00087 #include "settingsdialog.moc"
00088 
00089 
KDE Logo
This file is part of the documentation for KDevelop Version 3.1.2.
Documentation copyright © 1996-2004 the KDE developers.
Generated on Tue Feb 22 09:22:30 2005 by doxygen 1.3.9.1 written by Dimitri van Heesch, © 1997-2003