• Skip to content
  • Skip to link menu
KDE API Reference
  • KDE API Reference
  • kdepim API Reference
  • KDE Home
  • Contact Us
 

akregator

  • sources
  • kde-4.12
  • kdepim
  • akregator
  • src
main.cpp
Go to the documentation of this file.
1 /*
2  This file is part of Akregator.
3 
4  Copyright (C) 2004 Stanislav Karchebny <Stanislav.Karchebny@kdemail.net>
5 
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.
10 
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.
15 
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.
19 
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.
23 */
24 
25 #include "aboutdata.h"
26 #include "mainwindow.h"
27 #include "akregator_options.h"
28 
29 #include <kcmdlineargs.h>
30 #include <KDebug>
31 #include <klocale.h>
32 #include <kontactinterface/pimuniqueapplication.h>
33 #include <QtDBus/QtDBus>
34 #include <QStringList>
35 
36 namespace Akregator {
37 
38 class Application : public KontactInterface::PimUniqueApplication {
39  public:
40  Application() : mMainWindow(0) {}
41  ~Application() {}
42 
43  int newInstance();
44 
45  private:
46  Akregator::MainWindow *mMainWindow;
47 };
48 
49 int Application::newInstance()
50 {
51  if (!isSessionRestored())
52  {
53  QDBusInterface akr(QLatin1String("org.kde.akregator"), QLatin1String("/Akregator"), QLatin1String("org.kde.akregator.part"));
54 
55  KCmdLineArgs *args = KCmdLineArgs::parsedArgs();
56 
57  if ( !mMainWindow ) {
58  mMainWindow = new Akregator::MainWindow();
59  mMainWindow->loadPart();
60  mMainWindow->setupProgressWidgets();
61  if (!args->isSet("hide-mainwindow"))
62  mMainWindow->show();
63  akr.call( QLatin1String("openStandardFeedList"));
64  }
65 
66  akr.call( QLatin1String("handleCommandLine") );
67  args->clear();
68  }
69  return KUniqueApplication::newInstance();
70 }
71 
72 } // namespace Akregator
73 
74 int main(int argc, char **argv)
75 {
76  Akregator::AboutData about;
77  KCmdLineArgs::init(argc, argv, &about);
78  KCmdLineArgs::addCmdLineOptions( Akregator::akregator_options() );
79  KUniqueApplication::addCmdLineOptions();
80 
81  if ( !Akregator::Application::start() ) {
82  kWarning() << "akregator is already running, exiting.";
83  exit( 0 );
84  }
85 
86  Akregator::Application app;
87 
88  // start knotifyclient if not already started. makes it work for people who doesn't use full kde, according to kmail devels
89  //KNotifyClient::startDaemon();
90 
91  // see if we are starting with session management
92  if (app.isSessionRestored())
93  {
94 #undef RESTORE
95 #define RESTORE(type) { int n = 1;\
96  while (KMainWindow::canBeRestored(n)){\
97  (new type)->restore(n, false);\
98  n++;}}
99 
100  RESTORE(Akregator::MainWindow);
101  }
102 
103  return app.exec();
104 }
105 
106 
akregator_options.h
Akregator::AboutData
Definition: aboutdata.h:35
main
int main(int argc, char **argv)
Definition: main.cpp:74
RESTORE
#define RESTORE(type)
mainwindow.h
aboutdata.h
Akregator::MainWindow
This is the application "Shell".
Definition: mainwindow.h:67
Akregator::akregator_options
static KCmdLineOptions akregator_options()
Definition: akregator_options.h:33
This file is part of the KDE documentation.
Documentation copyright © 1996-2014 The KDE developers.
Generated on Tue Oct 14 2014 22:58:14 by doxygen 1.8.7 written by Dimitri van Heesch, © 1997-2006

KDE's Doxygen guidelines are available online.

akregator

Skip menu "akregator"
  • Main Page
  • Namespace List
  • Namespace Members
  • Alphabetical List
  • Class List
  • Class Hierarchy
  • Class Members
  • File List
  • File Members

kdepim API Reference

Skip menu "kdepim API Reference"
  • akonadi_next
  • akregator
  • blogilo
  • calendarsupport
  • console
  •   kabcclient
  •   konsolekalendar
  • kaddressbook
  • kalarm
  •   lib
  • kdgantt2
  • kjots
  • kleopatra
  • kmail
  • knode
  • knotes
  • kontact
  • korgac
  • korganizer
  • ktimetracker
  • libkdepim
  • libkleo
  • libkpgp
  • mailcommon
  • messagelist
  • messageviewer

Search



Report problems with this website to our bug tracking system.
Contact the specific authors with questions and comments about the page contents.

KDE® and the K Desktop Environment® logo are registered trademarks of KDE e.V. | Legal