void kiptablesgenerator::setupFForwardingPage() { fForwardingPage = new QFrame(this); QGridLayout *layout = new QGridLayout(fForwardingPage, 4, 2); QLabel *label = new QLabel(i18n( "<p>If you wish to enable TCP forwardind for any ports (incoming or outgoing) add them to this page.</p>"), fForwardingPage); label->show(); layout->addMultiCellWidget(label, 0, 0, 0, 1); KListView *ports = new KListView(fForwardingPage); ports->addColumn(i18n("In/Out")); ports->addColumn(i18n("Port")); ports->addColumn(i18n("Destination")); ports->show(); namedWidgets["forwardsList"] = ports; layout->addMultiCellWidget(ports, 1, 3, 0, 0); KPushButton *addForward = new KPushButton(i18n("Add..."), fForwardingPage); layout->addWidget(addForward, 1, 1); connect( addForward, SIGNAL(clicked()), newForwardDialog, SLOT(show())); KPushButton *delForward = new KPushButton(i18n("Remove"), fForwardingPage); layout->addWidget(delForward, 2, 1); connect( delForward, SIGNAL(clicked()), this, SLOT(slotDelForward())); this->addPage(fForwardingPage, i18n("Port Forwarding")); }
QWidget *KasTaskItem::createTaskProps( QObject *target, QWidget *parent, bool recursive ) { QVBox *vb = new QVBox( parent ); vb->setSpacing( KDialog::spacingHint() ); vb->setMargin( KDialog::marginHint() ); // Create List View KListView *taskprops = new KListView( vb, "props_view" ); taskprops->setResizeMode( QListView::LastColumn ); taskprops->addColumn( i18n("Property"), 0 ); taskprops->addColumn( i18n("Type"), 0 ); taskprops->addColumn( i18n("Value") ); // Create List Items QMetaObject *mo = target->metaObject(); for ( int i = 0; i < mo->numProperties( recursive ); i++ ) { const QMetaProperty *p = mo->property(i, recursive); (void) new KListViewItem( taskprops, p->name(), p->type(), target->property( p->name() ).toString() ); } return vb; }
void kiptablesgenerator::setupIHostsPage() { iHostsPage = new QFrame(this); QGridLayout *layout = new QGridLayout(iHostsPage, 4, 2); QLabel *label = new QLabel(i18n( "<p><i>Advanced users only</i> - If you wish to allow or block any specific hosts, " "ignoring all other rules, add them to this page.</p>"), iHostsPage); label->show(); layout->addMultiCellWidget(label, 0, 0, 0, 1); KListView *hosts = new KListView(iHostsPage); hosts->addColumn(i18n("Allow/Block")); hosts->addColumn(i18n("MAC/IP")); hosts->addColumn(i18n("Host")); hosts->show(); namedWidgets["hostsList"] = hosts; layout->addMultiCellWidget(hosts, 1, 3, 0, 0); KPushButton *addHost = new KPushButton(i18n("Add..."), iHostsPage); addHost->show(); layout->addWidget(addHost, 1, 1); connect( addHost, SIGNAL(clicked()), newHostDialog, SLOT(show())); KPushButton *delHost = new KPushButton(i18n("Remove"), iHostsPage); layout->addWidget(delHost, 2, 1); connect( delHost, SIGNAL(clicked()), this, SLOT(slotDelHost())); this->addPage(iHostsPage, i18n("Host Control")); }
void updateSearch(const QString& text) { KListViewSearchLine::updateSearch(text); KListView* view = listView(); QListViewItem* item = view->selectedItem(); if (item && item->isVisible()) { return; } QListViewItemIterator iterator(view, QListViewItemIterator::Visible); item = iterator.current(); if (item) { view->setSelected(item, true); } }
bool StdWidgetFactory::saveSpecialProperty(const QCString &classname, const QString &name, const QVariant &, QWidget *w, QDomElement &parentNode, QDomDocument &domDoc) { if(name == "list_items" && classname == "KComboBox") { KComboBox *combo = (KComboBox*)w; for(int i=0; i < combo->count(); i++) { QDomElement item = domDoc.createElement("item"); KFormDesigner::FormIO::savePropertyElement(item, domDoc, "property", "text", combo->text(i)); parentNode.appendChild(item); } return true; } else if(name == "list_items" && classname == "KListBox") { KListBox *listbox = (KListBox*)w; for(uint i=0; i < listbox->count(); i++) { QDomElement item = domDoc.createElement("item"); KFormDesigner::FormIO::savePropertyElement(item, domDoc, "property", "text", listbox->text(i)); parentNode.appendChild(item); } return true; } else if(name == "list_contents" && classname == "KListView") { KListView *listview = (KListView*)w; // First we save the columns for(int i = 0; i < listview->columns(); i++) { QDomElement item = domDoc.createElement("column"); KFormDesigner::FormIO::savePropertyElement(item, domDoc, "property", "text", listview->columnText(i)); KFormDesigner::FormIO::savePropertyElement(item, domDoc, "property", "width", listview->columnWidth(i)); KFormDesigner::FormIO::savePropertyElement(item, domDoc, "property", "resizable", listview->header()->isResizeEnabled(i)); KFormDesigner::FormIO::savePropertyElement(item, domDoc, "property", "clickable", listview->header()->isClickEnabled(i)); KFormDesigner::FormIO::savePropertyElement(item, domDoc, "property", "fullwidth", listview->header()->isStretchEnabled(i)); parentNode.appendChild(item); } // Then we save the list view items QListViewItem *item = listview->firstChild(); while(item) { saveListItem(item, parentNode, domDoc); item = item->nextSibling(); } return true; } return false; }
void KPluginListViewToolTip::maybeTip(const QPoint &pos) { if(!parentWidget() || !m_listView) return; KPluginInfoLVI *item = dynamic_cast< KPluginInfoLVI * >(m_listView->itemAt(pos)); if(!item) return; QString toolTip = i18n( "<qt><table>" "<tr><td><b>Description:</b></td><td>%1</td></tr>" "<tr><td><b>Author:</b></td><td>%2</td></tr>" "<tr><td><b>Version:</b></td><td>%3</td></tr>" "<tr><td><b>License:</b></td><td>%4</td></tr></table></qt>") .arg(item->pluginInfo()->comment(), item->pluginInfo()->author(), item->pluginInfo()->version(), item->pluginInfo()->license()); // kdDebug( 702 ) << k_funcinfo << "Adding tooltip: itemRect: " << itemRect << ", tooltip: " << toolTip << endl; tip(m_listView->itemRect(item), toolTip); }
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; }
virtual BOOL DlgProc(HWND hWnd, UINT uMsg, WPARAM wParam, LPARAM lParam) { switch (uMsg) { case WM_INITDIALOG: m_hWnd = hWnd; m_process.FromDlgItem(hWnd, IDC_PROCESS); m_process.AddColumn(0, 40, "PID"); m_process.AddColumn(1, 100, "Process"); m_process.AddColumn(2, 50, "Total"); m_process.AddColumn(3, 40, "DC"); m_process.AddColumn(4, 50, "Region"); m_process.AddColumn(5, 45, "Bitmap"); m_process.AddColumn(6, 50, "Palette"); m_process.AddColumn(7, 40, "Font"); m_process.AddColumn(8, 45, "Brush"); m_process.AddColumn(9, 45, "Other"); UpdateTable(); SetTimer(hWnd, 101, 1000, NULL); return TRUE; case WM_COMMAND: switch ( LOWORD(wParam) ) { case IDOK: EndDialog(hWnd, 1); return TRUE; } case WM_TIMER: UpdateTable(); } return FALSE; }
void kiptablesgenerator::setupIPortsPage() { iPortsPage = new QFrame(this); QGridLayout *layout = new QGridLayout(iPortsPage, 6, 2); QLabel *intro = new QLabel( i18n("<p>Here you can select which services are available to the outside world.</p>"), iPortsPage); intro->show(); layout->addMultiCellWidget(intro, 0, 0, 0, 1); KListView *ports = new KListView(iPortsPage); ports->addColumn(i18n("Port")); ports->addColumn(i18n("Protocol")); ports->addColumn(i18n("Action")); ports->addColumn(i18n("Service")); ports->setSorting(-1); ports->show(); layout->addMultiCellWidget(ports, 1, 5, 0, 0); namedWidgets["iPorts"] = ports; KPushButton *newService = new KPushButton(i18n("A&dd Service"), iPortsPage); newService->show(); layout->addWidget(newService, 1, 1); connect(newService, SIGNAL(clicked()), newServiceDialog, SLOT(show())); KPushButton *delService = new KPushButton(i18n("&Remove Service"), iPortsPage); delService->show(); layout->addWidget(delService, 2, 1); connect(delService, SIGNAL(clicked()), this, SLOT(slotDelService())); KPushButton *upService = new KPushButton(i18n("&Move Up"), iPortsPage); upService->show(); layout->addWidget(upService, 3, 1); connect(upService, SIGNAL(clicked()), this, SLOT(slotUpService())); KPushButton *downService = new KPushButton(i18n("M&ove Down"), iPortsPage); downService->show(); layout->addWidget(downService, 4, 1); connect(downService, SIGNAL(clicked()), this, SLOT(slotDownService())); iPortsPage->show(); this->addPage(iPortsPage, i18n("Incoming Ports")); }
void KPluginSelectionWidget::init(const QValueList< KPluginInfo * > &plugininfos, const QString &category) { // setup Widgets (new QVBoxLayout(this, 0, KDialog::spacingHint()))->setAutoAdd(true); KListView *listview = new KListView(this); d->tooltip = new KPluginListViewToolTip(listview->viewport(), listview); connect(listview, SIGNAL(pressed(QListViewItem *)), this, SLOT(executed(QListViewItem *))); connect(listview, SIGNAL(spacePressed(QListViewItem *)), this, SLOT(executed(QListViewItem *))); connect(listview, SIGNAL(returnPressed(QListViewItem *)), this, SLOT(executed(QListViewItem *))); connect(listview, SIGNAL(selectionChanged(QListViewItem *)), this, SLOT(executed(QListViewItem *))); listview->setSizePolicy(QSizePolicy::Minimum, QSizePolicy::Preferred); listview->setAcceptDrops(false); listview->setFullWidth(true); listview->setSelectionModeExt(KListView::Single); listview->setAllColumnsShowFocus(true); listview->addColumn(i18n("Name")); for(QValueList< KPluginInfo * >::ConstIterator it = plugininfos.begin(); it != plugininfos.end(); ++it) { d->plugincheckedchanged[*it] = false; if(!(*it)->isHidden() && (category.isNull() || (*it)->category() == category)) { QCheckListItem *item = new KPluginInfoLVI(*it, listview); if(!(*it)->icon().isEmpty()) item->setPixmap(0, SmallIcon((*it)->icon(), IconSize(KIcon::Small))); item->setOn((*it)->isPluginEnabled()); d->pluginInfoMap.insert(item, *it); } } // widgetstack d->widgetstack = d->kps->widgetStack(); load(); // select and highlight the first item in the plugin list if(listview->firstChild()) listview->setSelected(listview->firstChild(), true); }
KPreviewOptions::KPreviewOptions(QWidget *parent, const char * /*name*/) : KCModule(parent, "kcmkonq") { QVBoxLayout *lay = new QVBoxLayout(this, 0, KDialog::spacingHint()); lay->addWidget(new QLabel(i18n("<p>Allow previews, \"Folder Icons Reflect Contents\", and " "retrieval of meta-data on protocols:</p>"), this)); setQuickHelp( i18n("<h1>Preview Options</h1> Here you can modify the behavior " "of Konqueror when it shows the files in a folder." "<h2>The list of protocols:</h2> check the protocols over which " "previews should be shown; uncheck those over which they should not. " "For instance, you might want to show previews over SMB if the local " "network is fast enough, but you might disable it for FTP if you often " "visit very slow FTP sites with large images." "<h2>Maximum File Size:</h2> select the maximum file size for which " "previews should be generated. For instance, if set to 1 MB (the default), " "no preview will be generated for files bigger than 1 MB, for speed reasons.")); // Listview containing checkboxes for all protocols that support listing KListView *listView = new KListView(this, "listView"); listView->addColumn(i18n("Select Protocols")); listView->setFullWidth(true); QHBoxLayout *hbox = new QHBoxLayout(lay); hbox->addWidget(listView); hbox->addStretch(); PreviewCheckListItem *localItems = new PreviewCheckListItem(listView, i18n("Local Protocols")); PreviewCheckListItem *inetItems = new PreviewCheckListItem(listView, i18n("Internet Protocols")); QStringList protocolList = KProtocolInfo::protocols(); protocolList.sort(); QStringList::Iterator it = protocolList.begin(); KURL url; url.setPath("/"); for(; it != protocolList.end(); ++it) { url.setProtocol(*it); if(KProtocolInfo::supportsListing(url)) { QCheckListItem *item; if(KProtocolInfo::protocolClass(*it) == ":local") item = new PreviewCheckListItem(localItems, (*it)); else item = new PreviewCheckListItem(inetItems, (*it)); m_items.append(item); } } listView->setOpen(localItems, true); listView->setOpen(inetItems, true); QWhatsThis::add(listView, i18n("This option makes it possible to choose when the file previews, " "smart folder icons, and meta-data in the File Manager should be activated.\n" "In the list of protocols that appear, select which ones are fast " "enough for you to allow previews to be generated.")); QLabel *label = new QLabel(i18n("&Maximum file size:"), this); lay->addWidget(label); m_maxSize = new KDoubleNumInput(this); m_maxSize->setSuffix(i18n(" MB")); m_maxSize->setRange(0.02, 10, 0.02, true); m_maxSize->setPrecision(1); label->setBuddy(m_maxSize); lay->addWidget(m_maxSize); connect(m_maxSize, SIGNAL(valueChanged(double)), SLOT(changed())); m_boostSize = new QCheckBox(i18n("&Increase size of previews relative to icons"), this); connect(m_boostSize, SIGNAL(toggled(bool)), SLOT(changed())); lay->addWidget(m_boostSize); m_useFileThumbnails = new QCheckBox(i18n("&Use thumbnails embedded in files"), this); connect(m_useFileThumbnails, SIGNAL(toggled(bool)), SLOT(changed())); lay->addWidget(m_useFileThumbnails); QWhatsThis::add(m_useFileThumbnails, i18n("Select this to use thumbnails that are found inside some " "file types (e.g. JPEG). This will increase speed and reduce " "disk usage. Deselect it if you have files that have been processed " "by programs which create inaccurate thumbnails, such as ImageMagick.")); lay->addWidget(new QWidget(this), 10); load(); }
void KGDIObjectTable::UpdateTable(void) { // clear nNew array for an updating for (int i=0; i<m_info.size(); i++) memset(m_info[i].nNew, 0, sizeof(m_info[i].nNew)); for (i=0; i<MAXGDIHANDLE; i++) // all GDI handles { GDITableCell cell = m_gditable[i]; cell._nProcess = m_gditable.GetProcess(i); cell._nCount = m_gditable.GetCount(i); // if kernel object point is invalid, object is deleted if ( (unsigned) cell.pKernel < 0x80000000 ) continue; // search for the processid in m_info table int k = -1; for (int j=0; j<m_info.size(); j++) if ( m_info[j].processid == cell._nProcess ) { k = j; break; } if ( k==-1) { ProcessInfo pi = { 0 }; m_info.push_back(pi); k = m_info.size() - 1; m_info[k].processid = cell._nProcess; TCHAR szPath[MAX_PATH]; GetProcessName(m_info[k].processid, szPath); // new process in listview m_process.AddItem(0, m_info[k].processid); m_process.AddItem(1, szPath); } switch ( cell.nType & 0x1F ) // 0..31 { case DC_TYPE : m_info[k].nNew[0] ++; break; case RGN_TYPE : m_info[k].nNew[1] ++; break; case SURF_TYPE : m_info[k].nNew[2] ++; break; case PAL_TYPE : m_info[k].nNew[3] ++; break; case LFONT_TYPE: m_info[k].nNew[4] ++; break; case BRUSH_TYPE: m_info[k].nNew[5] ++; break; default : m_info[k].nNew[6] ++; break; } } // update any changed process for (i=0; i<m_info.size(); i++) // if changed if ( memcmp(m_info[i].nObject, m_info[i].nNew, sizeof(m_info[i].nNew)) ) { memcpy(m_info[i].nObject, m_info[i].nNew, sizeof(m_info[i].nNew)); m_process.SetItem(i, 2, m_info[i].nObject[0] + m_info[i].nObject[1] + m_info[i].nObject[2] + m_info[i].nObject[3] + m_info[i].nObject[4] + m_info[i].nObject[5] + m_info[i].nObject[6]); m_process.SetItem(i, 3, m_info[i].nObject[0]); m_process.SetItem(i, 4, m_info[i].nObject[1]); m_process.SetItem(i, 5, m_info[i].nObject[2]); m_process.SetItem(i, 6, m_info[i].nObject[3]); m_process.SetItem(i, 7, m_info[i].nObject[4]); m_process.SetItem(i, 8, m_info[i].nObject[5]); m_process.SetItem(i, 9, m_info[i].nObject[6]); } }
void kiptablesgenerator::accept() { QString rulesList; rulesList = "#!/bin/sh\n" + i18n("# Generated by KIptablesGenerator\n") + i18n("# Copyright (c) 2004 Fred Emmott <*****@*****.**>\n") + i18n("# See KIptablesGenerator for license information.\n") + i18n("# You probably want to make this a startup script, eg on\n") + i18n("# slackware you probably want to save this as /etc/rc.d/rc.firewall\n")+ "IPTABLES=/usr/sbin/iptables\n"; if (((QButtonGroup*) namedWidgets["incomingYesNo"])->selected()->name() == (QString) "yes") { if ( ((KComboBox*) namedWidgets["incomingPolicy"])->currentItem() == 0) rulesList += "$IPTABLES -P INPUT ACCEPT\n"; else rulesList += "$IPTABLES -P INPUT DROP\n"; KListBox* interfaces = (KListBox*) namedWidgets["iInterfaces"]; for (unsigned int i = 0; i < interfaces->count(); i++) { QListBoxItem* interface = interfaces->item(i); if (! interface->isSelected()) rulesList += QString("$IPTABLES -A INPUT -i %1 -j ACCEPT\n").arg(interface->text()); } KListView* hosts = (KListView*) namedWidgets["hostsList"]; QListViewItem* host = hosts->firstChild(); while (host) { QString accept = host->text(0), ipOrMAC = host->text(1), address = host->text(2), action; accept == i18n("Allow") ? action = "ACCEPT" : action = "DROP"; ipOrMAC == i18n("IP") ? rulesList += QString("$IPTABLES -A INPUT -s %1 -j %2\n").arg(address).arg(action) : rulesList += QString("$IPTABLES -A INPUT -m mac --mac-source %1 -j %2\n").arg(address).arg(action); host = host->nextSibling(); } if (((QCheckBox *) namedWidgets["iCheckLocalSpoof"])->isChecked()) rulesList += "$IPTABLES -A INPUT ! -i lo -d 127.0.0.0/8 -j DROP\n"; if (((QCheckBox *) namedWidgets["iSynFloodProtect"])->isChecked()) { rulesList += "$IPTABLES -N Flood-Scan\n"; rulesList += "$IPTABLES -A INPUT -p tcp -m tcp --syn -j Flood-Scan\n"; rulesList += "$IPTABLES -A Flood-Scan -m limit --limit 1/s --limit-burst 20 -j RETURN\n"; rulesList += "$IPTABLES -A Flood-Scan -j DROP\n"; } if (((QCheckBox *) namedWidgets["iCheckSyn"])->isChecked()) rulesList += "$IPTABLES -A INPUT -p tcp -m tcp ! --syn -m conntrack --ctstate NEW -j DROP\n"; if (((QCheckBox *) namedWidgets["iCheckSynFin"])->isChecked()) rulesList += "$IPTABLES -A INPUT -p tcp -m tcp --tcp-flags SYN,FIN SYN,FIN -j DROP\n"; if ( ((QCheckBox*) namedWidgets["iConntrackAllSame"])->isChecked() ) { if ( ((QCheckBox*) namedWidgets["iConntrackAllEstablished"])->isChecked() ) rulesList += "$IPTABLES -A INPUT -m conntrack --ctstate ESTABLISHED -j ACCEPT\n"; if ( ((QCheckBox*) namedWidgets["iConntrackAllRelated"])->isChecked() ) rulesList += "$IPTABLES -A INPUT -m conntrack --ctstate RELATED -j ACCEPT\n"; if ( ((QCheckBox*) namedWidgets["iConntrackAllNew"])->isChecked() ) rulesList += "$IPTABLES -A INPUT -m conntrack --ctstate NEW -j ACCEPT\n"; } else { if ( ((QCheckBox*) namedWidgets["iConntrackTcpEstablished"])->isChecked() ) rulesList += "$IPTABLES -A INPUT -p tcp -m conntrack --ctstate ESTABLISHED -j ACCEPT\n"; if ( ((QCheckBox*) namedWidgets["iConntrackTcpRelated"])->isChecked() ) rulesList += "$IPTABLES -A INPUT -p tcp -m conntrack --ctstate RELATED -j ACCEPT\n"; if ( ((QCheckBox*) namedWidgets["iConntrackTcpNew"])->isChecked() ) rulesList += "$IPTABLES -A INPUT -p tcp -m conntrack --ctstate NEW -j ACCEPT\n"; if ( ((QCheckBox*) namedWidgets["iConntrackUdpEstablished"])->isChecked() ) rulesList += "$IPTABLES -A INPUT -p udp -m conntrack --ctstate ESTABLISHED -j ACCEPT\n"; if ( ((QCheckBox*) namedWidgets["iConntrackUdpRelated"])->isChecked() ) rulesList += "$IPTABLES -A INPUT -p udp -m conntrack --ctstate RELATED -j ACCEPT\n"; if ( ((QCheckBox*) namedWidgets["iConntrackUdpNew"])->isChecked() ) rulesList += "$IPTABLES -A INPUT -p udp -m conntrack --ctstate NEW -j ACCEPT\n"; if ( ((QCheckBox*) namedWidgets["iConntrackICMPEstablished"])->isChecked() ) rulesList += "$IPTABLES -A INPUT -p icmp -m conntrack --ctstate ESTABLISHED -j ACCEPT\n"; if ( ((QCheckBox*) namedWidgets["iConntrackICMPRelated"])->isChecked() ) rulesList += "$IPTABLES -A INPUT -p icmp -m conntrack --ctstate RELATED -j ACCEPT\n"; if ( ((QCheckBox*) namedWidgets["iConntrackICMPNew"])->isChecked() ) rulesList += "$IPTABLES -A INPUT -p icmp -m conntrack --ctstate NEW -j ACCEPT\n"; } KListView* services = (KListView*) namedWidgets["iPorts"]; QListViewItem* service = services->firstChild(); while (service) { // columns: portNumber, protoName, action, portName QString portNumber = service->text(0), protocol = service->text(1), action = service->text(2), portName = service->text(3); action == i18n("Accept") ? action = "ACCEPT" : action = "DROP"; if (protocol == i18n("TCP & UDP") || protocol == i18n("TCP")) rulesList += QString("$IPTABLES -A INPUT -p tcp -m tcp --dport %1 -j %2\n").arg(portNumber).arg(action); if (protocol == i18n("TCP & UDP") || protocol == i18n("UDP")) rulesList += QString("$IPTABLES -A INPUT -p udp -m udp --dport %1 -j %2\n").arg(portNumber).arg(action); if (protocol == i18n("ICMP")) rulesList += QString("$IPTABLES -A INPUT -p icmp -m icmp --icmp-type %1 -j %2\n").arg(portName).arg(action); service = service->nextSibling(); } KListView* forwards = (KListView*) namedWidgets["forwardsList"]; QListViewItem* forward = forwards->firstChild(); while (forward) { QString direction = forward->text(0), localPort = forward->text(1), destination = forward->text(2); direction == i18n("Incoming") ? rulesList += QString("$IPTABLES -t nat -A PREROUTING -p tcp -m tcp --dport %1 -j DNAT --to %2\n").arg(localPort).arg(destination) : rulesList += QString("$IPTABLES -t nat -A OUTPUT -p tcp -m tcp --dport %1 -j DNAT --to %2\n").arg(localPort).arg(destination); forward = forward->nextSibling(); } } this->hide(); rulesDialog = new RulesDialog(this,(char*) 0, &rulesList); rulesDialog->show(); connect(rulesDialog, SIGNAL(closeClicked()), this, SLOT(slotShownRules())); }