void coEditorTextValueWidget::save()
{
    if (valueLineEdit->isModified())
    {
        QString value = valueLineEdit->text();
        //    if (this->property("infoWidget").toBool() ) hide();
        //this->setProperty("infoWidget", false);  fType should be enough, except i do systemwide colorize by property
        if (fType == coEditorValueWidget::InfoName) // this was a infoWidget that now for first time got a name
        {
            emit nameAdded(value); // saveValue is called in coEditorEntryWidget::nameAddedSlot
        }
        else // standard behaviour - call save
        {
            emit saveValue(fvariable, value);
        }

        // change behaviour for "delete this value" context menu
        if (fType == coEditorValueWidget::InfoName || fType == coEditorValueWidget::Info)
        {
            fType = coEditorValueWidget::Text;
            disconnect(deleteValueAction, SIGNAL(triggered()), this, SLOT(explainShowInfoButton()));
            connect(deleteValueAction, SIGNAL(triggered()), this, SLOT(suicide()));
        }

        valueLineEdit->setModified(false);
    }
}
Exemple #2
0
	int Path::parse(const std::string& path)
	{
		if (path.empty())
		{
			// do nothing?
			return 0;
		}
		
		std::string buffer(path.size(), 0);
		char lastChar = 0;
		int  bufi = 0;
		
		for (size_t i = 0; i < path.size(); i++)
		{
			if (path[i] == PATH_SEPARATOR)
			{
				if (lastChar == PATH_SEPARATOR)
				{	// invalid path containing // (more than one forw-slash)
          return -EINVAL;
				}
				if (bufi)
				{
					nameAdded(std::string(buffer, 0, bufi));
					bufi = 0;
				}
				else if (i == 0)
				{
					// if the first character is / separator,
					// the path is relative to root, so clear stack
					stk.clear();
				}
			}
			else
			{
				buffer[bufi] = path[i];
				bufi++;
			}
			lastChar = path[i];
		} // parse path
		if (bufi)
		{
			return nameAdded(std::string(buffer, 0, bufi));
		}
    return 0;
	}