const KProxyData KManualProxyDlg::data() const { KProxyData data; if (!m_bHasValidData) return data; data.proxyList["http"] = urlFromInput( mDlg->leHttp, mDlg->sbHttp ); if ( mDlg->cbSameProxy->isChecked () ) { data.proxyList["https"] = data.proxyList["http"]; data.proxyList["ftp"] = data.proxyList["http"]; } else { data.proxyList["https"] = urlFromInput( mDlg->leHttps, mDlg->sbHttps ); data.proxyList["ftp"] = urlFromInput( mDlg->leFtp, mDlg->sbFtp ); } if ( mDlg->lbExceptions->count() ) { QListBoxItem* item = mDlg->lbExceptions->firstItem(); for( ; item != 0L; item = item->next() ) data.noProxyFor << item->text(); } data.type = KProtocolManager::ManualProxy; data.useReverseProxy = mDlg->cbReverseProxy->isChecked(); return data; }
void OCompletionBox::setItems( const QStringList& items ) { bool block = signalsBlocked(); blockSignals( true ); QListBoxItem* item = firstItem(); if ( !item ) { insertStringList( items ); } else { for ( QStringList::ConstIterator it = items.begin(); it != items.end(); it++) { if ( item ) { ((OCompletionBoxItem*)item)->reuse( *it ); item = item->next(); } else { insertItem( new QListBoxText( *it ) ); } } QListBoxItem* tmp = item; while ( (item = tmp ) ) { tmp = item->next(); delete item; } triggerUpdate( false ); } blockSignals( block ); d->down_workaround = true; }
void KURLBar::setCurrentItem(const KURL &url) { d->currentURL = url; QString u = url.url(-1); if(m_activeItem && m_activeItem->url().url(-1) == u) return; bool hasURL = false; QListBoxItem *item = m_listBox->firstItem(); while(item) { if(static_cast< KURLBarItem * >(item)->url().url(-1) == u) { m_activeItem = static_cast< KURLBarItem * >(item); m_listBox->setCurrentItem(item); m_listBox->setSelected(item, true); hasURL = true; break; } item = item->next(); } if(!hasURL) { m_activeItem = 0L; m_listBox->clearSelection(); } }
void MessageFilterDialog::addedFilter(uint32_t mask, uint8_t filterid, const MessageFilter& filter) { if (m_existingFilters->count() == 0) { // add the new message filter new MessageFilterListBoxText(m_existingFilters, 0, filter.name(), filterid); } // iterate over all the existing filters for (QListBoxItem* currentLBT = m_existingFilters->firstItem(); currentLBT; currentLBT = currentLBT->next()) { // check if this is the removed filter if (((MessageFilterListBoxText*)currentLBT)->data() > filterid) { // add a new message filter at the appropriate location // NOTE: This maintains list order during an item update new MessageFilterListBoxText(m_existingFilters, currentLBT->prev(), filter.name(), filterid); break; } } }
void NetworkSettings::SLOT_Disable( bool T ) { QListBoxItem * LBI = Profiles_LB->item( Profiles_LB->currentItem() ); QString Msg; if ( ! LBI ) return; NetworkSetup * NC = NSResources->findNetworkSetup( LBI->text() ); Log(( "Prepare to %sable\n", (T) ? "en" : "dis" )); Msg = NC->setState( (T) ? Disable : Enable ); if( ! Msg.isEmpty() ) { Msg.insert( 0, "<p>" ); Msg.append( "</p>" ); QMessageBox::warning( 0, tr( "Activating profile" ), Msg ); return; } // reload new state NC->state( true ); updateProfileState( LBI ); }
void MessageFilterDialog::existingFilterSelectionChanged(QListBoxItem * item) { if (item) { // get the current filter number from the listbox item m_currentFilterNum = ((MessageFilterListBoxText*)item)->data(); // get the specified filter m_currentFilter = m_filters->filter(m_currentFilterNum); // set the GroupBox's label m_filterGroup->setTitle(m_currentFilter->name() + " &Filter"); // setup all the filter values m_name->setText(m_currentFilter->name()); m_pattern->setText(m_currentFilter->regexp().pattern()); // select all the message types uint64_t messageTypes = m_currentFilter->types(); uint32_t messageType; for (QListBoxItem* currentLBT = m_messageTypes->firstItem(); currentLBT; currentLBT = currentLBT->next()) { messageType = ((MessageFilterListBoxText*)currentLBT)->data(); m_messageTypes->setSelected(currentLBT, ((uint64_t(1) << messageType) & messageTypes) != 0); } } else // no item selected, clear all filter setup clearFilter(); // check the current state checkState(); }
bool ListBoxDnd::dropEvent( QDropEvent * event ) { if ( dragInside ) { if ( dMode & NullDrop ) { // combined with Move, a NullDrop will delete an item event->accept(); emit dropped( 0 ); // a NullDrop return TRUE; } QPoint pos = event->pos(); QListBoxItem * after = itemAt( pos ); if ( ListBoxItemDrag::decode( event, (QListBox *) src, after ) ) { event->accept(); QListBox * src = (QListBox *) this->src; QListBoxItem * item = ( after ? after->next() : src->firstItem() ); src->setCurrentItem( item ); emit dropped( item ); // ###FIX: Supports only one item! } } line->hide(); dragInside = FALSE; return TRUE; }
void CDPWizard::lstVariablesToCalc_selectionChanged() { QString myQString; int selectionSizeInt=0; for ( unsigned int i = 0; i < lstVariablesToCalc->count(); i++ ) { QListBoxItem *item = lstVariablesToCalc->item( i ); // if the item is selected... if ( item->isSelected() ) { // increment the count of selected items selectionSizeInt++; } } myQString.sprintf("<p align=\"right\">(%i) Variables selected </p>",selectionSizeInt); lblVariableCount->setText(myQString); if (selectionSizeInt==0) { setNextEnabled(currentPage(), false); } else { setNextEnabled(currentPage(), true); } }
void ListBoxDnd::insertList( ListBoxItemList & list ) { QListBoxItem * i = list.first(); while ( i ) { ((QListBox *)src)->insertItem( i, i->prev() ); i = list.next(); } }
void CustomWidgetEditor::addSignal() { QListBoxItem *i = new QListBoxText( listSignals, "signal()" ); listSignals->setCurrentItem( i ); listSignals->setSelected( i, TRUE ); MetaDataBase::CustomWidget *w = findWidget( boxWidgets->item( boxWidgets->currentItem() ) ); if ( w ) w->lstSignals.append( i->text().latin1() ); }
void GradientList::setGradient(int index, const Gradient& gradient) { QListBoxItem* listItem = item(index); if (listItem && listItem->rtti() == GradientItem::itemRtti) { GradientItem* gradItem = (GradientItem*)listItem; gradItem->setGradient(gradient); updateItem(index); } }
void ListBoxEditor::deletePixmap() { if ( preview->currentItem() == -1 ) return; QListBoxItem *i = preview->item( preview->currentItem() ); preview->changeItem( i->text(), preview->currentItem() ); itemDeletePixmap->setEnabled( FALSE ); }
void NetworkSettings::SLOT_Up( void ) { // bring more up QListBoxItem * LBI = Profiles_LB->item( Profiles_LB->currentItem() ); QString Msg; int led = -1; if ( ! LBI ) return; NetworkSetup * NC = NSResources->findNetworkSetup( LBI->text() ); switch( NC->state() ) { case Disabled : // cannot modify this state case Unknown : // cannot modify this state case Unchecked : // cannot modify this state case Unavailable : // cannot modify this state case IsUp : // highest UP state return; case Off : // -> activate led = 1; Down_TB->setEnabled( true ); Log(( "Activate interface %s\n", NC->name().latin1() )); Msg = NC->setState( Activate ); break; case Available : // -> up led = 2; Log(( "Bring up interface %s\n", NC->name().latin1() )); Msg = NC->setState( Up ); if( Msg.isEmpty() ) { Up_TB->setEnabled( false ); } break; } if( ! Msg.isEmpty() ) { Msg.insert( 0, "<p>" ); Msg.append( "</p>" ); QMessageBox::warning( 0, tr( "Increase availability" ), Msg ); return; } updateProfileState( LBI ); // set color of led we should change if( led > 0 ) { Leds[led]->setColor( blue ); Leds[led]->setOn( true ); } }
void NetworkSettings::SLOT_Down( void ) { // bring more down QListBoxItem * LBI = Profiles_LB->item( Profiles_LB->currentItem() ); int led = -1; QString Msg; if ( ! LBI ) return; NetworkSetup * NC = NSResources->findNetworkSetup( LBI->text() ); switch( NC->state() ) { case Disabled : // cannot modify this state case Unknown : // cannot modify this state case Unchecked : // cannot modify this state case Unavailable : // cannot modify this state case Off : // highest DOWN state break; case Available : // -> down led = 0; Log(( "Deactivate interface %s\n", NC->name().latin1() )); Msg = NC->setState( Deactivate ); Down_TB->setEnabled( false ); break; case IsUp : // highest UP state led = 1; Up_TB->setEnabled( true ); Log(( "Bring down interface %s\n", NC->name().latin1() )); Msg = NC->setState( Down, 1 ); if( Msg.isEmpty() ) { // remove 'up' file to make sure unlink ( QString().sprintf( "/tmp/Profile-%d.up", NC->number() ).latin1() );; } break; } if( ! Msg.isEmpty() ) { Msg.insert( 0, "<p>" ); Msg.append( "</p>" ); QMessageBox::warning( 0, tr( "Decrease availability" ), Msg ); return; } updateProfileState( LBI ); // set color of led we should change if( led >= 0 ) { Leds[led]->setColor( blue ); } }
int ListBoxDnd::buildList( ListBoxItemList & list ) { QListBoxItem * i = ((QListBox *)src)->firstItem(); while ( i ) { if ( i->isSelected() ) { ((QListBox *)src)->setSelected( i, FALSE ); list.append( i ); } i = i->next(); } return list.count(); }
ConfigEstateGroup *GroupEditor::currentGroup() { QListBoxItem *item = groups->item(groups->currentItem()); if (!item) return 0; for (ConfigEstateGroupList::Iterator it = mylist.begin(); it != mylist.end(); ++it) if ((*it).name() == item->text()) return &(*it); return 0; }
QListBoxItem * ListBoxDnd::itemAt( QPoint pos ) { QListBox * src = (QListBox *) this->src; QListBoxItem * result = src->itemAt( pos ); QListBoxItem * last = src->item( src->count() - 1 ); int i = src->index( result ); if ( result && ( pos.y() < (src->itemRect(result).top() + src->itemHeight(i)/2) ) ) result = result->prev(); else if ( !result && pos.y() > src->itemRect( last ).bottom() ) result = last; return result; }
void ossimQtBandSelectorController::rightButtonClicked() const { // Find the selected items and move them over. const int COUNT = theDialog->theAvailableBandsListBox->count(); for (int i = 0; i < COUNT; ++i) { if (theDialog->theAvailableBandsListBox->isSelected(i)) { QListBoxItem* item = theDialog->theAvailableBandsListBox->item(i); QString s = item->text(); theDialog->theSelectedBandsListBox->insertItem(s); } } }
void ClsQSAList::slotMoveUp() { // cout << "ClsQSAList::slotMoveUp()" << endl; int iCurrent = qlbox->currentItem(); if(iCurrent>=0) { QListBoxItem * lbCurrent = qlbox->item(iCurrent); QListBoxItem * lbPrev = lbCurrent->prev(); if(lbPrev!=NULL) { int iPrev = qlbox->index(lbPrev); qlbox->takeItem(lbCurrent); qlbox->insertItem(lbCurrent, iPrev); qlbox->setCurrentItem ( iPrev ); } } }
void ClsQSAList::slotMoveDown() { // cout << "ClsQSAList::slotMoveDown()" << endl; int iCurrent = qlbox->currentItem(); if(iCurrent>=0) { QListBoxItem * lbCurrent = qlbox->item(iCurrent); QListBoxItem * lbNext = lbCurrent->next(); if(lbNext!=NULL) { int iNext = qlbox->index(lbNext); qlbox->takeItem(lbCurrent); qlbox->insertItem(lbCurrent, iNext); qlbox->setCurrentItem ( iNext ); } } }
void ListViewEditor::columnUpClicked() { if ( colPreview->currentItem() <= 0 ) return; colPreview->clearSelection(); QListBoxItem *i = colPreview->item( colPreview->currentItem() ); QListBoxItem *above = i->prev(); colPreview->takeItem( above ); colPreview->insertItem( above, i ); colPreview->setCurrentItem( i ); colPreview->setSelected( i, TRUE ); }
void ConnectWizard::slotMoveDown() { // when nothing is selected, select the first QListBoxItem* i = m_viewList->selectedItem(); if( !i ) { m_viewList->setSelected( 0, true ); return; } // when next exists, select it, otherwise do nothing if( i->next() ) { m_viewList->setSelected( i->next(), true ); } else { m_viewList->setSelected( i, true ); } }
void ossimQtBandSelectorController::downButtonClicked() const { // Find the selected items and move them down. const int COUNT = theDialog->theSelectedBandsListBox->count(); for (int i = (COUNT-2); i >= 0; --i) // Skip the bottom cell... { if (theDialog->theSelectedBandsListBox->isSelected(i)) { QListBoxItem* item = theDialog->theSelectedBandsListBox->item(i); QString s = item->text(); theDialog->theSelectedBandsListBox->removeItem(i); theDialog->theSelectedBandsListBox->insertItem(s, (i+1)); } } }
void NetworkSettings::SLOT_DeleteNode( void ) { QListBoxItem * LBI = Profiles_LB->item( Profiles_LB->currentItem() ); if ( ! LBI ) return; if( QMessageBox::warning( 0, tr( "Removing profile" ), tr( "Remove selected profile ?" ), 1, 0 ) == 1 ) { NSResources->removeNetworkSetup( LBI->text() ); delete LBI; NSD.setModified( 1 ); } }
void ListViewEditor::columnDownClicked() { if ( colPreview->currentItem() == -1 || colPreview->currentItem() > (int)colPreview->count() - 2 ) return; colPreview->clearSelection(); QListBoxItem *i = colPreview->item( colPreview->currentItem() ); QListBoxItem *below = i->next(); colPreview->takeItem( i ); colPreview->insertItem( i, below ); colPreview->setCurrentItem( i ); colPreview->setSelected( i, TRUE ); }
void ossimQtBandSelectorController::upButtonClicked() const { // Find the selected items and move them up. const int COUNT = theDialog->theSelectedBandsListBox->count(); for (int i = 1; i < COUNT; ++i) // Skip the top cell... { if (theDialog->theSelectedBandsListBox->isSelected(i)) { QListBoxItem* item = theDialog->theSelectedBandsListBox->item(i); QString s = item->text(); theDialog->theSelectedBandsListBox->removeItem(i); theDialog->theSelectedBandsListBox->insertItem(s, (i-1)); } } }
void ListBoxEditor::applyClicked() { QListBoxItem *i = 0; QValueList<PopulateListBoxCommand::Item> items; for ( i = preview->firstItem(); i; i = i->next() ) { PopulateListBoxCommand::Item item; if ( i->pixmap() ) item.pix = *i->pixmap(); item.text = i->text(); items.append( item ); } PopulateListBoxCommand *cmd = new PopulateListBoxCommand( tr( "Edit Items of '%1'" ).arg( listbox->name() ), formwindow, listbox, items ); cmd->execute(); formwindow->commandHistory()->addCommand( cmd ); }
void KActionSelector::buttonRemoveClicked() { // move all selected items from selected to available listbox QListBoxItem *item = d->selectedListBox->firstItem(); while ( item ) { if ( item->isSelected() ) { d->selectedListBox->takeItem( item ); d->availableListBox->insertItem( item, insertionIndex( d->availableListBox, d->availableInsertionPolicy ) ); d->availableListBox->setCurrentItem( item ); emit removed( item ); } item = item->next(); } if ( d->availableInsertionPolicy == Sorted ) d->availableListBox->sort(); d->availableListBox->setFocus(); }
void ListBoxCombo::slotLeft2Right() { // Go through all items of the first ListBox for ( unsigned int i = 0; i < lb1->count(); i++ ) { QListBoxItem *item = lb1->item( i ); // if the item is selected... if ( item->selected() ) { // ...and it is a text item... if ( item->pixmap() && !item->text().isEmpty() ) lb2->insertItem( *item->pixmap(), item->text() ); else if ( !item->pixmap() ) lb2->insertItem( item->text() ); else if ( item->text().isEmpty() ) lb2->insertItem( *item->pixmap() ); } } }
void MessageFilterDialog::removedFilter(uint32_t mask, uint8_t filter) { // iterate over all the existing filters for (QListBoxItem* currentLBT = m_existingFilters->firstItem(); currentLBT; currentLBT = currentLBT->next()) { // check if this is the removed filter if (((MessageFilterListBoxText*)currentLBT)->data() == filter) { // delete the removed filter's list box item delete currentLBT; // nothing more to do break; } } }