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"));
}
Exemple #2
0
bool
StdWidgetFactory::readSpecialProperty(const QCString &classname, QDomElement &node, QWidget *w, KFormDesigner::ObjectTreeItem *)
{
	QString tag = node.tagName();
	QString name = node.attribute("name");

	if((tag == "item") && (classname == "KComboBox"))
	{
		KComboBox *combo = (KComboBox*)w;
		QVariant val = KFormDesigner::FormIO::readPropertyValue(node.firstChild().firstChild(), w, name);
		if(val.canCast(QVariant::Pixmap))
			combo->insertItem(val.toPixmap());
		else
			combo->insertItem(val.toString());
		return true;
	}

	if((tag == "item") && (classname == "KListBox"))
	{
		KListBox *listbox = (KListBox*)w;
		QVariant val = KFormDesigner::FormIO::readPropertyValue(node.firstChild().firstChild(), w, name);
		if(val.canCast(QVariant::Pixmap))
			listbox->insertItem(val.toPixmap());
		else
			listbox->insertItem(val.toString());
		return true;
	}

	if((tag == "column") && (classname == "KListView"))
	{
		KListView *listview = (KListView*)w;
		int id=0;
		for(QDomNode n = node.firstChild(); !n.isNull(); n = n.nextSibling())
		{
			QString prop = n.toElement().attribute("name");
			QVariant val = KFormDesigner::FormIO::readPropertyValue(n.firstChild(), w, name);
			if(prop == "text")
				id = listview->addColumn(val.toString());
			else if(prop == "width")
				listview->setColumnWidth(id, val.toInt());
			else if(prop == "resizable")
				listview->header()->setResizeEnabled(val.toBool(), id);
			else if(prop == "clickable")
				listview->header()->setClickEnabled(val.toBool(), id);
			else if(prop == "fullwidth")
				listview->header()->setStretchEnabled(val.toBool(), id);
		}
		return true;
	}
	else if((tag == "item") && (classname == "KListView"))
	{
		KListView *listview = (KListView*)w;
		readListItem(node, 0, listview);
		return true;
	}

	return false;
}
Exemple #3
0
LinkDialog::LinkDialog(QWidget* parent, Selection* selection)
        : KPageDialog(parent)
        , d(new Private)
{
    setCaption(i18n("Insert Link"));
    setButtons(Ok | Cancel);
    setFaceType(List);

    // link for web or ftp
    d->internetPage = new QWidget();
    d->p1 = addPage(d->internetPage, i18n("Internet"));
    d->p1->setHeader(i18n("Link to Internet Address"));
    d->p1->setIcon(KIcon("internet-web-browser"));
    QVBoxLayout* iLayout = new QVBoxLayout(d->internetPage);
    iLayout->addWidget(new QLabel(i18n("Text to display:"), d->internetPage));
    d->internetText = new KLineEdit(d->internetPage);
    iLayout->addWidget(d->internetText);
    iLayout->addWidget(new QLabel(i18n("Internet address:"), d->internetPage));
    d->internetLink = new KLineEdit(d->internetPage);
    iLayout->addWidget(d->internetLink);
    iLayout->addItem(new QSpacerItem(0, 0, QSizePolicy::Minimum, QSizePolicy::Expanding));
    connect(d->internetText, SIGNAL(textChanged(const QString&)), this,
            SLOT(setText(const QString&)));

    // link for e-mail
    d->mailPage = new QWidget();
    d->p2 = addPage(d->mailPage, i18n("Mail"));
    d->p2->setHeader(i18n("Link to Mail Address"));
    d->p2->setIcon(KIcon("mail-message"));
    QVBoxLayout* mLayout = new QVBoxLayout(d->mailPage);
    mLayout->addWidget(new QLabel(i18n("Text to display:"), d->mailPage));
    d->mailText = new KLineEdit(d->mailPage);
    mLayout->addWidget(d->mailText);
    mLayout->addWidget(new QLabel(i18n("Email:"), d->mailPage));
    d->mailLink = new KLineEdit(d->mailPage);
    mLayout->addWidget(d->mailLink);
    connect(d->mailText, SIGNAL(textChanged(const QString&)), this,
            SLOT(setText(const QString&)));
    mLayout->addWidget(new QLabel(i18n("Subject:"), d->mailPage));
    d->mailSubject = new KLineEdit(d->mailPage);
    mLayout->addWidget(d->mailSubject);
    mLayout->addItem(new QSpacerItem(0, 0, QSizePolicy::Minimum, QSizePolicy::Expanding));

    // link for external file
    d->filePage = new QWidget();
    d->p3 = addPage(d->filePage, i18n("File"));
    d->p3->setHeader(i18n("Link to File"));
    d->p3->setIcon(KIcon("system-file-manager"));
    QVBoxLayout* fLayout = new QVBoxLayout(d->filePage);
    fLayout->addWidget(new QLabel(i18n("Text to display:"), d->filePage));
    d->fileText = new KLineEdit(d->filePage);
    fLayout->addWidget(d->fileText);
    fLayout->addWidget(new QLabel(i18n("File location:"), d->filePage));
    d->fileLink = new KUrlRequester(d->filePage);
    d->fileLink->completionObject()->setReplaceHome(true);
    d->fileLink->completionObject()->setReplaceEnv(true);
    fLayout->addWidget(d->fileLink);
    fLayout->addWidget(new QLabel(i18n("Recent file:"), d->filePage));
    KComboBox* recentFile = new KComboBox(d->filePage);
    recentFile->setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Fixed);
    recentFile->setMinimumContentsLength(40);
    fLayout->addWidget(recentFile);
    fLayout->addItem(new QSpacerItem(0, 40, QSizePolicy::Minimum, QSizePolicy::MinimumExpanding));
    connect(d->fileText, SIGNAL(textChanged(const QString&)), this,
            SLOT(setText(const QString&)));
    QObject::connect(recentFile, SIGNAL(highlighted(const QString &)),
                     d->fileLink->lineEdit(), SLOT(setText(const QString &)));

    // populate recent files
    int index = 0;
    const QStringList fileList = KRecentDocument::recentDocuments();
    for (QStringList::ConstIterator it = fileList.constBegin(); it != fileList.constEnd(); ++it) {
        KDesktopFile f(*it);
        if (!f.readUrl().isEmpty())
            recentFile->insertItem(index++, f.readUrl());
    }
    if (recentFile->count() == 0) {
        recentFile->insertItem(0, i18n("No Entries"));
        recentFile->setEnabled(false);
    }

    // link to another cell
    d->cellPage = new QWidget();
    d->p4 = addPage(d->cellPage, i18n("Cell"));
    d->p4->setHeader(i18n("Link to Cell"));
    d->p4->setIcon(KIcon("table"));
    QVBoxLayout* cLayout = new QVBoxLayout(d->cellPage);
    cLayout->addWidget(new QLabel(i18n("Text to display:"), d->cellPage));
    d->cellText = new KLineEdit(d->cellPage);
    cLayout->addWidget(d->cellText);
    cLayout->addWidget(new QLabel(i18n("Cell or Named Area:"), d->cellPage));
    d->cellLink = new KComboBox(d->cellPage);
    d->cellLink->setEditable(true);

    const Sheet *sheet = selection->activeSheet();
    if (sheet && selection) {
        Cell cell(sheet, selection->cursor());
        d->cellLink->addItem(cell.fullName());
    }

    const NamedAreaManager *manager = selection->activeSheet()->map()->namedAreaManager();
    d->cellLink->addItems(manager->areaNames());

    d->cellLink->setItemText(d->cellLink->currentIndex(), "");
    cLayout->addWidget(d->cellLink);
    cLayout->addItem(new QSpacerItem(0, 0, QSizePolicy::Minimum, QSizePolicy::Expanding));
    connect(d->cellText, SIGNAL(textChanged(const QString&)), this,
            SLOT(setText(const QString&)));

    showButtonSeparator(true);
    d->internetText->setFocus();
    resize(400, 300);
    connect(this, SIGNAL(okClicked()), this, SLOT(slotOk()));
}
Exemple #4
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) ) );
}
DialogCreateTag::DialogCreateTag(QWidget *parent, TagTreeNode* parentNode, const char *name)
    : KDialogBase(parent, name, true, "", KDialogBase::Ok|KDialogBase::Cancel, KDialogBase::Ok, false )
    , m_parentNode(parentNode) {

    if (parentNode) {
        this->setCaption(i18n("Create tag"));
    } else {
        this->setCaption(i18n("Create toplevel tag"));
    }

    QWidget* mainPanel = new QWidget(this, "mainPanel");
    setMainWidget(mainPanel);
    QVBoxLayout* mainPanelLayout = new QVBoxLayout(mainPanel, 0, 5, "mainPanelLayout");
    mainPanelLayout->setAutoAdd(true);

    // parent
    if (parentNode) {
        // newTagGroup
        QGroupBox* parentTagGroup = new QGroupBox(i18n("Parent tag"), mainPanel, "parentTagGroup");
        QGridLayout* parentTagGroupLayout = new QGridLayout(parentTagGroup, 4, 4, 20, 5, "parentTagGroupLayout");

        parentTagGroupLayout->setRowSpacing(0, 10);

        // type
        QLabel* typeLabel = new QLabel(i18n("Type"), parentTagGroup, "typeLabel");
        parentTagGroupLayout->addWidget(typeLabel, 1, 0);

        KComboBox* typeComboBox = new KComboBox(false, parentTagGroup, "typeComboBox");
        typeComboBox->insertItem(parentNode->tagNode()->typeName());
        typeComboBox->setEnabled(false);
        parentTagGroupLayout->addMultiCellWidget(typeComboBox, 1, 1, 1, 2);

        // name
        QLabel* nameLabel = new QLabel(i18n("Name"), parentTagGroup, "nameLabel");
        parentTagGroupLayout->addWidget(nameLabel, 2, 0);

        KLineEdit* nameLineEdit = new KLineEdit(parentTagGroup, "nameLineEdit");
        nameLineEdit->setText(*parentNode->tagNode()->text());
        nameLineEdit->setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Fixed);
        nameLineEdit->setReadOnly(true);
        parentTagGroupLayout->addMultiCellWidget(nameLineEdit, 2, 2, 1, 2);

        // icon
        QLabel* iconLabel = new QLabel(i18n("Icon"), parentTagGroup, "iconLabel");
        parentTagGroupLayout->addWidget(iconLabel, 3, 0);

        KLineEdit* iconLineEdit = new KLineEdit(parentTagGroup, "iconLineEdit");
        iconLineEdit->setText(*parentNode->tagNode()->iconName());
        iconLineEdit->setMinimumWidth(300);
        iconLineEdit->setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Fixed);
        iconLineEdit->setReadOnly(true);
        parentTagGroupLayout->addWidget(iconLineEdit, 3, 1);

        QPushButton* iconButton = new QPushButton(i18n("Icon"), parentTagGroup, "iconButton");
        QIconSet iconSet = KGlobal::iconLoader()->loadIconSet(iconLineEdit->text(), KIcon::Small, Configuration::getInstance()->tagtreeIconSize(), true);
        iconButton->setIconSet(iconSet);
        iconButton->setText(QString::null);
        iconButton->setSizePolicy(QSizePolicy::Fixed, QSizePolicy::Fixed);
        iconButton->setEnabled(true);
        parentTagGroupLayout->addWidget(iconButton, 3, 2);
    }

    // newTagGroup
    QGroupBox* newTagGroup = new QGroupBox(i18n("New tag"), mainPanel, "newTagGroup");
    QGridLayout* newTagGroupLayout = new QGridLayout(newTagGroup, 4, 4, 20, 5, "newTagGroupLayout");

    newTagGroupLayout->setRowSpacing(0, 10);

    // type
    QLabel* typeLabel = new QLabel(i18n("Type"), newTagGroup, "typeLabel");
    newTagGroupLayout->addWidget(typeLabel, 1, 0);

    m_typeComboBox = new KComboBox(false, newTagGroup, "typeComboBox");
    m_typeComboBoxEntries = new QValueList<int>;
    if (!parentNode) {
        m_typeComboBox->insertItem(TagNode::tagNodeTypeName(TagNode::TYPE_TITLE));
        m_typeComboBoxEntries->append(TagNode::tagNodeTypeId(TagNode::TYPE_TITLE));
    }
    m_typeComboBox->insertItem(TagNode::tagNodeTypeName(TagNode::TYPE_BOOLEAN));
    m_typeComboBoxEntries->append(TagNode::tagNodeTypeId(TagNode::TYPE_BOOLEAN));
    newTagGroupLayout->addMultiCellWidget(m_typeComboBox, 1, 1, 1, 2);

    // name
    QLabel* nameLabel = new QLabel(i18n("Name"), newTagGroup, "nameLabel");
    newTagGroupLayout->addWidget(nameLabel, 2, 0);

    m_nameLineEdit = new KLineEdit(newTagGroup, "nameLineEdit");
    m_nameLineEdit->setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Fixed);
    QObject::connect(m_nameLineEdit, SIGNAL(textChanged(const QString&)), this, SLOT(slotNameChanged(const QString&)));
    newTagGroupLayout->addMultiCellWidget(m_nameLineEdit, 2, 2, 1, 2);

    // icon
    QLabel* iconLabel = new QLabel(i18n("Icon"), newTagGroup, "iconLabel");
    newTagGroupLayout->addWidget(iconLabel, 3, 0);

    m_iconLineEdit = new KLineEdit(newTagGroup, "iconLineEdit");
    m_iconLineEdit->setMinimumWidth(300);
    m_iconLineEdit->setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Fixed);
    QObject::connect(m_iconLineEdit, SIGNAL(textChanged(const QString&)), this, SLOT(slotIconTextChanged(const QString&)));
    newTagGroupLayout->addWidget(m_iconLineEdit, 3, 1);

    m_iconButton = new QPushButton(i18n("Icon"), newTagGroup, "iconButton");
    m_iconButton->setSizePolicy(QSizePolicy::Fixed, QSizePolicy::Fixed);
    newTagGroupLayout->addWidget(m_iconButton, 3, 2);

    QObject::connect(m_iconButton, SIGNAL(clicked()), this, SLOT(slotIconButtonClicked()));

    // spacer
    QWidget* spacer = new QWidget(mainPanel, "spacer");
    spacer->setSizePolicy(QSizePolicy::Fixed, QSizePolicy::Expanding);

    // disable ok button
    validate();

    // set the focus
    m_nameLineEdit->setFocus();
}
//
// Linux
//
void Smb4KConfigPageMounting::setupWidget()
{
  QVBoxLayout *mount_layout = new QVBoxLayout(this);
  mount_layout->setSpacing(5);
  mount_layout->setMargin(0);

  // Common Options
  QGroupBox *common_options = new QGroupBox(i18n("Common Options"), this);

  QGridLayout *common_layout = new QGridLayout(common_options);
  common_layout->setSpacing(5);

  QLabel *user_id_label = new QLabel(Smb4KMountSettings::self()->userIDItem()->label(), common_options);

  QWidget *user_widget = new QWidget(common_options);

  QGridLayout *user_layout = new QGridLayout(user_widget);
  user_layout->setSpacing(5);
  user_layout->setMargin(0);

  KLineEdit *user_id = new KLineEdit(user_widget);
  user_id->setObjectName("kcfg_UserID");
  user_id->setAlignment(Qt::AlignRight);
  user_id->setReadOnly(true);

  QToolButton *user_chooser = new QToolButton(user_widget);
  user_chooser->setIcon(KDE::icon("edit-find-user"));
  user_chooser->setToolTip(i18n("Choose a different user"));
  user_chooser->setPopupMode(QToolButton::InstantPopup);

  user_id_label->setBuddy(user_chooser);
  
  QMenu *user_menu = new QMenu(user_chooser);
  user_chooser->setMenu(user_menu);

  QList<KUser> user_list = KUser::allUsers();
  QMap<QString,QString> users;

  for (int i = 0; i < user_list.size(); ++i)
  {
    users.insert(QString("%1 (%2)").arg(user_list.at(i).loginName()).arg(user_list.at(i).userId().nativeId()),
                 QString("%1").arg(user_list.at(i).userId().nativeId()));
  }

  QMap<QString,QString>::const_iterator u_it = users.constBegin();

  while (u_it != users.constEnd())
  {
    QAction *user_action = user_menu->addAction(u_it.key());
    user_action->setData(u_it.value());
    ++u_it;
  }

  user_layout->addWidget(user_id, 0, 0, 0);
  user_layout->addWidget(user_chooser, 0, 1, Qt::AlignCenter);

  QLabel *group_id_label = new QLabel(Smb4KMountSettings::self()->groupIDItem()->label(), common_options);

  QWidget *group_widget = new QWidget(common_options);

  QGridLayout *group_layout = new QGridLayout(group_widget);
  group_layout->setSpacing(5);
  group_layout->setMargin(0);

  KLineEdit *group_id = new KLineEdit(group_widget);
  group_id->setObjectName("kcfg_GroupID");
  group_id->setAlignment(Qt::AlignRight);
  group_id->setReadOnly(true);
  
  QToolButton *group_chooser = new QToolButton(group_widget);
  group_chooser->setIcon(KDE::icon("edit-find-user"));
  group_chooser->setToolTip(i18n("Choose a different group"));
  group_chooser->setPopupMode(QToolButton::InstantPopup);

  group_id_label->setBuddy(group_chooser);

  QMenu *group_menu = new QMenu(group_chooser);
  group_chooser->setMenu(group_menu);

  QList<KUserGroup> group_list = KUserGroup::allGroups();
  QMap<QString,QString> groups;

  for (int i = 0; i < group_list.size(); ++i)
  {
    groups.insert(QString("%1 (%2)").arg(group_list.at(i).name()).arg(group_list.at(i).groupId().nativeId()),
                  QString("%1").arg(group_list.at(i).groupId().nativeId()));
  }

  QMap<QString,QString>::const_iterator g_it = groups.constBegin();

  while (g_it != groups.constEnd())
  {
    QAction *group_action = group_menu->addAction(g_it.key());
    group_action->setData(g_it.value());
    ++g_it;
  }

  group_layout->addWidget(group_id, 0, 0, 0);
  group_layout->addWidget(group_chooser, 0, 1, Qt::AlignCenter);

  QLabel *fmask_label = new QLabel(Smb4KMountSettings::self()->fileMaskItem()->label(), common_options);

  KLineEdit *fmask = new KLineEdit(common_options);
  fmask->setObjectName("kcfg_FileMask");
  fmask->setAlignment(Qt::AlignRight);

  fmask_label->setBuddy(fmask);

  QLabel *dmask_label = new QLabel(Smb4KMountSettings::self()->directoryMaskItem()->label(), common_options);

  KLineEdit *dmask = new KLineEdit(common_options);
  dmask->setObjectName("kcfg_DirectoryMask");
  dmask->setAlignment(Qt::AlignRight);

  dmask_label->setBuddy(dmask);
  
  QLabel *write_access_label = new QLabel(Smb4KMountSettings::self()->writeAccessItem()->label(), common_options);

  KComboBox *write_access      = new KComboBox(common_options);
  write_access->setObjectName("kcfg_WriteAccess");
  write_access->insertItem(Smb4KMountSettings::EnumWriteAccess::ReadWrite,
                           Smb4KMountSettings::self()->writeAccessItem()->choices().value(Smb4KMountSettings::EnumWriteAccess::ReadWrite).label);
  write_access->insertItem(Smb4KMountSettings::EnumWriteAccess::ReadOnly,
                           Smb4KMountSettings::self()->writeAccessItem()->choices().value(Smb4KMountSettings::EnumWriteAccess::ReadOnly).label);

  write_access_label->setBuddy(write_access);

  QLabel *charset_label = new QLabel(Smb4KMountSettings::self()->clientCharsetItem()->label(), common_options);

  KComboBox *charset = new KComboBox(common_options);
  charset->setObjectName("kcfg_ClientCharset");
  charset->insertItem(Smb4KMountSettings::EnumClientCharset::default_charset,
                      Smb4KMountSettings::self()->clientCharsetItem()->choices().value(Smb4KMountSettings::EnumClientCharset::default_charset).label);
  charset->insertItem(Smb4KMountSettings::EnumClientCharset::iso8859_1,
                      Smb4KMountSettings::self()->clientCharsetItem()->choices().value(Smb4KMountSettings::EnumClientCharset::iso8859_1).label);
  charset->insertItem(Smb4KMountSettings::EnumClientCharset::iso8859_2,
                      Smb4KMountSettings::self()->clientCharsetItem()->choices().value(Smb4KMountSettings::EnumClientCharset::iso8859_2).label);
  charset->insertItem(Smb4KMountSettings::EnumClientCharset::iso8859_3,
                      Smb4KMountSettings::self()->clientCharsetItem()->choices().value(Smb4KMountSettings::EnumClientCharset::iso8859_3).label);
  charset->insertItem(Smb4KMountSettings::EnumClientCharset::iso8859_4,
                      Smb4KMountSettings::self()->clientCharsetItem()->choices().value(Smb4KMountSettings::EnumClientCharset::iso8859_4).label);
  charset->insertItem(Smb4KMountSettings::EnumClientCharset::iso8859_5,
                      Smb4KMountSettings::self()->clientCharsetItem()->choices().value(Smb4KMountSettings::EnumClientCharset::iso8859_5).label);
  charset->insertItem(Smb4KMountSettings::EnumClientCharset::iso8859_6,
                      Smb4KMountSettings::self()->clientCharsetItem()->choices().value(Smb4KMountSettings::EnumClientCharset::iso8859_6).label);
  charset->insertItem(Smb4KMountSettings::EnumClientCharset::iso8859_7,
                      Smb4KMountSettings::self()->clientCharsetItem()->choices().value(Smb4KMountSettings::EnumClientCharset::iso8859_7).label);
  charset->insertItem(Smb4KMountSettings::EnumClientCharset::iso8859_8,
                      Smb4KMountSettings::self()->clientCharsetItem()->choices().value(Smb4KMountSettings::EnumClientCharset:: iso8859_8).label);
  charset->insertItem(Smb4KMountSettings::EnumClientCharset::iso8859_9,
                      Smb4KMountSettings::self()->clientCharsetItem()->choices().value(Smb4KMountSettings::EnumClientCharset::iso8859_9).label);
  charset->insertItem(Smb4KMountSettings::EnumClientCharset::iso8859_13,
                      Smb4KMountSettings::self()->clientCharsetItem()->choices().value(Smb4KMountSettings::EnumClientCharset::iso8859_13).label);
  charset->insertItem(Smb4KMountSettings::EnumClientCharset::iso8859_14,
                      Smb4KMountSettings::self()->clientCharsetItem()->choices().value(Smb4KMountSettings::EnumClientCharset::iso8859_14).label);
  charset->insertItem(Smb4KMountSettings::EnumClientCharset::iso8859_15,
                      Smb4KMountSettings::self()->clientCharsetItem()->choices().value(Smb4KMountSettings::EnumClientCharset::iso8859_15).label);
  charset->insertItem(Smb4KMountSettings::EnumClientCharset::utf8,
                      Smb4KMountSettings::self()->clientCharsetItem()->choices().value(Smb4KMountSettings::EnumClientCharset::utf8).label);
  charset->insertItem(Smb4KMountSettings::EnumClientCharset::koi8_r,
                      Smb4KMountSettings::self()->clientCharsetItem()->choices().value(Smb4KMountSettings::EnumClientCharset::koi8_r).label);
  charset->insertItem(Smb4KMountSettings::EnumClientCharset::koi8_u,
                      Smb4KMountSettings::self()->clientCharsetItem()->choices().value(Smb4KMountSettings::EnumClientCharset::koi8_u).label);
  charset->insertItem(Smb4KMountSettings::EnumClientCharset::koi8_ru,
                      Smb4KMountSettings::self()->clientCharsetItem()->choices().value(Smb4KMountSettings::EnumClientCharset::koi8_ru).label);
  charset->insertItem(Smb4KMountSettings::EnumClientCharset::cp1251,
                      Smb4KMountSettings::self()->clientCharsetItem()->choices().value(Smb4KMountSettings::EnumClientCharset::cp1251).label);
  charset->insertItem(Smb4KMountSettings::EnumClientCharset::gb2312,
                      Smb4KMountSettings::self()->clientCharsetItem()->choices().value(Smb4KMountSettings::EnumClientCharset::gb2312).label);
  charset->insertItem(Smb4KMountSettings::EnumClientCharset::big5,
                      Smb4KMountSettings::self()->clientCharsetItem()->choices().value(Smb4KMountSettings::EnumClientCharset::big5).label);
  charset->insertItem(Smb4KMountSettings::EnumClientCharset::euc_jp,
                      Smb4KMountSettings::self()->clientCharsetItem()->choices().value(Smb4KMountSettings::EnumClientCharset::euc_jp).label);
  charset->insertItem(Smb4KMountSettings::EnumClientCharset::euc_kr,
                      Smb4KMountSettings::self()->clientCharsetItem()->choices().value(Smb4KMountSettings::EnumClientCharset::euc_kr).label);
  charset->insertItem(Smb4KMountSettings::EnumClientCharset::tis_620,
                      Smb4KMountSettings::self()->clientCharsetItem()->choices().value(Smb4KMountSettings::EnumClientCharset::tis_620).label);
  charset_label->setBuddy(charset);
  
  QLabel *remote_fs_port_label = new QLabel(Smb4KMountSettings::self()->remoteFileSystemPortItem()->label(), common_options);

  QSpinBox *remote_fs_port = new QSpinBox(common_options);
  remote_fs_port->setObjectName("kcfg_RemoteFileSystemPort");
//   remote_fs_port->setSliderEnabled(true);

  common_layout->addWidget(user_id_label, 0, 0, 0);
  common_layout->addWidget(user_widget, 0, 1, 0);
  common_layout->addWidget(group_id_label, 1, 0, 0);
  common_layout->addWidget(group_widget, 1, 1, 0);
  common_layout->addWidget(fmask_label, 2, 0, 0);
  common_layout->addWidget(fmask, 2, 1, 0);
  common_layout->addWidget(dmask_label, 3, 0, 0);
  common_layout->addWidget(dmask, 3, 1, 0);
  common_layout->addWidget(write_access_label, 4, 0, 0);
  common_layout->addWidget(write_access, 4, 1, 0);
  common_layout->addWidget(charset_label, 5, 0, 0);
  common_layout->addWidget(charset, 5, 1, 0);
  common_layout->addWidget(remote_fs_port_label, 6, 0, 0);
  common_layout->addWidget(remote_fs_port, 6, 1, 0);

  // Advanced CIFS options
  QGroupBox *advanced_options = new QGroupBox(i18n("Advanced Options"), this);

  QGridLayout *advanced_layout = new QGridLayout(advanced_options);
  advanced_layout->setSpacing(5);
  
  QCheckBox *force_uid = new QCheckBox(Smb4KMountSettings::self()->forceUIDItem()->label(), advanced_options);
  force_uid->setObjectName("kcfg_ForceUID");
  
  QCheckBox *force_gid = new QCheckBox(Smb4KMountSettings::self()->forceGIDItem()->label(), advanced_options);
  force_gid->setObjectName("kcfg_ForceGID");

  QCheckBox *permission_checks = new QCheckBox(Smb4KMountSettings::self()->permissionChecksItem()->label(), advanced_options);
  permission_checks->setObjectName("kcfg_PermissionChecks");

  QCheckBox *client_controls = new QCheckBox(Smb4KMountSettings::self()->clientControlsIDsItem()->label(), advanced_options);
  client_controls->setObjectName("kcfg_ClientControlsIDs");

  QCheckBox *server_inodes = new QCheckBox(Smb4KMountSettings::self()->serverInodeNumbersItem()->label(), advanced_options);
  server_inodes->setObjectName("kcfg_ServerInodeNumbers");

  QCheckBox *reserved_chars = new QCheckBox(Smb4KMountSettings::self()->translateReservedCharsItem()->label(), advanced_options);
  reserved_chars->setObjectName("kcfg_TranslateReservedChars");

  QCheckBox *no_locking = new QCheckBox(Smb4KMountSettings::self()->noLockingItem()->label(), advanced_options);
  no_locking->setObjectName("kcfg_NoLocking");

  QWidget *c_extra_widget = new QWidget(advanced_options);

  QGridLayout *c_extra_layout = new QGridLayout(c_extra_widget);
  c_extra_layout->setSpacing(5);
  c_extra_layout->setMargin(0);
  
  QLabel *smbProtocol_label = new QLabel(Smb4KMountSettings::self()->smbProtocolVersionItem()->label(), c_extra_widget);
  
  KComboBox *smbProtocol_box = new KComboBox(c_extra_widget);
  smbProtocol_box->setObjectName("kcfg_SmbProtocolVersion");
  smbProtocol_box->insertItem(Smb4KMountSettings::EnumSmbProtocolVersion::OnePointZero,
                              Smb4KMountSettings::self()->smbProtocolVersionItem()->choices().value(Smb4KMountSettings::EnumSmbProtocolVersion::OnePointZero).label);
  smbProtocol_box->insertItem(Smb4KMountSettings::EnumSmbProtocolVersion::TwoPointZero,
                              Smb4KMountSettings::self()->smbProtocolVersionItem()->choices().value(Smb4KMountSettings::EnumSmbProtocolVersion::TwoPointZero).label);
  smbProtocol_box->insertItem(Smb4KMountSettings::EnumSmbProtocolVersion::TwoPointOne,
                              Smb4KMountSettings::self()->smbProtocolVersionItem()->choices().value(Smb4KMountSettings::EnumSmbProtocolVersion::TwoPointOne).label);
  smbProtocol_box->insertItem(Smb4KMountSettings::EnumSmbProtocolVersion::ThreePointZero,
                              Smb4KMountSettings::self()->smbProtocolVersionItem()->choices().value(Smb4KMountSettings::EnumSmbProtocolVersion::ThreePointZero).label);
  
  QLabel *cache_label = new QLabel(Smb4KMountSettings::self()->cacheModeItem()->label(), c_extra_widget);
  
  KComboBox *cache_box = new KComboBox(c_extra_widget);
  cache_box->setObjectName("kcfg_CacheMode");
  cache_box->insertItem(Smb4KMountSettings::EnumCacheMode::None,
                        Smb4KMountSettings::self()->cacheModeItem()->choices().value(Smb4KMountSettings::EnumCacheMode::None).label);
  cache_box->insertItem(Smb4KMountSettings::EnumCacheMode::Strict,
                        Smb4KMountSettings::self()->cacheModeItem()->choices().value(Smb4KMountSettings::EnumCacheMode::Strict).label);
  cache_box->insertItem(Smb4KMountSettings::EnumCacheMode::Loose,
                        Smb4KMountSettings::self()->cacheModeItem()->choices().value(Smb4KMountSettings::EnumCacheMode::Loose).label);
  cache_label->setBuddy(cache_box);
  
  QLabel *security_label = new QLabel(Smb4KMountSettings::self()->securityModeItem()->label(), c_extra_widget);
                                 
  KComboBox *security_box = new KComboBox(c_extra_widget);
  security_box->setObjectName("kcfg_SecurityMode");
  security_box->insertItem(Smb4KMountSettings::EnumSecurityMode::None,
                           Smb4KMountSettings::self()->securityModeItem()->choices().value(Smb4KMountSettings::EnumSecurityMode::None).label);
  security_box->insertItem(Smb4KMountSettings::EnumSecurityMode::Krb5,
                           Smb4KMountSettings::self()->securityModeItem()->choices().value(Smb4KMountSettings::EnumSecurityMode::Krb5).label);
  security_box->insertItem(Smb4KMountSettings::EnumSecurityMode::Krb5i,
                           Smb4KMountSettings::self()->securityModeItem()->choices().value(Smb4KMountSettings::EnumSecurityMode::Krb5i).label);
  security_box->insertItem(Smb4KMountSettings::EnumSecurityMode::Ntlm,
                           Smb4KMountSettings::self()->securityModeItem()->choices().value(Smb4KMountSettings::EnumSecurityMode::Ntlm).label);
  security_box->insertItem(Smb4KMountSettings::EnumSecurityMode::Ntlmi,
                           Smb4KMountSettings::self()->securityModeItem()->choices().value(Smb4KMountSettings::EnumSecurityMode::Ntlmi).label);
  security_box->insertItem(Smb4KMountSettings::EnumSecurityMode::Ntlmv2,
                           Smb4KMountSettings::self()->securityModeItem()->choices().value(Smb4KMountSettings::EnumSecurityMode::Ntlmv2).label);
  security_box->insertItem(Smb4KMountSettings::EnumSecurityMode::Ntlmv2i,
                           Smb4KMountSettings::self()->securityModeItem()->choices().value(Smb4KMountSettings::EnumSecurityMode::Ntlmv2i).label);
  security_box->insertItem(Smb4KMountSettings::EnumSecurityMode::Ntlmssp,
                           Smb4KMountSettings::self()->securityModeItem()->choices().value(Smb4KMountSettings::EnumSecurityMode::Ntlmssp).label);
  security_box->insertItem(Smb4KMountSettings::EnumSecurityMode::Ntlmsspi,
                           Smb4KMountSettings::self()->securityModeItem()->choices().value(Smb4KMountSettings::EnumSecurityMode::Ntlmsspi).label);
  security_label->setBuddy(security_box);

  QLabel *add_options_label = new QLabel(Smb4KMountSettings::self()->customCIFSOptionsItem()->label(), c_extra_widget);

  KLineEdit *additional_opts = new KLineEdit(c_extra_widget);
  additional_opts->setObjectName("kcfg_CustomCIFSOptions");
  additional_opts->setReadOnly(true);
  additional_opts->setClearButtonShown(true);
  add_options_label->setBuddy(additional_opts);
  
  QToolButton *additional_opts_edit = new QToolButton(c_extra_widget);
  additional_opts_edit->setIcon(KDE::icon("document-edit"));
  additional_opts_edit->setToolTip(i18n("Edit the additional CIFS options."));

  c_extra_layout->addWidget(smbProtocol_label, 0, 0, 0);
  c_extra_layout->addWidget(smbProtocol_box, 0, 1, 1, 2, 0);
  c_extra_layout->addWidget(cache_label, 1, 0, 0);
  c_extra_layout->addWidget(cache_box, 1, 1, 1, 2, 0);
  c_extra_layout->addWidget(security_label, 2, 0, 0);
  c_extra_layout->addWidget(security_box, 2, 1, 1, 2, 0);
  c_extra_layout->addWidget(add_options_label, 3, 0, 0);
  c_extra_layout->addWidget(additional_opts, 3, 1, 0);
  c_extra_layout->addWidget(additional_opts_edit, 3, 2, 0);

  advanced_layout->addWidget(force_uid, 0, 0, 0);
  advanced_layout->addWidget(force_gid, 0, 1, 0);
  advanced_layout->addWidget(permission_checks, 1, 0, 0);
  advanced_layout->addWidget(client_controls, 1, 1, 0);
  advanced_layout->addWidget(server_inodes, 2, 0, 0);
  advanced_layout->addWidget(reserved_chars, 2, 1, 0);
  advanced_layout->addWidget(no_locking, 3, 0, 0);
  advanced_layout->addWidget(c_extra_widget, 4, 0, 1, 2, 0);

  mount_layout->addWidget(common_options);
  mount_layout->addWidget(advanced_options);
  mount_layout->addStretch(100);
  
  //
  // Connections
  //
  connect(user_menu, SIGNAL(triggered(QAction*)),
          this, SLOT(slotNewUserTriggered(QAction*)));
  connect(group_menu, SIGNAL(triggered(QAction*)),
          this, SLOT(slotNewGroupTriggered(QAction*)));
  connect(additional_opts_edit, SIGNAL(clicked(bool)),
          this, SLOT(slotAdditionalCIFSOptions()));
}
//
// FreeBSD and NetBSD
//
void Smb4KConfigPageMounting::setupWidget()
{
  QVBoxLayout *mount_layout = new QVBoxLayout(this);
  mount_layout->setSpacing(5);
  mount_layout->setMargin(0);

  // Common Options
  QGroupBox *common_options = new QGroupBox(i18n("Common Options"), this);

  QGridLayout *common_layout = new QGridLayout(common_options);
  common_layout->setSpacing(5);

  QLabel *user_id_label = new QLabel(Smb4KMountSettings::self()->userIDItem()->label(), common_options);

  QWidget *user_widget = new QWidget(common_options);

  QGridLayout *user_layout = new QGridLayout(user_widget);
  user_layout->setSpacing(5);
  user_layout->setMargin(0);

  KLineEdit *user_id = new KLineEdit(user_widget);
  user_id->setObjectName("kcfg_UserID");
  user_id->setAlignment(Qt::AlignRight);
  user_id->setReadOnly(true);

  QToolButton *user_chooser = new QToolButton(user_widget);
  user_chooser->setIcon(KDE::icon("edit-find-user"));
  user_chooser->setToolTip(i18n("Choose a different user"));
  user_chooser->setPopupMode(QToolButton::InstantPopup);

  user_id_label->setBuddy(user_chooser);
  
  QMenu *user_menu = new QMenu(user_chooser);
  user_chooser->setMenu(user_menu);

  QList<KUser> user_list = KUser::allUsers();
  QMap<QString,QString> users;

  for (int i = 0; i < user_list.size(); ++i)
  {
    users.insert(QString("%1 (%2)").arg(user_list.at(i).loginName()).arg(user_list.at(i).userId().nativeId()),
                 QString("%1").arg(user_list.at(i).userId().nativeId()));
  }

  QMap<QString,QString>::const_iterator u_it = users.constBegin();

  while (u_it != users.constEnd())
  {
    QAction *user_action = user_menu->addAction(u_it.key());
    user_action->setData(u_it.value());
    ++u_it;
  }

  user_layout->addWidget(user_id, 0, 0, 0);
  user_layout->addWidget(user_chooser, 0, 1, Qt::AlignCenter);

  QLabel *group_id_label = new QLabel(Smb4KMountSettings::self()->groupIDItem()->label(), common_options);

  QWidget *group_widget = new QWidget(common_options);

  QGridLayout *group_layout = new QGridLayout(group_widget);
  group_layout->setSpacing(5);
  group_layout->setMargin(0);

  KLineEdit *group_id = new KLineEdit(group_widget);
  group_id->setObjectName("kcfg_GroupID");
  group_id->setAlignment(Qt::AlignRight);
  group_id->setReadOnly(true);
  
  QToolButton *group_chooser = new QToolButton(group_widget);
  group_chooser->setIcon(KDE::icon("edit-find-user"));
  group_chooser->setToolTip(i18n("Choose a different group"));
  group_chooser->setPopupMode(QToolButton::InstantPopup);

  group_id_label->setBuddy(group_chooser);

  QMenu *group_menu = new QMenu(group_chooser);
  group_chooser->setMenu(group_menu);

  QList<KUserGroup> group_list = KUserGroup::allGroups();
  QMap<QString,QString> groups;

  for (int i = 0; i < group_list.size(); ++i)
  {
    groups.insert(QString("%1 (%2)").arg(group_list.at(i).name()).arg(group_list.at(i).groupId().nativeId()),
                  QString("%1").arg(group_list.at(i).groupId().nativeId()));
  }

  QMap<QString,QString>::const_iterator g_it = groups.constBegin();

  while (g_it != groups.constEnd())
  {
    QAction *group_action = group_menu->addAction(g_it.key());
    group_action->setData(g_it.value());
    ++g_it;
  }

  group_layout->addWidget(group_id, 0, 0, 0);
  group_layout->addWidget(group_chooser, 0, 1, Qt::AlignCenter);

  QLabel *fmask_label = new QLabel(Smb4KMountSettings::self()->fileMaskItem()->label(), common_options);

  KLineEdit *fmask = new KLineEdit(common_options);
  fmask->setObjectName("kcfg_FileMask");
  fmask->setAlignment(Qt::AlignRight);

  fmask_label->setBuddy(fmask);

  QLabel *dmask_label = new QLabel(Smb4KMountSettings::self()->directoryMaskItem()->label(), common_options);

  KLineEdit *dmask = new KLineEdit(common_options);
  dmask->setObjectName("kcfg_DirectoryMask");
  dmask->setAlignment(Qt::AlignRight);

  dmask_label->setBuddy(dmask);
  
  QLabel *charset_label = new QLabel(Smb4KMountSettings::self()->clientCharsetItem()->label(), common_options);

  KComboBox *charset = new KComboBox(common_options);
  charset->setObjectName("kcfg_ClientCharset");
  charset->insertItem(Smb4KMountSettings::EnumClientCharset::default_charset,
                      Smb4KMountSettings::self()->clientCharsetItem()->choices().value(Smb4KMountSettings::EnumClientCharset::default_charset).label);
  charset->insertItem(Smb4KMountSettings::EnumClientCharset::iso8859_1,
                      Smb4KMountSettings::self()->clientCharsetItem()->choices().value(Smb4KMountSettings::EnumClientCharset::iso8859_1).label);
  charset->insertItem(Smb4KMountSettings::EnumClientCharset::iso8859_2,
                      Smb4KMountSettings::self()->clientCharsetItem()->choices().value(Smb4KMountSettings::EnumClientCharset::iso8859_2).label);
  charset->insertItem(Smb4KMountSettings::EnumClientCharset::iso8859_3,
                      Smb4KMountSettings::self()->clientCharsetItem()->choices().value(Smb4KMountSettings::EnumClientCharset::iso8859_3).label);
  charset->insertItem(Smb4KMountSettings::EnumClientCharset::iso8859_4,
                      Smb4KMountSettings::self()->clientCharsetItem()->choices().value(Smb4KMountSettings::EnumClientCharset::iso8859_4).label);
  charset->insertItem(Smb4KMountSettings::EnumClientCharset::iso8859_5,
                      Smb4KMountSettings::self()->clientCharsetItem()->choices().value(Smb4KMountSettings::EnumClientCharset::iso8859_5).label);
  charset->insertItem(Smb4KMountSettings::EnumClientCharset::iso8859_6,
                      Smb4KMountSettings::self()->clientCharsetItem()->choices().value(Smb4KMountSettings::EnumClientCharset::iso8859_6).label);
  charset->insertItem(Smb4KMountSettings::EnumClientCharset::iso8859_7,
                      Smb4KMountSettings::self()->clientCharsetItem()->choices().value(Smb4KMountSettings::EnumClientCharset::iso8859_7).label);
  charset->insertItem(Smb4KMountSettings::EnumClientCharset::iso8859_8,
                      Smb4KMountSettings::self()->clientCharsetItem()->choices().value(Smb4KMountSettings::EnumClientCharset:: iso8859_8).label);
  charset->insertItem(Smb4KMountSettings::EnumClientCharset::iso8859_9,
                      Smb4KMountSettings::self()->clientCharsetItem()->choices().value(Smb4KMountSettings::EnumClientCharset::iso8859_9).label);
  charset->insertItem(Smb4KMountSettings::EnumClientCharset::iso8859_13,
                      Smb4KMountSettings::self()->clientCharsetItem()->choices().value(Smb4KMountSettings::EnumClientCharset::iso8859_13).label);
  charset->insertItem(Smb4KMountSettings::EnumClientCharset::iso8859_14,
                      Smb4KMountSettings::self()->clientCharsetItem()->choices().value(Smb4KMountSettings::EnumClientCharset::iso8859_14).label);
  charset->insertItem(Smb4KMountSettings::EnumClientCharset::iso8859_15,
                      Smb4KMountSettings::self()->clientCharsetItem()->choices().value(Smb4KMountSettings::EnumClientCharset::iso8859_15).label);
  charset->insertItem(Smb4KMountSettings::EnumClientCharset::utf8,
                      Smb4KMountSettings::self()->clientCharsetItem()->choices().value(Smb4KMountSettings::EnumClientCharset::utf8).label);
  charset->insertItem(Smb4KMountSettings::EnumClientCharset::koi8_r,
                      Smb4KMountSettings::self()->clientCharsetItem()->choices().value(Smb4KMountSettings::EnumClientCharset::koi8_r).label);
  charset->insertItem(Smb4KMountSettings::EnumClientCharset::koi8_u,
                      Smb4KMountSettings::self()->clientCharsetItem()->choices().value(Smb4KMountSettings::EnumClientCharset::koi8_u).label);
  charset->insertItem(Smb4KMountSettings::EnumClientCharset::koi8_ru,
                      Smb4KMountSettings::self()->clientCharsetItem()->choices().value(Smb4KMountSettings::EnumClientCharset::koi8_ru).label);
  charset->insertItem(Smb4KMountSettings::EnumClientCharset::cp1251,
                      Smb4KMountSettings::self()->clientCharsetItem()->choices().value(Smb4KMountSettings::EnumClientCharset::cp1251).label);
  charset->insertItem(Smb4KMountSettings::EnumClientCharset::gb2312,
                      Smb4KMountSettings::self()->clientCharsetItem()->choices().value(Smb4KMountSettings::EnumClientCharset::gb2312).label);
  charset->insertItem(Smb4KMountSettings::EnumClientCharset::big5,
                      Smb4KMountSettings::self()->clientCharsetItem()->choices().value(Smb4KMountSettings::EnumClientCharset::big5).label);
  charset->insertItem(Smb4KMountSettings::EnumClientCharset::euc_jp,
                      Smb4KMountSettings::self()->clientCharsetItem()->choices().value(Smb4KMountSettings::EnumClientCharset::euc_jp).label);
  charset->insertItem(Smb4KMountSettings::EnumClientCharset::euc_kr,
                      Smb4KMountSettings::self()->clientCharsetItem()->choices().value(Smb4KMountSettings::EnumClientCharset::euc_kr).label);
  charset->insertItem(Smb4KMountSettings::EnumClientCharset::tis_620,
                      Smb4KMountSettings::self()->clientCharsetItem()->choices().value(Smb4KMountSettings::EnumClientCharset::tis_620).label);

  charset_label->setBuddy(charset);

  QLabel *codepage_label = new QLabel(Smb4KMountSettings::self()->serverCodepageItem()->label(), common_options);
  codepage_label->setObjectName("CodepageLabel");

  KComboBox *codepage = new KComboBox(common_options);
  codepage->setObjectName("kcfg_ServerCodepage");
  codepage->insertItem(Smb4KMountSettings::EnumServerCodepage::default_codepage,
                       Smb4KMountSettings::self()->serverCodepageItem()->choices().value(Smb4KMountSettings::EnumServerCodepage::default_codepage).label);
  codepage->insertItem(Smb4KMountSettings::EnumServerCodepage::cp437,
                       Smb4KMountSettings::self()->serverCodepageItem()->choices().value(Smb4KMountSettings::EnumServerCodepage::cp437).label);
  codepage->insertItem(Smb4KMountSettings::EnumServerCodepage::cp720,
                       Smb4KMountSettings::self()->serverCodepageItem()->choices().value(Smb4KMountSettings::EnumServerCodepage::cp720).label);
  codepage->insertItem(Smb4KMountSettings::EnumServerCodepage::cp737,
                       Smb4KMountSettings::self()->serverCodepageItem()->choices().value(Smb4KMountSettings::EnumServerCodepage::cp737).label);
  codepage->insertItem(Smb4KMountSettings::EnumServerCodepage::cp775,
                       Smb4KMountSettings::self()->serverCodepageItem()->choices().value(Smb4KMountSettings::EnumServerCodepage::cp775).label);
  codepage->insertItem(Smb4KMountSettings::EnumServerCodepage::cp850,
                       Smb4KMountSettings::self()->serverCodepageItem()->choices().value(Smb4KMountSettings::EnumServerCodepage::cp850).label);
  codepage->insertItem(Smb4KMountSettings::EnumServerCodepage::cp852,
                       Smb4KMountSettings::self()->serverCodepageItem()->choices().value(Smb4KMountSettings::EnumServerCodepage::cp852).label);
  codepage->insertItem(Smb4KMountSettings::EnumServerCodepage::cp855,
                       Smb4KMountSettings::self()->serverCodepageItem()->choices().value(Smb4KMountSettings::EnumServerCodepage::cp855).label);
  codepage->insertItem(Smb4KMountSettings::EnumServerCodepage::cp857,
                       Smb4KMountSettings::self()->serverCodepageItem()->choices().value(Smb4KMountSettings::EnumServerCodepage::cp857).label);
  codepage->insertItem(Smb4KMountSettings::EnumServerCodepage::cp858,
                       Smb4KMountSettings::self()->serverCodepageItem()->choices().value(Smb4KMountSettings::EnumServerCodepage::cp858).label);
  codepage->insertItem(Smb4KMountSettings::EnumServerCodepage::cp860,
                       Smb4KMountSettings::self()->serverCodepageItem()->choices().value(Smb4KMountSettings::EnumServerCodepage::cp860).label);
  codepage->insertItem(Smb4KMountSettings::EnumServerCodepage::cp861,
                       Smb4KMountSettings::self()->serverCodepageItem()->choices().value(Smb4KMountSettings::EnumServerCodepage::cp861).label);
  codepage->insertItem(Smb4KMountSettings::EnumServerCodepage::cp862,
                       Smb4KMountSettings::self()->serverCodepageItem()->choices().value(Smb4KMountSettings::EnumServerCodepage::cp862).label);
  codepage->insertItem(Smb4KMountSettings::EnumServerCodepage::cp863,
                       Smb4KMountSettings::self()->serverCodepageItem()->choices().value(Smb4KMountSettings::EnumServerCodepage::cp863).label);
  codepage->insertItem(Smb4KMountSettings::EnumServerCodepage::cp864,
                       Smb4KMountSettings::self()->serverCodepageItem()->choices().value(Smb4KMountSettings::EnumServerCodepage::cp864).label);
  codepage->insertItem(Smb4KMountSettings::EnumServerCodepage::cp865,
                       Smb4KMountSettings::self()->serverCodepageItem()->choices().value(Smb4KMountSettings::EnumServerCodepage::cp865).label);
  codepage->insertItem(Smb4KMountSettings::EnumServerCodepage::cp866,
                       Smb4KMountSettings::self()->serverCodepageItem()->choices().value(Smb4KMountSettings::EnumServerCodepage::cp866).label);
  codepage->insertItem(Smb4KMountSettings::EnumServerCodepage::cp869,
                       Smb4KMountSettings::self()->serverCodepageItem()->choices().value(Smb4KMountSettings::EnumServerCodepage::cp869).label);
  codepage->insertItem(Smb4KMountSettings::EnumServerCodepage::cp874,
                       Smb4KMountSettings::self()->serverCodepageItem()->choices().value(Smb4KMountSettings::EnumServerCodepage::cp874).label);
  codepage->insertItem(Smb4KMountSettings::EnumServerCodepage::cp932,
                       Smb4KMountSettings::self()->serverCodepageItem()->choices().value(Smb4KMountSettings::EnumServerCodepage::cp932).label);
  codepage->insertItem(Smb4KMountSettings::EnumServerCodepage::cp936,
                       Smb4KMountSettings::self()->serverCodepageItem()->choices().value(Smb4KMountSettings::EnumServerCodepage::cp936).label);
  codepage->insertItem(Smb4KMountSettings::EnumServerCodepage::cp949,
                       Smb4KMountSettings::self()->serverCodepageItem()->choices().value(Smb4KMountSettings::EnumServerCodepage::cp949).label);
  codepage->insertItem(Smb4KMountSettings::EnumServerCodepage::cp950,
                       Smb4KMountSettings::self()->serverCodepageItem()->choices().value(Smb4KMountSettings::EnumServerCodepage::cp950).label);
  codepage->insertItem(Smb4KMountSettings::EnumServerCodepage::cp1250,
                       Smb4KMountSettings::self()->serverCodepageItem()->choices().value(Smb4KMountSettings::EnumServerCodepage::cp1250).label);
  codepage->insertItem(Smb4KMountSettings::EnumServerCodepage::cp1251,
                       Smb4KMountSettings::self()->serverCodepageItem()->choices().value(Smb4KMountSettings::EnumServerCodepage::cp1251).label);
  codepage->insertItem(Smb4KMountSettings::EnumServerCodepage::cp1252,
                       Smb4KMountSettings::self()->serverCodepageItem()->choices().value(Smb4KMountSettings::EnumServerCodepage::cp1252).label);
  codepage->insertItem(Smb4KMountSettings::EnumServerCodepage::cp1253,
                       Smb4KMountSettings::self()->serverCodepageItem()->choices().value(Smb4KMountSettings::EnumServerCodepage::cp1253).label);
  codepage->insertItem(Smb4KMountSettings::EnumServerCodepage::cp1254,
                       Smb4KMountSettings::self()->serverCodepageItem()->choices().value(Smb4KMountSettings::EnumServerCodepage::cp1254).label);
  codepage->insertItem(Smb4KMountSettings::EnumServerCodepage::cp1255,
                       Smb4KMountSettings::self()->serverCodepageItem()->choices().value(Smb4KMountSettings::EnumServerCodepage::cp1255).label);
  codepage->insertItem(Smb4KMountSettings::EnumServerCodepage::cp1256,
                       Smb4KMountSettings::self()->serverCodepageItem()->choices().value(Smb4KMountSettings::EnumServerCodepage::cp1256).label);
  codepage->insertItem(Smb4KMountSettings::EnumServerCodepage::cp1257,
                       Smb4KMountSettings::self()->serverCodepageItem()->choices().value(Smb4KMountSettings::EnumServerCodepage::cp1257).label);
  codepage->insertItem(Smb4KMountSettings::EnumServerCodepage::cp1258,
                       Smb4KMountSettings::self()->serverCodepageItem()->choices().value(Smb4KMountSettings::EnumServerCodepage::cp1258).label);
  codepage->insertItem(Smb4KMountSettings::EnumServerCodepage::unicode,
                       Smb4KMountSettings::self()->serverCodepageItem()->choices().value(Smb4KMountSettings::EnumServerCodepage::unicode).label);

  codepage_label->setBuddy(codepage);

  common_layout->addWidget(user_id_label, 0, 0, 0);
  common_layout->addWidget(user_widget, 0, 1, 0);
  common_layout->addWidget(group_id_label, 1, 0, 0);
  common_layout->addWidget(group_widget, 1, 1, 0);
  common_layout->addWidget(fmask_label, 2, 0, 0);
  common_layout->addWidget(fmask, 2, 1, 0);
  common_layout->addWidget(dmask_label, 3, 0, 0);
  common_layout->addWidget(dmask, 3, 1, 0);
  common_layout->addWidget(charset_label, 4, 0, 0);
  common_layout->addWidget(charset, 4, 1, 0);
  common_layout->addWidget(codepage_label, 5, 0, 0);
  common_layout->addWidget(codepage, 5, 1, 0);

  mount_layout->addWidget(common_options);
  mount_layout->addStretch(100);

  //
  // Connections
  //
  connect(user_menu, SIGNAL(triggered(QAction*)),
          this, SLOT(slotNewUserTriggered(QAction*)));
  connect(group_menu, SIGNAL(triggered(QAction*)),
          this, SLOT(slotNewGroupTriggered(QAction*)));
}
void kiptablesgenerator::slotChangedProtocol(int newProtocol)
{
  // 0 = TCP
  // 1 = UDP
  // 2 = TCP+UDP
  // 3 = ICMP
  KComboBox *names = (KComboBox*) namedWidgets["newService_names"];
  names->clear();
  if (newProtocol != 3)
  {
    names->insertItem("SSH");
    names->insertItem("Telnet");
    names->insertItem("HTTP");
    names->insertItem("HTTPS");
    names->insertItem("SMTP");
    names->insertItem("SMTPS");
    names->insertItem("POP3");
    names->insertItem("POP3S");
    names->insertItem("IMAP");
    names->insertItem("IMAPS");
    ((QRadioButton *) namedWidgets["newService_numbered"])->setEnabled(true);
    ((QLineEdit *) namedWidgets["newService_ports"])->setEnabled(true);
    return;
  }
  ((QRadioButton *) namedWidgets["newService_numbered"])->setEnabled(false);
  ((QLineEdit *) namedWidgets["newService_ports"])->setEnabled(false);
  ((QRadioButton *) namedWidgets["newService_named"])->setChecked(true);
  names->insertItem("any");
  names->insertItem("echo-reply");
  names->insertItem("destination-unreachable");
  names->insertItem(" network-unreachable");
  names->insertItem(" host-unreachable");
  names->insertItem(" protocol-unreachable");
  names->insertItem(" port-unreachable");
  names->insertItem(" fragmentation-needed");
  names->insertItem(" source-route-failed");
  names->insertItem(" network-unknown");
  names->insertItem(" host-unknown");
  names->insertItem(" network-prohibited");
  names->insertItem(" host-prohibited");
  names->insertItem(" TOS-network-unreachable");
  names->insertItem(" TOS-host-unreachable");
  names->insertItem(" communication-prohibited");
  names->insertItem(" host-precedence-violation");
  names->insertItem(" precedence-cutoff");
  names->insertItem("source-quench");
  names->insertItem("redirect");
  names->insertItem(" network-redirect");
  names->insertItem(" host-redirect");
  names->insertItem(" TOS-network-redirect");
  names->insertItem(" TOS-host-redirect");
  names->insertItem("echo-request");
  names->insertItem("router-advertisement");
  names->insertItem("router-solicitation");
  names->insertItem("time-exceeded");
  names->insertItem(" ttl-zero-during-transit");
  names->insertItem(" ttl-zero-during-reassembly");
  names->insertItem("parameter-problem");
  names->insertItem(" ip-header-bad");
  names->insertItem(" required-option-missing");
  names->insertItem("timestamp-request");
  names->insertItem("timestamp-reply");
  names->insertItem("address-mask-request");
  names->insertItem("address-mask-reply");
}
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
}