author | tille <tille> | 2002-04-27 14:35:48 (UTC) |
---|---|---|
committer | tille <tille> | 2002-04-27 14:35:48 (UTC) |
commit | 320532727fc7dfbe9760d0eea0e17b8e1230fc8e (patch) (unidiff) | |
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,8 +1,10 @@ | |||
1 | * setDocument function | ||
1 | * Settings Class | 2 | * Settings Class |
2 | * tr() ;) | 3 | * tr() ;) |
3 | * Dialog to display ipkg output live | 4 | * Dialog to display ipkg output live |
4 | * parse "to install" and "to remove" from status | 5 | * parse "to install" and "to remove" from status |
5 | * install local file | 6 | * install local file |
6 | * qcop | 7 | * qcop |
7 | * error handling | 8 | * error handling |
8 | * manage links | 9 | * manage links |
10 | * 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 | |||
@@ -30,12 +30,16 @@ MainWindow::MainWindow( QWidget *parent, const char *name, WFlags f = 0 ) : | |||
30 | setCaption( tr("Package Manager") ); | 30 | setCaption( tr("Package Manager") ); |
31 | 31 | ||
32 | listViewPackages = new QListView( this,0,0 ); | 32 | listViewPackages = new QListView( this,0,0 ); |
33 | listViewPackages->setSelectionMode(QListView::NoSelection); | 33 | listViewPackages->setSelectionMode(QListView::NoSelection); |
34 | setCentralWidget( listViewPackages ); | 34 | setCentralWidget( listViewPackages ); |
35 | 35 | ||
36 | channel = new QCopChannel( "QPE/Application/oipkg", this ); | ||
37 | connect( channel, SIGNAL(received(const QCString&, const QByteArray&)), | ||
38 | this, SLOT(receive(const QCString&, const QByteArray&)) ); | ||
39 | |||
36 | makeMenu(); | 40 | makeMenu(); |
37 | #ifdef NEWLAYOUT | 41 | #ifdef NEWLAYOUT |
38 | listViewPackages->addColumn( tr("Package") ); | 42 | listViewPackages->addColumn( tr("Package") ); |
39 | listViewPackages->setRootIsDecorated( true ); | 43 | listViewPackages->setRootIsDecorated( true ); |
40 | #endif | 44 | #endif |
41 | #ifndef NEWLAYOUT | 45 | #ifndef NEWLAYOUT |
@@ -413,6 +417,20 @@ void MainWindow::changePackageDest( int i ) | |||
413 | 417 | ||
414 | void MainWindow::stopTimer( QListViewItem* ) | 418 | void MainWindow::stopTimer( QListViewItem* ) |
415 | { | 419 | { |
416 | pvDebug( 5, "stop timer" ); | 420 | pvDebug( 5, "stop timer" ); |
417 | popupTimer->stop(); | 421 | popupTimer->stop(); |
418 | } | 422 | } |
423 | |||
424 | void MainWindow::setDocument(const QString &fileName) | ||
425 | { | ||
426 | ipkg->installFile( fileName ); | ||
427 | } | ||
428 | |||
429 | void MainWindow::receive(const QCString &msg, const QByteArray &arg) | ||
430 | { | ||
431 | pvDebug(3, "QCop "+msg); | ||
432 | if ( msg == "setDocument(QString)" ) | ||
433 | { | ||
434 | setDocument( QString(arg) ); | ||
435 | } | ||
436 | } \ 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 | |||
@@ -13,32 +13,36 @@ | |||
13 | 13 | ||
14 | class QComboBox; | 14 | class QComboBox; |
15 | class QPEToolBar; | 15 | class QPEToolBar; |
16 | class QLineEdit; | 16 | class QLineEdit; |
17 | class QListView; | 17 | class QListView; |
18 | class PackageListItem; | 18 | class PackageListItem; |
19 | class QCopChannel; | ||
19 | 20 | ||
20 | class MainWindow : public QMainWindow | 21 | class MainWindow : public QMainWindow |
21 | { | 22 | { |
22 | Q_OBJECT | 23 | Q_OBJECT |
23 | 24 | ||
24 | 25 | ||
25 | public: | 26 | public: |
26 | MainWindow( QWidget *parent = 0, const char *name = 0, WFlags f = 0 ); | 27 | MainWindow( QWidget *parent = 0, const char *name = 0, WFlags f = 0 ); |
27 | ~MainWindow(); | 28 | ~MainWindow(); |
28 | 29 | ||
30 | QCopChannel *channel; | ||
31 | |||
29 | protected slots: | 32 | protected slots: |
30 | void runIpkg(); | 33 | void runIpkg(); |
31 | void getList(); | 34 | void getList(); |
32 | void updateList(); | 35 | void updateList(); |
33 | void displayList(); | 36 | void displayList(); |
34 | void subSectionChanged(); | 37 | void subSectionChanged(); |
35 | void sectionChanged(); | 38 | void sectionChanged(); |
36 | void showSettings(); | 39 | void showSettings(); |
37 | void showSettingsSrv(); | 40 | void showSettingsSrv(); |
38 | void showSettingsDst(); | 41 | void showSettingsDst(); |
42 | void setDocument (const QString &); | ||
39 | 43 | ||
40 | public slots: | 44 | public slots: |
41 | void showDetails(); | 45 | void showDetails(); |
42 | void toggleActivePackage(); | 46 | void toggleActivePackage(); |
43 | void setCurrent( QListViewItem* ); | 47 | void setCurrent( QListViewItem* ); |
44 | void sectionClose(); | 48 | void sectionClose(); |
@@ -46,12 +50,13 @@ public slots: | |||
46 | void findClose(); | 50 | void findClose(); |
47 | void findShow(bool); | 51 | void findShow(bool); |
48 | void filterList(); | 52 | void filterList(); |
49 | void showPopup(); | 53 | void showPopup(); |
50 | void changePackageDest( int ); | 54 | void changePackageDest( int ); |
51 | void stopTimer( QListViewItem* ); | 55 | void stopTimer( QListViewItem* ); |
56 | void receive (const QCString &, const QByteArray &); | ||
52 | 57 | ||
53 | private: | 58 | private: |
54 | void makeMenu(); | 59 | void makeMenu(); |
55 | void setSections(); | 60 | void setSections(); |
56 | void setSubSections(); | 61 | void setSubSections(); |
57 | 62 | ||
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 | |||
@@ -108,16 +108,21 @@ void PmIpkg::makeLinks(Package *pack) | |||
108 | { | 108 | { |
109 | Config cfg( "oipkg", Config::User ); | 109 | Config cfg( "oipkg", Config::User ); |
110 | cfg.setGroup( "Common" ); | 110 | cfg.setGroup( "Common" ); |
111 | QString statusDir = cfg.readEntry( "statusDir", "" ); | 111 | QString statusDir = cfg.readEntry( "statusDir", "" ); |
112 | } | 112 | } |
113 | QString fn = dest+"/"+statusDir+"/info/"+pack->name()+".list"; | 113 | QString fn = dest+"/"+statusDir+"/info/"+pack->name()+".list"; |
114 | QFile f( fn ); | 114 | linkPackage( fn, dest ); |
115 | if ( ! f.open(IO_ReadOnly) ) | 115 | } |
116 | |||
117 | void PmIpkg::linkPackage( QString packFileName, QString dest ) | ||
118 | { | ||
119 | QFile f( packFileName ); | ||
120 | if ( ! f.open(IO_ReadOnly) ) | ||
116 | { | 121 | { |
117 | out( "<b>Panik!</b> Could not open:<br>"+fn ); | 122 | out( "<b>Panik!</b> Could not open:<br>"+packFileName ); |
118 | return; | 123 | return; |
119 | }; | 124 | }; |
120 | QTextStream t( &f ); | 125 | QTextStream t( &f ); |
121 | QString fp; | 126 | QString fp; |
122 | while ( !t.eof() ) | 127 | while ( !t.eof() ) |
123 | { | 128 | { |
@@ -204,13 +209,13 @@ void PmIpkg::commit( PackageList pl ) | |||
204 | connect( runwindow->removeButton, SIGNAL( clicked() ), | 209 | connect( runwindow->removeButton, SIGNAL( clicked() ), |
205 | this, SLOT( remove() ) ); | 210 | this, SLOT( remove() ) ); |
206 | connect( runwindow->cancelButton, SIGNAL( clicked() ), | 211 | connect( runwindow->cancelButton, SIGNAL( clicked() ), |
207 | runwindow, SLOT( close() ) ); | 212 | runwindow, SLOT( close() ) ); |
208 | 213 | ||
209 | runwindow->exec(); | 214 | runwindow->exec(); |
210 | return; | 215 | out("<h1>"+tr("Its now save to close this window")+"<h1>"); |
211 | } | 216 | } |
212 | 217 | ||
213 | void PmIpkg::doIt() | 218 | void PmIpkg::doIt() |
214 | { | 219 | { |
215 | remove(); | 220 | remove(); |
216 | install(); | 221 | install(); |
@@ -311,6 +316,33 @@ void PmIpkg::show(bool b) | |||
311 | showButtons(b); | 316 | showButtons(b); |
312 | if ( b ) | 317 | if ( b ) |
313 | runwindow->progress->hide(); | 318 | runwindow->progress->hide(); |
314 | else | 319 | else |
315 | runwindow->progress->show(); | 320 | runwindow->progress->show(); |
316 | } | 321 | } |
322 | |||
323 | void PmIpkg::installFile(const QString &fileName) | ||
324 | { | ||
325 | pvDebug( 2,"PmIpkg::installFile "+ fileName); | ||
326 | show( false ); | ||
327 | runwindow->outPut->setText(""); | ||
328 | fileNameToInstall = fileName; | ||
329 | runwindow->doItButton->hide(); | ||
330 | runwindow->removeButton->hide(); | ||
331 | out("<b>"+tr("Install: ")+fileName); | ||
332 | connect( runwindow->installButton, SIGNAL( clicked() ), | ||
333 | this, SLOT( installFileName() ) ); | ||
334 | connect( runwindow->cancelButton, SIGNAL( clicked() ), | ||
335 | runwindow, SLOT( close() ) ); | ||
336 | |||
337 | runwindow->exec(); | ||
338 | } | ||
339 | |||
340 | void PmIpkg::installFileName() | ||
341 | { | ||
342 | if ( !QFile::exists( fileNameToInstall ) ) return; | ||
343 | out(tr("Installing pacakge ")+fileNameToInstall+"<br>"+tr("please wait")+"</b><br>"); | ||
344 | runIpkg("install " + fileNameToInstall ); | ||
345 | if ( settings->createLinks() ) | ||
346 | linkPackage( fileNameToInstall, settings->getDestinationUrl() ); | ||
347 | out("<h1>"+tr("Its now save to close this window")+"<h1>"); | ||
348 | } \ 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 | |||
@@ -28,20 +28,24 @@ public: | |||
28 | private: | 28 | private: |
29 | PackageManagerSettings* settings; | 29 | PackageManagerSettings* settings; |
30 | RunWindow *runwindow; | 30 | RunWindow *runwindow; |
31 | QList<Package> to_remove; | 31 | QList<Package> to_remove; |
32 | QList<Package> to_install; | 32 | QList<Package> to_install; |
33 | bool runwindowopen; | 33 | bool runwindowopen; |
34 | QString fileNameToInstall; | ||
34 | 35 | ||
35 | void makeLinks(Package*); | 36 | void makeLinks(Package*); |
37 | void linkPackage( QString, QString ); | ||
36 | void processLinkDir( QString, QString ); | 38 | void processLinkDir( QString, QString ); |
37 | int runIpkg(const QString& args, const QString& dest="" ); | 39 | int runIpkg(const QString& args, const QString& dest="" ); |
38 | void out( QString ); | 40 | void out( QString ); |
39 | 41 | ||
40 | public slots: | 42 | public slots: |
41 | void doIt(); | 43 | void doIt(); |
42 | void install(); | 44 | void install(); |
45 | void installFileName(); | ||
43 | void remove(); | 46 | void remove(); |
47 | void installFile(const QString &fileName); | ||
44 | void linkDestination( const QString, const QByteArray ); | 48 | void linkDestination( const QString, const QByteArray ); |
45 | }; | 49 | }; |
46 | 50 | ||
47 | #endif | 51 | #endif |