diff options
author | toma <toma@283d02a7-25f6-0310-bc7c-ecb5cbfe19da> | 2009-11-25 17:56:58 +0000 |
---|---|---|
committer | toma <toma@283d02a7-25f6-0310-bc7c-ecb5cbfe19da> | 2009-11-25 17:56:58 +0000 |
commit | 114a878c64ce6f8223cfd22d76a20eb16d177e5e (patch) | |
tree | acaf47eb0fa12142d3896416a69e74cbf5a72242 /buildtools/custommakefiles/custommanagerwidget.cpp | |
download | tdevelop-114a878c64ce6f8223cfd22d76a20eb16d177e5e.tar.gz tdevelop-114a878c64ce6f8223cfd22d76a20eb16d177e5e.zip |
Copy the KDE 3.5 branch to branches/trinity for new KDE 3.5 features.
BUG:215923
git-svn-id: svn://anonsvn.kde.org/home/kde/branches/trinity/kdevelop@1054174 283d02a7-25f6-0310-bc7c-ecb5cbfe19da
Diffstat (limited to 'buildtools/custommakefiles/custommanagerwidget.cpp')
-rw-r--r-- | buildtools/custommakefiles/custommanagerwidget.cpp | 80 |
1 files changed, 80 insertions, 0 deletions
diff --git a/buildtools/custommakefiles/custommanagerwidget.cpp b/buildtools/custommakefiles/custommanagerwidget.cpp new file mode 100644 index 00000000..9001480e --- /dev/null +++ b/buildtools/custommakefiles/custommanagerwidget.cpp @@ -0,0 +1,80 @@ +/*************************************************************************** + * Copyright (C) 2007 by Andreas Pakulat * + * apaku@gmx.de * + * * + * This program is free software; you can redistribute it and/or modify * + * it under the terms of the GNU General Public License as published by * + * the Free Software Foundation; either version 2 of the License, or * + * (at your option) any later version. * + * * + ***************************************************************************/ + +#include "custommanagerwidget.h" + +#include <qstringlist.h> +#include <qlayout.h> +#include <qlistbox.h> +#include <qwhatsthis.h> +#include <qtooltip.h> + +#include <ktextedit.h> +#include <kurlrequester.h> +#include <kurlcompletion.h> +#include <kfiledialog.h> +#include <keditlistbox.h> +#include <klocale.h> +#include <kdebug.h> + +#include "customprojectpart.h" +#include "domutil.h" + +CustomManagerWidget::CustomManagerWidget( CustomProjectPart* part, QWidget* parent ) + : CustomManagerWidgetBase( parent ), m_part( part), m_dom( *part->projectDom() ) +{ + m_filetypes->insertStringList( DomUtil::readListEntry( m_dom, "kdevcustomproject/filetypes", "filetype" ) ); + KURLRequester* urlselector = new KURLRequester( ); + urlselector->setMode( KFile::File | KFile::ExistingOnly | KFile::LocalOnly ); + urlselector->setURL( QString::null ); + urlselector->completionObject() ->setDir( part->projectDirectory() ); + urlselector->fileDialog() ->setURL( KURL( part->projectDirectory() ) ); + m_blacklistBox = new KEditListBox( i18n("blacklisted files and directories are not" + " considered part of the project, even if they fit one of " + "the wildcard patterns in the project file list", + "Blacklisted files/dirs"), urlselector->customEditor(), this); + m_blacklistBox->setButtons( KEditListBox::Add | KEditListBox::Remove ); + m_blacklistBox->insertStringList( DomUtil::readListEntry( m_dom, "kdevcustomproject/blacklist","path") ); + grid->addWidget( m_blacklistBox, 0, 1 ); + connect(m_blacklistBox, SIGNAL(added(const QString&)), this, SLOT(checkUrl(const QString&))); +} + +void CustomManagerWidget::checkUrl(const QString& url) +{ + kdDebug(9025) << "got file:" << url << endl; + if( !QFileInfo(url).isRelative() ) + { + kdDebug(9025) << "seems to be non-relative" << endl; + QString relpath = m_part->relativeToProject( url ); + QListBoxItem* item = m_blacklistBox->listBox()->findItem( url ); + m_blacklistBox->listBox()->takeItem( item ); + kdDebug(9025) << "relative path:" << relpath << endl; + if( !relpath.isEmpty() ) + m_blacklistBox->insertItem( relpath ); + } +} + +CustomManagerWidget::~CustomManagerWidget() +{ +} + +void CustomManagerWidget::accept() +{ + DomUtil::writeListEntry( m_dom, "kdevcustomproject/filetypes", "filetype", + m_filetypes->items() ); + DomUtil::writeListEntry( m_dom, "kdevcustomproject/blacklist", "path", + m_blacklistBox->items() ); +} + + +#include "custommanagerwidget.moc" + +// kate: space-indent on; indent-width 4; tab-width 4; replace-tabs on |