コード例 #1
0
//nparams: user_ip
return_type sUnmount(const int nparams, arg_type* a) {

    if(debug)printf("recevied %d nparams in sUnmount\n", nparams);
	// if (nparams != 2) {
	// 	r.return_val = NULL;
	// 	r.return_size = 0;
	// 	return r;
	// }

	char *user_ip = (char *)a->arg_val;
    char *alias = (char *)a->next->arg_val;

    MountedUser *found = findMount(user_ip, alias);

    if (found == NULL) {
        if(debug)printf("found is null in sUnmount\n");
        return createReturn(1, -1);
    }

    if (removeMount(user_ip, alias) != 0) {
        if(debug)printf("problem with removeMount\n");
        return createReturn(1, -1);
    }
    if(debug)printf("returning a good value from sUnmount\n");
    return createReturn(0, 0);
}
コード例 #2
0
void MaemoRunConfigurationWidget::addMountWidgets(QVBoxLayout *mainLayout)
{

    m_mountDetailsContainer = new Utils::DetailsWidget(this);
    QWidget *mountViewWidget = new QWidget;
    m_mountDetailsContainer->setWidget(mountViewWidget);
    mainLayout->addWidget(m_mountDetailsContainer);
    QVBoxLayout *mountViewLayout = new QVBoxLayout(mountViewWidget);
    m_mountWarningLabel = new QLabel;
    mountViewLayout->addWidget(m_mountWarningLabel);
    QHBoxLayout *tableLayout = new QHBoxLayout;
    mountViewLayout->addLayout(tableLayout);
    m_mountView = new QTableView;
    m_mountView->horizontalHeader()->setResizeMode(QHeaderView::ResizeToContents);
    m_mountView->setSelectionBehavior(QTableView::SelectRows);
    m_mountView->setModel(m_runConfiguration->remoteMounts());
    tableLayout->addWidget(m_mountView);
    QVBoxLayout *mountViewButtonsLayout = new QVBoxLayout;
    tableLayout->addLayout(mountViewButtonsLayout);
    QToolButton *addMountButton = new QToolButton;
    QIcon plusIcon;
    plusIcon.addFile(QLatin1String(Core::Constants::ICON_PLUS));
    addMountButton->setIcon(plusIcon);
    mountViewButtonsLayout->addWidget(addMountButton);
    m_removeMountButton = new QToolButton;
    QIcon minusIcon;
    minusIcon.addFile(QLatin1String(Core::Constants::ICON_MINUS));
    m_removeMountButton->setIcon(minusIcon);
    mountViewButtonsLayout->addWidget(m_removeMountButton);
    mountViewButtonsLayout->addStretch(1);

    connect(addMountButton, SIGNAL(clicked()), this, SLOT(addMount()));
    connect(m_removeMountButton, SIGNAL(clicked()), this, SLOT(removeMount()));
    connect(m_mountView, SIGNAL(doubleClicked(QModelIndex)), this,
        SLOT(changeLocalMountDir(QModelIndex)));
    connect(m_mountView->selectionModel(),
        SIGNAL(selectionChanged(QItemSelection,QItemSelection)), this,
        SLOT(enableOrDisableRemoveMountSpecButton()));
    connect(m_runConfiguration->remoteMounts(),
        SIGNAL(rowsInserted(QModelIndex, int, int)), this,
        SLOT(handleRemoteMountsChanged()));
    connect(m_runConfiguration->remoteMounts(),
        SIGNAL(rowsRemoved(QModelIndex, int, int)), this,
        SLOT(handleRemoteMountsChanged()));
    connect(m_runConfiguration->remoteMounts(),
        SIGNAL(dataChanged(QModelIndex, QModelIndex)), this,
        SLOT(handleRemoteMountsChanged()));
    connect(m_runConfiguration->remoteMounts(), SIGNAL(modelReset()), this,
        SLOT(handleRemoteMountsChanged()));
    enableOrDisableRemoveMountSpecButton();
    handleRemoteMountsChanged();
}