~ubuntu-branches/ubuntu/quantal/kde-runtime/quantal

« back to all changes in this revision

Viewing changes to drkonqi/bugzillalib.h

  • Committer: Package Import Robot
  • Author(s): Philip Muškovac
  • Date: 2012-06-03 21:50:00 UTC
  • mto: This revision was merged to the branch mainline in revision 21.
  • Revision ID: package-import@ubuntu.com-20120603215000-vn7oarsq0ynrydj5
Tags: upstream-4.8.80
Import upstream version 4.8.80

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
1
/*******************************************************************
2
2
* bugzillalib.h
3
3
* Copyright  2009, 2011   Dario Andres Rodriguez <andresbajotierra@gmail.com>
 
4
* Copyright  2012  George Kiagiadakis <kiagiadakis.george@gmail.com>
4
5
*
5
6
* This program is free software; you can redistribute it and/or
6
7
* modify it under the terms of the GNU General Public License as
20
21
#ifndef BUGZILLALIB__H
21
22
#define BUGZILLALIB__H
22
23
 
 
24
#include <kxmlrpcclient/client.h>
 
25
 
23
26
#include <QtCore/QObject>
24
27
#include <QtCore/QMap>
25
28
#include <QtCore/QStringList>
294
297
    void searchBugs(const QStringList & products, const QString & severity,
295
298
                    const QString & date_start, const QString & date_end , QString comment);
296
299
    
297
 
    void sendReport(BugReport);
 
300
    void sendReport(const BugReport & report);
298
301
    
299
 
    void attachTextToReport(const QString &, const QString &, const QString &, uint, const QString &);
300
 
 
301
 
    void addCommentToReport(const QString &, int, bool);
302
 
 
303
 
    void addMeToCC(int);
 
302
    void attachTextToReport(const QString & text, const QString & filename,
 
303
                            const QString & description, int bugId, const QString & comment);
 
304
 
 
305
    void addMeToCC(int bugId);
304
306
 
305
307
    void checkVersionsForProduct(const QString &);
306
308
    
313
315
    
314
316
private Q_SLOTS:
315
317
    /* Slots to handle KJob::finished */
316
 
    void loginJobFinished(KJob*);
317
318
    void fetchBugJobFinished(KJob*);
318
319
    void searchBugsJobFinished(KJob*);
319
 
    void sendReportJobFinished(KJob*);
320
 
    void attachToReportJobFinished(KJob*);
321
 
    void addCommentSubJobFinished(KJob*);
322
 
    void addCommentJobFinished(KJob*);
323
 
    void addMeToCCSubJobFinished(KJob*);
324
 
    void addMeToCCJobFinished(KJob*);
325
320
    void checkVersionJobFinished(KJob*);
326
321
 
 
322
    void callMessage(const QList<QVariant> & result, const QVariant & id);
 
323
    void callFault(int errorCode, const QString & errorString, const QVariant &id);
 
324
 
327
325
Q_SIGNALS:
328
326
    /* Bugzilla actions finished successfully */
329
327
    void loginFinished(bool);
331
329
    void searchFinished(const BugMapList &);
332
330
    void reportSent(int);
333
331
    void attachToReportSent(int, int);
334
 
    void addCommentFinished(int);
335
332
    void addMeToCCFinished(int);
336
333
    void checkVersionsForProductFinished(const QStringList);
337
334
 
338
335
    /* Bugzilla actions had errors */
339
 
    void loginError(const QString &, const QString &);
 
336
    void loginError(const QString & errorMsg, const QString & extendedErrorMsg = QString());
340
337
    void bugReportError(const QString &, QObject *);
341
338
    void searchError(const QString &);
342
 
    void sendReportError(const QString &, const QString &);
 
339
    void sendReportError(const QString & errorMsg, const QString & extendedErrorMsg = QString());
343
340
    void sendReportErrorInvalidValues(); //To use default values
344
 
    void attachToReportError(const QString &, const QString &);
345
 
    void addCommentError(const QString &, const QString &);
346
 
    void addMeToCCError(const QString &, const QString &);
 
341
    void attachToReportError(const QString & errorMsg, const QString & extendedErrorMsg = QString());
 
342
    void addMeToCCError(const QString & errorMsg, const QString & extendedErrorMsg = QString());
347
343
    void checkVersionsForProductError();
348
344
 
349
345
private:
350
 
    /* Private helper methods */
351
 
    QString getToken(const QString &);
352
 
    QString getErrorMessage(const QString &, bool fallBackMessage = true);
353
 
 
354
 
    void attachToReport(const QByteArray &, const QByteArray &);
355
 
    QByteArray generatePostDataForReport(BugReport) const;
356
 
 
357
346
    QString     m_username;
358
347
    QString     m_password;
359
348
    bool        m_logged;
360
349
 
361
350
    KIO::Job *  m_searchJob;
 
351
    KXmlRpc::Client *m_xmlRpcClient;
362
352
 
363
353
    QString     m_bugTrackerUrl;
364
354
};
365
355
 
366
 
class BugzillaUploadData
367
 
{
368
 
public:
369
 
    BugzillaUploadData(uint bugNumber);
370
 
    
371
 
    QByteArray postData() const;
372
 
    QByteArray boundary() const;
373
 
    
374
 
    void attachFile(const QString & url, const QString & description);
375
 
    void attachRawData(const QByteArray & data, const QString & filename, 
376
 
                    const QString & mimeType, const QString & description,
377
 
                    const QString & comment = QString());
378
 
    
379
 
private:
380
 
    void addPostField(const QString & name, const QString & value);
381
 
    void addPostData(const QString & name, const QByteArray & data, const QString & mimeType,
382
 
                     const QString & path);
383
 
    void finishPostRequest();
384
 
    
385
 
    QByteArray      m_boundary;
386
 
    uint            m_bugNumber;
387
 
    QByteArray      m_postData;
388
 
};
389
 
 
390
356
#endif