// lMouseUp
//---------------------------------------------------------------------------
void View::lMouseUp(const iXY &downPos, const iXY &upPos)
{
    // Check all components for a clicked event.
    {    
        ComponentsIterator i;
        for ( i=components.begin(); i != components.end(); i++)
        {        
            if ((*i)->contains(downPos) && (*i)->contains(upPos)) {
                mMouseEvent me((*i), mMouseEvent::MOUSE_EVENT_CLICKED, now(), InputEvent::BUTTON1_MASK, upPos.x, upPos.y, 0, false);

                (*i)->actionPerformed(me);

                actionPerformed(me);
            }
        }
    }

    // Report a mouse release to all components except for a clicked one.
    {    
        ComponentsIterator i;
        for ( i=components.begin(); i != components.end(); i++)
        {        
            if ((*i)->contains(upPos)) {
                mMouseEvent me((*i), mMouseEvent::MOUSE_EVENT_RELEASED, now(), InputEvent::BUTTON1_MASK, upPos.x, upPos.y, 0, false);

                (*i)->actionPerformed(me);

                actionPerformed(me);
            }
        }
    }
} // end View::lMouseUp
ArmButtons::ArmButtons(QWidget *parent)
    : QGroupBox(parent)
{
    this->setTitle("Arm");
    button=new QPushButton[4];

    button[0].setText("UP");
    button[1].setText("RELEASE");
    button[2].setText("CATCH");
    button[3].setText("DOWN");
    button[0].setMinimumSize(250,75);
    button[1].setMinimumSize(250,75);
    button[2].setMinimumSize(250,75);
    button[3].setMinimumSize(250,75);

    QVBoxLayout *lay=new QVBoxLayout;
    lay->addWidget(&button[0]);
    lay->addWidget(&button[1]);
    lay->addWidget(&button[2]);
    lay->addWidget(&button[3]);
    this->setLayout(lay);

    connect(&button[0], SIGNAL(pressed()), this, SLOT(actionPerformed()));
    connect(&button[1], SIGNAL(pressed()), this, SLOT(actionPerformed()));
    connect(&button[2], SIGNAL(pressed()), this, SLOT(actionPerformed()));
    connect(&button[3], SIGNAL(pressed()), this, SLOT(actionPerformed()));
}
void ConsistToolAction::common()
{
    // disable ourself if there is no consist manager available
 if (InstanceManager::getDefault("ConsistManager") == NULL) {
        setEnabled(false);
    }
 connect(this, SIGNAL(triggered()), this, SLOT(actionPerformed()));
}
 /*public*/ TrainConductorAction::TrainConductorAction(QString s, Train* train, QObject* parent)
   : AbstractAction(s, parent)
 {
     //super(s);
  f = NULL;
     this->train = train;
  connect(this, SIGNAL(triggered()), this, SLOT(actionPerformed()));
 }
void AudioTableAction::common()
{
 log = new Logger("AudioTableAction");
 bufferFrame = nullptr;
 sourceFrame = nullptr;
 listenerFrame = nullptr;
 connect(this, SIGNAL(triggered()), this, SLOT(actionPerformed()));
}
// mouseMove
//---------------------------------------------------------------------------
// Purpse: Changes the current highlighted button and checks for mouseEnter
//         and mouseExit status.
//---------------------------------------------------------------------------
void View::mouseMove(const iXY & prevPos, const iXY &newPos)
{
    // Check all components for a clicked event.
    ComponentsIterator i;
    for ( i=components.begin(); i != components.end(); i++)
    {        
        bool containsPrev=(*i)->contains(prevPos);
        bool containsNew=(*i)->contains(newPos);
        if (containsPrev && !containsNew) {
            mMouseEvent me((*i), mMouseEvent::MOUSE_EVENT_EXITED, now(), 0, newPos.x, newPos.y, 0, false);

            (*i)->actionPerformed(me);

            actionPerformed(me);
        } else if (!containsPrev && containsNew) {
            mMouseEvent me((*i), mMouseEvent::MOUSE_EVENT_ENTERED, now(), 0, newPos.x, newPos.y, 0, false);

            (*i)->actionPerformed(me);

            actionPerformed(me);
        } else if (containsNew && newPos!=prevPos) {
            mMouseEvent me((*i), mMouseEvent::MOUSE_EVENT_MOVED, now(), 0, newPos.x, newPos.y, 0, false);

            (*i)->actionPerformed(me);

            actionPerformed(me);
        }
    }

    /*  // THIS DOES NOT WORK!!!!!!!!!!
    	bool flagNewPos  = contains(newPos);
    	bool flagPrevPos = contains(prevPos);
     
    	// Check for status of mouseEnter and mouseExit.
    	if (flagNewPos && !flagPrevPos)
    	{
    		mouseEnter(newPos);
    	}
    	else if (!flagNewPos && flagPrevPos)
    	{
    		mouseExit(prevPos);
    	}
    */
} // end mouseMove
void LogViewer::setupActions()
{
    viewAction=KAuth::Action("org.kde.ufw.viewlog");
    viewAction.setHelperID("org.kde.ufw");
#if KDE_IS_VERSION(4, 5, 90)
    viewAction.setParentWidget(this);
#endif
//     queryAction.setExecutesAsync(true);
    connect(viewAction.watcher(), SIGNAL(actionPerformed(ActionReply)), SLOT(queryPerformed(ActionReply)));
}
// rMouseUp
//---------------------------------------------------------------------------
void View::rMouseUp(const iXY &downPos, const iXY &upPos)
{
    int reportRelease = true;

    // Check all components for a clicked event.
    ComponentsIterator i;
    for ( i=components.begin(); i != components.end(); i++)
    {        
        if ((*i)->contains(downPos) && (*i)->contains(upPos)) {
            mMouseEvent me((*i), mMouseEvent::MOUSE_EVENT_CLICKED, now(), InputEvent::BUTTON2_MASK, upPos.x, upPos.y, 0, false);

            (*i)->actionPerformed(me);

            reportRelease = false;

            actionPerformed(me);
        }
    }

    // If we are on the last component and there was no component containing both
    // mouse press positions, then report a release to an
    if (reportRelease) {
        // Check all components for a release event.
        ComponentsIterator i;
        for ( i=components.begin(); i != components.end(); i++)
        {        
            if ((*i)->contains(upPos)) {
                mMouseEvent me((*i), mMouseEvent::MOUSE_EVENT_RELEASED, now(), InputEvent::BUTTON2_MASK, upPos.x, upPos.y, 0, false);

                (*i)->actionPerformed(me);

                reportRelease = false;

                actionPerformed(me);
            }
        }
    }

} // end View::rMouseUp
// doDeactivate
//---------------------------------------------------------------------------
// Purpose: Default Implementation -
//---------------------------------------------------------------------------
void View::doDeactivate()
{
    ComponentsIterator i;
    for ( i=components.begin(); i != components.end(); i++)
    {
        mMouseEvent me((*i),
            mMouseEvent::MOUSE_EVENT_EXITED, now(), 0, 
            MouseInterface::getMouseX(), MouseInterface::getMouseY(), 0, false);

        (*i)->actionPerformed(me);

        actionPerformed(me);
    }
} // end View::doDeactivate
// mouseEnter
//---------------------------------------------------------------------------
// Purpose: Is triggered when the mouse enters the window.
//---------------------------------------------------------------------------
void View::mouseEnter(const iXY &pos)
{
    // Check all components for a entered event.
    ComponentsIterator i;
    for ( i=components.begin(); i != components.end(); i++)
    {        
        if ((*i)->contains(pos)) {
            mMouseEvent me((*i), mMouseEvent::MOUSE_EVENT_ENTERED, now(), 0, pos.x, pos.y, 0, false);

            (*i)->actionPerformed(me);

            actionPerformed(me);
        }
    }

} // end View::mouseEnter
// doActivate
//---------------------------------------------------------------------------
// Purpose: Default Implementation -
//---------------------------------------------------------------------------
void View::doActivate()
{
    // Tell all the components the mouse entered the view.
    ComponentsIterator i;
    for ( i=components.begin(); i != components.end(); i++)
    {
        if ((*i)->contains(MouseInterface::getMousePosition())) {
            mMouseEvent me((*i),
                mMouseEvent::MOUSE_EVENT_ENTERED, now(), 0, 
                MouseInterface::getMouseX(), MouseInterface::getMouseY(), 0, false);

            (*i)->actionPerformed(me);

            actionPerformed(me);
        }
    }
} // end View::doActivate
void DualDecoderToolAction::common()
{
 // disable ourself if programming is not possible
 bool enabled = false;
 if ((!InstanceManager::getList("GlobalProgrammerManager")->isEmpty())
     && (InstanceManager::getList("GlobalProgrammerManager")->size() > 0))
 {
     enabled = true;
 }
 if ((!InstanceManager::getList("AddressedProgrammerManager")->isEmpty())
     && (InstanceManager::getList("AddressedProgrammerManager")->size() > 0))
 {
     enabled = true;
 }

 setEnabled(enabled);
 connect(this, SIGNAL(triggered()), this, SLOT(actionPerformed()));
}
// rMouseDown
//---------------------------------------------------------------------------
void View::rMouseDown(const iXY &pos)
{
    focusComponent = 0;

    // Check all components for a pressed event.
    ComponentsIterator i;
    for ( i=components.begin(); i != components.end(); i++)
    {        
        if ((*i)->contains(pos)) {
            mMouseEvent me((*i), mMouseEvent::MOUSE_EVENT_PRESSED, now(), InputEvent::BUTTON2_MASK, pos.x, pos.y, 0, false);

            (*i)->actionPerformed(me);

            focusComponent = (*i);

            actionPerformed(me);
        }
    }

} // end View::rMouseDown
// lMouseDrag
//---------------------------------------------------------------------------
void View::lMouseDrag(const iXY &downPos, const iXY &prevPos, const iXY &newPos)
{
    //lMouseDown(newPos);
    //mouseMove(prevPos, newPos);

    // Check all components for a dragged event.
    ComponentsIterator i;
    for ( i=components.begin(); i != components.end(); i++)
    {        
        if ((*i)->contains(newPos) && (*i)->contains(downPos) && newPos!=prevPos) {
            mMouseEvent me((*i), mMouseEvent::MOUSE_EVENT_DRAGGED, now(), InputEvent::BUTTON1_MASK, newPos.x, newPos.y, 0, false);

            (*i)->actionPerformed(me);

            focusComponent = (*i);

            actionPerformed(me);
        }
    }

} // end View::lMouseDrag
 /*public*/ ExportCarRosterAction::ExportCarRosterAction(QString actionName, QWidget* frame)
    : AbstractAction(actionName, (QObject*)frame)
 {
     //super(actionName);
  connect(this, SIGNAL(triggered()), this, SLOT(actionPerformed()));
 }
 /*public*/ BackupFilesAction::BackupFilesAction(QString s, QObject* parent)
     : AbstractAction(s, parent)
 {
  //super(s);
  connect(this, SIGNAL(triggered()), this, SLOT(actionPerformed()));
 }
///*public*/ SignallingSourceAction() {
//    super(rb.getString("SignallingPairs"));
//}
void SignallingSourceAction::init()
{
    log = new Logger("SignallingSourceAction");
    connect(this, SIGNAL(triggered()), this, SLOT(actionPerformed()));
}
 void OperationsSetupAction::common()
 {
  connect(this, SIGNAL(triggered()), this, SLOT(actionPerformed()));
  f = NULL;
 }
 /*public*/ SetTrainIconPositionAction::SetTrainIconPositionAction(QString s, QObject* parent) : AbstractAction(s, parent) {
     //super(s);
      f = NULL;
      connect(this, SIGNAL(triggered()), this, SLOT(actionPerformed()));
 }
/*public*/ XmlFileLocationAction::XmlFileLocationAction(QObject* parent)
        : AbstractAction(parent)
{
 //super();
 connect(this, SIGNAL(triggered()), this, SLOT(actionPerformed()) );
}
void LcdClockAction::common()
{
 connect(this, SIGNAL(triggered()), this, SLOT(actionPerformed()));
}
/**
 * @brief PausedMenu::on_no_clicked resume the game
 */
void PausedMenu::on_no_clicked()
{
    this->quit = false ;
    emit actionPerformed();
    this->hide();
}
/**
 * @brief PausedMenu::on_yes_clicked returns the control to the main menu
 */
void PausedMenu::on_yes_clicked()
{
    this->quit = true ;
    emit actionPerformed();
    this->hide();
}
 void TrainCopyAction::common()
 {
  _train = NULL;
  f = NULL;
  connect(this, SIGNAL(triggered()), this, SLOT(actionPerformed()));
 }
void InputWindowAction::common()
{
 pref = (UserPreferencesManager*)InstanceManager::getDefault("UserPreferencesManager");
 connect(this, SIGNAL(triggered()), this, SLOT(actionPerformed()));
}