void kiptablesgenerator::setupIPolicyPage()
{
  iPolicyPage = new QFrame(this);
  
  QVBoxLayout *layout = new QVBoxLayout(iPolicyPage);
  
  QLabel *intro = new QLabel(i18n(
    "<p>What do you want your firewall to do to unmatched packets?</p>"
    "<p>Your firewall can either accept unmatched packets, or drop unmatched "
    "packets; the recommended option is to drop unmatched packets.</p>"
    "<p><i>Advanced users: This sets the policy for the INPUT chain.</i></p>"), iPolicyPage);
  intro->show();
  layout->addWidget(intro);
  
  KComboBox *options = new KComboBox(iPolicyPage);
  options->insertItem(i18n("Accept"));
  options->insertItem(i18n("Drop"));
  options->setCurrentItem(1);
  options->show();
  layout->addWidget(options);
  namedWidgets["incomingPolicy"] = options;
  
  iPolicyPage->show();
  this->addPage(iPolicyPage, i18n("Default Action"));
}
//// A dialog to load a KDE icon by its name
LoadIconDialog::LoadIconDialog(QWidget *parent)
        : KDialog(parent, "loadicon_dialog", true, i18n("Load KDE Icon by Name"), Ok | Cancel, Ok, false)
{
    QFrame *frame = makeMainWidget();
    QGridLayout *l = new QGridLayout(frame);

    // Name input
    QLabel *name = new QLabel(i18n("&Name:"), frame);
    l->addWidget(name, 0, 0);
    name->setAlignment(Qt::AlignRight | Qt::AlignVCenter);
    m_nameInput = new KLineEdit("kexi", frame);
    l->addWidget(m_nameInput, 0, 1);
    name->setBuddy(m_nameInput);

    // Choose size
    QLabel *size = new QLabel(i18n("&Size:"), frame);
    l->addWidget(size, 1, 0);
    size->setAlignment(Qt::AlignRight | Qt::AlignVCenter);

    KComboBox *combo = new KComboBox(frame);
    l->addWidget(combo, 1, 1);
    size->setBuddy(combo);
    QStringList list;
    list << i18n("Small") << i18n("Medium") << i18n("Large") << i18n("Huge");
    combo->insertStringList(list);
    combo->setCurrentItem(2);
    connect(combo, SIGNAL(activated(int)), this, SLOT(changeIconSize(int)));


    // Icon chooser button
    m_button = new KIconButton(frame);
    m_button->setIcon(koIconName("calligrakexi"));
    m_button->setIconSize(KIconLoader::SizeMedium);
    l->addWidget(m_button, 0, 2, 2, 1);
    connect(m_button, SIGNAL(iconChanged(QString)), this, SLOT(updateIconName(QString)));
    connect(m_nameInput, SIGNAL(textChanged(QString)), this, SLOT(setIcon(QString)));
}
Esempio n. 3
0
TransferDialog::TransferDialog( MediaDevice *mdev )
        : KDialogBase( Pana::mainWindow(), "transferdialog", true, QString::null, Ok|Cancel, Ok )
{
    m_dev = mdev;
    m_accepted = false;
    m_sort1LastIndex = m_sort2LastIndex = -1;

    kapp->setTopWidget( this );
    setCaption( kapp->makeStdCaption( i18n( "Transfer Queue to Device" ) ) );

    QVBox* vbox = makeVBoxMainWidget();
    vbox->setSpacing( KDialog::spacingHint() );

    QString transferDir = mdev->getTransferDir();

    QGroupBox *location = new QGroupBox( 1, Qt::Vertical, i18n( "Music Location" ), vbox );

    new QLabel( i18n( "Your music will be transferred to:\n%1" )
                    .arg( transferDir ), location );

    QVBox *vbox2 = new QVBox( vbox );
    QSpacerItem *spacer = new QSpacerItem( 0, 25 );
    QLayout *vlayout = vbox2->layout();
    if( vlayout )
        vlayout->addItem( spacer );

    new QLabel( i18n( "You can have your music automatically grouped in\n"
                      "a variety of ways. Each grouping will create\n"
                      "directories based upon the specified criteria.\n"), vbox );

    QGroupBox *sorting = new QGroupBox( 6, Qt::Vertical, i18n( "Groupings" ), vbox );
    m_label1 = new QLabel( i18n( "Select first grouping:\n" ), sorting );
    m_sort1  = new KComboBox( sorting );
    m_label2 = new QLabel( i18n( "Select second grouping:\n" ), sorting );
    m_sort2  = new KComboBox( sorting );
    m_label3 = new QLabel( i18n( "Select third grouping:\n" ), sorting );
    m_sort3  = new KComboBox( sorting );

    m_combolist = new QPtrList<KComboBox>();
    m_combolist->append( m_sort1 );
    m_combolist->append( m_sort2 );
    m_combolist->append( m_sort3 );

    KComboBox * comboTemp;
    for( comboTemp = m_combolist->first(); comboTemp; comboTemp = m_combolist->next() )
    {
        comboTemp->insertItem( i18n("None") );
        comboTemp->insertItem( i18n("Artist") );
        comboTemp->insertItem( i18n("Album") );
        comboTemp->insertItem( i18n("Genre") );
        comboTemp->setCurrentItem( 0 );
    }

    m_sort1->setCurrentItem( mdev->m_firstSort );
    m_sort2->setCurrentItem( mdev->m_secondSort );
    m_sort3->setCurrentItem( mdev->m_thirdSort );

    m_label2->setDisabled( m_sort1->currentItem() == 0 );
    m_sort2->setDisabled( m_sort1->currentItem() == 0 );
    m_label3->setDisabled( m_sort2->currentItem() == 0 );
    m_sort3->setDisabled( m_sort2->currentItem() == 0 );

    connect( m_sort1, SIGNAL( activated(int) ), SLOT( sort1_activated(int)) );
    connect( m_sort2, SIGNAL( activated(int) ), SLOT( sort2_activated(int)) );

    QVBox *vbox3 = new QVBox( vbox );
    QSpacerItem *spacer2 = new QSpacerItem( 0, 25 );
    QLayout *vlayout2 = vbox3->layout();
    if( vlayout2 )
        vlayout2->addItem( spacer2 );

    QGroupBox *options = new QGroupBox( 6, Qt::Vertical, i18n( "Options" ), vbox );

    QCheckBox *convertSpaces = new QCheckBox( i18n( "Convert spaces to underscores" ), options );
    convertSpaces->setChecked( mdev->getSpacesToUnderscores() );

    connect( convertSpaces, SIGNAL( toggled(bool) ), this, SLOT( convertSpaces_toggled(bool) ) );
}
void kiptablesgenerator::setupNewServiceDialog()
{
  newServiceDialog = new KDialogBase(this, 0, true, i18n("Add Service"), KDialogBase::Ok | KDialogBase::Cancel);
  
  QFrame *dialogArea = new QFrame(newServiceDialog);
  QGridLayout *layout = new QGridLayout(dialogArea, 7, 2);
  
  QLabel *intro = new QLabel(i18n(
    "<p><i>Advanced users only</i></p>"
    "<p>Here you can allow or deny access to services through your firewall.<br />"
    "You can specify a port range in the box using this format: <tt>fromPort:toPort</tt></p>"), dialogArea);
  intro->show();
  layout->addMultiCellWidget(intro, 0, 0, 0, 1);
  
  QLabel *protocolLabel = new QLabel(i18n("&Protocol: "), dialogArea);
  protocolLabel->show();
  layout->addWidget(protocolLabel, 1, 0);
 
  KComboBox *protocols = new KComboBox(dialogArea);
  protocols->insertItem(i18n("TCP"));
  protocols->insertItem(i18n("UDP"));
  protocols->insertItem(i18n("TCP & UDP"));
  protocols->insertItem(i18n("ICMP"));
  protocols->setCurrentItem(2);
  protocols->show();
  layout->addWidget(protocols, 1, 1);
  protocolLabel->setBuddy(protocols);
  namedWidgets["newService_protocols"] = protocols;
  connect(protocols, SIGNAL(activated(int )), this, SLOT(slotChangedProtocol(int )));
  
  QLabel *selectByLabel = new QLabel(i18n("Select service by: "), dialogArea);
  selectByLabel->show();
  layout->addMultiCellWidget(selectByLabel, 2, 2, 0, 1);
  
  QButtonGroup *optNamedOrNumbered = new QButtonGroup(dialogArea);
  optNamedOrNumbered->hide();
  namedWidgets["newService_namedOrNumbered"] = optNamedOrNumbered;
  
  QRadioButton *optNamed = new QRadioButton(i18n("&Name: "), dialogArea);
  optNamed->setChecked(true);
  optNamed->setName("named");
  optNamedOrNumbered->insert(optNamed);
  optNamed->show();
  layout->addWidget(optNamed, 3, 0);
  namedWidgets["newService_named"] = optNamed;
  
  KComboBox *names = new KComboBox(dialogArea);
  names->show();
  layout->addWidget(names, 3, 1);
  namedWidgets["newService_names"] = names;
  
  QRadioButton *optNumbered = new QRadioButton(i18n("&Port number(s): "), dialogArea);
  optNumbered->setName("numbered");
  optNamedOrNumbered->insert(optNumbered);
  optNumbered->show();
  layout->addWidget(optNumbered, 4, 0);
  namedWidgets["newService_numbered"] = optNumbered;
  
  KLineEdit *ports = new KLineEdit(dialogArea);
  ports->show();
  layout->addWidget(ports, 4, 1);
  namedWidgets["newService_ports"] = ports;
  
  QButtonGroup *optAllowDeny = new QButtonGroup(dialogArea);
  optAllowDeny->hide();
  namedWidgets["newService_allowDeny"] = optAllowDeny;
  
  KSeparator *separator = new KSeparator(dialogArea);
  separator->show();
  layout->addMultiCellWidget(separator, 5, 5, 0, 1);
  
  QRadioButton *optAllow = new QRadioButton(i18n("&Accept"), dialogArea);
  optAllow->setName(i18n("Accept"));
  optAllow->setChecked(true);
  optAllow->show();
  optAllowDeny->insert(optAllow);
  layout->addWidget(optAllow, 6, 0);
  
  QRadioButton *optDeny = new QRadioButton(i18n("&Drop"), dialogArea);
  optDeny->setName(i18n("Drop"));
  optDeny->show();
  optAllowDeny->insert(optDeny);
  layout->addWidget(optDeny, 6, 1);
    
  dialogArea->show();
  newServiceDialog->setMainWidget(dialogArea);
  connect(newServiceDialog, SIGNAL(okClicked()), this, SLOT(slotAddService()));
  slotChangedProtocol(2); // TCP+UDP
}