[PC-BSD Commits] r9748 - pcbsd/current/src-qt4/pc-softwaremanager
svn at pcbsd.org
svn at pcbsd.org
Mon Mar 21 13:17:46 PDT 2011
Author: kris
Date: 2011-03-21 13:17:46 -0700 (Mon, 21 Mar 2011)
New Revision: 9748
Modified:
pcbsd/current/src-qt4/pc-softwaremanager/pbi.cpp
pcbsd/current/src-qt4/pc-softwaremanager/pbi.h
pcbsd/current/src-qt4/pc-softwaremanager/softmanager-main.cpp
pcbsd/current/src-qt4/pc-softwaremanager/softmanager-main.h
pcbsd/current/src-qt4/pc-softwaremanager/softmanager-pbiupdate.cpp
pcbsd/current/src-qt4/pc-softwaremanager/softmanager.desktop
Log:
First update to AppCafe which allows it to run as user, and install / remove
applications
Modified: pcbsd/current/src-qt4/pc-softwaremanager/pbi.cpp
===================================================================
--- pcbsd/current/src-qt4/pc-softwaremanager/pbi.cpp 2011-03-21 19:52:38 UTC (rev 9747)
+++ pcbsd/current/src-qt4/pc-softwaremanager/pbi.cpp 2011-03-21 20:17:46 UTC (rev 9748)
@@ -36,6 +36,7 @@
setIcon(0, QIcon());
author = "";
website = "";
+ installBy = "";
savedIconPath = "";
setText(0, name + " " + version);
update = false;
@@ -60,6 +61,7 @@
update = false;
workingStatus = PBIINACTIVE;
working = false;
+ installBy = "";
dirty = false;
dodelete = false;
newdownload = false;
@@ -78,6 +80,7 @@
newdownload = false;
downloadFailed = false;
autoup = false;
+ installBy = "";
}
PBI::~PBI()
@@ -335,6 +338,16 @@
autoup=status;
}
+void PBI::setInstallBy(QString name)
+{
+ installBy=name;
+}
+
+QString PBI::getInstallBy()
+{
+ return installBy;
+}
+
bool PBI::isWorking()
{
return working;
Modified: pcbsd/current/src-qt4/pc-softwaremanager/pbi.h
===================================================================
--- pcbsd/current/src-qt4/pc-softwaremanager/pbi.h 2011-03-21 19:52:38 UTC (rev 9747)
+++ pcbsd/current/src-qt4/pc-softwaremanager/pbi.h 2011-03-21 20:17:46 UTC (rev 9748)
@@ -58,6 +58,7 @@
virtual QString getDownloadRepo();
virtual QString getDownloadVersion();
virtual QString getIconPath();
+ virtual QString getInstallBy();
virtual QString getName();
virtual QString getNameCLI();
virtual QString getProgDir();
@@ -79,6 +80,7 @@
virtual void setDownloadRepo(QString repo);
virtual void setDownloadVersion(QString newver);
virtual void setIconPath(QString iconPath);
+ virtual void setInstallBy(QString name);
virtual void setIsWorking(bool status);
virtual void setProgDir(QString path);
virtual void setProgIndexName(QString name);
@@ -112,6 +114,7 @@
QString downloadArch;
QString downloadRepo;
QString downloadVersion;
+ QString installBy;
QString localMdate;
QString name;
QString progDir;
Modified: pcbsd/current/src-qt4/pc-softwaremanager/softmanager-main.cpp
===================================================================
--- pcbsd/current/src-qt4/pc-softwaremanager/softmanager-main.cpp 2011-03-21 19:52:38 UTC (rev 9747)
+++ pcbsd/current/src-qt4/pc-softwaremanager/softmanager-main.cpp 2011-03-21 20:17:46 UTC (rev 9748)
@@ -79,7 +79,7 @@
QTimer::singleShot(500, this, SLOT(startSoftwareBrowser() ) );
// Confirm if we are running as root
- checkRoot();
+ //checkRoot();
qDebug("Populating list...");
@@ -236,7 +236,10 @@
// Do the delete now
QProcess pbicmd;
- pbicmd.start(QString("pbi_delete"), QStringList() << pbi->getProgIndexName() );
+ if ( pbi->getInstallBy() == "root" || pbi->getInstallBy() != RealUserName)
+ pbicmd.start(QString("pc-su"), QStringList() << "pbi_delete" << pbi->getProgIndexName() );
+ else
+ pbicmd.start(QString("pbi_delete"), QStringList() << pbi->getProgIndexName() );
while ( pbicmd.state() != QProcess::NotRunning ) {
pbicmd.waitForFinished(50);
QCoreApplication::processEvents();
@@ -342,7 +345,7 @@
PBI *pbi = 0;
bool foundPBI = false;
QPixmap defaultIcon(":/application.png");
- QString tmp, line, name, progIndexName, version, prefix, author, website, arch, icon, sig, repoID, autoUpdate;
+ QString tmp, line, name, progIndexName, version, prefix, author, website, arch, icon, sig, repoID, autoUpdate, installBy;
// Start by marking all PBIs as dirty
markAllPBIDirty();
@@ -359,18 +362,21 @@
while ( loadPBIs->canReadLine() ) {
line = loadPBIs->readLine().simplified(); // line of text excluding '\n'
- if ( line.isEmpty() && !progIndexName.isEmpty() && !name.isEmpty() && !version.isEmpty() )
+ if ( line.isEmpty() && !progIndexName.isEmpty() && !name.isEmpty() && !version.isEmpty() && !installBy.isEmpty() && !repoID.isEmpty() )
foundPBI = true;
if (line.indexOf("PBI Information for:" ) == 0 )
progIndexName = line.replace("PBI Information for: ", "");
- if (line.indexOf("Name:" ) == 0 )
+ if (line.indexOf("Name: " ) == 0 )
name = line.replace("Name: ", "");
- if ( line.indexOf("Version:") == 0)
+ if ( line.indexOf("Version: ") == 0)
version = line.replace("Version: ", "");
+ if ( line.indexOf("InstalledBy: ") == 0)
+ installBy = line.replace("InstalledBy: ", "");
+
if ( line.indexOf("Icon:") == 0)
icon = line.replace("Icon: ", "");
@@ -405,6 +411,7 @@
item->setAuthor(author);
item->setWebsite(website);
item->setRepoID(repoID);
+ item->setInstallBy(installBy);
item->setDirty(false);
item->setDelete(false);
item->setHidden(false);
@@ -424,6 +431,7 @@
pbi->setWebsite(website);
pbi->setArch(arch);
pbi->setRepoID(repoID);
+ pbi->setInstallBy(installBy);
pbi->setDirty(false);
pbi->setDelete(false);
pbi->setHidden(false);
@@ -444,6 +452,7 @@
arch="";
repoID="";
autoUpdate="";
+ installBy="";
}
}
Modified: pcbsd/current/src-qt4/pc-softwaremanager/softmanager-main.h
===================================================================
--- pcbsd/current/src-qt4/pc-softwaremanager/softmanager-main.h 2011-03-21 19:52:38 UTC (rev 9747)
+++ pcbsd/current/src-qt4/pc-softwaremanager/softmanager-main.h 2011-03-21 20:17:46 UTC (rev 9748)
@@ -57,6 +57,8 @@
// Slots for the PBI tab
void slotAddDesktopIcons();
+ void slotAddMenuIcons();
+ void slotAddMenuIconsRoot();
bool checkPBISelectedUpdates();
void markAllPBIDirty();
void markPBIForUpdate(PBI *item);
@@ -102,6 +104,7 @@
private:
void RemovePBI( PBI * pbi );
void installDesktopIcon( PBI * pbi );
+ void installMenuIcon( PBI * pbi, bool asRoot );
bool checkPBILoaded(QString name);
bool checkPBILoadedFuzzy(QString name);
bool checkOkToClose();
Modified: pcbsd/current/src-qt4/pc-softwaremanager/softmanager-pbiupdate.cpp
===================================================================
--- pcbsd/current/src-qt4/pc-softwaremanager/softmanager-pbiupdate.cpp 2011-03-21 19:52:38 UTC (rev 9747)
+++ pcbsd/current/src-qt4/pc-softwaremanager/softmanager-pbiupdate.cpp 2011-03-21 20:17:46 UTC (rev 9748)
@@ -364,7 +364,10 @@
popup->addAction( tr("View details"), this, SLOT(slotViewPBIClicked()));
if ( ! item->isNewDownload() ) {
+ popup->addSeparator();
popup->addAction( tr("Install Desktop Icons"), this, SLOT(slotAddDesktopIcons()));
+ popup->addAction( tr("Install Menu Icons"), this, SLOT(slotAddMenuIcons()));
+ popup->addAction( tr("Install Menu Icons (All Users)"), this, SLOT(slotAddMenuIconsRoot()));
popup->addSeparator();
popup->addAction( tr("Uninstall"), this, SLOT(RemoveButtonSlot()));
popup->exec( QCursor::pos() );
@@ -549,11 +552,51 @@
}
+void PBM::slotAddMenuIcons()
+{
+ QTreeWidgetItemIterator it(SoftwareListBox);
+ while (*it) {
+ PBI *pbi = dynamic_cast<PBI*>(*it);
+ if ((*it)->isSelected())
+ {
+ installMenuIcon(pbi, false);
+ return;
+ }
+ it++;
+ }
+}
+void PBM::slotAddMenuIconsRoot()
+{
+ QTreeWidgetItemIterator it(SoftwareListBox);
+ while (*it) {
+ PBI *pbi = dynamic_cast<PBI*>(*it);
+ if ((*it)->isSelected())
+ {
+ installMenuIcon(pbi, true);
+ return;
+ }
+ it++;
+ }
+}
+
+
// Installs desktop icons for this PBI
+void PBM::installMenuIcon(PBI *pbi, bool asRoot)
+{
+ installPBIDesktopIcon = new QProcess();
+ if ( asRoot ) {
+ QString cmd = "pbi_icon add-menu " + pbi->getProgIndexName();
+ // + " ; pbi_icon add-mime " + pbi->getProgIndexName();
+ installPBIDesktopIcon->start(QString("pc-su"), QStringList() << cmd );
+ } else {
+ installPBIDesktopIcon->start(QString("pbi_icon"), QStringList() << "add-menu " + pbi->getProgIndexName() + "; pbi_icon add mime " + pbi->getProgIndexName() );
+ }
+}
+
+// Installs desktop icons for this PBI
void PBM::installDesktopIcon(PBI *pbi)
{
installPBIDesktopIcon = new QProcess();
- // qDebug() << "su" << RealUserName << "-c pbi_icon add-desktop" << pbi->getProgIndexName();
- installPBIDesktopIcon->start(QString("su"), QStringList() << RealUserName << "-c" << "pbi_icon add-desktop " + pbi->getProgIndexName() );
+ installPBIDesktopIcon->start(QString("pbi_icon"), QStringList() << "add-desktop " + pbi->getProgIndexName() );
}
Modified: pcbsd/current/src-qt4/pc-softwaremanager/softmanager.desktop
===================================================================
--- pcbsd/current/src-qt4/pc-softwaremanager/softmanager.desktop 2011-03-21 19:52:38 UTC (rev 9747)
+++ pcbsd/current/src-qt4/pc-softwaremanager/softmanager.desktop 2011-03-21 20:17:46 UTC (rev 9748)
@@ -2,7 +2,7 @@
[Desktop Entry]
Comment[en_US]=
Comment=
-Exec=pc-su pc-softwaremanager
+Exec=pc-softwaremanager
GenericName[en_US]=Software Manager
GenericName=Software Manager
Icon=/usr/local/share/pcbsd/icons/appcafe.png
@@ -12,11 +12,7 @@
Terminal=false
TerminalOptions=
Type=Application
-X-DBUS-ServiceName=
-X-DBUS-StartupType=
-X-KDE-SubstituteUID=false
-X-KDE-Username=
-Categories=Qt;KDE;System;
+Categories=System;
Name=AppCafe
Name[en_GB]=AppCafe
Name[en_US]=AppCafe
More information about the Commits
mailing list