Exemple #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)
Exemple #2
0
 def __init__(self, *args):
     self.kc = KConfig(*args)
Exemple #3
0
 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()
Exemple #4
0
 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()
Exemple #5
0
 def __init__(self, filename='', ReadOnly=False, UseKDEGlobals=True,
              resType="config"):
     KConfig.__init__(self, 'dosbox-pykderc', ReadOnly, UseKDEGlobals, resType)