Ejemplo n.º 1
0
void CameraMainWindow::sendFile()
{
    if ( cur_thumb >= 0) {
        //copy file
        QFile input(picturefile[cur_thumb].fileName());
        if(!input.open(QIODevice::ReadOnly)){
            return; //error
        }
        QFile output(picfile);
        if(!output.open(QIODevice::WriteOnly)){
            return;
        }

        const int BUFFER_SIZE = 1024;
        qint8 buffer[BUFFER_SIZE];

        QDataStream srcStr(&input);
        QDataStream destStr(&output);

        while(!srcStr.atEnd()) {
            int i = 0;
            while(!srcStr.atEnd() && i < BUFFER_SIZE){
                srcStr >> buffer[i];
                i++;
            }
            for(int k = 0; k < i; k++) {
                destStr << buffer[k];
            }
        }

        QtopiaServiceRequest e("Email","writeMessage(QString,QString,QStringList,QStringList)");
        e << QString() << QString() << QStringList() << QStringList( QString( picfile ) );
        e.send();
    }
Ejemplo n.º 2
0
const void* findNamedValueMatch (const char* src, const void* namedValues, const void* namedValuesEnd, size_t stride)
{
	std::string srcStr(src);

	for (const void* curValue = namedValues; curValue != namedValuesEnd; curValue = (const void*)((deUintptr)curValue + stride))
	{
		if (srcStr == getNamedValueName(curValue))
			return curValue;
	}

	throw std::invalid_argument("unrecognized value '" + srcStr + "'");
}