author | tille <tille> | 2002-04-27 14:35:48 (UTC) |
---|---|---|
committer | tille <tille> | 2002-04-27 14:35:48 (UTC) |
commit | 320532727fc7dfbe9760d0eea0e17b8e1230fc8e (patch) (side-by-side diff) | |
tree | d65575cdd4c89e6a531b178de04198f39d8276c0 | |
parent | db90999f6298c1107888f062f2c25cb8817b528a (diff) | |
download | opie-320532727fc7dfbe9760d0eea0e17b8e1230fc8e.zip opie-320532727fc7dfbe9760d0eea0e17b8e1230fc8e.tar.gz opie-320532727fc7dfbe9760d0eea0e17b8e1230fc8e.tar.bz2 |
added setDocument and a qcop call to install a file
-rw-r--r-- | noncore/unsupported/oipkg/TODO | 2 | ||||
-rw-r--r-- | noncore/unsupported/oipkg/mainwindow.cpp | 18 | ||||
-rw-r--r-- | noncore/unsupported/oipkg/mainwindow.h | 5 | ||||
-rw-r--r-- | noncore/unsupported/oipkg/pmipkg.cpp | 40 | ||||
-rw-r--r-- | noncore/unsupported/oipkg/pmipkg.h | 4 |
5 files changed, 65 insertions, 4 deletions
diff --git a/noncore/unsupported/oipkg/TODO b/noncore/unsupported/oipkg/TODO index 744cba4..b07542a 100644 --- a/noncore/unsupported/oipkg/TODO +++ b/noncore/unsupported/oipkg/TODO @@ -1 +1,2 @@ +* setDocument function * Settings Class @@ -8 +9,2 @@ * manage links +* dependency checking
\ No newline at end of file diff --git a/noncore/unsupported/oipkg/mainwindow.cpp b/noncore/unsupported/oipkg/mainwindow.cpp index 25ca889..e3abf36 100644 --- a/noncore/unsupported/oipkg/mainwindow.cpp +++ b/noncore/unsupported/oipkg/mainwindow.cpp @@ -35,2 +35,6 @@ MainWindow::MainWindow( QWidget *parent, const char *name, WFlags f = 0 ) : + channel = new QCopChannel( "QPE/Application/oipkg", this ); + connect( channel, SIGNAL(received(const QCString&, const QByteArray&)), + this, SLOT(receive(const QCString&, const QByteArray&)) ); + makeMenu(); @@ -418 +422,15 @@ void MainWindow::stopTimer( QListViewItem* ) } + +void MainWindow::setDocument(const QString &fileName) +{ + ipkg->installFile( fileName ); +} + +void MainWindow::receive(const QCString &msg, const QByteArray &arg) +{ + pvDebug(3, "QCop "+msg); + if ( msg == "setDocument(QString)" ) + { + setDocument( QString(arg) ); + } +}
\ No newline at end of file diff --git a/noncore/unsupported/oipkg/mainwindow.h b/noncore/unsupported/oipkg/mainwindow.h index adc5e78..34943f2 100644 --- a/noncore/unsupported/oipkg/mainwindow.h +++ b/noncore/unsupported/oipkg/mainwindow.h @@ -18,2 +18,3 @@ class QListView; class PackageListItem; +class QCopChannel; @@ -28,2 +29,4 @@ public: + QCopChannel *channel; + protected slots: @@ -38,2 +41,3 @@ protected slots: void showSettingsDst(); + void setDocument (const QString &); @@ -51,2 +55,3 @@ public slots: void stopTimer( QListViewItem* ); + void receive (const QCString &, const QByteArray &); diff --git a/noncore/unsupported/oipkg/pmipkg.cpp b/noncore/unsupported/oipkg/pmipkg.cpp index 3b31b4d..45c89c5 100644 --- a/noncore/unsupported/oipkg/pmipkg.cpp +++ b/noncore/unsupported/oipkg/pmipkg.cpp @@ -113,6 +113,11 @@ void PmIpkg::makeLinks(Package *pack) QString fn = dest+"/"+statusDir+"/info/"+pack->name()+".list"; - QFile f( fn ); - if ( ! f.open(IO_ReadOnly) ) + linkPackage( fn, dest ); +} + +void PmIpkg::linkPackage( QString packFileName, QString dest ) +{ + QFile f( packFileName ); + if ( ! f.open(IO_ReadOnly) ) { - out( "<b>Panik!</b> Could not open:<br>"+fn ); + out( "<b>Panik!</b> Could not open:<br>"+packFileName ); return; @@ -209,3 +214,3 @@ void PmIpkg::commit( PackageList pl ) runwindow->exec(); - return; + out("<h1>"+tr("Its now save to close this window")+"<h1>"); } @@ -316 +321,28 @@ 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(); +} + +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 c57adb7..8e06f4c 100644 --- a/noncore/unsupported/oipkg/pmipkg.h +++ b/noncore/unsupported/oipkg/pmipkg.h @@ -33,4 +33,6 @@ private: bool runwindowopen; + QString fileNameToInstall; void makeLinks(Package*); + void linkPackage( QString, QString ); void processLinkDir( QString, QString ); @@ -42,3 +44,5 @@ public slots: void install(); + void installFileName(); void remove(); + void installFile(const QString &fileName); void linkDestination( const QString, const QByteArray ); |