コード例 #1
0
ファイル: transferitem.cpp プロジェクト: mtl1979/unizone
WTransferItem::WTransferItem(
							 Q3ListView * parent,
							 QString a, QString b, QString c, QString d,
							 QString e, QString f, QString g, QString h, QString i, QString j
							 )
							 : WUniListItem(parent, a, b, c, d, e, f, g, h, i, j)
{
	setText(Status, a);
	setText(Filename, b);
	setText(Received, c);
	setText(Total, d);
	setText(Rate, e);
	setText(ETA, f);
	setText(Elapsed, g);
	setText(User, h);
	setText(Index, i);
	setText(QR, j);

	setColumnType(Status, String_Cased);
	setColumnType(Filename, String_Cased);
	setColumnType(Received, Size);
	setColumnType(Total, Size);
	setColumnType(Rate, TransferSpeed);
	setColumnType(ETA, Time);
	setColumnType(Elapsed, Time);
	setColumnType(User, String_NoCase_Stripped);
	setColumnType(Index, String_NoCase);
	setColumnType(QR, Number);
}
コード例 #2
0
void UserSchema::initializeColumnTypes()
{
    QVector<RECORD_TYPE> userColumnType;

    userColumnType.append(PRIMARY_ID);
    userColumnType.append(USER_NAME);
    userColumnType.append(PASSWORD);
    userColumnType.append(ADMIN_BOOL);

    setColumnType(userColumnType);
}
コード例 #3
0
ファイル: testmodel.cpp プロジェクト: Jinxiaohai/QT
void TestModel::traverseNode(const QDomNode &node)
{
    QDomElement cells = node.toElement().firstChildElement("cells");
    int rows = cells.attribute("rows").toInt();
    int cols = cells.attribute("cols").toInt();

    insertRows(0, rows);
    insertColumns(0, cols);

    if (rows == 0 || cols == 0) {
        return;
    }

    QDomNode rowNode = cells.firstChild();
    while (!rowNode.isNull()) {
        int row = rowNode.nodeName().remove(0, 3).toInt();

         QDomNode colNode = rowNode.firstChild();
         while (!colNode.isNull()) {
            int col = colNode.nodeName().remove(0, 3).toInt();

            QDomElement colEl = colNode.toElement();
            setColumnType(col, QVariant::nameToType(colEl.attribute("type").toLatin1()));
            setItem(row, col, new QStandardItem(colEl.text()));

            colNode = colNode.nextSibling();
         }

        rowNode = rowNode.nextSibling();
    }

    // Fill empty indexes
    for (int row = 0; row < rowCount(); row++) {

        for (int col = 0; col < columnCount(); col++) {

            if(!item(row, col)) {
                setItem(row, col, new QStandardItem(QString()));
            }
        }
    }

    QDomElement titles = node.toElement().firstChildElement("titles");
    QDomNode colNode = titles.firstChild();
    while (!colNode.isNull()) {
        int col = colNode.nodeName().remove(0, 3).toInt();
        setHeaderData(col, Qt::Horizontal, colNode.toElement().text());

        colNode = colNode.nextSibling();
    }

}
コード例 #4
0
void ClientSchema::initializeColumnTypes()
{
    QVector<RECORD_TYPE> clientColumnType;

    clientColumnType.append(PRIMARY_ID);
    clientColumnType.append(SECONDARY_ID);
    clientColumnType.append(SECONDARY_ID);
    clientColumnType.append(INT);
    clientColumnType.append(INT);
    clientColumnType.append(FIRST_NAME);
    clientColumnType.append(PHONE_NUMBER);
    clientColumnType.append(EMAIL);
    clientColumnType.append(FIRST_NAME);
    clientColumnType.append(PHONE_NUMBER);
    clientColumnType.append(EMAIL);

    setColumnType(clientColumnType);
}
コード例 #5
0
ファイル: searchitem.cpp プロジェクト: mtl1979/unizone
WSearchListItem::WSearchListItem(
								 Q3ListView * parent,
								 QString a, QString b, QString c, QString d,
								 QString e, QString f, QString g
								 )
								 : WUniListItem(parent, a, b, c, d, e, f, g)
{
	setColumnType(FileName, String_NoCase);
	setColumnType(FileSize, Size);
	setColumnType(FileType, String_NoCase);
	setColumnType(Modified, Date);
	setColumnType(User, String_NoCase_Stripped);
	setColumnType(Info, String_NoCase_Stripped);
}
コード例 #6
0
ファイル: mymoneyreport.cpp プロジェクト: sajidji94/kmymoney2
bool MyMoneyReport::read ( const QDomElement& e )
{
  // The goal of this reading method is 100% backward AND 100% forward
  // compatability.  Any report ever created with any version of KMyMoney
  // should be able to be loaded by this method (as long as it's one of the
  // report types supported in this version, of course)

  bool result = false;

  if (
    "REPORT" == e.tagName()
    &&
    (
      ( e.attribute ( "type" ).find ( "pivottable 1." ) == 0 )
      ||
      ( e.attribute ( "type" ).find ( "querytable 1." ) == 0 )
      ||
      ( e.attribute ( "type" ).find ( "infotable 1." ) == 0 )
    )
  )
  {
    result = true;
    clear();

    int i;
    m_name = e.attribute ( "name" );
    m_comment = e.attribute ( "comment", "Extremely old report" );

    //set report type
    if(!e.attribute ( "type" ).find ( "pivottable" )) {
      m_reportType = MyMoneyReport::ePivotTable;
    } else if(!e.attribute ( "type" ).find ( "querytable" )) {
      m_reportType = MyMoneyReport::eQueryTable;
    } else if(!e.attribute ( "type" ).find ( "infotable" )) {
      m_reportType = MyMoneyReport::eInfoTable;
    } else {
      m_reportType = MyMoneyReport::eNoReport;
    }

    // Removed the line that screened out loading reports that are called
    // "Default Report".  It's possible for the user to change the comment
    // to this, and we'd hate for it to break as a result.
    m_group = e.attribute ( "group" );
    m_id = e.attribute ( "id" );

    //check for reports with older settings which didn't have the detail attribute
    if ( e.hasAttribute ( "detail" ) )
    {
      i = kDetailLevelText.findIndex ( e.attribute ( "detail", "all" ) );
      if ( i != -1 )
        m_detailLevel = static_cast<EDetailLevel> ( i );
    } else if ( e.attribute ( "showsubaccounts", "0" ).toUInt() ) {
      //set to show all accounts
      m_detailLevel = eDetailAll;
    } else {
      //set to show the top level account instead
      m_detailLevel = eDetailTop;
    }

    m_convertCurrency = e.attribute ( "convertcurrency", "1" ).toUInt();
    m_favorite = e.attribute ( "favorite", "0" ).toUInt();
    m_tax = e.attribute ( "tax", "0" ).toUInt();
    m_investments = e.attribute ( "investments", "0" ).toUInt();
    m_loans = e.attribute ( "loans", "0" ).toUInt();
    m_includeSchedules = e.attribute ( "includeschedules", "0" ).toUInt();
    m_columnsAreDays = e.attribute ( "columnsaredays", "0" ).toUInt();
    m_includeTransfers = e.attribute ( "includestransfers", "0" ).toUInt();
    if ( e.hasAttribute ( "budget" ) )
      m_budgetId = e.attribute ( "budget" );
    m_includeBudgetActuals = e.attribute ( "includesactuals", "0" ).toUInt();
    m_includeUnusedAccounts = e.attribute ( "includeunused", "0" ).toUInt();
    m_includeForecast = e.attribute ( "includesforecast", "0" ).toUInt();
    m_includePrice = e.attribute ( "includesprice", "0" ).toUInt();
    m_includeAveragePrice = e.attribute ( "includesaverageprice", "0" ).toUInt();
    m_includeMovingAverage = e.attribute ( "includesmovingaverage", "0" ).toUInt();
    if( m_includeMovingAverage )
      m_movingAverageDays = e.attribute ( "movingaveragedays", "1" ).toUInt();

    //only load chart data if it is a pivot table
    if ( m_reportType == ePivotTable ) {
      i = kChartTypeText.findIndex ( e.attribute ( "charttype" ) );

      if ( i != -1 )
        m_chartType = static_cast<EChartType> ( i );

      //if it is invalid, set to first type
      if (m_chartType == eChartEnd)
        m_chartType = eChartLine;

      m_chartDataLabels = e.attribute ( "chartdatalabels", "1" ).toUInt();
      m_chartGridLines = e.attribute ( "chartgridlines", "1" ).toUInt();
      m_chartByDefault = e.attribute ( "chartbydefault", "0" ).toUInt();
      m_chartLineWidth = e.attribute ( "chartlinewidth", "2" ).toUInt();
    } else {
      m_chartType = static_cast<EChartType> ( 0 );
      m_chartDataLabels = true;
      m_chartGridLines = true;
      m_chartByDefault = false;
      m_chartLineWidth = 1;
    }

    QString datelockstr = e.attribute ( "datelock", "userdefined" );
    // Handle the pivot 1.2/query 1.1 case where the values were saved as
    // numbers
    bool ok = false;
    i = datelockstr.toUInt ( &ok );
    if ( !ok )
    {
      i = kDateLockText.findIndex ( datelockstr );
      if ( i == -1 )
        i = userDefined;
    }
    setDateFilter ( static_cast<dateOptionE> ( i ) );

    i = kRowTypeText.findIndex ( e.attribute ( "rowtype", "expenseincome" ) );
    if ( i != -1 )
    {
      setRowType ( static_cast<ERowType> ( i ) );
      // recent versions of KMyMoney always showed a total column for
      // income/expense reports. We turn it on for backward compatability
      // here. If the total column is turned off, the flag will be reset
      // in the next step
      if ( i == eExpenseIncome )
        m_showRowTotals = true;
    }
    if ( e.hasAttribute ( "showrowtotals" ) )
      m_showRowTotals = e.attribute ( "showrowtotals" ).toUInt();

    i = kColumnTypeText.findIndex ( e.attribute ( "columntype", "months" ) );
    if ( i != -1 )
      setColumnType ( static_cast<EColumnType> ( i ) );

    unsigned qc = 0;
    QStringList columns = QStringList::split ( ",", e.attribute ( "querycolumns", "none" ) );
    QStringList::const_iterator it_column = columns.begin();
    while ( it_column != columns.end() )
    {
      i = kQueryColumnsText.findIndex ( *it_column );
      if ( i > 0 )
        qc |= ( 1 << ( i - 1 ) );

      ++it_column;
    }
    setQueryColumns ( static_cast<EQueryColumns> ( qc ) );

    QDomNode child = e.firstChild();
    while ( !child.isNull() && child.isElement() )
    {
      QDomElement c = child.toElement();
      if ( "TEXT" == c.tagName() && c.hasAttribute ( "pattern" ) )
      {
        setTextFilter ( QRegExp ( c.attribute ( "pattern" ), c.attribute ( "casesensitive", "1" ).toUInt(), !c.attribute ( "regex", "1" ).toUInt() ), c.attribute ( "inverttext", "0" ).toUInt() );
      }
      if ( "TYPE" == c.tagName() && c.hasAttribute ( "type" ) )
      {
        i = kTypeText.findIndex ( c.attribute ( "type" ) );
        if ( i != -1 )
          addType ( i );
      }
      if ( "STATE" == c.tagName() && c.hasAttribute ( "state" ) )
      {
        i = kStateText.findIndex ( c.attribute ( "state" ) );
        if ( i != -1 )
          addState ( i );
      }
      if ( "NUMBER" == c.tagName() )
      {
        setNumberFilter ( c.attribute ( "from" ), c.attribute ( "to" ) );
      }
      if ( "AMOUNT" == c.tagName() )
      {
        setAmountFilter ( MyMoneyMoney ( c.attribute ( "from", "0/100" ) ), MyMoneyMoney ( c.attribute ( "to", "0/100" ) ) );
      }
      if ( "DATES" == c.tagName() )
      {
        QDate from, to;
        if ( c.hasAttribute ( "from" ) )
          from = QDate::fromString ( c.attribute ( "from" ), Qt::ISODate );
        if ( c.hasAttribute ( "to" ) )
          to = QDate::fromString ( c.attribute ( "to" ), Qt::ISODate );
        MyMoneyTransactionFilter::setDateFilter ( from, to );
      }
      if ( "PAYEE" == c.tagName() )
      {
        addPayee ( c.attribute ( "id" ) );
      }
      if ( "CATEGORY" == c.tagName() && c.hasAttribute ( "id" ) )
      {
        addCategory ( c.attribute ( "id" ) );
      }
      if ( "ACCOUNT" == c.tagName() && c.hasAttribute ( "id" ) )
      {
        addAccount ( c.attribute ( "id" ) );
      }
      if ( "ACCOUNTGROUP" == c.tagName() && c.hasAttribute ( "group" ) )
      {
        i = kAccountTypeText.findIndex ( c.attribute ( "group" ) );
        if ( i != -1 )
          addAccountGroup ( static_cast<MyMoneyAccount::accountTypeE> ( i ) );
      }
      child = child.nextSibling();
    }
  }
  return result;
}
コード例 #7
0
ResultEditor& ResultEditor::setColumn(const size_t index, const int type, const std::string& name) {
	setColumnType(index, type);
	setColumnName(index, name);
	return *this;
}