// === 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); } }
void MainUI::on_tool_install_toggleall_clicked(){ //Determine if the current item is checked or unchecked bool checkall = (ui->tree_install_apps->currentItem()->checkState(0) == Qt::Unchecked); for(int i=0; i<ui->tree_install_apps->topLevelItemCount(); i++){ if(checkall){ ui->tree_install_apps->topLevelItem(i)->setCheckState(0,Qt::Checked); } else{ui->tree_install_apps->topLevelItem(i)->setCheckState(0,Qt::Unchecked); } } slotCheckSelectedItems(); }
void MainUI::contextMenuFinished(){ QTimer::singleShot(500, this, SLOT(slotCheckSelectedItems()) ); }
void MainUI::on_tree_install_apps_itemSelectionChanged(){ //When an installed PBI is clicked on slotCheckSelectedItems(); }
// === 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); } }