00001 // OSB library ************************************************ -*- C++ -*- 00006 /* 00007 AUTHOR(S): Stephan Broennimann (vb) 00008 00009 RCS information 00010 $Name: OSB_060808 $ 00011 $Revision: 1.9 $ 00012 00013 License 00014 OSB rating and billing library for communication networks 00015 Copyright (C) 2004, 2005, 2006 OSB systems 00016 00017 This file may be distributed and/or modify under the terms of the 00018 GNU General Public License (GPL) as published by the Free Software 00019 Foundation which is provided in the file LICENSE.GPL included in the 00020 packaging of this file. 00021 00022 The file is distributed in the hope that it will be useful, but WITHOUT 00023 ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or 00024 FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License 00025 for more details. 00026 00027 Holders of a OSB Commercial License may use this file under the terms 00028 and conditions of this commercial license. 00029 */ 00030 #ifndef _PRIVGRPACS_H_ 00031 #define _PRIVGRPACS_H_ 00032 00033 // ************************************************************************ 00034 // included header files 00035 // + standard includes 00036 00037 // + libraries 00038 #include <osbid.h> 00039 00040 #include <qlistview.h> 00041 00042 // + local headers 00043 00044 // + class declarations 00045 namespace OSB_LIB { 00046 class GrpAccessMap; 00047 class GrpAccess; 00048 class UserGroup; 00049 } 00050 00051 namespace OSB_GUI { 00052 class CmbUserGroup; 00053 } 00054 00055 class QHBoxLayout; 00056 class QHBoxLayout; 00057 class QLabel; 00058 class QPushButton; 00059 class QPushButton; 00060 class QPushButton; 00061 class QSpacerItem; 00062 class QVBoxLayout; 00063 00064 // ************************************************************************ 00065 // namespace extensions 00066 namespace OSB_GUI { 00067 00068 // ************************************************************************ 00069 // forward declarations 00070 class LvGrpAccess; 00071 class GrpAccessItem; 00072 00073 // ************************************************************************ 00074 // type definitions 00075 00076 // ************************************************************************ 00077 // class definitions 00081 class WdgtGrpAccess : public QWidget { 00082 Q_OBJECT // for vim ->; 00083 public: 00085 WdgtGrpAccess( 00086 QWidget* parent, 00087 const char* name = 0, 00088 WFlags flags = 0 00089 ); 00090 00091 private: 00093 WdgtGrpAccess(const WdgtGrpAccess&); 00095 WdgtGrpAccess& operator=(const WdgtGrpAccess&); 00096 00097 public slots: 00099 void languageChange(); 00100 00101 public: 00109 void populate( 00110 const OSB_LIB::Id<OSB_LIB::UserGroup> grpId 00111 ); 00118 const OSB_LIB::Id<OSB_LIB::UserGroup> curGroup() const; 00119 00120 private slots: 00122 void grpChanged(bool force = false); 00127 void addSibling(); 00132 void addChild(); 00136 void delAccess(); 00138 void enablePbs(); 00139 00140 private: // utils 00148 void addAccess( 00149 bool addSibling 00150 ); 00151 00152 private: // data 00154 OSB_LIB::Id<OSB_LIB::UserGroup> curGroup_; 00155 00156 private: // widgets 00158 QVBoxLayout* layout_; 00159 00161 QLabel* tlGroup_; 00163 CmbUserGroup* cmbGroups_; 00165 QHBoxLayout* loHead_; 00166 00168 LvGrpAccess* lvAccess_; 00169 00171 QFrame* linePb_; 00173 QPushButton* pbSibling_; 00175 QPushButton* pbChild_; 00177 QPushButton* pbDel_; 00178 00180 QHBoxLayout* loPb_; 00182 QSpacerItem* spPb_; 00183 }; // class WdgtGrpAccess 00184 00188 class LvGrpAccess : public QListView { 00189 Q_OBJECT // for vim ->; 00190 public: 00192 LvGrpAccess( 00193 QWidget* parent, 00194 const char* name = 0, 00195 WFlags flags = 0 00196 ); 00197 00198 public slots: 00200 void languageChange(); 00201 00202 public: 00208 void populate( 00209 const OSB_LIB::UserGroup& usrGroup 00210 ); 00218 void select( 00219 const OSB_LIB::Id<OSB_LIB::GrpAccess> gaId 00220 ); 00227 const OSB_LIB::GrpAccess* grpAccess() const; 00228 private: 00230 void populate( 00231 QListViewItem* parent, 00232 const OSB_LIB::GrpAccessMap& map, 00233 const OSB_LIB::Id<OSB_LIB::GrpAccess> gaParent 00234 ); 00235 }; // class LvGrpAccess 00236 00240 class GrpAccessItem : public QListViewItem { 00241 public: 00243 GrpAccessItem( 00244 const OSB_LIB::GrpAccess& access, 00245 QListView* parent 00246 ); 00248 GrpAccessItem( 00249 const OSB_LIB::GrpAccess& access, 00250 QListViewItem* parent 00251 ); 00253 ~GrpAccessItem(); 00254 00255 private: 00257 GrpAccessItem(const GrpAccessItem&); 00259 GrpAccessItem& operator=(const GrpAccessItem&); 00260 00261 public: 00263 const OSB_LIB::GrpAccess& grpAccess() const; 00264 00265 private: 00267 void setup(); 00269 void setTexts(); 00270 private: 00272 OSB_LIB::GrpAccess* grpAccess_; 00273 }; // class GrpAccessItem 00274 } // namespace OSB_GUI 00275 00276 // ************************************************************************ 00277 // inline definitions 00278 namespace OSB_GUI { 00279 } // namespace OSB_GUI 00280 #endif // #ifndef _PRIVGRPACS_H_