Members of the KDE Community are recommended to subscribe to the kde-community mailing list at https://mail.kde.org/mailman/listinfo/kde-community to allow them to participate in important discussions and receive other important announcements

Commit d97bd984 authored by Aleix Pol Gonzalez's avatar Aleix Pol Gonzalez 🐧

Fixed the bug when trying to create a builddir in a non-existent directory.

Cleaned up the code a bit.
parent 9e5e80c0
......@@ -101,7 +101,7 @@ void CMakeBuildDirCreator::cmakeCommandDone(int exitCode, QProcess::ExitStatus e
t.prepend(b.trimmed());
m_creatorUi->cmakeOutput->setPlainText(t);*/
bool successful=exitCode==0 & exitStatus==QProcess::NormalExit;
bool successful=exitCode==0 && exitStatus==QProcess::NormalExit;
if(successful) {
m_creatorUi->status->setText(i18n("Created successfully"));
}
......@@ -198,14 +198,18 @@ void CMakeBuildDirCreator::updated()
m_creatorUi->status->setText(i18n("Using an already created build directory"));
m_creatorUi->buttonBox->button(QDialogButtonBox::Ok)->setEnabled(true);
}
else
else if(!dirExists)
{
m_creatorUi->installPrefix->setEnabled(dirEmpty || !dirExists);
m_creatorUi->buildType->setEnabled(dirEmpty || !dirExists);
m_creatorUi->installPrefix->setEnabled(false);
m_creatorUi->buildType->setEnabled(false);
// m_creatorUi->generator->setEnabled(dirEmpty);
m_creatorUi->run->setEnabled(dirEmpty || !dirExists);
m_creatorUi->run->setText(i18n("&Run"));
m_creatorUi->buttonBox->button(QDialogButtonBox::Ok)->setEnabled(false);
m_creatorUi->run->setEnabled(false);
m_creatorUi->status->setText(i18n("Using a missing build directory, please create it first"));
m_creatorUi->buttonBox->button(QDialogButtonBox::Ok)->setEnabled(true);
}
else
{
bool enabled=false;
if( !dirEmpty && dirExists )
{
//Useful to prevent disasters
......@@ -214,10 +218,18 @@ void CMakeBuildDirCreator::updated()
else if ( alreadyCreated && !correctProject )
m_creatorUi->status->setText(i18n("This build directory is for %1, "
"but the project directory is %2", srcDir, m_srcFolder.toLocalFile()));
} else
}
else
{
m_creatorUi->status->setText(i18n("Click the Run button to run CMake"));
enabled=true;
}
m_creatorUi->installPrefix->setEnabled(enabled);
m_creatorUi->buildType->setEnabled(enabled);
// m_creatorUi->generator->setEnabled(enabled);
m_creatorUi->run->setEnabled(enabled);
m_creatorUi->run->setText(i18n("&Run"));
m_creatorUi->buttonBox->button(QDialogButtonBox::Ok)->setEnabled(false);
}
}
......
......@@ -88,6 +88,10 @@ void CMakePreferences::load()
m_prefsUi->buildDirs->addItems(CMakeSettings::buildDirs());
m_prefsUi->buildDirs->setCurrentIndex( m_prefsUi->buildDirs->findText( CMakeSettings::currentBuildDir().toLocalFile() ) );
if(m_prefsUi->buildDirs->count()==0)
{
m_prefsUi->removeBuildDir->setEnabled(false);
}
// QString cmDir=group.readEntry("CMakeDirectory");
// m_prefsUi->kcfg_cmakeDir->setUrl(KUrl(cmDir));
// kDebug(9032) << "cmakedir" << cmDir;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment