Пример #1
0
void QmlFile::exec()
{
     if (m_type == Read){
        qDebug() << "reading file " << m_fileName;
        QFile file(m_fileName);
        if ( !file.open(QIODevice::ReadOnly | QIODevice::Text) ){
            gotError("Could not open file for reading");
        }else{
            QTextStream in(&file);
            while ( !in.atEnd() ) {
                QString line = in.readAll();
                outPutChanged(line);
                file.close();
            }
        }
    }
    else if (m_type == Write){
        QFile file(m_fileName);
        if ( !file.open(QIODevice::WriteOnly | QIODevice::Text) ){
            gotError("Could not open file for reading");
        }else{
            QTextStream out(&file);
            out << m_incoming;
            file.close();
        }
    }
}
Пример #2
0
void Submission::slotMessageDataAvailable()
{
    m_rawMessageData.clear();
    QBuffer buf(&m_rawMessageData);
    buf.open(QIODevice::WriteOnly);
    QString errorMessage;
    QList<Imap::Mailbox::CatenatePair> catenateable;

    if (shouldBuildMessageLocally() && !m_composer->asRawMessage(&buf, &errorMessage)) {
        gotError(tr("Cannot send right now -- saving failed:\n %1").arg(errorMessage));
        return;
    }
    if (m_model->isCatenateSupported() && !m_composer->asCatenateData(catenateable, &errorMessage)) {
        gotError(tr("Cannot send right now -- saving (CATENATE) failed:\n %1").arg(errorMessage));
        return;
    }

    if (m_saveToSentFolder) {
        Q_ASSERT(m_model);
        m_appendUidReceived = false;
        m_genUrlAuthReceived = false;

        changeConnectionState(STATE_SAVING);
        QPointer<Imap::Mailbox::AppendTask> appendTask = 0;

        if (m_model->isCatenateSupported()) {
            // FIXME: without UIDPLUS, there isn't much point in $SubmitPending...
            appendTask = QPointer<Imap::Mailbox::AppendTask>(
                        m_model->appendIntoMailbox(
                            m_sentFolderName,
                            catenateable,
                            QStringList() << QLatin1String("$SubmitPending") << QLatin1String("\\Seen"),
                            m_composer->timestamp()));
        } else {
            // FIXME: without UIDPLUS, there isn't much point in $SubmitPending...
            appendTask = QPointer<Imap::Mailbox::AppendTask>(
                        m_model->appendIntoMailbox(
                            m_sentFolderName,
                            m_rawMessageData,
                            QStringList() << QLatin1String("$SubmitPending") << QLatin1String("\\Seen"),
                            m_composer->timestamp()));
        }

        Q_ASSERT(appendTask);
        connect(appendTask.data(), SIGNAL(appendUid(uint,uint)), this, SLOT(slotAppendUidKnown(uint,uint)));
        connect(appendTask.data(), SIGNAL(completed(Imap::Mailbox::ImapTask*)), this, SLOT(slotAppendSucceeded()));
        connect(appendTask.data(), SIGNAL(failed(QString)), this, SLOT(slotAppendFailed(QString)));
    } else {
Пример #3
0
QXmppRemoteMethodResult QXmppClient::callRemoteMethod( const QString &jid,
                                          const QString &interface,
                                          const QVariant &arg1,
                                          const QVariant &arg2,
                                          const QVariant &arg3,
                                          const QVariant &arg4,
                                          const QVariant &arg5,
                                          const QVariant &arg6,
                                          const QVariant &arg7,
                                          const QVariant &arg8,
                                          const QVariant &arg9,
                                          const QVariant &arg10 )
{
    QVariantList args;
    if( arg1.isValid() ) args << arg1;
    if( arg2.isValid() ) args << arg2;
    if( arg3.isValid() ) args << arg3;
    if( arg4.isValid() ) args << arg4;
    if( arg5.isValid() ) args << arg5;
    if( arg6.isValid() ) args << arg6;
    if( arg7.isValid() ) args << arg7;
    if( arg8.isValid() ) args << arg8;
    if( arg9.isValid() ) args << arg9;
    if( arg10.isValid() ) args << arg10;

    QXmppRemoteMethod method( jid, interface, args, this );
    connect( d->stream, SIGNAL(rpcCallResponse(QXmppRpcResponseIq)),
             &method, SLOT(gotResult(QXmppRpcResponseIq)));
    connect( d->stream, SIGNAL(rpcCallError(QXmppRpcErrorIq)),
             &method, SLOT(gotError(QXmppRpcErrorIq)));


    return method.call();
}
		SongSearch::SongSearch(QWidget *parent) :
			SoSSubWindow(parent),
			ui(new Ui::SongSearch),
			searchForGroup(new QButtonGroup()),
			searchTypeGroup(new QButtonGroup()),
			maxResults(10),
			currentTask(TT_SEARCH),
			timerId(0),
			skinMgr(0)
		{
			ui->setupUi(this);

			setSubWidgets(ui->windowBar, ui->content);
			connect(&httpHandler, SIGNAL(receivedResponse(QString)),
					this, SLOT(gotResponse(QString)));
			connect(&httpHandler, SIGNAL(responseError(QString)),
					this, SLOT(gotError(QString)));

			searchForGroup->addButton(ui->titleButton, 1);
			searchForGroup->addButton(ui->artistButton, 2);
			searchForGroup->addButton(ui->searchInAllButton, 3);

			searchTypeGroup->addButton(ui->ultraStarButton, 1);
			searchTypeGroup->addButton(ui->midiButton, 2);
			searchTypeGroup->addButton(ui->anyTypeButton, 3);
		}
Пример #5
0
QmlFile::QmlFile(QObject *parent) :
    QObject(parent),
    m_type(Read)
{

    connect(this,SIGNAL(gotError(QString)), this,SLOT(handdleError(QString)));
    connect(this,SIGNAL(outPutChanged(QString)), this,SLOT(hannleOut(QString)));
}
Пример #6
0
void Submission::send()
{
    // this double-updating is needed in case the same Submission attempts to send a message more than once
    changeConnectionState(STATE_INIT);
    changeConnectionState(STATE_BUILDING_MESSAGE);

    if (shouldBuildMessageLocally() && !m_composer->isReadyForSerialization()) {
        // we have to wait until the data arrive
        // FIXME: relax this to wait here
        gotError(tr("Some data are not available yet"));
    } else {
        slotMessageDataAvailable();
    }
}
Пример #7
0
	AudioCallDevice::AudioCallDevice (int32_t callIdx, CallManager *manager)
	: Idx_ { callIdx }
	, Manager_ { manager }
	, DataWriter_ { std::make_unique<CallDataWriter> (callIdx, manager) }
	{
		connect (Manager_,
				SIGNAL (gotFrame (int32_t, QByteArray)),
				this,
				SLOT (handleGotFrame (int32_t, QByteArray)));
		connect (DataWriter_.get (),
				SIGNAL (gotError (QString)),
				this,
				SLOT (handleWriteError (QString)));
	}
Пример #8
0
void Submission::send()
{
    if (!m_model) {
        gotError(tr("The IMAP connection has disappeared. "
                    "You'll have close the composer, save the draft and re-open it later. "
                    "The attachments will have to be added later. Sorry for the trouble, "
                    "please see <a href=\"https://projects.flaska.net/issues/640\">https://projects.flaska.net/issues/640</a> "
                    "for details."));
        return;
    }

    // this double-updating is needed in case the same Submission attempts to send a message more than once
    changeConnectionState(STATE_INIT);
    changeConnectionState(STATE_BUILDING_MESSAGE);

    if (shouldBuildMessageLocally() && !m_composer->isReadyForSerialization()) {
        // we have to wait until the data arrive
        // FIXME: relax this to wait here
        gotError(tr("Some data are not available yet"));
    } else {
        slotMessageDataAvailable();
    }
}
Пример #9
0
void DccTransferRecvWriteCacheHandler::slotKIOResult( KIO::Job* job )
{
    Q_ASSERT( m_transferJob );

    disconnect( m_transferJob, 0, 0, 0 );
    m_transferJob = 0;

    if ( job->error() )
    {
        QString errorString = job->errorString();
        closeNow();
        emit gotError( errorString );             // -> DccTransferRecv::slotLocalGotWriteError()
    }
}
Пример #10
0
void Kommunikator::handleIncoming(QVariant json) {
	QVariantMap m = json.toMap();

	// TODO dans le futur il faudra gérer le fait que le serveur puisse lui aussi
	// initier des communications.

	if(!m.contains("seq")) {
		emit invalidMessage(json);
		return;
	}

	if(m["action"].toString() == "error") {
		emit gotError(m["seq"].toInt(), m["code"].toInt(), m["name"].toString());
		return;
	}

	emit gotReply(m["seq"].toInt(), json);
}
Пример #11
0
void
LastFmParser::request_done (int id, bool err)
{
	if (err) {
		m_cache.remove (m_cache_map[id]);
		m_cache_map.remove (id);
		emit gotError (m_cache_map[id]);
		return;
	}
	QBuffer *b = m_requests.take (id);

	if (!b) {
		return;
	}
	
	parse_xml (b->buffer (), id);
	delete b;
}
Пример #12
0
void IrcLayer::errMsg(QString message)
{
	emit gotError(message);
}
Пример #13
0
	void LastFmRadioStation::handleError (const QString& error)
	{
		qDebug () << Q_FUNC_INFO << error;
		emit gotError (error);
	}
Пример #14
0
void ProjectResourcesModel::errorHandler(const QString &errorString)
{
    emit gotError(errorString);
}
Пример #15
0
CommandSender::CommandSender(): mTcpSocket()
{
    connect(&mTcpSocket, SIGNAL(bytesWritten(qint64)), this, SLOT(sent()));
    connect(&mTcpSocket, SIGNAL(error(QAbstractSocket::SocketError)),
            this, SLOT(gotError(QAbstractSocket::SocketError)));
}
Пример #16
0
void ProjectLangstatsModel::errorHandler(const QString &errorString)
{
    emit gotError(errorString);
}