void MainWindow::setCurrent(QListViewItem *item) { if (!item) return; _currentItem = (OListViewItem*)item; // _currentItem = dynamic_cast<OListViewItem*>(item); if (_currentItem->rtti() == OListViewItem::Result) { ResultItem *res = (ResultItem*)item; // ResultItem *res = dynamic_cast<ResultItem*>(item); richEdit->setText( res->toRichText() ); QIntDict<QString> acts = res->actions(); QButton *button; for (uint i = 0; i < acts.count(); i++) { button = buttonMap[i]; if (!button && acts[i]) { owarn << " no button for " << *acts[i] << oendl; button = new QPushButton( buttonBox ); buttonMap.insert( i, button ); signalMapper->setMapping(button, i ); connect(button, SIGNAL(clicked() ), signalMapper, SLOT(map() ) ); } else if (!acts[i]) { owarn << "No action for index " << i << oendl; continue; } button->setText( *acts[i] ); button->show(); } for (uint i = acts.count(); i < _buttonCount; i++) { button = buttonMap[i]; if (button) button->hide(); } _buttonCount = acts.count(); detailsFrame->show(); buttonBox->show(); } else { detailsFrame->hide(); buttonBox->hide(); } popupTimer->start( 300, true ); }
void PukeController::closefd(int fd) { if(bClosing == TRUE) return; bClosing = TRUE; if(qidConnectFd[fd] == NULL){ kdDebug(5008) << "PukeController: Connect table NULL, closed twice?" << endl; return; } // Shutof the listener before closing the socket, just in case. qidConnectFd[fd]->sr->setEnabled(FALSE); // Shut them off qidConnectFd[fd]->sw->setEnabled(FALSE); delete qidConnectFd[fd]->sr; delete qidConnectFd[fd]->sw; qidConnectFd[fd]->server.truncate(0); qidConnectFd.remove(fd); close(fd); /* * Now let's remove all traces of the widgets */ QIntDict<WidgetS> *qidWS = WidgetList[fd]; if(qidWS == 0){ kdDebug(5008) << "WidgetRunner:: Close called twice?" << endl; bClosing = FALSE; return; } qidWS->remove(PUKE_CONTROLLER); do { QIntDictIterator<WidgetS> it(*qidWS); if(it.count() == 0){ kdDebug(5008) << "WidgetRunner: nothing left to delete\n" << endl; break; } PObject *po = 0x0; while(it.current()){ /* * Delete all the layouts first * */ if(it.current()->type == POBJECT_LAYOUT){ po = it.current()->pwidget; break; } ++it; } if(po != 0x0){ po->manTerm(); delete po; continue; } /* * reset */ it.toFirst(); po = it.current()->pwidget; po->manTerm(); delete po; } while (qidWS->count() > 0); WidgetList.remove(fd); bClosing = FALSE; }
int ColorSchema::count() { return numb2schema.count(); }