示例#1
0
class kconfig(_kconfigbase):
    """
    A wrapped KConfig object, that can be accessed like a dictionary
    """
    def __init__(self, *args):
        self.kc = KConfig(*args)

    def setGroup(self, groupname):
        self.kc.setGroup(groupname)

    def group(self, groupname):
        """ return an object for this group """
        return kconfiggroup(self, groupname)
示例#2
0
 def __init__(self, *args):
     self.kc = KConfig(*args)
示例#3
0
文件: account.py 项目: Tayyib/uludag
 def setKopeteAccounts(self):
     "Add imported accounts into Kopete"
     config = KConfig("kopeterc")
     for account in self.accounts:
         if account["type"] == "Jabber":
             groupname = "Account_JabberProtocol_" + account["user"]
             if not config.hasGroup(groupname):
                 config.setGroup("Plugins")
                 config.writeEntry("kopete_jabberEnabled", "true")
                 config.setGroup(groupname)
                 config.writeEntry("AccountId", account["user"])
                 config.writeEntry("Protocol", "JabberProtocol")
                 config.writeEntry("CustomServer", "true")
                 config.writeEntry("Server", account["host"])
                 config.writeEntry("Port", account["port"])
                 if account["SSL"]:
                     config.writeEntry("UseSSL", "true")
         elif account["type"] == "MSN":
             groupname = "Account_MSNProtocol_" + account["mail"]
             if not config.hasGroup(groupname):
                 config.setGroup("Plugins")
                 config.writeEntry("kopete_msnEnabled", "true")
                 config.setGroup(groupname)
                 config.writeEntry("AccountId", account["mail"])
                 config.writeEntry("Protocol", "MSNProtocol")
                 config.writeEntry("serverName", "messenger.hotmail.com")
                 config.writeEntry("serverPort", 1863)
     config.sync()
示例#4
0
文件: account.py 项目: Tayyib/uludag
 def setKMailAccounts(self):
     "Add imported accounts into Kopete"
     config = KConfig("kmailrc")
     config.setGroup("General")
     accountno = config.readNumEntry("accounts") + 1
     config.setGroup("General")
     transportno = config.readNumEntry("transports") + 1
     for account in self.accounts:
         if not KMailAccountIsValid(config, account):
             continue
         # Add POP3 Account:
         if account["type"] == "POP3":
             config.setGroup("General")
             config.writeEntry("accounts", accountno)
             config.setGroup("Account " + str(accountno))
             accountno += 1
             config.writeEntry("trash", "trash")
             config.writeEntry("Type", "pop")
             config.writeEntry("Name", account["name"])
             config.writeEntry("auth", "USER")
             config.writeEntry("host", account["host"])
             config.writeEntry("login", account["user"])
             
             # Set Inbox Folder:
             inbox = account.get("inbox", "inbox")
             folder = KMailFolderName(inbox)
             config.writeEntry("Folder", folder)
             # Create inbox if not exists:
             folders = inbox.split("/")
             for i in xrange(len(folders)):
                 foldername = "/".join(folders[:(i + 1)])
                 foldername = KMailFolderName(foldername)
                 folderpath = os.path.expanduser("~/.kde/share/apps/kmail/mail/" + foldername)
                 if not os.path.exists(folderpath):
                     os.makedirs(folderpath)
                     os.makedirs(os.path.join(folderpath, "cur"))
                     os.makedirs(os.path.join(folderpath, "new"))
                     os.makedirs(os.path.join(folderpath, "tmp"))
             
             if account.has_key("SSL") and account["SSL"]:
                 config.writeEntry("use-ssl", "true")
                 config.writeEntry("port", 995)
             else:
                 config.writeEntry("use-ssl", "false")
                 config.writeEntry("port", 110)
             if account.has_key("port") and account["port"]:
                 config.writeEntry("port", account["port"])
             config.writeEntry("use-tls", "false")
         # Add IMAP Account:
         elif account["type"] == "IMAP":
             config.setGroup("General")
             config.writeEntry("accounts", accountno)
             config.setGroup("Account " + str(accountno))
             accountno += 1
             config.writeEntry("Folder", "")
             config.writeEntry("trash", "trash")
             config.writeEntry("Type", "imap")
             config.writeEntry("Name", account["name"])
             config.writeEntry("auth", "*")
             config.writeEntry("host", account["host"])
             config.writeEntry("login", account["user"])
             if account.has_key("SSL") and account["SSL"]:
                 config.writeEntry("use-ssl", "true")
                 config.writeEntry("port", 993)
             else:
                 config.writeEntry("use-ssl", "false")
                 config.writeEntry("port", 143)
             if account.has_key("port") and account["port"]:
                 config.writeEntry("port", account["port"])
             config.writeEntry("use-tls", "false")
         # Add SMTP Account:
         elif account["type"] == "SMTP":
             config.setGroup("General")
             config.writeEntry("transports", transportno)
             config.setGroup("Transport " + str(transportno))
             transportno += 1
             if account.get("auth", False) and account.has_key("user"):
                 config.writeEntry("auth", "true")
                 config.writeEntry("authtype", "PLAIN")
                 config.writeEntry("user", account["user"])
             config.writeEntry("name", account["host"])
             config.writeEntry("host", account["host"])
             if account.has_key("SSL") and account["SSL"]:
                 config.writeEntry("encryption", "SSL")
                 config.writeEntry("port", 465)
             else:
                 config.writeEntry("port", 25)
                 if account.has_key("TLS") and account["TLS"]:
                     config.writeEntry("encryption", "TLS")
             if account.has_key("port") and account["port"]:
                 config.writeEntry("port", account["port"])
         config.sync()
示例#5
0
 def __init__(self, filename='', ReadOnly=False, UseKDEGlobals=True,
              resType="config"):
     KConfig.__init__(self, 'dosbox-pykderc', ReadOnly, UseKDEGlobals, resType)