Made program functional again

git-svn-id: svn://anonsvn.kde.org/home/kde/branches/trinity/applications/kdpkg@1110662 283d02a7-25f6-0310-bc7c-ecb5cbfe19da
v3.5.13-sru
tpearson 15 years ago
parent 36c0c6f709
commit 01a3b7ad44

@ -9,7 +9,7 @@ METASOURCES = AUTO
# the application source, library search path, and link libraries # the application source, library search path, and link libraries
kdpkg_install_SOURCES = main.cpp install.cpp installdialog.ui process.cpp console.cpp consoledialog.ui kdpkg_install_SOURCES = main.cpp install.cpp installdialog.ui process.cpp console.cpp consoledialog.ui
kdpkg_install_LDFLAGS = $(KDE_RPATH) $(all_libraries) kdpkg_install_LDFLAGS = $(KDE_RPATH) $(all_libraries) -lkio
kdpkg_install_LDADD = $(LIB_KDEUI) kdpkg_install_LDADD = $(LIB_KDEUI)

@ -28,21 +28,51 @@
#include <qwidgetstack.h> #include <qwidgetstack.h>
#include <qlistview.h> #include <qlistview.h>
#include <qtextedit.h> #include <qtextedit.h>
#include <qstring.h>
#include <qlabel.h> #include <qlabel.h>
#include <qpushbutton.h> #include <qpushbutton.h>
#include "console.h" #include "console.h"
#include <string>
#include <stdio.h>
using namespace std;
console::console(QWidget *parent, const QStrList &run, const char *name, const QStringList &) console::console(QWidget *parent, const QStrList &run, const char *name, const QStringList &)
: Widget(parent,name) : Widget(parent,name)
{ {
// Get KDE prefix
// FIXME Is there a better way to do this???
string prefixcommand="kde-config --prefix";
FILE *pipe_prefix;
char prefix_result[2048];
int i;
if ((pipe_prefix = popen(prefixcommand.c_str(), "r")) == NULL)
{
m_kdePrefix = "/usr";
}
else {
fgets(prefix_result, 2048, pipe_prefix);
pclose(pipe_prefix);
for (i=0;i<2048;i++) {
if (prefix_result[i] == 0) {
prefix_result[i-1]=0;
i=2048;
}
}
m_kdePrefix = QString(prefix_result);
}
//label->setText( name ); //label->setText( name );
loadKonsole(); loadKonsole();
konsoleFrame->installEventFilter( this ); konsoleFrame->installEventFilter( this );
// run command // run command
terminal()->startProgram( "/usr/share/kdpkg/sh/kdpkg-sh", run ); terminal()->startProgram( m_kdePrefix + "/share/kdpkg/sh/kdpkg-sh", run );
connect( konsole, SIGNAL(destroyed()), this, SLOT( finish() ) ); connect( konsole, SIGNAL(destroyed()), this, SLOT( finish() ) );
} }

@ -24,6 +24,8 @@
#include "consoledialog.h" #include "consoledialog.h"
#include <qstring.h>
#include <kde_terminal_interface.h> #include <kde_terminal_interface.h>
#include <kparts/part.h> #include <kparts/part.h>
@ -39,6 +41,7 @@ class console : public Widget
return static_cast<ExtTerminalInterface*>(konsole->qt_cast( "ExtTerminalInterface" ) ); return static_cast<ExtTerminalInterface*>(konsole->qt_cast( "ExtTerminalInterface" ) );
} }
virtual bool eventFilter( QObject *o, QEvent *e ); virtual bool eventFilter( QObject *o, QEvent *e );
QString m_kdePrefix;
public slots: public slots:
virtual void finish(); virtual void finish();

@ -21,6 +21,7 @@
#include <kgenericfactory.h> #include <kgenericfactory.h>
#include <klocale.h> #include <klocale.h>
#include <kfiledialog.h>
#include <kurlrequester.h> #include <kurlrequester.h>
#include <kaboutapplication.h> #include <kaboutapplication.h>
@ -37,13 +38,17 @@
#include <console.h> #include <console.h>
#include <install.h> #include <install.h>
#include <string>
#include <stdio.h>
using namespace std;
install::install( const QString &url, QWidget *parent, const char *name, const QStringList &) install::install( const QString &url, QWidget *parent, const char *name, const QStringList &)
:InstallDialog(parent, name) :InstallDialog(parent, name)
{ {
if( !url ) if( !url )
path = QFileDialog::getOpenFileName( "", i18n("Debian Package (*.deb)"), this, i18n("open file dialog"), i18n("Choose a file to open") ); path = KFileDialog::getOpenFileName( QString::null, i18n("Debian Package (*.deb)"), this, i18n("Choose a Debian package file to open"));
else else
path = url; path = url;
@ -56,7 +61,28 @@ install::install( const QString &url, QWidget *parent, const char *name, const Q
installPushButton->hide(); installPushButton->hide();
nextPushButton1->hide(); nextPushButton1->hide();
// Get KDE prefix
// FIXME Is there a better way to do this???
string prefixcommand="kde-config --prefix";
FILE *pipe_prefix;
char prefix_result[2048];
int i;
if ((pipe_prefix = popen(prefixcommand.c_str(), "r")) == NULL)
{
m_kdePrefix = "/usr";
}
else {
fgets(prefix_result, 2048, pipe_prefix);
pclose(pipe_prefix);
for (i=0;i<2048;i++) {
if (prefix_result[i] == 0) {
prefix_result[i-1]=0;
i=2048;
}
}
m_kdePrefix = QString(prefix_result);
}
if( !checkArchitecture() ) if( !checkArchitecture() )
page2x1(); page2x1();
@ -116,7 +142,7 @@ void install::page1()
void install::page2x1() void install::page2x1()
{ {
errorTextLabel->setText("<b>"+i18n("The architecture of the package and the system doesn't match! You will not be able to install this package!")+"</b>"); errorTextLabel->setText("<b>"+i18n("The architecture of this package does not match that of your system. You will not be able to install this package!")+"</b>");
nextPushButton2->hide(); nextPushButton2->hide();
widgetStack->raiseWidget(2); widgetStack->raiseWidget(2);
@ -133,10 +159,10 @@ void install::page2x2()
void install::page3() void install::page3()
{ {
titleTextLabel->setText( "<b>"+i18n( "Resynchronization of the package index files.")+"</b>" ); titleTextLabel->setText( "<b>"+i18n( "Resynchronize Package Index")+"</b>" );
closePushButton->hide(); closePushButton->hide();
QStrList run; run.append( "/usr/share/kdpkg/sh/kdpkg-sh" ); QStrList run; run.append( m_kdePrefix + "/share/kdpkg/sh/kdpkg-sh" );
run.append( "update" ); run.append( "update" );
QWidget *consoleWidget = new console(this, run ); QWidget *consoleWidget = new console(this, run );
@ -151,7 +177,7 @@ void install::page4()
{ {
installPushButton->hide(); installPushButton->hide();
closePushButton->hide(); closePushButton->hide();
titleTextLabel->setText( "<b>"+i18n( "Installation of the new package." )+"</b>" ); titleTextLabel->setText( "<b>"+i18n( "Install New Package" )+"</b>" );
if( !installPkg ) if( !installPkg )
@ -159,7 +185,7 @@ void install::page4()
if( !removePkg ) if( !removePkg )
removePkg = "none"; removePkg = "none";
QStrList run; run.append( "/usr/share/kdpkg/sh/kdpkg-sh" ); QStrList run; run.append( m_kdePrefix + "/share/kdpkg/sh/kdpkg-sh" );
run.append( "install" ); run.append( "install" );
run.append( path ); run.append( path );
run.append( installPkg ); run.append( installPkg );
@ -181,6 +207,8 @@ void install::page4()
void install::showDependencies() void install::showDependencies()
{ {
int start_index;
int stop_index;
// show packages which will be installed // show packages which will be installed
@ -214,7 +242,11 @@ void install::showDependencies()
} }
} }
while (missingDepends.find("(") != -1) {
start_index = missingDepends.find("(");
stop_index = missingDepends.find(")", start_index);
missingDepends.replace(start_index, stop_index-start_index+1, "");
}
this->shell->setCommand("apt-get -s install "+missingDepends); this->shell->setCommand("apt-get -s install "+missingDepends);
this->shell->start(true); this->shell->start(true);
QStringList installList = QStringList::split( "\n", this->shell->getBuffer().stripWhiteSpace() ).grep("Inst"); QStringList installList = QStringList::split( "\n", this->shell->getBuffer().stripWhiteSpace() ).grep("Inst");
@ -234,7 +266,7 @@ void install::showDependencies()
pkgVersion = QStringList::split( " ", installList[i] )[2].mid(1); pkgVersion = QStringList::split( " ", installList[i] )[2].mid(1);
QListViewItem * item = new QListViewItem( dependenciesListView, 0 ); QListViewItem * item = new QListViewItem( dependenciesListView, 0 );
item->setPixmap( 0, QPixmap( "/usr/share/kdpkg/icons/install.png") ); item->setPixmap( 0, QPixmap( m_kdePrefix + "/share/kdpkg/icons/install.png") );
item->setText( 1, name ); item->setText( 1, name );
item->setText( 2, pkgVersion ); item->setText( 2, pkgVersion );
item->setText( 3, sysVersion ); item->setText( 3, sysVersion );
@ -288,6 +320,11 @@ void install::showDependencies()
QString conflicts = fields.grep( "Conflicts" )[0].mid(11); QString conflicts = fields.grep( "Conflicts" )[0].mid(11);
conflicts = conflicts.replace( ",", "" ); conflicts = conflicts.replace( ",", "" );
conflicts = conflicts+" "+rconflicts; conflicts = conflicts+" "+rconflicts;
while (conflicts.find("(") != -1) {
start_index = conflicts.find("(");
stop_index = conflicts.find(")", start_index);
conflicts.replace(start_index, stop_index-start_index+1, "");
}
this->shell->setCommand("apt-get -s remove "+conflicts); this->shell->setCommand("apt-get -s remove "+conflicts);
this->shell->start(true); this->shell->start(true);
@ -300,7 +337,7 @@ void install::showDependencies()
QString sysVersion = QStringList::split( " [", removeList[i] )[1].replace("]", ""); QString sysVersion = QStringList::split( " [", removeList[i] )[1].replace("]", "");
QListViewItem * item = new QListViewItem( dependenciesListView, 0 ); QListViewItem * item = new QListViewItem( dependenciesListView, 0 );
item->setPixmap( 0, QPixmap( "/usr/share/kdpkg/icons/remove.png") ); item->setPixmap( 0, QPixmap( m_kdePrefix + "/share/kdpkg/icons/remove.png") );
item->setText( 1, name ); item->setText( 1, name );
item->setText( 3, sysVersion ); item->setText( 3, sysVersion );

@ -37,6 +37,7 @@ class install : public InstallDialog
QString removePkg; QString removePkg;
QString path; QString path;
QStringList fields; QStringList fields;
QString m_kdePrefix;
bool isInstalled(QString); bool isInstalled(QString);
bool checkArchitecture(); bool checkArchitecture();
bool isLocked(); bool isLocked();

@ -43,10 +43,11 @@ int main(int argc, char **argv)
about->setProgramLogo( QImage("/usr/share/icons/hicolor/32x32/apps/kdpkg.png") ); about->setProgramLogo( QImage("/usr/share/icons/hicolor/32x32/apps/kdpkg.png") );
about->setShortDescription( I18N_NOOP("Frontend for dpkg.") ); about->setShortDescription( I18N_NOOP("Frontend for dpkg.") );
about->setLicense(KAboutData::License_GPL_V2); about->setLicense(KAboutData::License_GPL_V2);
about->setHomepage("http://linux.wuertz.org"); about->setHomepage("http://trinity.pearsoncomputing.net");
about->setBugAddress("xadras@sidux.com"); about->setBugAddress("http://bugs.pearsoncomputing.net");
about->setCopyrightStatement("(c) 2007 Fabian Würtz"); about->setCopyrightStatement("(c) 2010 Timothy Pearson\r(c) 2007 Fabian Würtz");
about->addAuthor("Timothy Pearson (Trinity Project)", I18N_NOOP("Developer"), "kb9vqf@pearsoncomputing.net", "http://trinity.pearsoncomputing.net");
about->addAuthor("Fabian Würtz (xadras)", I18N_NOOP("Developer"), "xadras@sidux.com", "http://linux.wuertz.org/"); about->addAuthor("Fabian Würtz (xadras)", I18N_NOOP("Developer"), "xadras@sidux.com", "http://linux.wuertz.org/");

@ -23,7 +23,7 @@
_process->clearArguments(); _process->clearArguments();
_buffer = QString::null; _buffer = QString::null;
*_process << "/bin/sh"; *_process << "/bin/bash";
*_process << "-c"; *_process << "-c";
*_process << command; *_process << command;
} }

@ -1,12 +1,19 @@
#!/bin/sh #!/bin/bash
# (C) Fabian Wuertz Feb 2008 # (c) 2010 Timothy Pearson
# (c) Fabian Wuertz Feb 2008
if [ "$1" == "update" ]; then if [ "$1" == "update" ]; then
apt-get update apt-get update
echo "" if [ $? -eq 0 ]; then
echo "Done! Press enter to continuo." echo ""
read echo "Update OK"
else
echo ""
echo "Errors were encountered while updating the package index"
echo "Please press enter to continue"
read
fi
fi fi
if [ "$1" == "install" ]; then if [ "$1" == "install" ]; then
@ -19,10 +26,22 @@ if [ "$1" == "install" ]; then
apt-get remove $removePackage apt-get remove $removePackage
fi fi
dpkg -i $2 dpkg -i $2
apt-get install -f if [ $? -eq 0 ]; then
echo "" apt-get install -f
echo "Done! Press enter to continuo." if [ $? -eq 0 ]; then
read echo ""
echo "Installation OK"
else
echo ""
echo "Errors were encountered while installing your package"
echo "Please press enter to exit"
read
fi
else
echo ""
echo "Errors were encountered while installing your package"
echo "Please press enter to continue"
read
fi
fi fi

@ -9,7 +9,7 @@ METASOURCES = AUTO
# the application source, library search path, and link libraries # the application source, library search path, and link libraries
kdpkg_SOURCES = main.cpp kdpkg.cpp kdpkgdialog.ui process.cpp kdpkg_SOURCES = main.cpp kdpkg.cpp kdpkgdialog.ui process.cpp
kdpkg_LDFLAGS = $(KDE_RPATH) $(all_libraries) kdpkg_LDFLAGS = $(KDE_RPATH) $(all_libraries) -lkio
kdpkg_LDADD = $(LIB_KDEUI) kdpkg_LDADD = $(LIB_KDEUI)

@ -18,6 +18,7 @@
*/ */
#include <kfiledialog.h>
#include <kmessagebox.h> #include <kmessagebox.h>
#include <kgenericfactory.h> #include <kgenericfactory.h>
#include <kaboutapplication.h> #include <kaboutapplication.h>
@ -44,7 +45,7 @@ kdpkg::kdpkg( const QString &url, QWidget *parent, const char *name, const QStri
if( !url ) if( !url )
path = QFileDialog::getOpenFileName( "", i18n("Debian Package (*.deb)"), this, i18n("open file dialog"), i18n("Choose a file to open") ); path = KFileDialog::getOpenFileName( QString::null, i18n("Debian Package (*.deb)"), this, i18n("Choose a Debian package file to open"));
else else
path = url; path = url;

@ -43,10 +43,11 @@ int main(int argc, char **argv)
about->setProgramLogo( QImage("/usr/share/icons/hicolor/32x32/apps/kdpkg.png") ); about->setProgramLogo( QImage("/usr/share/icons/hicolor/32x32/apps/kdpkg.png") );
about->setShortDescription( I18N_NOOP("Frontend for dpkg.") ); about->setShortDescription( I18N_NOOP("Frontend for dpkg.") );
about->setLicense(KAboutData::License_GPL_V2); about->setLicense(KAboutData::License_GPL_V2);
about->setHomepage("http://linux.wuertz.org"); about->setHomepage("http://trinity.pearsoncomputing.net");
about->setBugAddress("xadras@sidux.com"); about->setBugAddress("http://bugs.pearsoncomputing.net");
about->setCopyrightStatement("(c) 2007 Fabian Würtz"); about->setCopyrightStatement("(c) 2010 Timothy Pearson\r(c) 2007 Fabian Würtz");
about->addAuthor("Timothy Pearson (Trinity Project)", I18N_NOOP("Developer"), "kb9vqf@pearsoncomputing.net", "http://trinity.pearsoncomputing.net");
about->addAuthor("Fabian Würtz (xadras)", I18N_NOOP("Developer"), "xadras@sidux.com", "http://xadras.wordpress.com/"); about->addAuthor("Fabian Würtz (xadras)", I18N_NOOP("Developer"), "xadras@sidux.com", "http://xadras.wordpress.com/");

Loading…
Cancel
Save