149 |
149 |
150 const int NmNoError = 0; |
150 const int NmNoError = 0; |
151 const int NmNotFoundError = -1; |
151 const int NmNotFoundError = -1; |
152 const int NmGeneralError = -2; |
152 const int NmGeneralError = -2; |
153 const int NmCancelError = -3; |
153 const int NmCancelError = -3; |
|
154 const int NmAuthenticationError = -200; |
|
155 const int NmServerConnectionError = -201; |
154 |
156 |
155 /*! |
157 /*! |
156 Predefined constants for ContentTypes and parameters |
158 Predefined constants for ContentTypes and parameters |
157 for ContentType and ContentDisposition |
159 for ContentType and ContentDisposition |
158 */ |
160 */ |
293 #include <QDebug> |
295 #include <QDebug> |
294 #include <QFile> |
296 #include <QFile> |
295 #include <QDateTime> |
297 #include <QDateTime> |
296 |
298 |
297 static void printToFileAndConsole(QString str, QString filename) |
299 static void printToFileAndConsole(QString str, QString filename) |
298 { |
300 { |
299 // Print to file |
301 // Print to file |
300 QFile debugFile(filename); |
302 QFile debugFile(filename); |
301 QIODevice::OpenMode openMode = QIODevice::Text; |
303 QIODevice::OpenMode openMode = QIODevice::Text; |
302 if (debugFile.exists()) { |
304 if (debugFile.exists()) { |
303 openMode |= QIODevice::Append; |
305 openMode |= QIODevice::Append; |
312 QTextStream debugStream(&debugFile); |
314 QTextStream debugStream(&debugFile); |
313 debugStream << d << " " << str << endl; |
315 debugStream << d << " " << str << endl; |
314 debugFile.close(); |
316 debugFile.close(); |
315 } |
317 } |
316 // Print to console |
318 // Print to console |
317 qDebug() << d << str << endl; |
319 qDebug() << d << str << endl; |
318 } |
320 } |
319 |
321 |
320 // |
322 // |
321 // NMLOG is used to log QStrings to text file. For example: |
323 // NMLOG is used to log QStrings to text file. For example: |
322 // |
324 // |
323 // NMLOG("nmailui: application opened successfully"); |
325 // NMLOG("nmailui: application opened successfully"); |
324 // |
326 // |
325 // QString fileName = "mailbox.xml"; |
327 // QString fileName = "mailbox.xml"; |
326 // int error = -12; |
328 // int error = -12; |
327 // NMLOG(QString("### cannot open file: err=%1 file='%2' ###").arg(error).arg(fileName)); |
329 // NMLOG(QString("### cannot open file: err=%1 file='%2' ###").arg(error).arg(fileName)); |
328 // |
330 // |
|
331 #ifdef _DEBUG |
329 #define NMLOG(a) { printToFileAndConsole(a, "c:/logs/nmail.log"); } |
332 #define NMLOG(a) { printToFileAndConsole(a, "c:/logs/nmail.log"); } |
|
333 #else |
|
334 #define NMLOG(a) |
|
335 #endif |
|
336 |
330 |
337 |
331 /*! email list sort criteria definition */ |
338 /*! email list sort criteria definition */ |
332 class NmMailSortCriteria |
339 class NmMailSortCriteria |
333 { |
340 { |
334 public: |
341 public: |
335 NmMailSortField mField; |
342 NmMailSortField mField; |
336 NmMailSortOrder mOrder; |
343 NmMailSortOrder mOrder; |
337 }; |
344 }; |
338 |
345 |
|
346 /*! |
|
347 \class NmOperationCompletionEvent |
|
348 \brief Generic wrapper for information related to asynchronous operations |
|
349 */ |
|
350 class NmOperationCompletionEvent |
|
351 { |
|
352 public: |
|
353 int mOperationType; |
|
354 int mCompletionCode; |
|
355 NmId mMailboxId; |
|
356 NmId mFolderId; |
|
357 NmId mMessageId; |
|
358 }; |
|
359 Q_DECLARE_METATYPE(NmOperationCompletionEvent) |
339 |
360 |
340 #endif /* NMCOMMON_H_ */ |
361 #endif /* NMCOMMON_H_ */ |
341 |
362 |
342 |
363 |
343 |
364 |