00001 // OSB library ************************************************ -*- C++ -*- 00006 /* 00007 AUTHOR(S): Stephan Broennimann (vb) 00008 00009 RCS information 00010 $Name: OSB_060808 $ 00011 $Revision: 1.4 $ 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 _PRIVUSRGRP_H_ 00031 #define _PRIVUSRGRP_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 UserGroup; 00047 class UserGroups; 00048 } 00049 00050 class QFrame; 00051 class QHBoxLayout; 00052 class QPushButton; 00053 class QSpacerItem; 00054 class QVBoxLayout; 00055 00056 // ************************************************************************ 00057 // namespace extensions 00058 namespace OSB_GUI { 00059 00060 // ************************************************************************ 00061 // forward declarations 00062 class UsrGroupItem; 00063 class LvUsrGroups; 00064 00065 // ************************************************************************ 00066 // type definitions 00067 00068 // ************************************************************************ 00069 // class definitions 00073 class WdgtUsrGroups : public QWidget 00074 { 00075 Q_OBJECT // for vim ->; 00076 public: 00078 typedef OSB_LIB::Id<OSB_LIB::UserGroup> GrpId; 00079 public: 00081 WdgtUsrGroups( 00082 QWidget* parent, 00083 const char* name = 0, 00084 WFlags flags = 0 00085 ); 00086 00087 public slots: 00089 void languageChange(); 00090 00091 public: 00098 const GrpId curGroup() const; 00100 void populate( 00101 const OSB_LIB::UserGroups& grps 00102 ); 00104 void showGrp( 00105 const GrpId& grpId 00106 ); 00107 00108 signals: 00116 void cfgGroup(const GrpId grpId); 00117 00118 private slots: 00120 void showGrp(); 00122 void addGrp(); 00124 void delGrp(); 00126 void editGrp(); 00128 void cfgGrp(); 00129 00131 void enablePbs(); 00132 00133 private: 00135 LvUsrGroups* lvGroups_; 00137 QVBoxLayout* layout_; 00138 00140 QFrame* linePb_; 00142 QPushButton* pbNew_; 00144 QPushButton* pbDel_; 00146 QPushButton* pbEdit_; 00148 QPushButton* pbCfg_; 00149 00151 QHBoxLayout* loPb_; 00153 QSpacerItem* spPb_; 00154 }; // class WdgtUsrGroups 00155 00159 class LvUsrGroups : public QListView { 00160 Q_OBJECT // for vim ->; 00161 public: 00163 typedef OSB_LIB::Id<OSB_LIB::UserGroup> GrpId; 00164 public: 00166 LvUsrGroups( 00167 QWidget* parent, 00168 const char* name = 0, 00169 WFlags flags = 0 00170 ); 00171 00172 public slots: 00174 void languageChange(); 00175 00176 public: 00183 GrpId selectedGroup() const; 00185 void populate( 00186 const OSB_LIB::UserGroups& grps 00187 ); 00189 void selectGroup( 00190 const GrpId& grpId 00191 ); 00193 UsrGroupItem* insert( 00194 const OSB_LIB::UserGroup& grp 00195 ); 00197 void remove(const GrpId grpId); 00198 00199 private: 00201 UsrGroupItem* find(const GrpId grpId); 00202 }; // class LvUsrGroups 00203 00207 class UsrGroupItem : public QListViewItem { 00208 public: 00210 typedef OSB_LIB::Id<OSB_LIB::UserGroup> GrpId; 00211 public: 00213 UsrGroupItem( 00214 const OSB_LIB::UserGroup& grp, 00215 QListView* parent 00216 ); 00217 00218 public: 00220 const GrpId& grpId() const; 00222 void set(const OSB_LIB::UserGroup& grp); 00223 private: 00225 void setup(); 00226 private: 00228 GrpId grpId_; 00229 }; // class UsrGroupItem 00230 00231 } // namespace OSB_GUI 00232 00233 // ************************************************************************ 00234 // inline definitions 00235 namespace OSB_GUI { 00236 } // namespace OSB_GUI 00237 #endif // #ifndef _PRIVUSRGRP_H_