Exemplo n.º 1
0
Arquivo: main.C Projeto: xwizard/kde1
void TEDemo::font_menu_activated(int item)
{
  assert(se);
  se->setFontNo(item);
  activateSession((int)session2no.find(se)); // for attribute change
  // setFont(item) is probably enough
}
Exemplo n.º 2
0
Arquivo: main.C Projeto: xwizard/kde1
void TEDemo::schema_menu_activated(int item)
{
  assert(se);
  //FIXME: save schema name
  se->setSchemaNo(item);
  activateSession((int)session2no.find(se)); // for attribute change
  // setSchema(item) is probably enough
}
Exemplo n.º 3
0
Arquivo: main.C Projeto: xwizard/kde1
void TEDemo::runSession(TESession* s)
{
  int session_no = (int)session2no.find(s);
  activateSession(session_no);

  // give some time to get through the
  // resize events before starting up.
  QTimer::singleShot(100,s,SLOT(run()));
}
Exemplo n.º 4
0
Arquivo: main.C Projeto: xwizard/kde1
void TEDemo::doneSession(TESession* s, int status)
{
//printf("%s(%d): Exited:%d ExitStatus:%d\n",__FILE__,__LINE__,WIFEXITED(status),WEXITSTATUS(status));
#if 0 // die silently
  if (!WIFEXITED((status)) || WEXITSTATUS((status)))
  {
    QString str;
    //FIXME: "Title" is not a precise locator for the message.
    //       The command would be better.
    str.sprintf(i18n("`%s' terminated abnormally."), s->Title());
    if (WIFEXITED((status)))
    {char rcs[100]; sprintf(rcs,"%d.\n",WEXITSTATUS((status)));
      str = str + i18n("\nReturn code = ") + rcs;
    }
    KMsgBox::message( this, i18n("Error"), str, KMsgBox::EXCLAMATION );
  }
#endif
  int no = (int)session2no.find(s);
  if (!no) return; // oops
  no2session.remove(no);
  session2no.remove(s);
  m_sessions->removeItem(no);

  s->setConnect(FALSE);

  // This slot (doneSession) is activated from the Shell when receiving a
  // SIGCHLD. A lot is done during the signal handler, apparently deleting
  // the Shell additionally, is sometimes too much, causing something
  // to get messed up in rare cases. The following causes delete not to
  // be called from within the signal handler.

  QTimer::singleShot(100,s,SLOT(terminate()));

  if (s == se)
  { // pick a new session
    se = NULL;
    QIntDictIterator<TESession> it( no2session );
    if ( it.current() )
      activateSession(it.currentKey());
    else
      kapp->quit();
  }
}
Exemplo n.º 5
0
void KateSessionManager::sessionOpen()
{
    KateSessionOpenDialog *chooser = new KateSessionOpenDialog(0);

    int res = chooser->exec();

    if(res == KateSessionOpenDialog::resultCancel)
    {
        delete chooser;
        return;
    }

    KateSession::Ptr s = chooser->selectedSession();

    if(s)
        activateSession(s);

    delete chooser;
}
Exemplo n.º 6
0
template<class T> void AsyncEndpoint<T>::start()
{
    registerEndpoint();
    if(boost::shared_ptr<AsyncEndpoint<T> > activated = activateSession(this->shared_from_this())){
        //Transfer session object over to old session
        activated->unregisterEndpoint();
        {
            boost::mutex::scoped_lock lock(message_queueMutex);
            message_queue = std::deque<Message_ptr>(activated->message_queue);
        }
        log("Session reactivated");
    }
    boost::system::error_code ec(0,boost::system::system_category());
    handle_write(ec);
    isActive=true;
    aostream->async_read_some(boost::asio::buffer(data_, max_length),
                              boost::bind(&AsyncEndpoint::handle_read, this,
                                          boost::asio::placeholders::error,
                                          boost::asio::placeholders::bytes_transferred));
}//  NMEA-Protocol-Server
Exemplo n.º 7
0
void KateSessionManager::sessionNew()
{
    activateSession(new KateSession(this, "", ""));
}
Exemplo n.º 8
0
bool KateSessionManager::chooseSession()
{
    bool success = true;

    // app config
    KConfig *c = KateApp::self()->config();
    c->setGroup("General");

    // get last used session, default to default session
    QString lastSession(c->readEntry("Last Session", "default.katesession"));
    QString sesStart(c->readEntry("Startup Session", "manual"));

    // uhh, just open last used session, show no chooser
    if(sesStart == "last")
    {
        activateSession(new KateSession(this, lastSession, ""), false, false);
        return success;
    }

    // start with empty new session
    if(sesStart == "new")
    {
        activateSession(new KateSession(this, "", ""), false, false);
        return success;
    }

    KateSessionChooser *chooser = new KateSessionChooser(0, lastSession);

    bool retry = true;
    int res = 0;
    while(retry)
    {
        res = chooser->exec();

        switch(res)
        {
            case KateSessionChooser::resultOpen:
            {
                KateSession::Ptr s = chooser->selectedSession();

                if(!s)
                {
                    KMessageBox::error(chooser, i18n("No session selected to open."), i18n("No Session Selected"));
                    break;
                }

                activateSession(s, false, false);
                retry = false;
                break;
            }

            // exit the app lateron
            case KateSessionChooser::resultQuit:
                success = false;
                retry = false;
                break;

            default:
                activateSession(new KateSession(this, "", ""), false, false);
                retry = false;
                break;
        }
    }

    // write back our nice boolean :)
    if(success && chooser->reopenLastSession())
    {
        c->setGroup("General");

        if(res == KateSessionChooser::resultOpen)
            c->writeEntry("Startup Session", "last");
        else if(res == KateSessionChooser::resultNew)
            c->writeEntry("Startup Session", "new");

        c->sync();
    }

    delete chooser;

    return success;
}