settingsdialog.cpp
Go to the documentation of this file.00001
00002
00003
00004
00005
00006
00007
00008
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
00020 #if KDE_VERSION <= 305
00021 #include "../compat/kdeveditlistbox.h"
00022
00023 #define KEditListBox KDevCompat::KEditListBox
00024 #else
00025 #include <keditlistbox.h>
00026 #endif
00027
00028
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");
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
This file is part of the documentation for KDevelop Version 3.1.2.