NewWindowDialog::NewWindowDialog(const KSircChannel &channelInfo, QWidget * parent, const char * name) : KDialogBase(parent, name, true, i18n("New Window For"), Ok|Cancel, Ok, true), m_channelInfo(channelInfo) { QHBox * w = makeHBoxMainWidget(); QLabel * l = new QLabel(i18n("C&hannel/Nick:"), w); m_combo = new KHistoryCombo(w); m_combo->setFocus(); // we don't need duplicated channel into the list m_combo->setDuplicatesEnabled( false ); l->setBuddy(m_combo); QLabel * l2 = new QLabel(i18n("&Key:"), w); m_le = new KLineEdit(w); m_le->setEnabled(false); l2->setBuddy(m_le); connect( m_combo, SIGNAL(activated(const QString &)), m_combo, SLOT(addToHistory(const QString &))); connect( m_combo->lineEdit(), SIGNAL(textChanged ( const QString & )), this, SLOT( slotTextChanged( const QString &))); KConfig *kConfig = kapp->config(); KConfigGroupSaver saver(kConfig, "Recent"); m_combo->setHistoryItems(kConfig->readListEntry("Channels")); slotTextChanged( m_combo->lineEdit()->text()); }
KCustomMenuEditor::KCustomMenuEditor(QWidget *parent) : KDialogBase(parent, "custommenueditor", true, i18n("Menu Editor"), Ok|Cancel, Ok, true), m_listView(0) { d = new KCustomMenuEditorPrivate; QHBox *page = makeHBoxMainWidget(); m_listView = new KListView(page); m_listView->addColumn(i18n("Menu")); m_listView->setFullWidth(true); m_listView->setSorting(-1); KButtonBox *buttonBox = new KButtonBox(page, Vertical); buttonBox->addButton(i18n("New..."), this, SLOT(slotNewItem())); d->pbRemove=buttonBox->addButton(i18n("Remove"), this, SLOT(slotRemoveItem())); d->pbMoveUp=buttonBox->addButton(i18n("Move Up"), this, SLOT(slotMoveUp())); d->pbMoveDown=buttonBox->addButton(i18n("Move Down"), this, SLOT(slotMoveDown())); buttonBox->layout(); connect( m_listView, SIGNAL( selectionChanged () ), this, SLOT( refreshButton() ) ); refreshButton(); }
CompletionOrderEditor::CompletionOrderEditor(KPIM::LdapSearch *ldapSearch, QWidget *parent, const char *name) : KDialogBase(parent, name, true, i18n("Edit Completion Order"), Ok | Cancel, Ok, true), mConfig("kpimcompletionorder"), mDirty(false) { mItems.setAutoDelete(true); // The first step is to gather all the data, creating CompletionItem objects QValueList< LdapClient * > ldapClients = ldapSearch->clients(); for(QValueList<LdapClient *>::const_iterator it = ldapClients.begin(); it != ldapClients.end(); ++it) { //kdDebug(5300) << "LDAP: host " << (*it)->host() << " weight " << (*it)->completionWeight() << endl; mItems.append(new LDAPCompletionItem(*it)); } KABC::AddressBook *addressBook = KABC::StdAddressBook::self(true); QPtrList<KABC::Resource> resources = addressBook->resources(); for(QPtrListIterator<KABC::Resource> resit(resources); *resit; ++resit) { //kdDebug(5300) << "KABC Resource: " << (*resit)->className() << endl; ResourceABC *res = dynamic_cast<ResourceABC *>(*resit); if(res) // IMAP KABC resource { const QStringList subresources = res->subresources(); for(QStringList::const_iterator it = subresources.begin(); it != subresources.end(); ++it) { mItems.append(new KABCImapSubResCompletionItem(res, *it)); } } else // non-IMAP KABC resource { mItems.append(new SimpleCompletionItem(this, (*resit)->resourceName(), (*resit)->identifier())); } } #ifndef KDEPIM_NEW_DISTRLISTS // new distr lists are normal contact, so no separate item if using them // Add an item for distribution lists mItems.append(new SimpleCompletionItem(this, i18n("Distribution Lists"), "DistributionLists")); #endif // Now sort the items, then create the GUI mItems.sort(); QHBox *page = makeHBoxMainWidget(); mListView = new KListView(page); mListView->setSorting(-1); mListView->addColumn(QString::null); mListView->header()->hide(); for(QPtrListIterator<CompletionItem> compit(mItems); *compit; ++compit) { new CompletionViewItem(mListView, *compit); kdDebug(5300) << " " << (*compit)->label() << " " << (*compit)->completionWeight() << endl; } QVBox *upDownBox = new QVBox(page); mUpButton = new KPushButton(upDownBox, "mUpButton"); mUpButton->setIconSet(BarIconSet("up", KIcon::SizeSmall)); mUpButton->setEnabled(false); // b/c no item is selected yet mUpButton->setFocusPolicy(StrongFocus); mDownButton = new KPushButton(upDownBox, "mDownButton"); mDownButton->setIconSet(BarIconSet("down", KIcon::SizeSmall)); mDownButton->setEnabled(false); // b/c no item is selected yet mDownButton->setFocusPolicy(StrongFocus); QWidget *spacer = new QWidget(upDownBox); upDownBox->setStretchFactor(spacer, 100); connect(mListView, SIGNAL(selectionChanged(QListViewItem *)), SLOT(slotSelectionChanged(QListViewItem *))); connect(mUpButton, SIGNAL(clicked()), this, SLOT(slotMoveUp())); connect(mDownButton, SIGNAL(clicked()), this, SLOT(slotMoveDown())); }