Esempio n. 1
0
bool PimSettingsBackupRestore::restoreStart(const QString &filename)
{
    if (mStored.isEmpty()) {
        addDate();
        Q_EMIT addInfo(i18n("No data selected."));
        Q_EMIT jobFailed();
        deleteLater();
        return false;
    }
    if (!openArchive(filename, false)) {
        Q_EMIT addError(i18n("Unable to open file \"%1\".", filename));
        Q_EMIT jobFailed();
        deleteLater();
        return false;
    }
    Q_EMIT updateActions(true);
    mAction = Restore;
    mStoreIterator = mStored.constBegin();
    const int version = Utils::archiveVersion(mArchiveStorage->archive());
    if (version > Utils::currentArchiveVersion()) {
        if (!continueToRestore()) {
            return false;
        }
    }
    qCDebug(PIMSETTINGEXPORTERCORE_LOG) << " version " << version;
    AbstractImportExportJob::setArchiveVersion(version);

    addDate();

    Q_EMIT addInfo(i18n("Starting to restore data from \'%1\'", mArchiveStorage->filename()));
    Q_EMIT addEndLine();
    restoreNextStep();
    return true;
}
Esempio n. 2
0
bool PimSettingsBackupRestore::backupStart(const QString &filename)
{
    if (mStored.isEmpty()) {
        addDate();
        Q_EMIT addInfo(i18n("No data selected."));
        Q_EMIT jobFailed();
        deleteLater();
        return false;
    }
    if (!openArchive(filename, true)) {
        Q_EMIT addError(i18n("Unable to open file \"%1\".", filename));
        Q_EMIT jobFailed();
        deleteLater();
        return false;
    }
    Q_EMIT updateActions(true);
    mAction = Backup;
    mStoreIterator = mStored.constBegin();
    addDate();
    Q_EMIT addInfo(i18n("Starting to backup data in \'%1\'", mArchiveStorage->filename()));
    Q_EMIT addEndLine();
    //Add version
    Utils::addVersion(mArchiveStorage->archive());
    backupNextStep();
    return true;
}
void HelloWorld::moveDown(){
    
    if (linesCount<50) {
        addNormalLine(4);
    }else if(!showEnd){
        addEndLine();
        showEnd = true;
    }
    
    
    auto bs = Block::getBlocks();
    
    for (auto it = bs->begin(); it!=bs->end(); it++) {
        (*it)->moveDown();
    }
    
    if (currentEndLine!=NULL) {
        
        if (currentEndLine->getLineIndex()==1) {
            //Game end
            moveDown();
            stopTimer();
        }
    }
}
Esempio n. 4
0
void PimSettingsBackupRestore::nextStep()
{
    mStoreIterator++;
    Q_EMIT addEndLine();
    switch (mAction) {
    case Backup:
        backupNextStep();
        break;
    case Restore:
        restoreNextStep();
    }
}
Esempio n. 5
0
void PimSettingsBackupRestore::slotJobFinished()
{
    ++mStoreIterator;
    Q_EMIT addEndLine();
    delete mImportExportData;
    mImportExportData = Q_NULLPTR;
    switch (mAction) {
    case Backup:
        backupNextStep();
        break;
    case Restore:
        restoreNextStep();
        break;
    }
}
void HelloWorld::moveDown(){
    
    if (linesCount<50) {
        addNormalLine(4);
    }else if(!showEnd){
        addEndLine();
        showEnd = true;
    }
    
    
    auto bs = Block::getBlocks();
    
    for (auto it = bs->begin(); it!=bs->end(); it++) {
        (*it)->moveDown();
    }
}
Esempio n. 7
0
/**
 * This function prepares command to be sent to modem.
 * @param buffer pointer to the buffer
 * @param bufferSize the buffer size
 * @param command command which will be send to the modem
 * @param commandSize size of prepared command
 * @param commandData additional command data
 * @return error number
 */
int ATCommandManager::prepareBufferSend(char* buffer,int bufferSize,ATCommand command,int& commandSize,int commandData)
{
	switch(command)
	{
	case ATC_AT:
		{
			int index=0;
			index=addAT(buffer,index,bufferSize);
			if(index<0)
			{
				return index;
			}
			index=addEndLine(buffer,index,bufferSize);
			if(index<0)
			{
				return index;
			}
			commandSize=index;
			break;
		}
	case ATC_CPIN:
		{
			int index=0;
			index=addCommand(buffer,index,bufferSize,AT_CPIN);
			if(index<0)
			{
				return index;
			}

			string commandText="=\""+pin+"\"";

			index=addCommandText(buffer,index,bufferSize,commandText.c_str());
			if(index<0)
			{
				return index;
			}
			index=addEndLine(buffer,index,bufferSize);
			if(index<0)
			{
				return index;
			}
			commandSize=index;
			break;;
		}
	case ATC_CMGF:
		{
			int index=0;
			index=addCommand(buffer,index,bufferSize,AT_CMGF);
			if(index<0)
			{
				return index;
			}
			index=addCommandValue(buffer,index,bufferSize,0);
			if(index<0)
			{
				return index;
			}
			index=addEndLine(buffer,index,bufferSize);
			if(index<0)
			{
				return index;
			}
			commandSize=index;
			break;
		}
	case ATC_CNMI:
		{
			int index=0;
			index=addCommand(buffer,index,bufferSize,AT_CNMI);
			if(index<0)
			{
				return index;
			}
			index=addCommandText(buffer,index,bufferSize,"=1,0,0,0,0");
			if(index<0)
			{
				return index;
			}
			index=addEndLine(buffer,index,bufferSize);
			if(index<0)
			{
				return index;
			}
			commandSize=index;
			break;
		}
	case ATC_CMGS:
		{
			int index=0;
			index=addCommand(buffer,index,bufferSize,AT_CMGS);
			if(index<0)
			{
				return index;
			}
			index=addCommandValue(buffer,index,bufferSize,octetCount);
			if(index<0)
			{
				return index;
			}
			index=addEndLine(buffer,index,bufferSize);
			if(index<0)
			{
				return index;
			}

			commandSize=index;
			break;
		}
	case ATC_CMGL:
		{
			int index=0;
			index=addCommand(buffer,index,bufferSize,AT_CMGL);
			if(index<0)
			{
				return index;
			}
			index=addCommandValue(buffer,index,bufferSize,0);
			if(index<0)
			{
				return index;
			}
			index=addEndLine(buffer,index,bufferSize);
			if(index<0)
			{
				return index;
			}
			commandSize=index;
			break;
		}
	case ATC_CMGD:
		{
			int index=0;
			index=addCommand(buffer,index,bufferSize,AT_CMGD);
			if(index<0)
			{
				return index;
			}
			index=addCommandValue(buffer,index,bufferSize,commandData);
			if(index<0)
			{
				return index;
			}
			index=addEndLine(buffer,index,bufferSize);
			if(index<0)
			{
				return index;
			}
			commandSize=index;
			break;
		}
	case ATC_CREG:
		{
			int index=0;
			index=addCommand(buffer,index,bufferSize,AT_CREG);
			if(index<0)
			{
				return index;
			}
			index=addCommandText(buffer,index,bufferSize,"?");
			if(index<0)
			{
				return index;
			}
			index=addEndLine(buffer,index,bufferSize);
			if(index<0)
			{
				return index;
			}
			commandSize=index;
			break;
		}
	case ATC_CSCA:
		{
			int index=0;
			index=addCommand(buffer,index,bufferSize,AT_CSCA);
			if(index<0)
			{
				return index;
			}

			string commandText="=\""+ messageCenterID+"\"";

			index=addCommandText(buffer,index,bufferSize,commandText.c_str());
			if(index<0)
			{
				return index;
			}
			index=addEndLine(buffer,index,bufferSize);
			if(index<0)
			{
				return index;
			}
			commandSize=index;
			break;
		}
	case ATC_ATE0:
		{
			int index=0;
			index=addAT(buffer,index,bufferSize);
			if(index<0)
			{
				return index;
			}
			index=addCommandText(buffer,index,bufferSize,"E0");
			if(index<0)
			{
				return index;
			}
			index=addEndLine(buffer,index,bufferSize);
			if(index<0)
			{
				return index;
			}
			commandSize=index;
			break;
		}
	};

	return 1;
}