void QueueEditor::slotTransferModeChanged(int index)
{
  if (m_lastTransferType == index)
    return;
  else
    m_lastTransferType = (KFTPQueue::TransferType) index;

  resetTabs();
  resetServerData();
  
  switch (index) {
    case 0: {
      // Download - source: remote dest: local
      m_layout->serverTab->setTabEnabled(m_layout->tab, true);
      m_layout->serverTab->showPage(m_layout->tab);
      break;
    }
    case 1: {
      // Upload - source: local dest: remote
      m_layout->serverTab->setTabEnabled(m_layout->tab_2, true);
      m_layout->serverTab->showPage(m_layout->tab_2);
      break;
    }
    case 2: {
      // FXP - source: remote dest: remote
      m_layout->serverTab->setTabEnabled(m_layout->tab, true);
      m_layout->serverTab->setTabEnabled(m_layout->tab_2, true);
      m_layout->serverTab->showPage(m_layout->tab);
      break;
    }
  }

  slotTextChanged();
}
Exemplo n.º 2
0
void MainFrm::closeFile()
{
    if (pFrmReports->isVisible())
        closeSecondaryFrm(pFrmReports);

    if ( tabWidget->count() <1 ){
        QMessageBox::information(this, tr("FaoCAS"),
                                        tr("There is nothing to close."),
                                        QMessageBox::Ok);
         return;
    }

    //TODO: Ask if you want to save the changes (also on the load file)
    resetTabs();
}
Exemplo n.º 3
0
void MainFrm::newTabs()
{
    qApp->setOverrideCursor( QCursor(Qt::BusyCursor ) );
    statusShow(tr("Wait..."));

        if (pFrmReports->isVisible())
            closeSecondaryFrm(pFrmReports);

        resetTabs();

        if (sSample!=0) {delete sSample; sSample=0;}
        sSample=new Sample;
        initTabs();

    statusShow(tr("Project successfully initialized."));
    qApp->setOverrideCursor( QCursor(Qt::ArrowCursor ) );
}
Exemplo n.º 4
0
void MainFrm::loadTabs()
{
    qApp->setOverrideCursor( QCursor(Qt::BusyCursor ) );
    statusShow(tr("Wait..."));

        resetTabs();

        initTabs();

        if (pFrmFrame==0) return;
        this->tabWidget->insertTab(0,pFrmFrame, pFrmFrame->title());

        if (sSample->frameId==-1 || sSample->frameTimeId==-1) return;

        QVector<int> vSample;
        vSample << sSample->frameTimeId;
        vSample << sSample->minorStrataId;
        vSample << sSample->cellId;
        vSample << sSample->vesselTypeId;
        vSample << sSample->sampVesselId;
        vSample << sSample->tripId;
        vSample << sSample->operationId;
        vSample << sSample->catchId;

        if (vSample.size() != vTabs.size()){
            displayError(tr("Could not load project file!"),true);//TODO: improve errors!
        }else{

            bool bOk=true;
            int ct=0;
            QVector<int>::const_iterator it;
             for (it = vSample.begin(); it != vSample.end(); ++it){

                 if ( qobject_cast<PreviewTab*>(vTabs.at(ct))!=0){
                    PreviewTab* pTab=qobject_cast<PreviewTab*>(vTabs.at(ct));

                    if (*it!=-1){

                            if (!pTab->tableSelect(*it)){
                                displayError(tr("Could not find the saved record on form ") +
                                    vTabs.at(ct)->title(),true);
                                bOk=false;
                                break;
                            }

                            QVector<int>::const_iterator it2;
                            if (sSample->bLogBook && pTab->title()==tr("Stratum"))
                                it2=it+3;
                            else
                                it2=it+1;

                            //qDebug() << pTab->objectName() << endl;
                            if (*it2!=-1 && ct<vTabs.size()-1){
                                //|| (sSample->bLogBook && ( pTab->objectName()){
                             vTabs.at(ct)->setLoading(true);
                             if (!vTabs.at(ct)->next()){
                                bOk=false;
                                vTabs.at(ct)->setLoading(false);
                                break;
                             }
                             vTabs.at(ct)->setLoading(false);
                        }
                    }
                     ct++;

                 }//cast
             }//for

            if (bOk) statusShow(tr("Project successfully loaded."));
            else displayError (tr("Could not load tab ") + vTabs.at(ct)->title() + tr("!"),false);
        }

    qApp->setOverrideCursor( QCursor(Qt::ArrowCursor ) );
}