2012-02-17 14:11:18 +04:00
|
|
|
/*
|
|
|
|
* 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
|
|
|
|
|
2014-04-29 17:30:19 +04:00
|
|
|
#include "owncloudlib.h"
|
2013-07-29 16:28:19 +04:00
|
|
|
#include <QSharedPointer>
|
2012-05-21 18:48:49 +04:00
|
|
|
#include <QString>
|
2013-07-24 21:53:05 +04:00
|
|
|
#include <QVariant>
|
2012-05-21 18:48:49 +04:00
|
|
|
|
2013-07-22 14:28:43 +04:00
|
|
|
class QWidget;
|
2013-12-12 18:16:19 +04:00
|
|
|
class QHeaderView;
|
2012-05-21 18:48:49 +04:00
|
|
|
|
2012-02-17 14:11:18 +04:00
|
|
|
namespace Mirall {
|
|
|
|
|
2013-07-29 16:28:19 +04:00
|
|
|
class AbstractCredentials;
|
|
|
|
|
2014-04-29 17:30:19 +04:00
|
|
|
class OWNCLOUDSYNC_EXPORT MirallConfigFile
|
2012-02-17 14:11:18 +04:00
|
|
|
{
|
|
|
|
public:
|
2013-10-30 19:31:47 +04:00
|
|
|
MirallConfigFile();
|
2012-02-17 14:11:18 +04:00
|
|
|
|
2013-07-05 18:54:11 +04:00
|
|
|
enum Scope { UserScope, SystemScope };
|
2012-07-25 18:51:29 +04:00
|
|
|
|
2012-03-28 13:26:51 +04:00
|
|
|
QString configPath() const;
|
2013-10-03 19:04:55 +04:00
|
|
|
QString configPathWithAppName() const;
|
2012-03-28 14:23:34 +04:00
|
|
|
QString configFile() const;
|
2013-07-05 18:54:11 +04:00
|
|
|
QString excludeFile(Scope scope) const;
|
2012-03-28 14:23:34 +04:00
|
|
|
|
2012-02-17 14:11:18 +04:00
|
|
|
bool exists();
|
2012-02-18 20:02:10 +04:00
|
|
|
|
|
|
|
QString defaultConnection() const;
|
2012-02-17 14:11:18 +04:00
|
|
|
|
2012-08-06 15:57:26 +04:00
|
|
|
// the certs do not depend on a connection.
|
|
|
|
QByteArray caCerts();
|
|
|
|
void setCaCerts( const QByteArray& );
|
|
|
|
|
2013-02-11 17:20:32 +04:00
|
|
|
bool passwordStorageAllowed(const QString &connection = QString::null );
|
2012-02-18 20:02:10 +04:00
|
|
|
|
2012-05-14 18:22:30 +04:00
|
|
|
QString ownCloudVersion() const;
|
|
|
|
void setOwnCloudVersion( const QString& );
|
|
|
|
|
2012-06-05 17:11:29 +04:00
|
|
|
// max count of lines in the log window
|
|
|
|
int maxLogLines() const;
|
2013-02-18 19:17:03 +04:00
|
|
|
void setMaxLogLines(int);
|
2012-06-05 17:11:29 +04:00
|
|
|
|
2013-01-16 21:03:40 +04:00
|
|
|
/* Server poll interval in milliseconds */
|
2012-05-26 16:37:21 +04:00
|
|
|
int remotePollInterval( const QString& connection = QString() ) const;
|
2013-02-10 14:27:21 +04:00
|
|
|
/* Set poll interval. Value in microseconds has to be larger than 5000 */
|
2013-01-23 06:35:42 +04:00
|
|
|
void setRemotePollInterval(int interval, const QString& connection = QString() );
|
2012-05-26 16:37:21 +04:00
|
|
|
|
2013-08-08 16:30:45 +04:00
|
|
|
/* Force sync interval, in milliseconds */
|
|
|
|
quint64 forceSyncInterval(const QString &connection = QString()) const;
|
|
|
|
|
2013-07-04 21:59:40 +04:00
|
|
|
bool monoIcons() const;
|
|
|
|
void setMonoIcons(bool);
|
|
|
|
|
2012-07-31 12:17:52 +04:00
|
|
|
// proxy settings
|
|
|
|
void setProxyType(int proxyType,
|
|
|
|
const QString& host = QString(),
|
2013-05-29 14:56:23 +04:00
|
|
|
int port = 0, bool needsAuth = false,
|
2012-07-31 12:17:52 +04:00
|
|
|
const QString& user = QString(),
|
|
|
|
const QString& pass = QString());
|
|
|
|
|
|
|
|
int proxyType() const;
|
|
|
|
QString proxyHostName() const;
|
|
|
|
int proxyPort() const;
|
2013-05-29 14:56:23 +04:00
|
|
|
bool proxyNeedsAuth() const;
|
2012-07-31 12:17:52 +04:00
|
|
|
QString proxyUser() const;
|
|
|
|
QString proxyPassword() const;
|
2013-01-14 03:48:26 +04:00
|
|
|
|
2013-07-24 21:53:05 +04:00
|
|
|
/** 0: no limit, 1: manual, >0: automatic */
|
|
|
|
int useUploadLimit() const;
|
|
|
|
bool useDownloadLimit() const;
|
|
|
|
void setUseUploadLimit(int);
|
|
|
|
void setUseDownloadLimit(bool);
|
2013-08-14 15:35:31 +04:00
|
|
|
/** in kbyte/s */
|
2013-07-24 21:53:05 +04:00
|
|
|
int uploadLimit() const;
|
|
|
|
int downloadLimit() const;
|
|
|
|
void setUploadLimit(int kbytes);
|
|
|
|
void setDownloadLimit(int kbytes);
|
|
|
|
|
2013-01-14 03:48:26 +04:00
|
|
|
static void setConfDir(const QString &value);
|
2012-07-31 12:17:52 +04:00
|
|
|
|
2013-07-05 03:01:23 +04:00
|
|
|
bool optionalDesktopNotifications() const;
|
|
|
|
void setOptionalDesktopNotifications(bool show);
|
|
|
|
|
2013-07-22 14:28:43 +04:00
|
|
|
void saveGeometry(QWidget *w);
|
|
|
|
void restoreGeometry(QWidget *w);
|
|
|
|
|
2014-01-15 14:08:42 +04:00
|
|
|
// installer
|
|
|
|
bool skipUpdateCheck( const QString& connection = QString() ) const;
|
|
|
|
void setSkipUpdateCheck( bool, const QString& );
|
|
|
|
|
|
|
|
QString lastVersion() const;
|
|
|
|
void setLastVersion(const QString &version);
|
|
|
|
|
2013-12-12 18:16:19 +04:00
|
|
|
void saveGeometryHeader(QHeaderView *header);
|
|
|
|
void restoreGeometryHeader(QHeaderView *header);
|
2014-02-12 15:17:32 +04:00
|
|
|
|
2012-11-13 14:15:25 +04:00
|
|
|
protected:
|
2014-02-12 15:17:32 +04:00
|
|
|
QVariant getPolicySetting(const QString& policy, const QVariant& defaultValue = QVariant()) const;
|
2013-07-29 16:28:19 +04:00
|
|
|
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;
|
2012-12-11 18:07:44 +04:00
|
|
|
|
2012-07-31 12:17:52 +04:00
|
|
|
private:
|
2013-07-24 21:53:05 +04:00
|
|
|
QVariant getValue(const QString& param, const QString& group = QString::null,
|
|
|
|
const QVariant& defaultValue = QVariant()) const;
|
|
|
|
void setValue(const QString& key, const QVariant &value);
|
2012-07-31 12:17:52 +04:00
|
|
|
|
2012-04-12 16:06:59 +04:00
|
|
|
private:
|
2013-07-29 16:28:19 +04:00
|
|
|
typedef QSharedPointer< AbstractCredentials > SharedCreds;
|
|
|
|
|
2012-04-12 16:06:59 +04:00
|
|
|
static bool _askedUser;
|
2012-05-14 18:22:30 +04:00
|
|
|
static QString _oCVersion;
|
2013-01-14 03:48:26 +04:00
|
|
|
static QString _confDir;
|
2012-02-17 14:11:18 +04:00
|
|
|
};
|
|
|
|
|
|
|
|
}
|
|
|
|
#endif // MIRALLCONFIGFILE_H
|