Example #1
0
int AlarmDaemonApp::newInstance()
{
	kdDebug(5900) << "AlarmDaemonApp::newInstance()" << endl;

	/* Prevent the application being restored automatically by the session manager
	 * at session startup. Instead, the KDE autostart facility is used to start
	 * the application. This allows the user to configure whether or not it is to
	 * be started automatically, and also ensures that it is started in the correct
	 * phase of session startup, i.e. after clients have been restored by the
	 * session manager.
	 */
	disableSessionManagement();

	// Check if we already have a running alarm daemon widget
	if (mAd)
		return 0;

	// Check if we are starting up at session startup
	static bool restored = false;
	bool autostart = false;
	if (!restored  &&  isRestored())
		restored = true;       // make sure we restore only once
	else
	{
		KCmdLineArgs* args = KCmdLineArgs::parsedArgs();
		autostart = args->isSet("autostart");
		args->clear();      // free up memory
	}

	mAd = new AlarmDaemon(autostart, 0, DAEMON_DCOP_OBJECT);

	return 0;
}
int KHDAPSMonitor::newInstance()
{
  if (window)
    KWin::activateWindow(window->winId());
  else
  {
    window = new KHDAPSMonitorMain();
    if (isRestored() && KMainWindow::canBeRestored(0))
      window->restore(0, FALSE);
  }
  return 0;
}
Example #3
0
KateApp::KateApp (KCmdLineArgs *args)
 : KApplication ()
 , m_args (args)
 , m_shouldExit (false)
{
  // Don't handle DCOP requests yet
  dcopClient()->suspend();

  // insert right translations for the katepart
  KGlobal::locale()->insertCatalogue("katepart");

  // some global default
  Kate::Document::setFileChangedDialogsActivated (true);

  // application interface
  m_application = new Kate::Application (this);

  // doc + project man
  m_docManager = new KateDocManager (this);

  // init all normal plugins
  m_pluginManager = new KatePluginManager (this);

  // session manager up
  m_sessionManager = new KateSessionManager (this);

  // application dcop interface
  m_obj = new KateAppDCOPIface (this);

  kdDebug()<<"Setting KATE_PID: '"<<getpid()<<"'"<<endl;
  ::setenv( "KATE_PID", QString("%1").arg(getpid()).latin1(), 1 );

  // handle restore different
  if (isRestored())
  {
    restoreKate ();
  }
  else
  {
    // let us handle our command line args and co ;)
    // we can exit here if session chooser decides
    if (!startupKate ())
    {
      m_shouldExit = true;
      return;
    }
  }

  // Ok. We are ready for DCOP requests.
  dcopClient()->resume();
}
Example #4
0
int Application::newInstance()
{
    if(!isRestored())
    {
        DCOPRef akr("akregator", "AkregatorIface");

        KCmdLineArgs *args = KCmdLineArgs::parsedArgs();

        if(!mMainWindow)
        {
            mMainWindow = new Akregator::MainWindow();
            setMainWidget(mMainWindow);
            mMainWindow->loadPart();
            mMainWindow->setupProgressWidgets();
            if(!args->isSet("hide-mainwindow"))
                mMainWindow->show();
            akr.send("openStandardFeedList");
        }

        QString addFeedGroup = !args->getOption("group").isEmpty()
                               ? QString::fromLocal8Bit(args->getOption("group"))
                               : i18n("Imported Folder");

        KStringList feeds = args->getOptionList("addfeed");
        QStringList feedsToAdd;
        KStringList::ConstIterator end(feeds.end());
        for(KStringList::ConstIterator it = feeds.begin(); it != end; ++it)
            feedsToAdd.append(*it);

        if(!feedsToAdd.isEmpty())
            akr.send("addFeedsToGroup", feedsToAdd, addFeedGroup);

        args->clear();
    }
    return KUniqueApplication::newInstance();
}