~mzanetti/reminders-app/fix-search

« back to all changes in this revision

Viewing changes to src/libqtevernote/evernoteconnection.cpp

  • Committer: Tarmac
  • Author(s): Michael Zanetti
  • Date: 2015-02-28 14:47:28 UTC
  • mfrom: (357.1.1 reminders-app)
  • Revision ID: tarmac-20150228144728-sr1oi0guukjylmk2
Properly reset the connection when it fails.

Seems just closing and reopening is not enough. We need to create a new socket.

Approved by Riccardo Padovani, Ubuntu Phone Apps Jenkins Bot.

Show diffs side-by-side

added added

removed removed

Lines of Context:
147
147
 
148
148
void EvernoteConnection::disconnectFromEvernote()
149
149
{
 
150
    qDebug() << "[Connection] Disconnecting from Evernote.";
150
151
    if (!isConnected()) {
151
152
        qWarning() << "Not connected. Can't disconnect.";
152
153
        return;
201
202
        return;
202
203
    }
203
204
 
 
205
    qDebug() << "[Connection] Connecting to Evernote:" << m_hostname;
 
206
 
204
207
    m_errorMessage.clear();
205
208
    emit errorChanged();
206
209
 
207
210
    if (m_token.isEmpty()) {
208
 
        qWarning() << "Can't connect to Evernote. No token set.";
 
211
        qWarning() << "[Connection] Can't connect to Evernote. No token set.";
209
212
        return;
210
213
    }
211
214
    if (m_hostname.isEmpty()) {
212
 
        qWarning() << "Can't connect to Evernote. No hostname set.";
 
215
        qWarning() << "[Connection] Can't connect to Evernote. No hostname set.";
213
216
    }
214
 
    qDebug() << "******* Connecting *******";
215
 
    qDebug() << "hostname:" << m_hostname;
216
 
//    qDebug() << "token:" << m_token;
217
217
 
218
218
    setupUserStore();
219
219
    bool ok = connectUserStore();
220
220
    if (!ok) {
221
 
        qWarning() << "Error connecting User Store. Cannot continue.";
 
221
        qWarning() << "[Connection] Error connecting User Store. Cannot continue.";
222
222
        return;
223
223
    }
224
224
    setupNotesStore();
225
225
    ok = connectNotesStore();
226
226
 
227
227
    if (!ok) {
228
 
        qWarning() << "Error connecting Notes Store. Cannot continue.";
 
228
        qWarning() << "[Connection] Error connecting Notes Store. Cannot continue.";
229
229
        return;
230
230
    }
231
231
 
232
 
    qDebug() << "Connected!";
 
232
    qDebug() << "[Connection] Connected!";
233
233
    emit isConnectedChanged();
234
234
 
235
235
}
416
416
 
417
417
void EvernoteConnection::startNextJob()
418
418
{
 
419
    qDebug() << "[JobQueue] Job done:" << m_currentJob->toString();
419
420
    m_currentJob = 0;
420
421
    startJobQueue();
421
422
}