privdlgaccess.h

Go to the documentation of this file.
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 _PRIVDLGACCESS_H_
00031 #define _PRIVDLGACCESS_H_
00032 
00033 // ************************************************************************
00034 // included header files
00035 // + standard includes
00036 #include <list>
00037 
00038 // + libraries
00039 #include <osbid.h>
00040 
00041 #include <qdialog.h>
00042 #include <qcombobox.h>
00043 
00044 // + local headers
00045 #include "osbcombos.h"
00046 
00047 // + class declarations
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 // namespace extensions
00065 namespace OSB_GUI {
00066 
00067 // ************************************************************************
00068 // forward declarations
00069 
00070 // ************************************************************************
00071 // type definitions
00072 
00073 // ************************************************************************
00074 // class definitions
00078     class DlgAccessRight : public QDialog
00079     {
00080         Q_OBJECT                        // for vim ->;
00081     public:
00082         // defined below
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:                            // widgets
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     };                                  // class DlgAccessRight
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     };                                  // class DlgAccessRight::PathRow
00254 }                                       // namespace OSB_GUI
00255 
00256 // ************************************************************************
00257 // inline definitions
00258 namespace OSB_GUI {
00259 }                                       // namespace OSB_GUI
00260 #endif                                  // #ifndef _PRIVDLGACCESS_H_

Generated on Sat Sep 2 14:17:37 2006 for OSB Library by  doxygen 1.4.7