1
/***************************************************************************
2
* Copyright (C) 2002 by Bernd Gehrmann *
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 "custombuildoptionswidget.h"
14
#include <qcheckbox.h>
15
#include <klineedit.h>
16
#include <kurlrequester.h>
17
#include <kurlcompletion.h>
18
#include <kfiledialog.h>
19
#include <qradiobutton.h>
20
#include <qtabwidget.h>
24
CustomBuildOptionsWidget::CustomBuildOptionsWidget(QDomDocument &dom,
25
QWidget *parent, const char *name)
26
: CustomBuildOptionsWidgetBase(parent, name),
29
ant_button->setChecked(DomUtil::readEntry(dom, "/kdevcustomproject/build/buildtool") == "ant");
30
other_button->setChecked(DomUtil::readEntry(dom, "/kdevcustomproject/build/buildtool") == "other");
31
if( !DomUtil::readEntry(dom, "/kdevcustomproject/build/builddir").isEmpty()
32
&& QFileInfo( DomUtil::readEntry(dom, "/kdevcustomproject/build/builddir") ).exists() )
34
builddir_edit->setURL(DomUtil::readEntry(dom, "/kdevcustomproject/build/builddir"));
35
builddir_edit->fileDialog()->setURL( DomUtil::readEntry(dom, "/kdevcustomproject/build/builddir") );
39
builddir_edit->setURL( QString() );
40
builddir_edit->fileDialog()->setURL( QString() );
42
builddir_edit->completionObject()->setMode(KURLCompletion::DirCompletion);
43
builddir_edit->setMode( KFile::Directory | KFile::ExistingOnly | KFile::LocalOnly );
45
// This connection must not be made before the ant->setChecked() line,
46
// because at this time makeToggled() would crash
47
connect( make_button, SIGNAL(toggled(bool)),
48
this, SLOT(makeToggled(bool)) );
49
connect( other_button, SIGNAL(toggled(bool)),
50
this, SLOT(otherToggled(bool)) );
54
CustomBuildOptionsWidget::~CustomBuildOptionsWidget()
58
void CustomBuildOptionsWidget::accept()
61
if (ant_button->isChecked())
65
else if (other_button->isChecked())
73
DomUtil::writeEntry(m_dom, "/kdevcustomproject/build/buildtool", buildtool);
74
DomUtil::writeEntry(m_dom, "/kdevcustomproject/build/builddir", builddir_edit->url());
78
void CustomBuildOptionsWidget::setMakeOptionsWidget(QTabWidget *tw, QWidget *mow, QWidget* oow)
83
makeToggled(make_button->isChecked());
84
otherToggled(other_button->isChecked());
87
void CustomBuildOptionsWidget::otherToggled(bool b)
89
m_tabWidget->setTabEnabled(m_otherOptions, b);
92
void CustomBuildOptionsWidget::makeToggled(bool b)
94
m_tabWidget->setTabEnabled(m_makeOptions, b);
97
#include "custombuildoptionswidget.moc"
99
// kate: space-indent on; indent-width 4; tab-width 4; replace-tabs on