This file is indexed.

/usr/include/packagekitqt5/PackageKit/daemon.h is in libpackagekitqt5-dev 0.9.5-2ubuntu2.

This file is owned by root:root, with mode 0o644.

The actual contents of the file can be viewed below.

  1
  2
  3
  4
  5
  6
  7
  8
  9
 10
 11
 12
 13
 14
 15
 16
 17
 18
 19
 20
 21
 22
 23
 24
 25
 26
 27
 28
 29
 30
 31
 32
 33
 34
 35
 36
 37
 38
 39
 40
 41
 42
 43
 44
 45
 46
 47
 48
 49
 50
 51
 52
 53
 54
 55
 56
 57
 58
 59
 60
 61
 62
 63
 64
 65
 66
 67
 68
 69
 70
 71
 72
 73
 74
 75
 76
 77
 78
 79
 80
 81
 82
 83
 84
 85
 86
 87
 88
 89
 90
 91
 92
 93
 94
 95
 96
 97
 98
 99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
/*
 * This file is part of the QPackageKit project
 * Copyright (C) 2008 Adrien Bustany <madcat@mymadcat.com>
 * Copyright (C) 2010-2012 Daniel Nicoletti <dantti12@gmail.com>
 *
 * This library is free software; you can redistribute it and/or
 * modify it under the terms of the GNU Library General Public
 * License as published by the Free Software Foundation; either
 * version 2 of the License, or (at your option) any later version.
 *
 * This library is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
 * Library General Public License for more details.
 *
 * You should have received a copy of the GNU Library General Public License
 * along with this library; see the file COPYING.LIB. If not, write to
 * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
 * Boston, MA 02110-1301, USA.
 */

#ifndef PACKAGEKIT_DAEMON_H
#define PACKAGEKIT_DAEMON_H

#include <QtCore/QObject>
#include <QtCore/QMetaEnum>
#include <QtDBus/QDBusError>
#include <QtDBus/QDBusPendingReply>

#include "transaction.h"

namespace PackageKit {

/**
 * \class Daemon daemon.h Daemon
 * \author Adrien Bustany \e <madcat@mymadcat.com>
 * \author Daniel Nicoletti \e <dantti12@gmail.com>
 *
 * \brief Base class used to interact with the PackageKit daemon
 *
 * This class holds all the functions enabling the user to interact with the PackageKit daemon.
 *
 * Most methods are static so that you can just call Daemon::backendName() to get the name of the backend.
 * 
 * This class is a singleton, its constructor is private. Call Daemon::global() to get
 * an instance of the Daemon object, you only need Daemon::global() when connecting to the signals
 * of this class.
 */
class DaemonPrivate;
class Daemon : public QObject
{
    Q_OBJECT
    Q_ENUMS(Network)
    Q_ENUMS(Authorize)
    Q_PROPERTY(bool isRunning READ isRunning NOTIFY isRunningChanged)
    Q_PROPERTY(Transaction::Roles roles READ roles NOTIFY changed)
    Q_PROPERTY(QString backendName READ backendName NOTIFY changed)
    Q_PROPERTY(QString backendDescription READ backendDescription NOTIFY changed)
    Q_PROPERTY(QString backendAuthor READ backendAuthor NOTIFY changed)
    Q_PROPERTY(Transaction::Filters filters READ filters NOTIFY changed)
    Q_PROPERTY(Transaction::Groups groups READ groups NOTIFY changed)
    Q_PROPERTY(bool locked READ locked NOTIFY changed)
    Q_PROPERTY(QStringList mimeTypes READ mimeTypes NOTIFY changed)
    Q_PROPERTY(Daemon::Network networkState READ networkState NOTIFY networkStateChanged)
    Q_PROPERTY(QString distroID READ distroID NOTIFY changed)
    Q_PROPERTY(uint versionMajor READ versionMajor NOTIFY changed)
    Q_PROPERTY(uint versionMinor READ versionMinor NOTIFY changed)
    Q_PROPERTY(uint versionMicro READ versionMicro NOTIFY changed)
public:
    /**
     * Describes the current network state
     */
    enum Network {
        NetworkUnknown,
        NetworkOffline,
        NetworkOnline,
        NetworkWired,
        NetworkWifi,
        NetworkMobile
    };

    /**
     * Describes the authorization result
     * \sa canAuthorize()
     */
    enum Authorize {
        AuthorizeUnknown,
        AuthorizeYes,
        AuthorizeNo,
        AuthorizeInteractive
    };

    /**
     * \brief Returns an instance of the Daemon
     *
     * The Daemon class is a singleton, you can call this method several times,
     * a single Daemon object will exist.
     * Use this only when connecting to this class signals
     */
    static Daemon* global();

    /**
     * Destructor
     */
    ~Daemon();

    /**
     * Returns true if the daemon is running (ie registered to DBus)
     */
    static bool isRunning();

    /**
     * Returns all the roles supported by the current backend
     */
    static Transaction::Roles roles();

    /**
     * The backend name, e.g. "yum".
     */
    static QString backendName();

    /**
     * The backend description, e.g. "Yellow Dog Update Modifier".
     */
    static QString backendDescription();

    /**
     * The backend author, e.g. "Joe Bloggs <joe@blogs.com>"
     */
    static QString backendAuthor();

    /**
     * Returns the package filters supported by the current backend
     */
    static Transaction::Filters filters();

    /**
     * Returns the package groups supported by the current backend
     */
    static Transaction::Groups groups();

    /**
     * Set when the backend is locked and native tools would fail.
     */
    static bool locked();

    /**
     * Returns a list containing the MIME types supported by the current backend
     */
    static QStringList mimeTypes();

    /**
     * Returns the current network state
     */
    static Daemon::Network networkState();

    /**
     * The distribution identifier in the
     * distro;version;arch form,
     * e.g. "debian;squeeze/sid;x86_64".
     */
    static QString distroID();

    /**
     * Returns the major version number.
     */
    static uint versionMajor();

    /**
     * The minor version number.
     */
    static uint versionMinor();

    /**
     * The micro version number.
     */
    static uint versionMicro();

    /**
     * Allows a client to find out if it would be allowed to authorize an action.
     * The action ID, e.g. org.freedesktop.packagekit.system-network-proxy-configure
     * specified in \p actionId
     * Returm might be either yes, no or interactive \sa Authorize.
     */
    static QDBusPendingReply<Authorize> canAuthorize(const QString &actionId);

    /**
     * Returns the time (in seconds) since the specified \p action
     */
    static QDBusPendingReply<uint> getTimeSinceAction(PackageKit::Transaction::Role action);

    /**
     * \brief creates a new transaction path
     *
     * This function register a new DBus path on PackageKit
     * allowing a \c Transaction object to be created.
     *
     * \note Unless you want to know the transaction id
     * before creating the \c Transaction object this function
     * is not useful as simply creating a \c Transaction object will
     * automatically create this path.
     */
    static QDBusPendingReply<QDBusObjectPath> createTransaction();

    /**
     * Returns the list of current transactions
     */
    static QDBusPendingReply<QList<QDBusObjectPath> > getTransactionList();

    /**
     * \brief Sets a global hints for all the transactions to be created
     *
     * This method allows the calling session to set transaction \p hints for
     * the package manager which can change as the transaction runs.
     *
     * This method can be sent before the transaction has been run
     * (by using Daemon::setHints) or whilst it is running
     * (by using Transaction::setHints).
     * There is no limit to the number of times this
     * method can be sent, although some backends may only use the values
     * that were set before the transaction was started.
     *
     * The \p hints can be filled with entries like these
     * ('locale=en_GB.utf8','idle=true','interactive=false').
     *
     * \sa Transaction::setHints
     */
    static void setHints(const QStringList &hints);

    /**
     * Convenience function to set global hints
     * \sa setHints(const QStringList &hints)
     */
    static void setHints(const QString &hints);

    /**
     * This method returns the current hints
     */
    static QStringList hints();

    /**
     * Sets a proxy to be used for all the network operations
     */
    static QDBusPendingReply<> setProxy(const QString &http_proxy, const QString &https_proxy, const QString &ftp_proxy, const QString &socks_proxy, const QString &no_proxy, const QString &pac);

    /**
     * \brief Tells the daemon that the system state has changed, to make it reload its cache
     *
     * \p reason can be resume or posttrans
     */
    static QDBusPendingReply<> stateHasChanged(const QString &reason);

    /**
     * Asks PackageKit to quit, for example to let a native package manager operate
     */
    static QDBusPendingReply<> suggestDaemonQuit();

    /**
     * Returns the package name from the \p packageID
     */
    Q_INVOKABLE static QString packageName(const QString &packageID);

    /**
     * Returns the package version from the \p packageID
     */
    Q_INVOKABLE static QString packageVersion(const QString &packageID);

    /**
     * Returns the package arch from the \p packageID
     */
    Q_INVOKABLE static QString packageArch(const QString &packageID);

    /**
     * Returns the package data from the \p packageID
     */
    Q_INVOKABLE static QString packageData(const QString &packageID);

    /**
     * Returns the package icon from the \p packageID
     *
     * @deprecated use Appstream to fetch icons
     */
    Q_INVOKABLE QT_DEPRECATED static QString packageIcon(const QString &packageID);
    
    /**
     * Returns the string representing the enum
     * Useful for PackageDetails::Group
     */
    template<class T> static QString enumToString(int value, const char *enumName)
    {
        QString prefix = enumName;
        int id = T::staticMetaObject.indexOfEnumerator(enumName);
        QMetaEnum e = T::staticMetaObject.enumerator(id);
        if (!e.isValid ()) {
//             qDebug() << "Invalid enum " << prefix;
            return QString();
        }
        QString enumString = e.valueToKey(value);
        if (enumString.isNull()) {
//             qDebug() << "Enum key not found while searching for value" << QString::number(value) << "in enum" << prefix;
            return QString();
        }

        // Remove the prefix
        if(!prefix.isNull() && enumString.indexOf(prefix) == 0) {
            enumString.remove(0, prefix.length());
        }

        QString pkName;
        for(int i = 0 ; i < enumString.length() - 1 ; ++i) {
            pkName += enumString[i];
            if(enumString[i+1].isUpper())
                pkName += QChar('-');
        }
        pkName += enumString[enumString.length() - 1];

        return pkName.toLower();
    }
    
    template<class T> static int enumFromString(const QString &str, const char *enumName)
    {
        QString prefix = enumName;
        QString realName;
        bool lastWasDash = false;
        QChar buf;

        for(int i = 0 ; i < str.length() ; ++i) {
            buf = str[i].toLower();
            if(i == 0 || lastWasDash) {
                buf = buf.toUpper();
            }

            lastWasDash = false;
            if(buf == QLatin1Char('-')) {
                lastWasDash = true;
            } else if(buf == QLatin1Char('~')) {
                lastWasDash = true;
                realName += "Not";
            } else {
                realName += buf;
            }
        };

        if (!prefix.isNull()) {
            realName = prefix + realName;
        }

        int id = T::staticMetaObject.indexOfEnumerator(enumName);
        QMetaEnum e = T::staticMetaObject.enumerator(id);
        int enumValue = e.keyToValue(realName.toLatin1().data());

        if (enumValue == -1) {
            enumValue = e.keyToValue(prefix.append("Unknown").toLatin1().data());
            if (!QString(enumName).isEmpty()) {
//                 qDebug() << "enumFromString (" << enumName << ") : converted" << str << "to" << QString("Unknown").append(enumName) << ", enum id" << id;
            }
        }
        return enumValue;
    }

    /**
     * \brief Accepts an EULA
     *
     * The EULA is identified by the \sa Eula structure \p info
     *
     * \note You need to manually restart the transaction which triggered the EULA.
     * \sa eulaRequired()
     *
     * \warning check \sa errorCode() signal to know if it the call has any error
     */
    static Transaction *acceptEula(const QString &eulaID);

    /**
     * Download the given \p packages to a temp dir, if \p storeInCache is true
     * the download will be stored in the package manager cache
     *
     * \warning check \sa errorCode() signal to know if it the call has any error
     */
    static Transaction *downloadPackages(const QStringList &packageIDs, bool storeInCache = false);

    /**
     * This is a convenience function to download this \p package
     * \sa downloadPackages(const QStringList &packageIDs, bool storeInCache = false)
     *
     * \warning check \sa errorCode() signal to know if it the call has any error
     */
    static Transaction *downloadPackage(const QString &packageID, bool storeInCache = false);

    /**
     * Returns the collection categories
     *
     * \sa category
     *
     * \warning check \sa errorCode() signal to know if it the call has any error
     */
    static Transaction *getCategories();

    /**
     * \brief Gets the list of dependencies for the given \p packages
     *
     * You can use the \p filters to limit the results to certain packages.
     * The \p recursive flag indicates if the package manager should also
     * fetch the dependencies's dependencies.
     *
     * \note This method emits \sa package()
     *
     * \warning check \sa errorCode() signal to know if it the call has any error
     */
    static Transaction *dependsOn(const QStringList &packageIDs, Transaction::Filters filters = Transaction::FilterNone, bool recursive = false);

    /**
     * Convenience function to get the dependencies of this \p package
     * \sa dependsOn(const QStringList &packageIDs, Filters filters, bool recursive = false)
     *
     * \warning check \sa errorCode() signal to know if it the call has any error
     */
    static Transaction *dependsOn(const QString &packageID, Transaction::Filters filters = Transaction::FilterNone, bool recursive = false);

    /**
     * Gets more details about the given \p packages
     *
     * \sa Transaction::details
     * \note This method emits \sa package()
     * with details set
     *
     * \warning check \sa errorCode() signal to know if it the call has any error
     */
    static Transaction *getDetails(const QStringList &packageIDs);

    /**
     * Convenience function to get the details about this \p package
     * \sa getDetails(const QStringList &packageIDs)
     *
     * \warning check \sa errorCode() signal to know if it the call has any error
     */
    static Transaction *getDetails(const QString &packageID);

    /**
     * Gets more details about the given \p files
     *
     * \sa Transaction::details
     * \note This method emits \sa package()
     * with details set
     *
     * \warning check \sa errorCode() signal to know if it the call has any error
     */
    static Transaction *getDetailsLocal(const QStringList &files);

    /**
     * Gets more details about the given \p file
     *
     * \sa Transaction::details
     * \note This method emits \sa package()
     * with details set
     *
     * \warning check \sa errorCode() signal to know if it the call has any error
     */
    static Transaction *getDetailsLocal(const QString &file);

    /**
     * Gets the files contained in the given \p packages
     *
     * \note This method emits \sa files()
     *
     * \warning check \sa errorCode() signal to know if it the call has any error
     */
    static Transaction *getFiles(const QStringList &packageIDs);

    /**
     * Convenience function to get the files contained in this \p package
     * \sa getFiles(const QStringList &packageIDs)
     *
     * \warning check \sa errorCode() signal to know if it the call has any error
     */
    static Transaction *getFiles(const QString &packageIDs);

    /**
     * Gets the files contained in the given \p files
     *
     * \note This method emits \sa files()
     *
     * \warning check \sa errorCode() signal to know if it the call has any error
     */
    static Transaction *getFilesLocal(const QStringList &files);

    /**
     * Gets the files contained in the given \p file
     *
     * \note This method emits \sa files()
     *
     * \warning check \sa errorCode() signal to know if it the call has any error
     */
    static Transaction *getFilesLocal(const QString &file);

    /**
     * \brief Gets the last \p number finished transactions
     *
     * \note You must delete these transactions yourself
     * \note This method emits \sa transaction()
     *
     * \warning check \sa errorCode() signal to know if it the call has any error
     */
    static Transaction *getOldTransactions(uint number);

    /**
     * Gets all the packages matching the given \p filters
     *
     * \note This method emits \sa package()
     *
     * \warning check \sa errorCode() signal to know if it the call has any error
     */
    static Transaction *getPackages(Transaction::Filters filters = Transaction::FilterNone);

    /**
     * Gets the list of software repositories matching the given \p filters
     *
     * \note This method emits \sa repository()
     *
     * \warning check \sa errorCode() signal to know if it the call has any error
     */
    static Transaction *getRepoList(Transaction::Filters filters = Transaction::FilterNone);

    /**
     * \brief Searches for the packages requiring the given \p packages
     *
     * The search can be limited using the \p filters parameter.
     * The \p recursive flag is used to tell if the package manager should
     * also search for the package requiring the resulting packages.
     *
     * \note This method emits \sa package()
     *
     * \warning check \sa errorCode() signal to know if it the call has any error
     */
    static Transaction *requiredBy(const QStringList &packageIDs, Transaction::Filters filters = Transaction::FilterNone, bool recursive = false);

    /**
     * Convenience function to get packages requiring this package
     * \sa requiredBy(const QStringList &packageIDs, Filters filters, bool recursive = false)
     *
     * \warning check \sa errorCode() signal to know if it the call has any error
     */
    static Transaction *requiredBy(const QString &packageID, Transaction::Filters filters = Transaction::FilterNone, bool recursive = false);

    /**
     * Retrieves more details about the update for the given \p packageIDs
     *
     * \note This method emits \sa updateDetail()
     *
     * \warning check \sa errorCode() signal to know if it the call has any error
     */
    static Transaction *getUpdatesDetails(const QStringList &packageIDs);

    /**
     * Convenience function to get update details
     * \sa getUpdateDetail(const QStringList &packageIDs)
     *
     * \warning check \sa errorCode() signal to know if it the call has any error
     */
    static Transaction *getUpdateDetail(const QString &packageID);

    /**
     * \p Gets the available updates
     *
     * The \p filters parameters can be used to restrict the updates returned
     *
     * \note This method emits \sa package()
     *
     * \warning check \sa errorCode() signal to know if it the call has any error
     */
    static Transaction *getUpdates(Transaction::Filters filters = Transaction::FilterNone);

    /**
     * Retrieves the available distribution upgrades
     *
     * \note This method emits \sa distroUpgrade()
     *
     * \warning check \sa errorCode() signal to know if it the call has any error
     */
    static Transaction *getDistroUpgrades();

    /**
     * \brief Installs the local packages \p files
     *
     * \p onlyTrusted indicate if the packages are signed by a trusted authority
     *
     * \note This method emits \sa package() and \sa changed()
     *
     * \warning check \sa errorCode() signal to know if it the call has any error
     */
    static Transaction *installFiles(const QStringList &files, Transaction::TransactionFlags flags = Transaction::TransactionFlagOnlyTrusted);

    /**
     * Convenience function to install a file
     * \sa installFiles(const QStringList &files, TransactionFlags flags)
     *
     * \warning check \sa errorCode() signal to know if it the call has any error
     */
    static Transaction *installFile(const QString &file, Transaction::TransactionFlags flags = Transaction::TransactionFlagOnlyTrusted);

    /**
     * Install the given \p packages
     *
     * \p only_trusted indicates if we should allow installation of untrusted packages (requires a different authorization)
     *
     * \note This method emits \sa package() and \sa changed()
     *
     * \warning check \sa errorCode() signal to know if it the call has any error
     */
    static Transaction *installPackages(const QStringList &packageIDs, Transaction::TransactionFlags flags = Transaction::TransactionFlagOnlyTrusted);

    /**
     * Convenience function to install a package
     * \sa installPackages(const QStringList &packageIDs, TransactionFlags flags)
     *
     * \warning check \sa errorCode() signal to know if it the call has any error
     */
    static Transaction *installPackage(const QString &packageID, Transaction::TransactionFlags flags = Transaction::TransactionFlagOnlyTrusted);

    /**
     * \brief Installs a signature
     *
     * \p type, \p keyId and \p package generally come from the Transaction::repoSignatureRequired
     *
     * \warning check \sa errorCode() signal to know if it the call has any error
     */
    static Transaction *installSignature(Transaction::SigType type, const QString &keyID, const QString &packageID);

    /**
     * Refreshes the package manager's cache
     *
     * \note This method emits \sa changed()
     *
     * \warning check \sa errorCode() signal to know if it the call has any error
     */
    static Transaction *refreshCache(bool force);

    /**
     * \brief Removes the given \p packages
     *
     * \p allowDeps if the package manager has the right to remove other packages which depend on the
     * packages to be removed. \p autoRemove tells the package manager to remove all the package which
     * won't be needed anymore after the packages are uninstalled.
     *
     * \note This method emits \sa package() and \sa changed()
     *
     * \warning check \sa errorCode() signal to know if it the call has any error
     */
    static Transaction *removePackages(const QStringList &packageIDs, bool allowDeps = false, bool autoRemove = false, Transaction::TransactionFlags flags = Transaction::TransactionFlagOnlyTrusted);

    /**
     * Convenience function to remove a package
     *
     * \sa removePackages(const PackageList  &packages, bool allowDeps = false, bool autoRemove = false, TransactionFlags flags)
     *
     * \warning check \sa errorCode() signal to know if it the call has any error
     */
    static Transaction *removePackage(const QString &packageID, bool allowDeps = false, bool autoRemove = false, Transaction::TransactionFlags flags = Transaction::TransactionFlagOnlyTrusted);

    /**
     * Repairs a broken system
     *
     * \warning check \sa errorCode() signal to know if it the call has any error
     */
    static Transaction *repairSystem(Transaction::TransactionFlags flags = Transaction::TransactionFlagOnlyTrusted);

    /**
     * Activates or disables a repository
     *
     * \warning check \sa errorCode() signal to know if it the call has any error
     */
    static Transaction *repoEnable(const QString &repoId, bool enable = true);

    /**
     * Removes a repository
     *
     * \p autoremove packages from this repository
     *
     * \warning check \sa errorCode() signal to know if it the call has any error
     */
    static Transaction *repoRemove(const QString &repoId, bool autoremove, Transaction::TransactionFlags flags = Transaction::TransactionFlagNone);

    /**
     * Sets a repository's parameter
     *
     * \warning check \sa errorCode() signal to know if it the call has any error
     */
    static Transaction *repoSetData(const QString &repoId, const QString &parameter, const QString &value);

    /**
     * \brief Tries to create a Package object from the package's name
     *
     * The \p filters can be used to restrict the search
     *
     * \note This method emits \sa package()
     *
     * \warning check \sa errorCode() signal to know if it the call has any error
     */
    static Transaction *resolve(const QStringList &packageNames, Transaction::Filters filters = Transaction::FilterNone);

    /**
     * Convenience function to remove a package name
     * \sa resolve(const QStringList &packageNames, Transaction::Filters filters = Transaction::FilterNone)
     *
     * \warning check \sa errorCode() signal to know if it the call has any error
     */
    static Transaction *resolve(const QString &packageName, Transaction::Filters filters = Transaction::FilterNone);

    /**
     * \brief Search in the packages files
     *
     * \p filters can be used to restrict the returned packages
     *
     * \note This method emits \sa package()
     *
     * \warning check \sa errorCode() signal to know if it the call has any error
     */
    static Transaction *searchFiles(const QStringList &search, Transaction::Filters filters = Transaction::FilterNone);

    /**
     * Convenience function to search for a file
     * \sa searchFiles(const QStringList &search, Transaction::Filters filters = Transaction::FilterNone)
     *
     * \warning check \sa errorCode() signal to know if it the call has any error
     */
    static Transaction *searchFiles(const QString &search, Transaction::Filters filters = Transaction::FilterNone);

    /**
     * \brief Search in the packages details
     *
     * \p filters can be used to restrict the returned packages
     *
     * \note This method emits \sa package()
     *
     * \warning check \sa errorCode() signal to know if it the call has any error
     */
    static Transaction *searchDetails(const QStringList &search, Transaction::Filters filters = Transaction::FilterNone);

    /**
     * Convenience function to search by details
     * \sa searchDetails(const QStringList &search, Transaction::Filters filters = Transaction::FilterNone)
     *
     * \warning check \sa errorCode() signal to know if it the call has any error
     */
    static Transaction *searchDetails(const QString &search, Transaction::Filters filters = Transaction::FilterNone);

    /**
     * \brief Lists all the packages in the given \p group
     *
     * \p groups is the name of the group that you want, when searching for
     * categories prefix it with '@'
     * \p filters can be used to restrict the returned packages
     *
     * \note This method emits \sa package()
     *
     * \warning check \sa errorCode() signal to know if it the call has any error
     */
    static Transaction *searchGroups(const QStringList &groups, Transaction::Filters filters = Transaction::FilterNone);

    /**
     * Convenience function to search by group string
     * \sa searchGroups(const QStringList &groups, Transaction::Filters filters = Transaction::FilterNone)
     *
     * \warning check \sa errorCode() signal to know if it the call has any error
     */
    static Transaction *searchGroup(const QString &group, Transaction::Filters filters = Transaction::FilterNone);

    /**
     * Convenience function to search by group enum
     * \sa searchGroups(const QStringList &groups, Transaction::Filters filters = Transaction::FilterNone)
     *
     * \warning check \sa errorCode() signal to know if it the call has any error
     */
    static Transaction *searchGroup(Transaction::Group group, Transaction::Filters filters = Transaction::FilterNone);

    /**
     * \brief Lists all the packages in the given \p group
     *
     * \p filters can be used to restrict the returned packages
     *
     * \note This method emits \sa package()
     *
     * \warning check \sa errorCode() signal to know if it the call has any error
     */
    static Transaction *searchGroups(Transaction::Groups group, Transaction::Filters filters = Transaction::FilterNone);

    /**
     * \brief Search in the packages names
     *
     * \p filters can be used to restrict the returned packages
     *
     * \note This method emits \sa package()
     *
     * \warning check \sa errorCode() signal to know if it the call has any error
     */
    static Transaction *searchNames(const QStringList &search, Transaction::Filters filters = Transaction::FilterNone);

    /**
     * Convenience function to search by names
     * \sa searchNames(const QStringList &search, Filters filters)
     *
     * \warning check \sa errorCode() signal to know if it the call has any error
     */
    static Transaction *searchNames(const QString &search, Transaction::Filters filters = Transaction::FilterNone);

    /**
     * Update the given \p packages
     *
     * \p onlyTrusted indicates if this transaction is only allowed to install trusted packages
     * \note This method emits \sa package() and \sa changed()
     *
     * \warning check \sa errorCode() signal to know if it the call has any error
     */
    static Transaction *updatePackages(const QStringList &packageIDs, Transaction::TransactionFlags flags = Transaction::TransactionFlagOnlyTrusted);

    /**
     * Convenience function to update a package
     * \sa updatePackages(const QStringList &packageIDs, TransactionFlags flags)
     *
     * \warning check \sa errorCode() signal to know if it the call has any error
     */
    static Transaction *updatePackage(const QString &packageID, Transaction::TransactionFlags flags = Transaction::TransactionFlagOnlyTrusted);

    /**
     * Searchs for a package providing a file/a mimetype
     *
     * \note This method emits \sa package()
     *
     * \warning check \sa errorCode() signal to know if it the call has any error
     */
    static Transaction *whatProvides(const QStringList &search, Transaction::Filters filters = Transaction::FilterNone);

    /**
     * Convenience function to search for what provides
     * \sa whatProvides(Provides type, const QStringList &search, Transaction::Filters filters = Transaction::FilterNone)
     *
     * \warning check \sa errorCode() signal to know if it the call has any error
     */
    static Transaction *whatProvides(const QString &search, Transaction::Filters filters = Transaction::FilterNone);

Q_SIGNALS:
    void isRunningChanged();

    void networkStateChanged();

    /**
     * This signal is emitted when a property on the interface changes.
     */
    void changed();

    /**
     * Emitted when the list of repositories changes
     */
    void repoListChanged();

    /**
     * Emmitted when a restart is scheduled
     */
    void restartScheduled();

    /**
     * \brief Emitted when the current transactions list changes.
     *
     * \note This is mostly useful for monitoring the daemon's state.
     */
    void transactionListChanged(const QStringList &tids);

    /**
     * Emitted when new updates are available
     */
    void updatesChanged();

    /**
     * Emitted when the daemon quits
     */
    void daemonQuit();

protected:
    /**
     * This method connects to DBus signals
     * \attention Make sure to call this method in inherited classes
     * otherwise no signals will be emitted
     */
    virtual void connectNotify(const char *signal);
#if QT_VERSION >= QT_VERSION_CHECK(5, 0, 0)
    virtual void connectNotify(const QMetaMethod &signal);
#endif

    /**
     * This method disconnects from DBus signals
     * \attention Make sure to call this method in inherited classes
     * otherwise no signals will be disconnected
     */
    virtual void disconnectNotify(const char *signal);
#if QT_VERSION >= QT_VERSION_CHECK(5, 0, 0)
    virtual void disconnectNotify(const QMetaMethod &signal);
#endif

    DaemonPrivate * const d_ptr;

private:
    Q_DECLARE_PRIVATE(Daemon)
    Q_PRIVATE_SLOT(d_func(), void serviceOwnerChanged(QString,QString,QString))
    Q_PRIVATE_SLOT(d_func(), void propertiesChanged(QString,QVariantMap,QStringList))
    Q_PRIVATE_SLOT(d_func(), void updateProperties(QVariantMap))
    Daemon(QObject *parent = 0);
    static Daemon *m_global;
};

} // End namespace PackageKit

Q_DECLARE_METATYPE(PackageKit::Daemon::Network)
Q_DECLARE_METATYPE(PackageKit::Daemon::Authorize)

#endif