summaryrefslogtreecommitdiff
authortille <tille>2002-04-27 21:02:53 (UTC)
committer tille <tille>2002-04-27 21:02:53 (UTC)
commit69e271e44d23befc74a96a98708ddb6ec754a4b6 (patch) (side-by-side diff)
tree6f8300d8858d2c7659eb90066b58b302a2863e43
parentacdc33336307e48ac7089b146006fe7b36e321a5 (diff)
downloadopie-69e271e44d23befc74a96a98708ddb6ec754a4b6.zip
opie-69e271e44d23befc74a96a98708ddb6ec754a4b6.tar.gz
opie-69e271e44d23befc74a96a98708ddb6ec754a4b6.tar.bz2
setDocument working and some changes in install gui
Diffstat (more/less context) (show whitespace changes)
-rw-r--r--noncore/unsupported/oipkg/TODO1
-rw-r--r--noncore/unsupported/oipkg/debug.h2
-rw-r--r--noncore/unsupported/oipkg/mainwindow.cpp145
-rw-r--r--noncore/unsupported/oipkg/mainwindow.h22
-rw-r--r--noncore/unsupported/oipkg/oipkg.pro5
-rw-r--r--noncore/unsupported/oipkg/package.cpp42
-rw-r--r--noncore/unsupported/oipkg/package.h4
-rw-r--r--noncore/unsupported/oipkg/packagelistview.cpp91
-rw-r--r--noncore/unsupported/oipkg/packagelistview.h53
-rw-r--r--noncore/unsupported/oipkg/pmipkg.cpp132
-rw-r--r--noncore/unsupported/oipkg/pmipkg.h2
-rw-r--r--noncore/unsupported/oipkg/runwindow.ui32
12 files changed, 331 insertions, 200 deletions
diff --git a/noncore/unsupported/oipkg/TODO b/noncore/unsupported/oipkg/TODO
index b07542a..3fc84e5 100644
--- a/noncore/unsupported/oipkg/TODO
+++ b/noncore/unsupported/oipkg/TODO
@@ -9,2 +9,3 @@
* manage links
* dependency checking \ No newline at end of file
+* ipkg options in runwindow \ No newline at end of file
diff --git a/noncore/unsupported/oipkg/debug.h b/noncore/unsupported/oipkg/debug.h
index e73b9b2..973d96c 100644
--- a/noncore/unsupported/oipkg/debug.h
+++ b/noncore/unsupported/oipkg/debug.h
@@ -16,5 +16,5 @@ if ( debugLevel < 3 ) \
}else{\
if ( I <= debugLevel ) \
- printf("# %s \t\t(Level: %i)\n",QString(S).latin1(),I);\
+ qDebug("# %s \t\t(Level: %i)\n",QString(S).latin1(),I);\
}
diff --git a/noncore/unsupported/oipkg/mainwindow.cpp b/noncore/unsupported/oipkg/mainwindow.cpp
index e3abf36..6bf9a7a 100644
--- a/noncore/unsupported/oipkg/mainwindow.cpp
+++ b/noncore/unsupported/oipkg/mainwindow.cpp
@@ -15,4 +15,5 @@
#include <qstring.h>
#include <qlabel.h>
+#include <qfile.h>
#include <qlistview.h>
#include <qtextview.h>
@@ -28,9 +29,10 @@ MainWindow::MainWindow( QWidget *parent, const char *name, WFlags f = 0 ) :
QMainWindow( parent, name, f )
{
- setCaption( tr("Package Manager") );
+ settings = new PackageManagerSettings(this,0,TRUE);
+ listViewPackages = new PackageListView( this,"listViewPackages",settings );
+ ipkg = new PmIpkg( settings, this );
- listViewPackages = new QListView( this,0,0 );
- listViewPackages->setSelectionMode(QListView::NoSelection);
setCentralWidget( listViewPackages );
+ setCaption( tr("Package Manager") );
channel = new QCopChannel( "QPE/Application/oipkg", this );
@@ -39,35 +41,9 @@ MainWindow::MainWindow( QWidget *parent, const char *name, WFlags f = 0 ) :
makeMenu();
-#ifdef NEWLAYOUT
- listViewPackages->addColumn( tr("Package") );
- listViewPackages->setRootIsDecorated( true );
-#endif
-#ifndef NEWLAYOUT
- QFontMetrics fm = fontMetrics();
- int wlw = width()*2;
- int w0 = fm.width(tr("Package"))+30;
- // int w0 = fm.width(tr("Package"))+30;
- int w2 = fm.width("00000")+4;
- int w1 = wlw-w2-w0-24;
- listViewPackages->addColumn( tr("Package"), w0 );
- listViewPackages->addColumn( tr("Description"), w1 );
- listViewPackages->addColumn( tr("Size"), w2 );
- listViewPackages->setColumnWidthMode(0,QListView::Manual);
- listViewPackages->setColumnWidthMode(1,QListView::Manual);
- listViewPackages->setColumnWidthMode(2,QListView::Manual);
- listViewPackages->setSelectionMode( QListView::Multi );
-#endif
+
connect( section, SIGNAL( activated(int) ),
this, SLOT( sectionChanged() ) );
connect( subsection, SIGNAL(activated(int) ),
this, SLOT( subSectionChanged() ) );
- connect( listViewPackages, SIGNAL( pressed( QListViewItem* ) ),
- this, SLOT( setCurrent( QListViewItem* ) ) );
- connect( listViewPackages, SIGNAL( clicked( QListViewItem* ) ),
- this, SLOT( stopTimer( QListViewItem* ) ) );
-
- popupMenu = new QPopupMenu( this );
-
- settings = new PackageManagerSettings(this,0,TRUE);
ipkg = new PmIpkg( settings, this );
@@ -89,9 +65,4 @@ void MainWindow::makeMenu()
// QPopupMenu *sectMenu = new QPopupMenu( menuBar );
- popupMenu = new QPopupMenu( this );
- destsMenu = new QPopupMenu( popupMenu );
- popupTimer = new QTimer( this );
- connect( popupTimer, SIGNAL(timeout()), this, SLOT(showPopup()) );
-
setToolBarsMovable( false );
toolBar->setHorizontalStretchable( true );
@@ -124,11 +95,12 @@ void MainWindow::makeMenu()
updateAction->addTo( srvMenu );
- detailsAction = new QAction( tr( "Details" ),
- Resource::loadIconSet( "find" ),
- QString::null, 0, this, 0 );
- connect( detailsAction, SIGNAL( activated() ),
- this , SLOT( showDetails() ) );
- detailsAction->addTo( toolBar );
- detailsAction->addTo( srvMenu );
+// would we use for find
+// detailsAction = new QAction( tr( "Details" ),
+// Resource::loadIconSet( "find" ),
+// QString::null, 0, this, 0 );
+// connect( detailsAction, SIGNAL( activated() ),
+// this , SLOT( showDetails() ) );
+// detailsAction->addTo( toolBar );
+// detailsAction->addTo( srvMenu );
QAction *cfgact;
@@ -317,43 +289,4 @@ void MainWindow::showSettingsDst()
}
-
-void MainWindow::showDetails()
-{
- if ( details )
- {
- details = new PackageDetails( this );
- connect( details->install, SIGNAL(clicked()), SLOT( toggleActivePackage() ) );
- connect( details->remove, SIGNAL(clicked()), SLOT( toggleActivePackage() ) );
- connect( details->ignore, SIGNAL(clicked()), details, SLOT(close()));
- details->description->setTextFormat(RichText);
- }
- if ( !activePackage )
- {
- details->description->setText(tr("no package selected"));
- details->description->setText(tr("errmm...<br>...not working?"));
- }else{
- details->setCaption("Package: " + activePackage->name());
- details->description->setText(activePackage->details() );
- details->install->setEnabled(!activePackage->installed());
- details->remove->setEnabled(activePackage->installed());
- }
- details->showMaximized();
-}
-
-void MainWindow::toggleActivePackage()
-{
- activePackage->toggleProcess();
- if ( details ) details->close();
-}
-
-void MainWindow::setCurrent( QListViewItem* p )
-{
- if ( !p ) return;
- activePackageListItem = (PackageListItem*)p;
- activePackage = activePackageListItem->getPackage();
- pvDebug(5, "start timer");
- popupTimer->start( 750, true );
-}
-
void MainWindow::sectionShow(bool b)
{
@@ -390,39 +323,27 @@ void MainWindow::rotateUpdateIcon()
}
-void MainWindow::showPopup()
-{
- popupMenu->clear();
- destsMenu->clear();
-
- QAction *popupAction;
- popupMenu->insertItem( tr("Install to"), destsMenu );
- QStringList dests = settings->getDestinationNames();
- for (uint i = 0; i < dests.count(); i++ )
- {
- popupAction = new QAction( dests[i], QString::null, 0, this, 0 );
- popupAction->addTo( destsMenu );
- }
- connect( destsMenu, SIGNAL( activated( int ) ),
- this, SLOT( changePackageDest( int ) ) );
- popupMenu->popup( QCursor::pos() );
-}
-
-void MainWindow::changePackageDest( int i )
-{
- activePackage->setDest( destsMenu->text(i) );
- activePackage->setOn();
- activePackage->setLink( settings->createLinks() );
- activePackageListItem->displayDetails();
-}
-void MainWindow::stopTimer( QListViewItem* )
+void MainWindow::setDocument(const QString &fileName)
{
- pvDebug( 5, "stop timer" );
- popupTimer->stop();
+ installFile(fileName);
+ // ##### If we looked in the list of files, we could send out accurate
+ // ##### messages. But we don't bother yet, and just do an "all".
+ QCopEnvelope e("QPE/System", "linkChanged(QString)");
+ QString lf = QString::null;
+ e << lf;
+ displayList();
}
-void MainWindow::setDocument(const QString &fileName)
+void MainWindow::installFile(const QString &fileName)
{
+ pvDebug(3, "MainWindow::installFile "+fileName);
+ if ( !QFile::exists( fileName ) ) return;
ipkg->installFile( fileName );
+ // ##### If we looked in the list of files, we could send out accurate
+ // ##### messages. But we don't bother yet, and just do an "all".
+ QCopEnvelope e("QPE/System", "linkChanged(QString)");
+ QString lf = QString::null;
+ e << lf;
+ displayList();
}
@@ -430,7 +351,7 @@ void MainWindow::receive(const QCString &msg, const QByteArray &arg)
{
pvDebug(3, "QCop "+msg);
- if ( msg == "setDocument(QString)" )
+ if ( msg == "installFile(QString)" )
{
- setDocument( QString(arg) );
+ installFile( QString(arg) );
}
} \ No newline at end of file
diff --git a/noncore/unsupported/oipkg/mainwindow.h b/noncore/unsupported/oipkg/mainwindow.h
index 34943f2..bcb0cc9 100644
--- a/noncore/unsupported/oipkg/mainwindow.h
+++ b/noncore/unsupported/oipkg/mainwindow.h
@@ -10,10 +10,9 @@
#include "pmipkg.h"
#include "pksettings.h"
-#include "pkdesc.h"
+#include "packagelistview.h"
class QComboBox;
class QPEToolBar;
class QLineEdit;
-class QListView;
class PackageListItem;
class QCopChannel;
@@ -40,10 +39,6 @@ protected slots:
void showSettingsSrv();
void showSettingsDst();
- void setDocument (const QString &);
public slots:
- void showDetails();
- void toggleActivePackage();
- void setCurrent( QListViewItem* );
void sectionClose();
void sectionShow(bool);
@@ -51,8 +46,6 @@ public slots:
void findShow(bool);
void filterList();
- void showPopup();
- void changePackageDest( int );
- void stopTimer( QListViewItem* );
void receive (const QCString &, const QByteArray &);
+ void setDocument (const QString &);
private:
@@ -60,11 +53,10 @@ private:
void setSections();
void setSubSections();
+ void installFile(const QString &);
+ bool updateIcon;
PmIpkg* ipkg;
PackageManagerSettings *settings;
- PackageDetails* details;
PackageList packageList;
- Package *activePackage;
- PackageListItem *activePackageListItem;
QAction *runAction;
QAction *detailsAction;
@@ -72,5 +64,5 @@ private:
QAction *findAction;
QAction *sectionAction;
- QListView *listViewPackages;
+ PackageListView *listViewPackages;
QPEToolBar *findBar;
QLineEdit *findEdit;
@@ -78,8 +70,4 @@ private:
QComboBox *section;
QComboBox *subsection;
- QTimer *popupTimer;
- QPopupMenu *popupMenu;
- QPopupMenu *destsMenu;
- bool updateIcon;
private slots:
void rotateUpdateIcon();
diff --git a/noncore/unsupported/oipkg/oipkg.pro b/noncore/unsupported/oipkg/oipkg.pro
index 955c7f3..1f7a70d 100644
--- a/noncore/unsupported/oipkg/oipkg.pro
+++ b/noncore/unsupported/oipkg/oipkg.pro
@@ -8,7 +8,9 @@ HEADERS = mainwindow.h \
packagelistitem.h \
packagelist.h \
+ packagelistview.h \
package.h
SOURCES = main.cpp \
mainwindow.cpp \
+ packagelistview.cpp \
pksettings.cpp \
pmipkg.cpp \
@@ -19,6 +21,5 @@ INCLUDEPATH += $(OPIEDIR)/include
DEPENDPATH += $(OPIEDIR)/ioclude
LIBS += -lqpe
-INTERFACES = pkdesc.ui \
- runwindow.ui \
+INTERFACES = runwindow.ui \
pksettingsbase.ui
TARGET = oipkg
diff --git a/noncore/unsupported/oipkg/package.cpp b/noncore/unsupported/oipkg/package.cpp
index 9f602b5..5f0e5fa 100644
--- a/noncore/unsupported/oipkg/package.cpp
+++ b/noncore/unsupported/oipkg/package.cpp
@@ -3,4 +3,8 @@
#include <qpe/process.h>
#include <qpe/stringutil.h>
+#include <qfile.h>
+#include <qtextstream.h>
+#include <stdlib.h>
+#include <unistd.h>
#include "debug.h"
@@ -26,5 +30,6 @@ void Package::init( PackageManagerSettings *s )
_toProcess = false;
_status = "";
- _dest = "";
+ _dest = settings->getDestinationName();
+ _link = settings->createLinks();
}
@@ -33,5 +38,4 @@ Package::Package( QStringList pack, PackageManagerSettings *s )
init(s);
parsePackage( pack );
- _toProcess = false;
}
@@ -39,6 +43,12 @@ Package::Package( QString n, PackageManagerSettings *s )
{
init(s);
+ if ( !QFile::exists( n ) )
+ {
_name = QString( n );
- _toProcess = false;
+ }else{
+ parseIpkgFile( n );
+ _toProcess = true;
+ _packageName = QString( n );
+ }
}
@@ -47,5 +57,4 @@ Package::Package( Package *pi )
init(pi->settings);
copyValues( pi );
- _toProcess = false;
}
@@ -296,2 +305,27 @@ void Package::setLink(bool b)
_link = b;
}
+
+void Package::parseIpkgFile( QString file)
+{
+ system("tar xzf "+file+" -C /tmp");
+ system("tar xzf /tmp/control.tar.gz -C /tmp");
+ QFile f("/tmp/control");
+ if ( f.open(IO_ReadOnly) )
+ {
+ QTextStream t( &f );
+ QStringList pack;
+ while ( !t.eof() )
+ {
+ pack << t.readLine();
+ }
+ f.close();
+ parsePackage( pack );
+ }
+
+}
+
+QString Package::getPackageName()
+{
+ if ( _packageName.isEmpty() ) return _name;
+ else return _packageName;
+}
diff --git a/noncore/unsupported/oipkg/package.h b/noncore/unsupported/oipkg/package.h
index 6c292ed..31b0010 100644
--- a/noncore/unsupported/oipkg/package.h
+++ b/noncore/unsupported/oipkg/package.h
@@ -44,9 +44,13 @@ class Package //: public QObject
bool link();
void setLink(bool);
+ void parseIpkgFile( QString );;
public slots:
+ /** No descriptions */
+ QString getPackageName();
void toggleProcess();
private:
PackageManagerSettings *settings;
+ QString _packageName;
QString _name;
bool _toProcess;
diff --git a/noncore/unsupported/oipkg/packagelistview.cpp b/noncore/unsupported/oipkg/packagelistview.cpp
new file mode 100644
index 0000000..693ea6a
--- a/dev/null
+++ b/noncore/unsupported/oipkg/packagelistview.cpp
@@ -0,0 +1,91 @@
+/***************************************************************************
+ packagelistview.cpp - description
+ -------------------
+ begin : Sat Apr 27 2002
+ copyright : (C) 2002 by tille
+ email : tille@handhelds.org
+ ***************************************************************************/
+
+/***************************************************************************
+ * *
+ * This program is free software; you can redistribute it and/or modify *
+ * it under the terms of the GNU General Public License as published by *
+ * the Free Software Foundation; either version 2 of the License, or *
+ * (at your option) any later version. *
+ * *
+ ***************************************************************************/
+
+#include "packagelistview.h"
+
+#include <qpopupmenu.h>
+#include <qaction.h>
+
+#include "packagelistitem.h"
+#include "pksettings.h"
+
+PackageListView::PackageListView(QWidget *p, const char* n, PackageManagerSettings *s)
+ : QListView(p,n)
+{
+ settings = s;
+ popupMenu = new QPopupMenu( this );
+ destsMenu = new QPopupMenu( popupMenu );
+ popupTimer = new QTimer( this );
+ setSelectionMode(QListView::NoSelection);
+ addColumn( tr("Package") );
+ setRootIsDecorated( true );
+
+ connect( popupTimer, SIGNAL(timeout()),
+ this, SLOT(showPopup()) );
+ connect( this, SIGNAL( pressed( QListViewItem* ) ),
+ this, SLOT( setCurrent( QListViewItem* ) ) );
+ connect( this, SIGNAL( clicked( QListViewItem* ) ),
+ this, SLOT( stopTimer( QListViewItem* ) ) );
+
+}
+
+//PackageListView::~PackageListView()
+//{
+//}
+
+void PackageListView::setCurrent( QListViewItem* p )
+{
+ if ( !p ) return;
+ activePackageListItem = (PackageListItem*)p;
+ activePackage = activePackageListItem->getPackage();
+ pvDebug(5, "start timer");
+ popupTimer->start( 750, true );
+}
+
+
+void PackageListView::showPopup()
+{
+ popupMenu->clear();
+ destsMenu->clear();
+
+ QAction *popupAction;
+ popupMenu->insertItem( QObject::tr("Install to"), destsMenu );
+ QStringList dests = settings->getDestinationNames();
+ for (uint i = 0; i < dests.count(); i++ )
+ {
+ popupAction = new QAction( dests[i], QString::null, 0, this, 0 );
+ popupAction->addTo( destsMenu );
+ }
+ connect( destsMenu, SIGNAL( activated( int ) ),
+ this, SLOT( changePackageDest( int ) ) );
+ popupMenu->popup( QCursor::pos() );
+}
+
+void PackageListView::stopTimer( QListViewItem* )
+{
+ pvDebug( 5, "stop timer" );
+ popupTimer->stop();
+}
+
+
+void PackageListView::changePackageDest( int i )
+{
+ activePackage->setDest( destsMenu->text(i) );
+ activePackage->setOn();
+ activePackage->setLink( settings->createLinks() );
+ activePackageListItem->displayDetails();
+}
diff --git a/noncore/unsupported/oipkg/packagelistview.h b/noncore/unsupported/oipkg/packagelistview.h
new file mode 100644
index 0000000..15e200b
--- a/dev/null
+++ b/noncore/unsupported/oipkg/packagelistview.h
@@ -0,0 +1,53 @@
+/***************************************************************************
+ packagelistview.h - description
+ -------------------
+ begin : Sat Apr 27 2002
+ copyright : (C) 2002 by tille
+ email : tille@handhelds.org
+ ***************************************************************************/
+
+/***************************************************************************
+ * *
+ * This program is free software; you can redistribute it and/or modify *
+ * it under the terms of the GNU General Public License as published by *
+ * the Free Software Foundation; either version 2 of the License, or *
+ * (at your option) any later version. *
+ * *
+ ***************************************************************************/
+
+#ifndef PACKAGELISTVIEW_H
+#define PACKAGELISTVIEW_H
+
+#include <qlistview.h>
+#include <qaction.h>
+#include <qtimer.h>
+#include <qwidget.h>
+#include <qpopupmenu.h>
+#include "debug.h"
+
+class PackageListItem;
+class Package;
+class PackageManagerSettings;
+
+class PackageListView : public QListView
+{
+ Q_OBJECT
+
+public:
+ PackageListView(QWidget*, const char*, PackageManagerSettings*);
+// ~PackageListView();
+ QTimer *popupTimer;
+private:
+ PackageManagerSettings *settings;
+ Package *activePackage;
+ PackageListItem *activePackageListItem;
+ QPopupMenu *popupMenu;
+ QPopupMenu *destsMenu;
+public slots:
+ void showPopup();
+ void changePackageDest( int );
+ void setCurrent( QListViewItem* );
+ void stopTimer( QListViewItem* );
+};
+
+#endif
diff --git a/noncore/unsupported/oipkg/pmipkg.cpp b/noncore/unsupported/oipkg/pmipkg.cpp
index 45c89c5..f0992f5 100644
--- a/noncore/unsupported/oipkg/pmipkg.cpp
+++ b/noncore/unsupported/oipkg/pmipkg.cpp
@@ -1,4 +1,3 @@
#include "pmipkg.h"
-#include "pkdesc.h"
#include "pksettings.h"
#include "package.h"
@@ -13,4 +12,5 @@
#include <qmultilineedit.h>
#include <qstring.h>
+#include <qcheckbox.h>
#include <qtextstream.h>
#include <qtextview.h>
@@ -58,4 +58,7 @@ int PmIpkg::runIpkg(const QString& args, const QString& dest )
cmd += " -force-defaults ";
+// if (runwindow->forcedepends->isChecked())
+// cmd += " -force-depends ";
+
out( "<hr><br>Starting to "+ args+"<br>\n");
cmd += args;
@@ -72,5 +75,5 @@ int PmIpkg::runIpkg(const QString& args, const QString& dest )
out( "running:<br>\n"+cmd+"<br>\n" );
QString redirect = "/tmp/oipkg.pipe";
- cmd += " | tee "+redirect+" 2>&1";
+ cmd += " 2>&1 | tee "+redirect+" 2>&1";
pvDebug(2, "running >"+cmd+"<");
r = system(cmd.latin1());
@@ -104,6 +107,4 @@ void PmIpkg::makeLinks(Package *pack)
QString dest = settings->getDestinationUrlByName( pack->dest() );
if (dest == "/" ) return;
- out( "<br>creating links<br>" );
- out("for package "+pack->name()+" in "+dest+"<br>");
{
Config cfg( "oipkg", Config::User );
@@ -123,4 +124,6 @@ void PmIpkg::linkPackage( QString packFileName, QString dest )
return;
};
+ out( "<br>creating links<br>" );
+ out("for package "+packFileName+" in "+dest+"<br>");
QTextStream t( &f );
QString fp;
@@ -135,4 +138,5 @@ void PmIpkg::linkPackage( QString packFileName, QString dest )
void PmIpkg::processLinkDir( QString file, QString dest )
{
+ pvDebug( 7,"PmIpkg::processLinkDir "+file+" to "+ dest);
if ( dest == "???" ) return;
QString destFile = file;
@@ -168,13 +172,9 @@ void PmIpkg::processLinkDir( QString file, QString dest )
void PmIpkg::commit( PackageList pl )
{
- show( false );
- runwindow->outPut->setText("");
- out( "<h1>"+tr("Todo")+"</h1>\n");
-
+ int sizecount = 0;
to_install.clear();
to_remove.clear();
- int sizecount = 0;
- QString rem="<b>To remove:</b><br>\n";
- QString inst="<b>To install:</b><br>\n";;
+ QString rem="<b>"+tr("To remove:")+"</b><br>\n";
+ QString inst="<b>"+tr("To install:")+"</b><br>\n";
pl.allPackages();
for( Package *pack = pl.first();pack ; (pack = pl.next()) )
@@ -186,5 +186,5 @@ void PmIpkg::commit( PackageList pl )
to_install.append( pack );
sizecount += pack->size().toInt();
- inst += pack->name()+"\t(on "+pack->dest()+")<br>";
+ inst += pack->name()+"\t("+tr("on ")+pack->dest()+")<br>";
}
if ( pack->toRemove() )
@@ -197,21 +197,75 @@ void PmIpkg::commit( PackageList pl )
}
- out("<p>"+inst+"</p>"+"<p>"+rem+"</p><hl>");
+ startDialog();
- qDebug("to remove=%i; to install=%i",to_remove.count(),to_install.count());
+}
+
+void PmIpkg::startDialog()
+{
+ QDialog *d = new QDialog();
+ QGridLayout *RunWindowLayout = new QGridLayout( d );
+ RunWindowLayout->setSpacing( 2 );
+ RunWindowLayout->setMargin( 2 );
- runwindow->progress->setTotalSteps( sizecount );
+ QHBoxLayout *buttons = new QHBoxLayout;
+ buttons->setSpacing( 6 );
+ buttons->setMargin( 0 );
- connect( runwindow->doItButton, SIGNAL( clicked() ),
- SLOT( doIt() ) );
- connect( runwindow->installButton, SIGNAL( clicked() ),
+ PackageListView *plv = new PackageListView(d, "install",settings);
+ RunWindowLayout->addWidget( plv, 1, 0 );
+ for (Package *it=to_remove.first(); it != 0; it=to_remove.next() )
+ {
+ plv->insertItem( new PackageListItem(plv, it,settings) );
+ }
+ for (Package *it=to_install.first(); it != 0; it=to_install.next() )
+ {
+ plv->insertItem( new PackageListItem(plv, it,settings) );
+ }
+ QPushButton *doItButton = new QPushButton( d, "doItButton" );
+ doItButton->setSizePolicy( QSizePolicy( (QSizePolicy::SizeType)0, (QSizePolicy::SizeType)0, doItButton->sizePolicy().hasHeightForWidth() ) );
+ QFont doItButton_font( doItButton->font() );
+ doItButton_font.setPointSize( 8 );
+ doItButton->setFont( doItButton_font );
+ doItButton->setText( tr( "Do all " ) );
+ doItButton->setAutoResize( FALSE );
+ buttons->addWidget( doItButton );
+
+ QPushButton *installButton = new QPushButton( d, "installButton" );
+ QFont installButton_font( installButton->font() );
+ installButton_font.setPointSize( 8 );
+ installButton->setFont( installButton_font );
+ installButton->setText( tr( "Install" ) );
+ installButton->setAutoResize( TRUE );
+ buttons->addWidget( installButton );
+
+ QPushButton *removeButton = new QPushButton( d, "removeButton" );
+ QFont removeButton_font( removeButton->font() );
+ removeButton_font.setPointSize( 7 );
+ removeButton->setFont( removeButton_font );
+ removeButton->setText( tr( "Remove" ) );
+ removeButton->setAutoResize( TRUE );
+ buttons->addWidget( removeButton );
+
+ QPushButton *cancelButton = new QPushButton( d, "cancelButton" );
+ QFont cancelButton_font( cancelButton->font() );
+ cancelButton_font.setPointSize( 8 );
+ cancelButton->setFont( cancelButton_font );
+ cancelButton->setText( tr( "Cancel" ) );
+ cancelButton->setAutoResize( TRUE );
+ buttons->addWidget( cancelButton );
+
+ RunWindowLayout->addLayout( buttons, 3, 0 );
+
+ connect( doItButton, SIGNAL( clicked() ),
+ this, SLOT( doIt() ) );
+ connect( installButton, SIGNAL( clicked() ),
this, SLOT( install() ) );
- connect( runwindow->removeButton, SIGNAL( clicked() ),
+ connect( removeButton, SIGNAL( clicked() ),
this, SLOT( remove() ) );
- connect( runwindow->cancelButton, SIGNAL( clicked() ),
- runwindow, SLOT( close() ) );
-
- runwindow->exec();
- out("<h1>"+tr("Its now save to close this window")+"<h1>");
+ connect( cancelButton, SIGNAL( clicked() ),
+ d, SLOT( close() ) );
+ d->showMaximized();
+ d->exec();
+ // d->close();
}
@@ -252,5 +306,5 @@ void PmIpkg::install()
{
- if ( runIpkg("install " + it->name(), it->dest() ) == 0 )
+ if ( runIpkg("install " + it->getPackageName(), it->dest() ) == 0 )
{
runwindow->progress->setProgress( it->size().toInt() + runwindow->progress->progress());
@@ -315,5 +369,5 @@ void PmIpkg::show(bool b)
runwindow->showMaximized();
showButtons(b);
- if ( b )
+ if ( !b )
runwindow->progress->hide();
else
@@ -323,26 +377,10 @@ void PmIpkg::show(bool b)
void PmIpkg::installFile(const QString &fileName)
{
- pvDebug( 2,"PmIpkg::installFile "+ fileName);
- show( false );
- runwindow->outPut->setText("");
- fileNameToInstall = fileName;
- runwindow->doItButton->hide();
- runwindow->removeButton->hide();
- out("<b>"+tr("Install: ")+fileName);
- connect( runwindow->installButton, SIGNAL( clicked() ),
- this, SLOT( installFileName() ) );
- connect( runwindow->cancelButton, SIGNAL( clicked() ),
- runwindow, SLOT( close() ) );
- runwindow->exec();
+ to_install.clear();
+ to_remove.clear();
+ pvDebug( 2,"PmIpkg::installFile "+ fileName);
+ to_install.append( new Package(fileName,settings) );
+ startDialog();
}
-void PmIpkg::installFileName()
-{
- if ( !QFile::exists( fileNameToInstall ) ) return;
- out(tr("Installing pacakge ")+fileNameToInstall+"<br>"+tr("please wait")+"</b><br>");
- runIpkg("install " + fileNameToInstall );
- if ( settings->createLinks() )
- linkPackage( fileNameToInstall, settings->getDestinationUrl() );
- out("<h1>"+tr("Its now save to close this window")+"<h1>");
-} \ No newline at end of file
diff --git a/noncore/unsupported/oipkg/pmipkg.h b/noncore/unsupported/oipkg/pmipkg.h
index 8e06f4c..f70283e 100644
--- a/noncore/unsupported/oipkg/pmipkg.h
+++ b/noncore/unsupported/oipkg/pmipkg.h
@@ -34,4 +34,5 @@ private:
QString fileNameToInstall;
+ void startDialog();
void makeLinks(Package*);
void linkPackage( QString, QString );
@@ -43,5 +44,4 @@ public slots:
void doIt();
void install();
- void installFileName();
void remove();
void installFile(const QString &fileName);
diff --git a/noncore/unsupported/oipkg/runwindow.ui b/noncore/unsupported/oipkg/runwindow.ui
index 52da408..8582ce8 100644
--- a/noncore/unsupported/oipkg/runwindow.ui
+++ b/noncore/unsupported/oipkg/runwindow.ui
@@ -13,5 +13,5 @@
<y>0</y>
<width>344</width>
- <height>291</height>
+ <height>442</height>
</rect>
</property>
@@ -46,18 +46,5 @@
</property>
</widget>
- <widget row="1" column="0" >
- <class>QTextView</class>
- <property stdset="1">
- <name>name</name>
- <cstring>outPut</cstring>
- </property>
- <property stdset="1">
- <name>font</name>
- <font>
- <pointsize>6</pointsize>
- </font>
- </property>
- </widget>
- <widget row="2" column="0" >
+ <widget row="3" column="0" >
<class>QLayoutWidget</class>
<property stdset="1">
@@ -99,5 +86,5 @@
<property stdset="1">
<name>autoResize</name>
- <bool>true</bool>
+ <bool>false</bool>
</property>
</widget>
@@ -167,4 +154,17 @@
</hbox>
</widget>
+ <widget row="1" column="0" >
+ <class>QTextView</class>
+ <property stdset="1">
+ <name>name</name>
+ <cstring>outPut</cstring>
+ </property>
+ <property stdset="1">
+ <name>font</name>
+ <font>
+ <pointsize>6</pointsize>
+ </font>
+ </property>
+ </widget>
</grid>
</widget>