Beispiel #1
0
void Node::updateMeta()
{
    QMutexLocker mutlock(&featMutex);
    if (MetaUpToDate)
        return;

    Feature::updateMeta();

    IsWaypoint = (findKey("_waypoint_") != -1);
    IsPOI = false;
    for (int i=0; i<tagSize(); ++i) {
        if (!M_PREFS->getTechnicalTags().contains(tagKey(i))) {
            IsPOI = true;
            break;
        }
    }

    if (!IsPOI && !IsWaypoint) {
        int i=0;
        int prtReadonly=0, prtWritable=0;
        for (; i<sizeParents(); ++i) {
            if (getParent(i)->isReadonly())
                ++prtReadonly;
            else
                ++prtWritable;
        }
        if (!ReadOnly) {
            if (prtReadonly && !prtWritable)
                setReadonly(true);
        }
    }
    MetaUpToDate = true;
}
//=============================================================================
// Constructor of the class CCommunication.
//=============================================================================
CCommunication::CCommunication (QWidget *parent, const char *name, QSqlDatabase *db,
                                CUserData *current)
	: QWidget (parent,name)
{
  int   i;
  
  mContentChanged = false;
  mNew            = false;
  mDB             = db;
  mCurrentUser    = current;

  //----------------------------------------------------------------------------
  //  Create the layout
  //----------------------------------------------------------------------------
  mLayout = new QGridLayout (this, 10, 2, 10);

  //----------------------------------------------------------------------------
  //  Create four default rows consisting of combobox and lineedit.
  //----------------------------------------------------------------------------
  for (i = 0; i < 4; i++)
    slotAddLine();
  
  setReadonly (true);
  connectSlots();
}
Beispiel #3
0
FileServer *
MultiServer::getServer(ServerContext& s, const char *path, string& subpath)
{
	//TRACE();
	string realpath;
	fs_map_t::iterator it;
	memory_node_t *root = static_cast<memory_node_t *>(s.getData(name()));

	if (root->kids.size() == 0)
	{
		setReadonly(false);
		for (it = m_map.begin(); it != m_map.end(); it++)
		{
			MemoryServer::createDir(s, it->first.c_str(), 0755);
			_DEBUG("created directory: %s", it->first.c_str());
		}
	}

	unsigned int maxlen = 0;
	FileServer *server = NULL;
	subpath.clear();

	ASSERT(strncmp(path, "//", 2));

	for (it = m_map.begin(); it != m_map.end(); it++)
	{
		_DEBUG("matching %s to %s", path, it->first.c_str());
		if (strncmp(path, it->first.c_str(), it->first.length()) == 0
			&& (*(path + it->first.length()) == SEPARATOR
				|| *(path + it->first.length()) == 0)
			&& it->first.length() > maxlen)
		{
			maxlen = (int) it->first.length();
			server = it->second;
			_DEBUG("matched %s[%d] (%p)", path, maxlen, server);
		}
	}
	subpath = path + maxlen;
	if (subpath.empty())
	{
		subpath = SEPSTR;
	}
	_DEBUG("new subpath = %s", subpath.c_str());
	return server;
}
AuthorPropertyWidget::AuthorPropertyWidget(data::models::Author *author,
                                           QWidget              *parent)
    : PropertyWidget{WIDGET_TITLE, parent},
      m_pLblEmail{new QLabel{LBL_EMAIL, this}},
      m_pLblWebsite{new QLabel{LBL_WEBSITE, this}},
      m_pTxtEmail{new QLineEdit{this}},
      m_pTxtWebsite{new QLineEdit{this}}
{
    addRow(m_pLblEmail, m_pTxtEmail);
    addRow(m_pLblWebsite, m_pTxtWebsite);

    setToolTip(WIDGET_TITLE);

    setReadonly(true);
    updateProperties(author);

    connectContentsChangingSignals();
}
Beispiel #5
0
//=============================================================================
// Constructor of the class CAddress.
//=============================================================================
CAddress::CAddress (QWidget *parent, const char *name, QSqlDatabase *db,
                    CUserData *current)
	: QWidget (parent,name)
{
  mContentChanged = false;
  mNew            = false;
  mDB             = db;
  mCurrentUser    = current;
  mMore           = 0;
  
  //----------------------------------------------------------------------------
  //  Create the grid layout
  //----------------------------------------------------------------------------
  mLayout = new QGridLayout (this, 10, 2, 10, 20);

  //----------------------------------------------------------------------------
  //  Create two default address sets.
  //----------------------------------------------------------------------------
  slotAddLine();
  
  setReadonly (true);
  connectSlots();
}
Beispiel #6
0
SpecialLayer::SpecialLayer(const QString &aName, Layer::LayerType type, const QString &filename)
    : TrackLayer(aName, filename), m_type(type)
{
    setReadonly(true);
}
//=============================================================================
// Load the detail communication information of the person.
//=============================================================================
void CCommunication::loadData (QString id, bool readonly)
{
  QString 			DBnull = "?", tip;
  unsigned int      row = 0;
  
  //----------------------------------------------------------------------------
  // Disconnect the slots during data load.
  //----------------------------------------------------------------------------
  removeAllLines();
  slotAddLine();
  disconnectSlots();

  //----------------------------------------------------------------------------
  // Load the communication types.
  //----------------------------------------------------------------------------
  QSqlQuery query ("SELECT comm_id, type, number, created, last_modified "
                   "FROM   contacts_communications "
                   "WHERE  person_id = " + id + " ORDER BY type");

  if (!query.isActive())
  {
    SHOW_DB_ERROR(tr ("Error during database query"), query);
    return;
  }

  while (query.next())
  {
    if (row >= mLine.count())
    {
      slotAddLine();
      disconnectSlots();
    }
    
    mIDs << query.value(0).toString();
    mLine.at(row)->setID      (query.value(0).toString());
    mLine.at(row)->setType    (query.value(1).toInt());
    mLine.at(row)->setValue   (query.value(2).toString());
    mLine.at(row)->setToolTip (tr ("Created:\t\t\t") + 
                               formatDateTime (query.value(3).toString()) +
                               tr ("\nLast Modified:\t\t") + 
                               formatDateTime (query.value(4).toString()));
    mLine.at(row)->setChanged (false);
    
    row++;
  } 
  
  //----------------------------------------------------------------------------
  // Store the ID of the currently loaded person.
  //----------------------------------------------------------------------------
  mCurrent  = id;
  mReadonly = readonly;

  //----------------------------------------------------------------------------
  // Connect the slots after data load is complete.
  //----------------------------------------------------------------------------
  connectSlots();
  setReadonly (readonly);
  
  emit contentLoaded  (true);
  emit contentChanged (false);
}