Example #1
0
void ConfigureDialog::apply()
{
    bLanguageChanged = false;
    m_bAccept = true;
    emit applyChanges();
    if (!m_bAccept)
        return;
    for (unsigned i = 0; i < getContacts()->nClients(); i++){
        Client *client = getContacts()->getClient(i);
        const DataDef *def = client->protocol()->userDataDef();
        if (def == NULL)
            continue;
        size_t size = 0;
        for (const DataDef *d = def; d->name; ++d)
            size += sizeof(unsigned) * d->n_values;
        void *data = malloc(size);
        string cfg = client->getConfig();
        load_data(def, data, cfg.c_str());
        emit applyChanges(client, data);
        client->setClientInfo(data);
        free_data(def, data);
        free(data);
    }
    for (QListViewItem *item = lstBox->firstChild(); item; item = item->nextSibling()){
        apply(item);
    }
    if (bLanguageChanged){
        unsigned id = 0;
        if (lstBox->currentItem())
            id = static_cast<ConfigItem*>(lstBox->currentItem())->id();
        disconnect(lstBox, SIGNAL(currentChanged(QListViewItem*)), this, SLOT(itemSelected(QListViewItem*)));
        fill(id);
        connect(lstBox, SIGNAL(currentChanged(QListViewItem*)), this, SLOT(itemSelected(QListViewItem*)));
        itemSelected(lstBox->currentItem());
        buttonApply->setText(i18n("&Apply"));
        buttonOk->setText(i18n("&OK"));
        buttonCancel->setText(i18n("&Cancel"));
        setCaption(i18n("Setup"));
    }
    if (lstBox->currentItem())
        static_cast<ConfigItem*>(lstBox->currentItem())->show();
    Event e(EventSaveState);
    e.process();
}
Example #2
0
/******************************************************************************
* Return a list of events for birthdays chosen.
*/
QValueList<KAEvent> BirthdayDlg::events() const
{
	QValueList<KAEvent> list;
	QDate today = QDate::currentDate();
	QDateTime todayNoon(today, QTime(12, 0, 0));
	int thisYear = today.year();
	int reminder = mReminder->minutes();

	for (QListViewItem* item = mAddresseeList->firstChild();  item;  item = item->nextSibling())
	{
		if (mAddresseeList->isSelected(item))
		{
			AddresseeItem* aItem = dynamic_cast<AddresseeItem*>(item);
			if (aItem)
			{
				QDate date = aItem->birthday();
				date.setYMD(thisYear, date.month(), date.day());
				if (date <= today)
					date.setYMD(thisYear + 1, date.month(), date.day());
				KAEvent event(date,
				              mPrefix->text() + aItem->text(AddresseeItem::NAME) + mSuffix->text(),
				              mFontColourButton->bgColour(), mFontColourButton->fgColour(),
				              mFontColourButton->font(), KAEvent::MESSAGE, mLateCancel->minutes(),
				              mFlags);
				float fadeVolume;
				int   fadeSecs;
				float volume = mSoundPicker->volume(fadeVolume, fadeSecs);
				event.setAudioFile(mSoundPicker->file(), volume, fadeVolume, fadeSecs);
				QValueList<int> months;
				months.append(date.month());
				event.setRecurAnnualByDate(1, months, 0, Preferences::defaultFeb29Type(), -1, QDate());
				event.setRepetition(mSubRepetition->interval(), mSubRepetition->count());
				event.setNextOccurrence(todayNoon);
				if (reminder)
					event.setReminder(reminder, false);
				if (mSpecialActionsButton)
					event.setActions(mSpecialActionsButton->preAction(),
					                 mSpecialActionsButton->postAction());
				list.append(event);
			}
		}
	}
	return list;
}
Example #3
0
void KateFileList::slotViewChanged ()
{
  if (!viewManager->activeView()) return;

  Kate::View *view = viewManager->activeView();
  uint dn = view->getDoc()->documentNumber();

  QListViewItem * i = firstChild();
  while( i ) {
    if ( ((KateFileListItem *)i)->documentNumber() == dn )
    {
      break;
    }
    i = i->nextSibling();
  }

  if ( ! i )
    return;

  KateFileListItem *item = (KateFileListItem*)i;
  setCurrentItem( item );

  // ### During load of file lists, all the loaded views gets active.
  // Do something to avoid shading them -- maybe not creating views, just
  // open the documents???


//   int p = 0;
//   if (  m_viewHistory.count() )
//   {
//     int p =  m_viewHistory.findRef( item ); // only repaint items that needs it
//   }

  m_viewHistory.removeRef( item );
  m_viewHistory.prepend( item );

  for ( uint i=0; i <  m_viewHistory.count(); i++ )
  {
    m_viewHistory.at( i )->setViewHistPos( i+1 );
    repaintItem(  m_viewHistory.at( i ) );
  }

}
Example #4
0
void KateFileList::slotDocumentDeleted(uint documentNumber)
{
    QListViewItem *item = firstChild();
    while(item)
    {
        if(((KateFileListItem *)item)->documentNumber() == documentNumber)
        {
            //       m_viewHistory.removeRef( (KateFileListItem *)item );
            //       m_editHistory.removeRef( (KateFileListItem *)item );

            removeItem(item);

            break;
        }
        item = item->nextSibling();
    }

    updateActions();
}
Example #5
0
void SoundUserConfig::apply(void *data)
{
    SoundUserData *user_data = (SoundUserData*)data;
    for (QListViewItem *item = lstSound->firstChild(); item; item = item->nextSibling()){
        unsigned id = item->text(2).toUInt();
        QString text = item->text(1);
        if (text.isEmpty())
            text = "-";
        if (id == ONLINE_ALERT){
            set_str(&user_data->Alert, QFile::encodeName(text));
        }else{
            set_str(&user_data->Receive, id, QFile::encodeName(text));
        }
    }
    user_data->NoSoundIfActive = chkActive->isChecked();
    user_data->Disable = chkDisable->isChecked();
	Event e(m_plugin->EventSoundChanged);
	e.process();
}
Example #6
0
void
Item::stateChange( bool b )
{
    QStringList &cs_m_dirs = CollectionSetup::instance()->m_dirs;

    if( CollectionSetup::instance()->recursive() )
        for( QListViewItem *item = firstChild(); item; item = item->nextSibling() )
            static_cast<QCheckListItem*>(item)->QCheckListItem::setOn( b );

    // Update folder list
    QStringList::Iterator it = cs_m_dirs.find( m_url.path() );
    if ( isOn() ) {
        if ( it == cs_m_dirs.end() )
            cs_m_dirs << m_url.path();
    }
    else {
        //Deselect item and recurse through children but only deselect children if they
        //do not exist unless we are in recursive mode (where no children should be
        //selected if the parent is being unselected)
        //Note this does not do anything to the checkboxes, but they should be doing
        //the same thing as we are (hopefully)
        cs_m_dirs.erase( it );
        QStringList::Iterator diriter = cs_m_dirs.begin();
        while ( diriter != cs_m_dirs.end() )
        {
            if ( (*diriter).startsWith( m_url.path() + '/' ) )
            {
                if ( CollectionSetup::instance()->recursive() ||
                     !QFile::exists( *diriter ) )
                {
                    diriter = cs_m_dirs.erase(diriter);
                }
                else
                    ++diriter;
    }
    else
                ++diriter;
        }
    }

    // Redraw parent items
    listView()->triggerUpdate();
}
Example #7
0
void oprof_start::event_selected()
{
	// The deal is simple: QT lack of a way to know what item was the last
	// (de)selected item so we record a set of selected items and diff
	// it in the appropriate way with the previous list of selected items.

	set<QListViewItem *> current_selection;
	QListViewItem * cur;
	for (cur = events_list->firstChild(); cur; cur = cur->nextSibling()) {
		if (cur->isSelected())
			current_selection.insert(cur);
	}

	// First remove the deselected item.
	vector<QListViewItem *> new_deselected;
	set_difference(selected_events.begin(), selected_events.end(),
		       current_selection.begin(), current_selection.end(),
		       back_inserter(new_deselected));
	vector<QListViewItem *>::const_iterator it;
	for (it = new_deselected.begin(); it != new_deselected.end(); ++it)
		selected_events.erase(*it);

	// Now try to add the newly selected item if enough HW resource exists
	vector<QListViewItem *> new_selected;
	set_difference(current_selection.begin(), current_selection.end(),
		       selected_events.begin(), selected_events.end(),
		       back_inserter(new_selected));
	for (it = new_selected.begin(); it != new_selected.end(); ++it) {
		selected_events.insert(*it);
		if (!alloc_selected_events()) {
			(*it)->setSelected(false);
			selected_events.erase(*it);
		} else {
			current_event = *it;
		}
	}

	draw_event_list();

	if (current_event)
		display_event(locate_event(current_event->text(0).latin1()));
}
Example #8
0
// This function is called when selection is changed (both selected/deselected)
// It notifies the parent about selection status and enables/disables menubar
void KfindWindow::selectionHasChanged()
{
    emit resultSelected(true);

    QListViewItem *item = firstChild();
    while(item != 0L)
    {
        if(isSelected(item))
        {
            emit resultSelected(true);
            haveSelection = true;
            return;
        }

        item = item->nextSibling();
    }

    haveSelection = false;
    emit resultSelected(false);
}
Example #9
0
/*
*Function:SetListViewItem
*Inputs:list view, item to find
*Outputs:none
*Returns:index to found item or 0
*/
int SetListViewItem(QListView *pCombo, const QString &item)
{
	
	IT_IT("SetListViewItem");
	
	QListViewItem *pI = pCombo->firstChild();
	if(pI)
	{
		for(; pI != 0; pI = pI->nextSibling())
		{
			if(pI->text(0) == item)
			{
				pCombo->setCurrentItem(pI);
				return 0;       
			};
		};
		pCombo->setCurrentItem(pCombo->firstChild());
	};
	return 0;
};
Example #10
0
void KateFileList::slotNameChanged(Kate::Document *doc)
{
    if(!doc)
        return;

    // ### using nextSibling to *only* look at toplevel items.
    // child items could be marks for example
    QListViewItem *item = firstChild();
    while(item)
    {
        if(((KateFileListItem *)item)->document() == doc)
        {
            item->setText(0, doc->docName());
            repaintItem(item);
            break;
        }
        item = item->nextSibling();
    }
    updateSort();
}
Example #11
0
/** Add question with form data */
void KControlAddEdit::addQuestion()
{
    _keducaFile->setQuestion( FileRead::QF_TEXT, _questionText->text() );
    _keducaFile->setQuestion( FileRead::QF_TYPE, _questionType->currentItem()+1 );
    _keducaFile->setQuestion( FileRead::QF_PICTURE, _questionPicture->url() );
    _keducaFile->setQuestion( FileRead::QF_POINTS, _questionPoint->value() );
    _keducaFile->setQuestion( FileRead::QF_TIME, _questionTime->value() );
    _keducaFile->setQuestion( FileRead::QF_TIP, _questionTip->text() );
    _keducaFile->setQuestion( FileRead::QF_EXPLAIN, _questionExplain->text() );

    _keducaFile->clearAnswers();
    QListViewItem *item = _listAnswers->firstChild();
    while (item) {
        _keducaFile->setAnswer(
            item->text(0), // The Answer text
            item->text(1)==i18n("True"), // the validity of the answer
            item->text(2).toInt()); // the points
        item = item->nextSibling();
    }
}
Example #12
0
void
KCustomMenuEditor::slotMoveUp()
{
   QListViewItem *item = m_listView->currentItem();
   if (!item)
      return;

   QListViewItem *searchItem = m_listView->firstChild();
   while(searchItem)
   {
      QListViewItem *next = searchItem->nextSibling();
      if (next == item)
      {
         searchItem->moveItem(item);
         break;
      }
      searchItem = next;
   }
   refreshButton();
}
Example #13
0
void SoundUserConfig::apply(void *data)
{
    selectionChanged(NULL);
    SoundUserData *user_data = (SoundUserData*)data;
    for (QListViewItem *item = lstSound->firstChild(); item; item = item->nextSibling()){
        unsigned id = item->text(2).toUInt();
        QString text = item->text(1);
        if (text.isEmpty())
            text = "(nosound)";
        if (id == ONLINE_ALERT){
            user_data->Alert.str() = text;
        }else{
            set_str(&user_data->Receive, id, text);
        }
    }
    user_data->NoSoundIfActive.asBool() = chkActive->isChecked();
    user_data->Disable.asBool() = chkDisable->isChecked();
    Event e(m_plugin->EventSoundChanged);
    e.process();
}
void RKVarSlot::listSelectionChanged () {
	RK_TRACE (PLUGIN);

	bool selection = false;

	ObjectList sellist;
	QListViewItem *item = list->firstChild ();
	while (item) {
		if (item->isSelected ()) {
			selection = true;
			RObject *robj = item_map[item];
			RK_ASSERT (robj);
			sellist.append (robj);
		}
		item = item->nextSibling ();
	}
	selected->setObjectList (sellist);

	setSelectButton (((!multi) || (!selection)) && (!available->atMaxLength ()));
}
Example #15
0
void IndexDialog::getList (QString &d)
{
  d.truncate(0);
  
  if (! list->childCount())
    return;
  
  QListViewItem *item = list->firstChild();
  
  while (item)
  {
    QString *sp = symbolDict[item->text(0)];
    d.append(sp->left(sp->length()));
    d.append(":");
    d.append(item->text(1));
    d.append(":");
    
    item = item->nextSibling();
  }
}
Example #16
0
/**
 * Makes all descendants of the given item visible.
 * This slot is connected to the showAll() signal of the QueryResultsMenu
 * object.
 */
void TreeWidget::slotShowAll(QListViewItem* pParent)
{
	QListViewItem* pItem;
	
	// Get the first child
	if (pParent != NULL)
		pItem = pParent->firstChild();
	else
		pItem = firstChild();
	
	// Iterate over all child items
	while (pItem != NULL) {
		pItem->setVisible(true);
		
		// Show child items recursively
		slotShowAll(pItem);
			
		pItem = pItem->nextSibling();
	}
}
void RefactoringAssistant::addDerivedClassifier()
{
    QListViewItem *item = selectedItem();
    if(!item)
    {
        kWarning()<<"RefactoringAssistant::addDerivedClassifier() "
        <<"called with no item selected"<<endl;
        return;
    }
    UMLObject *obj = findUMLObject( item );
    if( !dynamic_cast<UMLClassifier*>(obj) )
    {
        kWarning()<<"RefactoringAssistant::addDerivedClassifier() "
        <<"called for a non-classifier object"<<endl;
        return;
    }

    //classes have classes and interfaces interfaces as super/derived classifiers
    Uml::Object_Type t = obj->getBaseType();
    UMLClassifier *derived = static_cast<UMLClassifier*>(Object_Factory::createUMLObject(t));
    if(!derived)
        return;
    m_doc->createUMLAssociation( derived, obj, Uml::at_Generalization );

    //////////////////////   Manually add the classifier to the assitant - would be nicer to do it with
    /////////////////////    a signal, like operations and attributes
    QListViewItem *derivedFolder = item->firstChild();
    while( derivedFolder->text(0) != i18n("Derived Classifiers") )
        derivedFolder = derivedFolder->nextSibling();
    if(!derivedFolder)
    {
        kWarning()<<"Cannot find Derived Folder"<<endl;
        return;
    }
    item = new KListViewItem( derivedFolder, derived->getName() );
    item->setPixmap(0,m_pixmaps.Subclass);
    item->setExpandable( true );
    m_umlObjectMap[item] = derived;
    addClassifier( derived, item, false, true, true);
    /////////////////////////
}
Example #18
0
void VariableTree::prune()
{
	QListViewItem *child = firstChild();

    while (child != 0) {
        QListViewItem *nextChild = child->nextSibling();

        // Only prune var frames, not the watch or global root
        if (child->rtti() == RTTI_VAR_FRAME_ROOT) {
			if (((VarFrameRoot*) child)->isActive()) {
				if (child->isOpen()) {
					((VarFrameRoot*) child)->prune();
				}
			} else {
				delete child;
			}
		}
		
        child = nextChild;
    }
}
void CompletionOrderEditor::slotOk()
{
    if(mDirty)
    {
        int w = 100;
        for(QListViewItem *it = mListView->firstChild(); it; it = it->nextSibling())
        {
            CompletionViewItem *item = static_cast<CompletionViewItem *>(it);
            item->item()->setCompletionWeight(w);
            item->item()->save(this);
            kdDebug(5300) << "slotOk:   " << item->item()->label() << " " << w << endl;
            --w;
        }

        // Emit DCOP signal
        // The emitter is always set to KPIM::IMAPCompletionOrder, so that the connect works
        // This is why we can't use k_dcop_signals here, but need to use emitDCOPSignal
        kapp->dcopClient()->emitDCOPSignal("KPIM::IMAPCompletionOrder", "orderChanged()", QByteArray());
    }
    KDialogBase::slotOk();
}
FrameStackItem *FramestackWidget::findFrame(int frameNo, int threadNo)
{
	ThreadStackItem * thread = findThread(threadNo);
	if (thread == 0) {
		kdDebug(9012) << "FramestackWidget::findFrame: no matching thread " << 
					frameNo << " thread: " << threadNo << endl;
		return 0;     // no matching thread?
	}

	QListViewItem * frameItem = thread->firstChild();

    while (frameItem != 0) {
        if (((FrameStackItem *) frameItem)->frameNo() == frameNo) {
            return (FrameStackItem *) frameItem;
		}

        frameItem = frameItem->nextSibling();
    }
	
    return 0;
}
Example #21
0
void ConnectionManager::selectionChanged()
{
    QListViewItem *item = lstConnection->currentItem();
    if (item == NULL){
        btnUp->setEnabled(false);
        btnDown->setEnabled(false);
        btnRemove->setEnabled(false);
        btnUpdate->setEnabled(false);
        return;
    }
    btnUpdate->setEnabled(true);
    btnRemove->setEnabled(true);
    int n = 0;
    int index = -1;
    for (QListViewItem *i = lstConnection->firstChild(); i; i = i->nextSibling(), n++){
        if (i == item)
            index = n;
    }
    btnUp->setEnabled(index > 0);
    btnDown->setEnabled(index < n - 1);
}
Example #22
0
/**
 * Sets the visibility of \a i and
 * returns whether it was made visible.
 */
bool ProcAttachPS::setVisibility(QListViewItem* i, const QString& text)
{
    bool visible = false;
    for (QListViewItem* j = i->firstChild(); j; j = j->nextSibling())
    {
	if (setVisibility(j, text))
	    visible = true;
    }
    // look for text in the process name and in the PID
    visible = visible || text.isEmpty() ||
	i->text(0).find(text, 0, false) >= 0 ||
	i->text(1).find(text) >= 0;

    i->setVisible(visible);

    // disable the OK button if the selected item becomes invisible
    if (i->isSelected())
	buttonOk->setEnabled(visible);

    return visible;
}
Example #23
0
void ShortcutsConfig::loadMenu(unsigned id, bool bCanGlobal)
{
    Event eDef(EventGetMenuDef, (void*)id);
    CommandsDef *def = (CommandsDef*)(eDef.process());
    if (def){
        CommandsList list(*def, true);
        CommandDef *s;
        while ((s = ++list) != NULL){
            if ((s->id == 0) || s->popup_id || (s->flags & COMMAND_TITLE))
                continue;
            QString title = i18n(s->text);
            title = title.replace(QRegExp("&"), "");
            QString accel;
            int key = 0;
            const char *cfg_accel = m_plugin->getKey(s->id);
            if (cfg_accel)
                key = QAccel::stringToKey(cfg_accel);
            if ((key == 0) && s->accel)
                key = QAccel::stringToKey(i18n(s->accel));
            if (key)
                accel = QAccel::keyToString(key);
            QString global;
            bool bGlobal = m_plugin->getOldGlobal(s);
            const char *cfg_global = m_plugin->getGlobal(s->id);
            if (cfg_global && *cfg_global)
                bGlobal = !bGlobal;
            if (bGlobal)
                global = i18n("Global");
            QListViewItem *item;
            for (item = lstKeys->firstChild(); item; item = item->nextSibling()){
                if (item->text(3).toUInt() == s->id)
                    break;
            }
            if (item == NULL)
                new QListViewItem(lstKeys,
                                  title, accel, global,
                                  QString::number(s->id), bCanGlobal ? "1" : "");
        }
    }
}
Example #24
0
void NewDevice::fillTree()
{
  QListViewItem* parent = NULL;
  QListViewItem* newItem = NULL;

  QList <DeviceClass> dclist(_app->doc()->deviceClassList());
  QPixmap pm(_app->settings()->pixmapPath() + QString("dmx.xpm"));

  m_tree->clear();

  for (DeviceClass* dc = dclist.first(); dc != NULL; dc = dclist.next())
    {
      bool alreadyAdded = false;

      for (QListViewItem* i = m_tree->firstChild(); i != NULL; i = i->nextSibling())
	{
	  if (i->text(0) == dc->manufacturer())
	    {
	      alreadyAdded = true;
	      parent = i;
	      break;
	    }
	}

      if (alreadyAdded == false)
	{
	  parent = new QListViewItem(m_tree, dc->manufacturer());
	  if (_app->settings()->newDeviceTreeOpen() == true)
	    {
	      parent->setOpen(true);
	    }
	}

      parent->setPixmap(0, QPixmap(_app->settings()->pixmapPath() + QString("global.xpm")));

      newItem = new QListViewItem(parent, dc->model());
      newItem->setPixmap(0, pm);
      newItem->setText(1,dc->type());
    }
}
void 
PolicyView::init(PolicyXML * _policy)
{
  if (policy_ == _policy)
    return;

  // delete all childs
  QObjectList * childs;
  while((childs =  const_cast<QObjectList *>(viewport()->children())) != NULL && 
	!childs->isEmpty()) {
    delete childs->first();
  }

  policy_ = _policy;

  if (policy_ == NULL)
    return;

  policy_->setWidget(this);

  //-------------------------
  // rebuild the widget list

  QListViewItem * i = policy_->listViewItem()->firstChild();
  while (i != NULL) {
    Item * item = policy_->itemFromListViewItem(i);
    PatternXML * pattern = dynamic_cast<PatternXML *>(item);
    if (pattern != NULL)
      addPatternWidget(pattern);

    i = i->nextSibling();
  }

  QRect r = viewport()->childrenRect();
  QPoint s = viewportToContents(r.bottomRight());

  resizeContents(s.x(), s.y());
  setContentsPos(0, 0);
}
Example #26
0
// Sets the initial value of a new Watch item, along with the
// display id
void WatchRoot::setWatchExpression(char * buf, char * expression)
{
	QString expr(expression);
	QRegExp display_re("^(\\d+):\\s([^\n]+)\n");
	
    for (	QListViewItem *child = firstChild(); 
			child != 0; 
			child = child->nextSibling() ) 
	{
        WatchVarItem *varItem = (WatchVarItem*) child;
		if (	varItem->text(VAR_NAME_COLUMN) == expr 
				&& varItem->displayId() == -1
				&& display_re.search(buf) >= 0 ) 
		{
			varItem->setDisplayId(display_re.cap(1).toInt());
			// Skip over the 'thing = ' part of expr to get the value
			varItem->setText(	VALUE_COLUMN, 
								display_re.cap(2).mid(varItem->text(VAR_NAME_COLUMN).length() + strlen(" = ")) );
			return;
		}
	}
}
void QTodoRecoveryDialog::recover()
{
    QFileInfo file_info;
    QDir dir;

    QListViewItem* item = list->firstChild();
    for(; item; item = item->nextSibling())
    {
        if(item->text(2).isEmpty())
        {   //we can't recover from a backup file, so we at least (try to) restore the todo-list-name :(
            file_info.setFile(item->text(0));
            dynamic_cast<QTodoRecoveryListViewItem*>(item)->list_view_item->listWidget()->getHeader()->setName(file_info.fileName());
            dynamic_cast<QTodoRecoveryListViewItem*>(item)->list_view_item->update();
            dynamic_cast<QTodoRecoveryListViewItem*>(item)->list_view_item->listWidget()->setModified();
            dynamic_cast<QTodoRecoveryListViewItem*>(item)->list_view_item->save();
        }
        else
        {
            dir.rename(item->text(0)+'~',item->text(0),true);
            dynamic_cast<QTodoRecoveryListViewItem*>(item)->list_view_item->load();
        }
    }
}
Example #28
0
/**
 * Hides all descendant that do not meet the given search criteria.
 * This slot is connected to the search() signal of the QueryResultsMenu
 * object.
 * The search is incremental: only visible items are checked, so that a new
 * search goes over the results of the previous one.
 * @param	pParent	The parent item whose child are searched
 * @param	re		The pattern to search
 * @param	nCol	The list column to search in
 */
void TreeWidget::slotSearch(QListViewItem* pParent, const QRegExp& re, 
	int nCol)
{
	QListViewItem* pItem;
	
	// Get the first child
	if (pParent != NULL)
		pItem = pParent->firstChild();
	else
		pItem = firstChild();
	
	// Iterate over all child items
	while (pItem != NULL) {
		// Filter visible items only
		if (pItem->isVisible() && re.search(pItem->text(nCol)) == -1)
			pItem->setVisible(false);
		
		// Search child items recursively
		slotSearch(pItem, re, nCol);
		
		pItem = pItem->nextSibling();
	}
}
Example #29
0
/**
 * Associates a root directory with this list.
 * For each file in the list, the part of the path corresponding to the root
 * is replaced with a $ sign.
 * @param	sRoot	The new root path
 */
void FileList::setRoot(const QString& sRoot)
{
	QListViewItem* pItem;
	QString sPath;
	
	// Update all items in the list
	for (pItem = m_pList->firstChild(); pItem != NULL; 
		pItem = pItem->nextSibling()) {
		sPath = pItem->text(2);
		
		// Restore the full path
		sPath.replace("$", m_sRoot);
		
		// Replace the root with a $ sign
		if (sRoot != "/")
			sPath.replace(sRoot, "$");
		
		pItem->setText(2, sPath);
	}
	
	// Store the new root
	m_sRoot = sRoot;
}
Example #30
0
void KonqSidebarBookmarkModule::slotBookmarksChanged( const QString & groupAddress )
{
    m_ignoreOpenChange = true;

    // update the right part of the tree
    KBookmarkGroup group = KonqBookmarkManager::self()->findByAddress( groupAddress ).toGroup();
    KonqSidebarBookmarkItem * item = findByAddress( groupAddress );
    Q_ASSERT(!group.isNull());
    Q_ASSERT(item);
    if (!group.isNull() && item)
    {
        // Delete all children of item
        QListViewItem * child = item->firstChild();
        while( child ) {
            QListViewItem * next = child->nextSibling();
            delete child;
            child = next;
        }
        fillGroup( item, group );
    }

    m_ignoreOpenChange = false;
}