Exemplo n.º 1
0
    bool AddressbookHandler::writeSyncee(KSync::AddressBookSyncee *mAddressBookSyncee)
    {
        bool ret = true;

        if ( mAddressBookSyncee->isValid() ) {
            KABC::Addressee::List addrAdded;
            KABC::Addressee::List addrRemoved;
            KABC::Addressee::List addrModified;

            setMaximumSteps(mAddressBookSyncee->added().count() + mAddressBookSyncee->removed().count() + mAddressBookSyncee->modified().count());
            resetSteps();
            getAddressees( addrAdded, mAddressBookSyncee->added() );
            getAddressees( addrRemoved, mAddressBookSyncee->removed() );
            getAddressees( addrModified, mAddressBookSyncee->modified() );

            setStatus( "Writing added Contacts" );
            if (ret = addAddressees( addrAdded )) {
                setStatus( "Erasing deleted Contacts" );
                if (ret = removeAddressees( addrRemoved )) {
                    setStatus( "Writing changed Contacts" );
                    if (!(ret = updateAddressees( addrModified ))) {
                        setError("Can not write back updated Contacts to the Device");
                    }
                } else {
                    setError("Can not erase deleted Contacts on the Device");
                }
            } else {
                setError("Can not added Contacts on the Device");
            }
        }

        return ret;
    }
Exemplo n.º 2
0
void Foo::checkSteps()
{
	// checks steps to see whether they have run their course.
	// if a step is done running, next step is selected as current.
	
	theCurrentStep = steps.entry(stepIndex)->me;
	
	if (theCurrentStep->isFinished)
	{
		stepIndex++;
		
		if (stepIndex == countSteps())
		{
			if (repeats)	resetSteps();
			else			isRunning = false;
		}
		else
		{
			theCurrentStep = steps.entry(stepIndex)->me;
		}
	}
}