void FedgeConfigAccounts::slotKmail() {
		
	KConfig config("kmailrc", true);
	QStringList list;
	QMap<QString, QString> configmap;
	int i = 1;

	while (config.hasGroup("Account " + QString::number(i))) {

		QString account = "Account " + QString::number(i++);
		configmap = config.entryMap(account);	
		if (!configmap.empty()) list << account;
	} 

	int accno = 1;

	if (list.empty()) return;
	if (list.size() > 1) {

		FedgeSelectDialog fsd(0, "Select Kmail Account:", list);
		accno = fsd.exec();	
	}

	KmailAccount account("Account " + QString::number(accno));

	m_config->setGroup(newGroup());
	addAccount(&account);
	
	m_changed = true;
   emit accountsChanged();
}
예제 #2
0
int32_t mount(char *devfile, char *mntpoint, char *fstype,
      uint32_t flags, void *data) {

    /* mount() System Call. */
    uint32_t error;
    vfsmount_t *vfsmount = NULL;
    vfsmount_t *vfsparent = NULL;
    inode_t *mp_inode = NULL;
    super_block_t *sb = NULL;
    device_t *dev = NULL;
    fsd_t *fsdriver;
    namei_t namei_data;
    int32_t err;
    inode_t *i;

    /* I) Process "fstype" argument:  */
    /* ------------------------------ */
    /* fstype must be valid: */
    fsdriver = fsd(fstype);
    if (fsdriver == NULL)
        return -ENODEV;

    /* II) Get Disk Device Driver:  */
    /* ---------------------------- */
    if (fsdriver->flags & FSD_REQDEV) {

        /* get the inode of the device file: */
        namei_data;
        err = namei(NULL, devfile, &namei_data);

        /* exists? */
        if (err)
            return -ENODEV;
        kfree(namei_data.path); /* not needed now. */

        /* device file? */
        i = namei_data.inode;
        if ((i->mode & FT_MASK) != FT_SPECIAL) {
            iput(i);
            return -EINVAL;
        }

        /* get device structure: */
        dev = (device_t *) devid_to_dev(i->devid);

        /* release the inode: */
        iput(i);

    }

    /* III) Validate the mount point:  */
    /* ------------------------------- */
    if (vfsroot != NULL) {

        /* get the inode of the mount point: */
        namei_t namei_data;
        int32_t err;
        if (err = namei(NULL, mntpoint, &namei_data))
            return -err;

        /* extract data: */
        mp_inode = namei_data.inode;
        vfsparent = namei_data.mp;
        kfree(namei_data.path); /* not needed now. */

        /* must be directory: */
        if ((mp_inode->mode & FT_MASK) != FT_DIR) {
            iput(mp_inode);
            return -ENOTDIR;
        }

    }

    /* IV) Allocate a mount point structure:  */
    /* -------------------------------------- */
    vfsmount = kmalloc(sizeof(vfsmount_t));
    if (!vfsmount) {
        if (mp_inode) {
            iput(mp_inode);
        }
        return -ENOMEM;
    }

    /* V) Read the super block:  */
    /* ------------------------- */
    if (!dev || !(dev->sb)) {
        /* first mount.. */
        sb = fsdriver->read_super(dev);

        /* error? */
        if (!sb) {
            kfree(vfsmount);
            if (mp_inode) {
                iput(mp_inode);
            }
            return -ENOMEM;
        }

        /* update device structure: */
        if (dev)
            dev->sb = sb;
    } else {
        /* mounted before. */
        sb = dev->sb;
        sb->mounts++;
    }

    /* VI) Initialize the mount point structure:  */
    /* ------------------------------------------ */
    vfsmount->vfsparent = vfsparent;
    vfsmount->mp_inode  = mp_inode;
    vfsmount->sb        = sb;

    /* VII) Inform the parent filesystem of this mount:  */
    /* ------------------------------------------------- */
    if (mp_inode) {
        mp_inode->submount = vfsmount;
    } else {
        /* first mount! no parent fs. */
        vfsroot = vfsmount;
    }

    /* VIII) Return:  */
    /* -------------- */
    return ESUCCESS;

}