Welcome to mirror list, hosted at ThFree Co, Russian Federation.

mirallconfigfile.h « mirall « src - github.com/owncloud/client.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
blob: 6c5645c8a96b9a42231c2d981b4be9ee33f5c949 (plain)
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
/*
 * Copyright (C) by Klaas Freitag <freitag@owncloud.com>
 *
 * This program is free software; you can redistribute it and/or modify
 * it under the terms of the GNU General Public License as published by
 * the Free Software Foundation; either version 2 of the License, or
 * (at your option) any later version.
 *
 * This program 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 General Public License
 * for more details.
 */

#ifndef MIRALLCONFIGFILE_H
#define MIRALLCONFIGFILE_H

#include "owncloudlib.h"
#include <QSharedPointer>
#include <QString>
#include <QVariant>

class QWidget;
class QHeaderView;

namespace Mirall {

class AbstractCredentials;

class OWNCLOUDSYNC_EXPORT MirallConfigFile
{
public:
    MirallConfigFile();

    enum Scope { UserScope, SystemScope };

    QString configPath() const;
    QString configPathWithAppName() const;
    QString configFile() const;
    QString excludeFile(Scope scope) const;
    static QString excludeFileFromSystem(); // doesn't access config dir

    bool exists();

    QString defaultConnection() const;

    // the certs do not depend on a connection.
    QByteArray caCerts();
    void setCaCerts( const QByteArray& );

    bool passwordStorageAllowed(const QString &connection = QString::null );

    QString ownCloudVersion() const;
    void setOwnCloudVersion( const QString& );

    // max count of lines in the log window
    int  maxLogLines() const;
    void setMaxLogLines(int);

    /* Server poll interval in milliseconds */
    int remotePollInterval( const QString& connection = QString() ) const;
    /* Set poll interval. Value in microseconds has to be larger than 5000 */
    void setRemotePollInterval(int interval, const QString& connection = QString() );

    /* Force sync interval, in milliseconds */
    quint64 forceSyncInterval(const QString &connection = QString()) const;

    bool monoIcons() const;
    void setMonoIcons(bool);

    // proxy settings
    void setProxyType(int proxyType,
                      const QString& host = QString(),
                      int port = 0, bool needsAuth = false,
                      const QString& user = QString(),
                      const QString& pass = QString());

    int proxyType() const;
    QString proxyHostName() const;
    int proxyPort() const;
    bool proxyNeedsAuth() const;
    QString proxyUser() const;
    QString proxyPassword() const;
    
    /** 0: no limit, 1: manual, >0: automatic */
    int useUploadLimit() const;
    bool useDownloadLimit() const;
    void setUseUploadLimit(int);
    void setUseDownloadLimit(bool);
    /** in kbyte/s */
    int uploadLimit() const;
    int downloadLimit() const;
    void setUploadLimit(int kbytes);
    void setDownloadLimit(int kbytes);

    static void setConfDir(const QString &value);

    bool optionalDesktopNotifications() const;
    void setOptionalDesktopNotifications(bool show);

    int timeout() const;

    void saveGeometry(QWidget *w);
    void restoreGeometry(QWidget *w);

    // installer
    bool skipUpdateCheck( const QString& connection = QString() ) const;
    void setSkipUpdateCheck( bool, const QString& );

    QString lastVersion() const;
    void setLastVersion(const QString &version);

    void saveGeometryHeader(QHeaderView *header);
    void restoreGeometryHeader(QHeaderView *header);

protected:
    QVariant getPolicySetting(const QString& policy, const QVariant& defaultValue = QVariant()) const;
    void storeData(const QString& group, const QString& key, const QVariant& value);
    QVariant retrieveData(const QString& group, const QString& key) const;
    void removeData(const QString& group, const QString& key);
    bool dataExists(const QString& group, const QString& key) const;

private:
    QVariant getValue(const QString& param, const QString& group = QString::null,
                      const QVariant& defaultValue = QVariant()) const;
    void setValue(const QString& key, const QVariant &value);

private:
    typedef QSharedPointer< AbstractCredentials > SharedCreds;

    static bool    _askedUser;
    static QString _oCVersion;
    static QString _confDir;
};

}
#endif // MIRALLCONFIGFILE_H