KXmlCommandDlg::KXmlCommandDlg(TQWidget *parent, const char *name) : KDialogBase(parent, name, true, TQString::null, Ok|Cancel|Details, Ok, true) { setButtonText(Details, i18n("&Mime Type Settings")); m_cmd = 0; TQWidget *dummy = new TQWidget(this, "TopDetail"); TQWidget *topmain = new TQWidget(this, "TopMain"); TQGroupBox *m_gb1 = new TQGroupBox(0, Qt::Horizontal, i18n("Supported &Input Formats"), dummy); TQGroupBox *m_gb2 = new TQGroupBox(0, Qt::Horizontal, i18n("Requirements"), topmain); m_description = new TQLineEdit(topmain); m_idname = new TQLabel(topmain); m_requirements = new TDEListView(m_gb2); m_requirements->addColumn(""); m_requirements->header()->hide(); m_addreq = new TQToolButton(m_gb2); m_addreq->setIconSet(SmallIconSet("filenew")); m_removereq = new TQToolButton(m_gb2); m_removereq->setIconSet(SmallIconSet("editdelete")); TQPushButton *m_edit = new KPushButton(KGuiItem(i18n("&Edit Command..."), "edit"), topmain); m_mimetype = new TQComboBox(dummy); m_availablemime = new TDEListBox(m_gb1); m_selectedmime = new TDEListBox(m_gb1); m_addmime = new TQToolButton(m_gb1); m_addmime->setIconSet(TQApplication::reverseLayout()? SmallIconSet("forward") : SmallIconSet("back")); m_removemime = new TQToolButton(m_gb1); m_removemime->setIconSet(TQApplication::reverseLayout()? SmallIconSet("back" ) : SmallIconSet("forward")); m_gb2->setMinimumWidth(380); m_gb1->setMinimumHeight(180); m_requirements->setMaximumHeight(80); m_removereq->setEnabled(false); m_addmime->setEnabled(false); m_removemime->setEnabled(false); TQLabel *m_desclab = new TQLabel(i18n("&Description:"), topmain); m_desclab->setBuddy(m_description); TQLabel *m_mimetypelab = new TQLabel(i18n("Output &format:"), dummy); m_mimetypelab->setBuddy(m_mimetype); TQLabel *m_idnamelab = new TQLabel(i18n("ID name:"), topmain); TQFont f(m_idname->font()); f.setBold(true); m_idname->setFont(f); KSeparator *sep1 = new KSeparator(TQFrame::HLine, dummy); TQVBoxLayout *l0 = new TQVBoxLayout(topmain, 0, 10); TQGridLayout *l5 = new TQGridLayout(0, 2, 2, 0, 5); l0->addLayout(TQT_TQLAYOUT(l5)); l5->addWidget(m_idnamelab, 0, 0); l5->addWidget(m_idname, 0, 1); l5->addWidget(m_desclab, 1, 0); l5->addWidget(m_description, 1, 1); l0->addWidget(m_gb2); TQHBoxLayout *l3 = new TQHBoxLayout(0, 0, 0); l0->addLayout(l3); l3->addWidget(m_edit); l3->addStretch(1); TQVBoxLayout *l7 = new TQVBoxLayout(dummy, 0, 10); TQHBoxLayout *l6 = new TQHBoxLayout(0, 0, 5); l7->addWidget(sep1); l7->addLayout(l6); l6->addWidget(m_mimetypelab, 0); l6->addWidget(m_mimetype, 1); l7->addWidget(m_gb1); TQGridLayout *l2 = new TQGridLayout(TQT_TQLAYOUT(m_gb1->layout()), 4, 3, 10); l2->addMultiCellWidget(m_availablemime, 0, 3, 2, 2); l2->addMultiCellWidget(m_selectedmime, 0, 3, 0, 0); l2->addWidget(m_addmime, 1, 1); l2->addWidget(m_removemime, 2, 1); l2->setRowStretch(0, 1); l2->setRowStretch(3, 1); TQHBoxLayout *l4 = new TQHBoxLayout(TQT_TQLAYOUT(m_gb2->layout()), 10); l4->addWidget(m_requirements); TQVBoxLayout *l8 = new TQVBoxLayout(0, 0, 0); l4->addLayout(l8); l8->addWidget(m_addreq); l8->addWidget(m_removereq); l8->addStretch(1); connect(m_addmime, TQT_SIGNAL(clicked()), TQT_SLOT(slotAddMime())); connect(m_removemime, TQT_SIGNAL(clicked()), TQT_SLOT(slotRemoveMime())); connect(m_edit, TQT_SIGNAL(clicked()), TQT_SLOT(slotEditCommand())); connect(m_requirements, TQT_SIGNAL(selectionChanged(TQListViewItem*)), TQT_SLOT(slotReqSelected(TQListViewItem*))); connect(m_availablemime, TQT_SIGNAL(selectionChanged(TQListBoxItem*)), TQT_SLOT(slotAvailableSelected(TQListBoxItem*))); connect(m_selectedmime, TQT_SIGNAL(selectionChanged(TQListBoxItem*)), TQT_SLOT(slotSelectedSelected(TQListBoxItem*))); connect(m_addreq, TQT_SIGNAL(clicked()), TQT_SLOT(slotAddReq())); connect(m_removereq, TQT_SIGNAL(clicked()), TQT_SLOT(slotRemoveReq())); KMimeType::List list = KMimeType::allMimeTypes(); for (TQValueList<KMimeType::Ptr>::ConstIterator it=list.begin(); it!=list.end(); ++it) { TQString mimetype = (*it)->name(); m_mimelist << mimetype; } m_mimelist.sort(); m_mimetype->insertStringList(m_mimelist); m_availablemime->insertStringList(m_mimelist); setMainWidget(topmain); setDetailsWidget(dummy); }
KgProtocols::KgProtocols(bool first, QWidget* parent) : KonfiguratorPage(first, parent) { QGridLayout *KgProtocolsLayout = new QGridLayout(this); KgProtocolsLayout->setSpacing(6); // -------------------------- LINK VIEW ---------------------------------- QGroupBox *linkGrp = createFrame(i18n("Links"), this); QGridLayout *linkGrid = createGridLayout(linkGrp); QStringList labels; labels << i18n("Defined Links"); linkList = new KrTreeWidget(linkGrp); linkList->setHeaderLabels(labels); linkList->setRootIsDecorated(true); linkGrid->addWidget(linkList, 0, 0); KgProtocolsLayout->addWidget(linkGrp, 0, 0, 2, 1); // -------------------------- BUTTONS ---------------------------------- QWidget *vbox1Widget = new QWidget(this); QVBoxLayout *vbox1 = new QVBoxLayout(vbox1Widget); addSpacer(vbox1); btnAddProtocol = new QPushButton(vbox1Widget); btnAddProtocol->setIcon(krLoader->loadIcon("arrow-left", KIconLoader::Small)); btnAddProtocol->setWhatsThis(i18n("Add protocol to the link list.")); vbox1->addWidget(btnAddProtocol); btnRemoveProtocol = new QPushButton(vbox1Widget); btnRemoveProtocol->setIcon(krLoader->loadIcon("arrow-right", KIconLoader::Small)); btnRemoveProtocol->setWhatsThis(i18n("Remove protocol from the link list.")); vbox1->addWidget(btnRemoveProtocol); addSpacer(vbox1); KgProtocolsLayout->addWidget(vbox1Widget, 0 , 1); QWidget *vbox2Widget = new QWidget(this); QVBoxLayout *vbox2 = new QVBoxLayout(vbox2Widget); addSpacer(vbox2); btnAddMime = new QPushButton(vbox2Widget); btnAddMime->setIcon(krLoader->loadIcon("arrow-left", KIconLoader::Small)); btnAddMime->setWhatsThis(i18n("Add MIME to the selected protocol on the link list.")); vbox2->addWidget(btnAddMime); btnRemoveMime = new QPushButton(vbox2Widget); btnRemoveMime->setIcon(krLoader->loadIcon("arrow-right", KIconLoader::Small)); btnRemoveMime->setWhatsThis(i18n("Remove MIME from the link list.")); vbox2->addWidget(btnRemoveMime); addSpacer(vbox2); KgProtocolsLayout->addWidget(vbox2Widget, 1 , 1); // -------------------------- PROTOCOLS LISTBOX ---------------------------------- QGroupBox *protocolGrp = createFrame(i18n("Protocols"), this); QGridLayout *protocolGrid = createGridLayout(protocolGrp); protocolList = new KrListWidget(protocolGrp); loadProtocols(); protocolGrid->addWidget(protocolList, 0, 0); KgProtocolsLayout->addWidget(protocolGrp, 0 , 2); // -------------------------- MIMES LISTBOX ---------------------------------- QGroupBox *mimeGrp = createFrame(i18n("MIMEs"), this); QGridLayout *mimeGrid = createGridLayout(mimeGrp); mimeList = new KrListWidget(mimeGrp); loadMimes(); mimeGrid->addWidget(mimeList, 0, 0); KgProtocolsLayout->addWidget(mimeGrp, 1 , 2); // -------------------------- CONNECT TABLE ---------------------------------- connect(protocolList, SIGNAL(itemSelectionChanged()), this, SLOT(slotDisableButtons())); connect(linkList, SIGNAL(itemSelectionChanged()), this, SLOT(slotDisableButtons())); connect(mimeList, SIGNAL(itemSelectionChanged()), this, SLOT(slotDisableButtons())); connect(linkList, SIGNAL(currentItemChanged(QTreeWidgetItem *, QTreeWidgetItem *)), this, SLOT(slotDisableButtons())); connect(btnAddProtocol, SIGNAL(clicked()) , this, SLOT(slotAddProtocol())); connect(btnRemoveProtocol, SIGNAL(clicked()) , this, SLOT(slotRemoveProtocol())); connect(btnAddMime, SIGNAL(clicked()) , this, SLOT(slotAddMime())); connect(btnRemoveMime, SIGNAL(clicked()) , this, SLOT(slotRemoveMime())); loadInitialValues(); slotDisableButtons(); }