File indexing completed on 2024-04-28 05:02:31

0001 /*
0002     SPDX-FileCopyrightText: 2018 Ralf Habacker ralf.habacker @freenet.de
0003 
0004     This file is part of libalkimia.
0005 
0006     SPDX-License-Identifier: LGPL-2.1-or-later
0007 */
0008 
0009 #ifndef ALKONLINEQUOTESPROFILE_H
0010 #define ALKONLINEQUOTESPROFILE_H
0011 
0012 #include <alkimia/alk_export.h>
0013 #include <alkimia/alkonlinequotesource.h>
0014 
0015 #include <KSharedConfig>
0016 
0017 #include <QObject>
0018 #include <QString>
0019 #include <QMap>
0020 
0021 class AlkOnlineQuoteSource;
0022 class AlkOnlineQuotesProfileManager;
0023 
0024 class ALK_EXPORT AlkOnlineQuotesProfile : public QObject
0025 {
0026     Q_OBJECT
0027 public:
0028     typedef QMap<QString, AlkOnlineQuoteSource> Map;
0029     enum class Type {
0030         Undefined, None, Alkimia4, Alkimia5, KMyMoney4, KMyMoney5, Skrooge4, Skrooge5, Script
0031     };
0032     explicit AlkOnlineQuotesProfile(const QString &name = "alkimia", Type type = Type::None,
0033         const QString &ghnsConfigFile = QString());
0034     ~AlkOnlineQuotesProfile();
0035 
0036     QString name() const;
0037     QString hotNewStuffConfigFile() const;
0038     QString hotNewStuffRelPath() const;
0039     QStringList hotNewStuffReadPath() const;
0040     QString hotNewStuffWriteDir() const;
0041     QString hotNewStuffReadFilePath(const QString &fileName) const;
0042     QString hotNewStuffWriteFilePath(const QString &fileName) const;
0043     QString kConfigFile() const;
0044     void setManager(AlkOnlineQuotesProfileManager *manager);
0045     AlkOnlineQuotesProfileManager *manager();
0046 
0047     KSharedConfigPtr kConfig() const;
0048     void setKConfig(KSharedConfigPtr kconfig);
0049 
0050     /**
0051      * Check if the profile is supported (build) by Alkimia
0052      *
0053      * @returns @c true if support is compiled, @c false otherwise.
0054      */
0055     bool typeIsSupported() const;
0056 
0057     /**
0058      * Check if the profile is functional
0059      *
0060      * @returns @c true if support is available, @c false otherwise.
0061      */
0062     bool typeIsOperational() const;
0063 
0064     Type type();
0065     bool hasGHNSSupport();
0066 
0067     /**
0068      * return available default sources of this profile
0069      */
0070     const Map defaultQuoteSources();
0071 
0072     /**
0073      * return available sources of this profile
0074      */
0075     const QStringList quoteSources();
0076 
0077     QString scriptPath();
0078 
0079     QString GHNSId(const QString &name) const;
0080     QString GHNSFilePath(const QString &name) const;
0081 
0082 Q_SIGNALS:
0083     /**
0084      * emit quote source for which an update is available
0085      */
0086    void updateAvailable(const QString &profile, const QString &name);
0087 
0088 private:
0089     class Private;
0090     Private *const d;
0091 };
0092 
0093 #endif // ALKONLINEQUOTESPROFILE_H