KDevelop API Documentation

lib/project/subclassesdlg.cpp

Go to the documentation of this file.
00001 /* This file is part of the KDE project 00002 Copyright (C) 2003 Alexander Dymo <cloudtemple@mksat.net> 00003 00004 This library is free software; you can redistribute it and/or 00005 modify it under the terms of the GNU Library General Public 00006 License as published by the Free Software Foundation; either 00007 version 2 of the License, or (at your option) any later version. 00008 00009 This library is distributed in the hope that it will be useful, 00010 but WITHOUT ANY WARRANTY; without even the implied warranty of 00011 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 00012 Library General Public License for more details. 00013 00014 You should have received a copy of the GNU Library General Public License 00015 along with this library; see the file COPYING.LIB. If not, write to 00016 the Free Software Foundation, Inc., 59 Temple Place - Suite 330, 00017 Boston, MA 02111-1307, USA. 00018 */ 00019 #include <qlistbox.h> 00020 #include <kurlrequester.h> 00021 00022 #include "subclassesdlg.h" 00023 #include "subclassesdlg.moc" 00024 SubclassesDlg::SubclassesDlg(QString form, DomUtil::PairList &config, QString projectDir, QWidget* parent, const char* name, bool modal, WFlags fl) 00025 : SubclassesDlgBase(parent,name, modal,fl), m_form(form), m_config(config), m_projectDir(projectDir) 00026 { 00027 subclass_url->setEnabled(false); 00028 00029 DomUtil::PairList::iterator it; 00030 for ( it = config.begin(); it != config.end(); ++it ) 00031 { 00032 if ((*it).second == form) 00033 subclasses_box->insertItem(projectDir + (*it).first); 00034 } 00035 } 00036 00037 SubclassesDlg::~SubclassesDlg() 00038 { 00039 } 00040 00041 /*$SPECIALIZATION$*/ 00042 void SubclassesDlg::accept() 00043 { 00044 QPtrList<DomUtil::Pair> pairsToRemove; 00045 00046 DomUtil::PairList::iterator it; 00047 for ( it = m_config.begin(); it != m_config.end(); ++it ) 00048 { 00049 if ((*it).second == m_form) 00050 { 00051 pairsToRemove.append(&(*it)); 00052 } 00053 } 00054 00055 DomUtil::Pair *pair; 00056 for ( pair = pairsToRemove.first(); pair; pair = pairsToRemove.next() ) 00057 { 00058 m_config.remove(*pair); 00059 } 00060 00061 for (int i = 0; i < (int)subclasses_box->count(); ++i) 00062 { 00063 m_config << DomUtil::Pair(subclasses_box->text(i).remove(0,m_projectDir.length()), m_form); 00064 } 00065 00066 SubclassesDlgBase::accept(); 00067 } 00068 00069 00070 void SubclassesDlg::newRelation() 00071 { 00072 subclasses_box->setFocus(); 00073 subclasses_box->insertItem(""); 00074 subclasses_box->setCurrentItem(subclasses_box->count()-1); 00075 subclass_url->setEnabled(true); 00076 subclass_url->setURL(""); 00077 subclass_url->setFocus(); 00078 } 00079 00080 void SubclassesDlg::removeRelation() 00081 { 00082 if (subclasses_box->currentItem() > -1) 00083 { 00084 QListBoxItem *item = subclasses_box->item(subclasses_box->currentItem()); 00085 int itemIdx = subclasses_box->currentItem(); 00086 00087 if (item->prev()) 00088 { 00089 subclasses_box->setCurrentItem(item->prev()); 00090 subclass_url->setURL(item->prev()->text()); 00091 } 00092 else if (item->next()) 00093 { 00094 subclasses_box->setCurrentItem(item->next()); 00095 subclass_url->setURL(item->next()->text()); 00096 } 00097 else 00098 { 00099 subclass_url->setEnabled(false); 00100 subclass_url->setURL(""); 00101 } 00102 subclasses_box->removeItem(itemIdx); 00103 } 00104 } 00105 00106 void SubclassesDlg::changeCurrentURL(const QString &str) 00107 { 00108 if ( subclasses_box->currentItem() > -1 ) 00109 { 00110 subclasses_box->changeItem(str, subclasses_box->currentItem()); 00111 } 00112 } 00113 00114 void SubclassesDlg::currentRelationChanged( QListBoxItem * item ) 00115 { 00116 if (item) 00117 { 00118 subclass_url->setEnabled(true); 00119 subclass_url->setURL(item->text()); 00120 } 00121 } 00122
KDE Logo
This file is part of the documentation for KDevelop Version 3.0.4.
Documentation copyright © 1996-2004 the KDE developers.
Generated on Tue Oct 19 08:01:48 2004 by doxygen 1.3.7 written by Dimitri van Heesch, © 1997-2003