00001 
00006 
00007 
00008 
00009 
00010 
00011 
00012 
00013 
00014 
00015 
00016 
00017 
00018 
00019 
00020 
00021 
00022 
00023 
00024 
00025 
00026 
00027 
00028 
00029 
00030 #ifndef _PRIVDLGACCESS_H_
00031 #define _PRIVDLGACCESS_H_
00032 
00033 
00034 
00035 
00036 #include <list>
00037 
00038 
00039 #include <osbid.h>
00040 
00041 #include <qdialog.h>
00042 #include <qcombobox.h>
00043 
00044 
00045 #include "osbcombos.h"
00046 
00047 
00048 namespace OSB_LIB {
00049     class GrpAccess;
00050     class Module;
00051     class ModAccess;
00052     class UserGroup;
00053 }
00054 
00055 class QFrame;
00056 class QGridLayout;
00057 class QHBoxLayout;
00058 class QLabel;
00059 class QLineEdit;
00060 class QSpacerItem;
00061 class QVBoxLayout;
00062 
00063 
00064 
00065 namespace OSB_GUI {
00066 
00067 
00068 
00069 
00070 
00071 
00072 
00073 
00074 
00078     class DlgAccessRight : public QDialog
00079     {
00080         Q_OBJECT                        
00081     public:
00082         
00083         class PathRow;
00084     public:
00086         explicit DlgAccessRight(
00087                   QWidget* parent,
00088             const char*    name   = 0,
00089                   bool     modal  = false,
00090                   WFlags   flags  = 0
00091         );
00092 
00093     public slots:
00095         void languageChange();
00096 
00097     public:
00108         int exec(
00109                   OSB_LIB::GrpAccess& access,
00110             const OSB_LIB::UserGroup& grp
00111         );
00112 
00123         int exec(
00124                   OSB_LIB::ModAccess& access,
00125             const OSB_LIB::Module&    module
00126         );
00127     private:
00131         void accept();
00132 
00133         void clearRows();
00134         PathRow* creDisplayRow(
00135             const std::string& text
00136         );
00137         PathRow* creEditRow(
00138             const std::string& text
00139         );
00140         PathRow* creComboRow(
00141             std::list<OSB_LIB::ModAccess>& maList
00142         );
00143 
00144     private:                            
00146         QVBoxLayout* layout_;
00147 
00149 
00150         QLabel* tlModule_;
00151         QLineEdit* leModule_;
00152         QLabel* tlGroup_;
00153         QLineEdit* leGroup_;
00154         QGridLayout* loHead_;
00155 
00156         QFrame* lineHead_;
00157         QLabel* tlAccessRight_;
00159 
00161         QVBoxLayout* loPath_;
00162 
00164         std::list<PathRow*> rows_;
00165 
00167         QSpacerItem* spPath_;
00168 
00170 
00171         QFrame* linePb_;
00172 
00173         QPushButton* pkOk_;
00174         QPushButton* pbCancel_;
00175         QSpacerItem* spPb_;
00176         QHBoxLayout* loPb_;
00178     };                                  
00179 
00180     class DlgAccessRight::PathRow : public QWidget {
00181     public:
00182         static PathRow* creDisplayRow(
00183                   int      level,
00184                   QWidget* parent,
00185             const char*    name    = 0,
00186                   WFlags   flags   = 0
00187         );
00188         static PathRow* creEditRow(
00189                   int      level,
00190                   QWidget* parent,
00191             const char*    name    = 0,
00192                   WFlags   flags   = 0
00193         );
00194         static PathRow* creComboRow(
00195                   int      level,
00196                   QWidget* parent,
00197             const char*    name    = 0,
00198                   WFlags   flags   = 0
00199         );
00200     private:
00202         PathRow(
00203                   int          level,
00204                   QWidget*     parent,
00205             const char*        name,
00206                   WFlags       flags
00207         );
00208 
00209     public:
00210         bool notEmpty() const;
00211 
00212         void setText(const std::string& text);
00213         std::string text() const;
00214 
00215         void populate(
00216             const std::list<OSB_LIB::ModAccess>& maList
00217         );
00218         OSB_LIB::Id<OSB_LIB::ModAccess> modAccessId() const;
00219 
00220     private:
00221         void mkDisplay();
00222         void mkCombo();
00223         void mkEditable();
00224 
00225         typedef ValueCombo< OSB_LIB::Id<OSB_LIB::ModAccess> > ModAcsComboBase;
00226         class ModAcsCombo : public ModAcsComboBase {
00227         public:
00228             ModAcsCombo(
00229                       QWidget* parent,
00230                 const char*    name
00231             ) : ModAcsComboBase(parent, name)
00232             {
00233             }
00234             ~ModAcsCombo()
00235             {
00236             }
00237         };
00238 
00240         void paintEvent(QPaintEvent*);
00241 
00242     private:
00244         size_t level_;
00246         QSpacerItem* spacer_;
00248         QLineEdit* element_;
00250         ModAcsCombo* combo_;
00252         QHBoxLayout* layout_;
00253     };                                  
00254 }                                       
00255 
00256 
00257 
00258 namespace OSB_GUI {
00259 }                                       
00260 #endif                                  // #ifndef _PRIVDLGACCESS_H_