File indexing completed on 2024-04-28 05:10:45

0001 /*
0002   This file is part of Akregator.
0003 
0004   SPDX-FileCopyrightText: 2004 Sashmit Bhaduri <smt@vfemail.net>
0005 
0006   SPDX-License-Identifier: GPL-2.0-or-later WITH Qt-Commercial-exception-1.0
0007 
0008   This program is distributed in the hope that it will be useful,
0009   but WITHOUT ANY WARRANTY; without even the implied warranty of
0010   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
0011   GNU General Public License for more details.
0012 
0013   You should have received a copy of the GNU General Public Licensea along
0014   with this program; if not, write to the Free Software Foundation, Inc.,
0015   51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
0016 
0017   As a special exception, permission is given to link this program
0018   with any edition of Qt, and distribute the resulting executable,
0019   without including the source code for Qt in the source distribution.
0020 */
0021 
0022 #pragma once
0023 
0024 #include <KontactInterface/UniqueAppHandler>
0025 
0026 namespace KontactInterface
0027 {
0028 class Plugin;
0029 }
0030 
0031 class OrgKdeAkregatorPartInterface;
0032 
0033 class AkregatorUniqueAppHandler : public KontactInterface::UniqueAppHandler
0034 {
0035     Q_OBJECT
0036 public:
0037     explicit AkregatorUniqueAppHandler(KontactInterface::Plugin *plugin)
0038         : KontactInterface::UniqueAppHandler(plugin)
0039     {
0040     }
0041 
0042     void loadCommandLineOptions(QCommandLineParser *parser) override;
0043     int activate(const QStringList &args, const QString &workingDir) override;
0044 };
0045 
0046 class AkregatorPlugin : public KontactInterface::Plugin
0047 {
0048     Q_OBJECT
0049 
0050 public:
0051     AkregatorPlugin(KontactInterface::Core *core, const KPluginMetaData &, const QVariantList &);
0052     ~AkregatorPlugin() override;
0053 
0054     int weight() const override
0055     {
0056         return 475;
0057     }
0058 
0059     OrgKdeAkregatorPartInterface *interface();
0060 
0061     bool isRunningStandalone() const override;
0062     void readProperties(const KConfigGroup &config) override;
0063     void saveProperties(KConfigGroup &config) override;
0064 
0065 protected:
0066     KParts::Part *createPart() override;
0067     KontactInterface::UniqueAppWatcher *mUniqueAppWatcher = nullptr;
0068     OrgKdeAkregatorPartInterface *m_interface = nullptr;
0069 
0070 private:
0071     void addFeed();
0072     void setHelpText(QAction *action, const QString &text);
0073 };