00001 /*************************************************************************** 00002 * Copyright (C) 2006 by Graeme Foster * 00003 * email foster.graeme@gmail.com * 00004 * * 00005 * This program is free software; you can redistribute it and/or modify * 00006 * it under the terms of the GNU General Public License as published by * 00007 * the Free Software Foundation; either version 2 of the License, or * 00008 * (at your option) any later version. * 00009 * * 00010 * This program is distributed in the hope that it will be useful, * 00011 * but WITHOUT ANY WARRANTY; without even the implied warranty of * 00012 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * 00013 * GNU General Public License for more details. * 00014 * * 00015 * You should have received a copy of the GNU General Public License * 00016 * along with this program; if not, write to the * 00017 * Free Software Foundation, Inc., * 00018 * 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. * 00019 ***************************************************************************/ 00020 00021 #ifndef __INSTITUTE_DLG_H 00022 #define __INSTITUTE_DLG_H 00023 00024 #include <QtGui> 00025 00026 #include "control_panel.h" 00027 00028 #include "InstItem.h" 00029 00030 #include "Name_Abbrev_Root_dlg.h" 00031 00032 class InstituteDlg : public NameAbbrevRootDlg 00033 { 00034 Q_OBJECT 00035 00036 public: // methods 00037 InstituteDlg(int btnAction, RootItem * inst, RootItem * parentItem = 0, QMainWindow *parent = 0); 00038 00039 inline InstItem * getInstItem(){return dynamic_cast<InstItem*>(dataItem);} 00040 inline bool setInstitute (RootItem * data); 00041 inline QString getNameOnDB(); 00042 inline QString getAbbrevOnDB(); 00043 00044 private: // Properties 00045 // RootItem * dataItem; 00046 00047 private: // Methods 00048 void createActions(); 00049 void initialise (int btnAction); 00050 00051 private slots: 00052 void enableBtn(); 00053 void okPressed(); 00054 }; 00055 00056 inline bool InstituteDlg::setInstitute (RootItem * data) 00057 { 00058 if (data != 0) 00059 if (data->rtti() == RootItem::INST_ITEM) 00060 { 00061 dataItem = data; 00062 return true; 00063 } 00064 return false; 00065 } 00066 00067 inline QString InstituteDlg::getNameOnDB() 00068 { 00069 if (dataItem == 0) 00070 { 00071 return ""; 00072 } 00073 else 00074 { 00075 return getInstItem()->getInstName(); 00076 } 00077 } 00078 00079 inline QString InstituteDlg::getAbbrevOnDB() 00080 { 00081 if (dataItem == 0) 00082 { 00083 return ""; 00084 } 00085 else 00086 { 00087 return getInstItem()->getInstAbbrev(); 00088 } 00089 } 00090 00091 #endif