Ejemplo n.º 1
0
    def __init__(self, parent=None, flags=PyQt4.QtCore.Qt.Widget):
        QWizard.__init__(self, parent, flags)
        self.setupUi(self)
        # need to initialize the pages before connecting signals
        self.restart()

        attributePixmap = pixmapFromTheme("addattribute", ":/icons/64/add-attribute")
        objectclassPixmap = pixmapFromTheme("objectclass", ":/icons/64/objectclass")
        self.imageLabel.setPixmap(attributePixmap)
        self.objectclassLabel.setPixmap(objectclassPixmap)

        self.enableAllBox.toggled.connect(self.initAttributeBox)
        self.attributeBox.activated[str].connect(self.newSelection)
        self.classBox.itemSelectionChanged.connect(self.classSelection)

        # attribute values of the current ldap object
        self.OBJECTVALUES = None

        # schema information for the ldap server
        self.SCHEMAINFO = None

        # set of attributes which are possible with the current objectclasses
        self.possibleAttributes = None

        # set of all attributes which are supported by the server
        self.allPossibleAttributes = None
Ejemplo n.º 2
0
    def __init__(self, parent=None, flags=PyQt4.QtCore.Qt.Widget):
        QWizard.__init__(self, parent, flags)
        self.setupUi(self)
        # need to initialize the pages before connecting signals
        self.restart()

        attributePixmap = pixmapFromTheme("addattribute",
                                          ":/icons/64/add-attribute")
        objectclassPixmap = pixmapFromTheme("objectclass",
                                            ":/icons/64/objectclass")
        self.imageLabel.setPixmap(attributePixmap)
        self.objectclassLabel.setPixmap(objectclassPixmap)

        self.enableAllBox.toggled.connect(self.initAttributeBox)
        self.attributeBox.activated[str].connect(self.newSelection)
        self.classBox.itemSelectionChanged.connect(self.classSelection)

        # attribute values of the current ldap object
        self.OBJECTVALUES = None

        # schema information for the ldap server
        self.SCHEMAINFO = None

        # set of attributes which are possible with the current objectclasses
        self.possibleAttributes = None

        # set of all attributes which are supported by the server
        self.allPossibleAttributes = None
Ejemplo n.º 3
0
    def __init__(self, parent=None):
        super(SearchPlugin, self).__init__(parent)
        self.setupUi(self)
        self.setObjectName('SearchPlugin')
        self.openTabs = {}
        self.completer = None
        self.currentServer = None
        #self.connection = None
        self.resultSetCount = 0

        self.serverListObject = ServerList()
        self.serverList = self.serverListObject.getTable()

        self.searchForm = SearchForm(parent=self)
        self.filterBuilder = FilterBuilder(parent=self)

        # Icons
        searchIcon = iconFromTheme('edit-find', ':/icons/32/edit-find')
        filterIcon = iconFromTheme('edit-find-replace',
                                   ':/icons/32/edit-find-replace')
        secureIcon = iconFromTheme('object-locked', ':/icons/16/object-locked')
        errorIcon = pixmapFromTheme('dialog-error', ':/icons/48/dialog-error',
                                    24, 24)
        undoIcon = iconFromTheme('edit-undo', ':/icons/32/edit-undo')
        redoIcon = iconFromTheme('edit-redo', ':/icons/32/edit-redo')
        addIcon = iconFromTheme('list-add', ':/icons/32/list-add')

        self.indexSF = self.left.addTab(self.searchForm, searchIcon, '')
        self.indexFB = self.left.addTab(self.filterBuilder, filterIcon, '')

        self.searchForm.filterBuilderToolButton.setIcon(filterIcon)
        self.searchForm.errorIcon.setPixmap(errorIcon)
        self.filterBuilder.undoButton.setIcon(undoIcon)
        self.filterBuilder.redoButton.setIcon(redoIcon)
        self.filterBuilder.addSpecialCharButton.setIcon(addIcon)

        # The search plugin event filter we
        # use for acting upon various events
        eventFilter = SearchPluginEventFilter(self)
        # Install the eventFilter on desired widgets
        self.installEventFilter(eventFilter)
        self.right.installEventFilter(eventFilter)
        self.right.setUsesScrollButtons(True)

        self.__loadSettings()
        self.__connectSlots()

        # Only add text to these class and its children at this time
        self.retranslate(all=False)

        # TODO: maybe we allways want to return a list from ServerList,
        #       eliminating the 'NoneType is not iterable' exceptions.
        if not self.serverList is None:
            for server in self.serverList:
                # As documendted in the ServerObject class:
                # 0 = Unencrypted, 1 = TLS, 2 = SSL
                if server.encryptionMethod == 0:
                    self.searchForm.serverBox.addItem(server.name)
                else:
                    self.searchForm.serverBox.addItem(secureIcon, server.name)
Ejemplo n.º 4
0
    def __init__(self, msg='', parent=None):
        """
        @param items:
            The list of items to export.
        @param msg:
            A message to display in the dialog. Might be information
            about problems with fetching all the LDAP entries, etc.
        """
        super(ExportDialog, self).__init__(parent)
        self.setupUi(self)

        self.iconLabel.setPixmap(
            pixmapFromTheme('document-save', ':/icons/64/document-export'))
        self.fileButton.setIcon(
            iconFromTheme('document-open', ':/icons/32/document-open'))
        self.messageLabel.setText(msg)

        self.model = QtGui.QStandardItemModel()
        self.exportItemView.setModel(self.model)
        self.exportItemView.setAlternatingRowColors(True)
        self.exportItemView.setUniformItemSizes(True)
        self.exportDict = {}

        # Disabled until path set
        self.exportButton.setEnabled(False)
        # If the users manually edits the path, we'll trust him
        #self.outputEdit.textEdited.connect(self.enableExport)
        # The signal textEdit is not emitted if the text is changed
        # programmatically, we therefore use textChanged instead.
        self.outputEdit.textChanged['QString'].connect(self.onFilenameChanged)
Ejemplo n.º 5
0
    def __init__(self, msg='', parent=None):
        """
        @param items:
            The list of items to export.
        @param msg:
            A message to display in the dialog. Might be information
            about problems with fetching all the LDAP entries, etc.
        """
        super(ExportDialog, self).__init__(parent)
        self.setupUi(self)

        self.iconLabel.setPixmap(pixmapFromTheme(
            'document-save', ':/icons/64/document-export'))
        self.fileButton.setIcon(iconFromTheme(
            'document-open', ':/icons/32/document-open'))
        self.messageLabel.setText(msg)

        self.model = QtGui.QStandardItemModel()
        self.exportItemView.setModel(self.model)
        self.exportItemView.setAlternatingRowColors(True)
        self.exportItemView.setUniformItemSizes(True)
        self.exportDict = {}

        # Disabled until path set
        self.exportButton.setEnabled(False)
        # If the users manually edits the path, we'll trust him
        #self.outputEdit.textEdited.connect(self.enableExport)
        # The signal textEdit is not emitted if the text is changed
        # programmatically, we therefore use textChanged instead.
        self.outputEdit.textChanged['QString'].connect(self.onFilenameChanged)
Ejemplo n.º 6
0
    def __init__(self, parent = None, flags = PyQt4.QtCore.Qt.Widget):
        QDialog.__init__(self, parent, flags)
        self.setupUi(self)

        self.informationLabel.setText("")
        self.okButton.setEnabled(False)

        # Set icon for label and button
        editorPixmap = pixmapFromTheme("document-encrypted", ":/icons/64/document-encrypted", 64, 64)
        self.iconLabel.setPixmap(editorPixmap)

        folderPixmap = pixmapFromTheme("folder", ":/icons/16/folder", 16, 16)
        self.fileButton.setIcon(QIcon(folderPixmap))

        self.value = None
        self.fileName = ""
Ejemplo n.º 7
0
    def __init__(self, parent=None, flags=PyQt4.QtCore.Qt.Widget):
        QDialog.__init__(self, parent, flags)
        self.setupUi(self)

        self.informationLabel.setText("")
        self.okButton.setEnabled(False)

        # Set icon for label and button
        editorPixmap = pixmapFromTheme("document-encrypted",
                                       ":/icons/64/document-encrypted", 64, 64)
        self.iconLabel.setPixmap(editorPixmap)

        folderPixmap = pixmapFromTheme("folder", ":/icons/16/folder", 16, 16)
        self.fileButton.setIcon(QIcon(folderPixmap))

        self.value = None
        self.fileName = ""
Ejemplo n.º 8
0
    def __init__(self, parent = None, flags = PyQt4.QtCore.Qt.Widget):
        QDialog.__init__(self, parent, flags=flags)
        self.setupUi(self)

        # Set icon for label
        editorPixmap = pixmapFromTheme(
            "accessories-text-editor", ":/icons/48/accessories-text-editor")
        self.iconLabel.setPixmap(editorPixmap)

        self.value = None
Ejemplo n.º 9
0
    def __init__(self, parent=None, flags=PyQt4.QtCore.Qt.Widget):
        QDialog.__init__(self, parent, flags=flags)
        self.setupUi(self)

        # Set icon for label
        editorPixmap = pixmapFromTheme("accessories-text-editor",
                                       ":/icons/48/accessories-text-editor")
        self.iconLabel.setPixmap(editorPixmap)

        self.value = None
Ejemplo n.º 10
0
    def __init__(self, sOList, subTree=True, parent=None):
        """
        subTree:
            False = only sOList
            True = subtree of SOList
        """
        super(DeleteDialog, self).__init__(parent)
        self.setupUi(self)

        self.iconLabel.setPixmap(
            pixmapFromTheme('document-close', ':/icons/64/document-close'))

        self.model = QtGui.QStandardItemModel()

        self.model.setHorizontalHeaderLabels(["DN", "Status"])
        self.items = sOList
        self.deleteDict = {}

        self.subTree = subTree
        self.serverConnections = {}

        if not self.subTree:  # The nodes only
            for smd in self.items:
                self.addItemToModel(smd)
        else:
            # Load subtrees
            for sO in self.items:
                if not self.serverConnections.has_key(sO.serverMeta.name):
                    self.serverConnections[
                        sO.serverMeta.name] = LumaConnectionWrapper(
                            sO.serverMeta)
                    self.serverConnections[sO.serverMeta.name].bindSync()
                con = self.serverConnections[sO.serverMeta.name]
                # Subtree
                success, result, e = con.searchSync(base=sO.getDN(),
                                                    scope=ldap.SCOPE_SUBTREE)
                if success:
                    for i in result:
                        # Subtree only
                        if i.getDN() == sO.getDN():
                            continue
                        self.addItemToModel(i)
                else:
                    continue

        self.deleteItemView.setModel(self.model)
        self.deleteItemView.setAlternatingRowColors(True)
        self.deleteItemView.setUniformRowHeights(True)

        self.hasTriedToDelete = False
        self.passedItemsWasDeleted = False
Ejemplo n.º 11
0
    def __init__(self, parent=None, flags=PyQt4.QtCore.Qt.Widget):
        QDialog.__init__(self, parent, flags)
        self.setupUi(self)

        # Set icon for label
        editorPixmap = pixmapFromTheme("accessories-text-editor",
                                       ":/icons/48/accessories-text-editor")
        self.iconLabel.setPixmap(editorPixmap)

        # The complete DN of the object
        self.value = None

        # The base dn where the object should be created
        self.baseDN = None
Ejemplo n.º 12
0
    def __init__(self, parent = None, flags = PyQt4.QtCore.Qt.Widget):
        QDialog.__init__(self,parent,flags)
        self.setupUi(self)

        # Set icon for label
        editorPixmap = pixmapFromTheme(
            "accessories-text-editor", ":/icons/48/accessories-text-editor")
        self.iconLabel.setPixmap(editorPixmap)

        # The complete DN of the object
        self.value = None

        # The base dn where the object should be created
        self.baseDN = None
Ejemplo n.º 13
0
    def __init__(self, sOList, subTree = True, parent=None):
        """
        subTree:
            False = only sOList
            True = subtree of SOList
        """
        super(DeleteDialog, self).__init__(parent)
        self.setupUi(self)

        self.iconLabel.setPixmap(pixmapFromTheme(
            'document-close', ':/icons/64/document-close'))

        self.model = QtGui.QStandardItemModel()

        self.model.setHorizontalHeaderLabels(["DN","Status"])
        self.items = sOList
        self.deleteDict = {}

        self.subTree = subTree
        self.serverConnections = {}

        if not self.subTree: # The nodes only
            for smd in self.items:
                self.addItemToModel(smd)
        else:
            # Load subtrees
            for sO in self.items:
                if not self.serverConnections.has_key(sO.serverMeta.name):
                    self.serverConnections[sO.serverMeta.name] = LumaConnectionWrapper(sO.serverMeta)
                    self.serverConnections[sO.serverMeta.name].bindSync()
                con = self.serverConnections[sO.serverMeta.name]
                # Subtree
                success, result, e = con.searchSync(base=sO.getDN(), scope=ldap.SCOPE_SUBTREE)
                if success:
                    for i in result:
                        # Subtree only
                        if i.getDN() == sO.getDN():
                            continue
                        self.addItemToModel(i)
                else:
                    continue

        self.deleteItemView.setModel(self.model)
        self.deleteItemView.setAlternatingRowColors(True)
        self.deleteItemView.setUniformRowHeights(True)

        self.hasTriedToDelete = False
        self.passedItemsWasDeleted = False
Ejemplo n.º 14
0
    def onNoResult(self):
        """Adds a styled *no result* message to the main layout.
        """
        font = QtGui.QFont()
        font.setBold(True)
        sadface = QtGui.QLabel(self)
        sadface.setPixmap(pixmapFromTheme('face-sad', ':/icons/48/face-sad'))
        noresult = QtGui.QLabel(self)
        noresult.setText(self.str_NO_RESULT)
        noresult.setFont(font)
        hlayout = QtGui.QHBoxLayout()
        hlayout.addItem(self.__getVSpacer())
        hlayout.addWidget(sadface)
        hlayout.addWidget(noresult)
        hlayout.addItem(self.__getVSpacer())

        self.layout.addLayout(hlayout)
Ejemplo n.º 15
0
    def onNoResult(self):
        """Adds a styled *no result* message to the main layout.
        """
        font = QtGui.QFont()
        font.setBold(True)
        sadface = QtGui.QLabel(self)
        sadface.setPixmap(pixmapFromTheme('face-sad', ':/icons/48/face-sad'))
        noresult = QtGui.QLabel(self)
        noresult.setText(self.str_NO_RESULT)
        noresult.setFont(font)
        hlayout = QtGui.QHBoxLayout()
        hlayout.addItem(self.__getVSpacer())
        hlayout.addWidget(sadface)
        hlayout.addWidget(noresult)
        hlayout.addItem(self.__getVSpacer())

        self.layout.addLayout(hlayout)
Ejemplo n.º 16
0
    def __init__(self, parent = None, flags = PyQt4.QtCore.Qt.Widget):
        QDialog.__init__(self, parent, flags)
        self.setupUi(self)

        editorPixmap = pixmapFromTheme(
            "dialog-password", ":/icons/48/dialog-password")
        self.iconLabel.setPixmap(editorPixmap)

        self.supportedAlgorithms = get_available_hash_methods()
        map(self.methodBox.addItem, self.supportedAlgorithms)
        self.methodBox.currentIndexChanged[str].connect(self.methodChanged)

        self.okButton.setEnabled(False)
        self.progressBar.setValue(0)

        self.asciiInput = True
        self.asciiBox.clicked.connect(self.asciiBoxClicked)
        self.hiddenBox.clicked.connect(self.hiddenBoxClicked)

        # The new password in cleartext
        self.password = None

        self.methodBox.currentIndexChanged[str].emit(self.methodBox.currentText())
Ejemplo n.º 17
0
    def __init__(self, parent=None, flags=PyQt4.QtCore.Qt.Widget):
        QDialog.__init__(self, parent, flags)
        self.setupUi(self)

        editorPixmap = pixmapFromTheme("dialog-password",
                                       ":/icons/48/dialog-password")
        self.iconLabel.setPixmap(editorPixmap)

        self.supportedAlgorithms = get_available_hash_methods()
        map(self.methodBox.addItem, self.supportedAlgorithms)
        self.methodBox.currentIndexChanged[str].connect(self.methodChanged)

        self.okButton.setEnabled(False)
        self.progressBar.setValue(0)

        self.asciiInput = True
        self.asciiBox.clicked.connect(self.asciiBoxClicked)
        self.hiddenBox.clicked.connect(self.hiddenBoxClicked)

        # The new password in cleartext
        self.password = None

        self.methodBox.currentIndexChanged[str].emit(
            self.methodBox.currentText())
Ejemplo n.º 18
0
    def __init__(self,
                 index,
                 currentTemplate="classic.html",
                 parent=None,
                 entryTemplate=None):
        QWidget.__init__(self, parent)

        w = 24
        h = 24
        self.entryModel = None

        # Standard pixmaps used by the widget
        self.reloadPixmap = pixmapFromTheme("view-refresh",
                                            ":/icons/32/view-refresh", w, h)
        self.savePixmap = pixmapFromTheme("document-save",
                                          ":/icons/32/document-save", w, h)
        self.addPixmap = pixmapFromTheme("list-add", ":/icons/32/list-add", w,
                                         h)
        self.deleteSmallPixmap = pixmapFromTheme("list-remove",
                                                 ":/icons/32/list-remove", w,
                                                 h)

        self.treeIndex = index

        self.setLayout(QVBoxLayout(self))
        self.layout().setSpacing(0)
        self.layout().setContentsMargins(0, 0, 0, 0)

        self.setSizePolicy(QSizePolicy.Expanding, QSizePolicy.Expanding)

        # create the widget containing the data
        self.textBrowser = QTextBrowser()
        self.textBrowser.setOpenLinks(False)
        self.textBrowser.setWordWrapMode(QTextOption.WrapAnywhere)
        self.layout().addWidget(self.textBrowser)
        self.textBrowser.anchorClicked.connect(self.anchorClicked)

        self.currentDocument = ''
        self.addingToComboBox = False

        # create the combobox containing the different views
        self.comboBox = QComboBox()
        self.currentTemplate = currentTemplate
        self.errorTemplate = "error.html"
        self.usedTemplates = []
        # FIXED: Need a more robust way for locating the path used in
        #        the TemplateFactory for locating the template view
        #        files
        # >>>    with base.util.Paths.getLumaRoot this should work.
        #        Probably needs some validation testing on platforms
        #        other than Linux
        # Another issue occured when running Luma after a installation
        # from a source distribution. Because the site-packages is only
        # intended for pure python modules, the html templates is not
        # installed, resulting in an Exception when trying to view an
        # entry in the Browser plugin. The setup.py script is modified
        # such that the needed html templates is copied into a folder
        # in the path returned by `base.util.Paths.getConfigPrefix`.
        s = QtCore.QSettings()
        configPrefix = s.value('application/config_prefix').toString()
        templatesPath = os.path.join(
            unicode(configPrefix).encode('utf-8'), 'browser-templates')
        # If we run Luma from a development environment the isntalled
        # templatesPath do most likely not exist. We therefore use the
        # directory in the repository
        if not os.path.isdir(templatesPath):
            templatesPath = unicode(
                os.path.join(getLumaRoot(), 'plugins', 'browser', 'templates'))

        self.templateFactory = TemplateFactory(templatesPath)

        self.htmlParser = HtmlParser(self.textBrowser)

        self.str_RELOAD = QtCore.QCoreApplication.translate(
            "AdvancedObjectWidget", "Reload")
        self.str_SAVE = QtCore.QCoreApplication.translate(
            "AdvancedObjectWidget", "Save entry")
        self.str_SAVE_CONTINUE = QtCore.QCoreApplication.translate(
            "AdvancedObjectWidget",
            "Do you want to save the entry before continuing?")
        self.str_SAVE_FAILED = QtCore.QCoreApplication.translate(
            "AdvancedObjectWidget", "Saving failed, continue anyway?")
        self.str_DELETE = QtCore.QCoreApplication.translate(
            "AdvancedObjectWidget", "Delete object")
        self.str_DELETE_CONFIRM = QtCore.QCoreApplication.translate(
            "AdvancedObjectWidget", "Do you really want to delete the object?")
        self.str_ADD = QtCore.QCoreApplication.translate(
            "AdvancedObjectWidget", "Add attribute")
        self.str_SWITCH_VIEWS = QtCore.QCoreApplication.translate(
            "AdvancedObjectWidget", "Switch between views")
        self.str_REASON = QtCore.QCoreApplication.translate(
            "AdvancedObjectWidget", "Reason:")
        self.str_EXPORT_BINARY = QtCore.QCoreApplication.translate(
            "AdvancedObjectWidget", "Export binary attribute to file")
        self.str_EXPORT_BINARY_EXCEPT = QtCore.QCoreApplication.translate(
            "AdvancedObjectWidget", "Could not export binary data to file.")
        self.str_SELECT_ANOTHER_FILE = QtCore.QCoreApplication.translate(
            "AdvancedObjectWidget", "Please select another filename.")
        self.str_NO_TEMPLATE = QtCore.QCoreApplication.translate(
            "AdvancedObjectWidget", "No templates available")
        self.str_MISSING_ENTRY = QtCore.QCoreApplication.translate(
            "AdvancedObjectWidget",
            "Did'nt receive a ldap-object, it might have been deleted")
        self.str_ENTRY_INVALID = QtCore.QCoreApplication.translate(
            "AdvancedObjectWidget",
            "The ldap object is not valid\nClick Yes to view the object anyway\nNo to view the errors \nIgnore to view the object and ignore this message in later attempts."
        )

        self.buildToolBar()
Ejemplo n.º 19
0
    def __init__(self, index, currentTemplate="classic.html", parent=None, entryTemplate = None):
        QWidget.__init__(self, parent)

        w = 24
        h = 24
        self.entryModel = None

        # Standard pixmaps used by the widget
        self.reloadPixmap = pixmapFromTheme(
            "view-refresh", ":/icons/32/view-refresh", w, h)
        self.savePixmap = pixmapFromTheme(
            "document-save", ":/icons/32/document-save",w, h)
        self.addPixmap = pixmapFromTheme(
            "list-add", ":/icons/32/list-add", w, h)
        self.deleteSmallPixmap = pixmapFromTheme(
            "list-remove", ":/icons/32/list-remove", w, h)

        self.treeIndex = index

        self.setLayout(QVBoxLayout(self))
        self.layout().setSpacing(0)
        self.layout().setContentsMargins(0, 0, 0, 0)

        self.setSizePolicy(QSizePolicy.Expanding, QSizePolicy.Expanding)

        # create the widget containing the data
        self.textBrowser = QTextBrowser()
        self.textBrowser.setOpenLinks(False)
        self.textBrowser.setWordWrapMode(QTextOption.WrapAnywhere)
        self.layout().addWidget(self.textBrowser)
        self.textBrowser.anchorClicked.connect(self.anchorClicked)

        self.currentDocument = ''
        self.addingToComboBox = False

        # create the combobox containing the different views
        self.comboBox = QComboBox()
        self.currentTemplate = currentTemplate
        self.errorTemplate = "error.html"
        self.usedTemplates = []
        # FIXED: Need a more robust way for locating the path used in
        #        the TemplateFactory for locating the template view
        #        files
        # >>>    with base.util.Paths.getLumaRoot this should work.
        #        Probably needs some validation testing on platforms
        #        other than Linux
        # Another issue occured when running Luma after a installation
        # from a source distribution. Because the site-packages is only
        # intended for pure python modules, the html templates is not
        # installed, resulting in an Exception when trying to view an
        # entry in the Browser plugin. The setup.py script is modified
        # such that the needed html templates is copied into a folder
        # in the path returned by `base.util.Paths.getConfigPrefix`.
        s = QtCore.QSettings()
        configPrefix = s.value('application/config_prefix').toString()
        templatesPath = os.path.join(unicode(configPrefix).encode('utf-8'),
                                     'browser-templates')
        # If we run Luma from a development environment the isntalled
        # templatesPath do most likely not exist. We therefore use the
        # directory in the repository
        if not os.path.isdir(templatesPath):
            templatesPath = unicode(
                os.path.join(
                    getLumaRoot(), 'plugins', 'browser', 'templates')
            )

        self.templateFactory = TemplateFactory(templatesPath)

        self.htmlParser = HtmlParser(self.textBrowser)

        self.str_RELOAD= QtCore.QCoreApplication.translate("AdvancedObjectWidget",
            "Reload")
        self.str_SAVE = QtCore.QCoreApplication.translate("AdvancedObjectWidget",
            "Save entry")
        self.str_SAVE_CONTINUE = QtCore.QCoreApplication.translate("AdvancedObjectWidget",
            "Do you want to save the entry before continuing?")
        self.str_SAVE_FAILED = QtCore.QCoreApplication.translate("AdvancedObjectWidget",
            "Saving failed, continue anyway?")
        self.str_DELETE = QtCore.QCoreApplication.translate("AdvancedObjectWidget",
            "Delete object")
        self.str_DELETE_CONFIRM = QtCore.QCoreApplication.translate("AdvancedObjectWidget",
            "Do you really want to delete the object?")
        self.str_ADD = QtCore.QCoreApplication.translate("AdvancedObjectWidget",
            "Add attribute")
        self.str_SWITCH_VIEWS = QtCore.QCoreApplication.translate("AdvancedObjectWidget",
            "Switch between views")
        self.str_REASON = QtCore.QCoreApplication.translate("AdvancedObjectWidget",
            "Reason:")
        self.str_EXPORT_BINARY = QtCore.QCoreApplication.translate("AdvancedObjectWidget",
            "Export binary attribute to file")
        self.str_EXPORT_BINARY_EXCEPT = QtCore.QCoreApplication.translate("AdvancedObjectWidget",
            "Could not export binary data to file.")
        self.str_SELECT_ANOTHER_FILE = QtCore.QCoreApplication.translate("AdvancedObjectWidget",
            "Please select another filename.")
        self.str_NO_TEMPLATE = QtCore.QCoreApplication.translate("AdvancedObjectWidget",
            "No templates available")
        self.str_MISSING_ENTRY = QtCore.QCoreApplication.translate("AdvancedObjectWidget",
            "Did'nt receive a ldap-object, it might have been deleted")
        self.str_ENTRY_INVALID = QtCore.QCoreApplication.translate("AdvancedObjectWidget",
            "The ldap object is not valid\nClick Yes to view the object anyway\nNo to view the errors \nIgnore to view the object and ignore this message in later attempts.")

        self.buildToolBar()
Ejemplo n.º 20
0
    def __init__(self, parent=None):
        super(SearchPlugin, self).__init__(parent)
        self.setupUi(self)
        self.setObjectName('SearchPlugin')
        self.openTabs = {}
        self.completer = None
        self.currentServer = None
        #self.connection = None
        self.resultSetCount = 0

        self.serverListObject = ServerList()
        self.serverList = self.serverListObject.getTable()

        self.searchForm = SearchForm(parent=self)
        self.filterBuilder = FilterBuilder(parent=self)

        # Icons
        searchIcon = iconFromTheme(
            'edit-find', ':/icons/32/edit-find')
        filterIcon = iconFromTheme(
            'edit-find-replace', ':/icons/32/edit-find-replace')
        secureIcon = iconFromTheme(
            'object-locked', ':/icons/16/object-locked')
        errorIcon = pixmapFromTheme(
            'dialog-error', ':/icons/48/dialog-error', 24, 24)
        undoIcon = iconFromTheme(
            'edit-undo', ':/icons/32/edit-undo')
        redoIcon = iconFromTheme(
            'edit-redo', ':/icons/32/edit-redo')
        addIcon = iconFromTheme(
            'list-add', ':/icons/32/list-add')

        self.indexSF = self.left.addTab(self.searchForm, searchIcon, '')
        self.indexFB = self.left.addTab(self.filterBuilder, filterIcon, '')

        self.searchForm.filterBuilderToolButton.setIcon(filterIcon)
        self.searchForm.errorIcon.setPixmap(errorIcon)
        self.filterBuilder.undoButton.setIcon(undoIcon)
        self.filterBuilder.redoButton.setIcon(redoIcon)
        self.filterBuilder.addSpecialCharButton.setIcon(addIcon)

        # The search plugin event filter we
        # use for acting upon various events
        eventFilter = SearchPluginEventFilter(self)
        # Install the eventFilter on desired widgets
        self.installEventFilter(eventFilter)
        self.right.installEventFilter(eventFilter)
        self.right.setUsesScrollButtons(True)

        self.__loadSettings()
        self.__connectSlots()

        # Only add text to these class and its children at this time
        self.retranslate(all=False)

        # TODO: maybe we allways want to return a list from ServerList,
        #       eliminating the 'NoneType is not iterable' exceptions.
        if not self.serverList is None:
            for server in self.serverList:
                # As documendted in the ServerObject class:
                # 0 = Unencrypted, 1 = TLS, 2 = SSL
                if server.encryptionMethod == 0:
                    self.searchForm.serverBox.addItem(server.name)
                else:
                    self.searchForm.serverBox.addItem(secureIcon, server.name)