2 This file is part of Akregator.
4 Copyright (C) 2004 Stanislav Karchebny <Stanislav.Karchebny@kdemail.net>
6 This program is free software; you can redistribute it and/or modify
7 it under the terms of the GNU General Public License as published by
8 the Free Software Foundation; either version 2 of the License, or
9 (at your option) any later version.
11 This program is distributed in the hope that it will be useful,
12 but WITHOUT ANY WARRANTY; without even the implied warranty of
13 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 GNU General Public License for more details.
16 You should have received a copy of the GNU General Public License
17 along with this program; if not, write to the Free Software
18 Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
20 As a special exception, permission is given to link this program
21 with any edition of Qt, and distribute the resulting executable,
22 without including the source code for Qt in the source distribution.
25 #include "aboutdata.h"
26 #include "mainwindow.h"
27 #include "akregator_options.h"
29 #include "akregator_debug.h"
30 #include "akregratormigrateapplication.h"
32 #include <KLocalizedString>
33 #include <kontactinterface/pimuniqueapplication.h>
34 #include <QtDBus/QtDBus>
39 class Application
: public KontactInterface::PimUniqueApplication
42 Application(int &argc
, char **argv
[])
43 : KontactInterface::PimUniqueApplication(argc
, argv
)
49 int activate(const QStringList
&args
, const QString
&workingDir
) Q_DECL_OVERRIDE
;
52 Akregator::MainWindow
*mMainWindow
;
55 int Application::activate(const QStringList
&args
, const QString
&workingDir
)
57 if (!isSessionRestored()) {
58 QDBusInterface
akr(QStringLiteral("org.kde.akregator"), QStringLiteral("/Akregator"), QStringLiteral("org.kde.akregator.part"));
60 QCommandLineParser
*parser
= cmdArgs();
61 parser
->process(args
);
64 mMainWindow
= new Akregator::MainWindow();
65 mMainWindow
->loadPart();
66 mMainWindow
->setupProgressWidgets();
67 if (!parser
->isSet(QStringLiteral("hide-mainwindow"))) {
70 akr
.call(QStringLiteral("openStandardFeedList"));
73 akr
.call(QStringLiteral("handleCommandLine"), args
);
75 return PimUniqueApplication::activate(args
, workingDir
);
78 } // namespace Akregator
80 int main(int argc
, char **argv
)
82 Akregator::Application
app(argc
, &argv
);
83 KLocalizedString::setApplicationDomain("akregator");
87 app
.setAttribute(Qt::AA_UseHighDpiPixmaps
, true);
88 app
.setAttribute(Qt::AA_EnableHighDpiScaling
);
89 Akregator::AboutData about
;
90 app
.setAboutData(about
);
92 QCommandLineParser
*cmdArgs
= app
.cmdArgs();
93 Akregator::akregator_options(cmdArgs
);
95 const QStringList args
= QCoreApplication::arguments();
96 cmdArgs
->process(args
);
97 about
.processCommandLine(cmdArgs
);
99 if (!Akregator::Application::start(args
)) {
100 qCWarning(AKREGATOR_LOG
) << "akregator is already running, exiting.";
103 AkregratorMigrateApplication migrate
;
106 // start knotifyclient if not already started. makes it work for people who doesn't use full kde, according to kmail devels
107 //KNotifyClient::startDaemon();
109 // see if we are starting with session management
110 if (app
.isSessionRestored()) {
112 #define RESTORE(type) { int n = 1;\
113 while (KMainWindow::canBeRestored(n)){\
114 (new type)->restore(n, false);\
117 RESTORE(Akregator::MainWindow
);