Exemplo n.º 1
0
 def __init__(self, parent):
     QPopupMenu.__init__(self)
     self.parent = parent
     self.connect(self, SIGNAL("aboutToShow()"), self.slotScan)
     vb = QVBox(self)
     self.insertItem(vb)
     vb.setMargin(3)
     vb.setSpacing(3)
     lab = QLabel(i18n("Scan results:"), vb)
     self.view = QListView(vb)
     self.view.connect(self.view, SIGNAL("selectionChanged()"), self.slotScanSelect)
     self.view.connect(self.view, SIGNAL("doubleClicked(QListViewItem *)"), self.slotScanDouble)
     self.view.setMinimumSize(300, 120)
     self.view.addColumn("")
     self.view.addColumn("")
     self.view.addColumn("")
     self.view.addColumn("")
     self.view.addColumn("")
     self.view.setColumnAlignment(4, Qt.AlignRight)
     self.view.setResizeMode(QListView.LastColumn)
     self.view.setAllColumnsShowFocus(True)
     self.view.setShowToolTips(True)
     self.view.header().hide()
     self.package_tipper = WirelessTipper(self.view.viewport())
     self.package_tipper.list = self.view
     hb = QHBox(vb)
     hb.setSpacing(6)
     but = QPushButton(getIconSet("reload", KIcon.Small), i18n("Scan again"), hb)
     but.setFlat(1)
     self.connect(but, SIGNAL("clicked()"), self.slotScan)
     but = QPushButton(getIconSet("key_enter", KIcon.Small), i18n("Use"), hb)
     but.setFlat(1)
     self.scan_use_but = but
     self.connect(but, SIGNAL("clicked()"), self.slotScanUse)
Exemplo n.º 2
0
 def __init__(self, parent, conn, link=None, new_conn=None):
     QMainWindow.__init__(self, parent, " ", Qt.WType_Dialog)
     
     self.setCaption(i18n("Configure network connection"))
     #self.setMinimumSize(580, 380)
     
     vb = QVBox(self)
     vb.setMargin(6)
     vb.setSpacing(12)
     self.setCentralWidget(vb)
     
     if not link:
         link = comlink.links[conn.script]
     self.settings = Settings(vb, link, conn, new_conn)
     
     hb = QHBox(vb)
     hb.setSpacing(12)
     lab = QLabel("", hb)
     but = QPushButton(getIconSet("apply", KIcon.Small), i18n("Apply"), hb)
     but.setFlat(1)
     self.connect(but, SIGNAL("clicked()"), self.slotAccept)
     but = QPushButton(getIconSet("cancel", KIcon.Small), i18n("Cancel"), hb)
     but.setFlat(1)
     self.connect(but, SIGNAL("clicked()"), self.slotCancel)
     
     self.show()
Exemplo n.º 3
0
    def __init__(self, *args):
        QVBox.__init__(self, *args)
        self.setMargin(6)
        self.setSpacing(6)

        self.config = KConfig("network-appletrc")
        self.config.setGroup("General")

        bar = QToolBar("lala", None, self)

        self.butNew = QToolButton(getIconSet("add"), "", "lala",
                                  self.slotCreate, bar)
        self.butNew.setTextLabel(i18n("New connection"), False)
        self.butNew.setUsesTextLabel(True)
        self.butNew.setTextPosition(self.butNew.BesideIcon)

        self.butConf = QToolButton(getIconSet("configure"), "", "lala",
                                   self.slotSettings, bar)
        self.butConf.setTextLabel(i18n("Name Service Settings"), False)
        self.butConf.setUsesTextLabel(True)
        self.butConf.setTextPosition(self.butConf.BesideIcon)

        self.butAutoConnect = QToolButton(getIconSet("connect_creating"), "",
                                          "lala", self.slotAutoConnect, bar)
        self.butAutoConnect.setTextLabel(i18n("Connect Automatically"), False)
        self.butAutoConnect.setUsesTextLabel(True)
        self.butAutoConnect.setTextPosition(self.butAutoConnect.BesideIcon)

        self.helpwin = None
        self.newconnwin = None

        lab = QToolButton(bar)
        lab.setEnabled(False)
        bar.setStretchableWidget(lab)

        but = QToolButton(getIconSet("help"), "", "lala", self.slotHelp, bar)
        but.setTextLabel(i18n("Help"), False)
        but.setUsesTextLabel(True)
        but.setTextPosition(but.BesideIcon)

        self.view = ConnectionView(self)

        self.stack = nameconf.Window(self)
        self.autoCheck = QCheckBox(i18n("Try Auto Connect on startup"), self)
        self.connect(self.autoCheck, SIGNAL('clicked()'), self.setAutoConnect)
        self.autoCheck.setOn(self.config.readBoolEntry("AutoConnect", True))
        self.autoSwitch = autoswitch.autoSwitch(comlink, notifier=False)

        comlink.new_hook.append(self.view.add)
        comlink.delete_hook.append(self.view.remove)
        comlink.nowifi_hook.append(self.disableAutoConnectButtons)
        comlink.config_hook.append(self.view.configUpdate)
        comlink.state_hook.append(self.view.stateUpdate)
        comlink.hotplug_hook.append(self.view.hotPlug)
        comlink.noconn_hook.append(self.slotCreate)

        comlink.window = self

        for script in comlink.links:
            comlink.queryConnections(script)
Exemplo n.º 4
0
 def fillLabels(self):
     self.setCaption(i18n("Create a new connection"))
     self.deviceLabel.setText(i18n("Select device:"))
     self.createBut.setIconSet(getIconSet("add", KIcon.Small))
     self.createBut.setText(i18n("Create"))
     self.cancelBut.setIconSet(getIconSet("cancel", KIcon.Small))
     self.cancelBut.setText(i18n("Cancel"))
Exemplo n.º 5
0
 def __init__(self, *args):
     QVBox.__init__(self, *args)
     self.setMargin(6)
     self.setSpacing(6)
     
     bar = QToolBar("lala", None, self)
     
     but = QToolButton(getIconSet("add.png"), i18n("New connection"), "lala", self.slotCreate, bar)
     but.setUsesTextLabel(True)
     but.setTextPosition(but.BesideIcon)
     
     but = QToolButton(getIconSet("configure.png"), i18n("Name Service Settings"), "lala", self.slotSettings, bar)
     but.setUsesTextLabel(True)
     but.setTextPosition(but.BesideIcon)
     
     bar.addSeparator()
     
     but = QToolButton(getIconSet("help.png"), i18n("Help"), "lala", self.slotHelp, bar)
     but.setUsesTextLabel(True)
     but.setTextPosition(but.BesideIcon)
     
     self.view = ConnectionView(self)
     
     self.stack = nameconf.Window(self)
     
     comlink.new_hook.append(self.view.add)
     comlink.delete_hook.append(self.view.remove)
     comlink.state_hook.append(self.view.stateUpdate)
     comlink.hotplug_hook.append(self.view.hotPlug)
     comlink.noconn_hook.append(self.slotCreate)
     comlink.connect()
Exemplo n.º 6
0
 def __init__(self, parent):
     QPopupMenu.__init__(self)
     self.parent = parent
     self.connect(self, SIGNAL("aboutToShow()"), self.slotScan)
     vb = QVBox(self)
     self.insertItem(vb)
     vb.setMargin(3)
     vb.setSpacing(3)
     lab = QLabel(i18n("Scan results:"), vb)
     self.view = QListView(vb)
     self.view.connect(self.view, SIGNAL("selectionChanged()"), self.slotScanSelect)
     self.view.connect(self.view, SIGNAL("doubleClicked(QListViewItem *)"), self.slotScanDouble)
     self.view.setMinimumSize(300, 120)
     self.view.addColumn("")
     self.view.addColumn("")
     self.view.addColumn("")
     self.view.addColumn("")
     self.view.addColumn("")
     self.view.setColumnAlignment(4, Qt.AlignRight)
     self.view.setResizeMode(QListView.LastColumn)
     self.view.setAllColumnsShowFocus(True)
     self.view.setShowToolTips(True)
     self.view.header().hide()
     self.package_tipper = WirelessTipper(self.view.viewport())
     self.package_tipper.list = self.view
     hb = QHBox(vb)
     hb.setSpacing(6)
     but = QPushButton(getIconSet("reload", KIcon.Small), i18n("Scan again"), hb)
     self.connect(but, SIGNAL("clicked()"), self.slotScan)
     but = QPushButton(getIconSet("key_enter", KIcon.Small), i18n("Use"), hb)
     self.scan_use_but = but
     self.connect(but, SIGNAL("clicked()"), self.slotScanUse)
Exemplo n.º 7
0
    def __init__(self, parent, conn, link=None, new_conn=None):
        QMainWindow.__init__(self, parent, " ", Qt.WType_Dialog)

        self.setCaption(i18n("Configure network connection"))
        #self.setMinimumSize(580, 380)

        vb = QVBox(self)
        vb.setMargin(6)
        vb.setSpacing(12)
        self.setCentralWidget(vb)

        if not link:
            link = comlink.links[conn.script]
        self.settings = Settings(vb, link, conn, new_conn)

        hb = QHBox(vb)
        hb.setSpacing(12)
        lab = QLabel("", hb)
        but = QPushButton(getIconSet("apply", KIcon.Small), i18n("Apply"), hb)
        self.connect(but, SIGNAL("clicked()"), self.slotAccept)
        but = QPushButton(getIconSet("cancel", KIcon.Small), i18n("Cancel"),
                          hb)
        self.connect(but, SIGNAL("clicked()"), self.slotCancel)

        self.show()
Exemplo n.º 8
0
 def __init__(self, parent, data):
     QListViewItem.__init__(self, parent)
     self.info = {}
     
     if not data:
         self.setPixmap(0, getIconSet("remove", KIcon.Small).pixmap(QIconSet.Automatic, QIconSet.Normal))
         self.setText(1, "")
         self.setText(2, i18n("No remotes found"))
         return
     
     for key, value in data.iteritems():
         self.info[key] = value
     
     enc = self.info.get("encryption", "none")
     if enc != "none":
         self.setPixmap(0, getIconSet("kgpg_key1", KIcon.Small).pixmap(QIconSet.Automatic, QIconSet.Normal))
     self.enc = enc
     
     qual = self.info.get("quality", "0")
     try:
         qual = int(qual)
     except:
         qual = 0
     self.setPixmap(1, self.signalIcon(qual))
     
     remote = self.info["remote"]
     if remote == "<hidden>" or remote == "":
         remote = i18n("<hidden>")
     self.remote = remote
     self.setText(2, remote)
     
     self.mac = self.info.get("mac", None)
     if self.mac:
         self.setText(3, self.mac)
Exemplo n.º 9
0
 def fillLabels(self):
     self.setCaption(i18n("Internet Connection Sharing"))
     self.sharecheckBox.setText(i18n("Share Internet Connection"))
     self.textLabel1.setText(i18n("Interface that goes to internet"))
     self.textLabel2.setText(i18n("Interface that will share connection"))
     self.applyBut.setText(i18n("Apply"))
     self.applyBut.setIconSet(getIconSet("apply", KIcon.Small))
     self.cancelBut.setText(i18n("Close"))
     self.cancelBut.setIconSet(getIconSet("cancel", KIcon.Small))
Exemplo n.º 10
0
    def __init__(self, *args):
        QVBox.__init__(self, *args)
        self.setMargin(6)
        self.setSpacing(6)
        
        self.config = KConfig("network-appletrc")
        self.config.setGroup("General")
        
        bar = QToolBar("lala", None, self)
        
        self.butNew = QToolButton(getIconSet("add"), "", "lala", self.slotCreate, bar)
        self.butNew.setTextLabel(i18n("New connection"), False)
        self.butNew.setUsesTextLabel(True)
        self.butNew.setTextPosition(self.butNew.BesideIcon)
        
        self.butConf = QToolButton(getIconSet("configure"), "", "lala", self.slotSettings, bar)
        self.butConf.setTextLabel(i18n("Name Service Settings"), False)
        self.butConf.setUsesTextLabel(True)
        self.butConf.setTextPosition(self.butConf.BesideIcon)
        
        self.butAutoConnect = QToolButton(getIconSet("connect_creating"), "", "lala", self.slotAutoConnect, bar)
        self.butAutoConnect.setTextLabel(i18n("Connect Automatically"), False)
        self.butAutoConnect.setUsesTextLabel(True)
        self.butAutoConnect.setTextPosition(self.butAutoConnect.BesideIcon)

        self.helpwin = None
        self.newconnwin = None
        
        lab = QToolButton(bar)
        lab.setEnabled(False)
        bar.setStretchableWidget(lab)
        
        but = QToolButton(getIconSet("help"), "", "lala", self.slotHelp, bar)
        but.setTextLabel(i18n("Help"), False)
        but.setUsesTextLabel(True)
        but.setTextPosition(but.BesideIcon)
        
        self.view = ConnectionView(self)
        
        self.stack = nameconf.Window(self)
        self.autoCheck = QCheckBox(i18n("Try Auto Connect on startup"),self)
        self.connect(self.autoCheck, SIGNAL('clicked()'),self.setAutoConnect)
        self.autoCheck.setOn(self.config.readBoolEntry("AutoConnect",True))
        self.autoSwitch = autoswitch.autoSwitch(comlink, notifier=False)
        
        comlink.new_hook.append(self.view.add)
        comlink.delete_hook.append(self.view.remove)
        comlink.nowifi_hook.append(self.disableAutoConnectButtons)
        comlink.config_hook.append(self.view.configUpdate)
        comlink.state_hook.append(self.view.stateUpdate)
        comlink.hotplug_hook.append(self.view.hotPlug)
        comlink.noconn_hook.append(self.slotCreate)

        comlink.window = self
        
        for script in comlink.links:
            comlink.queryConnections(script)
Exemplo n.º 11
0
    def __init__(self, parent):
        QDialog.__init__(self, parent)
        self.setMinimumSize(340, 340)
        self.resize(340, 340)
        self.setCaption(i18n("Create a new connection"))
        vb = QVBoxLayout(self)
        vb.setSpacing(6)
        vb.setMargin(12)

        lab = QLabel(i18n("Select device:"), self)
        vb.addWidget(lab)

        self.links = QListView(self)
        self.connect(
            self.links,
            SIGNAL("doubleClicked(QListViewItem *, const QPoint &, int)"),
            self.slotDouble)
        self.connect(self.links, SIGNAL("selectionChanged()"),
                     self.slotSelection)
        self.connect(self.links, SIGNAL("collapsed(QListViewItem *)"),
                     self.slotCollapse)
        self.links.setAllColumnsShowFocus(True)
        vb.addWidget(self.links)
        self.links.addColumn("")
        self.links.addColumn("")
        self.links.header().hide()
        links = comlink.links.values()
        links.sort(key=lambda x: x.name)

        comlink.device_hook.append(self.slotDevices)
        for link in links:
            item = QListViewItem(self.links)
            item.setSelectable(False)
            item.setPixmap(0, icons.get_state(link.type, "up"))
            item.setText(1, unicode(link.name))
            item.setText(2, link.script)
            item.setOpen(True)
            comlink.queryDevices(link.script)

        hb = QHBox(self)
        hb.setSpacing(6)
        but = QPushButton(getIconSet("add", KIcon.Small), i18n("Create"), hb)
        but.setEnabled(False)
        self.connect(but, SIGNAL("clicked()"), self.accept)
        but.setDefault(True)
        self.but = but

        but = QPushButton(
            getIconSet("cancel", KIcon.Small), i18n("Cancel"), hb)
        self.connect(but, SIGNAL("clicked()"), self.reject)

        vb.addWidget(hb)
        self.show()
Exemplo n.º 12
0
 def __init__(self, parent):
     QMainWindow.__init__(self, parent)
     
     self.old_host = None
     self.old_dns = None
     
     self.setCaption(i18n("Name Service Settings"))
     self.setMinimumSize(280, 320)
     
     vb = QVBox(self)
     vb.setMargin(6)
     vb.setSpacing(6)
     self.setCentralWidget(vb)
     
     widgets.HLine(i18n("Computer"), vb)
     
     hb = QHBox(vb)
     hb.setSpacing(6)
     QLabel(i18n("Host name:"), hb)
     self.host = widgets.Edit(hb)
     
     widgets.HLine(i18n("Name servers"), vb)
     
     vb2 = QVBox(vb)
     vb2.setSpacing(3)
     
     self.dns = QListBox(vb2)
     
     hb = QHBox(vb2)
     hb.setSpacing(3)
     but = QPushButton(getIconSet("add.png", KIcon.Small), i18n("Add"), hb)
     self.connect(but, SIGNAL("clicked()"), self.slotAdd)
     but = QPushButton(getIconSet("remove.png", KIcon.Small), i18n("Remove"), hb)
     self.connect(but, SIGNAL("clicked()"), self.slotRemove)
     
     hb = QWidget(vb)
     lay = QHBoxLayout(hb)
     lay.setMargin(3)
     lay.setSpacing(12)
     lay.addStretch(1)
     but = QPushButton(getIconSet("apply.png", KIcon.Small), i18n("Apply"), hb)
     self.connect(but, SIGNAL("clicked()"), self.slotApply)
     lay.addWidget(but)
     but = QPushButton(getIconSet("cancel.png", KIcon.Small), i18n("Cancel"), hb)
     self.connect(but, SIGNAL("clicked()"), self.slotCancel)
     lay.addWidget(but)
     
     comlink.name_hook.append(self.slotName)
Exemplo n.º 13
0
 def __init__(self, parent, data):
     QListViewItem.__init__(self, parent)
     self.info = {}
     for param in data.split("\t"):
         key, value = param.split("=", 1)
         self.info[key] = value
     
     enc = self.info.get("encryption", "none")
     if enc != "none":
         self.setPixmap(0, getIconSet("kgpg_key1", KIcon.Small).pixmap(QIconSet.Automatic, QIconSet.Normal))
     self.enc = enc
     
     qual = self.info.get("quality", "0")
     try:
         qual = int(qual)
     except:
         qual = 0
     self.setPixmap(1, self.signalIcon(qual))
     
     remote = self.info["remote"]
     if remote == "<hidden>" or remote == "":
         remote = i18n("<hidden>")
     self.remote = remote
     self.setText(2, remote)
     
     mac = self.info.get("mac", None)
     if mac:
         self.setText(3, mac)
Exemplo n.º 14
0
 def __init__(self, name, parent):
     QPushButton.__init__(self, parent)
     self.setFlat(True)
     self.myset = getIconSet(name, KIcon.Small)
     self.setIconSet(self.myset)
     size = self.myset.iconSize(QIconSet.Small)
     self.myWidth = size.width() + 4
     self.myHeight = size.height() + 4
     self.resize(self.myWidth, self.myHeight)
Exemplo n.º 15
0
 def __init__(self, name, parent):
     QPushButton.__init__(self, parent)
     self.setFlat(True)
     self.myset = getIconSet(name, KIcon.Small)
     self.setIconSet(self.myset)
     size = self.myset.iconSize(QIconSet.Small)
     self.myWidth = size.width() + 4
     self.myHeight = size.height() + 4
     self.resize(self.myWidth, self.myHeight)
Exemplo n.º 16
0
    def __init__(self, parent, data):
        QListViewItem.__init__(self, parent)
        self.info = {}

        if not data:
            self.setPixmap(
                0,
                getIconSet("remove",
                           KIcon.Small).pixmap(QIconSet.Automatic,
                                               QIconSet.Normal))
            self.setText(1, "")
            self.setText(2, i18n("No remotes found"))
            return

        for key, value in data.iteritems():
            self.info[key] = value

        enc = self.info.get("encryption", "none")
        if enc != "none":
            self.setPixmap(
                0,
                getIconSet("kgpg_key1",
                           KIcon.Small).pixmap(QIconSet.Automatic,
                                               QIconSet.Normal))
        self.enc = enc

        qual = self.info.get("quality", "0")
        try:
            qual = int(qual)
        except:
            qual = 0
        self.setPixmap(1, self.signalIcon(qual))

        remote = self.info["remote"]
        if remote == "<hidden>" or remote == "":
            remote = i18n("<hidden>")
        self.remote = remote
        self.setText(2, remote)

        self.mac = self.info.get("mac", None)
        if self.mac:
            self.setText(3, self.mac)
Exemplo n.º 17
0
 def initScan(self):
     pop = QPopupMenu()
     self.connect(pop, SIGNAL("aboutToShow()"), self.slotScan)
     vb = QVBox(pop)
     pop.insertItem(vb)
     vb.setMargin(3)
     vb.setSpacing(3)
     lab = QLabel(i18n("Scan results:"), vb)
     box = QListBox(vb)
     box.connect(box, SIGNAL("selectionChanged()"), self.slotScanSelect)
     box.connect(box, SIGNAL("selected(QListBoxItem *)"), self.slotScanDouble)
     box.setMinimumSize(260, 110)
     self.scan_box = box
     hb = QHBox(vb)
     hb.setSpacing(6)
     but = QPushButton(getIconSet("reload.png", KIcon.Small), i18n("Scan again"), hb)
     self.connect(but, SIGNAL("clicked()"), self.slotScan)
     but = QPushButton(getIconSet("key_enter.png", KIcon.Small), i18n("Use"), hb)
     self.scan_use_but = but
     self.connect(but, SIGNAL("clicked()"), self.slotScanUse)
     return pop
Exemplo n.º 18
0
 def __init__(self, *args):
     QVBox.__init__(self, *args)
     self.setMargin(6)
     self.setSpacing(6)
     
     bar = QToolBar("lala", None, self)
     
     self.butNew = QToolButton(getIconSet("add"), "", "lala", self.slotCreate, bar)
     self.butNew.setTextLabel(i18n("New connection"), False)
     self.butNew.setUsesTextLabel(True)
     self.butNew.setTextPosition(self.butNew.BesideIcon)
     
     self.butConf = QToolButton(getIconSet("configure"), "", "lala", self.slotSettings, bar)
     self.butConf.setTextLabel(i18n("Name Service Settings"), False)
     self.butConf.setUsesTextLabel(True)
     self.butConf.setTextPosition(self.butConf.BesideIcon)
     
     lab = QToolButton(bar)
     lab.setEnabled(False)
     bar.setStretchableWidget(lab)
     
     but = QToolButton(getIconSet("help"), "", "lala", self.slotHelp, bar)
     but.setTextLabel(i18n("Help"), False)
     but.setUsesTextLabel(True)
     but.setTextPosition(but.BesideIcon)
     
     self.view = ConnectionView(self)
     
     self.stack = nameconf.Window(self)
     
     comlink.new_hook.append(self.view.add)
     comlink.delete_hook.append(self.view.remove)
     comlink.config_hook.append(self.view.configUpdate)
     comlink.state_hook.append(self.view.stateUpdate)
     comlink.hotplug_hook.append(self.view.hotPlug)
     comlink.noconn_hook.append(self.slotCreate)
     comlink.connect()
     
     comlink.denied_hook.append(self.setInterface)
     comlink.checkAccess("setConnection")
Exemplo n.º 19
0
 def fillLabels(self):
     self.setCaption(i18n("Configure network connection"))
     self.connectionGroupBox.setTitle(i18n("Connection"))
     self.addressGroupBox.setTitle(i18n("Address Settings"))
     self.dnsGroupBox.setTitle(i18n("Name Server Settings"))
     self.nameLabel.setText(i18n("Name"))
     self.deviceLabel.setText(i18n("Device"))
     self.devices_but.setText(i18n("Select"))
     self.ssidLabel.setText(unicode(self.link.remote_name))
     self.r1.setText(i18n("Automatic query (DHCP)"))
     self.r2.setText(i18n("Manual"))
     self.addressLabel.setText(i18n("Address :"))
     self.auto_addr.setText(i18n("Custom"))
     self.netmaskLabel.setText(i18n("Net mask :"))
     self.gatewayLabel.setText(i18n("Gateway :"))
     self.auto_gate.setText(i18n("Custom"))
     self.dns1.setText(i18n("Default"))
     self.dns2.setText(i18n("Automatic"))
     self.dns3.setText(i18n("Custom"))
     self.security_mode_label.setText(i18n("Security"))
     self.auth_private_key_label.setText(i18n("Private Key File :"))
     self.auth_private_key_pass_label.setText(i18n("Private Key Password :"******"CA Certificate :"))
     self.auth_client_cert_label.setText(i18n("Client Certificate :"))
     self.auth_passphrase_label.setText(i18n("Password :"******"User/Identity :"))
     self.auth_anon_id_label.setText(i18n("Anonymous User :"******"Inner Authentication"))
     self.auth_mode_label.setText(i18n("Authentication"))
     self.auth_client_cert_but.setText(i18n("browse"))
     self.auth_client_cert_but.setIconSet(getIconSet("file", KIcon.Small))
     self.auth_ca_cert_but.setText(i18n("browse"))
     self.auth_ca_cert_but.setIconSet(getIconSet("file", KIcon.Small))
     self.auth_private_key_but.setText(i18n("browse"))
     self.auth_private_key_but.setIconSet(getIconSet("file", KIcon.Small))
     self.applyBut.setIconSet(getIconSet("apply", KIcon.Small))
     self.applyBut.setText(i18n("Apply"))
     self.cancelBut.setIconSet(getIconSet("cancel", KIcon.Small))
     self.cancelBut.setText(i18n("Cancel"))
Exemplo n.º 20
0
    def signalIcon(self, signal):
        # FIXME: make this more pythonic
        num = 0
        if signal >= 80:
            num = 4
        elif signal >= 60:
            num = 3
        elif signal >= 40:
            num = 2
        elif signal >= 20:
            num = 1

        iconSet = getIconSet(locate("data", "network-manager/signal_%d.png" % num), KIcon.Small)
        return iconSet.pixmap(QIconSet.Automatic, QIconSet.Normal)
Exemplo n.º 21
0
 def signalIcon(self, signal):
     # FIXME: make this more pythonic
     num = 0
     if signal >= 80:
         num = 4
     elif signal >= 60:
         num = 3
     elif signal >= 40:
         num = 2
     elif signal >= 20:
         num = 1
     
     iconSet = getIconSet(locate("data", "network-manager/signal_%d.png" % num), KIcon.Small)
     return iconSet.pixmap(QIconSet.Automatic, QIconSet.Normal)
Exemplo n.º 22
0
 def __init__(self, *args):
     QVBox.__init__(self, *args)
     self.setMargin(6)
     self.setSpacing(6)
     
     bar = QToolBar("lala", None, self)
     
     but = QToolButton(getIconSet("add.png"), i18n("New connection"), "lala", self.slotCreate, bar)
     but.setUsesTextLabel(True)
     but.setTextPosition(but.BesideIcon)
     bar.addSeparator()
     
     but = QToolButton(getIconSet("configure.png"), i18n("Name Service Settings"), "lala", self.slotSettings, bar)
     but.setUsesTextLabel(True)
     but.setTextPosition(but.BesideIcon)
     bar.addSeparator()
     
     but = QToolButton(getIconSet("help.png"), i18n("Help"), "lala", self.slotHelp, bar)
     but.setUsesTextLabel(True)
     but.setTextPosition(but.BesideIcon)
     
     self.comar = comar.Link()
     
     self.view = ConnectionView(self, self.comar)
     
     self.stack = stack.Window(self, self.comar)
     links.query(self.comar)
     
     self.comar.ask_notify("Net.Link.stateChanged")
     self.comar.ask_notify("Net.Link.connectionChanged")
     self.comar.ask_notify("Net.Link.deviceChanged")
     
     self.comar.call("Net.Link.connections", id=1)
     
     self.notifier = QSocketNotifier(self.comar.sock.fileno(), QSocketNotifier.Read)
     self.connect(self.notifier, SIGNAL("activated(int)"), self.slotComar)
Exemplo n.º 23
0
 def __init__(self, title, parent, pixmap=None):
     QHBox.__init__(self, parent)
     self.setSizePolicy(QSizePolicy.Minimum, QSizePolicy.Minimum)
     self.setSpacing(6)
     
     line = QFrame(self)
     line.setFrameStyle(line.HLine | line.Sunken)
     line.setFixedWidth(24)
     
     if pixmap:
         gfx = QLabel(self)
         gfx.setPixmap(getIconSet(pixmap).pixmap(QIconSet.Small, QIconSet.Normal))
     text = QLabel(unicode(title), self)
     
     line = QFrame(self)
     line.setFrameStyle(line.HLine | line.Sunken)
     self.setStretchFactor(line, 8)
Exemplo n.º 24
0
 def __init__(self, title, parent, pixmap=None):
     QHBox.__init__(self, parent)
     self.setSizePolicy(QSizePolicy.Minimum, QSizePolicy.Minimum)
     self.setSpacing(6)
     
     line = QFrame(self)
     line.setFrameStyle(line.HLine | line.Sunken)
     line.setFixedWidth(24)
     
     if pixmap:
         gfx = QLabel(self)
         gfx.setPixmap(getIconSet(pixmap).pixmap(QIconSet.Small, QIconSet.Normal))
     text = QLabel(unicode(title), self)
     
     line = QFrame(self)
     line.setFrameStyle(line.HLine | line.Sunken)
     self.setStretchFactor(line, 8)
Exemplo n.º 25
0
def main():
    global kapp

    about = AboutData()
    KCmdLineArgs.init(sys.argv, about)
    KCmdLineArgs.addCmdLineOptions ([("auto-connect", I18N_NOOP("Just try to connect automatically"))])
    KUniqueApplication.addCmdLineOptions()

    """
    args = KCmdLineArgs.parsedArgs()

    if args.isSet("auto-connect"):
        # Import module after setting DBus mainloop
        # This module makes async. calls on startup
        import autoswitch
        autoSwitch = autoswitch.autoSwitch(notifier = False)
        autoSwitch.scanAndConnect(force=True)
        sys.exit()
    """

    if not KUniqueApplication.start():
        print i18n("Network manager module is already started!")
        return

    kapp = KUniqueApplication(True, True, True)
    win = QDialog()

    DBusQtMainLoop(set_as_default=True)

    # PolicyKit Agent requires window ID
    from comariface import comlink
    comlink.winID = win.winId()

    win.setCaption(i18n("Network Manager"))
    win.setMinimumSize(500, 440)
    win.resize(620, 440)
    attachMainWidget(win)
    win.setIcon(getIconSet("network").pixmap(QIconSet.Small, QIconSet.Normal))
    kapp.setMainWidget(win)
    sys.exit(win.exec_loop())
Exemplo n.º 26
0
    def fillLabels(self):
        self.setCaption(i18n("Name Service Settings"))
        self.hostNameLabel.setText(i18n("Host name:"))
        self.nameServLabel.setText(i18n("Name servers"))

        self.b1.setIconSet(getIconSet("up", KIcon.Small))
        self.b1.setText(i18n("Up"))
        self.b2.setIconSet(getIconSet("down", KIcon.Small))
        self.b2.setText(i18n("Down"))
        self.b3.setIconSet(getIconSet("remove", KIcon.Small))
        self.b3.setText(i18n("Remove"))
        self.b4.setIconSet(getIconSet("add", KIcon.Small))
        self.b4.setText(i18n("Add"))
        self.applyBut.setIconSet(getIconSet("apply", KIcon.Small))
        self.applyBut.setText(i18n("Apply"))
        self.cancelBut.setIconSet(getIconSet("cancel", KIcon.Small))
        self.cancelBut.setText(i18n("Cancel"))
Exemplo n.º 27
0
 def __init__(self, parent, link, conn, new_conn=None):
     QWidget.__init__(self, parent)
     
     self.link = link
     self.conn = conn
     self.new_conn = new_conn
     
     lay = QVBoxLayout(self, 3, 3)
     
     # Identification
     grid = QGridLayout(1, 2, 6)
     lay.addLayout(grid)
     lab = QLabel(i18n("Connection name:"), self)
     grid.addWidget(lab, 0, 0, Qt.AlignRight)
     self.name = widgets.Edit(self)
     self.name.edit.setMaxLength(48)
     grid.addWidget(self.name, 0, 1)
     
     # Connection
     line = widgets.HLine(i18n("Connection"), self, "irkick.png")
     lay.addSpacing(6)
     lay.addWidget(line)
     grid = QGridLayout(2, 2)
     lay.addLayout(grid)
     
     lab = QLabel(i18n("Device:"), self)
     grid.addWidget(lab, 0, 0, Qt.AlignRight)
     hb = QHBox(self)
     hb.setSpacing(3)
     self.device = KActiveLabel("", hb)
     self.devices_but = QPushButton(i18n("Select"), hb)
     self.devices_but.setEnabled(False)
     self.devices = QPopupMenu()
     self.connect(self.devices, SIGNAL("activated(int)"), self.slotDeviceSelect)
     self.devices_but.setPopup(self.devices)
     grid.addWidget(hb, 0, 1)
     
     if "remote" in link.modes:
         lab = QLabel(unicode(link.remote_name), self)
         grid.addWidget(lab, 1, 0, Qt.AlignRight)
         if "scan" in link.modes:
             hb = QHBox(self)
             hb.setSpacing(3)
             self.remote = QLineEdit(hb)
             but = QPushButton(getIconSet("find.png", KIcon.Small), i18n("Scan"), hb)
             self.scanpop = self.initScan()
             but.setPopup(self.scanpop)
             grid.addWidget(hb, 1, 1)
         else:
             self.remote = QLineEdit(self)
             grid.addWidget(self.remote, 1, 1)
     
     # Authentication
     if "auth" in link.modes:
         line = widgets.HLine(i18n("Authentication"), self, "kgpg_key1.png")
         lay.addSpacing(12)
         lay.addWidget(line)
         grid = QGridLayout(3, 2)
         lay.addLayout(grid)
         
         lab = QLabel(i18n("Mode:"), self)
         grid.addWidget(lab, 0, 0, Qt.AlignRight)
         
         self.auth_mode = QComboBox(False, self)
         self.connect(self.auth_mode, SIGNAL("activated(int)"), self.slotAuthToggle)
         grid.addWidget(self.auth_mode, 0, 1)
         grid.setColStretch(2, 2)
         
         self.auth_mode.insertItem(i18n("No authentication"))
         flag = 0
         for mode in link.auth_modes:
             self.auth_mode.insertItem(mode.name)
             if mode.type == "login":
                 flag = 1
         
         self.auth_stack = QWidgetStack(self)
         if flag == 1:
             grid.addMultiCellWidget(self.auth_stack, 0, 1, 2, 2)
         else:
             grid.addWidget(self.auth_stack, 0, 2)
         
         lab = QLabel("", self)
         self.auth_stack.addWidget(lab, 0)
         
         hb = QHBox(self)
         hb.setSpacing(6)
         QLabel(i18n("Password:"******"User name:"), w), 0, 0, Qt.AlignRight)
             self.auth_user = QLineEdit(w)
             grid3.addWidget(self.auth_user, 0, 1)
             grid3.addWidget(QLabel(i18n("Password:"******"net" in link.modes:
         self.initNet(lay)
     
     self.setValues()
     
     comlink.device_hook.append(self.slotDevices)
     comlink.remote_hook.append(self.slotRemotes)
     comlink.queryDevices(link.script)
Exemplo n.º 28
0
    def __init__(self, parent, link, conn, new_conn=None):
        QWidget.__init__(self, parent)
        
        self.scanpop = None
        self.link = link
        self.conn = conn
        self.new_conn = new_conn
        
        self.apmac = ''
        lay = QVBoxLayout(self, 3, 3)
        
        # Identification
        grid = QGridLayout(1, 2, 6)
        lay.addLayout(grid)
        lab = QLabel(i18n("Connection name:"), self)
        grid.addWidget(lab, 0, 0, Qt.AlignRight)
        self.name = widgets.Edit(self)
        self.name.edit.setMaxLength(48)
        grid.addWidget(self.name, 0, 1)
        
        # Connection
        line = widgets.HLine(i18n("Connection"), self, "irkick")
        lay.addSpacing(6)
        lay.addWidget(line)
        grid = QGridLayout(2, 2)
        lay.addLayout(grid)
        
        lab = QLabel(i18n("Device:"), self)
        grid.addWidget(lab, 0, 0, Qt.AlignRight)
        hb = QHBox(self)
        hb.setSpacing(3)
        self.device = KActiveLabel("", hb)
        self.devices_but = QPushButton(i18n("Select"), hb)
        self.devices_but.setEnabled(False)
        self.devices = QPopupMenu()
        self.connect(self.devices, SIGNAL("activated(int)"), self.slotDeviceSelect)
        self.devices_but.setPopup(self.devices)
        grid.addWidget(hb, 0, 1)

        if "remote" in link.modes:
            lab = QLabel(unicode(link.remote_name), self)
            grid.addWidget(lab, 1, 0, Qt.AlignRight)
            if "scan" in link.modes:
                hb = QHBox(self)
                hb.setSpacing(3)
                self.remote = QLineEdit(hb)
                but = QPushButton(getIconSet("find", KIcon.Small), i18n("Scan"), hb)
                self.scanpop = Scanner(self)
                comlink.remote_hook.append(self.scanpop.slotRemotes)
                but.setPopup(self.scanpop)
                grid.addWidget(hb, 1, 1)
            else:
                self.remote = QLineEdit(self)
                grid.addWidget(self.remote, 1, 1)
        
        if "vpn" in link.modes:
            line = widgets.HLine(i18n("VPN Authentication"), self, "vpn_icon")
            lay.addSpacing(6)
            lay.addWidget(line)
            grid2 = QGridLayout(7, 2, 6)
            lay.addLayout(grid2)
            
            lab = QLabel(i18n("Domain:"), self)
            grid2.addWidget(lab, 0, 0, Qt.AlignRight)
            self.domain = QLineEdit(self)
            grid2.addWidget(self.domain, 0, 1)
            
            lab = QLabel(i18n("Port:"), self)
            grid2.addWidget(lab, 1, 0, Qt.AlignRight)
            self.port = QLineEdit(self)
            grid2.addWidget(self.port, 1, 1)

            lab = QLabel(i18n("Protocol:"),self)
            grid2.addWidget(lab, 2, 0, Qt.AlignRight)
            self.protocol = QComboBox(0, self, "TCP")
            self.protocol.insertItem("TCP")
            self.protocol.insertItem("UDP")
            grid2.addWidget(self.protocol, 2, 1)
            grid2.setSpacing(7)

            lab = QLabel(i18n("Cryptographic Chipher:"),self)
            grid2.addWidget(lab, 3, 0, Qt.AlignRight)
            self.chipher = QComboBox(0, self, "None")
            self.chipher.insertItem("-")
            self.chipher.insertItem("BF-CBC")
            self.chipher.insertItem("AES-128-CBC")
            self.chipher.insertItem("DES-EDE3-CBC")
            grid2.addWidget(self.chipher, 3, 1)
            grid2.setColStretch(2,2)
            grid2.setSpacing(7)

            lab = QLabel(i18n("CA Certificate:"), self)
            grid2.addWidget(lab, 4, 0, Qt.AlignRight)

            hb = QHBox(self)
            self.lab2 = KActiveLabel("", hb)
            self.file_but = QPushButton(i18n("Select .ca File"), hb)
            self.file_but.setEnabled(True)
            self.ca = ""
            self.connect(self.file_but, SIGNAL("clicked()"), lambda: self.getFileName(1))
            grid2.addWidget(hb, 4, 1)
            
            lab = QLabel(i18n("Cert Certificate:"), self)
            grid2.addWidget(lab, 5, 0, Qt.AlignRight)

            hb = QHBox(self)
            self.lab3 = KActiveLabel("", hb)
            self.file_but2 = QPushButton(i18n("Select .crt File"), hb)
            self.file_but2.setEnabled(True)
            self.cert = ""
            self.connect(self.file_but2, SIGNAL("clicked()"), lambda: self.getFileName(2))
            grid2.addWidget(hb, 5, 1)


            lab = QLabel(i18n("Key:"), self)
            grid2.addWidget(lab, 6, 0, Qt.AlignRight)
            hb = QHBox(self)
            self.lab4 = KActiveLabel("", hb)
            self.file_but3 = QPushButton(i18n("Select .key File"), hb)
            self.file_but3.setEnabled(True)
            self.key = ""
            self.connect(self.file_but3, SIGNAL("clicked()"), lambda: self.getFileName(3))
            grid2.addWidget(hb, 6, 1)


        # Authentication
        if "auth" in link.modes:
            line = widgets.HLine(i18n("Authentication"), self, "kgpg_key1")
            lay.addSpacing(6)
            lay.addWidget(line)
            grid = QGridLayout(3, 2)
            lay.addLayout(grid)
            
            lab = QLabel(i18n("Mode:"), self)
            grid.addWidget(lab, 0, 0, Qt.AlignRight)
            
            self.auth_mode = QComboBox(False, self)
            self.connect(self.auth_mode, SIGNAL("activated(int)"), self.slotAuthToggle)
            grid.addWidget(self.auth_mode, 0, 1)
            grid.setColStretch(2, 2)
            
            self.auth_mode.insertItem(i18n("No authentication"))
            flag = 0
            for mode in link.auth_modes:
                self.auth_mode.insertItem(mode.name)
                if mode.type == "login":
                    flag = 1
            
            self.auth_stack = QWidgetStack(self)
            if flag == 1:
                grid.addMultiCellWidget(self.auth_stack, 0, 1, 2, 2)
            else:
                grid.addWidget(self.auth_stack, 0, 2)
            
            lab = QLabel("", self)
            self.auth_stack.addWidget(lab, 0)
            
            w = QWidget(self)
            grid3 = QGridLayout(w, 2, 2, 0, 6)
            grid3.addWidget(QLabel(i18n("Password:"******"User name:"), w), 0, 0, Qt.AlignRight)
                self.auth_user = QLineEdit(w)
                grid3.addWidget(self.auth_user, 0, 1)
                grid3.addWidget(QLabel(i18n("Password:"******"net" in link.modes:
            self.initNet(lay)
        
        self.setValues()
        
        comlink.device_hook.append(self.slotDevices)
        comlink.queryDevices(link.script)
Exemplo n.º 29
0
    def __init__(self, parent, link, conn, new_conn=None):
        QWidget.__init__(self, parent)

        self.scanpop = None
        self.link = link
        self.conn = conn
        self.new_conn = new_conn
        self.channel = None
        self.auth_dict = {"TLS":[], "TTLS":["PAP","MSCHAPV2"], "PEAP":["MSCHAPV2", "MD5"]}

        self.apmac = ''
        lay = QVBoxLayout(self, 3, 3, "mainVertLayout")

        # Identification
        grid = QGridLayout(1, 2, 6)
        lay.addLayout(grid)
        lab = QLabel(i18n("Connection name:"), self)
        grid.addWidget(lab, 0, 0, Qt.AlignRight)
        self.name = widgets.Edit(self)
        self.name.edit.setMaxLength(48)
        grid.addWidget(self.name, 0, 1)

        # Connection
        line = widgets.HLine(i18n("Connection"), self, "irkick")
        lay.addSpacing(6)
        lay.addWidget(line)

        grid = QGridLayout(None, 1, 1, 11, 6)

        lab = QLabel(i18n("Device:"), self)
        grid.addWidget(lab, 0, 0, Qt.AlignRight)
        self.device = QLabel("", self)
        grid.addMultiCellWidget(self.device, 0, 0, 1, 2)

        self.devices_but = QPushButton(i18n("Select"), self)
        self.devices_but.setEnabled(False)
        self.devices_but.setFlat(1)
        grid.addWidget(self.devices_but, 0, 3)

        self.devices = QPopupMenu()
        self.connect(self.devices, SIGNAL("activated(int)"), self.slotDeviceSelect)
        self.devices_but.setPopup(self.devices)

        self.selected_device_mode = QComboBox(False, self)
        grid.addWidget(self.selected_device_mode, 1, 2)

        self.ssidLabel = QLabel(unicode(link.remote_name), self)
        grid.addWidget(self.ssidLabel, 1, 0, Qt.AlignRight)

        self.remote = QLineEdit(self)
        grid.addWidget(self.remote, 1, 1)

        self.scanBut = QPushButton(getIconSet("find", KIcon.Small), i18n("Scan"), self)
        self.scanBut.setFlat(1)
        grid.addWidget(self.scanBut, 1, 3)

        if "remote" in link.modes:
            if "remote_scan" in link.modes:
                self.scanpop = Scanner(self)
                comlink.remote_hook.append(self.scanpop.slotRemotes)
                self.scanBut.setPopup(self.scanpop)
            else:
                self.scanBut.hide()

            if "device_mode" in link.modes:
                for dev_mode in link.device_modes:
                    self.selected_device_mode.insertItem(dev_mode.name)
            else:
                self.selected_device_mode.hide()
        else:
            self.scanBut.hide()
            self.remote.hide()
            self.selected_device_mode.hide()
            self.ssidLabel.hide()

        lay.addLayout(grid)

        # Authentication
        if "auth" in link.modes:
            self.auth_client_cert = ""
            self.auth_ca_cert = ""
            self.auth_private_key = ""
            self.auth_private_key_pass = ""

            line = widgets.HLine(i18n("Authentication"), self, "kgpg_key1")
            lay.addSpacing(6)
            lay.addWidget(line)

            grid = QGridLayout(lay, 1, 1, 6, "mainAuthGrid")

            layoutLeft = QGridLayout(None, 1, 1, 0, 6, "layoutLeft")

            self.security_mode_label = QLabel(i18n("Security:"), self)
            self.security_mode_combo = QComboBox(0, self)
            self.security_mode_combo.setWFlags(Qt.WStyle_NoBorder)
            self.security_mode_combo.insertItem(i18n("No authentication"))
            layoutLeft.addWidget(self.security_mode_label, 0, 0, Qt.AlignRight)
            layoutLeft.addWidget(self.security_mode_combo, 0, 1)

            self.auth_mode_label = QLabel(i18n("Authentication:"), self)
            self.auth_mode_combo = QComboBox(0, self)
            self.auth_mode_combo.setWFlags(Qt.WStyle_NoBorder)
            layoutLeft.addWidget(self.auth_mode_label, 1, 0, Qt.AlignRight)
            layoutLeft.addWidget(self.auth_mode_combo, 1, 1)

            self.auth_inner_label = QLabel(i18n("Inner Authentication:"), self)
            self.auth_inner_combo = QComboBox(0, self)
            self.auth_inner_combo.setWFlags(Qt.WStyle_NoBorder)
            layoutLeft.addWidget(self.auth_inner_label, 2, 0, Qt.AlignRight)
            layoutLeft.addWidget(self.auth_inner_combo, 2, 1)

            grid.addLayout(layoutLeft, 0, 0)
            spacer1 = QSpacerItem(20, 40, QSizePolicy.Minimum, QSizePolicy.Expanding)
            grid.addItem(spacer1, 1, 0)

            layoutRight = QGridLayout(None, 1, 1, 0, 6, "layoutRight")

            self.auth_anon_id_label = QLabel(i18n("Anonymous Identity:"), self)
            self.auth_anon_id_line = QLineEdit(self)
            layoutRight.addWidget(self.auth_anon_id_label, 0, 0, Qt.AlignRight)
            layoutRight.addWidget(self.auth_anon_id_line, 0, 1)

            self.auth_user_label = QLabel(i18n("User/Identity"), self)
            self.auth_user_line = QLineEdit(self)
            layoutRight.addWidget(self.auth_user_label, 1, 0, Qt.AlignRight)
            layoutRight.addWidget(self.auth_user_line, 1, 1)

            self.auth_passphrase_label = QLabel(i18n("Password:"******"Client Certificate:"), self)
            self.auth_client_cert_but = QPushButton(getIconSet("file", KIcon.Small), i18n("browse"),  self)
            self.auth_client_cert_but.setFlat(1)
            layoutRight.addWidget(self.auth_client_cert_label, 3, 0, Qt.AlignRight)
            layoutRight.addWidget(self.auth_client_cert_but, 3, 1)

            self.auth_ca_cert_label = QLabel(i18n("CA Certificate:"), self)
            self.auth_ca_cert_but = QPushButton(getIconSet("file", KIcon.Small), i18n("browse"), self)
            self.auth_ca_cert_but.setFlat(1)
            layoutRight.addWidget(self.auth_ca_cert_label, 4, 0, Qt.AlignRight)
            layoutRight.addWidget(self.auth_ca_cert_but, 4, 1)

            self.auth_private_key_label = QLabel(i18n("Private Key File:"), self)
            self.auth_private_key_but = QPushButton(getIconSet("file", KIcon.Small), i18n("browse"), self)
            self.auth_private_key_but.setFlat(1)
            layoutRight.addWidget(self.auth_private_key_label, 5, 0, Qt.AlignRight)
            layoutRight.addWidget(self.auth_private_key_but, 5, 1)

            self.auth_private_key_pass_label = QLabel(i18n("Private Key Password:"******"activated(int)"), self.slotSecurityToggle)
            self.connect(self.auth_mode_combo, SIGNAL("activated(int)"), self.slotAuthToggle)
            self.connect(self.auth_ca_cert_but, SIGNAL("clicked()"), self.getCaCert)
            self.connect(self.auth_client_cert_but, SIGNAL("clicked()"), self.getClientCert)
            self.connect(self.auth_private_key_but, SIGNAL("clicked()"), self.getPrivateKey)

            self.slotSecurityToggle()

        # Communication
        if "net" in link.modes:
            self.initNet(lay)

        self.setValues()

        comlink.device_hook.append(self.slotDevices)
        comlink.queryDevices(link.script)
Exemplo n.º 30
0
    def __init__(self, parent, link, conn, new_conn=None):
        QWidget.__init__(self, parent)
        
        self.scanpop = None
        self.link = link
        self.conn = conn
        self.new_conn = new_conn
        
        self.apmac = ''
        lay = QVBoxLayout(self, 3, 3)
        
        # Identification
        grid = QGridLayout(1, 2, 6)
        lay.addLayout(grid)
        lab = QLabel(i18n("Connection name:"), self)
        grid.addWidget(lab, 0, 0, Qt.AlignRight)
        self.name = widgets.Edit(self)
        self.name.edit.setMaxLength(48)
        grid.addWidget(self.name, 0, 1)
        
        # Connection
        line = widgets.HLine(i18n("Connection"), self, "irkick")
        lay.addSpacing(6)
        lay.addWidget(line)
        grid = QGridLayout(2, 2)
        lay.addLayout(grid)
        
        lab = QLabel(i18n("Device:"), self)
        grid.addWidget(lab, 0, 0, Qt.AlignRight)
        hb = QHBox(self)
        hb.setSpacing(3)
        self.device = KActiveLabel("", hb)
        self.devices_but = QPushButton(i18n("Select"), hb)
        self.devices_but.setEnabled(False)
        self.devices = QPopupMenu()
        self.connect(self.devices, SIGNAL("activated(int)"), self.slotDeviceSelect)
        self.devices_but.setPopup(self.devices)
        grid.addWidget(hb, 0, 1)

        if "devicemode" in link.modes:
            line = widgets.HLine(i18n("Device Mode"), self, "unindent")
            lay.addSpacing(6)
            lay.addWidget(line)
            grid = QGridLayout(3, 2)
            lay.addLayout(grid)
            
            lab = QLabel(i18n("Mode:"), self)
            grid.addWidget(lab, 0, 0, Qt.AlignRight)
            
            self.selected_device_mode = QComboBox(False, self)
            self.selected_device_mode.insertItem("-")
            
            for dev_mode in link.device_modes:
                self.selected_device_mode.insertItem(dev_mode)

            self.selected_device_mode.setCurrentText("Select Mode")
            grid.addWidget(self.selected_device_mode, 0, 1)
            grid.setColStretch(1, 2)
        
        if "remote" in link.modes:
            lab = QLabel(unicode(link.remote_name), self)
            grid.addWidget(lab, 1, 0, Qt.AlignRight)
            if "scan" in link.modes:
                hb = QHBox(self)
                hb.setSpacing(3)
                self.remote = QLineEdit(hb)
                but = QPushButton(getIconSet("find", KIcon.Small), i18n("Scan"), hb)
                self.scanpop = Scanner(self)
                comlink.remote_hook.append(self.scanpop.slotRemotes)
                but.setPopup(self.scanpop)
                grid.addWidget(hb, 1, 1)
            else:
                self.remote = QLineEdit(self)
                grid.addWidget(self.remote, 1, 1)
        
        # Authentication
        if "auth" in link.modes:
            line = widgets.HLine(i18n("Authentication"), self, "kgpg_key1")
            lay.addSpacing(6)
            lay.addWidget(line)
            grid = QGridLayout(3, 2)
            lay.addLayout(grid)
            
            lab = QLabel(i18n("Mode:"), self)
            grid.addWidget(lab, 0, 0, Qt.AlignRight)
            
            self.auth_mode = QComboBox(False, self)
            self.connect(self.auth_mode, SIGNAL("activated(int)"), self.slotAuthToggle)
            grid.addWidget(self.auth_mode, 0, 1)
            grid.setColStretch(2, 2)
            
            self.auth_mode.insertItem(i18n("No authentication"))
            flag = 0
            for mode in link.auth_modes:
                self.auth_mode.insertItem(mode.name)
                if mode.type == "login":
                    flag = 1
            
            self.auth_stack = QWidgetStack(self)
            if flag == 1:
                grid.addMultiCellWidget(self.auth_stack, 0, 1, 2, 2)
            else:
                grid.addWidget(self.auth_stack, 0, 2)
            
            lab = QLabel("", self)
            self.auth_stack.addWidget(lab, 0)
            
            w = QWidget(self)
            grid3 = QGridLayout(w, 2, 2, 0, 6)
            grid3.addWidget(QLabel(i18n("Password:"******"User name:"), w), 0, 0, Qt.AlignRight)
                self.auth_user = QLineEdit(w)
                grid3.addWidget(self.auth_user, 0, 1)
                grid3.addWidget(QLabel(i18n("Password:"******"net" in link.modes:
            self.initNet(lay)
        
        self.setValues()
        
        comlink.device_hook.append(self.slotDevices)
        comlink.queryDevices(link.script)
Exemplo n.º 31
0
    def __init__(self, parent, link, conn, new_conn=None):
        """ Connection Settings Widget """
        QWidget.__init__(self, parent)

        self.scanpop = None
        self.link = link
        self.conn = conn
        self.new_conn = new_conn
        self.channel = None
        self.auth_dict = {
            "TLS": [],
            "TTLS": ["PAP", "MSCHAPV2"],
            "PEAP": ["MSCHAPV2", "MD5"]
        }

        self.apmac = ''
        lay = QVBoxLayout(self, 3, 3, "mainVertLayout")

        # Identification
        grid = QGridLayout(1, 2, 6)
        lay.addLayout(grid)
        lab = QLabel(i18n("Connection name:"), self)
        grid.addWidget(lab, 0, 0, Qt.AlignRight)
        self.name = widgets.Edit(self)
        self.name.edit.setMaxLength(48)
        grid.addWidget(self.name, 0, 1)

        # Connection
        line = widgets.HLine(i18n("Connection"), self, "irkick")
        lay.addSpacing(6)
        lay.addWidget(line)
        grid = QGridLayout(2, 2)
        lay.addLayout(grid)

        lab = QLabel(i18n("Device:"), self)
        grid.addWidget(lab, 0, 0, Qt.AlignRight)
        hb = QHBox(self)
        hb.setSpacing(3)
        self.device = QLabel("", hb)
        hb.setStretchFactor(self.device, 3)
        self.devices_but = QPushButton(i18n("Select"), hb)
        self.devices_but.setEnabled(False)
        self.devices = QPopupMenu()
        self.connect(self.devices, SIGNAL("activated(int)"),
                     self.slotDeviceSelect)
        self.devices_but.setPopup(self.devices)
        grid.addWidget(hb, 0, 1)

        if "remote" in link.modes:
            lab = QLabel(unicode(link.remote_name), self)
            grid.addWidget(lab, 1, 0, Qt.AlignRight)
            if "scan" in link.modes:
                hb = QHBox(self)
                hb.setSpacing(3)
                self.remote = QLineEdit(hb)
                but = QPushButton(getIconSet("find", KIcon.Small),
                                  i18n("Scan"), hb)
                self.scanpop = Scanner(self)
                comlink.remote_hook.append(self.scanpop.slotRemotes)

                but.setPopup(self.scanpop)
                grid.addWidget(hb, 1, 1)
            else:
                self.remote = QLineEdit(self)
                grid.addWidget(self.remote, 1, 1)

        # Authentication
        if "auth" in link.modes:
            self.auth_client_cert = ""
            self.auth_ca_cert = ""
            self.auth_private_key = ""
            self.auth_private_key_pass = ""

            line = widgets.HLine(i18n("Authentication"), self, "kgpg_key1")
            lay.addSpacing(6)
            lay.addWidget(line)
            grid = QGridLayout(lay, 1, 1, 6, "mainAuthGrid")

            layoutLeft = QGridLayout(None, 1, 1, 0, 6, "layoutLeft")

            self.security_mode_label = QLabel(i18n("Security:"), self)
            self.security_mode_combo = QComboBox(0, self)
            self.security_mode_combo.insertItem(i18n("No authentication"))
            layoutLeft.addWidget(self.security_mode_label, 0, 0, Qt.AlignRight)
            layoutLeft.addWidget(self.security_mode_combo, 0, 1)

            self.auth_mode_label = QLabel(i18n("Authentication:"), self)
            self.auth_mode_combo = QComboBox(0, self)
            layoutLeft.addWidget(self.auth_mode_label, 1, 0, Qt.AlignRight)
            layoutLeft.addWidget(self.auth_mode_combo, 1, 1)

            self.auth_inner_label = QLabel(i18n("Inner Authentication:"), self)
            self.auth_inner_combo = QComboBox(0, self)
            layoutLeft.addWidget(self.auth_inner_label, 2, 0, Qt.AlignRight)
            layoutLeft.addWidget(self.auth_inner_combo, 2, 1)

            grid.addLayout(layoutLeft, 0, 0)
            spacer1 = QSpacerItem(20, 40, QSizePolicy.Minimum,
                                  QSizePolicy.Expanding)
            grid.addItem(spacer1, 1, 0)

            layoutRight = QGridLayout(None, 1, 1, 0, 6, "layoutRight")

            self.auth_anon_id_label = QLabel(i18n("Anonymous Identity:"), self)
            self.auth_anon_id_line = QLineEdit(self)
            layoutRight.addWidget(self.auth_anon_id_label, 0, 0, Qt.AlignRight)
            layoutRight.addWidget(self.auth_anon_id_line, 0, 1)

            self.auth_user_label = QLabel(i18n("User/Identity"), self)
            self.auth_user_line = QLineEdit(self)
            layoutRight.addWidget(self.auth_user_label, 1, 0, Qt.AlignRight)
            layoutRight.addWidget(self.auth_user_line, 1, 1)

            self.auth_passphrase_label = QLabel(i18n("Password:"******"Client Certificate:"),
                                                 self)
            self.auth_client_cert_but = QPushButton(
                getIconSet("file", KIcon.Small), "", self)
            layoutRight.addWidget(self.auth_client_cert_label, 3, 0,
                                  Qt.AlignRight)
            layoutRight.addWidget(self.auth_client_cert_but, 3, 1)

            self.auth_ca_cert_label = QLabel(i18n("CA Certificate:"), self)
            self.auth_ca_cert_but = QPushButton(
                getIconSet("file", KIcon.Small), "", self)
            layoutRight.addWidget(self.auth_ca_cert_label, 4, 0, Qt.AlignRight)
            layoutRight.addWidget(self.auth_ca_cert_but, 4, 1)

            self.auth_private_key_label = QLabel(i18n("Private Key File:"),
                                                 self)
            self.auth_private_key_but = QPushButton(
                getIconSet("file", KIcon.Small), "", self)
            layoutRight.addWidget(self.auth_private_key_label, 5, 0,
                                  Qt.AlignRight)
            layoutRight.addWidget(self.auth_private_key_but, 5, 1)

            self.auth_private_key_pass_label = QLabel(
                i18n("Private Key Password:"******"activated(int)"),
                         self.slotSecurityToggle)
            self.connect(self.auth_mode_combo, SIGNAL("activated(int)"),
                         self.slotAuthToggle)
            self.connect(self.auth_ca_cert_but, SIGNAL("clicked()"),
                         self.getCaCert)
            self.connect(self.auth_client_cert_but, SIGNAL("clicked()"),
                         self.getClientCert)
            self.connect(self.auth_private_key_but, SIGNAL("clicked()"),
                         self.getPrivateKey)

            self.slotSecurityToggle()

        # Communication
        if "net" in link.modes:
            self.initNet(lay)

        self.setValues()

        comlink.device_hook.append(self.slotDevices)
        comlink.queryDevices(link.script)
Exemplo n.º 32
0
    def __init__(self, parent):
        QDialog.__init__(self, parent)

        self.old_host = None
        self.old_dns = None

        self.setCaption(i18n("Name Service Settings"))
        self.resize(260, 290)

        vb = QVBoxLayout(self)
        vb.setMargin(12)
        vb.setSpacing(6)

        line = widgets.HLine(i18n("Computer"), self)
        vb.addWidget(line)

        hb = QHBox(self)
        vb.addWidget(hb)
        hb.setSpacing(6)
        QLabel(i18n("Host name:"), hb)
        self.host = QLineEdit(hb)

        vb.addSpacing(6)
        line = widgets.HLine(i18n("Name servers"), self)
        vb.addWidget(line)

        vb2 = QVBox(self)
        vb.addWidget(vb2)
        vb2.setSpacing(3)

        self.dns = QListBox(vb2)

        hb = QHBox(vb2)
        hb.setSpacing(3)
        but = QPushButton(getIconSet("up", KIcon.Small), i18n("Up"), hb)
        self.connect(but, SIGNAL("clicked()"), self.slotUp)
        self.b1 = but
        but = QPushButton(getIconSet("down", KIcon.Small), i18n("Down"), hb)
        self.connect(but, SIGNAL("clicked()"), self.slotDown)
        self.b2 = but
        but = QPushButton(getIconSet("add", KIcon.Small), i18n("Add"), hb)
        self.connect(but, SIGNAL("clicked()"), self.slotAdd)
        but = QPushButton(getIconSet("remove", KIcon.Small), i18n("Remove"),
                          hb)
        self.connect(but, SIGNAL("clicked()"), self.slotRemove)
        self.b3 = but

        self.connect(self.dns, SIGNAL("selectionChanged()"),
                     self.slotSelection)
        self.slotSelection()

        hb = QWidget(self)
        vb.addSpacing(6)
        vb.addWidget(hb)
        lay = QHBoxLayout(hb)
        lay.setMargin(3)
        lay.setSpacing(12)
        lay.addStretch(1)
        but = QPushButton(getIconSet("apply", KIcon.Small), i18n("Apply"), hb)
        self.connect(but, SIGNAL("clicked()"), self.accept)
        lay.addWidget(but)
        but = QPushButton(getIconSet("cancel", KIcon.Small), i18n("Cancel"),
                          hb)
        self.connect(but, SIGNAL("clicked()"), self.reject)
        lay.addWidget(but)

        comlink.name_hook.append(self.slotName)
Exemplo n.º 33
0
    def __init__(self, parent, link, conn, new_conn=None):
        QWidget.__init__(self, parent)

        self.scanpop = None
        self.link = link
        self.conn = conn
        self.new_conn = new_conn

        self.apmac = ''
        lay = QVBoxLayout(self, 3, 3)

        # Identification
        grid = QGridLayout(1, 2, 6)
        lay.addLayout(grid)
        lab = QLabel(i18n("Connection name:"), self)
        grid.addWidget(lab, 0, 0, Qt.AlignRight)
        self.name = widgets.Edit(self)
        self.name.edit.setMaxLength(48)
        grid.addWidget(self.name, 0, 1)

        # Connection
        line = widgets.HLine(i18n("Connection"), self, "irkick")
        lay.addSpacing(6)
        lay.addWidget(line)
        grid = QGridLayout(2, 2)
        lay.addLayout(grid)

        lab = QLabel(i18n("Device:"), self)
        grid.addWidget(lab, 0, 0, Qt.AlignRight)
        hb = QHBox(self)
        hb.setSpacing(3)
        self.device = KActiveLabel("", hb)
        self.devices_but = QPushButton(i18n("Select"), hb)
        self.devices_but.setEnabled(False)
        self.devices = QPopupMenu()
        self.connect(self.devices, SIGNAL("activated(int)"),
                     self.slotDeviceSelect)
        self.devices_but.setPopup(self.devices)
        grid.addWidget(hb, 0, 1)

        if "remote" in link.modes:
            lab = QLabel(unicode(link.remote_name), self)
            grid.addWidget(lab, 1, 0, Qt.AlignRight)
            if "scan" in link.modes:
                hb = QHBox(self)
                hb.setSpacing(3)
                self.remote = QLineEdit(hb)
                but = QPushButton(getIconSet("find", KIcon.Small),
                                  i18n("Scan"), hb)
                self.scanpop = Scanner(self)
                comlink.remote_hook.append(self.scanpop.slotRemotes)
                but.setPopup(self.scanpop)
                grid.addWidget(hb, 1, 1)
            else:
                self.remote = QLineEdit(self)
                grid.addWidget(self.remote, 1, 1)

        if "vpn" in link.modes:
            line = widgets.HLine(i18n("VPN Authentication"), self, "vpn_icon")
            lay.addSpacing(6)
            lay.addWidget(line)
            grid2 = QGridLayout(7, 2, 6)
            lay.addLayout(grid2)

            lab = QLabel(i18n("Domain:"), self)
            grid2.addWidget(lab, 0, 0, Qt.AlignRight)
            self.domain = QLineEdit(self)
            grid2.addWidget(self.domain, 0, 1)

            lab = QLabel(i18n("Port:"), self)
            grid2.addWidget(lab, 1, 0, Qt.AlignRight)
            self.port = QLineEdit(self)
            grid2.addWidget(self.port, 1, 1)

            lab = QLabel(i18n("Protocol:"), self)
            grid2.addWidget(lab, 2, 0, Qt.AlignRight)
            self.protocol = QComboBox(0, self, "TCP")
            self.protocol.insertItem("TCP")
            self.protocol.insertItem("UDP")
            grid2.addWidget(self.protocol, 2, 1)
            grid2.setSpacing(7)

            lab = QLabel(i18n("Cryptographic Chipher:"), self)
            grid2.addWidget(lab, 3, 0, Qt.AlignRight)
            self.chipher = QComboBox(0, self, "None")
            self.chipher.insertItem("-")
            self.chipher.insertItem("BF-CBC")
            self.chipher.insertItem("AES-128-CBC")
            self.chipher.insertItem("DES-EDE3-CBC")
            grid2.addWidget(self.chipher, 3, 1)
            grid2.setColStretch(2, 2)
            grid2.setSpacing(7)

            lab = QLabel(i18n("CA Certificate:"), self)
            grid2.addWidget(lab, 4, 0, Qt.AlignRight)

            hb = QHBox(self)
            self.lab2 = KActiveLabel("", hb)
            self.file_but = QPushButton(i18n("Select .ca File"), hb)
            self.file_but.setEnabled(True)
            self.ca = ""
            self.connect(self.file_but, SIGNAL("clicked()"),
                         lambda: self.getFileName(1))
            grid2.addWidget(hb, 4, 1)

            lab = QLabel(i18n("Cert Certificate:"), self)
            grid2.addWidget(lab, 5, 0, Qt.AlignRight)

            hb = QHBox(self)
            self.lab3 = KActiveLabel("", hb)
            self.file_but2 = QPushButton(i18n("Select .crt File"), hb)
            self.file_but2.setEnabled(True)
            self.cert = ""
            self.connect(self.file_but2, SIGNAL("clicked()"),
                         lambda: self.getFileName(2))
            grid2.addWidget(hb, 5, 1)

            lab = QLabel(i18n("Key:"), self)
            grid2.addWidget(lab, 6, 0, Qt.AlignRight)
            hb = QHBox(self)
            self.lab4 = KActiveLabel("", hb)
            self.file_but3 = QPushButton(i18n("Select .key File"), hb)
            self.file_but3.setEnabled(True)
            self.key = ""
            self.connect(self.file_but3, SIGNAL("clicked()"),
                         lambda: self.getFileName(3))
            grid2.addWidget(hb, 6, 1)

        # Authentication
        if "auth" in link.modes:
            line = widgets.HLine(i18n("Authentication"), self, "kgpg_key1")
            lay.addSpacing(6)
            lay.addWidget(line)
            grid = QGridLayout(3, 2)
            lay.addLayout(grid)

            lab = QLabel(i18n("Mode:"), self)
            grid.addWidget(lab, 0, 0, Qt.AlignRight)

            self.auth_mode = QComboBox(False, self)
            self.connect(self.auth_mode, SIGNAL("activated(int)"),
                         self.slotAuthToggle)
            grid.addWidget(self.auth_mode, 0, 1)
            grid.setColStretch(2, 2)

            self.auth_mode.insertItem(i18n("No authentication"))
            flag = 0
            for mode in link.auth_modes:
                self.auth_mode.insertItem(mode.name)
                if mode.type == "login":
                    flag = 1

            self.auth_stack = QWidgetStack(self)
            if flag == 1:
                grid.addMultiCellWidget(self.auth_stack, 0, 1, 2, 2)
            else:
                grid.addWidget(self.auth_stack, 0, 2)

            lab = QLabel("", self)
            self.auth_stack.addWidget(lab, 0)

            w = QWidget(self)
            grid3 = QGridLayout(w, 2, 2, 0, 6)
            grid3.addWidget(QLabel(i18n("Password:"******"User name:"), w), 0, 0,
                                Qt.AlignRight)
                self.auth_user = QLineEdit(w)
                grid3.addWidget(self.auth_user, 0, 1)
                grid3.addWidget(QLabel(i18n("Password:"******"net" in link.modes:
            self.initNet(lay)

        self.setValues()

        comlink.device_hook.append(self.slotDevices)
        comlink.queryDevices(link.script)
Exemplo n.º 34
0
 def __init__(self, parent):
     QDialog.__init__(self, parent)
     
     self.old_host = None
     self.old_dns = None
     
     self.setCaption(i18n("Name Service Settings"))
     self.resize(260, 290)
     
     vb = QVBoxLayout(self)
     vb.setMargin(12)
     vb.setSpacing(6)
     
     line = widgets.HLine(i18n("Computer"), self)
     vb.addWidget(line)
     
     hb = QHBox(self)
     vb.addWidget(hb)
     hb.setSpacing(6)
     QLabel(i18n("Host name:"), hb)
     self.host = QLineEdit(hb)
     
     vb.addSpacing(6)
     line = widgets.HLine(i18n("Name servers"), self)
     vb.addWidget(line)
     
     vb2 = QVBox(self)
     vb.addWidget(vb2)
     vb2.setSpacing(3)
     
     self.dns = QListBox(vb2)
     
     hb = QHBox(vb2)
     hb.setSpacing(3)
     but = QPushButton(getIconSet("up", KIcon.Small), i18n("Up"), hb)
     self.connect(but, SIGNAL("clicked()"), self.slotUp)
     self.b1 = but
     but = QPushButton(getIconSet("down", KIcon.Small), i18n("Down"), hb)
     self.connect(but, SIGNAL("clicked()"), self.slotDown)
     self.b2 = but
     but = QPushButton(getIconSet("add", KIcon.Small), i18n("Add"), hb)
     self.connect(but, SIGNAL("clicked()"), self.slotAdd)
     but = QPushButton(getIconSet("remove", KIcon.Small), i18n("Remove"), hb)
     self.connect(but, SIGNAL("clicked()"), self.slotRemove)
     self.b3 = but
     
     self.connect(self.dns, SIGNAL("selectionChanged()"), self.slotSelection)
     self.slotSelection()
     
     hb = QWidget(self)
     vb.addSpacing(6)
     vb.addWidget(hb)
     lay = QHBoxLayout(hb)
     lay.setMargin(3)
     lay.setSpacing(12)
     lay.addStretch(1)
     but = QPushButton(getIconSet("apply", KIcon.Small), i18n("Apply"), hb)
     self.connect(but, SIGNAL("clicked()"), self.accept)
     lay.addWidget(but)
     but = QPushButton(getIconSet("cancel", KIcon.Small), i18n("Cancel"), hb)
     self.connect(but, SIGNAL("clicked()"), self.reject)
     lay.addWidget(but)
     
     comlink.name_hook.append(self.slotName)