File indexing completed on 2024-04-28 16:26:31

0001 /**************************************************************************
0002 *   Copyright (C) 2007-2012 by Michel Ludwig (michel.ludwig@kdemail.net)  *
0003 *                 2011 by Felix Mauch (felix_mauch@web.de)                *
0004 ***************************************************************************/
0005 
0006 /**************************************************************************
0007 *                                                                         *
0008 *   This program is free software; you can redistribute it and/or modify  *
0009 *   it under the terms of the GNU General Public License as published by  *
0010 *   the Free Software Foundation; either version 2 of the License, or     *
0011 *   (at your option) any later version.                                   *
0012 *                                                                         *
0013 ***************************************************************************/
0014 
0015 #include "widgets/generalconfigwidget.h"
0016 
0017 #include <config.h>
0018 
0019 #include <KUrlCompletion>
0020 #include <QFileDialog>
0021 
0022 KileWidgetGeneralConfig::KileWidgetGeneralConfig(QWidget *parent) : QWidget(parent)
0023 {
0024     setupUi(this);
0025     m_defaultProjectLocationButton->setIcon(QIcon::fromTheme("folder-open"));
0026 
0027     connect(m_defaultProjectLocationButton, SIGNAL(clicked()),
0028             this, SLOT(selectDefaultProjectLocation()));
0029 
0030     KUrlCompletion *dirCompletion = new KUrlCompletion();
0031     dirCompletion->setMode(KUrlCompletion::DirCompletion);
0032     kcfg_DefaultProjectLocation->setCompletionObject(dirCompletion);
0033     kcfg_DefaultProjectLocation->setAutoDeleteCompletionObject(true);
0034 }
0035 
0036 KileWidgetGeneralConfig::~KileWidgetGeneralConfig()
0037 {
0038 }
0039 
0040 void KileWidgetGeneralConfig::selectDefaultProjectLocation()
0041 {
0042     QString newDefaultLocation = QFileDialog::getExistingDirectory(this, QString(), kcfg_DefaultProjectLocation->text());
0043     if (!newDefaultLocation.isEmpty()) {
0044         kcfg_DefaultProjectLocation->setText(newDefaultLocation);
0045     }
0046 }
0047