KDevelop API Documentation

filepropspage.cpp

Go to the documentation of this file.
00001 #include "filepropspage.h"
00002 #include <qlistbox.h>
00003 #include <qlineedit.h>
00004 #include <qtextview.h>
00005 #include <klocale.h>
00006 #include <qlabel.h>
00007 #include <qmultilineedit.h>
00008 
00009 /* 
00010  *  Constructs a FilePropsPage which is a child of 'parent', with the 
00011  *  name 'name' and widget flags set to 'f' 
00012  */
00013 FilePropsPage::FilePropsPage( QWidget* parent,  const char* name, WFlags fl )
00014     : FilePropsPageBase( parent, name, fl ){
00015   m_props = new QPtrList<ClassFileProp>;
00016   m_current_class = 9999; // no current  
00017 }
00018 
00019 /*  
00020  *  Destroys the object and frees any allocated resources
00021  */
00022 FilePropsPage::~FilePropsPage()
00023 {
00024     // no need to delete child widgets, Qt does it all for us
00025 }
00026 
00027 /* 
00028  * public slot
00029  */
00030 void FilePropsPage::slotSelectionChanged()
00031 {
00032   int item = classes_listbox->currentItem();
00033   ClassFileProp* prop;
00034   // save the old values
00035   if (m_current_class != 9999){ // != no selected
00036     prop = m_props->at(m_current_class);
00037     prop->m_classname = classname_edit->text();
00038     prop->m_headerfile = headerfile_edit->text();
00039     if(m_different_header_impl){
00040       prop->m_implfile = implfile_edit->text();
00041     }
00042     if(prop->m_change_baseclass){
00043       prop->m_baseclass = baseclass_edit->text();
00044     }
00045   }
00046   prop = m_props->at(item);
00047   classname_edit->setText(prop->m_classname);
00048   desc_textview->setText(prop->m_description);
00049   headerfile_edit->setText(prop->m_headerfile);
00050   if(m_different_header_impl){
00051     implfile_edit->setText(prop->m_implfile);
00052   }
00053   baseclass_edit->setText(prop->m_baseclass);
00054   if(prop->m_change_baseclass){
00055     baseclass_edit->setEnabled(true);
00056   }
00057   else {
00058     baseclass_edit->setEnabled(false);
00059   }
00060   m_current_class = item;
00061 }
00062 
00063 void FilePropsPage::setClassFileProps(QPtrList<ClassFileProp> props,bool different_header_impl){
00064   *m_props = props;
00065   m_different_header_impl = different_header_impl;
00066   if (!m_different_header_impl){
00067     implfile_edit->hide();
00068     implfile_label->hide();
00069     headerfile_label->setText(i18n("Header/Implementation file:"));
00070     
00071   }
00072   // fill the listbox
00073   ClassFileProp* prop;
00074   for ( prop=m_props->first(); prop != 0; prop=m_props->next() ){
00075     classes_listbox->insertItem(prop->m_classname);
00076   }
00077   classes_listbox->setSelected(0,true);
00078   slotSelectionChanged();
00079 }
00080 
00081 QPtrList<ClassFileProp> FilePropsPage::getClassFileProps(){
00082   return *m_props;
00083 }
00084 void FilePropsPage::slotClassnameChanged(const QString& text){
00085   classes_listbox->changeItem(text, classes_listbox->currentItem());
00086 }
00087 
00088 #include "filepropspage.moc"
KDE Logo
This file is part of the documentation for KDevelop Version 3.1.2.
Documentation copyright © 1996-2004 the KDE developers.
Generated on Tue Feb 22 09:22:37 2005 by doxygen 1.3.9.1 written by Dimitri van Heesch, © 1997-2003