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::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")); }
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")); }
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; }
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(); }