void MainUI::slotEnableBrowser(){ qDebug() << "Repo Ready: - generating browser home page"; //Now create the browser home page slotUpdateBrowserHome(); //And allow the user to go there ui->tab_browse->setEnabled(TRUE); slotDisplayStats(); }
// === SLOTS === void MainUI::slotRefreshInstallTab(){ //Update the list of installed PBI's w/o clearing the list (loses selections) //Get the list we need (in order) QStringList installList = PBI->installedList(); installList.append( PBI->pendingInstallList() ); installList.removeDuplicates(); //Quick finish if no items installed/pending if(installList.isEmpty()){ ui->tree_install_apps->clear(); return; } //Get the list we have now and handle items as needed QStringList cList; for(int i=0; i<ui->tree_install_apps->topLevelItemCount(); i++){ QString item = ui->tree_install_apps->topLevelItem(i)->whatsThis(0); //Update item if necessary if(installList.contains(item)){ formatInstalledItemDisplay( ui->tree_install_apps->topLevelItem(i) ); installList.removeAll(item); //Remove it from the list - since already handled //Remove item if necessary }else{ delete ui->tree_install_apps->takeTopLevelItem(i); i--; //make sure to back up once to prevent missing the next item } } //Now add any new items to the list for(int i=0; i<installList.length(); i++){ QTreeWidgetItem *item = new QTreeWidgetItem; //create the item //qDebug() << "New Item:" << installList[i]; item->setWhatsThis(0,installList[i]); //Now format the display formatInstalledItemDisplay(item); if(item->text(0).isEmpty()){ //Do not put empty items into the display delete item; }else{ //Now insert this item onto the list ui->tree_install_apps->insertTopLevelItem(i,item); } } //Make sure that there is an item selected if(ui->tree_install_apps->topLevelItemCount() > 0 ){ if( ui->tree_install_apps->selectedItems().isEmpty() ){ ui->tree_install_apps->setCurrentItem( ui->tree_install_apps->topLevelItem(0) ); } //Now re-size the columns to the minimum required width for(int i=0; i<3; i++){ ui->tree_install_apps->resizeColumnToContents(i); } } //slotUpdateSelectedPBI();; //Update the info boxes slotDisplayStats(); slotCheckSelectedItems(); //If the browser app page is currently visible for this app if( (ui->stacked_browser->currentWidget() == ui->page_app) && ui->page_app->isVisible() ){ slotGoToApp(cApp); } }
// === SLOTS === void MainUI::slotDisableBrowser(bool shownotification){ if(shownotification){ qDebug() << "No Repo Available: De-activating the Browser"; } ui->tabWidget->setCurrentWidget(ui->tab_installed); ui->tab_browse->setEnabled(FALSE); slotDisplayStats(); }
// === SLOTS === void MainUI::slotRefreshInstallTab(){ //Update the list of installed PBI's w/o clearing the list (loses selections) //Get the list we need (in order) slotUpdateJailMenu(); if(VISJAIL.isEmpty()){ ui->label_install_jail->setText( tr("Showing: Local System") ); } else{ ui->label_install_jail->setText( QString(tr("Showing Jail: %1")).arg(VISJAIL) ); } QStringList installList = PBI->installedList(VISJAIL, ui->actionRaw_Inst_Packages->isChecked()); //qDebug() << "Installed Pkgs:" << installList; installList.append( PBI->pendingInstallList() ); installList.removeDuplicates(); if( !ui->actionShow_Base_Packages->isChecked() ){ installList = PBI->filterBasePkgs(installList); //don't show base dependencies } //Quick finish if no items installed/pending if(installList.isEmpty()){ ui->tree_install_apps->clear(); return; } //Get the list we have now and handle items as needed //QStringList cList; for(int i=0; i<ui->tree_install_apps->topLevelItemCount(); i++){ QString item = ui->tree_install_apps->topLevelItem(i)->whatsThis(0); //Update item if necessary if(installList.contains(item)){ formatInstalledItemDisplay( ui->tree_install_apps->topLevelItem(i) ); installList.removeAll(item); //Remove it from the list - since already handled //Remove item if necessary }else{ delete ui->tree_install_apps->takeTopLevelItem(i); i--; //make sure to back up once to prevent missing the next item } } //Now add any new items to the list //qDebug() << "New Items:" << installList; for(int i=0; i<installList.length(); i++){ QTreeWidgetItem *item = new QTreeWidgetItem; //create the item //qDebug() << "New Item:" << installList[i]; item->setWhatsThis(0,installList[i]); //Now format the display formatInstalledItemDisplay(item); //qDebug() << "New Item:" << installList[i] << item->text(0); if(item->whatsThis(0).isEmpty()){ //Do not put invalid items into the display delete item; }else{ //Now insert this item onto the list ui->tree_install_apps->addTopLevelItem(item); } } ui->tree_install_apps->sortItems(0, Qt::AscendingOrder); //Make sure that there is an item selected if(ui->tree_install_apps->topLevelItemCount() > 0 ){ if( ui->tree_install_apps->selectedItems().isEmpty() ){ ui->tree_install_apps->setCurrentItem( ui->tree_install_apps->topLevelItem(0) ); } //Now re-size the columns to the minimum required width for(int i=0; i<6; i++){ ui->tree_install_apps->resizeColumnToContents(i); } } //slotUpdateSelectedPBI();; //Update the info boxes slotDisplayStats(); slotCheckSelectedItems(); if(PBI->checkForUpdates(VISJAIL)){ ui->group_updates->setVisible(true); if(VISJAIL.isEmpty()){ ui->tool_start_updates->setIcon(QIcon(":icons/view-refresh.png")); } else{ ui->tool_start_updates->setIcon(QIcon(":icons/view-jail.png")); } }else{ ui->group_updates->setVisible(false); } ui->group_jailwarn->setVisible( !VISJAIL.isEmpty() ); //If the browser app page is currently visible for this app if( (ui->stacked_browser->currentWidget() == ui->page_app) && ui->page_app->isVisible() ){ slotGoToApp(cApp); } }