summaryrefslogtreecommitdiff
Unidiff
Diffstat (more/less context) (ignore whitespace changes)
-rw-r--r--noncore/unsupported/oipkg/mainwindow.cpp55
-rw-r--r--noncore/unsupported/oipkg/pmipkg.cpp37
2 files changed, 72 insertions, 20 deletions
diff --git a/noncore/unsupported/oipkg/mainwindow.cpp b/noncore/unsupported/oipkg/mainwindow.cpp
index 233eae6..7df1d6b 100644
--- a/noncore/unsupported/oipkg/mainwindow.cpp
+++ b/noncore/unsupported/oipkg/mainwindow.cpp
@@ -40,21 +40,22 @@ MainWindow::MainWindow( QWidget *parent, const char *name, WFlags f = 0 ) :
40 setCaption( tr("Package Manager") ); 40 setCaption( tr("Package Manager") );
41 settings = new PackageManagerSettings(this,0,TRUE); 41 settings = new PackageManagerSettings(this,0,TRUE);
42 listViewPackages = new PackageListView( this,"listViewPackages",settings ); 42 listViewPackages = new PackageListView( this,"listViewPackages",settings );
43 setCentralWidget( listViewPackages ); 43 setCentralWidget( listViewPackages );
44 listViewPackages->addList( tr("feeds"), &packageListServers ); 44 listViewPackages->addList( tr("feeds"), &packageListServers );
45 listViewPackages->addList( tr("ipkgfind"), &packageListSearch ); 45 listViewPackages->addList( tr("ipkgfind"), &packageListSearch );
46 listViewPackages->addList( tr("documents"), &packageListDocLnk ); 46//listViewPackages->addList( tr("documents"), &packageListDocLnk );
47 ipkg = new PmIpkg( settings, this ); 47 ipkg = new PmIpkg( settings, this );
48 packageListServers.setSettings( settings ); 48 packageListServers.setSettings( settings );
49 packageListSearch.setSettings( settings ); 49 packageListSearch.setSettings( settings );
50 packageListDocLnk.setSettings( settings ); 50 packageListDocLnk.setSettings( settings );
51 pvDebug(9,"packageListServers.update"); 51 pvDebug(9,"packageListServers.update");
52 packageListServers.update(); 52 packageListServers.update();
53 pvDebug(9,"packageListDocLnk.update"); 53 pvDebug(9,"packageListDocLnk.update");
54 packageListDocLnk.update(); 54 pvDebug(0,"no UPDATE of DocLnk");
55// packageListDocLnk.update();
55 pvDebug(9,"makeMenu"); 56 pvDebug(9,"makeMenu");
56 makeMenu(); 57 makeMenu();
57 makeChannel(); 58 makeChannel();
58 //opie is hardcoded default ;) 59 //opie is hardcoded default ;)
59 //pvDebug(9,"section->setCurrentItem"); 60 //pvDebug(9,"section->setCurrentItem");
60// for (int i=0;i<section->count();i++) 61// for (int i=0;i<section->count();i++)
@@ -79,20 +80,20 @@ void MainWindow::makeMenu()
79 80
80 QPEToolBar *toolBar = new QPEToolBar( this ); 81 QPEToolBar *toolBar = new QPEToolBar( this );
81 QPEMenuBar *menuBar = new QPEMenuBar( toolBar ); 82 QPEMenuBar *menuBar = new QPEMenuBar( toolBar );
82 QPopupMenu *srvMenu = new QPopupMenu( menuBar ); 83 QPopupMenu *srvMenu = new QPopupMenu( menuBar );
83 QPopupMenu *viewMenu = new QPopupMenu( menuBar ); 84 QPopupMenu *viewMenu = new QPopupMenu( menuBar );
84 QPopupMenu *cfgMenu = new QPopupMenu( menuBar ); 85 QPopupMenu *cfgMenu = new QPopupMenu( menuBar );
85 // QPopupMenu *sectMenu = new QPopupMenu( menuBar ); 86 QPopupMenu *helpMenu = new QPopupMenu( menuBar );
86 87
87 setToolBarsMovable( false ); 88 setToolBarsMovable( false );
88 toolBar->setHorizontalStretchable( true ); 89 toolBar->setHorizontalStretchable( true );
89 menuBar->insertItem( tr( "Package" ), srvMenu ); 90 menuBar->insertItem( tr( "Package" ), srvMenu );
90 menuBar->insertItem( tr( "View" ), viewMenu ); 91 menuBar->insertItem( tr( "View" ), viewMenu );
91 menuBar->insertItem( tr( "Settings" ), cfgMenu ); 92 menuBar->insertItem( tr( "Settings" ), cfgMenu );
92 // menuBar->insertItem( tr( "Sections" ), sectMenu ); 93 menuBar->insertItem( tr( "Help" ), helpMenu );
93 94
94 QLabel *spacer; 95 QLabel *spacer;
95// spacer = new QLabel( "", toolBar ); 96// spacer = new QLabel( "", toolBar );
96// spacer->setBackgroundColor( toolBar->backgroundColor() ); 97// spacer->setBackgroundColor( toolBar->backgroundColor() );
97// toolBar->setStretchableWidget( spacer ); 98// toolBar->setStretchableWidget( spacer );
98 99
@@ -102,13 +103,13 @@ void MainWindow::makeMenu()
102 QString::null, 0, this, 0 ); 103 QString::null, 0, this, 0 );
103 connect( runAction, SIGNAL( activated() ), 104 connect( runAction, SIGNAL( activated() ),
104 this, SLOT( runIpkg() ) ); 105 this, SLOT( runIpkg() ) );
105 runAction->addTo( toolBar ); 106 runAction->addTo( toolBar );
106 runAction->addTo( srvMenu ); 107 runAction->addTo( srvMenu );
107 108
108 srvMenu->insertSeparator (); 109 srvMenu->insertSeparator();
109 110
110 updateAction = new QAction( tr( "Update" ), 111 updateAction = new QAction( tr( "Update" ),
111 Resource::loadIconSet( "oipkg/update" ), 112 Resource::loadIconSet( "oipkg/update" ),
112 QString::null, 0, this, 0 ); 113 QString::null, 0, this, 0 );
113 connect( updateAction, SIGNAL( activated() ), 114 connect( updateAction, SIGNAL( activated() ),
114 this , SLOT( updateList() ) ); 115 this , SLOT( updateList() ) );
@@ -226,12 +227,49 @@ void MainWindow::makeMenu()
226 connect( a, SIGNAL( activated() ), SLOT( destClose() ) ); 227 connect( a, SIGNAL( activated() ), SLOT( destClose() ) );
227 a->addTo( destBar ); 228 a->addTo( destBar );
228 destBar->setStretchableWidget( CheckBoxLink ); 229 destBar->setStretchableWidget( CheckBoxLink );
229 destAction->setToggleAction( true ); 230 destAction->setToggleAction( true );
230 // destAction->addTo( viewMenu ); 231 // destAction->addTo( viewMenu );
231 232
233// helpMenu
234 helpMenu->insertSeparator();
235 a = new QAction( tr( "Package Actions" ), QString::null, 0, this, 0 );
236 a->addTo( helpMenu );
237 helpMenu->insertSeparator();
238 a = new QAction( tr( "Install" ),
239 Resource::loadPixmap( "oipkg/install" ), QString::null, 0, this, 0 );
240 a->addTo( helpMenu );
241 a = new QAction( tr( "Remove" ),
242 Resource::loadPixmap( "oipkg/uninstall" ), QString::null, 0, this, 0 );
243 a->addTo( helpMenu );
244 helpMenu->insertSeparator();
245 a = new QAction( tr( "Package Status" ), QString::null, 0, this, 0 );
246 a->addTo( helpMenu );
247 helpMenu->insertSeparator();
248 a = new QAction( tr( "New version, installed" ),
249 Resource::loadPixmap( "oipkg/installed" ), QString::null, 0, this, 0 );
250 a->addTo( helpMenu );
251 a = new QAction( tr( "New version, not installed" ),
252 Resource::loadPixmap( "oipkg/uninstalled" ), QString::null, 0, this, 0 );
253 a->addTo( helpMenu );
254 a = new QAction( tr( "Old version, installed" ),
255 Resource::loadPixmap( "oipkg/installedOld" ), QString::null, 0, this, 0 );
256 a->addTo( helpMenu );
257 a = new QAction( tr( "Old version, not installed" ),
258 Resource::loadPixmap( "oipkg/uninstalledOld" ), QString::null, 0, this, 0 );
259 a->addTo( helpMenu );
260 a = new QAction( tr( "Old version, new version installed" ),
261 Resource::loadPixmap( "oipkg/uninstalledOldinstalledNew" ), QString::null, 0, this, 0 );
262 a->addTo( helpMenu );
263 a = new QAction( tr( "New version, old version installed" ),
264 Resource::loadPixmap( "oipkg/uninstalledInstalledOld" ), QString::null, 0, this, 0 );
265 a->addTo( helpMenu );
266 //a = new QAction( tr( "" ),
267 // Resource::loadPixmap( "oipkg/" ), QString::null, 0, this, 0 );
268 // a->addTo( helpMenu );
269
232 // configure the menus 270 // configure the menus
233 Config cfg( "oipkg", Config::User ); 271 Config cfg( "oipkg", Config::User );
234 cfg.setGroup( "gui" ); 272 cfg.setGroup( "gui" );
235 273
236 findShow( cfg.readBoolEntry( "findBar", true ) ); 274 findShow( cfg.readBoolEntry( "findBar", true ) );
237 searchShow( cfg.readBoolEntry( "searchBar", true ) ); 275 searchShow( cfg.readBoolEntry( "searchBar", true ) );
@@ -251,13 +289,13 @@ MainWindow::~MainWindow()
251} 289}
252 290
253void MainWindow::runIpkg() 291void MainWindow::runIpkg()
254{ 292{
255 packageListServers.allPackages(); 293 packageListServers.allPackages();
256 ipkg->loadList( &packageListSearch ); 294 ipkg->loadList( &packageListSearch );
257 ipkg->loadList( &packageListDocLnk ); 295//ipkg->loadList( &packageListDocLnk );
258 ipkg->loadList( &packageListServers ); 296 ipkg->loadList( &packageListServers );
259 ipkg->commit(); 297 ipkg->commit();
260 ipkg->clearLists(); 298 ipkg->clearLists();
261 // ##### If we looked in the list of files, we could send out accurate 299 // ##### If we looked in the list of files, we could send out accurate
262 // ##### messages. But we don't bother yet, and just do an "all". 300 // ##### messages. But we don't bother yet, and just do an "all".
263 QCopEnvelope e("QPE/System", "linkChanged(QString)"); 301 QCopEnvelope e("QPE/System", "linkChanged(QString)");
@@ -267,17 +305,18 @@ void MainWindow::runIpkg()
267} 305}
268 306
269void MainWindow::updateList() 307void MainWindow::updateList()
270{ 308{
271 packageListServers.clear(); 309 packageListServers.clear();
272 packageListSearch.clear(); 310 packageListSearch.clear();
273 packageListDocLnk.clear(); 311
312// packageListDocLnk.clear();
274 ipkg->update(); 313 ipkg->update();
275 packageListServers.update(); 314 packageListServers.update();
276 packageListSearch.update(); 315 packageListSearch.update();
277 packageListDocLnk.update(); 316// packageListDocLnk.update();
278} 317}
279 318
280void MainWindow::filterList() 319void MainWindow::filterList()
281{ 320{
282 QString f = ""; 321 QString f = "";
283 if ( findAction->isOn() ) f = findEdit->text(); 322 if ( findAction->isOn() ) f = findEdit->text();
diff --git a/noncore/unsupported/oipkg/pmipkg.cpp b/noncore/unsupported/oipkg/pmipkg.cpp
index 0817247..7d0e246 100644
--- a/noncore/unsupported/oipkg/pmipkg.cpp
+++ b/noncore/unsupported/oipkg/pmipkg.cpp
@@ -1,14 +1,12 @@
1#include "pmipkg.h" 1#include "pmipkg.h"
2#include "pksettings.h" 2#include "pksettings.h"
3#include "package.h" 3#include "package.h"
4#include "packagelistitem.h" 4#include "packagelistitem.h"
5 5
6//#infdef OPROCESS
7#include <opie/oprocess.h> 6#include <opie/oprocess.h>
8//#endif
9#include <qpe/resource.h> 7#include <qpe/resource.h>
10#include <qpe/config.h> 8#include <qpe/config.h>
11#include <qpe/stringutil.h> 9#include <qpe/stringutil.h>
12#include <qpe/qpeapplication.h> 10#include <qpe/qpeapplication.h>
13#include <qdir.h> 11#include <qdir.h>
14#include <qfile.h> 12#include <qfile.h>
@@ -26,12 +24,14 @@
26#include <stdlib.h> 24#include <stdlib.h>
27#include <unistd.h> 25#include <unistd.h>
28 26
29#include "mainwindow.h" 27#include "mainwindow.h"
30 28
31 29
30//#define OPROCESS
31
32PmIpkg::PmIpkg( PackageManagerSettings* s, QWidget* p, const char * name, WFlags f ) 32PmIpkg::PmIpkg( PackageManagerSettings* s, QWidget* p, const char * name, WFlags f )
33 : QObject ( p ) 33 : QObject ( p )
34{ 34{
35 settings = s; 35 settings = s;
36 runwindow = new RunWindow( p, name, true, f ); 36 runwindow = new RunWindow( p, name, true, f );
37#ifdef OPROCESS 37#ifdef OPROCESS
@@ -123,31 +123,30 @@ bool PmIpkg::runIpkg(const QString& args, const QString& dest )
123 FILE *fp; 123 FILE *fp;
124 char line[130]; 124 char line[130];
125 QString lineStr, lineStrOld; 125 QString lineStr, lineStrOld;
126 sleep(1); 126 sleep(1);
127 cmd +=" 2>&1"; 127 cmd +=" 2>&1";
128 fp = popen( (const char *) cmd, "r"); 128 fp = popen( (const char *) cmd, "r");
129 if ( !fp ) { 129 if ( fp == NULL ) {
130 qDebug("Could not execute '" + cmd + "'! err=%d", fp); 130 qDebug("Could not execute '" + cmd + "'! err=%d", fp);
131 pclose(fp);
132 out("\nError while executing "+ cmd+"\n\n"); 131 out("\nError while executing "+ cmd+"\n\n");
133 return false; 132 ret = false;
134 } else { 133 } else {
135 while ( fgets( line, sizeof line, fp)) { 134 while ( fgets( line, sizeof line, fp) != NULL)
135 {
136 lineStr = line; 136 lineStr = line;
137 lineStr=lineStr.left(lineStr.length()-1); 137 lineStr=lineStr.left(lineStr.length()-1);
138 //Configuring opie-oipkg...Done 138 //Configuring opie-oipkg...Done
139 if (lineStr.contains("Done")) 139 if (lineStr.contains("Done")) ret = true;
140 ret = true;
141 if (lineStr!=lineStrOld) 140 if (lineStr!=lineStrOld)
142 out(lineStr); 141 out(lineStr);
143 lineStrOld = lineStr; 142 lineStrOld = lineStr;
144 qApp->processEvents(); 143 qApp->processEvents();
145 } 144 }
146 pclose(fp);
147 } 145 }
146 pclose(fp);
148#endif 147#endif
149 //out( "Finished!"); 148 //out( "Finished!");
150 pvDebug(2,QString(ret?"success\n":"failure\n")); 149 pvDebug(2,QString(ret?"success\n":"failure\n"));
151 return ret; 150 return ret;
152} 151}
153 152
@@ -231,21 +230,21 @@ void PmIpkg::processLinkDir( QString file, QString dest )
231 processLinkDir( fi->absFilePath(), dest ); 230 processLinkDir( fi->absFilePath(), dest );
232 ++it; 231 ++it;
233 } 232 }
234 } else 233 } else
235 if ( fileInfo.isFile() ) 234 if ( fileInfo.isFile() )
236 { 235 {
237 const char *instFile = strdup( (file).ascii() ); 236 const char *instFile = strdup( (file).latin1() );
238 const char *linkFile = strdup( (destFile).ascii()); 237 const char *linkFile = strdup( (destFile).latin1());
239 if( linkOpp==createLink ) 238 if( linkOpp==createLink )
240 { 239 {
241 pvDebug(4, "linking: "+file+" -> "+destFile ); 240 pvDebug(4, "linking: "+file+" -> "+destFile );
242 symlink( instFile, linkFile ); 241 symlink( instFile, linkFile );
243 } 242 }
244 } else { 243 } else {
245 const char *linkFile = strdup( (destFile).ascii()); 244 const char *linkFile = strdup( (destFile).latin1());
246 if( linkOpp==removeLink ) 245 if( linkOpp==removeLink )
247 { 246 {
248 QFileInfo toRemoveLink( destFile ); 247 QFileInfo toRemoveLink( destFile );
249 if ( !QFile::exists( file ) && toRemoveLink.isSymLink() ) 248 if ( !QFile::exists( file ) && toRemoveLink.isSymLink() )
250 { 249 {
251 pvDebug(4,"removing "+destFile+" no "+file); 250 pvDebug(4,"removing "+destFile+" no "+file);
@@ -350,12 +349,26 @@ void PmIpkg::install()
350{ 349{
351 if ( to_install.count() == 0 ) return; 350 if ( to_install.count() == 0 ) return;
352 out(tr("Installing")+"\n"+tr("please wait")+"\n"); 351 out(tr("Installing")+"\n"+tr("please wait")+"\n");
353 for (uint i=0; i < to_install.count(); i++) 352 for (uint i=0; i < to_install.count(); i++)
354 { 353 {
355 qDebug("install loop %i of %i installing %s",i,to_install.count(),to_install.at(i)->installName().latin1()); //pvDebug 354 qDebug("install loop %i of %i installing %s",i,to_install.count(),to_install.at(i)->installName().latin1()); //pvDebug
355 if (to_install.at(i)->link())
356 {
357 // hack to have package.list
358 // in "dest"/usr/lib/ipkg/info/
359 QString rds = settings->getDestinationUrlByName("root");
360 QString lds = settings->getDestinationUrlByName(to_install.at(i)->dest());
361 QString listFile = "usr/lib/ipkg/lists/"+to_install.at(i)->name()+".list";
362 rds += listFile;
363 lds += listFile;
364 const char *rd = rds.latin1();
365 const char *ld = lds.latin1();
366 pvDebug(4, "linking: "+rds+" -> "+lds );
367 symlink( rd, ld );
368 }
356 if ( runIpkg("install " + to_install.at(i)->installName(), to_install.at(i)->dest() )) 369 if ( runIpkg("install " + to_install.at(i)->installName(), to_install.at(i)->dest() ))
357 { 370 {
358 runwindow->progress->setProgress( to_install.at(i)->size().toInt() + runwindow->progress->progress()); 371 runwindow->progress->setProgress( to_install.at(i)->size().toInt() + runwindow->progress->progress());
359 to_install.at(i)->processed(); 372 to_install.at(i)->processed();
360 linkOpp = createLink; 373 linkOpp = createLink;
361 if ( to_install.at(i)->link() ) 374 if ( to_install.at(i)->link() )