Exemple #1
0
bool DvbStream::setPids( DVBout *o )
{
	int i, dmx;
	struct dmx_pes_filter_params pesFilterParams;
	dmx_pes_type_t pestype = DMX_PES_OTHER;
	QValueList<int> pidList;

	pidList = o->pidsList();

	for ( i=0; i<(int)pidList.count(); i++ ) {
		if ( ( dmx = open( demuxName.ascii(), O_RDWR)) < 0 ) {
			fprintf(stderr,"FD %i: ",i);
			perror("DEMUX DEVICE: ");
			return false;
		}
		else
			o->dmx.append(dmx);
	}

	for ( i=0; i<(int)pidList.count(); i++ ) {
		pesFilterParams.pid = pidList[i];
		pesFilterParams.input = DMX_IN_FRONTEND;
		pesFilterParams.output = DMX_OUT_TS_TAP;
		pesFilterParams.pes_type = pestype;
		pesFilterParams.flags = DMX_IMMEDIATE_START;
		if ( ioctl( o->dmx[i], DMX_SET_PES_FILTER, &pesFilterParams) < 0)  {
			fprintf( stderr, "FILTER %i: ", pidList[i] );
			perror("DMX SET PES FILTER");
		}
	}

	ndmx +=pidList.count();

	return true;
}
void MyMoneyQifWriter::writeTransactionEntry(QTextStream &s, const MyMoneyTransaction& t, const QString& accountId)
{
  MyMoneyFile* file = MyMoneyFile::instance();
  MyMoneySplit split = t.splitByAccount(accountId);

  s << "D" << m_qifProfile.date(t.postDate()) << endl;

  switch(split.reconcileFlag()) {
    case MyMoneySplit::Cleared:
      s << "C*" << endl;
      break;

    case MyMoneySplit::Reconciled:
    case MyMoneySplit::Frozen:
      s << "CX" << endl;
      break;

    default:
      break;
  }

  if(split.memo().length() > 0) {
    QString m = split.memo();
    m.replace('\n', "\\n");
    s << "M" << m << endl;
  }

  s << "T" << m_qifProfile.value('T', split.value()) << endl;

  if(split.number().length() > 0)
    s << "N" << split.number() << endl;

  if(!split.payeeId().isEmpty()) {
    MyMoneyPayee payee = file->payee(split.payeeId());
    s << "P" << payee.name() << endl;
  }

  QValueList<MyMoneySplit> list = t.splits();
  if(list.count() > 1) {
    MyMoneySplit sp = t.splitByAccount(accountId, false);
    MyMoneyAccount acc = file->account(sp.accountId());
    if(acc.accountGroup() != MyMoneyAccount::Income
    && acc.accountGroup() != MyMoneyAccount::Expense) {
      s << "L" << m_qifProfile.accountDelimiter()[0]
              << MyMoneyFile::instance()->accountToCategory(sp.accountId())
              << m_qifProfile.accountDelimiter()[1] << endl;
    } else {
      s << "L" << file->accountToCategory(sp.accountId()) << endl;
    }
    if(list.count() > 2) {
      QValueList<MyMoneySplit>::ConstIterator it;
      for(it = list.begin(); it != list.end(); ++it) {
        if(!((*it) == split)) {
          writeSplitEntry(s, *it);
        }
      }
    }
  }
  s << "^" << endl;
}
Exemple #3
0
UmlOperation * UmlOperation::cpp2Python(UmlClass * python, UmlClass * cpp,
					 const char * cppname,
					 const char * pythonname)
{
  if (pythonname == 0)
    pythonname = cppname;
  
  UmlOperation * from = cpp->get_operation(cppname);
  
  if (from == 0) {
    QCString err = QCString("cannot find operation '") + 
      cppname + QCString("' in class '") + cpp->name()
	+ QCString("'<br>\n");
    UmlCom::trace(err);
    throw 0;
  }
  
  UmlOperation * to = UmlBaseOperation::create(python, pythonname);
  
  if (to == 0) {
    QCString err = QCString("cannot create operation '") + 
      pythonname + QCString("' in class '") + python->name()
	+ QCString("'<br>\n");
    UmlCom::trace(err);
    throw 0;
  }
  
  UmlCom::trace("add operation " + python->name() + "::" + pythonname + "<br>\n");

  to->set_Description(::cpp2Python(from->description()));
  to->set_ReturnType(from->returnType());
  to->set_isClassMember(from->isClassMember());
  to->set_Visibility(from->visibility());
  to->set_CppVisibility(from->cppVisibility());
  
  const QValueList<UmlParameter> params = from->params();
  unsigned index;
  
  for (index = 0; index != params.count(); index += 1)
    to->addParameter(index, params[index]);
  
  const QValueList<UmlTypeSpec> exceptions = from->exceptions();
  
  for (index = 0; index != exceptions.count(); index += 1)
    to->addException(index, exceptions[index]);
  
  to->set_isCppVirtual(from->isCppVirtual());
  to->set_isCppConst(from->isCppConst());
  to->set_isCppInline(from->isCppInline());
  to->set_CppDecl(::cpp2Python(from->cppDecl()));
  to->set_CppDef(::cpp2Python(from->cppDef()));
  to->set_CppBody(::cpp2Python(from->cppBody()));
  
  to->set_isJavaFinal(from->isJavaFinal());
  to->set_JavaDef(from->javaDef());
  to->set_JavaBody(::cpp2Python(from->javaBody()));
  
  return to;
}
Exemple #4
0
void KWDocStructRootItem::setupTextFrameSets()
{

    // Delete Empty item from list.
    QListViewItem* lvItem = firstChild();
    if (lvItem && (lvItem->text(0) == i18n("Empty"))) delete lvItem;

    // Build a list of framesets ordered by their screen position (top left corner).
    KWDocument* dok = doc();
    QValueList<KWOrderedFrameSet> orderedFrameSets;
    for ( int i = dok->frameSetCount() - 1; i >= 0; i-- ) {
        KWFrameSet* frameset = dok->frameSet(i);
        if ( frameset->type() == FT_TEXT && frameset->frameSetInfo() == KWFrameSet::FI_BODY &&
            !frameset->groupmanager() && frameset->frameCount()>0)

            orderedFrameSets.append(KWOrderedFrameSet(frameset));
    }
    qHeapSort(orderedFrameSets);

    // Build a list of frameset pointers from the sorted list.
    QPtrList<KWTextFrameSet> frameSetPtrs;
    frameSetPtrs.setAutoDelete(false);
    for ( uint i = 0; i < orderedFrameSets.count(); i++ )
        frameSetPtrs.append(dynamic_cast<KWTextFrameSet *>(orderedFrameSets[i].frameSet()));

    // Remove deleted framesets from the listview.
    KWDocStructTextFrameSetItem* item = dynamic_cast<KWDocStructTextFrameSetItem *>(firstChild());
    KWDocStructTextFrameSetItem* delItem;
    while (item) {
        delItem = item;
        item = dynamic_cast<KWDocStructTextFrameSetItem *>(item->nextSibling());
        if (frameSetPtrs.containsRef(delItem->frameSet()) == 0) delete delItem;
    }

    // Add new framesets to the list or update existing ones.
    KWDocStructTextFrameSetItem* after = 0L;
    for ( uint i = 0; i < orderedFrameSets.count(); i++ )
    {
        KWTextFrameSet* textFrameset = dynamic_cast<KWTextFrameSet *>(orderedFrameSets[i].frameSet());
        item = findTextFrameSetItem(textFrameset);
        if (item)
            item->setText(0, textFrameset->name());
        else {
            if (after)
                item = new KWDocStructTextFrameSetItem(
                    this, after, textFrameset->name(), textFrameset);
            else
                item = new KWDocStructTextFrameSetItem(this, textFrameset->name(), textFrameset);
        }
        after = item;
        item->setupTextFrames();
    }

    if ( childCount() == 0 )
        ( void )new KListViewItem( this, i18n( "Empty" ) );
}
Exemple #5
0
// ok, this is lifted from gst... but why mess with what works?
void
HelixEngine::setEqualizerParameters( int preamp, const QValueList<int>& bandGains ) //SLOT
{
   m_preamp = ( preamp + 100 ) / 2;

   m_equalizerGains.resize( bandGains.count() );
   for ( uint i = 0; i < bandGains.count(); i++ )
      m_equalizerGains[i] = ( *bandGains.at( i ) + 100 ) / 2;

   updateEQgains();
}
Exemple #6
0
bool AttachItem::isParentof(const QValueList<int>&path)
{
    /* if not set, then no parent */
    if (path.count()==0||_path.count()==0) return false;
    /* the parent must have one digit less then a child */
    if (path.count()!=_path.count()+1) return false;
    for (unsigned int i=0; i < _path.count();++i)
    {
        if (_path[i]!=path[i]) return false;
    }
    return true;
}
PluginFactory::PluginFactory( PConfigArgs& args ): args(args), d(new PluginFactoryPrivate)
{
    pluginFactory = this;

    QValueList<int> keys = ancaConf->readIntListEntry( "onStartupMapKeys" );
    QValueList<int> values = ancaConf->readIntListEntry( "onStartupMapValues" );
    if( !keys.isEmpty() && keys.count() == values.count() ) {
        QValueList<int>::iterator it1 = keys.begin();
        QValueList<int>::iterator it2 = values.begin();
        for( ; it1 != keys.end() /* && it2 != values.end() */; ++it1, ++it2 )
            onStartupMap[*it1] = *it2;
    }
}
Exemple #8
0
void CalendarDiffAlgo::diffList( const QString &id,
                                 const QValueList<L> &left, const QValueList<L> &right )
{
  for ( uint i = 0; i < left.count(); ++i ) {
    if ( right.find( left[ i ] ) == right.end() )
      additionalLeftField( id, toString( left[ i ] ) );
  }

  for ( uint i = 0; i < right.count(); ++i ) {
    if ( left.find( right[ i ] ) == left.end() )
      additionalRightField( id, toString( right[ i ] ) );
  }
}
Exemple #9
0
Value DOMStyleSheetList::tryGet(ExecState *exec, const Identifier &p) const
{
#ifdef KJS_VERBOSE
    kdDebug(6070) << "DOMStyleSheetList::tryGet " << p.qstring() << endl;
#endif
    if(p == lengthPropertyName)
        return Number(styleSheetList.length());
    else if(p == "item")
        return lookupOrCreateFunction< DOMStyleSheetListFunc >(exec, p, this, DOMStyleSheetList::Item, 1, DontDelete | Function);

    // Retrieve stylesheet by index
    bool ok;
    long unsigned int u = p.toULong(&ok);
    if(ok)
        return getDOMStyleSheet(exec, DOM::StyleSheetList(styleSheetList).item(u));

// IE also supports retrieving a stylesheet by name, using the name/id of the <style> tag
// (this is consistent with all the other collections)
#if 0
  // Bad implementation because DOM::StyleSheet doesn't inherit DOM::Node
  // so we can't use DOMNamedNodesCollection.....
  // We could duplicate it for stylesheets though - worth it ?
  // Other problem of this implementation: it doesn't look for the ID attribute!
  DOM::NameNodeListImpl namedList( m_doc.documentElement().handle(), p.string() );
  int len = namedList.length();
  if ( len ) {
    QValueList<DOM::Node> styleSheets;
    for ( int i = 0 ; i < len ; ++i ) {
      DOM::HTMLStyleElement elem = DOM::Node(namedList.item(i));
      if (!elem.isNull())
        styleSheets.append(elem.sheet());
    }
    if ( styleSheets.count() == 1 ) // single result
      return getDOMStyleSheet(exec, styleSheets[0]);
    else if ( styleSheets.count() > 1 ) {
      return new DOMNamedItemsCollection(exec,styleSheets);
    }
  }
#endif
    // ### Bad implementation because returns a single element (are IDs always unique?)
    // and doesn't look for name attribute (see implementation above).
    // But unicity of stylesheet ids is good practice anyway ;)
    DOM::DOMString pstr = p.string();
    DOM::HTMLStyleElement styleElem = m_doc.getElementById(pstr);
    if(!styleElem.isNull())
        return getDOMStyleSheet(exec, styleElem.sheet());

    return DOMObject::tryGet(exec, p);
}
Exemple #10
0
void PlaylistItem::reactToChanges( const QValueList<int> &columns )
{
    MetaBundle::reactToChanges(columns);
    bool totals = false, ref = false, length = false, url = false;
    for( int i = 0, n = columns.count(); i < n; ++i )
      {
        if( columns[i] == Mood )
          moodbar().reset();
	if ( !length && columns[i] == Length ) {
	    length = true;
	    incrementLengths();
	    listView()->countChanged();
	}
        switch( columns[i] )
        {
            case Artist: case Album: ref = true; //note, no breaks
            case Track: case Rating: case Score: case LastPlayed:
                totals = true; break;
            case Filename: case Directory: url = true;
        }
        updateColumn( columns[i] );
      }
    if ( url )
        Playlist::instance()->m_urlIndex.add(this);
    if( ref )
        refAlbum();
    if( totals )
        incrementTotals();
}
void FavoriteFolderView::readConfig()
{
    mReadingConfig = true;
    clear();
    QValueList<int> folderIds = GlobalSettings::self()->favoriteFolderIds();
    QStringList folderNames = GlobalSettings::self()->favoriteFolderNames();
    QListViewItem *afterItem = 0;
    for(uint i = 0; i < folderIds.count(); ++i)
    {
        KMFolder *folder = kmkernel->folderMgr()->findById(folderIds[i]);
        if(!folder)
            folder = kmkernel->imapFolderMgr()->findById(folderIds[i]);
        if(!folder)
            folder = kmkernel->dimapFolderMgr()->findById(folderIds[i]);
        if(!folder)
            folder = kmkernel->searchFolderMgr()->findById(folderIds[i]);
        QString name;
        if(folderNames.count() > i)
            name = folderNames[i];
        afterItem = addFolder(folder, name, afterItem);
    }
    if(firstChild())
        ensureItemVisible(firstChild());

    // folder tree is not yet populated at this point
    QTimer::singleShot(0, this, SLOT(initializeFavorites()));

    readColorConfig();
    mReadingConfig = false;
}
Exemple #12
0
K3bVideoDVDRippingDialog::K3bVideoDVDRippingDialog( const K3bVideoDVD::VideoDVD& dvd,
						    const QValueList<int>& titles,
						    QWidget* parent, const char* name )
  : K3bInteractionDialog( parent, name,
			  i18n("Video DVD Ripping"),
			  QString::null,
			  START_BUTTON|CANCEL_BUTTON,
			  START_BUTTON,
			  "VideoDVD Ripping" ), // config group
    m_dvd( dvd )
{
  d = new Private;

  QWidget* frame = mainWidget();
  QHBoxLayout* frameLayout = new QHBoxLayout( frame );
  frameLayout->setMargin( 0 );
  frameLayout->setAutoAdd( true );
  m_w = new K3bVideoDVDRippingWidget( frame );

  connect( m_w, SIGNAL(changed()),
	   this, SLOT(slotUpdateFilesizes()) );
  connect( m_w, SIGNAL(changed()),
	   this, SLOT(slotUpdateFilenames()) );
  connect( m_w, SIGNAL(changed()),
	   this, SLOT(slotUpdateVideoSizes()) );

  setTitle( i18n("Video DVD Ripping"),
	    i18n("1 title from %1", "%n titles from %1", titles.count())
	    .arg( k3bappcore->mediaCache()->medium(m_dvd.device()).beautifiedVolumeId() ) );

  // populate list map
  populateTitleView( titles );
}
void HistoryDialog::slotLoadDays()
{
		if(mInit.dateMCList.isEmpty())
		{
				if (!mMainWidget->searchLine->text().isEmpty())
					QTimer::singleShot(0, this, SLOT(slotSearch()));
				doneProgressBar();
				return;
		}
		
		DMPair pair(mInit.dateMCList.first());
		mInit.dateMCList.pop_front();
		HistoryLogger logger(pair.metaContact(), this);
		QValueList<int> dayList = logger.getDaysForMonth(pair.date());
		for (unsigned int i=0; i<dayList.count(); i++)
		{
				QDate c2Date(pair.date().year(),pair.date().month(),dayList[i]);
				if (mInit.dateMCList.find(pair) == mInit.dateMCList.end())
						new KListViewDateItem(mMainWidget->dateListView, c2Date, pair.metaContact());
		}
		mMainWidget->searchProgress->advance(1);
		QTimer::singleShot(0,this,SLOT(slotLoadDays()));


}
Exemple #14
0
void QueryTableTest::testTaxReport()
{
  try {
    TransactionHelper t1q1( QDate(2004,1,1), MyMoneySplit::ActionWithdrawal, moSolo, acChecking, acSolo );
    TransactionHelper t2q1( QDate(2004,2,1), MyMoneySplit::ActionWithdrawal, moParent1, acChecking, acTax );

    unsigned cols;
    MyMoneyReport filter;

    filter.setRowType( MyMoneyReport::eCategory );
    filter.setName("Tax Transactions");
    cols = MyMoneyReport::eQCnumber | MyMoneyReport::eQCpayee | MyMoneyReport::eQCaccount;
    filter.setQueryColumns( static_cast<MyMoneyReport::EQueryColumns>(cols) );
    filter.setTax(true);

    XMLandback(filter);
    QueryTable qtbl_3(filter);

    writeTabletoHTML(qtbl_3,"Tax Transactions.html");

    QValueList<ListTable::TableRow> rows = qtbl_3.rows();

    QString html = qtbl_3.renderHTML();
    CPPUNIT_ASSERT(rows.count() == 1);
  } catch(MyMoneyException *e) {
    CPPUNIT_FAIL(e->what());
    delete e;
  }
}
Exemple #15
0
/******************************************************************************
*  Called when the mouse is moved.
*  Creates a drag object when the mouse drags one or more selected items.
*/
void AlarmListView::contentsMouseMoveEvent(QMouseEvent *e)
{
    QListView::contentsMouseMoveEvent(e);
    if(mMousePressed
            && (mMousePressPos - e->pos()).manhattanLength() > QApplication::startDragDistance())
    {
        // Create a calendar object containing all the currently selected alarms
        kdDebug(5950) << "AlarmListView::contentsMouseMoveEvent(): drag started" << endl;
        mMousePressed = false;
        KCal::CalendarLocal cal(QString::fromLatin1("UTC"));
        cal.setLocalTime();    // write out using local time (i.e. no time zone)
        QValueList<EventListViewItemBase *> items = selectedItems();
        if(!items.count())
            return;
        for(QValueList<EventListViewItemBase *>::Iterator it = items.begin();  it != items.end();  ++it)
        {
            const KAEvent &event = (*it)->event();
            KCal::Event *kcalEvent = new KCal::Event;
            event.updateKCalEvent(*kcalEvent, false, true);
            kcalEvent->setUid(event.id());
            cal.addEvent(kcalEvent);
        }

        // Create the drag object for the destination program to receive
        mDragging = true;
        KCal::ICalDrag *dobj = new KCal::ICalDrag(&cal, this);
        dobj->dragCopy();       // the drag operation will copy the alarms
    }
}
Exemple #16
0
void UmlOperation::write_cpp_java_params(FileOut & out, QCString decl) {
  int index1 = decl.find("${(}");
    
  if (index1 == -1)
    return;
    
  int index2 = decl.find("${)}", index1 + 4);
    
  if (index2 == -1)
    return;
    
  decl = decl.mid(index1 + 4, index2 - index1 - 4);
    
  index1 = 0;
    
  const QValueList<UmlParameter> p = params();
  QCString sparam;
  QCString kname;
  QCString ktype;
  int rank;
    
  if ((name() == "unload") && (parent()->name() == "UmlBasePackage"))
    rank = 123;
    
  while (get_param(decl, index1, sparam, kname, ktype, rank)) {
    if (rank < (int) p.count()) {
      const UmlParameter & pa = p[rank];
      
      out.indent();
      out << "<UML:Parameter name=\"" << pa.name
	<< "\" xmi.id=\"BOUML_op_param_"
	  << ++param_id << "\" kind =\"";
      switch (pa.dir) {
      case InputOutputDirection: out << "inout\">\n"; break;
      case OutputDirection: out << "out\">\n"; break;
      default: out << "in\">\n";
      }
      
      UmlTypeSpec t = pa.type;
      
      if ((t.type != 0) ||
	  !(t.explicit_type = (_lang == Cpp)
	    ? CppSettings::type(t.explicit_type)
	    : JavaSettings::type(t.explicit_type)).isEmpty()) {
	out.indent();
	out << "\t<UML:Parameter.type>\n";
	out.indent();
	out << "\t\t<UML:DataType";
	write_type(out, t, sparam, kname, ktype);
	out << "/>\n";
	out.indent();
	out << "\t</UML:Parameter.type>\n";
      }
      
      out.indent();
      out << "</UML:Parameter>\n";
    }
  }
}
Exemple #17
0
static bool generate_type(const QValueList<UmlParameter> & params,
			  unsigned rank, QTextOStream & f)
{
  if (rank >= params.count())
    return FALSE;
  
  UmlClass::write(f, params[rank].type);
  return TRUE;
}
Exemple #18
0
void SetMaxRate::makeMenu()
{

	int rate=(type==0) ? m_core->getMaxUploadSpeed() : m_core->getMaxDownloadSpeed();
	int maxBandwidth=(rate > 0) ? rate : (type==0) ? 0 : 20 ;
	int delta = 0;
	int maxBandwidthRounded;

	setCheckable(true);
	insertTitle(i18n("Speed limit in KB/s"));

	if(rate == 0)
		setItemChecked(insertItem(i18n("Unlimited")), true);
	else
		insertItem(i18n("Unlimited"));

	if((maxBandwidth%5)>=3)
		maxBandwidthRounded=maxBandwidth + 5 - (maxBandwidth%5);
	else
		maxBandwidthRounded=maxBandwidth - (maxBandwidth%5);

	for (int i = 0; i < 15; i++)
	{
		QValueList<int> valuePair;
		if (delta == 0)
			valuePair.append(maxBandwidth);
		else
		{
			if((maxBandwidth%5)!=0)
			{
				valuePair.append(maxBandwidthRounded - delta);
				valuePair.append(maxBandwidthRounded + delta);
			}
			else
			{
				valuePair.append(maxBandwidth - delta);
				valuePair.append(maxBandwidth + delta);
			}
		}

		for (int j = 0; j < (int)valuePair.count(); j++)
		{
			if (valuePair[j] >= 1)
			{
				if(rate == valuePair[j] && j==0)
				{
					setItemChecked(insertItem(QString("%1").arg(valuePair[j]),-1, (j == 0) ? 2 : count()), true);
				}
				else
					insertItem(QString("%1").arg(valuePair[j]),-1, (j == 0) ? 2 : count());
			}
		}

		delta += (delta >= 50) ? 50 : (delta >= 20) ? 10 : 5;

	}
}
Exemple #19
0
static bool generate_var(const QValueList<UmlParameter> & params, 
			 unsigned rank, QTextOStream & f)
{
  if (rank >= params.count())
    return FALSE;
  
  f << params[rank].name;
  return TRUE;
}
void KMyMoneyBriefSchedule::setSchedules(QValueList<MyMoneySchedule> list, const QDate& date)
{
  m_scheduleList = list;
  m_date = date;

  m_index = 0;
  if (list.count() >= 1)
  {
    loadSchedule();
  }
}
Exemple #21
0
void DocLnkSet::findChildren(const QString &dr, const QValueList<QRegExp> &mimeFilters, QDict<void> &reference, int depth)
{
    depth++;
    if ( depth > 10 )
  return;

    QDir dir( dr );

    /* Opie got a different approach
     * I guess it's geek vs. consumer
     * in this case to be discussed
     */
    if ( dir.exists( ".Qtopia-ignore" ) )
  return;

    const QFileInfoList *list = dir.entryInfoList();
    if ( list ) {
  QFileInfo* fi;
  for ( QFileInfoListIterator it(*list); (fi=*it); ++it ) {
      QString bn = fi->fileName();
      if ( bn[0] != '.' ) {
    if ( fi->isDir()  ) {
        if ( bn != "CVS" && bn != "Qtopia" && bn != "QtPalmtop" )
      findChildren(fi->filePath(), mimeFilters, reference, depth);
    } else {
        if ( fi->extension(FALSE) == "desktop" ) {
      DocLnk* dl = new DocLnk( fi->filePath() );
      QFileInfo fi2(dl->file());
      bool match = FALSE;
      if ( !fi2.exists() ) {
          dir.remove( dl->file() );
      }
      if ( mimeFilters.count() == 0 ) {
          add( dl );
          match = TRUE;
      } else {
          for( QValueList<QRegExp>::ConstIterator it = mimeFilters.begin(); it != mimeFilters.end(); ++ it ) {
        if ( (*it).match(dl->type()) >= 0 ) {
            add(dl);
            match = TRUE;
        }
          }
      }
      if ( !match )
          delete dl;
        } else {
      if ( !reference.find(fi->fileName()) )
          reference.insert(fi->filePath(), (void*)2);
        }
    }
      }
  }
    }
}
Exemple #22
0
void Undo::saveReactivates(const QValueList<KAEvent> &events)
{
    int count = events.count();
    if(count == 1)
        saveReactivate(events.first());
    else if(count > 1)
    {
        new UndoReactivates(UNDO, events);
        emitChanged();
    }
}
Exemple #23
0
void RcFile::saveSplitterSize (Parm name, QSplitter *sp, const QString &n)
{
  QStringList stringList;
  QValueList<int> sizeList = sp->sizes();
  
  int loop;
  for (loop = 0; loop < (int) sizeList.count(); loop++)
    stringList.append(QString::number(sizeList[loop]));
  
  QString s(stringList.join(","));
  saveData(name, s, n);
}
Exemple #24
0
void CdWidget::loadConfig( KConfig* config )
{
	QValueList<int> sl;

	config->setGroup("DVBClient");
	sl = config->readIntListEntry("SplitSizes");
	if ( !sl.count() ) {
		sl.append( 200 );
		sl.append( 200 );
	}
	split->setSizes( sl );
}
Exemple #25
0
FNTextDialog::FNTextDialog(const QString& fontname, FNColorDialog* dlg, QWidget* parent, const char* name )
	:FNTextDialogBase(parent, name, true, 0), _pen(1), _colorSelector(dlg)
{
	static QFontDatabase fbase;
	QValueList<int> sizes = fbase.pointSizes(fontname);
	char buf[10];
	for (uint i = 0; i < sizes.count(); ++i) {
		sprintf(buf, "%d", sizes[i]);
		cboFontSize->insertItem(buf);
	}
	lines->setFont(QFont(fontname, 20));
}
Exemple #26
0
  //this is to prevent me from making mistakes again when modifying balances - asoliverez
  //this case tests only the opening and ending balance of the accounts
  void QueryTableTest::testBalanceColumn()
  {
    try
    {
      TransactionHelper t1q1( QDate(2004,1,1), MyMoneySplit::ActionWithdrawal, moSolo, acChecking, acSolo );
      TransactionHelper t2q1( QDate(2004,2,1), MyMoneySplit::ActionWithdrawal, moParent1, acCredit, acParent );
      TransactionHelper t3q1( QDate(2004,3,1), MyMoneySplit::ActionWithdrawal, moParent2, acCredit, acParent );
      TransactionHelper t4y1( QDate(2004,11,7), MyMoneySplit::ActionWithdrawal, moChild, acCredit, acChild );

      TransactionHelper t1q2( QDate(2004,4,1), MyMoneySplit::ActionWithdrawal, moSolo, acChecking, acSolo );
      TransactionHelper t2q2( QDate(2004,5,1), MyMoneySplit::ActionWithdrawal, moParent1, acCredit, acParent );
      TransactionHelper t3q2( QDate(2004,6,1), MyMoneySplit::ActionWithdrawal, moParent2, acCredit, acParent );
      TransactionHelper t4q2( QDate(2004,11,7), MyMoneySplit::ActionWithdrawal, moChild, acCredit, acChild );

      TransactionHelper t1y2( QDate(2005,1,1), MyMoneySplit::ActionWithdrawal, moSolo, acChecking, acSolo );
      TransactionHelper t2y2( QDate(2005,5,1), MyMoneySplit::ActionWithdrawal, moParent1, acCredit, acParent );
      TransactionHelper t3y2( QDate(2005,9,1), MyMoneySplit::ActionWithdrawal, moParent2, acCredit, acParent );
      TransactionHelper t4y2( QDate(2004,11,7), MyMoneySplit::ActionWithdrawal, moChild, acCredit, acChild );

      unsigned cols;

      MyMoneyReport filter;

      filter.setRowType( MyMoneyReport::eAccount );
      filter.setName("Transactions by Account");
      cols = MyMoneyReport::eQCnumber | MyMoneyReport::eQCpayee | MyMoneyReport::eQCcategory | MyMoneyReport::eQCbalance;
      filter.setQueryColumns( static_cast<MyMoneyReport::EQueryColumns>(cols) ); //
      XMLandback(filter);
      QueryTable qtbl_3(filter);

      writeTabletoHTML(qtbl_3,"Transactions by Account.html");

      QString html = qtbl_3.renderHTML();

      QValueList<ListTable::TableRow> rows = qtbl_3.rows();

      CPPUNIT_ASSERT(rows.count() == 16);

      //this is to make sure that the dates of closing and opening balances and the balance numbers are ok
      QString openingDate = KGlobal::locale()->formatDate(QDate(2004,1,1), true);
      QString closingDate = KGlobal::locale()->formatDate(QDate(2005,9,1), true);
      CPPUNIT_ASSERT( html.find(openingDate + "</td><td class=\"left\"></td><td class=\"left\">"+i18n("Opening Balance")) > 0);
      CPPUNIT_ASSERT( html.find(closingDate + "</td><td class=\"left\"></td><td class=\"left\">"+i18n("Closing Balance")+"</td><td class=\"left\"></td><td class=\"value\"></td><td>&nbsp;-702.36</td></tr>") > 0);
      CPPUNIT_ASSERT( html.find(closingDate + "</td><td class=\"left\"></td><td class=\"left\">"+i18n("Closing Balance")+"</td><td class=\"left\"></td><td class=\"value\"></td><td>&nbsp;-705.69</td></tr>") > 0);

    }
    catch(MyMoneyException *e)
    {
      CPPUNIT_FAIL(e->what());
      delete e;
    }

  }
Exemple #27
0
void Undo::saveDeletes(const QValueList<KAEvent> &events)
{
    int count = events.count();
    if(count == 1)
        saveDelete(events.first());
    else if(count > 1)
    {
        new UndoDeletes(UNDO, events);
        for(QValueList<KAEvent>::ConstIterator it = events.begin();  it != events.end();  ++it)
            removeRedos((*it).id());    // remove any redos which are made invalid by these deletions
        emitChanged();
    }
}
void KAccountTemplateSelector::Private::loadHierarchy(void)
{
  m_templateHierarchy.clear();
  QListViewItemIterator it(m_parent->m_groupList, QListViewItemIterator::Selected);
  QListViewItem* it_v;
  while((it_v = it.current()) != 0) {
    m_templates[it_v->text(2)].hierarchy(m_templateHierarchy);
    ++it;
  }

  // I need to think about this some more. The code works and shows
  // the current account hierarchy. It might be usefull, to show
  // existing accounts dimmed and the new ones in bold or so.
#if 0

  // add the hierarchy from the MyMoneyFile object
  QValueList<MyMoneyAccount> aList;
  QValueList<MyMoneyAccount>::const_iterator it_a;
  MyMoneyFile* file = MyMoneyFile::instance();
  file->accountList(aList);
  if(aList.count() > 0) {
    m_templateHierarchy[file->accountToCategory(file->asset().id(), true)] = 0;
    m_templateHierarchy[file->accountToCategory(file->liability().id(), true)] = 0;
    m_templateHierarchy[file->accountToCategory(file->income().id(), true)] = 0;
    m_templateHierarchy[file->accountToCategory(file->expense().id(), true)] = 0;
    m_templateHierarchy[file->accountToCategory(file->equity().id(), true)] = 0;
  }

  for(it_a = aList.begin(); it_a != aList.end(); ++it_a) {
    m_templateHierarchy[file->accountToCategory((*it_a).id(), true)] = 0;
  }
#endif

  m_parent->m_accountList->clear();
  QMap<QString, QListViewItem*>::iterator it_m;

  QRegExp exp("(.*):(.*)");
  for(it_m = m_templateHierarchy.begin(); it_m != m_templateHierarchy.end(); ++it_m) {
    if(exp.search(it_m.key()) == -1) {
      (*it_m) = new KListViewItem(m_parent->m_accountList, it_m.key());
    } else {
      (*it_m) = hierarchyItem(exp.cap(1), exp.cap(2));
    }
    (*it_m)->setOpen(true);
  }

  m_parent->m_description->clear();
  if(m_parent->m_groupList->currentItem()) {
    m_parent->m_description->setText(m_templates[m_parent->m_groupList->currentItem()->text(2)].longDescription());
  }
}
Exemple #29
0
void FavoriteFolderView::folderRemoved(KMFolder * folder)
{
  QValueList<KMFolderTreeItem*> delItems;
  for ( QListViewItemIterator it( this ); it.current(); ++it ) {
    KMFolderTreeItem *fti = static_cast<KMFolderTreeItem*>( it.current() );
    if ( fti->folder() == folder )
      delItems << fti;
    if ( fti == mContextMenuItem )
      mContextMenuItem = 0;
  }
  for ( uint i = 0; i < delItems.count(); ++i )
    delete delItems[i];
  removeFromFolderToItemMap(folder);
}
QString RegExpConverter::escape( QString text, QValueList<QChar> chars, QChar escapeChar) const
{
	QString res;
	for (unsigned int i=0; i<text.length(); i++) {
		for (unsigned int j=0; j<chars.count(); j++) {
			if ( text.at(i) == (chars[j]) ) {
				res.append( escapeChar );
				break;
			}
		}
		res.append( text.at(i) );
	}

	return res;
}