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

0001 /*
0002     SPDX-FileCopyrightText: 2019 Thomas Baumgart tbaumgart @kde.org
0003     SPDX-FileCopyrightText: 2018, 2024 Ralf Habacker ralf.habacker @freenet.de
0004 
0005     This file is part of libalkimia.
0006 
0007     SPDX-License-Identifier: LGPL-2.1-or-later
0008 */
0009 
0010 #ifndef ALKONLINEQUOTESPROFILE_P_H
0011 #define ALKONLINEQUOTESPROFILE_P_H
0012 
0013 #include "alkonlinequotesprofile.h"
0014 
0015 #include "alknewstuffengine.h"
0016 
0017 #ifdef ENABLE_FINANCEQUOTE
0018 #include "alkfinancequoteprocess.h"
0019 #endif
0020 
0021 #include <KConfigGroup>
0022 
0023 #ifdef ENABLE_FINANCEQUOTE
0024 #include <QApplication>
0025 #endif
0026 
0027 #include <QDir>
0028 #include <QFileInfo>
0029 #include <QLibraryInfo>
0030 
0031 #if QT_VERSION >= QT_VERSION_CHECK(5,0,0)
0032     #include <KSharedConfig>
0033 #endif
0034 
0035 class ALK_NO_EXPORT AlkOnlineQuotesProfile::Private : public QObject
0036 {
0037     Q_OBJECT
0038 public:
0039     AlkOnlineQuotesProfile *m_p;
0040     QString m_name;
0041     QString m_GHNSFile;
0042     QString m_GHNSFilePath;
0043     QString m_kconfigFile;
0044     AlkOnlineQuotesProfileManager *m_profileManager;
0045     AlkNewStuffEngine *m_engine = 0;
0046     KSharedConfigPtr m_config;
0047     Type m_type;
0048     static QString m_financeQuoteScriptPath;
0049     static QStringList m_financeQuoteSources;
0050 
0051     bool setupFinanceQuoteScriptPath();
0052 
0053     explicit Private(AlkOnlineQuotesProfile *p);
0054 
0055     ~Private();
0056 
0057     QString GHNSId(const QString &name) const;
0058     QString GHNSFilePath(const QString &name) const;
0059 
0060     const QStringList quoteSourcesNative();
0061 
0062 #ifdef ENABLE_FINANCEQUOTE
0063     const QStringList quoteSourcesFinanceQuote();
0064 #endif
0065 
0066     const QStringList quoteSourcesSkrooge();
0067 
0068     const QStringList quoteSourcesGHNS();
0069 
0070     const AlkOnlineQuotesProfile::Map defaultQuoteSources();
0071 
0072     /**
0073      * @brief return data root path
0074      * @return path
0075      */
0076     QString dataRootPath();
0077 
0078     /**
0079      * @brief return home root path
0080      * @return path
0081      */
0082     QString homeRootPath();
0083 
0084     QString configPath();
0085 
0086     QString dataReadPath();
0087 
0088     QString dataWritePath();
0089 
0090 public Q_SLOTS:
0091     void slotUpdatesAvailable(const AlkNewStuffEntryList &updates);
0092 };
0093 
0094 #endif // ALKONLINEQUOTESPROFILE_P_H