Example #1
0
void PBIBackend::installApp(QStringList appID, QString injail){
  qDebug() << "Install App requested for:" << appID;
  bool jailok = RUNNINGJAILS.contains(injail) && JAILPKGS.contains(injail);
  for(int i=0; i<appID.length(); i++){
    NGApp app;
    if(APPHASH.contains(appID[i])){ app = APPHASH[appID[i]]; }
    else if(PKGHASH.contains(appID[i])){ app = PKGHASH[appID[i]]; }
    else{
      qDebug() << appID[i] << "is not a valid application";
      continue; //go to the next item is this one is invalid
    } 
    bool jailpkgok = false;
    if(jailok){ jailpkgok = !JAILPKGS[injail].contains(app.origin); }
    if( !app.isInstalled || jailpkgok ){
      queueProcess(appID[i], true, injail);
      emit PBIStatusChange(appID[i]);
    }else{
      qDebug() << appID[i] << "is already installed!";
    }
  } // end of loop over items
  //Now check/start the remove process
  QTimer::singleShot(0,this,SLOT(checkProcesses()) );
  //Now emit the signal that items have changed or been added
  emit LocalPBIChanges();
}
Example #2
0
void MainUI::ProgramInit()
{ 
   QSplashScreen *SS = new QSplashScreen(this, QPixmap(":/icons/splash.png"));
     SS->show();
     QCoreApplication::processEvents();
   qDebug("Application starting...");
   //Now startup the backend
   qDebug() << "Startup Backend";
   QApplication::processEvents();
   PBI = new PBIBackend(this, SS);
   //Initialize the Installed tab
   qDebug() << "Initialize Installed Tab";
   initializeInstalledTab();
   //Initialize the PBI Browser
   qDebug() << "Initialize Browser Tab";
   initializeBrowserTab();


     connect(PBI,SIGNAL(LocalPBIChanges()),this,SLOT(slotRefreshInstallTab()) );
     connect(PBI,SIGNAL(PBIStatusChange(QString)),this,SLOT(slotPBIStatusUpdate(QString)) );
     connect(PBI,SIGNAL(RepositoryInfoReady()),this,SLOT(slotEnableBrowser()) );
     connect(PBI,SIGNAL(NoRepoAvailable()),this,SLOT(slotDisableBrowser()) );
     connect(PBI,SIGNAL(SearchComplete(QStringList,QStringList)),this,SLOT(slotShowSearchResults(QStringList, QStringList)) );
     connect(PBI,SIGNAL(SimilarFound(QStringList)),this,SLOT(slotShowSimilarApps(QStringList)) );
     connect(PBI,SIGNAL(Error(QString,QString,QStringList)),this,SLOT(slotDisplayError(QString,QString,QStringList)) );
     connect(PBI,SIGNAL(devMessage(QString)), ui->text_dev_output, SLOT(append(QString)) );
   //Make sure we start on the installed tab
   ui->tabWidget->setCurrentWidget(ui->tab_browse);

   //In the initialization phase, this should already have the installed/repo info available
   slotRefreshInstallTab();
   slotEnableBrowser();
   SS->finish(this);
}
Example #3
0
void PBIBackend::procFinished(int ret, QProcess::ExitStatus stat){
  emit devMessage("** Process Finished **");
  if(stat != QProcess::NormalExit){
    //Process Crashed
    emit Error(tr("Process Crashed"), QString(tr("The process for %1 has quit unexpectedly. Please restart this operation at a later time.")).arg(PKGRUN), PROCLOG);
  }else if( ret != 0 ){
    //Failure
    QString title, msg;
      if(PROCTYPE==0){ 
	title = tr("Installation Failure"); 
	msg = QString(tr("The following application installation experienced an error: %1")+"\n\n"+tr("Please try again later.")).arg(APPHASH[PKGRUN].name);
      }else if(PROCTYPE==1){ 
	title = tr("Removal Failure"); 
	msg = QString(tr("The following application removal experienced an error: %1")+"\n\n"+tr("Please try again later.")).arg(APPHASH[PKGRUN].name);
      }
      if(!msg.isEmpty()){ emit Error(title, msg, PROCLOG); }
  }else{
    //Success - perform any cleanup operations
    if(PROCTYPE==0 && PKGCMD.contains("pbi_") && !PROCCANCELLED && PKGJAIL.isEmpty()){ //if new installation on main system
      Extras::getCmdOutput("pbi_icon add-menu add-mime "+PKGRUN); //don't care about result
      if(autoDE && APPHASH[PKGRUN].hasDE){ runCmdAsUser("pbi_icon add-desktop "+PKGRUN); }
    }else if(PROCTYPE==0 && PKGCMD.contains("pc-pkg ") && !PROCCANCELLED && PKGJAIL.isEmpty()){
      Extras::getCmdOutput("pc-extractoverlay ports"); //make sure to extract the ports overlay after a pkg operation
    }
	  
  }
  //Now clean up the process variables and update the app status
  if(PKGJAIL.isEmpty()){
    //update the local system info
    slotSyncToDatabase(true);
  }else if(PKGJAIL=="--newjail"){
    //Find the new jail
    checkForJails();
    emit JailListChanged();
  }else{
    //Just update the pkg list for this particular jail
    checkForJails(PKGJAIL);
  }
  QString origin = PKGRUN; //temporary
  PKGCMD.clear();
  PKGRUN.clear();
  PKGJAIL.clear();
  //Emit the proper signals
  emit PBIStatusChange(origin);
  emit LocalPBIChanges(); //so that it knows to look for a different install list
  //Now check for the next command to run
  QTimer::singleShot(1, this, SLOT(checkProcesses()) );
}