~ubuntu-branches/ubuntu/oneiric/kdepim/oneiric-updates

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
/* -*- mode: c++; c-basic-offset:4 -*-
    core/command.h

    This file is part of KleopatraClient, the Kleopatra interface library
    Copyright (c) 2008 Klarälvdalens Datakonsult AB

    KleopatraClient 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.

    KleopatraClient 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 program; if not, write to the Free Software
    Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301  USA
*/

#ifndef __LIBKLEOPATRACLIENT_CORE_COMMAND_H__
#define __LIBKLEOPATRACLIENT_CORE_COMMAND_H__

#include <libkleopatraclient/kleopatraclient_export.h>

#include <QtCore/QObject>
#include <QtGui/QWidget> // only for WId, doesn't prevent linking against QtCore-only

class QString;
class QByteArray;
class QVariant;

namespace KLEOPATRACLIENT_NAMESPACE {

    class KLEOPATRACLIENTCORE_EXPORT Command : public QObject {
        Q_OBJECT
    public:
        explicit Command( QObject * parent=0 );
        ~Command();

        void setParentWId( WId wid );
        WId parentWId() const;

        void setServerLocation( const QString & location );
        QString serverLocation() const;

        bool waitForFinished();
        bool waitForFinished( unsigned long ms );

        bool error() const;
        bool wasCanceled() const;
        QString errorString() const;

        qint64 serverPid() const;

    public Q_SLOTS:
        void start();
        void cancel();

    Q_SIGNALS:
        void started();
        void finished();

    protected:
        void setOptionValue( const char * name, const QVariant & value, bool critical=true );
        void setOption( const char * name, bool critical=true );
        void unsetOption( const char * name );

        QVariant optionValue( const char * name ) const;
        bool isOptionSet( const char * name ) const;
        bool isOptionCritical( const char * name ) const;

        void setFilePaths( const QStringList & filePaths );
        QStringList filePaths() const;

        void setRecipients( const QStringList & recipients, bool informative );
        QStringList recipients() const;
        bool areRecipientsInformative() const;

        void setSenders( const QStringList & senders, bool informative );
        QStringList senders() const;
        bool areSendersInformative() const;

        void setInquireData( const char * what, const QByteArray & data );
        void unsetInquireData( const char * what );
        QByteArray inquireData( const char * what ) const;
        bool isInquireDataSet( const char * what ) const;

        QByteArray receivedData() const;

        void setCommand( const char * command );
        QByteArray command() const;

    protected:
        class Private;
        Private * d;
        Command( Private * p, QObject * parent );
    };

}

#endif /* __LIBKLEOPATRACLIENT_CORE_COMMAND_H__ */