Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

Merge branch 'master' of https://github.com/pcbsd/pcbsd

  • Loading branch information...
commit dcaaab6251b9c80b1d5e3c3ab60a4b5cbe1ed807 2 parents 4302cc4 + 127b5d8
@JoshDW19 JoshDW19 authored
View
107 src-qt4/pc-softwaremanager/mainUI.cpp
@@ -167,6 +167,24 @@ void MainUI::initializeInstalledTab(){
actionMenu->addAction( QIcon(":icons/remove.png"), tr("Uninstall"), this, SLOT(slotActionRemove()) );
actionMenu->addSeparator();
actionMenu->addAction( QIcon(":icons/dialog-cancel.png"), tr("Cancel Actions"), this, SLOT(slotActionCancel()) );
+ //Setup the shortcuts menu for installed applications
+ shortcutMenu = new QMenu(this);
+ sDeskMenu = shortcutMenu->addMenu( QIcon(":icons/xdg_desktop.png"), tr("Desktop Icons"));
+ sDeskMenu->addAction( QIcon(":icons/add.png"),tr("Add"),this,SLOT(slotActionAddDesktop()) );
+ sDeskMenu->addAction( QIcon(":icons/remove.png"),tr("Remove"),this,SLOT(slotActionRemoveDesktop()) );
+ sMenuMenu = shortcutMenu->addMenu( QIcon(":icons/xdg_menu.png"), tr("Menu Icons"));
+ sMenuMenu->addAction( QIcon(":icons/add.png"),tr("Add"),this,SLOT(slotActionAddMenu()) );
+ sMenuMenu->addAction( QIcon(":icons/remove.png"),tr("Remove"),this,SLOT(slotActionRemoveMenu()) );
+ sMenuMenu->addAction( QIcon(":icons/add-root.png"),tr("Add (All Users)"),this,SLOT(slotActionAddMenuAll()) );
+ QMenu *spmenu = shortcutMenu->addMenu( QIcon(":icons/xdg_paths.png"), tr("Path Links"));
+ spmenu->addAction( QIcon(":icons/add.png"),tr("Add"),this,SLOT(slotActionAddPath()) );
+ spmenu->addAction( QIcon(":icons/remove.png"),tr("Remove"),this,SLOT(slotActionRemovePath()) );
+ spmenu->addAction( QIcon(":icons/add-root.png"),tr("Add (All Users)"),this,SLOT(slotActionAddPathAll()) );
+ QMenu *sfmenu = shortcutMenu->addMenu( QIcon(":icons/xdg_mime.png"), tr("File Associations"));
+ sfmenu->addAction( QIcon(":icons/add.png"),tr("Add"),this,SLOT(slotActionAddMime()) );
+ sfmenu->addAction( QIcon(":icons/remove.png"),tr("Remove"),this,SLOT(slotActionRemoveMime()) );
+ sfmenu->addAction( QIcon(":icons/add-root.png"),tr("Add (All Users)"),this,SLOT(slotActionAddMimeAll()) );
+ ui->tool_install_shortcuts->setMenu(shortcutMenu);
//Setup the binary menu for installed applications
appBinMenu = new QMenu();
ui->tool_install_startApp->setMenu(appBinMenu);
@@ -178,8 +196,6 @@ void MainUI::initializeInstalledTab(){
ui->tree_install_apps->setIconSize(QSize(22,22));
connect(ui->tree_install_apps, SIGNAL(itemClicked(QTreeWidgetItem*, int)), this, SLOT(slotCheckSelectedItems()) );
slotRefreshInstallTab();
- qDebug() << "Detailed shortcuts button not implemented yet";
- ui->tool_install_shortcuts->setEnabled(false);
}
void MainUI::formatInstalledItemDisplay(QTreeWidgetItem *item){
@@ -204,20 +220,21 @@ void MainUI::formatInstalledItemDisplay(QTreeWidgetItem *item){
}
QStringList MainUI::getCheckedItems(){
- //Return the pbiID's of all the checked items
+ //Return the pbiID's of all the active items
QStringList output;
- for(int i=0; i<ui->tree_install_apps->topLevelItemCount(); i++){
- if(ui->tree_install_apps->topLevelItem(i)->checkState(0) == Qt::Checked){
- output << ui->tree_install_apps->topLevelItem(i)->whatsThis(0);
- }
- }
- //If no items checked, use the item that is selected instead
- if(output.isEmpty()){
- //Make sure that an item is selected
- if(ui->tree_install_apps->topLevelItemCount() >0){
- output << ui->tree_install_apps->currentItem()->whatsThis(0);
+ //See if we are on the single-app details page - then get the current app only
+ if(ui->stackedWidget->currentWidget() == ui->page_install_details){
+ output << cDetails;
+
+ //If on the main Installed page, look for checked items only
+ }else{
+ for(int i=0; i<ui->tree_install_apps->topLevelItemCount(); i++){
+ if(ui->tree_install_apps->topLevelItem(i)->checkState(0) == Qt::Checked){
+ output << ui->tree_install_apps->topLevelItem(i)->whatsThis(0);
+ }
}
}
+ qDebug() << "Checked Items:" << output;
return output;
}
@@ -291,6 +308,10 @@ void MainUI::slotRefreshInstallTab(){
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::slotCheckSelectedItems(){
@@ -327,6 +348,11 @@ void MainUI::slotPBIStatusUpdate(QString pbiID){
}
}
}
+ //If the browser app page is current for this app
+ QString metaID = PBI->pbiToAppID(pbiID);
+ if( (ui->stacked_browser->currentWidget() == ui->page_app) && (cApp == metaID) && ui->page_app->isVisible() ){
+ slotUpdateAppDownloadButton();
+ }
}
void MainUI::on_tool_install_details_clicked(){
@@ -569,6 +595,7 @@ void MainUI::slotUpdateSelectedPBI(){
void MainUI::updateInstallDetails(QString appID){
//Get the information to update the details page
//Get the PBI info for that item
+ cDetails = appID; //save for later
QStringList vals;
vals << "name" << "icon" << "author" << "website" << "version" << "license" << "description" << "maintainer" << "date" << "arch";
QStringList bools;
@@ -593,6 +620,8 @@ void MainUI::updateInstallDetails(QString appID){
else if(desktopSC){ shortcuts = tr("Desktop"); }
else if(menuSC){ shortcuts = tr("Menu"); }
else{ shortcuts = tr("None"); }
+ sDeskMenu->setEnabled(desktopSC);
+ sMenuMenu->setEnabled(menuSC);
//Now display that info on the UI
ui->label_install_app->setText(vals[0]);
ui->label_install_icon->setPixmap( QPixmap(vals[1]).scaled(64,64, Qt::KeepAspectRatio, Qt::SmoothTransformation) );
@@ -609,7 +638,7 @@ void MainUI::updateInstallDetails(QString appID){
ui->tool_install_maintainer->setVisible( vals[7].contains("@") );
ui->label_install_date->setText(vals[8]);
ui->label_install_arch->setText(vals[9]);
- ui->label_install_shortcuts->setText(shortcuts);
+ //ui->label_install_shortcuts->setText(shortcuts);
ui->check_install_autoupdate->setChecked(autoupdate);
//Adjust the quick action buttons as necessary
@@ -831,6 +860,7 @@ void MainUI::slotGoToApp(QString appID){
qDebug() << "Invalid App:" << appID;
return;
}
+ cApp = appID; //save this for later
//Start the search for similar apps
PBI->searchSimilar = appID;
ui->group_bapp_similar->setVisible(FALSE);
@@ -867,21 +897,42 @@ void MainUI::slotGoToApp(QString appID){
else{ ui->label_bapp_size->setText( Extras::sizeKToDisplay(data[14]) ); }
}
//Now update the download button appropriately
+ slotUpdateAppDownloadButton();
+
+ //Now enable/disable the shortcut buttons
+ ui->tool_browse_app->setVisible(TRUE);
+ ui->tool_browse_app->setText(data[0]);
+ ui->tool_browse_app->setIcon(QIcon(data[1]));
+ QStringList catinfo = PBI->CatInfo(Extras::nameToID(data[7]),QStringList() << "name" << "icon");
+ if(!catinfo.isEmpty()){
+ ui->tool_browse_cat->setVisible(TRUE);
+ ui->tool_browse_cat->setText(catinfo[0]);
+ if(catinfo[1].isEmpty()){ catinfo[1] = defaultIcon; }
+ ui->tool_browse_cat->setIcon(QIcon(catinfo[1]));
+ }
+ ui->tabWidget->setCurrentWidget(ui->tab_browse);
+ ui->stacked_browser->setCurrentWidget(ui->page_app);
+
+}
+
+void MainUI::slotUpdateAppDownloadButton(){
QString ico;
- QString working = PBI->currentAppStatus(appID);
+ QString working = PBI->currentAppStatus(cApp);
+ QStringList info = PBI->AppInfo(cApp, QStringList() << "latestversion" << "backupversion" << "requiresroot");
+ QString pbiID = PBI->isInstalled(cApp);
if(!working.isEmpty()){ //app currently pending or actually doing something
ui->tool_bapp_download->setText(working);
ui->tool_bapp_download->setIcon(QIcon(":icons/working.png"));
ui->tool_bapp_download->setEnabled(FALSE);
- }else if(useLatest && cVer.isEmpty()){ //new installation
+ }else if( pbiID.isEmpty() ){ //new installation
ui->tool_bapp_download->setText(tr("Install Now!"));
ico = ":icons/app_download.png";
ui->tool_bapp_download->setEnabled(TRUE);
- }else if(useLatest){ //Update available
+ }else if( !PBI->upgradeAvailable(pbiID).isEmpty() ){ //Update available
ui->tool_bapp_download->setText(tr("Update"));
ico = ":icons/app_upgrade.png";
ui->tool_bapp_download->setEnabled(TRUE);
- }else if(!nobackup){ //Downgrade available
+ }else if(!info[1].isEmpty()){ //Downgrade available
ui->tool_bapp_download->setText(tr("Downgrade"));
ico = ":icons/app_downgrade.png";
ui->tool_bapp_download->setEnabled(TRUE);
@@ -892,26 +943,12 @@ void MainUI::slotGoToApp(QString appID){
}
//Now set the icon appropriately if it requires root permissions
if(!ico.isEmpty()){
- if(data[8]=="true"){ //requires root permissions to install
+ if(info[2]=="true"){ //requires root permissions to install
ico.replace(".png","-root.png");
}
ui->tool_bapp_download->setIcon(QIcon(ico));
}
- ui->tool_bapp_download->setWhatsThis(appID); //set for slot
- //Now enable/disable the shortcut buttons
- ui->tool_browse_app->setVisible(TRUE);
- ui->tool_browse_app->setText(data[0]);
- ui->tool_browse_app->setIcon(QIcon(data[1]));
- QStringList catinfo = PBI->CatInfo(Extras::nameToID(data[7]),QStringList() << "name" << "icon");
- if(!catinfo.isEmpty()){
- ui->tool_browse_cat->setVisible(TRUE);
- ui->tool_browse_cat->setText(catinfo[0]);
- if(catinfo[1].isEmpty()){ catinfo[1] = defaultIcon; }
- ui->tool_browse_cat->setIcon(QIcon(catinfo[1]));
- }
- ui->tabWidget->setCurrentWidget(ui->tab_browse);
- ui->stacked_browser->setCurrentWidget(ui->page_app);
-
+ ui->tool_bapp_download->setWhatsThis(cApp); //set for slot
}
void MainUI::slotGoToSearch(){
@@ -1058,7 +1095,7 @@ void MainUI::on_tool_bapp_download_clicked(){
PBI->installApp(QStringList() << appID);
ui->tool_bapp_download->setEnabled(FALSE); //make sure it cannot be clicked more than once before page refresh
//Now show the Installed tab
- ui->tabWidget->setCurrentWidget(ui->tab_installed);
+ //ui->tabWidget->setCurrentWidget(ui->tab_installed);
}
void MainUI::on_group_br_home_newapps_toggled(bool show){
View
9 src-qt4/pc-softwaremanager/mainUI.h
@@ -94,6 +94,7 @@ private slots:
void slotGoToHome();
void slotGoToCategory(QString);
void slotGoToApp(QString);
+ void slotUpdateAppDownloadButton();
void slotGoToSearch();
void slotShowSimilarApps(QStringList);
void slotShowSearchResults(QStringList, QStringList);
@@ -113,22 +114,20 @@ private slots:
QString wardenDir, wardenIP, defaultIcon;
PBIBackend *PBI;
//INSTALLED TAB
- QMenu *actionMenu, *appBinMenu;
+ QMenu *actionMenu, *appBinMenu, *shortcutMenu, *sDeskMenu, *sMenuMenu;
+ QString cDetails;
void initializeInstalledTab();
void formatInstalledItemDisplay(QTreeWidgetItem *item);
QStringList getCheckedItems();
//BROWSER TAB
QTimer *searchTimer;
- QString cCat;
+ QString cCat, cApp;
void initializeBrowserTab();
//OTHER
QLabel *statusLabel;
void clearScrollArea(QScrollArea*);
void slotDisplayStats();
-
-signals:
-
} ;
#endif
View
27 src-qt4/pc-softwaremanager/mainUI.ui
@@ -503,6 +503,9 @@
<iconset resource="SoftwareManager.qrc">
<normaloff>:/icons/config.png</normaloff>:/icons/config.png</iconset>
</property>
+ <property name="popupMode">
+ <enum>QToolButton::InstantPopup</enum>
+ </property>
<property name="toolButtonStyle">
<enum>Qt::ToolButtonTextBesideIcon</enum>
</property>
@@ -876,8 +879,8 @@ spacing: 1px;
<rect>
<x>0</x>
<y>0</y>
- <width>407</width>
- <height>61</height>
+ <width>98</width>
+ <height>28</height>
</rect>
</property>
<layout class="QHBoxLayout" name="horizontalLayout_5"/>
@@ -927,8 +930,8 @@ spacing: 1px;
<rect>
<x>0</x>
<y>0</y>
- <width>401</width>
- <height>254</height>
+ <width>98</width>
+ <height>28</height>
</rect>
</property>
<layout class="QVBoxLayout" name="verticalLayout_6"/>
@@ -952,8 +955,8 @@ spacing: 1px;
<rect>
<x>0</x>
<y>0</y>
- <width>423</width>
- <height>381</height>
+ <width>98</width>
+ <height>28</height>
</rect>
</property>
<layout class="QVBoxLayout" name="verticalLayout_23"/>
@@ -1352,8 +1355,8 @@ spacing: 1px;
<rect>
<x>0</x>
<y>0</y>
- <width>411</width>
- <height>61</height>
+ <width>98</width>
+ <height>28</height>
</rect>
</property>
</widget>
@@ -1413,8 +1416,8 @@ spacing: 1px;
<rect>
<x>0</x>
<y>0</y>
- <width>407</width>
- <height>148</height>
+ <width>98</width>
+ <height>28</height>
</rect>
</property>
</widget>
@@ -1451,8 +1454,8 @@ spacing: 1px;
<rect>
<x>0</x>
<y>0</y>
- <width>407</width>
- <height>148</height>
+ <width>98</width>
+ <height>28</height>
</rect>
</property>
</widget>
View
6 src-qt4/pc-softwaremanager/pbiBackend.cpp
@@ -630,6 +630,12 @@ QStringList PBIBackend::pbiBinList(QString pbiID){
return output;
}
+QString PBIBackend::pbiToAppID(QString pbiID){
+ QString appID;
+ if( PBIHASH.contains(pbiID) ){ appID = PBIHASH[pbiID].metaID; }
+ return appID;
+}
+
// === Configuration Management ===
void PBIBackend::openConfigurationDialog(){
//temporarily disable the filesystem watcher (causes issues with repo changes)
View
3  src-qt4/pc-softwaremanager/pbiBackend.h
@@ -69,6 +69,7 @@ class PBIBackend : public QObject{
QString currentAppStatus( QString appID , bool rawstatus = false);
bool isWorking(QString pbiID);
QStringList pbiBinList(QString pbiID);
+ QString pbiToAppID(QString pbiID);
//Configuration Management
void openConfigurationDialog();
@@ -76,7 +77,7 @@ class PBIBackend : public QObject{
//Import/Export PBI lists
bool exportPbiListToFile(QString filepath);
bool importPbiListFromFile(QString filepath);
-
+
public slots:
void startAppSearch(); //get list of apps containing the search string (SIGNAL OUTPUT ONLY)
void startSimilarSearch(); //get list of apps that are similar to the input app
View
49 src-qt4/warden-gui/wizardNewJail.cpp
@@ -110,27 +110,23 @@ bool wizardNewJail::validatePage()
goodPal.setColor(QPalette::Window,white);
goodPal.setColor(QPalette::WindowText,white);
labelMessage->setText(QString());
-
+ bool ok = true;
switch (currentId()) {
case Page_IP:
// Make sure items are not empty. Also check for invalid characters
if ( checkIPv4->isChecked() && lineIP->text().isEmpty() ) {
- button(QWizard::NextButton)->setEnabled(false);
- return false;
+ ok=false;
}
if ( checkIPv6->isChecked() && lineIP6->text().isEmpty() ) {
- button(QWizard::NextButton)->setEnabled(false);
- return false;
+ ok=false;
}
if ( lineHost->text().isEmpty() ) {
- button(QWizard::NextButton)->setEnabled(false);
- return false;
+ ok=false;
}
if ( lineHost->text().contains(" ") ) {
- button(QWizard::NextButton)->setEnabled(false);
labelMessage->setText(tr("Hostname cannot contain spaces!"));
- return false;
+ ok=false;
}
if ( lineHost->text().contains("~") || lineHost->text().contains("`") || lineHost->text().contains("!") || lineHost->text().contains("@") || lineHost->text().contains("#") || lineHost->text().contains("$") || lineHost->text().contains("%") || lineHost->text().contains("^") || lineHost->text().contains("&") || lineHost->text().contains("*") || lineHost->text().contains("(") || lineHost->text().contains(")") || lineHost->text().contains("_") || lineHost->text().contains("+") || lineHost->text().contains("=") || lineHost->text().contains(";") || lineHost->text().contains(":") || lineHost->text().contains("'") || lineHost->text().contains("|") || lineHost->text().contains("?") || lineHost->text().contains("<") || lineHost->text().contains(">") || lineHost->text().contains(".") || lineHost->text().contains("?") || lineHost->text().contains(",") ) {
button(QWizard::NextButton)->setEnabled(false);
@@ -140,45 +136,43 @@ bool wizardNewJail::validatePage()
// Check if this IP / Host is already used
for (int i = 0; i < usedHosts.size(); ++i) {
if ( usedHosts.at(i).toLower() == lineHost->text().toLower() ) {
- button(QWizard::NextButton)->setEnabled(false);
lineHost->setPalette(badPal);
labelMessage->setText(tr("Hostname already used!"));
- return false;
+ ok=false;
}
}
for (int i = 0; i < usedIP.size(); ++i)
if ( usedIP.at(i).contains(lineIP->text() + "/24") ) {
- button(QWizard::NextButton)->setEnabled(false);
lineIP->setPalette(badPal);
labelMessage->setText(tr("IP already used!"));
- return false;
+ ok=false;
+ break;
}
// Check if we have a good IPV4 or IPV6 address
if ( checkIPv4->isChecked() && ! pcbsd::Utils::validateIPV4(lineIP->text())) {
- button(QWizard::NextButton)->setEnabled(false);
lineIP->setPalette(badPal);
labelMessage->setText(tr("Invalid IP address!"));
- return false;
+ ok=false;
}
if ( checkIPv6->isChecked() && ! pcbsd::Utils::validateIPV6(lineIP6->text()) ) {
- button(QWizard::NextButton)->setEnabled(false);
lineIP6->setPalette(badPal);
labelMessage->setText(tr("Invalid IPv6 address!"));
- return false;
+ ok=false;
}
-
-
- // Got to the end, must be good!
- lineIP->setPalette(goodPal);
- lineHost->setPalette(goodPal);
- button(QWizard::NextButton)->setEnabled(true);
- return true;
+ if(!ok){
+ button(QWizard::NextButton)->setEnabled(false);
+ }else{
+ // Got to the end, must be good!
+ lineIP->setPalette(goodPal);
+ lineHost->setPalette(goodPal);
+ button(QWizard::NextButton)->setEnabled(true);
+ }
case Page_Root:
if ( lineRoot->text() != lineRoot2->text() ) {
button(QWizard::NextButton)->setEnabled(false);
- return false;
+ ok = false;
} else {
button(QWizard::NextButton)->setEnabled(true);
}
@@ -186,14 +180,13 @@ bool wizardNewJail::validatePage()
case Page_Linux:
if ( lineLinuxScript->text().isEmpty() ) {
button(QWizard::NextButton)->setEnabled(false);
- return false;
+ ok = false;
}
default:
button(QWizard::NextButton)->setEnabled(true);
- return true;
}
- return true;
+ return ok;
}
int wizardNewJail::nextId() const
View
2  src-sh/warden/bin/warden
@@ -767,7 +767,7 @@ template) require_root
get) require_root
OPT="${2}"
JAILNAME="${3}"
- if [ -z "${JAILNAME}" ] ; then exit_err "No jail specified!"; fi
+ if [ -z "${JAILNAME}" ] ; then help_get; exit 1; fi
if [ ! -e "${JDIR}/${JAILNAME}" ] ; then exit_err "No such jail!"; fi
set_warden_metadir
Please sign in to comment.
Something went wrong with that request. Please try again.