Ejemplo n.º 1
0
KACLEditWidget::KACLEditWidget( QWidget *parent )
    : QWidget(parent), d(new KACLEditWidgetPrivate)
{
    QHBoxLayout *hbox = new QHBoxLayout( this );
    hbox->setMargin( 0 );
    d->m_listView = new KACLListView(this);
    hbox->addWidget(d->m_listView);
    connect(d->m_listView->selectionModel(),
            SIGNAL(selectionChanged(const QItemSelection&, const QItemSelection& )),
            this,
            SLOT(_k_slotUpdateButtons()));
    QVBoxLayout *vbox = new QVBoxLayout();
    hbox->addLayout( vbox );
    d->m_AddBtn = new QPushButton(i18n("Add Entry..."), this);
    vbox->addWidget(d->m_AddBtn);
    d->m_AddBtn->setObjectName(QLatin1String("add_entry_button"));
    connect(d->m_AddBtn, SIGNAL(clicked()), d->m_listView, SLOT(slotAddEntry()));
    d->m_EditBtn = new QPushButton(i18n("Edit Entry..."), this);
    vbox->addWidget(d->m_EditBtn);
    d->m_EditBtn->setObjectName(QLatin1String("edit_entry_button"));
    connect(d->m_EditBtn, SIGNAL(clicked()), d->m_listView, SLOT(slotEditEntry()));
    d->m_DelBtn = new QPushButton(i18n("Delete Entry"), this);
    vbox->addWidget(d->m_DelBtn);
    d->m_DelBtn->setObjectName(QLatin1String("delete_entry_button"));
    connect(d->m_DelBtn, SIGNAL(clicked()), d->m_listView, SLOT(slotRemoveEntry()));
    vbox->addItem( new QSpacerItem( 10, 10, QSizePolicy::Fixed, QSizePolicy::Expanding ) );
    d->_k_slotUpdateButtons();
}
Ejemplo n.º 2
0
DesktopAccessDlg::DesktopAccessDlg(QWidget* parent)
: QDialog(parent, QT_DEFAULT_DIALOG_HINTS)
{
    ui.setupUi(this);
    setWindowIcon(QIcon(APPICON));

    connect(ui.delBtn, SIGNAL(clicked()),
            SLOT(slotDelEntry()));
    connect(ui.clearBtn, SIGNAL(clicked()),
            SLOT(slotClearEntry()));
    connect(ui.addBtn, SIGNAL(clicked()),
            SLOT(slotAddEntry()));

    connect(ui.addchanBtn, SIGNAL(clicked()),
            SLOT(slotAddChannel()));
    connect(ui.delchanBtn, SIGNAL(clicked()),
            SLOT(slotDelChannel()));
    connect(ui.adduserBtn, SIGNAL(clicked()),
            SLOT(slotAddUsername()));
    connect(ui.deluserBtn, SIGNAL(clicked()),
            SLOT(slotDelUsername()));

    connect(ui.listView, SIGNAL(clicked(const QModelIndex&)),
            SLOT(slotServerSelected(const QModelIndex&)));

    m_model = new DesktopAccessModel(this);

    QVector<DesktopAccessEntry> entries;
    getDesktopAccessList(entries);
    ui.listView->setModel(m_model);
    m_model->setEntries(entries);

    HostEntry host;
    if(getLatestHost(0, host))
    {
        int i;
        for(i=0;i<m_model->getEntries().size();i++)
        {
            if(m_model->getEntries()[i].ipaddr == host.ipaddr &&
               m_model->getEntries()[i].tcpport == host.tcpport)
            {
                QModelIndex index = m_model->index(i, 0);
                ui.listView->setCurrentIndex(index);
                slotServerSelected(index);
                break;
            }
        }
        if(i>=m_model->getEntries().size())
        {
            ui.hostaddrEdit->setText(host.ipaddr);
            ui.tcpportSpinBox->setValue(host.tcpport);
        }
    }
}
Ejemplo n.º 3
0
KACLEditWidget::KACLEditWidget(QWidget *parent, const char *name) : QWidget(parent, name)
{
    QHBox *hbox = new QHBox(parent);
    hbox->setSpacing(KDialog::spacingHint());
    m_listView = new KACLListView(hbox, "acl_listview");
    connect(m_listView, SIGNAL(selectionChanged()), this, SLOT(slotUpdateButtons()));
    QVBox *vbox = new QVBox(hbox);
    vbox->setSpacing(KDialog::spacingHint());
    m_AddBtn = new QPushButton(i18n("Add Entry..."), vbox, "add_entry_button");
    connect(m_AddBtn, SIGNAL(clicked()), m_listView, SLOT(slotAddEntry()));
    m_EditBtn = new QPushButton(i18n("Edit Entry..."), vbox, "edit_entry_button");
    connect(m_EditBtn, SIGNAL(clicked()), m_listView, SLOT(slotEditEntry()));
    m_DelBtn = new QPushButton(i18n("Delete Entry"), vbox, "delete_entry_button");
    connect(m_DelBtn, SIGNAL(clicked()), m_listView, SLOT(slotRemoveEntry()));
    QWidget *spacer = new QWidget(vbox);
    spacer->setSizePolicy(QSizePolicy::Minimum, QSizePolicy::Expanding);
    slotUpdateButtons();
}