Example #1
0
void ActionWidget::slotDeleteAction()
{
    Q3ListViewItem *item = listView->currentItem();
    if ( item && item->parent() )
        item = item->parent();
    delete item;
}
void GCUserView::clear()
{
	for (Q3ListViewItem *j = firstChild(); j; j = j->nextSibling())
		while (GCUserViewItem* i = (GCUserViewItem*) j->firstChild()) {
			delete i;
		}
}
Example #3
0
void Tab_Logins::setPrimaryLogin()
{
    Q3ListViewItem   *curItem;
    
    curItem = list->currentItem();
    if (curItem != NULL) {
		char    tmpSt[1024];
		sprintf(tmpSt, "Are you sure you wish to set the primary\nlogin for this account to '%s'?", (const char *) curItem->text(0));
        if (QMessageBox::warning(this, "Set Primary Login", tmpSt, "&Yes", "&No", 0, 1) == 0) {
		    CustomersDB     CDB;
		    CDB.get(myCustID);
		    if (strcmp(CDB.getStr("PrimaryLogin"), curItem->text(0))) {
		        // The logins are different.  Update it.
		        sprintf(tmpSt, "Set primary login from %s to %s", (const char *) CDB.getStr("PrimaryLogin"), (const char *) curItem->text(0));
                CDB.setValue("PrimaryLogin", curItem->text(0));
                CDB.upd();
                
		        NotesDB NDB;
                NDB.setValue("LoginID", curItem->text(0));
                NDB.setValue("CustomerID", myCustID);
                NDB.setValue("NoteType", "Operator");
                NDB.setValue("NoteText", tmpSt);
                NDB.ins();

            	refreshLoginList(1);
                emit(customerUpdated(myCustID));
		    } else {
            	QMessageBox::information(this, "Set Primary Login", "The specified login ID is\nalready the primary login ID.");
		    }
		}
    }
}
Example #4
0
bool DatabaseDialog::columnsDoNext()
{
  QStringList columns;
  for (Q3ListViewItem * item = m_columnView->firstChild(); item; item = item->nextSibling())
  {
    if (((Q3CheckListItem * ) item)->isOn())
    {
      columns.append( item->text(1) + '.' + ((Q3CheckListItem * ) item)->text());
    }
  }

  if (columns.empty())
  {
    KMessageBox::error( this, i18n("You have to select at least one column.") );
    return false;
  }

  m_columns_1->clear();
  m_columns_2->clear();
  m_columns_3->clear();
  m_columns_1->insertItems( 0,columns);
  m_columns_2->insertItems( 0,columns);
  m_columns_3->insertItems( 0,columns);
  m_columnsSort_1->clear();
  m_columnsSort_2->clear();
  m_columnsSort_1->insertItem( 0,i18n("None") );
  m_columnsSort_2->insertItem( 0,i18n("None") );
  m_columnsSort_1->insertItems( 1,columns);
  m_columnsSort_2->insertItems( 2,columns);

  setValid(m_options, true);

  return true;
}
Example #5
0
void classTable::selectionChanged( QListViewItem *p )
#endif
{
  // Determine if the selected item is a child of this table using the y coord, is there a better way?
#ifdef QT_V4LAYOUT
  Q3ListViewItem *n = nextSibling() ;
#else
  QListViewItem *n = nextSibling() ;
#endif
  int siblingPos = n ? n->itemPos() : 999999 ;
  int selectPos  = p ? p->itemPos() : 0      ;
  int thisPos    =        itemPos()          ;

  if ( thisPos <= selectPos && selectPos < siblingPos )
  {
    if ( !pBrowse )
      pBrowse = new classBrowseFrame( hDbc, qsTable, qsLibrary, pCanvas );
    pBrowse->show();
  }
  else
  {
    if ( pBrowse )
      pBrowse->hide();
  }
}
QString SloxFolderDialog::selectedFolder() const
{
  Q3ListViewItem *item = mListView->selectedItem();
  if ( item )
    return item->text( 1 );
  return "-1"; // OX default folder
}
void CatalogForm::Refresh( qulonglong id )
{
	Q3ListViewItem * item;
	if( map_el.contains( id ))
	{
		item = map_el[id];
		cat->select( id );
		for(uint i=0; i<fieldList.count(); i++)
		{

			item->setText(i,cat->sysValue(fieldList[i]).toString());
			ListView->setFocus();
		}
	}
	else
	{
		if( map_gr.contains( id ) )
		{
			item = map_gr[id];
			cat->groupSelect( id );
			item->setText(0,cat->GroupSysValue(fieldListGroup[0]).toString());
			ListView->setFocus();
		}
	}
}
Example #8
0
void MouseConfig::loadMenu(unsigned id)
{
    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 == 0))
                continue;
            QString title = i18n(s->text);
            if (title == "_")
                continue;
            Q3ListViewItem *item;
            for (item = lstCmd->firstChild(); item; item = item->nextSibling()){
                if (QString::number(s->popup_id) == item->text(3))
                    break;
            }
            if (item)
                continue;
            title = title.replace(QRegExp("&"), "");
            new Q3ListViewItem(lstCmd, title, m_plugin->getMouse(s->id), QString::number(s->id), QString::number(s->popup_id));
        }
    }
}
void RecipeActionsHandler::categorize()
{
	QList<Q3ListViewItem*> items = parentListView->selectedItems();
	if ( items.count() > 0 ) {
		ElementList categoryList;
		QPointer<SelectCategoriesDialog> editCategoriesDialog = new SelectCategoriesDialog( parentListView, categoryList, database );
	
		if ( editCategoriesDialog->exec() == QDialog::Accepted ) { // user presses Ok
			editCategoriesDialog->getSelectedCategories( &categoryList ); // get the category list chosen
			
			QListIterator<Q3ListViewItem *> it(items);
			Q3ListViewItem *item;
			while ( it.hasNext() ) {
				item = it.next();
				if ( item->parent() != 0 ) {
					RecipeListItem * recipe_it = ( RecipeListItem* ) item;
					int recipe_id = recipe_it->recipeID();
	
					database->categorizeRecipe( recipe_id, categoryList );
				}
			}
		}

		delete editCategoriesDialog;
	}
}
Example #10
0
void BrowserNode::update_stereotype(bool rec) {
  BasicData * data = get_data();
  
  if (data != 0) {
    const char * stereotype = data->get_stereotype();
    
    if (show_stereotypes && stereotype[0]) {
      QString s = toUnicode(stereotype);
      int index = s.find(':');
      
      setText(0,
	      "<<" + ((index == -1) ? s : s.mid(index + 1))
	      + ">> " + name);
    }
    else
      setText(0, (const char *) name);
  }
  
  if (rec) {
    Q3ListViewItem * child;
    
    for (child = firstChild(); child != 0; child = child->nextSibling())
      ((BrowserNode *) child)->update_stereotype(TRUE);
  }
}
Example #11
0
bool BrowserNode::may_contains(BrowserNode * bn, bool rec) const {
  // for the type point of view bn is legal for 'this'
  if (((BrowserNode *) bn->parent()) == this)
    return TRUE;
  
  QString s = (const char *) bn->name;
  
  if (! s.isEmpty()) {
    UmlCode type = bn->get_type();
    
    for (Q3ListViewItem * child = firstChild(); child; child = child->nextSibling()) {
      if (!((BrowserNode *) child)->deletedp() &&
	  // case already check : (child != bn) &&
	  ((BrowserNode *) child)->same_name(s, type))
	return FALSE;
    }
  }
    
  if (!rec)
    return TRUE;
  
  const BrowserNode * pa = this;
  
  for (;;) {
    if (pa == 0)
      return TRUE;
    else if (pa == bn)
      // cannot move a parent in a child !
      return FALSE;
    
    pa = ((BrowserNode *) pa->parent());
  }
}
Example #12
0
void BrowserNodeList::search(BrowserNode * bn, UmlCode k, const QString & s,
			     bool cs, bool even_deleted, bool for_name,
			     bool for_stereotype)
{
  Q3ListViewItem * child;
    
  for (child = bn->firstChild(); child != 0; child = child->nextSibling()) {
    if (even_deleted || !((BrowserNode *) child)->deletedp()) {
      BrowserNode * ch = (BrowserNode *) child;
      
      if (((k == UmlCodeSup) ||
	   ((k == UmlRelations)
	    ? IsaRelation(ch->get_type())
	    : (ch->get_type() == k))) &&
	  (s.isEmpty() ||
	   (QString((for_name)
		    ? ch->get_name()
		    : ((for_stereotype) ? ch->get_stereotype()
					: ch->get_comment()))
	    .find(s, 0, cs) != -1)))
	append((BrowserNode *) child);
      
      search((BrowserNode *) child, k, s, cs, even_deleted,
	     for_name, for_stereotype);
    }
  }
}
void CustomCheckListItem::stateChange( bool on )
{
    if ( !m_locked ) {
        for ( Q3CheckListItem * it = static_cast<Q3CheckListItem*>( firstChild() ); it; it = static_cast<Q3CheckListItem*>( it->nextSibling() ) ) {
            it->setOn( on );
        }
    }

    if ( !on ) {
        Q3ListViewItem * parent = this->parent();
        if ( parent && ( parent->rtti() == 1 ) ) {
            CustomCheckListItem * item = static_cast<CustomCheckListItem*>( parent );
            item->setLocked( true );
            item->setOn( on );
            item->setLocked( false );
        }
    }

    QString thisText = text(0);
    Q3ListViewItemIterator it( listView() );
    while ( it.current() ) {
        if ( it.current()->rtti() == 1 && it.current()->text(0) == thisText ) {
            CustomCheckListItem * item = static_cast<CustomCheckListItem*>( it.current() );
            item->setOn( on );
        }
        ++it;
    }
}
void QDisplayPropertyWidget::updateListViewItem()
{
    std::map<QTreeWidgetItem*, std::pair<core::objectmodel::Base*, Q3ListViewItem*> >::iterator objectIterator;
    for(objectIterator = objects.begin(); objectIterator != objects.end(); ++objectIterator)
    {
        core::objectmodel::Base* object = objectIterator->second.first;
        Q3ListViewItem* item = objectIterator->second.second;

        if (/*simulation::Node *node=*/dynamic_cast< simulation::Node *>(object))
        {
            item->setText(0,object->getName().c_str());
            //emit nodeNameModification(node);
        }
        else
        {
            QString currentName = item->text(0);

            std::string name=item->text(0).ascii();
            std::string::size_type pos = name.find(' ');
            if(pos != std::string::npos)
                name = name.substr(0,pos);
            name += "  ";
            name += object->getName();
            QString newName(name.c_str());
            if(newName != currentName)
                item->setText(0,newName);
        }
    }
}
Example #15
0
void RDListView::mouseButtonClickedData(int button,Q3ListViewItem *item,
					const QPoint &pt,int col)
{
  Q3ListViewItem *l;
  bool contiguous;

  if((list_contiguous==false)||(selectionMode()!=Q3ListView::Extended)||(item==NULL)||(button!=1)) {
    return;
  }

  //
  // Get Selected Range
  //
  l=item;
  contiguous=true;
  while((l=l->itemAbove())!=NULL) {
    if(!l->isSelected()) {
      contiguous=false;
    }
    if(!contiguous) {
      setSelected(l,false);
    }
  }
  l=item;
  contiguous=true;
  while((l=l->itemBelow())!=NULL) {
    if(!l->isSelected()) {
      contiguous=false;
    }
    if(!contiguous) {
      setSelected(l,false);
    }
  }
}
Example #16
0
printShippingForms::printShippingForms(QWidget* parent, const char* name, bool modal, Qt::WFlags fl)
    : QDialog(parent, name, modal, fl)
{
  setupUi(this);

  connect(_print, SIGNAL(clicked()), this, SLOT(sPrint()));
  connect(_shipformNumOfCopies, SIGNAL(valueChanged(int)), this, SLOT(sHandleShippingFormCopies(int)));
  connect(_shipformWatermarks, SIGNAL(itemSelected(int)), this, SLOT(sEditShippingFormWatermark()));

  _captive = FALSE;

  _shipformWatermarks->addColumn( tr("Copy #"),      _dateColumn, Qt::AlignCenter );
  _shipformWatermarks->addColumn( tr("Watermark"),   -1,          Qt::AlignLeft   );
  _shipformWatermarks->addColumn( tr("Show Prices"), _dateColumn, Qt::AlignCenter );

  _shipformNumOfCopies->setValue(_metrics->value("ShippingFormCopies").toInt());
  if (_shipformNumOfCopies->value())
  {
    Q3ListViewItem *cursor = _shipformWatermarks->firstChild();
    for (int counter = 0; cursor; cursor = cursor->nextSibling(), counter++)
    {
      cursor->setText(1, _metrics->value(QString("ShippingFormWatermark%1").arg(counter)));
      cursor->setText(2, ((_metrics->boolean(QString("ShippingFormShowPrices%1").arg(counter))) ? tr("Yes") : tr("No")));
    }
  }
}
Example #17
0
void oprof_start::read_set_events()
{
	string name = get_config_filename(".oprofile/daemonrc");

	ifstream in(name.c_str());

	if (!in) {
		setup_default_event();
		return;
	}

	string str;

	bool one_enabled = false;

	while (getline(in, str)) {
		string const val = split(str, '=');
		string const name = str;

		if (!is_prefix(name, "CHOSEN_EVENTS_"))
			continue;

		one_enabled = true;

		// CHOSEN_EVENTS_#nr=CPU_CLK_UNHALTED:10000:0:1:1
		vector<string> parts = separate_token(val, ':');

		if (parts.size() != 5 && parts.size() != 2) {
			cerr << "invalid configuration file\n";
			// FIXME
			exit(EXIT_FAILURE);
		}

		string ev_name = parts[0];
		event_cfgs[ev_name].count =
			op_lexical_cast<unsigned int>(parts[1]);

		// CPU_CLK_UNHALTED:10000 is also valid
		if (parts.size() == 5) {
			event_cfgs[ev_name].umask =
				op_lexical_cast<unsigned int>(parts[2]);
			event_cfgs[ev_name].user_ring_count =
				op_lexical_cast<unsigned int>(parts[3]);
			event_cfgs[ev_name].os_ring_count =
				op_lexical_cast<unsigned int>(parts[4]);
		} else {
			event_cfgs[ev_name].umask = 0;
			event_cfgs[ev_name].user_ring_count = 1;
			event_cfgs[ev_name].os_ring_count = 1;
		}

		Q3ListViewItem * item = findItem(events_list, ev_name.c_str());
		if (item)
			item->setSelected(true);
	}

	// use default event if none set
	if (!one_enabled)
		setup_default_event();
}
Example #18
0
// -----------------------------------------------------------
void OptimizeDialog::slotAddVariable()
{
  if(VarNameEdit->text().isEmpty() || VarInitEdit->text().isEmpty() ||
        VarMinEdit->text().isEmpty() || VarMaxEdit->text().isEmpty()) {
    QMessageBox::critical(this, tr("Error"),
       tr("Every text field must be non-empty!"));
    return;
  }

  Q3ListViewItem *item;
  for(item = VarList->firstChild(); item != 0; item = item->itemBelow())
    if(item->text(0) == VarNameEdit->text()) {
      QMessageBox::critical(this, tr("Error"),
         tr("Variable \"%1\" already in list!").arg(VarNameEdit->text()));
      return;
    }


  new Q3ListViewItem(VarList, VarNameEdit->text(),
      VarActiveCheck->isChecked() ? tr("yes") : tr("no"),
      VarInitEdit->text(), VarMinEdit->text(), VarMaxEdit->text(),
      VarTypeCombo->currentText());

  slotEditVariable(0);   // clear entry fields
  VarList->clearSelection();
}
void
KexiRelationsTableFieldList::slotDropped(QDropEvent *ev)
{
    Q3ListViewItem *recever = itemAt(ev->pos() - QPoint(0, contentsY()));
    if (!recever || !KexiFieldDrag::canDecodeSingle(ev)) {
        ev->ignore();
        return;
    }
    QString sourceMimeType;
    QString srcTable;
    QString srcField;
    if (!KexiFieldDrag::decodeSingle(ev, sourceMimeType, srcTable, srcField))
        return;
    if (sourceMimeType != "kexi/table" && sourceMimeType == "kexi/query")
        return;
//  kDebug() << "KexiRelationsTableFieldList::slotDropped() srcfield: " << srcField;

    QString rcvField = recever->text(0);

    SourceConnection s;
    s.masterTable = srcTable;
    s.detailsTable = schema()->name();
    s.masterField = srcField;
    s.detailsField = rcvField;

    m_scrollArea->addConnection(s);

    kDebug() << "KexiRelationsTableFieldList::slotDropped() " << srcTable << ":" << srcField << " "
    << schema()->name() << ":" << rcvField;
    ev->accept();
}
Example #20
0
// -----------------------------------------------------------
void OptimizeDialog::slotChangeVarActive(bool On)
{
  Q3ListViewItem *Item = VarList->selectedItem();
  if(Item == 0) return;

  Item->setText(1, On ? tr("yes") : tr("no"));
}
Example #21
0
ORParameter ReportParameter::paramData()
{
  ORParameter param;

  param.name = _leName->text();
  param.type = QString(types[_cbType->currentItem()]);
  param.defaultValue = _leDefault->text();
  param.description = _tbDescrip->text();
  param.active = _active->isChecked();
  if(_staticList->isChecked())
  {
    param.listtype = "static";
    Q3ListViewItem * item = _listValues->firstChild();
    while(0 != item)
    {
      param.values.append(qMakePair(item->text(0), item->text(1)));
      item = item->nextSibling();
    }
  }
  else // if(_dynamicList->isChecked())
  {
    param.listtype = "dynamic";
    param.query = _dynamicQuery->text();
  }

  return param;
}
Example #22
0
// -----------------------------------------------------------
void OptimizeDialog::slotChangeVarType(const QString& Text)
{
  Q3ListViewItem *Item = VarList->selectedItem();
  if(Item == 0) return;

  Item->setText(5, Text);
}
Example #23
0
/*! \internal */
bool QAccessibleListView::setSelected(int child, bool on, bool extend)
{
    if (!child || (extend &&
        listView()->selectionMode() != Q3ListView::Extended &&
        listView()->selectionMode() != Q3ListView::Multi))
        return false;

    Q3ListViewItem *item = findLVItem(listView(), child);
    if (!item)
        return false;
    if (!extend) {
        listView()->setSelected(item, on);
    } else {
        Q3ListViewItem *current = listView()->currentItem();
        if (!current)
            return false;
        bool down = item->itemPos() > current->itemPos();
        Q3ListViewItemIterator it(current);
        while (it.current()) {
            listView()->setSelected(it.current(), on);
            if (it.current() == item)
                break;
            if (down)
                ++it;
            else
                --it;
        }
    }
    return true;
}
Example #24
0
// -----------------------------------------------------------
void OptimizeDialog::slotChangeGoalNum(const QString& Text)
{
  Q3ListViewItem *Item = GoalList->selectedItem();
  if(Item == 0) return;

  Item->setText(2, Text);
}
DomItem *Q3ListViewExtraInfo::saveQ3ListViewItem(Q3ListViewItem *item) const
{
    DomItem *pitem = new DomItem();
    QList<DomProperty *> properties;
    const int columnCount = static_cast<Q3ListView*>(widget())->columns();
    for (int i = 0; i < columnCount; ++i) {
        DomString *str = new DomString();
        str->setText(item->text(i));

        DomProperty *ptext = new DomProperty();
        ptext->setAttributeName(QLatin1String("text"));
        ptext->setElementString(str);

        properties.append(ptext);
    }
    pitem->setElementProperty(properties);
    QList<DomItem *> items;
    Q3ListViewItem *child = item->firstChild();
    while (child) {
        items.append(saveQ3ListViewItem(child));
        child = child->nextSibling();
    }
    pitem->setElementItem(items);
    return pitem;
}
Example #26
0
bool RecipeFilter::hideIfEmpty( Q3ListViewItem *parent )
{
	Q3ListViewItem * it;
	if ( parent == 0 )
		it = listview->firstChild();
	else
		it = parent->firstChild();

	bool parent_should_show = false;
	for ( ; it; it = it->nextSibling() ) {
		if ( (it->rtti() == 1000 && it->isVisible()) || (it->rtti() == NEXTLISTITEM_RTTI || it->rtti() == PREVLISTITEM_RTTI) ) {
			parent_should_show = true;
		}
		else {
			bool result = hideIfEmpty( it );
			if ( parent_should_show == false )
				parent_should_show = result;
		}
	}

	if ( parent && parent->rtti() != 1000 ) {
		if ( parent_should_show )
			parent->setOpen( true );
		parent->setVisible( parent_should_show );
	}
	return parent_should_show;
}
Example #27
0
void Tab_Logins::editLogin(void)
{
	LoginsDB	    LDB;
	Q3ListViewItem   *curItem;
	
	curItem = list->currentItem();
	
    if (curItem != NULL) {
		QApplication::setOverrideCursor(WaitCursor);
		// Make sure that the login is active before we edit it.
		LDB.get(myCustID, (const char *) curItem->text(0));
		
		if (!LDB.getLong("InternalID")) {
		    printf("ARG!  Couldn't load Customer ID = %ld, list item = '%s'.\n", myCustID, (const char *) curItem->text(0));
		}
		
        QApplication::restoreOverrideCursor();		
		if (LDB.getInt("Active")) {
			LoginEdit *le;
			le = new LoginEdit(0, "", myCustID, (const char *) curItem->text(0));
			connect(le, SIGNAL(refreshLoginList(long)), SLOT(refreshLoginListV(long)));
			le->show();
		} else {
			QMessageBox::warning(this, "Unable to Edit", "Inactive accounts may not be edited.");
		}
	}
}
Example #28
0
void CdRipper::mediaChangedData()
{
  Q3ListViewItem *l;

  rip_isrc_read=false;
  rip_track_list->clear();
  rip_track[0]=-1;
  rip_track[1]=-1;
  for(int i=rip_cdrom->tracks();i>0;i--) {
    l=new Q3ListViewItem(rip_track_list);
    l->setText(0,QString().sprintf("%d",i));
    if(rip_cdrom->isAudio(i)) {
      l->setText(4,tr("Audio Track"));
    }
    else {
      l->setText(4,tr("Data Track"));
    }
    l->setText(1,RDGetTimeLength(rip_cdrom->trackLength(i)));
  }
  rip_cddb_record->clear();
  rip_cdrom->setCddbRecord(rip_cddb_record);
  rip_cddb_lookup->setCddbRecord(rip_cddb_record);
  Profile("starting metadata lookup");
  rip_cddb_lookup->lookupRecord(rip_cdda_dir.path(),rip_conf->ripperDevice(),
				rip_conf->cddbServer(),8880,
				RIPPER_CDDB_USER,PACKAGE_NAME,VERSION);
  Profile("metadata lookup finished");
}
Example #29
0
		QString key() {
			Q3ListViewItem* item = keysListpr->selectedItem();

			if(item)
				return item->text(2);
			return "";
		}
Example #30
0
void ActionWidget::slotAddAction()
{
    Q3ListViewItem *item = new Q3ListViewItem( listView );
    item->setPixmap( 0, SmallIcon( "misc" ));
    item->setText( 0, i18n("Click here to set the regexp"));
    item->setText( 1, i18n("<new action>"));
}