[PC-BSD Commits] r147 - in pcbsd/trunk: PBIsource PBItext
svn at pcbsd.org
svn at pcbsd.org
Mon Apr 2 13:52:50 PDT 2007
Author: kris
Date: 2007-04-02 21:52:49 +0100 (Mon, 02 Apr 2007)
New Revision: 147
Modified:
pcbsd/trunk/PBIsource/main.cpp
pcbsd/trunk/PBIsource/pbi.ui.h
pcbsd/trunk/PBItext/main.cpp
Log:
Updates to the PBI software, which allow the -text and -extract options, along with misc bugfixes.
Modified: pcbsd/trunk/PBIsource/main.cpp
===================================================================
--- pcbsd/trunk/PBIsource/main.cpp 2007-03-27 20:11:07 UTC (rev 146)
+++ pcbsd/trunk/PBIsource/main.cpp 2007-04-02 20:52:49 UTC (rev 147)
@@ -7,22 +7,43 @@
int main( int argc, char ** argv )
{
-
+
+ KCmdLineArgs::init(argc, argv, "PBI", "PBI", "PBI Installer", "3.1");
-
-
- KCmdLineArgs::init(argc, argv, "PBI", "PBI", "PBI Installer", "3.0");
+
+ static KCmdLineOptions options[] =
+ {
+ { "", "Start the PBI Install", 0 },
+ { "extract", "Extract the PBI files and create the .pbc configuration", 0 },
+ KCmdLineLastOption
+ };
+ // Tell which options are supported
+ KCmdLineArgs::addCmdLineOptions( options );
+
+ KApplication a;
- KApplication a;
-
//QApplication a( argc, argv);
QTranslator translator( 0 );
translator.load( QString("PBI_") + QTextCodec::locale(), "." );
a.installTranslator( &translator );
+ PBI w;
+
+
+ if ( argc == 2)
+ {
+ QString flag = argv[1];
+ if ( flag == "-extract" )
+ {
+ w.extractOnly();
+ w.hide();
+ a.connect( &a, SIGNAL( lastWindowClosed() ), &a, SLOT( quit() ) );
+ return a.exec();
+ }
+ }
- PBI w;
+
w.ProgramInit(a.applicationDirPath());
w.show();
Modified: pcbsd/trunk/PBIsource/pbi.ui.h
===================================================================
--- pcbsd/trunk/PBIsource/pbi.ui.h 2007-03-27 20:11:07 UTC (rev 146)
+++ pcbsd/trunk/PBIsource/pbi.ui.h 2007-04-02 20:52:49 UTC (rev 147)
@@ -11,12 +11,16 @@
*****************************************************************************/
/****************************************************************************
* Name: PBI-Wizard
-* Version: 1.0
+* Version: 3.1
* Author: Kris Moore
* License: BSD (See LICENSE file for more detail)
-* Date: 11-21-05
+* Date: 4-2-07
*****************************************************************************/
+#include <iostream>
+#include <string>
+using namespace std;
+
void PBI::ProgramInit( QString ProgDir )
{
@@ -231,9 +235,9 @@
}
if ( line.find("ExeTaskbar:") == 0)
{
- ExeTaskbar[i] = line.replace("ExeTaskbar: ", "").toInt();
+ ExeTaskbar[i] = line.replace("ExeTaskbar: ", "");
- if ( ExeTaskbar[i] == 1)
+ if ( ExeTaskbar[i] == "1")
{
NoTaskbarCheck = 0;
}
@@ -835,6 +839,7 @@
}
// change permissions of the directory
+ /*
chown = new QProcess( this );
chown->addArgument( "chmod" );
chown->addArgument( "-R" );
@@ -842,7 +847,7 @@
chown->addArgument("/Programs/" + ProgramName);
if ( !chown->start() ) {
- }
+ } */
}
@@ -922,7 +927,7 @@
}
}
- if (TaskbarCheckBox->isChecked() && ExeTaskbar[exenum] == 1 && ExeWebLink[exenum] != "1" )
+ if (TaskbarCheckBox->isChecked() && ExeTaskbar[exenum] == "1" && ExeWebLink[exenum] != "1" )
{
QString ShellOption;
@@ -1121,7 +1126,7 @@
Chmod = new QProcess( this );
Chmod->addArgument( "chmod" );
Chmod->addArgument( "755" );
- Chmod->addArgument( "/usr/local/share/minelnk/applications/" + ProgramName + MimeNumString + ".desktop");
+ Chmod->addArgument( "/usr/local/share/mimelnk/applications/" + ProgramName + MimeNumString + ".desktop");
if ( !Chmod->start() ) {
}
@@ -1477,6 +1482,9 @@
QPixmap pixmap2;
pixmap2.load("header.png");
headerPixmap->setPixmap(pixmap2);
+ headerPixmap2->setPixmap(pixmap2);
+ headerPixmap3->setPixmap(pixmap2);
+ headerPixmap4->setPixmap(pixmap2);
}
// Check if a custom icon.png exists and load it
@@ -1534,3 +1542,134 @@
}
}
+
+
+
+
+void PBI::extractOnly()
+{
+
+ // Load the settings into memory
+ readSettingsSlot();
+
+
+ // Start the extraction process
+ QDir NewDir;
+ NewDir.setPath("/home/" + RealUserName + "/" + ProgDirName);
+ if (NewDir.exists() )
+ {
+ cout << "Error! The directory /home/" + RealUserName + "/" + ProgDirName + " already exists!\nRemove this directory and try again. ";
+ exit(1);
+ }
+
+ NewDir.mkdir("/home/" + RealUserName + "/" + ProgDirName, TRUE);
+ cout << "Made Directory: /home/" + RealUserName + "/" + ProgDirName + "\n";
+
+ // Make the install script now
+ QFile file4( "extract.sh" );
+ if ( file4.open( IO_WriteOnly ) ) {
+ QTextStream stream4( &file4 );
+ stream4 << "#!/bin/sh\nSKIP=`cat pbiskip`\ntail +${SKIP} pbilink | tar xpovj -C \"${1}\" -f - ";
+ file4.close();
+ }
+
+ UnTar = new QProcess( this );
+ UnTar->addArgument( "sh" );
+ UnTar->addArgument( "extract.sh" );
+ UnTar->addArgument( "/home/" + RealUserName + "/" + ProgDirName );
+ connect( UnTar, SIGNAL(processExited()), this, SLOT(extractOnlyFinished() ) );
+ if ( !UnTar->start() ) {
+
+ }
+}
+
+
+void PBI::extractOnlyFinished()
+{
+ cout << "Extracted to: /home/" + RealUserName + "/" + ProgDirName + "\n";
+
+ QFile CfgFile( "/home/" + RealUserName + "/" + ProgDirName + ".pbc" );
+ if ( CfgFile.open( IO_WriteOnly ) ) {
+ QTextStream stream( &CfgFile );
+ // Save the software name and info
+ stream << "[ PBC 1.0 ]" << "\n";
+ stream << "ProgName: " << ProgramName << "\n";
+ stream << "ProgVersion: " << ProgramVer << "\n";
+ stream << "ProgWeb: " << ProgramWeb << "\n";
+ stream << "ProgAuthor: " << ProgramAuthor << "\n";
+ stream << "PBIVer: NEW\n";
+ stream << "PBIUpdate: " << ProgUpdateURL << "\n";
+
+ // Save the package directory
+ stream << "PackageDir: " << "/home/" + RealUserName + "/" + ProgDirName << "\n";
+ stream << "LibDir: " << LibDir << "\n" ;
+
+
+ // Save the default icon, if needed
+ stream << "DefaultIcon: " << "/home/" + RealUserName + "/" + ProgDirName + "/" + DefaultIcon << "\n";
+
+ // Start saving exe info
+ int i = 0;
+
+ while (! ExePath[i].isEmpty() )
+ {
+
+ stream << "ExePath: " << "/home/" + RealUserName + "/" + ProgDirName + "/" + ExePath[i] << "\n" ;
+ if ( ExeIcon[i].isEmpty() ) {
+ stream << "ExeIcon: \n";
+ } else {
+ stream << "ExeIcon: " << "/home/" + RealUserName + "/" + ProgDirName + "/" + ExeIcon[i] << "\n" ;
+ }
+
+ stream << "ExeDescr: " << ExeDescr[i] << "\n" ;
+ stream << "ExeNoDesktop: " << NoDesktop[i] << "\n";
+ stream << "ExeNoMenu: " << NoMenu[i] << "\n";
+ stream << "ExeRunRoot: " << RunRoot[i] << "\n";
+ stream << "ExeRunShell: " << RunShell[i] << "\n";
+ stream << "ExeNotify: " << Notify[i] << "\n";
+ stream << "ExeLink: " << ExeLink[i] << "\n";
+ stream << "ExeWebLink: " << ExeWebLink[i] << "\n";
+ stream << "ExeTaskbar: " << ExeTaskbar[i] << "\n";
+ stream << "ExeOwndir: " << ExeOwndir[i] << "\n";
+ stream << "ExeKdeCat: " << ExeKdeCat[i] << "\n";
+ i++;
+ }
+
+ i = 0;
+ while (! MimeExt[i].isEmpty() )
+ {
+ stream << "MimeExt: " << MimeExt[i] << "\n";
+ if ( MimeIcon[i].isEmpty() ) {
+ stream << "MimeIcon: \n";
+ } else {
+ stream << "MimeIcon: " << "/home/" + RealUserName + "/" + ProgDirName + "/" + MimeIcon[i] << "\n";
+ }
+ stream << "MimeProg: " << MimeProg[i] << "\n";
+ i++;
+ }
+
+
+ QFile LicFile( "LICENSE" );
+ if ( LicFile.exists() )
+ {
+ stream << "License: YES\n" ;
+ if ( LicFile.open( IO_ReadOnly ) ) {
+ QTextStream stream2( &LicFile );
+ while ( !stream2.atEnd() ) {
+ stream << stream2.readLine() + "\n" ;
+ }
+ }
+
+
+ } else {
+ stream << "License: NO\n";
+ }
+
+
+ CfgFile.close();
+
+
+ }
+ cout << "PBC file created at: /home/" + RealUserName + "/" + ProgDirName + ".pbc\n";
+ exit (0);
+}
Modified: pcbsd/trunk/PBItext/main.cpp
===================================================================
--- pcbsd/trunk/PBItext/main.cpp 2007-03-27 20:11:07 UTC (rev 146)
+++ pcbsd/trunk/PBItext/main.cpp 2007-04-02 20:52:49 UTC (rev 147)
@@ -21,6 +21,7 @@
void CheckScriptSlot(void);
void CreateMimeSlot( int MimeNum );
void acceptLicense(void);
+void MassageGTKFiles(void);
QString ProgramName;
QString ProgramVer;
@@ -47,7 +48,11 @@
int OverWrote;
QString ExeLink[100];
QString ExeWebLink[100];
+int ExeOwndir[100];
+QString ExeKdeCat[100];
+QString ExeTaskbar[100];
QString ProgUpdateURL;
+int GTKFound = 0;
int main( int argc, char ** argv )
@@ -136,10 +141,16 @@
}
+ // Make the install script now
+ QFile file4( "extract.sh" );
+ if ( file4.open( IO_WriteOnly ) ) {
+ QTextStream stream4( &file4 );
+ stream4 << "#!/bin/sh\nSKIP=`cat pbiskip`\ntail +${SKIP} pbilink | tar xpovj -C \"${1}\" -f - >/dev/null 2>/dev/null";
+ file4.close();
+ }
-
- QString command = "tar xpov -C /Programs/" + ProgDirName + "/ -f Package.tar >/dev/null 2>/dev/null";
+ QString command = "sh extract.sh /Programs/" + ProgDirName + "/";
QString inputLine = getLineFromCommandOutput(command);
// Setup the libraries
@@ -151,7 +162,18 @@
void readSettingsSlot(void)
{
+ // Loads the username
+ QFile whoami( "whoami" );
+ if ( whoami.open( IO_ReadOnly ) ) {
+ QTextStream stream3( &whoami );
+ while ( !stream3.atEnd() ) {
+ RealUserName = stream3.readLine();
+ }
+ }
+
+
int NoMenuCheck = 1;
+ int NoTaskbarCheck = 1;
// Open our config file, and read in the data
QFile file( "PkgConfig" );
@@ -237,7 +259,26 @@
{
ExeWebLink[i] = line.replace("ExeWebLink: ", "");
}
+ if ( line.find("ExeTaskbar:") == 0)
+ {
+ ExeTaskbar[i] = line.replace("ExeTaskbar: ", "");
+
+ if ( ExeTaskbar[i] == "1")
+ {
+ NoTaskbarCheck = 0;
+ }
+ }
+ if ( line.find("ExeOwndir:") == 0)
+ {
+ ExeOwndir[i] = line.replace("ExeOwndir: ", "").toInt();
+ }
+ if ( line.find("ExeKdeCat:") == 0)
+ {
+ ExeKdeCat[i] = line.replace("ExeKdeCat: ", "");
+ }
+
+
if ( line.find("MimeExt:") == 0)
{
j++;
@@ -254,6 +295,13 @@
}
+ if (line.find("TarLines:") == 0)
+ {
+ line = line.replace("TarLines: ", "");
+ TotalLinesTar = line.toInt();
+ TotalLinesTar = 0;
+ }
+
}
file.close();
@@ -302,6 +350,16 @@
void CreateConfigSlot(void)
{
+
+ QFile GTKCheck("/Programs/" + ProgDirName + "/libs/pangorc");
+ if (GTKCheck.exists() )
+ {
+ GTKFound = 1;
+ MassageGTKFiles();
+ }
+
+
+
if ( OverWrote == 1)
{
@@ -309,7 +367,7 @@
QString line;
QString line2;
- QFile file2( "/Programs/.config/ProgList" );
+ QFile file2( "/Programs/.config/ProgList" );
if ( file2.open( IO_ReadOnly ) ) {
QTextStream stream2( &file2 );
while ( !stream2.atEnd() ) {
@@ -387,6 +445,10 @@
file.close();
}
+ // First create the special ".sbin" directory for each script executable
+ QDir sbindir;
+ sbindir.mkdir ( "/Programs/" + ProgDirName + "/.sbin", TRUE );
+
// Starts creating the scripts for each EXE
i = 0;
QString Binary;
@@ -403,39 +465,54 @@
Binary = ExePath[i];
}
- QFile file2( "/Programs/.sbin/" + Binary );
+ QFile file2( "/Programs/" + ProgDirName + "/.sbin/" + Binary );
if ( file2.open( IO_WriteOnly ) ) {
QTextStream stream2( &file2 );
stream2 << "#!/bin/sh\n";
stream2 << "# Auto-Generated by PC-BSD\n";
- stream2 << "PATH=\"/usr/local/MyPrograms/" + ProgDirName + "/bin:$PATH\"; export PATH\n";
+ stream2 << "PATH=\"/Programs/" + ProgDirName + "/bin:$PATH\"; export PATH\n";
if ( LibDir == "Auto")
{
- stream2 << "LD_LIBRARY_PATH=\"/usr/local/MyPrograms/" + ProgDirName + "/libs/\" ; export LD_LIBRARY_PATH\n";
+ stream2 << "LD_LIBRARY_PATH=\"/Programs/" + ProgDirName + "/autolibs/\" ; export LD_LIBRARY_PATH\n";
} else if ( LibDir != "NONE" ) {
- stream2 << "LD_LIBRARY_PATH=\"/usr/local/MyPrograms/" + ProgDirName + "/" + LibDir + "/\" ; export LD_LIBRARY_PATH\n";
+ stream2 << "LD_LIBRARY_PATH=\"/Programs/" + ProgDirName + "/" + LibDir + "/\" ; export LD_LIBRARY_PATH\n";
}
+
+ if ( GTKFound == 1 )
+ {
+ stream2 << "\nGDK_PIXBUF_MODULE_FILE=\"/Programs/" + ProgDirName + "/libs/etc/gtk-dir/gdk-pixbuf.loaders\" ; export GDK_PIXBUF_MODULE_FILE\n";
+ stream2 << "PANGO_RC_FILE=\"/Programs/" + ProgDirName + "/libs/pangorc\"; export PANGO_RC_FILE\n\n";
+ }
+
-
- stream2 << "/Programs/" + ProgDirName + "/" + ExePath[i] + " \"$@\"\n";
-
+ if ( RunShell[i] == "1" )
+ {
+ stream2 << "/Programs/" + ProgDirName + "/" + ExePath[i] + " \"$@\"";
+ } else {
+
+ stream2 << "STDLOG=\"${HOME}/.$$stdout\"\n";
+ stream2 << "STELOG=\"${HOME}/.$$stderr\"\n";
+ stream2 << "(((( /Programs/" + ProgDirName + "/" + ExePath[i] + " \"$@\" || /PCBSD/bin/CrashHandler \"" + ExePath[i] + "\" \"${STDLOG}\" \"${STELOG}\" ) | tee $STDLOG) 3>&1 1>&2 2>&3 | tee $STELOG) 3>&1 1>&2 2>&3)\n\n";
+ stream2 << "rm $STDLOG >/dev/null 2>/dev/null\n";
+ stream2 << "rm $STELOG >/dev/null 2>/dev/null\n";
+
+ }
+
file2.close();
}
// Chmod the new script
- QString command = "chmod 755 /Programs/.sbin/" + Binary;
- QString inputLine = getLineFromCommandOutput(command);
-
+ runCommand("chmod 755 /Programs/" + ProgDirName + "/.sbin/" + Binary);
- // Create the simlink to the fake script
- command = "ln -s /Programs/.sbin/" + Binary + " /usr/local/bin/" + Binary;
- inputLine = getLineFromCommandOutput(command);
- }
-
+
+ }
+
// Start creating the Icons now
CreateIconsSlot(i);
+
+
i++;
}
@@ -464,6 +541,8 @@
{
QString ExeTemp = ExePath[exenum];
+ //StatusLabel->setText("Creating Icons...");
+
// Get the binary name
QString Binary;
@@ -502,10 +581,22 @@
if( NoMenu[exenum] == "0" )
{
// Create the app directory / icon
+ QString SubDir;
+
+ // Find if we are installing in a subdir, or not
+ if ( ExeOwndir[exenum] == 0 )
+ {
+ SubDir = "";
+ } else if (ExeOwndir[exenum] == 1) {
+ SubDir = "/" + ExeKdeCat[exenum] + "/";
+ } else {
+ SubDir="";
+ }
+
QDir LaunchDir;
- LaunchDir.mkdir("/usr/local/share/applnk/My Programs/" + ProgramName);
+ LaunchDir.mkdir("/usr/local/share/applnk/" +SubDir + ProgramName);
- QFile diricon("/usr/local/share/applnk/My Programs/" + ProgramName + "/.directory");
+ QFile diricon("/usr/local/share/applnk/" + SubDir + ProgramName + "/.directory");
if ( diricon.open( IO_WriteOnly) ) {
QTextStream dirstream( &diricon );
dirstream << "[Desktop Entry]\n";
@@ -513,18 +604,18 @@
diricon.close();
}
- QFile file( "/usr/local/share/applnk/My Programs/" + ProgramName + "/" + Binary + ".desktop");
+ QFile file( "/usr/local/share/applnk/" + SubDir + ProgramName + "/" + Binary + ".desktop");
// Regular Program Application
- if ( ExeLink[exenum] == "0" && ExeWebLink[exenum] == "0" ) {
+ if ( ExeLink[exenum] == "0" && ExeWebLink[exenum] == "0" && ExeLink[exenum] == "0" ) {
if ( file.open( IO_WriteOnly) ) {
QTextStream stream( &file );
stream << "[Desktop Entry]\n";
stream << "Name=" + ExeDescr[exenum] + "\n";
- stream << "Exec=/usr/local/bin/" + Binary + "\n";
+ stream << "Exec=/Programs/" + ProgDirName + "/.sbin/" + Binary + "\n";
stream << "Type=Application\n";
- stream << "Path=/usr/local/MyPrograms/" + ProgDirName + "/\n";
+ stream << "Path=/Programs/" + ProgDirName + "/\n";
stream << "Icon=" + Icon + "\n";
if ( RunRoot[exenum] == "1" )
{
@@ -538,6 +629,73 @@
{
stream << "StartupNotify=false\n";
}
+
+ // Add entry to place in KDE default directories
+ if ( ExeOwndir[exenum] == 2 )
+ {
+ if ( ExeKdeCat[exenum] == "Development")
+ {
+ stream << "Categories=Qt;KDE;Development;\n";
+ }
+ if ( ExeKdeCat[exenum] == "Editors")
+ {
+ stream << "Categories=Qt;KDE;Editors;\n";
+ }
+ if ( ExeKdeCat[exenum] == "Edutainment")
+ {
+ stream << "Categories=Qt;KDE;Edutainment;\n";
+ }
+ if ( ExeKdeCat[exenum] == "Games/Arcade")
+ {
+ stream << "Categories=Qt;KDE;Game;ArcadeGame;\n";
+ }
+ if ( ExeKdeCat[exenum] == "Games/Board")
+ {
+ stream << "Categories=Qt;KDE;Game;BoardGame;\n";
+ }
+ if ( ExeKdeCat[exenum] == "Games/Card")
+ {
+ stream << "Categories=Qt;KDE;Game;CardGame;\n";
+ }
+ if ( ExeKdeCat[exenum] == "Games/Kidsgames")
+ {
+ stream << "Categories=Qt;KDE;Game;X-KDE-KidsGame;\n";
+ }
+ if ( ExeKdeCat[exenum] == "Games/TacticStrategy")
+ {
+ stream << "Categories=Qt;KDE;Game;StrategyGame;\n";
+ }
+ if ( ExeKdeCat[exenum] == "Graphics")
+ {
+ stream << "Categories=Qt;KDE;Graphics;\n";
+ }
+ if ( ExeKdeCat[exenum] == "Internet")
+ {
+ stream << "Categories=Qt;KDE;Internet;\n";
+ }
+ if ( ExeKdeCat[exenum] == "Multimedia")
+ {
+ stream << "Categories=Qt;KDE;Multimedia;\n";
+ }
+ if ( ExeKdeCat[exenum] == "Office")
+ {
+ stream << "Categories=Qt;KDE;Office;\n";
+ }
+ if ( ExeKdeCat[exenum] == "System")
+ {
+ stream << "Categories=Qt;KDE;System;\n";
+ }
+ if ( ExeKdeCat[exenum] == "Toys")
+ {
+ stream << "Categories=Qt;KDE;Toys;\n";
+ }
+ if ( ExeKdeCat[exenum] == "Utilities")
+ {
+ stream << "Categories=Qt;KDE;Utility;\n";
+ }
+
+ }
+
file.close();
}
@@ -551,7 +709,7 @@
{
link = ExePath[exenum];
} else {
- link = "/usr/local/MyPrograms/" + ProgDirName + "/" +ExePath[exenum];
+ link = "/Programs/" + ProgDirName + "/" +ExePath[exenum];
}
if ( file.open( IO_WriteOnly) ) {
@@ -563,21 +721,187 @@
stream << "Path=\n";
stream << "Type=Application\n";
stream << "StartupNotify=false\n";
- stream << "X-KDE-SubstituteUID=false\nX-KDE-Username=";
-
+ stream << "X-KDE-SubstituteUID=false\n";
+
+ // Add entry to place in KDE default directories
+ if ( ExeOwndir[exenum] == 2 )
+ {
+ if ( ExeKdeCat[exenum] == "Development")
+ {
+ stream << "Categories=Qt;KDE;Development;\n";
+ }
+ if ( ExeKdeCat[exenum] == "Editors")
+ {
+ stream << "Categories=Qt;KDE;Editors;\n";
+ }
+ if ( ExeKdeCat[exenum] == "Edutainment")
+ {
+ stream << "Categories=Qt;KDE;Edutainment;\n";
+ }
+ if ( ExeKdeCat[exenum] == "Games/Arcade")
+ {
+ stream << "Categories=Qt;KDE;Game;ArcadeGame;\n";
+ }
+ if ( ExeKdeCat[exenum] == "Games/Board")
+ {
+ stream << "Categories=Qt;KDE;Game;BoardGame;\n";
+ }
+ if ( ExeKdeCat[exenum] == "Games/Card")
+ {
+ stream << "Categories=Qt;KDE;Game;CardGame;\n";
+ }
+ if ( ExeKdeCat[exenum] == "Games/Kidsgames")
+ {
+ stream << "Categories=Qt;KDE;Game;X-KDE-KidsGame;\n";
+ }
+ if ( ExeKdeCat[exenum] == "Games/TacticStrategy")
+ {
+ stream << "Categories=Qt;KDE;Game;StrategyGame;\n";
+ }
+ if ( ExeKdeCat[exenum] == "Graphics")
+ {
+ stream << "Categories=Qt;KDE;Graphics;\n";
+ }
+ if ( ExeKdeCat[exenum] == "Internet")
+ {
+ stream << "Categories=Qt;KDE;Internet;\n";
+ }
+ if ( ExeKdeCat[exenum] == "Multimedia")
+ {
+ stream << "Categories=Qt;KDE;Multimedia;\n";
+ }
+ if ( ExeKdeCat[exenum] == "Office")
+ {
+ stream << "Categories=Qt;KDE;Office;\n";
+ }
+ if ( ExeKdeCat[exenum] == "System")
+ {
+ stream << "Categories=Qt;KDE;System;\n";
+ }
+ if ( ExeKdeCat[exenum] == "Toys")
+ {
+ stream << "Categories=Qt;KDE;Toys;\n";
+ }
+ if ( ExeKdeCat[exenum] == "Utilities")
+ {
+ stream << "Categories=Qt;KDE;Utility;\n";
+ }
+ }
file.close();
}
}
// change permissions of the directory
- QString command = "chmod -R 755 '/usr/local/share/applnk/My Programs/" + ProgramName + "'";
- runCommand(command);
+ //runCommand("chmod -R 755 /Programs/" + ProgramDirName);
+
+ }
+
+ if (NoDesktop[exenum] == "0" && ExeWebLink[exenum] != "1" )
+ {
+
+ QFile file2( "/home/" + RealUserName + "/Desktop/" + Binary + ".desktop");
+
+
+ // Regular Program Application
+ if ( ExeLink[exenum] == "0" && ExeWebLink[exenum] == "0") {
+ // Create desktop link
+
+ if ( file2.open( IO_WriteOnly) ) {
+ QTextStream stream2( &file2 );
+ stream2 << "[Desktop Entry]\n";
+ stream2 << "Name=" + ExeDescr[exenum] + "\n";
+ stream2 << "Exec=/Programs/" + ProgDirName + "/.sbin/" + Binary + "\n";
+ stream2 << "Type=Application\n";
+ stream2 << "Path=/Programs/" + ProgDirName + "/\n";
+ stream2 << "Icon=" + Icon + "\n";
+
+ if ( RunRoot[exenum] == "1" )
+ {
+ stream2 << "X-KDE-SubstituteUID=true\nX-KDE-Username=root\n";
+ }
+ if ( RunShell[exenum] == "1" )
+ {
+ stream2 << "Terminal=true\nTerminalOptions=\n";
+ }
+ if ( Notify[exenum] == "0" )
+ {
+ stream2 << "StartupNotify=false\n";
+ }
+
+ file2.close();
+ }
+
+ } else {
+
+
+ QString link;
+
+ if ( ExeWebLink[exenum] == "1" )
+ {
+ link = ExePath[exenum];
+ } else {
+ link = "/Programs/" + ProgDirName + "/" +ExePath[exenum];
+ }
+
+
+ if ( file2.open( IO_WriteOnly) ) {
+ QTextStream stream2( &file2 );
+ stream2 << "[Desktop Entry]\n";
+ stream2 << "Exec=kfmclient exec '" << link << "'\n";
+ stream2 << "Icon=" + Icon + "\n";
+ stream2 << "Name=" + ExeDescr[exenum] + "\n";
+ stream2 << "Path=\n";
+ stream2 << "Type=Application\n";
+ stream2 << "StartupNotify=false\n";
+ stream2 << "X-KDE-SubstituteUID=false\nX-KDE-Username=";
+
+ file2.close();
+ }
+
+ }
+
+ // change owner of file
+ if ( RealUserName == "root" ) {
+ runCommand("chown -R root:wheel /root/Desktop/" + Binary + ".desktop" );
+ } else {
+ runCommand("chown -R " + RealUserName + ":" + RealUserName + " /home/" + RealUserName + "/Desktop/" + Binary + ".desktop" );
+ }
+
}
+ if ( ExeTaskbar[exenum] == "1" && ExeWebLink[exenum] != "1" )
+ {
+
+ QString ShellOption;
+
+ if ( RunShell[exenum] == "1" )
+ {
+ ShellOption = "TRUE";
+ } else {
+ ShellOption = "FALSE";
+ }
+
+
+ QFile file3( "dcop.sh");
+ if ( file3.open( IO_WriteOnly) ) {
+ QTextStream stream3( &file3 );
+ stream3 << "#!/bin/sh\n";
+ stream3 << "dcop --user " + RealUserName + " kicker Panel addNonKDEAppButton \"" + ExeDescr[exenum] + "\" \"" + ExeDescr[exenum] + "\" \"/Programs/" + ProgDirName + "/.sbin/" + Binary + "\" \"" + Icon + "\" \"\" " + ShellOption + "\n";
+
+ }
+
+ file3.close();
+
+ // Now run the dcop command
+ runCommand("sh dcop.sh");
+
+ }
+
+
}
@@ -593,7 +917,7 @@
{
cout << "Running install script...\n";
// Run the programs SetupScript
- QString command = "/Programs/" + ProgDirName + "/PBI.SetupScript.sh " + ProgDirName + " root >/dev/null 2>/dev/null";
+ QString command = "/Programs/" + ProgDirName + "/PBI.SetupScript.sh " + ProgDirName + " " + RealUserName + " >/dev/null 2>/dev/null";
runCommand(command);
}
@@ -665,11 +989,11 @@
}
// Chmod the new file
- QString command = "chmod 755 /usr/local/share/applnk/.hidden/" + ProgramName + MimeNumString + ".desktop";
+ QString command = "chmod 755 '/usr/local/share/applnk/.hidden/" + ProgramName + MimeNumString + ".desktop'";
runCommand(command);
// Chmod the new file
- command = "chmod 755 /usr/local/share/minelnk/applications/" + ProgramName + MimeNumString + ".desktop";
+ command = "chmod 755 '/usr/local/share/mimelnk/application/" + ProgramName + MimeNumString + ".desktop'";
runCommand(command);
}
@@ -722,3 +1046,85 @@
}
+
+void MassageGTKFiles()
+{
+
+ QString EditFile;
+ QString tmp;
+ QString line;
+
+ // Create the pangorc file
+ QFile GTKCheck("/Programs/" + ProgDirName + "/libs/pangorc");
+ if ( GTKCheck.open( IO_WriteOnly) ) {
+ QTextStream stream( >KCheck );
+ stream << "[Pango]\n";
+ stream << "ModuleFiles=/Programs/" + ProgDirName + "/libs/etc/pango-dir/pango.modules\n";
+ stream << "[PangoX]\n";
+ stream << "AliasFiles=/Programs/" +ProgDirName + "/libs/etc/pango-dir/pangox.aliases";
+
+ }
+
+ // Edit the GTK etc files
+ QFile file( "/Programs/" + ProgDirName + "/libs/etc/gtk-dir/gdk-pixbuf.loaders" );
+ if ( file.open( IO_ReadOnly ) ) {
+ QTextStream stream( &file );
+
+ while ( !stream.atEnd() ) {
+ line = stream.readLine(); // line of text excluding '\n'
+ if ( line.find("\"/usr/X11R6/lib/gtk" ) == 0)
+ {
+ tmp = line.replace("\"/usr/X11R6/lib/", "");
+ //tmp.remove(0, tmp.find("/") + 1 );
+ tmp = "\"/Programs/" + ProgDirName + "/libs/" + tmp;
+ EditFile = EditFile + tmp + "\n";
+ } else {
+ EditFile = EditFile + line + "\n";
+ }
+ }
+
+ }
+
+ file.close();
+
+ QFile GTKWrite("/Programs/" + ProgDirName + "/libs/etc/gtk-dir/gdk-pixbuf.loaders");
+ if ( GTKWrite.open( IO_WriteOnly) ) {
+ QTextStream streamGTK( >KWrite );
+ streamGTK << EditFile;
+ }
+ GTKWrite.close();
+ EditFile = "";
+
+ // Edit the GTK etc files
+ QFile Pangofile( "/Programs/" + ProgDirName + "/libs/etc/pango-dir/pango.modules" );
+ if ( Pangofile.open( IO_ReadOnly ) ) {
+ QTextStream stream2( &Pangofile );
+
+ while ( !stream2.atEnd() ) {
+ line = stream2.readLine(); // line of text excluding '\n'
+ if ( line.find("/usr/X11R6/lib/pango" ) == 0)
+ {
+ tmp = line.replace("/usr/X11R6/lib/", "");
+ //tmp.remove(0, tmp.find("/") + 1 );
+ tmp = "/Programs/" + ProgDirName + "/libs/" + tmp;
+ EditFile = EditFile + tmp + "\n";
+ } else {
+ EditFile = EditFile + line + "\n";
+ }
+ }
+
+ }
+
+ Pangofile.close();
+
+ QFile PangoWrite("/Programs/" + ProgDirName + "/libs/etc/pango-dir/pango.modules");
+ if ( PangoWrite.open( IO_WriteOnly) ) {
+ QTextStream streamPango( &PangoWrite );
+ streamPango << EditFile;
+ }
+
+ PangoWrite.close();
+
+ EditFile = "";
+
+}
More information about the Commits
mailing list